Skip to content

Commit

Permalink
Merge pull request #13 from OPAE/mgerlach/master-fix-exclusive
Browse files Browse the repository at this point in the history
fpgasupdate: fix exlusive locking of /dev/iffpga_sec*
  • Loading branch information
fpgamatt authored and GitHub Enterprise committed Jul 26, 2019
2 parents 22b7760 + 9f0c871 commit 666b4fb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion opae.admin/opae/admin/fpga.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,12 @@ def ioctl(self, req, data, mutate_flag=True):
return data

def __enter__(self):
self._fd = os.open(self.devpath, os.O_SYNC | os.O_RDWR | os.O_EXCL)
self._fd = os.open(self.devpath, os.O_SYNC | os.O_RDWR)
fcntl.lockf(self._fd, fcntl.LOCK_EX | fcntl.LOCK_NB)
return self._fd

def __exit__(self, ex_type, ex_val, ex_traceback):
fcntl.lockf(self._fd, fcntl.LOCK_UN)
os.close(self._fd)


Expand Down

0 comments on commit 666b4fb

Please sign in to comment.