summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2017-03-12 11:59:43 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2017-03-12 11:59:43 +0000
commitc60ebd422171808ad58b936914055397bb205bef (patch)
tree7db3e5728d72ad209f8e22b9eb9f337e0b0c3e58
parente28fe5908a91d8795ca9923d64eeed7d3e898434 (diff)
downloads6-c60ebd422171808ad58b936914055397bb205bef.tar.xz
Adapt to skalibs-2.5.0.0
-rw-r--r--doc/libs6/accessrules.html7
-rw-r--r--doc/libs6/ftrigr.html10
-rw-r--r--doc/libs6/ftrigw.html2
-rw-r--r--doc/libs6/s6lock.html6
-rw-r--r--doc/libs6/s6lockd-helper.html3
-rw-r--r--src/conn-tools/s6-accessrules-cdb-from-fs.c11
-rw-r--r--src/conn-tools/s6-accessrules-fs-from-cdb.c28
-rw-r--r--src/conn-tools/s6-connlimit.c13
-rw-r--r--src/conn-tools/s6-ioconnect.c6
-rw-r--r--src/conn-tools/s6-ipcclient.c10
-rw-r--r--src/conn-tools/s6-ipcserver-access.c37
-rw-r--r--src/conn-tools/s6-ipcserver-socketbinder.c5
-rw-r--r--src/conn-tools/s6-ipcserver.c13
-rw-r--r--src/conn-tools/s6-ipcserverd.c67
-rw-r--r--src/conn-tools/s6-sudo.c4
-rw-r--r--src/conn-tools/s6-sudoc.c35
-rw-r--r--src/conn-tools/s6-sudod.c19
-rw-r--r--src/daemontools-extras/s6-applyuidgid.c19
-rw-r--r--src/daemontools-extras/s6-envdir.c2
-rw-r--r--src/daemontools-extras/s6-envuidgid.c39
-rw-r--r--src/daemontools-extras/s6-fghack.c1
-rw-r--r--src/daemontools-extras/s6-log.c140
-rw-r--r--src/daemontools-extras/s6-setlock.c7
-rw-r--r--src/daemontools-extras/s6-setsid.c4
-rw-r--r--src/daemontools-extras/s6-setuidgid.c13
-rw-r--r--src/daemontools-extras/s6-softlimit.c2
-rw-r--r--src/daemontools-extras/s6-tai64n.c7
-rw-r--r--src/daemontools-extras/s6-tai64nlocal.c6
-rw-r--r--src/daemontools-extras/ucspilogd.c8
-rw-r--r--src/fdholder/s6-fdholder-daemon.c13
-rw-r--r--src/fdholder/s6-fdholder-delete.c4
-rw-r--r--src/fdholder/s6-fdholder-deletec.c4
-rw-r--r--src/fdholder/s6-fdholder-getdump.c4
-rw-r--r--src/fdholder/s6-fdholder-getdumpc.c19
-rw-r--r--src/fdholder/s6-fdholder-list.c4
-rw-r--r--src/fdholder/s6-fdholder-listc.c9
-rw-r--r--src/fdholder/s6-fdholder-retrieve.c4
-rw-r--r--src/fdholder/s6-fdholder-retrievec.c4
-rw-r--r--src/fdholder/s6-fdholder-setdump.c4
-rw-r--r--src/fdholder/s6-fdholder-setdumpc.c17
-rw-r--r--src/fdholder/s6-fdholder-store.c4
-rw-r--r--src/fdholder/s6-fdholder-storec.c4
-rw-r--r--src/fdholder/s6-fdholder-transferdump.c4
-rw-r--r--src/fdholder/s6-fdholder-transferdumpc.c4
-rw-r--r--src/fdholder/s6-fdholderd.c65
-rw-r--r--src/include/s6/ftrigr.h19
-rw-r--r--src/include/s6/ftrigw.h8
-rw-r--r--src/include/s6/s6lock.h14
-rw-r--r--src/libs6/ftrig1_make.c11
-rw-r--r--src/libs6/ftrigr_check.c2
-rw-r--r--src/libs6/ftrigr_subscribe.c24
-rw-r--r--src/libs6/ftrigr_unsubscribe.c2
-rw-r--r--src/libs6/ftrigr_update.c2
-rw-r--r--src/libs6/ftrigr_wait_and.c2
-rw-r--r--src/libs6/ftrigr_wait_or.c4
-rw-r--r--src/libs6/ftrigw_clean.c13
-rw-r--r--src/libs6/ftrigw_fifodir_make.c3
-rw-r--r--src/libs6/ftrigw_notifyb_nosig.c15
-rw-r--r--src/libs6/s6-ftrigrd.c14
-rw-r--r--src/libs6/s6_accessrules_backend_cdb.c9
-rw-r--r--src/libs6/s6_accessrules_backend_fs.c20
-rw-r--r--src/libs6/s6_accessrules_keycheck_ip4.c7
-rw-r--r--src/libs6/s6_accessrules_keycheck_ip6.c9
-rw-r--r--src/libs6/s6_accessrules_keycheck_reversedns.c10
-rw-r--r--src/libs6/s6_accessrules_keycheck_uidgid.c4
-rw-r--r--src/libs6/s6_fdholder_delete.c2
-rw-r--r--src/libs6/s6_fdholder_delete_async.c11
-rw-r--r--src/libs6/s6_fdholder_getdump.c13
-rw-r--r--src/libs6/s6_fdholder_list.c2
-rw-r--r--src/libs6/s6_fdholder_list_async.c3
-rw-r--r--src/libs6/s6_fdholder_list_cb.c6
-rw-r--r--src/libs6/s6_fdholder_retrieve.c2
-rw-r--r--src/libs6/s6_fdholder_retrieve_async.c12
-rw-r--r--src/libs6/s6_fdholder_retrieve_cb.c4
-rw-r--r--src/libs6/s6_fdholder_setdump.c22
-rw-r--r--src/libs6/s6_fdholder_store.c2
-rw-r--r--src/libs6/s6_fdholder_store_async.c11
-rw-r--r--src/libs6/s6_supervise_lock.c1
-rw-r--r--src/libs6/s6_supervise_lock_mode.c13
-rw-r--r--src/libs6/s6_svc_ok.c11
-rw-r--r--src/libs6/s6_svc_write.c2
-rw-r--r--src/libs6/s6_svc_writectl.c13
-rw-r--r--src/libs6/s6_svstatus_pack.c4
-rw-r--r--src/libs6/s6_svstatus_read.c9
-rw-r--r--src/libs6/s6_svstatus_unpack.c8
-rw-r--r--src/libs6/s6_svstatus_write.c9
-rw-r--r--src/libs6/s6lock_acquire.c17
-rw-r--r--src/libs6/s6lock_release.c2
-rw-r--r--src/libs6/s6lock_update.c2
-rw-r--r--src/libs6/s6lock_wait_and.c2
-rw-r--r--src/libs6/s6lock_wait_or.c4
-rw-r--r--src/libs6/s6lockd.c22
-rw-r--r--src/pipe-tools/s6-ftrig-listen.c7
-rw-r--r--src/pipe-tools/s6-ftrig-listen1.c7
-rw-r--r--src/pipe-tools/s6-ftrig-wait.c4
-rw-r--r--src/pipe-tools/s6-mkfifodir.c4
-rw-r--r--src/supervision/s6-supervise.c24
-rw-r--r--src/supervision/s6-svc.c17
-rw-r--r--src/supervision/s6-svlisten.c5
-rw-r--r--src/supervision/s6-svlisten1.c7
-rw-r--r--src/supervision/s6-svscan.c31
-rw-r--r--src/supervision/s6-svscanctl.c3
-rw-r--r--src/supervision/s6-svstat.c17
-rw-r--r--src/supervision/s6-svwait.c4
-rw-r--r--src/supervision/s6_svlisten_loop.c24
-rw-r--r--src/supervision/s6_svlisten_signal_handler.c2
106 files changed, 596 insertions, 652 deletions
diff --git a/doc/libs6/accessrules.html b/doc/libs6/accessrules.html
index 20d3f2c..4cdca6c 100644
--- a/doc/libs6/accessrules.html
+++ b/doc/libs6/accessrules.html
@@ -66,7 +66,7 @@ Namely:
</p>
<p>
-<code>s6_accessrules_result_t f (char const *key, unsigned int keylen, void *handle, s6_accessrules_params_t *params) </code>
+<code>s6_accessrules_result_t f (char const *key, size_t keylen, void *handle, s6_accessrules_params_t *params) </code>
</p>
<p>
@@ -123,9 +123,8 @@ is not S6_ACCESSRULES_NOTFOUND. If no match can be found in the whole list,
<li>
<a name="uidgid" />
<tt>s6_accessrules_keycheck_uidgid</tt> interprets <em>key</em> as a
-<a href="http://skarnet.org/software/skalibs/libstddjb/">diuint</a>, i.e. a
-structure containing two unsigned ints. The first one is interpreted as an
-uid <em>u</em>, the second one as a gid <em>g</em>. The function first looks
+pointer to a structure containing an uid <em>u</em> and a gid <em>g</em>.
+The function first looks
for a <tt>uid/<em>u</em></tt> match; if it cannot find one, it looks for a
<tt>gid/<em>g</em></tt> match. If it cannot find one either, it checks
<tt>uid/default</tt> and returns the result. </li>
diff --git a/doc/libs6/ftrigr.html b/doc/libs6/ftrigr.html
index b16081f..889e389 100644
--- a/doc/libs6/ftrigr.html
+++ b/doc/libs6/ftrigr.html
@@ -44,8 +44,8 @@ simply ignoring pids you don't know.
</p>
<p>
- If your (badly programmed) application has trouble handling unknown
-children, consider using a ftrigrd service.
+ If your application has trouble handling unknown
+children, consider using a ftrigrd service. (And fix your application!)
</p>
<h3> A programming example </h3>
@@ -240,14 +240,14 @@ which something happened.
<p>
When <tt>ftrigr_update</tt> returns,
-<tt>genalloc_s(uint16, &amp;a-&gt;list)</tt> points to an array of
-<tt>genalloc_len(uint16, &amp;a-&gt;list)</tt> 16-bit unsigned
+<tt>genalloc_s(uint16_t, &amp;a-&gt;list)</tt> points to an array of
+<tt>genalloc_len(uint16_t, &amp;a-&gt;list)</tt> 16-bit unsigned
integers. Those integers are ids waiting to be passed to
<tt>ftrigr_check</tt>.
</p>
<pre>
-int ftrigr_check (ftrigr_t *a, uint16 id, char *what)
+int ftrigr_check (ftrigr_t *a, uint16_t id, char *what)
</pre>
<p>
diff --git a/doc/libs6/ftrigw.html b/doc/libs6/ftrigw.html
index d494d72..1089ed7 100644
--- a/doc/libs6/ftrigw.html
+++ b/doc/libs6/ftrigw.html
@@ -41,7 +41,7 @@ exact function prototypes.
<pre>
char const *path = "/var/lib/myservice/fifodir" ;
-int gid = -1 ;
+gid_t gid = -1 ;
int forceperms = 0 ;
int r = ftrigw_fifodir_make(path, gid, forceperms) ;
</pre>
diff --git a/doc/libs6/s6lock.html b/doc/libs6/s6lock.html
index cffe3f8..268b4c0 100644
--- a/doc/libs6/s6lock.html
+++ b/doc/libs6/s6lock.html
@@ -193,14 +193,14 @@ which something happened.
<p>
When <tt>s6lock_update</tt> returns,
-<tt>genalloc_s(uint16, &amp;a-&gt;list)</tt> points to an array of
-<tt>genalloc_len(uint16, &amp;a-&gt;list)</tt> 16-bit unsigned
+<tt>genalloc_s(uint16_t, &amp;a-&gt;list)</tt> points to an array of
+<tt>genalloc_len(uint16_t, &amp;a-&gt;list)</tt> 16-bit unsigned
integers. Those integers are ids waiting to be passed to
<tt>s6lock_check</tt>.
</p>
<pre>
-int s6lock_check (s6lock_t *a, uint16 id, char *what)
+int s6lock_check (s6lock_t *a, uint16_t id, char *what)
</pre>
<p>
diff --git a/doc/libs6/s6lockd-helper.html b/doc/libs6/s6lockd-helper.html
index 281c7e8..7a7d80a 100644
--- a/doc/libs6/s6lockd-helper.html
+++ b/doc/libs6/s6lockd-helper.html
@@ -43,7 +43,8 @@ threads) to implement timed lock acquisition. This can lead to a lot of
s6lockd-helper processes, but this is not a problem:
<ul>
<li> Processes are not a scarce resource. Today's schedulers work in O(1),
-i.e. a sleeping process takes no scheduling time at all. </li>
+or in O(a function of the number of runnable processes), which means that a
+sleeping process takes no scheduling time at all </li>
<li> s6lockd-helper is extremely tiny. Every instance should use up at
most one or two pages of non-sharable memory. </li>
</ul> </li>
diff --git a/src/conn-tools/s6-accessrules-cdb-from-fs.c b/src/conn-tools/s6-accessrules-cdb-from-fs.c
index c5b007c..ccd1204 100644
--- a/src/conn-tools/s6-accessrules-cdb-from-fs.c
+++ b/src/conn-tools/s6-accessrules-cdb-from-fs.c
@@ -1,13 +1,10 @@
/* ISC license. */
-#include <sys/types.h>
#include <stdint.h>
#include <unistd.h>
#include <errno.h>
-#include <stdio.h> /* for rename() */
-#include <skalibs/bytestr.h>
-#include <skalibs/uint16.h>
-#include <skalibs/fmtscan.h>
+#include <stdio.h>
+#include <skalibs/types.h>
#include <skalibs/cdb_make.h>
#include <skalibs/strerr2.h>
#include <skalibs/stralloc.h>
@@ -22,7 +19,7 @@ static stralloc tmp = STRALLOC_ZERO ;
static void cleanup (void)
{
- register int e = errno ;
+ int e = errno ;
unlink(tmp.s) ;
errno = e ;
}
@@ -66,7 +63,7 @@ static void doit (struct cdb_make *c, stralloc *sa, size_t start)
{
uint16_t envlen = 0 ;
uint16_t execlen = 0 ;
- register ssize_t r ;
+ ssize_t r ;
tmp.s[tmpbase] = 'A' ;
sa->len = k+1 ;
stralloc_catb(sa, "env", 4) ;
diff --git a/src/conn-tools/s6-accessrules-fs-from-cdb.c b/src/conn-tools/s6-accessrules-fs-from-cdb.c
index 4bc048f..3db1c77 100644
--- a/src/conn-tools/s6-accessrules-fs-from-cdb.c
+++ b/src/conn-tools/s6-accessrules-fs-from-cdb.c
@@ -1,12 +1,12 @@
/* ISC license. */
-#include <sys/types.h>
+#include <string.h>
#include <stdint.h>
#include <sys/stat.h>
#include <errno.h>
#include <unistd.h>
#include <skalibs/bytestr.h>
-#include <skalibs/uint16.h>
+#include <skalibs/types.h>
#include <skalibs/cdb.h>
#include <skalibs/strerr2.h>
#include <skalibs/djbunix.h>
@@ -31,8 +31,8 @@ static int domkdir (char const *s)
static void mkdirp (char *s)
{
mode_t m = umask(0) ;
- size_t len = str_len(s) ;
- register size_t i = basedirlen + 1 ;
+ size_t len = strlen(s) ;
+ size_t i = basedirlen + 1 ;
for (; i < len ; i++) if (s[i] == '/')
{
s[i] = 0 ;
@@ -50,7 +50,7 @@ static void mkdirp (char *s)
static void touchtrunc (char const *file)
{
- register int fd = open_trunc(file) ;
+ int fd = open_trunc(file) ;
if (fd < 0) strerr_diefu2sys(111, "open_trunc ", file) ;
fd_close(fd) ;
}
@@ -72,9 +72,9 @@ static int doenv (char const *dir, size_t dirlen, char *env, size_t envlen)
{
size_t p = byte_chr(env + i, n, '=') ;
char tmp[dirlen + p + 2] ;
- byte_copy(tmp, dirlen, dir) ;
+ memcpy(tmp, dir, dirlen) ;
tmp[dirlen] = '/' ;
- byte_copy(tmp + dirlen + 1, p, env + i) ;
+ memcpy(tmp + dirlen + 1, env + i, p) ;
tmp[dirlen + p + 1] = 0 ;
if (p < n)
{
@@ -100,7 +100,7 @@ static int doit (struct cdb *c)
uint16_t envlen, execlen ;
char name[basedirlen + klen + 8] ;
char data[dlen] ;
- byte_copy(name, basedirlen, basedir) ;
+ memcpy(name, basedir, basedirlen) ;
name[basedirlen] = '/' ;
if (!dlen || (dlen > 8201)) return (errno = EINVAL, 0) ;
if ((cdb_read(c, name+basedirlen+1, klen, cdb_keypos(c)) < 0)
@@ -114,12 +114,12 @@ static int doit (struct cdb *c)
name[basedirlen + klen + 1] = '/' ;
if (data[0] == 'A')
{
- byte_copy(name + basedirlen + klen + 2, 6, "allow") ;
+ memcpy(name + basedirlen + klen + 2, "allow", 6) ;
touchtrunc(name) ;
}
else if (data[0] == 'D')
{
- byte_copy(name + basedirlen + klen + 2, 5, "deny") ;
+ memcpy(name + basedirlen + klen + 2, "deny", 5) ;
touchtrunc(name) ;
}
if (dlen < 3) return 1 ;
@@ -129,10 +129,10 @@ static int doit (struct cdb *c)
if ((execlen > 4096U) || (5U + envlen + execlen != dlen)) return (errno = EINVAL, 0) ;
if (envlen)
{
- byte_copy(name + basedirlen + klen + 2, 4, "env") ;
+ memcpy(name + basedirlen + klen + 2, "env", 4) ;
if (!doenv(name, basedirlen + klen + 5, data + 3, envlen)) return (errno = EINVAL, 0) ;
}
- byte_copy(name + basedirlen + klen + 2, 5, "exec") ;
+ memcpy(name + basedirlen + klen + 2, "exec", 5) ;
if (execlen && !openwritenclose_unsafe(name, data + 5 + envlen, execlen))
{
cleanup() ;
@@ -150,7 +150,7 @@ int main (int argc, char const *const *argv)
if (argc < 3) strerr_dieusage(100, USAGE) ;
if (cdb_mapfile(&c, argv[2]) < 0) strerr_diefu1sys(111, "cdb_mapfile") ;
basedir = argv[1] ;
- basedirlen = str_len(argv[1]) ;
+ basedirlen = strlen(argv[1]) ;
{
mode_t m = umask(0) ;
if (mkdir(basedir, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH | S_ISGID) < 0)
@@ -160,7 +160,7 @@ int main (int argc, char const *const *argv)
cdb_traverse_init(&c, &kpos) ;
for (;;)
{
- register int r = cdb_nextkey(&c, &kpos) ;
+ int r = cdb_nextkey(&c, &kpos) ;
if (r < 0)
{
cleanup() ;
diff --git a/src/conn-tools/s6-connlimit.c b/src/conn-tools/s6-connlimit.c
index 903a777..d7d48c9 100644
--- a/src/conn-tools/s6-connlimit.c
+++ b/src/conn-tools/s6-connlimit.c
@@ -1,8 +1,7 @@
/* ISC license. */
-#include <sys/types.h>
-#include <skalibs/uint.h>
-#include <skalibs/bytestr.h>
+#include <string.h>
+#include <skalibs/types.h>
#include <skalibs/strerr2.h>
#include <skalibs/env.h>
#include <skalibs/djbunix.h>
@@ -14,17 +13,17 @@ int main (int argc, char const *const *argv, char const *const *envp)
PROG = "s6-connlimit" ;
x = env_get2(envp, "PROTO") ;
if (!x) strerr_dienotset(100, "PROTO") ;
- protolen = str_len(x) ;
+ protolen = strlen(x) ;
if (!protolen) strerr_dief1x(100, "empty PROTO") ;
{
unsigned int num ;
char s[protolen + 8] ;
- byte_copy(s, protolen, x) ;
- byte_copy(s + protolen, 8, "CONNNUM") ;
+ memcpy(s, x, protolen) ;
+ memcpy(s + protolen, "CONNNUM", 8) ;
x = env_get2(envp, s) ;
if (!x) strerr_dienotset(100, s) ;
if (!uint0_scan(x, &num)) strerr_dief2x(100, "invalid ", s) ;
- byte_copy(s + protolen + 4, 4, "MAX") ;
+ memcpy(s + protolen + 4, "MAX", 4) ;
x = env_get2(envp, s) ;
if (x)
{
diff --git a/src/conn-tools/s6-ioconnect.c b/src/conn-tools/s6-ioconnect.c
index abd309b..05a3fdf 100644
--- a/src/conn-tools/s6-ioconnect.c
+++ b/src/conn-tools/s6-ioconnect.c
@@ -4,7 +4,7 @@
#include <sys/socket.h>
#include <errno.h>
#include <signal.h>
-#include <skalibs/uint.h>
+#include <skalibs/types.h>
#include <skalibs/allreadwrite.h>
#include <skalibs/sgetopt.h>
#include <skalibs/error.h>
@@ -74,14 +74,14 @@ static void handle_signals (void)
int main (int argc, char const *const *argv)
{
tain_t tto ;
- register unsigned int i, j ;
+ unsigned int i, j ;
PROG = "s6-ioconnect" ;
{
subgetopt_t l = SUBGETOPT_ZERO ;
unsigned int t = 0 ;
for (;;)
{
- register int opt = subgetopt_r(argc, argv, "0167t:r:w:", &l) ;
+ int opt = subgetopt_r(argc, argv, "0167t:r:w:", &l) ;
if (opt < 0) break ;
switch (opt)
{
diff --git a/src/conn-tools/s6-ipcclient.c b/src/conn-tools/s6-ipcclient.c
index 384fca0..a8c6075 100644
--- a/src/conn-tools/s6-ipcclient.c
+++ b/src/conn-tools/s6-ipcclient.c
@@ -1,6 +1,6 @@
/* ISC license. */
-#include <sys/types.h>
+#include <string.h>
#include <skalibs/sgetopt.h>
#include <skalibs/strerr2.h>
#include <skalibs/env.h>
@@ -19,7 +19,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
subgetopt_t l = SUBGETOPT_ZERO ;
for (;;)
{
- register int opt = subgetopt_r(argc, argv, "qQvp:l:", &l) ;
+ int opt = subgetopt_r(argc, argv, "qQvp:l:", &l) ;
if (opt == -1) break ;
switch (opt)
{
@@ -46,16 +46,16 @@ int main (int argc, char const *const *argv, char const *const *envp)
if (verbosity >= 2) strerr_warn3x(PROG, ": connected to ", argv[0]) ;
if (localname)
{
- register size_t n = str_len(localname) ;
+ size_t n = strlen(localname) ;
if (n > IPCPATH_MAX) n = IPCPATH_MAX ;
- byte_copy(modif + i, n, localname) ;
+ memcpy(modif + i, localname, n) ;
i += n ; modif[i++] = 0 ;
}
else
{
int dummy ;
if (ipc_local(s, modif + i, IPCPATH_MAX, &dummy) < 0) modif[--i] = 0 ;
- else i += str_len(modif + i) + 1 ;
+ else i += strlen(modif + i) + 1 ;
}
if (fd_move(6, s) < 0)
strerr_diefu2sys(111, "set up fd ", "6") ;
diff --git a/src/conn-tools/s6-ipcserver-access.c b/src/conn-tools/s6-ipcserver-access.c
index 1a30913..c5e20c2 100644
--- a/src/conn-tools/s6-ipcserver-access.c
+++ b/src/conn-tools/s6-ipcserver-access.c
@@ -1,12 +1,10 @@
/* ISC license. */
-#include <sys/types.h>
+#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <skalibs/gccattributes.h>
-#include <skalibs/uint64.h>
-#include <skalibs/uint.h>
-#include <skalibs/gidstuff.h>
+#include <skalibs/types.h>
#include <skalibs/strerr2.h>
#include <skalibs/sgetopt.h>
#include <skalibs/cdb.h>
@@ -45,11 +43,11 @@ static inline void X ()
static void logit (pid_t pid, uid_t uid, gid_t gid, int h)
{
- char fmtpid[UINT_FMT] ;
- char fmtuid[UINT64_FMT] ;
+ char fmtpid[PID_FMT] ;
+ char fmtuid[UID_FMT] ;
char fmtgid[GID_FMT] ;
- fmtpid[uint_fmt(fmtpid, (unsigned int)pid)] = 0 ;
- fmtuid[uint64_fmt(fmtuid, (uint64)uid)] = 0 ;
+ fmtpid[pid_fmt(fmtpid, pid)] = 0 ;
+ fmtuid[uid_fmt(fmtuid, uid)] = 0 ;
fmtgid[gid_fmt(fmtgid, gid)] = 0 ;
if (h) strerr_warni7x("allow", " pid ", fmtpid, " uid ", fmtuid, " gid ", fmtgid) ;
else strerr_warni7sys("deny", " pid ", fmtpid, " uid ", fmtuid, " gid ", fmtgid) ;
@@ -72,7 +70,7 @@ static s6_accessrules_result_t check_cdb (uid_t uid, gid_t gid, char const *file
{
struct cdb c = CDB_ZERO ;
int fd = open_readb(file) ;
- register s6_accessrules_result_t r ;
+ s6_accessrules_result_t r ;
if (fd < 0) return -1 ;
if (cdb_init(&c, fd) < 0) strerr_diefu2sys(111, "cdb_init ", file) ;
r = s6_accessrules_uidgid_cdb(uid, gid, &c, params) ;
@@ -127,7 +125,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
subgetopt_t l = SUBGETOPT_ZERO ;
for (;;)
{
- register int opt = subgetopt_r(argc, argv, "v:Eel:i:x:", &l) ;
+ int opt = subgetopt_r(argc, argv, "v:Eel:i:x:", &l) ;
if (opt == -1) break ;
switch (opt)
{
@@ -147,19 +145,16 @@ int main (int argc, char const *const *argv, char const *const *envp)
proto = env_get2(envp, "PROTO") ;
if (!proto) strerr_dienotset(100, "PROTO") ;
- protolen = str_len(proto) ;
+ protolen = strlen(proto) ;
{
- uint64 u ;
char const *x ;
char tmp[protolen + 11] ;
byte_copy(tmp, protolen, proto) ;
byte_copy(tmp + protolen, 11, "REMOTEEUID") ;
x = env_get2(envp, tmp) ;
if (!x) strerr_dienotset(100, tmp) ;
- if (!uint640_scan(x, &u)) strerr_dieinvalid(100, tmp) ;
- if (u > (uint64)(uid_t)-1) strerr_dieinvalid(100, tmp) ;
- uid = (uid_t)u ;
+ if (!uid0_scan(x, &uid)) strerr_dieinvalid(100, tmp) ;
tmp[protolen + 7] = 'G' ;
x = env_get2(envp, tmp) ;
if (!x) strerr_dienotset(100, tmp) ;
@@ -176,8 +171,8 @@ int main (int argc, char const *const *argv, char const *const *envp)
if (doenv)
{
char tmp[protolen + 10] ;
- byte_copy(tmp, protolen, proto) ;
- byte_copy(tmp + protolen, 10, "LOCALPATH") ;
+ memcpy(tmp, proto, protolen) ;
+ memcpy(tmp + protolen, "LOCALPATH", 10) ;
if (localname)
{
if (!env_addmodif(&params.env, tmp, localname)) dienomem() ;
@@ -194,15 +189,15 @@ int main (int argc, char const *const *argv, char const *const *envp)
else
{
char tmp[protolen + 11] ;
- byte_copy(tmp, protolen, proto) ;
- byte_copy(tmp + protolen, 11, "REMOTEEUID") ;
+ memcpy(tmp, proto, protolen) ;
+ memcpy(tmp + protolen, "REMOTEEUID", 11) ;
if (!env_addmodif(&params.env, "PROTO", 0)) dienomem() ;
if (!env_addmodif(&params.env, tmp, 0)) dienomem() ;
tmp[protolen + 7] = 'G' ;
if (!env_addmodif(&params.env, tmp, 0)) dienomem() ;
- byte_copy(tmp + protolen + 6, 5, "PATH") ;
+ memcpy(tmp + protolen + 6, "PATH", 5) ;
if (!env_addmodif(&params.env, tmp, 0)) dienomem() ;
- byte_copy(tmp + protolen, 10, "LOCALPATH") ;
+ memcpy(tmp + protolen, "LOCALPATH", 10) ;
if (!env_addmodif(&params.env, tmp, 0)) dienomem() ;
}
diff --git a/src/conn-tools/s6-ipcserver-socketbinder.c b/src/conn-tools/s6-ipcserver-socketbinder.c
index 523b118..5d74096 100644
--- a/src/conn-tools/s6-ipcserver-socketbinder.c
+++ b/src/conn-tools/s6-ipcserver-socketbinder.c
@@ -1,10 +1,9 @@
/* ISC license. */
-#include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <unistd.h>
-#include <skalibs/uint.h>
+#include <skalibs/types.h>
#include <skalibs/sgetopt.h>
#include <skalibs/strerr2.h>
#include <skalibs/djbunix.h>
@@ -23,7 +22,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
subgetopt_t l = SUBGETOPT_ZERO ;
for (;;)
{
- register int opt = subgetopt_r(argc, argv, "DdMmb:", &l) ;
+ int opt = subgetopt_r(argc, argv, "DdMmb:", &l) ;
if (opt == -1) break ;
switch (opt)
{
diff --git a/src/conn-tools/s6-ipcserver.c b/src/conn-tools/s6-ipcserver.c
index 7b7023f..9e85699 100644
--- a/src/conn-tools/s6-ipcserver.c
+++ b/src/conn-tools/s6-ipcserver.c
@@ -2,8 +2,7 @@
#include <sys/types.h>
#include <limits.h>
-#include <skalibs/uint.h>
-#include <skalibs/gidstuff.h>
+#include <skalibs/types.h>
#include <skalibs/sgetopt.h>
#include <skalibs/strerr2.h>
#include <skalibs/djbunix.h>
@@ -21,7 +20,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
int flagreuse = 1 ;
unsigned int uid = 0, gid = 0 ;
gid_t gids[NGROUPS_MAX] ;
- unsigned int gidn = (unsigned int)-1 ;
+ size_t gidn = (size_t)-1 ;
unsigned int maxconn = 0 ;
unsigned int localmaxconn = 0 ;
unsigned int backlog = (unsigned int)-1 ;
@@ -30,7 +29,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
subgetopt_t l = SUBGETOPT_ZERO ;
for (;;)
{
- register int opt = subgetopt_r(argc, argv, "qQvDd1UPpc:C:b:u:g:G:", &l) ;
+ int opt = subgetopt_r(argc, argv, "qQvDd1UPpc:C:b:u:g:G:", &l) ;
if (opt == -1) break ;
switch (opt)
{
@@ -48,7 +47,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
case 'g' : if (!uint0_scan(l.arg, &gid)) dieusage() ; break ;
case 'G' : if (!gid_scanlist(gids, NGROUPS_MAX, l.arg, &gidn) && *l.arg) dieusage() ; break ;
case '1' : flag1 = 1 ; break ;
- case 'U' : flagU = 1 ; uid = 0 ; gid = 0 ; gidn = (unsigned int)-1 ; break ;
+ case 'U' : flagU = 1 ; uid = 0 ; gid = 0 ; gidn = (size_t)-1 ; break ;
default : dieusage() ;
}
}
@@ -73,7 +72,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
}
newargv[m++] = "--" ;
newargv[m++] = *argv++ ;
- if (flagU || uid || gid || gidn != (unsigned int)-1)
+ if (flagU || uid || gid || gidn != (size_t)-1)
{
newargv[m++] = S6_BINPREFIX "s6-applyuidgid" ;
if (flagU) newargv[m++] = "-Uz" ;
@@ -91,7 +90,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
pos += uint_fmt(fmt + pos, gid) ;
fmt[pos++] = 0 ;
}
- if (gidn != (unsigned int)-1)
+ if (gidn != (size_t)-1)
{
newargv[m++] = "-G" ;
newargv[m++] = fmt + pos ;
diff --git a/src/conn-tools/s6-ipcserverd.c b/src/conn-tools/s6-ipcserverd.c
index eb8553e..036de7b 100644
--- a/src/conn-tools/s6-ipcserverd.c
+++ b/src/conn-tools/s6-ipcserverd.c
@@ -3,14 +3,13 @@
#include <sys/types.h>
#include <sys/wait.h>
#include <errno.h>
+#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <signal.h>
-#include <skalibs/uint.h>
-#include <skalibs/gidstuff.h>
+#include <skalibs/types.h>
#include <skalibs/gccattributes.h>
#include <skalibs/allreadwrite.h>
-#include <skalibs/bytestr.h>
#include <skalibs/sgetopt.h>
#include <skalibs/strerr2.h>
#include <skalibs/env.h>
@@ -70,14 +69,14 @@ static inline void X (void)
static unsigned int lookup_pid (pid_t pid)
{
- register unsigned int i = 0 ;
+ unsigned int i = 0 ;
for (; i < numconn ; i++) if (pid == piduid[i].left) break ;
return i ;
}
static inline unsigned int lookup_uid (uid_t uid)
{
- register unsigned int i = 0 ;
+ unsigned int i = 0 ;
for (; i < uidlen ; i++) if (uid == uidnum[i].left) break ;
return i ;
}
@@ -104,12 +103,12 @@ static void log_status (void)
static void log_deny (uid_t uid, gid_t gid, unsigned int num)
{
- char fmtuid[UINT64_FMT] = "?" ;
+ char fmtuid[UID_FMT] = "?" ;
char fmtgid[GID_FMT] = "?" ;
char fmtnum[UINT_FMT] = "?" ;
if (flaglookup)
{
- fmtuid[uint64_fmt(fmtuid, (uint64)uid)] = 0 ;
+ fmtuid[uid_fmt(fmtuid, uid)] = 0 ;
fmtgid[gid_fmt(fmtgid, gid)] = 0 ;
fmtnum[uint_fmt(fmtnum, num)] = 0 ;
}
@@ -118,28 +117,28 @@ static void log_deny (uid_t uid, gid_t gid, unsigned int num)
static void log_accept (pid_t pid, uid_t uid, gid_t gid, unsigned int num)
{
- char fmtuidgid[UINT64_FMT + GID_FMT + 1] = "?:?" ;
+ char fmtuidgid[UID_FMT + GID_FMT + 1] = "?:?" ;
char fmtpid[UINT_FMT] ;
char fmtnum[UINT_FMT] = "?" ;
if (flaglookup)
{
- register size_t n = uint64_fmt(fmtuidgid, (uint64)uid) ;
+ size_t n = uid_fmt(fmtuidgid, uid) ;
fmtuidgid[n++] = ':' ;
n += gid_fmt(fmtuidgid + n, gid) ;
fmtuidgid[n] = 0 ;
fmtnum[uint_fmt(fmtnum, num)] = 0 ;
}
- fmtpid[uint_fmt(fmtpid, (unsigned int)pid)] = 0 ;
+ fmtpid[pid_fmt(fmtpid, pid)] = 0 ;
strerr_warni7x("allow ", fmtuidgid, " pid ", fmtpid, " count ", fmtnum, fmtlocalmaxconn) ;
}
static void log_close (pid_t pid, uid_t uid, int w)
{
- char fmtpid[UINT_FMT] ;
- char fmtuid[UINT64_FMT] = "?" ;
+ char fmtpid[PID_FMT] ;
+ char fmtuid[UID_FMT] = "?" ;
char fmtw[UINT_FMT] ;
- fmtpid[uint_fmt(fmtpid, (unsigned int)pid)] = 0 ;
- if (flaglookup) fmtuid[uint64_fmt(fmtuid, (uint64)uid)] = 0 ;
+ fmtpid[pid_fmt(fmtpid, pid)] = 0 ;
+ if (flaglookup) fmtuid[uid_fmt(fmtuid, uid)] = 0 ;
fmtw[uint_fmt(fmtw, WIFSIGNALED(w) ? WTERMSIG(w) : WEXITSTATUS(w))] = 0 ;
strerr_warni6x("end pid ", fmtpid, " uid ", fmtuid, WIFSIGNALED(w) ? " signal " : " exitcode ", fmtw) ;
}
@@ -149,7 +148,7 @@ static void log_close (pid_t pid, uid_t uid, int w)
static void killthem (int sig)
{
- register unsigned int i = 0 ;
+ unsigned int i = 0 ;
for (; i < numconn ; i++) kill(piduid[i].left, sig) ;
}
@@ -159,7 +158,7 @@ static void wait_children (void)
{
unsigned int i ;
int w ;
- register pid_t pid = wait_nohang(&w) ;
+ pid_t pid = wait_nohang(&w) ;
if (pid < 0)
if (errno != ECHILD) strerr_diefu1sys(111, "wait_nohang") ;
else break ;
@@ -168,7 +167,7 @@ static void wait_children (void)
if (i < numconn)
{
uid_t uid = piduid[i].right ;
- register unsigned int j = lookup_uid(uid) ;
+ unsigned int j = lookup_uid(uid) ;
if (j >= uidlen) X() ;
if (!--uidnum[j].right) uidnum[j] = uidnum[--uidlen] ;
piduid[i] = piduid[--numconn] ;
@@ -227,34 +226,34 @@ static void handle_signals (void)
/* New connection handling */
-static void run_child (int, unsigned int, unsigned int, unsigned int, char const *, char const *const *, char const *const *) gccattr_noreturn ;
-static void run_child (int s, unsigned int uid, unsigned int gid, unsigned int num, char const *remotepath, char const *const *argv, char const *const *envp)
+static void run_child (int, uid_t, gid_t, unsigned int, char const *, char const *const *, char const *const *) gccattr_noreturn ;
+static void run_child (int s, uid_t uid, gid_t gid, unsigned int num, char const *remotepath, char const *const *argv, char const *const *envp)
{
- size_t rplen = str_len(remotepath) + 1 ;
+ size_t rplen = strlen(remotepath) + 1 ;
unsigned int n = 0 ;
- char fmt[65 + UINT_FMT * 3 + rplen] ;
+ char fmt[65 + UID_FMT + GID_FMT + UINT_FMT + rplen] ;
PROG = "s6-ipcserver (child)" ;
if ((fd_move(0, s) < 0) || (fd_copy(1, 0) < 0))
strerr_diefu1sys(111, "move fds") ;
- byte_copy(fmt+n, 23, "PROTO=IPC\0IPCREMOTEEUID") ; n += 23 ;
+ memcpy(fmt+n, "PROTO=IPC\0IPCREMOTEEUID", 23) ; n += 23 ;
if (flaglookup)
{
fmt[n++] = '=' ;
- n += uint_fmt(fmt+n, uid) ;
+ n += uid_fmt(fmt+n, uid) ;
}
fmt[n++] = 0 ;
- byte_copy(fmt+n, 13, "IPCREMOTEEGID") ; n += 13 ;
+ memcpy(fmt+n, "IPCREMOTEEGID", 13) ; n += 13 ;
if (flaglookup)
{
fmt[n++] = '=' ;
- n += uint_fmt(fmt+n, gid) ;
+ n += gid_fmt(fmt+n, gid) ;
}
fmt[n++] = 0 ;
- byte_copy(fmt+n, 11, "IPCCONNNUM=") ; n += 11 ;
+ memcpy(fmt+n, "IPCCONNNUM=", 11) ; n += 11 ;
if (flaglookup) n += uint_fmt(fmt+n, num) ;
fmt[n++] = 0 ;
- byte_copy(fmt+n, 14, "IPCREMOTEPATH=") ; n += 14 ;
- byte_copy(fmt+n, rplen, remotepath) ; n += rplen ;
+ memcpy(fmt+n, "IPCREMOTEPATH=", 14) ; n += 14 ;
+ memcpy(fmt+n, remotepath, rplen) ; n += rplen ;
pathexec_r(argv, envp, env_len(envp), fmt, n) ;
strerr_dieexec(111, argv[0]) ;
}
@@ -263,8 +262,8 @@ static void new_connection (int s, char const *remotepath, char const *const *ar
{
uid_t uid = 0 ;
gid_t gid = 0 ;
+ pid_t pid ;
unsigned int num, i ;
- register pid_t pid ;
if (flaglookup && (getpeereid(s, &uid, &gid) < 0))
{
if (verbosity) strerr_warnwu1sys("getpeereid") ;
@@ -314,7 +313,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
int flag1 = 0 ;
for (;;)
{
- register int opt = subgetopt_r(argc, argv, "Pp1c:C:v:", &l) ;
+ int opt = subgetopt_r(argc, argv, "Pp1c:C:v:", &l) ;
if (opt == -1) break ;
switch (opt)
{
@@ -393,15 +392,15 @@ int main (int argc, char const *const *argv, char const *const *envp)
{
int dummy ;
char remotepath[IPCPATH_MAX+1] ;
- register int s = ipc_accept(x[1].fd, remotepath, IPCPATH_MAX+1, &dummy) ;
- if (s < 0)
+ int sock = ipc_accept(x[1].fd, remotepath, IPCPATH_MAX+1, &dummy) ;
+ if (sock < 0)
{
if (verbosity) strerr_warnwu1sys("accept") ;
}
else
{
- new_connection(s, remotepath, argv, envp) ;
- fd_close(s) ;
+ new_connection(sock, remotepath, argv, envp) ;
+ fd_close(sock) ;
}
}
}
diff --git a/src/conn-tools/s6-sudo.c b/src/conn-tools/s6-sudo.c
index 12880b2..c422a1d 100644
--- a/src/conn-tools/s6-sudo.c
+++ b/src/conn-tools/s6-sudo.c
@@ -1,6 +1,6 @@
/* ISC license. */
-#include <skalibs/uint.h>
+#include <skalibs/types.h>
#include <skalibs/sgetopt.h>
#include <skalibs/strerr2.h>
#include <skalibs/djbunix.h>
@@ -20,7 +20,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
subgetopt_t l = SUBGETOPT_ZERO ;
for (;;)
{
- register int opt = subgetopt_r(argc, argv, "qQvp:l:et:T:", &l) ;
+ int opt = subgetopt_r(argc, argv, "qQvp:l:et:T:", &l) ;
if (opt == -1) break ;
switch (opt)
{
diff --git a/src/conn-tools/s6-sudoc.c b/src/conn-tools/s6-sudoc.c
index 779380f..eb8f138 100644
--- a/src/conn-tools/s6-sudoc.c
+++ b/src/conn-tools/s6-sudoc.c
@@ -1,14 +1,14 @@
/* ISC license. */
+#include <string.h>
#include <stdint.h>
#include <errno.h>
#include <fcntl.h>
#include <signal.h>
+#include <sys/uio.h>
#include <sys/wait.h>
-#include <skalibs/uint32.h>
-#include <skalibs/uint.h>
+#include <skalibs/types.h>
#include <skalibs/sgetopt.h>
-#include <skalibs/bytestr.h>
#include <skalibs/buffer.h>
#include <skalibs/stralloc.h>
#include <skalibs/strerr2.h>
@@ -36,7 +36,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
PROG = "s6-sudoc" ;
for (;;)
{
- register int opt = subgetopt_r(argc, argv, "et:T:", &l) ;
+ int opt = subgetopt_r(argc, argv, "et:T:", &l) ;
if (opt < 0) break ;
switch (opt)
{
@@ -59,33 +59,33 @@ int main (int argc, char const *const *argv, char const *const *envp)
char tmp[S6_SUDO_BANNERB_LEN] ;
if (buffer_timed_get_g(&b6, tmp, S6_SUDO_BANNERB_LEN, &deadline) < S6_SUDO_BANNERB_LEN)
strerr_diefu1sys(111, "read banner from s6-sudod") ;
- if (str_diffn(tmp, S6_SUDO_BANNERB, S6_SUDO_BANNERB_LEN))
+ if (strncmp(tmp, S6_SUDO_BANNERB, S6_SUDO_BANNERB_LEN))
strerr_dief1x(100, "wrong server banner") ;
}
{
int fds[3] = { 0, 1, 2 } ;
char pack[16] ;
- siovec_t v[4] = {
- { .s = S6_SUDO_BANNERA, .len = S6_SUDO_BANNERA_LEN },
- { .s = pack, .len = 16 },
- { .s = 0, .len = 0 },
- { .s = 0, .len = 0 } } ;
+ struct iovec v[4] = {
+ { .iov_base = S6_SUDO_BANNERA, .iov_len = S6_SUDO_BANNERA_LEN },
+ { .iov_base = pack, .iov_len = 16 },
+ { .iov_base = 0, .iov_len = 0 },
+ { .iov_base = 0, .iov_len = 0 } } ;
unixmessage_v_t mv = { .v = v, .vlen = 4, .fds = fds, .nfds = 3 } ;
stralloc sa = STRALLOC_ZERO ;
size_t envlen = doenv ? env_len(envp) : 0 ;
uint32_pack_big(pack, (uint32_t)argc) ;
uint32_pack_big(pack + 4, (uint32_t)envlen) ;
if (!env_string(&sa, argv, argc)) dienomem() ;
- v[2].len = sa.len ;
- uint32_pack_big(pack + 8, (uint32_t)v[2].len) ;
+ v[2].iov_len = sa.len ;
+ uint32_pack_big(pack + 8, (uint32_t)v[2].iov_len) ;
if (doenv)
{
if (!env_string(&sa, envp, envlen)) dienomem() ;
- v[3].len = sa.len - v[2].len ;
+ v[3].iov_len = sa.len - v[2].iov_len ;
}
- uint32_pack_big(pack + 12, (uint32)v[3].len) ;
- v[2].s = sa.s ;
- v[3].s = sa.s + v[2].len ;
+ uint32_pack_big(pack + 12, (uint32_t)v[3].iov_len) ;
+ v[2].iov_base = sa.s ;
+ v[3].iov_base = sa.s + v[2].iov_len ;
if (!unixmessage_putv_and_close(&b7, &mv, (unsigned char const *)"\003"))
strerr_diefu1sys(111, "unixmessage_putv") ;
stralloc_free(&sa) ;
@@ -112,6 +112,5 @@ int main (int argc, char const *const *argv, char const *const *envp)
strerr_diefu1sys(111, "get exit status from server") ;
uint_unpack_big(pack, &t) ;
}
- if (WIFSIGNALED(t)) raise(WTERMSIG(t)) ;
- return WEXITSTATUS(t) ;
+ return wait_estatus(t) ;
}
diff --git a/src/conn-tools/s6-sudod.c b/src/conn-tools/s6-sudod.c
index c2256a4..bb56d84 100644
--- a/src/conn-tools/s6-sudod.c
+++ b/src/conn-tools/s6-sudod.c
@@ -1,13 +1,12 @@
/* ISC license. */
-#include <sys/types.h>
+#include <string.h>
#include <stdint.h>
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
#include <signal.h>
-#include <skalibs/uint32.h>
-#include <skalibs/uint.h>
+#include <skalibs/types.h>
#include <skalibs/allreadwrite.h>
#include <skalibs/sgetopt.h>
#include <skalibs/bytestr.h>
@@ -40,7 +39,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
PROG = "s6-sudod" ;
for (;;)
{
- register int opt = subgetopt_r(argc, argv, "012t:", &l) ;
+ int opt = subgetopt_r(argc, argv, "012t:", &l) ;
if (opt < 0) break ;
switch (opt)
{
@@ -67,7 +66,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
strerr_dief1x(100, "client did not send 3 fds") ;
if (m.len < 16 + S6_SUDO_BANNERA_LEN)
strerr_dief1x(100, "wrong client message") ;
- if (str_diffn(m.s, S6_SUDO_BANNERA, S6_SUDO_BANNERA_LEN))
+ if (strncmp(m.s, S6_SUDO_BANNERA, S6_SUDO_BANNERA_LEN))
strerr_dief1x(100, "wrong client banner") ;
uint32_unpack_big(m.s + S6_SUDO_BANNERA_LEN, &cargc) ;
uint32_unpack_big(m.s + S6_SUDO_BANNERA_LEN + 4, &cenvc) ;
@@ -100,7 +99,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
char const *targv[argc + 1 + cargc] ;
char const *tenvp[envc + 1 + cenvc] ;
int p[2] ;
- register unsigned int i = 0 ;
+ unsigned int i = 0 ;
for (; i < (unsigned int)argc ; i++) targv[i] = argv[i] ;
for (i = 0 ; i <= envc ; i++) tenvp[i] = envp[i] ;
if (!env_make(targv + argc, cargc, m.s + S6_SUDO_BANNERA_LEN + 16, carglen))
@@ -124,8 +123,8 @@ int main (int argc, char const *const *argv, char const *const *envp)
for (i = 0 ; i < cenvc ; i++)
{
char const *var = tenvp[envc + 1 + i] ;
- register unsigned int j = 0 ;
- register size_t len = str_chr(var, '=') ;
+ unsigned int j = 0 ;
+ size_t len = str_chr(var, '=') ;
if (!var[len])
{
char c = EINVAL ;
@@ -133,7 +132,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
buffer_timed_flush_g(buffer_1small, &deadline) ;
strerr_dief1x(100, "bad environment from client") ;
}
- for (; j < envc ; j++) if (!str_diffn(var, tenvp[j], len+1)) break ;
+ for (; j < envc ; j++) if (!strncmp(var, tenvp[j], len+1)) break ;
if ((j < envc) && !tenvp[j][len+1]) tenvp[j] = var ;
}
@@ -167,7 +166,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
fd_close(p[1]) ;
{
char c ;
- register ssize_t r = fd_read(p[0], &c, 1) ;
+ ssize_t r = fd_read(p[0], &c, 1) ;
if (r < 0) strerr_diefu1sys(111, "read from child") ;
if (r)
{
diff --git a/src/daemontools-extras/s6-applyuidgid.c b/src/daemontools-extras/s6-applyuidgid.c
index b80564f..a770b2a 100644
--- a/src/daemontools-extras/s6-applyuidgid.c
+++ b/src/daemontools-extras/s6-applyuidgid.c
@@ -1,12 +1,10 @@
/* ISC license. */
#include <skalibs/nonposix.h>
-#include <sys/types.h>
#include <unistd.h>
#include <grp.h>
#include <limits.h>
-#include <skalibs/uint64.h>
-#include <skalibs/gidstuff.h>
+#include <skalibs/types.h>
#include <skalibs/setgroups.h>
#include <skalibs/strerr2.h>
#include <skalibs/sgetopt.h>
@@ -18,29 +16,29 @@
int main (int argc, char const *const *argv, char const *const *envp)
{
- uint64 uid = 0 ;
+ uid_t uid = 0 ;
gid_t gid = 0 ;
gid_t gids[NGROUPS_MAX] ;
- unsigned int gidn = (unsigned int)-1 ;
+ size_t gidn = (size_t)-1 ;
int unexport = 0 ;
PROG = "s6-applyuidgid" ;
{
subgetopt_t l = SUBGETOPT_ZERO ;
for (;;)
{
- register int opt = subgetopt_r(argc, argv, "zUu:g:G:", &l) ;
+ int opt = subgetopt_r(argc, argv, "zUu:g:G:", &l) ;
if (opt == -1) break ;
switch (opt)
{
case 'z' : unexport = 1 ; break ;
- case 'u' : if (!uint640_scan(l.arg, &uid)) dieusage() ; break ;
+ case 'u' : if (!uid0_scan(l.arg, &uid)) dieusage() ; break ;
case 'g' : if (!gid0_scan(l.arg, &gid)) dieusage() ; break ;
case 'G' : if (!gid_scanlist(gids, NGROUPS_MAX, l.arg, &gidn) && *l.arg) dieusage() ; break ;
case 'U' :
{
char const *x = env_get2(envp, "UID") ;
if (!x) strerr_dienotset(100, "UID") ;
- if (!uint640_scan(x, &uid)) strerr_dieinvalid(100, "UID") ;
+ if (!uid0_scan(x, &uid)) strerr_dieinvalid(100, "UID") ;
x = env_get2(envp, "GID") ;
if (!x) strerr_dienotset(100, "GID") ;
if (!gid0_scan(x, &gid)) strerr_dieinvalid(100, "GID") ;
@@ -57,12 +55,11 @@ int main (int argc, char const *const *argv, char const *const *envp)
}
if (!argc) dieusage() ;
- if (uid > (uint64)(uid_t)-1) strerr_dief1x(100, "uid value too big") ;
- if (gidn != (unsigned int)-1 && setgroups(gidn, gids) < 0)
+ if (gidn != (size_t)-1 && setgroups(gidn, gids) < 0)
strerr_diefu1sys(111, "set supplementary group list") ;
if (gid && setgid(gid) < 0)
strerr_diefu1sys(111, "setgid") ;
- if (uid && setuid((uid_t)uid) < 0)
+ if (uid && setuid(uid) < 0)
strerr_diefu1sys(111, "setuid") ;
if (unexport) pathexec_r(argv, envp, env_len(envp), "UID\0GID\0GIDLIST", 16) ;
diff --git a/src/daemontools-extras/s6-envdir.c b/src/daemontools-extras/s6-envdir.c
index 394253e..431389b 100644
--- a/src/daemontools-extras/s6-envdir.c
+++ b/src/daemontools-extras/s6-envdir.c
@@ -19,7 +19,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
PROG = "s6-envdir" ;
for (;;)
{
- register int opt = subgetopt_r(argc, argv, "Iinfc:", &l) ;
+ int opt = subgetopt_r(argc, argv, "Iinfc:", &l) ;
if (opt == -1) break ;
switch (opt)
{
diff --git a/src/daemontools-extras/s6-envuidgid.c b/src/daemontools-extras/s6-envuidgid.c
index 365a862..d808219 100644
--- a/src/daemontools-extras/s6-envuidgid.c
+++ b/src/daemontools-extras/s6-envuidgid.c
@@ -1,24 +1,21 @@
/* ISC license. */
-#include <sys/types.h>
+#include <string.h>
#include <pwd.h>
#include <grp.h>
#include <limits.h>
-#include <skalibs/uint64.h>
-#include <skalibs/gidstuff.h>
-#include <skalibs/bytestr.h>
+#include <skalibs/types.h>
#include <skalibs/sgetopt.h>
#include <skalibs/strerr2.h>
#include <skalibs/env.h>
-#include <skalibs/fmtscan.h>
#include <skalibs/djbunix.h>
#define USAGE "s6-envuidgid [ -i | -D defaultuid:defaultgid ] [ -u | -g | -B ] [ -n ] account prog..."
#define dieusage() strerr_dieusage(100, USAGE)
-static inline size_t scan_defaults (char const *s, uint64 *uid, gid_t *gid, unsigned int *n, gid_t *tab)
+static inline size_t scan_defaults (char const *s, uid_t *uid, gid_t *gid, size_t *n, gid_t *tab)
{
- size_t pos = uint64_scan(s, uid) ;
+ size_t pos = uid_scan(s, uid) ;
if (!pos)
{
if (*s != ':') return 0 ;
@@ -54,16 +51,16 @@ int main (int argc, char *const *argv, char const *const *envp)
unsigned int what = 7 ;
int numfallback = 0 ;
int insist = 1 ;
- uint64 uid ;
+ uid_t uid ;
gid_t gid ;
- unsigned int n ;
+ size_t n ;
gid_t tab[NGROUPS_MAX] ;
PROG = "s6-envuidgid" ;
{
subgetopt_t l = SUBGETOPT_ZERO ;
for (;;)
{
- register int opt = subgetopt_r(argc, (char const *const *)argv, "ugBniD:", &l) ;
+ int opt = subgetopt_r(argc, (char const *const *)argv, "ugBniD:", &l) ;
if (opt == -1) break ;
switch (opt)
{
@@ -94,13 +91,13 @@ int main (int argc, char *const *argv, char const *const *envp)
break ;
case 3 : /* both */
{
- size_t pos = str_chr(argv[0], ':') ;
+ char *colon = strchr(argv[0], ':') ;
user = argv[0] ;
- if (argv[0][pos])
+ if (colon)
{
- argv[0][pos] = 0 ;
- group = argv[0] + pos + 1 ;
- if (!pos) user = 0 ;
+ *colon = 0 ;
+ group = colon + 1 ;
+ if (colon == argv[0]) user = 0 ;
if (!group[0]) group = 0 ;
}
break ;
@@ -131,28 +128,28 @@ int main (int argc, char *const *argv, char const *const *envp)
gid = pw->pw_gid ;
}
}
- else if (numfallback && uint64_scan(user, &uid)) ;
+ else if (numfallback && uid_scan(user, &uid)) ;
else if (insist) strerr_dief2x(1, "unknown user: ", user) ;
}
{
size_t pos = 0 ;
- char fmt[19 + UINT64_FMT + (NGROUPS_MAX+1) * GID_FMT] ;
+ char fmt[19 + UID_FMT + (NGROUPS_MAX+1) * GID_FMT] ;
if (what & 1)
{
- byte_copy(fmt + pos, 4, "UID=") ; pos += 4 ;
- pos += uint64_fmt(fmt + pos, uid) ;
+ memcpy(fmt + pos, "UID=", 4) ; pos += 4 ;
+ pos += uid_fmt(fmt + pos, uid) ;
fmt[pos++] = 0 ;
}
if (what & 2)
{
- byte_copy(fmt + pos, 4, "GID=") ; pos += 4 ;
+ memcpy(fmt + pos, "GID=", 4) ; pos += 4 ;
pos += gid_fmt(fmt + pos, gid) ;
fmt[pos++] = 0 ;
}
if (what & 4)
{
- byte_copy(fmt + pos, 8, "GIDLIST=") ; pos += 8 ;
+ memcpy(fmt + pos, "GIDLIST=", 8) ; pos += 8 ;
pos += gid_fmtlist(fmt + pos, tab, n) ;
fmt[pos++] = 0 ;
}
diff --git a/src/daemontools-extras/s6-fghack.c b/src/daemontools-extras/s6-fghack.c
index 1415706..5981b96 100644
--- a/src/daemontools-extras/s6-fghack.c
+++ b/src/daemontools-extras/s6-fghack.c
@@ -1,6 +1,5 @@
/* ISC license. */
-#include <sys/types.h>
#include <unistd.h>
#include <errno.h>
#include <sys/wait.h>
diff --git a/src/daemontools-extras/s6-log.c b/src/daemontools-extras/s6-log.c
index 0fdbf68..bdc0a82 100644
--- a/src/daemontools-extras/s6-log.c
+++ b/src/daemontools-extras/s6-log.c
@@ -1,17 +1,17 @@
/* ISC license. */
-#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
+#include <stdint.h>
+#include <string.h>
#include <errno.h>
#include <signal.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <regex.h>
-#include <skalibs/uint32.h>
#include <skalibs/uint64.h>
-#include <skalibs/uint.h>
+#include <skalibs/types.h>
#include <skalibs/allreadwrite.h>
#include <skalibs/buffer.h>
#include <skalibs/bytestr.h>
@@ -141,11 +141,11 @@ struct logdir_s
unsigned int xindex ;
tain_t retrytto ;
tain_t deadline ;
- uint64 maxdirsize ;
- uint32 b ;
- uint32 n ;
- uint32 s ;
- uint32 tolerance ;
+ uint64_t maxdirsize ;
+ uint32_t b ;
+ uint32_t n ;
+ uint32_t s ;
+ uint32_t tolerance ;
pid_t pid ;
char const *dir ;
char const *processor ;
@@ -188,13 +188,13 @@ static unsigned int llen = 0 ;
static int filesize_cmp (filesize_t const *a, filesize_t const *b)
{
- return byte_diff(a->name+1, 26, b->name+1) ;
+ return memcmp(a->name+1, b->name+1, 26) ;
}
static int name_is_relevant (char const *name)
{
tain_t dummy ;
- if (str_len(name) != 27) return 0 ;
+ if (strlen(name) != 27) return 0 ;
if (!timestamp_scan(name, &dummy)) return 0 ;
if (name[25] != '.') return 0 ;
if ((name[26] != 's') && (name[26] != 'u')) return 0 ;
@@ -216,7 +216,7 @@ static inline int logdir_trim (logdir_t *ldp)
}
if (errno)
{
- register int e = errno ;
+ int e = errno ;
dir_close(dir) ;
errno = e ;
return -1 ;
@@ -224,12 +224,12 @@ static inline int logdir_trim (logdir_t *ldp)
rewinddir(dir) ;
if (n)
{
- uint64 totalsize = 0 ;
- size_t dirlen = str_len(ldp->dir) ;
+ uint64_t totalsize = 0 ;
+ size_t dirlen = strlen(ldp->dir) ;
unsigned int i = 0 ;
filesize_t blurgh[n] ;
char fullname[dirlen + 29] ;
- byte_copy(fullname, dirlen, ldp->dir) ;
+ memcpy(fullname, ldp->dir, dirlen) ;
fullname[dirlen] = '/' ;
for (;;)
{
@@ -240,20 +240,20 @@ static inline int logdir_trim (logdir_t *ldp)
if (!d) break ;
if (!name_is_relevant(d->d_name)) continue ;
if (i >= n) { errno = EBUSY ; break ; }
- byte_copy(fullname + dirlen + 1, 28, d->d_name) ;
+ memcpy(fullname + dirlen + 1, d->d_name, 28) ;
if (stat(fullname, &st) < 0)
{
if (verbosity) strerr_warnwu2sys("stat ", fullname) ;
continue ;
}
- byte_copy(blurgh[i].name, 28, d->d_name) ;
+ memcpy(blurgh[i].name, d->d_name, 28) ;
blurgh[i].size = st.st_size ;
totalsize += st.st_size ;
i++ ;
}
if (errno)
{
- register int e = errno ;
+ int e = errno ;
dir_close(dir) ;
errno = e ;
return -1 ;
@@ -265,7 +265,7 @@ static inline int logdir_trim (logdir_t *ldp)
n = 0 ;
while ((i > ldp->n + n) || (ldp->maxdirsize && (totalsize > ldp->maxdirsize)))
{
- byte_copy(fullname + dirlen + 1, 28, blurgh[n].name) ;
+ memcpy(fullname + dirlen + 1, blurgh[n].name, 28) ;
if (unlink(fullname) < 0)
{
if (errno == ENOENT) totalsize -= blurgh[n].size ;
@@ -281,17 +281,17 @@ static inline int logdir_trim (logdir_t *ldp)
static int finish (logdir_t *ldp, char const *name, char suffix)
{
struct stat st ;
- size_t dirlen = str_len(ldp->dir) ;
- size_t namelen = str_len(name) ;
+ size_t dirlen = strlen(ldp->dir) ;
+ size_t namelen = strlen(name) ;
char x[dirlen + namelen + 2] ;
- byte_copy(x, dirlen, ldp->dir) ;
+ memcpy(x, ldp->dir, dirlen) ;
x[dirlen] = '/' ;
- byte_copy(x + dirlen + 1, namelen + 1, name) ;
+ memcpy(x + dirlen + 1, name, namelen + 1) ;
if (stat(x, &st) < 0) return errno == ENOENT ? 0 : -1 ;
if (st.st_nlink == 1)
{
char y[dirlen + 29] ;
- byte_copy(y, dirlen, ldp->dir) ;
+ memcpy(y, ldp->dir, dirlen) ;
y[dirlen] = '/' ;
timestamp_g(y + dirlen + 1) ;
y[dirlen + 26] = '.' ;
@@ -329,7 +329,7 @@ static inline void exec_processor (logdir_t *ldp)
static int rotator (logdir_t *ldp)
{
- size_t dirlen = str_len(ldp->dir) ;
+ size_t dirlen = strlen(ldp->dir) ;
switch (ldp->rstate)
{
case ROTSTATE_START :
@@ -344,10 +344,10 @@ static int rotator (logdir_t *ldp)
{
char current[dirlen + 9] ;
char previous[dirlen + 10] ;
- byte_copy(current, dirlen, ldp->dir) ;
- byte_copy(current + dirlen, 9, "/current") ;
- byte_copy(previous, dirlen, ldp->dir) ;
- byte_copy(previous + dirlen, 10, "/previous") ;
+ memcpy(current, ldp->dir, dirlen) ;
+ memcpy(current + dirlen, "/current", 9) ;
+ memcpy(previous, ldp->dir, dirlen) ;
+ memcpy(previous + dirlen, "/previous", 10) ;
if (rename(current, previous) < 0)
{
if (verbosity) strerr_warnwu4sys("rename ", current, " to ", previous) ;
@@ -359,8 +359,8 @@ static int rotator (logdir_t *ldp)
{
int fd ;
char x[dirlen + 9] ;
- byte_copy(x, dirlen, ldp->dir) ;
- byte_copy(x + dirlen, 9, "/current") ;
+ memcpy(x, ldp->dir, dirlen) ;
+ memcpy(x + dirlen, "/current", 9) ;
fd = open_append(x) ;
if (fd < 0)
{
@@ -369,7 +369,7 @@ static int rotator (logdir_t *ldp)
}
if (coe(fd) < 0)
{
- register int e = errno ;
+ int e = errno ;
fd_close(fd) ;
errno = e ;
if (verbosity) strerr_warnwu2sys("coe ", x) ;
@@ -377,7 +377,7 @@ static int rotator (logdir_t *ldp)
}
if (fd_chmod(fd, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH) < 0)
{
- register int e = errno ;
+ int e = errno ;
fd_close(fd) ;
errno = e ;
if (verbosity) strerr_warnwu3sys("fchmod ", x, " to 0644") ;
@@ -391,8 +391,8 @@ static int rotator (logdir_t *ldp)
case ROTSTATE_CHMODPREVIOUS :
{
char x[dirlen + 10] ;
- byte_copy(x, dirlen, ldp->dir) ;
- byte_copy(x + dirlen, 10, "/previous") ;
+ memcpy(x, ldp->dir, dirlen) ;
+ memcpy(x + dirlen, "/previous", 10) ;
if (chmod(x, S_IRWXU | S_IRGRP | S_IROTH) < 0)
{
if (verbosity) strerr_warnwu3sys("chmod ", x, " to 0744") ;
@@ -431,8 +431,8 @@ static int rotator (logdir_t *ldp)
{
int fd ;
char x[dirlen + 11] ;
- byte_copy(x, dirlen, ldp->dir) ;
- byte_copy(x + dirlen, 11, "/processed") ;
+ memcpy(x, ldp->dir, dirlen) ;
+ memcpy(x + dirlen, "/processed", 11) ;
fd = open_append(x) ;
if (fd < 0)
{
@@ -441,7 +441,7 @@ static int rotator (logdir_t *ldp)
}
if (fd_sync(fd) < 0)
{
- register int e = errno ;
+ int e = errno ;
fd_close(fd) ;
errno = e ;
if (verbosity) strerr_warnwu2sys("fd_sync ", x) ;
@@ -450,7 +450,7 @@ static int rotator (logdir_t *ldp)
tain_now_g() ;
if (fd_chmod(fd, S_IRWXU | S_IRGRP | S_IROTH) < 0)
{
- register int e = errno ;
+ int e = errno ;
fd_close(fd) ;
errno = e ;
if (verbosity) strerr_warnwu3sys("fd_chmod ", x, " to 0744") ;
@@ -463,8 +463,8 @@ static int rotator (logdir_t *ldp)
{
int fd ;
char x[dirlen + 10] ;
- byte_copy(x, dirlen, ldp->dir) ;
- byte_copy(x + dirlen, 10, "/newstate") ;
+ memcpy(x, ldp->dir, dirlen) ;
+ memcpy(x + dirlen, "/newstate", 10) ;
fd = open_append(x) ;
if (fd < 0)
{
@@ -483,8 +483,8 @@ static int rotator (logdir_t *ldp)
case ROTSTATE_UNLINKPREVIOUS :
{
char x[dirlen + 10] ;
- byte_copy(x, dirlen, ldp->dir) ;
- byte_copy(x + dirlen, 10, "/previous") ;
+ memcpy(x, ldp->dir, dirlen) ;
+ memcpy(x + dirlen, "/previous", 10) ;
if ((unlink(x) < 0) && (errno != ENOENT))
{
if (verbosity) strerr_warnwu2sys("open_append ", x) ;
@@ -496,10 +496,10 @@ static int rotator (logdir_t *ldp)
{
char newstate[dirlen + 10] ;
char state[dirlen + 7] ;
- byte_copy(newstate, dirlen, ldp->dir) ;
- byte_copy(state, dirlen, ldp->dir) ;
- byte_copy(newstate + dirlen, 10, "/newstate") ;
- byte_copy(state + dirlen, 7, "/state") ;
+ memcpy(newstate, ldp->dir, dirlen) ;
+ memcpy(state, ldp->dir, dirlen) ;
+ memcpy(newstate + dirlen, "/newstate", 10) ;
+ memcpy(state + dirlen, "/state", 7) ;
if (rename(newstate, state) < 0)
{
if (verbosity) strerr_warnwu4sys("rename ", newstate, " to ", state) ;
@@ -524,7 +524,7 @@ static int rotator (logdir_t *ldp)
return 0 ;
}
-static int logdir_write (int i, char const *s, size_t len)
+static ssize_t logdir_write (int i, char const *s, size_t len)
{
logdir_t *ldp = logdirs + i ;
ssize_t r ;
@@ -563,7 +563,7 @@ static inline void rotate_or_flush (logdir_t *ldp)
bufalloc_flush(&ldp->out) ;
}
-static inline void logdir_init (unsigned int index, uint32_t s, uint32_t n, uint32_t tolerance, uint64 maxdirsize, tain_t const *retrytto, char const *processor, char const *name, unsigned int flags)
+static inline void logdir_init (unsigned int index, uint32_t s, uint32_t n, uint32_t tolerance, uint64_t maxdirsize, tain_t const *retrytto, char const *processor, char const *name, unsigned int flags)
{
logdir_t *ldp = logdirs + index ;
struct stat st ;
@@ -583,25 +583,25 @@ static inline void logdir_init (unsigned int index, uint32_t s, uint32_t n, uint
ldp->rstate = ROTSTATE_WRITABLE ;
r = mkdir(ldp->dir, S_IRWXU | S_ISGID) ;
if ((r < 0) && (errno != EEXIST)) strerr_diefu2sys(111, "mkdir ", name) ;
- byte_copy(x, dirlen, name) ;
- byte_copy(x + dirlen, 6, "/lock") ;
+ memcpy(x, name, dirlen) ;
+ memcpy(x + dirlen, "/lock", 6) ;
ldp->fdlock = open_append(x) ;
if ((ldp->fdlock) < 0) strerr_diefu2sys(111, "open_append ", x) ;
if (lock_exnb(ldp->fdlock) < 0) strerr_diefu2sys(111, "lock_exnb ", x) ;
if (coe(ldp->fdlock) < 0) strerr_diefu2sys(111, "coe ", x) ;
- byte_copy(x + dirlen + 1, 8, "current") ;
+ memcpy(x + dirlen + 1, "current", 8) ;
if (stat(x, &st) < 0)
{
if (errno != ENOENT) strerr_diefu2sys(111, "stat ", x) ;
}
else if (st.st_mode & S_IXUSR) goto opencurrent ;
- byte_copy(x + dirlen + 1, 6, "state") ;
+ memcpy(x + dirlen + 1, "state", 6) ;
unlink(x) ;
- byte_copy(x + dirlen + 1, 9, "newstate") ;
+ memcpy(x + dirlen + 1, "newstate", 9) ;
unlink(x) ;
{
int flagprocessed = 0 ;
- byte_copy(x + dirlen + 1, 10, "processed") ;
+ memcpy(x + dirlen + 1, "processed", 10) ;
if (stat(x, &st) < 0)
{
if (errno != ENOENT) strerr_diefu2sys(111, "stat ", x) ;
@@ -609,7 +609,7 @@ static inline void logdir_init (unsigned int index, uint32_t s, uint32_t n, uint
else if (st.st_mode & S_IXUSR) flagprocessed = 1 ;
if (flagprocessed)
{
- byte_copy(x + dirlen + 1, 9, "previous") ;
+ memcpy(x + dirlen + 1, "previous", 9) ;
unlink(x) ;
if (finish(ldp, "processed", 's') < 0)
strerr_diefu2sys(111, "finish processed .s for logdir ", ldp->dir) ;
@@ -623,12 +623,12 @@ static inline void logdir_init (unsigned int index, uint32_t s, uint32_t n, uint
}
if (finish(ldp, "current", 'u') < 0)
strerr_diefu2sys(111, "finish current .u for logdir ", ldp->dir) ;
- byte_copy(x + dirlen + 1, 6, "state") ;
+ memcpy(x + dirlen + 1, "state", 6) ;
ldp->fd = open_trunc(x) ;
if (ldp->fd < 0) strerr_diefu2sys(111, "open_trunc ", x) ;
fd_close(ldp->fd) ;
st.st_size = 0 ;
- byte_copy(x + dirlen + 1, 8, "current") ;
+ memcpy(x + dirlen + 1, "current", 8) ;
opencurrent:
ldp->fd = open_append(x) ;
if (ldp->fd < 0) strerr_diefu2sys(111, "open_append ", x) ;
@@ -779,7 +779,7 @@ static inline void script_secondpass (char const *const *argv, scriptelem_t *scr
uint32_t s = 99999 ;
uint32_t n = 10 ;
uint32_t tolerance = 2000 ;
- uint64 maxdirsize = 0 ;
+ uint64_t maxdirsize = 0 ;
char const *processor = 0 ;
unsigned int sel = 0, act = 0, lidx = 0, flags = 0 ;
int flagacted = 0 ;
@@ -948,7 +948,7 @@ static void script_run (scriptelem_t const *script, unsigned int scriptlen, char
for (j = 0 ; j < script[i].actlen ; j++)
{
act_t const *act = script[i].acts + j ;
- siovec_t v[4] = { { .s = tstamp, .len = act->flags & 1 ? TIMESTAMP+1 : 0 }, { .s = hstamp, .len = act->flags & 2 ? hlen : 0 }, { .s = (char *)s, .len = len }, { .s = "\n", .len = 1 } } ;
+ struct iovec v[4] = { { .iov_base = tstamp, .iov_len = act->flags & 1 ? TIMESTAMP+1 : 0 }, { .iov_base = hstamp, .iov_len = act->flags & 2 ? hlen : 0 }, { .iov_base = (char *)s, .iov_len = len }, { .iov_base = "\n", .iov_len = 1 } } ;
switch (act->type)
{
case ACTTYPE_FD1 :
@@ -961,9 +961,9 @@ static void script_run (scriptelem_t const *script, unsigned int scriptlen, char
buffer_puts(buffer_2, ": alert: ") ;
if (act->data.fd2_size && act->data.fd2_size + 3 < len)
{
- v[2].len = act->data.fd2_size ;
- v[3].s = "...\n" ;
- v[3].len = 4 ;
+ v[2].iov_len = act->data.fd2_size ;
+ v[3].iov_base = "...\n" ;
+ v[3].iov_len = 4 ;
}
buffer_putv(buffer_2, v, 4) ;
buffer_flush(buffer_2) ; /* if it blocks, too bad */
@@ -977,10 +977,10 @@ static void script_run (scriptelem_t const *script, unsigned int scriptlen, char
siovec_trunc(v, 4, act->data.status.filelen) ;
else
{
- register size_t k = act->data.status.filelen - reallen + 1 ;
+ size_t k = act->data.status.filelen - reallen + 1 ;
char pad[k] ;
- v[3].s = pad ;
- v[3].len = k ;
+ v[3].iov_base = pad ;
+ v[3].iov_len = k ;
while (k--) pad[k] = '\n' ;
if (!openwritevnclose_suffix(act->data.status.file, v, 4, ".new") && verbosity)
strerr_warnwu2sys("write status file ", act->data.status.file) ;
@@ -1115,8 +1115,8 @@ static inline void handle_signals (void)
case 0 : return ;
case SIGALRM :
{
- register unsigned int i = 0 ;
- for (i = 0 ; i < llen ; i++)
+ unsigned int i = 0 ;
+ for (; i < llen ; i++)
if ((logdirs[i].rstate == ROTSTATE_WRITABLE) && logdirs[i].b)
{
logdirs[i].rstate = ROTSTATE_START ;
@@ -1135,8 +1135,8 @@ static inline void handle_signals (void)
for (;;)
{
int wstat ;
- register unsigned int i = 0 ;
- register pid_t r = wait_nohang(&wstat) ;
+ unsigned int i = 0 ;
+ pid_t r = wait_nohang(&wstat) ;
if (r <= 0) break ;
for (; i < llen ; i++) if (r == logdirs[i].pid) break ;
if (i < llen) processor_died(logdirs + i, wstat) ;
@@ -1161,7 +1161,7 @@ int main (int argc, char const *const *argv)
subgetopt_t l = SUBGETOPT_ZERO ;
for (;;)
{
- register int opt = subgetopt_r(argc, argv, "qvbptel:", &l) ;
+ int opt = subgetopt_r(argc, argv, "qvbptel:", &l) ;
if (opt == -1) break ;
switch (opt)
{
diff --git a/src/daemontools-extras/s6-setlock.c b/src/daemontools-extras/s6-setlock.c
index 27b6b23..a90bb13 100644
--- a/src/daemontools-extras/s6-setlock.c
+++ b/src/daemontools-extras/s6-setlock.c
@@ -1,13 +1,12 @@
/* ISC license. */
-#include <sys/types.h>
#include <unistd.h>
#include <errno.h>
#include <signal.h>
#include <skalibs/allreadwrite.h>
#include <skalibs/sgetopt.h>
#include <skalibs/strerr2.h>
-#include <skalibs/uint.h>
+#include <skalibs/types.h>
#include <skalibs/tai.h>
#include <skalibs/iopause.h>
#include <skalibs/djbunix.h>
@@ -28,7 +27,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
PROG = "s6-setlock" ;
for (;;)
{
- register int opt = subgetopt(argc, argv, "nNrwt:") ;
+ int opt = subgetopt(argc, argv, "nNrwt:") ;
if (opt == -1) break ;
switch (opt)
{
@@ -68,7 +67,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
for (;;)
{
ssize_t rr ;
- register int r = iopause_g(&x, 1, &deadline) ;
+ int r = iopause_g(&x, 1, &deadline) ;
if (r < 0) strerr_diefu1sys(111, "iopause") ;
if (!r)
{
diff --git a/src/daemontools-extras/s6-setsid.c b/src/daemontools-extras/s6-setsid.c
index 609b041..0e30559 100644
--- a/src/daemontools-extras/s6-setsid.c
+++ b/src/daemontools-extras/s6-setsid.c
@@ -2,7 +2,7 @@
#include <unistd.h>
#include <signal.h>
-#include <skalibs/uint.h>
+#include <skalibs/types.h>
#include <skalibs/sgetopt.h>
#include <skalibs/strerr2.h>
#include <skalibs/sig.h>
@@ -19,7 +19,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
subgetopt_t l = SUBGETOPT_ZERO ;
for (;;)
{
- register int opt = subgetopt_r(argc, argv, "sbfgiIqd:", &l) ;
+ int opt = subgetopt_r(argc, argv, "sbfgiIqd:", &l) ;
if (opt == -1) break ;
switch (opt)
{
diff --git a/src/daemontools-extras/s6-setuidgid.c b/src/daemontools-extras/s6-setuidgid.c
index 727696a..1893883 100644
--- a/src/daemontools-extras/s6-setuidgid.c
+++ b/src/daemontools-extras/s6-setuidgid.c
@@ -1,7 +1,6 @@
/* ISC license. */
-#include <sys/types.h>
-#include <skalibs/bytestr.h>
+#include <string.h>
#include <skalibs/strerr2.h>
#include <skalibs/djbunix.h>
#include <s6/config.h>
@@ -12,20 +11,20 @@
int main (int argc, char *const *argv, char const *const *envp)
{
char const *newargv[argc + 7] ;
- size_t pos ;
+ char *colon ;
unsigned int m = 0 ;
PROG = "s6-setuidgid" ;
if (argc < 3) dieusage() ;
argv++ ;
- pos = str_chr(argv[0], ':') ;
- if (argv[0][pos])
+ colon = strchr(argv[0], ':') ;
+ if (colon)
{
- argv[0][pos] = 0 ;
+ *colon = 0 ;
newargv[m++] = S6_BINPREFIX "s6-applyuidgid" ;
newargv[m++] = "-u" ;
newargv[m++] = argv[0] ;
newargv[m++] = "-g" ;
- newargv[m++] = argv[0] + pos + 1 ;
+ newargv[m++] = colon + 1 ;
newargv[m++] = "-G" ;
newargv[m++] = "" ;
argv++ ;
diff --git a/src/daemontools-extras/s6-softlimit.c b/src/daemontools-extras/s6-softlimit.c
index 6ddd779..7de9f3d 100644
--- a/src/daemontools-extras/s6-softlimit.c
+++ b/src/daemontools-extras/s6-softlimit.c
@@ -30,7 +30,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
PROG = "s6-softlimit" ;
for (;;)
{
- register int opt = subgetopt_r(argc, argv, "a:c:d:f:l:m:o:p:r:s:t:", &l) ;
+ int opt = subgetopt_r(argc, argv, "a:c:d:f:l:m:o:p:r:s:t:", &l) ;
if (opt == -1) break ;
switch (opt)
{
diff --git a/src/daemontools-extras/s6-tai64n.c b/src/daemontools-extras/s6-tai64n.c
index 085c053..c6b2859 100644
--- a/src/daemontools-extras/s6-tai64n.c
+++ b/src/daemontools-extras/s6-tai64n.c
@@ -1,5 +1,6 @@
/* ISC license. */
+#include <sys/types.h>
#include <errno.h>
#include <skalibs/buffer.h>
#include <skalibs/strerr2.h>
@@ -14,7 +15,7 @@ int main (void)
stamp[TIMESTAMP] = ' ' ;
for (;;)
{
- register int r = skagetln(buffer_0f1, &satmp, '\n') ;
+ int r = skagetln(buffer_0f1, &satmp, '\n') ;
if (r < 0)
if (errno != EPIPE)
strerr_diefu1sys(111, "read from stdin") ;
@@ -26,8 +27,8 @@ int main (void)
}
else if (!r) break ;
timestamp(stamp) ;
- if ((buffer_put(buffer_1, stamp, TIMESTAMP+1) < 0)
- || (buffer_put(buffer_1, satmp.s, satmp.len) < 0))
+ if ((buffer_put(buffer_1, stamp, TIMESTAMP+1) < TIMESTAMP+1)
+ || (buffer_put(buffer_1, satmp.s, satmp.len) < (ssize_t)satmp.len))
strerr_diefu1sys(111, "write to stdout") ;
satmp.len = 0 ;
}
diff --git a/src/daemontools-extras/s6-tai64nlocal.c b/src/daemontools-extras/s6-tai64nlocal.c
index 84e717a..ce97470 100644
--- a/src/daemontools-extras/s6-tai64nlocal.c
+++ b/src/daemontools-extras/s6-tai64nlocal.c
@@ -2,8 +2,6 @@
#include <sys/types.h>
#include <errno.h>
-#include <skalibs/allreadwrite.h>
-#include <skalibs/fmtscan.h>
#include <skalibs/buffer.h>
#include <skalibs/strerr2.h>
#include <skalibs/tai.h>
@@ -34,11 +32,11 @@ int main (void)
size_t len ;
localtmn_from_tain(&local, &a, 1) ;
len = localtmn_fmt(fmt, &local) ;
- if (buffer_put(buffer_1, fmt, len) < 0)
+ if (buffer_put(buffer_1, fmt, len) < (ssize_t)len)
strerr_diefu1sys(111, "write to stdout") ;
}
}
- if (buffer_put(buffer_1, satmp.s + p, satmp.len - p) < 0)
+ if (buffer_put(buffer_1, satmp.s + p, satmp.len - p) < (ssize_t)(satmp.len - p))
strerr_diefu1sys(111, "write to stdout") ;
satmp.len = 0 ;
}
diff --git a/src/daemontools-extras/ucspilogd.c b/src/daemontools-extras/ucspilogd.c
index 1f338bd..25e8371 100644
--- a/src/daemontools-extras/ucspilogd.c
+++ b/src/daemontools-extras/ucspilogd.c
@@ -10,7 +10,7 @@
#include <errno.h>
#include <stdlib.h>
#include <syslog.h>
-#include <skalibs/uint.h>
+#include <skalibs/types.h>
#include <skalibs/sgetopt.h>
#include <skalibs/bytestr.h>
#include <skalibs/buffer.h>
@@ -138,7 +138,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
subgetopt_t l = SUBGETOPT_ZERO ;
for (;;)
{
- register int opt = subgetopt_r(argc, argv, "D:", &l) ;
+ int opt = subgetopt_r(argc, argv, "D:", &l) ;
if (opt == -1) break ;
switch (opt)
{
@@ -162,7 +162,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
size_t pos = 0 ;
satmp.len = 0 ;
{
- register int r = skagetlnsep(buffer_0f1, &satmp, "\n", 2) ;
+ int r = skagetlnsep(buffer_0f1, &satmp, "\n", 2) ;
if (r < 0)
{
if (errno != EPIPE || !stralloc_0(&satmp))
@@ -181,7 +181,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
if ((buffer_puts(buffer_1, envs[i]) < 0)
|| (buffer_put(buffer_1, ": ", 2) < 2)) die() ;
pos += syslog_names(satmp.s + pos) ;
- if (buffer_put(buffer_1, satmp.s + pos, satmp.len - pos) < (int)(satmp.len - pos)) die() ;
+ if (buffer_put(buffer_1, satmp.s + pos, satmp.len - pos) < (ssize_t)(satmp.len - pos)) die() ;
}
}
return 0 ;
diff --git a/src/fdholder/s6-fdholder-daemon.c b/src/fdholder/s6-fdholder-daemon.c
index 0a706da..0a0f019 100644
--- a/src/fdholder/s6-fdholder-daemon.c
+++ b/src/fdholder/s6-fdholder-daemon.c
@@ -2,8 +2,7 @@
#include <sys/types.h>
#include <limits.h>
-#include <skalibs/uint.h>
-#include <skalibs/gidstuff.h>
+#include <skalibs/types.h>
#include <skalibs/sgetopt.h>
#include <skalibs/strerr2.h>
#include <skalibs/djbunix.h>
@@ -20,7 +19,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
int flagreuse = 1 ;
unsigned int uid = 0, gid = 0 ;
gid_t gids[NGROUPS_MAX] ;
- unsigned int gidn = (unsigned int)-1 ;
+ size_t gidn = (size_t)-1 ;
unsigned int maxconn = 0 ;
unsigned int maxfds = 0 ;
unsigned int backlog = (unsigned int)-1 ;
@@ -33,7 +32,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
subgetopt_t l = SUBGETOPT_ZERO ;
for (;;)
{
- register int opt = subgetopt_r(argc, argv, "Dd1Uv:c:n:b:u:g:G:t:T:i:x:", &l) ;
+ int opt = subgetopt_r(argc, argv, "Dd1Uv:c:n:b:u:g:G:t:T:i:x:", &l) ;
if (opt == -1) break ;
switch (opt)
{
@@ -47,7 +46,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
case 'u' : if (!uint0_scan(l.arg, &uid)) dieusage() ; break ;
case 'g' : if (!uint0_scan(l.arg, &gid)) dieusage() ; break ;
case 'G' : if (!gid_scanlist(gids, NGROUPS_MAX, l.arg, &gidn) && *l.arg) dieusage() ; break ;
- case 'U' : flagU = 1 ; uid = 0 ; gid = 0 ; gidn = (unsigned int)-1 ; break ;
+ case 'U' : flagU = 1 ; uid = 0 ; gid = 0 ; gidn = (size_t)-1 ; break ;
case 't' : if (!uint0_scan(l.arg, &timeout)) dieusage() ; break ;
case 'T' : if (!uint0_scan(l.arg, &ltimeout)) dieusage() ; break ;
case 'i' : rulesdir = l.arg ; rulesfile = 0 ; break ;
@@ -76,7 +75,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
}
newargv[m++] = "--" ;
newargv[m++] = *argv++ ;
- if (flagU || uid || gid || gidn != (unsigned int)-1)
+ if (flagU || uid || gid || gidn != (size_t)-1)
{
newargv[m++] = S6_BINPREFIX "s6-applyuidgid" ;
if (flagU) newargv[m++] = "-Uz" ;
@@ -94,7 +93,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
pos += uint_fmt(fmt + pos, gid) ;
fmt[pos++] = 0 ;
}
- if (gidn != (unsigned int)-1)
+ if (gidn != (size_t)-1)
{
newargv[m++] = "-G" ;
newargv[m++] = fmt + pos ;
diff --git a/src/fdholder/s6-fdholder-delete.c b/src/fdholder/s6-fdholder-delete.c
index 7742148..94e658b 100644
--- a/src/fdholder/s6-fdholder-delete.c
+++ b/src/fdholder/s6-fdholder-delete.c
@@ -1,6 +1,6 @@
/* ISC license. */
-#include <skalibs/uint.h>
+#include <skalibs/types.h>
#include <skalibs/sgetopt.h>
#include <skalibs/strerr2.h>
#include <skalibs/djbunix.h>
@@ -20,7 +20,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
subgetopt_t l = SUBGETOPT_ZERO ;
for (;;)
{
- register int opt = subgetopt_r(argc, argv, "t:", &l) ;
+ int opt = subgetopt_r(argc, argv, "t:", &l) ;
if (opt == -1) break ;
switch (opt)
{
diff --git a/src/fdholder/s6-fdholder-deletec.c b/src/fdholder/s6-fdholder-deletec.c
index 5f7dfa4..2b9820e 100644
--- a/src/fdholder/s6-fdholder-deletec.c
+++ b/src/fdholder/s6-fdholder-deletec.c
@@ -1,6 +1,6 @@
/* ISC license. */
-#include <skalibs/uint.h>
+#include <skalibs/types.h>
#include <skalibs/strerr2.h>
#include <skalibs/sgetopt.h>
#include <skalibs/tai.h>
@@ -19,7 +19,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
subgetopt_t l = SUBGETOPT_ZERO ;
for (;;)
{
- register int opt = subgetopt_r(argc, argv, "t:", &l) ;
+ int opt = subgetopt_r(argc, argv, "t:", &l) ;
if (opt == -1) break ;
switch (opt)
{
diff --git a/src/fdholder/s6-fdholder-getdump.c b/src/fdholder/s6-fdholder-getdump.c
index 7ac88a2..bb359dc 100644
--- a/src/fdholder/s6-fdholder-getdump.c
+++ b/src/fdholder/s6-fdholder-getdump.c
@@ -1,6 +1,6 @@
/* ISC license. */
-#include <skalibs/uint.h>
+#include <skalibs/types.h>
#include <skalibs/sgetopt.h>
#include <skalibs/strerr2.h>
#include <skalibs/djbunix.h>
@@ -18,7 +18,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
subgetopt_t l = SUBGETOPT_ZERO ;
for (;;)
{
- register int opt = subgetopt_r(argc, argv, "t:", &l) ;
+ int opt = subgetopt_r(argc, argv, "t:", &l) ;
if (opt == -1) break ;
switch (opt)
{
diff --git a/src/fdholder/s6-fdholder-getdumpc.c b/src/fdholder/s6-fdholder-getdumpc.c
index 41ad5c5..73be61b 100644
--- a/src/fdholder/s6-fdholder-getdumpc.c
+++ b/src/fdholder/s6-fdholder-getdumpc.c
@@ -1,9 +1,8 @@
/* ISC license. */
-#include <sys/types.h>
+#include <string.h>
#include <limits.h>
-#include <skalibs/uint.h>
-#include <skalibs/bytestr.h>
+#include <skalibs/types.h>
#include <skalibs/strerr2.h>
#include <skalibs/sgetopt.h>
#include <skalibs/tai.h>
@@ -25,7 +24,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
subgetopt_t l = SUBGETOPT_ZERO ;
for (;;)
{
- register int opt = subgetopt_r(argc, argv, "t:", &l) ;
+ int opt = subgetopt_r(argc, argv, "t:", &l) ;
if (opt == -1) break ;
switch (opt)
{
@@ -53,25 +52,25 @@ int main (int argc, char const *const *argv, char const *const *envp)
unsigned int i = 0 ;
char modifs[7 + UINT_FMT + (25 + TIMESTAMP + 4 * UINT_FMT) * n] ;
if (n > UINT_MAX) strerr_dief1x(100, "dump exceeds maximum size") ;
- byte_copy(modifs + pos, 7, "S6_FD#=") ; pos += 7 ;
+ memcpy(modifs + pos, "S6_FD#=", 7) ; pos += 7 ;
pos += uint_fmt(modifs + pos, n) ;
modifs[pos++] = 0 ;
for (; i < n ; i++)
{
s6_fdholder_fd_t *p = genalloc_s(s6_fdholder_fd_t, &dump) + i ;
- size_t len = str_len(p->id) + 1 ;
+ size_t len = strlen(p->id) + 1 ;
if (uncoe(p->fd) < 0) strerr_diefu1sys(111, "uncoe") ;
- byte_copy(modifs + pos, 6, "S6_FD_") ; pos += 6 ;
+ memcpy(modifs + pos, "S6_FD_", 6) ; pos += 6 ;
pos += uint_fmt(modifs + pos, i) ;
modifs[pos++] = '=' ;
pos += uint_fmt(modifs + pos, p->fd) ;
modifs[pos++] = 0 ;
- byte_copy(modifs + pos, 8, "S6_FDID_") ; pos += 8 ;
+ memcpy(modifs + pos, "S6_FDID_", 8) ; pos += 8 ;
pos += uint_fmt(modifs + pos, i) ;
modifs[pos++] = '=' ;
- byte_copy(modifs + pos, len, p->id) ;
+ memcpy(modifs + pos, p->id, len) ;
pos += len ;
- byte_copy(modifs + pos, 11, "S6_FDLIMIT_") ; pos += 11 ;
+ memcpy(modifs + pos, "S6_FDLIMIT_", 11) ; pos += 11 ;
pos += uint_fmt(modifs + pos, i) ;
if (tain_less(&p->limit, &halfinfinite))
{
diff --git a/src/fdholder/s6-fdholder-list.c b/src/fdholder/s6-fdholder-list.c
index 2c6f73e..43f9ec8 100644
--- a/src/fdholder/s6-fdholder-list.c
+++ b/src/fdholder/s6-fdholder-list.c
@@ -1,6 +1,6 @@
/* ISC license. */
-#include <skalibs/uint.h>
+#include <skalibs/types.h>
#include <skalibs/sgetopt.h>
#include <skalibs/strerr2.h>
#include <skalibs/djbunix.h>
@@ -21,7 +21,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
subgetopt_t l = SUBGETOPT_ZERO ;
for (;;)
{
- register int opt = subgetopt_r(argc, argv, "d:t:T:", &l) ;
+ int opt = subgetopt_r(argc, argv, "d:t:T:", &l) ;
if (opt == -1) break ;
switch (opt)
{
diff --git a/src/fdholder/s6-fdholder-listc.c b/src/fdholder/s6-fdholder-listc.c
index 7bc2d1d..8c746c3 100644
--- a/src/fdholder/s6-fdholder-listc.c
+++ b/src/fdholder/s6-fdholder-listc.c
@@ -1,8 +1,7 @@
/* ISC license. */
-#include <sys/types.h>
-#include <skalibs/uint.h>
-#include <skalibs/bytestr.h>
+#include <string.h>
+#include <skalibs/types.h>
#include <skalibs/buffer.h>
#include <skalibs/strerr2.h>
#include <skalibs/sgetopt.h>
@@ -27,7 +26,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
subgetopt_t l = SUBGETOPT_ZERO ;
for (;;)
{
- register int opt = subgetopt_r(argc, argv, "t:", &l) ;
+ int opt = subgetopt_r(argc, argv, "t:", &l) ;
if (opt == -1) break ;
switch (opt)
{
@@ -47,7 +46,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
if (n < 0) strerr_diefu1sys(1, "get fd list") ;
while (n--)
{
- register size_t len = str_len(sa.s + pos) ;
+ size_t len = strlen(sa.s + pos) ;
sb.len = 0 ;
if (!string_quote_nodelim_mustquote(&sb, sa.s + pos, len, 0, 0))
strerr_diefu1sys(111, "quote string") ;
diff --git a/src/fdholder/s6-fdholder-retrieve.c b/src/fdholder/s6-fdholder-retrieve.c
index 3622580..5c76f6e 100644
--- a/src/fdholder/s6-fdholder-retrieve.c
+++ b/src/fdholder/s6-fdholder-retrieve.c
@@ -1,6 +1,6 @@
/* ISC license. */
-#include <skalibs/uint.h>
+#include <skalibs/types.h>
#include <skalibs/sgetopt.h>
#include <skalibs/strerr2.h>
#include <skalibs/djbunix.h>
@@ -19,7 +19,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
subgetopt_t l = SUBGETOPT_ZERO ;
for (;;)
{
- register int opt = subgetopt_r(argc, argv, "Dt:", &l) ;
+ int opt = subgetopt_r(argc, argv, "Dt:", &l) ;
if (opt == -1) break ;
switch (opt)
{
diff --git a/src/fdholder/s6-fdholder-retrievec.c b/src/fdholder/s6-fdholder-retrievec.c
index 8b86bc4..a74c118 100644
--- a/src/fdholder/s6-fdholder-retrievec.c
+++ b/src/fdholder/s6-fdholder-retrievec.c
@@ -1,6 +1,6 @@
/* ISC license. */
-#include <skalibs/uint.h>
+#include <skalibs/types.h>
#include <skalibs/strerr2.h>
#include <skalibs/sgetopt.h>
#include <skalibs/tai.h>
@@ -22,7 +22,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
subgetopt_t l = SUBGETOPT_ZERO ;
for (;;)
{
- register int opt = subgetopt_r(argc, argv, "Dt:", &l) ;
+ int opt = subgetopt_r(argc, argv, "Dt:", &l) ;
if (opt == -1) break ;
switch (opt)
{
diff --git a/src/fdholder/s6-fdholder-setdump.c b/src/fdholder/s6-fdholder-setdump.c
index 72be5f7..fac1381 100644
--- a/src/fdholder/s6-fdholder-setdump.c
+++ b/src/fdholder/s6-fdholder-setdump.c
@@ -1,6 +1,6 @@
/* ISC license. */
-#include <skalibs/uint.h>
+#include <skalibs/types.h>
#include <skalibs/sgetopt.h>
#include <skalibs/strerr2.h>
#include <skalibs/djbunix.h>
@@ -20,7 +20,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
subgetopt_t l = SUBGETOPT_ZERO ;
for (;;)
{
- register int opt = subgetopt_r(argc, argv, "t:", &l) ;
+ int opt = subgetopt_r(argc, argv, "t:", &l) ;
if (opt == -1) break ;
switch (opt)
{
diff --git a/src/fdholder/s6-fdholder-setdumpc.c b/src/fdholder/s6-fdholder-setdumpc.c
index 5c80fd7..ff01384 100644
--- a/src/fdholder/s6-fdholder-setdumpc.c
+++ b/src/fdholder/s6-fdholder-setdumpc.c
@@ -1,8 +1,7 @@
/* ISC license. */
-#include <sys/types.h>
-#include <skalibs/uint.h>
-#include <skalibs/bytestr.h>
+#include <string.h>
+#include <skalibs/types.h>
#include <skalibs/env.h>
#include <skalibs/strerr2.h>
#include <skalibs/sgetopt.h>
@@ -24,7 +23,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
subgetopt_t l = SUBGETOPT_ZERO ;
for (;;)
{
- register int opt = subgetopt_r(argc, argv, "t:", &l) ;
+ int opt = subgetopt_r(argc, argv, "t:", &l) ;
if (opt == -1) break ;
switch (opt)
{
@@ -52,20 +51,20 @@ int main (int argc, char const *const *argv, char const *const *envp)
{
size_t len ;
unsigned int fd ;
- byte_copy(s, 6, "S6_FD_") ;
+ memcpy(s, "S6_FD_", 6) ;
s[6 + uint_fmt(s+6, i)] = 0 ;
x = env_get2(envp, s) ;
if (!x) strerr_dienotset(100, s) ;
if (!uint0_scan(x, &fd)) strerr_dieinvalid(100, s) ;
dump[i].fd = fd ;
- byte_copy(s, 8, "S6_FDID_") ;
+ memcpy(s, "S6_FDID_", 8) ;
s[8 + uint_fmt(s+8, i)] = 0 ;
x = env_get2(envp, s) ;
if (!x) strerr_dienotset(100, s) ;
- len = str_len(x) ;
+ len = strlen(x) ;
if (!len || len > S6_FDHOLDER_ID_SIZE) strerr_dieinvalid(100, s) ;
- byte_copy(dump[i].id, len+1, x) ;
- byte_copy(s, 11, "S6_FDLIMIT_") ;
+ memcpy(dump[i].id, x, len+1) ;
+ memcpy(s, "S6_FDLIMIT_", 11) ;
s[11 + uint_fmt(s+11, i)] = 0 ;
x = env_get2(envp, s) ;
if (!x) tain_add_g(&dump[i].limit, &tain_infinite_relative) ;
diff --git a/src/fdholder/s6-fdholder-store.c b/src/fdholder/s6-fdholder-store.c
index 76faa88..9dcef8a 100644
--- a/src/fdholder/s6-fdholder-store.c
+++ b/src/fdholder/s6-fdholder-store.c
@@ -1,6 +1,6 @@
/* ISC license. */
-#include <skalibs/uint.h>
+#include <skalibs/types.h>
#include <skalibs/sgetopt.h>
#include <skalibs/strerr2.h>
#include <skalibs/djbunix.h>
@@ -22,7 +22,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
subgetopt_t l = SUBGETOPT_ZERO ;
for (;;)
{
- register int opt = subgetopt_r(argc, argv, "d:t:T:", &l) ;
+ int opt = subgetopt_r(argc, argv, "d:t:T:", &l) ;
if (opt == -1) break ;
switch (opt)
{
diff --git a/src/fdholder/s6-fdholder-storec.c b/src/fdholder/s6-fdholder-storec.c
index eeb0ed8..32af82c 100644
--- a/src/fdholder/s6-fdholder-storec.c
+++ b/src/fdholder/s6-fdholder-storec.c
@@ -1,6 +1,6 @@
/* ISC license. */
-#include <skalibs/uint.h>
+#include <skalibs/types.h>
#include <skalibs/strerr2.h>
#include <skalibs/sgetopt.h>
#include <skalibs/tai.h>
@@ -19,7 +19,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
subgetopt_t l = SUBGETOPT_ZERO ;
for (;;)
{
- register int opt = subgetopt_r(argc, argv, "t:T:", &l) ;
+ int opt = subgetopt_r(argc, argv, "t:T:", &l) ;
if (opt == -1) break ;
switch (opt)
{
diff --git a/src/fdholder/s6-fdholder-transferdump.c b/src/fdholder/s6-fdholder-transferdump.c
index 5d6ccd0..1f02e90 100644
--- a/src/fdholder/s6-fdholder-transferdump.c
+++ b/src/fdholder/s6-fdholder-transferdump.c
@@ -1,7 +1,7 @@
/* ISC license. */
#include <sys/types.h>
-#include <skalibs/uint.h>
+#include <skalibs/types.h>
#include <skalibs/sgetopt.h>
#include <skalibs/env.h>
#include <skalibs/strerr2.h>
@@ -24,7 +24,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
subgetopt_t l = SUBGETOPT_ZERO ;
for (;;)
{
- register int opt = subgetopt_r(argc, argv, "t:", &l) ;
+ int opt = subgetopt_r(argc, argv, "t:", &l) ;
if (opt == -1) break ;
switch (opt)
{
diff --git a/src/fdholder/s6-fdholder-transferdumpc.c b/src/fdholder/s6-fdholder-transferdumpc.c
index b5be170..9b53fac 100644
--- a/src/fdholder/s6-fdholder-transferdumpc.c
+++ b/src/fdholder/s6-fdholder-transferdumpc.c
@@ -1,6 +1,6 @@
/* ISC license. */
-#include <skalibs/uint.h>
+#include <skalibs/types.h>
#include <skalibs/strerr2.h>
#include <skalibs/sgetopt.h>
#include <skalibs/tai.h>
@@ -21,7 +21,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
subgetopt_t l = SUBGETOPT_ZERO ;
for (;;)
{
- register int opt = subgetopt_r(argc, argv, "t:T:", &l) ;
+ int opt = subgetopt_r(argc, argv, "t:T:", &l) ;
if (opt == -1) break ;
switch (opt)
{
diff --git a/src/fdholder/s6-fdholderd.c b/src/fdholder/s6-fdholderd.c
index 001108a..37ca961 100644
--- a/src/fdholder/s6-fdholderd.c
+++ b/src/fdholder/s6-fdholderd.c
@@ -1,15 +1,15 @@
/* ISC license. */
-#include <sys/types.h>
+#include <sys/uio.h>
#include <sys/stat.h>
#include <sys/resource.h>
+#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <signal.h>
#include <regex.h>
-#include <skalibs/uint32.h>
-#include <skalibs/uint.h>
+#include <skalibs/types.h>
#include <skalibs/allreadwrite.h>
#include <skalibs/sgetopt.h>
#include <skalibs/env.h>
@@ -21,7 +21,6 @@
#include <skalibs/sig.h>
#include <skalibs/iopause.h>
#include <skalibs/selfpipe.h>
-#include <skalibs/siovec.h>
#include <skalibs/cdb.h>
#include <skalibs/getpeereid.h>
#include <skalibs/webipc.h>
@@ -102,7 +101,7 @@ static void *fds_id_dtok (unsigned int d, void *x)
static int fds_id_cmp (void const *a, void const *b, void *x)
{
(void)x ;
- return str_diff((char const *)a, (char const *)b) ;
+ return strcmp((char const *)a, (char const *)b) ;
}
static void *fds_deadline_dtok (unsigned int d, void *x)
@@ -113,8 +112,8 @@ static void *fds_deadline_dtok (unsigned int d, void *x)
static int fds_deadline_cmp (void const *a, void const *b, void *x)
{
- register tain_t const *aa = (tain_t const *)a ;
- register tain_t const *bb = (tain_t const *)b ;
+ tain_t const *aa = (tain_t const *)a ;
+ tain_t const *bb = (tain_t const *)b ;
(void)x ;
return tain_less(aa, bb) ? -1 : tain_less(bb, aa) ;
}
@@ -163,7 +162,7 @@ static inline void client_free (client_t *c)
static inline void client_delete (unsigned int cc, unsigned int prev)
{
- register client_t *c = CLIENT(cc) ;
+ client_t *c = CLIENT(cc) ;
CLIENT(prev)->next = c->next ;
client_free(c) ;
genset_delete(clients, cc) ;
@@ -186,7 +185,7 @@ static void client_setdeadline (client_t *c)
static inline int client_prepare_iopause (unsigned int i, tain_t *deadline, iopause_fd *x, unsigned int *j)
{
- register client_t *c = CLIENT(i) ;
+ client_t *c = CLIENT(i) ;
if (tain_less(&c->deadline, deadline)) *deadline = c->deadline ;
if (!unixmessage_sender_isempty(&c->connection.out) || !unixmessage_receiver_isempty(&c->connection.in) || (cont && !unixmessage_receiver_isfull(&c->connection.in)))
{
@@ -217,7 +216,7 @@ static inline void client_add (unsigned int *cc, int fd, regex_t const *rre, reg
static inline int client_flush (unsigned int i, iopause_fd const *x)
{
- register client_t *c = CLIENT(i) ;
+ client_t *c = CLIENT(i) ;
if (c->xindex && (x[c->xindex].revents & IOPAUSE_WRITE))
{
if (unixconnection_flush(&c->connection))
@@ -261,8 +260,8 @@ static int do_store (unsigned int cc, unixmessage_t const *m)
if (!answer(c, 0)) return 0 ;
pp = genset_new(fdstore) ; p = FD(pp) ;
tain_unpack(m->s, &p->limit) ; p->fd = m->fds[0] ;
- byte_copy(p->id, idlen, m->s + TAIN_PACK + 1) ;
- byte_zero(p->id + idlen, S6_FDHOLDER_ID_SIZE + 1 - idlen) ;
+ memcpy(p->id, m->s + TAIN_PACK + 1, idlen) ;
+ memset(p->id + idlen, 0, S6_FDHOLDER_ID_SIZE + 1 - idlen) ;
for (;;)
{
unsigned int dummy ;
@@ -308,24 +307,24 @@ static int do_retrieve (unsigned int cc, unixmessage_t const *m)
static int fill_siovec_with_ids_iter (char *thing, void *data)
{
- siovec_t *v = (*(siovec_t **)data)++ ;
+ struct iovec *v = (*(struct iovec **)data)++ ;
s6_fdholder_fd_t *p = (s6_fdholder_fd_t *)thing ;
- v->s = p->id ;
- v->len = str_len(p->id) + 1 ;
+ v->iov_base = p->id ;
+ v->iov_len = strlen(p->id) + 1 ;
return 1 ;
}
static int do_list (unsigned int cc, unixmessage_t const *m)
{
client_t *c = CLIENT(cc) ;
- siovec_t v[numfds] ;
+ struct iovec v[numfds] ;
unixmessage_v_t ans = { .v = v, .vlen = 1+numfds, .fds = 0, .nfds = 0 } ;
- siovec_t *vp = v + 1 ;
+ struct iovec *vp = v + 1 ;
char pack[5] = "" ;
if (c->dumping || m->len || m->nfds) return (errno = EPROTO, 0) ;
if (!(c->flags & 4)) return answer(c, EPERM) ;
uint32_pack_big(pack + 1, (uint32_t)numfds) ;
- v[0].s = pack ; v[0].len = 5 ;
+ v[0].iov_base = pack ; v[0].iov_len = 5 ;
genset_iter(fdstore, &fill_siovec_with_ids_iter, &vp) ;
if (!unixmessage_putv(&c->connection.out, &ans)) return answer(c, errno) ;
client_setdeadline(c) ;
@@ -335,7 +334,7 @@ static int do_list (unsigned int cc, unixmessage_t const *m)
typedef struct getdumpiter_s getdumpiter_t, *getdumpiter_t_ref ;
struct getdumpiter_s
{
- siovec_t *v ;
+ struct iovec *v ;
int *fd ;
char *limit ;
} ;
@@ -344,11 +343,11 @@ static int getdump_iter (char *thing, void *stuff)
{
s6_fdholder_fd_t *p = (s6_fdholder_fd_t *)thing ;
getdumpiter_t *blah = stuff ;
- unsigned char len = str_len(p->id) ;
+ unsigned char len = strlen(p->id) ;
tain_pack(blah->limit, &p->limit) ;
blah->limit[TAIN_PACK] = (unsigned char)len ;
- blah->v->s = p->id ;
- blah->v->len = len + 1 ;
+ blah->v->iov_base = p->id ;
+ blah->v->iov_len = len + 1 ;
*blah->fd++ = p->fd ;
blah->v += 2 ;
blah->limit += TAIN_PACK + 1 ;
@@ -372,13 +371,13 @@ static int do_getdump (unsigned int cc, unixmessage_t const *m)
{
unsigned int i = 0 ;
unixmessage_v_t ans[n] ;
- siovec_t v[numfds << 1] ;
+ struct iovec v[numfds << 1] ;
int fds[numfds] ;
char limits[(TAIN_PACK+1) * numfds] ;
for (; i < numfds ; i++)
{
- v[i<<1].s = limits + i * (TAIN_PACK+1) ;
- v[i<<1].len = TAIN_PACK+1 ;
+ v[i<<1].iov_base = limits + i * (TAIN_PACK+1) ;
+ v[i<<1].iov_len = TAIN_PACK+1 ;
}
{
getdumpiter_t state = { .v = v+1, .fd = fds, .limit = limits } ;
@@ -458,7 +457,7 @@ static int do_setdump_data (unsigned int cc, unixmessage_t const *m)
indices[i] = genset_new(fdstore) ;
p = FD(indices[i]) ;
tain_unpack(s, &p->limit) ;
- byte_copy(p->id, idlen+1, s + TAIN_PACK + 1) ;
+ memcpy(p->id, s + TAIN_PACK + 1, idlen+1) ;
p->fd = m->fds[i] ;
if (avltreen_search(fds_by_id, p->id, &oldid)) fds_close_and_delete(oldid) ;
avltreen_insert(fds_by_id, indices[i]) ;
@@ -514,7 +513,7 @@ static inline int parse_protocol (unixmessage_t const *m, void *p)
static inline int client_read (unsigned int cc, iopause_fd const *x)
{
- register client_t *c = CLIENT(cc) ;
+ client_t *c = CLIENT(cc) ;
return !unixmessage_receiver_isempty(&c->connection.in) || (c->xindex && (x[c->xindex].revents & IOPAUSE_READ)) ?
unixmessage_handle(&c->connection.in, &parse_protocol, &cc) > 0 : 1 ;
}
@@ -524,7 +523,7 @@ static inline int client_read (unsigned int cc, iopause_fd const *x)
static int makere (regex_t *re, char const *s, char const *var)
{
- register size_t varlen = str_len(var) ;
+ size_t varlen = strlen(var) ;
if (str_start(s, var) && (s[varlen] == '='))
{
int r = regcomp(re, s + varlen + 1, REG_EXTENDED | REG_NOSUB) ;
@@ -617,10 +616,10 @@ static inline int new_connection (int fd, regex_t *rre, regex_t *wre, unsigned i
}
if (params.exec.len && verbosity)
{
- char fmtuid[UINT_FMT] ;
- char fmtgid[UINT_FMT] ;
- fmtuid[uint_fmt(fmtuid, uid)] = 0 ;
- fmtgid[uint_fmt(fmtgid, gid)] = 0 ;
+ char fmtuid[UID_FMT] ;
+ char fmtgid[GID_FMT] ;
+ fmtuid[uid_fmt(fmtuid, uid)] = 0 ;
+ fmtgid[gid_fmt(fmtgid, gid)] = 0 ;
strerr_warnw4x("unused exec string in rules for uid ", fmtuid, " gid ", fmtgid) ;
}
if (params.env.s)
@@ -658,7 +657,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
unsigned int t = 0, T = 0 ;
for (;;)
{
- register int opt = subgetopt_r(argc, argv, "v:1c:n:i:x:t:T:", &l) ;
+ int opt = subgetopt_r(argc, argv, "v:1c:n:i:x:t:T:", &l) ;
if (opt == -1) break ;
switch (opt)
{
diff --git a/src/include/s6/ftrigr.h b/src/include/s6/ftrigr.h
index 9124f4d..db91ca9 100644
--- a/src/include/s6/ftrigr.h
+++ b/src/include/s6/ftrigr.h
@@ -3,9 +3,8 @@
#ifndef FTRIGR_H
#define FTRIGR_H
+#include <stdint.h>
#include <skalibs/config.h>
-#include <skalibs/uint16.h>
-#include <skalibs/uint32.h>
#include <skalibs/tai.h>
#include <skalibs/genalloc.h>
#include <skalibs/gensetdyn.h>
@@ -40,12 +39,12 @@ enum fr1state_e
typedef struct ftrigr1_s ftrigr1_t, *ftrigr1_t_ref ;
struct ftrigr1_s
{
- uint32 options ;
+ uint32_t options ;
unsigned int count ;
fr1state_t state ;
char what ;
} ;
-#define FTRIGR1_ZERO { 0, 0, FR1STATE_ERROR, 0 }
+#define FTRIGR1_ZERO { .options = 0, .count = 0, .state = FR1STATE_ERROR, .what = 0 }
extern ftrigr1_t const ftrigr1_zero ;
@@ -55,7 +54,7 @@ typedef struct ftrigr_s ftrigr, ftrigr_t, *ftrigr_ref, *ftrigr_t_ref ;
struct ftrigr_s
{
skaclient_t connection ;
- genalloc list ; /* array of uint16 */
+ genalloc list ; /* array of uint16_t */
gensetdyn data ; /* set of ftrigr1_t */
skaclient_buffer_t buffers ;
} ;
@@ -76,21 +75,21 @@ extern void ftrigr_end (ftrigr_t *) ;
#define ftrigr_fd(a) skaclient_fd(&(a)->connection)
extern int ftrigr_update (ftrigr_t *) ;
-extern int ftrigr_check (ftrigr_t *, uint16, char *) ;
+extern int ftrigr_check (ftrigr_t *, uint16_t, char *) ;
/* Synchronous functions with timeouts */
#define FTRIGR_REPEAT 0x0001
-extern uint16 ftrigr_subscribe (ftrigr_t *, char const *, char const *, uint32, tain_t const *, tain_t *) ;
+extern uint16_t ftrigr_subscribe (ftrigr_t *, char const *, char const *, uint32_t, tain_t const *, tain_t *) ;
#define ftrigr_subscribe_g(a, path, re, options, deadline) ftrigr_subscribe(a, path, re, options, (deadline), &STAMP)
-extern int ftrigr_unsubscribe (ftrigr_t *, uint16, tain_t const *, tain_t *) ;
+extern int ftrigr_unsubscribe (ftrigr_t *, uint16_t, tain_t const *, tain_t *) ;
#define ftrigr_unsubscribe_g(a, id, deadline) ftrigr_unsubscribe(a, id, (deadline), &STAMP)
-extern int ftrigr_wait_and (ftrigr_t *, uint16 const *, unsigned int, tain_t const *, tain_t *) ;
+extern int ftrigr_wait_and (ftrigr_t *, uint16_t const *, unsigned int, tain_t const *, tain_t *) ;
#define ftrigr_wait_and_g(a, list, len, deadline) ftrigr_wait_and(a, list, len, (deadline), &STAMP)
-extern int ftrigr_wait_or (ftrigr_t *, uint16 const *, unsigned int, tain_t const *, tain_t *, char *) ;
+extern int ftrigr_wait_or (ftrigr_t *, uint16_t const *, unsigned int, tain_t const *, tain_t *, char *) ;
#define ftrigr_wait_or_g(a, list, len, deadline, what) ftrigr_wait_or(a, list, len, deadline, &STAMP, what)
#endif
diff --git a/src/include/s6/ftrigw.h b/src/include/s6/ftrigw.h
index 2ffc20b..ae11a76 100644
--- a/src/include/s6/ftrigw.h
+++ b/src/include/s6/ftrigw.h
@@ -3,14 +3,14 @@
#ifndef FTRIGW_H
#define FTRIGW_H
-#include <sys/types.h>
-#include <skalibs/bytestr.h>
+#include <sys/stat.h>
+#include <string.h>
-extern int ftrigw_fifodir_make (char const *, int, int) ;
+extern int ftrigw_fifodir_make (char const *, gid_t, int) ;
extern int ftrigw_notify (char const *, char) ;
extern int ftrigw_notifyb (char const *, char const *, size_t) ;
extern int ftrigw_notifyb_nosig (char const *, char const *, size_t) ;
-#define ftrigw_notifys(f, s) ftrigw_notifyb(f, (s), str_len(s))
+#define ftrigw_notifys(f, s) ftrigw_notifyb(f, (s), strlen(s))
extern int ftrigw_clean (char const *) ;
#endif
diff --git a/src/include/s6/s6lock.h b/src/include/s6/s6lock.h
index 03fb7d3..90ad05c 100644
--- a/src/include/s6/s6lock.h
+++ b/src/include/s6/s6lock.h
@@ -3,8 +3,8 @@
#ifndef S6LOCK_H
#define S6LOCK_H
+#include <stdint.h>
#include <errno.h>
-#include <skalibs/uint16.h>
#include <skalibs/tai.h>
#include <skalibs/genalloc.h>
#include <skalibs/gensetdyn.h>
@@ -29,7 +29,7 @@ typedef struct s6lock_s s6lock_t, *s6lock_t_ref ;
struct s6lock_s
{
skaclient_t connection ;
- genalloc list ; /* array of uint16 */
+ genalloc list ; /* array of uint16_t */
gensetdyn data ; /* set of char */
skaclient_buffer_t buffers ;
} ;
@@ -50,7 +50,7 @@ extern void s6lock_end (s6lock_t *) ;
#define s6lock_fd(a) skaclient_fd(&(a)->connection)
extern int s6lock_update (s6lock_t *) ;
-extern int s6lock_check (s6lock_t *, uint16) ;
+extern int s6lock_check (s6lock_t *, uint16_t) ;
/* Synchronous functions */
@@ -58,18 +58,18 @@ extern int s6lock_check (s6lock_t *, uint16) ;
#define S6LOCK_OPTIONS_SH 0x0000U
#define S6LOCK_OPTIONS_EX 0x0001U
-extern int s6lock_acquire (s6lock_t *, uint16 *, char const *, uint32, tain_t const *, tain_t const *, tain_t *) ;
+extern int s6lock_acquire (s6lock_t *, uint16_t *, char const *, uint32_t, tain_t const *, tain_t const *, tain_t *) ;
#define s6lock_acquire_g(a, id, path, options, limit, deadline) s6lock_acquire(a, id, path, options, limit, (deadline), &STAMP)
#define s6lock_acquire_sh(a, id, path, limit, deadline, stamp) s6lock_aquire(a, id, path, S6LOCK_OPTIONS_SH, limit, deadline, stamp)
#define s6lock_acquire_ex(a, id, path, limit, deadline, stamp) s6lock_aquire(a, id, path, S6LOCK_OPTIONS_EX, limit, deadline, stamp)
#define s6lock_acquire_sh_g(a, id, path, limit, deadline) s6lock_acquire_sh(a, id, path, limit, (deadline), &STAMP)
#define s6lock_acquire_ex_g(a, id, path, limit, deadline) s6lock_acquire_ex(a, id, path, limit, (deadline), &STAMP)
-extern int s6lock_release (s6lock_t *, uint16, tain_t const *, tain_t *) ;
+extern int s6lock_release (s6lock_t *, uint16_t, tain_t const *, tain_t *) ;
#define s6lock_release_g(a, id, deadline) s6lock_release(a, id, (deadline), &STAMP)
-extern int s6lock_wait_and (s6lock_t *, uint16 const *, unsigned int, tain_t const *, tain_t *) ;
+extern int s6lock_wait_and (s6lock_t *, uint16_t const *, unsigned int, tain_t const *, tain_t *) ;
#define s6lock_wait_and_g(a, list, len, deadline) s6lock_wait_and(a, list, len, (deadline), &STAMP)
-extern int s6lock_wait_or (s6lock_t *, uint16 const *, unsigned int, tain_t const *, tain_t *) ;
+extern int s6lock_wait_or (s6lock_t *, uint16_t const *, unsigned int, tain_t const *, tain_t *) ;
#define s6lock_wait_or_g(a, list, len, deadline) s6lock_wait_or(a, list, len, (deadline), &STAMP)
#endif
diff --git a/src/libs6/ftrig1_make.c b/src/libs6/ftrig1_make.c
index d22a76f..8cac6b2 100644
--- a/src/libs6/ftrig1_make.c
+++ b/src/libs6/ftrig1_make.c
@@ -1,11 +1,10 @@
/* ISC license. */
-#include <sys/types.h>
+#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
-#include <stdio.h> /* for rename() */
+#include <stdio.h>
#include <errno.h>
-#include <skalibs/bytestr.h>
#include <skalibs/tai.h>
#include <skalibs/stralloc.h>
#include <skalibs/djbunix.h>
@@ -32,13 +31,13 @@ static inline void surfname (char *s, size_t n)
int ftrig1_make (ftrig1_t *f, char const *path)
{
ftrig1_t ff = FTRIG1_ZERO ;
- size_t pathlen = str_len(path) ;
+ size_t pathlen = strlen(path) ;
int e = 0 ;
char tmp[pathlen + 46 + FTRIG1_PREFIXLEN] ;
- byte_copy(tmp, pathlen, path) ;
+ memcpy(tmp, path, pathlen) ;
tmp[pathlen] = '/' ; tmp[pathlen+1] = '.' ;
- byte_copy(tmp + pathlen + 2, FTRIG1_PREFIXLEN, FTRIG1_PREFIX) ;
+ memcpy(tmp + pathlen + 2, FTRIG1_PREFIX, FTRIG1_PREFIXLEN) ;
tmp[pathlen + 2 + FTRIG1_PREFIXLEN] = ':' ;
if (!timestamp(tmp + pathlen + 3 + FTRIG1_PREFIXLEN)) return 0 ;
tmp[pathlen + 28 + FTRIG1_PREFIXLEN] = ':' ;
diff --git a/src/libs6/ftrigr_check.c b/src/libs6/ftrigr_check.c
index 8db7d7f..ba0a6f1 100644
--- a/src/libs6/ftrigr_check.c
+++ b/src/libs6/ftrigr_check.c
@@ -22,7 +22,7 @@ int ftrigr_check (ftrigr_t *a, uint16_t id, char *c)
}
case FR1STATE_LISTENING :
{
- register unsigned int r = p->count ;
+ unsigned int r = p->count ;
if (r) *c = p->what ;
p->count = 0 ;
return (int)r ;
diff --git a/src/libs6/ftrigr_subscribe.c b/src/libs6/ftrigr_subscribe.c
index ddb706f..97e1931 100644
--- a/src/libs6/ftrigr_subscribe.c
+++ b/src/libs6/ftrigr_subscribe.c
@@ -1,11 +1,10 @@
/* ISC license. */
-#include <sys/types.h>
+#include <sys/uio.h>
+#include <string.h>
#include <stdint.h>
#include <errno.h>
-#include <skalibs/uint16.h>
-#include <skalibs/uint32.h>
-#include <skalibs/siovec.h>
+#include <skalibs/types.h>
#include <skalibs/tai.h>
#include <skalibs/gensetdyn.h>
#include <skalibs/skaclient.h>
@@ -13,20 +12,25 @@
uint16_t ftrigr_subscribe (ftrigr_t *a, char const *path, char const *re, uint32_t options, tain_t const *deadline, tain_t *stamp)
{
- size_t pathlen = str_len(path) ;
- size_t relen = str_len(re) ;
+ size_t pathlen = strlen(path) ;
+ size_t relen = strlen(re) ;
unsigned int i ;
char err ;
char tmp[15] = "--L" ;
- siovec_t v[3] = { { .s = tmp, .len = 15 }, { .s = (char *)path, .len = pathlen + 1 }, { .s = (char *)re, .len = relen + 1 } } ;
+ struct iovec v[3] = { { .iov_base = tmp, .iov_len = 15 }, { .iov_base = (char *)path, .iov_len = pathlen + 1 }, { .iov_base = (char *)re, .iov_len = relen + 1 } } ;
if (!gensetdyn_new(&a->data, &i)) return 0 ;
+ if (i >= UINT16_MAX)
+ {
+ gensetdyn_delete(&a->data, i) ;
+ return (errno = EMFILE, 0) ;
+ }
uint16_pack_big(tmp, (uint16_t)i) ;
uint32_pack_big(tmp+3, options) ;
uint32_pack_big(tmp+7, (uint32_t)pathlen) ;
uint32_pack_big(tmp+11, (uint32_t)relen) ;
if (!skaclient_sendv(&a->connection, v, 3, &skaclient_default_cb, &err, deadline, stamp))
{
- register int e = errno ;
+ int e = errno ;
gensetdyn_delete(&a->data, i) ;
errno = e ;
return 0 ;
@@ -37,11 +41,11 @@ uint16_t ftrigr_subscribe (ftrigr_t *a, char const *path, char const *re, uint32
return (errno = err, 0) ;
}
{
- register ftrigr1_t *p = GENSETDYN_P(ftrigr1_t, &a->data, i) ;
+ ftrigr1_t *p = GENSETDYN_P(ftrigr1_t, &a->data, i) ;
p->options = options ;
p->state = FR1STATE_LISTENING ;
p->count = 0 ;
p->what = 0 ;
}
- return (uint16)(i+1) ;
+ return (uint16_t)(i+1) ;
}
diff --git a/src/libs6/ftrigr_unsubscribe.c b/src/libs6/ftrigr_unsubscribe.c
index 1c44905..949bc50 100644
--- a/src/libs6/ftrigr_unsubscribe.c
+++ b/src/libs6/ftrigr_unsubscribe.c
@@ -2,7 +2,7 @@
#include <stdint.h>
#include <errno.h>
-#include <skalibs/uint16.h>
+#include <skalibs/types.h>
#include <skalibs/tai.h>
#include <skalibs/gensetdyn.h>
#include <skalibs/skaclient.h>
diff --git a/src/libs6/ftrigr_update.c b/src/libs6/ftrigr_update.c
index 52f79b9..7f494c6 100644
--- a/src/libs6/ftrigr_update.c
+++ b/src/libs6/ftrigr_update.c
@@ -5,7 +5,7 @@
#include <errno.h>
#include <skalibs/gccattributes.h>
#include <skalibs/error.h>
-#include <skalibs/uint16.h>
+#include <skalibs/types.h>
#include <skalibs/genalloc.h>
#include <skalibs/gensetdyn.h>
#include <skalibs/unixmessage.h>
diff --git a/src/libs6/ftrigr_wait_and.c b/src/libs6/ftrigr_wait_and.c
index 961d0ba..dc633a9 100644
--- a/src/libs6/ftrigr_wait_and.c
+++ b/src/libs6/ftrigr_wait_and.c
@@ -15,7 +15,7 @@ int ftrigr_wait_and (ftrigr_t *a, uint16_t const *idlist, unsigned int n, tain_t
for (;;)
{
char dummy ;
- register int r = ftrigr_check(a, *idlist, &dummy) ;
+ int r = ftrigr_check(a, *idlist, &dummy) ;
if (r < 0) return r ;
else 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 188a97e..9d0be0f 100644
--- a/src/libs6/ftrigr_wait_or.c
+++ b/src/libs6/ftrigr_wait_or.c
@@ -14,8 +14,8 @@ int ftrigr_wait_or (ftrigr_t *a, uint16_t const *idlist, unsigned int n, tain_t
if (x.fd < 0) return -1 ;
for (;;)
{
- register unsigned int i = 0 ;
- register int r ;
+ unsigned int i = 0 ;
+ int r ;
for (; i < n ; i++)
{
r = ftrigr_check(a, idlist[i], c) ;
diff --git a/src/libs6/ftrigw_clean.c b/src/libs6/ftrigw_clean.c
index 5e344eb..3253f7a 100644
--- a/src/libs6/ftrigw_clean.c
+++ b/src/libs6/ftrigw_clean.c
@@ -1,23 +1,22 @@
/* ISC license. */
-#include <sys/types.h>
+#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <skalibs/direntry.h>
-#include <skalibs/bytestr.h>
#include <skalibs/djbunix.h>
#include "ftrig1.h"
#include <s6/ftrigw.h>
int ftrigw_clean (char const *path)
{
- size_t pathlen = str_len(path) ;
+ size_t pathlen = strlen(path) ;
int e = 0 ;
DIR *dir = opendir(path) ;
if (!dir) return 0 ;
{
char tmp[pathlen + FTRIG1_PREFIXLEN + 45] ;
- byte_copy(tmp, pathlen, path) ;
+ memcpy(tmp, path, pathlen) ;
tmp[pathlen] = '/' ; tmp[pathlen + FTRIG1_PREFIXLEN + 44] = 0 ;
for (;;)
{
@@ -26,9 +25,9 @@ int ftrigw_clean (char const *path)
errno = 0 ;
d = readdir(dir) ;
if (!d) break ;
- if (str_diffn(d->d_name, FTRIG1_PREFIX, FTRIG1_PREFIXLEN)) continue ;
- if (str_len(d->d_name) != FTRIG1_PREFIXLEN + 43) continue ;
- byte_copy(tmp + pathlen + 1, FTRIG1_PREFIXLEN + 43, d->d_name) ;
+ if (strncmp(d->d_name, FTRIG1_PREFIX, FTRIG1_PREFIXLEN)) continue ;
+ if (strlen(d->d_name) != FTRIG1_PREFIXLEN + 43) continue ;
+ memcpy(tmp + pathlen + 1, d->d_name, FTRIG1_PREFIXLEN + 43) ;
fd = open_write(tmp) ;
if (fd >= 0) fd_close(fd) ;
else if ((errno == ENXIO) && (unlink(tmp) < 0)) e = errno ;
diff --git a/src/libs6/ftrigw_fifodir_make.c b/src/libs6/ftrigw_fifodir_make.c
index 1a69a8e..c7b93a5 100644
--- a/src/libs6/ftrigw_fifodir_make.c
+++ b/src/libs6/ftrigw_fifodir_make.c
@@ -1,12 +1,11 @@
/* ISC license. */
-#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <errno.h>
#include <s6/ftrigw.h>
-int ftrigw_fifodir_make (char const *path, int gid, int force)
+int ftrigw_fifodir_make (char const *path, gid_t gid, int force)
{
mode_t m = umask(0) ;
if (mkdir(path, 0700) == -1)
diff --git a/src/libs6/ftrigw_notifyb_nosig.c b/src/libs6/ftrigw_notifyb_nosig.c
index 0a21419..0ba38a6 100644
--- a/src/libs6/ftrigw_notifyb_nosig.c
+++ b/src/libs6/ftrigw_notifyb_nosig.c
@@ -1,11 +1,10 @@
/* ISC license. */
-#include <sys/types.h>
+#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <skalibs/direntry.h>
#include <skalibs/allreadwrite.h>
-#include <skalibs/bytestr.h>
#include <skalibs/djbunix.h>
#include "ftrig1.h"
#include <s6/ftrigw.h>
@@ -16,9 +15,9 @@ int ftrigw_notifyb_nosig (char const *path, char const *s, size_t len)
DIR *dir = opendir(path) ;
if (!dir) return -1 ;
{
- size_t pathlen = str_len(path) ;
+ size_t pathlen = strlen(path) ;
char tmp[pathlen + FTRIG1_PREFIXLEN + 45] ;
- byte_copy(tmp, pathlen, path) ;
+ memcpy(tmp, path, pathlen) ;
tmp[pathlen] = '/' ; tmp[pathlen + FTRIG1_PREFIXLEN + 44] = 0 ;
for (;;)
{
@@ -27,9 +26,9 @@ int ftrigw_notifyb_nosig (char const *path, char const *s, size_t len)
errno = 0 ;
d = readdir(dir) ;
if (!d) break ;
- if (str_diffn(d->d_name, FTRIG1_PREFIX, FTRIG1_PREFIXLEN)) continue ;
- if (str_len(d->d_name) != FTRIG1_PREFIXLEN + 43) continue ;
- byte_copy(tmp + pathlen + 1, FTRIG1_PREFIXLEN + 43, d->d_name) ;
+ if (strncmp(d->d_name, FTRIG1_PREFIX, FTRIG1_PREFIXLEN)) continue ;
+ if (strlen(d->d_name) != FTRIG1_PREFIXLEN + 43) continue ;
+ memcpy(tmp + pathlen + 1, d->d_name, FTRIG1_PREFIXLEN + 43) ;
fd = open_write(tmp) ;
if (fd == -1)
{
@@ -37,7 +36,7 @@ int ftrigw_notifyb_nosig (char const *path, char const *s, size_t len)
}
else
{
- register ssize_t r = fd_write(fd, s, len) ;
+ ssize_t r = fd_write(fd, s, len) ;
if ((r < 0) || (size_t)r < len)
{
if (errno == EPIPE) unlink(tmp) ;
diff --git a/src/libs6/s6-ftrigrd.c b/src/libs6/s6-ftrigrd.c
index 1bbe856..5afec98 100644
--- a/src/libs6/s6-ftrigrd.c
+++ b/src/libs6/s6-ftrigrd.c
@@ -1,13 +1,11 @@
/* ISC license. */
-#include <sys/types.h>
+#include <string.h>
#include <stdint.h>
#include <errno.h>
#include <signal.h>
#include <regex.h>
-#include <skalibs/uint16.h>
-#include <skalibs/uint32.h>
-#include <skalibs/bytestr.h>
+#include <skalibs/types.h>
#include <skalibs/allreadwrite.h>
#include <skalibs/error.h>
#include <skalibs/strerr2.h>
@@ -53,7 +51,7 @@ static void ftrigio_deepfree (ftrigio_t *p)
static void cleanup (void)
{
- register unsigned int i = 0 ;
+ unsigned int i = 0 ;
for (; i < n ; i++) ftrigio_deepfree(a + i) ;
n = 0 ;
}
@@ -95,7 +93,7 @@ static inline int ftrigio_read (ftrigio_t *p)
{
regmatch_t pmatch ;
size_t blen ;
- register ssize_t r = sanitize_read(buffer_fill(&p->b)) ;
+ ssize_t r = sanitize_read(buffer_fill(&p->b)) ;
if (!r) break ;
if (r < 0) return (trig(p->id, 'd', errno), 0) ;
blen = buffer_len(&p->b) ;
@@ -107,7 +105,7 @@ static inline int ftrigio_read (ftrigio_t *p)
{
trig(p->id, '!', p->sa.s[pmatch.rm_eo - 1]) ;
if (!(p->options & FTRIGR_REPEAT)) return 0 ;
- byte_copy(p->sa.s, p->sa.len + 1 - pmatch.rm_eo, p->sa.s + pmatch.rm_eo) ;
+ memcpy(p->sa.s, p->sa.s + pmatch.rm_eo, p->sa.len + 1 - pmatch.rm_eo) ;
p->sa.len -= pmatch.rm_eo ;
}
}
@@ -127,7 +125,7 @@ static int parse_protocol (unixmessage_t const *m, void *context)
{
case 'U' : /* unsubscribe */
{
- register unsigned int i = 0 ;
+ unsigned int i = 0 ;
for (; i < n ; i++) if (a[i].id == id) break ;
if (i < n)
{
diff --git a/src/libs6/s6_accessrules_backend_cdb.c b/src/libs6/s6_accessrules_backend_cdb.c
index 1187485..64e95d2 100644
--- a/src/libs6/s6_accessrules_backend_cdb.c
+++ b/src/libs6/s6_accessrules_backend_cdb.c
@@ -1,11 +1,10 @@
/* ISC license. */
-#include <sys/types.h>
+#include <string.h>
#include <stdint.h>
#include <unistd.h>
#include <errno.h>
-#include <skalibs/bytestr.h>
-#include <skalibs/uint16.h>
+#include <skalibs/types.h>
#include <skalibs/cdb.h>
#include <skalibs/stralloc.h>
#include <s6/accessrules.h>
@@ -16,7 +15,7 @@ s6_accessrules_result_t s6_accessrules_backend_cdb (char const *key, size_t keyl
size_t execbase ;
unsigned int n ;
uint16_t envlen, execlen ;
- register int r = cdb_find(c, key, keylen) ;
+ int r = cdb_find(c, key, keylen) ;
if (r < 0) return S6_ACCESSRULES_ERROR ;
else if (!r) return S6_ACCESSRULES_NOTFOUND ;
n = cdb_datalen(c) ;
@@ -31,7 +30,7 @@ s6_accessrules_result_t s6_accessrules_backend_cdb (char const *key, size_t keyl
uint16_unpack_big(params->exec.s + execbase + 3 + envlen, &execlen) ;
if ((execlen > 4096U) || (5U + envlen + execlen != n)) return (errno = EINVAL, S6_ACCESSRULES_ERROR) ;
if (!stralloc_catb(&params->env, params->exec.s + execbase + 3U, envlen)) return S6_ACCESSRULES_ERROR ;
- byte_copy(params->exec.s + execbase, execlen, params->exec.s + execbase + 5U + envlen) ;
+ memcpy(params->exec.s + execbase, params->exec.s + execbase + 5U + envlen, execlen) ;
if (execlen)
{
params->exec.len += execlen ;
diff --git a/src/libs6/s6_accessrules_backend_fs.c b/src/libs6/s6_accessrules_backend_fs.c
index 17119c9..614f42b 100644
--- a/src/libs6/s6_accessrules_backend_fs.c
+++ b/src/libs6/s6_accessrules_backend_fs.c
@@ -1,10 +1,8 @@
/* ISC license. */
-#include <sys/types.h>
+#include <string.h>
#include <unistd.h>
#include <errno.h>
-#include <skalibs/bytestr.h>
-#include <skalibs/fmtscan.h>
#include <skalibs/stralloc.h>
#include <skalibs/djbunix.h>
#include <s6/accessrules.h>
@@ -12,25 +10,25 @@
s6_accessrules_result_t s6_accessrules_backend_fs (char const *key, size_t keylen, void *data, s6_accessrules_params_t *params)
{
char *dir = data ;
- size_t dirlen = str_len(dir) ;
+ size_t dirlen = strlen(dir) ;
size_t envbase = params->env.len ;
int wasnull = !params->env.s ;
{
char tmp[dirlen + keylen + 10] ;
- byte_copy(tmp, dirlen, dir) ;
+ memcpy(tmp, dir, dirlen) ;
tmp[dirlen] = '/' ;
- byte_copy(tmp + dirlen + 1, keylen, key) ;
- byte_copy(tmp + dirlen + keylen + 1, 7, "/allow") ;
+ memcpy(tmp + dirlen + 1, key, keylen) ;
+ memcpy(tmp + dirlen + keylen + 1, "/allow", 7) ;
if (access(tmp, R_OK) < 0)
{
if ((errno != EACCES) && (errno != ENOENT))
return S6_ACCESSRULES_ERROR ;
- byte_copy(tmp + dirlen + keylen + 2, 5, "deny") ;
+ memcpy(tmp + dirlen + keylen + 2, "deny", 5) ;
return (access(tmp, R_OK) == 0) ? S6_ACCESSRULES_DENY :
(errno != EACCES) && (errno != ENOENT) ? S6_ACCESSRULES_ERROR :
S6_ACCESSRULES_NOTFOUND ;
}
- byte_copy(tmp + dirlen + keylen + 2, 4, "env") ;
+ memcpy(tmp + dirlen + keylen + 2, "env", 4) ;
if ((envdir(tmp, &params->env) < 0) && (errno != ENOENT))
return S6_ACCESSRULES_ERROR ;
if (!stralloc_readyplus(&params->exec, 4097))
@@ -39,9 +37,9 @@ s6_accessrules_result_t s6_accessrules_backend_fs (char const *key, size_t keyle
else params->env.len = envbase ;
return S6_ACCESSRULES_ERROR ;
}
- byte_copy(tmp + dirlen + keylen + 2, 5, "exec") ;
+ memcpy(tmp + dirlen + keylen + 2, "exec", 5) ;
{
- register ssize_t r = openreadnclose(tmp, params->exec.s + params->exec.len, 4096) ;
+ ssize_t r = openreadnclose(tmp, params->exec.s + params->exec.len, 4096) ;
if ((r < 0) && (errno != EACCES) && (errno != ENOENT))
{
if (wasnull) stralloc_free(&params->env) ;
diff --git a/src/libs6/s6_accessrules_keycheck_ip4.c b/src/libs6/s6_accessrules_keycheck_ip4.c
index 4942e8e..2bd620d 100644
--- a/src/libs6/s6_accessrules_keycheck_ip4.c
+++ b/src/libs6/s6_accessrules_keycheck_ip4.c
@@ -2,8 +2,7 @@
#include <sys/types.h>
#include <stdint.h>
-#include <skalibs/uint32.h>
-#include <skalibs/uint.h>
+#include <skalibs/types.h>
#include <skalibs/fmtscan.h>
#include <s6/accessrules.h>
@@ -15,8 +14,8 @@ s6_accessrules_result_t s6_accessrules_keycheck_ip4 (void const *key, void *data
uint32_unpack_big((char const *)key, &ip) ;
for (; i <= 32 ; i++)
{
- register s6_accessrules_result_t r ;
- register size_t len = 4 + ip4_fmtu32(fmt+4, (i == 32) ? 0 : ip & ~((1U << i) - 1)) ;
+ s6_accessrules_result_t r ;
+ size_t len = 4 + ip4_fmtu32(fmt+4, (i == 32) ? 0 : ip & ~((1U << i) - 1)) ;
fmt[len++] = '_' ;
len += uint_fmt(fmt + len, 32 - i) ;
r = (*check1)(fmt, len, data, params) ;
diff --git a/src/libs6/s6_accessrules_keycheck_ip6.c b/src/libs6/s6_accessrules_keycheck_ip6.c
index cd7fe02..93418d3 100644
--- a/src/libs6/s6_accessrules_keycheck_ip6.c
+++ b/src/libs6/s6_accessrules_keycheck_ip6.c
@@ -1,8 +1,7 @@
/* ISC license. */
-#include <sys/types.h>
-#include <skalibs/uint.h>
-#include <skalibs/bytestr.h>
+#include <string.h>
+#include <skalibs/types.h>
#include <skalibs/bitarray.h>
#include <skalibs/fmtscan.h>
#include <s6/accessrules.h>
@@ -12,11 +11,11 @@ s6_accessrules_result_t s6_accessrules_keycheck_ip6 (void const *key, void *data
char fmt[IP6_FMT + UINT_FMT + 6] = "ip6/" ;
char ip6[16] ;
unsigned int i = 0 ;
- byte_copy(ip6, 16, (char const *)key) ;
+ memcpy(ip6, (char const *)key, 16) ;
for (; i <= 128 ; i++)
{
size_t len ;
- register s6_accessrules_result_t r ;
+ s6_accessrules_result_t r ;
if (i) bitarray_clear(ip6, 128 - i) ;
len = 4 + ip6_fmt(fmt+4, ip6) ;
fmt[len++] = '_' ;
diff --git a/src/libs6/s6_accessrules_keycheck_reversedns.c b/src/libs6/s6_accessrules_keycheck_reversedns.c
index 5c44e47..34da90f 100644
--- a/src/libs6/s6_accessrules_keycheck_reversedns.c
+++ b/src/libs6/s6_accessrules_keycheck_reversedns.c
@@ -1,6 +1,6 @@
/* ISC license. */
-#include <sys/types.h>
+#include <string.h>
#include <errno.h>
#include <skalibs/bytestr.h>
#include <s6/accessrules.h>
@@ -8,17 +8,17 @@
s6_accessrules_result_t s6_accessrules_keycheck_reversedns (void const *key, void *data, s6_accessrules_params_t *params, s6_accessrules_backend_func_t_ref check1)
{
char const *name = key ;
- size_t len = str_len(name) ;
+ size_t len = strlen(name) ;
if (!len) return (errno = EINVAL, S6_ACCESSRULES_ERROR) ;
if (name[len-1] == '.') len-- ;
{
size_t i = 0 ;
char tmp[len + 11] ;
- byte_copy(tmp, 11, "reversedns/") ;
+ memcpy(tmp, "reversedns/", 11) ;
while (i < len)
{
- register s6_accessrules_result_t r ;
- byte_copy(tmp+11, len-i, name+i) ;
+ s6_accessrules_result_t r ;
+ memcpy(tmp+11, name+i, len-i) ;
r = (*check1)(tmp, 11+len-i, data, params) ;
if (r != S6_ACCESSRULES_NOTFOUND) return r ;
i += byte_chr(name+i, len-i, '.') + 1 ;
diff --git a/src/libs6/s6_accessrules_keycheck_uidgid.c b/src/libs6/s6_accessrules_keycheck_uidgid.c
index 7a2cd0a..61a6229 100644
--- a/src/libs6/s6_accessrules_keycheck_uidgid.c
+++ b/src/libs6/s6_accessrules_keycheck_uidgid.c
@@ -1,13 +1,13 @@
/* ISC license. */
#include <skalibs/uint64.h>
-#include <skalibs/gidstuff.h>
+#include <skalibs/types.h>
#include <s6/accessrules.h>
s6_accessrules_result_t s6_accessrules_keycheck_uidgid (void const *key, void *data, s6_accessrules_params_t *params, s6_accessrules_backend_func_t_ref check1)
{
char fmt[4 + UINT64_FMT] = "uid/" ;
- register s6_accessrules_result_t r = (*check1)(fmt, 4 + uint64_fmt(fmt+4, ((uidgid_t const *)key)->left), data, params) ;
+ s6_accessrules_result_t r = (*check1)(fmt, 4 + uid_fmt(fmt+4, ((uidgid_t const *)key)->left), data, params) ;
if (r != S6_ACCESSRULES_NOTFOUND) return r ;
fmt[0] = 'g' ;
r = (*check1)(fmt, 4 + gid_fmt(fmt+4, ((uidgid_t const *)key)->right), data, params) ;
diff --git a/src/libs6/s6_fdholder_delete.c b/src/libs6/s6_fdholder_delete.c
index fd7aa4e..f6f2c2b 100644
--- a/src/libs6/s6_fdholder_delete.c
+++ b/src/libs6/s6_fdholder_delete.c
@@ -1,4 +1,4 @@
- /* ISC license. */
+/* ISC license. */
#include <errno.h>
#include <skalibs/allreadwrite.h>
diff --git a/src/libs6/s6_fdholder_delete_async.c b/src/libs6/s6_fdholder_delete_async.c
index 21caab3..e234cfd 100644
--- a/src/libs6/s6_fdholder_delete_async.c
+++ b/src/libs6/s6_fdholder_delete_async.c
@@ -1,17 +1,16 @@
- /* ISC license. */
+/* ISC license. */
-#include <sys/types.h>
+#include <sys/uio.h>
+#include <string.h>
#include <errno.h>
-#include <skalibs/bytestr.h>
-#include <skalibs/siovec.h>
#include <skalibs/unixmessage.h>
#include <s6/s6-fdholder.h>
int s6_fdholder_delete_async (s6_fdholder_t *a, char const *id)
{
- size_t idlen = str_len(id) ;
+ size_t idlen = strlen(id) ;
char pack[2] = "D" ;
- siovec_t v[2] = { { .s = pack, .len = 2 }, { .s = (char *)id, .len = idlen + 1 } } ;
+ struct iovec v[2] = { { .iov_base = pack, .iov_len = 2 }, { .iov_base = (char *)id, .iov_len = idlen + 1 } } ;
unixmessage_v_t m = { .v = v, .vlen = 2, .fds = 0, .nfds = 0 } ;
if (idlen > S6_FDHOLDER_ID_SIZE) return (errno = ENAMETOOLONG, 0) ;
pack[1] = (unsigned char)idlen ;
diff --git a/src/libs6/s6_fdholder_getdump.c b/src/libs6/s6_fdholder_getdump.c
index 213cad8..e201e6e 100644
--- a/src/libs6/s6_fdholder_getdump.c
+++ b/src/libs6/s6_fdholder_getdump.c
@@ -1,12 +1,11 @@
- /* ISC license. */
+/* ISC license. */
-#include <sys/types.h>
+#include <string.h>
#include <stdint.h>
#include <errno.h>
-#include <skalibs/uint32.h>
+#include <skalibs/types.h>
#include <skalibs/allreadwrite.h>
#include <skalibs/error.h>
-#include <skalibs/bytestr.h>
#include <skalibs/tai.h>
#include <skalibs/genalloc.h>
#include <skalibs/djbunix.h>
@@ -17,7 +16,7 @@ int s6_fdholder_getdump (s6_fdholder_t *a, genalloc *g, tain_t const *deadline,
{
unixmessage_t m = { .s = "?", .len = 1, .fds = 0, .nfds = 0 } ;
uint32_t ntot, n ;
- unsigned int oldlen = genalloc_len(s6_fdholder_fd_t, g) ;
+ size_t oldlen = genalloc_len(s6_fdholder_fd_t, g) ;
unsigned int i = 0 ;
int ok ;
if (!unixmessage_put(&a->connection.out, &m)) return 0 ;
@@ -48,8 +47,8 @@ int s6_fdholder_getdump (s6_fdholder_t *a, genalloc *g, tain_t const *deadline,
m.s += TAIN_PACK ; m.len -= TAIN_PACK + 1 ;
thislen = *m.s++ ;
if (thislen > m.len - 1 || m.s[thislen]) goto droperr ;
- byte_copy(tab[j].id, thislen, m.s) ;
- byte_zero(tab[j].id + thislen, S6_FDHOLDER_ID_SIZE + 1 - thislen) ;
+ memcpy(tab[j].id, m.s, thislen) ;
+ memset(tab[j].id + thislen, 0, S6_FDHOLDER_ID_SIZE + 1 - thislen) ;
m.s += (size_t)thislen + 1 ; m.len -= (size_t)thislen + 1 ;
tab[j].fd = m.fds[j] ;
}
diff --git a/src/libs6/s6_fdholder_list.c b/src/libs6/s6_fdholder_list.c
index 868a3e6..d86049f 100644
--- a/src/libs6/s6_fdholder_list.c
+++ b/src/libs6/s6_fdholder_list.c
@@ -1,4 +1,4 @@
- /* ISC license. */
+/* ISC license. */
#include <errno.h>
#include <skalibs/allreadwrite.h>
diff --git a/src/libs6/s6_fdholder_list_async.c b/src/libs6/s6_fdholder_list_async.c
index fc62ff8..8275f23 100644
--- a/src/libs6/s6_fdholder_list_async.c
+++ b/src/libs6/s6_fdholder_list_async.c
@@ -1,6 +1,5 @@
- /* ISC license. */
+/* ISC license. */
-#include <errno.h>
#include <skalibs/unixmessage.h>
#include <s6/s6-fdholder.h>
diff --git a/src/libs6/s6_fdholder_list_cb.c b/src/libs6/s6_fdholder_list_cb.c
index 8bf5faf..9daaff7 100644
--- a/src/libs6/s6_fdholder_list_cb.c
+++ b/src/libs6/s6_fdholder_list_cb.c
@@ -1,8 +1,8 @@
- /* ISC license. */
+/* ISC license. */
#include <stdint.h>
#include <errno.h>
-#include <skalibs/uint32.h>
+#include <skalibs/types.h>
#include <skalibs/bytestr.h>
#include <skalibs/error.h>
#include <skalibs/stralloc.h>
@@ -12,7 +12,7 @@
int s6_fdholder_list_cb (unixmessage_t const *m, void *p)
{
uint32_t n ;
- register s6_fdholder_list_result_t *res = p ;
+ s6_fdholder_list_result_t *res = p ;
if (m->nfds) goto droperr ;
if (!m->len) goto err ;
if (m->s[0])
diff --git a/src/libs6/s6_fdholder_retrieve.c b/src/libs6/s6_fdholder_retrieve.c
index caf2426..9bdb8ad 100644
--- a/src/libs6/s6_fdholder_retrieve.c
+++ b/src/libs6/s6_fdholder_retrieve.c
@@ -1,4 +1,4 @@
- /* ISC license. */
+/* ISC license. */
#include <errno.h>
#include <skalibs/allreadwrite.h>
diff --git a/src/libs6/s6_fdholder_retrieve_async.c b/src/libs6/s6_fdholder_retrieve_async.c
index 5336544..e258772 100644
--- a/src/libs6/s6_fdholder_retrieve_async.c
+++ b/src/libs6/s6_fdholder_retrieve_async.c
@@ -1,18 +1,16 @@
- /* ISC license. */
+/* ISC license. */
-#include <sys/types.h>
+#include <sys/uio.h>
+#include <string.h>
#include <errno.h>
-#include <skalibs/bytestr.h>
-#include <skalibs/tai.h>
-#include <skalibs/siovec.h>
#include <skalibs/unixmessage.h>
#include <s6/s6-fdholder.h>
int s6_fdholder_retrieve_maybe_delete_async (s6_fdholder_t *a, char const *id, int dodelete)
{
- size_t idlen = str_len(id) ;
+ size_t idlen = strlen(id) ;
char pack[3] = "R" ;
- siovec_t v[2] = { { .s = pack, .len = 3 }, { .s = (char *)id, .len = idlen + 1 } } ;
+ struct iovec v[2] = { { .iov_base = pack, .iov_len = 3 }, { .iov_base = (char *)id, .iov_len = idlen + 1 } } ;
unixmessage_v_t m = { .v = v, .vlen = 2, .fds = 0, .nfds = 0 } ;
if (idlen > S6_FDHOLDER_ID_SIZE) return (errno = ENAMETOOLONG, 0) ;
pack[1] = !!dodelete ;
diff --git a/src/libs6/s6_fdholder_retrieve_cb.c b/src/libs6/s6_fdholder_retrieve_cb.c
index 9197b22..f009ff6 100644
--- a/src/libs6/s6_fdholder_retrieve_cb.c
+++ b/src/libs6/s6_fdholder_retrieve_cb.c
@@ -1,4 +1,4 @@
- /* ISC license. */
+/* ISC license. */
#include <errno.h>
#include <skalibs/error.h>
@@ -7,7 +7,7 @@
int s6_fdholder_retrieve_cb (unixmessage_t const *m, void *p)
{
- register s6_fdholder_retrieve_result_t *res = p ;
+ s6_fdholder_retrieve_result_t *res = p ;
if (m->len != 1) goto err ;
if (m->s[0])
{
diff --git a/src/libs6/s6_fdholder_setdump.c b/src/libs6/s6_fdholder_setdump.c
index 5982b95..1548409 100644
--- a/src/libs6/s6_fdholder_setdump.c
+++ b/src/libs6/s6_fdholder_setdump.c
@@ -1,14 +1,14 @@
- /* ISC license. */
+/* ISC license. */
-#include <sys/types.h>
+#include <sys/uio.h>
#include <stdint.h>
+#include <string.h>
#include <errno.h>
-#include <skalibs/uint32.h>
+#include <skalibs/types.h>
#include <skalibs/allreadwrite.h>
#include <skalibs/bytestr.h>
#include <skalibs/error.h>
#include <skalibs/tai.h>
-#include <skalibs/siovec.h>
#include <skalibs/unixmessage.h>
#include <s6/s6-fdholder.h>
@@ -40,20 +40,20 @@ int s6_fdholder_setdump (s6_fdholder_t *a, s6_fdholder_fd_t const *list, unsigne
{
unsigned int n = ntot > UNIXMESSAGE_MAXFDS ? UNIXMESSAGE_MAXFDS : ntot ;
unsigned int j = 0 ;
- siovec_t v[1 + (n<<1)] ;
+ struct iovec v[1 + (n<<1)] ;
int fds[n] ;
unixmessage_v_t m = { .v = v, .vlen = 1 + (n<<1), .fds = fds, .nfds = n } ;
char pack[n * (TAIN_PACK+1)] ;
- v[0].s = "." ; v[0].len = 1 ;
+ v[0].iov_base = "." ; v[0].iov_len = 1 ;
for (; j < n ; j++, list++, ntot--)
{
- size_t len = str_len(list->id) ;
- v[1 + (j<<1)].s = pack + j * (TAIN_PACK+1) ;
- v[1 + (j<<1)].len = TAIN_PACK + 1 ;
+ size_t len = strlen(list->id) ;
+ v[1 + (j<<1)].iov_base = pack + j * (TAIN_PACK+1) ;
+ v[1 + (j<<1)].iov_len = TAIN_PACK + 1 ;
tain_pack(pack + j * (TAIN_PACK+1), &list->limit) ;
pack[j * (TAIN_PACK+1) + TAIN_PACK] = (unsigned char)len ;
- v[2 + (j<<1)].s = (char *)list->id ;
- v[2 + (j<<1)].len = len + 1 ;
+ v[2 + (j<<1)].iov_base = (char *)list->id ;
+ v[2 + (j<<1)].iov_len = len + 1 ;
fds[j] = list->fd ;
}
if (!unixmessage_putv(&a->connection.out, &m)) return 0 ;
diff --git a/src/libs6/s6_fdholder_store.c b/src/libs6/s6_fdholder_store.c
index 7b8f6dc..b13d854 100644
--- a/src/libs6/s6_fdholder_store.c
+++ b/src/libs6/s6_fdholder_store.c
@@ -1,4 +1,4 @@
- /* ISC license. */
+/* ISC license. */
#include <errno.h>
#include <skalibs/allreadwrite.h>
diff --git a/src/libs6/s6_fdholder_store_async.c b/src/libs6/s6_fdholder_store_async.c
index 6a5482a..a782d2d 100644
--- a/src/libs6/s6_fdholder_store_async.c
+++ b/src/libs6/s6_fdholder_store_async.c
@@ -1,18 +1,17 @@
- /* ISC license. */
+/* ISC license. */
-#include <sys/types.h>
+#include <sys/uio.h>
+#include <string.h>
#include <errno.h>
-#include <skalibs/bytestr.h>
#include <skalibs/tai.h>
-#include <skalibs/siovec.h>
#include <skalibs/unixmessage.h>
#include <s6/s6-fdholder.h>
int s6_fdholder_store_async (s6_fdholder_t *a, int fd, char const *id, tain_t const *limit)
{
- size_t idlen = str_len(id) ;
+ size_t idlen = strlen(id) ;
char pack[2 + TAIN_PACK] = "S" ;
- siovec_t v[2] = { { .s = pack, .len = 2 + TAIN_PACK }, { .s = (char *)id, .len = idlen + 1 } } ;
+ struct iovec v[2] = { { .iov_base = pack, .iov_len = 2 + TAIN_PACK }, { .iov_base = (char *)id, .iov_len = idlen + 1 } } ;
unixmessage_v_t m = { .v = v, .vlen = 2, .fds = &fd, .nfds = 1 } ;
if (idlen > S6_FDHOLDER_ID_SIZE) return (errno = ENAMETOOLONG, 0) ;
tain_pack(pack + 1, limit) ;
diff --git a/src/libs6/s6_supervise_lock.c b/src/libs6/s6_supervise_lock.c
index 5c9ca30..e241320 100644
--- a/src/libs6/s6_supervise_lock.c
+++ b/src/libs6/s6_supervise_lock.c
@@ -1,6 +1,5 @@
/* ISC license. */
-#include <sys/types.h>
#include <sys/stat.h>
#include <s6/s6-supervise.h>
diff --git a/src/libs6/s6_supervise_lock_mode.c b/src/libs6/s6_supervise_lock_mode.c
index cda4ac2..039760c 100644
--- a/src/libs6/s6_supervise_lock_mode.c
+++ b/src/libs6/s6_supervise_lock_mode.c
@@ -1,23 +1,22 @@
/* ISC license. */
-#include <sys/types.h>
#include <sys/stat.h>
+#include <string.h>
#include <errno.h>
-#include <skalibs/bytestr.h>
#include <skalibs/strerr2.h>
#include <skalibs/djbunix.h>
#include <s6/s6-supervise.h>
int s6_supervise_lock_mode (char const *subdir, unsigned int subdirmode, unsigned int controlmode)
{
- size_t subdirlen = str_len(subdir) ;
+ size_t subdirlen = strlen(subdir) ;
int fdctl, fdctlw, fdlock ;
char control[subdirlen + 9] ;
char lock[subdirlen + 6] ;
- byte_copy(control, subdirlen, subdir) ;
- byte_copy(control + subdirlen, 9, "/control") ;
- byte_copy(lock, subdirlen, subdir) ;
- byte_copy(lock + subdirlen, 6, "/lock") ;
+ memcpy(control, subdir, subdirlen) ;
+ memcpy(control + subdirlen, "/control", 9) ;
+ memcpy(lock, subdir, subdirlen) ;
+ memcpy(lock + subdirlen, "/lock", 6) ;
if ((mkdir(subdir, (mode_t)subdirmode) == -1) && (errno != EEXIST))
strerr_diefu2sys(111, "mkdir ", subdir) ;
if (mkfifo(control, controlmode) < 0)
diff --git a/src/libs6/s6_svc_ok.c b/src/libs6/s6_svc_ok.c
index de30fd7..5e6aa27 100644
--- a/src/libs6/s6_svc_ok.c
+++ b/src/libs6/s6_svc_ok.c
@@ -1,20 +1,19 @@
/* ISC license. */
-#include <sys/types.h>
+#include <string.h>
#include <errno.h>
-#include <skalibs/bytestr.h>
#include <skalibs/djbunix.h>
#include <s6/s6-supervise.h>
int s6_svc_ok (char const *dir)
{
- size_t dirlen = str_len(dir) ;
+ size_t dirlen = strlen(dir) ;
int fd ;
char fn[dirlen + 9 + sizeof(S6_SUPERVISE_CTLDIR)] ;
- byte_copy(fn, dirlen, dir) ;
+ memcpy(fn, dir, dirlen) ;
fn[dirlen] = '/' ;
- byte_copy(fn + dirlen + 1, sizeof(S6_SUPERVISE_CTLDIR) - 1, S6_SUPERVISE_CTLDIR) ;
- byte_copy(fn + dirlen + sizeof(S6_SUPERVISE_CTLDIR), 9, "/control") ;
+ memcpy(fn + dirlen + 1, S6_SUPERVISE_CTLDIR, sizeof(S6_SUPERVISE_CTLDIR) - 1) ;
+ memcpy(fn + dirlen + sizeof(S6_SUPERVISE_CTLDIR), "/control", 9) ;
fd = open_write(fn) ;
if (fd < 0)
{
diff --git a/src/libs6/s6_svc_write.c b/src/libs6/s6_svc_write.c
index 03bf648..b7d2a27 100644
--- a/src/libs6/s6_svc_write.c
+++ b/src/libs6/s6_svc_write.c
@@ -13,7 +13,7 @@ int s6_svc_write (char const *fifo, char const *data, size_t datalen)
else if (ndelay_off(fd) == -1) return -1 ;
else if (fd_write(fd, data, datalen) == -1)
{
- register int e = errno ;
+ int e = errno ;
fd_close(fd) ;
errno = e ;
return -1 ;
diff --git a/src/libs6/s6_svc_writectl.c b/src/libs6/s6_svc_writectl.c
index 26c0fb6..b4d8e15 100644
--- a/src/libs6/s6_svc_writectl.c
+++ b/src/libs6/s6_svc_writectl.c
@@ -1,17 +1,16 @@
/* ISC license. */
-#include <sys/types.h>
-#include <skalibs/bytestr.h>
+#include <string.h>
#include <s6/s6-supervise.h>
int s6_svc_writectl (char const *service, char const *subdir, char const *s, size_t len)
{
- size_t svlen = str_len(service) ;
- size_t sublen = str_len(subdir) ;
+ size_t svlen = strlen(service) ;
+ size_t sublen = strlen(subdir) ;
char fn[svlen + sublen + 10] ;
- byte_copy(fn, svlen, service) ;
+ memcpy(fn, service, svlen) ;
fn[svlen] = '/' ;
- byte_copy(fn + svlen + 1, sublen, subdir) ;
- byte_copy(fn + svlen + 1 + sublen, 9, "/control") ;
+ memcpy(fn + svlen + 1, subdir, sublen) ;
+ memcpy(fn + svlen + 1 + sublen, "/control", 9) ;
return s6_svc_write(fn, s, len) ;
}
diff --git a/src/libs6/s6_svstatus_pack.c b/src/libs6/s6_svstatus_pack.c
index c7afe24..f6e6e92 100644
--- a/src/libs6/s6_svstatus_pack.c
+++ b/src/libs6/s6_svstatus_pack.c
@@ -1,8 +1,8 @@
/* ISC license. */
#include <stdint.h>
-#include <skalibs/uint16.h>
#include <skalibs/uint64.h>
+#include <skalibs/types.h>
#include <skalibs/tai.h>
#include <s6/s6-supervise.h>
@@ -10,7 +10,7 @@ void s6_svstatus_pack (char *pack, s6_svstatus_t const *sv)
{
tain_pack(pack, &sv->stamp) ;
tain_pack(pack + 12, &sv->readystamp) ;
- uint64_pack_big(pack + 24, (uint64)sv->pid) ;
+ uint64_pack_big(pack + 24, (uint64_t)sv->pid) ;
uint16_pack_big(pack + 32, (uint16_t)sv->wstat) ;
pack[34] =
sv->flagpaused |
diff --git a/src/libs6/s6_svstatus_read.c b/src/libs6/s6_svstatus_read.c
index 6b6ae4e..edcf38b 100644
--- a/src/libs6/s6_svstatus_read.c
+++ b/src/libs6/s6_svstatus_read.c
@@ -1,17 +1,16 @@
/* ISC license. */
-#include <sys/types.h>
-#include <skalibs/bytestr.h>
+#include <string.h>
#include <skalibs/djbunix.h>
#include <s6/s6-supervise.h>
int s6_svstatus_read (char const *dir, s6_svstatus_t *status)
{
- size_t n = str_len(dir) ;
+ size_t n = strlen(dir) ;
char pack[S6_SVSTATUS_SIZE] ;
char tmp[n + 1 + sizeof(S6_SVSTATUS_FILENAME)] ;
- byte_copy(tmp, n, dir) ;
- byte_copy(tmp + n, 1 + sizeof(S6_SVSTATUS_FILENAME), "/" S6_SVSTATUS_FILENAME) ;
+ memcpy(tmp, dir, n) ;
+ memcpy(tmp + n, "/" S6_SVSTATUS_FILENAME, 1 + sizeof(S6_SVSTATUS_FILENAME)) ;
if (openreadnclose(tmp, pack, S6_SVSTATUS_SIZE) < S6_SVSTATUS_SIZE) return 0 ;
s6_svstatus_unpack(pack, status) ;
return 1 ;
diff --git a/src/libs6/s6_svstatus_unpack.c b/src/libs6/s6_svstatus_unpack.c
index 6ec2f02..dcd923a 100644
--- a/src/libs6/s6_svstatus_unpack.c
+++ b/src/libs6/s6_svstatus_unpack.c
@@ -1,21 +1,21 @@
/* ISC license. */
#include <stdint.h>
-#include <skalibs/uint16.h>
#include <skalibs/uint64.h>
+#include <skalibs/types.h>
#include <skalibs/tai.h>
#include <s6/s6-supervise.h>
void s6_svstatus_unpack (char const *pack, s6_svstatus_t *sv)
{
- uint64 pid ;
+ uint64_t pid ;
uint16_t wstat ;
tain_unpack(pack, &sv->stamp) ;
tain_unpack(pack + 12, &sv->readystamp) ;
uint64_unpack_big(pack + 24, &pid) ;
- sv->pid = (pid_t)pid ;
+ sv->pid = pid ;
uint16_unpack_big(pack + 32, &wstat) ;
- sv->wstat = (int)wstat ;
+ sv->wstat = wstat ;
sv->flagpaused = pack[34] & 1 ;
sv->flagfinishing = !!(pack[34] & 2) ;
sv->flagwant = !!(pack[34] & 4) ;
diff --git a/src/libs6/s6_svstatus_write.c b/src/libs6/s6_svstatus_write.c
index 935db9c..29d4f40 100644
--- a/src/libs6/s6_svstatus_write.c
+++ b/src/libs6/s6_svstatus_write.c
@@ -1,17 +1,16 @@
/* ISC license. */
-#include <sys/types.h>
-#include <skalibs/bytestr.h>
+#include <string.h>
#include <skalibs/djbunix.h>
#include <s6/s6-supervise.h>
int s6_svstatus_write (char const *dir, s6_svstatus_t const *status)
{
- size_t n = str_len(dir) ;
+ size_t n = strlen(dir) ;
char pack[S6_SVSTATUS_SIZE] ;
char tmp[n + 1 + sizeof(S6_SVSTATUS_FILENAME)] ;
- byte_copy(tmp, n, dir) ;
- byte_copy(tmp + n, 1 + sizeof(S6_SVSTATUS_FILENAME), "/" S6_SVSTATUS_FILENAME) ;
+ memcpy(tmp, dir, n) ;
+ memcpy(tmp + n, "/" S6_SVSTATUS_FILENAME, 1 + sizeof(S6_SVSTATUS_FILENAME)) ;
s6_svstatus_pack(pack, status) ;
return openwritenclose_suffix(tmp, pack, S6_SVSTATUS_SIZE, ".new") ;
}
diff --git a/src/libs6/s6lock_acquire.c b/src/libs6/s6lock_acquire.c
index 2bf6171..d9b4170 100644
--- a/src/libs6/s6lock_acquire.c
+++ b/src/libs6/s6lock_acquire.c
@@ -1,12 +1,10 @@
/* ISC license. */
-#include <sys/types.h>
+#include <sys/uio.h>
+#include <string.h>
#include <stdint.h>
#include <errno.h>
-#include <skalibs/uint16.h>
-#include <skalibs/uint32.h>
-#include <skalibs/bytestr.h>
-#include <skalibs/siovec.h>
+#include <skalibs/types.h>
#include <skalibs/tai.h>
#include <skalibs/gensetdyn.h>
#include <skalibs/skaclient.h>
@@ -14,13 +12,18 @@
int s6lock_acquire (s6lock_t *a, uint16_t *u, char const *path, uint32_t options, tain_t const *limit, tain_t const *deadline, tain_t *stamp)
{
- size_t pathlen = str_len(path) ;
+ size_t pathlen = strlen(path) ;
char err ;
char tmp[23] = "--<" ;
- siovec_t v[2] = { { .s = tmp, .len = 23 }, { .s = (char *)path, .len = pathlen + 1 } } ;
+ struct iovec v[2] = { { .iov_base = tmp, .iov_len = 23 }, { .iov_base = (char *)path, .iov_len = pathlen + 1 } } ;
unsigned int i ;
if (pathlen > UINT32_MAX) return (errno = ENAMETOOLONG, 0) ;
if (!gensetdyn_new(&a->data, &i)) return 0 ;
+ if (i > UINT16_MAX)
+ {
+ gensetdyn_delete(&a->data, i) ;
+ return (errno = EMFILE, 0) ;
+ }
uint16_pack_big(tmp, (uint16_t)i) ;
uint32_pack_big(tmp+3, options) ;
tain_pack(tmp+7, limit) ;
diff --git a/src/libs6/s6lock_release.c b/src/libs6/s6lock_release.c
index 344ace4..5be66e2 100644
--- a/src/libs6/s6lock_release.c
+++ b/src/libs6/s6lock_release.c
@@ -3,7 +3,7 @@
#include <stdint.h>
#include <errno.h>
#include <skalibs/error.h>
-#include <skalibs/uint16.h>
+#include <skalibs/types.h>
#include <skalibs/tai.h>
#include <skalibs/gensetdyn.h>
#include <skalibs/skaclient.h>
diff --git a/src/libs6/s6lock_update.c b/src/libs6/s6lock_update.c
index a56c276..128f9cc 100644
--- a/src/libs6/s6lock_update.c
+++ b/src/libs6/s6lock_update.c
@@ -3,7 +3,7 @@
#include <stdint.h>
#include <errno.h>
#include <skalibs/error.h>
-#include <skalibs/uint16.h>
+#include <skalibs/types.h>
#include <skalibs/genalloc.h>
#include <skalibs/gensetdyn.h>
#include <skalibs/unixmessage.h>
diff --git a/src/libs6/s6lock_wait_and.c b/src/libs6/s6lock_wait_and.c
index 30c7a43..22ec63b 100644
--- a/src/libs6/s6lock_wait_and.c
+++ b/src/libs6/s6lock_wait_and.c
@@ -14,7 +14,7 @@ int s6lock_wait_and (s6lock_t *a, uint16_t const *idlist, unsigned int n, tain_t
{
for (;;)
{
- register int r = s6lock_check(a, *idlist) ;
+ int r = s6lock_check(a, *idlist) ;
if (r < 0) return r ;
else if (r) break ;
r = iopause_stamp(&x, 1, deadline, stamp) ;
diff --git a/src/libs6/s6lock_wait_or.c b/src/libs6/s6lock_wait_or.c
index 1a4d468..f098339 100644
--- a/src/libs6/s6lock_wait_or.c
+++ b/src/libs6/s6lock_wait_or.c
@@ -14,8 +14,8 @@ int s6lock_wait_or (s6lock_t *a, uint16_t const *idlist, unsigned int n, tain_t
if (x.fd < 0) return -1 ;
for (;;)
{
- register unsigned int i = 0 ;
- register int r ;
+ unsigned int i = 0 ;
+ int r ;
for (; i < n ; i++)
{
r = s6lock_check(a, idlist[i]) ;
diff --git a/src/libs6/s6lockd.c b/src/libs6/s6lockd.c
index e8c8cb6..5899b46 100644
--- a/src/libs6/s6lockd.c
+++ b/src/libs6/s6lockd.c
@@ -1,12 +1,10 @@
/* ISC license. */
-#include <sys/types.h>
#include <stdint.h>
#include <unistd.h>
#include <errno.h>
#include <signal.h>
-#include <skalibs/uint16.h>
-#include <skalibs/uint32.h>
+#include <skalibs/types.h>
#include <skalibs/allreadwrite.h>
#include <skalibs/error.h>
#include <skalibs/strerr2.h>
@@ -39,7 +37,7 @@ static genalloc a = GENALLOC_ZERO ; /* array of s6lockio_t */
static void s6lockio_free (s6lockio_t *p)
{
- register int e = errno ;
+ int e = errno ;
fd_close(p->p[1]) ;
fd_close(p->p[0]) ;
kill(p->pid, SIGTERM) ;
@@ -49,7 +47,7 @@ static void s6lockio_free (s6lockio_t *p)
static void cleanup (void)
{
- register size_t i = genalloc_len(s6lockio_t, &a) ;
+ size_t i = genalloc_len(s6lockio_t, &a) ;
for (; i ; i--) s6lockio_free(genalloc_s(s6lockio_t, &a) + i - 1) ;
genalloc_setlen(s6lockio_t, &a, 0) ;
}
@@ -79,7 +77,7 @@ static void answer (char c)
static void remove (unsigned int i)
{
- register size_t n = genalloc_len(s6lockio_t, &a) - 1 ;
+ size_t n = genalloc_len(s6lockio_t, &a) - 1 ;
s6lockio_free(genalloc_s(s6lockio_t, &a) + i) ;
genalloc_s(s6lockio_t, &a)[i] = genalloc_s(s6lockio_t, &a)[n] ;
genalloc_setlen(s6lockio_t, &a, n) ;
@@ -117,7 +115,7 @@ static int parse_protocol (unixmessage_t const *m, void *context)
{
case '>' : /* release */
{
- register size_t i = genalloc_len(s6lockio_t, &a) ;
+ size_t i = genalloc_len(s6lockio_t, &a) ;
for (; i ; i--) if (genalloc_s(s6lockio_t, &a)[i-1].id == id) break ;
if (i)
{
@@ -211,7 +209,7 @@ int main (int argc, char const *const *argv)
for (;;)
{
- register size_t n = genalloc_len(s6lockio_t, &a) ;
+ size_t n = genalloc_len(s6lockio_t, &a) ;
iopause_fd x[4 + n] ;
unsigned int i = 0 ;
int r ;
@@ -224,7 +222,7 @@ int main (int argc, char const *const *argv)
x[3].fd = sfd ; x[3].events = IOPAUSE_READ ;
for (; i < n ; i++)
{
- register s6lockio_t_ref p = genalloc_s(s6lockio_t, &a) + i ;
+ s6lockio_t *p = genalloc_s(s6lockio_t, &a) + i ;
x[4+i].fd = p->p[0] ;
x[4+i].events = IOPAUSE_READ ;
if (p->limit.sec.x && tain_less(&p->limit, &deadline)) deadline = p->limit ;
@@ -243,7 +241,7 @@ int main (int argc, char const *const *argv)
{
for (i = 0 ; i < n ; i++)
{
- register s6lockio_t_ref p = genalloc_s(s6lockio_t, &a) + i ;
+ s6lockio_t *p = genalloc_s(s6lockio_t, &a) + i ;
if (p->limit.sec.x && !tain_future(&p->limit)) break ;
}
if (i < n)
@@ -274,12 +272,12 @@ int main (int argc, char const *const *argv)
/* scan children for successes */
for (i = 0 ; i < genalloc_len(s6lockio_t, &a) ; i++)
{
- register s6lockio_t *p = genalloc_s(s6lockio_t, &a) + i ;
+ s6lockio_t *p = genalloc_s(s6lockio_t, &a) + i ;
if (p->p[0] < 0) continue ;
if (x[p->xindex].revents & IOPAUSE_READ)
{
char c ;
- register ssize_t r = sanitize_read(fd_read(p->p[0], &c, 1)) ;
+ ssize_t r = sanitize_read(fd_read(p->p[0], &c, 1)) ;
if (!r) continue ;
if (r < 0)
{
diff --git a/src/pipe-tools/s6-ftrig-listen.c b/src/pipe-tools/s6-ftrig-listen.c
index 112c853..f0ef2bf 100644
--- a/src/pipe-tools/s6-ftrig-listen.c
+++ b/src/pipe-tools/s6-ftrig-listen.c
@@ -1,12 +1,11 @@
/* ISC license. */
-#include <sys/types.h>
#include <stdint.h>
#include <errno.h>
#include <signal.h>
#include <unistd.h>
#include <skalibs/sgetopt.h>
-#include <skalibs/uint.h>
+#include <skalibs/types.h>
#include <skalibs/strerr2.h>
#include <skalibs/tai.h>
#include <skalibs/iopause.h>
@@ -43,7 +42,7 @@ int main (int argc, char const **argv, char const *const *envp)
unsigned int t = 0 ;
for (;;)
{
- register int opt = subgetopt(argc, argv, "aot:") ;
+ int opt = subgetopt(argc, argv, "aot:") ;
if (opt == -1) break ;
switch (opt)
{
@@ -85,7 +84,7 @@ int main (int argc, char const **argv, char const *const *envp)
for (;;)
{
- register int r ;
+ int r ;
i = 0 ;
while (i < idlen)
{
diff --git a/src/pipe-tools/s6-ftrig-listen1.c b/src/pipe-tools/s6-ftrig-listen1.c
index f5f7814..e9a5e82 100644
--- a/src/pipe-tools/s6-ftrig-listen1.c
+++ b/src/pipe-tools/s6-ftrig-listen1.c
@@ -1,12 +1,11 @@
/* ISC license. */
-#include <sys/types.h>
#include <stdint.h>
#include <errno.h>
#include <signal.h>
#include <unistd.h>
#include <skalibs/sgetopt.h>
-#include <skalibs/uint.h>
+#include <skalibs/types.h>
#include <skalibs/strerr2.h>
#include <skalibs/tai.h>
#include <skalibs/iopause.h>
@@ -40,7 +39,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
unsigned int t = 0 ;
for (;;)
{
- register int opt = subgetopt(argc, argv, "t:") ;
+ int opt = subgetopt(argc, argv, "t:") ;
if (opt == -1) break ;
switch (opt)
{
@@ -73,7 +72,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
for (;;)
{
char dummy ;
- register int r = ftrigr_check(&a, id, &dummy) ;
+ int r = ftrigr_check(&a, id, &dummy) ;
if (r < 0) strerr_diefu1sys(111, "ftrigr_check") ;
if (r) break ;
r = iopause_g(x, 2, &deadline) ;
diff --git a/src/pipe-tools/s6-ftrig-wait.c b/src/pipe-tools/s6-ftrig-wait.c
index 40d458e..5aca73c 100644
--- a/src/pipe-tools/s6-ftrig-wait.c
+++ b/src/pipe-tools/s6-ftrig-wait.c
@@ -4,7 +4,7 @@
#include <errno.h>
#include <skalibs/allreadwrite.h>
#include <skalibs/sgetopt.h>
-#include <skalibs/uint.h>
+#include <skalibs/types.h>
#include <skalibs/strerr2.h>
#include <skalibs/tai.h>
#include <s6/ftrigr.h>
@@ -22,7 +22,7 @@ int main (int argc, char const *const *argv)
unsigned int t = 0 ;
for (;;)
{
- register int opt = subgetopt(argc, argv, "t:") ;
+ int opt = subgetopt(argc, argv, "t:") ;
if (opt == -1) break ;
switch (opt)
{
diff --git a/src/pipe-tools/s6-mkfifodir.c b/src/pipe-tools/s6-mkfifodir.c
index 268d822..cad7d06 100644
--- a/src/pipe-tools/s6-mkfifodir.c
+++ b/src/pipe-tools/s6-mkfifodir.c
@@ -2,7 +2,7 @@
#include <sys/types.h>
#include <skalibs/sgetopt.h>
-#include <skalibs/gidstuff.h>
+#include <skalibs/types.h>
#include <skalibs/strerr2.h>
#include <s6/ftrigw.h>
@@ -16,7 +16,7 @@ int main (int argc, char const *const *argv)
PROG = "s6-mkfifodir" ;
for (;;)
{
- register int opt = subgetopt_r(argc, argv, "fg:", &l) ;
+ int opt = subgetopt_r(argc, argv, "fg:", &l) ;
if (opt == -1) break ;
switch (opt)
{
diff --git a/src/supervision/s6-supervise.c b/src/supervision/s6-supervise.c
index fa2cff9..dcafc83 100644
--- a/src/supervision/s6-supervise.c
+++ b/src/supervision/s6-supervise.c
@@ -3,16 +3,16 @@
/* For SIGWINCH */
#include <skalibs/nonposix.h>
-#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
+#include <string.h>
#include <strings.h>
#include <errno.h>
#include <fcntl.h>
#include <signal.h>
#include <skalibs/allreadwrite.h>
#include <skalibs/bytestr.h>
-#include <skalibs/uint.h>
+#include <skalibs/types.h>
#include <skalibs/strerr2.h>
#include <skalibs/tai.h>
#include <skalibs/iopause.h>
@@ -73,7 +73,7 @@ static inline void announce (void)
static int read_uint (char const *file, unsigned int *fd)
{
char buf[UINT_FMT + 1] ;
- register ssize_t r = openreadnclose_nb(file, buf, UINT_FMT) ;
+ ssize_t r = openreadnclose_nb(file, buf, UINT_FMT) ;
if (r < 0)
{
if (errno != ENOENT) strerr_warnwu2sys("open ", file) ;
@@ -491,11 +491,11 @@ static action_t_ref const actions[5][25] =
static inline void handle_notifyfd (void)
{
char buf[4096] ;
- register ssize_t r = 1 ;
+ ssize_t r = 1 ;
while (r > 0)
{
r = sanitize_read(fd_read(notifyfd, buf, 4096)) ;
- if (r > 0 && byte_chr(buf, r, '\n') < r)
+ if (r > 0 && memchr(buf, r, '\n'))
{
tain_copynow(&status.readystamp) ;
status.flagready = 1 ;
@@ -553,12 +553,12 @@ static inline void handle_control (int fd)
for (;;)
{
char c ;
- register ssize_t r = sanitize_read(fd_read(fd, &c, 1)) ;
+ ssize_t r = sanitize_read(fd_read(fd, &c, 1)) ;
if (r < 0) strerr_diefu1sys(111, "read " S6_SUPERVISE_CTLDIR "/control") ;
else if (!r) break ;
else
{
- register size_t pos = byte_chr("abqhkti12fFpcyoduxOX", 20, c) ;
+ size_t pos = byte_chr("abqhkti12fFpcyoduxOX", 20, c) ;
if (pos < 20) (*actions[state][V_a + pos])() ;
}
}
@@ -571,12 +571,12 @@ int main (int argc, char const *const *argv)
if (argc < 2) strerr_dieusage(100, USAGE) ;
if (chdir(argv[1]) < 0) strerr_diefu2sys(111, "chdir to ", argv[1]) ;
{
- size_t proglen = str_len(PROG) ;
- size_t namelen = str_len(argv[1]) ;
+ size_t proglen = strlen(PROG) ;
+ size_t namelen = strlen(argv[1]) ;
char progname[proglen + namelen + 2] ;
- byte_copy(progname, proglen, PROG) ;
+ memcpy(progname, PROG, proglen) ;
progname[proglen] = ' ' ;
- byte_copy(progname + proglen + 1, namelen + 1, argv[1]) ;
+ memcpy(progname + proglen + 1, argv[1], namelen + 1) ;
PROG = progname ;
if (!fd_sanitize()) strerr_diefu1sys(111, "sanitize stdin and stdout") ;
x[1].fd = s6_supervise_lock(S6_SUPERVISE_CTLDIR) ;
@@ -611,7 +611,7 @@ int main (int argc, char const *const *argv)
while (cont)
{
- register int r ;
+ int r ;
x[2].fd = notifyfd ;
r = iopause_g(x, 2 + (notifyfd >= 0), &deadline) ;
if (r < 0) strerr_diefu1sys(111, "iopause") ;
diff --git a/src/supervision/s6-svc.c b/src/supervision/s6-svc.c
index c929806..ed323af 100644
--- a/src/supervision/s6-svc.c
+++ b/src/supervision/s6-svc.c
@@ -1,10 +1,9 @@
/* ISC license. */
-#include <sys/types.h>
+#include <string.h>
#include <unistd.h>
#include <errno.h>
-#include <skalibs/uint.h>
-#include <skalibs/bytestr.h>
+#include <skalibs/types.h>
#include <skalibs/sgetopt.h>
#include <skalibs/strerr2.h>
#include <skalibs/djbunix.h>
@@ -27,7 +26,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
subgetopt_t l = SUBGETOPT_ZERO ;
for (;;)
{
- register int opt = subgetopt_r(argc, argv, "abqhkti12pcoduxOXyT:w:", &l) ;
+ int opt = subgetopt_r(argc, argv, "abqhkti12pcoduxOXyT:w:", &l) ;
if (opt == -1) break ;
switch (opt)
{
@@ -57,7 +56,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
case 'T' : if (!uint0_scan(l.arg, &timeout)) dieusage() ; break ;
case 'w' :
{
- if (byte_chr("dDuUrR", 6, l.arg[0]) >= 6) dieusage() ;
+ if (!memchr("dDuUrR", 6, l.arg[0])) dieusage() ;
updown[1] = l.arg[0] ;
break ;
}
@@ -72,10 +71,10 @@ int main (int argc, char const *const *argv, char const *const *envp)
if (datalen <= 1) return 0 ;
if (updown[1] == 'U' || updown[1] == 'R')
{
- size_t arglen = str_len(argv[0]) ;
+ size_t arglen = strlen(argv[0]) ;
char fn[arglen + 17] ;
- byte_copy(fn, arglen, argv[0]) ;
- byte_copy(fn + arglen, 17, "/notification-fd") ;
+ memcpy(fn, argv[0], arglen) ;
+ memcpy(fn + arglen, "/notification-fd", 17) ;
if (access(fn, F_OK) < 0)
{
if (errno != ENOENT) strerr_diefu2sys(111, "access ", fn) ;
@@ -109,7 +108,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
}
else
{
- register int r = s6_svc_writectl(argv[0], S6_SUPERVISE_CTLDIR, data + 1, datalen - 1) ;
+ int r = s6_svc_writectl(argv[0], S6_SUPERVISE_CTLDIR, data + 1, datalen - 1) ;
if (r < 0) strerr_diefu2sys(111, "control ", argv[0]) ;
else if (!r) strerr_diefu3x(100, "control ", argv[0], ": supervisor not listening") ;
}
diff --git a/src/supervision/s6-svlisten.c b/src/supervision/s6-svlisten.c
index 319a4c3..f2191fd 100644
--- a/src/supervision/s6-svlisten.c
+++ b/src/supervision/s6-svlisten.c
@@ -1,9 +1,8 @@
/* ISC license. */
-#include <sys/types.h>
#include <stdint.h>
#include <skalibs/sgetopt.h>
-#include <skalibs/uint.h>
+#include <skalibs/types.h>
#include <skalibs/bitarray.h>
#include <skalibs/tai.h>
#include <skalibs/strerr2.h>
@@ -27,7 +26,7 @@ int main (int argc, char const **argv, char const *const *envp)
unsigned int t = 0 ;
for (;;)
{
- register int opt = subgetopt_r(argc, argv, "uUdDrRaot:", &l) ;
+ int opt = subgetopt_r(argc, argv, "uUdDrRaot:", &l) ;
if (opt == -1) break ;
switch (opt)
{
diff --git a/src/supervision/s6-svlisten1.c b/src/supervision/s6-svlisten1.c
index f5608f0..d9a5de4 100644
--- a/src/supervision/s6-svlisten1.c
+++ b/src/supervision/s6-svlisten1.c
@@ -1,9 +1,8 @@
/* ISC license. */
-#include <sys/types.h>
#include <stdint.h>
#include <skalibs/sgetopt.h>
-#include <skalibs/uint.h>
+#include <skalibs/types.h>
#include <skalibs/tai.h>
#include <skalibs/strerr2.h>
#include <skalibs/djbunix.h>
@@ -27,7 +26,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
unsigned int t = 0 ;
for (;;)
{
- register int opt = subgetopt_r(argc, argv, "uUdDrRt:", &l) ;
+ int opt = subgetopt_r(argc, argv, "uUdDrRt:", &l) ;
if (opt == -1) break ;
switch (opt)
{
@@ -53,7 +52,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
if (!pid) strerr_diefu2sys(111, "spawn ", argv[1]) ;
if (wantrestart)
{
- register int r = s6_svlisten_loop(&foo, 0, 1, 1, &deadline, spfd, &s6_svlisten_signal_handler) ;
+ int r = s6_svlisten_loop(&foo, 0, 1, 1, &deadline, spfd, &s6_svlisten_signal_handler) ;
if (r) return r ;
wantup = 1 ;
}
diff --git a/src/supervision/s6-svscan.c b/src/supervision/s6-svscan.c
index cf8714c..690a068 100644
--- a/src/supervision/s6-svscan.c
+++ b/src/supervision/s6-svscan.c
@@ -1,15 +1,14 @@
/* ISC license. */
-#include <sys/types.h>
+#include <string.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <unistd.h>
#include <errno.h>
#include <signal.h>
#include <skalibs/allreadwrite.h>
-#include <skalibs/bytestr.h>
#include <skalibs/sgetopt.h>
-#include <skalibs/uint.h>
+#include <skalibs/types.h>
#include <skalibs/strerr2.h>
#include <skalibs/tai.h>
#include <skalibs/iopause.h>
@@ -74,7 +73,7 @@ static void panic (char const *errmsg)
static void killthem (void)
{
- register unsigned int i = 0 ;
+ unsigned int i = 0 ;
if (!wantkill) return ;
for (; i < n ; i++)
{
@@ -140,7 +139,7 @@ static void handle_diverted_signals (void)
{
for (;;)
{
- register int sig = selfpipe_read() ;
+ int sig = selfpipe_read() ;
switch (sig)
{
case -1 : panic("selfpipe_read") ;
@@ -151,11 +150,11 @@ static void handle_diverted_signals (void)
default :
{
char const *name = sig_name(sig) ;
- size_t len = str_len(name) ;
+ size_t len = strlen(name) ;
char fn[SIGNAL_PROG_LEN + len + 1] ;
char const *const newargv[2] = { fn, 0 } ;
- byte_copy(fn, SIGNAL_PROG_LEN, SIGNAL_PROG) ;
- byte_copy(fn + SIGNAL_PROG_LEN, len + 1, name) ;
+ memcpy(fn, SIGNAL_PROG, SIGNAL_PROG_LEN) ;
+ memcpy(fn + SIGNAL_PROG_LEN, name, len + 1) ;
if (!child_spawn0(newargv[0], newargv, (char const **)environ))
strerr_warnwu2sys("spawn ", newargv[0]) ;
}
@@ -213,14 +212,14 @@ static void reap (void)
for (;;)
{
int wstat ;
- int r = wait_nohang(&wstat) ;
+ pid_t r = wait_nohang(&wstat) ;
if (r < 0)
if (errno != ECHILD) panic("wait_nohang") ;
else break ;
else if (!r) break ;
else
{
- register unsigned int i = 0 ;
+ unsigned int i = 0 ;
for (; i < n ; i++)
{
if (services[i].pid[0] == r)
@@ -324,7 +323,7 @@ static void check (char const *name)
return ;
}
if (!S_ISDIR(st.st_mode)) return ;
- namelen = str_len(name) ;
+ namelen = strlen(name) ;
for (; i < n ; i++) if ((services[i].ino == st.st_ino) && (services[i].dev == st.st_dev)) break ;
if (i < n)
{
@@ -346,8 +345,8 @@ static void check (char const *name)
{
struct stat su ;
char tmp[namelen + 5] ;
- byte_copy(tmp, namelen, name) ;
- byte_copy(tmp + namelen, 5, "/log") ;
+ memcpy(tmp, name, namelen) ;
+ memcpy(tmp + namelen, "/log", 5) ;
if (stat(tmp, &su) < 0)
if (errno == ENOENT) services[i].flaglog = 0 ;
else
@@ -385,8 +384,8 @@ static void check (char const *name)
if (!tain_future(&services[i].restartafter[1]))
{
char tmp[namelen + 5] ;
- byte_copy(tmp, namelen, name) ;
- byte_copy(tmp + namelen, 5, "/log") ;
+ memcpy(tmp, name, namelen) ;
+ memcpy(tmp + namelen, "/log", 5) ;
trystart(i, tmp, 1) ;
}
else if (tain_less(&services[i].restartafter[1], &deadline))
@@ -456,7 +455,7 @@ int main (int argc, char const *const *argv)
unsigned int t = 0 ;
for (;;)
{
- register int opt = subgetopt_r(argc, argv, "Sst:c:", &l) ;
+ int opt = subgetopt_r(argc, argv, "Sst:c:", &l) ;
if (opt == -1) break ;
switch (opt)
{
diff --git a/src/supervision/s6-svscanctl.c b/src/supervision/s6-svscanctl.c
index a991146..2794290 100644
--- a/src/supervision/s6-svscanctl.c
+++ b/src/supervision/s6-svscanctl.c
@@ -1,6 +1,5 @@
/* ISC license. */
-#include <skalibs/bytestr.h>
#include <skalibs/sgetopt.h>
#include <skalibs/strerr2.h>
#include <s6/s6-supervise.h>
@@ -20,7 +19,7 @@ int main (int argc, char const *const *argv)
subgetopt_t l = SUBGETOPT_ZERO ;
for (;;)
{
- register int opt = subgetopt_r(argc, argv, "phratszbnNiq0678", &l) ;
+ int opt = subgetopt_r(argc, argv, "phratszbnNiq0678", &l) ;
if (opt == -1) break ;
switch (opt)
{
diff --git a/src/supervision/s6-svstat.c b/src/supervision/s6-svstat.c
index 2a0f1aa..2b4da7a 100644
--- a/src/supervision/s6-svstat.c
+++ b/src/supervision/s6-svstat.c
@@ -1,12 +1,11 @@
/* ISC license. */
-#include <sys/types.h>
#include <sys/wait.h>
+#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <skalibs/uint64.h>
-#include <skalibs/uint.h>
-#include <skalibs/bytestr.h>
+#include <skalibs/types.h>
#include <skalibs/buffer.h>
#include <skalibs/strerr2.h>
#include <skalibs/sgetopt.h>
@@ -23,13 +22,13 @@ int main (int argc, char const *const *argv)
s6_svstatus_t status ;
int flagnum = 0 ;
int isup, normallyup ;
- char fmt[UINT_FMT] ;
+ char fmt[UINT64_FMT] ;
PROG = "s6-svstat" ;
{
subgetopt_t l = SUBGETOPT_ZERO ;
for (;;)
{
- register int opt = subgetopt_r(argc, argv, "n", &l) ;
+ int opt = subgetopt_r(argc, argv, "n", &l) ;
if (opt == -1) break ;
switch (opt)
{
@@ -51,10 +50,10 @@ int main (int argc, char const *const *argv)
if (tain_future(&status.stamp)) tain_copynow(&status.stamp) ;
{
- size_t dirlen = str_len(*argv) ;
+ size_t dirlen = strlen(*argv) ;
char fn[dirlen + 6] ;
- byte_copy(fn, dirlen, *argv) ;
- byte_copy(fn + dirlen, 6, "/down") ;
+ memcpy(fn, *argv, dirlen) ;
+ memcpy(fn + dirlen, "/down", 6) ;
if (access(fn, F_OK) < 0)
if (errno != ENOENT) strerr_diefu2sys(111, "access ", fn) ;
else normallyup = 1 ;
@@ -65,7 +64,7 @@ int main (int argc, char const *const *argv)
if (isup)
{
buffer_putnoflush(buffer_1small,"up (pid ", 8) ;
- buffer_putnoflush(buffer_1small, fmt, uint_fmt(fmt, status.pid)) ;
+ buffer_putnoflush(buffer_1small, fmt, pid_fmt(fmt, status.pid)) ;
buffer_putnoflush(buffer_1small, ") ", 2) ;
}
else
diff --git a/src/supervision/s6-svwait.c b/src/supervision/s6-svwait.c
index 3f05b75..752da69 100644
--- a/src/supervision/s6-svwait.c
+++ b/src/supervision/s6-svwait.c
@@ -2,7 +2,7 @@
#include <stdint.h>
#include <skalibs/sgetopt.h>
-#include <skalibs/uint.h>
+#include <skalibs/types.h>
#include <skalibs/bitarray.h>
#include <skalibs/tai.h>
#include <skalibs/strerr2.h>
@@ -22,7 +22,7 @@ int main (int argc, char const *const *argv)
unsigned int t = 0 ;
for (;;)
{
- register int opt = subgetopt_r(argc, argv, "UudDaot:", &l) ;
+ int opt = subgetopt_r(argc, argv, "UudDaot:", &l) ;
if (opt == -1) break ;
switch (opt)
{
diff --git a/src/supervision/s6_svlisten_loop.c b/src/supervision/s6_svlisten_loop.c
index 40c7b88..5f60be6 100644
--- a/src/supervision/s6_svlisten_loop.c
+++ b/src/supervision/s6_svlisten_loop.c
@@ -1,11 +1,11 @@
/* ISC license. */
-#include <sys/types.h>
+#include <string.h>
#include <stdint.h>
#include <unistd.h>
#include <errno.h>
+#include <skalibs/types.h>
#include <skalibs/bytestr.h>
-#include <skalibs/uint16.h>
#include <skalibs/bitarray.h>
#include <skalibs/tai.h>
#include <skalibs/strerr2.h>
@@ -17,7 +17,7 @@
void s6_svlisten_init (int argc, char const *const *argv, s6_svlisten_t *foo, uint16_t *ids, unsigned char *upstate, unsigned char *readystate, tain_t const *deadline)
{
- register unsigned int i = 0 ;
+ unsigned int i = 0 ;
foo->n = (unsigned int)argc ;
foo->ids = ids ;
foo->upstate = upstate ;
@@ -26,11 +26,11 @@ void s6_svlisten_init (int argc, char const *const *argv, s6_svlisten_t *foo, ui
for (; i < foo->n ; i++)
{
s6_svstatus_t status = S6_SVSTATUS_ZERO ;
- size_t len = str_len(argv[i]) ;
+ size_t len = strlen(argv[i]) ;
char s[len + 1 + sizeof(S6_SUPERVISE_EVENTDIR)] ;
- byte_copy(s, len, argv[i]) ;
+ memcpy(s, argv[i], len) ;
s[len] = '/' ;
- byte_copy(s + len + 1, sizeof(S6_SUPERVISE_EVENTDIR), S6_SUPERVISE_EVENTDIR) ;
+ memcpy(s + len + 1, S6_SUPERVISE_EVENTDIR, sizeof(S6_SUPERVISE_EVENTDIR)) ;
foo->ids[i] = ftrigr_subscribe_g(&foo->a, s, "[DuUd]", FTRIGR_REPEAT, deadline) ;
if (!foo->ids[i]) strerr_diefu2sys(111, "subscribe to events for ", argv[i]) ;
if (!s6_svstatus_read(argv[i], &status)) strerr_diefu1sys(111, "s6_svstatus_read") ;
@@ -41,9 +41,9 @@ void s6_svlisten_init (int argc, char const *const *argv, s6_svlisten_t *foo, ui
static inline int got (s6_svlisten_t const *foo, int wantup, int wantready, int or)
{
- register unsigned int m = bitarray_div8(foo->n) ;
+ unsigned int m = bitarray_div8(foo->n) ;
unsigned char t[m] ;
- byte_copy(t, m, foo->upstate) ;
+ memcpy(t, foo->upstate, m) ;
if (!wantup) bitarray_not(t, 0, foo->n) ;
if (wantready) bitarray_and(t, t, foo->readystate, foo->n) ;
return (bitarray_first(t, foo->n, or) < foo->n) == or ;
@@ -54,22 +54,22 @@ int s6_svlisten_loop (s6_svlisten_t *foo, int wantup, int wantready, int or, tai
iopause_fd x[2] = { { .fd = ftrigr_fd(&foo->a), .events = IOPAUSE_READ }, { .fd = spfd, .events = IOPAUSE_READ, .revents = 0 } } ;
while (!got(foo, wantup, wantready, or))
{
- register int r = iopause_g(x, 1 + (spfd >= 0), deadline) ;
+ int r = iopause_g(x, 1 + (spfd >= 0), deadline) ;
if (r < 0) strerr_diefu1sys(111, "iopause") ;
else if (!r) strerr_dief1x(1, "timed out") ;
if (x[1].revents & IOPAUSE_READ) (*handler)() ;
if (x[0].revents & IOPAUSE_READ)
{
- register unsigned int i = 0 ;
+ unsigned int i = 0 ;
if (ftrigr_update(&foo->a) < 0) strerr_diefu1sys(111, "ftrigr_update") ;
for (; i < foo->n ; i++)
{
char what ;
- register int r = ftrigr_check(&foo->a, foo->ids[i], &what) ;
+ int r = ftrigr_check(&foo->a, foo->ids[i], &what) ;
if (r < 0) strerr_diefu1sys(111, "ftrigr_check") ;
if (r)
{
- register unsigned int d = byte_chr("dDuU", 4, what) ;
+ unsigned int d = byte_chr("dDuU", 4, what) ;
bitarray_poke(foo->upstate, i, d & 2) ;
bitarray_poke(foo->readystate, i, d & 1) ;
}
diff --git a/src/supervision/s6_svlisten_signal_handler.c b/src/supervision/s6_svlisten_signal_handler.c
index 0738f43..bfb72bd 100644
--- a/src/supervision/s6_svlisten_signal_handler.c
+++ b/src/supervision/s6_svlisten_signal_handler.c
@@ -9,7 +9,7 @@
int s6_svlisten_selfpipe_init (void)
{
- register int spfd = selfpipe_init() ;
+ int spfd = selfpipe_init() ;
if (spfd < 0) strerr_diefu1sys(111, "selfpipe_init") ;
if (selfpipe_trap(SIGCHLD) < 0) strerr_diefu1sys(111, "selfpipe_trap") ;
if (sig_ignore(SIGPIPE) < 0) strerr_diefu1sys(111, "ignore SIGPIPE") ;