MCPcopy Index your code
hub / github.com/RustPython/RustPython / get_lockdata

Function get_lockdata

Lib/test/test_fcntl.py:19–46  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

17
18
19def get_lockdata():
20 try:
21 os.O_LARGEFILE
22 except AttributeError:
23 start_len = "ll"
24 else:
25 start_len = "qq"
26
27 if (sys.platform.startswith(('netbsd', 'freebsd', 'openbsd'))
28 or sys.platform == 'darwin'):
29 if struct.calcsize('l') == 8:
30 off_t = 'l'
31 pid_t = 'i'
32 else:
33 off_t = 'lxxxx'
34 pid_t = 'l'
35 lockdata = struct.pack(off_t + off_t + pid_t + 'hh', 0, 0, 0,
36 fcntl.F_WRLCK, 0)
37 elif sys.platform.startswith('gnukfreebsd'):
38 lockdata = struct.pack('qqihhi', 0, 0, 0, fcntl.F_WRLCK, 0, 0)
39 elif sys.platform in ['hp-uxB', 'unixware7']:
40 lockdata = struct.pack('hhlllii', fcntl.F_WRLCK, 0, 0, 0, 0, 0, 0)
41 else:
42 lockdata = struct.pack('hh'+start_len+'hh', fcntl.F_WRLCK, 0, 0, 0, 0, 0)
43 if lockdata:
44 if verbose:
45 print('struct.pack: ', repr(lockdata))
46 return lockdata
47
48lockdata = get_lockdata()
49

Callers 1

test_fcntl.pyFile · 0.85

Calls 4

reprFunction · 0.85
printFunction · 0.50
startswithMethod · 0.45
packMethod · 0.45

Tested by

no test coverage detected