On Tue, Oct 04, 2016 at 03:42:52PM -0300, Daniel. wrote: > Because the libc is calling it again based on what has been passed as > argument and what was received as return value. Here is one example > https://gist.github.com/gkos/5479135. I don't really know if this code is > working since I made it a long time ago. Your test to check wether the device is already open looks weak to me. You should rather use atomic operations such as described in [1] or mutex like in [2]. [1] http://www.oreilly.com/openbook/linuxdrive3/book/ch06.pdf p 40 [2] http://pete.akeo.ie/2011/08/writing-linux-device-driver-for-kernels.html -- François _______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies