Re: [Exim] Locked mail spool file

Top Page
Delete this message
Reply to this message
Author: Trevor Sky Garside
Date:  
To: Phil Pennock, exim-users, pop-imap
Subject: Re: [Exim] Locked mail spool file
| > I'm just wondering how Exim handles encountering a flock'd file (or if
| > anyone has any good ideas here).

|
| Since you're writing a new POP3 server, I'd kind of assume that you know
| C. [1]

|
| So surely the best way of checking is to go read the Exim source code?
| You're asking about appendfile, so look at the source for appendfile.


Yes, I *know* C, but I don't consider myself to be a good C programmer. I
did poke around in the Exim source to see, but I had a feeling there might
be some options regarding this.

| Then, and I'm telling you this because I'm nice really, have a think -
| are fcntl and flock implemented the same way on your system? If not, is
| anything likely to be using flock()? And if they are different, does
| flock affect a non-blocking open? Which type of open does Exim use?


Considering all of this, I decided to toss the idea of trying to access a
Unix style single-file mailbox, and instead use the directory-per-user
format of mailspool. A bit of creative file checking, and no flock'ing
needed. Since this box is 100% virtual (no user logins except for the
administrators), I will just make sure that the few programs/daeomons who
would ever be deleting a particular mail message all employ a common
'locking' procedure. It's working out great for me so far, and the
performance is amazingly better than with the old-style mailboxes.

| [1] You _could_ write a POP3 server in Perl, and if it's started from
|     inetd with 'wait' and handles multiple users internally, the startup
|     overhead would be limited and perhaps feasible.  I'd still expect
|     you to know C though, on principle.  ;^P


My actual plan is to implement it as its own daemon, this way the Perl
program is parsed once, and merely forks itself on an incoming connection.
From what I can tell, I can get the same performance from Perl this way as I
would with a regular C program running from inetd.

Alas, this is getting off-topic for the Exim list. I'll move future
messages about this over to the pop-imap list. Please keep responses from
the Exim list, unless they are indeed Exim related.

Trevor Sky Garside
trevor@???