> -----Mesaj original-----
> De la: dev [mailto:dev-boun...@openvswitch.org] În numele Paul Boca
> Trimis: Wednesday, July 6, 2016 3:38 PM
> Către: dev@openvswitch.org
> Subiect: [ovs-dev] [PATCH V6 05/17] python tests: Added fcntl module for
> Windows
> 
> This is needed for lockf function used to lock the PID file on Windows.
> ioctl and fcntl functions are not implemented at this time because they are
> not used by any script.
[Alin Gabriel Serdean: ] Since ioctl and fnctl are not used why implement them?
> 
> +
> +def lockf(fd, flags, length=0xFFFF0000, start=0, whence=0):
> +    file_name = fd.name
> +    overlapped = pywintypes.OVERLAPPED()
> +    hfile = msvcrt.get_osfhandle(fd.fileno())
> +    if LOCK_UN & flags:
> +        ret = win32file.UnlockFileEx(hfile, 0, start, length, overlapped)
> +    else:
> +        try:
> +            ret = win32file.LockFileEx(hfile, flags, start, length, 
> overlapped)
> +        except:
> +            raise IOError(errno.EAGAIN, "", "")
> +
> +def flock(fd, flags):
> +    lockf(fd, flags, 0xFFFF0000, 0, 0)
> --
> 2.7.2.windows.1
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to