diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /ipc/chromium/src/third_party/libevent/make_epoll_table.py | |
parent | Initial commit. (diff) | |
download | thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ipc/chromium/src/third_party/libevent/make_epoll_table.py')
-rwxr-xr-x | ipc/chromium/src/third_party/libevent/make_epoll_table.py | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/ipc/chromium/src/third_party/libevent/make_epoll_table.py b/ipc/chromium/src/third_party/libevent/make_epoll_table.py new file mode 100755 index 0000000000..1b15a91a67 --- /dev/null +++ b/ipc/chromium/src/third_party/libevent/make_epoll_table.py @@ -0,0 +1,63 @@ +#!/usr/bin/python2 + +def get(old,wc,rc,cc): + if ('xxx' in (rc, wc, cc)): + return "0",255 + + if ('add' in (rc, wc, cc)): + events = [] + if rc == 'add' or (rc != 'del' and 'r' in old): + events.append("EPOLLIN") + if wc == 'add' or (wc != 'del' and 'w' in old): + events.append("EPOLLOUT") + if cc == 'add' or (cc != 'del' and 'c' in old): + events.append("EPOLLRDHUP") + + if old == "0": + op = "EPOLL_CTL_ADD" + else: + op = "EPOLL_CTL_MOD" + return "|".join(events), op + + if ('del' in (rc, wc, cc)): + delevents = [] + modevents = [] + op = "EPOLL_CTL_DEL" + + if 'r' in old: + modevents.append("EPOLLIN") + if 'w' in old: + modevents.append("EPOLLOUT") + if 'c' in old: + modevents.append("EPOLLRDHUP") + + for item, event in [(rc,"EPOLLIN"), + (wc,"EPOLLOUT"), + (cc,"EPOLLRDHUP")]: + if item == 'del': + delevents.append(event) + if event in modevents: + modevents.remove(event) + + if modevents: + return "|".join(modevents), "EPOLL_CTL_MOD" + else: + return "|".join(delevents), "EPOLL_CTL_DEL" + + return 0, 0 + + +def fmt(op, ev, old, wc, rc, cc): + entry = "{ %s, %s },"%(op, ev) + print "\t/* old=%3s, write:%3s, read:%3s, close:%3s */\n\t%s" % ( + old, wc, rc, cc, entry) + return len(entry) + +for old in ('0','r','w','rw','c','cr','cw','crw'): + for wc in ('0', 'add', 'del', 'xxx'): + for rc in ('0', 'add', 'del', 'xxx'): + for cc in ('0', 'add', 'del', 'xxx'): + + op,ev = get(old,wc,rc,cc) + + fmt(op, ev, old, wc, rc, cc) |