bug-mailutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-mailutils] Mailbox locking (especially over NFS) questions


From: Sergey Poznyakoff
Subject: Re: [bug-mailutils] Mailbox locking (especially over NFS) questions
Date: Tue, 05 Jul 2005 14:17:14 +0300

Kostas Zorbadelos <address@hidden> wrote:

> I would like to use a combination of mechanisms (dot lock file
> combined with fnctl). Is this possible?

Yes, though it will require some extra work. Only one locker object is
associated with a mailbox, so you will have to operate the second locker
manually. For instance (a simplified example, no error checking):

mailbox_t mbox;
locker_t lock1, lock2;

/* Get mailbox locker and force it to use kernel locking */
mailbox_get_locker (mbox, &lock1);
locker_set_flags (lock1, MU_LOCKER_KERNEL|MU_LOCKER_RETRY);

/* Lock it */
locker_lock (lock1);

/* Create an alternative dotlock locker */
locker_create (&lock2, mailbox_filename, MU_LOCKER_RETRY);
/* Lock it as well */
locker_lock (lock2);

...Access the mailbox now...

/* Unlock and destroy the alternative locker */
locker_unlock (lock2);
locker_destroy (&lock2);

/* Unlock main locker (do not destroy it!) */
locker_unlock (lock1);

> From what I understand you are referring to your own framework for
> parsing arguments in programs, using configuration files with option
> groups. Is this correct?

Yes, quite correct.

> From what I have seen in the mail.local source you use something like
> ...
>    /* Default locker settings */
>   locker_set_default_flags (MU_LOCKER_PID|MU_LOCKER_RETRY,
>                           mu_locker_set_flags);
> 
> What are the valid flags?

You will find them in include/mailutils/locker.h, lines 50--78. Each
flag is documented in a comment. Additional flags are listed in lines 29--33.

> What is this mu_locker_set_flags?

locker_set_default_flags() takes two arguments: first argument gives the
desired flag bits, second argument specifies what to do with them. Three
values are allowed:

mu_locker_set_flags     Set the locker flags to the given bits
mu_locker_set_bit       Set the given bits in the flags, preserving any
                        other bits that may have been set.
mu_locker_clear_bit     Clear the given bits from the flags.

(See include/mailutils/locker.h:41)                     

> I do not understand exactly how to use your framework for argument
> parsing, so I am in favour of using getopt(1) for my options.
> If you however have the time I would like to know more about your
> framework

Sure, I will send you the description in a separate message.

Regards,
Sergey




reply via email to

[Prev in Thread] Current Thread [Next in Thread]