From cf98937cc73201a71fabbd35fd9853cbe2790ed0 Mon Sep 17 00:00:00 2001 From: Zbigniew Jędrzejewski-Szmek Date: Thu, 11 Feb 2016 23:33:09 -0500 Subject: activate: allow multiple, possibly invalid, fd names 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. --- man/systemd-activate.xml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'man') diff --git a/man/systemd-activate.xml b/man/systemd-activate.xml index 995e6eecce..a8e17f2a2a 100644 --- a/man/systemd-activate.xml +++ b/man/systemd-activate.xml @@ -136,13 +136,15 @@ - NAME - - Specify a name for the activation file - descriptors. This is equivalent to setting - FileDescriptorName= in socket unit files, and - enables use of - sd_listen_fds_with_names3. + NAME:NAME... + + Specify names for the file descriptors passed. This is equivalent to setting + FileDescriptorName= in socket unit files, and enables use of + sd_listen_fds_with_names3. + Multiple entries may be specifies using separate options or by separating names with colons + (:) in one option. In case more names are given than descriptors, superflous ones willl be + ignored. In case less names are given than descriptors, the remaining file descriptors will be unnamed. + -- cgit v1.2.3-54-g00ecf From 7f6e804332f50dbd52afe04f5c3ce9db1072c98b Mon Sep 17 00:00:00 2001 From: Zbigniew Jędrzejewski-Szmek Date: Thu, 11 Feb 2016 22:11:33 -0500 Subject: Promote systemd-activate to /usr/bin/systemd-socket-activate It has fairly wide functionality now and the interface has been stable for a while. It it a useful testing tool. The name is changed to better indicate what it does. --- .gitignore | 2 +- Makefile-man.am | 4 +- Makefile.am | 8 +- NEWS | 6 ++ man/systemd-activate.xml | 206 ---------------------------------------- man/systemd-socket-activate.xml | 206 ++++++++++++++++++++++++++++++++++++++++ 6 files changed, 219 insertions(+), 213 deletions(-) delete mode 100644 man/systemd-activate.xml create mode 100644 man/systemd-socket-activate.xml (limited to 'man') diff --git a/.gitignore b/.gitignore index cc24233ab8..4ac63a4e28 100644 --- a/.gitignore +++ b/.gitignore @@ -49,7 +49,6 @@ /systemctl /systemd /systemd-ac-power -/systemd-activate /systemd-analyze /systemd-ask-password /systemd-backlight @@ -109,6 +108,7 @@ /systemd-run /systemd-shutdown /systemd-sleep +/systemd-socket-activate /systemd-socket-proxyd /systemd-stdio-bridge /systemd-sysctl diff --git a/Makefile-man.am b/Makefile-man.am index 28b5fb6adb..f4c9edc42c 100644 --- a/Makefile-man.am +++ b/Makefile-man.am @@ -94,7 +94,6 @@ MANPAGES += \ man/shutdown.8 \ man/sysctl.d.5 \ man/systemctl.1 \ - man/systemd-activate.8 \ man/systemd-analyze.1 \ man/systemd-ask-password-console.service.8 \ man/systemd-ask-password.1 \ @@ -126,6 +125,7 @@ MANPAGES += \ man/systemd-resolve.1 \ man/systemd-run.1 \ man/systemd-sleep.conf.5 \ + man/systemd-socket-activate.1 \ man/systemd-socket-proxyd.8 \ man/systemd-suspend.service.8 \ man/systemd-sysctl.service.8 \ @@ -2574,7 +2574,6 @@ EXTRA_DIST += \ man/standard-options.xml \ man/sysctl.d.xml \ man/systemctl.xml \ - man/systemd-activate.xml \ man/systemd-analyze.xml \ man/systemd-ask-password-console.service.xml \ man/systemd-ask-password.xml \ @@ -2628,6 +2627,7 @@ EXTRA_DIST += \ man/systemd-rfkill.service.xml \ man/systemd-run.xml \ man/systemd-sleep.conf.xml \ + man/systemd-socket-activate.xml \ man/systemd-socket-proxyd.xml \ man/systemd-suspend.service.xml \ man/systemd-sysctl.service.xml \ diff --git a/Makefile.am b/Makefile.am index 676d97c7d4..da94b502a3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3875,13 +3875,13 @@ tests += \ # ------------------------------------------------------------------------------ -rootlibexec_PROGRAMS += \ - systemd-activate +bin_PROGRAMS += \ + systemd-socket-activate -systemd_activate_SOURCES = \ +systemd_socket_activate_SOURCES = \ src/activate/activate.c -systemd_activate_LDADD = \ +systemd_socket_activate_LDADD = \ libshared.la # ------------------------------------------------------------------------------ diff --git a/NEWS b/NEWS index 265847c7bd..80e59c53d3 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,11 @@ systemd System and Service Manager +CHANGES WITH 230 in spe: + + * Testing tool /usr/lib/systemd/systemd-activate is renamed to + systemd-socket-activate and installed into /usr/bin. It is now fully + supported. + CHANGES WITH 229: * The systemd-resolved DNS resolver service has gained a substantial diff --git a/man/systemd-activate.xml b/man/systemd-activate.xml deleted file mode 100644 index a8e17f2a2a..0000000000 --- a/man/systemd-activate.xml +++ /dev/null @@ -1,206 +0,0 @@ - - - - - - - - - systemd-activate - systemd - - - - Developer - Zbigniew - Jędrzejewski-Szmek - zbyszek@in.waw.pl - - - - - - systemd-activate - 8 - - - - systemd-activate - Test socket activation of daemons - - - - - /usr/lib/systemd/systemd-activate - OPTIONS - daemon - OPTIONS - - - - - Description - - systemd-activate may be used to launch a socket-activated service binary from the command - line for testing purposes. It may also be used to launch individual instances of the service binary per connection. - - - The daemon to launch and its options should be specified - after options intended for systemd-activate. - - - If the option is given, the socket file descriptor will be used as the standard - input and output of the launched process. Otherwise, standard input and output will be inherited, and sockets will - be passed through file descriptors 3 and higher. Sockets passed through $LISTEN_FDS to - systemd-activate will be passed through to the daemon, in the original positions. Other sockets - specified with will use consecutive descriptors. By default, - systemd-activate listens on a stream socket, use and - to listen on datagram or sequential packet sockets instead (see below). - - - - - Options - - - - - - Listen on this address. - Takes a string like 2000 or - 127.0.0.1:2001. - - - - - - - - Launch an instance of the service binary for each connection and pass the connection - socket. - - - - - - - Listen on a datagram socket (SOCK_DGRAM), instead of a stream socket - (SOCK_STREAM). May not be combined with . - - - - - - Listen on a sequential packet socket (SOCK_SEQPACKET), instead of a stream - socket (SOCK_STREAM). May not be combined with - . - - - - - - Use the inetd protocol for passing file descriptors, i.e. as standard input and standard - output, instead of the new-style protocol for passing file descriptors using $LISTEN_FDS - (see above). - - - - - - - Add this variable to the environment of the - launched process. If VAR is - followed by =, assume that it is a - variable–value pair. Otherwise, obtain the value from the - environment of systemd-activate itself. - - - - - NAME:NAME... - - Specify names for the file descriptors passed. This is equivalent to setting - FileDescriptorName= in socket unit files, and enables use of - sd_listen_fds_with_names3. - Multiple entries may be specifies using separate options or by separating names with colons - (:) in one option. In case more names are given than descriptors, superflous ones willl be - ignored. In case less names are given than descriptors, the remaining file descriptors will be unnamed. - - - - - - - - - - Environment variables - - - $LISTEN_FDS - $LISTEN_PID - $LISTEN_FDNAMES - - See - sd_listen_fds3. - - - - $SYSTEMD_LOG_TARGET - $SYSTEMD_LOG_LEVEL - $SYSTEMD_LOG_COLOR - $SYSTEMD_LOG_LOCATION - - Same as in - systemd1. - - - - - - Examples - - - Run an echo server on port 2000 - - $ /usr/lib/systemd/systemd-activate -l 2000 --inetd -a cat - - - - Run a socket-activated instance of <citerefentry><refentrytitle>systemd-journal-gatewayd</refentrytitle><manvolnum>8</manvolnum></citerefentry> - - $ /usr/lib/systemd/systemd-activate -l 19531 /usr/lib/systemd/systemd-journal-gatewayd - - - - - See Also - - systemd1, - systemd.socket5, - systemd.service5, - sd_listen_fds3, - sd_listen_fds_with_names3, - cat1 - - - diff --git a/man/systemd-socket-activate.xml b/man/systemd-socket-activate.xml new file mode 100644 index 0000000000..5d7f157c72 --- /dev/null +++ b/man/systemd-socket-activate.xml @@ -0,0 +1,206 @@ + + + + + + + + + systemd-socket-activate + systemd + + + + Developer + Zbigniew + Jędrzejewski-Szmek + zbyszek@in.waw.pl + + + + + + systemd-socket-activate + 1 + + + + systemd-socket-activate + Test socket activation of daemons + + + + + systemd-socket-activate + OPTIONS + daemon + OPTIONS + + + + + Description + + systemd-socket-activate may be used to launch a socket-activated service binary from the command + line for testing purposes. It may also be used to launch individual instances of the service binary per connection. + + + The daemon to launch and its options should be specified + after options intended for systemd-socket-activate. + + + If the option is given, the socket file descriptor will be used as the standard + input and output of the launched process. Otherwise, standard input and output will be inherited, and sockets will + be passed through file descriptors 3 and higher. Sockets passed through $LISTEN_FDS to + systemd-socket-activate will be passed through to the daemon, in the original positions. Other sockets + specified with will use consecutive descriptors. By default, + systemd-socket-activate listens on a stream socket, use and + to listen on datagram or sequential packet sockets instead (see below). + + + + + Options + + + + + + Listen on this address. + Takes a string like 2000 or + 127.0.0.1:2001. + + + + + + + + Launch an instance of the service binary for each connection and pass the connection + socket. + + + + + + + Listen on a datagram socket (SOCK_DGRAM), instead of a stream socket + (SOCK_STREAM). May not be combined with . + + + + + + Listen on a sequential packet socket (SOCK_SEQPACKET), instead of a stream + socket (SOCK_STREAM). May not be combined with + . + + + + + + Use the inetd protocol for passing file descriptors, i.e. as standard input and standard + output, instead of the new-style protocol for passing file descriptors using $LISTEN_FDS + (see above). + + + + + + + Add this variable to the environment of the + launched process. If VAR is + followed by =, assume that it is a + variable–value pair. Otherwise, obtain the value from the + environment of systemd-socket-activate itself. + + + + + NAME:NAME... + + Specify names for the file descriptors passed. This is equivalent to setting + FileDescriptorName= in socket unit files, and enables use of + sd_listen_fds_with_names3. + Multiple entries may be specifies using separate options or by separating names with colons + (:) in one option. In case more names are given than descriptors, superflous ones willl be + ignored. In case less names are given than descriptors, the remaining file descriptors will be unnamed. + + + + + + + + + + Environment variables + + + $LISTEN_FDS + $LISTEN_PID + $LISTEN_FDNAMES + + See + sd_listen_fds3. + + + + $SYSTEMD_LOG_TARGET + $SYSTEMD_LOG_LEVEL + $SYSTEMD_LOG_COLOR + $SYSTEMD_LOG_LOCATION + + Same as in + systemd1. + + + + + + Examples + + + Run an echo server on port 2000 + + $ systemd-socket-activate -l 2000 --inetd -a cat + + + + Run a socket-activated instance of <citerefentry><refentrytitle>systemd-journal-gatewayd</refentrytitle><manvolnum>8</manvolnum></citerefentry> + + $ systemd-socket-activate -l 19531 /usr/lib/systemd/systemd-journal-gatewayd + + + + + See Also + + systemd1, + systemd.socket5, + systemd.service5, + sd_listen_fds3, + sd_listen_fds_with_names3, + cat1 + + + -- cgit v1.2.3-54-g00ecf