diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2017-03-12 11:59:43 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2017-03-12 11:59:43 +0000 |
commit | c60ebd422171808ad58b936914055397bb205bef (patch) | |
tree | 7db3e5728d72ad209f8e22b9eb9f337e0b0c3e58 /src/fdholder | |
parent | e28fe5908a91d8795ca9923d64eeed7d3e898434 (diff) | |
download | s6-c60ebd422171808ad58b936914055397bb205bef.tar.xz |
Adapt to skalibs-2.5.0.0
Diffstat (limited to 'src/fdholder')
-rw-r--r-- | src/fdholder/s6-fdholder-daemon.c | 13 | ||||
-rw-r--r-- | src/fdholder/s6-fdholder-delete.c | 4 | ||||
-rw-r--r-- | src/fdholder/s6-fdholder-deletec.c | 4 | ||||
-rw-r--r-- | src/fdholder/s6-fdholder-getdump.c | 4 | ||||
-rw-r--r-- | src/fdholder/s6-fdholder-getdumpc.c | 19 | ||||
-rw-r--r-- | src/fdholder/s6-fdholder-list.c | 4 | ||||
-rw-r--r-- | src/fdholder/s6-fdholder-listc.c | 9 | ||||
-rw-r--r-- | src/fdholder/s6-fdholder-retrieve.c | 4 | ||||
-rw-r--r-- | src/fdholder/s6-fdholder-retrievec.c | 4 | ||||
-rw-r--r-- | src/fdholder/s6-fdholder-setdump.c | 4 | ||||
-rw-r--r-- | src/fdholder/s6-fdholder-setdumpc.c | 17 | ||||
-rw-r--r-- | src/fdholder/s6-fdholder-store.c | 4 | ||||
-rw-r--r-- | src/fdholder/s6-fdholder-storec.c | 4 | ||||
-rw-r--r-- | src/fdholder/s6-fdholder-transferdump.c | 4 | ||||
-rw-r--r-- | src/fdholder/s6-fdholder-transferdumpc.c | 4 | ||||
-rw-r--r-- | src/fdholder/s6-fdholderd.c | 65 |
16 files changed, 81 insertions, 86 deletions
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, <imeout)) 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) { |