summaryrefslogtreecommitdiffstats
path: root/src/activate (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* core: add support for naming file descriptors passed using socket activationLennart Poettering2015-10-061-16/+45
| | | | | | | | | | | | | | | | | | | | | | | This adds support for naming file descriptors passed using socket activation. The names are passed in a new $LISTEN_FDNAMES= environment variable, that matches the existign $LISTEN_FDS= one and contains a colon-separated list of names. This also adds support for naming fds submitted to the per-service fd store using FDNAME= in the sd_notify() message. This also adds a new FileDescriptorName= setting for socket unit files to set the name for fds created by socket units. This also adds a new call sd_listen_fds_with_names(), that is similar to sd_listen_fds(), but also returns the names of the fds. systemd-activate gained the new --fdname= switch to specify a name for testing socket activation. This is based on #1247 by Maciej Wereski. Fixes #1247.
* util: introduce common version() implementation and use it everywhereLennart Poettering2015-09-291-8/+5
| | | | | | This also allows us to drop build.h from a ton of files, hence do so. Since we touched the #includes of those files, let's order them properly according to CODING_STYLE.
* tree-wide: whenever we fork off a foreign child process reset signal ↵Lennart Poettering2015-06-101-0/+5
| | | | | | | | | | mask/handlers Also, when the child is potentially long-running make sure to set a death signal. Also, ignore the result of the reset operations explicitly by casting them to (void).
* remove unused includesThomas Hindoe Paaboel Andersen2015-02-231-1/+0
| | | | | | This patch removes includes that are not used. The removals were found with include-what-you-use which checks if any of the symbols from a header is in use.
* treewide: another round of simplificationsMichal Schmidt2014-11-281-12/+6
| | | | | Using the same scripts as in f647962d64e "treewide: yet more log_*_errno + return simplifications".
* treewide: use log_*_errno whenever %m is in the format stringMichal Schmidt2014-11-281-11/+11
| | | | | | | | | | | If the format string contains %m, clearly errno must have a meaningful value, so we might as well use log_*_errno to have ERRNO= logged. Using: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\((".*%m.*")/log_\1_errno(errno, \2/' Plus some whitespace, linewrap, and indent adjustments.
* treewide: more log_*_errno + return simplificationsMichal Schmidt2014-11-281-2/+1
|
* treewide: simplify log_*_errno(r,...) immediately followed by "return r"Michal Schmidt2014-11-281-4/+2
|
* treewide: more log_*_errno() conversions, multiline callsMichal Schmidt2014-11-281-2/+1
| | | | | | | | | | | | Basically: find . -name '*.[ch]' | while read f; do perl -i.mmm -e \ 'local $/; local $_=<>; s/log_(debug|info|notice|warning|error|emergency)\("([^"]*)%s"([^;]*),\s*strerror\(-?([->a-zA-Z_]+)\)\);/log_\1_errno(\4, "\2%m"\3);/gms;print;' \ $f; done Plus manual indentation fixups.
* treewide: no need to negate errno for log_*_errno()Michal Schmidt2014-11-281-1/+1
| | | | It corrrectly handles both positive and negative errno values.
* treewide: auto-convert the simple cases to log_*_errno()Michal Schmidt2014-11-281-1/+1
| | | | | | | | | | | | | As a followup to 086891e5c1 "log: add an "error" parameter to all low-level logging calls and intrdouce log_error_errno() as log calls that take error numbers", use sed to convert the simple cases to use the new macros: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\("(.*)%s"(.*), strerror\(-([a-zA-Z_]+)\)\);/log_\1_errno(-\4, "\2%m"\3);/' Multi-line log_*() invocations are not covered. And we also should add log_unit_*_errno().
* activate: fix fd leak in do_accept()Philippe De Swert2014-09-111-1/+1
| | | | Found with Coverity.
* Unify parse_argv styleZbigniew Jędrzejewski-Szmek2014-08-041-7/+5
| | | | | | | | | | | | | | | | getopt is usually good at printing out a nice error message when commandline options are invalid. It distinguishes between an unknown option and a known option with a missing arg. It is better to let it do its job and not use opterr=0 unless we actually want to suppress messages. So remove opterr=0 in the few places where it wasn't really useful. When an error in options is encountered, we should not print a lengthy help() and overwhelm the user, when we know precisely what is wrong with the commandline. In addition, since help() prints to stdout, it should not be used except when requested with -h or --help. Also, simplify things here and there.
* Always prefer our headers to system headersZbigniew Jędrzejewski-Szmek2014-07-311-1/+1
| | | | | | In practice this shouldn't make much difference, but sometimes our headers might be newer, and we want to test them.
* activate: export make_socket_fdZbigniew Jędrzejewski-Szmek2014-03-171-20/+1
| | | | Also improve logging to print out the parsed address on error.
* acticate: rename --environment to --setenvZbigniew Jędrzejewski-Szmek2013-12-301-15/+15
| | | | | | | Nspawn has --setenv, and systemd itself accepts systemd.setenv. It is nice to have the same parameter name everywhere. Old name is accepted, but not advertised.
* activate: fix error checking on epoll_ctl()Lennart Poettering2013-12-171-4/+6
|
* activate: clean up inherited descriptorsZbigniew Jędrzejewski-Szmek2013-12-111-4/+19
| | | | | | | | | | | | | | | | > [simon@troela server]$ /usr/lib/systemd/systemd-activate -l 9000 main.js > Assertion 'fd == 3 + count' failed at src/activate/activate.c:115, > function open_sockets(). Aborting. > Aborted (core dumped) > after a bit debuging i found the problem: > slim appears to leak an fd into all of its children: > stat /proc/14004/fd/3 (14004 is the pid a random process in my session) > File: '/proc/14004/fd/3' -> '/var/log/slim.log' systemd-activate should be robust against the shell (or anything else) leaking descriptors. Now everything except stdin/stdout/stderr and received sockets will be closed.
* remove unused variablesThomas Hindoe Paaboel Andersen2013-11-181-1/+0
|
* activate: fix crash when -s is passedMantas Mikulėnas2013-11-131-1/+1
| | | | getopt_long() was told to accept -s which was never implemented.
* activate: mention -E in the help textMantas Mikulėnas2013-11-131-0/+2
|
* clients: fix some signal handler issuesLennart Poettering2013-11-081-0/+2
|
* activate: print a nice message if no fd to listen on was specifiedLennart Poettering2013-11-071-2/+6
|
* build-sys: add Makefile symlink for src/activate/Lennart Poettering2013-11-071-0/+1
|
* activate: port to use new getpeername_pretty()/getsockname_pretty() callsLennart Poettering2013-11-071-75/+37
|
* activate: fix uninitialized memoryLennart Poettering2013-11-071-1/+1
|
* active: rework make_socket_fd() to be based on socket_address_listen()Lennart Poettering2013-11-061-0/+30
| | | | | Among other things this makes sure we set SO_REUSEADDR which is immensely useful.
* activate: reduce log settings to normalLennart Poettering2013-11-061-3/+2
|
* activate: get rid of redundant definiton of fd_cloexec()Lennart Poettering2013-11-061-27/+6
|
* clients: unify how we invoke getopt_long()Lennart Poettering2013-11-061-5/+3
| | | | | Among other things this makes sure we always expose a --version command and show it in the help texts.
* replace tabs with spaces in various filesJason St. John2013-07-031-5/+4
| | | | | | | | The affected files in this patch had inconsistent use of tabs vs. spaces for indentation, and this patch eliminates the stray tabs. Also, the opening brace of sigchld_hdl() in activate.c was moved so the opening braces are consistent throughout the file.
* move _cleanup_ attribute in front of the typeHarald Hoyer2013-04-181-4/+4
| | | | http://lists.freedesktop.org/archives/systemd-devel/2013-April/010510.html
* activate: do not leak envp on errorZbigniew Jędrzejewski-Szmek2013-04-011-1/+7
|
* activate: avoid warning from -WshadowZbigniew Jędrzejewski-Szmek2013-03-211-4/+4
| | | | | | | | | src/activate/activate.c:167:51: warning: declaration shadows a variable in the global scope [-Wshadow] static int launch(char* name, char **argv, char **environ, int fds) { ^ /usr/include/unistd.h:546:15: note: previous declaration is here extern char **environ; ^
* systemd-activate: pass environment variables throughZbigniew Jędrzejewski-Szmek2013-03-161-3/+30
| | | | | | | | | | | I need this to test half-installed socket-activated python script, which requires PYTHONPATH and LD_LIBRARY_PATH set. I assume that other people might find it useful to. -E VAR passes through VAR from the environment, while -E VAR=value sets VAR=value. systemd-activate -E PYTHONPATH=/var/tmp/inst1/usr/lib64/python3.3/site-packages -E LD_LIBRARY_PATH=/var/tmp/inst1/usr/lib -l 2000 python3 -c 'from systemd.daemon import listen_fds; print(listen_fds())'
* systemd-activate: add a socket-activation test toolZbigniew Jędrzejewski-Szmek2013-02-281-0/+410