Semaphore

Kosta Zertsekel zertsekel at gmail.com
Fri Feb 24 02:07:40 EST 2012


>> > Imagine a driver which only one app can use at a time (perhaps a serial
>> > port). The kernel will take a lock when the user space app open()s the
>> > device node and release it when it close()s.
>> > If the app segfaults in between the open() and close() the lock will
>> > still get released. The kernel always cleans up open files for stopped
>> > processes, regardless of how they stop. During this cleanup the kernel
>> > will close() the device node, and as a result the driver will release
>> > the lock.

Can you please point to some code in Linux Kernel that does the job?
Thanks,
--- KostaZ



More information about the Kernelnewbies mailing list