mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
Support for netbsd1 and freebsd3, after suggestions by Anders Andersen
and Jacques Vidrine.
This commit is contained in:
parent
c0f29c2d31
commit
91221c29f2
2 changed files with 9 additions and 4 deletions
|
@ -177,7 +177,7 @@ class _posixfile_:
|
||||||
# Hack by davem@magnet.com to get locking to go on freebsd;
|
# Hack by davem@magnet.com to get locking to go on freebsd;
|
||||||
# additions for AIX by Vladimir.Marangozov@imag.fr
|
# additions for AIX by Vladimir.Marangozov@imag.fr
|
||||||
import sys, os
|
import sys, os
|
||||||
if sys.platform == 'freebsd2':
|
if sys.platform in ('netbsd1', 'freebsd2', 'freebsd3'):
|
||||||
flock = struct.pack('lxxxxlxxxxlhh', \
|
flock = struct.pack('lxxxxlxxxxlhh', \
|
||||||
l_start, l_len, os.getpid(), l_type, l_whence)
|
l_start, l_len, os.getpid(), l_type, l_whence)
|
||||||
elif sys.platform in ['aix3', 'aix4']:
|
elif sys.platform in ['aix3', 'aix4']:
|
||||||
|
@ -190,7 +190,7 @@ class _posixfile_:
|
||||||
flock = fcntl.fcntl(self._file_.fileno(), cmd, flock)
|
flock = fcntl.fcntl(self._file_.fileno(), cmd, flock)
|
||||||
|
|
||||||
if '?' in how:
|
if '?' in how:
|
||||||
if sys.platform == 'freebsd2':
|
if sys.platform in ('netbsd1', 'freebsd2', 'freebsd3'):
|
||||||
l_start, l_len, l_pid, l_type, l_whence = \
|
l_start, l_len, l_pid, l_type, l_whence = \
|
||||||
struct.unpack('lxxxxlxxxxlhh', flock)
|
struct.unpack('lxxxxlxxxxlhh', flock)
|
||||||
elif sys.platform in ['aix3', 'aix4']:
|
elif sys.platform in ['aix3', 'aix4']:
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
import struct
|
import struct
|
||||||
import fcntl
|
import fcntl
|
||||||
import FCNTL
|
import FCNTL
|
||||||
import os
|
import os, sys
|
||||||
from test_support import verbose
|
from test_support import verbose
|
||||||
|
|
||||||
filename = '/tmp/delete-me'
|
filename = '/tmp/delete-me'
|
||||||
|
@ -16,6 +16,11 @@ rv = fcntl.fcntl(f.fileno(), FCNTL.F_SETFL, os.O_NONBLOCK)
|
||||||
if verbose:
|
if verbose:
|
||||||
print 'Status from fnctl with O_NONBLOCK: ', rv
|
print 'Status from fnctl with O_NONBLOCK: ', rv
|
||||||
|
|
||||||
|
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)
|
lockdata = struct.pack('hhllhh', FCNTL.F_WRLCK, 0, 0, 0, 0, 0)
|
||||||
if verbose:
|
if verbose:
|
||||||
print 'struct.pack: ', `lockdata`
|
print 'struct.pack: ', `lockdata`
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue