diff options
| author | Laurent Bercot <ska-skaware@skarnet.org> | 2026-03-18 01:57:01 +0000 |
|---|---|---|
| committer | Laurent Bercot <ska-skaware@skarnet.org> | 2026-03-18 01:57:01 +0000 |
| commit | 24637cd3776cda5fd0a919ba9343ba86d82d3e04 (patch) | |
| tree | dac9d66860d763fedc999ace6e1a5f37d3add229 | |
| parent | 4cdcab0506e76666800d2bc111c602bb3154cc30 (diff) | |
| download | s6-24637cd3776cda5fd0a919ba9343ba86d82d3e04.tar.gz | |
More fixes, ftrigr_string addition, doc update
| -rw-r--r-- | INSTALL | 2 | ||||
| -rw-r--r-- | NEWS | 13 | ||||
| -rw-r--r-- | doc/index.html | 6 | ||||
| -rw-r--r-- | doc/libs6/ftrigr.html | 132 | ||||
| -rw-r--r-- | doc/libs6/s6-ftrigrd.html | 37 | ||||
| -rw-r--r-- | doc/s6-setsid.html | 3 | ||||
| -rw-r--r-- | doc/upgrade.html | 17 | ||||
| -rw-r--r-- | package/deps.mak | 9 | ||||
| -rw-r--r-- | src/include/s6/ftrigr.h | 13 | ||||
| -rw-r--r-- | src/libs6/deps-lib/s6 | 1 | ||||
| -rw-r--r-- | src/libs6/ftrigr_peek.c | 7 | ||||
| -rw-r--r-- | src/libs6/ftrigr_peek1.c | 14 | ||||
| -rw-r--r-- | src/libs6/ftrigr_wait_and.c | 4 | ||||
| -rw-r--r-- | src/libs6/ftrigr_wait_or.c | 5 | ||||
| -rw-r--r-- | src/pipe-tools/s6-ftrig-listen.c | 4 | ||||
| -rw-r--r-- | src/pipe-tools/s6-ftrig-listen1.c | 6 | ||||
| -rw-r--r-- | src/pipe-tools/s6-ftrig-wait.c | 6 | ||||
| -rw-r--r-- | src/supervision/s6-notifyoncheck.c | 6 | ||||
| -rw-r--r-- | src/supervision/s6_svlisten_loop.c | 13 |
19 files changed, 151 insertions, 147 deletions
@@ -6,7 +6,7 @@ Build Instructions - A POSIX-compliant C development environment - GNU make version 3.81 or later - - skalibs version 2.14.5.1 or later: https://skarnet.org/software/skalibs/ + - skalibs version 2.14.6.0 or later: https://skarnet.org/software/skalibs/ - Recommended: execline version 2.9.8.1 or later: https://skarnet.org/software/execline/ (You can disable this requirement at configure time, but will lose some functionality.) @@ -1,5 +1,18 @@ Changelog for s6. +In 2.15.0.0 +----------- + + - Bugfixes. + - s6-svscan's scandir argument is now mandatory. + - s6-setsid now autodetects its controlling terminal by default. + - Complete ftrigr refactor. This doesn't impact CLI programs, +except the next point. + - s6-ftrig-wait and s6-ftrig-listen1 now print the whole +sequence of events (followed by a newline) to stdout, rather than +just the triggering event. + + In 2.14.0.1 ----------- diff --git a/doc/index.html b/doc/index.html index 1baa6ab..925661e 100644 --- a/doc/index.html +++ b/doc/index.html @@ -83,7 +83,7 @@ with s6</a> </li> <li> A POSIX-compliant system with a standard C development environment </li> <li> GNU make, version 3.81 or later </li> <li> <a href="//skarnet.org/software/skalibs/">skalibs</a> version -2.14.5.1 or later. It's a build-time requirement. It's also a run-time +2.14.6.0 or later. It's a build-time requirement. It's also a run-time requirement if you link against the shared version of the skalibs library. </li> <li> (Optional, but really recommended for full functionality): @@ -115,8 +115,8 @@ want nsswitch-like functionality: <h3> Download </h3> <ul> - <li> The current released version of s6 is <a href="s6-2.14.0.1.tar.gz">2.14.0.1</a>. -You can access its checksum <a href="s6-2.14.0.1.tar.gz.sha256">here</a>. </li> + <li> The current released version of s6 is <a href="s6-2.15.0.0.tar.gz">2.15.0.0</a>. +You can access its checksum <a href="s6-2.15.0.0.tar.gz.sha256">here</a>. </li> <li> Alternatively, you can checkout a copy of the <a href="//git.skarnet.org/cgi-bin/cgit.cgi/s6/">s6 git repository</a>: diff --git a/doc/libs6/ftrigr.html b/doc/libs6/ftrigr.html index 052d7bf..a8cf98b 100644 --- a/doc/libs6/ftrigr.html +++ b/doc/libs6/ftrigr.html @@ -43,11 +43,6 @@ and to <em>always</em> use <tt>wait_nohang()</tt> to reap children, simply ignoring pids you don't know. </p> -<p> - If your application has trouble handling unknown -children, consider using an ftrigrd service. (And fix your application!) -</p> - <h3> A programming example </h3> <p> @@ -61,8 +56,8 @@ for instance, illustrate how to use the ftrigr library. </a> <ul> - <li> Synchronous functions take a <tt>tain_t const *</tt> -(<em>deadline</em>) parameter and a <tt>tain_t *</tt> (<em>stamp</em>) + <li> Synchronous functions take a <tt>tain const *</tt> +(<em>deadline</em>) parameter and a <tt>tain *</tt> (<em>stamp</em>) parameter. Those are pointers to tain_t structures containing absolute times; the former represents a deadline (in most cases, this time will be in the future) and the latter must be an accurate enough timestamp. These @@ -100,28 +95,25 @@ control on. </li> <h3> Starting and ending a session </h3> <pre> -ftrigr_t a = FTRIGR_ZERO ; +ftrigr a = FTRIGR_ZERO ; tain_t deadline, stamp ; tain_now(&stamp) ; tain_addsec(&deadline, &stamp, 2) -// char const *path = FTRIGR_IPCPATH ; -// ftrigr_start(&a, path, &deadline, &stamp) ; ftrigr_startf(&a, &deadline, &stamp) ; </pre> <p> -<tt>ftrigr_start</tt> starts a session with an ftrigrd service listening on -<em>path</em>. <br /> <tt>ftrigr_startf</tt> starts a session with an ftrigrd process as a child (which is the simplest usage). <br /> -<tt>a</tt> is an ftrigr_t structure that must be declared in the stack and -initialized to FTRIGR_ZERO. +<tt>a</tt> is an ftrigr structure that can be declared in the stack and +must be initialized to FTRIGR_ZERO. <tt>stamp</tt> must be an accurate enough timestamp. <br /> If the session initialization fails, the function returns 0 and errno is set; else the function returns 1. </p> + <p> If the absolute time <tt>deadline</tt> is reached and the function has not returned yet, it immediately returns 0 with errno set to ETIMEDOUT. @@ -135,8 +127,8 @@ problem with the underlying processes. <p> You can have more than one session open in parallel, by declaring -several distinct <tt>ftrigr_t</tt> structures and calling -<tt>ftrigr_startf</tt> (or <tt>ftrigr_start</tt>) more than once. +several distinct <tt>ftrigr</tt> structures and calling +<tt>ftrigr_startf</tt> more than once. However, this is useless, since one single session can handle virtually as many concurrent fifodirs as your application needs. </p> @@ -156,8 +148,10 @@ ftrigr_end(&a) ; char const *path = "/var/lib/myservice/fifodir" ; char const *re = "a.*b|c*d" ; uint32_t options = 0 ; +uint32_t timeout = 60000 ; +uint32_t id ; -uint16_t id = ftrigr_subscribe (&a, path, re, options, &deadline, &stamp) ; +int r = ftrigr_subscribe(&a, &id, options, timeout, path, re, options, &deadline, &stamp) ; </pre> <p> @@ -165,7 +159,9 @@ uint16_t id = ftrigr_subscribe (&a, path, re, options, &deadline, &s <a href="s6-ftrigrd.html">s6-ftrigrd daemon</a>, related to the open session represented by the <tt>a</tt> structure, to subscribe to the <tt>path</tt> fifodir, and to notify the application when it receives -a series of events that matches the <tt>re</tt> regexp. +a series of events that matches the <tt>re</tt> regexp. </p> + +<p> <tt>options</tt> can be 0 or FTRIGR_REPEAT. If it is 0, the daemon will automatically unsubscribe from <tt>path</tt> once <tt>re</tt> has been matched by a series of events. If it is FTRIGR_REPEAT, it will remain @@ -173,8 +169,16 @@ subscribed until told otherwise. </p> <p> - <tt>ftrigr_subscribe()</tt> returns 0 and sets errno in case of failure, or -a nonzero 16-bit number identifying the subscription in case of success. + If <tt>timeout</tt> is nonzero, it represents a number of milliseconds; +after this delay, the daemon will automatically unsubscribe from +<tt>path</tt> and report an ETIMEDOUT error to the client. It is not +advised to use a nonzero timeout along with the FTRIGR_REPEAT option. +</p> + +<p> + If it fails, <tt>ftrigr_subscribe()</tt> returns 0 and sets errno. If +it succeeds, it returns 1 and stores a number identifying the subscription +into <tt>id</tt>. </p> <p> @@ -188,26 +192,29 @@ and events can be sent without the risk of a race condition. <h3> Synchronously waiting for events </h3> <pre> -uint16_t list[1] ; +uint32_t list[1] = { id } ; unsigned int n = 1 ; -char trigger ; -list[0] = id ; +ftrigr_string fs ; // r = ftrigr_wait_and(&a, list, n, &deadline, &stamp) ; -r = ftrigr_wait_or(&a, list, n, &deadline, &stamp, &trigger) ; +r = ftrigr_wait_or(&a, list, n, &deadline, &stamp, &fs) ; </pre> <p> <tt>ftrigr_wait_and()</tt> waits for <em>all</em> the <tt>n</tt> fifodirs whose ids are listed in <tt>list</tt> to receive an event. It returns -1 -in case of error or timeout, or a non-negative integer in case of success. <br /> +in case of error or timeout, or a non-negative integer in case of success. +</p> + +<p> <tt>ftrigr_wait_or()</tt> waits for <em>one</em> of the <tt>n</tt> fifodirs whose ids are listed in <tt>list</tt> to receive an event. It returns -1 in case of error or timeout; if it succeeds, the return value is the position in <tt>list</tt>, starting at 0, of the identifier that received -an event; and <tt>trigger</tt> is set to the character that triggered that -event, i.e. the last character of a sequence that matched the regular -expression <tt>re</tt> used in the subscription. +an event; and <tt>fs</tt> is the list of events that were received +since the subscription and matched the <tt>re</tt> regular expression. +<tt>fs.s</tt> is a <tt>char *</tt> pointing to the (not null-terminated) +string of events, and <tt>fs.len</tt> is its length. </p> <h3> Asynchronously waiting for events </h3> @@ -218,7 +225,7 @@ of usage examples.) </em> </p> <pre> -int ftrigr_fd (ftrigr_t const *a) +int ftrigr_fd (ftrigr const *a) </pre> <p> @@ -227,30 +234,19 @@ int ftrigr_fd (ftrigr_t const *a) </p> <pre> -int ftrigr_updateb (ftrigr_t *a) +int ftrigr_update (ftrigr *a) </pre> <p> Call this function whenever the fd checks readability: it will update <em>a</em>'s internal structures with information from the -<a href="s6-ftrigrd.html">s6-ftrigrd</a> daemon. It returns -1 if an error -occurs; in case of success, it returns the number of identifiers for -which something happened. -</p> - -<p> - When <tt>ftrigr_updateb</tt> returns, -<tt>genalloc_s(uint16_t, &a->list)</tt> points to an array of -<tt>genalloc_len(uint16_t, &a->list)</tt> 16-bit unsigned -integers. Those integers are ids waiting to be passed to -<tt>ftrigr_check</tt> or <tt>ftrigr_checksa</tt>. -The number of ids already acknowledged is stored in -<tt>a->head</tt>, so the first unacknowledged id is -<tt>genalloc_s(uint16_t, &a->list)[a->head]</tt>. +<a href="s6-ftrigrd.html">s6-ftrigrd</a> daemon. It returns -1 (and sets +errno) if an error occurs, 0 if there were no events, and 1 if events +were received. </p> <pre> -int ftrigr_check (ftrigr_t *a, uint16_t id, char *what) +int ftrigr_peek (ftrigr *a, uint32_t id, ftrigr_string *fs) </pre> <p> @@ -263,49 +259,39 @@ call to <tt>ftrigr_updateb()</tt>. number may have been transmitted from <a href="s6-ftrigrd.html">s6-ftrigrd</a>. </li> <li> If no notification happened yet, returns 0. </li> - <li> If something happened, writes the character that triggered the -latest notification into <em>what</em> and returns the number of -times that an event happened to this identifier since the last -call to <tt>ftrigr_check()</tt>. </li> + <li> If something happened, returns 1, and <tt>fs</tt> contains +the string of events that were received since the subscription or +since the last call to <tt>ftrigr_ack</tt> (see below). +<tt>fs->s</tt> is a pointer to the non-null-terminated string, +and <tt>fs->len</tt> is its length. </li> </ul> <pre> -int ftrigr_checksa (ftrigr_t *a, uint16_t id, stralloc *what) +void ftrigr_ack (ftrigr *a, uint32_t id) </pre> <p> - Checks whether an event happened to <em>id</em>. Use after a -call to <tt>ftrigr_update()</tt>, as an alternative to <tt>ftrigr_check()</tt>. + Resets the stored string of events. The next invocation of +<tt>ftrigr_peek()</tt> will only show new events, if any. </p> -<ul> - <li> If an error occurred, returns -1 and sets errno. The error -number may have been transmitted from -<a href="s6-ftrigrd.html">s6-ftrigrd</a>. </li> - <li> If no notification happened yet, returns 0. </li> - <li> If something happened, appends one character to the end of the <em>what</em> -<a href="//skarnet.org/software/skalibs/libstddjb/stralloc.html">stralloc</a> -for every time a notification was triggered since the last call -to <tt>ftrigr_check()</tt>. Each character is the one that triggered -a notification. The function then returns 1. </li> -</ul> - <pre> -void ftrigr_ack (ftrigr_t *a, size_t n) +int ftrigr_release (ftrigr *a, uint32_t id) </pre> <p> - Acknowledges reading <em>n</em> ids from the id list updated by -<tt>ftrigr_updateb</tt>. + Frees the resources used by subscription <tt>id</tt>. Use this +after getting an event from a subscription done without the +FTRIGR_REPEAT flag and reading its results, if you want to +keep the session open and perform more subscriptions. </p> -<pre> -int ftrigr_update (ftrigr_t *a) -</pre> - <p> - Acknowledges all the pending ids (i.e. clears the stored id list) -then calls <tt>ftrigr_updateb()</tt>. + If subscription <tt>id</tt> was given the FTRIGR_REPEAT flag, +use <tt>ftrigr_unsubscribe()</tt> instead. If you're not going +to perform other subscriptions, <tt>ftrigr_end()</tt> will +free all the resources without you needing to call +<tt>ftrigr_release()</tt> first. </p> </body> diff --git a/doc/libs6/s6-ftrigrd.html b/doc/libs6/s6-ftrigrd.html index 7325c72..672b660 100644 --- a/doc/libs6/s6-ftrigrd.html +++ b/doc/libs6/s6-ftrigrd.html @@ -17,7 +17,7 @@ <a href="//skarnet.org/">skarnet.org</a> </p> -<h1> The s6-ftrigrd program </h1> +<h1> The s6-ftrigrd internal program </h1> <p> s6-ftrigrd is a helper program that manages a set of subscriptions to fifodirs as well @@ -29,24 +29,17 @@ events happen. <h2> Interface </h2> <p> - s6-ftrigrd is not meant to be called directly. -</p> - -<ul> - <li> If the client program uses <tt>ftrigr_startf()</tt>, it spawns an instance of + s6-ftrigrd is not meant to be called directly. When the client calls +<tt>ftrigr_start()</tt> or <tt>ftrigr_startf</tt>, it spawns an instance of s6-ftrigrd as a child. s6-ftrigrd's stdin is a pipe reading from the client; its stdout is a pipe writing to the client; its stderr is the same as the client's; and there's an additional pipe from s6-ftrigrd to the client, used for asynchronous -notifications. </li> - <li> If the client program uses <tt>ftrigr_start()</tt>, then it tries to connect -to a Unix domain socket. An ftrigrd <a href="../localservice.html">local service</a> should be listening to that -socket, i.e. a Unix domain super-server such as -<a href="s6-ipcserver.html">s6-ipcserver</a> -spawning an s6-ftrigrd program on every connection. Then an s6-ftrigrd instance is created -for the client. </li> - <li> When the client uses <tt>ftrigr_end()</tt>, or closes s6-ftrigrd's stdin in -any way, s6-ftrigrd exits 0. </li> -</ul> +notifications. +</p> + +<p> When the client uses <tt>ftrigr_end()</tt>, or closes s6-ftrigrd's stdin in +any way, s6-ftrigrd exits 0. +</p> <p> s6-ftrigrd handles the grunt work of creating fifos in a @@ -60,7 +53,7 @@ the client. <p> The connection management between the client and s6-ftrigrd is entirely done -by the <em>textclient</em> library from skalibs. +by the <em>sassclient</em> library from skalibs. </p> <p> @@ -71,9 +64,13 @@ to read them. To avoid uncontrolled growth, make sure your client calls </p> <p> - An s6-ftrigrd instance can only handle up to FTRIGRD_MAX (defined in <tt>s6/ftrigr.h</tt>) -subscriptions at once. By default, this number is 1000, which is more than enough for -any reasonable system. + The number of concurrent subscriptions that an s6-ftrigrd instance can handle is +only limited by RAM and open file descriptors. It is likely that the latter is the +bottleneck: s6-ftrigrd uses two file descriptors per fifodir. With a default +limit of 1024 open file descriptors per process, it means that s6-ftrigrd can +handle around 500 concurrent fifodirs, which is reasonable for most systems, but +make sure to increase the open files resource limit before starting an ftrigr +session if you need more. </p> </body> diff --git a/doc/s6-setsid.html b/doc/s6-setsid.html index 2a9e3d3..af10a57 100644 --- a/doc/s6-setsid.html +++ b/doc/s6-setsid.html @@ -69,7 +69,8 @@ message; it will exec into <em>prog</em> even if it cannot perform the operations. </li> <li> <tt>-d <em>ctty</em></tt> : assume file descriptor number <em>ctty</em> is -the controlling terminal for the current session. Default is 0. +the controlling terminal for the current session. (By default, the +value is obtained from <tt>/dev/tty</tt>.) This is only useful when used with the <tt>-f</tt> or <tt>-g</tt> options. </li> </ul> diff --git a/doc/upgrade.html b/doc/upgrade.html index ce8d682..8ae86f5 100644 --- a/doc/upgrade.html +++ b/doc/upgrade.html @@ -18,6 +18,23 @@ <h1> What has changed in s6 </h1> +<h2> in 2.15.0.0 </h2> + +<ul> + <li> <a href="//skarnet.org/software/skalibs/">skalibs</a> +dependency bumped to 2.14.6.0 </li> + <li> Large changes around the <a href="libs6/ftrigr.html">ftrigr library</a>: + <ul> + <li> <a href="s6-ftrigrd.html">s6-ftrigrd</a> is now an +internal program </li> + <li> Local ftrigrd services are not supported anymore, +s6-ftrigrd now always runs as a child of the client </li> + <li> The API of the <a href="libs6/ftrigr.html">ftrigr library</a> +is somewhat different. </li>. + </ul> </li> +</ul> + + <h2> in 2.14.0.1 </h2> <ul> diff --git a/package/deps.mak b/package/deps.mak index b70c0aa..b6bae62 100644 --- a/package/deps.mak +++ b/package/deps.mak @@ -52,7 +52,6 @@ src/instance/s6-instance-status.o src/instance/s6-instance-status.lo: src/instan src/libs6/ftrigr_ack.o src/libs6/ftrigr_ack.lo: src/libs6/ftrigr_ack.c src/libs6/ftrigr-internal.h src/include/s6/ftrigr.h src/libs6/ftrigr_end.o src/libs6/ftrigr_end.lo: src/libs6/ftrigr_end.c src/libs6/ftrigr-internal.h src/include/s6/ftrigr.h src/libs6/ftrigr_peek.o src/libs6/ftrigr_peek.lo: src/libs6/ftrigr_peek.c src/libs6/ftrigr-internal.h src/include/s6/ftrigr.h -src/libs6/ftrigr_peek1.o src/libs6/ftrigr_peek1.lo: src/libs6/ftrigr_peek1.c src/include/s6/ftrigr.h src/libs6/ftrigr_release.o src/libs6/ftrigr_release.lo: src/libs6/ftrigr_release.c src/libs6/ftrigr-internal.h src/include/s6/ftrigr.h src/libs6/ftrigr_start.o src/libs6/ftrigr_start.lo: src/libs6/ftrigr_start.c src/include/s6/ftrigr.h src/libs6/ftrigr_startf.o src/libs6/ftrigr_startf.lo: src/libs6/ftrigr_startf.c src/libs6/ftrigr-internal.h src/include/s6/config.h src/include/s6/ftrigr.h @@ -229,15 +228,15 @@ s6-instance-maker: src/instance/s6-instance-maker.o libs6auto.a.xyzzy -lskarnet s6-instance-status: EXTRA_LIBS := s6-instance-status: src/instance/s6-instance-status.o -lskarnet ifeq ($(strip $(STATIC_LIBS_ARE_PIC)),) -libs6.a.xyzzy: src/libs6/ftrigr_ack.o src/libs6/ftrigr_end.o src/libs6/ftrigr_peek.o src/libs6/ftrigr_peek1.o src/libs6/ftrigr_release.o src/libs6/ftrigr_start.o src/libs6/ftrigr_startf.o src/libs6/ftrigr_subscribe.o src/libs6/ftrigr_unsubscribe.o src/libs6/ftrigr_update.o src/libs6/ftrigr_wait_and.o src/libs6/ftrigr_wait_or.o src/libs6/ftrigw_clean.o src/libs6/ftrigw_fifodir_make.o src/libs6/ftrigw_notify.o src/libs6/ftrigw_notifyb.o src/libs6/ftrigw_notifyb_nosig.o src/libs6/s6_accessrules_backend_cdb.o src/libs6/s6_accessrules_backend_fs.o src/libs6/s6_accessrules_keycheck_ip4.o src/libs6/s6_accessrules_keycheck_ip6.o src/libs6/s6_accessrules_keycheck_reversedns.o src/libs6/s6_accessrules_keycheck_uidgid.o src/libs6/s6_accessrules_params_free.o src/libs6/s6_accessrules_uidgid_cdb.o src/libs6/s6_accessrules_uidgid_fs.o src/libs6/s6_compat_el_semicolon.o src/libs6/s6_dtally_pack.o src/libs6/s6_dtally_unpack.o src/libs6/s6_dtally_read.o src/libs6/s6_dtally_write.o src/libs6/s6_instance_chdirservice.o src/libs6/s6_servicedir_file_list.o src/libs6/s6_servicedir_instances_recreate_offline.o src/libs6/s6_servicedir_instances_recreate_offline_tmp.o src/libs6/s6_svc_ok.o src/libs6/s6_svc_write.o src/libs6/s6_svc_writectl.o src/libs6/s6_svstatus_pack.o src/libs6/s6_svstatus_read.o src/libs6/s6_svstatus_unpack.o src/libs6/s6_svstatus_write.o src/libs6/s6_fdholder_delete.o src/libs6/s6_fdholder_delete_async.o src/libs6/s6_fdholder_end.o src/libs6/s6_fdholder_getdump.o src/libs6/s6_fdholder_list.o src/libs6/s6_fdholder_list_async.o src/libs6/s6_fdholder_list_cb.o src/libs6/s6_fdholder_retrieve.o src/libs6/s6_fdholder_retrieve_async.o src/libs6/s6_fdholder_retrieve_cb.o src/libs6/s6_fdholder_setdump.o src/libs6/s6_fdholder_start.o src/libs6/s6_fdholder_store.o src/libs6/s6_fdholder_store_async.o src/libs6/s6_supervise_link.o src/libs6/s6_supervise_link_names.o src/libs6/s6_supervise_unlink.o src/libs6/s6_supervise_unlink_names.o +libs6.a.xyzzy: src/libs6/ftrigr_ack.o src/libs6/ftrigr_end.o src/libs6/ftrigr_peek.o src/libs6/ftrigr_release.o src/libs6/ftrigr_start.o src/libs6/ftrigr_startf.o src/libs6/ftrigr_subscribe.o src/libs6/ftrigr_unsubscribe.o src/libs6/ftrigr_update.o src/libs6/ftrigr_wait_and.o src/libs6/ftrigr_wait_or.o src/libs6/ftrigw_clean.o src/libs6/ftrigw_fifodir_make.o src/libs6/ftrigw_notify.o src/libs6/ftrigw_notifyb.o src/libs6/ftrigw_notifyb_nosig.o src/libs6/s6_accessrules_backend_cdb.o src/libs6/s6_accessrules_backend_fs.o src/libs6/s6_accessrules_keycheck_ip4.o src/libs6/s6_accessrules_keycheck_ip6.o src/libs6/s6_accessrules_keycheck_reversedns.o src/libs6/s6_accessrules_keycheck_uidgid.o src/libs6/s6_accessrules_params_free.o src/libs6/s6_accessrules_uidgid_cdb.o src/libs6/s6_accessrules_uidgid_fs.o src/libs6/s6_compat_el_semicolon.o src/libs6/s6_dtally_pack.o src/libs6/s6_dtally_unpack.o src/libs6/s6_dtally_read.o src/libs6/s6_dtally_write.o src/libs6/s6_instance_chdirservice.o src/libs6/s6_servicedir_file_list.o src/libs6/s6_servicedir_instances_recreate_offline.o src/libs6/s6_servicedir_instances_recreate_offline_tmp.o src/libs6/s6_svc_ok.o src/libs6/s6_svc_write.o src/libs6/s6_svc_writectl.o src/libs6/s6_svstatus_pack.o src/libs6/s6_svstatus_read.o src/libs6/s6_svstatus_unpack.o src/libs6/s6_svstatus_write.o src/libs6/s6_fdholder_delete.o src/libs6/s6_fdholder_delete_async.o src/libs6/s6_fdholder_end.o src/libs6/s6_fdholder_getdump.o src/libs6/s6_fdholder_list.o src/libs6/s6_fdholder_list_async.o src/libs6/s6_fdholder_list_cb.o src/libs6/s6_fdholder_retrieve.o src/libs6/s6_fdholder_retrieve_async.o src/libs6/s6_fdholder_retrieve_cb.o src/libs6/s6_fdholder_setdump.o src/libs6/s6_fdholder_start.o src/libs6/s6_fdholder_store.o src/libs6/s6_fdholder_store_async.o src/libs6/s6_supervise_link.o src/libs6/s6_supervise_link_names.o src/libs6/s6_supervise_unlink.o src/libs6/s6_supervise_unlink_names.o else -libs6.a.xyzzy:src/libs6/ftrigr_ack.lo src/libs6/ftrigr_end.lo src/libs6/ftrigr_peek.lo src/libs6/ftrigr_peek1.lo src/libs6/ftrigr_release.lo src/libs6/ftrigr_start.lo src/libs6/ftrigr_startf.lo src/libs6/ftrigr_subscribe.lo src/libs6/ftrigr_unsubscribe.lo src/libs6/ftrigr_update.lo src/libs6/ftrigr_wait_and.lo src/libs6/ftrigr_wait_or.lo src/libs6/ftrigw_clean.lo src/libs6/ftrigw_fifodir_make.lo src/libs6/ftrigw_notify.lo src/libs6/ftrigw_notifyb.lo src/libs6/ftrigw_notifyb_nosig.lo src/libs6/s6_accessrules_backend_cdb.lo src/libs6/s6_accessrules_backend_fs.lo src/libs6/s6_accessrules_keycheck_ip4.lo src/libs6/s6_accessrules_keycheck_ip6.lo src/libs6/s6_accessrules_keycheck_reversedns.lo src/libs6/s6_accessrules_keycheck_uidgid.lo src/libs6/s6_accessrules_params_free.lo src/libs6/s6_accessrules_uidgid_cdb.lo src/libs6/s6_accessrules_uidgid_fs.lo src/libs6/s6_compat_el_semicolon.lo src/libs6/s6_dtally_pack.lo src/libs6/s6_dtally_unpack.lo src/libs6/s6_dtally_read.lo src/libs6/s6_dtally_write.lo src/libs6/s6_instance_chdirservice.lo src/libs6/s6_servicedir_file_list.lo src/libs6/s6_servicedir_instances_recreate_offline.lo src/libs6/s6_servicedir_instances_recreate_offline_tmp.lo src/libs6/s6_svc_ok.lo src/libs6/s6_svc_write.lo src/libs6/s6_svc_writectl.lo src/libs6/s6_svstatus_pack.lo src/libs6/s6_svstatus_read.lo src/libs6/s6_svstatus_unpack.lo src/libs6/s6_svstatus_write.lo src/libs6/s6_fdholder_delete.lo src/libs6/s6_fdholder_delete_async.lo src/libs6/s6_fdholder_end.lo src/libs6/s6_fdholder_getdump.lo src/libs6/s6_fdholder_list.lo src/libs6/s6_fdholder_list_async.lo src/libs6/s6_fdholder_list_cb.lo src/libs6/s6_fdholder_retrieve.lo src/libs6/s6_fdholder_retrieve_async.lo src/libs6/s6_fdholder_retrieve_cb.lo src/libs6/s6_fdholder_setdump.lo src/libs6/s6_fdholder_start.lo src/libs6/s6_fdholder_store.lo src/libs6/s6_fdholder_store_async.lo src/libs6/s6_supervise_link.lo src/libs6/s6_supervise_link_names.lo src/libs6/s6_supervise_unlink.lo src/libs6/s6_supervise_unlink_names.lo +libs6.a.xyzzy:src/libs6/ftrigr_ack.lo src/libs6/ftrigr_end.lo src/libs6/ftrigr_peek.lo src/libs6/ftrigr_release.lo src/libs6/ftrigr_start.lo src/libs6/ftrigr_startf.lo src/libs6/ftrigr_subscribe.lo src/libs6/ftrigr_unsubscribe.lo src/libs6/ftrigr_update.lo src/libs6/ftrigr_wait_and.lo src/libs6/ftrigr_wait_or.lo src/libs6/ftrigw_clean.lo src/libs6/ftrigw_fifodir_make.lo src/libs6/ftrigw_notify.lo src/libs6/ftrigw_notifyb.lo src/libs6/ftrigw_notifyb_nosig.lo src/libs6/s6_accessrules_backend_cdb.lo src/libs6/s6_accessrules_backend_fs.lo src/libs6/s6_accessrules_keycheck_ip4.lo src/libs6/s6_accessrules_keycheck_ip6.lo src/libs6/s6_accessrules_keycheck_reversedns.lo src/libs6/s6_accessrules_keycheck_uidgid.lo src/libs6/s6_accessrules_params_free.lo src/libs6/s6_accessrules_uidgid_cdb.lo src/libs6/s6_accessrules_uidgid_fs.lo src/libs6/s6_compat_el_semicolon.lo src/libs6/s6_dtally_pack.lo src/libs6/s6_dtally_unpack.lo src/libs6/s6_dtally_read.lo src/libs6/s6_dtally_write.lo src/libs6/s6_instance_chdirservice.lo src/libs6/s6_servicedir_file_list.lo src/libs6/s6_servicedir_instances_recreate_offline.lo src/libs6/s6_servicedir_instances_recreate_offline_tmp.lo src/libs6/s6_svc_ok.lo src/libs6/s6_svc_write.lo src/libs6/s6_svc_writectl.lo src/libs6/s6_svstatus_pack.lo src/libs6/s6_svstatus_read.lo src/libs6/s6_svstatus_unpack.lo src/libs6/s6_svstatus_write.lo src/libs6/s6_fdholder_delete.lo src/libs6/s6_fdholder_delete_async.lo src/libs6/s6_fdholder_end.lo src/libs6/s6_fdholder_getdump.lo src/libs6/s6_fdholder_list.lo src/libs6/s6_fdholder_list_async.lo src/libs6/s6_fdholder_list_cb.lo src/libs6/s6_fdholder_retrieve.lo src/libs6/s6_fdholder_retrieve_async.lo src/libs6/s6_fdholder_retrieve_cb.lo src/libs6/s6_fdholder_setdump.lo src/libs6/s6_fdholder_start.lo src/libs6/s6_fdholder_store.lo src/libs6/s6_fdholder_store_async.lo src/libs6/s6_supervise_link.lo src/libs6/s6_supervise_link_names.lo src/libs6/s6_supervise_unlink.lo src/libs6/s6_supervise_unlink_names.lo endif libs6.pc: EXTRA_LIBS := -lskarnet libs6.so.xyzzy: EXTRA_LIBS := -lskarnet -libs6.so.xyzzy:src/libs6/ftrigr_ack.lo src/libs6/ftrigr_end.lo src/libs6/ftrigr_peek.lo src/libs6/ftrigr_peek1.lo src/libs6/ftrigr_release.lo src/libs6/ftrigr_start.lo src/libs6/ftrigr_startf.lo src/libs6/ftrigr_subscribe.lo src/libs6/ftrigr_unsubscribe.lo src/libs6/ftrigr_update.lo src/libs6/ftrigr_wait_and.lo src/libs6/ftrigr_wait_or.lo src/libs6/ftrigw_clean.lo src/libs6/ftrigw_fifodir_make.lo src/libs6/ftrigw_notify.lo src/libs6/ftrigw_notifyb.lo src/libs6/ftrigw_notifyb_nosig.lo src/libs6/s6_accessrules_backend_cdb.lo src/libs6/s6_accessrules_backend_fs.lo src/libs6/s6_accessrules_keycheck_ip4.lo src/libs6/s6_accessrules_keycheck_ip6.lo src/libs6/s6_accessrules_keycheck_reversedns.lo src/libs6/s6_accessrules_keycheck_uidgid.lo src/libs6/s6_accessrules_params_free.lo src/libs6/s6_accessrules_uidgid_cdb.lo src/libs6/s6_accessrules_uidgid_fs.lo src/libs6/s6_compat_el_semicolon.lo src/libs6/s6_dtally_pack.lo src/libs6/s6_dtally_unpack.lo src/libs6/s6_dtally_read.lo src/libs6/s6_dtally_write.lo src/libs6/s6_instance_chdirservice.lo src/libs6/s6_servicedir_file_list.lo src/libs6/s6_servicedir_instances_recreate_offline.lo src/libs6/s6_servicedir_instances_recreate_offline_tmp.lo src/libs6/s6_svc_ok.lo src/libs6/s6_svc_write.lo src/libs6/s6_svc_writectl.lo src/libs6/s6_svstatus_pack.lo src/libs6/s6_svstatus_read.lo src/libs6/s6_svstatus_unpack.lo src/libs6/s6_svstatus_write.lo src/libs6/s6_fdholder_delete.lo src/libs6/s6_fdholder_delete_async.lo src/libs6/s6_fdholder_end.lo src/libs6/s6_fdholder_getdump.lo src/libs6/s6_fdholder_list.lo src/libs6/s6_fdholder_list_async.lo src/libs6/s6_fdholder_list_cb.lo src/libs6/s6_fdholder_retrieve.lo src/libs6/s6_fdholder_retrieve_async.lo src/libs6/s6_fdholder_retrieve_cb.lo src/libs6/s6_fdholder_setdump.lo src/libs6/s6_fdholder_start.lo src/libs6/s6_fdholder_store.lo src/libs6/s6_fdholder_store_async.lo src/libs6/s6_supervise_link.lo src/libs6/s6_supervise_link_names.lo src/libs6/s6_supervise_unlink.lo src/libs6/s6_supervise_unlink_names.lo +libs6.so.xyzzy:src/libs6/ftrigr_ack.lo src/libs6/ftrigr_end.lo src/libs6/ftrigr_peek.lo src/libs6/ftrigr_release.lo src/libs6/ftrigr_start.lo src/libs6/ftrigr_startf.lo src/libs6/ftrigr_subscribe.lo src/libs6/ftrigr_unsubscribe.lo src/libs6/ftrigr_update.lo src/libs6/ftrigr_wait_and.lo src/libs6/ftrigr_wait_or.lo src/libs6/ftrigw_clean.lo src/libs6/ftrigw_fifodir_make.lo src/libs6/ftrigw_notify.lo src/libs6/ftrigw_notifyb.lo src/libs6/ftrigw_notifyb_nosig.lo src/libs6/s6_accessrules_backend_cdb.lo src/libs6/s6_accessrules_backend_fs.lo src/libs6/s6_accessrules_keycheck_ip4.lo src/libs6/s6_accessrules_keycheck_ip6.lo src/libs6/s6_accessrules_keycheck_reversedns.lo src/libs6/s6_accessrules_keycheck_uidgid.lo src/libs6/s6_accessrules_params_free.lo src/libs6/s6_accessrules_uidgid_cdb.lo src/libs6/s6_accessrules_uidgid_fs.lo src/libs6/s6_compat_el_semicolon.lo src/libs6/s6_dtally_pack.lo src/libs6/s6_dtally_unpack.lo src/libs6/s6_dtally_read.lo src/libs6/s6_dtally_write.lo src/libs6/s6_instance_chdirservice.lo src/libs6/s6_servicedir_file_list.lo src/libs6/s6_servicedir_instances_recreate_offline.lo src/libs6/s6_servicedir_instances_recreate_offline_tmp.lo src/libs6/s6_svc_ok.lo src/libs6/s6_svc_write.lo src/libs6/s6_svc_writectl.lo src/libs6/s6_svstatus_pack.lo src/libs6/s6_svstatus_read.lo src/libs6/s6_svstatus_unpack.lo src/libs6/s6_svstatus_write.lo src/libs6/s6_fdholder_delete.lo src/libs6/s6_fdholder_delete_async.lo src/libs6/s6_fdholder_end.lo src/libs6/s6_fdholder_getdump.lo src/libs6/s6_fdholder_list.lo src/libs6/s6_fdholder_list_async.lo src/libs6/s6_fdholder_list_cb.lo src/libs6/s6_fdholder_retrieve.lo src/libs6/s6_fdholder_retrieve_async.lo src/libs6/s6_fdholder_retrieve_cb.lo src/libs6/s6_fdholder_setdump.lo src/libs6/s6_fdholder_start.lo src/libs6/s6_fdholder_store.lo src/libs6/s6_fdholder_store_async.lo src/libs6/s6_supervise_link.lo src/libs6/s6_supervise_link_names.lo src/libs6/s6_supervise_unlink.lo src/libs6/s6_supervise_unlink_names.lo libs6.dylib.xyzzy: EXTRA_LIBS := -lskarnet -libs6.dylib.xyzzy:src/libs6/ftrigr_ack.lo src/libs6/ftrigr_end.lo src/libs6/ftrigr_peek.lo src/libs6/ftrigr_peek1.lo src/libs6/ftrigr_release.lo src/libs6/ftrigr_start.lo src/libs6/ftrigr_startf.lo src/libs6/ftrigr_subscribe.lo src/libs6/ftrigr_unsubscribe.lo src/libs6/ftrigr_update.lo src/libs6/ftrigr_wait_and.lo src/libs6/ftrigr_wait_or.lo src/libs6/ftrigw_clean.lo src/libs6/ftrigw_fifodir_make.lo src/libs6/ftrigw_notify.lo src/libs6/ftrigw_notifyb.lo src/libs6/ftrigw_notifyb_nosig.lo src/libs6/s6_accessrules_backend_cdb.lo src/libs6/s6_accessrules_backend_fs.lo src/libs6/s6_accessrules_keycheck_ip4.lo src/libs6/s6_accessrules_keycheck_ip6.lo src/libs6/s6_accessrules_keycheck_reversedns.lo src/libs6/s6_accessrules_keycheck_uidgid.lo src/libs6/s6_accessrules_params_free.lo src/libs6/s6_accessrules_uidgid_cdb.lo src/libs6/s6_accessrules_uidgid_fs.lo src/libs6/s6_compat_el_semicolon.lo src/libs6/s6_dtally_pack.lo src/libs6/s6_dtally_unpack.lo src/libs6/s6_dtally_read.lo src/libs6/s6_dtally_write.lo src/libs6/s6_instance_chdirservice.lo src/libs6/s6_servicedir_file_list.lo src/libs6/s6_servicedir_instances_recreate_offline.lo src/libs6/s6_servicedir_instances_recreate_offline_tmp.lo src/libs6/s6_svc_ok.lo src/libs6/s6_svc_write.lo src/libs6/s6_svc_writectl.lo src/libs6/s6_svstatus_pack.lo src/libs6/s6_svstatus_read.lo src/libs6/s6_svstatus_unpack.lo src/libs6/s6_svstatus_write.lo src/libs6/s6_fdholder_delete.lo src/libs6/s6_fdholder_delete_async.lo src/libs6/s6_fdholder_end.lo src/libs6/s6_fdholder_getdump.lo src/libs6/s6_fdholder_list.lo src/libs6/s6_fdholder_list_async.lo src/libs6/s6_fdholder_list_cb.lo src/libs6/s6_fdholder_retrieve.lo src/libs6/s6_fdholder_retrieve_async.lo src/libs6/s6_fdholder_retrieve_cb.lo src/libs6/s6_fdholder_setdump.lo src/libs6/s6_fdholder_start.lo src/libs6/s6_fdholder_store.lo src/libs6/s6_fdholder_store_async.lo src/libs6/s6_supervise_link.lo src/libs6/s6_supervise_link_names.lo src/libs6/s6_supervise_unlink.lo src/libs6/s6_supervise_unlink_names.lo +libs6.dylib.xyzzy:src/libs6/ftrigr_ack.lo src/libs6/ftrigr_end.lo src/libs6/ftrigr_peek.lo src/libs6/ftrigr_release.lo src/libs6/ftrigr_start.lo src/libs6/ftrigr_startf.lo src/libs6/ftrigr_subscribe.lo src/libs6/ftrigr_unsubscribe.lo src/libs6/ftrigr_update.lo src/libs6/ftrigr_wait_and.lo src/libs6/ftrigr_wait_or.lo src/libs6/ftrigw_clean.lo src/libs6/ftrigw_fifodir_make.lo src/libs6/ftrigw_notify.lo src/libs6/ftrigw_notifyb.lo src/libs6/ftrigw_notifyb_nosig.lo src/libs6/s6_accessrules_backend_cdb.lo src/libs6/s6_accessrules_backend_fs.lo src/libs6/s6_accessrules_keycheck_ip4.lo src/libs6/s6_accessrules_keycheck_ip6.lo src/libs6/s6_accessrules_keycheck_reversedns.lo src/libs6/s6_accessrules_keycheck_uidgid.lo src/libs6/s6_accessrules_params_free.lo src/libs6/s6_accessrules_uidgid_cdb.lo src/libs6/s6_accessrules_uidgid_fs.lo src/libs6/s6_compat_el_semicolon.lo src/libs6/s6_dtally_pack.lo src/libs6/s6_dtally_unpack.lo src/libs6/s6_dtally_read.lo src/libs6/s6_dtally_write.lo src/libs6/s6_instance_chdirservice.lo src/libs6/s6_servicedir_file_list.lo src/libs6/s6_servicedir_instances_recreate_offline.lo src/libs6/s6_servicedir_instances_recreate_offline_tmp.lo src/libs6/s6_svc_ok.lo src/libs6/s6_svc_write.lo src/libs6/s6_svc_writectl.lo src/libs6/s6_svstatus_pack.lo src/libs6/s6_svstatus_read.lo src/libs6/s6_svstatus_unpack.lo src/libs6/s6_svstatus_write.lo src/libs6/s6_fdholder_delete.lo src/libs6/s6_fdholder_delete_async.lo src/libs6/s6_fdholder_end.lo src/libs6/s6_fdholder_getdump.lo src/libs6/s6_fdholder_list.lo src/libs6/s6_fdholder_list_async.lo src/libs6/s6_fdholder_list_cb.lo src/libs6/s6_fdholder_retrieve.lo src/libs6/s6_fdholder_retrieve_async.lo src/libs6/s6_fdholder_retrieve_cb.lo src/libs6/s6_fdholder_setdump.lo src/libs6/s6_fdholder_start.lo src/libs6/s6_fdholder_store.lo src/libs6/s6_fdholder_store_async.lo src/libs6/s6_supervise_link.lo src/libs6/s6_supervise_link_names.lo src/libs6/s6_supervise_unlink.lo src/libs6/s6_supervise_unlink_names.lo ifeq ($(strip $(STATIC_LIBS_ARE_PIC)),) libs6auto.a.xyzzy: src/libs6/s6_auto_write_logger.o src/libs6/s6_auto_write_logger_tmp.o src/libs6/s6_auto_write_logrun.o src/libs6/s6_auto_write_logrun_tmp.o src/libs6/s6_auto_write_service.o else diff --git a/src/include/s6/ftrigr.h b/src/include/s6/ftrigr.h index 30a7ca6..2e0f340 100644 --- a/src/include/s6/ftrigr.h +++ b/src/include/s6/ftrigr.h @@ -3,7 +3,6 @@ #ifndef S6_FTRIGR_H #define S6_FTRIGR_H -#include <sys/uio.h> #include <stdint.h> #include <skalibs/tai.h> @@ -21,6 +20,13 @@ struct ftrigr_s } ; #define FTRIGR_ZERO { .client = SASSCLIENT_ZERO, .data = GENALLOC_ZERO } +typedef struct ftrigr_string_s ftrigr_string, *ftrigr_string_ref ; +struct ftrigr_string_s +{ + char *s ; + uint32_t len ; +} ; + extern int ftrigr_startf (ftrigr *, tain const *, tain *) ; #define ftrigr_startf_g(a, deadline) ftrigr_startf(a, (deadline), &STAMP) extern int ftrigr_start (ftrigr *, unsigned int) ; @@ -28,8 +34,7 @@ extern void ftrigr_end (ftrigr *) ; #define ftrigr_fd(a) sassclient_fd(&(a)->client) extern int ftrigr_update (ftrigr *) ; -extern int ftrigr_peek (ftrigr *, uint32_t, struct iovec *) ; -extern int ftrigr_peek1 (ftrigr *, uint32_t, char *) ; +extern int ftrigr_peek (ftrigr *, uint32_t, ftrigr_string *) ; extern int ftrigr_ack (ftrigr *, uint32_t) ; extern void ftrigr_release (ftrigr *, uint32_t) ; @@ -41,7 +46,7 @@ extern int ftrigr_unsubscribe (ftrigr *, uint32_t, tain const *, tain *) ; extern int ftrigr_wait_and (ftrigr *, uint32_t const *, unsigned int, tain const *, tain *) ; #define ftrigr_wait_and_g(a, list, len, deadline) ftrigr_wait_and(a, list, len, (deadline), &STAMP) -extern int ftrigr_wait_or (ftrigr *, uint32_t const *, unsigned int, struct iovec *, tain const *, tain *) ; +extern int ftrigr_wait_or (ftrigr *, uint32_t const *, unsigned int, ftrigr_string *, tain const *, tain *) ; #define ftrigr_wait_or_g(a, list, n, v, deadline) ftrigr_wait_or(a, list, n, v, (deadline), &STAMP) #endif diff --git a/src/libs6/deps-lib/s6 b/src/libs6/deps-lib/s6 index 74a30a7..6590d83 100644 --- a/src/libs6/deps-lib/s6 +++ b/src/libs6/deps-lib/s6 @@ -1,7 +1,6 @@ ftrigr_ack.o ftrigr_end.o ftrigr_peek.o -ftrigr_peek1.o ftrigr_release.o ftrigr_start.o ftrigr_startf.o diff --git a/src/libs6/ftrigr_peek.c b/src/libs6/ftrigr_peek.c index 155fce3..5107bae 100644 --- a/src/libs6/ftrigr_peek.c +++ b/src/libs6/ftrigr_peek.c @@ -1,6 +1,5 @@ /* ISC license. */ -#include <sys/uio.h> #include <errno.h> #include <skalibs/genalloc.h> @@ -8,7 +7,7 @@ #include <s6/ftrigr.h> #include "ftrigr-internal.h" -int ftrigr_peek (ftrigr *a, uint32_t id, struct iovec *v) +int ftrigr_peek (ftrigr *a, uint32_t id, ftrigr_string *fs) { ftrigr_data *p = genalloc_s(ftrigr_data, &a->data) + id ; switch (p->status) @@ -16,8 +15,8 @@ int ftrigr_peek (ftrigr *a, uint32_t id, struct iovec *v) case EAGAIN : return 0 ; case 0 : { - v->iov_base = p->sa.s ; - v->iov_len = p->sa.len ; + fs->s = p->sa.s ; + fs->len = p->sa.len ; return 1 ; } default: break ; diff --git a/src/libs6/ftrigr_peek1.c b/src/libs6/ftrigr_peek1.c deleted file mode 100644 index 81059f7..0000000 --- a/src/libs6/ftrigr_peek1.c +++ /dev/null @@ -1,14 +0,0 @@ -/* ISC license. */ - -#include <sys/uio.h> - -#include <s6/ftrigr.h> - -int ftrigr_peek1 (ftrigr *a, uint32_t id, char *c) -{ - struct iovec v ; - int r = ftrigr_peek(a, id, &v) ; - if (r <= 0) return r ; - *c = ((char *)v.iov_base)[v.iov_len - 1] ; - return 1 ; -} diff --git a/src/libs6/ftrigr_wait_and.c b/src/libs6/ftrigr_wait_and.c index 24e722f..0619b08 100644 --- a/src/libs6/ftrigr_wait_and.c +++ b/src/libs6/ftrigr_wait_and.c @@ -14,8 +14,8 @@ int ftrigr_wait_and (ftrigr *a, uint32_t const *list, unsigned int n, tain const { for (;;) { - struct iovec v ; - int r = ftrigr_peek(a, list[i], &v) ; + ftrigr_string fs ; + int r = ftrigr_peek(a, list[i], &fs) ; if (r == -1) return -1 ; if (r) break ; r = iopause_stamp(&x, 1, deadline, stamp) ; diff --git a/src/libs6/ftrigr_wait_or.c b/src/libs6/ftrigr_wait_or.c index 0ed41b7..799e2e0 100644 --- a/src/libs6/ftrigr_wait_or.c +++ b/src/libs6/ftrigr_wait_or.c @@ -1,13 +1,12 @@ /* ISC license. */ -#include <sys/uio.h> #include <errno.h> #include <skalibs/iopause.h> #include <s6/ftrigr.h> -int ftrigr_wait_or (ftrigr *a, uint32_t const *list, unsigned int n, struct iovec *v, tain const *deadline, tain *stamp) +int ftrigr_wait_or (ftrigr *a, uint32_t const *list, unsigned int n, ftrigr_string *fs, tain const *deadline, tain *stamp) { iopause_fd x = { .fd = ftrigr_fd(a), .events = IOPAUSE_READ } ; for (;;) @@ -15,7 +14,7 @@ int ftrigr_wait_or (ftrigr *a, uint32_t const *list, unsigned int n, struct iove int r ; for (unsigned int i = 0 ; i < n ; i++) { - r = ftrigr_peek(a, list[i], v) ; + r = ftrigr_peek(a, list[i], fs) ; if (r == -1) return -1 ; if (r) return i ; } diff --git a/src/pipe-tools/s6-ftrig-listen.c b/src/pipe-tools/s6-ftrig-listen.c index 5fa3e33..48f5f6b 100644 --- a/src/pipe-tools/s6-ftrig-listen.c +++ b/src/pipe-tools/s6-ftrig-listen.c @@ -107,8 +107,8 @@ int main (int argc, char const **argv) unsigned int i = 0 ; while (i < n) { - struct iovec v ; - r = ftrigr_peek(&a, ids[i], &v) ; + ftrigr_string fs ; + r = ftrigr_peek(&a, ids[i], &fs) ; if (r == -1) strerr_diefu1sys(111, "ftrigr_check") ; else if (!r) i++ ; else if (wgolb & GOLB_OR) n = 0 ; diff --git a/src/pipe-tools/s6-ftrig-listen1.c b/src/pipe-tools/s6-ftrig-listen1.c index 1a08e6d..9ebd5ca 100644 --- a/src/pipe-tools/s6-ftrig-listen1.c +++ b/src/pipe-tools/s6-ftrig-listen1.c @@ -1,5 +1,6 @@ /* ISC license. */ +#include <sys/uio.h> #include <stdint.h> #include <errno.h> #include <signal.h> @@ -51,7 +52,7 @@ int main (int argc, char const *const *argv) ftrigr a = FTRIGR_ZERO ; pid_t pid ; uint32_t id ; - struct iovec v[2] = { [1] = { .iov_base = "\n", .iov_len = 1 } } ; + ftrigr_string fs ; unsigned int golc ; PROG = "s6-ftrig-listen1" ; @@ -84,7 +85,7 @@ int main (int argc, char const *const *argv) for (;;) { - int r = ftrigr_peek(&a, id, &v[0]) ; + int r = ftrigr_peek(&a, id, &fs) ; if (r == -1) strerr_diefu1sys(111, "ftrigr_peek") ; if (r) break ; r = iopause_g(x, 2, &deadline) ; @@ -99,6 +100,7 @@ int main (int argc, char const *const *argv) if (ftrigr_update(&a) == -1) strerr_diefu1sys(111, "ftrigr_update") ; } + struct iovec v[2] = { { .iov_base = fs.s, .iov_len = fs.len }, { .iov_base = "\n", .iov_len = 1 } } ; if (allwritev(1, v, 2) < 2) strerr_diefu1sys(111, "write to stdout") ; _exit(0) ; } diff --git a/src/pipe-tools/s6-ftrig-wait.c b/src/pipe-tools/s6-ftrig-wait.c index 87b573d..e36fa2d 100644 --- a/src/pipe-tools/s6-ftrig-wait.c +++ b/src/pipe-tools/s6-ftrig-wait.c @@ -32,9 +32,9 @@ int main (int argc, char const *const *argv) tain deadline ; tain tto = TAIN_INFINITE_RELATIVE ; ftrigr a = FTRIGR_ZERO ; + ftrigr_string fs ; uint32_t id ; unsigned int golc ; - struct iovec v[2] = { [1] = { .iov_base = "\n", .iov_len = 1 } } ; PROG = "s6-ftrig-wait" ; golc = gol_main(argc, argv, 0, 0, rgola, GOLA_N, 0, wgola) ; @@ -54,8 +54,10 @@ int main (int argc, char const *const *argv) if (!ftrigr_startf_g(&a, &deadline)) strerr_diefu1sys(111, "ftrigr_startf") ; if (!ftrigr_subscribe_g(&a, &id, 0, 0, argv[0], argv[1], &deadline)) strerr_diefu4sys(111, "subscribe to ", argv[0], " with regexp ", argv[1]) ; - if (ftrigr_wait_or_g(&a, &id, 1, &v[0], &deadline) == -1) + if (ftrigr_wait_or_g(&a, &id, 1, &fs, &deadline) == -1) strerr_diefu2sys((errno == ETIMEDOUT) ? 99 : 111, "match regexp on ", argv[1]) ; + + struct iovec v[2] = { { .iov_base = fs.s, .iov_len = fs.len }, { .iov_base = "\n", .iov_len = 1 } } ; if (allwritev(1, v, 2) < siovec_len(v, 2)) strerr_diefu1sys(111, "write to stdout") ; _exit(0) ; } diff --git a/src/supervision/s6-notifyoncheck.c b/src/supervision/s6-notifyoncheck.c index f86b1e0..ba8e91d 100644 --- a/src/supervision/s6-notifyoncheck.c +++ b/src/supervision/s6-notifyoncheck.c @@ -85,13 +85,13 @@ static inline int handle_signals (pid_t pid, int *w) static int handle_event (ftrigr *a, uint32_t id, pid_t pid) { int r ; - struct iovec v ; + ftrigr_string fs ; if (ftrigr_update(a) == -1) strerr_diefu1sys(111, "ftrigr_update") ; - r = ftrigr_peek(a, id, &v) ; + r = ftrigr_peek(a, id, &fs) ; if (r == -1) strerr_diefu1sys(111, "ftrigr_check") ; if (r) { - if (memchr(v.iov_base, 'd', v.iov_len)) + if (memchr(fs.s, 'd', fs.len)) { if (pid) kill(pid, SIGTERM) ; ftrigr_ack(a, id) ; diff --git a/src/supervision/s6_svlisten_loop.c b/src/supervision/s6_svlisten_loop.c index 4a3e4cf..60e77ad 100644 --- a/src/supervision/s6_svlisten_loop.c +++ b/src/supervision/s6_svlisten_loop.c @@ -70,15 +70,14 @@ unsigned int s6_svlisten_loop (s6_svlisten_t *foo, int wantup, int wantready, in if (ftrigr_update(&foo->a) < 0) strerr_diefu1sys(111, "ftrigr_update") ; for (unsigned int i = 0 ; i < foo->n ; i++) { - struct iovec v ; - r = ftrigr_peek(&foo->a, foo->ids[i], &v) ; + ftrigr_string fs ; + r = ftrigr_peek(&foo->a, foo->ids[i], &fs) ; if (r == -1) strerr_diefu1sys(111, "ftrigr_check") ; else if (r) { - char const *s = v.iov_base ; - for (size_t j = 0 ; j < v.iov_len ; j++) + for (uint32_t j = 0 ; j < fs.len ; j++) { - if (s[j] == 'x') + if (fs.s[j] == 'x') { if (bitarray_peek(foo->upstate, i) != wantup || bitarray_peek(foo->readystate, i) != wantready) @@ -86,7 +85,7 @@ unsigned int s6_svlisten_loop (s6_svlisten_t *foo, int wantup, int wantready, in bitarray_poke(foo->upstate, i, wantup) ; bitarray_poke(foo->readystate, i, wantready) ; } - else if (s[j] == 'O') + else if (fs.s[j] == 'O') { if (wantup) { @@ -97,7 +96,7 @@ unsigned int s6_svlisten_loop (s6_svlisten_t *foo, int wantup, int wantready, in } else { - unsigned int d = byte_chr("dDuU", 4, s[j]) ; + unsigned int d = byte_chr("dDuU", 4, fs.s[j]) ; bitarray_poke(foo->upstate, i, d & 2) ; bitarray_poke(foo->readystate, i, d & 1) ; } |
