Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / amd64 / lib / python2.4 / lib-old / lockfile.py
CommitLineData
920dae64
AT
1import struct, fcntl
2
3def writelock(f):
4 _lock(f, fcntl.F_WRLCK)
5
6def readlock(f):
7 _lock(f, fcntl.F_RDLCK)
8
9def unlock(f):
10 _lock(f, fcntl.F_UNLCK)
11
12def _lock(f, op):
13 dummy = fcntl.fcntl(f.fileno(), fcntl.F_SETLKW,
14 struct.pack('2h8l', op,
15 0, 0, 0, 0, 0, 0, 0, 0, 0))