|
|
1.1 root 1: '\"! tbl | mmdoc
2: '\"macro stdmacro
3: .if n .pH g3x.maillock %W% of %G%
4: '\" t
5: .nr X
6: .if \nX=0 .ds x} maillock 3X "" "\&"
7: .if \nX=1 .ds x} maillock 3X ""
8: .if \nX=2 .ds x} maillock 3X "" "\&"
9: .if \nX=3 .ds x} maillock "" "" "\&"
10: .TH \*(x}
11: .SH NAME
12: \f4maillock\f1 \- manage lockfile for user's mailbox
13: .SH SYNOPSIS
14: \f4cc [flag...] file ... \-lmail\f1
15: .P
16: \f4#include <maillock.h>\f1
17: .P
18: \f4int maillock (char *user, int retrycnt);\f1
19: .P
20: \f4int mailunlock();\f1
21: .SH DESCRIPTION
22: The \f4maillock\f1 function attempts to create a lockfile for the
23: user's mailfile.
24: If a lockfile already exists, \f4maillock\f1 assumes the
25: contents of the file is the process
26: .SM ID
27: (as a null-terminated
28: .SM ASCII
29: string)
30: of the process that created the
31: lockfile (presumably with a call to \f4maillock\f1).
32: If the process that created the lockfile is still alive,
33: \f4maillock\f1 will sleep and try
34: again \f2retrycnt\f1 times before returning with an error indication.
35: The sleep algorithm is to sleep for 5 seconds times the attempt number.
36: That is, the first sleep will be for 5 seconds, the next sleep will be for
37: 10 seconds, etc. until the number of attempts reaches \f2retrycnt\f1.
38: When the lockfile is no longer needed, it should be removed
39: by calling \f4mailunlock\f1.
40: .PP
41: .I user
42: is the login name of the user for whose mailbox the lockfile will be created.
43: \f4maillock\f1 assumes that users' mailfiles are in the ``standard''
44: place as defined in \f4<maillock.h>\f1.
45: .SH RETURN VALUE
46: The following return code definitions are contained in \f4<maillock.h>\f1.
47: .P
48: .TS
49: center ;
50: lf4 lf4 lf4 lf4.
51: #define L_SUCCESS 0 /\(** Lockfile created or removed \(**/
52: #define L_NAMELEN 1 /\(** Recipient name > 13 chars \(**/
53: #define L_TMPLOCK 2 /\(** Can't create tmp file \(**/
54: #define L_TMPWRITE 3 /\(** Can't write pid into lockfile \(**/
55: #define L_MAXTRYS 4 /\(** Failed after retrycnt attempts \(**/
56: #define L_ERROR 5 /\(** Check errno for reason \(**/
57: .TE
58: .SH FILES
59: .nf
60: .ft 4
61: /usr/lib/llib-mail.ln
62: /usr/lib/libmail.a
63: /var/mail/\(**
64: /var/mail/\(**.lock
65: .ft 1
66: .fi
67: .SH NOTES
68: \f4mailunlock\f1 will only remove the lockfile created from the most
69: previous call to \f4maillock\f1.
70: Calling \f4maillock\f1 for different users
71: without intervening calls to \f4mailunlock\f1 will cause the initially
72: created lockfile(s) to remain, potentially blocking subsequent message
73: delivery until the current process finally terminates.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.