summaryrefslogtreecommitdiffstats
path: root/src/activate (follow)
Commit message (Collapse)AuthorAgeFilesLines
* tree-wide: make use of getpid_cached() wherever we canLennart Poettering2017-07-201-2/+3
| | | | | | | This moves pretty much all uses of getpid() over to getpid_raw(). I didn't specifically check whether the optimization is worth it for each replacement, but in order to keep things simple and systematic I switched over everything at once.
* build-sys: drop automake supportZbigniew Jędrzejewski-Szmek2017-07-181-1/+0
| | | | | v2: - also mention m4
* tree-wide: set SA_RESTART for signal handlers we installLennart Poettering2016-12-011-1/+1
| | | | | We already set it in most cases, but make sure to set it in all others too, and document that that's a good idea.
* activate: improve SIGCHLD handlerEvgeny Vereshchagin2016-04-051-6/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Don't lose children exit codes * Don't receive notification when child processes stop Eliminates annoying "Child died"-messages: $ ./systemd-socket-activate -l 2000 --inetd -a cat ^Z [1]+ Stopped ./systemd-socket-activate -l 2000 --inetd -a cat $ bg %1 [1]+ ./systemd-socket-activate -l 2000 --inetd -a cat & Child 15657 died with code 20 $ ps u 15657 USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND ubuntu 15657 0.0 0.0 4540 680 pts/2 S 00:34 0:00 cat * Don't fail to reap some zombie children Fixes $ ./systemd-socket-activate -l 2000 --inetd -a cat & $ for i in {1..1000}; do echo a | nc localhost 2000 & done $ ps f ... 18235 pts/2 Ss 0:01 -bash 15849 pts/2 S 0:00 \_ ./systemd-socket-activate -l 2000 --inetd -a cat 16081 pts/2 Z 0:00 | \_ [cat] <defunct> 16381 pts/2 Z 0:00 | \_ [cat] <defunct> and many more zombies ...
* tree-wide: make ++/-- usage consistent WRT spacingVito Caputo2016-02-231-4/+4
| | | | | | Throughout the tree there's spurious use of spaces separating ++ and -- operators from their respective operands. Make ++ and -- operator consistent with the majority of existing uses; discard the spaces.
* activate: fix -E option parsingZbigniew Jędrzejewski-Szmek2016-02-191-1/+1
| | | | Fixes #2658.
* activate: allow multiple, possibly invalid, fd namesZbigniew Jędrzejewski-Szmek2016-02-131-31/+53
| | | | | | | | | | | Previous code only allowed a single name to be passed, and duplicated it over all descriptors. For the sake of testing, allow different names and in arbitrary number. If just one is given, duplicate it to match the number of sockets. This matches previuos behaviour. Since this is a testing tool, it seems useful to allow passing invalid names to test application behaviour with invalid names. Hence, only warn. When warning, escape the name.
* activate: add a new switch --inetd to enable inetd-style socket activationLennart Poettering2016-02-101-60/+83
| | | | | | | | | | | Previously, using --accept would enable inetd-style socket activation in addition to per-connection operation. This is now split into two switches: --accept only switches between per-connection or single-instance operation. --inetd switches between inetd-style or new-style fd passing. This breaks the interface of the tool, but given that it is a debugging tool shipped in /usr/lib/systemd/ it's not really a public interface. This change allows testing new-style per-connection daemons.
* activate: minor fixesLennart Poettering2016-02-101-10/+11
|
* activate: add new --seqpacket switch for testing SOCK_SEQPACKET socketsLennart Poettering2016-02-101-11/+22
|
* tree-wide: remove Emacs lines from all filesDaniel Mack2016-02-101-2/+0
| | | | | This should be handled fine now by .dir-locals.el, so need to carry that stuff in every file.
* activate: reorder --help textLennart Poettering2016-02-011-3/+3
| | | | Make sure the --help and --version options are mentioned first, like in all our other tools.
* activate: fix memory allocation for execv() parametersLennart Poettering2016-02-011-9/+29
| | | | | Make sure we construct the full environment block on the heap, so that we can clean things up properly if execv() fails.
* Merge pull request #2080 from ↵Daniel Mack2016-01-221-1/+1
|\ | | | | | | | | chaloulo/split-mode-host-remove-port-from-journal-filename journal-remote: split-mode=host, remove port from journal filename
| * journal-remote: split-mode=host, remove port from journal filenameKlearchos Chaloulos2015-12-011-1/+1
| | | | | | | | | | When constructing the journal filename to store logs from a remote host, remove the port of the tcp connection, as the port will change with every reboot/connection loss between sender/reveiver machines. Having the port in the filename will cause a new journal file to be created for every reboot or connection loss. For the implementation, a new argument "bool include_port" is added to the getpeername_pretty() function. This is passed to the sockaddr_pretty() function. The value of the include_port argument is set to true in all calls of getpeername_pretty(), except for 2 calls in journal-remote.c, where it is set to false.
* | systemd-activate: Add support for datagram socketsSusant Sahani2016-01-221-2/+19
|/ | | | | | | | | core: Add flexible way to provide socket type the socket type should be a diffrent argumet in make_socket_fd . In this way we can set the socket type like SOCK_STREAM SOCK_DGRAM in the address. journal-remote: modify make_socket_fd
* util-lib: split out allocation calls into alloc-util.[ch]Lennart Poettering2015-10-271-1/+2
|
* util-lib: split out fd-related operations into fd-util.[ch]Lennart Poettering2015-10-251-0/+1
| | | | | There are more than enough to deserve their own .c file, hence move them over.
* util-lib: split our string related calls from util.[ch] into its own file ↵Lennart Poettering2015-10-241-0/+1
| | | | | | | | | | | | | | string-util.[ch] There are more than enough calls doing string manipulations to deserve its own files, hence do something about it. This patch also sorts the #include blocks of all files that needed to be updated, according to the sorting suggestions from CODING_STYLE. Since pretty much every file needs our string manipulation functions this effectively means that most files have sorted #include blocks now. Also touches a few unrelated include files.
* activate: validate fdname when accepting itLennart Poettering2015-10-061-0/+5
|
* 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.