Re: How to make /dev/ttyACM0 (and friends) exclusive?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 04 Mar 2019 16:38:44 +0100, Yann Droneaud said:

> O_EXCL is intended to be used to prevent opening an existing file. Said
> differently, it's used to ensure a new file is created, useful to
> prevent race condition, where multiple processes compete to create a
> file. For example think of temporary file created with random name.

Which means that if you're trying to regulate exclusive use of a character
device or similar, you use O_EXCL|O_CREAT to create a lock file, and make sure
that all the programs competing for the character device use the same pathname
to create the lock file - which has been a tried-and-true way of handling
exclusive locking for serial ports for 4 decades now.

The fact that 'strings /usr/sbin/ModemManager | grep /' proves pretty clearly
that ModemManager is trusting DBus to keep track of things rather than using
lock files on the modems is almost certainly part of the reason it's a steaming
pile of dingo's kidneys rather than a helpful piece of software.

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]

  Powered by Linux