mutt stable branch with some hacks
at jcs 164 lines 4.2 kB view raw
1.\" Project : tin 2.\" Module : mmdf.5 3.\" Author : U. Janssen 4.\" Created : 2002-02-18 5.\" Updated : 6.\" Notes : needs a lot of work 7.\" 8.TH mmdf 5 "February 18th, 2002" "Unix" "User Manuals" 9.\" 10.SH NAME 11MMDF \- Multi\-channel Memorandum Distribution Facility mailbox format 12.\" 13.SH DESCRIPTION 14This document describes the 15.B MMDF 16mailbox format used by some MTAs and MUAs (i.e. 17.BR scomail (1)) 18to store mail messages locally. 19.PP 20An 21.B MMDF 22mailbox is a text file containing an arbitrary number of e-mail messages. 23Each message consists of a postmark, followed by an e-mail message formatted 24according to \fBRFC822\fP / \fBRFC2822\fP, followed by a postmark. The file 25format is line-oriented. Lines are separated by line feed characters (ASCII 2610). A postmark line consists of the four characters "^A^A^A^A" (Control-A; 27ASCII 1). 28.TP 29Example of a \fBMMDF\fP mailbox holding two mails: 30.RS 31.nf 32.sp 33^A^A^A^A 34.br 35From: example@example.com 36.br 37To: example@example.org 38.br 39Subject: test 40.br 41.sp 42.br 43>From what I learned about the MMDF-format: 44.br 45.br 46^A^A^A^A 47.br 48^A^A^A^A 49.br 50From: example@example.com 51.br 52To: example@example.org 53.br 54Subject: test 2 55.br 56.sp 57.br 58bar 59.br 60^A^A^A^A 61.fi 62.RE 63.PP 64In contrast to most other single file mailbox formats like 65MBOXO and MBOXRD (see 66.BR mbox (5)) 67there is no need to quote/dequote "From "\-lines in 68.B MMDF 69mailboxes as such lines have no special meaning in this format. 70.PP 71If the modification-time (usually determined via 72.BR stat (2)) 73of a nonempty mailbox file is greater than the access-time 74the file has new mail. Many MUAs place a Status: header in 75each message to indicate which messages have already been 76read. 77.\" 78.SH LOCKING 79Since 80.B MMDF 81files are frequently accessed by multiple programs in parallel, 82.B MMDF 83files should generally not be accessed without locking. 84.PP 85Three different locking mechanisms (and combinations thereof) are in 86general use: 87.IP "\(bu" 88.BR fcntl (2) 89locking is mostly used on recent, POSIX-compliant systems. Use of 90this locking method is, in particular, advisable if 91.B MMDF 92files are accessed through the Network File System (NFS), since it 93seems the only way to reliably invalidate NFS clients' caches. 94.IP "\(bu" 95.BR flock (2) 96locking is mostly used on BSD-based systems. 97.IP "\(bu" 98Dotlocking is used on all kinds of systems. In order to lock an 99.B MMDF 100file named \fIfolder\fR, an application first creates a temporary file 101with a unique name in the directory in which the 102\fIfolder\fR resides. The application then tries to use the 103.BR link (2) 104system call to create a hard link named \fIfolder.lock\fR 105to the temporary file. The success of the 106.BR link (2) 107system call should be additionally verified using 108.BR stat (2) 109calls. If the link has succeeded, the mail folder is considered 110dotlocked. The temporary file can then safely be unlinked. 111.IP "" 112In order to release the lock, an application just unlinks the 113\fIfolder.lock\fR file. 114.PP 115If multiple methods are combined, implementors should make sure to 116use the non-blocking variants of the 117.BR fcntl (2) 118and 119.BR flock (2) 120system calls in order to avoid deadlocks. 121.PP 122If multiple methods are combined, an 123.B MMDF 124file must not be considered to have been successfully locked before 125all individual locks were obtained. When one of the individual 126locking methods fails, an application should release all locks it 127acquired successfully, and restart the entire locking procedure from 128the beginning, after a suitable delay. 129.PP 130The locking mechanism used on a particular system is a matter of 131local policy, and should be consistently used by all applications 132installed on the system which access 133.B MMDF 134files. Failure to do so may result in loss of e-mail data, and in 135corrupted 136.B MMDF 137files. 138.\" 139.\" .SH FILES 140.\" /usr/spool/mmdf/lock/home 141.\" $HOME/Mail/ 142.\" 143.\" .SH SECURITY 144.\" 145.SH "CONFORMING TO" 146.B MMDF 147is not part of any currently supported standard. 148.\" 149.SH HISTORY 150.B MMDF 151was developed at the University of Delaware by Dave Crocker. 152.\" 153.SH "SEE ALSO" 154.BR scomail (1), 155.BR fcntl (2), 156.BR flock (2), 157.BR link (2), 158.BR stat (2), 159.BR mbox (5), 160.BR RFC822 , 161.BR RFC2822 162 163.SH AUTHOR 164Urs Janssen <urs@tin.org>