2014-04-02 16:04:43 +00:00
|
|
|
import ffi
|
|
|
|
|
|
|
|
|
|
|
|
libc = ffi.open("libc.so.6")
|
|
|
|
|
|
|
|
fcntl_l = libc.func("i", "fcntl", "iil")
|
2014-04-21 21:39:21 +00:00
|
|
|
fcntl_s = libc.func("i", "fcntl", "iip")
|
2014-04-02 16:04:43 +00:00
|
|
|
ioctl_l = libc.func("i", "ioctl", "iil")
|
2014-04-21 21:39:21 +00:00
|
|
|
ioctl_s = libc.func("i", "ioctl", "iip")
|
2014-04-02 16:04:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
def fcntl(fd, op, arg):
|
|
|
|
if type(arg) is int:
|
|
|
|
return fcntl_l(fd, op, arg)
|
|
|
|
else:
|
|
|
|
raise NotImplementedError
|
|
|
|
|
|
|
|
|
|
|
|
def ioctl(fd, op, arg):
|
|
|
|
if type(arg) is int:
|
|
|
|
return ioctl_l(fd, op, arg)
|
|
|
|
else:
|
|
|
|
raise NotImplementedError
|