aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2012-11-22 12:23:20 (GMT)
committerZac Medico <zmedico@gentoo.org>2012-11-22 12:23:20 (GMT)
commit4cc3db2b37e3a0ee123f9c9c81aba56be543b383 (patch)
treeca37b00da74d4096e38d18ab4a339b0f72c281ef
parentflat_hash.__iter__: validate keys (diff)
downloadportage-4cc3db2b37e3a0ee123f9c9c81aba56be543b383.zip
portage-4cc3db2b37e3a0ee123f9c9c81aba56be543b383.tar.gz
portage-4cc3db2b37e3a0ee123f9c9c81aba56be543b383.tar.bz2
EventLoop: handle Linux 2.4 errno 38 for epoll
-rw-r--r--pym/portage/util/_eventloop/EventLoop.py27
1 files changed, 19 insertions, 8 deletions
diff --git a/pym/portage/util/_eventloop/EventLoop.py b/pym/portage/util/_eventloop/EventLoop.py
index 15d4ef2..17a468f 100644
--- a/pym/portage/util/_eventloop/EventLoop.py
+++ b/pym/portage/util/_eventloop/EventLoop.py
@@ -53,9 +53,28 @@ class EventLoop(object):
self._timeout_handlers = {}
self._timeout_interval = None
+ self._poll_obj = None
try:
select.epoll
except AttributeError:
+ pass
+ else:
+ try:
+ epoll_obj = select.epoll()
+ except IOError:
+ # This happens with Linux 2.4 kernels:
+ # IOError: [Errno 38] Function not implemented
+ pass
+ else:
+ self._poll_obj = _epoll_adapter(epoll_obj)
+ self.IO_ERR = select.EPOLLERR
+ self.IO_HUP = select.EPOLLHUP
+ self.IO_IN = select.EPOLLIN
+ self.IO_NVAL = 0
+ self.IO_OUT = select.EPOLLOUT
+ self.IO_PRI = select.EPOLLPRI
+
+ if self._poll_obj is None:
self._poll_obj = create_poll_instance()
self.IO_ERR = PollConstants.POLLERR
self.IO_HUP = PollConstants.POLLHUP
@@ -63,14 +82,6 @@ class EventLoop(object):
self.IO_NVAL = PollConstants.POLLNVAL
self.IO_OUT = PollConstants.POLLOUT
self.IO_PRI = PollConstants.POLLPRI
- else:
- self._poll_obj = _epoll_adapter(select.epoll())
- self.IO_ERR = select.EPOLLERR
- self.IO_HUP = select.EPOLLHUP
- self.IO_IN = select.EPOLLIN
- self.IO_NVAL = 0
- self.IO_OUT = select.EPOLLOUT
- self.IO_PRI = select.EPOLLPRI
self._child_handlers = {}
self._sigchld_read = None