Subject: Re: /var/run vs /var/spool/locks
To: Wenchi Liao <wliao@midway.uchicago.edu>
From: Robert Elz <kre@munnari.OZ.AU>
List: netbsd-help
Date: 02/05/2000 06:43:54
    Date:        Fri, 04 Feb 2000 11:51:17 -0600
    From:        Wenchi Liao <wliao@midway.uchicago.edu>
    Message-ID:  <200002041751.LAA25132@harper.uchicago.edu>

  | Anyways, there is /var/run where pid files are kept.

Yes.

  | Historically, aren't pid files supposed to go into
  | /var/spool/lock?

No.   As the name suggests, that contains lock files.  Lock files
often contain the pid of the owning process, that's so it can be
found if needed, but finding a process isn't the purpose.

  | What goes in one, and what goes in the other?

/var/run contains the pid of running daemons in files named after
the name of the daemon.  /var/spool/locks contains lock files, in
files named after the object being locked.

Eg a daemon that opened a modem might have /var/run/daemon containing
its PID, and then when it wants to use the modem, would create
/var/spool/locks/modem (and probably put its pid in their as well).

Then if you want to find the daemon, you look in /var/run/daemon
or if you want to find whether the modem is locked, and if so, who
has it locked, you look in /var/spool/locks/modem.

All the specific examples in this mail are invented, don't expect
anything to correspond to this...

kre