Re: Question on liblockfile (Re: policy Q's WRT imapd)
"A. P. Harris" <apharris@onshore.com> writes:
> Yes, but is liblockfile relevant to MTAs and MUAs or also to any program
> that needs to lock a file? I'm having doubts about whether I can use it
> locking shared data files in addressbook package, since it seems to
> geared towards stuff from /var/spool/mail. After all, the only
> documented function in that library is maillock(3).
>
> So does anyone know if it's safe/kosher/policy-compliant to use
> maillock() for non-mail locking?
Well, maillock() is only for locking mail, but there is an
alternative, and it's in publib-dev. From the maillock manpage:
NOTES
These functions are not thread safe. If you need thread
safe functions, or you need to lock other mailbox (alike)
files that are not in the standard lockation, use lock?
file_create(3) instead.
SEE ALSO
lockfile_create(3), lockfile_touch (3), lockfile_remove(3)
(I wonder if that next to last line in the NOTES is a pun or a
typo...)
Unfortunately, there's no manpage for these, but they look pretty
straightforward from the prototypes. From
/usr/include/publib/lockfile.h (which is included from
/usr/include/publib.h):
int lockfile_create(const char *);
int lockfile_remove(const char *);
Hope this helps.
--
Rob Browning <rlb@cs.utexas.edu>
PGP fingerprint = E8 0E 0D 04 F5 21 A0 94 53 2B 97 F5 D6 4E 39 30
Reply to: