Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ maillock(3X) — SunOS 5.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

maillock(3X)

NAME

maillock − manage lockfile for user’s mailbox

SYNOPSIS

cc [ flag ... ] file ... −lmail [ library ... ]

#include <maillock.h>

int maillock(const char ∗user, int retrycnt);

int mailunlock(void);

DESCRIPTION

maillock − manage lockfile for user’s mailbox The maillock() function attempts to create a lockfile for the user’s mailfile.  If a lockfile already exists, maillock() assumes the contents of the file is the process ID (as a null-terminated ASCII string) of the process that created the lockfile (presumably with a call to maillock()).  If the process that created the lockfile is still alive, maillock() will sleep and try again retrycnt times before returning with an error indication.  The sleep algorithm is to sleep for 5 seconds times the attempt number.  That is, the first sleep will be for 5 seconds, the next sleep will be for 10 seconds, etc. until the number of attempts reaches retrycnt.  When the lockfile is no longer needed, it should be removed by calling mailunlock(). 

user is the login name of the user for whose mailbox the lockfile will be created.  maillock() assumes that users’ mailfiles are in the “standard” place as defined in <maillock.h>. 

RETURN VALUES

The following return code definitions are contained in <maillock.h>. 

#defineL_SUCCESS0/∗ Lockfile created or removed ∗/
#defineL_NAMELEN1/∗ Recipient name > 13 chars ∗/
#defineL_TMPLOCK2/∗ Can’t create tmp file ∗/
#defineL_TMPWRITE3/∗ Can’t write pid into lockfile ∗/
#defineL_MAXTRYS4/∗ Failed after retrycnt attempts ∗/
#defineL_ERROR5/∗ Check errno for reason ∗/

FILES

LIBDIR/llib-mail.ln
LIBDIR/mail.a
/var/mail/∗
/var/mail/∗.lock

NOTES

mailunlock() will only remove the lockfile created from the most previous call to maillock().  Calling maillock() for different users without intervening calls to mailunlock() will cause the initially created lockfile(s) to remain, potentially blocking subsequent message delivery until the current process finally terminates. 

SunOS 5.1  —  Last change: 3 Jul 1990

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026