The mention of posixfile, fcntl and BSD made me remember something. There's some very non-portable code that constructs the fcntl call. The CVS archives have a version of posixfile.py that is newer than that in the Python 1.5.2b2 release, and the CVS log comment says:
| According to Jeffrey Honig, bsd/os 2.0 - 4.0 should be added to the | list (of bsd variants that have a different lock structure).
Here's the patch:
Index: posixfile.py
RCS file: /projects/cvsroot/python/dist/src/Lib/posixfile.py,v retrieving revision 1.10 retrieving revision 1.11 diff -c -r1.10 -r1.11 *** posixfile.py 1998/03/26 21:12:38 1.10 --- posixfile.py 1999/02/23 04:14:32 1.11
*** 177,183 ****
# Hack by davem@magnet.com to get locking to go on freebsd;
# additions for AIX by Vladimir.Marangozov@imag.fr
import sys, os
! if sys.platform in ('netbsd1', 'freebsd2', 'freebsd3'):
flock = struct.pack('lxxxxlxxxxlhh',
l_start, l_len, os.getpid(), l_type, l_whence)
elif sys.platform in ['aix3', 'aix4']:
--- 177,185 ----
# Hack by davem@magnet.com to get locking to go on freebsd;
# additions for AIX by Vladimir.Marangozov@imag.fr
import sys, os
! if sys.platform in ('netbsd1',
! 'freebsd2', 'freebsd3',
! 'bsdos2', 'bsdos3', 'bsdos4'):
flock = struct.pack('lxxxxlxxxxlhh',
l_start, l_len, os.getpid(), l_type, l_whence)
elif sys.platform in ['aix3', 'aix4']:
*** 190,196 **** flock = fcntl.fcntl(self._file_.fileno(), cmd, flock)
if '?' in how:
! if sys.platform in ('netbsd1', 'freebsd2', 'freebsd3'):
l_start, l_len, l_pid, l_type, l_whence =
struct.unpack('lxxxxlxxxxlhh', flock)
elif sys.platform in ['aix3', 'aix4']:
--- 192,200 ----
flock = fcntl.fcntl(self._file_.fileno(), cmd, flock)
if '?' in how:
! if sys.platform in ('netbsd1',
! 'freebsd2', 'freebsd3',
! 'bsdos2', 'bsdos3', 'bsdos4'):
l_start, l_len, l_pid, l_type, l_whence =
struct.unpack('lxxxxlxxxxlhh', flock)
elif sys.platform in ['aix3', 'aix4']:
--Guido van Rossum (home page: http://www.python.org/~guido/)