summaryrefslogtreecommitdiff
path: root/src/fdevent_impl.c
Commit message (Collapse)AuthorAgeFilesLines
* [core] always decr fd count upon socket close()Glenn Strauss2023-05-031-2/+3
| | | | | | | | | | | | | | always decr fd count in connection_close() always decr fd count in fdevent_sched_run() Error return value from close() should be used for diagnostics and recovery, but the state of the file descriptor is unspecified by POSIX. On most systems, it is invalid to redo close(). (Linux 'man 2 close' suggests that HP-UX is an outlier, and that a future POSIX standard update will specify the behavior for the file descriptor to be closed) EBADF should not happen in those funcs for lighttpd since those should be the only locations in lighttpd where those fds are closed.
* [core] _WIN32 use log_serror() for WSAGetLastErrorGlenn Strauss2023-05-031-2/+2
|
* [core] _WIN32 alternative fdarray for WindowsGlenn Strauss2023-05-031-5/+69
| | | | | | | | | | | | | | | | | | | _WIN32 SOCKET (long long unsigned) handles are assigned differently from how POSIX allocates file descriptors (lowest number available). On _WIN32, the SOCKET descriptor should not be used to index an array of (fdnode *), so this commit provides an alternative method to store (fdnode *) for use by select() and by WSAPoll(). select(): commonly used unix select() idioms may be incorrect on _WIN32 https://devblogs.microsoft.com/oldnewthing/20221102-00/?p=107343 https://devblogs.microsoft.com/oldnewthing/20161221-00/?p=94985 WSAPoll(): https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsapoll As of Windows 10 version 2004, when a TCP socket fails to connect, (POLLHUP | POLLERR | POLLWRNORM) is indicated. (note: this was broken in WSAPoll() in all earlier Windows versions)
* [core] _WIN32 clock ticks and timeGlenn Strauss2023-05-031-1/+1
|
* [core] _WIN32 socket-compat, filesystem-compatGlenn Strauss2023-05-031-0/+2
| | | | | | | | | | | | | | | | | | | | _WIN32 is sufficiently different -- *different*; not better -- that isolating _WIN32 code is clearer than #ifdef _WIN32 in almost every func in fdevent.c _WIN32-specific fdevent_socket_* funcs _WIN32 SOCKET fds must be closed with closesocket(), not close() _WIN32 HANDLE_FLAG_INHERIT for FD_CLOEXEC _WIN32 use _sopen_s() without _O_TEMPORARY Use _sopen_s() without _O_TEMPORARY in fdevent_mkostemp(). _O_TEMPORARY would remove file once last handle to file is closed. Temporary files in chunkqueue may be closed for large request/response _WIN32 fdevent_rename() using MoveFileExA _WIN32 rename() fails if the target file already exists. Alternatives are MoveFileExA() or ReplaceFileA(). Both of the above fail if either oldfile or newfile are open, so - not atomic - may fail sporadically
* [core] _WIN32 sys-unistd.h to wrap <unistd.h>Glenn Strauss2023-05-031-1/+1
| | | | (selective implementations; not complete)
* [core] fdevent_poll_poll avoid potential raceGlenn Strauss2023-02-041-5/+4
| | | | fdevent_poll_poll avoid potential race with pollfds list being extended
* [core] avoid select() FD_ISSET repeat on active fdsGlenn Strauss2023-02-031-35/+15
|
* [core] pass fdn to fdevent_sched_close,_unregisterGlenn Strauss2023-01-231-19/+5
| | | | remove issock flag; on _WIN32, select(), WSAPoll() work only on sockets
* [multiple] employ ck_calloc, ck_malloc shared codeGlenn Strauss2022-12-101-17/+6
| | | | | employ ck_calloc(), ck_malloc() shared code to slightly reduce code size (centralize the ck_assert() to check that memory allocation succeeded)
* [multiple] employ ck_realloc_u32() shared codeGlenn Strauss2022-12-101-5/+4
| | | | employ ck_realloc_u32() shared code to slightly reduce code size
* [core] remove libev fdevent option (ignore)Glenn Strauss2022-12-031-149/+0
| | | | lighttpd directly uses native OS event handlers
* [core] libev EV_ERROR conflicts with kqueueGlenn Strauss2021-11-041-0/+7
| | | | libev EV_ERROR conflicts with kqueue sys/event.h EV_ERROR
* [core] close backend socket fds more quicklyGlenn Strauss2021-11-031-1/+1
| | | | | | | | | | | (thx ThomasDevoogdt) close backend socket fds more quickly by polling with zero timeout when there are pending fds scheduled to be closed after the next poll. x-ref: "Slow request handling in Lighttpd 1.4.60" https://redmine.lighttpd.net/boards/2/topics/10063
* [core] merge fdevent impls into fdevent_impl.cGlenn Strauss2021-11-021-0/+799
|
* [core] fdevent_impl.c separate from fdevent.cGlenn Strauss2021-11-011-0/+318