[Mailman-developers] Re: anyone got mailman running on freebsd ?

Andrew Kuchling akuchlin@cnri.reston.va.us
Tue, 5 May 1998 14:31:18 -0400 (EDT)

Ken Manheimer writes:
>Clearly we need some fairly portable solution, and it probably makes
>sense to tackle this now.  Barry has an article by jamie zawinski
>pointing out the pitfalls of locking, with a conclusion (i gather)
>that use of a directory (with a leading '.' dot in its name) is the
>best portable answer.  I'd be interested to hear whether anyone has a
>fairly clear-win solution - one that's simple and portable - and/or
>whether just switching over to fcntl.lockf() is the right thing.
>Maybe andrew's discussions (in that thread) about revision of the
>posixfile interfaces should play in here...

	The person sent me the relevant header file; the flock
structure is:

struct flock {
	off_t	l_start;	/* starting offset */
	off_t	l_len;		/* len = 0 means until end of file */
	pid_t	l_pid;		/* lock owner */
	short	l_type;		/* lock type: read/write, etc. */
	short	l_whence;	/* type of l_start */

I don't have a FreeBSD machine to fiddle with, so I can't really help
suggest a fix.  The struct format in posixfile.py is:
        if sys.platform in ('netbsd1', 'freebsd2', 'freebsd3'):
            flock = struct.pack('lxxxxlxxxxlhh', \
                  l_start, l_len, os.getpid(), l_type, l_whence) 

Perhaps the xxxx padding is unnecessary or something, but a FreeBSD
person will have to look into it.

For Python, probably the best solution is to change posixfile.py to
use lockf(), and possibly change the interface in other ways.  Best to
discuss this on the main list.

A.M. Kuchling			http://starship.skyport.net/crew/amk/
But I'm getting too old for the trick, which troubles me, for the sea is in my
blood like a fever and I don't know how I can leave.
    -- Jim's envoi, in SANDMAN #53: "Hob's Leviathan"