Can I 开发者_JAVA技巧see PID who uses COM1 in Debian from start os and if can how ? Is there any log file for this ?
The simple way is to simply:
$ fuser /dev/ttyS0
Note that this will only show processes from your own user, unless you're root.
The kernel does not directly log when processes open the serial port. There are a number of options if you need to log:
- Periodically log the output of
fuser /dev/ttyS0
orlsof /dev/ttyS0
. - Restrict access to
/dev/ttyS0
to a special-purpose user, and usesudo
or some other gateway program to gain access to it. This will leave logs when the gateway program is invoked.
精彩评论