Glenn Strauss
2b4166fb74
[core] fdevent_dup_cloexec()
2020-10-11 12:19:27 -04:00
Glenn Strauss
771ebd39a9
[core] fdevent_load_file_bytes()
...
wrapper to load defined number of bytes from file at given offset
2020-10-11 12:19:27 -04:00
Glenn Strauss
be6da785c5
[mod_deflate] deflate.cache-dir compressed cache
...
(achieves feature parity with mod_compress)
2020-08-02 06:46:22 -04:00
Glenn Strauss
2781a3be6d
[multiple] address coverity warnings
2020-07-10 21:34:28 -04:00
Glenn Strauss
cc04468762
[core] fdevent_load_file() shared code
2020-07-08 22:51:32 -04:00
Glenn Strauss
95b2774863
[core] skip excess close() when FD_CLOEXEC defined
...
do not run through close() loop after fork() and before execve()
when FD_CLOEXEC is defined
2020-07-08 19:54:30 -04:00
Glenn Strauss
3f7779d247
[core] restart dead piped loggers every 64 sec
...
(when piped logger exited too quickly after being restarted
and when server.max-worker = 0)
2020-07-08 19:54:29 -04:00
Glenn Strauss
8588772caa
[core] isolate fdevent subsystem
...
fdevent.c no longer directly uses struct server *srv
srv->srvconf.max_fds (if set) is used to set rlimits
set max_conns in server.c after fdevent_init(), which sets srv->max_fds
using srv->srvconf.max_fds (if set) as input hint
2020-07-08 19:54:29 -04:00
Glenn Strauss
48004c6a7c
[core] remove unused arg to fdevent_fcntl_set_nb*
2020-07-08 19:54:29 -04:00
Glenn Strauss
3cd74a16a2
[core] fdevent uses uint32_t instead of size_t
2020-07-08 19:54:29 -04:00
Glenn Strauss
010c28949c
[multiple] prefer (connection *) to (srv *)
...
convert all log_error_write() to log_error() and pass (log_error_st *)
use con->errh in preference to srv->errh (even though currently same)
avoid passing (server *) when previously used only for logging (errh)
2020-07-08 19:54:28 -04:00
Glenn Strauss
ed62e354ff
[core] use config_plugin_values_init()
2020-07-08 18:08:51 -04:00
Glenn Strauss
12aa0f4c91
[core] save errno before logging if execve() fails
...
(fdevent_fork_execve())
2020-01-26 00:41:06 -05:00
Glenn Strauss
fce489b806
[core] fall back to accept() if accept4() EPERM ( fixes #2998 )
...
On some architectures, accept4() might result in EPERM depending
on Linux kernel and/or glibc support for accept4()
(thx alex-che)
x-ref:
"accept4 returns EPERM instead of ENOSYS on some platforms"
https://redmine.lighttpd.net/issues/2998
2020-01-26 00:41:05 -05:00
Glenn Strauss
c6b46da2c9
[core] retry on some fdevent set/del temporary err
2019-09-07 12:22:04 -04:00
Glenn Strauss
a78404cfbf
[core] fdevent_mkstemp_append() (shared)
2019-03-16 01:38:29 -04:00
Glenn Strauss
37bd124ae4
[core] pass conf.follow_symlink in more places
2019-03-10 23:22:58 -04:00
Glenn Strauss
1fb0d7e295
[core] no SOCK_NONBLOCK on QNX 7.0
...
QNX 7.0 has SOCK_CLOEXEC but not SOCK_NONBLOCK
(thx supergaute)
github: closes #98
x-ref:
"Fix compile error when system has SOCK_CLOEXEC but not SOCK_NONBLOCK"
https://github.com/lighttpd/lighttpd1.4/pull/98
2019-03-07 00:32:17 -05:00
Glenn Strauss
9113011d5b
[core] pass (fdnode *) for registered fdevent fd
...
inline fdevent_fdnode_interest()
avoid array lookup for (fdnode *) for various ops
2019-03-07 00:32:17 -05:00
Glenn Strauss
d76756ca10
[core] perf: pass (fdnode *) to epoll and kqueue
2019-03-07 00:32:17 -05:00
Glenn Strauss
41384a3657
[core] isolate fdevent processing
2019-03-07 00:32:17 -05:00
Glenn Strauss
800e9b7349
[core] remove fde_ndx member outside fdevents
...
(isolated to fdevent framework internals)
2019-03-07 00:32:17 -05:00
Glenn Strauss
0a46f7ec23
[core] some fdevent code streamlining
...
isolate fde_ndx to fdevent framework internals
2019-03-07 00:32:17 -05:00
Glenn Strauss
fc914ae442
[core] map FDEVENT_* to OS system event frameworks
...
(avoid need to translate event flags between OS and lighttpd FDEVENT_*)
2019-02-17 18:35:05 -05:00
Glenn Strauss
f5f221eda8
[core] dispatch events from within event framework
...
event framework now calls interface to dispatch events rather than
itself implementing multiple interfaces for fdevent_process() to
be able to dispatch events generically.
2019-02-13 21:34:59 -05:00
Glenn Strauss
653b0dac7c
[core] fdevent_process()
...
process fdevents in fdevent.c
2019-02-04 03:01:33 -05:00
Glenn Strauss
78024584bb
[core] check if SOCK_NONBLOCK is ignored ( fixes #2883 )
...
x-ref:
"fdevent_init should check if SOCK_NONBLOCK works"
https://redmine.lighttpd.net/issues/2883
2018-08-05 03:44:15 -04:00
Glenn Strauss
04d76e7afd
[core] some header cleanup
...
provide standard types in first.h instead of base.h
provide lighttpd types in base_decls.h instead of settings.h
reduce headers exposed by headers for core data structures
do not expose <pcre.h> or <stdlib.h> in headers
move stat_cache_entry to stat_cache.h
reduce use of "server.h" and "base.h" in headers
2018-04-08 22:22:23 -04:00
Glenn Strauss
d400f8aac5
[core] fdevent_accept_listenfd() nonblock cloexec
...
fdevent_accept_listenfd() now always returns fd O_NONBLOCK O_CLOEXEC
for consistency, rather than setting elsewhere in connection_accepted()
Handle older Linux 2.6 kernels which might have accept4() in glibc,
but return ENOSYS, as accept4() was not added until Linux kernel 2.6.28.
2018-03-25 00:59:48 -04:00
Glenn Strauss
b9df146b3c
[core] non-blocking write() to piped loggers
...
If pipe fills and would block, then discard remaining write.
Do not block lighttpd if the logger blocks, such as if disk fills up.
2018-01-02 21:01:41 -05:00
Glenn Strauss
84b5064dc4
[core] discard from socket using recv MSG_TRUNC
...
discard from socket using recv MSG_TRUNC on Linux TCP SOCK_STREAM socket
Currently, lighttpd supports only TCP SOCK_STREAM. If UDP SOCK_DGRAM
were to be supported in the future, then socket type will need to be
stored so that MSG_TRUNC is used appropriately for the desired effect.
To find out socket type on arbitrary socket fd:
getsockopt(..., SOL_SOCKET, SO_TYPE, ...)
but better to store it with each listening socket.
2017-12-11 21:35:31 -05:00
Glenn Strauss
d5d0258362
[core] support POLLRDHUP, where available ( #2743 )
...
x-ref:
"mod_cgi, lighty not killing CGI if connection in the other end is closed"
https://redmine.lighttpd.net/boards/2/topics/5962
"1.4.40/41 mod_proxy, mod_scgi may trigger POLLHUP on *BSD,Darwin"
https://redmine.lighttpd.net/issues/2743
2017-11-19 12:01:09 -05:00
Glenn Strauss
8f3bbd7f13
[core] isolate backend fdevent handler defs
2017-11-03 23:02:08 -04:00
Glenn Strauss
168f67a1b1
[core] perf: more efficient fdevent_sched_run()
...
perf: more efficient fdevent_sched_run() over fds pending close
2017-10-21 12:34:17 -04:00
Glenn Strauss
93e91954a7
[core] fdevent setsockopt() helper functions
...
fdevent_set_tcp_nodelay()
fdevent_set_so_reuseaddr()
2017-09-23 10:30:08 -04:00
Glenn Strauss
9030cfaecf
[core] SIGCHLD handle_waitpid hook for modules
...
centralize most waitpid() handling in core server, with hooks for
modules to be informed of pid and status when a process exits.
This enables faster discovery (and restart) of exited processes,
and also allows for lighttpd to manage backend processes in the
parent (master) process when server.max-worker > 0.
2017-09-10 16:24:34 -04:00
Glenn Strauss
d4a37a3bbb
[core] remove fdevent fcntl_set hook
...
(could have been removed in 2010 with commit 38f2d1dd
which removed fdevent_linux_rtsig.c)
2017-07-29 00:36:48 -04:00
Glenn Strauss
adeec956c3
[core] restart piped loggers if they exit ( fixes #1393 )
...
x-ref:
"access log pipe writer should restart child process if it exits"
https://redmine.lighttpd.net/issues/1393
2017-07-23 19:02:31 -04:00
Glenn Strauss
ad7d6a6b15
[core] fdevent_cycle_logger()
...
fdevent_cycle_logger() re-opens log files before closing existing fd
2017-07-23 19:02:31 -04:00
Glenn Strauss
91d14acfc3
[core] fdevent_connect_status() shared code
2017-07-15 22:42:15 -04:00
Glenn Strauss
9e75b81982
[core] reduce exposure of unistd.h, other includes
...
reduce exposure of unistd.h, and some other include cleanup
2017-07-15 22:42:15 -04:00
Glenn Strauss
685cab057e
[core] rename fd_close_on_exec()
...
rename fd_close_on_exec() to fdevent_setfd_cloexec()
2017-07-15 22:42:15 -04:00
Glenn Strauss
a9970fec23
[core] consolidate fork()/execve() code ( #1393 )
...
(refactoring work to address issue #1393 )
x-ref:
"access log pipe writer should restart child process if it exits"
https://redmine.lighttpd.net/issues/1393
2017-07-15 22:42:15 -04:00
Glenn Strauss
6f88c28c44
[core] fix compiler warnings on Mac OS X
...
(thx wardw)
2017-06-13 08:56:13 -04:00
Glenn Strauss
69aeaf2fad
[mod_proxy] fix typo identified by coverity
...
fix mod_proxy.c typo identified by coverity
silence some warnings checking return values of fcntl() in fdevent.c
2017-05-15 23:59:22 -04:00
Glenn Strauss
8641d1b03f
[core] no SOCK_CLOEXEC on Linux kernel < 2.6.27
...
Linux kernels < 2.6.27 (old!) might return EINVAL if SOCK_CLOEXEC used
x-ref:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=529929
http://www.linksysinfo.org/index.php?threads/lighttpd-no-longer-starts-toastman-1-28-0510-7.73132/
2017-04-15 17:46:25 -04:00
Glenn Strauss
4796313efc
[core] collect ioctl FIONREAD code
...
include <sys/ioctl.h> in files which use ioctl()
instead of exposing header in local header "sys-socket.h"
2017-03-28 02:17:33 -04:00
Glenn Strauss
ba953cdf45
[core] include "fdevent.h" where needed
...
(instead of providing #include "fdevent.h" in base.h)
2017-03-28 02:17:33 -04:00
Glenn Strauss
a53f662a30
[core] remove some unused header includes
...
remove exposure of stdio.h in buffer.h for print_backtrace(), now static
2017-03-28 02:17:33 -04:00
Glenn Strauss
3399b0dd16
[core] default server.max-fds=4096 if unspecified ( #2789 )
...
x-ref:
"lighttpd cores on AIX when nofiles is unlimited"
https://redmine.lighttpd.net/issues/2789
2017-02-28 11:34:04 -05:00