diff options
author | monster <monster@ydb.tech> | 2022-07-07 14:41:37 +0300 |
---|---|---|
committer | monster <monster@ydb.tech> | 2022-07-07 14:41:37 +0300 |
commit | 06e5c21a835c0e923506c4ff27929f34e00761c2 (patch) | |
tree | 75efcbc6854ef9bd476eb8bf00cc5c900da436a2 /contrib/libs/libevent | |
parent | 03f024c4412e3aa613bb543cf1660176320ba8f4 (diff) | |
download | ydb-06e5c21a835c0e923506c4ff27929f34e00761c2.tar.gz |
fix ya.make
Diffstat (limited to 'contrib/libs/libevent')
-rw-r--r-- | contrib/libs/libevent/.yandex_meta/devtools.copyrights.report | 594 | ||||
-rw-r--r-- | contrib/libs/libevent/.yandex_meta/devtools.licenses.report | 338 | ||||
-rw-r--r-- | contrib/libs/libevent/.yandex_meta/licenses.list.txt | 386 | ||||
-rw-r--r-- | contrib/libs/libevent/buffer_iocp.c | 327 | ||||
-rw-r--r-- | contrib/libs/libevent/bufferevent_async.c | 706 | ||||
-rw-r--r-- | contrib/libs/libevent/config.h | 555 | ||||
-rw-r--r-- | contrib/libs/libevent/devpoll.c | 311 | ||||
-rw-r--r-- | contrib/libs/libevent/epoll_sub.c | 66 | ||||
-rw-r--r-- | contrib/libs/libevent/event_core/CMakeLists.txt | 2 | ||||
-rw-r--r-- | contrib/libs/libevent/event_iocp.c | 294 | ||||
-rw-r--r-- | contrib/libs/libevent/evport.c | 451 | ||||
-rw-r--r-- | contrib/libs/libevent/evthread_win32.c | 341 | ||||
-rw-r--r-- | contrib/libs/libevent/include/evdns.h | 45 | ||||
-rw-r--r-- | contrib/libs/libevent/include/event2/rpc_compat.h | 61 | ||||
-rw-r--r-- | contrib/libs/libevent/include/evrpc.h | 45 | ||||
-rw-r--r-- | contrib/libs/libevent/win32select.c | 389 |
16 files changed, 1 insertions, 4910 deletions
diff --git a/contrib/libs/libevent/.yandex_meta/devtools.copyrights.report b/contrib/libs/libevent/.yandex_meta/devtools.copyrights.report deleted file mode 100644 index 3b33a245c02..00000000000 --- a/contrib/libs/libevent/.yandex_meta/devtools.copyrights.report +++ /dev/null @@ -1,594 +0,0 @@ -# File format ($ symbol means the beginning of a line): -# -# $ # this message -# $ # ======================= -# $ # comments (all commentaries should starts with some number of spaces and # symbol) -# ${action} {license id} {license text hash} -# $BELONGS ./ya/make/file/relative/path/1/ya.make ./ya/make/2/ya.make -# ${all_file_action} filename -# $ # user commentaries (many lines) -# $ generated description - files with this license, license text... (some number of lines that starts with some number of spaces, do not modify) -# ${action} {license spdx} {license text hash} -# $BELONGS ./ya/make/file/relative/path/3/ya.make -# ${all_file_action} filename -# $ # user commentaries -# $ generated description -# $ ... -# -# You can modify action, all_file_action and add commentaries -# Available actions: -# keep - keep license in contrib and use in credits -# skip - skip license -# remove - remove all files with this license -# rename - save license text/links into licenses texts file, but not store SPDX into LINCENSE macro. You should store correct license id into devtools.license.spdx.txt file -# -# {all file action} records will be generated when license text contains filename that exists on filesystem (in contrib directory) -# We suppose that that files can contain some license info -# Available all file actions: -# FILE_IGNORE - ignore file (do nothing) -# FILE_INCLUDE - include all file data into licenses text file -# ======================= - -KEEP COPYRIGHT_SERVICE_LABEL 0746e9cd4bc6ffb17540ab9638dfa1cb -BELONGS ya.make - License text: - * Copyright (c) 2002-2007 Niels Provos <provos@citi.umich.edu> - * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson - Scancode info: - Original SPDX id: COPYRIGHT_SERVICE_LABEL - Score : 100.00 - Match type : COPYRIGHT - Files with this license: - buffer.c [2:3] - bufferevent.c [2:3] - http.c [2:3] - -KEEP COPYRIGHT_SERVICE_LABEL 082b1a41fffa5015f815756cc2f6b7b9 -BELONGS ya.make - License text: - /* Copyright 2006-2007 Niels Provos - * Copyright 2007-2012 Nick Mathewson and Niels Provos - Scancode info: - Original SPDX id: COPYRIGHT_SERVICE_LABEL - Score : 100.00 - Match type : COPYRIGHT - Files with this license: - evdns.c [1:2] - -KEEP COPYRIGHT_SERVICE_LABEL 0b90bbcf56f9e22951896b662d1340c1 -BELONGS ya.make - License text: - Copyright (c) 2003 Michael A. Davis <mike@datanerds.net> - Scancode info: - Original SPDX id: COPYRIGHT_SERVICE_LABEL - Score : 100.00 - Match type : COPYRIGHT - Files with this license: - LICENSE [44:44] - -KEEP COPYRIGHT_SERVICE_LABEL 0e0c666533d8c10c166b89876ccce2a9 -BELONGS ya.make - License text: - * Copyright (c) 2012 Niels Provos and Nick Mathewson - Scancode info: - Original SPDX id: COPYRIGHT_SERVICE_LABEL - Score : 100.00 - Match type : COPYRIGHT - Files with this license: - kqueue-internal.h [2:2] - -KEEP COPYRIGHT_SERVICE_LABEL 0fadbeefe92a23384f4527ecc4101793 -BELONGS ya.make - License text: - * Copyright (c) 2009-2012 Niels Provos and Nick Mathewson - Scancode info: - Original SPDX id: COPYRIGHT_SERVICE_LABEL - Score : 100.00 - Match type : COPYRIGHT - Files with this license: - buffer_iocp.c [2:2] - bufferevent_async.c [2:2] - bufferevent_openssl.c [2:2] - changelist-internal.h [2:2] - defer-internal.h [2:2] - event_tagging.c [2:3] - include/event2/bufferevent_ssl.h [2:2] - iocp-internal.h [2:2] - ipv6-internal.h [2:2] - ratelim-internal.h [2:2] - -KEEP COPYRIGHT_SERVICE_LABEL 12c13673979d84c93fb3f9aed80709bd -BELONGS ya.make - License text: - Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> - Scancode info: - Original SPDX id: COPYRIGHT_SERVICE_LABEL - Score : 100.00 - Match type : COPYRIGHT - Files with this license: - LICENSE [41:41] - -KEEP COPYRIGHT_SERVICE_LABEL 13ce363ae6eb95e6da30562d6d8815cf -BELONGS ya.make - License text: - Copyright (c) 2010 BitTorrent, Inc. - Scancode info: - Original SPDX id: COPYRIGHT_SERVICE_LABEL - Score : 100.00 - Match type : COPYRIGHT - Files with this license: - LICENSE [81:81] - evutil_time.c [464:464] - -KEEP COPYRIGHT_SERVICE_LABEL 247b3276a119d8838067969cbabcc850 -BELONGS ya.make - License text: - /* Copyright 2002 Christopher Clark */ - /* Copyright 2005-2012 Nick Mathewson */ - /* Copyright 2009-2012 Niels Provos and Nick Mathewson */ - /* See license at end. */ - Scancode info: - Original SPDX id: COPYRIGHT_SERVICE_LABEL - Score : 100.00 - Match type : COPYRIGHT - Files with this license: - ht-internal.h [1:4] - -KEEP COPYRIGHT_SERVICE_LABEL 366255da81f164622082d6e6e857079b -BELONGS ya.make - License text: - * Copyright 2000-2007 Niels Provos <provos@citi.umich.edu> - * Copyright 2007-2012 Niels Provos, Nick Mathewson - Scancode info: - Original SPDX id: COPYRIGHT_SERVICE_LABEL - Score : 100.00 - Match type : COPYRIGHT - Files with this license: - epoll.c [2:3] - evsignal-internal.h [2:3] - include/evhttp.h [2:3] - kqueue.c [4:5] - poll.c [4:5] - select.c [4:5] - signal.c [4:5] - win32select.c [2:4] - -KEEP COPYRIGHT_SERVICE_LABEL 3da890df9fa10383f224d1c72d16c9c3 -BELONGS ya.make - License text: - Copyright (c) 2000 Dug Song <dugsong@monkey.org> - Copyright (c) 1993 The Regents of the University of California. - Scancode info: - Original SPDX id: COPYRIGHT_SERVICE_LABEL - Score : 100.00 - Match type : COPYRIGHT - Files with this license: - LICENSE [37:38] - log.c [10:10] - -KEEP COPYRIGHT_SERVICE_LABEL 41f7c2c18ae9c0d7c90b8e57e386adfe -BELONGS ya.make - License text: - * Copyright (c) 2008-2012 Niels Provos, Nick Mathewson - Scancode info: - Original SPDX id: COPYRIGHT_SERVICE_LABEL - Score : 100.00 - Match type : COPYRIGHT - Files with this license: - evthread-internal.h [2:2] - evthread.c [2:2] - -KEEP COPYRIGHT_SERVICE_LABEL 452658f99fe7971a64b571ccc6e61b06 -BELONGS ya.make - License text: - * Copyright 2000-2009 Niels Provos <provos@citi.umich.edu> - * Copyright 2009-2012 Niels Provos and Nick Mathewson - Scancode info: - Original SPDX id: COPYRIGHT_SERVICE_LABEL - Score : 100.00 - Match type : COPYRIGHT - Files with this license: - devpoll.c [2:3] - -KEEP COPYRIGHT_SERVICE_LABEL 49714afdc41a2a2583129057fbed3acd -BELONGS ya.make - License text: - /* Copyright 2002 Christopher Clark */ - /* Copyright 2005-2012 Nick Mathewson */ - /* Copyright 2009-2012 Niels Provos and Nick Mathewson */ - /* See license at end. */ - Scancode info: - Original SPDX id: COPYRIGHT_SERVICE_LABEL - Score : 100.00 - Match type : COPYRIGHT - Files with this license: - ht-internal.h [1:4] - -KEEP COPYRIGHT_SERVICE_LABEL 4b7e3a37a14ebd0b46a20796adc38b79 -BELONGS ya.make - License text: - * Copyright (c) 2006-2007 Niels Provos <provos@citi.umich.edu> - * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson - Scancode info: - Original SPDX id: COPYRIGHT_SERVICE_LABEL - Score : 100.00 - Match type : COPYRIGHT - Files with this license: - evrpc-internal.h [2:3] - include/event2/dns.h [2:3] - include/event2/dns_compat.h [2:3] - include/event2/rpc.h [2:3] - include/event2/rpc_compat.h [2:3] - include/event2/rpc_struct.h [2:3] - -KEEP COPYRIGHT_SERVICE_LABEL 4d7d4c20bd840002b4ae931bb775a39a -BELONGS ya.make - License text: - /* Copyright 2006-2007 Niels Provos - * Copyright 2007-2012 Nick Mathewson and Niels Provos - Scancode info: - Original SPDX id: COPYRIGHT_SERVICE_LABEL - Score : 100.00 - Match type : COPYRIGHT - Files with this license: - evdns.c [1:2] - evport.c [4:5] - -KEEP COPYRIGHT_SERVICE_LABEL 5890bfc11f1b786acdc4535bce0cc746 -BELONGS ya.make - License text: - * Copyright 2003-2009 Niels Provos <provos@citi.umich.edu> - * Copyright 2009-2012 Niels Provos and Nick Mathewson - Scancode info: - Original SPDX id: COPYRIGHT_SERVICE_LABEL - Score : 100.00 - Match type : COPYRIGHT - Files with this license: - epoll_sub.c [2:3] - -KEEP COPYRIGHT_SERVICE_LABEL 64ad41a9da8360b4ae09a7f268770842 -BELONGS ya.make - License text: - * Copyright (c) 1996, David Mazieres <dm@uun.org> - * Copyright (c) 2008, Damien Miller <djm@openbsd.org> - Scancode info: - Original SPDX id: COPYRIGHT_SERVICE_LABEL - Score : 100.00 - Match type : COPYRIGHT - Files with this license: - LICENSE [60:61] - arc4random.c [11:12] - -KEEP COPYRIGHT_SERVICE_LABEL 713db492a4ae2763feb87886d3630c50 -BELONGS ya.make - License text: - * Copyright (c) 2007 Sun Microsystems. All rights reserved. - Scancode info: - Original SPDX id: COPYRIGHT_SERVICE_LABEL - Score : 100.00 - Match type : COPYRIGHT - Files with this license: - LICENSE [47:47] - evport.c [31:31] - -KEEP COPYRIGHT_SERVICE_LABEL 7197a7d386bc3f4a432c41de2fb4c167 -BELONGS ya.make - License text: - * Copyright (c) 2002-2007 Niels Provos <provos@citi.umich.edu> - * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson - Scancode info: - Original SPDX id: COPYRIGHT_SERVICE_LABEL - Score : 100.00 - Match type : COPYRIGHT - Files with this license: - LICENSE [5:6] - buffer.c [2:3] - bufferevent_filter.c [2:4] - bufferevent_ratelim.c [2:4] - bufferevent_sock.c [2:4] - epolltable-internal.h [2:3] - evbuffer-internal.h [2:3] - event-internal.h [2:3] - event.c [2:3] - evmap-internal.h [2:2] - evmap.c [2:2] - evrpc-internal.h [2:3] - evrpc.c [2:3] - evutil.c [2:2] - evutil_rand.c [2:2] - evutil_time.c [2:2] - http.c [2:3] - include/evdns.h [2:3] - include/event.h [2:3] - include/event2/buffer.h [2:2] - include/event2/buffer_compat.h [2:2] - include/event2/bufferevent.h [2:3] - include/event2/bufferevent_struct.h [2:3] - include/event2/dns.h [2:3] - include/event2/dns_compat.h [2:3] - include/event2/dns_struct.h [2:3] - include/event2/event.h [2:3] - include/event2/event_compat.h [2:3] - include/event2/event_struct.h [2:3] - include/event2/http.h [2:3] - include/event2/http_compat.h [2:3] - include/event2/http_struct.h [2:3] - include/event2/keyvalq_struct.h [2:3] - include/event2/listener.h [2:3] - include/event2/rpc.h [2:3] - include/event2/rpc_compat.h [2:3] - include/event2/rpc_struct.h [2:3] - include/event2/tag.h [2:3] - include/event2/tag_compat.h [2:3] - include/event2/util.h [2:2] - include/event2/visibility.h [3:3] - include/evrpc.h [2:3] - include/evutil.h [2:2] - log-internal.h [2:3] - minheap-internal.h [2:2] - mm-internal.h [2:2] - time-internal.h [2:3] - util-internal.h [2:2] - -KEEP COPYRIGHT_SERVICE_LABEL 7a2a99a9f08ea1bf1640d0a02cea0402 -BELONGS ya.make - License text: - * Copyright (c) 2003-2009 Niels Provos <provos@citi.umich.edu> - * Copyright (c) 2009-2012 Niels Provos and Nick Mathewson - Scancode info: - Original SPDX id: COPYRIGHT_SERVICE_LABEL - Score : 100.00 - Match type : COPYRIGHT - Files with this license: - event_tagging.c [2:3] - -KEEP COPYRIGHT_SERVICE_LABEL 7c2936cc0453639e0a55b4d9f729353c -BELONGS ya.make - License text: - Copyright (c) 2000 Dug Song <dugsong@monkey.org> - Copyright (c) 1993 The Regents of the University of California. - Scancode info: - Original SPDX id: COPYRIGHT_SERVICE_LABEL - Score : 100.00 - Match type : COPYRIGHT - Files with this license: - LICENSE [37:38] - log.c [12:13] - -KEEP COPYRIGHT_SERVICE_LABEL 7fa4218389a7a2d24125e2c3b13b1a44 -BELONGS ya.make - License text: - * Copyright 2000-2007 Niels Provos <provos@citi.umich.edu> - * Copyright 2007-2012 Niels Provos, Nick Mathewson - Scancode info: - Original SPDX id: COPYRIGHT_SERVICE_LABEL - Score : 100.00 - Match type : COPYRIGHT - Files with this license: - epoll.c [2:3] - -KEEP COPYRIGHT_SERVICE_LABEL 8c7cfe6ef6362b4f64ae0a58953fe2e8 -BELONGS ya.make - License text: - * Copyright 2006-2007 Niels Provos - * Copyright 2007-2012 Niels Provos and Nick Mathewson - Scancode info: - Original SPDX id: COPYRIGHT_SERVICE_LABEL - Score : 100.00 - Match type : COPYRIGHT - Files with this license: - evport.c [4:5] - evsignal-internal.h [2:3] - include/evhttp.h [2:3] - kqueue.c [4:5] - poll.c [4:5] - select.c [4:5] - signal.c [4:5] - win32select.c [2:4] - -KEEP COPYRIGHT_SERVICE_LABEL 9f2dacf4d0ea861ef5e68ac0825102d5 -BELONGS ya.make - License text: - * Copyright (c) 2009-2012 Niels Provos, Nick Mathewson - Scancode info: - Original SPDX id: COPYRIGHT_SERVICE_LABEL - Score : 100.00 - Match type : COPYRIGHT - Files with this license: - bufferevent_pair.c [2:2] - event_iocp.c [2:2] - listener.c [2:2] - -KEEP COPYRIGHT_SERVICE_LABEL a387dc4f3515be25ebc2c5b93bd3b7f6 -BELONGS ya.make - License text: - * Copyright (c) 2002-2007 Niels Provos <provos@citi.umich.edu> - * Copyright (c) 2007-2012 Niels Provos, Nick Mathewson - Scancode info: - Original SPDX id: COPYRIGHT_SERVICE_LABEL - Score : 100.00 - Match type : COPYRIGHT - Files with this license: - bufferevent.c [2:3] - include/event2/bufferevent_compat.h [2:4] - -KEEP COPYRIGHT_SERVICE_LABEL a3b0f6940cc8b095be04e48d4272b8a3 -BELONGS ya.make - License text: - Copyright (c) 2002 Christopher Clark - Scancode info: - Original SPDX id: COPYRIGHT_SERVICE_LABEL - Score : 100.00 - Match type : COPYRIGHT - Files with this license: - LICENSE [50:50] - -KEEP COPYRIGHT_SERVICE_LABEL aff3dc90bd054108716ad9ad16452926 -BELONGS ya.make - License text: - * Copyright (c) 1996, David Mazieres <dm@uun.org> - * Copyright (c) 2008, Damien Miller <djm@openbsd.org> - Scancode info: - Original SPDX id: COPYRIGHT_SERVICE_LABEL - Score : 100.00 - Match type : COPYRIGHT - Files with this license: - LICENSE [60:61] - arc4random.c [11:12] - -KEEP COPYRIGHT_SERVICE_LABEL b2fa82f331d4915d971d8941f3f6ad65 -BELONGS ya.make - License text: - * Copyright (c) 2000-2007 Niels Provos <provos@citi.umich.edu> - * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson - Scancode info: - Original SPDX id: COPYRIGHT_SERVICE_LABEL - Score : 100.00 - Match type : COPYRIGHT - Files with this license: - LICENSE [5:6] - epolltable-internal.h [2:3] - evbuffer-internal.h [2:3] - event-internal.h [2:3] - event.c [2:3] - evrpc.c [2:3] - include/evdns.h [2:3] - include/event.h [2:3] - include/event2/bufferevent.h [2:3] - include/event2/bufferevent_compat.h [2:4] - include/event2/bufferevent_struct.h [2:3] - include/event2/dns_struct.h [2:3] - include/event2/event.h [2:3] - include/event2/event_compat.h [2:3] - include/event2/event_struct.h [2:3] - include/event2/http.h [2:3] - include/event2/http_compat.h [2:3] - include/event2/http_struct.h [2:3] - include/event2/keyvalq_struct.h [2:3] - include/event2/listener.h [2:3] - include/event2/tag.h [2:3] - include/event2/tag_compat.h [2:3] - include/evrpc.h [2:3] - log-internal.h [2:3] - time-internal.h [2:3] - -KEEP COPYRIGHT_SERVICE_LABEL b9bfaef4277e2cce9fac4727bbeba2fd -BELONGS ya.make - Note: matched license text is too long. Read it in the source files. - Scancode info: - Original SPDX id: COPYRIGHT_SERVICE_LABEL - Score : 100.00 - Match type : COPYRIGHT - Files with this license: - arc4random.c [2:4] - -KEEP COPYRIGHT_SERVICE_LABEL bc880feecda4f2f893732dcdc66e796a -BELONGS ya.make - License text: - * Copyright (c) 2002, Christopher Clark - * All rights reserved. - Scancode info: - Original SPDX id: COPYRIGHT_SERVICE_LABEL - Score : 100.00 - Match type : COPYRIGHT - Files with this license: - ht-internal.h [454:455] - -KEEP COPYRIGHT_SERVICE_LABEL d30bd999d006f7ceb0313656233feb6c -BELONGS ya.make - License text: - * Copyright (c) 2005-2012 Niels Provos and Nick Mathewson - Scancode info: - Original SPDX id: COPYRIGHT_SERVICE_LABEL - Score : 100.00 - Match type : COPYRIGHT - Files with this license: - log.c [8:8] - -KEEP COPYRIGHT_SERVICE_LABEL d545942b97f4fbf6349b45d4d286e283 -BELONGS ya.make - Note: matched license text is too long. Read it in the source files. - Scancode info: - Original SPDX id: COPYRIGHT_SERVICE_LABEL - Score : 100.00 - Match type : COPYRIGHT - Files with this license: - ht-internal.h [449:452] - -KEEP COPYRIGHT_SERVICE_LABEL db1a948f7d71c9a52587d33ee11ee654 -BELONGS ya.make - License text: - * Copyright (c) 2008-2012 Niels Provos and Nick Mathewson - Scancode info: - Original SPDX id: COPYRIGHT_SERVICE_LABEL - Score : 100.00 - Match type : COPYRIGHT - Files with this license: - bufferevent-internal.h [2:2] - include/event2/thread.h [2:2] - -KEEP COPYRIGHT_SERVICE_LABEL ea86b16c35472acd430408ac1459f593 -BELONGS ya.make - License text: - * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson - * Copyright (c) 2002-2006 Niels Provos <provos@citi.umich.edu> - * All rights reserved. - Scancode info: - Original SPDX id: COPYRIGHT_SERVICE_LABEL - Score : 100.00 - Match type : COPYRIGHT - Files with this license: - bufferevent_filter.c [2:4] - bufferevent_ratelim.c [2:4] - bufferevent_sock.c [2:4] - -KEEP COPYRIGHT_SERVICE_LABEL eaec484363c86db38a328cb8663c659a -BELONGS ya.make - Note: matched license text is too long. Read it in the source files. - Scancode info: - Original SPDX id: COPYRIGHT_SERVICE_LABEL - Score : 100.00 - Match type : COPYRIGHT - Files with this license: - arc4random.c [2:4] - -KEEP COPYRIGHT_SERVICE_LABEL f0e6e66d876a25c8b8a649b895eaf7be -BELONGS ya.make - License text: - Copyright (c) 2006 Maxim Yegorushkin <maxim.yegorushkin@gmail.com> - Scancode info: - Original SPDX id: COPYRIGHT_SERVICE_LABEL - Score : 100.00 - Match type : COPYRIGHT - Files with this license: - LICENSE [53:53] - minheap-internal.h [4:4] - -KEEP COPYRIGHT_SERVICE_LABEL f1be63594dfb4ec92eb100d249db5724 -BELONGS ya.make - License text: - * Copyright 2000-2009 Niels Provos <provos@citi.umich.edu> - * Copyright 2009-2012 Niels Provos and Nick Mathewson - Scancode info: - Original SPDX id: COPYRIGHT_SERVICE_LABEL - Score : 100.00 - Match type : COPYRIGHT - Files with this license: - devpoll.c [2:3] - epoll_sub.c [2:3] - evthread_pthread.c [2:2] - evthread_win32.c [2:2] - ht-internal.h [1:4] - -KEEP COPYRIGHT_SERVICE_LABEL fce98e564d26e0f3db83f82df32d416c -BELONGS ya.make - License text: - * Copyright 2007-2012 Niels Provos and Nick Mathewson - * Copyright 2000-2007 Niels Provos <provos@citi.umich.edu> - * Copyright 2003 Michael A. Davis <mike@datanerds.net> - Scancode info: - Original SPDX id: COPYRIGHT_SERVICE_LABEL - Score : 100.00 - Match type : COPYRIGHT - Files with this license: - win32select.c [2:4] diff --git a/contrib/libs/libevent/.yandex_meta/devtools.licenses.report b/contrib/libs/libevent/.yandex_meta/devtools.licenses.report deleted file mode 100644 index 38bdccf0bd5..00000000000 --- a/contrib/libs/libevent/.yandex_meta/devtools.licenses.report +++ /dev/null @@ -1,338 +0,0 @@ -# File format ($ symbol means the beginning of a line): -# -# $ # this message -# $ # ======================= -# $ # comments (all commentaries should starts with some number of spaces and # symbol) -# ${action} {license spdx} {license text hash} -# $BELONGS ./ya/make/file/relative/path/1/ya.make ./ya/make/2/ya.make -# ${all_file_action} filename -# $ # user commentaries (many lines) -# $ generated description - files with this license, license text... (some number of lines that starts with some number of spaces, do not modify) -# ${action} {license spdx} {license text hash} -# $BELONGS ./ya/make/file/relative/path/3/ya.make -# ${all_file_action} filename -# $ # user commentaries -# $ generated description -# $ ... -# -# You can modify action, all_file_action and add commentaries -# Available actions: -# keep - keep license in contrib and use in credits -# skip - skip license -# remove - remove all files with this license -# rename - save license text/links into licenses texts file, but not store SPDX into LINCENSE macro. You should store correct license id into devtools.license.spdx.txt file -# -# {all file action} records will be generated when license text contains filename that exists on filesystem (in contrib directory) -# We suppose that that files can contain some license info -# Available all file actions: -# FILE_IGNORE - ignore file (do nothing) -# FILE_INCLUDE - include all file data into licenses text file -# ======================= - -KEEP CC-PDDC 03f1d5aee47da1e798f42f29c0315e49 -BELONGS ya.make - Note: matched license text is too long. Read it in the source files. - Scancode info: - Original SPDX id: CC-PDDC - Score : 100.00 - Match type : NOTICE - Links : http://creativecommons.org/licenses/publicdomain/, https://creativecommons.org/licenses/publicdomain/, https://spdx.org/licenses/CC-PDDC - Files with this license: - evdns.c [32:36] - -KEEP BSD-3-Clause 15998ea282d57c57446ae7296c7e3029 -BELONGS ya.make - Note: matched license text is too long. Read it in the source files. - Scancode info: - Original SPDX id: BSD-3-Clause - Score : 100.00 - Match type : TEXT - Links : http://www.opensource.org/licenses/BSD-3-Clause, https://spdx.org/licenses/BSD-3-Clause - Files with this license: - buffer.c [5:25] - buffer_iocp.c [4:24] - bufferevent-internal.h [4:24] - bufferevent.c [5:25] - bufferevent_async.c [6:26] - bufferevent_filter.c [6:26] - bufferevent_openssl.c [4:24] - bufferevent_pair.c [4:24] - bufferevent_ratelim.c [6:26] - bufferevent_sock.c [6:26] - changelist-internal.h [4:24] - defer-internal.h [4:24] - devpoll.c [5:25] - epoll.c [5:25] - epoll_sub.c [5:25] - epolltable-internal.h [5:25] - evbuffer-internal.h [5:25] - evdns.c [4:24] - event-internal.h [5:25] - event.c [5:25] - event_iocp.c [4:24] - event_tagging.c [5:25] - evmap-internal.h [4:24] - evmap.c [4:24] - evrpc-internal.h [5:25] - evrpc.c [5:25] - evsignal-internal.h [5:25] - evthread-internal.h [4:24] - evthread.c [4:24] - evthread_pthread.c [4:24] - evthread_win32.c [4:24] - evutil.c [4:24] - evutil_rand.c [4:24] - evutil_time.c [4:24] - http.c [5:25] - include/evdns.h [5:25] - include/event.h [5:25] - include/event2/buffer.h [4:24] - include/event2/buffer_compat.h [4:24] - include/event2/bufferevent.h [5:25] - include/event2/bufferevent_compat.h [6:26] - include/event2/bufferevent_ssl.h [4:24] - include/event2/bufferevent_struct.h [5:25] - include/event2/dns.h [5:25] - include/event2/dns_compat.h [5:25] - include/event2/dns_struct.h [5:25] - include/event2/event.h [5:25] - include/event2/event_compat.h [5:25] - include/event2/event_struct.h [5:25] - include/event2/http.h [5:25] - include/event2/http_compat.h [5:25] - include/event2/http_struct.h [5:25] - include/event2/keyvalq_struct.h [5:25] - include/event2/listener.h [5:25] - include/event2/rpc.h [5:25] - include/event2/rpc_compat.h [5:25] - include/event2/rpc_struct.h [5:25] - include/event2/tag.h [5:25] - include/event2/tag_compat.h [5:25] - include/event2/thread.h [4:24] - include/event2/util.h [4:24] - include/event2/visibility.h [5:25] - include/evhttp.h [5:25] - include/evrpc.h [5:25] - include/evutil.h [4:24] - iocp-internal.h [4:24] - ipv6-internal.h [4:24] - kqueue-internal.h [4:24] - kqueue.c [7:27] - listener.c [4:24] - log-internal.h [5:25] - minheap-internal.h [6:26] - mm-internal.h [4:24] - poll.c [7:27] - ratelim-internal.h [4:24] - select.c [7:27] - signal.c [7:27] - time-internal.h [5:25] - util-internal.h [4:24] - win32select.c [6:26] - -KEEP BSD-3-Clause 24aa4f16d31cd3a0b1ce6f69c61fc6d1 -BELONGS ya.make - License text: - Libevent is available for use under the following license, commonly known - as the 3-clause (or "modified") BSD license: - Scancode info: - Original SPDX id: BSD-3-Clause - Score : 100.00 - Match type : NOTICE - Links : http://www.opensource.org/licenses/BSD-3-Clause, https://spdx.org/licenses/BSD-3-Clause - Files with this license: - LICENSE [1:2] - -KEEP BSD-3-Clause 2bd53cb7752dbd0ccaa15008374ad93a -BELONGS ya.make - License text: - o Change the BSD license from 4 to 3-clause. (86df3ed Joakim Soderberg) - Scancode info: - Original SPDX id: BSD-3-Clause - Score : 99.00 - Match type : REFERENCE - Links : http://www.opensource.org/licenses/BSD-3-Clause, https://spdx.org/licenses/BSD-3-Clause - Files with this license: - ChangeLog [935:935] - -KEEP BSD-3-Clause 2dc5abaaad0d6b67fcf860d7a06a2cf3 -BELONGS ya.make - License text: - Portions of Libevent are based on works by others, also made available by - them under the three-clause BSD license above. The copyright notices are - Scancode info: - Original SPDX id: BSD-3-Clause - Score : 100.00 - Match type : NOTICE - Links : http://www.opensource.org/licenses/BSD-3-Clause, https://spdx.org/licenses/BSD-3-Clause - Files with this license: - LICENSE [31:32] - -KEEP MIT 5debb370f50e1dfd24ff5144233a2ef6 -BELONGS ya.make - Note: matched license text is too long. Read it in the source files. - Scancode info: - Original SPDX id: MIT - Score : 100.00 - Match type : TEXT - Links : http://opensource.org/licenses/mit-license.php, https://spdx.org/licenses/MIT - Files with this license: - LICENSE [83:99] - -KEEP BSD-3-Clause 6daffccbe81cc81cf1b75435c1342138 -BELONGS ya.make - Note: matched license text is too long. Read it in the source files. - Scancode info: - Original SPDX id: BSD-3-Clause - Score : 100.00 - Match type : TEXT - Links : http://www.opensource.org/licenses/BSD-3-Clause, https://spdx.org/licenses/BSD-3-Clause - Files with this license: - log.c [15:37] - -KEEP BSD-3-Clause 74e7cfa481aeed78f9e1ce584d7eebd2 -BELONGS ya.make - Note: matched license text is too long. Read it in the source files. - Scancode info: - Original SPDX id: BSD-3-Clause - Score : 100.00 - Match type : TEXT - Links : http://www.opensource.org/licenses/BSD-3-Clause, https://spdx.org/licenses/BSD-3-Clause - Files with this license: - evport.c [7:27] - -SKIP LicenseRef-scancode-unknown-license-reference 8ce01b16f6e2e91b1fa0d9d781708ee0 -BELONGS ya.make - License text: - BitTorrent's libUTP library. That code is subject to the following - license: - Scancode info: - Original SPDX id: LicenseRef-scancode-unknown-license-reference - Score : 100.00 - Match type : REFERENCE - Links : https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/unknown-license-reference.LICENSE - Files with this license: - evutil_time.c [461:462] - -KEEP BSD-3-Clause 9032bc92a1ee349e22cdac7b1bdde2cb -BELONGS ya.make - License text: - /* This code is originally from Tor. Used with permission. */ - Scancode info: - Original SPDX id: BSD-3-Clause - Score : 95.00 - Match type : NOTICE - Links : http://www.opensource.org/licenses/BSD-3-Clause, https://spdx.org/licenses/BSD-3-Clause - Files with this license: - evutil.c [215:215] - -KEEP BSD-3-Clause 95d34b24745f43bd8af4e1f7b381e433 -BELONGS ya.make - Note: matched license text is too long. Read it in the source files. - Scancode info: - Original SPDX id: BSD-3-Clause - Score : 100.00 - Match type : TEXT - Links : http://www.opensource.org/licenses/BSD-3-Clause, https://spdx.org/licenses/BSD-3-Clause - Files with this license: - LICENSE [8:28] - -KEEP ISC 9614ebcaadc8e2307131663313f2052f -BELONGS ya.make - Note: matched license text is too long. Read it in the source files. - Scancode info: - Original SPDX id: ISC - Score : 100.00 - Match type : TEXT - Links : http://fedoraproject.org/wiki/Licensing:MIT#Old_Style_with_legal_disclaimer_2, https://spdx.org/licenses/ISC, https://www.isc.org/software/license - Files with this license: - LICENSE [63:73] - -KEEP BSD-3-Clause AND CC-PDDC 9c80eee62ec4471c5059d4e48622bbb3 -BELONGS ya.make - Note: matched license text is too long. Read it in the source files. - Scancode info: - Original SPDX id: BSD-3-Clause - Score : 98.41 - Match type : NOTICE - Links : http://www.opensource.org/licenses/BSD-3-Clause, https://spdx.org/licenses/BSD-3-Clause - Files with this license: - include/event2/dns.h [30:37] - Scancode info: - Original SPDX id: CC-PDDC - Score : 98.41 - Match type : NOTICE - Links : http://creativecommons.org/licenses/publicdomain/, https://creativecommons.org/licenses/publicdomain/, https://spdx.org/licenses/CC-PDDC - Files with this license: - include/event2/dns.h [30:37] - -SKIP LicenseRef-scancode-unknown-license-reference a9642e514f4e64f7e454b6a3454ec27d -BELONGS ya.make - License text: - /* See license at end. */ - Scancode info: - Original SPDX id: LicenseRef-scancode-unknown-license-reference - Score : 100.00 - Match type : REFERENCE - Links : https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/unknown-license-reference.LICENSE - Files with this license: - ht-internal.h [4:4] - -KEEP MIT b4f4a5d5eb47875b1e57b4c13529256d -BELONGS ya.make - License text: - The Windows timer code is based on code from libutp, which is - distributed under this license, sometimes called the "MIT" license. - Scancode info: - Original SPDX id: MIT - Score : 100.00 - Match type : NOTICE - Links : http://opensource.org/licenses/mit-license.php, https://spdx.org/licenses/MIT - Files with this license: - LICENSE [77:78] - -KEEP ISC c17826195ae7a32a1d777262c034dea8 -BELONGS ya.make - License text: - The arc4module is available under the following, sometimes called the - "OpenBSD" license: - Scancode info: - Original SPDX id: ISC - Score : 90.00 - Match type : NOTICE - Links : http://fedoraproject.org/wiki/Licensing:MIT#Old_Style_with_legal_disclaimer_2, https://spdx.org/licenses/ISC, https://www.isc.org/software/license - Files with this license: - LICENSE [57:58] - -KEEP MIT ded5b9658d5a7e7d35aee36414b05084 -BELONGS ya.make - Note: matched license text is too long. Read it in the source files. - Scancode info: - Original SPDX id: MIT - Score : 100.00 - Match type : TEXT - Links : http://opensource.org/licenses/mit-license.php, https://spdx.org/licenses/MIT - Files with this license: - evutil_time.c [466:483] - -KEEP BSD-3-Clause e5c1d5c5af73cf6350449d2bb5bca19a -BELONGS ya.make - Note: matched license text is too long. Read it in the source files. - Scancode info: - Original SPDX id: BSD-3-Clause - Score : 100.00 - Match type : TEXT - Links : http://www.opensource.org/licenses/BSD-3-Clause, https://spdx.org/licenses/BSD-3-Clause - Files with this license: - ht-internal.h [457:483] - -KEEP ISC e6a382fc7564fdd1a5e46b2d97b3221f -BELONGS ya.make - Note: matched license text is too long. Read it in the source files. - Scancode info: - Original SPDX id: ISC - Score : 100.00 - Match type : TEXT - Links : http://fedoraproject.org/wiki/Licensing:MIT#Old_Style_with_legal_disclaimer_2, https://spdx.org/licenses/ISC, https://www.isc.org/software/license - Files with this license: - arc4random.c [14:24] diff --git a/contrib/libs/libevent/.yandex_meta/licenses.list.txt b/contrib/libs/libevent/.yandex_meta/licenses.list.txt deleted file mode 100644 index 7d897a353f8..00000000000 --- a/contrib/libs/libevent/.yandex_meta/licenses.list.txt +++ /dev/null @@ -1,386 +0,0 @@ -====================BSD-3-Clause==================== - /* This code is originally from Tor. Used with permission. */ - - -====================BSD-3-Clause==================== - o Change the BSD license from 4 to 3-clause. (86df3ed Joakim Soderberg) - - -====================BSD-3-Clause==================== - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * * Neither the name of the original author; nor the names of any contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -====================BSD-3-Clause==================== - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - - -====================BSD-3-Clause==================== - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY SUN MICROSYSTEMS, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL SUN MICROSYSTEMS, INC. BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -====================BSD-3-Clause==================== - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -====================BSD-3-Clause==================== -Libevent is available for use under the following license, commonly known -as the 3-clause (or "modified") BSD license: - - -====================BSD-3-Clause==================== -Portions of Libevent are based on works by others, also made available by -them under the three-clause BSD license above. The copyright notices are - - -====================BSD-3-Clause==================== -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. -3. The name of the author may not be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -====================BSD-3-Clause AND CC-PDDC==================== - * modifications by Nick Mathewson. Adam put his DNS software in the - * public domain. You can find his original copyright below. Please, - * aware that the code as part of Libevent is governed by the 3-clause - * BSD license above. - * - * This software is Public Domain. To view a copy of the public domain dedication, - * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to - * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. - - -====================CC-PDDC==================== - * Public Domain code - * - * This software is Public Domain. To view a copy of the public domain dedication, - * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to - * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. - - -====================COPYRIGHT==================== - Copyright (c) 2010 BitTorrent, Inc. - - -====================COPYRIGHT==================== - Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> - - -====================COPYRIGHT==================== - Copyright (c) 2000 Dug Song <dugsong@monkey.org> - Copyright (c) 1993 The Regents of the University of California. - - -====================COPYRIGHT==================== - Copyright (c) 2002 Christopher Clark - - -====================COPYRIGHT==================== - Copyright (c) 2003 Michael A. Davis <mike@datanerds.net> - - -====================COPYRIGHT==================== - Copyright (c) 2006 Maxim Yegorushkin <maxim.yegorushkin@gmail.com> - - -====================COPYRIGHT==================== - * Copyright (c) 1996, David Mazieres <dm@uun.org> - * Copyright (c) 2008, Damien Miller <djm@openbsd.org> - - -====================COPYRIGHT==================== - * Copyright (c) 2000-2007 Niels Provos <provos@citi.umich.edu> - * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson - - -====================COPYRIGHT==================== - * Copyright (c) 2002, Christopher Clark - * All rights reserved. - - -====================COPYRIGHT==================== - * Copyright (c) 2002-2007 Niels Provos <provos@citi.umich.edu> - * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson - - -====================COPYRIGHT==================== - * Copyright (c) 2002-2007 Niels Provos <provos@citi.umich.edu> - * Copyright (c) 2007-2012 Niels Provos, Nick Mathewson - - -====================COPYRIGHT==================== - * Copyright (c) 2003-2009 Niels Provos <provos@citi.umich.edu> - * Copyright (c) 2009-2012 Niels Provos and Nick Mathewson - - -====================COPYRIGHT==================== - * Copyright (c) 2005-2012 Niels Provos and Nick Mathewson - - -====================COPYRIGHT==================== - * Copyright (c) 2006-2007 Niels Provos <provos@citi.umich.edu> - * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson - - -====================COPYRIGHT==================== - * Copyright (c) 2007 Sun Microsystems. All rights reserved. - - -====================COPYRIGHT==================== - * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson - * Copyright (c) 2002-2006 Niels Provos <provos@citi.umich.edu> - * All rights reserved. - - -====================COPYRIGHT==================== - * Copyright (c) 2008-2012 Niels Provos and Nick Mathewson - - -====================COPYRIGHT==================== - * Copyright (c) 2008-2012 Niels Provos, Nick Mathewson - - -====================COPYRIGHT==================== - * Copyright (c) 2009-2012 Niels Provos and Nick Mathewson - - -====================COPYRIGHT==================== - * Copyright (c) 2009-2012 Niels Provos, Nick Mathewson - - -====================COPYRIGHT==================== - * Copyright (c) 2012 Niels Provos and Nick Mathewson - - -====================COPYRIGHT==================== - * Copyright 2000-2007 Niels Provos <provos@citi.umich.edu> - * Copyright 2007-2012 Niels Provos, Nick Mathewson - - -====================COPYRIGHT==================== - * Copyright 2000-2009 Niels Provos <provos@citi.umich.edu> - * Copyright 2009-2012 Niels Provos and Nick Mathewson - - -====================COPYRIGHT==================== - * Copyright 2003-2009 Niels Provos <provos@citi.umich.edu> - * Copyright 2009-2012 Niels Provos and Nick Mathewson - - -====================COPYRIGHT==================== - * Copyright 2005, Nick Mathewson. Implementation logic is adapted from code - * by Christopher Clark, retrofit to allow drop-in memory management, and to - * use the same interface as Niels Provos's tree.h. This is probably still - * a derived work, so the original license below still applies. - - -====================COPYRIGHT==================== - * Copyright 2006-2007 Niels Provos - * Copyright 2007-2012 Niels Provos and Nick Mathewson - - -====================COPYRIGHT==================== - * Copyright 2007-2012 Niels Provos and Nick Mathewson - * Copyright 2000-2007 Niels Provos <provos@citi.umich.edu> - * Copyright 2003 Michael A. Davis <mike@datanerds.net> - - -====================COPYRIGHT==================== - * Portable version by Chris Davis, adapted for Libevent by Nick Mathewson - * Copyright (c) 2010 Chris Davis, Niels Provos, and Nick Mathewson - * Copyright (c) 2010-2012 Niels Provos and Nick Mathewson - - -====================COPYRIGHT==================== -/* Copyright 2002 Christopher Clark */ -/* Copyright 2005-2012 Nick Mathewson */ -/* Copyright 2009-2012 Niels Provos and Nick Mathewson */ -/* See license at end. */ - - -====================COPYRIGHT==================== -/* Copyright 2006-2007 Niels Provos - * Copyright 2007-2012 Nick Mathewson and Niels Provos - - -====================ISC==================== - Permission to use, copy, modify, and distribute this software for any - purpose with or without fee is hereby granted, provided that the above - copyright notice and this permission notice appear in all copies. - - THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - - -====================ISC==================== - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - - -====================ISC==================== -The arc4module is available under the following, sometimes called the -"OpenBSD" license: - - -====================MIT==================== - Permission is hereby granted, free of charge, to any person obtaining a - copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - -====================MIT==================== -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - -====================MIT==================== -The Windows timer code is based on code from libutp, which is -distributed under this license, sometimes called the "MIT" license. diff --git a/contrib/libs/libevent/buffer_iocp.c b/contrib/libs/libevent/buffer_iocp.c deleted file mode 100644 index 2af0c49cc64..00000000000 --- a/contrib/libs/libevent/buffer_iocp.c +++ /dev/null @@ -1,327 +0,0 @@ -/* - * Copyright (c) 2009-2012 Niels Provos and Nick Mathewson - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/** - @file buffer_iocp.c - - This module implements overlapped read and write functions for evbuffer - objects on Windows. -*/ -#include "event2/event-config.h" -#include "evconfig-private.h" - -#include "event2/buffer.h" -#include "event2/buffer_compat.h" -#include "event2/util.h" -#include "event2/thread.h" -#include "util-internal.h" -#include "evthread-internal.h" -#include "evbuffer-internal.h" -#include "iocp-internal.h" -#include "mm-internal.h" - -#include <winsock2.h> -#include <winerror.h> -#include <windows.h> -#include <stdio.h> - -#define MAX_WSABUFS 16 - -/** An evbuffer that can handle overlapped IO. */ -struct evbuffer_overlapped { - struct evbuffer buffer; - /** The socket that we're doing overlapped IO on. */ - evutil_socket_t fd; - - /** pending I/O type */ - unsigned read_in_progress : 1; - unsigned write_in_progress : 1; - - /** The first pinned chain in the buffer. */ - struct evbuffer_chain *first_pinned; - - /** How many chains are pinned; how many of the fields in buffers - * are we using. */ - int n_buffers; - WSABUF buffers[MAX_WSABUFS]; -}; - -/** Given an evbuffer, return the correponding evbuffer structure, or NULL if - * the evbuffer isn't overlapped. */ -static inline struct evbuffer_overlapped * -upcast_evbuffer(struct evbuffer *buf) -{ - if (!buf || !buf->is_overlapped) - return NULL; - return EVUTIL_UPCAST(buf, struct evbuffer_overlapped, buffer); -} - -/** Unpin all the chains noted as pinned in 'eo'. */ -static void -pin_release(struct evbuffer_overlapped *eo, unsigned flag) -{ - int i; - struct evbuffer_chain *next, *chain = eo->first_pinned; - - for (i = 0; i < eo->n_buffers; ++i) { - EVUTIL_ASSERT(chain); - next = chain->next; - evbuffer_chain_unpin_(chain, flag); - chain = next; - } -} - -void -evbuffer_commit_read_(struct evbuffer *evbuf, ev_ssize_t nBytes) -{ - struct evbuffer_overlapped *buf = upcast_evbuffer(evbuf); - struct evbuffer_chain **chainp; - size_t remaining, len; - unsigned i; - - EVBUFFER_LOCK(evbuf); - EVUTIL_ASSERT(buf->read_in_progress && !buf->write_in_progress); - EVUTIL_ASSERT(nBytes >= 0); /* XXXX Can this be false? */ - - evbuffer_unfreeze(evbuf, 0); - - chainp = evbuf->last_with_datap; - if (!((*chainp)->flags & EVBUFFER_MEM_PINNED_R)) - chainp = &(*chainp)->next; - remaining = nBytes; - for (i = 0; remaining > 0 && i < (unsigned)buf->n_buffers; ++i) { - EVUTIL_ASSERT(*chainp); - len = buf->buffers[i].len; - if (remaining < len) - len = remaining; - (*chainp)->off += len; - evbuf->last_with_datap = chainp; - remaining -= len; - chainp = &(*chainp)->next; - } - - pin_release(buf, EVBUFFER_MEM_PINNED_R); - - buf->read_in_progress = 0; - - evbuf->total_len += nBytes; - evbuf->n_add_for_cb += nBytes; - - evbuffer_invoke_callbacks_(evbuf); - - evbuffer_decref_and_unlock_(evbuf); -} - -void -evbuffer_commit_write_(struct evbuffer *evbuf, ev_ssize_t nBytes) -{ - struct evbuffer_overlapped *buf = upcast_evbuffer(evbuf); - - EVBUFFER_LOCK(evbuf); - EVUTIL_ASSERT(buf->write_in_progress && !buf->read_in_progress); - evbuffer_unfreeze(evbuf, 1); - evbuffer_drain(evbuf, nBytes); - pin_release(buf,EVBUFFER_MEM_PINNED_W); - buf->write_in_progress = 0; - evbuffer_decref_and_unlock_(evbuf); -} - -struct evbuffer * -evbuffer_overlapped_new_(evutil_socket_t fd) -{ - struct evbuffer_overlapped *evo; - - evo = mm_calloc(1, sizeof(struct evbuffer_overlapped)); - if (!evo) - return NULL; - - LIST_INIT(&evo->buffer.callbacks); - evo->buffer.refcnt = 1; - evo->buffer.last_with_datap = &evo->buffer.first; - - evo->buffer.is_overlapped = 1; - evo->fd = fd; - - return &evo->buffer; -} - -int -evbuffer_launch_write_(struct evbuffer *buf, ev_ssize_t at_most, - struct event_overlapped *ol) -{ - struct evbuffer_overlapped *buf_o = upcast_evbuffer(buf); - int r = -1; - int i; - struct evbuffer_chain *chain; - DWORD bytesSent; - - if (!buf) { - /* No buffer, or it isn't overlapped */ - return -1; - } - - EVBUFFER_LOCK(buf); - EVUTIL_ASSERT(!buf_o->read_in_progress); - if (buf->freeze_start || buf_o->write_in_progress) - goto done; - if (!buf->total_len) { - /* Nothing to write */ - r = 0; - goto done; - } else if (at_most < 0 || (size_t)at_most > buf->total_len) { - at_most = buf->total_len; - } - evbuffer_freeze(buf, 1); - - buf_o->first_pinned = NULL; - buf_o->n_buffers = 0; - memset(buf_o->buffers, 0, sizeof(buf_o->buffers)); - - chain = buf_o->first_pinned = buf->first; - - for (i=0; i < MAX_WSABUFS && chain; ++i, chain=chain->next) { - WSABUF *b = &buf_o->buffers[i]; - b->buf = (char*)( chain->buffer + chain->misalign ); - evbuffer_chain_pin_(chain, EVBUFFER_MEM_PINNED_W); - - if ((size_t)at_most > chain->off) { - /* XXXX Cast is safe for now, since win32 has no - mmaped chains. But later, we need to have this - add more WSAbufs if chain->off is greater than - ULONG_MAX */ - b->len = (unsigned long)chain->off; - at_most -= chain->off; - } else { - b->len = (unsigned long)at_most; - ++i; - break; - } - } - - buf_o->n_buffers = i; - evbuffer_incref_(buf); - if (WSASend(buf_o->fd, buf_o->buffers, i, &bytesSent, 0, - &ol->overlapped, NULL)) { - int error = WSAGetLastError(); - if (error != WSA_IO_PENDING) { - /* An actual error. */ - pin_release(buf_o, EVBUFFER_MEM_PINNED_W); - evbuffer_unfreeze(buf, 1); - evbuffer_free(buf); /* decref */ - goto done; - } - } - - buf_o->write_in_progress = 1; - r = 0; -done: - EVBUFFER_UNLOCK(buf); - return r; -} - -int -evbuffer_launch_read_(struct evbuffer *buf, size_t at_most, - struct event_overlapped *ol) -{ - struct evbuffer_overlapped *buf_o = upcast_evbuffer(buf); - int r = -1, i; - int nvecs; - int npin=0; - struct evbuffer_chain *chain=NULL, **chainp; - DWORD bytesRead; - DWORD flags = 0; - struct evbuffer_iovec vecs[MAX_WSABUFS]; - - if (!buf_o) - return -1; - EVBUFFER_LOCK(buf); - EVUTIL_ASSERT(!buf_o->write_in_progress); - if (buf->freeze_end || buf_o->read_in_progress) - goto done; - - buf_o->first_pinned = NULL; - buf_o->n_buffers = 0; - memset(buf_o->buffers, 0, sizeof(buf_o->buffers)); - - if (evbuffer_expand_fast_(buf, at_most, MAX_WSABUFS) == -1) - goto done; - evbuffer_freeze(buf, 0); - - nvecs = evbuffer_read_setup_vecs_(buf, at_most, - vecs, MAX_WSABUFS, &chainp, 1); - for (i=0;i<nvecs;++i) { - WSABUF_FROM_EVBUFFER_IOV( - &buf_o->buffers[i], - &vecs[i]); - } - - buf_o->n_buffers = nvecs; - buf_o->first_pinned = chain = *chainp; - - npin=0; - for ( ; chain; chain = chain->next) { - evbuffer_chain_pin_(chain, EVBUFFER_MEM_PINNED_R); - ++npin; - } - EVUTIL_ASSERT(npin == nvecs); - - evbuffer_incref_(buf); - if (WSARecv(buf_o->fd, buf_o->buffers, nvecs, &bytesRead, &flags, - &ol->overlapped, NULL)) { - int error = WSAGetLastError(); - if (error != WSA_IO_PENDING) { - /* An actual error. */ - pin_release(buf_o, EVBUFFER_MEM_PINNED_R); - evbuffer_unfreeze(buf, 0); - evbuffer_free(buf); /* decref */ - goto done; - } - } - - buf_o->read_in_progress = 1; - r = 0; -done: - EVBUFFER_UNLOCK(buf); - return r; -} - -evutil_socket_t -evbuffer_overlapped_get_fd_(struct evbuffer *buf) -{ - struct evbuffer_overlapped *buf_o = upcast_evbuffer(buf); - return buf_o ? buf_o->fd : -1; -} - -void -evbuffer_overlapped_set_fd_(struct evbuffer *buf, evutil_socket_t fd) -{ - struct evbuffer_overlapped *buf_o = upcast_evbuffer(buf); - EVBUFFER_LOCK(buf); - /* XXX is this right?, should it cancel current I/O operations? */ - if (buf_o) - buf_o->fd = fd; - EVBUFFER_UNLOCK(buf); -} diff --git a/contrib/libs/libevent/bufferevent_async.c b/contrib/libs/libevent/bufferevent_async.c deleted file mode 100644 index 40c7c5e8d0d..00000000000 --- a/contrib/libs/libevent/bufferevent_async.c +++ /dev/null @@ -1,706 +0,0 @@ -/* - * Copyright (c) 2009-2012 Niels Provos and Nick Mathewson - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "event2/event-config.h" -#include "evconfig-private.h" - -#ifdef EVENT__HAVE_SYS_TIME_H -#include <sys/time.h> -#endif - -#include <errno.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#ifdef EVENT__HAVE_STDARG_H -#include <stdarg.h> -#endif -#ifdef EVENT__HAVE_UNISTD_H -#include <unistd.h> -#endif - -#ifdef _WIN32 -#include <winsock2.h> -#include <winerror.h> -#include <ws2tcpip.h> -#endif - -#include <sys/queue.h> - -#include "event2/util.h" -#include "event2/bufferevent.h" -#include "event2/buffer.h" -#include "event2/bufferevent_struct.h" -#include "event2/event.h" -#include "event2/util.h" -#include "event-internal.h" -#include "log-internal.h" -#include "mm-internal.h" -#include "bufferevent-internal.h" -#include "util-internal.h" -#include "iocp-internal.h" - -#ifndef SO_UPDATE_CONNECT_CONTEXT -/* Mingw is sometimes missing this */ -#define SO_UPDATE_CONNECT_CONTEXT 0x7010 -#endif - -/* prototypes */ -static int be_async_enable(struct bufferevent *, short); -static int be_async_disable(struct bufferevent *, short); -static void be_async_destruct(struct bufferevent *); -static int be_async_flush(struct bufferevent *, short, enum bufferevent_flush_mode); -static int be_async_ctrl(struct bufferevent *, enum bufferevent_ctrl_op, union bufferevent_ctrl_data *); - -struct bufferevent_async { - struct bufferevent_private bev; - struct event_overlapped connect_overlapped; - struct event_overlapped read_overlapped; - struct event_overlapped write_overlapped; - size_t read_in_progress; - size_t write_in_progress; - unsigned ok : 1; - unsigned read_added : 1; - unsigned write_added : 1; -}; - -const struct bufferevent_ops bufferevent_ops_async = { - "socket_async", - evutil_offsetof(struct bufferevent_async, bev.bev), - be_async_enable, - be_async_disable, - NULL, /* Unlink */ - be_async_destruct, - bufferevent_generic_adj_timeouts_, - be_async_flush, - be_async_ctrl, -}; - -static inline void -be_async_run_eventcb(struct bufferevent *bev, short what, int options) -{ bufferevent_run_eventcb_(bev, what, options|BEV_TRIG_DEFER_CALLBACKS); } - -static inline void -be_async_trigger_nolock(struct bufferevent *bev, short what, int options) -{ bufferevent_trigger_nolock_(bev, what, options|BEV_TRIG_DEFER_CALLBACKS); } - -static inline int -fatal_error(int err) -{ - switch (err) { - /* We may have already associated this fd with a port. - * Let's hope it's this port, and that the error code - * for doing this neer changes. */ - case ERROR_INVALID_PARAMETER: - return 0; - } - return 1; -} - -static inline struct bufferevent_async * -upcast(struct bufferevent *bev) -{ - struct bufferevent_async *bev_a; - if (!BEV_IS_ASYNC(bev)) - return NULL; - bev_a = EVUTIL_UPCAST(bev, struct bufferevent_async, bev.bev); - return bev_a; -} - -static inline struct bufferevent_async * -upcast_connect(struct event_overlapped *eo) -{ - struct bufferevent_async *bev_a; - bev_a = EVUTIL_UPCAST(eo, struct bufferevent_async, connect_overlapped); - EVUTIL_ASSERT(BEV_IS_ASYNC(&bev_a->bev.bev)); - return bev_a; -} - -static inline struct bufferevent_async * -upcast_read(struct event_overlapped *eo) -{ - struct bufferevent_async *bev_a; - bev_a = EVUTIL_UPCAST(eo, struct bufferevent_async, read_overlapped); - EVUTIL_ASSERT(BEV_IS_ASYNC(&bev_a->bev.bev)); - return bev_a; -} - -static inline struct bufferevent_async * -upcast_write(struct event_overlapped *eo) -{ - struct bufferevent_async *bev_a; - bev_a = EVUTIL_UPCAST(eo, struct bufferevent_async, write_overlapped); - EVUTIL_ASSERT(BEV_IS_ASYNC(&bev_a->bev.bev)); - return bev_a; -} - -static void -bev_async_del_write(struct bufferevent_async *beva) -{ - struct bufferevent *bev = &beva->bev.bev; - - if (beva->write_added) { - beva->write_added = 0; - event_base_del_virtual_(bev->ev_base); - } -} - -static void -bev_async_del_read(struct bufferevent_async *beva) -{ - struct bufferevent *bev = &beva->bev.bev; - - if (beva->read_added) { - beva->read_added = 0; - event_base_del_virtual_(bev->ev_base); - } -} - -static void -bev_async_add_write(struct bufferevent_async *beva) -{ - struct bufferevent *bev = &beva->bev.bev; - - if (!beva->write_added) { - beva->write_added = 1; - event_base_add_virtual_(bev->ev_base); - } -} - -static void -bev_async_add_read(struct bufferevent_async *beva) -{ - struct bufferevent *bev = &beva->bev.bev; - - if (!beva->read_added) { - beva->read_added = 1; - event_base_add_virtual_(bev->ev_base); - } -} - -static void -bev_async_consider_writing(struct bufferevent_async *beva) -{ - size_t at_most; - int limit; - struct bufferevent *bev = &beva->bev.bev; - - /* Don't write if there's a write in progress, or we do not - * want to write, or when there's nothing left to write. */ - if (beva->write_in_progress || beva->bev.connecting) - return; - if (!beva->ok || !(bev->enabled&EV_WRITE) || - !evbuffer_get_length(bev->output)) { - bev_async_del_write(beva); - return; - } - - at_most = evbuffer_get_length(bev->output); - - /* This is safe so long as bufferevent_get_write_max never returns - * more than INT_MAX. That's true for now. XXXX */ - limit = (int)bufferevent_get_write_max_(&beva->bev); - if (at_most >= (size_t)limit && limit >= 0) - at_most = limit; - - if (beva->bev.write_suspended) { - bev_async_del_write(beva); - return; - } - - /* XXXX doesn't respect low-water mark very well. */ - bufferevent_incref_(bev); - if (evbuffer_launch_write_(bev->output, at_most, - &beva->write_overlapped)) { - bufferevent_decref_(bev); - beva->ok = 0; - be_async_run_eventcb(bev, BEV_EVENT_ERROR, 0); - } else { - beva->write_in_progress = at_most; - bufferevent_decrement_write_buckets_(&beva->bev, at_most); - bev_async_add_write(beva); - } -} - -static void -bev_async_consider_reading(struct bufferevent_async *beva) -{ - size_t cur_size; - size_t read_high; - size_t at_most; - int limit; - struct bufferevent *bev = &beva->bev.bev; - - /* Don't read if there is a read in progress, or we do not - * want to read. */ - if (beva->read_in_progress || beva->bev.connecting) - return; - if (!beva->ok || !(bev->enabled&EV_READ)) { - bev_async_del_read(beva); - return; - } - - /* Don't read if we're full */ - cur_size = evbuffer_get_length(bev->input); - read_high = bev->wm_read.high; - if (read_high) { - if (cur_size >= read_high) { - bev_async_del_read(beva); - return; - } - at_most = read_high - cur_size; - } else { - at_most = 16384; /* FIXME totally magic. */ - } - - /* XXXX This over-commits. */ - /* XXXX see also not above on cast on bufferevent_get_write_max_() */ - limit = (int)bufferevent_get_read_max_(&beva->bev); - if (at_most >= (size_t)limit && limit >= 0) - at_most = limit; - - if (beva->bev.read_suspended) { - bev_async_del_read(beva); - return; - } - - bufferevent_incref_(bev); - if (evbuffer_launch_read_(bev->input, at_most, &beva->read_overlapped)) { - beva->ok = 0; - be_async_run_eventcb(bev, BEV_EVENT_ERROR, 0); - bufferevent_decref_(bev); - } else { - beva->read_in_progress = at_most; - bufferevent_decrement_read_buckets_(&beva->bev, at_most); - bev_async_add_read(beva); - } - - return; -} - -static void -be_async_outbuf_callback(struct evbuffer *buf, - const struct evbuffer_cb_info *cbinfo, - void *arg) -{ - struct bufferevent *bev = arg; - struct bufferevent_async *bev_async = upcast(bev); - - /* If we added data to the outbuf and were not writing before, - * we may want to write now. */ - - bufferevent_incref_and_lock_(bev); - - if (cbinfo->n_added) - bev_async_consider_writing(bev_async); - - bufferevent_decref_and_unlock_(bev); -} - -static void -be_async_inbuf_callback(struct evbuffer *buf, - const struct evbuffer_cb_info *cbinfo, - void *arg) -{ - struct bufferevent *bev = arg; - struct bufferevent_async *bev_async = upcast(bev); - - /* If we drained data from the inbuf and were not reading before, - * we may want to read now */ - - bufferevent_incref_and_lock_(bev); - - if (cbinfo->n_deleted) - bev_async_consider_reading(bev_async); - - bufferevent_decref_and_unlock_(bev); -} - -static int -be_async_enable(struct bufferevent *buf, short what) -{ - struct bufferevent_async *bev_async = upcast(buf); - - if (!bev_async->ok) - return -1; - - if (bev_async->bev.connecting) { - /* Don't launch anything during connection attempts. */ - return 0; - } - - if (what & EV_READ) - BEV_RESET_GENERIC_READ_TIMEOUT(buf); - if (what & EV_WRITE) - BEV_RESET_GENERIC_WRITE_TIMEOUT(buf); - - /* If we newly enable reading or writing, and we aren't reading or - writing already, consider launching a new read or write. */ - - if (what & EV_READ) - bev_async_consider_reading(bev_async); - if (what & EV_WRITE) - bev_async_consider_writing(bev_async); - return 0; -} - -static int -be_async_disable(struct bufferevent *bev, short what) -{ - struct bufferevent_async *bev_async = upcast(bev); - /* XXXX If we disable reading or writing, we may want to consider - * canceling any in-progress read or write operation, though it might - * not work. */ - - if (what & EV_READ) { - BEV_DEL_GENERIC_READ_TIMEOUT(bev); - bev_async_del_read(bev_async); - } - if (what & EV_WRITE) { - BEV_DEL_GENERIC_WRITE_TIMEOUT(bev); - bev_async_del_write(bev_async); - } - - return 0; -} - -static void -be_async_destruct(struct bufferevent *bev) -{ - struct bufferevent_async *bev_async = upcast(bev); - struct bufferevent_private *bev_p = BEV_UPCAST(bev); - evutil_socket_t fd; - - EVUTIL_ASSERT(!upcast(bev)->write_in_progress && - !upcast(bev)->read_in_progress); - - bev_async_del_read(bev_async); - bev_async_del_write(bev_async); - - fd = evbuffer_overlapped_get_fd_(bev->input); - if (fd != (evutil_socket_t)EVUTIL_INVALID_SOCKET && - (bev_p->options & BEV_OPT_CLOSE_ON_FREE)) { - evutil_closesocket(fd); - evbuffer_overlapped_set_fd_(bev->input, EVUTIL_INVALID_SOCKET); - } -} - -/* GetQueuedCompletionStatus doesn't reliably yield WSA error codes, so - * we use WSAGetOverlappedResult to translate. */ -static void -bev_async_set_wsa_error(struct bufferevent *bev, struct event_overlapped *eo) -{ - DWORD bytes, flags; - evutil_socket_t fd; - - fd = evbuffer_overlapped_get_fd_(bev->input); - WSAGetOverlappedResult(fd, &eo->overlapped, &bytes, FALSE, &flags); -} - -static int -be_async_flush(struct bufferevent *bev, short what, - enum bufferevent_flush_mode mode) -{ - return 0; -} - -static void -connect_complete(struct event_overlapped *eo, ev_uintptr_t key, - ev_ssize_t nbytes, int ok) -{ - struct bufferevent_async *bev_a = upcast_connect(eo); - struct bufferevent *bev = &bev_a->bev.bev; - evutil_socket_t sock; - - BEV_LOCK(bev); - - EVUTIL_ASSERT(bev_a->bev.connecting); - bev_a->bev.connecting = 0; - sock = evbuffer_overlapped_get_fd_(bev_a->bev.bev.input); - /* XXXX Handle error? */ - setsockopt(sock, SOL_SOCKET, SO_UPDATE_CONNECT_CONTEXT, NULL, 0); - - if (ok) - bufferevent_async_set_connected_(bev); - else - bev_async_set_wsa_error(bev, eo); - - be_async_run_eventcb(bev, ok ? BEV_EVENT_CONNECTED : BEV_EVENT_ERROR, 0); - - event_base_del_virtual_(bev->ev_base); - - bufferevent_decref_and_unlock_(bev); -} - -static void -read_complete(struct event_overlapped *eo, ev_uintptr_t key, - ev_ssize_t nbytes, int ok) -{ - struct bufferevent_async *bev_a = upcast_read(eo); - struct bufferevent *bev = &bev_a->bev.bev; - short what = BEV_EVENT_READING; - ev_ssize_t amount_unread; - BEV_LOCK(bev); - EVUTIL_ASSERT(bev_a->read_in_progress); - - amount_unread = bev_a->read_in_progress - nbytes; - evbuffer_commit_read_(bev->input, nbytes); - bev_a->read_in_progress = 0; - if (amount_unread) - bufferevent_decrement_read_buckets_(&bev_a->bev, -amount_unread); - - if (!ok) - bev_async_set_wsa_error(bev, eo); - - if (bev_a->ok) { - if (ok && nbytes) { - BEV_RESET_GENERIC_READ_TIMEOUT(bev); - be_async_trigger_nolock(bev, EV_READ, 0); - bev_async_consider_reading(bev_a); - } else if (!ok) { - what |= BEV_EVENT_ERROR; - bev_a->ok = 0; - be_async_run_eventcb(bev, what, 0); - } else if (!nbytes) { - what |= BEV_EVENT_EOF; - bev_a->ok = 0; - be_async_run_eventcb(bev, what, 0); - } - } - - bufferevent_decref_and_unlock_(bev); -} - -static void -write_complete(struct event_overlapped *eo, ev_uintptr_t key, - ev_ssize_t nbytes, int ok) -{ - struct bufferevent_async *bev_a = upcast_write(eo); - struct bufferevent *bev = &bev_a->bev.bev; - short what = BEV_EVENT_WRITING; - ev_ssize_t amount_unwritten; - - BEV_LOCK(bev); - EVUTIL_ASSERT(bev_a->write_in_progress); - - amount_unwritten = bev_a->write_in_progress - nbytes; - evbuffer_commit_write_(bev->output, nbytes); - bev_a->write_in_progress = 0; - - if (amount_unwritten) - bufferevent_decrement_write_buckets_(&bev_a->bev, - -amount_unwritten); - - - if (!ok) - bev_async_set_wsa_error(bev, eo); - - if (bev_a->ok) { - if (ok && nbytes) { - BEV_RESET_GENERIC_WRITE_TIMEOUT(bev); - be_async_trigger_nolock(bev, EV_WRITE, 0); - bev_async_consider_writing(bev_a); - } else if (!ok) { - what |= BEV_EVENT_ERROR; - bev_a->ok = 0; - be_async_run_eventcb(bev, what, 0); - } else if (!nbytes) { - what |= BEV_EVENT_EOF; - bev_a->ok = 0; - be_async_run_eventcb(bev, what, 0); - } - } - - bufferevent_decref_and_unlock_(bev); -} - -struct bufferevent * -bufferevent_async_new_(struct event_base *base, - evutil_socket_t fd, int options) -{ - struct bufferevent_async *bev_a; - struct bufferevent *bev; - struct event_iocp_port *iocp; - - options |= BEV_OPT_THREADSAFE; - - if (!(iocp = event_base_get_iocp_(base))) - return NULL; - - if (fd >= 0 && event_iocp_port_associate_(iocp, fd, 1)<0) { - if (fatal_error(GetLastError())) - return NULL; - } - - if (!(bev_a = mm_calloc(1, sizeof(struct bufferevent_async)))) - return NULL; - - bev = &bev_a->bev.bev; - if (!(bev->input = evbuffer_overlapped_new_(fd))) { - mm_free(bev_a); - return NULL; - } - if (!(bev->output = evbuffer_overlapped_new_(fd))) { - evbuffer_free(bev->input); - mm_free(bev_a); - return NULL; - } - - if (bufferevent_init_common_(&bev_a->bev, base, &bufferevent_ops_async, - options)<0) - goto err; - - evbuffer_add_cb(bev->input, be_async_inbuf_callback, bev); - evbuffer_add_cb(bev->output, be_async_outbuf_callback, bev); - - event_overlapped_init_(&bev_a->connect_overlapped, connect_complete); - event_overlapped_init_(&bev_a->read_overlapped, read_complete); - event_overlapped_init_(&bev_a->write_overlapped, write_complete); - - bufferevent_init_generic_timeout_cbs_(bev); - - bev_a->ok = fd >= 0; - - return bev; -err: - bufferevent_free(&bev_a->bev.bev); - return NULL; -} - -void -bufferevent_async_set_connected_(struct bufferevent *bev) -{ - struct bufferevent_async *bev_async = upcast(bev); - bev_async->ok = 1; - /* Now's a good time to consider reading/writing */ - be_async_enable(bev, bev->enabled); -} - -int -bufferevent_async_can_connect_(struct bufferevent *bev) -{ - const struct win32_extension_fns *ext = - event_get_win32_extension_fns_(); - - if (BEV_IS_ASYNC(bev) && - event_base_get_iocp_(bev->ev_base) && - ext && ext->ConnectEx) - return 1; - - return 0; -} - -int -bufferevent_async_connect_(struct bufferevent *bev, evutil_socket_t fd, - const struct sockaddr *sa, int socklen) -{ - BOOL rc; - struct bufferevent_async *bev_async = upcast(bev); - struct sockaddr_storage ss; - const struct win32_extension_fns *ext = - event_get_win32_extension_fns_(); - - EVUTIL_ASSERT(ext && ext->ConnectEx && fd >= 0 && sa != NULL); - - /* ConnectEx() requires that the socket be bound to an address - * with bind() before using, otherwise it will fail. We attempt - * to issue a bind() here, taking into account that the error - * code is set to WSAEINVAL when the socket is already bound. */ - memset(&ss, 0, sizeof(ss)); - if (sa->sa_family == AF_INET) { - struct sockaddr_in *sin = (struct sockaddr_in *)&ss; - sin->sin_family = AF_INET; - sin->sin_addr.s_addr = INADDR_ANY; - } else if (sa->sa_family == AF_INET6) { - struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)&ss; - sin6->sin6_family = AF_INET6; - sin6->sin6_addr = in6addr_any; - } else { - /* Well, the user will have to bind() */ - return -1; - } - if (bind(fd, (struct sockaddr *)&ss, sizeof(ss)) < 0 && - WSAGetLastError() != WSAEINVAL) - return -1; - - event_base_add_virtual_(bev->ev_base); - bufferevent_incref_(bev); - rc = ext->ConnectEx(fd, sa, socklen, NULL, 0, NULL, - &bev_async->connect_overlapped.overlapped); - if (rc || WSAGetLastError() == ERROR_IO_PENDING) - return 0; - - event_base_del_virtual_(bev->ev_base); - bufferevent_decref_(bev); - - return -1; -} - -static int -be_async_ctrl(struct bufferevent *bev, enum bufferevent_ctrl_op op, - union bufferevent_ctrl_data *data) -{ - switch (op) { - case BEV_CTRL_GET_FD: - data->fd = evbuffer_overlapped_get_fd_(bev->input); - return 0; - case BEV_CTRL_SET_FD: { - struct bufferevent_async *bev_a = upcast(bev); - struct event_iocp_port *iocp; - - if (data->fd == evbuffer_overlapped_get_fd_(bev->input)) - return 0; - if (!(iocp = event_base_get_iocp_(bev->ev_base))) - return -1; - if (event_iocp_port_associate_(iocp, data->fd, 1) < 0) { - if (fatal_error(GetLastError())) - return -1; - } - evbuffer_overlapped_set_fd_(bev->input, data->fd); - evbuffer_overlapped_set_fd_(bev->output, data->fd); - bev_a->ok = data->fd >= 0; - return 0; - } - case BEV_CTRL_CANCEL_ALL: { - struct bufferevent_async *bev_a = upcast(bev); - evutil_socket_t fd = evbuffer_overlapped_get_fd_(bev->input); - if (fd != (evutil_socket_t)EVUTIL_INVALID_SOCKET && - (bev_a->bev.options & BEV_OPT_CLOSE_ON_FREE)) { - closesocket(fd); - evbuffer_overlapped_set_fd_(bev->input, EVUTIL_INVALID_SOCKET); - } - bev_a->ok = 0; - return 0; - } - case BEV_CTRL_GET_UNDERLYING: - default: - return -1; - } -} - - diff --git a/contrib/libs/libevent/config.h b/contrib/libs/libevent/config.h deleted file mode 100644 index 8b875920522..00000000000 --- a/contrib/libs/libevent/config.h +++ /dev/null @@ -1,555 +0,0 @@ -/* config.h. Generated from config.h.in by configure. */ -/* config.h.in. Generated from configure.ac by autoheader. */ - -/* Define if libevent should build without support for a debug mode */ -/* #undef DISABLE_DEBUG_MODE */ - -/* Define if libevent should not allow replacing the mm functions */ -/* #undef DISABLE_MM_REPLACEMENT */ - -/* Define if libevent should not be compiled with thread support */ -/* #undef DISABLE_THREAD_SUPPORT */ - -/* Define to 1 if you have the `accept4' function. */ -#define HAVE_ACCEPT4 1 - -/* Define to 1 if you have the <afunix.h> header file. */ -/* #undef HAVE_AFUNIX_H */ - -/* Define to 1 if you have the `arc4random' function. */ -/* #undef HAVE_ARC4RANDOM */ - -/* Define to 1 if you have the `arc4random_addrandom' function. */ -/* #undef HAVE_ARC4RANDOM_ADDRANDOM */ - -/* Define to 1 if you have the `arc4random_buf' function. */ -/* #undef HAVE_ARC4RANDOM_BUF */ - -/* Define to 1 if you have the <arpa/inet.h> header file. */ -#define HAVE_ARPA_INET_H 1 - -/* Define to 1 if you have the `clock_gettime' function. */ -#define HAVE_CLOCK_GETTIME 1 - -/* Define to 1 if you have the declaration of `CTL_KERN', and to 0 if you - don't. */ -/* #undef HAVE_DECL_CTL_KERN */ - -/* Define to 1 if you have the declaration of `KERN_ARND', and to 0 if you - don't. */ -/* #undef HAVE_DECL_KERN_ARND */ - -/* Define if /dev/poll is available */ -/* #undef HAVE_DEVPOLL */ - -/* Define to 1 if you have the <dlfcn.h> header file. */ -#define HAVE_DLFCN_H 1 - -/* Define if your system supports the epoll system calls */ -#define HAVE_EPOLL 1 - -/* Define to 1 if you have the `epoll_create1' function. */ -#define HAVE_EPOLL_CREATE1 1 - -/* Define to 1 if you have the `epoll_ctl' function. */ -#define HAVE_EPOLL_CTL 1 - -/* Define to 1 if you have the <errno.h> header file. */ -#define HAVE_ERRNO_H 1 - -/* Define to 1 if you have the `eventfd' function. */ -#define HAVE_EVENTFD 1 - -/* Define if your system supports event ports */ -/* #undef HAVE_EVENT_PORTS */ - -/* Define to 1 if you have the `fcntl' function. */ -#define HAVE_FCNTL 1 - -/* Define to 1 if you have the <fcntl.h> header file. */ -#define HAVE_FCNTL_H 1 - -/* Define to 1 if the system has the type `fd_mask'. */ -#define HAVE_FD_MASK 1 - -/* Do we have getaddrinfo()? */ -#define HAVE_GETADDRINFO 1 - -/* Define to 1 if you have the `getegid' function. */ -#define HAVE_GETEGID 1 - -/* Define to 1 if you have the `geteuid' function. */ -#define HAVE_GETEUID 1 - -/* Define this if you have any gethostbyname_r() */ -/* #undef HAVE_GETHOSTBYNAME_R */ - -/* Define this if gethostbyname_r takes 3 arguments */ -/* #undef HAVE_GETHOSTBYNAME_R_3_ARG */ - -/* Define this if gethostbyname_r takes 5 arguments */ -/* #undef HAVE_GETHOSTBYNAME_R_5_ARG */ - -/* Define this if gethostbyname_r takes 6 arguments */ -/* #undef HAVE_GETHOSTBYNAME_R_6_ARG */ - -/* Define to 1 if you have the `getifaddrs' function. */ -#define HAVE_GETIFADDRS 1 - -/* Define to 1 if you have the `getnameinfo' function. */ -#define HAVE_GETNAMEINFO 1 - -/* Define to 1 if you have the `getprotobynumber' function. */ -#define HAVE_GETPROTOBYNUMBER 1 - -/* Define to 1 if you have the `getrandom' function. */ -#define HAVE_GETRANDOM 1 - -/* Define to 1 if you have the `getservbyname' function. */ -#define HAVE_GETSERVBYNAME 1 - -/* Define to 1 if you have the `gettimeofday' function. */ -#define HAVE_GETTIMEOFDAY 1 - -/* Define to 1 if you have the <ifaddrs.h> header file. */ -#define HAVE_IFADDRS_H 1 - -/* Define to 1 if you have the `inet_ntop' function. */ -#define HAVE_INET_NTOP 1 - -/* Define to 1 if you have the `inet_pton' function. */ -#define HAVE_INET_PTON 1 - -/* Define to 1 if you have the <inttypes.h> header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define to 1 if you have the `issetugid' function. */ -/* #undef HAVE_ISSETUGID */ - -/* Define to 1 if you have the `kqueue' function. */ -/* #undef HAVE_KQUEUE */ - -/* Define to 1 if you have the `ws2_32' library (-lws2_32). */ -/* #undef HAVE_LIBWS2_32 */ - -/* Define if the system has zlib */ -#define HAVE_LIBZ 1 - -/* Define to 1 if you have the `mach_absolute_time' function. */ -/* #undef HAVE_MACH_ABSOLUTE_TIME */ - -/* Define to 1 if you have the <mach/mach.h> header file. */ -/* #undef HAVE_MACH_MACH_H */ - -/* Define to 1 if you have the <mach/mach_time.h> header file. */ -/* #undef HAVE_MACH_MACH_TIME_H */ - -/* Define to 1 if you have the <memory.h> header file. */ -#define HAVE_MEMORY_H 1 - -/* Define to 1 if you have the `mmap' function. */ -#define HAVE_MMAP 1 - -/* Define to 1 if you have the `nanosleep' function. */ -#define HAVE_NANOSLEEP 1 - -/* Define to 1 if you have the <netdb.h> header file. */ -#define HAVE_NETDB_H 1 - -/* Define to 1 if you have the <netinet/in6.h> header file. */ -/* #undef HAVE_NETINET_IN6_H */ - -/* Define to 1 if you have the <netinet/in.h> header file. */ -#define HAVE_NETINET_IN_H 1 - -/* Define to 1 if you have the <netinet/tcp.h> header file. */ -#define HAVE_NETINET_TCP_H 1 - -/* Define if the system has openssl */ -#define HAVE_OPENSSL 1 - -/* Define to 1 if you have the <openssl/ssl.h> header file. */ -#define HAVE_OPENSSL_SSL_H 1 - -/* Define to 1 if you have the `pipe' function. */ -#define HAVE_PIPE 1 - -/* Define to 1 if you have the `pipe2' function. */ -#define HAVE_PIPE2 1 - -/* Define to 1 if you have the `poll' function. */ -#define HAVE_POLL 1 - -/* Define to 1 if you have the <poll.h> header file. */ -#define HAVE_POLL_H 1 - -/* Define to 1 if you have the `port_create' function. */ -/* #undef HAVE_PORT_CREATE */ - -/* Define to 1 if you have the <port.h> header file. */ -/* #undef HAVE_PORT_H */ - -/* Define if you have POSIX threads libraries and header files. */ -/* #undef HAVE_PTHREAD */ - -/* Define if we have pthreads on this system */ -#define HAVE_PTHREADS 1 - -/* Define to 1 if you have the `putenv' function. */ -#define HAVE_PUTENV 1 - -/* Define to 1 if the system has the type `sa_family_t'. */ -#define HAVE_SA_FAMILY_T 1 - -/* Define to 1 if you have the `select' function. */ -#define HAVE_SELECT 1 - -/* Define to 1 if you have the `sendfile' function. */ -#define HAVE_SENDFILE 1 - -/* Define to 1 if you have the `setenv' function. */ -#define HAVE_SETENV 1 - -/* Define if F_SETFD is defined in <fcntl.h> */ -#define HAVE_SETFD 1 - -/* Define to 1 if you have the `setrlimit' function. */ -#define HAVE_SETRLIMIT 1 - -/* Define to 1 if you have the `sigaction' function. */ -#define HAVE_SIGACTION 1 - -/* Define to 1 if you have the `signal' function. */ -#define HAVE_SIGNAL 1 - -/* Define to 1 if you have the `splice' function. */ -#define HAVE_SPLICE 1 - -/* Define to 1 if you have the <stdarg.h> header file. */ -#define HAVE_STDARG_H 1 - -/* Define to 1 if you have the <stddef.h> header file. */ -#define HAVE_STDDEF_H 1 - -/* Define to 1 if you have the <stdint.h> header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the <stdlib.h> header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the <strings.h> header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the <string.h> header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the `strlcpy' function. */ -/* #undef HAVE_STRLCPY */ - -/* Define to 1 if you have the `strsep' function. */ -#define HAVE_STRSEP 1 - -/* Define to 1 if you have the `strtok_r' function. */ -#define HAVE_STRTOK_R 1 - -/* Define to 1 if you have the `strtoll' function. */ -#define HAVE_STRTOLL 1 - -/* Define to 1 if the system has the type `struct addrinfo'. */ -#define HAVE_STRUCT_ADDRINFO 1 - -/* Define to 1 if the system has the type `struct in6_addr'. */ -#define HAVE_STRUCT_IN6_ADDR 1 - -/* Define to 1 if `s6_addr16' is a member of `struct in6_addr'. */ -#define HAVE_STRUCT_IN6_ADDR_S6_ADDR16 1 - -/* Define to 1 if `s6_addr32' is a member of `struct in6_addr'. */ -#define HAVE_STRUCT_IN6_ADDR_S6_ADDR32 1 - -/* Define to 1 if the system has the type `struct linger'. */ -#define HAVE_STRUCT_LINGER 1 - -/* Define to 1 if the system has the type `struct sockaddr_in6'. */ -#define HAVE_STRUCT_SOCKADDR_IN6 1 - -/* Define to 1 if `sin6_len' is a member of `struct sockaddr_in6'. */ -/* #undef HAVE_STRUCT_SOCKADDR_IN6_SIN6_LEN */ - -/* Define to 1 if `sin_len' is a member of `struct sockaddr_in'. */ -/* #undef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */ - -/* Define to 1 if the system has the type `struct sockaddr_storage'. */ -#define HAVE_STRUCT_SOCKADDR_STORAGE 1 - -/* Define to 1 if `ss_family' is a member of `struct sockaddr_storage'. */ -#define HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY 1 - -/* Define to 1 if `__ss_family' is a member of `struct sockaddr_storage'. */ -/* #undef HAVE_STRUCT_SOCKADDR_STORAGE___SS_FAMILY */ - -/* Define to 1 if the system has the type `struct sockaddr_un'. */ -#define HAVE_STRUCT_SOCKADDR_UN 1 - -/* Define to 1 if you have the `sysctl' function. */ -/* #undef HAVE_SYSCTL */ - -/* Define to 1 if you have the <sys/devpoll.h> header file. */ -/* #undef HAVE_SYS_DEVPOLL_H */ - -/* Define to 1 if you have the <sys/epoll.h> header file. */ -#define HAVE_SYS_EPOLL_H 1 - -/* Define to 1 if you have the <sys/eventfd.h> header file. */ -#define HAVE_SYS_EVENTFD_H 1 - -/* Define to 1 if you have the <sys/event.h> header file. */ -/* #undef HAVE_SYS_EVENT_H */ - -/* Define to 1 if you have the <sys/ioctl.h> header file. */ -#define HAVE_SYS_IOCTL_H 1 - -/* Define to 1 if you have the <sys/mman.h> header file. */ -#define HAVE_SYS_MMAN_H 1 - -/* Define to 1 if you have the <sys/param.h> header file. */ -#define HAVE_SYS_PARAM_H 1 - -/* Define to 1 if you have the <sys/queue.h> header file. */ -#define HAVE_SYS_QUEUE_H 1 - -/* Define to 1 if you have the <sys/random.h> header file. */ -#define HAVE_SYS_RANDOM_H 1 - -/* Define to 1 if you have the <sys/resource.h> header file. */ -#define HAVE_SYS_RESOURCE_H 1 - -/* Define to 1 if you have the <sys/select.h> header file. */ -#define HAVE_SYS_SELECT_H 1 - -/* Define to 1 if you have the <sys/sendfile.h> header file. */ -#define HAVE_SYS_SENDFILE_H 1 - -/* Define to 1 if you have the <sys/socket.h> header file. */ -#define HAVE_SYS_SOCKET_H 1 - -/* Define to 1 if you have the <sys/stat.h> header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the <sys/sysctl.h> header file. */ -/* #undef HAVE_SYS_SYSCTL_H */ - -/* Define to 1 if you have the <sys/timerfd.h> header file. */ -#define HAVE_SYS_TIMERFD_H 1 - -/* Define to 1 if you have the <sys/time.h> header file. */ -#define HAVE_SYS_TIME_H 1 - -/* Define to 1 if you have the <sys/types.h> header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the <sys/uio.h> header file. */ -#define HAVE_SYS_UIO_H 1 - -/* Define to 1 if you have the <sys/un.h> header file. */ -#define HAVE_SYS_UN_H 1 - -/* Define to 1 if you have the <sys/wait.h> header file. */ -#define HAVE_SYS_WAIT_H 1 - -/* Define if TAILQ_FOREACH is defined in <sys/queue.h> */ -#define HAVE_TAILQFOREACH 1 - -/* Define if timeradd is defined in <sys/time.h> */ -#define HAVE_TIMERADD 1 - -/* Define if timerclear is defined in <sys/time.h> */ -#define HAVE_TIMERCLEAR 1 - -/* Define if timercmp is defined in <sys/time.h> */ -#define HAVE_TIMERCMP 1 - -/* Define to 1 if you have the `timerfd_create' function. */ -#define HAVE_TIMERFD_CREATE 1 - -/* Define if timerisset is defined in <sys/time.h> */ -#define HAVE_TIMERISSET 1 - -/* Define to 1 if the system has the type `uint16_t'. */ -#define HAVE_UINT16_T 1 - -/* Define to 1 if the system has the type `uint32_t'. */ -#define HAVE_UINT32_T 1 - -/* Define to 1 if the system has the type `uint64_t'. */ -#define HAVE_UINT64_T 1 - -/* Define to 1 if the system has the type `uint8_t'. */ -#define HAVE_UINT8_T 1 - -/* Define to 1 if the system has the type `uintptr_t'. */ -#define HAVE_UINTPTR_T 1 - -/* Define to 1 if you have the `umask' function. */ -#define HAVE_UMASK 1 - -/* Define to 1 if you have the <unistd.h> header file. */ -#define HAVE_UNISTD_H 1 - -/* Define to 1 if you have the `unsetenv' function. */ -#define HAVE_UNSETENV 1 - -/* Define to 1 if you have the `usleep' function. */ -#define HAVE_USLEEP 1 - -/* Define to 1 if you have the `vasprintf' function. */ -#define HAVE_VASPRINTF 1 - -/* Define if kqueue works correctly with pipes */ -/* #undef HAVE_WORKING_KQUEUE */ - -/* Define to 1 if you have the <zlib.h> header file. */ -#define HAVE_ZLIB_H 1 - -/* Define to 1 if you have the `_gmtime64' function. */ -/* #undef HAVE__GMTIME64 */ - -/* Define to 1 if you have the `_gmtime64_s' function. */ -/* #undef HAVE__GMTIME64_S */ - -/* Define to 1 if compiler have __FUNCTION__ */ -#define HAVE___FUNCTION__ 1 - -/* Define to 1 if compiler have __func__ */ -#define HAVE___func__ 1 - -/* Define to the sub-directory where libtool stores uninstalled libraries. */ -#define LT_OBJDIR ".libs/" - -/* Numeric representation of the version */ -#define NUMERIC_VERSION 0x02010c00 - -/* Name of package */ -#define PACKAGE "libevent" - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "libevent" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "libevent 2.1.12-stable" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "libevent" - -/* Define to the home page for this package. */ -#define PACKAGE_URL "" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "2.1.12-stable" - -/* Define to necessary symbol if this constant uses a non-standard name on - your system. */ -/* #undef PTHREAD_CREATE_JOINABLE */ - -/* The size of `int', as computed by sizeof. */ -#define SIZEOF_INT 4 - -/* The size of `long', as computed by sizeof. */ -#define SIZEOF_LONG 8 - -/* The size of `long long', as computed by sizeof. */ -#define SIZEOF_LONG_LONG 8 - -/* The size of `off_t', as computed by sizeof. */ -#define SIZEOF_OFF_T 8 - -/* The size of `pthread_t', as computed by sizeof. */ -#define SIZEOF_PTHREAD_T 8 - -/* The size of `short', as computed by sizeof. */ -#define SIZEOF_SHORT 2 - -/* The size of `size_t', as computed by sizeof. */ -#define SIZEOF_SIZE_T 8 - -/* The size of `time_t', as computed by sizeof. */ -#define SIZEOF_TIME_T 8 - -/* The size of `void *', as computed by sizeof. */ -#define SIZEOF_VOID_P 8 - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */ -#define TIME_WITH_SYS_TIME 1 - -/* Enable extensions on AIX 3, Interix. */ -#ifndef _ALL_SOURCE -# define _ALL_SOURCE 1 -#endif -/* Enable GNU extensions on systems that have them. */ -#ifndef _GNU_SOURCE -# define _GNU_SOURCE 1 -#endif -/* Enable threading extensions on Solaris. */ -#ifndef _POSIX_PTHREAD_SEMANTICS -# define _POSIX_PTHREAD_SEMANTICS 1 -#endif -/* Enable extensions on HP NonStop. */ -#ifndef _TANDEM_SOURCE -# define _TANDEM_SOURCE 1 -#endif -/* Enable general extensions on Solaris. */ -#ifndef __EXTENSIONS__ -# define __EXTENSIONS__ 1 -#endif - - -/* Version number of package */ -#define VERSION "2.1.12-stable" - -/* Enable large inode numbers on Mac OS X 10.5. */ -#ifndef _DARWIN_USE_64_BIT_INODE -# define _DARWIN_USE_64_BIT_INODE 1 -#endif - -/* Number of bits in a file offset, on hosts where this is settable. */ -/* #undef _FILE_OFFSET_BITS */ - -/* Define for large files, on AIX-style hosts. */ -/* #undef _LARGE_FILES */ - -/* Define to 1 if on MINIX. */ -/* #undef _MINIX */ - -/* Define to 2 if the system does not provide POSIX.1 features except with - this defined. */ -/* #undef _POSIX_1_SOURCE */ - -/* Define to 1 if you need to in order for `stat' and other things to work. */ -/* #undef _POSIX_SOURCE */ - -/* Define to empty if `const' does not conform to ANSI C. */ -/* #undef const */ - -/* Define to `__inline__' or `__inline' if that's what the C compiler - calls it, or to nothing if 'inline' is not supported under any name. */ -#ifndef __cplusplus -/* #undef inline */ -#endif - -/* Define to `int' if <sys/types.h> does not define. */ -/* #undef pid_t */ - -/* Define to `unsigned int' if <sys/types.h> does not define. */ -/* #undef size_t */ - -/* Define to unsigned int if you dont have it */ -/* #undef socklen_t */ - -/* Define to `int' if <sys/types.h> does not define. */ -/* #undef ssize_t */ diff --git a/contrib/libs/libevent/devpoll.c b/contrib/libs/libevent/devpoll.c deleted file mode 100644 index 3a2f86d6f1a..00000000000 --- a/contrib/libs/libevent/devpoll.c +++ /dev/null @@ -1,311 +0,0 @@ -/* - * Copyright 2000-2009 Niels Provos <provos@citi.umich.edu> - * Copyright 2009-2012 Niels Provos and Nick Mathewson - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "event2/event-config.h" -#include "evconfig-private.h" - -#ifdef EVENT__HAVE_DEVPOLL - -#include <sys/types.h> -#include <sys/resource.h> -#ifdef EVENT__HAVE_SYS_TIME_H -#include <sys/time.h> -#endif -#include <sys/queue.h> -#include <sys/devpoll.h> -#include <signal.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <fcntl.h> -#include <errno.h> - -#include "event2/event.h" -#include "event2/event_struct.h" -#include "event2/thread.h" -#include "event-internal.h" -#include "evsignal-internal.h" -#include "log-internal.h" -#include "evmap-internal.h" -#include "evthread-internal.h" - -struct devpollop { - struct pollfd *events; - int nevents; - int dpfd; - struct pollfd *changes; - int nchanges; -}; - -static void *devpoll_init(struct event_base *); -static int devpoll_add(struct event_base *, int fd, short old, short events, void *); -static int devpoll_del(struct event_base *, int fd, short old, short events, void *); -static int devpoll_dispatch(struct event_base *, struct timeval *); -static void devpoll_dealloc(struct event_base *); - -const struct eventop devpollops = { - "devpoll", - devpoll_init, - devpoll_add, - devpoll_del, - devpoll_dispatch, - devpoll_dealloc, - 1, /* need reinit */ - EV_FEATURE_FDS|EV_FEATURE_O1, - 0 -}; - -#define NEVENT 32000 - -static int -devpoll_commit(struct devpollop *devpollop) -{ - /* - * Due to a bug in Solaris, we have to use pwrite with an offset of 0. - * Write is limited to 2GB of data, until it will fail. - */ - if (pwrite(devpollop->dpfd, devpollop->changes, - sizeof(struct pollfd) * devpollop->nchanges, 0) == -1) - return (-1); - - devpollop->nchanges = 0; - return (0); -} - -static int -devpoll_queue(struct devpollop *devpollop, int fd, int events) { - struct pollfd *pfd; - - if (devpollop->nchanges >= devpollop->nevents) { - /* - * Change buffer is full, must commit it to /dev/poll before - * adding more - */ - if (devpoll_commit(devpollop) != 0) - return (-1); - } - - pfd = &devpollop->changes[devpollop->nchanges++]; - pfd->fd = fd; - pfd->events = events; - pfd->revents = 0; - - return (0); -} - -static void * -devpoll_init(struct event_base *base) -{ - int dpfd, nfiles = NEVENT; - struct rlimit rl; - struct devpollop *devpollop; - - if (!(devpollop = mm_calloc(1, sizeof(struct devpollop)))) - return (NULL); - - if (getrlimit(RLIMIT_NOFILE, &rl) == 0 && - rl.rlim_cur != RLIM_INFINITY) - nfiles = rl.rlim_cur; - - /* Initialize the kernel queue */ - if ((dpfd = evutil_open_closeonexec_("/dev/poll", O_RDWR, 0)) == -1) { - event_warn("open: /dev/poll"); - mm_free(devpollop); - return (NULL); - } - - devpollop->dpfd = dpfd; - - /* Initialize fields */ - /* FIXME: allocating 'nfiles' worth of space here can be - * expensive and unnecessary. See how epoll.c does it instead. */ - devpollop->events = mm_calloc(nfiles, sizeof(struct pollfd)); - if (devpollop->events == NULL) { - mm_free(devpollop); - close(dpfd); - return (NULL); - } - devpollop->nevents = nfiles; - - devpollop->changes = mm_calloc(nfiles, sizeof(struct pollfd)); - if (devpollop->changes == NULL) { - mm_free(devpollop->events); - mm_free(devpollop); - close(dpfd); - return (NULL); - } - - evsig_init_(base); - - return (devpollop); -} - -static int -devpoll_dispatch(struct event_base *base, struct timeval *tv) -{ - struct devpollop *devpollop = base->evbase; - struct pollfd *events = devpollop->events; - struct dvpoll dvp; - int i, res, timeout = -1; - - if (devpollop->nchanges) - devpoll_commit(devpollop); - - if (tv != NULL) - timeout = tv->tv_sec * 1000 + (tv->tv_usec + 999) / 1000; - - dvp.dp_fds = devpollop->events; - dvp.dp_nfds = devpollop->nevents; - dvp.dp_timeout = timeout; - - EVBASE_RELEASE_LOCK(base, th_base_lock); - - res = ioctl(devpollop->dpfd, DP_POLL, &dvp); - - EVBASE_ACQUIRE_LOCK(base, th_base_lock); - - if (res == -1) { - if (errno != EINTR) { - event_warn("ioctl: DP_POLL"); - return (-1); - } - - return (0); - } - - event_debug(("%s: devpoll_wait reports %d", __func__, res)); - - for (i = 0; i < res; i++) { - int which = 0; - int what = events[i].revents; - - if (what & POLLHUP) - what |= POLLIN | POLLOUT; - else if (what & POLLERR) - what |= POLLIN | POLLOUT; - - if (what & POLLIN) - which |= EV_READ; - if (what & POLLOUT) - which |= EV_WRITE; - - if (!which) - continue; - - /* XXX(niels): not sure if this works for devpoll */ - evmap_io_active_(base, events[i].fd, which); - } - - return (0); -} - - -static int -devpoll_add(struct event_base *base, int fd, short old, short events, void *p) -{ - struct devpollop *devpollop = base->evbase; - int res; - (void)p; - - /* - * It's not necessary to OR the existing read/write events that we - * are currently interested in with the new event we are adding. - * The /dev/poll driver ORs any new events with the existing events - * that it has cached for the fd. - */ - - res = 0; - if (events & EV_READ) - res |= POLLIN; - if (events & EV_WRITE) - res |= POLLOUT; - - if (devpoll_queue(devpollop, fd, res) != 0) - return (-1); - - return (0); -} - -static int -devpoll_del(struct event_base *base, int fd, short old, short events, void *p) -{ - struct devpollop *devpollop = base->evbase; - int res; - (void)p; - - res = 0; - if (events & EV_READ) - res |= POLLIN; - if (events & EV_WRITE) - res |= POLLOUT; - - /* - * The only way to remove an fd from the /dev/poll monitored set is - * to use POLLREMOVE by itself. This removes ALL events for the fd - * provided so if we care about two events and are only removing one - * we must re-add the other event after POLLREMOVE. - */ - - if (devpoll_queue(devpollop, fd, POLLREMOVE) != 0) - return (-1); - - if ((res & (POLLIN|POLLOUT)) != (POLLIN|POLLOUT)) { - /* - * We're not deleting all events, so we must resubmit the - * event that we are still interested in if one exists. - */ - - if ((res & POLLIN) && (old & EV_WRITE)) { - /* Deleting read, still care about write */ - devpoll_queue(devpollop, fd, POLLOUT); - } else if ((res & POLLOUT) && (old & EV_READ)) { - /* Deleting write, still care about read */ - devpoll_queue(devpollop, fd, POLLIN); - } - } - - return (0); -} - -static void -devpoll_dealloc(struct event_base *base) -{ - struct devpollop *devpollop = base->evbase; - - evsig_dealloc_(base); - if (devpollop->events) - mm_free(devpollop->events); - if (devpollop->changes) - mm_free(devpollop->changes); - if (devpollop->dpfd >= 0) - close(devpollop->dpfd); - - memset(devpollop, 0, sizeof(struct devpollop)); - mm_free(devpollop); -} - -#endif /* EVENT__HAVE_DEVPOLL */ diff --git a/contrib/libs/libevent/epoll_sub.c b/contrib/libs/libevent/epoll_sub.c deleted file mode 100644 index 3f01f6a6995..00000000000 --- a/contrib/libs/libevent/epoll_sub.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 2003-2009 Niels Provos <provos@citi.umich.edu> - * Copyright 2009-2012 Niels Provos and Nick Mathewson - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "evconfig-private.h" -#include <stdint.h> - -#include <sys/param.h> -#include <sys/types.h> -#include <sys/syscall.h> -#include <sys/epoll.h> -#include <unistd.h> -#include <errno.h> - -int -epoll_create(int size) -{ -#if !defined(__NR_epoll_create) && defined(__NR_epoll_create1) - if (size <= 0) { - errno = EINVAL; - return -1; - } - return (syscall(__NR_epoll_create1, 0)); -#else - return (syscall(__NR_epoll_create, size)); -#endif -} - -int -epoll_ctl(int epfd, int op, int fd, struct epoll_event *event) -{ - - return (syscall(__NR_epoll_ctl, epfd, op, fd, event)); -} - -int -epoll_wait(int epfd, struct epoll_event *events, int maxevents, int timeout) -{ -#if !defined(__NR_epoll_wait) && defined(__NR_epoll_pwait) - return (syscall(__NR_epoll_pwait, epfd, events, maxevents, timeout, NULL, 0)); -#else - return (syscall(__NR_epoll_wait, epfd, events, maxevents, timeout)); -#endif -} diff --git a/contrib/libs/libevent/event_core/CMakeLists.txt b/contrib/libs/libevent/event_core/CMakeLists.txt index fc7b1ee73ce..a681d385f3e 100644 --- a/contrib/libs/libevent/event_core/CMakeLists.txt +++ b/contrib/libs/libevent/event_core/CMakeLists.txt @@ -8,6 +8,6 @@ if (APPLE) include(CMakeLists.darwin.txt) -elseif (UNIX AND NOT APPLE) +elseif (UNIX) include(CMakeLists.linux.txt) endif() diff --git a/contrib/libs/libevent/event_iocp.c b/contrib/libs/libevent/event_iocp.c deleted file mode 100644 index 6b2a2e15ef8..00000000000 --- a/contrib/libs/libevent/event_iocp.c +++ /dev/null @@ -1,294 +0,0 @@ -/* - * Copyright (c) 2009-2012 Niels Provos, Nick Mathewson - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "evconfig-private.h" - -#ifndef _WIN32_WINNT -/* Minimum required for InitializeCriticalSectionAndSpinCount */ -#define _WIN32_WINNT 0x0403 -#endif -#include <winsock2.h> -#include <windows.h> -#include <process.h> -#include <stdio.h> -#include <mswsock.h> - -#include "event2/util.h" -#include "util-internal.h" -#include "iocp-internal.h" -#include "log-internal.h" -#include "mm-internal.h" -#include "event-internal.h" -#include "evthread-internal.h" - -#define NOTIFICATION_KEY ((ULONG_PTR)-1) - -void -event_overlapped_init_(struct event_overlapped *o, iocp_callback cb) -{ - memset(o, 0, sizeof(struct event_overlapped)); - o->cb = cb; -} - -static void -handle_entry(OVERLAPPED *o, ULONG_PTR completion_key, DWORD nBytes, int ok) -{ - struct event_overlapped *eo = - EVUTIL_UPCAST(o, struct event_overlapped, overlapped); - eo->cb(eo, completion_key, nBytes, ok); -} - -static void -loop(void *port_) -{ - struct event_iocp_port *port = port_; - long ms = port->ms; - HANDLE p = port->port; - - if (ms <= 0) - ms = INFINITE; - - while (1) { - OVERLAPPED *overlapped=NULL; - ULONG_PTR key=0; - DWORD bytes=0; - int ok = GetQueuedCompletionStatus(p, &bytes, &key, - &overlapped, ms); - EnterCriticalSection(&port->lock); - if (port->shutdown) { - if (--port->n_live_threads == 0) - ReleaseSemaphore(port->shutdownSemaphore, 1, - NULL); - LeaveCriticalSection(&port->lock); - return; - } - LeaveCriticalSection(&port->lock); - - if (key != NOTIFICATION_KEY && overlapped) - handle_entry(overlapped, key, bytes, ok); - else if (!overlapped) - break; - } - event_warnx("GetQueuedCompletionStatus exited with no event."); - EnterCriticalSection(&port->lock); - if (--port->n_live_threads == 0) - ReleaseSemaphore(port->shutdownSemaphore, 1, NULL); - LeaveCriticalSection(&port->lock); -} - -int -event_iocp_port_associate_(struct event_iocp_port *port, evutil_socket_t fd, - ev_uintptr_t key) -{ - HANDLE h; - h = CreateIoCompletionPort((HANDLE)fd, port->port, key, port->n_threads); - if (!h) - return -1; - return 0; -} - -static void * -get_extension_function(SOCKET s, const GUID *which_fn) -{ - void *ptr = NULL; - DWORD bytes=0; - WSAIoctl(s, SIO_GET_EXTENSION_FUNCTION_POINTER, - (GUID*)which_fn, sizeof(*which_fn), - &ptr, sizeof(ptr), - &bytes, NULL, NULL); - - /* No need to detect errors here: if ptr is set, then we have a good - function pointer. Otherwise, we should behave as if we had no - function pointer. - */ - return ptr; -} - -/* Mingw doesn't have these in its mswsock.h. The values are copied from - wine.h. Perhaps if we copy them exactly, the cargo will come again. -*/ -#ifndef WSAID_ACCEPTEX -#define WSAID_ACCEPTEX \ - {0xb5367df1,0xcbac,0x11cf,{0x95,0xca,0x00,0x80,0x5f,0x48,0xa1,0x92}} -#endif -#ifndef WSAID_CONNECTEX -#define WSAID_CONNECTEX \ - {0x25a207b9,0xddf3,0x4660,{0x8e,0xe9,0x76,0xe5,0x8c,0x74,0x06,0x3e}} -#endif -#ifndef WSAID_GETACCEPTEXSOCKADDRS -#define WSAID_GETACCEPTEXSOCKADDRS \ - {0xb5367df2,0xcbac,0x11cf,{0x95,0xca,0x00,0x80,0x5f,0x48,0xa1,0x92}} -#endif - -static int extension_fns_initialized = 0; - -static void -init_extension_functions(struct win32_extension_fns *ext) -{ - const GUID acceptex = WSAID_ACCEPTEX; - const GUID connectex = WSAID_CONNECTEX; - const GUID getacceptexsockaddrs = WSAID_GETACCEPTEXSOCKADDRS; - SOCKET s = socket(AF_INET, SOCK_STREAM, 0); - if (s == EVUTIL_INVALID_SOCKET) - return; - ext->AcceptEx = get_extension_function(s, &acceptex); - ext->ConnectEx = get_extension_function(s, &connectex); - ext->GetAcceptExSockaddrs = get_extension_function(s, - &getacceptexsockaddrs); - closesocket(s); - - extension_fns_initialized = 1; -} - -static struct win32_extension_fns the_extension_fns; - -const struct win32_extension_fns * -event_get_win32_extension_fns_(void) -{ - return &the_extension_fns; -} - -#define N_CPUS_DEFAULT 2 - -struct event_iocp_port * -event_iocp_port_launch_(int n_cpus) -{ - struct event_iocp_port *port; - int i; - - if (!extension_fns_initialized) - init_extension_functions(&the_extension_fns); - - if (!(port = mm_calloc(1, sizeof(struct event_iocp_port)))) - return NULL; - - if (n_cpus <= 0) - n_cpus = N_CPUS_DEFAULT; - port->n_threads = n_cpus * 2; - port->threads = mm_calloc(port->n_threads, sizeof(HANDLE)); - if (!port->threads) - goto err; - - port->port = CreateIoCompletionPort(INVALID_HANDLE_VALUE, NULL, 0, - n_cpus); - port->ms = -1; - if (!port->port) - goto err; - - port->shutdownSemaphore = CreateSemaphore(NULL, 0, 1, NULL); - if (!port->shutdownSemaphore) - goto err; - - for (i=0; i<port->n_threads; ++i) { - ev_uintptr_t th = _beginthread(loop, 0, port); - if (th == (ev_uintptr_t)-1) - goto err; - port->threads[i] = (HANDLE)th; - ++port->n_live_threads; - } - - InitializeCriticalSectionAndSpinCount(&port->lock, 1000); - - return port; -err: - if (port->port) - CloseHandle(port->port); - if (port->threads) - mm_free(port->threads); - if (port->shutdownSemaphore) - CloseHandle(port->shutdownSemaphore); - mm_free(port); - return NULL; -} - -static void -event_iocp_port_unlock_and_free_(struct event_iocp_port *port) -{ - DeleteCriticalSection(&port->lock); - CloseHandle(port->port); - CloseHandle(port->shutdownSemaphore); - mm_free(port->threads); - mm_free(port); -} - -static int -event_iocp_notify_all(struct event_iocp_port *port) -{ - int i, r, ok=1; - for (i=0; i<port->n_threads; ++i) { - r = PostQueuedCompletionStatus(port->port, 0, NOTIFICATION_KEY, - NULL); - if (!r) - ok = 0; - } - return ok ? 0 : -1; -} - -int -event_iocp_shutdown_(struct event_iocp_port *port, long waitMsec) -{ - DWORD ms = INFINITE; - int n; - - EnterCriticalSection(&port->lock); - port->shutdown = 1; - LeaveCriticalSection(&port->lock); - event_iocp_notify_all(port); - - if (waitMsec >= 0) - ms = waitMsec; - - WaitForSingleObject(port->shutdownSemaphore, ms); - EnterCriticalSection(&port->lock); - n = port->n_live_threads; - LeaveCriticalSection(&port->lock); - if (n == 0) { - event_iocp_port_unlock_and_free_(port); - return 0; - } else { - return -1; - } -} - -int -event_iocp_activate_overlapped_( - struct event_iocp_port *port, struct event_overlapped *o, - ev_uintptr_t key, ev_uint32_t n) -{ - BOOL r; - - r = PostQueuedCompletionStatus(port->port, n, key, &o->overlapped); - return (r==0) ? -1 : 0; -} - -struct event_iocp_port * -event_base_get_iocp_(struct event_base *base) -{ -#ifdef _WIN32 - return base->iocp; -#else - return NULL; -#endif -} diff --git a/contrib/libs/libevent/evport.c b/contrib/libs/libevent/evport.c deleted file mode 100644 index a014386bfe3..00000000000 --- a/contrib/libs/libevent/evport.c +++ /dev/null @@ -1,451 +0,0 @@ -/* - * Submitted by David Pacheco (dp.spambait@gmail.com) - * - * Copyright 2006-2007 Niels Provos - * Copyright 2007-2012 Niels Provos and Nick Mathewson - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY SUN MICROSYSTEMS, INC. ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL SUN MICROSYSTEMS, INC. BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * Copyright (c) 2007 Sun Microsystems. All rights reserved. - * Use is subject to license terms. - */ - -/* - * evport.c: event backend using Solaris 10 event ports. See port_create(3C). - * This implementation is loosely modeled after the one used for select(2) (in - * select.c). - * - * The outstanding events are tracked in a data structure called evport_data. - * Each entry in the ed_fds array corresponds to a file descriptor, and contains - * pointers to the read and write events that correspond to that fd. (That is, - * when the file is readable, the "read" event should handle it, etc.) - * - * evport_add and evport_del update this data structure. evport_dispatch uses it - * to determine where to callback when an event occurs (which it gets from - * port_getn). - * - * Helper functions are used: grow() grows the file descriptor array as - * necessary when large fd's come in. reassociate() takes care of maintaining - * the proper file-descriptor/event-port associations. - * - * As in the select(2) implementation, signals are handled by evsignal. - */ - -#include "event2/event-config.h" -#include "evconfig-private.h" - -#ifdef EVENT__HAVE_EVENT_PORTS - -#include <sys/time.h> -#include <sys/queue.h> -#include <errno.h> -#include <poll.h> -#include <port.h> -#include <signal.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <time.h> -#include <unistd.h> - -#include "event2/thread.h" - -#include "evthread-internal.h" -#include "event-internal.h" -#include "log-internal.h" -#include "evsignal-internal.h" -#include "evmap-internal.h" - -#define INITIAL_EVENTS_PER_GETN 8 -#define MAX_EVENTS_PER_GETN 4096 - -/* - * Per-file-descriptor information about what events we're subscribed to. These - * fields are NULL if no event is subscribed to either of them. - */ - -struct fd_info { - /* combinations of EV_READ and EV_WRITE */ - short fdi_what; - /* Index of this fd within ed_pending, plus 1. Zero if this fd is - * not in ed_pending. (The +1 is a hack so that memset(0) will set - * it to a nil index. */ - int pending_idx_plus_1; -}; - -#define FDI_HAS_READ(fdi) ((fdi)->fdi_what & EV_READ) -#define FDI_HAS_WRITE(fdi) ((fdi)->fdi_what & EV_WRITE) -#define FDI_HAS_EVENTS(fdi) (FDI_HAS_READ(fdi) || FDI_HAS_WRITE(fdi)) -#define FDI_TO_SYSEVENTS(fdi) (FDI_HAS_READ(fdi) ? POLLIN : 0) | \ - (FDI_HAS_WRITE(fdi) ? POLLOUT : 0) - -struct evport_data { - int ed_port; /* event port for system events */ - /* How many elements of ed_pending should we look at? */ - int ed_npending; - /* How many elements are allocated in ed_pending and pevtlist? */ - int ed_maxevents; - /* fdi's that we need to reassoc */ - int *ed_pending; - /* storage space for incoming events. */ - port_event_t *ed_pevtlist; - -}; - -static void* evport_init(struct event_base *); -static int evport_add(struct event_base *, int fd, short old, short events, void *); -static int evport_del(struct event_base *, int fd, short old, short events, void *); -static int evport_dispatch(struct event_base *, struct timeval *); -static void evport_dealloc(struct event_base *); -static int grow(struct evport_data *, int min_events); - -const struct eventop evportops = { - "evport", - evport_init, - evport_add, - evport_del, - evport_dispatch, - evport_dealloc, - 1, /* need reinit */ - 0, /* features */ - sizeof(struct fd_info), /* fdinfo length */ -}; - -/* - * Initialize the event port implementation. - */ - -static void* -evport_init(struct event_base *base) -{ - struct evport_data *evpd; - - if (!(evpd = mm_calloc(1, sizeof(struct evport_data)))) - return (NULL); - - if ((evpd->ed_port = port_create()) == -1) { - mm_free(evpd); - return (NULL); - } - - if (grow(evpd, INITIAL_EVENTS_PER_GETN) < 0) { - close(evpd->ed_port); - mm_free(evpd); - return NULL; - } - - evpd->ed_npending = 0; - - evsig_init_(base); - - return (evpd); -} - -static int -grow(struct evport_data *data, int min_events) -{ - int newsize; - int *new_pending; - port_event_t *new_pevtlist; - if (data->ed_maxevents) { - newsize = data->ed_maxevents; - do { - newsize *= 2; - } while (newsize < min_events); - } else { - newsize = min_events; - } - - new_pending = mm_realloc(data->ed_pending, sizeof(int)*newsize); - if (new_pending == NULL) - return -1; - data->ed_pending = new_pending; - new_pevtlist = mm_realloc(data->ed_pevtlist, sizeof(port_event_t)*newsize); - if (new_pevtlist == NULL) - return -1; - data->ed_pevtlist = new_pevtlist; - - data->ed_maxevents = newsize; - return 0; -} - -#ifdef CHECK_INVARIANTS -/* - * Checks some basic properties about the evport_data structure. Because it - * checks all file descriptors, this function can be expensive when the maximum - * file descriptor ever used is rather large. - */ - -static void -check_evportop(struct evport_data *evpd) -{ - EVUTIL_ASSERT(evpd); - EVUTIL_ASSERT(evpd->ed_port > 0); -} - -/* - * Verifies very basic integrity of a given port_event. - */ -static void -check_event(port_event_t* pevt) -{ - /* - * We've only registered for PORT_SOURCE_FD events. The only - * other thing we can legitimately receive is PORT_SOURCE_ALERT, - * but since we're not using port_alert either, we can assume - * PORT_SOURCE_FD. - */ - EVUTIL_ASSERT(pevt->portev_source == PORT_SOURCE_FD); -} - -#else -#define check_evportop(epop) -#define check_event(pevt) -#endif /* CHECK_INVARIANTS */ - -/* - * (Re)associates the given file descriptor with the event port. The OS events - * are specified (implicitly) from the fd_info struct. - */ -static int -reassociate(struct evport_data *epdp, struct fd_info *fdip, int fd) -{ - int sysevents = FDI_TO_SYSEVENTS(fdip); - - if (sysevents != 0) { - if (port_associate(epdp->ed_port, PORT_SOURCE_FD, - fd, sysevents, fdip) == -1) { - event_warn("port_associate"); - return (-1); - } - } - - check_evportop(epdp); - - return (0); -} - -/* - * Main event loop - polls port_getn for some number of events, and processes - * them. - */ - -static int -evport_dispatch(struct event_base *base, struct timeval *tv) -{ - int i, res; - struct evport_data *epdp = base->evbase; - port_event_t *pevtlist = epdp->ed_pevtlist; - - /* - * port_getn will block until it has at least nevents events. It will - * also return how many it's given us (which may be more than we asked - * for, as long as it's less than our maximum (ed_maxevents)) in - * nevents. - */ - int nevents = 1; - - /* - * We have to convert a struct timeval to a struct timespec - * (only difference is nanoseconds vs. microseconds). If no time-based - * events are active, we should wait for I/O (and tv == NULL). - */ - struct timespec ts; - struct timespec *ts_p = NULL; - if (tv != NULL) { - ts.tv_sec = tv->tv_sec; - ts.tv_nsec = tv->tv_usec * 1000; - ts_p = &ts; - } - - /* - * Before doing anything else, we need to reassociate the events we hit - * last time which need reassociation. See comment at the end of the - * loop below. - */ - for (i = 0; i < epdp->ed_npending; ++i) { - struct fd_info *fdi = NULL; - const int fd = epdp->ed_pending[i]; - if (fd != -1) { - /* We might have cleared out this event; we need - * to be sure that it's still set. */ - fdi = evmap_io_get_fdinfo_(&base->io, fd); - } - - if (fdi != NULL && FDI_HAS_EVENTS(fdi)) { - reassociate(epdp, fdi, fd); - /* epdp->ed_pending[i] = -1; */ - fdi->pending_idx_plus_1 = 0; - } - } - - EVBASE_RELEASE_LOCK(base, th_base_lock); - - res = port_getn(epdp->ed_port, pevtlist, epdp->ed_maxevents, - (unsigned int *) &nevents, ts_p); - - EVBASE_ACQUIRE_LOCK(base, th_base_lock); - - if (res == -1) { - if (errno == EINTR || errno == EAGAIN) { - return (0); - } else if (errno == ETIME) { - if (nevents == 0) - return (0); - } else { - event_warn("port_getn"); - return (-1); - } - } - - event_debug(("%s: port_getn reports %d events", __func__, nevents)); - - for (i = 0; i < nevents; ++i) { - port_event_t *pevt = &pevtlist[i]; - int fd = (int) pevt->portev_object; - struct fd_info *fdi = pevt->portev_user; - /*EVUTIL_ASSERT(evmap_io_get_fdinfo_(&base->io, fd) == fdi);*/ - - check_evportop(epdp); - check_event(pevt); - epdp->ed_pending[i] = fd; - fdi->pending_idx_plus_1 = i + 1; - - /* - * Figure out what kind of event it was - * (because we have to pass this to the callback) - */ - res = 0; - if (pevt->portev_events & (POLLERR|POLLHUP)) { - res = EV_READ | EV_WRITE; - } else { - if (pevt->portev_events & POLLIN) - res |= EV_READ; - if (pevt->portev_events & POLLOUT) - res |= EV_WRITE; - } - - /* - * Check for the error situations or a hangup situation - */ - if (pevt->portev_events & (POLLERR|POLLHUP|POLLNVAL)) - res |= EV_READ|EV_WRITE; - - evmap_io_active_(base, fd, res); - } /* end of all events gotten */ - epdp->ed_npending = nevents; - - if (nevents == epdp->ed_maxevents && - epdp->ed_maxevents < MAX_EVENTS_PER_GETN) { - /* we used all the space this time. We should be ready - * for more events next time around. */ - grow(epdp, epdp->ed_maxevents * 2); - } - - check_evportop(epdp); - - return (0); -} - - -/* - * Adds the given event (so that you will be notified when it happens via - * the callback function). - */ - -static int -evport_add(struct event_base *base, int fd, short old, short events, void *p) -{ - struct evport_data *evpd = base->evbase; - struct fd_info *fdi = p; - - check_evportop(evpd); - - fdi->fdi_what |= events; - - return reassociate(evpd, fdi, fd); -} - -/* - * Removes the given event from the list of events to wait for. - */ - -static int -evport_del(struct event_base *base, int fd, short old, short events, void *p) -{ - struct evport_data *evpd = base->evbase; - struct fd_info *fdi = p; - int associated = ! fdi->pending_idx_plus_1; - - check_evportop(evpd); - - fdi->fdi_what &= ~(events &(EV_READ|EV_WRITE)); - - if (associated) { - if (!FDI_HAS_EVENTS(fdi) && - port_dissociate(evpd->ed_port, PORT_SOURCE_FD, fd) == -1) { - /* - * Ignore EBADFD error the fd could have been closed - * before event_del() was called. - */ - if (errno != EBADFD) { - event_warn("port_dissociate"); - return (-1); - } - } else { - if (FDI_HAS_EVENTS(fdi)) { - return (reassociate(evpd, fdi, fd)); - } - } - } else { - if ((fdi->fdi_what & (EV_READ|EV_WRITE)) == 0) { - const int i = fdi->pending_idx_plus_1 - 1; - EVUTIL_ASSERT(evpd->ed_pending[i] == fd); - evpd->ed_pending[i] = -1; - fdi->pending_idx_plus_1 = 0; - } - } - return 0; -} - - -static void -evport_dealloc(struct event_base *base) -{ - struct evport_data *evpd = base->evbase; - - evsig_dealloc_(base); - - close(evpd->ed_port); - - if (evpd->ed_pending) - mm_free(evpd->ed_pending); - if (evpd->ed_pevtlist) - mm_free(evpd->ed_pevtlist); - - mm_free(evpd); -} - -#endif /* EVENT__HAVE_EVENT_PORTS */ diff --git a/contrib/libs/libevent/evthread_win32.c b/contrib/libs/libevent/evthread_win32.c deleted file mode 100644 index 2ec80560a5c..00000000000 --- a/contrib/libs/libevent/evthread_win32.c +++ /dev/null @@ -1,341 +0,0 @@ -/* - * Copyright 2009-2012 Niels Provos and Nick Mathewson - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "event2/event-config.h" -#include "evconfig-private.h" - -#ifdef _WIN32 -#ifndef _WIN32_WINNT -/* Minimum required for InitializeCriticalSectionAndSpinCount */ -#define _WIN32_WINNT 0x0403 -#endif -#include <winsock2.h> -#define WIN32_LEAN_AND_MEAN -#include <windows.h> -#undef WIN32_LEAN_AND_MEAN -#include <sys/locking.h> -#endif - -struct event_base; -#include "event2/thread.h" - -#include "mm-internal.h" -#include "evthread-internal.h" -#include "time-internal.h" - -#define SPIN_COUNT 2000 - -static void * -evthread_win32_lock_create(unsigned locktype) -{ - CRITICAL_SECTION *lock = mm_malloc(sizeof(CRITICAL_SECTION)); - if (!lock) - return NULL; - if (InitializeCriticalSectionAndSpinCount(lock, SPIN_COUNT) == 0) { - mm_free(lock); - return NULL; - } - return lock; -} - -static void -evthread_win32_lock_free(void *lock_, unsigned locktype) -{ - CRITICAL_SECTION *lock = lock_; - DeleteCriticalSection(lock); - mm_free(lock); -} - -static int -evthread_win32_lock(unsigned mode, void *lock_) -{ - CRITICAL_SECTION *lock = lock_; - if ((mode & EVTHREAD_TRY)) { - return ! TryEnterCriticalSection(lock); - } else { - EnterCriticalSection(lock); - return 0; - } -} - -static int -evthread_win32_unlock(unsigned mode, void *lock_) -{ - CRITICAL_SECTION *lock = lock_; - LeaveCriticalSection(lock); - return 0; -} - -static unsigned long -evthread_win32_get_id(void) -{ - return (unsigned long) GetCurrentThreadId(); -} - -#ifdef WIN32_HAVE_CONDITION_VARIABLES -static void WINAPI (*InitializeConditionVariable_fn)(PCONDITION_VARIABLE) - = NULL; -static BOOL WINAPI (*SleepConditionVariableCS_fn)( - PCONDITION_VARIABLE, PCRITICAL_SECTION, DWORD) = NULL; -static void WINAPI (*WakeAllConditionVariable_fn)(PCONDITION_VARIABLE) = NULL; -static void WINAPI (*WakeConditionVariable_fn)(PCONDITION_VARIABLE) = NULL; - -static int -evthread_win32_condvar_init(void) -{ - HANDLE lib; - - lib = GetModuleHandle(TEXT("kernel32.dll")); - if (lib == NULL) - return 0; - -#define LOAD(name) \ - name##_fn = GetProcAddress(lib, #name) - LOAD(InitializeConditionVariable); - LOAD(SleepConditionVariableCS); - LOAD(WakeAllConditionVariable); - LOAD(WakeConditionVariable); - - return InitializeConditionVariable_fn && SleepConditionVariableCS_fn && - WakeAllConditionVariable_fn && WakeConditionVariable_fn; -} - -/* XXXX Even if we can build this, we don't necessarily want to: the functions - * in question didn't exist before Vista, so we'd better LoadProc them. */ -static void * -evthread_win32_condvar_alloc(unsigned condflags) -{ - CONDITION_VARIABLE *cond = mm_malloc(sizeof(CONDITION_VARIABLE)); - if (!cond) - return NULL; - InitializeConditionVariable_fn(cond); - return cond; -} - -static void -evthread_win32_condvar_free(void *cond_) -{ - CONDITION_VARIABLE *cond = cond_; - /* There doesn't _seem_ to be a cleaup fn here... */ - mm_free(cond); -} - -static int -evthread_win32_condvar_signal(void *cond, int broadcast) -{ - CONDITION_VARIABLE *cond = cond_; - if (broadcast) - WakeAllConditionVariable_fn(cond); - else - WakeConditionVariable_fn(cond); - return 0; -} - -static int -evthread_win32_condvar_wait(void *cond_, void *lock_, const struct timeval *tv) -{ - CONDITION_VARIABLE *cond = cond_; - CRITICAL_SECTION *lock = lock_; - DWORD ms, err; - BOOL result; - - if (tv) - ms = evutil_tv_to_msec_(tv); - else - ms = INFINITE; - result = SleepConditionVariableCS_fn(cond, lock, ms); - if (result) { - if (GetLastError() == WAIT_TIMEOUT) - return 1; - else - return -1; - } else { - return 0; - } -} -#endif - -struct evthread_win32_cond { - HANDLE event; - - CRITICAL_SECTION lock; - int n_waiting; - int n_to_wake; - int generation; -}; - -static void * -evthread_win32_cond_alloc(unsigned flags) -{ - struct evthread_win32_cond *cond; - if (!(cond = mm_malloc(sizeof(struct evthread_win32_cond)))) - return NULL; - if (InitializeCriticalSectionAndSpinCount(&cond->lock, SPIN_COUNT)==0) { - mm_free(cond); - return NULL; - } - if ((cond->event = CreateEvent(NULL,TRUE,FALSE,NULL)) == NULL) { - DeleteCriticalSection(&cond->lock); - mm_free(cond); - return NULL; - } - cond->n_waiting = cond->n_to_wake = cond->generation = 0; - return cond; -} - -static void -evthread_win32_cond_free(void *cond_) -{ - struct evthread_win32_cond *cond = cond_; - DeleteCriticalSection(&cond->lock); - CloseHandle(cond->event); - mm_free(cond); -} - -static int -evthread_win32_cond_signal(void *cond_, int broadcast) -{ - struct evthread_win32_cond *cond = cond_; - EnterCriticalSection(&cond->lock); - if (broadcast) - cond->n_to_wake = cond->n_waiting; - else - ++cond->n_to_wake; - cond->generation++; - SetEvent(cond->event); - LeaveCriticalSection(&cond->lock); - return 0; -} - -static int -evthread_win32_cond_wait(void *cond_, void *lock_, const struct timeval *tv) -{ - struct evthread_win32_cond *cond = cond_; - CRITICAL_SECTION *lock = lock_; - int generation_at_start; - int waiting = 1; - int result = -1; - DWORD ms = INFINITE, ms_orig = INFINITE, startTime, endTime; - if (tv) - ms_orig = ms = evutil_tv_to_msec_(tv); - - EnterCriticalSection(&cond->lock); - ++cond->n_waiting; - generation_at_start = cond->generation; - LeaveCriticalSection(&cond->lock); - - LeaveCriticalSection(lock); - - startTime = GetTickCount(); - do { - DWORD res; - res = WaitForSingleObject(cond->event, ms); - EnterCriticalSection(&cond->lock); - if (cond->n_to_wake && - cond->generation != generation_at_start) { - --cond->n_to_wake; - --cond->n_waiting; - result = 0; - waiting = 0; - goto out; - } else if (res != WAIT_OBJECT_0) { - result = (res==WAIT_TIMEOUT) ? 1 : -1; - --cond->n_waiting; - waiting = 0; - goto out; - } else if (ms != INFINITE) { - endTime = GetTickCount(); - if (startTime + ms_orig <= endTime) { - result = 1; /* Timeout */ - --cond->n_waiting; - waiting = 0; - goto out; - } else { - ms = startTime + ms_orig - endTime; - } - } - /* If we make it here, we are still waiting. */ - if (cond->n_to_wake == 0) { - /* There is nobody else who should wake up; reset - * the event. */ - ResetEvent(cond->event); - } - out: - LeaveCriticalSection(&cond->lock); - } while (waiting); - - EnterCriticalSection(lock); - - EnterCriticalSection(&cond->lock); - if (!cond->n_waiting) - ResetEvent(cond->event); - LeaveCriticalSection(&cond->lock); - - return result; -} - -int -evthread_use_windows_threads(void) -{ - struct evthread_lock_callbacks cbs = { - EVTHREAD_LOCK_API_VERSION, - EVTHREAD_LOCKTYPE_RECURSIVE, - evthread_win32_lock_create, - evthread_win32_lock_free, - evthread_win32_lock, - evthread_win32_unlock - }; - - - struct evthread_condition_callbacks cond_cbs = { - EVTHREAD_CONDITION_API_VERSION, - evthread_win32_cond_alloc, - evthread_win32_cond_free, - evthread_win32_cond_signal, - evthread_win32_cond_wait - }; -#ifdef WIN32_HAVE_CONDITION_VARIABLES - struct evthread_condition_callbacks condvar_cbs = { - EVTHREAD_CONDITION_API_VERSION, - evthread_win32_condvar_alloc, - evthread_win32_condvar_free, - evthread_win32_condvar_signal, - evthread_win32_condvar_wait - }; -#endif - - evthread_set_lock_callbacks(&cbs); - evthread_set_id_callback(evthread_win32_get_id); -#ifdef WIN32_HAVE_CONDITION_VARIABLES - if (evthread_win32_condvar_init()) { - evthread_set_condition_callbacks(&condvar_cbs); - return 0; - } -#endif - evthread_set_condition_callbacks(&cond_cbs); - - return 0; -} - diff --git a/contrib/libs/libevent/include/evdns.h b/contrib/libs/libevent/include/evdns.h deleted file mode 100644 index 8672db03698..00000000000 --- a/contrib/libs/libevent/include/evdns.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2000-2007 Niels Provos <provos@citi.umich.edu> - * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#ifndef EVENT1_EVDNS_H_INCLUDED_ -#define EVENT1_EVDNS_H_INCLUDED_ - -/** @file evdns.h - - A dns subsystem for Libevent. - - The <evdns.h> header is deprecated in Libevent 2.0 and later; please - use <event2/evdns.h> instead. Depending on what functionality you - need, you may also want to include more of the other <event2/...> - headers. - */ - -#include <event.h> -#include <event2/dns.h> -#include <event2/dns_compat.h> -#include <event2/dns_struct.h> - -#endif /* EVENT1_EVDNS_H_INCLUDED_ */ diff --git a/contrib/libs/libevent/include/event2/rpc_compat.h b/contrib/libs/libevent/include/event2/rpc_compat.h deleted file mode 100644 index 8d8334d25f9..00000000000 --- a/contrib/libs/libevent/include/event2/rpc_compat.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2006-2007 Niels Provos <provos@citi.umich.edu> - * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#ifndef EVENT2_RPC_COMPAT_H_INCLUDED_ -#define EVENT2_RPC_COMPAT_H_INCLUDED_ - -/** @file event2/rpc_compat.h - - Deprecated versions of the functions in rpc.h: provided only for - backwards compatibility. - - */ - -#ifdef __cplusplus -extern "C" { -#endif - -/** backwards compatible accessors that work only with gcc */ -#if defined(__GNUC__) && !defined(__STRICT_ANSI__) - -#undef EVTAG_ASSIGN -#undef EVTAG_GET -#undef EVTAG_ADD - -#define EVTAG_ASSIGN(msg, member, args...) \ - (*(msg)->base->member##_assign)(msg, ## args) -#define EVTAG_GET(msg, member, args...) \ - (*(msg)->base->member##_get)(msg, ## args) -#define EVTAG_ADD(msg, member, args...) \ - (*(msg)->base->member##_add)(msg, ## args) -#endif -#define EVTAG_LEN(msg, member) ((msg)->member##_length) - -#ifdef __cplusplus -} -#endif - -#endif /* EVENT2_EVENT_COMPAT_H_INCLUDED_ */ diff --git a/contrib/libs/libevent/include/evrpc.h b/contrib/libs/libevent/include/evrpc.h deleted file mode 100644 index 7e986f7dabb..00000000000 --- a/contrib/libs/libevent/include/evrpc.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2000-2007 Niels Provos <provos@citi.umich.edu> - * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#ifndef EVENT1_EVRPC_H_INCLUDED_ -#define EVENT1_EVRPC_H_INCLUDED_ - -/** @file evrpc.h - - An RPC system for Libevent. - - The <evrpc.h> header is deprecated in Libevent 2.0 and later; please - use <event2/rpc.h> instead. Depending on what functionality you - need, you may also want to include more of the other <event2/...> - headers. - */ - -#include <event.h> -#include <event2/rpc.h> -#include <event2/rpc_struct.h> -#include <event2/rpc_compat.h> - -#endif /* EVENT1_EVRPC_H_INCLUDED_ */ diff --git a/contrib/libs/libevent/win32select.c b/contrib/libs/libevent/win32select.c deleted file mode 100644 index d005b587d45..00000000000 --- a/contrib/libs/libevent/win32select.c +++ /dev/null @@ -1,389 +0,0 @@ -/* - * Copyright 2007-2012 Niels Provos and Nick Mathewson - * Copyright 2000-2007 Niels Provos <provos@citi.umich.edu> - * Copyright 2003 Michael A. Davis <mike@datanerds.net> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#include "event2/event-config.h" -#include "evconfig-private.h" - -#ifdef _WIN32 - -#include <winsock2.h> -#include <windows.h> -#include <sys/types.h> -#include <sys/queue.h> -#include <limits.h> -#include <signal.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <errno.h> - -#include "event2/util.h" -#include "util-internal.h" -#include "log-internal.h" -#include "event2/event.h" -#include "event-internal.h" -#include "evmap-internal.h" -#include "event2/thread.h" -#include "evthread-internal.h" -#include "time-internal.h" - -#define XFREE(ptr) do { if (ptr) mm_free(ptr); } while (0) - -extern struct event_list timequeue; -extern struct event_list addqueue; - -struct win_fd_set { - unsigned int fd_count; - SOCKET fd_array[1]; -}; - -/* MSDN says this is required to handle SIGFPE */ -volatile double SIGFPE_REQ = 0.0f; - -struct idx_info { - int read_pos_plus1; - int write_pos_plus1; -}; - -struct win32op { - unsigned num_fds_in_fd_sets; - int resize_out_sets; - struct win_fd_set *readset_in; - struct win_fd_set *writeset_in; - struct win_fd_set *readset_out; - struct win_fd_set *writeset_out; - struct win_fd_set *exset_out; - unsigned signals_are_broken : 1; -}; - -static void *win32_init(struct event_base *); -static int win32_add(struct event_base *, evutil_socket_t, short old, short events, void *idx_); -static int win32_del(struct event_base *, evutil_socket_t, short old, short events, void *idx_); -static int win32_dispatch(struct event_base *base, struct timeval *); -static void win32_dealloc(struct event_base *); - -struct eventop win32ops = { - "win32", - win32_init, - win32_add, - win32_del, - win32_dispatch, - win32_dealloc, - 0, /* doesn't need reinit */ - 0, /* No features supported. */ - sizeof(struct idx_info), -}; - -#define FD_SET_ALLOC_SIZE(n) ((sizeof(struct win_fd_set) + ((n)-1)*sizeof(SOCKET))) - -static int -grow_fd_sets(struct win32op *op, unsigned new_num_fds) -{ - size_t size; - - EVUTIL_ASSERT(new_num_fds >= op->readset_in->fd_count && - new_num_fds >= op->writeset_in->fd_count); - EVUTIL_ASSERT(new_num_fds >= 1); - - size = FD_SET_ALLOC_SIZE(new_num_fds); - if (!(op->readset_in = mm_realloc(op->readset_in, size))) - return (-1); - if (!(op->writeset_in = mm_realloc(op->writeset_in, size))) - return (-1); - op->resize_out_sets = 1; - op->num_fds_in_fd_sets = new_num_fds; - return (0); -} - -static int -do_fd_set(struct win32op *op, struct idx_info *ent, evutil_socket_t s, int read) -{ - struct win_fd_set *set = read ? op->readset_in : op->writeset_in; - if (read) { - if (ent->read_pos_plus1 > 0) - return (0); - } else { - if (ent->write_pos_plus1 > 0) - return (0); - } - if (set->fd_count == op->num_fds_in_fd_sets) { - if (grow_fd_sets(op, op->num_fds_in_fd_sets*2)) - return (-1); - /* set pointer will have changed and needs reiniting! */ - set = read ? op->readset_in : op->writeset_in; - } - set->fd_array[set->fd_count] = s; - if (read) - ent->read_pos_plus1 = set->fd_count+1; - else - ent->write_pos_plus1 = set->fd_count+1; - return (set->fd_count++); -} - -static int -do_fd_clear(struct event_base *base, - struct win32op *op, struct idx_info *ent, int read) -{ - int i; - struct win_fd_set *set = read ? op->readset_in : op->writeset_in; - if (read) { - i = ent->read_pos_plus1 - 1; - ent->read_pos_plus1 = 0; - } else { - i = ent->write_pos_plus1 - 1; - ent->write_pos_plus1 = 0; - } - if (i < 0) - return (0); - if (--set->fd_count != (unsigned)i) { - struct idx_info *ent2; - SOCKET s2; - s2 = set->fd_array[i] = set->fd_array[set->fd_count]; - - ent2 = evmap_io_get_fdinfo_(&base->io, s2); - - if (!ent2) /* This indicates a bug. */ - return (0); - if (read) - ent2->read_pos_plus1 = i+1; - else - ent2->write_pos_plus1 = i+1; - } - return (0); -} - -#define NEVENT 32 -void * -win32_init(struct event_base *base) -{ - struct win32op *winop; - size_t size; - if (!(winop = mm_calloc(1, sizeof(struct win32op)))) - return NULL; - winop->num_fds_in_fd_sets = NEVENT; - size = FD_SET_ALLOC_SIZE(NEVENT); - if (!(winop->readset_in = mm_malloc(size))) - goto err; - if (!(winop->writeset_in = mm_malloc(size))) - goto err; - if (!(winop->readset_out = mm_malloc(size))) - goto err; - if (!(winop->writeset_out = mm_malloc(size))) - goto err; - if (!(winop->exset_out = mm_malloc(size))) - goto err; - winop->readset_in->fd_count = winop->writeset_in->fd_count = 0; - winop->readset_out->fd_count = winop->writeset_out->fd_count - = winop->exset_out->fd_count = 0; - - if (evsig_init_(base) < 0) - winop->signals_are_broken = 1; - - evutil_weakrand_seed_(&base->weakrand_seed, 0); - - return (winop); - err: - XFREE(winop->readset_in); - XFREE(winop->writeset_in); - XFREE(winop->readset_out); - XFREE(winop->writeset_out); - XFREE(winop->exset_out); - XFREE(winop); - return (NULL); -} - -int -win32_add(struct event_base *base, evutil_socket_t fd, - short old, short events, void *idx_) -{ - struct win32op *win32op = base->evbase; - struct idx_info *idx = idx_; - - if ((events & EV_SIGNAL) && win32op->signals_are_broken) - return (-1); - - if (!(events & (EV_READ|EV_WRITE))) - return (0); - - event_debug(("%s: adding event for %d", __func__, (int)fd)); - if (events & EV_READ) { - if (do_fd_set(win32op, idx, fd, 1)<0) - return (-1); - } - if (events & EV_WRITE) { - if (do_fd_set(win32op, idx, fd, 0)<0) - return (-1); - } - return (0); -} - -int -win32_del(struct event_base *base, evutil_socket_t fd, short old, short events, - void *idx_) -{ - struct win32op *win32op = base->evbase; - struct idx_info *idx = idx_; - - event_debug(("%s: Removing event for "EV_SOCK_FMT, - __func__, EV_SOCK_ARG(fd))); - if (events & EV_READ) - do_fd_clear(base, win32op, idx, 1); - if (events & EV_WRITE) - do_fd_clear(base, win32op, idx, 0); - - return 0; -} - -static void -fd_set_copy(struct win_fd_set *out, const struct win_fd_set *in) -{ - out->fd_count = in->fd_count; - memcpy(out->fd_array, in->fd_array, in->fd_count * (sizeof(SOCKET))); -} - -/* - static void dump_fd_set(struct win_fd_set *s) - { - unsigned int i; - printf("[ "); - for(i=0;i<s->fd_count;++i) - printf("%d ",(int)s->fd_array[i]); - printf("]\n"); - } -*/ - -int -win32_dispatch(struct event_base *base, struct timeval *tv) -{ - struct win32op *win32op = base->evbase; - int res = 0; - unsigned j, i; - int fd_count; - SOCKET s; - - if (win32op->resize_out_sets) { - size_t size = FD_SET_ALLOC_SIZE(win32op->num_fds_in_fd_sets); - if (!(win32op->readset_out = mm_realloc(win32op->readset_out, size))) - return (-1); - if (!(win32op->exset_out = mm_realloc(win32op->exset_out, size))) - return (-1); - if (!(win32op->writeset_out = mm_realloc(win32op->writeset_out, size))) - return (-1); - win32op->resize_out_sets = 0; - } - - fd_set_copy(win32op->readset_out, win32op->readset_in); - fd_set_copy(win32op->exset_out, win32op->writeset_in); - fd_set_copy(win32op->writeset_out, win32op->writeset_in); - - fd_count = - (win32op->readset_out->fd_count > win32op->writeset_out->fd_count) ? - win32op->readset_out->fd_count : win32op->writeset_out->fd_count; - - if (!fd_count) { - long msec = tv ? evutil_tv_to_msec_(tv) : LONG_MAX; - /* Sleep's DWORD argument is unsigned long */ - if (msec < 0) - msec = LONG_MAX; - /* Windows doesn't like you to call select() with no sockets */ - Sleep(msec); - return (0); - } - - EVBASE_RELEASE_LOCK(base, th_base_lock); - - res = select(fd_count, - (struct fd_set*)win32op->readset_out, - (struct fd_set*)win32op->writeset_out, - (struct fd_set*)win32op->exset_out, tv); - - EVBASE_ACQUIRE_LOCK(base, th_base_lock); - - event_debug(("%s: select returned %d", __func__, res)); - - if (res <= 0) { - event_debug(("%s: %s", __func__, - evutil_socket_error_to_string(EVUTIL_SOCKET_ERROR()))); - return res; - } - - if (win32op->readset_out->fd_count) { - i = evutil_weakrand_range_(&base->weakrand_seed, - win32op->readset_out->fd_count); - for (j=0; j<win32op->readset_out->fd_count; ++j) { - if (++i >= win32op->readset_out->fd_count) - i = 0; - s = win32op->readset_out->fd_array[i]; - evmap_io_active_(base, s, EV_READ); - } - } - if (win32op->exset_out->fd_count) { - i = evutil_weakrand_range_(&base->weakrand_seed, - win32op->exset_out->fd_count); - for (j=0; j<win32op->exset_out->fd_count; ++j) { - if (++i >= win32op->exset_out->fd_count) - i = 0; - s = win32op->exset_out->fd_array[i]; - evmap_io_active_(base, s, EV_WRITE); - } - } - if (win32op->writeset_out->fd_count) { - i = evutil_weakrand_range_(&base->weakrand_seed, - win32op->writeset_out->fd_count); - for (j=0; j<win32op->writeset_out->fd_count; ++j) { - if (++i >= win32op->writeset_out->fd_count) - i = 0; - s = win32op->writeset_out->fd_array[i]; - evmap_io_active_(base, s, EV_WRITE); - } - } - return (0); -} - -void -win32_dealloc(struct event_base *base) -{ - struct win32op *win32op = base->evbase; - - evsig_dealloc_(base); - if (win32op->readset_in) - mm_free(win32op->readset_in); - if (win32op->writeset_in) - mm_free(win32op->writeset_in); - if (win32op->readset_out) - mm_free(win32op->readset_out); - if (win32op->writeset_out) - mm_free(win32op->writeset_out); - if (win32op->exset_out) - mm_free(win32op->exset_out); - /* XXXXX free the tree. */ - - memset(win32op, 0, sizeof(*win32op)); - mm_free(win32op); -} - -#endif |