Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/util/_eventloop/
Date: Thu, 22 Nov 2012 12:24:00
Message-Id: 1353587000.4cc3db2b37e3a0ee123f9c9c81aba56be543b383.zmedico@gentoo
1 commit: 4cc3db2b37e3a0ee123f9c9c81aba56be543b383
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Thu Nov 22 12:23:20 2012 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Thu Nov 22 12:23:20 2012 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=4cc3db2b
7
8 EventLoop: handle Linux 2.4 errno 38 for epoll
9
10 ---
11 pym/portage/util/_eventloop/EventLoop.py | 27 +++++++++++++++++++--------
12 1 files changed, 19 insertions(+), 8 deletions(-)
13
14 diff --git a/pym/portage/util/_eventloop/EventLoop.py b/pym/portage/util/_eventloop/EventLoop.py
15 index 15d4ef2..17a468f 100644
16 --- a/pym/portage/util/_eventloop/EventLoop.py
17 +++ b/pym/portage/util/_eventloop/EventLoop.py
18 @@ -53,9 +53,28 @@ class EventLoop(object):
19 self._timeout_handlers = {}
20 self._timeout_interval = None
21
22 + self._poll_obj = None
23 try:
24 select.epoll
25 except AttributeError:
26 + pass
27 + else:
28 + try:
29 + epoll_obj = select.epoll()
30 + except IOError:
31 + # This happens with Linux 2.4 kernels:
32 + # IOError: [Errno 38] Function not implemented
33 + pass
34 + else:
35 + self._poll_obj = _epoll_adapter(epoll_obj)
36 + self.IO_ERR = select.EPOLLERR
37 + self.IO_HUP = select.EPOLLHUP
38 + self.IO_IN = select.EPOLLIN
39 + self.IO_NVAL = 0
40 + self.IO_OUT = select.EPOLLOUT
41 + self.IO_PRI = select.EPOLLPRI
42 +
43 + if self._poll_obj is None:
44 self._poll_obj = create_poll_instance()
45 self.IO_ERR = PollConstants.POLLERR
46 self.IO_HUP = PollConstants.POLLHUP
47 @@ -63,14 +82,6 @@ class EventLoop(object):
48 self.IO_NVAL = PollConstants.POLLNVAL
49 self.IO_OUT = PollConstants.POLLOUT
50 self.IO_PRI = PollConstants.POLLPRI
51 - else:
52 - self._poll_obj = _epoll_adapter(select.epoll())
53 - self.IO_ERR = select.EPOLLERR
54 - self.IO_HUP = select.EPOLLHUP
55 - self.IO_IN = select.EPOLLIN
56 - self.IO_NVAL = 0
57 - self.IO_OUT = select.EPOLLOUT
58 - self.IO_PRI = select.EPOLLPRI
59
60 self._child_handlers = {}
61 self._sigchld_read = None