summaryrefslogtreecommitdiffstats
path: root/Lib/dos-8x3/posixfil.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1996-07-30 16:35:26 (GMT)
committerGuido van Rossum <guido@python.org>1996-07-30 16:35:26 (GMT)
commit3bb710d6473fdcf3fb13fcfbff8e3942494c2fc5 (patch)
tree4a34ea1941c878af2638186353ed2b0fb675929a /Lib/dos-8x3/posixfil.py
parentc8b4791d9e632cd0f05f1441ab2fe2749402f6f7 (diff)
downloadcpython-3bb710d6473fdcf3fb13fcfbff8e3942494c2fc5.zip
cpython-3bb710d6473fdcf3fb13fcfbff8e3942494c2fc5.tar.gz
cpython-3bb710d6473fdcf3fb13fcfbff8e3942494c2fc5.tar.bz2
updated again
Diffstat (limited to 'Lib/dos-8x3/posixfil.py')
-rwxr-xr-xLib/dos-8x3/posixfil.py19
1 files changed, 16 insertions, 3 deletions
diff --git a/Lib/dos-8x3/posixfil.py b/Lib/dos-8x3/posixfil.py
index 459cd52..64cda98 100755
--- a/Lib/dos-8x3/posixfil.py
+++ b/Lib/dos-8x3/posixfil.py
@@ -174,12 +174,25 @@ class _posixfile_:
elif len(args) > 3:
raise TypeError, 'too many arguments'
- flock = struct.pack('hhllhh', l_type, l_whence, l_start, l_len, 0, 0)
+ # Hack by davem@magnet.com to get locking to go on freebsd
+ import sys, os
+ if sys.platform == 'freebsd2':
+ flock = struct.pack('lxxxxlxxxxlhh', \
+ l_start, l_len, os.getpid(), l_type, l_whence)
+ else:
+ flock = struct.pack('hhllhh', \
+ l_type, l_whence, l_start, l_len, 0, 0)
+
flock = fcntl.fcntl(self._file_.fileno(), cmd, flock)
if '?' in how:
- l_type, l_whence, l_start, l_len, l_sysid, l_pid = \
- struct.unpack('hhllhh', flock)
+ if sys.platform == 'freebsd2':
+ l_start, l_len, l_pid, l_type, l_whence = \
+ struct.unpack('lxxxxlxxxxlhh', flock)
+ else:
+ l_type, l_whence, l_start, l_len, l_sysid, l_pid = \
+ struct.unpack('hhllhh', flock)
+
if l_type != FCNTL.F_UNLCK:
if l_type == FCNTL.F_RDLCK:
return 'r', l_len, l_start, l_whence, l_pid