Hal V. Engel wrote:
This may work for some situations but it is far from fool proof. One example. I have a time keeping serial GPS connected to my system (Motorola Oncore UT+) that is used by ntp for precise time keeping (< +- 1 microsecond after it has stabilized). Nothing related to this including the kernel module that creates the interrupt from the one second pulse that marks the epoch or ntp creates a lock of any kind. Messing with this serial port could cause a time keeping failure on systems like mine. This type of set up is not common since Pulse Per Second (PPS) support was only added to the linux kernel recently (2.6.32 - FreeBSD has had this for several years now and is the reference implementation) but I suspect that PPS support is only one example of systems that do not create locks when using a serial port.
Hi Hal, this is an unfortunate example. I notice that the setserial program gets more information about the serial ports by opening them O_NONBLOCK and then doing an ioctl TIOCGSERIAL. So it would seem that anyone doing a "setserial -g /dev/ttyS*" will upset your device. I notice that similar information is in /proc/tty/driver/serial, but the software would need elevated privileges to read this file. In contrast, attempting to open the devices ends up listing devices that could be opened with the current credentials. Graeme Gill.