kopia lustrzana https://github.com/micropython/micropython-lib
select: Use symbolic constant from errno module.
rodzic
1d69a4a0d5
commit
4016f0664c
|
@ -1,6 +1,7 @@
|
||||||
import ffi
|
import ffi
|
||||||
import struct
|
import struct
|
||||||
import os
|
import os
|
||||||
|
import errno
|
||||||
|
|
||||||
|
|
||||||
libc = ffi.open("libc.so.6")
|
libc = ffi.open("libc.so.6")
|
||||||
|
@ -37,7 +38,7 @@ class Epoll:
|
||||||
retval = fd
|
retval = fd
|
||||||
s = struct.pack(self.epoll_event, eventmask, retval)
|
s = struct.pack(self.epoll_event, eventmask, retval)
|
||||||
r = epoll_ctl(self.epfd, EPOLL_CTL_ADD, fd, s)
|
r = epoll_ctl(self.epfd, EPOLL_CTL_ADD, fd, s)
|
||||||
if r == -1 and os.errno.get() == 17:
|
if r == -1 and os.errno.get() == errno.EEXIST:
|
||||||
r = epoll_ctl(self.epfd, EPOLL_CTL_MOD, fd, s)
|
r = epoll_ctl(self.epfd, EPOLL_CTL_MOD, fd, s)
|
||||||
os.check_error(r)
|
os.check_error(r)
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue