vgetty file locking

Gert Doering (gert@greenie.muc.de)
Mon, 6 Apr 1998 23:10:18 +0200


Hi,

Francesco L. wrote:
> > IFF both programs use /dev/modem AND both programs write their lock file
> > into /var/lock/LCK..*, they should properly interact.
> > 
> > If you have compiled mgetty/vgetty to use /usr/spool/uucp/LCK..* or
> > wherever, they will collide.  Look into the debug log file to see what 
> > file vgetty uses.
> 
> Here are the contents of /var/log/vgetty.modem:
> 
> 04/06 09:42:08 dem  check for lockfiles
> 04/06 09:42:08 dem   checklock: stat failed, no file
> 04/06 09:42:08 dem  locking the line
> 04/06 09:42:08 dem   makelock(modem) called
> 04/06 09:42:08 dem   do_makelock: lock='/var/lock/LCK..modem'
>                                         ^^^^^^^^^^^^^^^^^^^^^
> 04/06 09:42:08 dem   lock made

Ok.  This is what vgetty uses.  Now look whether that's what pppd creates...

> 04/06 09:42:11 dem   waiting for line to clear (VTIME), read:
> 04/06 09:42:12 dem   removing lock file
>                      ^^^^^^^^^^^^^^^^^^
> 04/06 09:42:12 dem  waiting...

... now we wait for a call.  We MUST NOT lock the device while it's not in
use, otherwise pppd won't be able to lock it for its own.

The next 5 lines are the only ones that are interesting. The rest is
pretty normal (as you can easily see yourself if you bother to look
into the examples in the manual).

> So vgetty creates the lockfile, but it is being deleted in a few 
> seconds. Is this method right?

Sure.

> I've also manually created /var/lock/LCK..modem then fired up vgetty 
> but It seems that vgetty doesn't care about it..

The content must be a proper process ID for your system, in "%10d\n"
format (that is, 10 digits, space-padded, right justified, with a trailing
newline).

Show what happens when pppd starts!  Not what happens if everything is
fine!

Use your brains!

gert

-- 
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             gert@greenie.muc.de
fax: +49-89-35655025                        gert.doering@physik.tu-muenchen.de