unixd.c

Checkout Tools
  • last updated 4 hours ago
Constraints
Constraints: committers
 
Constraints: files
Constraints: dates
Add optional options= argument to Listen to add listener-specific

socket options.

Reimplement "use_specific_errors" listener flag under generic

ap_listen_rec flags field holding all listener-specific options.

* include/ap_listen.h: Add AP_LISTEN_* flags.

(ap_listen_rec): Rename use_specific_errors to flags.

* server/listen.c (make_sock): Set APR_SO_FREEBIND if

AP_LISTEN_FREEBIND flag is set on listener; set APR_SO_REUSEPORT

unconditionally if AP_LISTEN_REUSEPORT is set.

(alloc_listener): Take flags argument.

(ap_setup_listeners): Set AP_LISTEN_SPECIFIC_ERRORS flag here.

(ap_set_listener): Parse optional options=... argument, catch

typos and fail if protocol name contains a "=".

(ap_duplicate_listeners): Duplicate flags.

Submitted by: jkaluza, Lubos Uhliarik <luhliari redhat.com>, jorton

PR: 61865

Github: closes #114

  1. … 5 more files in changeset.
Follow up to r1822537: replace static variable with pool userdata.

Also adds a comment and a CHANGES entry.

  1. … 1 more file in changeset.
mpm_unix(es): cleanup properly on exit in one_process mode.

We can't destroy ap_pglobal in the MPMs because clean_child_exit() runs in

a DSO which would be unloaded under us.

So we defer an ap_terminate() with atexit() in ap_unixd_mpm_set_signals(),

all this is static/builtin code in "os/unix/unixd.c".

Add "AcceptErrorsNonFatal" directive

This tweaks accept() failure processing by having ap_unixd_accept

pass more errors up, and having the MPM's check against a macro

to see if they are in a whitelist of non ENETDOWN/EMFILE kind

of potential process-wide errors.

Default behavior is still to exit.

edit: MMN bump in 1820099.

  1. … 8 more files in changeset.
Fix compilation failure :

unixd.c: In function ‘ap_unixd_mpm_set_signals’:

unixd.c:579:5: error: implicit declaration of function ‘apr_signal’; did you mean ‘strsignal’? [-Werror=implicit-function-declaration]

apr_signal(SIGPIPE, SIG_IGN);

^~~~~~~~~~

strsignal

Not sure where it comes from, maybe related to r1812301.

MPMs unix: follow up to r1809881 and r1809973.

unset_signals() is called when ap_pglobal is destroyed too.

core, MPMs unix: follow up to r1809881.

Deregister all hooks first (in pre_cleanup), by doing it last we could still

have had them run when DSOs were unloaded.

Likewise, avoid double faults when handling fatal signals by restoring the

default handler before pconf is cleared (we can't ap_log_error there).

Finally, we need to ignore sig_term/restart (do nothing) when the main

process is exiting (i.e. ap_pglobal is destroyed), since retained_data are

freed.

Aimed to fix all faults in PR 61558.

  1. … 6 more files in changeset.
MPMs unix: Place signals handlers and helpers out of DSOs to avoid

a possible crash if a signal is caught during (graceful) restart.

PR 60487.

  1. … 8 more files in changeset.
Save a few bytes in conf pool when parsing some directives. Use temp_pool when applicable.
  1. … 2 more files in changeset.
Add missing APLOGNO.

Refactor some lines to keep APLOGNO on the same line as ap_log_error, when applicable.

Split lines longer than 80.

Improve alignment.

  1. … 14 more files in changeset.
'ap_getword_conf' does not return NULL but an empty string if nothing could be got.

So the message 02173 can never trigger.

Actually, this is not a problem because all calls to 'ap_unixd_set_rlimit' are done in configuration parsing functions guarded with AP_INIT_TAKE12, so we are guaranteed to have something.

Fix valgrind warning about uninitialized memory in argument to semctl

PR: 53690

Submitted by: Mikhail T. <mi+apache aldan algebra com>

  1. … 1 more file in changeset.
Various code cleanup to avoid compiler, cppcheck, or clang warnings:

modules/debugging/mod_firehose.c: Make some internal functions static

(to do: logs_cleanup() is unused)

modules/filters/mod_charset_lite.c: Remove dead assignments

modules/filters/mod_include.c: likewise

modules/metadata/mod_usertrack.c: likewise

modules/proxy/mod_proxy_ftp.c: likewise

modules/ssl/ssl_engine_pphrase.c: likewise

modules/proxy/mod_proxy_balancer.c: likewise;

Remove NULL check that can never happen

modules/proxy/proxy_util.c: Axe NULL-check that can never happen and if it

would, it would just mask another bug

os/unix/unixd.c: likewise

modules/http/http_filters.c: Remove sub-condition that is always true

modules/lua/mod_lua.c: Add default cases to switch statements

modules/generators/mod_autoindex.c: Unsigned value can never be < 0

server/util_expr_eval.c: Fix compiler warnings with VC and on OS2

  1. … 12 more files in changeset.
Add lots of unique tags to error log messages

  1. … 172 more files in changeset.
We already have ap_str_tolower(), so also add ap_str_toupper() function and use

it where possible.

  1. … 6 more files in changeset.
fix some logging calls to include the server_rec

(and even the conn_rec in a couple of places)

  1. … 7 more files in changeset.
Per the existing comment and setrlimit() behavior -- only prevent attempts to

raise the hard limit, not to lower it, by nonroot users.

Use the new APLOG_USE_MODULE/AP_DECLARE_MODULE macros everywhere to take

advantage of per-module loglevels

  1. … 169 more files in changeset.
generalize the existing (r589761) platform- and errno-specific

logic to suppress an error message if accept() fails after the

socket has been marked inactive

a message will still be logged, but at debug level instead of error

PR: 49058

revert 759711 and 759713... don't require apr2

0600 is UWRITE+UREAD
Use apr-2 object perms setter
remove TPF support
  1. … 15 more files in changeset.
API Cleanup in preperation for 2.4.x, make sure all exported functions or variables contain an ap_ prefix.

  1. … 28 more files in changeset.
Further unixd hacks to remove duplication between old-unixd and mod_unixd,

and get it working with old MPMS[1] + mod_unixd. It's still an uneasy

split, as some modules (mod_cgid, suexec)[2] also use unixd.

More thinking+hacking due.

[1] Should be prefork/worker/event, but only worker is tested.

[2] cgid is OK, suexec is untested.

  1. … 5 more files in changeset.
Also adjust unixd.c with changes from r709406

Remove all references to CORE_PRIVATE.

  1. … 67 more files in changeset.
Support chroot on unix-family platforms

PR 43596 (Dimitar Pashev)

  1. … 2 more files in changeset.
After a stop or restart signal, the old listening sockets

are closed. "Some platforms" drop out of the accept() with

an EBADF after the sockets have been closed. Such an

error should not clutter the logs.

update license header text
  1. … 316 more files in changeset.