3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/os-specific/linux/sdnotify-wrapper/sdnotify-wrapper.c

175 lines
5.8 KiB
C
Raw Normal View History

2019-02-03 15:50:04 +00:00
/*
skawarePackages: 2021-01 release Maintainer notes ----- The execline exec function interface changed quite drastically, and backwards-compatibility to the old functions was dropped in-between the last release and this one. Thus, downstream code might break. At the end of this commit message is a compatibility interface. ----- Release notes ----- Hello, Happy New Year to everyone! New versions of the skarnet.org packages are available. This is a major release. The skalibs major version number has been bumped, which means that compatibility with previous versions is not ensured. Other packages have been updated to build against the new skalibs. If they only had their patch number increased, that's all the modifications they had (save for possible bugfixes); but some packages also received significant changes and underwent either a major (compatibility not ensured) or minor (simple additions) release. Support for the 2.9.* branch of skalibs, and associated versions of the other packages, is still ensured for a while, but users are always strongly encouraged to upgrade. * General ------- - Some rarely-triggered build bugs have been fixed. - -fno-stack-protector is not part of the default CFLAGS anymore; stack protector policy now defaults to the compiler's settings. * skalibs-2.10.0.0 ---------------- - Bugfixes. - Significant code cleanup. - New sysdep: chroot. - Lots of new functions, mostly to optimize the number of needed fcntl() calls at open() time. Traces should generally be marginally shorter than they were before. - Removal of the DJBUNIX_FLAG_NB and DJBUNIX_FLAG_COE macros, replaced by the POSIX O_NONBLOCK and O_CLOEXEC macros wherever they were used. - Removal of the skalibs/webipc.h header, and better header separation. - Complete revamping of the pathexec functions, now separated into exec_* (simple execution) and mexec_* (execution with merging of the environment first). In true skalibs fashion, there is a little code, and 3 pages of convenience macros (the exec.h header). - Complete rewrite of the locking functions, with a change of underlying mechanisms. The skalibs locking primitives are now named fd_lock(), fd_unlock() and fd_islocked(). The Unix locks primitive space is a horror show. flock() is not POSIX and does not have a way to test for a lock without taking it. The POSIX lockf() only has exclusive locks, not shared ones. The least bad option is fcntl(), which has shared and exclusive locks *and* a way to check for a lock without taking it, but does not allow taking a shared lock via a O_WRONLY file descriptor. Of all inconveniences this is the most minor one, so now skalibs uses fcntl(). https://skarnet.org/software/skalibs/ git://git.skarnet.org/skalibs * nsss-0.1.0.0 ------------ - New --enable-libc-includes configure option. Without this option, the pwd.h, grp.h and shadow.h headers are not installed anymore, so by default installing nsss on a FHS system does not overwrite the libc headers. https://skarnet.org/software/nsss/ git://git.skarnet.org/nsss * utmps-0.1.0.0 ------------- - New --enable-libc-includes configure option. Without this option, the utmpx.h header is not installed anymore, so by default installing utmps on a FHS system does not overwrite the libc headers. https://skarnet.org/software/utmps/ git://git.skarnet.org/utmps * execline-2.7.0.0 ---------------- - Bugfixes. - The trap program has changed. The "timeout" directive has been removed; a "default" directive has been added, to handle all signals for which a specific directive has not been given. Subprograms are now run with the SIGNAL environment variable set to the signal number (in addition to ! always being set to the application's pid). - The forstdin program has changed. It now exits 0 if it has read at least one line, and 1 otherwise. - The default list of delimiters for backtick, withstdinas, forstdin and forbacktickx has been set to "\n", so by default those programs will read and/or split on lines and only lines. - The backtick, withstdinas, forstdin, forbacktickx, forx, getpid and getcwd programs now have a -E option to activate autoimport. (This saves the user from manually adding "importas var var" after every use of these programs.) https://skarnet.org/software/execline/ git://git.skarnet.org/execline * s6-2.10.0.0 ----------- It is imperative to restart your supervision trees, by rebooting if necessary, after upgrading s6 to the new version. Otherwise, new s6 binaries interacting with service directories maintained by old s6-supervise binaries may not work. If you are using s6-linux-init, it is necessary to upgrade to the latest version of s6-linux-init at the same time as s6. - Bugfixes. - Significant code refactoring. - The internal locking system of service directories has changed, allowing for a cleaner permissions model and official support of relaxed permissions. - New binary to implement those relaxed permissions: s6-svperms. - The "nosetsid" file is not supported anymore in service directories. Services are now always started in a new session. - s6-supervise now traps SIGINT: before dying, it sends a SIGINT to its service's process group. This allows correct transmission of ^C when a supervision tree is running in a terminal, even though every service runs in its own session. - s6-svc -X doesn't exist anymore. s6-supervise now always closes stdin and stdout on the last execution of the service. - The semantics of SIGHUP and SIGQUIT have changed for s6-supervise. - The set of commands sent by s6-svscanctl and received by s6-svscan has been cleaned up and made more logical. - When told to exit normally (typically via s6-svscanctl -t), s6-svscan now first waits for the whole supervision tree to die. The .s6-svscan/finish script can now assume that all services are completely down. (s6-svscanctl -b is an exception; it should not be used in normal circumstances.) - The -s and -S options to s6-svscan are not supported anymore. Signal management in s6-svscan has been streamlined: signals have a default handler that can be overridden by a corresponding executable .s6-svscan/SIGfoo file. - Default signal handlers for s6-svscan have more intuitive semantics. - New binary to help with management of user-owned supervision trees: s6-usertree-maker. https://skarnet.org/software/s6/ git://git.skarnet.org/s6 s6 now has man pages! Thanks to flexibeast for performing the conversion work. Please allow some time for the man pages to be updated to reflect the current HTML documentation. The repository can be found here: https://github.com/flexibeast/s6-man-pages * s6-linux-init-1.0.6.0 --------------------- It *is necessary* to upgrade s6-linux-init at the same time as s6. It *is recommended*, although not strictly necessary, to create your run-image directory again via a s6-linux-init-maker invocation. Old images will still boot, as long as you are using an upgraded version of s6-linux-init; but they may incorrectly handle signals sent to init, so for instance Ctrl-Alt-Del may not work anymore, until you run s6-linux-init-maker again. - New internal binary: s6-linux-init-nuke. This program is not meant to be invoked by users directly: it simply removes a dependency to the 'kill' program in a rare case involving containers. https://skarnet.org/software/s6-linux-init/ git://git.skarnet.org/s6-linux-init * s6-dns-2.3.4.0 -------------- - New library function: s6dns_message_parse_question(). https://skarnet.org/software/s6-dns/ git://git.skarnet.org/s6-dns * s6-networking-2.4.0.0 --------------------- - Important refactoring of the tls code. The crypto tunnel now runs as a child of the application, instead of the other way around. It is now isolated in a s6-tls[cd]-io binary; s6-tlsc is now a simple wrapper around s6-tlsc-io, and s6-tlsd is a simple wrapper around s6-tlsd-io. - New binaries: s6-ucspitlsc and s6-ucspitlsd. Those implement opportunistic TLS via the UCSPI-TLS protocol. - The -K option to the tls binaries has changed semantics: it now enforces a timeout for the handshake instead of dropping the connection after some inactivity. Note that this option is only useful with the bearssl backend: the libtls backend always performs a synchronous handshake, with no way of interrupting it after a timeout expires. - The execline dependency is now optional. Disabling execline, however, changes the behaviour of s6-tcpserver-access (which cannot support exec files without it). https://skarnet.org/software/s6-networking/ git://git.skarnet.org/s6-networking It is now possible to build the s6-networking package against OpenSSL instead of LibreSSL, thanks to the libretls project: https://git.causal.agency/libretls/about/ * mdevd-0.1.3.0 ------------- - New -C option to the mdevd program. This option makes mdevd automatically spawn a mdevd-coldplug program when it's ready, allowing mdevd to be used as a drop-in mdev -d replacement. (Note that the coldplug is also performed if mdevd restarts after being killed, so this feature should not be used in place of a proper service startup sequence with a mdevd-coldplug oneshot depending on the mdevd longrun. It has only been added for convenience.) https://skarnet.org/software/mdevd/ git://git.skarnet.org/mdevd * Other packages -------------- The following packages have received an update so they build with the latest version of skalibs and other dependencies, but nothing has changed except possibly some bugfixes, and hopefully not too many bug additions. - s6-rc-0.5.2.1. (It is not necessary to recompile your service database. However, it is necessary to upgrade s6-rc along with s6, and to reboot the system ASAP after upgrading.) - s6-portable-utils-2.2.3.1 - s6-linux-utils-2.5.1.4 - bcnm-0.0.1.2 Enjoy, Bug-reports welcome. -- Laurent ----- execline compat interface ----- /* Compatibility */ #define pathexec_run(file, argv, envp) exec_ae(file, argv, envp) #define pathexec0_run(file, argv, envp) exec0_ae(file, argv, envp) #define xpathexec_run(file, argv, envp) xexec_ae(file, argv, envp) #define xpathexec0_run(file, argv, envp) xexec0_ae(file, argv, envp) #define pathexec_env(key, value) env_mexec(key, value) #define pathexec_fromenv(argv, envp, envlen) mexec_f(argv, envp, envlen) #define pathexec(argv) mexec(argv) #define pathexec0(argv) mexec0(argv) #define xpathexec_fromenv(argv, envp, envlen) xmexec_f(argv, envp, envlen) #define xpathexec(argv) xmexec(argv) #define xpathexec0(argv) xmexec0(argv) #define pathexec_r_name(file, argv, envp, envlen, modif, modiflen) mexec_afm(file, argv, envp, envlen, modif, modiflen) #define pathexec_r(argv, envp, envlen, modif, modiflen) mexec_fm(argv, envp, envlen, modif, modiflen) #define xpathexec_r_name(file, argv, envp, envlen, modif, modiflen) xmexec_afm(file, argv, envp, envlen, modif, modiflen) #define xpathexec_r(argv, envp, envlen, modif, modiflen) xmexec_fm(argv, envp, envlen, modif, modiflen) #endif copied from https://github.com/skarnet/skalibs/commit/18e43565574b700befc832ed4d25d25e40951f68#diff-69efbe5d997280a1430a6af2fa38e3f5105e706076a26fc751885c505ca598c6R140
2021-01-21 18:54:13 +00:00
Copyright: (C)2015-2020 Laurent Bercot. http://skarnet.org/
2019-02-03 15:50:04 +00:00
ISC license. See http://opensource.org/licenses/ISC
skawarePackages: Fall 2021 release Maintainers Notes below. ~~~ Hello, New versions of all the skarnet.org packages are available. skalibs has undergone a major update, with a few APIs having disappeared, and others having changed. Compatibility with previous versions is *not* assured. Consequently, all the rest of the skarnet.org software has undergone at least a release bump, in order to build with the new skalibs. But some packages also have new functionality added (hence, a minor bump), and others also have their own incompatible changes (hence, a major bump). The new versions are the following: skalibs-2.11.0.0 (major) nsss-0.2.0.0 (major) utmps-0.1.0.3 (release) execline-2.8.1.0 (minor) s6-2.11.0.0 (major) s6-rc-0.5.2.3 (release) s6-portable-utils-2.2.3.3 (release) s6-linux-utils-2.5.1.6 (release) s6-linux-init-1.0.6.4 (release) s6-dns-2.3.5.2 (release) s6-networking-2.5.0.0 (major) mdevd-0.1.5.0 (minor) bcnm-0.0.1.4 (release) dnsfunnel-0.0.1.2 (release) Additionally, a new package has been released: smtpd-starttls-proxy-0.0.1.0 Dependencies have all been updated to the latest versions. They are, this time, partially strict: libraries and binaries may build with older releases of their dependencies, but not across major version bumps. The safest approach is to upgrade everything at the same time. You do not need to recompile your s6-rc service databases or recreate your s6-linux-init run-images. You should restart your supervision tree after upgrading skalibs and s6, as soon as is convenient for you. Details of major and minor package changes follow. * skalibs-2.11.0.0 ---------------- - A lot of obsolete or useless functionality has been removed: libbiguint, rc4, md5, iobuffer, skasigaction, environ.h and getpeereid.h headers, various functions that have not proven their value in a while. - Some functions changed signatures or changed names, or both. - All custom types ending in _t have been renamed, to avoid treading on POSIX namespace. (The same change has not been done yet in other packages, but skalibs was the biggest offender by far.) - Signal functions have been deeply reworked. - cdb has been reworked, the API is now more user-friendly. - New functions have been added. The deletion of significant portions of code has made skalibs leaner. libskarnet.so has dropped under 190 kB on x86_64. The cdb rewrite on its own has helped reduce an important amount of boilerplate in cdb-using code. All in all, code linked against the new skalibs should be slightly smaller and use a tiny bit less RAM. https://skarnet.org/software/skalibs/ git://git.skarnet.org/skalibs * nsss-0.2.0.0 ------------ - Bugfixes. - nsss-switch wire protocol slightly modified, which is enough to warrant a major version bump. - _r functions are now entirely thread-safe. - Spawned nsssd programs are now persistent and only expire after a timeout on non-enumeration queries. This saves a lot of forking with applications that can call primitives such as getpwnam() repeatedly, as e.g. mdevd does when initially parsing its configuration file. - New nsssd-switch program, implementing real nsswitch functionality by dispatching queries to various backends according to a script. It does not dlopen a single library or read a single config file. https://skarnet.org/software/nsss/ git://git.skarnet.org/nsss * execline-2.8.1.0 ---------------- - Bugfixes. - New binary: case. It compares a value against a series of regular expressions, executing into another command line on the first match. https://skarnet.org/software/execline/ git://git.skarnet.org/execline * s6-2.11.0.0 ----------- - Bugfixes. - Some libs6 header names have been simplified. - s6-svwait now accepts -r and -R options. - s6-supervise now reads an optional lock-fd file in the service directory; if it finds one, the first action of the service is to take a blocking lock. This prevents confusion when a controller process dies while still leaving workers holding resources; it also prevents log spamming on user mistakes (autobackgrounding services, notably). - New binaries: s6-socklog, s6-svlink, s6-svunlink. The former is a rewrite of smarden.org's socklog program, in order to implement a fully functional syslogd with only s6 programs. The latter are tools that start and stop services by symlinking/unlinking service directories from a scan directory, in order to make it easier to integrate s6-style services in boot scripts for sequential service managers such as OpenRC. https://skarnet.org/software/s6/ git://git.skarnet.org/s6 * s6-networking-2.5.0.0 --------------------- - Bugfixes. - minidentd has been removed. It was an old and somehow still buggy piece of code that was only hanging around for nostalgia reasons. - Full support for client certificates. Details of the client certificate are transmitted to the application via environment variables (or via an environment string in the case of opportunistic TLS). - Full SNI support, including server-side. (That involved a deep dive into the bearssl internals, which is why it took so long.) The filenames containing secret keys and certificates for <domain> are read in the environment variables KEYFILE:<domain> and CERTFILE:<domain>. Complete client certificate and SNI support now make the TLS part of s6-networking a fully viable replacement of stunnel and other similar TLS tunneling tools. This is most interesting when s6-networking is built against bearssl, which uses about 1/9 of the resources that OpenSSL needs. https://skarnet.org/software/s6-networking/ git://git.skarnet.org/s6-networking * mdevd-0.1.5.0 ------------- - A new option to mdevd is available: -O <nlgroups>. This option makes mdevd rebroadcast uevents to a netlink group (or set of netlink groups) once they have been handled. This allows applications to read uevents from a netlink group *after* the device manager is done with them. This is useful, for instance, when pairing mdevd with libudev-zero for full udev emulation. - The * and & directives, which previously were only triggered by "add" and "remove" actions, are now triggered by *all* action types. This gives users full scripting access to any event, which can be used to implement complex rules similar to udev ones. These two changes make it possible to now build a full-featured desktop system based on mdevd + libudev-zero, without running systemd-udevd or eudev. https://skarnet.org/software/mdevd/ git://git.skarnet.org/mdevd * smtpd-starttls-proxy-0.0.1.0 ---------------------------- This new package, in conjunction with the latest s6-networking, implements the STARTTLS functionality for inetd-like mail servers that do not already support it. (Currently only tested with qmail-smtpd.) If you have noticed that sending mail to skarnet.org supports STARTTLS now, it is thanks to this little piece of software. https://skarnet.org/software/smtpd-starttls-proxy/ git://git.skarnet.org/smtpd-starttls-proxy Enjoy, Bug-reports welcome. Laurent
2021-09-26 17:00:07 +01:00
Build-time requirements: skalibs. https://skarnet.org/software/skalibs/
2019-02-03 15:50:04 +00:00
Run-time requirements: none, if you link skalibs statically.
skawarePackages: Fall 2021 release Maintainers Notes below. ~~~ Hello, New versions of all the skarnet.org packages are available. skalibs has undergone a major update, with a few APIs having disappeared, and others having changed. Compatibility with previous versions is *not* assured. Consequently, all the rest of the skarnet.org software has undergone at least a release bump, in order to build with the new skalibs. But some packages also have new functionality added (hence, a minor bump), and others also have their own incompatible changes (hence, a major bump). The new versions are the following: skalibs-2.11.0.0 (major) nsss-0.2.0.0 (major) utmps-0.1.0.3 (release) execline-2.8.1.0 (minor) s6-2.11.0.0 (major) s6-rc-0.5.2.3 (release) s6-portable-utils-2.2.3.3 (release) s6-linux-utils-2.5.1.6 (release) s6-linux-init-1.0.6.4 (release) s6-dns-2.3.5.2 (release) s6-networking-2.5.0.0 (major) mdevd-0.1.5.0 (minor) bcnm-0.0.1.4 (release) dnsfunnel-0.0.1.2 (release) Additionally, a new package has been released: smtpd-starttls-proxy-0.0.1.0 Dependencies have all been updated to the latest versions. They are, this time, partially strict: libraries and binaries may build with older releases of their dependencies, but not across major version bumps. The safest approach is to upgrade everything at the same time. You do not need to recompile your s6-rc service databases or recreate your s6-linux-init run-images. You should restart your supervision tree after upgrading skalibs and s6, as soon as is convenient for you. Details of major and minor package changes follow. * skalibs-2.11.0.0 ---------------- - A lot of obsolete or useless functionality has been removed: libbiguint, rc4, md5, iobuffer, skasigaction, environ.h and getpeereid.h headers, various functions that have not proven their value in a while. - Some functions changed signatures or changed names, or both. - All custom types ending in _t have been renamed, to avoid treading on POSIX namespace. (The same change has not been done yet in other packages, but skalibs was the biggest offender by far.) - Signal functions have been deeply reworked. - cdb has been reworked, the API is now more user-friendly. - New functions have been added. The deletion of significant portions of code has made skalibs leaner. libskarnet.so has dropped under 190 kB on x86_64. The cdb rewrite on its own has helped reduce an important amount of boilerplate in cdb-using code. All in all, code linked against the new skalibs should be slightly smaller and use a tiny bit less RAM. https://skarnet.org/software/skalibs/ git://git.skarnet.org/skalibs * nsss-0.2.0.0 ------------ - Bugfixes. - nsss-switch wire protocol slightly modified, which is enough to warrant a major version bump. - _r functions are now entirely thread-safe. - Spawned nsssd programs are now persistent and only expire after a timeout on non-enumeration queries. This saves a lot of forking with applications that can call primitives such as getpwnam() repeatedly, as e.g. mdevd does when initially parsing its configuration file. - New nsssd-switch program, implementing real nsswitch functionality by dispatching queries to various backends according to a script. It does not dlopen a single library or read a single config file. https://skarnet.org/software/nsss/ git://git.skarnet.org/nsss * execline-2.8.1.0 ---------------- - Bugfixes. - New binary: case. It compares a value against a series of regular expressions, executing into another command line on the first match. https://skarnet.org/software/execline/ git://git.skarnet.org/execline * s6-2.11.0.0 ----------- - Bugfixes. - Some libs6 header names have been simplified. - s6-svwait now accepts -r and -R options. - s6-supervise now reads an optional lock-fd file in the service directory; if it finds one, the first action of the service is to take a blocking lock. This prevents confusion when a controller process dies while still leaving workers holding resources; it also prevents log spamming on user mistakes (autobackgrounding services, notably). - New binaries: s6-socklog, s6-svlink, s6-svunlink. The former is a rewrite of smarden.org's socklog program, in order to implement a fully functional syslogd with only s6 programs. The latter are tools that start and stop services by symlinking/unlinking service directories from a scan directory, in order to make it easier to integrate s6-style services in boot scripts for sequential service managers such as OpenRC. https://skarnet.org/software/s6/ git://git.skarnet.org/s6 * s6-networking-2.5.0.0 --------------------- - Bugfixes. - minidentd has been removed. It was an old and somehow still buggy piece of code that was only hanging around for nostalgia reasons. - Full support for client certificates. Details of the client certificate are transmitted to the application via environment variables (or via an environment string in the case of opportunistic TLS). - Full SNI support, including server-side. (That involved a deep dive into the bearssl internals, which is why it took so long.) The filenames containing secret keys and certificates for <domain> are read in the environment variables KEYFILE:<domain> and CERTFILE:<domain>. Complete client certificate and SNI support now make the TLS part of s6-networking a fully viable replacement of stunnel and other similar TLS tunneling tools. This is most interesting when s6-networking is built against bearssl, which uses about 1/9 of the resources that OpenSSL needs. https://skarnet.org/software/s6-networking/ git://git.skarnet.org/s6-networking * mdevd-0.1.5.0 ------------- - A new option to mdevd is available: -O <nlgroups>. This option makes mdevd rebroadcast uevents to a netlink group (or set of netlink groups) once they have been handled. This allows applications to read uevents from a netlink group *after* the device manager is done with them. This is useful, for instance, when pairing mdevd with libudev-zero for full udev emulation. - The * and & directives, which previously were only triggered by "add" and "remove" actions, are now triggered by *all* action types. This gives users full scripting access to any event, which can be used to implement complex rules similar to udev ones. These two changes make it possible to now build a full-featured desktop system based on mdevd + libudev-zero, without running systemd-udevd or eudev. https://skarnet.org/software/mdevd/ git://git.skarnet.org/mdevd * smtpd-starttls-proxy-0.0.1.0 ---------------------------- This new package, in conjunction with the latest s6-networking, implements the STARTTLS functionality for inetd-like mail servers that do not already support it. (Currently only tested with qmail-smtpd.) If you have noticed that sending mail to skarnet.org supports STARTTLS now, it is thanks to this little piece of software. https://skarnet.org/software/smtpd-starttls-proxy/ git://git.skarnet.org/smtpd-starttls-proxy Enjoy, Bug-reports welcome. Laurent
2021-09-26 17:00:07 +01:00
2019-02-03 15:50:04 +00:00
Compilation:
gcc -o sdnotify-wrapper -L/usr/lib/skalibs sdnotify-wrapper.c -lskarnet
Use /usr/lib/skalibs/libskarnet.a instead of -lskarnet to link statically.
Adapt gcc's -I and -L options to your skalibs installation paths.
Usage: if a daemon would be launched by systemd as "foobard args...",
launch it as "sdnotify-wrapper foobard args..." instead, and you can now
tell systemd that this daemon supports readiness notification.
Instead of using sd_notify() and having to link against the systemd
library, the daemon notifies readiness by writing whatever it wants
to a file descriptor (by default: stdout), then a newline. (Then it
should close that file descriptor.) The simplest way is something like
int notify_readiness() { write(1, "\n", 1) ; close(1) ; }
This mechanism is understandable by any notification readiness framework.
Readiness notification occurs when the newline is written, not when
the descriptor is closed; but since sdnotify-wrapper stops reading
after the first newline and will exit, any subsequent writes will
fail and it's best to simply close the descriptor right away.
sdnotify-wrapper sees the notification when it occurs and sends it
to systemd using the sd_notify format.
Options:
-d fd: the daemon will write its notification on descriptor fd.
Default is 1.
-f: do not doublefork. Use if the daemon waits for children it does
not know it has (for instance, superservers do this). When in doubt,
do not use that option, or you may have a zombie hanging around.
-t timeout: if the daemon has not sent a notification after timeout
milliseconds, give up and exit; systemd will not be notified.
-k: keep the NOTIFY_SOCKET environment variable when execing into the
daemon. By default, the variable is unset: the daemon should not need it.
Notes:
sdnotify-wrapper does not change the daemon's pid. It runs as a
(grand)child of the daemon.
If the NOTIFY_SOCKET environment variable is not set, sdnotify-wrapper
does nothing - it only execs into the daemon.
sdnotify-wrapper is more liberal than sd_notify(). It will accept
a relative path in NOTIFY_SOCKET.
*/
#include <sys/types.h>
#include <string.h>
#include <unistd.h>
skawarePackages: 2021-01 release Maintainer notes ----- The execline exec function interface changed quite drastically, and backwards-compatibility to the old functions was dropped in-between the last release and this one. Thus, downstream code might break. At the end of this commit message is a compatibility interface. ----- Release notes ----- Hello, Happy New Year to everyone! New versions of the skarnet.org packages are available. This is a major release. The skalibs major version number has been bumped, which means that compatibility with previous versions is not ensured. Other packages have been updated to build against the new skalibs. If they only had their patch number increased, that's all the modifications they had (save for possible bugfixes); but some packages also received significant changes and underwent either a major (compatibility not ensured) or minor (simple additions) release. Support for the 2.9.* branch of skalibs, and associated versions of the other packages, is still ensured for a while, but users are always strongly encouraged to upgrade. * General ------- - Some rarely-triggered build bugs have been fixed. - -fno-stack-protector is not part of the default CFLAGS anymore; stack protector policy now defaults to the compiler's settings. * skalibs-2.10.0.0 ---------------- - Bugfixes. - Significant code cleanup. - New sysdep: chroot. - Lots of new functions, mostly to optimize the number of needed fcntl() calls at open() time. Traces should generally be marginally shorter than they were before. - Removal of the DJBUNIX_FLAG_NB and DJBUNIX_FLAG_COE macros, replaced by the POSIX O_NONBLOCK and O_CLOEXEC macros wherever they were used. - Removal of the skalibs/webipc.h header, and better header separation. - Complete revamping of the pathexec functions, now separated into exec_* (simple execution) and mexec_* (execution with merging of the environment first). In true skalibs fashion, there is a little code, and 3 pages of convenience macros (the exec.h header). - Complete rewrite of the locking functions, with a change of underlying mechanisms. The skalibs locking primitives are now named fd_lock(), fd_unlock() and fd_islocked(). The Unix locks primitive space is a horror show. flock() is not POSIX and does not have a way to test for a lock without taking it. The POSIX lockf() only has exclusive locks, not shared ones. The least bad option is fcntl(), which has shared and exclusive locks *and* a way to check for a lock without taking it, but does not allow taking a shared lock via a O_WRONLY file descriptor. Of all inconveniences this is the most minor one, so now skalibs uses fcntl(). https://skarnet.org/software/skalibs/ git://git.skarnet.org/skalibs * nsss-0.1.0.0 ------------ - New --enable-libc-includes configure option. Without this option, the pwd.h, grp.h and shadow.h headers are not installed anymore, so by default installing nsss on a FHS system does not overwrite the libc headers. https://skarnet.org/software/nsss/ git://git.skarnet.org/nsss * utmps-0.1.0.0 ------------- - New --enable-libc-includes configure option. Without this option, the utmpx.h header is not installed anymore, so by default installing utmps on a FHS system does not overwrite the libc headers. https://skarnet.org/software/utmps/ git://git.skarnet.org/utmps * execline-2.7.0.0 ---------------- - Bugfixes. - The trap program has changed. The "timeout" directive has been removed; a "default" directive has been added, to handle all signals for which a specific directive has not been given. Subprograms are now run with the SIGNAL environment variable set to the signal number (in addition to ! always being set to the application's pid). - The forstdin program has changed. It now exits 0 if it has read at least one line, and 1 otherwise. - The default list of delimiters for backtick, withstdinas, forstdin and forbacktickx has been set to "\n", so by default those programs will read and/or split on lines and only lines. - The backtick, withstdinas, forstdin, forbacktickx, forx, getpid and getcwd programs now have a -E option to activate autoimport. (This saves the user from manually adding "importas var var" after every use of these programs.) https://skarnet.org/software/execline/ git://git.skarnet.org/execline * s6-2.10.0.0 ----------- It is imperative to restart your supervision trees, by rebooting if necessary, after upgrading s6 to the new version. Otherwise, new s6 binaries interacting with service directories maintained by old s6-supervise binaries may not work. If you are using s6-linux-init, it is necessary to upgrade to the latest version of s6-linux-init at the same time as s6. - Bugfixes. - Significant code refactoring. - The internal locking system of service directories has changed, allowing for a cleaner permissions model and official support of relaxed permissions. - New binary to implement those relaxed permissions: s6-svperms. - The "nosetsid" file is not supported anymore in service directories. Services are now always started in a new session. - s6-supervise now traps SIGINT: before dying, it sends a SIGINT to its service's process group. This allows correct transmission of ^C when a supervision tree is running in a terminal, even though every service runs in its own session. - s6-svc -X doesn't exist anymore. s6-supervise now always closes stdin and stdout on the last execution of the service. - The semantics of SIGHUP and SIGQUIT have changed for s6-supervise. - The set of commands sent by s6-svscanctl and received by s6-svscan has been cleaned up and made more logical. - When told to exit normally (typically via s6-svscanctl -t), s6-svscan now first waits for the whole supervision tree to die. The .s6-svscan/finish script can now assume that all services are completely down. (s6-svscanctl -b is an exception; it should not be used in normal circumstances.) - The -s and -S options to s6-svscan are not supported anymore. Signal management in s6-svscan has been streamlined: signals have a default handler that can be overridden by a corresponding executable .s6-svscan/SIGfoo file. - Default signal handlers for s6-svscan have more intuitive semantics. - New binary to help with management of user-owned supervision trees: s6-usertree-maker. https://skarnet.org/software/s6/ git://git.skarnet.org/s6 s6 now has man pages! Thanks to flexibeast for performing the conversion work. Please allow some time for the man pages to be updated to reflect the current HTML documentation. The repository can be found here: https://github.com/flexibeast/s6-man-pages * s6-linux-init-1.0.6.0 --------------------- It *is necessary* to upgrade s6-linux-init at the same time as s6. It *is recommended*, although not strictly necessary, to create your run-image directory again via a s6-linux-init-maker invocation. Old images will still boot, as long as you are using an upgraded version of s6-linux-init; but they may incorrectly handle signals sent to init, so for instance Ctrl-Alt-Del may not work anymore, until you run s6-linux-init-maker again. - New internal binary: s6-linux-init-nuke. This program is not meant to be invoked by users directly: it simply removes a dependency to the 'kill' program in a rare case involving containers. https://skarnet.org/software/s6-linux-init/ git://git.skarnet.org/s6-linux-init * s6-dns-2.3.4.0 -------------- - New library function: s6dns_message_parse_question(). https://skarnet.org/software/s6-dns/ git://git.skarnet.org/s6-dns * s6-networking-2.4.0.0 --------------------- - Important refactoring of the tls code. The crypto tunnel now runs as a child of the application, instead of the other way around. It is now isolated in a s6-tls[cd]-io binary; s6-tlsc is now a simple wrapper around s6-tlsc-io, and s6-tlsd is a simple wrapper around s6-tlsd-io. - New binaries: s6-ucspitlsc and s6-ucspitlsd. Those implement opportunistic TLS via the UCSPI-TLS protocol. - The -K option to the tls binaries has changed semantics: it now enforces a timeout for the handshake instead of dropping the connection after some inactivity. Note that this option is only useful with the bearssl backend: the libtls backend always performs a synchronous handshake, with no way of interrupting it after a timeout expires. - The execline dependency is now optional. Disabling execline, however, changes the behaviour of s6-tcpserver-access (which cannot support exec files without it). https://skarnet.org/software/s6-networking/ git://git.skarnet.org/s6-networking It is now possible to build the s6-networking package against OpenSSL instead of LibreSSL, thanks to the libretls project: https://git.causal.agency/libretls/about/ * mdevd-0.1.3.0 ------------- - New -C option to the mdevd program. This option makes mdevd automatically spawn a mdevd-coldplug program when it's ready, allowing mdevd to be used as a drop-in mdev -d replacement. (Note that the coldplug is also performed if mdevd restarts after being killed, so this feature should not be used in place of a proper service startup sequence with a mdevd-coldplug oneshot depending on the mdevd longrun. It has only been added for convenience.) https://skarnet.org/software/mdevd/ git://git.skarnet.org/mdevd * Other packages -------------- The following packages have received an update so they build with the latest version of skalibs and other dependencies, but nothing has changed except possibly some bugfixes, and hopefully not too many bug additions. - s6-rc-0.5.2.1. (It is not necessary to recompile your service database. However, it is necessary to upgrade s6-rc along with s6, and to reboot the system ASAP after upgrading.) - s6-portable-utils-2.2.3.1 - s6-linux-utils-2.5.1.4 - bcnm-0.0.1.2 Enjoy, Bug-reports welcome. -- Laurent ----- execline compat interface ----- /* Compatibility */ #define pathexec_run(file, argv, envp) exec_ae(file, argv, envp) #define pathexec0_run(file, argv, envp) exec0_ae(file, argv, envp) #define xpathexec_run(file, argv, envp) xexec_ae(file, argv, envp) #define xpathexec0_run(file, argv, envp) xexec0_ae(file, argv, envp) #define pathexec_env(key, value) env_mexec(key, value) #define pathexec_fromenv(argv, envp, envlen) mexec_f(argv, envp, envlen) #define pathexec(argv) mexec(argv) #define pathexec0(argv) mexec0(argv) #define xpathexec_fromenv(argv, envp, envlen) xmexec_f(argv, envp, envlen) #define xpathexec(argv) xmexec(argv) #define xpathexec0(argv) xmexec0(argv) #define pathexec_r_name(file, argv, envp, envlen, modif, modiflen) mexec_afm(file, argv, envp, envlen, modif, modiflen) #define pathexec_r(argv, envp, envlen, modif, modiflen) mexec_fm(argv, envp, envlen, modif, modiflen) #define xpathexec_r_name(file, argv, envp, envlen, modif, modiflen) xmexec_afm(file, argv, envp, envlen, modif, modiflen) #define xpathexec_r(argv, envp, envlen, modif, modiflen) xmexec_fm(argv, envp, envlen, modif, modiflen) #endif copied from https://github.com/skarnet/skalibs/commit/18e43565574b700befc832ed4d25d25e40951f68#diff-69efbe5d997280a1430a6af2fa38e3f5105e706076a26fc751885c505ca598c6R140
2021-01-21 18:54:13 +00:00
#include <stdlib.h>
2019-02-03 15:50:04 +00:00
#include <errno.h>
#include <sys/socket.h>
#include <sys/un.h>
skawarePackages: 2021-01 release Maintainer notes ----- The execline exec function interface changed quite drastically, and backwards-compatibility to the old functions was dropped in-between the last release and this one. Thus, downstream code might break. At the end of this commit message is a compatibility interface. ----- Release notes ----- Hello, Happy New Year to everyone! New versions of the skarnet.org packages are available. This is a major release. The skalibs major version number has been bumped, which means that compatibility with previous versions is not ensured. Other packages have been updated to build against the new skalibs. If they only had their patch number increased, that's all the modifications they had (save for possible bugfixes); but some packages also received significant changes and underwent either a major (compatibility not ensured) or minor (simple additions) release. Support for the 2.9.* branch of skalibs, and associated versions of the other packages, is still ensured for a while, but users are always strongly encouraged to upgrade. * General ------- - Some rarely-triggered build bugs have been fixed. - -fno-stack-protector is not part of the default CFLAGS anymore; stack protector policy now defaults to the compiler's settings. * skalibs-2.10.0.0 ---------------- - Bugfixes. - Significant code cleanup. - New sysdep: chroot. - Lots of new functions, mostly to optimize the number of needed fcntl() calls at open() time. Traces should generally be marginally shorter than they were before. - Removal of the DJBUNIX_FLAG_NB and DJBUNIX_FLAG_COE macros, replaced by the POSIX O_NONBLOCK and O_CLOEXEC macros wherever they were used. - Removal of the skalibs/webipc.h header, and better header separation. - Complete revamping of the pathexec functions, now separated into exec_* (simple execution) and mexec_* (execution with merging of the environment first). In true skalibs fashion, there is a little code, and 3 pages of convenience macros (the exec.h header). - Complete rewrite of the locking functions, with a change of underlying mechanisms. The skalibs locking primitives are now named fd_lock(), fd_unlock() and fd_islocked(). The Unix locks primitive space is a horror show. flock() is not POSIX and does not have a way to test for a lock without taking it. The POSIX lockf() only has exclusive locks, not shared ones. The least bad option is fcntl(), which has shared and exclusive locks *and* a way to check for a lock without taking it, but does not allow taking a shared lock via a O_WRONLY file descriptor. Of all inconveniences this is the most minor one, so now skalibs uses fcntl(). https://skarnet.org/software/skalibs/ git://git.skarnet.org/skalibs * nsss-0.1.0.0 ------------ - New --enable-libc-includes configure option. Without this option, the pwd.h, grp.h and shadow.h headers are not installed anymore, so by default installing nsss on a FHS system does not overwrite the libc headers. https://skarnet.org/software/nsss/ git://git.skarnet.org/nsss * utmps-0.1.0.0 ------------- - New --enable-libc-includes configure option. Without this option, the utmpx.h header is not installed anymore, so by default installing utmps on a FHS system does not overwrite the libc headers. https://skarnet.org/software/utmps/ git://git.skarnet.org/utmps * execline-2.7.0.0 ---------------- - Bugfixes. - The trap program has changed. The "timeout" directive has been removed; a "default" directive has been added, to handle all signals for which a specific directive has not been given. Subprograms are now run with the SIGNAL environment variable set to the signal number (in addition to ! always being set to the application's pid). - The forstdin program has changed. It now exits 0 if it has read at least one line, and 1 otherwise. - The default list of delimiters for backtick, withstdinas, forstdin and forbacktickx has been set to "\n", so by default those programs will read and/or split on lines and only lines. - The backtick, withstdinas, forstdin, forbacktickx, forx, getpid and getcwd programs now have a -E option to activate autoimport. (This saves the user from manually adding "importas var var" after every use of these programs.) https://skarnet.org/software/execline/ git://git.skarnet.org/execline * s6-2.10.0.0 ----------- It is imperative to restart your supervision trees, by rebooting if necessary, after upgrading s6 to the new version. Otherwise, new s6 binaries interacting with service directories maintained by old s6-supervise binaries may not work. If you are using s6-linux-init, it is necessary to upgrade to the latest version of s6-linux-init at the same time as s6. - Bugfixes. - Significant code refactoring. - The internal locking system of service directories has changed, allowing for a cleaner permissions model and official support of relaxed permissions. - New binary to implement those relaxed permissions: s6-svperms. - The "nosetsid" file is not supported anymore in service directories. Services are now always started in a new session. - s6-supervise now traps SIGINT: before dying, it sends a SIGINT to its service's process group. This allows correct transmission of ^C when a supervision tree is running in a terminal, even though every service runs in its own session. - s6-svc -X doesn't exist anymore. s6-supervise now always closes stdin and stdout on the last execution of the service. - The semantics of SIGHUP and SIGQUIT have changed for s6-supervise. - The set of commands sent by s6-svscanctl and received by s6-svscan has been cleaned up and made more logical. - When told to exit normally (typically via s6-svscanctl -t), s6-svscan now first waits for the whole supervision tree to die. The .s6-svscan/finish script can now assume that all services are completely down. (s6-svscanctl -b is an exception; it should not be used in normal circumstances.) - The -s and -S options to s6-svscan are not supported anymore. Signal management in s6-svscan has been streamlined: signals have a default handler that can be overridden by a corresponding executable .s6-svscan/SIGfoo file. - Default signal handlers for s6-svscan have more intuitive semantics. - New binary to help with management of user-owned supervision trees: s6-usertree-maker. https://skarnet.org/software/s6/ git://git.skarnet.org/s6 s6 now has man pages! Thanks to flexibeast for performing the conversion work. Please allow some time for the man pages to be updated to reflect the current HTML documentation. The repository can be found here: https://github.com/flexibeast/s6-man-pages * s6-linux-init-1.0.6.0 --------------------- It *is necessary* to upgrade s6-linux-init at the same time as s6. It *is recommended*, although not strictly necessary, to create your run-image directory again via a s6-linux-init-maker invocation. Old images will still boot, as long as you are using an upgraded version of s6-linux-init; but they may incorrectly handle signals sent to init, so for instance Ctrl-Alt-Del may not work anymore, until you run s6-linux-init-maker again. - New internal binary: s6-linux-init-nuke. This program is not meant to be invoked by users directly: it simply removes a dependency to the 'kill' program in a rare case involving containers. https://skarnet.org/software/s6-linux-init/ git://git.skarnet.org/s6-linux-init * s6-dns-2.3.4.0 -------------- - New library function: s6dns_message_parse_question(). https://skarnet.org/software/s6-dns/ git://git.skarnet.org/s6-dns * s6-networking-2.4.0.0 --------------------- - Important refactoring of the tls code. The crypto tunnel now runs as a child of the application, instead of the other way around. It is now isolated in a s6-tls[cd]-io binary; s6-tlsc is now a simple wrapper around s6-tlsc-io, and s6-tlsd is a simple wrapper around s6-tlsd-io. - New binaries: s6-ucspitlsc and s6-ucspitlsd. Those implement opportunistic TLS via the UCSPI-TLS protocol. - The -K option to the tls binaries has changed semantics: it now enforces a timeout for the handshake instead of dropping the connection after some inactivity. Note that this option is only useful with the bearssl backend: the libtls backend always performs a synchronous handshake, with no way of interrupting it after a timeout expires. - The execline dependency is now optional. Disabling execline, however, changes the behaviour of s6-tcpserver-access (which cannot support exec files without it). https://skarnet.org/software/s6-networking/ git://git.skarnet.org/s6-networking It is now possible to build the s6-networking package against OpenSSL instead of LibreSSL, thanks to the libretls project: https://git.causal.agency/libretls/about/ * mdevd-0.1.3.0 ------------- - New -C option to the mdevd program. This option makes mdevd automatically spawn a mdevd-coldplug program when it's ready, allowing mdevd to be used as a drop-in mdev -d replacement. (Note that the coldplug is also performed if mdevd restarts after being killed, so this feature should not be used in place of a proper service startup sequence with a mdevd-coldplug oneshot depending on the mdevd longrun. It has only been added for convenience.) https://skarnet.org/software/mdevd/ git://git.skarnet.org/mdevd * Other packages -------------- The following packages have received an update so they build with the latest version of skalibs and other dependencies, but nothing has changed except possibly some bugfixes, and hopefully not too many bug additions. - s6-rc-0.5.2.1. (It is not necessary to recompile your service database. However, it is necessary to upgrade s6-rc along with s6, and to reboot the system ASAP after upgrading.) - s6-portable-utils-2.2.3.1 - s6-linux-utils-2.5.1.4 - bcnm-0.0.1.2 Enjoy, Bug-reports welcome. -- Laurent ----- execline compat interface ----- /* Compatibility */ #define pathexec_run(file, argv, envp) exec_ae(file, argv, envp) #define pathexec0_run(file, argv, envp) exec0_ae(file, argv, envp) #define xpathexec_run(file, argv, envp) xexec_ae(file, argv, envp) #define xpathexec0_run(file, argv, envp) xexec0_ae(file, argv, envp) #define pathexec_env(key, value) env_mexec(key, value) #define pathexec_fromenv(argv, envp, envlen) mexec_f(argv, envp, envlen) #define pathexec(argv) mexec(argv) #define pathexec0(argv) mexec0(argv) #define xpathexec_fromenv(argv, envp, envlen) xmexec_f(argv, envp, envlen) #define xpathexec(argv) xmexec(argv) #define xpathexec0(argv) xmexec0(argv) #define pathexec_r_name(file, argv, envp, envlen, modif, modiflen) mexec_afm(file, argv, envp, envlen, modif, modiflen) #define pathexec_r(argv, envp, envlen, modif, modiflen) mexec_fm(argv, envp, envlen, modif, modiflen) #define xpathexec_r_name(file, argv, envp, envlen, modif, modiflen) xmexec_afm(file, argv, envp, envlen, modif, modiflen) #define xpathexec_r(argv, envp, envlen, modif, modiflen) xmexec_fm(argv, envp, envlen, modif, modiflen) #endif copied from https://github.com/skarnet/skalibs/commit/18e43565574b700befc832ed4d25d25e40951f68#diff-69efbe5d997280a1430a6af2fa38e3f5105e706076a26fc751885c505ca598c6R140
2021-01-21 18:54:13 +00:00
2019-02-03 15:50:04 +00:00
#include <skalibs/uint64.h>
#include <skalibs/types.h>
#include <skalibs/bytestr.h>
#include <skalibs/sgetopt.h>
#include <skalibs/strerr2.h>
#include <skalibs/allreadwrite.h>
#include <skalibs/tai.h>
#include <skalibs/iopause.h>
#include <skalibs/djbunix.h>
skawarePackages: 2021-01 release Maintainer notes ----- The execline exec function interface changed quite drastically, and backwards-compatibility to the old functions was dropped in-between the last release and this one. Thus, downstream code might break. At the end of this commit message is a compatibility interface. ----- Release notes ----- Hello, Happy New Year to everyone! New versions of the skarnet.org packages are available. This is a major release. The skalibs major version number has been bumped, which means that compatibility with previous versions is not ensured. Other packages have been updated to build against the new skalibs. If they only had their patch number increased, that's all the modifications they had (save for possible bugfixes); but some packages also received significant changes and underwent either a major (compatibility not ensured) or minor (simple additions) release. Support for the 2.9.* branch of skalibs, and associated versions of the other packages, is still ensured for a while, but users are always strongly encouraged to upgrade. * General ------- - Some rarely-triggered build bugs have been fixed. - -fno-stack-protector is not part of the default CFLAGS anymore; stack protector policy now defaults to the compiler's settings. * skalibs-2.10.0.0 ---------------- - Bugfixes. - Significant code cleanup. - New sysdep: chroot. - Lots of new functions, mostly to optimize the number of needed fcntl() calls at open() time. Traces should generally be marginally shorter than they were before. - Removal of the DJBUNIX_FLAG_NB and DJBUNIX_FLAG_COE macros, replaced by the POSIX O_NONBLOCK and O_CLOEXEC macros wherever they were used. - Removal of the skalibs/webipc.h header, and better header separation. - Complete revamping of the pathexec functions, now separated into exec_* (simple execution) and mexec_* (execution with merging of the environment first). In true skalibs fashion, there is a little code, and 3 pages of convenience macros (the exec.h header). - Complete rewrite of the locking functions, with a change of underlying mechanisms. The skalibs locking primitives are now named fd_lock(), fd_unlock() and fd_islocked(). The Unix locks primitive space is a horror show. flock() is not POSIX and does not have a way to test for a lock without taking it. The POSIX lockf() only has exclusive locks, not shared ones. The least bad option is fcntl(), which has shared and exclusive locks *and* a way to check for a lock without taking it, but does not allow taking a shared lock via a O_WRONLY file descriptor. Of all inconveniences this is the most minor one, so now skalibs uses fcntl(). https://skarnet.org/software/skalibs/ git://git.skarnet.org/skalibs * nsss-0.1.0.0 ------------ - New --enable-libc-includes configure option. Without this option, the pwd.h, grp.h and shadow.h headers are not installed anymore, so by default installing nsss on a FHS system does not overwrite the libc headers. https://skarnet.org/software/nsss/ git://git.skarnet.org/nsss * utmps-0.1.0.0 ------------- - New --enable-libc-includes configure option. Without this option, the utmpx.h header is not installed anymore, so by default installing utmps on a FHS system does not overwrite the libc headers. https://skarnet.org/software/utmps/ git://git.skarnet.org/utmps * execline-2.7.0.0 ---------------- - Bugfixes. - The trap program has changed. The "timeout" directive has been removed; a "default" directive has been added, to handle all signals for which a specific directive has not been given. Subprograms are now run with the SIGNAL environment variable set to the signal number (in addition to ! always being set to the application's pid). - The forstdin program has changed. It now exits 0 if it has read at least one line, and 1 otherwise. - The default list of delimiters for backtick, withstdinas, forstdin and forbacktickx has been set to "\n", so by default those programs will read and/or split on lines and only lines. - The backtick, withstdinas, forstdin, forbacktickx, forx, getpid and getcwd programs now have a -E option to activate autoimport. (This saves the user from manually adding "importas var var" after every use of these programs.) https://skarnet.org/software/execline/ git://git.skarnet.org/execline * s6-2.10.0.0 ----------- It is imperative to restart your supervision trees, by rebooting if necessary, after upgrading s6 to the new version. Otherwise, new s6 binaries interacting with service directories maintained by old s6-supervise binaries may not work. If you are using s6-linux-init, it is necessary to upgrade to the latest version of s6-linux-init at the same time as s6. - Bugfixes. - Significant code refactoring. - The internal locking system of service directories has changed, allowing for a cleaner permissions model and official support of relaxed permissions. - New binary to implement those relaxed permissions: s6-svperms. - The "nosetsid" file is not supported anymore in service directories. Services are now always started in a new session. - s6-supervise now traps SIGINT: before dying, it sends a SIGINT to its service's process group. This allows correct transmission of ^C when a supervision tree is running in a terminal, even though every service runs in its own session. - s6-svc -X doesn't exist anymore. s6-supervise now always closes stdin and stdout on the last execution of the service. - The semantics of SIGHUP and SIGQUIT have changed for s6-supervise. - The set of commands sent by s6-svscanctl and received by s6-svscan has been cleaned up and made more logical. - When told to exit normally (typically via s6-svscanctl -t), s6-svscan now first waits for the whole supervision tree to die. The .s6-svscan/finish script can now assume that all services are completely down. (s6-svscanctl -b is an exception; it should not be used in normal circumstances.) - The -s and -S options to s6-svscan are not supported anymore. Signal management in s6-svscan has been streamlined: signals have a default handler that can be overridden by a corresponding executable .s6-svscan/SIGfoo file. - Default signal handlers for s6-svscan have more intuitive semantics. - New binary to help with management of user-owned supervision trees: s6-usertree-maker. https://skarnet.org/software/s6/ git://git.skarnet.org/s6 s6 now has man pages! Thanks to flexibeast for performing the conversion work. Please allow some time for the man pages to be updated to reflect the current HTML documentation. The repository can be found here: https://github.com/flexibeast/s6-man-pages * s6-linux-init-1.0.6.0 --------------------- It *is necessary* to upgrade s6-linux-init at the same time as s6. It *is recommended*, although not strictly necessary, to create your run-image directory again via a s6-linux-init-maker invocation. Old images will still boot, as long as you are using an upgraded version of s6-linux-init; but they may incorrectly handle signals sent to init, so for instance Ctrl-Alt-Del may not work anymore, until you run s6-linux-init-maker again. - New internal binary: s6-linux-init-nuke. This program is not meant to be invoked by users directly: it simply removes a dependency to the 'kill' program in a rare case involving containers. https://skarnet.org/software/s6-linux-init/ git://git.skarnet.org/s6-linux-init * s6-dns-2.3.4.0 -------------- - New library function: s6dns_message_parse_question(). https://skarnet.org/software/s6-dns/ git://git.skarnet.org/s6-dns * s6-networking-2.4.0.0 --------------------- - Important refactoring of the tls code. The crypto tunnel now runs as a child of the application, instead of the other way around. It is now isolated in a s6-tls[cd]-io binary; s6-tlsc is now a simple wrapper around s6-tlsc-io, and s6-tlsd is a simple wrapper around s6-tlsd-io. - New binaries: s6-ucspitlsc and s6-ucspitlsd. Those implement opportunistic TLS via the UCSPI-TLS protocol. - The -K option to the tls binaries has changed semantics: it now enforces a timeout for the handshake instead of dropping the connection after some inactivity. Note that this option is only useful with the bearssl backend: the libtls backend always performs a synchronous handshake, with no way of interrupting it after a timeout expires. - The execline dependency is now optional. Disabling execline, however, changes the behaviour of s6-tcpserver-access (which cannot support exec files without it). https://skarnet.org/software/s6-networking/ git://git.skarnet.org/s6-networking It is now possible to build the s6-networking package against OpenSSL instead of LibreSSL, thanks to the libretls project: https://git.causal.agency/libretls/about/ * mdevd-0.1.3.0 ------------- - New -C option to the mdevd program. This option makes mdevd automatically spawn a mdevd-coldplug program when it's ready, allowing mdevd to be used as a drop-in mdev -d replacement. (Note that the coldplug is also performed if mdevd restarts after being killed, so this feature should not be used in place of a proper service startup sequence with a mdevd-coldplug oneshot depending on the mdevd longrun. It has only been added for convenience.) https://skarnet.org/software/mdevd/ git://git.skarnet.org/mdevd * Other packages -------------- The following packages have received an update so they build with the latest version of skalibs and other dependencies, but nothing has changed except possibly some bugfixes, and hopefully not too many bug additions. - s6-rc-0.5.2.1. (It is not necessary to recompile your service database. However, it is necessary to upgrade s6-rc along with s6, and to reboot the system ASAP after upgrading.) - s6-portable-utils-2.2.3.1 - s6-linux-utils-2.5.1.4 - bcnm-0.0.1.2 Enjoy, Bug-reports welcome. -- Laurent ----- execline compat interface ----- /* Compatibility */ #define pathexec_run(file, argv, envp) exec_ae(file, argv, envp) #define pathexec0_run(file, argv, envp) exec0_ae(file, argv, envp) #define xpathexec_run(file, argv, envp) xexec_ae(file, argv, envp) #define xpathexec0_run(file, argv, envp) xexec0_ae(file, argv, envp) #define pathexec_env(key, value) env_mexec(key, value) #define pathexec_fromenv(argv, envp, envlen) mexec_f(argv, envp, envlen) #define pathexec(argv) mexec(argv) #define pathexec0(argv) mexec0(argv) #define xpathexec_fromenv(argv, envp, envlen) xmexec_f(argv, envp, envlen) #define xpathexec(argv) xmexec(argv) #define xpathexec0(argv) xmexec0(argv) #define pathexec_r_name(file, argv, envp, envlen, modif, modiflen) mexec_afm(file, argv, envp, envlen, modif, modiflen) #define pathexec_r(argv, envp, envlen, modif, modiflen) mexec_fm(argv, envp, envlen, modif, modiflen) #define xpathexec_r_name(file, argv, envp, envlen, modif, modiflen) xmexec_afm(file, argv, envp, envlen, modif, modiflen) #define xpathexec_r(argv, envp, envlen, modif, modiflen) xmexec_fm(argv, envp, envlen, modif, modiflen) #endif copied from https://github.com/skarnet/skalibs/commit/18e43565574b700befc832ed4d25d25e40951f68#diff-69efbe5d997280a1430a6af2fa38e3f5105e706076a26fc751885c505ca598c6R140
2021-01-21 18:54:13 +00:00
#include <skalibs/socket.h>
#include <skalibs/exec.h>
2019-02-03 15:50:04 +00:00
#define USAGE "sdnotify-wrapper [ -d fd ] [ -f ] [ -t timeout ] [ -k ] prog..."
#define dieusage() strerr_dieusage(100, USAGE)
#define VAR "NOTIFY_SOCKET"
static inline int ipc_sendto (int fd, char const *s, size_t len, char const *path)
{
struct sockaddr_un sa ;
size_t l = strlen(path) ;
if (l > IPCPATH_MAX) return (errno = ENAMETOOLONG, 0) ;
memset(&sa, 0, sizeof sa) ;
sa.sun_family = AF_UNIX ;
memcpy(sa.sun_path, path, l+1) ;
if (path[0] == '@') sa.sun_path[0] = 0 ;
return sendto(fd, s, len, MSG_NOSIGNAL, (struct sockaddr *)&sa, sizeof sa) >= 0 ;
}
static inline void notify_systemd (pid_t pid, char const *socketpath)
{
size_t n = 16 ;
char fmt[16 + PID_FMT] = "READY=1\nMAINPID=" ;
int fd = ipc_datagram_b() ;
if (fd < 0) strerr_diefu1sys(111, "create socket") ;
n += pid_fmt(fmt + n, pid) ;
fmt[n++] = '\n' ;
if (!ipc_sendto(fd, fmt, n, socketpath))
strerr_diefu2sys(111, "send notification message to ", socketpath) ;
close(fd) ;
}
static inline int run_child (int fd, unsigned int timeout, pid_t pid, char const *s)
{
char dummy[4096] ;
iopause_fd x = { .fd = fd, .events = IOPAUSE_READ } ;
skawarePackages: Fall 2021 release Maintainers Notes below. ~~~ Hello, New versions of all the skarnet.org packages are available. skalibs has undergone a major update, with a few APIs having disappeared, and others having changed. Compatibility with previous versions is *not* assured. Consequently, all the rest of the skarnet.org software has undergone at least a release bump, in order to build with the new skalibs. But some packages also have new functionality added (hence, a minor bump), and others also have their own incompatible changes (hence, a major bump). The new versions are the following: skalibs-2.11.0.0 (major) nsss-0.2.0.0 (major) utmps-0.1.0.3 (release) execline-2.8.1.0 (minor) s6-2.11.0.0 (major) s6-rc-0.5.2.3 (release) s6-portable-utils-2.2.3.3 (release) s6-linux-utils-2.5.1.6 (release) s6-linux-init-1.0.6.4 (release) s6-dns-2.3.5.2 (release) s6-networking-2.5.0.0 (major) mdevd-0.1.5.0 (minor) bcnm-0.0.1.4 (release) dnsfunnel-0.0.1.2 (release) Additionally, a new package has been released: smtpd-starttls-proxy-0.0.1.0 Dependencies have all been updated to the latest versions. They are, this time, partially strict: libraries and binaries may build with older releases of their dependencies, but not across major version bumps. The safest approach is to upgrade everything at the same time. You do not need to recompile your s6-rc service databases or recreate your s6-linux-init run-images. You should restart your supervision tree after upgrading skalibs and s6, as soon as is convenient for you. Details of major and minor package changes follow. * skalibs-2.11.0.0 ---------------- - A lot of obsolete or useless functionality has been removed: libbiguint, rc4, md5, iobuffer, skasigaction, environ.h and getpeereid.h headers, various functions that have not proven their value in a while. - Some functions changed signatures or changed names, or both. - All custom types ending in _t have been renamed, to avoid treading on POSIX namespace. (The same change has not been done yet in other packages, but skalibs was the biggest offender by far.) - Signal functions have been deeply reworked. - cdb has been reworked, the API is now more user-friendly. - New functions have been added. The deletion of significant portions of code has made skalibs leaner. libskarnet.so has dropped under 190 kB on x86_64. The cdb rewrite on its own has helped reduce an important amount of boilerplate in cdb-using code. All in all, code linked against the new skalibs should be slightly smaller and use a tiny bit less RAM. https://skarnet.org/software/skalibs/ git://git.skarnet.org/skalibs * nsss-0.2.0.0 ------------ - Bugfixes. - nsss-switch wire protocol slightly modified, which is enough to warrant a major version bump. - _r functions are now entirely thread-safe. - Spawned nsssd programs are now persistent and only expire after a timeout on non-enumeration queries. This saves a lot of forking with applications that can call primitives such as getpwnam() repeatedly, as e.g. mdevd does when initially parsing its configuration file. - New nsssd-switch program, implementing real nsswitch functionality by dispatching queries to various backends according to a script. It does not dlopen a single library or read a single config file. https://skarnet.org/software/nsss/ git://git.skarnet.org/nsss * execline-2.8.1.0 ---------------- - Bugfixes. - New binary: case. It compares a value against a series of regular expressions, executing into another command line on the first match. https://skarnet.org/software/execline/ git://git.skarnet.org/execline * s6-2.11.0.0 ----------- - Bugfixes. - Some libs6 header names have been simplified. - s6-svwait now accepts -r and -R options. - s6-supervise now reads an optional lock-fd file in the service directory; if it finds one, the first action of the service is to take a blocking lock. This prevents confusion when a controller process dies while still leaving workers holding resources; it also prevents log spamming on user mistakes (autobackgrounding services, notably). - New binaries: s6-socklog, s6-svlink, s6-svunlink. The former is a rewrite of smarden.org's socklog program, in order to implement a fully functional syslogd with only s6 programs. The latter are tools that start and stop services by symlinking/unlinking service directories from a scan directory, in order to make it easier to integrate s6-style services in boot scripts for sequential service managers such as OpenRC. https://skarnet.org/software/s6/ git://git.skarnet.org/s6 * s6-networking-2.5.0.0 --------------------- - Bugfixes. - minidentd has been removed. It was an old and somehow still buggy piece of code that was only hanging around for nostalgia reasons. - Full support for client certificates. Details of the client certificate are transmitted to the application via environment variables (or via an environment string in the case of opportunistic TLS). - Full SNI support, including server-side. (That involved a deep dive into the bearssl internals, which is why it took so long.) The filenames containing secret keys and certificates for <domain> are read in the environment variables KEYFILE:<domain> and CERTFILE:<domain>. Complete client certificate and SNI support now make the TLS part of s6-networking a fully viable replacement of stunnel and other similar TLS tunneling tools. This is most interesting when s6-networking is built against bearssl, which uses about 1/9 of the resources that OpenSSL needs. https://skarnet.org/software/s6-networking/ git://git.skarnet.org/s6-networking * mdevd-0.1.5.0 ------------- - A new option to mdevd is available: -O <nlgroups>. This option makes mdevd rebroadcast uevents to a netlink group (or set of netlink groups) once they have been handled. This allows applications to read uevents from a netlink group *after* the device manager is done with them. This is useful, for instance, when pairing mdevd with libudev-zero for full udev emulation. - The * and & directives, which previously were only triggered by "add" and "remove" actions, are now triggered by *all* action types. This gives users full scripting access to any event, which can be used to implement complex rules similar to udev ones. These two changes make it possible to now build a full-featured desktop system based on mdevd + libudev-zero, without running systemd-udevd or eudev. https://skarnet.org/software/mdevd/ git://git.skarnet.org/mdevd * smtpd-starttls-proxy-0.0.1.0 ---------------------------- This new package, in conjunction with the latest s6-networking, implements the STARTTLS functionality for inetd-like mail servers that do not already support it. (Currently only tested with qmail-smtpd.) If you have noticed that sending mail to skarnet.org supports STARTTLS now, it is thanks to this little piece of software. https://skarnet.org/software/smtpd-starttls-proxy/ git://git.skarnet.org/smtpd-starttls-proxy Enjoy, Bug-reports welcome. Laurent
2021-09-26 17:00:07 +01:00
tain deadline ;
2019-02-03 15:50:04 +00:00
tain_now_g() ;
if (timeout) tain_from_millisecs(&deadline, timeout) ;
else deadline = tain_infinite_relative ;
tain_add_g(&deadline, &deadline) ;
for (;;)
{
int r = iopause_g(&x, 1, &deadline) ;
if (r < 0) strerr_diefu1sys(111, "iopause") ;
if (!r) return 99 ;
r = sanitize_read(fd_read(fd, dummy, 4096)) ;
if (r < 0)
if (errno == EPIPE) return 1 ;
else strerr_diefu1sys(111, "read from parent") ;
else if (r && memchr(dummy, '\n', r)) break ;
}
close(fd) ;
notify_systemd(pid, s) ;
return 0 ;
}
skawarePackages: 2021-01 release Maintainer notes ----- The execline exec function interface changed quite drastically, and backwards-compatibility to the old functions was dropped in-between the last release and this one. Thus, downstream code might break. At the end of this commit message is a compatibility interface. ----- Release notes ----- Hello, Happy New Year to everyone! New versions of the skarnet.org packages are available. This is a major release. The skalibs major version number has been bumped, which means that compatibility with previous versions is not ensured. Other packages have been updated to build against the new skalibs. If they only had their patch number increased, that's all the modifications they had (save for possible bugfixes); but some packages also received significant changes and underwent either a major (compatibility not ensured) or minor (simple additions) release. Support for the 2.9.* branch of skalibs, and associated versions of the other packages, is still ensured for a while, but users are always strongly encouraged to upgrade. * General ------- - Some rarely-triggered build bugs have been fixed. - -fno-stack-protector is not part of the default CFLAGS anymore; stack protector policy now defaults to the compiler's settings. * skalibs-2.10.0.0 ---------------- - Bugfixes. - Significant code cleanup. - New sysdep: chroot. - Lots of new functions, mostly to optimize the number of needed fcntl() calls at open() time. Traces should generally be marginally shorter than they were before. - Removal of the DJBUNIX_FLAG_NB and DJBUNIX_FLAG_COE macros, replaced by the POSIX O_NONBLOCK and O_CLOEXEC macros wherever they were used. - Removal of the skalibs/webipc.h header, and better header separation. - Complete revamping of the pathexec functions, now separated into exec_* (simple execution) and mexec_* (execution with merging of the environment first). In true skalibs fashion, there is a little code, and 3 pages of convenience macros (the exec.h header). - Complete rewrite of the locking functions, with a change of underlying mechanisms. The skalibs locking primitives are now named fd_lock(), fd_unlock() and fd_islocked(). The Unix locks primitive space is a horror show. flock() is not POSIX and does not have a way to test for a lock without taking it. The POSIX lockf() only has exclusive locks, not shared ones. The least bad option is fcntl(), which has shared and exclusive locks *and* a way to check for a lock without taking it, but does not allow taking a shared lock via a O_WRONLY file descriptor. Of all inconveniences this is the most minor one, so now skalibs uses fcntl(). https://skarnet.org/software/skalibs/ git://git.skarnet.org/skalibs * nsss-0.1.0.0 ------------ - New --enable-libc-includes configure option. Without this option, the pwd.h, grp.h and shadow.h headers are not installed anymore, so by default installing nsss on a FHS system does not overwrite the libc headers. https://skarnet.org/software/nsss/ git://git.skarnet.org/nsss * utmps-0.1.0.0 ------------- - New --enable-libc-includes configure option. Without this option, the utmpx.h header is not installed anymore, so by default installing utmps on a FHS system does not overwrite the libc headers. https://skarnet.org/software/utmps/ git://git.skarnet.org/utmps * execline-2.7.0.0 ---------------- - Bugfixes. - The trap program has changed. The "timeout" directive has been removed; a "default" directive has been added, to handle all signals for which a specific directive has not been given. Subprograms are now run with the SIGNAL environment variable set to the signal number (in addition to ! always being set to the application's pid). - The forstdin program has changed. It now exits 0 if it has read at least one line, and 1 otherwise. - The default list of delimiters for backtick, withstdinas, forstdin and forbacktickx has been set to "\n", so by default those programs will read and/or split on lines and only lines. - The backtick, withstdinas, forstdin, forbacktickx, forx, getpid and getcwd programs now have a -E option to activate autoimport. (This saves the user from manually adding "importas var var" after every use of these programs.) https://skarnet.org/software/execline/ git://git.skarnet.org/execline * s6-2.10.0.0 ----------- It is imperative to restart your supervision trees, by rebooting if necessary, after upgrading s6 to the new version. Otherwise, new s6 binaries interacting with service directories maintained by old s6-supervise binaries may not work. If you are using s6-linux-init, it is necessary to upgrade to the latest version of s6-linux-init at the same time as s6. - Bugfixes. - Significant code refactoring. - The internal locking system of service directories has changed, allowing for a cleaner permissions model and official support of relaxed permissions. - New binary to implement those relaxed permissions: s6-svperms. - The "nosetsid" file is not supported anymore in service directories. Services are now always started in a new session. - s6-supervise now traps SIGINT: before dying, it sends a SIGINT to its service's process group. This allows correct transmission of ^C when a supervision tree is running in a terminal, even though every service runs in its own session. - s6-svc -X doesn't exist anymore. s6-supervise now always closes stdin and stdout on the last execution of the service. - The semantics of SIGHUP and SIGQUIT have changed for s6-supervise. - The set of commands sent by s6-svscanctl and received by s6-svscan has been cleaned up and made more logical. - When told to exit normally (typically via s6-svscanctl -t), s6-svscan now first waits for the whole supervision tree to die. The .s6-svscan/finish script can now assume that all services are completely down. (s6-svscanctl -b is an exception; it should not be used in normal circumstances.) - The -s and -S options to s6-svscan are not supported anymore. Signal management in s6-svscan has been streamlined: signals have a default handler that can be overridden by a corresponding executable .s6-svscan/SIGfoo file. - Default signal handlers for s6-svscan have more intuitive semantics. - New binary to help with management of user-owned supervision trees: s6-usertree-maker. https://skarnet.org/software/s6/ git://git.skarnet.org/s6 s6 now has man pages! Thanks to flexibeast for performing the conversion work. Please allow some time for the man pages to be updated to reflect the current HTML documentation. The repository can be found here: https://github.com/flexibeast/s6-man-pages * s6-linux-init-1.0.6.0 --------------------- It *is necessary* to upgrade s6-linux-init at the same time as s6. It *is recommended*, although not strictly necessary, to create your run-image directory again via a s6-linux-init-maker invocation. Old images will still boot, as long as you are using an upgraded version of s6-linux-init; but they may incorrectly handle signals sent to init, so for instance Ctrl-Alt-Del may not work anymore, until you run s6-linux-init-maker again. - New internal binary: s6-linux-init-nuke. This program is not meant to be invoked by users directly: it simply removes a dependency to the 'kill' program in a rare case involving containers. https://skarnet.org/software/s6-linux-init/ git://git.skarnet.org/s6-linux-init * s6-dns-2.3.4.0 -------------- - New library function: s6dns_message_parse_question(). https://skarnet.org/software/s6-dns/ git://git.skarnet.org/s6-dns * s6-networking-2.4.0.0 --------------------- - Important refactoring of the tls code. The crypto tunnel now runs as a child of the application, instead of the other way around. It is now isolated in a s6-tls[cd]-io binary; s6-tlsc is now a simple wrapper around s6-tlsc-io, and s6-tlsd is a simple wrapper around s6-tlsd-io. - New binaries: s6-ucspitlsc and s6-ucspitlsd. Those implement opportunistic TLS via the UCSPI-TLS protocol. - The -K option to the tls binaries has changed semantics: it now enforces a timeout for the handshake instead of dropping the connection after some inactivity. Note that this option is only useful with the bearssl backend: the libtls backend always performs a synchronous handshake, with no way of interrupting it after a timeout expires. - The execline dependency is now optional. Disabling execline, however, changes the behaviour of s6-tcpserver-access (which cannot support exec files without it). https://skarnet.org/software/s6-networking/ git://git.skarnet.org/s6-networking It is now possible to build the s6-networking package against OpenSSL instead of LibreSSL, thanks to the libretls project: https://git.causal.agency/libretls/about/ * mdevd-0.1.3.0 ------------- - New -C option to the mdevd program. This option makes mdevd automatically spawn a mdevd-coldplug program when it's ready, allowing mdevd to be used as a drop-in mdev -d replacement. (Note that the coldplug is also performed if mdevd restarts after being killed, so this feature should not be used in place of a proper service startup sequence with a mdevd-coldplug oneshot depending on the mdevd longrun. It has only been added for convenience.) https://skarnet.org/software/mdevd/ git://git.skarnet.org/mdevd * Other packages -------------- The following packages have received an update so they build with the latest version of skalibs and other dependencies, but nothing has changed except possibly some bugfixes, and hopefully not too many bug additions. - s6-rc-0.5.2.1. (It is not necessary to recompile your service database. However, it is necessary to upgrade s6-rc along with s6, and to reboot the system ASAP after upgrading.) - s6-portable-utils-2.2.3.1 - s6-linux-utils-2.5.1.4 - bcnm-0.0.1.2 Enjoy, Bug-reports welcome. -- Laurent ----- execline compat interface ----- /* Compatibility */ #define pathexec_run(file, argv, envp) exec_ae(file, argv, envp) #define pathexec0_run(file, argv, envp) exec0_ae(file, argv, envp) #define xpathexec_run(file, argv, envp) xexec_ae(file, argv, envp) #define xpathexec0_run(file, argv, envp) xexec0_ae(file, argv, envp) #define pathexec_env(key, value) env_mexec(key, value) #define pathexec_fromenv(argv, envp, envlen) mexec_f(argv, envp, envlen) #define pathexec(argv) mexec(argv) #define pathexec0(argv) mexec0(argv) #define xpathexec_fromenv(argv, envp, envlen) xmexec_f(argv, envp, envlen) #define xpathexec(argv) xmexec(argv) #define xpathexec0(argv) xmexec0(argv) #define pathexec_r_name(file, argv, envp, envlen, modif, modiflen) mexec_afm(file, argv, envp, envlen, modif, modiflen) #define pathexec_r(argv, envp, envlen, modif, modiflen) mexec_fm(argv, envp, envlen, modif, modiflen) #define xpathexec_r_name(file, argv, envp, envlen, modif, modiflen) xmexec_afm(file, argv, envp, envlen, modif, modiflen) #define xpathexec_r(argv, envp, envlen, modif, modiflen) xmexec_fm(argv, envp, envlen, modif, modiflen) #endif copied from https://github.com/skarnet/skalibs/commit/18e43565574b700befc832ed4d25d25e40951f68#diff-69efbe5d997280a1430a6af2fa38e3f5105e706076a26fc751885c505ca598c6R140
2021-01-21 18:54:13 +00:00
int main (int argc, char const *const *argv)
2019-02-03 15:50:04 +00:00
{
skawarePackages: 2021-01 release Maintainer notes ----- The execline exec function interface changed quite drastically, and backwards-compatibility to the old functions was dropped in-between the last release and this one. Thus, downstream code might break. At the end of this commit message is a compatibility interface. ----- Release notes ----- Hello, Happy New Year to everyone! New versions of the skarnet.org packages are available. This is a major release. The skalibs major version number has been bumped, which means that compatibility with previous versions is not ensured. Other packages have been updated to build against the new skalibs. If they only had their patch number increased, that's all the modifications they had (save for possible bugfixes); but some packages also received significant changes and underwent either a major (compatibility not ensured) or minor (simple additions) release. Support for the 2.9.* branch of skalibs, and associated versions of the other packages, is still ensured for a while, but users are always strongly encouraged to upgrade. * General ------- - Some rarely-triggered build bugs have been fixed. - -fno-stack-protector is not part of the default CFLAGS anymore; stack protector policy now defaults to the compiler's settings. * skalibs-2.10.0.0 ---------------- - Bugfixes. - Significant code cleanup. - New sysdep: chroot. - Lots of new functions, mostly to optimize the number of needed fcntl() calls at open() time. Traces should generally be marginally shorter than they were before. - Removal of the DJBUNIX_FLAG_NB and DJBUNIX_FLAG_COE macros, replaced by the POSIX O_NONBLOCK and O_CLOEXEC macros wherever they were used. - Removal of the skalibs/webipc.h header, and better header separation. - Complete revamping of the pathexec functions, now separated into exec_* (simple execution) and mexec_* (execution with merging of the environment first). In true skalibs fashion, there is a little code, and 3 pages of convenience macros (the exec.h header). - Complete rewrite of the locking functions, with a change of underlying mechanisms. The skalibs locking primitives are now named fd_lock(), fd_unlock() and fd_islocked(). The Unix locks primitive space is a horror show. flock() is not POSIX and does not have a way to test for a lock without taking it. The POSIX lockf() only has exclusive locks, not shared ones. The least bad option is fcntl(), which has shared and exclusive locks *and* a way to check for a lock without taking it, but does not allow taking a shared lock via a O_WRONLY file descriptor. Of all inconveniences this is the most minor one, so now skalibs uses fcntl(). https://skarnet.org/software/skalibs/ git://git.skarnet.org/skalibs * nsss-0.1.0.0 ------------ - New --enable-libc-includes configure option. Without this option, the pwd.h, grp.h and shadow.h headers are not installed anymore, so by default installing nsss on a FHS system does not overwrite the libc headers. https://skarnet.org/software/nsss/ git://git.skarnet.org/nsss * utmps-0.1.0.0 ------------- - New --enable-libc-includes configure option. Without this option, the utmpx.h header is not installed anymore, so by default installing utmps on a FHS system does not overwrite the libc headers. https://skarnet.org/software/utmps/ git://git.skarnet.org/utmps * execline-2.7.0.0 ---------------- - Bugfixes. - The trap program has changed. The "timeout" directive has been removed; a "default" directive has been added, to handle all signals for which a specific directive has not been given. Subprograms are now run with the SIGNAL environment variable set to the signal number (in addition to ! always being set to the application's pid). - The forstdin program has changed. It now exits 0 if it has read at least one line, and 1 otherwise. - The default list of delimiters for backtick, withstdinas, forstdin and forbacktickx has been set to "\n", so by default those programs will read and/or split on lines and only lines. - The backtick, withstdinas, forstdin, forbacktickx, forx, getpid and getcwd programs now have a -E option to activate autoimport. (This saves the user from manually adding "importas var var" after every use of these programs.) https://skarnet.org/software/execline/ git://git.skarnet.org/execline * s6-2.10.0.0 ----------- It is imperative to restart your supervision trees, by rebooting if necessary, after upgrading s6 to the new version. Otherwise, new s6 binaries interacting with service directories maintained by old s6-supervise binaries may not work. If you are using s6-linux-init, it is necessary to upgrade to the latest version of s6-linux-init at the same time as s6. - Bugfixes. - Significant code refactoring. - The internal locking system of service directories has changed, allowing for a cleaner permissions model and official support of relaxed permissions. - New binary to implement those relaxed permissions: s6-svperms. - The "nosetsid" file is not supported anymore in service directories. Services are now always started in a new session. - s6-supervise now traps SIGINT: before dying, it sends a SIGINT to its service's process group. This allows correct transmission of ^C when a supervision tree is running in a terminal, even though every service runs in its own session. - s6-svc -X doesn't exist anymore. s6-supervise now always closes stdin and stdout on the last execution of the service. - The semantics of SIGHUP and SIGQUIT have changed for s6-supervise. - The set of commands sent by s6-svscanctl and received by s6-svscan has been cleaned up and made more logical. - When told to exit normally (typically via s6-svscanctl -t), s6-svscan now first waits for the whole supervision tree to die. The .s6-svscan/finish script can now assume that all services are completely down. (s6-svscanctl -b is an exception; it should not be used in normal circumstances.) - The -s and -S options to s6-svscan are not supported anymore. Signal management in s6-svscan has been streamlined: signals have a default handler that can be overridden by a corresponding executable .s6-svscan/SIGfoo file. - Default signal handlers for s6-svscan have more intuitive semantics. - New binary to help with management of user-owned supervision trees: s6-usertree-maker. https://skarnet.org/software/s6/ git://git.skarnet.org/s6 s6 now has man pages! Thanks to flexibeast for performing the conversion work. Please allow some time for the man pages to be updated to reflect the current HTML documentation. The repository can be found here: https://github.com/flexibeast/s6-man-pages * s6-linux-init-1.0.6.0 --------------------- It *is necessary* to upgrade s6-linux-init at the same time as s6. It *is recommended*, although not strictly necessary, to create your run-image directory again via a s6-linux-init-maker invocation. Old images will still boot, as long as you are using an upgraded version of s6-linux-init; but they may incorrectly handle signals sent to init, so for instance Ctrl-Alt-Del may not work anymore, until you run s6-linux-init-maker again. - New internal binary: s6-linux-init-nuke. This program is not meant to be invoked by users directly: it simply removes a dependency to the 'kill' program in a rare case involving containers. https://skarnet.org/software/s6-linux-init/ git://git.skarnet.org/s6-linux-init * s6-dns-2.3.4.0 -------------- - New library function: s6dns_message_parse_question(). https://skarnet.org/software/s6-dns/ git://git.skarnet.org/s6-dns * s6-networking-2.4.0.0 --------------------- - Important refactoring of the tls code. The crypto tunnel now runs as a child of the application, instead of the other way around. It is now isolated in a s6-tls[cd]-io binary; s6-tlsc is now a simple wrapper around s6-tlsc-io, and s6-tlsd is a simple wrapper around s6-tlsd-io. - New binaries: s6-ucspitlsc and s6-ucspitlsd. Those implement opportunistic TLS via the UCSPI-TLS protocol. - The -K option to the tls binaries has changed semantics: it now enforces a timeout for the handshake instead of dropping the connection after some inactivity. Note that this option is only useful with the bearssl backend: the libtls backend always performs a synchronous handshake, with no way of interrupting it after a timeout expires. - The execline dependency is now optional. Disabling execline, however, changes the behaviour of s6-tcpserver-access (which cannot support exec files without it). https://skarnet.org/software/s6-networking/ git://git.skarnet.org/s6-networking It is now possible to build the s6-networking package against OpenSSL instead of LibreSSL, thanks to the libretls project: https://git.causal.agency/libretls/about/ * mdevd-0.1.3.0 ------------- - New -C option to the mdevd program. This option makes mdevd automatically spawn a mdevd-coldplug program when it's ready, allowing mdevd to be used as a drop-in mdev -d replacement. (Note that the coldplug is also performed if mdevd restarts after being killed, so this feature should not be used in place of a proper service startup sequence with a mdevd-coldplug oneshot depending on the mdevd longrun. It has only been added for convenience.) https://skarnet.org/software/mdevd/ git://git.skarnet.org/mdevd * Other packages -------------- The following packages have received an update so they build with the latest version of skalibs and other dependencies, but nothing has changed except possibly some bugfixes, and hopefully not too many bug additions. - s6-rc-0.5.2.1. (It is not necessary to recompile your service database. However, it is necessary to upgrade s6-rc along with s6, and to reboot the system ASAP after upgrading.) - s6-portable-utils-2.2.3.1 - s6-linux-utils-2.5.1.4 - bcnm-0.0.1.2 Enjoy, Bug-reports welcome. -- Laurent ----- execline compat interface ----- /* Compatibility */ #define pathexec_run(file, argv, envp) exec_ae(file, argv, envp) #define pathexec0_run(file, argv, envp) exec0_ae(file, argv, envp) #define xpathexec_run(file, argv, envp) xexec_ae(file, argv, envp) #define xpathexec0_run(file, argv, envp) xexec0_ae(file, argv, envp) #define pathexec_env(key, value) env_mexec(key, value) #define pathexec_fromenv(argv, envp, envlen) mexec_f(argv, envp, envlen) #define pathexec(argv) mexec(argv) #define pathexec0(argv) mexec0(argv) #define xpathexec_fromenv(argv, envp, envlen) xmexec_f(argv, envp, envlen) #define xpathexec(argv) xmexec(argv) #define xpathexec0(argv) xmexec0(argv) #define pathexec_r_name(file, argv, envp, envlen, modif, modiflen) mexec_afm(file, argv, envp, envlen, modif, modiflen) #define pathexec_r(argv, envp, envlen, modif, modiflen) mexec_fm(argv, envp, envlen, modif, modiflen) #define xpathexec_r_name(file, argv, envp, envlen, modif, modiflen) xmexec_afm(file, argv, envp, envlen, modif, modiflen) #define xpathexec_r(argv, envp, envlen, modif, modiflen) xmexec_fm(argv, envp, envlen, modif, modiflen) #endif copied from https://github.com/skarnet/skalibs/commit/18e43565574b700befc832ed4d25d25e40951f68#diff-69efbe5d997280a1430a6af2fa38e3f5105e706076a26fc751885c505ca598c6R140
2021-01-21 18:54:13 +00:00
char const *s = getenv(VAR) ;
2019-02-03 15:50:04 +00:00
unsigned int fd = 1 ;
unsigned int timeout = 0 ;
int df = 1, keep = 0 ;
PROG = "sdnotify-wrapper" ;
{
skawarePackages: Fall 2021 release Maintainers Notes below. ~~~ Hello, New versions of all the skarnet.org packages are available. skalibs has undergone a major update, with a few APIs having disappeared, and others having changed. Compatibility with previous versions is *not* assured. Consequently, all the rest of the skarnet.org software has undergone at least a release bump, in order to build with the new skalibs. But some packages also have new functionality added (hence, a minor bump), and others also have their own incompatible changes (hence, a major bump). The new versions are the following: skalibs-2.11.0.0 (major) nsss-0.2.0.0 (major) utmps-0.1.0.3 (release) execline-2.8.1.0 (minor) s6-2.11.0.0 (major) s6-rc-0.5.2.3 (release) s6-portable-utils-2.2.3.3 (release) s6-linux-utils-2.5.1.6 (release) s6-linux-init-1.0.6.4 (release) s6-dns-2.3.5.2 (release) s6-networking-2.5.0.0 (major) mdevd-0.1.5.0 (minor) bcnm-0.0.1.4 (release) dnsfunnel-0.0.1.2 (release) Additionally, a new package has been released: smtpd-starttls-proxy-0.0.1.0 Dependencies have all been updated to the latest versions. They are, this time, partially strict: libraries and binaries may build with older releases of their dependencies, but not across major version bumps. The safest approach is to upgrade everything at the same time. You do not need to recompile your s6-rc service databases or recreate your s6-linux-init run-images. You should restart your supervision tree after upgrading skalibs and s6, as soon as is convenient for you. Details of major and minor package changes follow. * skalibs-2.11.0.0 ---------------- - A lot of obsolete or useless functionality has been removed: libbiguint, rc4, md5, iobuffer, skasigaction, environ.h and getpeereid.h headers, various functions that have not proven their value in a while. - Some functions changed signatures or changed names, or both. - All custom types ending in _t have been renamed, to avoid treading on POSIX namespace. (The same change has not been done yet in other packages, but skalibs was the biggest offender by far.) - Signal functions have been deeply reworked. - cdb has been reworked, the API is now more user-friendly. - New functions have been added. The deletion of significant portions of code has made skalibs leaner. libskarnet.so has dropped under 190 kB on x86_64. The cdb rewrite on its own has helped reduce an important amount of boilerplate in cdb-using code. All in all, code linked against the new skalibs should be slightly smaller and use a tiny bit less RAM. https://skarnet.org/software/skalibs/ git://git.skarnet.org/skalibs * nsss-0.2.0.0 ------------ - Bugfixes. - nsss-switch wire protocol slightly modified, which is enough to warrant a major version bump. - _r functions are now entirely thread-safe. - Spawned nsssd programs are now persistent and only expire after a timeout on non-enumeration queries. This saves a lot of forking with applications that can call primitives such as getpwnam() repeatedly, as e.g. mdevd does when initially parsing its configuration file. - New nsssd-switch program, implementing real nsswitch functionality by dispatching queries to various backends according to a script. It does not dlopen a single library or read a single config file. https://skarnet.org/software/nsss/ git://git.skarnet.org/nsss * execline-2.8.1.0 ---------------- - Bugfixes. - New binary: case. It compares a value against a series of regular expressions, executing into another command line on the first match. https://skarnet.org/software/execline/ git://git.skarnet.org/execline * s6-2.11.0.0 ----------- - Bugfixes. - Some libs6 header names have been simplified. - s6-svwait now accepts -r and -R options. - s6-supervise now reads an optional lock-fd file in the service directory; if it finds one, the first action of the service is to take a blocking lock. This prevents confusion when a controller process dies while still leaving workers holding resources; it also prevents log spamming on user mistakes (autobackgrounding services, notably). - New binaries: s6-socklog, s6-svlink, s6-svunlink. The former is a rewrite of smarden.org's socklog program, in order to implement a fully functional syslogd with only s6 programs. The latter are tools that start and stop services by symlinking/unlinking service directories from a scan directory, in order to make it easier to integrate s6-style services in boot scripts for sequential service managers such as OpenRC. https://skarnet.org/software/s6/ git://git.skarnet.org/s6 * s6-networking-2.5.0.0 --------------------- - Bugfixes. - minidentd has been removed. It was an old and somehow still buggy piece of code that was only hanging around for nostalgia reasons. - Full support for client certificates. Details of the client certificate are transmitted to the application via environment variables (or via an environment string in the case of opportunistic TLS). - Full SNI support, including server-side. (That involved a deep dive into the bearssl internals, which is why it took so long.) The filenames containing secret keys and certificates for <domain> are read in the environment variables KEYFILE:<domain> and CERTFILE:<domain>. Complete client certificate and SNI support now make the TLS part of s6-networking a fully viable replacement of stunnel and other similar TLS tunneling tools. This is most interesting when s6-networking is built against bearssl, which uses about 1/9 of the resources that OpenSSL needs. https://skarnet.org/software/s6-networking/ git://git.skarnet.org/s6-networking * mdevd-0.1.5.0 ------------- - A new option to mdevd is available: -O <nlgroups>. This option makes mdevd rebroadcast uevents to a netlink group (or set of netlink groups) once they have been handled. This allows applications to read uevents from a netlink group *after* the device manager is done with them. This is useful, for instance, when pairing mdevd with libudev-zero for full udev emulation. - The * and & directives, which previously were only triggered by "add" and "remove" actions, are now triggered by *all* action types. This gives users full scripting access to any event, which can be used to implement complex rules similar to udev ones. These two changes make it possible to now build a full-featured desktop system based on mdevd + libudev-zero, without running systemd-udevd or eudev. https://skarnet.org/software/mdevd/ git://git.skarnet.org/mdevd * smtpd-starttls-proxy-0.0.1.0 ---------------------------- This new package, in conjunction with the latest s6-networking, implements the STARTTLS functionality for inetd-like mail servers that do not already support it. (Currently only tested with qmail-smtpd.) If you have noticed that sending mail to skarnet.org supports STARTTLS now, it is thanks to this little piece of software. https://skarnet.org/software/smtpd-starttls-proxy/ git://git.skarnet.org/smtpd-starttls-proxy Enjoy, Bug-reports welcome. Laurent
2021-09-26 17:00:07 +01:00
subgetopt l = SUBGETOPT_ZERO ;
2019-02-03 15:50:04 +00:00
for (;;)
{
skawarePackages: 2021-01 release Maintainer notes ----- The execline exec function interface changed quite drastically, and backwards-compatibility to the old functions was dropped in-between the last release and this one. Thus, downstream code might break. At the end of this commit message is a compatibility interface. ----- Release notes ----- Hello, Happy New Year to everyone! New versions of the skarnet.org packages are available. This is a major release. The skalibs major version number has been bumped, which means that compatibility with previous versions is not ensured. Other packages have been updated to build against the new skalibs. If they only had their patch number increased, that's all the modifications they had (save for possible bugfixes); but some packages also received significant changes and underwent either a major (compatibility not ensured) or minor (simple additions) release. Support for the 2.9.* branch of skalibs, and associated versions of the other packages, is still ensured for a while, but users are always strongly encouraged to upgrade. * General ------- - Some rarely-triggered build bugs have been fixed. - -fno-stack-protector is not part of the default CFLAGS anymore; stack protector policy now defaults to the compiler's settings. * skalibs-2.10.0.0 ---------------- - Bugfixes. - Significant code cleanup. - New sysdep: chroot. - Lots of new functions, mostly to optimize the number of needed fcntl() calls at open() time. Traces should generally be marginally shorter than they were before. - Removal of the DJBUNIX_FLAG_NB and DJBUNIX_FLAG_COE macros, replaced by the POSIX O_NONBLOCK and O_CLOEXEC macros wherever they were used. - Removal of the skalibs/webipc.h header, and better header separation. - Complete revamping of the pathexec functions, now separated into exec_* (simple execution) and mexec_* (execution with merging of the environment first). In true skalibs fashion, there is a little code, and 3 pages of convenience macros (the exec.h header). - Complete rewrite of the locking functions, with a change of underlying mechanisms. The skalibs locking primitives are now named fd_lock(), fd_unlock() and fd_islocked(). The Unix locks primitive space is a horror show. flock() is not POSIX and does not have a way to test for a lock without taking it. The POSIX lockf() only has exclusive locks, not shared ones. The least bad option is fcntl(), which has shared and exclusive locks *and* a way to check for a lock without taking it, but does not allow taking a shared lock via a O_WRONLY file descriptor. Of all inconveniences this is the most minor one, so now skalibs uses fcntl(). https://skarnet.org/software/skalibs/ git://git.skarnet.org/skalibs * nsss-0.1.0.0 ------------ - New --enable-libc-includes configure option. Without this option, the pwd.h, grp.h and shadow.h headers are not installed anymore, so by default installing nsss on a FHS system does not overwrite the libc headers. https://skarnet.org/software/nsss/ git://git.skarnet.org/nsss * utmps-0.1.0.0 ------------- - New --enable-libc-includes configure option. Without this option, the utmpx.h header is not installed anymore, so by default installing utmps on a FHS system does not overwrite the libc headers. https://skarnet.org/software/utmps/ git://git.skarnet.org/utmps * execline-2.7.0.0 ---------------- - Bugfixes. - The trap program has changed. The "timeout" directive has been removed; a "default" directive has been added, to handle all signals for which a specific directive has not been given. Subprograms are now run with the SIGNAL environment variable set to the signal number (in addition to ! always being set to the application's pid). - The forstdin program has changed. It now exits 0 if it has read at least one line, and 1 otherwise. - The default list of delimiters for backtick, withstdinas, forstdin and forbacktickx has been set to "\n", so by default those programs will read and/or split on lines and only lines. - The backtick, withstdinas, forstdin, forbacktickx, forx, getpid and getcwd programs now have a -E option to activate autoimport. (This saves the user from manually adding "importas var var" after every use of these programs.) https://skarnet.org/software/execline/ git://git.skarnet.org/execline * s6-2.10.0.0 ----------- It is imperative to restart your supervision trees, by rebooting if necessary, after upgrading s6 to the new version. Otherwise, new s6 binaries interacting with service directories maintained by old s6-supervise binaries may not work. If you are using s6-linux-init, it is necessary to upgrade to the latest version of s6-linux-init at the same time as s6. - Bugfixes. - Significant code refactoring. - The internal locking system of service directories has changed, allowing for a cleaner permissions model and official support of relaxed permissions. - New binary to implement those relaxed permissions: s6-svperms. - The "nosetsid" file is not supported anymore in service directories. Services are now always started in a new session. - s6-supervise now traps SIGINT: before dying, it sends a SIGINT to its service's process group. This allows correct transmission of ^C when a supervision tree is running in a terminal, even though every service runs in its own session. - s6-svc -X doesn't exist anymore. s6-supervise now always closes stdin and stdout on the last execution of the service. - The semantics of SIGHUP and SIGQUIT have changed for s6-supervise. - The set of commands sent by s6-svscanctl and received by s6-svscan has been cleaned up and made more logical. - When told to exit normally (typically via s6-svscanctl -t), s6-svscan now first waits for the whole supervision tree to die. The .s6-svscan/finish script can now assume that all services are completely down. (s6-svscanctl -b is an exception; it should not be used in normal circumstances.) - The -s and -S options to s6-svscan are not supported anymore. Signal management in s6-svscan has been streamlined: signals have a default handler that can be overridden by a corresponding executable .s6-svscan/SIGfoo file. - Default signal handlers for s6-svscan have more intuitive semantics. - New binary to help with management of user-owned supervision trees: s6-usertree-maker. https://skarnet.org/software/s6/ git://git.skarnet.org/s6 s6 now has man pages! Thanks to flexibeast for performing the conversion work. Please allow some time for the man pages to be updated to reflect the current HTML documentation. The repository can be found here: https://github.com/flexibeast/s6-man-pages * s6-linux-init-1.0.6.0 --------------------- It *is necessary* to upgrade s6-linux-init at the same time as s6. It *is recommended*, although not strictly necessary, to create your run-image directory again via a s6-linux-init-maker invocation. Old images will still boot, as long as you are using an upgraded version of s6-linux-init; but they may incorrectly handle signals sent to init, so for instance Ctrl-Alt-Del may not work anymore, until you run s6-linux-init-maker again. - New internal binary: s6-linux-init-nuke. This program is not meant to be invoked by users directly: it simply removes a dependency to the 'kill' program in a rare case involving containers. https://skarnet.org/software/s6-linux-init/ git://git.skarnet.org/s6-linux-init * s6-dns-2.3.4.0 -------------- - New library function: s6dns_message_parse_question(). https://skarnet.org/software/s6-dns/ git://git.skarnet.org/s6-dns * s6-networking-2.4.0.0 --------------------- - Important refactoring of the tls code. The crypto tunnel now runs as a child of the application, instead of the other way around. It is now isolated in a s6-tls[cd]-io binary; s6-tlsc is now a simple wrapper around s6-tlsc-io, and s6-tlsd is a simple wrapper around s6-tlsd-io. - New binaries: s6-ucspitlsc and s6-ucspitlsd. Those implement opportunistic TLS via the UCSPI-TLS protocol. - The -K option to the tls binaries has changed semantics: it now enforces a timeout for the handshake instead of dropping the connection after some inactivity. Note that this option is only useful with the bearssl backend: the libtls backend always performs a synchronous handshake, with no way of interrupting it after a timeout expires. - The execline dependency is now optional. Disabling execline, however, changes the behaviour of s6-tcpserver-access (which cannot support exec files without it). https://skarnet.org/software/s6-networking/ git://git.skarnet.org/s6-networking It is now possible to build the s6-networking package against OpenSSL instead of LibreSSL, thanks to the libretls project: https://git.causal.agency/libretls/about/ * mdevd-0.1.3.0 ------------- - New -C option to the mdevd program. This option makes mdevd automatically spawn a mdevd-coldplug program when it's ready, allowing mdevd to be used as a drop-in mdev -d replacement. (Note that the coldplug is also performed if mdevd restarts after being killed, so this feature should not be used in place of a proper service startup sequence with a mdevd-coldplug oneshot depending on the mdevd longrun. It has only been added for convenience.) https://skarnet.org/software/mdevd/ git://git.skarnet.org/mdevd * Other packages -------------- The following packages have received an update so they build with the latest version of skalibs and other dependencies, but nothing has changed except possibly some bugfixes, and hopefully not too many bug additions. - s6-rc-0.5.2.1. (It is not necessary to recompile your service database. However, it is necessary to upgrade s6-rc along with s6, and to reboot the system ASAP after upgrading.) - s6-portable-utils-2.2.3.1 - s6-linux-utils-2.5.1.4 - bcnm-0.0.1.2 Enjoy, Bug-reports welcome. -- Laurent ----- execline compat interface ----- /* Compatibility */ #define pathexec_run(file, argv, envp) exec_ae(file, argv, envp) #define pathexec0_run(file, argv, envp) exec0_ae(file, argv, envp) #define xpathexec_run(file, argv, envp) xexec_ae(file, argv, envp) #define xpathexec0_run(file, argv, envp) xexec0_ae(file, argv, envp) #define pathexec_env(key, value) env_mexec(key, value) #define pathexec_fromenv(argv, envp, envlen) mexec_f(argv, envp, envlen) #define pathexec(argv) mexec(argv) #define pathexec0(argv) mexec0(argv) #define xpathexec_fromenv(argv, envp, envlen) xmexec_f(argv, envp, envlen) #define xpathexec(argv) xmexec(argv) #define xpathexec0(argv) xmexec0(argv) #define pathexec_r_name(file, argv, envp, envlen, modif, modiflen) mexec_afm(file, argv, envp, envlen, modif, modiflen) #define pathexec_r(argv, envp, envlen, modif, modiflen) mexec_fm(argv, envp, envlen, modif, modiflen) #define xpathexec_r_name(file, argv, envp, envlen, modif, modiflen) xmexec_afm(file, argv, envp, envlen, modif, modiflen) #define xpathexec_r(argv, envp, envlen, modif, modiflen) xmexec_fm(argv, envp, envlen, modif, modiflen) #endif copied from https://github.com/skarnet/skalibs/commit/18e43565574b700befc832ed4d25d25e40951f68#diff-69efbe5d997280a1430a6af2fa38e3f5105e706076a26fc751885c505ca598c6R140
2021-01-21 18:54:13 +00:00
int opt = subgetopt_r(argc, argv, "d:ft:k", &l) ;
2019-02-03 15:50:04 +00:00
if (opt == -1) break ;
switch (opt)
{
case 'd' : if (!uint0_scan(l.arg, &fd)) dieusage() ; break ;
case 'f' : df = 0 ; break ;
case 't' : if (!uint0_scan(l.arg, &timeout)) dieusage() ; break ;
case 'k' : keep = 1 ; break ;
default : dieusage() ;
}
}
argc -= l.ind ; argv += l.ind ;
}
if (!argc) dieusage() ;
skawarePackages: 2021-01 release Maintainer notes ----- The execline exec function interface changed quite drastically, and backwards-compatibility to the old functions was dropped in-between the last release and this one. Thus, downstream code might break. At the end of this commit message is a compatibility interface. ----- Release notes ----- Hello, Happy New Year to everyone! New versions of the skarnet.org packages are available. This is a major release. The skalibs major version number has been bumped, which means that compatibility with previous versions is not ensured. Other packages have been updated to build against the new skalibs. If they only had their patch number increased, that's all the modifications they had (save for possible bugfixes); but some packages also received significant changes and underwent either a major (compatibility not ensured) or minor (simple additions) release. Support for the 2.9.* branch of skalibs, and associated versions of the other packages, is still ensured for a while, but users are always strongly encouraged to upgrade. * General ------- - Some rarely-triggered build bugs have been fixed. - -fno-stack-protector is not part of the default CFLAGS anymore; stack protector policy now defaults to the compiler's settings. * skalibs-2.10.0.0 ---------------- - Bugfixes. - Significant code cleanup. - New sysdep: chroot. - Lots of new functions, mostly to optimize the number of needed fcntl() calls at open() time. Traces should generally be marginally shorter than they were before. - Removal of the DJBUNIX_FLAG_NB and DJBUNIX_FLAG_COE macros, replaced by the POSIX O_NONBLOCK and O_CLOEXEC macros wherever they were used. - Removal of the skalibs/webipc.h header, and better header separation. - Complete revamping of the pathexec functions, now separated into exec_* (simple execution) and mexec_* (execution with merging of the environment first). In true skalibs fashion, there is a little code, and 3 pages of convenience macros (the exec.h header). - Complete rewrite of the locking functions, with a change of underlying mechanisms. The skalibs locking primitives are now named fd_lock(), fd_unlock() and fd_islocked(). The Unix locks primitive space is a horror show. flock() is not POSIX and does not have a way to test for a lock without taking it. The POSIX lockf() only has exclusive locks, not shared ones. The least bad option is fcntl(), which has shared and exclusive locks *and* a way to check for a lock without taking it, but does not allow taking a shared lock via a O_WRONLY file descriptor. Of all inconveniences this is the most minor one, so now skalibs uses fcntl(). https://skarnet.org/software/skalibs/ git://git.skarnet.org/skalibs * nsss-0.1.0.0 ------------ - New --enable-libc-includes configure option. Without this option, the pwd.h, grp.h and shadow.h headers are not installed anymore, so by default installing nsss on a FHS system does not overwrite the libc headers. https://skarnet.org/software/nsss/ git://git.skarnet.org/nsss * utmps-0.1.0.0 ------------- - New --enable-libc-includes configure option. Without this option, the utmpx.h header is not installed anymore, so by default installing utmps on a FHS system does not overwrite the libc headers. https://skarnet.org/software/utmps/ git://git.skarnet.org/utmps * execline-2.7.0.0 ---------------- - Bugfixes. - The trap program has changed. The "timeout" directive has been removed; a "default" directive has been added, to handle all signals for which a specific directive has not been given. Subprograms are now run with the SIGNAL environment variable set to the signal number (in addition to ! always being set to the application's pid). - The forstdin program has changed. It now exits 0 if it has read at least one line, and 1 otherwise. - The default list of delimiters for backtick, withstdinas, forstdin and forbacktickx has been set to "\n", so by default those programs will read and/or split on lines and only lines. - The backtick, withstdinas, forstdin, forbacktickx, forx, getpid and getcwd programs now have a -E option to activate autoimport. (This saves the user from manually adding "importas var var" after every use of these programs.) https://skarnet.org/software/execline/ git://git.skarnet.org/execline * s6-2.10.0.0 ----------- It is imperative to restart your supervision trees, by rebooting if necessary, after upgrading s6 to the new version. Otherwise, new s6 binaries interacting with service directories maintained by old s6-supervise binaries may not work. If you are using s6-linux-init, it is necessary to upgrade to the latest version of s6-linux-init at the same time as s6. - Bugfixes. - Significant code refactoring. - The internal locking system of service directories has changed, allowing for a cleaner permissions model and official support of relaxed permissions. - New binary to implement those relaxed permissions: s6-svperms. - The "nosetsid" file is not supported anymore in service directories. Services are now always started in a new session. - s6-supervise now traps SIGINT: before dying, it sends a SIGINT to its service's process group. This allows correct transmission of ^C when a supervision tree is running in a terminal, even though every service runs in its own session. - s6-svc -X doesn't exist anymore. s6-supervise now always closes stdin and stdout on the last execution of the service. - The semantics of SIGHUP and SIGQUIT have changed for s6-supervise. - The set of commands sent by s6-svscanctl and received by s6-svscan has been cleaned up and made more logical. - When told to exit normally (typically via s6-svscanctl -t), s6-svscan now first waits for the whole supervision tree to die. The .s6-svscan/finish script can now assume that all services are completely down. (s6-svscanctl -b is an exception; it should not be used in normal circumstances.) - The -s and -S options to s6-svscan are not supported anymore. Signal management in s6-svscan has been streamlined: signals have a default handler that can be overridden by a corresponding executable .s6-svscan/SIGfoo file. - Default signal handlers for s6-svscan have more intuitive semantics. - New binary to help with management of user-owned supervision trees: s6-usertree-maker. https://skarnet.org/software/s6/ git://git.skarnet.org/s6 s6 now has man pages! Thanks to flexibeast for performing the conversion work. Please allow some time for the man pages to be updated to reflect the current HTML documentation. The repository can be found here: https://github.com/flexibeast/s6-man-pages * s6-linux-init-1.0.6.0 --------------------- It *is necessary* to upgrade s6-linux-init at the same time as s6. It *is recommended*, although not strictly necessary, to create your run-image directory again via a s6-linux-init-maker invocation. Old images will still boot, as long as you are using an upgraded version of s6-linux-init; but they may incorrectly handle signals sent to init, so for instance Ctrl-Alt-Del may not work anymore, until you run s6-linux-init-maker again. - New internal binary: s6-linux-init-nuke. This program is not meant to be invoked by users directly: it simply removes a dependency to the 'kill' program in a rare case involving containers. https://skarnet.org/software/s6-linux-init/ git://git.skarnet.org/s6-linux-init * s6-dns-2.3.4.0 -------------- - New library function: s6dns_message_parse_question(). https://skarnet.org/software/s6-dns/ git://git.skarnet.org/s6-dns * s6-networking-2.4.0.0 --------------------- - Important refactoring of the tls code. The crypto tunnel now runs as a child of the application, instead of the other way around. It is now isolated in a s6-tls[cd]-io binary; s6-tlsc is now a simple wrapper around s6-tlsc-io, and s6-tlsd is a simple wrapper around s6-tlsd-io. - New binaries: s6-ucspitlsc and s6-ucspitlsd. Those implement opportunistic TLS via the UCSPI-TLS protocol. - The -K option to the tls binaries has changed semantics: it now enforces a timeout for the handshake instead of dropping the connection after some inactivity. Note that this option is only useful with the bearssl backend: the libtls backend always performs a synchronous handshake, with no way of interrupting it after a timeout expires. - The execline dependency is now optional. Disabling execline, however, changes the behaviour of s6-tcpserver-access (which cannot support exec files without it). https://skarnet.org/software/s6-networking/ git://git.skarnet.org/s6-networking It is now possible to build the s6-networking package against OpenSSL instead of LibreSSL, thanks to the libretls project: https://git.causal.agency/libretls/about/ * mdevd-0.1.3.0 ------------- - New -C option to the mdevd program. This option makes mdevd automatically spawn a mdevd-coldplug program when it's ready, allowing mdevd to be used as a drop-in mdev -d replacement. (Note that the coldplug is also performed if mdevd restarts after being killed, so this feature should not be used in place of a proper service startup sequence with a mdevd-coldplug oneshot depending on the mdevd longrun. It has only been added for convenience.) https://skarnet.org/software/mdevd/ git://git.skarnet.org/mdevd * Other packages -------------- The following packages have received an update so they build with the latest version of skalibs and other dependencies, but nothing has changed except possibly some bugfixes, and hopefully not too many bug additions. - s6-rc-0.5.2.1. (It is not necessary to recompile your service database. However, it is necessary to upgrade s6-rc along with s6, and to reboot the system ASAP after upgrading.) - s6-portable-utils-2.2.3.1 - s6-linux-utils-2.5.1.4 - bcnm-0.0.1.2 Enjoy, Bug-reports welcome. -- Laurent ----- execline compat interface ----- /* Compatibility */ #define pathexec_run(file, argv, envp) exec_ae(file, argv, envp) #define pathexec0_run(file, argv, envp) exec0_ae(file, argv, envp) #define xpathexec_run(file, argv, envp) xexec_ae(file, argv, envp) #define xpathexec0_run(file, argv, envp) xexec0_ae(file, argv, envp) #define pathexec_env(key, value) env_mexec(key, value) #define pathexec_fromenv(argv, envp, envlen) mexec_f(argv, envp, envlen) #define pathexec(argv) mexec(argv) #define pathexec0(argv) mexec0(argv) #define xpathexec_fromenv(argv, envp, envlen) xmexec_f(argv, envp, envlen) #define xpathexec(argv) xmexec(argv) #define xpathexec0(argv) xmexec0(argv) #define pathexec_r_name(file, argv, envp, envlen, modif, modiflen) mexec_afm(file, argv, envp, envlen, modif, modiflen) #define pathexec_r(argv, envp, envlen, modif, modiflen) mexec_fm(argv, envp, envlen, modif, modiflen) #define xpathexec_r_name(file, argv, envp, envlen, modif, modiflen) xmexec_afm(file, argv, envp, envlen, modif, modiflen) #define xpathexec_r(argv, envp, envlen, modif, modiflen) xmexec_fm(argv, envp, envlen, modif, modiflen) #endif copied from https://github.com/skarnet/skalibs/commit/18e43565574b700befc832ed4d25d25e40951f68#diff-69efbe5d997280a1430a6af2fa38e3f5105e706076a26fc751885c505ca598c6R140
2021-01-21 18:54:13 +00:00
if (!s) xexec(argv) ;
2019-02-03 15:50:04 +00:00
else
{
pid_t parent = getpid() ;
pid_t child ;
int p[2] ;
if (pipe(p) < 0) strerr_diefu1sys(111, "pipe") ;
child = df ? doublefork() : fork() ;
if (child < 0) strerr_diefu1sys(111, df ? "doublefork" : "fork") ;
else if (!child)
{
PROG = "sdnotify-wrapper (child)" ;
close(p[1]) ;
return run_child(p[0], timeout, parent, s) ;
}
close(p[0]) ;
if (fd_move((int)fd, p[1]) < 0) strerr_diefu1sys(111, "move descriptor") ;
skawarePackages: 2021-01 release Maintainer notes ----- The execline exec function interface changed quite drastically, and backwards-compatibility to the old functions was dropped in-between the last release and this one. Thus, downstream code might break. At the end of this commit message is a compatibility interface. ----- Release notes ----- Hello, Happy New Year to everyone! New versions of the skarnet.org packages are available. This is a major release. The skalibs major version number has been bumped, which means that compatibility with previous versions is not ensured. Other packages have been updated to build against the new skalibs. If they only had their patch number increased, that's all the modifications they had (save for possible bugfixes); but some packages also received significant changes and underwent either a major (compatibility not ensured) or minor (simple additions) release. Support for the 2.9.* branch of skalibs, and associated versions of the other packages, is still ensured for a while, but users are always strongly encouraged to upgrade. * General ------- - Some rarely-triggered build bugs have been fixed. - -fno-stack-protector is not part of the default CFLAGS anymore; stack protector policy now defaults to the compiler's settings. * skalibs-2.10.0.0 ---------------- - Bugfixes. - Significant code cleanup. - New sysdep: chroot. - Lots of new functions, mostly to optimize the number of needed fcntl() calls at open() time. Traces should generally be marginally shorter than they were before. - Removal of the DJBUNIX_FLAG_NB and DJBUNIX_FLAG_COE macros, replaced by the POSIX O_NONBLOCK and O_CLOEXEC macros wherever they were used. - Removal of the skalibs/webipc.h header, and better header separation. - Complete revamping of the pathexec functions, now separated into exec_* (simple execution) and mexec_* (execution with merging of the environment first). In true skalibs fashion, there is a little code, and 3 pages of convenience macros (the exec.h header). - Complete rewrite of the locking functions, with a change of underlying mechanisms. The skalibs locking primitives are now named fd_lock(), fd_unlock() and fd_islocked(). The Unix locks primitive space is a horror show. flock() is not POSIX and does not have a way to test for a lock without taking it. The POSIX lockf() only has exclusive locks, not shared ones. The least bad option is fcntl(), which has shared and exclusive locks *and* a way to check for a lock without taking it, but does not allow taking a shared lock via a O_WRONLY file descriptor. Of all inconveniences this is the most minor one, so now skalibs uses fcntl(). https://skarnet.org/software/skalibs/ git://git.skarnet.org/skalibs * nsss-0.1.0.0 ------------ - New --enable-libc-includes configure option. Without this option, the pwd.h, grp.h and shadow.h headers are not installed anymore, so by default installing nsss on a FHS system does not overwrite the libc headers. https://skarnet.org/software/nsss/ git://git.skarnet.org/nsss * utmps-0.1.0.0 ------------- - New --enable-libc-includes configure option. Without this option, the utmpx.h header is not installed anymore, so by default installing utmps on a FHS system does not overwrite the libc headers. https://skarnet.org/software/utmps/ git://git.skarnet.org/utmps * execline-2.7.0.0 ---------------- - Bugfixes. - The trap program has changed. The "timeout" directive has been removed; a "default" directive has been added, to handle all signals for which a specific directive has not been given. Subprograms are now run with the SIGNAL environment variable set to the signal number (in addition to ! always being set to the application's pid). - The forstdin program has changed. It now exits 0 if it has read at least one line, and 1 otherwise. - The default list of delimiters for backtick, withstdinas, forstdin and forbacktickx has been set to "\n", so by default those programs will read and/or split on lines and only lines. - The backtick, withstdinas, forstdin, forbacktickx, forx, getpid and getcwd programs now have a -E option to activate autoimport. (This saves the user from manually adding "importas var var" after every use of these programs.) https://skarnet.org/software/execline/ git://git.skarnet.org/execline * s6-2.10.0.0 ----------- It is imperative to restart your supervision trees, by rebooting if necessary, after upgrading s6 to the new version. Otherwise, new s6 binaries interacting with service directories maintained by old s6-supervise binaries may not work. If you are using s6-linux-init, it is necessary to upgrade to the latest version of s6-linux-init at the same time as s6. - Bugfixes. - Significant code refactoring. - The internal locking system of service directories has changed, allowing for a cleaner permissions model and official support of relaxed permissions. - New binary to implement those relaxed permissions: s6-svperms. - The "nosetsid" file is not supported anymore in service directories. Services are now always started in a new session. - s6-supervise now traps SIGINT: before dying, it sends a SIGINT to its service's process group. This allows correct transmission of ^C when a supervision tree is running in a terminal, even though every service runs in its own session. - s6-svc -X doesn't exist anymore. s6-supervise now always closes stdin and stdout on the last execution of the service. - The semantics of SIGHUP and SIGQUIT have changed for s6-supervise. - The set of commands sent by s6-svscanctl and received by s6-svscan has been cleaned up and made more logical. - When told to exit normally (typically via s6-svscanctl -t), s6-svscan now first waits for the whole supervision tree to die. The .s6-svscan/finish script can now assume that all services are completely down. (s6-svscanctl -b is an exception; it should not be used in normal circumstances.) - The -s and -S options to s6-svscan are not supported anymore. Signal management in s6-svscan has been streamlined: signals have a default handler that can be overridden by a corresponding executable .s6-svscan/SIGfoo file. - Default signal handlers for s6-svscan have more intuitive semantics. - New binary to help with management of user-owned supervision trees: s6-usertree-maker. https://skarnet.org/software/s6/ git://git.skarnet.org/s6 s6 now has man pages! Thanks to flexibeast for performing the conversion work. Please allow some time for the man pages to be updated to reflect the current HTML documentation. The repository can be found here: https://github.com/flexibeast/s6-man-pages * s6-linux-init-1.0.6.0 --------------------- It *is necessary* to upgrade s6-linux-init at the same time as s6. It *is recommended*, although not strictly necessary, to create your run-image directory again via a s6-linux-init-maker invocation. Old images will still boot, as long as you are using an upgraded version of s6-linux-init; but they may incorrectly handle signals sent to init, so for instance Ctrl-Alt-Del may not work anymore, until you run s6-linux-init-maker again. - New internal binary: s6-linux-init-nuke. This program is not meant to be invoked by users directly: it simply removes a dependency to the 'kill' program in a rare case involving containers. https://skarnet.org/software/s6-linux-init/ git://git.skarnet.org/s6-linux-init * s6-dns-2.3.4.0 -------------- - New library function: s6dns_message_parse_question(). https://skarnet.org/software/s6-dns/ git://git.skarnet.org/s6-dns * s6-networking-2.4.0.0 --------------------- - Important refactoring of the tls code. The crypto tunnel now runs as a child of the application, instead of the other way around. It is now isolated in a s6-tls[cd]-io binary; s6-tlsc is now a simple wrapper around s6-tlsc-io, and s6-tlsd is a simple wrapper around s6-tlsd-io. - New binaries: s6-ucspitlsc and s6-ucspitlsd. Those implement opportunistic TLS via the UCSPI-TLS protocol. - The -K option to the tls binaries has changed semantics: it now enforces a timeout for the handshake instead of dropping the connection after some inactivity. Note that this option is only useful with the bearssl backend: the libtls backend always performs a synchronous handshake, with no way of interrupting it after a timeout expires. - The execline dependency is now optional. Disabling execline, however, changes the behaviour of s6-tcpserver-access (which cannot support exec files without it). https://skarnet.org/software/s6-networking/ git://git.skarnet.org/s6-networking It is now possible to build the s6-networking package against OpenSSL instead of LibreSSL, thanks to the libretls project: https://git.causal.agency/libretls/about/ * mdevd-0.1.3.0 ------------- - New -C option to the mdevd program. This option makes mdevd automatically spawn a mdevd-coldplug program when it's ready, allowing mdevd to be used as a drop-in mdev -d replacement. (Note that the coldplug is also performed if mdevd restarts after being killed, so this feature should not be used in place of a proper service startup sequence with a mdevd-coldplug oneshot depending on the mdevd longrun. It has only been added for convenience.) https://skarnet.org/software/mdevd/ git://git.skarnet.org/mdevd * Other packages -------------- The following packages have received an update so they build with the latest version of skalibs and other dependencies, but nothing has changed except possibly some bugfixes, and hopefully not too many bug additions. - s6-rc-0.5.2.1. (It is not necessary to recompile your service database. However, it is necessary to upgrade s6-rc along with s6, and to reboot the system ASAP after upgrading.) - s6-portable-utils-2.2.3.1 - s6-linux-utils-2.5.1.4 - bcnm-0.0.1.2 Enjoy, Bug-reports welcome. -- Laurent ----- execline compat interface ----- /* Compatibility */ #define pathexec_run(file, argv, envp) exec_ae(file, argv, envp) #define pathexec0_run(file, argv, envp) exec0_ae(file, argv, envp) #define xpathexec_run(file, argv, envp) xexec_ae(file, argv, envp) #define xpathexec0_run(file, argv, envp) xexec0_ae(file, argv, envp) #define pathexec_env(key, value) env_mexec(key, value) #define pathexec_fromenv(argv, envp, envlen) mexec_f(argv, envp, envlen) #define pathexec(argv) mexec(argv) #define pathexec0(argv) mexec0(argv) #define xpathexec_fromenv(argv, envp, envlen) xmexec_f(argv, envp, envlen) #define xpathexec(argv) xmexec(argv) #define xpathexec0(argv) xmexec0(argv) #define pathexec_r_name(file, argv, envp, envlen, modif, modiflen) mexec_afm(file, argv, envp, envlen, modif, modiflen) #define pathexec_r(argv, envp, envlen, modif, modiflen) mexec_fm(argv, envp, envlen, modif, modiflen) #define xpathexec_r_name(file, argv, envp, envlen, modif, modiflen) xmexec_afm(file, argv, envp, envlen, modif, modiflen) #define xpathexec_r(argv, envp, envlen, modif, modiflen) xmexec_fm(argv, envp, envlen, modif, modiflen) #endif copied from https://github.com/skarnet/skalibs/commit/18e43565574b700befc832ed4d25d25e40951f68#diff-69efbe5d997280a1430a6af2fa38e3f5105e706076a26fc751885c505ca598c6R140
2021-01-21 18:54:13 +00:00
if (keep) xexec(argv) ;
else xmexec_m(argv, VAR, sizeof(VAR)) ;
2019-02-03 15:50:04 +00:00
}
}