Re: Idea: a way to use /dev/modem symlinks safely
On Wed, Apr 07, 1999 at 12:26:52PM -0400, Avery Pennarun wrote:
> Hi all,
> I've recently run into several people who are still using /dev/modem as a
> symlink to one of the /dev/ttySx devices, to make it easier to remember
> which one is their modem (and to make it easier to change that later, if
> I think there are advantages to using /dev/modem, however, there is a big
> disadvantage that we already know about: if some programs use /dev/modem and
> others use /dev/ttySx, their lock files have different names and locking
> doesn't work correctly. This means that mgetty conflicts with minicom,
> diald conflicts with efax, etc.
> Here's my thought: rather than creating a lockfile for the filename of the
> requested device (eg. /dev/modem --> /var/lock/LCK..modem) we can create a
> lockfile for the target of the symlink (eg. /dev/modem --> /dev/ttyS2 -->
> /var/lock/LCK.ttyS2). That way, programs using /dev/modem and programs
> using /dev/ttyS2 will both use the same lock file, automatically.
I'm not sure if there is a 'right' way to do this, but I always used to have
mgetty(-voice) running on /dev/ttySx and pppd (via pon) running on
/dev/modem, so that I could still connect to the Internet without
disabling/stopping mgetty first.
It was my opinion that lockfiles should be used as a pointer for
communication, rather than just a brick wall... ie, pppd would notice that
there was a lockfile, read the pid from the file, and communicate (via
signals or IPC, perhaps) to the program already using the device that it
should be freed if possible... the program would free the device if not in
use, and cede control to pppd, or report back to pppd that the device was,
indeed, in use.
Hope that makes sense. I also hope on both sides that this is/is not already
implemented - perhaps I just missed a configuration option.
"IBM don't make nonstandard things. People just cloned them wrong."
-- Tim Foster