]> granicus.if.org Git - python/commitdiff
Support for netbsd1 and freebsd3, after suggestions by Anders Andersen
authorGuido van Rossum <guido@python.org>
Tue, 2 Dec 1997 20:30:29 +0000 (20:30 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 2 Dec 1997 20:30:29 +0000 (20:30 +0000)
and Jacques Vidrine.

Lib/posixfile.py
Lib/test/test_fcntl.py

index fc5f53fe2cad030e1a2674a9d9e8d3a4c10da38f..d66517fbbc4565c55f9c8d12135b6ce541582d93 100644 (file)
@@ -177,7 +177,7 @@ class _posixfile_:
        # 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 == 'freebsd2':
+        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']:
@@ -190,7 +190,7 @@ class _posixfile_:
        flock = fcntl.fcntl(self._file_.fileno(), cmd, flock)
 
        if '?' in how:
-           if sys.platform == 'freebsd2':
+           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']:
index a5ea1e678f115ae1e3793fccb027434597d31111..2ae6b993a5ca9dc2080c137ca28ee6db77a49a72 100755 (executable)
@@ -5,7 +5,7 @@
 import struct
 import fcntl
 import FCNTL
-import os
+import os, sys
 from test_support import verbose
 
 filename = '/tmp/delete-me'
@@ -16,7 +16,12 @@ rv = fcntl.fcntl(f.fileno(), FCNTL.F_SETFL, os.O_NONBLOCK)
 if verbose:
     print 'Status from fnctl with O_NONBLOCK: ', rv
     
-lockdata = struct.pack('hhllhh', FCNTL.F_WRLCK, 0, 0, 0, 0, 0)
+if sys.platform in ('netbsd1', 'freebsd2', 'freebsd3'):
+    lockdata = struct.pack('lxxxxlxxxxlhh', 0, 0, 0, FCNTL.F_WRLCK, 0)
+elif sys.platform in ['aix3', 'aix4']:
+    lockdata = struct.pack('hhlllii', FCNTL.F_WRLCK, 0, 0, 0, 0, 0, 0)
+else:
+    lockdata = struct.pack('hhllhh', FCNTL.F_WRLCK, 0, 0, 0, 0, 0)
 if verbose:
     print 'struct.pack: ', `lockdata`