]> diplodocus.org Git - nmh/commitdiff
Added lockmethod pseudocomponent to mhparam so that users
authorDavid Levine <levinedl@acm.org>
Wed, 6 Mar 2013 02:17:08 +0000 (20:17 -0600)
committerDavid Levine <levinedl@acm.org>
Wed, 6 Mar 2013 02:17:08 +0000 (20:17 -0600)
can easily find out what locking method was configured in.

man/mh-folders.man
man/mhparam.man
uip/mhparam.c

index 06296bcf32ec2a7d0e00d452b629599cbf164756..59de18dab6cbad618b01ac8e294f859af52d1ae6 100644 (file)
@@ -1,4 +1,4 @@
-.TH MH-MAIL %manext5% "March 3, 2013" "%nmhversion%"
+.TH MH-MAIL %manext5% "March 5, 2013" "%nmhversion%"
 .\"
 .\" %nmhwarning%
 .\"
@@ -15,7 +15,6 @@ A
 .B nmh
 folder corresponds to directory.  There are no limits on folder
 names beyond those of the host filesystem.
-.I Is that right?
 .RE
 .PP
 .B one message per file
@@ -31,7 +30,7 @@ the existence of non\-message files that are not prefixed with a \*(lq.\*(rq.
 .PP
 The filename for a new
 message is one greater than the highest numbered message in
-the folder; its full path can be accessed by the pseudo\-sequence 
+the folder; its full path can be accessed by the pseudo\-sequence
 .I new
 (e.g.,
 .B mhpath
@@ -120,12 +119,13 @@ these files when accessing them.  Any program outside of
 that accesses these files must be sure to lock them using the same
 locking method.  The locking method is selected when
 .B nmh
-is configured.  By default, kernel-level locking is used if
-appropriate for the platform, and it is for popular platforms.  That
-default should also be the same as used by the
+is configured and can be accessed as a string using
+.BR "mhparam lockmethod" .
+By default, kernel-level locking is used if appropriate for the
+platform, and it is for popular platforms.  That default should also
+be the same as used by the
 .B mail
 program, if provided on the platform.
-.I Should we add a lockmethod component to mhparam so users can easily detect it?
 .SH FILES
 .fc ^ ~
 .nf
@@ -137,6 +137,7 @@ program, if provided on the platform.
 .SH "SEE ALSO"
 .I
 .IR mail (1),
+.IR mh\-param (1),
 .IR mh\-path (1),
 .IR mh\-profile (5),
 .IR mh\-sequence (5)
index cc614ef0a27814b9004e55eb489a4fe7497ff17b..6f51ffd9e8cd55fef46eebf8edaaa0c734d93e6b 100644 (file)
@@ -50,9 +50,11 @@ the locations of the nmh
 .I etcdir
 and
 .I libdir
-install directories and all
+install directories, all
 .I proc
-settings.  The
+settings, and the locking method with which the
+.B nmh
+installation was configured.  The
 .B \-debug
 switch displays all such other information available from
 .BR mhparam .
@@ -88,6 +90,9 @@ context: context
 
 % mhparam libdir
 %libdir%
+
+% mhparam lockmethod
+fcntl
 .fi
 .RE
 .PP
index c4b0af2efbb2091d4c945515f8421b48e01e1807..414255bab30208044639586c9e873da1c208969e 100644 (file)
 
 #include <h/mh.h>
 
-extern char *mhlibdir;
-extern char *mhetcdir;
-
-char *sbackup = BACKUP_PREFIX;
-
 #define MHPARAM_SWITCHES \
     X("components", 0, COMPSW) \
     X("nocomponents", 0, NCOMPSW) \
@@ -33,6 +28,25 @@ DEFINE_SWITCH_ENUM(MHPARAM);
 DEFINE_SWITCH_ARRAY(MHPARAM, switches);
 #undef X
 
+extern char *mhlibdir;
+extern char *mhetcdir;
+
+char *sbackup = BACKUP_PREFIX;
+
+char *lockmethod =
+#if defined FCNTL_LOCKING
+    "fcntl"
+#elif defined FLOCK_LOCKING
+    "flock"
+#elif defined LOCKF_LOCKING
+    "lockf"
+#elif defined DOT_LOCKING
+    "dot"
+#else
+    "none"
+#endif
+    ;
+
 struct proc {
     char *p_name;
     char **p_field;
@@ -65,6 +79,7 @@ static struct proc procs [] = {
      { "etcdir",        &mhetcdir },
      { "libdir",        &mhlibdir },
      { "sbackup",       &sbackup },
+     { "lockmethod",    &lockmethod },
      { NULL,            NULL },
 };