summaryrefslogtreecommitdiff
path: root/poll
Commit message (Collapse)AuthorAgeFilesLines
* The 'flags' field in apr_pollset_private_t looks unused.Christophe Jaillet2023-02-191-1/+0
| | | | | | Remove it to save 8 bytes (on 64 bits arch) when such a struct is allocated. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1907751 13f79535-47bb-0310-9956-ffa450edef68
* Fix further strict C99 compliance issue. (fixes #37)Joe Orton2023-01-112-2/+2
| | | | | | | | PR: 66408 Submitted by: Sam James <sam gentoo.org> git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1906594 13f79535-47bb-0310-9956-ffa450edef68
* Remove trailing whitespaces in *.c.Ivan Zhakov2022-11-206-55/+55
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1905414 13f79535-47bb-0310-9956-ffa450edef68
* * poll/unix/wakeup.c: Add final newline.Ivan Zhakov2022-11-191-1/+1
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1905392 13f79535-47bb-0310-9956-ffa450edef68
* poll: Follow up to r1902236: Fix poll() sleeps cases.Yann Ylavic2022-06-262-7/+15
| | | | | | | | | | Don't convert timeout to milliseconds before potentially callig apr_sleep(). Tests for "poll() didn't sleep" now use the real timeout as lower limit. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902258 13f79535-47bb-0310-9956-ffa450edef68
* poll: Round up milliseconds timeouts.Yann Ylavic2022-06-245-18/+15
| | | | | | | | | When converting appr_interval_time_t (usecs) to system call's msecs, round up. apr_*poll() calls should wait *at least* the given timeout, not less. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902236 13f79535-47bb-0310-9956-ffa450edef68
* poll: kqueue: Fix -Wincompatible-pointer-types-discards-qualifiersYann Ylavic2022-06-221-2/+2
| | | | | | | | | * poll/unix/kqueue.c(impl_pollset_add): Cast to (void *) to "break" constantnes of descriptor. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902178 13f79535-47bb-0310-9956-ffa450edef68
* Fix various harmless cases of undefined behaviour, and add a TravisJoe Orton2022-02-141-1/+1
| | | | | | | | | | | | | | | | | | | job testing under UBSan. * poll/unix/poll.c (apr_poll): For the on-stack array allocation use num+1 since allocating a 0-length array is undefined behaviour. * tables/apr_skiplist.c (get_b_rand): Use unsigned integers to avoid signed integer overflow in the left shift. (skiplist_qpush): Avoid calling memcpy(,NULL,0). * random/unix/apr_random.c (apr_random_add_entropy): Avoid calling memcpy(,NULL,0). * test/teststr.c (overflow_strfsize): Avoid signed integer overflow. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1898076 13f79535-47bb-0310-9956-ffa450edef68
* On 'win32-pollset-wakeup-no-file-socket-emulation' branch: Merge changes fromwin32-pollset-wakeup-no-file-socket-emulationIvan Zhakov2022-02-092-53/+86
|\ | | | | | | | | | | trunk. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/win32-pollset-wakeup-no-file-socket-emulation@1897894 13f79535-47bb-0310-9956-ffa450edef68
| * poll: Follow up to r1897521: struct epoll_event's events field is unsigned int.Yann Ylavic2022-01-271-3/+3
| | | | | | | | | | | | | | | | | | EPOLLEXCLUSIVE is 1u << 28 so it doesn't fit in an int16_t, use unsigned for the native epoll events type. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1897548 13f79535-47bb-0310-9956-ffa450edef68
| * poll: Provide APR_POLLEXCL for exclusive wake up on systems that support it.Yann Ylavic2022-01-261-0/+4
| | | | | | | | | | | | | | | | epoll has EPOLLEXCLUSIVE, start with that. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1897521 13f79535-47bb-0310-9956-ffa450edef68
| * poll: Implement APR_POLLSET_NOCOPY for kqueue.Yann Ylavic2022-01-262-50/+79
| | | | | | | | | | | | | | | | | | Like with epoll, it allows to be lockless if the lifetime of the pollfd(s) is garanteed by the user. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1897520 13f79535-47bb-0310-9956-ffa450edef68
| * Revert r1897518 (spurious changes).Yann Ylavic2022-01-263-234/+168
| | | | | | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1897519 13f79535-47bb-0310-9956-ffa450edef68
| * poll: Implement APR_POLLSET_NOCOPY for kqueue.Yann Ylavic2022-01-263-168/+234
| | | | | | | | | | | | | | | | | | Like with epoll, it allows to be lockless if the lifetime of the pollfd(s) is garanteed by the user. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1897518 13f79535-47bb-0310-9956-ffa450edef68
* | On 'win32-pollset-wakeup-no-file-socket-emulation' branch:Ivan Zhakov2022-01-201-3/+3
| | | | | | | | | | | | | | | | | | Windows: Use term `socket_pipe` instead for `file_socket_pipe` for internal poll wakeup socket API. Move implementation to network_io/win32/socket_pipe.c from file_io/win32/pipe.c. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/win32-pollset-wakeup-no-file-socket-emulation@1897246 13f79535-47bb-0310-9956-ffa450edef68
* | On 'win32-pollset-wakeup-no-file-socket-emulation' branch:Ivan Zhakov2022-01-195-37/+106
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Windows: For the pollset wakeup, use apr_socket_t directly instead of using a socket disguised as an apr_file_t. * file_io/win32/pipe.c (): Include apr_arch_networkio.h. (socket_pipe_cleanup, apr_file_socket_pipe_create, apr_file_socket_pipe_close): Update to use apr_socket_t instead of apr_file_t. * include/arch/unix/apr_arch_poll_private.h (WAKEUP_USES_PIPE): New #define to specify mechanism used for pollset wakeup. (apr_pollset_t, apr_pollcb_t): Add wakeup_socket if not WAKEUP_USES_PIPE. (apr_poll_create_wakeup_socket, apr_poll_close_wakeup_socket, apr_poll_drain_wakeup_socket): Declare if not WAKEUP_USES_PIPE. * include/arch/win32/apr_arch_file_io.h (apr_file_socket_pipe_create, apr_file_socket_pipe_close): Update to use apr_socket_t instead of apr_file_t. * poll/unix/poll.c (impl_pollset_add): Remove hack that allows apr_file_t even if APR_FILES_AS_SOCKETS == 0. (impl_pollset_poll, impl_pollcb_poll): Use wakeup_pipe or wakeup_socket depending of WAKEUP_USES_PIPE. * poll/unix/pollcb.c (pollcb_cleanup, apr_pollcb_create_ex, apr_pollcb_wakeup): Use wakeup_pipe or wakeup_socket depending of WAKEUP_USES_PIPE. * poll/unix/pollset.c (pollset_cleanup, apr_pollset_create_ex, apr_pollset_wakeup): Use wakeup_pipe or wakeup_socket depending of WAKEUP_USES_PIPE. * poll/unix/select.c (impl_pollset_add): Remove hack that allows apr_file_t even if APR_FILES_AS_SOCKETS == 0. (impl_pollset_poll): Use wakeup_pipe or wakeup_socket depending of WAKEUP_USES_PIPE. * poll/unix/wakeup.c (apr_poll_create_wakeup_pipe): Rename to apr_poll_create_wakeup_socket() on Windows and use apr_socket_t instead of apr_file_t. (apr_poll_close_wakeup_pipe): Rename to apr_poll_close_wakeup_socket() on Windows and use apr_socket_t instead of apr_file_t. (apr_poll_drain_wakeup_socket): New. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/win32-pollset-wakeup-no-file-socket-emulation@1897208 13f79535-47bb-0310-9956-ffa450edef68
* Sync WIN32 local function names with 1.7.x branch -- no functional changeMladen Turk2021-11-191-4/+4
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1895177 13f79535-47bb-0310-9956-ffa450edef68
* Follow up to r1895106: Use less expensive atomics for wakeup.Yann Ylavic2021-11-194-39/+31
| | | | | | | | | | | | | | | | | | If pipe writers (wakeup) put a single byte until consume it's consumed by the reader (drain), an atomic cas for the writers (still) and an atomic (re)set for the reader is enough (not need to cas on the reader side). This requires that the reader never blocks on read though (e.g. spurious return from poll), so (re)make the read side on the pipe non-blocking (finally). Since synchronous non-blocking read is not a thing for Windows' Readfile(), add a ->socket flag this arch's to apr_file_t (like the existing ->pipe one) which file_socket_pipe_create() will set to make apr_file_read/write() handle non-blocking (nor overlapped) socket pipes with WSARecv/Send(). git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1895175 13f79535-47bb-0310-9956-ffa450edef68
* Follow up to r1895106: now we want blocking reads on unix too so revert ↵Yann Ylavic2021-11-171-4/+2
| | | | | | r1894914. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1895111 13f79535-47bb-0310-9956-ffa450edef68
* Fix drain wakeup pipe issue when multiple threads call ↵Mladen Turk2021-11-178-22/+32
| | | | | | apr_pollset_wakeup/apr_pollcb_wakeup for the same pollset filling up drain pipe. Use atomics so that wakeup call is noop if some other thread allready done this git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1895106 13f79535-47bb-0310-9956-ffa450edef68
* Follow up to r1894914: non-blocking wakeup pipe reads on Windows too.Yann Ylavic2021-11-101-0/+4
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1894917 13f79535-47bb-0310-9956-ffa450edef68
* poll: Fix possible blocking when draining the wakeup pipe.Yann Ylavic2021-11-101-2/+3
| | | | | | | | | | | | | apr_poll_drain_wakeup_pipe() can block if exactly 512 bytes (or multiple thereof) are available on the drained pipe, fix this by setting read end of the pipe nonblocking (the write end is still blocking). Submitted by: Mihaly Szjatinya <mihaly.szjatinya nxlog.org> Reviewed by: ylavic git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1894914 13f79535-47bb-0310-9956-ffa450edef68
* Windows platform: Use WSAPoll directly.Ivan Zhakov2019-05-272-15/+2
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1860159 13f79535-47bb-0310-9956-ffa450edef68
* poll, epoll: pollset's pfd is not modified on poll(), mark it const.Yann Ylavic2018-01-031-1/+1
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1819935 13f79535-47bb-0310-9956-ffa450edef68
* poll, kqueue: save a pollfd (mem)copy per returned event.Yann Ylavic2018-01-031-5/+5
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1819934 13f79535-47bb-0310-9956-ffa450edef68
* poll, port: follow up to r1819860.Yann Ylavic2018-01-021-31/+29
| | | | | | | | This test is redundant now, axe it (no functional change). git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1819861 13f79535-47bb-0310-9956-ffa450edef68
* poll, port: no need to release and re-acquire the lock in between walking theYann Ylavic2018-01-021-8/+5
| | | | | | | | | | pollset and handling the dead ring, all is simple/fast/nonblocking ops. Also, set types of "i" and "j" respectively to the ones of nget and *num. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1819860 13f79535-47bb-0310-9956-ffa450edef68
* poll, port: re-add the wakeup pipe to the pollset after it triggered.Yann Ylavic2018-01-021-18/+15
| | | | | | | | | | Just like user fds (file, socket), otherwise it's one shot only (PR-61786). Corresponding test committed in r1819857. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1819858 13f79535-47bb-0310-9956-ffa450edef68
* * include/arch/unix/apr_arch_poll_private.h,Joe Orton2017-08-188-37/+37
| | | | | | | | poll/unix/poll/*.c: Constify all apr_pollcb_provider_t and apr_pollset_provider_t structures. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1805380 13f79535-47bb-0310-9956-ffa450edef68
* clear the aiocb structure used for asyncio cancel Eric Covener2016-09-021-1/+2
| | | | | | | | | | | | | | The underlying syscall sanity checks some fields we don't later specify, possibly even some fields that are n/a for a cancel operation, which may result in a cancel call failing. outstanding aysnc I/O requests are cancelled when the fd is closed, but with very long-lived sockets, failing cancels could result in elevated CPU during BP4XAIO of type select or cancel. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1759009 13f79535-47bb-0310-9956-ffa450edef68
* apr_pollset_poll(): don't return a positive (nay negative in case of error)Yann Ylavic2016-08-105-8/+9
| | | | | | | | | number of descriptors/events, before the returned descriptors are actually initialized. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1755758 13f79535-47bb-0310-9956-ffa450edef68
* apr_pollset_poll(): OS/2: follow up to r1755740.Yann Ylavic2016-08-101-3/+0
| | | | | | | | The UNIX socket is SOCK_DGRAM, so draining the pipe is another read().. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1755746 13f79535-47bb-0310-9956-ffa450edef68
* apr_pollset_poll(): OS/2: follow up to r923311.Yann Ylavic2016-08-101-4/+14
| | | | | | | | | | Don't return APR_EINTR (woken up) unless we actually read something on the wakeup pipe (which we must drain), and also return APR_SUCCESS if at least some other event is available simultaneously. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1755740 13f79535-47bb-0310-9956-ffa450edef68
* Fix a case where the cleanup for a pollset w/o the thread-safe flagEric Covener2016-06-271-3/+5
| | | | | | | | | | would try to zap a random/garbage message queue identifier. In httpd, this could happen with e.g. mod_cgi's short-lived, non-threadsafe pollset. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1750374 13f79535-47bb-0310-9956-ffa450edef68
* poll/unix/z_asio.c:271]: (style) Suspicious condition (assignment +Eric Covener2016-05-191-2/+2
| | | | | | | | | | comparison); Clarify expression with parentheses. PR59582 git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1744600 13f79535-47bb-0310-9956-ffa450edef68
* Revert r1671389; apr_pollset_poll() should return APR_SUCCESSJeff Trawick2015-04-061-1/+3
| | | | | | | | and the real event if a real event occurs AND apr_pollset_wakeup() is called before apr_pollset_poll() is called and/or awakened. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1671513 13f79535-47bb-0310-9956-ffa450edef68
* poll() implementation of apr_pollset_poll(): Return APR_EINTR as appropriate.Jeff Trawick2015-04-051-3/+2
| | | | | | | (APR_SUCCESS was returned instead in that scenario.) git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1671389 13f79535-47bb-0310-9956-ffa450edef68
* Follow up to r1089433: handle impl_pollcb_poll().Yann Ylavic2015-03-201-1/+12
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1667915 13f79535-47bb-0310-9956-ffa450edef68
* Follow up to r1666341: fix timeout given to poll() from usecs to msecs.Yann Ylavic2015-03-201-2/+3
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1667914 13f79535-47bb-0310-9956-ffa450edef68
* apr_poll(cb): fix error paths returned values and leaks.Yann Ylavic2015-03-136-35/+94
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1666341 13f79535-47bb-0310-9956-ffa450edef68
* apr_pollset state fixes for z/OSEric Covener2014-12-191-0/+2
| | | | | | | | | Submitted By: Pat Odonnell <patod us ibm com> Committed By: covener git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1646891 13f79535-47bb-0310-9956-ffa450edef68
* fix memory leakGreg Ames2013-02-021-1/+10
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1441742 13f79535-47bb-0310-9956-ffa450edef68
* Minor fixes to quiet valgrind warningsStefan Fritsch2013-01-261-1/+1
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1438959 13f79535-47bb-0310-9956-ffa450edef68
* no functional change, just flesh out the commentGreg Ames2013-01-231-1/+1
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1437607 13f79535-47bb-0310-9956-ffa450edef68
* initialize flags fields to avoid JRAsyncAuthErrGreg Ames2013-01-221-1/+4
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1437109 13f79535-47bb-0310-9956-ffa450edef68
* * don't just initialize cancel_a, use it for the asyncio AIO_CANCEL callGreg Ames2013-01-211-1/+2
| | | | | | | | | * reset the state to ASIO_INIT after finding something that wasn't apr_pollset_remove'd on the prior ready ring thanks to Pat O'Donnell / IBM for debugging assistance git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1436667 13f79535-47bb-0310-9956-ffa450edef68
* apr_pollset_remove: use a separate aiocb pointing to the original for ↵Greg Ames2013-01-181-1/+3
| | | | | | | | | cancelling async i/o. this fixes a leak in USS for every keepalive timeout combined with CPU growth on the httpd listener thread git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1434976 13f79535-47bb-0310-9956-ffa450edef68
* * create/set new state ASIO_COMPLETE to track when async i/o is completeGreg Ames2013-01-171-13/+28
| | | | | | | * in apr_pollset_remove, don't cancel async i/o if it has already completed git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1434971 13f79535-47bb-0310-9956-ffa450edef68
* change asyncio to take a struct aiocb input argGreg Ames2013-01-171-7/+7
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1434941 13f79535-47bb-0310-9956-ffa450edef68
* rename state to ASIO_REMOVED to match the name of the apr_pollset_remove API ↵Greg Ames2013-01-171-4/+4
| | | | | | that set it git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1434929 13f79535-47bb-0310-9956-ffa450edef68