In case of "bug" in port driver using locking is not acceptable.
+1
A:
So you need to lock out other processes from opening a device file, but file locking is unacceptable...
Well, you could rename the device file to something non-standard, so everything that tries to open /dev/ttyS0 won't step on your toes.
Peter Cordes
2009-12-08 19:26:29
*THANKS*. It's interested idea.
vitaly.v.ch
2009-12-09 09:42:51
+1
A:
Assuming you are guarding against mistaken opens by "foreign" binaries: in your driver's open() method, match the name of the opening binary (current->comm). And allow opens only for your binary.
This can, of course be easily circumvented (by renaming a foreign binary.)
terminus
2010-01-18 12:35:31
A:
Or you can change the properties of the corresponding dev file, only granting access to a custom group you are a member of. If you want the serial port to be accessible to any user, this might not work.
shodanex
2010-01-18 16:36:37