Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ maillock(3X) — Reliant UNIX 5.44c4

Media Vault

Software Library

Restoration Projects

Artifacts Sought

maillock(3X)                                                   maillock(3X)

NAME
     maillock, mailunlock - manage lockfile for user's mailbox

SYNOPSIS
     cc [flag ...] file ... -lmail

     #include <maillock.h>

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

     int mailunlock(void);

DESCRIPTION
     The maillock() function attempts to create a lockfile for the user's
     mailfile. If a lockfile already exists, maillock() assumes the con-
     tents 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 memory
     location provided, as defined in maillock.h.

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

     #define    LSUCCESS      0    /* Lockfile created or removed */
     #define    LNAMELEN      1    /* Recipient name > 13 chars */
     #define    LTMPLOCK      2    /* Can't create tmp file */
     #define    LTMPWRITE     3    /* Can't write pid into lockfile */
     #define    LMAXTRYS      4    /* Failed after retrycnt attempts */
     #define    LERROR        5    /* Check errno for reason */
     #define    LMANLOCK      6    /* Unable to set mandatory lock */

NOTES
     mailunlock() will only remove the lockfile created from the most pre-
     vious 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.










Page 1                       Reliant UNIX 5.44                Printed 11/98

maillock(3X)                                                   maillock(3X)

FILES
     LIBDIR/llib-mail.ln

     LIBDIR/libmail.a

     /var/mail/*

     /var/mail/*.lock














































Page 2                       Reliant UNIX 5.44                Printed 11/98

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