[Top][All Lists]

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

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

From: Kostas Zorbadelos
Subject: Re: [bug-mailutils] Mailbox locking (especially over NFS) questions
Date: Tue, 5 Jul 2005 13:38:48 +0300
User-agent: Mutt/1.5.9i

On Tue, Jul 05, 2005 at 12:51:21PM +0300, Sergey Poznyakoff wrote:
> Kostas Zorbadelos <address@hidden> wrote:
> It can use a variety of mechanisms:
> * Dotlock-compatible locking (default)
> * Kernel locking via fcntl
> * Locking via an external program

I would like to use a combination of mechanisms (dot lock file
combined with fnctl). Is this possible? Please answer only this one if
you don't have much time.
I have such a need because the mailboxes are being accessed via a lot
of applications (my delivery agent, pop server, imap server) and each
uses its own method for locking.
> The actual mechanism to be used by any instance of locker is specified
> by locker_set_default_flags(). The actual mechanism to be used by a
> particular instance of locker can be specified by 3rd argument to
> locker_create. 

That's fine.
> From the user's point of view, it is selected using --locker-.* options
> ("mailbox" argp capability).

>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?
>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,

What are the valid flags? What is this mu_locker_set_flags?

  locker_set_default_retry_timeout (1);
  locker_set_default_retry_count (300);

  /* Default error code for command line errors */
  mu_argp_error_code = EX_CONFIG;
  /* Register needed modules */
  mu_argp_init (program_version, NULL);
  sieve_argp_init ();
  /* Parse command line */
  mu_argp_parse (&argp, &argc, &argv, 0, argp_capa, &arg_index, NULL);

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 (usage of
mu_argp_error_code,mu_argp_init,mu_argp_parse). Are they somewhere

> > Can I have an example of code that properly locks an NFS mailbox?
> From the developer's point of view, the way of locking does not depend
> on particular storage system (see, however, the comment below):
> char *mboxname;
> int status;
> mailbox_t mbox;
> locker_t lock;
> mailbox_get_locker (mbox, &lock);
> #if 0   
> /* This is optional. The best way for an application will be to
>    register "mailbox" argp capability and to let the user select the
>    preferred locker settings, providing the defaults by calling
>    locker_set_default_.*() functions before calling mu_argp_parse().

I guess you refer to your args parsing framework again...

>    If you still prefer the direct method, notice that dotlock is
>    considered the safest method for NFS. It is selected if none
>    of the following bits is set in lock_flags:

So, can I have MU_LOCKER_NULL|MU_LOCKER_KERNEL for dot lock and fcntl

> */    
> locker_set_flags (lock, lock_flags);
> locker_set_retries (lock, retries);
>  ..etc..
> #endif 
> status = locker_lock (lock);
> if (status)
>   {
>     mu_error("Cannot lock mailbox `%s': %s",
>              mboxname, mu_strerror (status));
>     exit (1);
>   }   
> /* ... Actually access the mailbox ... */
> locker_unlock (lock);        
> Regards,
> Sergey

Thanks Sergey.


  Kostas Zorbadelos
  Systems Designer/Developer, Otenet SA 
  address@hidden contact: kzorba (at) otenet.gr
  Out there in the darkness, out there in the night
  out there in the starlight, one soul burns brighter
  than a thousand suns.

reply via email to

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