Commit graph

22 commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek e0aa372610 activate: export make_socket_fd
Also improve logging to print out the parsed address on error.
2014-03-17 01:55:48 -04:00
Zbigniew Jędrzejewski-Szmek 892213bf1f acticate: rename --environment to --setenv
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.
2013-12-30 00:17:15 -05:00
Lennart Poettering 603938e0a9 activate: fix error checking on epoll_ctl() 2013-12-17 15:42:33 +01:00
Zbigniew Jędrzejewski-Szmek c099716487 activate: clean up inherited descriptors
> [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.
2013-12-10 21:52:57 -05:00
Thomas Hindoe Paaboel Andersen d5d217eae1 remove unused variables 2013-11-18 23:04:16 +01:00
Mantas Mikulėnas ed6556920c activate: fix crash when -s is passed
getopt_long() was told to accept -s which was never implemented.
2013-11-14 00:20:43 +10:00
Mantas Mikulėnas df49ccafc0 activate: mention -E in the help text 2013-11-14 00:19:43 +10:00
Lennart Poettering 9d458c0902 clients: fix some signal handler issues 2013-11-08 14:07:27 +01:00
Lennart Poettering 2c408cb627 activate: print a nice message if no fd to listen on was specified 2013-11-07 16:53:26 +01:00
Lennart Poettering bc80136385 build-sys: add Makefile symlink for src/activate/ 2013-11-07 03:09:59 +01:00
Lennart Poettering 30374ebe5e activate: port to use new getpeername_pretty()/getsockname_pretty() calls 2013-11-07 00:13:58 +01:00
Lennart Poettering 5b84559a76 activate: fix uninitialized memory 2013-11-07 00:13:58 +01:00
Lennart Poettering 175a3d25d0 active: rework make_socket_fd() to be based on socket_address_listen()
Among other things this makes sure we set SO_REUSEADDR which is
immensely useful.
2013-11-06 23:03:12 +01:00
Lennart Poettering eceb8483e5 activate: reduce log settings to normal 2013-11-06 23:03:12 +01:00
Lennart Poettering 29a5ca9baa activate: get rid of redundant definiton of fd_cloexec() 2013-11-06 23:03:12 +01:00
Lennart Poettering eb9da376d7 clients: unify how we invoke getopt_long()
Among other things this makes sure we always expose a --version command
and show it in the help texts.
2013-11-06 18:28:39 +01:00
Jason St. John e9c1ea9de8 replace tabs with spaces in various files
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.
2013-07-02 23:06:22 -04:00
Harald Hoyer 7fd1b19bc9 move _cleanup_ attribute in front of the type
http://lists.freedesktop.org/archives/systemd-devel/2013-April/010510.html
2013-04-18 09:11:22 +02:00
Zbigniew Jędrzejewski-Szmek fff40a51cc activate: do not leak envp on error 2013-03-31 19:01:57 -04:00
Zbigniew Jędrzejewski-Szmek 23ea3dab15 activate: avoid warning from -Wshadow
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;
              ^
2013-03-20 19:16:01 -04:00
Zbigniew Jędrzejewski-Szmek 5e65c93a43 systemd-activate: pass environment variables through
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())'
2013-03-15 22:55:24 -04:00
Zbigniew Jędrzejewski-Szmek 2ca0435be9 systemd-activate: add a socket-activation test tool 2013-02-27 22:10:14 -05:00