summaryrefslogtreecommitdiff
path: root/poll
Commit message (Collapse)AuthorAgeFilesLines
* The 'flags' field in apr_pollset_private_t looks unused.jailletc362023-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)jorton2023-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.ivan2022-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.ivan2022-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.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.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-qualifiersylavic2022-06-221-2/+2
| | | | | | | | | | * poll/unix/kqueue.c(impl_pollset_add): Cast to (void *) to "break" constantnes of descriptor. Follow up to r1902178. 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 Travisjorton2022-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
* Merge 'win32-pollset-wakeup-no-file-socket-emulation' branch to trunk.ivan2022-02-095-37/+106
| | | | | | | | | | Rework win32 poll wakeup implementation: - Explicitly use apr_socket_t instead of apr_file_t for wakeup `pipe` - Remove code in win32 apr_file_t implementation that emulates working with sockets as files. Sockets on Windows are not kernel objects and should be used only via Winsock API. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1897895 13f79535-47bb-0310-9956-ffa450edef68
* poll: Follow up to r1897521: struct epoll_event's events field is unsigned int.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.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.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).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.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. [Reverted by r1897519] git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1897518 13f79535-47bb-0310-9956-ffa450edef68
* Sync WIN32 local function names with 1.7.x branch -- no functional changemturk2021-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.ylavic2021-11-194-39/+31
| | | | | | | | | | | | | | | | | | If pipe writers (wakeup) put a single byte until it's consumed by the reader (drain), it's enough to use an atomic cas for the writers (still) and an atomic (re)set for the reader (no more cas here). This requires that the reader never blocks on read though (e.g. spurious return from poll), so make the read side on the pipe non-blocking again/finally. Since synchronous non-blocking read is not a thing for Windows' Readfile(), add a ->socket flag to this arch's 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 ↵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 ↵mturk2021-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.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.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.ivan2019-05-272-15/+2
| | | | git-svn-id: http://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.ylavic2018-01-031-1/+1
| | | | git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1819935 13f79535-47bb-0310-9956-ffa450edef68
* poll, kqueue: save a pollfd (mem)copy per returned event.ylavic2018-01-031-5/+5
| | | | git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1819934 13f79535-47bb-0310-9956-ffa450edef68
* poll, port: follow up to r1819860.ylavic2018-01-021-31/+29
| | | | | | | | This test is redundant now, axe it (no functional change). git-svn-id: http://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 theylavic2018-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: http://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.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: http://svn.apache.org/repos/asf/apr/apr/trunk@1819858 13f79535-47bb-0310-9956-ffa450edef68
* * include/arch/unix/apr_arch_poll_private.h,jorton2017-08-188-37/+37
| | | | | | | | poll/unix/poll/*.c: Constify all apr_pollcb_provider_t and apr_pollset_provider_t structures. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1805380 13f79535-47bb-0310-9956-ffa450edef68
* clear the aiocb structure used for asyncio cancel 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: http://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)ylavic2016-08-105-8/+9
| | | | | | | | | number of descriptors/events, before the returned descriptors are actually initialized. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1755758 13f79535-47bb-0310-9956-ffa450edef68
* apr_pollset_poll(): OS/2: follow up to r1755740.ylavic2016-08-101-3/+0
| | | | | | | | The UNIX socket is SOCK_DGRAM, so draining the pipe is another read().. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1755746 13f79535-47bb-0310-9956-ffa450edef68
* apr_pollset_poll(): OS/2: follow up to r923311.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: http://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 flagcovener2016-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: http://svn.apache.org/repos/asf/apr/apr/trunk@1750374 13f79535-47bb-0310-9956-ffa450edef68
* poll/unix/z_asio.c:271]: (style) Suspicious condition (assignment +covener2016-05-191-2/+2
| | | | | | | | | | comparison); Clarify expression with parentheses. PR59582 git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1744600 13f79535-47bb-0310-9956-ffa450edef68
* Revert r1671389; apr_pollset_poll() should return APR_SUCCESStrawick2015-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: http://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.trawick2015-04-051-3/+2
| | | | | | | (APR_SUCCESS was returned instead in that scenario.) git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1671389 13f79535-47bb-0310-9956-ffa450edef68
* Follow up to r1089433: handle impl_pollcb_poll().ylavic2015-03-201-1/+12
| | | | git-svn-id: http://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.ylavic2015-03-201-2/+3
| | | | git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1667914 13f79535-47bb-0310-9956-ffa450edef68
* apr_poll(cb): fix error paths returned values and leaks.ylavic2015-03-136-35/+94
| | | | git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1666341 13f79535-47bb-0310-9956-ffa450edef68
* apr_pollset state fixes for z/OScovener2014-12-191-0/+2
| | | | | | | | | Submitted By: Pat Odonnell <patod us ibm com> Committed By: covener git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1646891 13f79535-47bb-0310-9956-ffa450edef68
* fix memory leakgregames2013-02-021-1/+10
| | | | git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1441742 13f79535-47bb-0310-9956-ffa450edef68
* Minor fixes to quiet valgrind warningssf2013-01-261-1/+1
| | | | git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1438959 13f79535-47bb-0310-9956-ffa450edef68
* no functional change, just flesh out the commentgregames2013-01-231-1/+1
| | | | git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1437607 13f79535-47bb-0310-9956-ffa450edef68
* initialize flags fields to avoid JRAsyncAuthErrgregames2013-01-221-1/+4
| | | | git-svn-id: http://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 callgregames2013-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: http://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 ↵gregames2013-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: http://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 completegregames2013-01-171-13/+28
| | | | | | | * in apr_pollset_remove, don't cancel async i/o if it has already completed git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1434971 13f79535-47bb-0310-9956-ffa450edef68
* change asyncio to take a struct aiocb input arggregames2013-01-171-7/+7
| | | | git-svn-id: http://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 ↵gregames2013-01-171-4/+4
| | | | | | that set it git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1434929 13f79535-47bb-0310-9956-ffa450edef68
* no functional change, whitespace only. remove trailing blanksgregames2013-01-171-65/+65
| | | | git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1434858 13f79535-47bb-0310-9956-ffa450edef68
* give John Brooks credit for his design, but don't feed hisgregames2013-01-081-1/+2
| | | | | | | email to the spammers git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1430410 13f79535-47bb-0310-9956-ffa450edef68