> Hi Friends,
> How to lock a serial Port ? I have used the following procedure
> to lock a serial port.
> 1. set group-execute bit off
> 2. group-ID bit on
> This reflectes a Mandatory locking. Then I am using
> fcntl function with appropricate parameters to lock the port
>> But the problem is , even after this procedure I am not able
> to give an exclusive access to Serial Port. Utilities like
> minicom 'open, write and read' the Serial port which is locked.
>> If once a port is opened and locked, then all successive
> opens to that port must fail, until the port is close/unlocked.
>>> How can I do it ?
Serial port locking is implemented by a lockfile convention.
For example, /var/lock/uucp/LCK..ttyS0 is a lock file for
ttyS0. (Or maybe it's /var/lock/LCK..ttyS0).
When I was writing my portserver app, I stole the locking
code from pppd. I'd suggest that you look at the pppd
sources or at
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!