summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/conn-tools/s6-accessrules-cdb-from-fs.c16
-rw-r--r--src/conn-tools/s6-accessrules-fs-from-cdb.c20
-rw-r--r--src/conn-tools/s6-connlimit.c3
-rw-r--r--src/conn-tools/s6-ipcclient.c5
-rw-r--r--src/conn-tools/s6-ipcserver-access.c35
-rw-r--r--src/conn-tools/s6-ipcserver.c2
-rw-r--r--src/conn-tools/s6-ipcserverd.c87
-rw-r--r--src/conn-tools/s6-sudoc.c10
-rw-r--r--src/conn-tools/s6-sudod.c16
-rw-r--r--src/daemontools-extras/s6-applyuidgid.c16
-rw-r--r--src/daemontools-extras/s6-envuidgid.c8
-rw-r--r--src/daemontools-extras/s6-log.c61
-rw-r--r--src/daemontools-extras/s6-setlock.c10
-rw-r--r--src/daemontools-extras/s6-setuidgid.c3
-rw-r--r--src/daemontools-extras/s6-tai64nlocal.c2
-rw-r--r--src/daemontools-extras/ucspilogd.c8
-rw-r--r--src/fdholder/s6-fdholder-daemon.c3
-rw-r--r--src/fdholder/s6-fdholder-getdumpc.c10
-rw-r--r--src/fdholder/s6-fdholder-listc.c5
-rw-r--r--src/fdholder/s6-fdholder-setdumpc.c4
-rw-r--r--src/fdholder/s6-fdholder-transferdump.c3
-rw-r--r--src/fdholder/s6-fdholderd.c20
-rw-r--r--src/include/s6/accessrules.h15
-rw-r--r--src/include/s6/ftrigw.h5
-rw-r--r--src/include/s6/s6-supervise.h4
-rw-r--r--src/libs6/ftrig1_make.c4
-rw-r--r--src/libs6/ftrigr_check.c4
-rw-r--r--src/libs6/ftrigr_end.c3
-rw-r--r--src/libs6/ftrigr_subscribe.c14
-rw-r--r--src/libs6/ftrigr_unsubscribe.c3
-rw-r--r--src/libs6/ftrigr_update.c9
-rw-r--r--src/libs6/ftrigr_wait_and.c4
-rw-r--r--src/libs6/ftrigr_wait_or.c4
-rw-r--r--src/libs6/ftrigw_clean.c3
-rw-r--r--src/libs6/ftrigw_notifyb.c3
-rw-r--r--src/libs6/ftrigw_notifyb_nosig.c9
-rw-r--r--src/libs6/s6-ftrigrd.c16
-rw-r--r--src/libs6/s6_accessrules_backend_cdb.c9
-rw-r--r--src/libs6/s6_accessrules_backend_fs.c9
-rw-r--r--src/libs6/s6_accessrules_keycheck_ip4.c6
-rw-r--r--src/libs6/s6_accessrules_keycheck_ip6.c3
-rw-r--r--src/libs6/s6_accessrules_keycheck_reversedns.c5
-rw-r--r--src/libs6/s6_accessrules_keycheck_uidgid.c10
-rw-r--r--src/libs6/s6_accessrules_uidgid_cdb.c6
-rw-r--r--src/libs6/s6_accessrules_uidgid_fs.c6
-rw-r--r--src/libs6/s6_fdholder_delete_async.c3
-rw-r--r--src/libs6/s6_fdholder_getdump.c22
-rw-r--r--src/libs6/s6_fdholder_list_cb.c3
-rw-r--r--src/libs6/s6_fdholder_retrieve_async.c3
-rw-r--r--src/libs6/s6_fdholder_setdump.c8
-rw-r--r--src/libs6/s6_fdholder_store_async.c3
-rw-r--r--src/libs6/s6_supervise_lock_mode.c2
-rw-r--r--src/libs6/s6_svc_ok.c3
-rw-r--r--src/libs6/s6_svc_write.c3
-rw-r--r--src/libs6/s6_svc_writectl.c7
-rw-r--r--src/libs6/s6_svstatus_pack.c3
-rw-r--r--src/libs6/s6_svstatus_read.c3
-rw-r--r--src/libs6/s6_svstatus_unpack.c4
-rw-r--r--src/libs6/s6_svstatus_write.c3
-rw-r--r--src/libs6/s6lock_acquire.c11
-rw-r--r--src/libs6/s6lock_check.c4
-rw-r--r--src/libs6/s6lock_end.c3
-rw-r--r--src/libs6/s6lock_release.c3
-rw-r--r--src/libs6/s6lock_start.c2
-rw-r--r--src/libs6/s6lock_update.c7
-rw-r--r--src/libs6/s6lock_wait_and.c6
-rw-r--r--src/libs6/s6lock_wait_or.c4
-rw-r--r--src/libs6/s6lockd.c24
-rw-r--r--src/pipe-tools/s6-ftrig-listen.c6
-rw-r--r--src/pipe-tools/s6-ftrig-listen1.c6
-rw-r--r--src/pipe-tools/s6-ftrig-wait.c3
-rw-r--r--src/pipe-tools/s6-mkfifodir.c13
-rw-r--r--src/supervision/s6-supervise.c12
-rw-r--r--src/supervision/s6-svc.c3
-rw-r--r--src/supervision/s6-svlisten.c4
-rw-r--r--src/supervision/s6-svlisten.h6
-rw-r--r--src/supervision/s6-svlisten1.c4
-rw-r--r--src/supervision/s6-svscan.c12
-rw-r--r--src/supervision/s6-svstat.c2
-rw-r--r--src/supervision/s6-svwait.c4
-rw-r--r--src/supervision/s6_svlisten_loop.c6
81 files changed, 407 insertions, 309 deletions
diff --git a/src/conn-tools/s6-accessrules-cdb-from-fs.c b/src/conn-tools/s6-accessrules-cdb-from-fs.c
index c1aa992..c5b007c 100644
--- a/src/conn-tools/s6-accessrules-cdb-from-fs.c
+++ b/src/conn-tools/s6-accessrules-cdb-from-fs.c
@@ -1,5 +1,7 @@
/* ISC license. */
+#include <sys/types.h>
+#include <stdint.h>
#include <unistd.h>
#include <errno.h>
#include <stdio.h> /* for rename() */
@@ -31,9 +33,9 @@ static void dienomem (void)
strerr_diefu1sys(111, "stralloc_catb") ;
}
-static void doit (struct cdb_make *c, stralloc *sa, unsigned int start)
+static void doit (struct cdb_make *c, stralloc *sa, size_t start)
{
- unsigned int tmpbase = tmp.len ;
+ size_t tmpbase = tmp.len ;
unsigned int k = sa->len ;
if (!stralloc_readyplus(sa, 10)) dienomem() ;
stralloc_catb(sa, "/allow", 7) ;
@@ -62,9 +64,9 @@ static void doit (struct cdb_make *c, stralloc *sa, unsigned int start)
}
else
{
- uint16 envlen = 0 ;
- uint16 execlen = 0 ;
- register int r ;
+ uint16_t envlen = 0 ;
+ uint16_t execlen = 0 ;
+ register ssize_t r ;
tmp.s[tmpbase] = 'A' ;
sa->len = k+1 ;
stralloc_catb(sa, "env", 4) ;
@@ -106,7 +108,7 @@ int main (int argc, char const *const *argv)
stralloc sa = STRALLOC_ZERO ;
struct cdb_make c = CDB_MAKE_ZERO ;
DIR *dir ;
- unsigned int start ;
+ size_t start ;
int fd ;
PROG = "s6-accessrules-cdb-from-fs" ;
if (argc < 3) strerr_dieusage(100, USAGE) ;
@@ -138,7 +140,7 @@ int main (int argc, char const *const *argv)
{
DIR *subdir ;
direntry *d ;
- unsigned int base ;
+ size_t base ;
errno = 0 ;
d = readdir(dir) ;
if (!d) break ;
diff --git a/src/conn-tools/s6-accessrules-fs-from-cdb.c b/src/conn-tools/s6-accessrules-fs-from-cdb.c
index cbe67ef..4bc048f 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 <stdint.h>
#include <sys/stat.h>
#include <errno.h>
#include <unistd.h>
#include <skalibs/bytestr.h>
#include <skalibs/uint16.h>
-#include <skalibs/uint32.h>
#include <skalibs/cdb.h>
#include <skalibs/strerr2.h>
#include <skalibs/djbunix.h>
@@ -14,7 +14,7 @@
#define USAGE "s6-accessrules-fs-from-cdb dir cdbfile"
static char const *basedir ;
-unsigned int basedirlen ;
+size_t basedirlen ;
static void cleanup ()
{
@@ -31,8 +31,8 @@ static int domkdir (char const *s)
static void mkdirp (char *s)
{
mode_t m = umask(0) ;
- unsigned int len = str_len(s) ;
- register unsigned int i = basedirlen + 1 ;
+ size_t len = str_len(s) ;
+ register size_t i = basedirlen + 1 ;
for (; i < len ; i++) if (s[i] == '/')
{
s[i] = 0 ;
@@ -55,10 +55,10 @@ static void touchtrunc (char const *file)
fd_close(fd) ;
}
-static int doenv (char const *dir, unsigned int dirlen, char *env, unsigned int envlen)
+static int doenv (char const *dir, size_t dirlen, char *env, size_t envlen)
{
mode_t m = umask(0) ;
- unsigned int i = 0 ;
+ size_t i = 0 ;
if (!domkdir(dir))
{
cleanup() ;
@@ -67,10 +67,10 @@ static int doenv (char const *dir, unsigned int dirlen, char *env, unsigned int
umask(m) ;
while (i < envlen)
{
- unsigned int n = byte_chr(env + i, envlen - i, 0) ;
+ size_t n = byte_chr(env + i, envlen - i, 0) ;
if (i + n >= envlen) return 0 ;
{
- unsigned int p = byte_chr(env + i, n, '=') ;
+ size_t p = byte_chr(env + i, n, '=') ;
char tmp[dirlen + p + 2] ;
byte_copy(tmp, dirlen, dir) ;
tmp[dirlen] = '/' ;
@@ -97,7 +97,7 @@ static int doit (struct cdb *c)
unsigned int klen = cdb_keylen(c) ;
unsigned int dlen = cdb_datalen(c) ;
{
- uint16 envlen, execlen ;
+ uint16_t envlen, execlen ;
char name[basedirlen + klen + 8] ;
char data[dlen] ;
byte_copy(name, basedirlen, basedir) ;
@@ -145,7 +145,7 @@ static int doit (struct cdb *c)
int main (int argc, char const *const *argv)
{
struct cdb c = CDB_ZERO ;
- uint32 kpos ;
+ uint32_t kpos ;
PROG = "s6-accessrules-fs-from-cdb" ;
if (argc < 3) strerr_dieusage(100, USAGE) ;
if (cdb_mapfile(&c, argv[2]) < 0) strerr_diefu1sys(111, "cdb_mapfile") ;
diff --git a/src/conn-tools/s6-connlimit.c b/src/conn-tools/s6-connlimit.c
index 19f4a2d..903a777 100644
--- a/src/conn-tools/s6-connlimit.c
+++ b/src/conn-tools/s6-connlimit.c
@@ -1,5 +1,6 @@
/* ISC license. */
+#include <sys/types.h>
#include <skalibs/uint.h>
#include <skalibs/bytestr.h>
#include <skalibs/strerr2.h>
@@ -9,7 +10,7 @@
int main (int argc, char const *const *argv, char const *const *envp)
{
char const *x ;
- unsigned int protolen ;
+ size_t protolen ;
PROG = "s6-connlimit" ;
x = env_get2(envp, "PROTO") ;
if (!x) strerr_dienotset(100, "PROTO") ;
diff --git a/src/conn-tools/s6-ipcclient.c b/src/conn-tools/s6-ipcclient.c
index c2352ae..384fca0 100644
--- a/src/conn-tools/s6-ipcclient.c
+++ b/src/conn-tools/s6-ipcclient.c
@@ -1,5 +1,6 @@
/* ISC license. */
+#include <sys/types.h>
#include <skalibs/sgetopt.h>
#include <skalibs/strerr2.h>
#include <skalibs/env.h>
@@ -35,7 +36,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
if (argc < 2) strerr_dieusage(100, USAGE) ;
{
char modif[24 + IPCPATH_MAX] = "PROTO=IPC\0IPCLOCALPATH=" ;
- unsigned int i = 23 ;
+ size_t i = 23 ;
int s = ipc_stream_b() ;
if (s < 0) strerr_diefu1sys(111, "create socket") ;
if (bindpath && (ipc_bind(s, bindpath) == -1))
@@ -45,7 +46,7 @@ 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 unsigned int n = str_len(localname) ;
+ register size_t n = str_len(localname) ;
if (n > IPCPATH_MAX) n = IPCPATH_MAX ;
byte_copy(modif + i, n, localname) ;
i += n ; modif[i++] = 0 ;
diff --git a/src/conn-tools/s6-ipcserver-access.c b/src/conn-tools/s6-ipcserver-access.c
index 629fabb..1a30913 100644
--- a/src/conn-tools/s6-ipcserver-access.c
+++ b/src/conn-tools/s6-ipcserver-access.c
@@ -1,9 +1,12 @@
/* ISC license. */
+#include <sys/types.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/strerr2.h>
#include <skalibs/sgetopt.h>
#include <skalibs/cdb.h>
@@ -40,24 +43,24 @@ static inline void X ()
/* Logging */
-static void logit (unsigned int pid, unsigned int uid, unsigned int gid, int h)
+static void logit (pid_t pid, uid_t uid, gid_t gid, int h)
{
char fmtpid[UINT_FMT] ;
- char fmtuid[UINT_FMT] ;
- char fmtgid[UINT_FMT] ;
- fmtpid[uint_fmt(fmtpid, pid)] = 0 ;
- fmtuid[uint_fmt(fmtuid, uid)] = 0 ;
- fmtgid[uint_fmt(fmtgid, gid)] = 0 ;
+ char fmtuid[UINT64_FMT] ;
+ char fmtgid[GID_FMT] ;
+ fmtpid[uint_fmt(fmtpid, (unsigned int)pid)] = 0 ;
+ fmtuid[uint64_fmt(fmtuid, (uint64)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) ;
}
-static inline void log_accept (unsigned int pid, unsigned int uid, unsigned int gid)
+static inline void log_accept (pid_t pid, uid_t uid, gid_t gid)
{
logit(pid, uid, gid, 1) ;
}
-static inline void log_deny (unsigned int pid, unsigned int uid, unsigned int gid)
+static inline void log_deny (pid_t pid, uid_t uid, gid_t gid)
{
logit(pid, uid, gid, 0) ;
}
@@ -65,7 +68,7 @@ static inline void log_deny (unsigned int pid, unsigned int uid, unsigned int gi
/* Checking */
-static s6_accessrules_result_t check_cdb (unsigned int uid, unsigned int gid, char const *file, s6_accessrules_params_t *params)
+static s6_accessrules_result_t check_cdb (uid_t uid, gid_t gid, char const *file, s6_accessrules_params_t *params)
{
struct cdb c = CDB_ZERO ;
int fd = open_readb(file) ;
@@ -78,7 +81,7 @@ static s6_accessrules_result_t check_cdb (unsigned int uid, unsigned int gid, ch
return r ;
}
-static inline int check (s6_accessrules_params_t *params, char const *rules, unsigned int rulestype, unsigned int uid, unsigned int gid)
+static inline int check (s6_accessrules_params_t *params, char const *rules, unsigned int rulestype, uid_t uid, gid_t gid)
{
char const *x = "" ;
s6_accessrules_result_t r ;
@@ -114,8 +117,9 @@ int main (int argc, char const *const *argv, char const *const *envp)
char const *rules = 0 ;
char const *localname = 0 ;
char const *proto ;
- unsigned int protolen ;
- unsigned int uid = 0, gid = 0 ;
+ size_t protolen ;
+ uid_t uid = 0 ;
+ gid_t gid = 0 ;
unsigned int rulestype = 0 ;
int doenv = 1 ;
PROG = "s6-ipcserver-access" ;
@@ -146,17 +150,20 @@ int main (int argc, char const *const *argv, char const *const *envp)
protolen = str_len(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 (!uint0_scan(x, &uid)) strerr_dieinvalid(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 ;
tmp[protolen + 7] = 'G' ;
x = env_get2(envp, tmp) ;
if (!x) strerr_dienotset(100, tmp) ;
- if (!uint0_scan(x, &gid)) strerr_dieinvalid(100, tmp) ;
+ if (!gid0_scan(x, &gid)) strerr_dieinvalid(100, tmp) ;
}
if (!check(&params, rules, rulestype, uid, gid))
diff --git a/src/conn-tools/s6-ipcserver.c b/src/conn-tools/s6-ipcserver.c
index 96f10c7..7b7023f 100644
--- a/src/conn-tools/s6-ipcserver.c
+++ b/src/conn-tools/s6-ipcserver.c
@@ -57,8 +57,8 @@ int main (int argc, char const *const *argv, char const *const *envp)
}
{
+ size_t pos = 0 ;
unsigned int m = 0 ;
- unsigned int pos = 0 ;
char fmt[UINT_FMT * 5 + GID_FMT * NGROUPS_MAX] ;
char const *newargv[24 + argc] ;
newargv[m++] = S6_BINPREFIX "s6-ipcserver-socketbinder" ;
diff --git a/src/conn-tools/s6-ipcserverd.c b/src/conn-tools/s6-ipcserverd.c
index 4afe5cc..eb8553e 100644
--- a/src/conn-tools/s6-ipcserverd.c
+++ b/src/conn-tools/s6-ipcserverd.c
@@ -7,17 +7,18 @@
#include <fcntl.h>
#include <signal.h>
#include <skalibs/uint.h>
+#include <skalibs/gidstuff.h>
#include <skalibs/gccattributes.h>
#include <skalibs/allreadwrite.h>
#include <skalibs/bytestr.h>
#include <skalibs/sgetopt.h>
#include <skalibs/strerr2.h>
-#include <skalibs/diuint.h>
#include <skalibs/env.h>
#include <skalibs/djbunix.h>
#include <skalibs/sig.h>
#include <skalibs/selfpipe.h>
#include <skalibs/iopause.h>
+#include <skalibs/getpeereid.h>
#include <skalibs/webipc.h>
#define USAGE "s6-ipcserverd [ -v verbosity ] [ -1 ] [ -P | -p ] [ -c maxconn ] [ -C localmaxconn ] prog..."
@@ -32,9 +33,23 @@ static int flaglookup = 1 ;
static unsigned int verbosity = 1 ;
static int cont = 1 ;
-static diuint *piduid ;
+typedef struct piduid_s piduid_t, *piduid_t_ref ;
+struct piduid_s
+{
+ pid_t left ;
+ uid_t right ;
+} ;
+
+typedef struct uidnum_s uidnum_t, *uidnum_t_ref ;
+struct uidnum_s
+{
+ uid_t left ;
+ unsigned int right ;
+} ;
+
+static piduid_t *piduid ;
static unsigned int numconn = 0 ;
-static diuint *uidnum ;
+static uidnum_t *uidnum ;
static unsigned int uidlen = 0 ;
@@ -53,21 +68,18 @@ static inline void X (void)
/* Lookup primitives */
-static unsigned int lookup_diuint (diuint const *tab, unsigned int tablen, unsigned int key)
+static unsigned int lookup_pid (pid_t pid)
{
register unsigned int i = 0 ;
- for (; i < tablen ; i++) if (key == tab[i].left) break ;
+ for (; i < numconn ; i++) if (pid == piduid[i].left) break ;
return i ;
}
-static inline unsigned int lookup_pid (unsigned int pid)
-{
- return lookup_diuint(piduid, numconn, pid) ;
-}
-
-static inline unsigned int lookup_uid (unsigned int uid)
+static inline unsigned int lookup_uid (uid_t uid)
{
- return lookup_diuint(uidnum, uidlen, uid) ;
+ register unsigned int i = 0 ;
+ for (; i < uidlen ; i++) if (uid == uidnum[i].left) break ;
+ return i ;
}
@@ -90,44 +102,44 @@ static void log_status (void)
strerr_warni3x("status: ", fmt, fmtmaxconn) ;
}
-static void log_deny (unsigned int uid, unsigned int gid, unsigned int num)
+static void log_deny (uid_t uid, gid_t gid, unsigned int num)
{
- char fmtuid[UINT_FMT] = "?" ;
- char fmtgid[UINT_FMT] = "?" ;
+ char fmtuid[UINT64_FMT] = "?" ;
+ char fmtgid[GID_FMT] = "?" ;
char fmtnum[UINT_FMT] = "?" ;
if (flaglookup)
{
- fmtuid[uint_fmt(fmtuid, uid)] = 0 ;
- fmtgid[uint_fmt(fmtgid, gid)] = 0 ;
+ fmtuid[uint64_fmt(fmtuid, (uint64)uid)] = 0 ;
+ fmtgid[gid_fmt(fmtgid, gid)] = 0 ;
fmtnum[uint_fmt(fmtnum, num)] = 0 ;
}
strerr_warni7sys("deny ", fmtuid, ":", fmtgid, " count ", fmtnum, fmtlocalmaxconn) ;
}
-static void log_accept (unsigned int pid, unsigned int uid, unsigned int gid, unsigned int num)
+static void log_accept (pid_t pid, uid_t uid, gid_t gid, unsigned int num)
{
- char fmtuidgid[UINT_FMT * 2 + 1] = "?:?" ;
+ char fmtuidgid[UINT64_FMT + GID_FMT + 1] = "?:?" ;
char fmtpid[UINT_FMT] ;
char fmtnum[UINT_FMT] = "?" ;
if (flaglookup)
{
- register unsigned int n = uint_fmt(fmtuidgid, uid) ;
+ register size_t n = uint64_fmt(fmtuidgid, (uint64)uid) ;
fmtuidgid[n++] = ':' ;
- n += uint_fmt(fmtuidgid + n, gid) ;
+ n += gid_fmt(fmtuidgid + n, gid) ;
fmtuidgid[n] = 0 ;
fmtnum[uint_fmt(fmtnum, num)] = 0 ;
}
- fmtpid[uint_fmt(fmtpid, pid)] = 0 ;
+ fmtpid[uint_fmt(fmtpid, (unsigned int)pid)] = 0 ;
strerr_warni7x("allow ", fmtuidgid, " pid ", fmtpid, " count ", fmtnum, fmtlocalmaxconn) ;
}
-static void log_close (unsigned int pid, unsigned int uid, int w)
+static void log_close (pid_t pid, uid_t uid, int w)
{
char fmtpid[UINT_FMT] ;
- char fmtuid[UINT_FMT] = "?" ;
+ char fmtuid[UINT64_FMT] = "?" ;
char fmtw[UINT_FMT] ;
- fmtpid[uint_fmt(fmtpid, pid)] = 0 ;
- if (flaglookup) fmtuid[uint_fmt(fmtuid, uid)] = 0 ;
+ fmtpid[uint_fmt(fmtpid, (unsigned int)pid)] = 0 ;
+ if (flaglookup) fmtuid[uint64_fmt(fmtuid, (uint64)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) ;
}
@@ -155,7 +167,7 @@ static void wait_children (void)
i = lookup_pid(pid) ;
if (i < numconn)
{
- unsigned int uid = piduid[i].right ;
+ uid_t uid = piduid[i].right ;
register unsigned int j = lookup_uid(uid) ;
if (j >= uidlen) X() ;
if (!--uidnum[j].right) uidnum[j] = uidnum[--uidlen] ;
@@ -218,7 +230,7 @@ static void handle_signals (void)
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)
{
- unsigned int rplen = str_len(remotepath) + 1 ;
+ size_t rplen = str_len(remotepath) + 1 ;
unsigned int n = 0 ;
char fmt[65 + UINT_FMT * 3 + rplen] ;
PROG = "s6-ipcserver (child)" ;
@@ -249,12 +261,13 @@ static void run_child (int s, unsigned int uid, unsigned int gid, unsigned int n
static void new_connection (int s, char const *remotepath, char const *const *argv, char const *const *envp)
{
- unsigned int uid = 0, gid = 0 ;
+ uid_t uid = 0 ;
+ gid_t gid = 0 ;
unsigned int num, i ;
register pid_t pid ;
- if (flaglookup && (ipc_eid(s, &uid, &gid) < 0))
+ if (flaglookup && (getpeereid(s, &uid, &gid) < 0))
{
- if (verbosity) strerr_warnwu1sys("ipc_eid") ;
+ if (verbosity) strerr_warnwu1sys("getpeereid") ;
return ;
}
i = lookup_uid(uid) ;
@@ -282,18 +295,16 @@ static void new_connection (int s, char const *remotepath, char const *const *ar
uidnum[uidlen].left = uid ;
uidnum[uidlen++].right = 1 ;
}
- piduid[numconn].left = (unsigned int)pid ;
+ piduid[numconn].left = pid ;
piduid[numconn++].right = uid ;
if (verbosity >= 2)
{
- log_accept((unsigned int)pid, uid, gid, uidnum[i].right) ;
+ log_accept(pid, uid, gid, uidnum[i].right) ;
log_status() ;
}
}
- /* And the main */
-
int main (int argc, char const *const *argv, char const *const *envp)
{
iopause_fd x[2] = { { .events = IOPAUSE_READ }, { .fd = 0, .events = IOPAUSE_READ | IOPAUSE_EXCEPT } } ;
@@ -363,8 +374,10 @@ int main (int argc, char const *const *argv, char const *const *envp)
}
{
- diuint inyostack[maxconn + (flaglookup ? maxconn : 1)] ;
- piduid = inyostack ; uidnum = inyostack + maxconn ;
+ piduid_t inyostack0[maxconn] ;
+ uidnum_t inyostack1[flaglookup ? maxconn : 1] ;
+ piduid = inyostack0 ;
+ uidnum = inyostack1 ;
while (cont)
{
diff --git a/src/conn-tools/s6-sudoc.c b/src/conn-tools/s6-sudoc.c
index 823d7cb..779380f 100644
--- a/src/conn-tools/s6-sudoc.c
+++ b/src/conn-tools/s6-sudoc.c
@@ -1,9 +1,11 @@
/* ISC license. */
+#include <stdint.h>
#include <errno.h>
#include <fcntl.h>
#include <signal.h>
#include <sys/wait.h>
+#include <skalibs/uint32.h>
#include <skalibs/uint.h>
#include <skalibs/sgetopt.h>
#include <skalibs/bytestr.h>
@@ -70,12 +72,12 @@ int main (int argc, char const *const *argv, char const *const *envp)
{ .s = 0, .len = 0 } } ;
unixmessage_v_t mv = { .v = v, .vlen = 4, .fds = fds, .nfds = 3 } ;
stralloc sa = STRALLOC_ZERO ;
- unsigned int envlen = doenv ? env_len(envp) : 0 ;
- uint32_pack_big(pack, (uint32)argc) ;
- uint32_pack_big(pack + 4, (uint32)envlen) ;
+ 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)v[2].len) ;
+ uint32_pack_big(pack + 8, (uint32_t)v[2].len) ;
if (doenv)
{
if (!env_string(&sa, envp, envlen)) dienomem() ;
diff --git a/src/conn-tools/s6-sudod.c b/src/conn-tools/s6-sudod.c
index 8c52bb9..c2256a4 100644
--- a/src/conn-tools/s6-sudod.c
+++ b/src/conn-tools/s6-sudod.c
@@ -1,10 +1,12 @@
/* ISC license. */
#include <sys/types.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/allreadwrite.h>
#include <skalibs/sgetopt.h>
@@ -31,8 +33,8 @@ int main (int argc, char const *const *argv, char const *const *envp)
unixmessage_t m ;
unsigned int nullfds = 0, t = 2000 ;
pid_t pid ;
- uint32 envc = env_len(envp) ;
- uint32 cargc, cenvc, carglen, cenvlen ;
+ size_t envc = env_len(envp) ;
+ uint32_t cargc, cenvc, carglen, cenvlen ;
int spfd ;
tain_t deadline = TAIN_INFINITE_RELATIVE ;
PROG = "s6-sudod" ;
@@ -123,7 +125,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
{
char const *var = tenvp[envc + 1 + i] ;
register unsigned int j = 0 ;
- register unsigned int len = str_chr(var, '=') ;
+ register size_t len = str_chr(var, '=') ;
if (!var[len])
{
char c = EINVAL ;
@@ -165,7 +167,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
fd_close(p[1]) ;
{
char c ;
- register int r = fd_read(p[0], &c, 1) ;
+ register ssize_t r = fd_read(p[0], &c, 1) ;
if (r < 0) strerr_diefu1sys(111, "read from child") ;
if (r)
{
@@ -201,10 +203,10 @@ int main (int argc, char const *const *argv, char const *const *envp)
else if (c == SIGCHLD)
{
int wstat ;
- register int r = wait_pid_nohang(pid, &wstat) ;
- if ((r < 0) && (errno != ECHILD))
+ c = wait_pid_nohang(pid, &wstat) ;
+ if ((c < 0) && (errno != ECHILD))
strerr_diefu1sys(111, "wait_pid_nohang") ;
- else if (r > 0)
+ else if (c > 0)
{
char pack[UINT_PACK] ;
uint_pack_big(pack, (unsigned int)wstat) ;
diff --git a/src/daemontools-extras/s6-applyuidgid.c b/src/daemontools-extras/s6-applyuidgid.c
index 31dc198..b80564f 100644
--- a/src/daemontools-extras/s6-applyuidgid.c
+++ b/src/daemontools-extras/s6-applyuidgid.c
@@ -5,7 +5,7 @@
#include <unistd.h>
#include <grp.h>
#include <limits.h>
-#include <skalibs/uint.h>
+#include <skalibs/uint64.h>
#include <skalibs/gidstuff.h>
#include <skalibs/setgroups.h>
#include <skalibs/strerr2.h>
@@ -18,7 +18,8 @@
int main (int argc, char const *const *argv, char const *const *envp)
{
- unsigned int uid = 0, gid = 0 ;
+ uint64 uid = 0 ;
+ gid_t gid = 0 ;
gid_t gids[NGROUPS_MAX] ;
unsigned int gidn = (unsigned int)-1 ;
int unexport = 0 ;
@@ -32,17 +33,17 @@ int main (int argc, char const *const *argv, char const *const *envp)
switch (opt)
{
case 'z' : unexport = 1 ; break ;
- case 'u' : if (!uint0_scan(l.arg, &uid)) dieusage() ; break ;
- case 'g' : if (!uint0_scan(l.arg, &gid)) dieusage() ; break ;
+ case 'u' : if (!uint640_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 (!uint0_scan(x, &uid)) strerr_dieinvalid(100, "UID") ;
+ if (!uint640_scan(x, &uid)) strerr_dieinvalid(100, "UID") ;
x = env_get2(envp, "GID") ;
if (!x) strerr_dienotset(100, "GID") ;
- if (!uint0_scan(x, &gid)) strerr_dieinvalid(100, "GID") ;
+ if (!gid0_scan(x, &gid)) strerr_dieinvalid(100, "GID") ;
x = env_get2(envp, "GIDLIST") ;
if (!x) strerr_dienotset(100, "GIDLIST") ;
if (!gid_scanlist(gids, NGROUPS_MAX, x, &gidn) && *x)
@@ -56,11 +57,12 @@ 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)
strerr_diefu1sys(111, "set supplementary group list") ;
if (gid && setgid(gid) < 0)
strerr_diefu1sys(111, "setgid") ;
- if (uid && setuid(uid) < 0)
+ if (uid && setuid((uid_t)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-envuidgid.c b/src/daemontools-extras/s6-envuidgid.c
index 57c178f..365a862 100644
--- a/src/daemontools-extras/s6-envuidgid.c
+++ b/src/daemontools-extras/s6-envuidgid.c
@@ -16,9 +16,9 @@
#define USAGE "s6-envuidgid [ -i | -D defaultuid:defaultgid ] [ -u | -g | -B ] [ -n ] account prog..."
#define dieusage() strerr_dieusage(100, USAGE)
-static inline unsigned int 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, uint64 *uid, gid_t *gid, unsigned int *n, gid_t *tab)
{
- unsigned int pos = uint64_scan(s, uid) ;
+ size_t pos = uint64_scan(s, uid) ;
if (!pos)
{
if (*s != ':') return 0 ;
@@ -94,7 +94,7 @@ int main (int argc, char *const *argv, char const *const *envp)
break ;
case 3 : /* both */
{
- unsigned int pos = str_chr(argv[0], ':') ;
+ size_t pos = str_chr(argv[0], ':') ;
user = argv[0] ;
if (argv[0][pos])
{
@@ -136,7 +136,7 @@ int main (int argc, char *const *argv, char const *const *envp)
}
{
- unsigned int pos = 0 ;
+ size_t pos = 0 ;
char fmt[19 + UINT64_FMT + (NGROUPS_MAX+1) * GID_FMT] ;
if (what & 1)
{
diff --git a/src/daemontools-extras/s6-log.c b/src/daemontools-extras/s6-log.c
index 0602c66..e7133b1 100644
--- a/src/daemontools-extras/s6-log.c
+++ b/src/daemontools-extras/s6-log.c
@@ -103,13 +103,13 @@ typedef struct as_status_s as_status_t, *as_status_t_ref ;
struct as_status_s
{
char const *file ;
- unsigned int filelen ;
+ size_t filelen ;
} ;
typedef union actstuff_u actstuff_t, *actstuff_t_ref ;
union actstuff_u
{
- unsigned int fd2_size ;
+ size_t fd2_size ;
as_status_t status ;
unsigned int ld ;
} ;
@@ -131,7 +131,7 @@ struct scriptelem_s
unsigned int actlen ;
} ;
-typedef void inputprocfunc_t (scriptelem_t const *, unsigned int, unsigned int, unsigned int) ;
+typedef void inputprocfunc_t (scriptelem_t const *, unsigned int, size_t, unsigned int) ;
typedef inputprocfunc_t *inputprocfunc_t_ref ;
typedef struct logdir_s logdir_t, *logdir_t_ref ;
@@ -146,7 +146,7 @@ struct logdir_s
uint32 n ;
uint32 s ;
uint32 tolerance ;
- unsigned int pid ;
+ pid_t pid ;
char const *dir ;
char const *processor ;
unsigned int flags ;
@@ -176,7 +176,7 @@ struct logdir_s
typedef struct filesize_s filesize_t, *filesize_t_ref ;
struct filesize_s
{
- uint64 size ;
+ size_t size ;
char name[28] ;
} ;
@@ -225,7 +225,7 @@ static inline int logdir_trim (logdir_t *ldp)
if (n)
{
uint64 totalsize = 0 ;
- unsigned int dirlen = str_len(ldp->dir) ;
+ size_t dirlen = str_len(ldp->dir) ;
unsigned int i = 0 ;
filesize_t blurgh[n] ;
char fullname[dirlen + 29] ;
@@ -281,8 +281,8 @@ static inline int logdir_trim (logdir_t *ldp)
static int finish (logdir_t *ldp, char const *name, char suffix)
{
struct stat st ;
- unsigned int dirlen = str_len(ldp->dir) ;
- unsigned int namelen = str_len(name) ;
+ size_t dirlen = str_len(ldp->dir) ;
+ size_t namelen = str_len(name) ;
char x[dirlen + namelen + 2] ;
byte_copy(x, dirlen, ldp->dir) ;
x[dirlen] = '/' ;
@@ -329,7 +329,7 @@ static inline void exec_processor (logdir_t *ldp)
static int rotator (logdir_t *ldp)
{
- unsigned int dirlen = str_len(ldp->dir) ;
+ size_t dirlen = str_len(ldp->dir) ;
switch (ldp->rstate)
{
case ROTSTATE_START :
@@ -414,14 +414,14 @@ static int rotator (logdir_t *ldp)
ldp->rstate = ROTSTATE_RUNPROCESSOR ;
case ROTSTATE_RUNPROCESSOR :
{
- int pid = fork() ;
+ pid_t pid = fork() ;
if (pid < 0)
{
if (verbosity) strerr_warnwu2sys("fork processor for logdir ", ldp->dir) ;
goto fail ;
}
else if (!pid) exec_processor(ldp) ;
- ldp->pid = (unsigned int)pid ;
+ ldp->pid = pid ;
tain_add_g(&ldp->deadline, &tain_infinite_relative) ;
ldp->rstate = ROTSTATE_WAITPROCESSOR ;
}
@@ -524,13 +524,13 @@ static int rotator (logdir_t *ldp)
return 0 ;
}
-static int logdir_write (int i, char const *s, unsigned int len)
+static int logdir_write (int i, char const *s, size_t len)
{
logdir_t *ldp = logdirs + i ;
- int r ;
- unsigned int n = len ;
+ ssize_t r ;
+ size_t n = len ;
{
- unsigned int m = byte_rchr(s, n, '\n') ;
+ size_t m = byte_rchr(s, n, '\n') ;
if (m < n) n = m+1 ;
}
r = fd_write(ldp->fd, s, n) ;
@@ -563,11 +563,11 @@ static inline void rotate_or_flush (logdir_t *ldp)
bufalloc_flush(&ldp->out) ;
}
-static inline void logdir_init (unsigned int index, uint32 s, uint32 n, uint32 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 maxdirsize, tain_t const *retrytto, char const *processor, char const *name, unsigned int flags)
{
logdir_t *ldp = logdirs + index ;
struct stat st ;
- unsigned int dirlen = str_len(name) ;
+ size_t dirlen = str_len(name) ;
int r ;
char x[dirlen + 11] ;
ldp->s = s ;
@@ -776,9 +776,9 @@ static inline void script_secondpass (char const *const *argv, scriptelem_t *scr
tain_t retrytto ;
unsigned int fd2_size = 200 ;
unsigned int status_size = 1001 ;
- uint32 s = 99999 ;
- uint32 n = 10 ;
- uint32 tolerance = 2000 ;
+ uint32_t s = 99999 ;
+ uint32_t n = 10 ;
+ uint32_t tolerance = 2000 ;
uint64 maxdirsize = 0 ;
char const *processor = 0 ;
unsigned int sel = 0, act = 0, lidx = 0, flags = 0 ;
@@ -836,7 +836,7 @@ static inline void script_secondpass (char const *const *argv, scriptelem_t *scr
break ;
case 'r' :
{
- uint32 t ;
+ uint32_t t ;
if (!uint320_scan(*argv + 1, &t)) goto fail ;
if (!tain_from_millisecs(&retrytto, t)) goto fail ;
break ;
@@ -901,10 +901,11 @@ static inline void script_secondpass (char const *const *argv, scriptelem_t *scr
strerr_dief2x(100, "unrecognized directive: ", *argv) ;
}
-static void script_run (scriptelem_t const *script, unsigned int scriptlen, char const *s, unsigned int len, unsigned int gflags)
+static void script_run (scriptelem_t const *script, unsigned int scriptlen, char const *s, size_t len, unsigned int gflags)
{
int flagselected = 1, flagacted = 0 ;
- unsigned int i = 0, hlen = 0 ;
+ unsigned int i = 0 ;
+ size_t hlen = 0 ;
char hstamp[32] ;
char tstamp[TIMESTAMP+1] ;
if (gflags & 1)
@@ -971,12 +972,12 @@ static void script_run (scriptelem_t const *script, unsigned int scriptlen, char
case ACTTYPE_STATUS :
if (act->data.status.filelen)
{
- unsigned int reallen = siovec_len(v, 4) ;
+ size_t reallen = siovec_len(v, 4) ;
if (reallen > act->data.status.filelen)
siovec_trunc(v, 4, act->data.status.filelen) ;
else
{
- register unsigned int k = act->data.status.filelen - reallen + 1 ;
+ register size_t k = act->data.status.filelen - reallen + 1 ;
char pad[k] ;
v[3].s = pad ;
v[3].len = k ;
@@ -1012,9 +1013,9 @@ static void prepare_to_exit (void)
flagexiting = 1 ;
}
-static void normal_stdin (scriptelem_t const *script, unsigned int scriptlen, unsigned int linelimit, unsigned int gflags)
+static void normal_stdin (scriptelem_t const *script, unsigned int scriptlen, size_t linelimit, unsigned int gflags)
{
- int r = sanitize_read(buffer_fill(buffer_0)) ;
+ ssize_t r = sanitize_read(buffer_fill(buffer_0)) ;
if (r < 0)
{
if ((errno != EPIPE) && verbosity) strerr_warnwu1sys("read from stdin") ;
@@ -1038,7 +1039,7 @@ static void normal_stdin (scriptelem_t const *script, unsigned int scriptlen, un
}
}
-static void last_stdin (scriptelem_t const *script, unsigned int scriptlen, unsigned int linelimit, unsigned int gflags)
+static void last_stdin (scriptelem_t const *script, unsigned int scriptlen, size_t linelimit, unsigned int gflags)
{
int cont = 1 ;
while (cont)
@@ -1135,9 +1136,9 @@ static inline void handle_signals (void)
{
int wstat ;
register unsigned int i = 0 ;
- register int r = wait_nohang(&wstat) ;
+ register pid_t r = wait_nohang(&wstat) ;
if (r <= 0) break ;
- for (; i < llen ; i++) if ((unsigned int)r == logdirs[i].pid) break ;
+ for (; i < llen ; i++) if (r == logdirs[i].pid) break ;
if (i < llen) processor_died(logdirs + i, wstat) ;
}
break ;
diff --git a/src/daemontools-extras/s6-setlock.c b/src/daemontools-extras/s6-setlock.c
index 15970ed..27b6b23 100644
--- a/src/daemontools-extras/s6-setlock.c
+++ b/src/daemontools-extras/s6-setlock.c
@@ -1,5 +1,6 @@
/* ISC license. */
+#include <sys/types.h>
#include <unistd.h>
#include <errno.h>
#include <signal.h>
@@ -56,7 +57,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
iopause_fd x = { .events = IOPAUSE_READ } ;
tain_t deadline ;
int p[2] ;
- unsigned int pid ;
+ pid_t pid ;
char c ;
tain_now_g() ;
tain_from_millisecs(&deadline, timeout) ;
@@ -66,6 +67,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
x.fd = p[0] ;
for (;;)
{
+ ssize_t rr ;
register int r = iopause_g(&x, 1, &deadline) ;
if (r < 0) strerr_diefu1sys(111, "iopause") ;
if (!r)
@@ -74,9 +76,9 @@ int main (int argc, char const *const *argv, char const *const *envp)
errno = ETIMEDOUT ;
strerr_diefu1sys(1, "acquire lock") ;
}
- r = sanitize_read(fd_read(p[0], &c, 1)) ;
- if (r < 0) strerr_diefu1sys(111, "read ack from helper") ;
- if (r) break ;
+ rr = sanitize_read(fd_read(p[0], &c, 1)) ;
+ if (rr < 0) strerr_diefu1sys(111, "read ack from helper") ;
+ if (rr) break ;
}
if (c != '!') strerr_dief1x(111, "helper sent garbage ack") ;
fd_close(p[0]) ;
diff --git a/src/daemontools-extras/s6-setuidgid.c b/src/daemontools-extras/s6-setuidgid.c
index 30cce8c..727696a 100644
--- a/src/daemontools-extras/s6-setuidgid.c
+++ b/src/daemontools-extras/s6-setuidgid.c
@@ -1,5 +1,6 @@
/* ISC license. */
+#include <sys/types.h>
#include <skalibs/bytestr.h>
#include <skalibs/strerr2.h>
#include <skalibs/djbunix.h>
@@ -11,8 +12,8 @@
int main (int argc, char *const *argv, char const *const *envp)
{
char const *newargv[argc + 7] ;
+ size_t pos ;
unsigned int m = 0 ;
- unsigned int pos ;
PROG = "s6-setuidgid" ;
if (argc < 3) dieusage() ;
argv++ ;
diff --git a/src/daemontools-extras/s6-tai64nlocal.c b/src/daemontools-extras/s6-tai64nlocal.c
index d5af0d3..84e717a 100644
--- a/src/daemontools-extras/s6-tai64nlocal.c
+++ b/src/daemontools-extras/s6-tai64nlocal.c
@@ -31,7 +31,7 @@ int main (void)
{
char fmt[LOCALTMN_FMT+1] ;
localtmn_t local ;
- unsigned int len ;
+ size_t len ;
localtmn_from_tain(&local, &a, 1) ;
len = localtmn_fmt(fmt, &local) ;
if (buffer_put(buffer_1, fmt, len) < 0)
diff --git a/src/daemontools-extras/ucspilogd.c b/src/daemontools-extras/ucspilogd.c
index 9ad739d..1f338bd 100644
--- a/src/daemontools-extras/ucspilogd.c
+++ b/src/daemontools-extras/ucspilogd.c
@@ -6,6 +6,7 @@
#endif
#include <skalibs/nonposix.h>
+#include <sys/types.h>
#include <errno.h>
#include <stdlib.h>
#include <syslog.h>
@@ -88,9 +89,10 @@ static CODE const facilitynames[] =
#endif
-static unsigned int syslog_names (char const *line)
+static size_t syslog_names (char const *line)
{
- unsigned int fpr, i ;
+ size_t i ;
+ unsigned int fpr ;
int fp ;
CODE const *p = facilitynames ;
@@ -157,7 +159,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
}
for (;;)
{
- unsigned int pos = 0 ;
+ size_t pos = 0 ;
satmp.len = 0 ;
{
register int r = skagetlnsep(buffer_0f1, &satmp, "\n", 2) ;
diff --git a/src/fdholder/s6-fdholder-daemon.c b/src/fdholder/s6-fdholder-daemon.c
index 46c4923..0a706da 100644
--- a/src/fdholder/s6-fdholder-daemon.c
+++ b/src/fdholder/s6-fdholder-daemon.c
@@ -61,7 +61,8 @@ int main (int argc, char const *const *argv, char const *const *envp)
if (!rulesdir && !rulesfile) strerr_dief1x(100, "no access rights specified!") ;
{
- unsigned int m = 0, pos = 0 ;
+ size_t pos = 0 ;
+ unsigned int m = 0 ;
char const *newargv[30] ;
char fmt[UINT_FMT * 8 + GID_FMT * NGROUPS_MAX] ;
newargv[m++] = S6_BINPREFIX "s6-ipcserver-socketbinder" ;
diff --git a/src/fdholder/s6-fdholder-getdumpc.c b/src/fdholder/s6-fdholder-getdumpc.c
index 85c288c..41ad5c5 100644
--- a/src/fdholder/s6-fdholder-getdumpc.c
+++ b/src/fdholder/s6-fdholder-getdumpc.c
@@ -1,5 +1,7 @@
/* ISC license. */
+#include <sys/types.h>
+#include <limits.h>
#include <skalibs/uint.h>
#include <skalibs/bytestr.h>
#include <skalibs/strerr2.h>
@@ -46,16 +48,18 @@ int main (int argc, char const *const *argv, char const *const *envp)
tain_half(&halfinfinite, &tain_infinite_relative) ;
tain_add_g(&halfinfinite, &halfinfinite) ;
{
- unsigned int n = genalloc_len(s6_fdholder_fd_t, &dump) ;
- unsigned int pos = 0, i = 0 ;
+ size_t n = genalloc_len(s6_fdholder_fd_t, &dump) ;
+ size_t pos = 0 ;
+ 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 ;
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 ;
- unsigned int len = str_len(p->id) + 1 ;
+ size_t len = str_len(p->id) + 1 ;
if (uncoe(p->fd) < 0) strerr_diefu1sys(111, "uncoe") ;
byte_copy(modifs + pos, 6, "S6_FD_") ; pos += 6 ;
pos += uint_fmt(modifs + pos, i) ;
diff --git a/src/fdholder/s6-fdholder-listc.c b/src/fdholder/s6-fdholder-listc.c
index 6bd2104..7bc2d1d 100644
--- a/src/fdholder/s6-fdholder-listc.c
+++ b/src/fdholder/s6-fdholder-listc.c
@@ -1,5 +1,6 @@
/* ISC license. */
+#include <sys/types.h>
#include <skalibs/uint.h>
#include <skalibs/bytestr.h>
#include <skalibs/buffer.h>
@@ -17,7 +18,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
{
s6_fdholder_t a = S6_FDHOLDER_ZERO ;
stralloc sa = STRALLOC_ZERO, sb = STRALLOC_ZERO ;
- unsigned int pos = 0 ;
+ size_t pos = 0 ;
int n ;
tain_t deadline ;
PROG = "s6-fdholder-listc" ;
@@ -46,7 +47,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 unsigned int len = str_len(sa.s + pos) ;
+ register size_t len = str_len(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-setdumpc.c b/src/fdholder/s6-fdholder-setdumpc.c
index 9e253d9..5c80fd7 100644
--- a/src/fdholder/s6-fdholder-setdumpc.c
+++ b/src/fdholder/s6-fdholder-setdumpc.c
@@ -1,5 +1,6 @@
/* ISC license. */
+#include <sys/types.h>
#include <skalibs/uint.h>
#include <skalibs/bytestr.h>
#include <skalibs/env.h>
@@ -49,7 +50,8 @@ int main (int argc, char const *const *argv, char const *const *envp)
tain_add_g(&deadline, &deadline) ;
for (; i < dumplen ; i++)
{
- unsigned int fd, len ;
+ size_t len ;
+ unsigned int fd ;
byte_copy(s, 6, "S6_FD_") ;
s[6 + uint_fmt(s+6, i)] = 0 ;
x = env_get2(envp, s) ;
diff --git a/src/fdholder/s6-fdholder-transferdump.c b/src/fdholder/s6-fdholder-transferdump.c
index 3f86d69..5d6ccd0 100644
--- a/src/fdholder/s6-fdholder-transferdump.c
+++ b/src/fdholder/s6-fdholder-transferdump.c
@@ -1,5 +1,6 @@
/* ISC license. */
+#include <sys/types.h>
#include <skalibs/uint.h>
#include <skalibs/sgetopt.h>
#include <skalibs/env.h>
@@ -29,7 +30,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
{
case 't' :
{
- unsigned int pos = uint_scan(l.arg, &timeoutfrom) ;
+ size_t pos = uint_scan(l.arg, &timeoutfrom) ;
if (!pos)
{
if (l.arg[pos] != ':') dieusage() ;
diff --git a/src/fdholder/s6-fdholderd.c b/src/fdholder/s6-fdholderd.c
index cb041f3..001108a 100644
--- a/src/fdholder/s6-fdholderd.c
+++ b/src/fdholder/s6-fdholderd.c
@@ -23,6 +23,7 @@
#include <skalibs/selfpipe.h>
#include <skalibs/siovec.h>
#include <skalibs/cdb.h>
+#include <skalibs/getpeereid.h>
#include <skalibs/webipc.h>
#include <skalibs/genset.h>
#include <skalibs/avltreen.h>
@@ -323,7 +324,7 @@ static int do_list (unsigned int cc, unixmessage_t const *m)
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)numfds) ;
+ uint32_pack_big(pack + 1, (uint32_t)numfds) ;
v[0].s = pack ; v[0].len = 5 ;
genset_iter(fdstore, &fill_siovec_with_ids_iter, &vp) ;
if (!unixmessage_putv(&c->connection.out, &ans)) return answer(c, errno) ;
@@ -363,8 +364,8 @@ static int do_getdump (unsigned int cc, unixmessage_t const *m)
{
char pack[9] = "" ;
unixmessage_t ans = { .s = pack, .len = 9, .fds = 0, .nfds = 0 } ;
- uint32_pack_big(pack+1, (uint32)n) ;
- uint32_pack_big(pack+5, (uint32)numfds) ;
+ uint32_pack_big(pack+1, (uint32_t)n) ;
+ uint32_pack_big(pack+5, (uint32_t)numfds) ;
if (!unixmessage_put(&c->connection.out, &ans)) return answer(c, errno) ;
}
if (n)
@@ -412,7 +413,7 @@ static int do_getdump (unsigned int cc, unixmessage_t const *m)
static int do_setdump (unsigned int cc, unixmessage_t const *m)
{
char pack[5] = "" ;
- uint32 n ;
+ uint32_t n ;
unixmessage_t ans = { .s = pack, .len = 5, .fds = 0, .nfds = 0 } ;
client_t *c = CLIENT(cc) ;
if (c->dumping || m->len != 4 || m->nfds) return (errno = EPROTO, 0) ;
@@ -443,7 +444,7 @@ static int do_setdump_data (unsigned int cc, unixmessage_t const *m)
}
{
char const *s = m->s ;
- unsigned int len = m->len ;
+ size_t len = m->len ;
unsigned int i = 0 ;
unsigned int indices[m->nfds] ;
for (; i < m->nfds ; i++)
@@ -523,7 +524,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 unsigned int varlen = str_len(var) ;
+ register size_t varlen = str_len(var) ;
if (str_start(s, var) && (s[varlen] == '='))
{
int r = regcomp(re, s + varlen + 1, REG_EXTENDED | REG_NOSUB) ;
@@ -591,9 +592,10 @@ static inline int new_connection (int fd, regex_t *rre, regex_t *wre, unsigned i
{
s6_accessrules_params_t params = S6_ACCESSRULES_PARAMS_ZERO ;
s6_accessrules_result_t result = S6_ACCESSRULES_ERROR ;
- unsigned int uid, gid ;
+ uid_t uid ;
+ gid_t gid ;
- if (ipc_eid(fd, &uid, &gid) < 0)
+ if (getpeereid(fd, &uid, &gid) < 0)
{
if (verbosity) strerr_warnwu1sys("getpeereid") ;
return 0 ;
@@ -623,7 +625,7 @@ static inline int new_connection (int fd, regex_t *rre, regex_t *wre, unsigned i
}
if (params.env.s)
{
- unsigned int n = byte_count(params.env.s, params.env.len, '\0') ;
+ size_t n = byte_count(params.env.s, params.env.len, '\0') ;
char const *envp[n+1] ;
if (!env_make(envp, n, params.env.s, params.env.len))
{
diff --git a/src/include/s6/accessrules.h b/src/include/s6/accessrules.h
index e294817..c8a9400 100644
--- a/src/include/s6/accessrules.h
+++ b/src/include/s6/accessrules.h
@@ -3,10 +3,19 @@
#ifndef S6_ACCESSRULES_H
#define S6_ACCESSRULES_H
+#include <sys/types.h>
#include <skalibs/cdb.h>
#include <skalibs/stralloc.h>
#include <skalibs/ip46.h>
+
+typedef struct uidgid_s uidgid_t, *uidgid_t_ref ;
+struct uidgid_s
+{
+ uid_t left ;
+ gid_t right ;
+} ;
+
typedef struct s6_accessrules_params_s s6_accessrules_params_t, *s6_accessrules_params_t_ref ;
struct s6_accessrules_params_s
{
@@ -26,7 +35,7 @@ enum s6_accessrules_result_e
S6_ACCESSRULES_NOTFOUND = 2
} ;
-typedef s6_accessrules_result_t s6_accessrules_backend_func_t (char const *, unsigned int, void *, s6_accessrules_params_t *) ;
+typedef s6_accessrules_result_t s6_accessrules_backend_func_t (char const *, size_t, void *, s6_accessrules_params_t *) ;
typedef s6_accessrules_backend_func_t *s6_accessrules_backend_func_t_ref ;
extern s6_accessrules_backend_func_t s6_accessrules_backend_fs ;
@@ -41,8 +50,8 @@ extern s6_accessrules_keycheck_func_t s6_accessrules_keycheck_ip6 ;
extern s6_accessrules_keycheck_func_t s6_accessrules_keycheck_reversedns ;
#define s6_accessrules_keycheck_ip46(key, data, params, f) (ip46_is6((ip46_t const *)(key)) ? s6_accessrules_keycheck_ip6(((ip46_t const *)(key))->ip, data, params, f) : s6_accessrules_keycheck_ip4(((ip46_t const *)(key))->ip, data, params, f))
-extern s6_accessrules_result_t s6_accessrules_uidgid_cdb (unsigned int, unsigned int, struct cdb *, s6_accessrules_params_t *) ;
-extern s6_accessrules_result_t s6_accessrules_uidgid_fs (unsigned int, unsigned int, char const *, s6_accessrules_params_t *) ;
+extern s6_accessrules_result_t s6_accessrules_uidgid_cdb (uid_t, gid_t, struct cdb *, s6_accessrules_params_t *) ;
+extern s6_accessrules_result_t s6_accessrules_uidgid_fs (uid_t, gid_t, char const *, s6_accessrules_params_t *) ;
#define s6_accessrules_ip4_cdb(ip4, c, params) s6_accessrules_keycheck_ip4(ip4, c, (params), &s6_accessrules_backend_cdb)
#define s6_accessrules_ip4_fs(ip4, rulesdir, params) s6_accessrules_keycheck_ip4(ip4, rulesdir, (params), &s6_accessrules_backend_fs)
#define s6_accessrules_ip6_cdb(ip6, c, params) s6_accessrules_keycheck_ip6(ip6, c, (params), &s6_accessrules_backend_cdb)
diff --git a/src/include/s6/ftrigw.h b/src/include/s6/ftrigw.h
index 38d89f1..2ffc20b 100644
--- a/src/include/s6/ftrigw.h
+++ b/src/include/s6/ftrigw.h
@@ -3,12 +3,13 @@
#ifndef FTRIGW_H
#define FTRIGW_H
+#include <sys/types.h>
#include <skalibs/bytestr.h>
extern int ftrigw_fifodir_make (char const *, int, int) ;
extern int ftrigw_notify (char const *, char) ;
-extern int ftrigw_notifyb (char const *, char const *, unsigned int) ;
-extern int ftrigw_notifyb_nosig (char const *, char const *, unsigned int) ;
+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))
extern int ftrigw_clean (char const *) ;
diff --git a/src/include/s6/s6-supervise.h b/src/include/s6/s6-supervise.h
index faf4e9c..7fc70d7 100644
--- a/src/include/s6/s6-supervise.h
+++ b/src/include/s6/s6-supervise.h
@@ -13,8 +13,8 @@
#define S6_SVSTATUS_SIZE 35
extern int s6_svc_ok (char const *) ;
-extern int s6_svc_write (char const *, char const *, unsigned int) ;
-extern int s6_svc_writectl (char const *, char const *, char const *, unsigned int) ;
+extern int s6_svc_write (char const *, char const *, size_t) ;
+extern int s6_svc_writectl (char const *, char const *, char const *, size_t) ;
extern int s6_svc_main (int, char const *const *, char const *, char const *, char const *) ;
typedef struct s6_svstatus_s s6_svstatus_t, *s6_svstatus_t_ref ;
diff --git a/src/libs6/ftrig1_make.c b/src/libs6/ftrig1_make.c
index 8352e64..d22a76f 100644
--- a/src/libs6/ftrig1_make.c
+++ b/src/libs6/ftrig1_make.c
@@ -22,7 +22,7 @@ void ftrig1_init (void)
surf_init(&surf_ctx, seed) ;
}
-static inline void surfname (char *s, unsigned int n)
+static inline void surfname (char *s, size_t n)
{
static char const oklist[64] = "ABCDEFGHIJKLMNOPQRSTUVWXYZghijklmnopqrstuvwxyz-_0123456789abcdef" ;
surf(&surf_ctx, s, n) ;
@@ -32,7 +32,7 @@ static inline void surfname (char *s, unsigned int n)
int ftrig1_make (ftrig1_t *f, char const *path)
{
ftrig1_t ff = FTRIG1_ZERO ;
- unsigned int pathlen = str_len(path) ;
+ size_t pathlen = str_len(path) ;
int e = 0 ;
char tmp[pathlen + 46 + FTRIG1_PREFIXLEN] ;
diff --git a/src/libs6/ftrigr_check.c b/src/libs6/ftrigr_check.c
index 147deca..8db7d7f 100644
--- a/src/libs6/ftrigr_check.c
+++ b/src/libs6/ftrigr_check.c
@@ -1,11 +1,11 @@
/* ISC license. */
+#include <stdint.h>
#include <errno.h>
-#include <skalibs/uint16.h>
#include <skalibs/gensetdyn.h>
#include <s6/ftrigr.h>
-int ftrigr_check (ftrigr_t *a, uint16 id, char *c)
+int ftrigr_check (ftrigr_t *a, uint16_t id, char *c)
{
ftrigr1_t *p ;
if (!id--) return (errno = EINVAL, -1) ;
diff --git a/src/libs6/ftrigr_end.c b/src/libs6/ftrigr_end.c
index f35f06c..9783601 100644
--- a/src/libs6/ftrigr_end.c
+++ b/src/libs6/ftrigr_end.c
@@ -1,5 +1,6 @@
/* ISC license. */
+#include <stdint.h>
#include <skalibs/genalloc.h>
#include <skalibs/gensetdyn.h>
#include <skalibs/skaclient.h>
@@ -8,7 +9,7 @@
void ftrigr_end (ftrigr_ref a)
{
gensetdyn_free(&a->data) ;
- genalloc_free(uint16, &a->list) ;
+ genalloc_free(uint16_t, &a->list) ;
skaclient_end(&a->connection) ;
*a = ftrigr_zero ;
}
diff --git a/src/libs6/ftrigr_subscribe.c b/src/libs6/ftrigr_subscribe.c
index 95a5d0b..ddb706f 100644
--- a/src/libs6/ftrigr_subscribe.c
+++ b/src/libs6/ftrigr_subscribe.c
@@ -1,5 +1,7 @@
/* ISC license. */
+#include <sys/types.h>
+#include <stdint.h>
#include <errno.h>
#include <skalibs/uint16.h>
#include <skalibs/uint32.h>
@@ -9,19 +11,19 @@
#include <skalibs/skaclient.h>
#include <s6/ftrigr.h>
-uint16 ftrigr_subscribe (ftrigr_t *a, char const *path, char const *re, uint32 options, tain_t const *deadline, tain_t *stamp)
+uint16_t ftrigr_subscribe (ftrigr_t *a, char const *path, char const *re, uint32_t options, tain_t const *deadline, tain_t *stamp)
{
- unsigned int pathlen = str_len(path) ;
- unsigned int relen = str_len(re) ;
+ size_t pathlen = str_len(path) ;
+ size_t relen = str_len(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 } } ;
if (!gensetdyn_new(&a->data, &i)) return 0 ;
- uint16_pack_big(tmp, (uint16)i) ;
+ uint16_pack_big(tmp, (uint16_t)i) ;
uint32_pack_big(tmp+3, options) ;
- uint32_pack_big(tmp+7, (uint32)pathlen) ;
- uint32_pack_big(tmp+11, (uint32)relen) ;
+ 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 ;
diff --git a/src/libs6/ftrigr_unsubscribe.c b/src/libs6/ftrigr_unsubscribe.c
index 4833571..1c44905 100644
--- a/src/libs6/ftrigr_unsubscribe.c
+++ b/src/libs6/ftrigr_unsubscribe.c
@@ -1,5 +1,6 @@
/* ISC license. */
+#include <stdint.h>
#include <errno.h>
#include <skalibs/uint16.h>
#include <skalibs/tai.h>
@@ -7,7 +8,7 @@
#include <skalibs/skaclient.h>
#include <s6/ftrigr.h>
-int ftrigr_unsubscribe (ftrigr_ref a, uint16 i, tain_t const *deadline, tain_t *stamp)
+int ftrigr_unsubscribe (ftrigr_t *a, uint16_t i, tain_t const *deadline, tain_t *stamp)
{
ftrigr1_t *p ;
if (!i--) return (errno = EINVAL, 0) ;
diff --git a/src/libs6/ftrigr_update.c b/src/libs6/ftrigr_update.c
index ad69714..68e3bde 100644
--- a/src/libs6/ftrigr_update.c
+++ b/src/libs6/ftrigr_update.c
@@ -1,5 +1,6 @@
/* ISC license. */
+#include <stdint.h>
#include <errno.h>
#include <skalibs/error.h>
#include <skalibs/uint16.h>
@@ -13,13 +14,13 @@ static int msghandler (unixmessage_t const *m, void *context)
{
ftrigr_t *a = (ftrigr_t *)context ;
ftrigr1_t *p ;
- uint16 id ;
+ uint16_t id ;
if (m->len != 4 || m->nfds) return (errno = EPROTO, 0) ;
uint16_unpack_big(m->s, &id) ;
p = GENSETDYN_P(ftrigr1_t, &a->data, id) ;
if (!p) return 1 ;
if (p->state != FR1STATE_LISTENING) return (errno = EINVAL, 0) ;
- if (!genalloc_readyplus(uint16, &a->list, 1)) return 0 ;
+ if (!genalloc_readyplus(uint16_t, &a->list, 1)) return 0 ;
switch (m->s[2])
{
case 'd' :
@@ -32,12 +33,12 @@ static int msghandler (unixmessage_t const *m, void *context)
default : return (errno = EPROTO, 0) ;
}
p->what = m->s[3] ;
- id++ ; genalloc_append(uint16, &a->list, &id) ;
+ id++ ; genalloc_append(uint16_t, &a->list, &id) ;
return 1 ;
}
int ftrigr_update (ftrigr_t *a)
{
- genalloc_setlen(uint16, &a->list, 0) ;
+ genalloc_setlen(uint16_t, &a->list, 0) ;
return skaclient_update(&a->connection, &msghandler, a) ;
}
diff --git a/src/libs6/ftrigr_wait_and.c b/src/libs6/ftrigr_wait_and.c
index f854a8d..961d0ba 100644
--- a/src/libs6/ftrigr_wait_and.c
+++ b/src/libs6/ftrigr_wait_and.c
@@ -1,12 +1,12 @@
/* ISC license. */
+#include <stdint.h>
#include <errno.h>
-#include <skalibs/uint16.h>
#include <skalibs/tai.h>
#include <skalibs/iopause.h>
#include <s6/ftrigr.h>
-int ftrigr_wait_and (ftrigr_t *a, uint16 const *idlist, unsigned int n, tain_t const *deadline, tain_t *stamp)
+int ftrigr_wait_and (ftrigr_t *a, uint16_t const *idlist, unsigned int n, tain_t const *deadline, tain_t *stamp)
{
iopause_fd x = { -1, IOPAUSE_READ, 0 } ;
x.fd = ftrigr_fd(a) ;
diff --git a/src/libs6/ftrigr_wait_or.c b/src/libs6/ftrigr_wait_or.c
index 8a01d85..188a97e 100644
--- a/src/libs6/ftrigr_wait_or.c
+++ b/src/libs6/ftrigr_wait_or.c
@@ -1,13 +1,13 @@
/* ISC license. */
+#include <stdint.h>
#include <errno.h>
#include <skalibs/error.h>
-#include <skalibs/uint16.h>
#include <skalibs/tai.h>
#include <skalibs/iopause.h>
#include <s6/ftrigr.h>
-int ftrigr_wait_or (ftrigr_t *a, uint16 const *idlist, unsigned int n, tain_t const *deadline, tain_t *stamp, char *c)
+int ftrigr_wait_or (ftrigr_t *a, uint16_t const *idlist, unsigned int n, tain_t const *deadline, tain_t *stamp, char *c)
{
iopause_fd x = { -1, IOPAUSE_READ | IOPAUSE_EXCEPT, 0 } ;
x.fd = ftrigr_fd(a) ;
diff --git a/src/libs6/ftrigw_clean.c b/src/libs6/ftrigw_clean.c
index 1198828..5e344eb 100644
--- a/src/libs6/ftrigw_clean.c
+++ b/src/libs6/ftrigw_clean.c
@@ -1,5 +1,6 @@
/* ISC license. */
+#include <sys/types.h>
#include <unistd.h>
#include <errno.h>
#include <skalibs/direntry.h>
@@ -10,7 +11,7 @@
int ftrigw_clean (char const *path)
{
- unsigned int pathlen = str_len(path) ;
+ size_t pathlen = str_len(path) ;
int e = 0 ;
DIR *dir = opendir(path) ;
if (!dir) return 0 ;
diff --git a/src/libs6/ftrigw_notifyb.c b/src/libs6/ftrigw_notifyb.c
index ddd1116..36871ec 100644
--- a/src/libs6/ftrigw_notifyb.c
+++ b/src/libs6/ftrigw_notifyb.c
@@ -1,11 +1,12 @@
/* ISC license. */
+#include <sys/types.h>
#include <errno.h>
#include <signal.h>
#include <skalibs/sig.h>
#include <s6/ftrigw.h>
-int ftrigw_notifyb (char const *path, char const *s, unsigned int len)
+int ftrigw_notifyb (char const *path, char const *s, size_t len)
{
struct skasigaction old ;
int r ;
diff --git a/src/libs6/ftrigw_notifyb_nosig.c b/src/libs6/ftrigw_notifyb_nosig.c
index 0d7b565..0a21419 100644
--- a/src/libs6/ftrigw_notifyb_nosig.c
+++ b/src/libs6/ftrigw_notifyb_nosig.c
@@ -1,5 +1,6 @@
/* ISC license. */
+#include <sys/types.h>
#include <unistd.h>
#include <errno.h>
#include <skalibs/direntry.h>
@@ -9,13 +10,13 @@
#include "ftrig1.h"
#include <s6/ftrigw.h>
-int ftrigw_notifyb_nosig (char const *path, char const *s, unsigned int len)
+int ftrigw_notifyb_nosig (char const *path, char const *s, size_t len)
{
unsigned int i = 0 ;
DIR *dir = opendir(path) ;
if (!dir) return -1 ;
{
- unsigned int pathlen = str_len(path) ;
+ size_t pathlen = str_len(path) ;
char tmp[pathlen + FTRIG1_PREFIXLEN + 45] ;
byte_copy(tmp, pathlen, path) ;
tmp[pathlen] = '/' ; tmp[pathlen + FTRIG1_PREFIXLEN + 44] = 0 ;
@@ -36,8 +37,8 @@ int ftrigw_notifyb_nosig (char const *path, char const *s, unsigned int len)
}
else
{
- register int r = fd_write(fd, s, len) ;
- if ((r < 0) || (unsigned int)r < len)
+ register ssize_t r = fd_write(fd, s, len) ;
+ if ((r < 0) || (size_t)r < len)
{
if (errno == EPIPE) unlink(tmp) ;
/* what to do if EGAIN ? full fifo -> fix the reader !
diff --git a/src/libs6/s6-ftrigrd.c b/src/libs6/s6-ftrigrd.c
index ac79bd2..1bbe856 100644
--- a/src/libs6/s6-ftrigrd.c
+++ b/src/libs6/s6-ftrigrd.c
@@ -1,5 +1,7 @@
/* ISC license. */
+#include <sys/types.h>
+#include <stdint.h>
#include <errno.h>
#include <signal.h>
#include <regex.h>
@@ -34,8 +36,8 @@ struct ftrigio_s
char buf[FTRIGRD_BUFSIZE] ;
regex_t re ;
stralloc sa ;
- uint32 options ;
- uint16 id ; /* given by client */
+ uint32_t options ;
+ uint16_t id ; /* given by client */
} ;
#define FTRIGIO_ZERO { .xindex = 0, .trig = FTRIG1_ZERO, .b = BUFFER_INIT(0, -1, 0, 0), .buf = "", .sa = STRALLOC_ZERO, .options = 0, .id = 0 }
@@ -56,7 +58,7 @@ static void cleanup (void)
n = 0 ;
}
-static void trig (uint16 id, char what, char info)
+static void trig (uint16_t id, char what, char info)
{
char pack[4] ;
unixmessage_t m = { .s = pack, .len = 4, .fds = 0, .nfds = 0 } ;
@@ -92,8 +94,8 @@ static inline int ftrigio_read (ftrigio_t *p)
while (i--)
{
regmatch_t pmatch ;
- unsigned int blen ;
- register int r = sanitize_read(buffer_fill(&p->b)) ;
+ size_t blen ;
+ register 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) ;
@@ -114,7 +116,7 @@ static inline int ftrigio_read (ftrigio_t *p)
static int parse_protocol (unixmessage_t const *m, void *context)
{
- uint16 id ;
+ uint16_t id ;
if (m->len < 3 || m->nfds)
{
cleanup() ;
@@ -137,7 +139,7 @@ static int parse_protocol (unixmessage_t const *m, void *context)
}
case 'L' : /* subscribe to path and match re */
{
- uint32 options, pathlen, relen ;
+ uint32_t options, pathlen, relen ;
int r ;
if (m->len < 19)
{
diff --git a/src/libs6/s6_accessrules_backend_cdb.c b/src/libs6/s6_accessrules_backend_cdb.c
index fc564bb..1187485 100644
--- a/src/libs6/s6_accessrules_backend_cdb.c
+++ b/src/libs6/s6_accessrules_backend_cdb.c
@@ -1,5 +1,7 @@
/* ISC license. */
+#include <sys/types.h>
+#include <stdint.h>
#include <unistd.h>
#include <errno.h>
#include <skalibs/bytestr.h>
@@ -8,11 +10,12 @@
#include <skalibs/stralloc.h>
#include <s6/accessrules.h>
-s6_accessrules_result_t s6_accessrules_backend_cdb (char const *key, unsigned int keylen, void *data, s6_accessrules_params_t *params)
+s6_accessrules_result_t s6_accessrules_backend_cdb (char const *key, size_t keylen, void *data, s6_accessrules_params_t *params)
{
struct cdb *c = data ;
- unsigned int execbase, n ;
- uint16 envlen, execlen ;
+ size_t execbase ;
+ unsigned int n ;
+ uint16_t envlen, execlen ;
register int r = cdb_find(c, key, keylen) ;
if (r < 0) return S6_ACCESSRULES_ERROR ;
else if (!r) return S6_ACCESSRULES_NOTFOUND ;
diff --git a/src/libs6/s6_accessrules_backend_fs.c b/src/libs6/s6_accessrules_backend_fs.c
index 5723db6..17119c9 100644
--- a/src/libs6/s6_accessrules_backend_fs.c
+++ b/src/libs6/s6_accessrules_backend_fs.c
@@ -1,5 +1,6 @@
/* ISC license. */
+#include <sys/types.h>
#include <unistd.h>
#include <errno.h>
#include <skalibs/bytestr.h>
@@ -8,11 +9,11 @@
#include <skalibs/djbunix.h>
#include <s6/accessrules.h>
-s6_accessrules_result_t s6_accessrules_backend_fs (char const *key, unsigned int keylen, void *data, s6_accessrules_params_t *params)
+s6_accessrules_result_t s6_accessrules_backend_fs (char const *key, size_t keylen, void *data, s6_accessrules_params_t *params)
{
char *dir = data ;
- unsigned int dirlen = str_len(dir) ;
- unsigned int envbase = params->env.len ;
+ size_t dirlen = str_len(dir) ;
+ size_t envbase = params->env.len ;
int wasnull = !params->env.s ;
{
char tmp[dirlen + keylen + 10] ;
@@ -40,7 +41,7 @@ s6_accessrules_result_t s6_accessrules_backend_fs (char const *key, unsigned int
}
byte_copy(tmp + dirlen + keylen + 2, 5, "exec") ;
{
- register int r = openreadnclose(tmp, params->exec.s + params->exec.len, 4096) ;
+ register 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 66ace93..4942e8e 100644
--- a/src/libs6/s6_accessrules_keycheck_ip4.c
+++ b/src/libs6/s6_accessrules_keycheck_ip4.c
@@ -1,5 +1,7 @@
/* ISC license. */
+#include <sys/types.h>
+#include <stdint.h>
#include <skalibs/uint32.h>
#include <skalibs/uint.h>
#include <skalibs/fmtscan.h>
@@ -8,13 +10,13 @@
s6_accessrules_result_t s6_accessrules_keycheck_ip4 (void const *key, void *data, s6_accessrules_params_t *params, s6_accessrules_backend_func_t_ref check1)
{
char fmt[IP4_FMT + UINT_FMT + 6] = "ip4/" ;
- uint32 ip ;
+ uint32_t ip ;
unsigned int i = 0 ;
uint32_unpack_big((char const *)key, &ip) ;
for (; i <= 32 ; i++)
{
register s6_accessrules_result_t r ;
- register unsigned int len = 4 + ip4_fmtu32(fmt+4, (i == 32) ? 0 : ip & ~((1U << i) - 1)) ;
+ register 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 a476f3d..cd7fe02 100644
--- a/src/libs6/s6_accessrules_keycheck_ip6.c
+++ b/src/libs6/s6_accessrules_keycheck_ip6.c
@@ -1,5 +1,6 @@
/* ISC license. */
+#include <sys/types.h>
#include <skalibs/uint.h>
#include <skalibs/bytestr.h>
#include <skalibs/bitarray.h>
@@ -14,7 +15,7 @@ s6_accessrules_result_t s6_accessrules_keycheck_ip6 (void const *key, void *data
byte_copy(ip6, 16, (char const *)key) ;
for (; i <= 128 ; i++)
{
- unsigned int len ;
+ size_t len ;
register s6_accessrules_result_t r ;
if (i) bitarray_clear(ip6, 128 - i) ;
len = 4 + ip6_fmt(fmt+4, ip6) ;
diff --git a/src/libs6/s6_accessrules_keycheck_reversedns.c b/src/libs6/s6_accessrules_keycheck_reversedns.c
index 00d7e21..5c44e47 100644
--- a/src/libs6/s6_accessrules_keycheck_reversedns.c
+++ b/src/libs6/s6_accessrules_keycheck_reversedns.c
@@ -1,5 +1,6 @@
/* ISC license. */
+#include <sys/types.h>
#include <errno.h>
#include <skalibs/bytestr.h>
#include <s6/accessrules.h>
@@ -7,11 +8,11 @@
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 ;
- unsigned int len = str_len(name) ;
+ size_t len = str_len(name) ;
if (!len) return (errno = EINVAL, S6_ACCESSRULES_ERROR) ;
if (name[len-1] == '.') len-- ;
{
- unsigned int i = 0 ;
+ size_t i = 0 ;
char tmp[len + 11] ;
byte_copy(tmp, 11, "reversedns/") ;
while (i < len)
diff --git a/src/libs6/s6_accessrules_keycheck_uidgid.c b/src/libs6/s6_accessrules_keycheck_uidgid.c
index 08f0f9c..7a2cd0a 100644
--- a/src/libs6/s6_accessrules_keycheck_uidgid.c
+++ b/src/libs6/s6_accessrules_keycheck_uidgid.c
@@ -1,16 +1,16 @@
/* ISC license. */
-#include <skalibs/uint.h>
-#include <skalibs/diuint.h>
+#include <skalibs/uint64.h>
+#include <skalibs/gidstuff.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 + UINT_FMT] = "uid/" ;
- register s6_accessrules_result_t r = (*check1)(fmt, 4 + uint_fmt(fmt+4, ((diuint const *)key)->left), data, params) ;
+ 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) ;
if (r != S6_ACCESSRULES_NOTFOUND) return r ;
fmt[0] = 'g' ;
- r = (*check1)(fmt, 4 + uint_fmt(fmt+4, ((diuint const *)key)->right), data, params) ;
+ r = (*check1)(fmt, 4 + gid_fmt(fmt+4, ((uidgid_t const *)key)->right), data, params) ;
return (r != S6_ACCESSRULES_NOTFOUND) ? r :
(*check1)("uid/default", 11, data, params) ;
}
diff --git a/src/libs6/s6_accessrules_uidgid_cdb.c b/src/libs6/s6_accessrules_uidgid_cdb.c
index a1a83d6..3679d87 100644
--- a/src/libs6/s6_accessrules_uidgid_cdb.c
+++ b/src/libs6/s6_accessrules_uidgid_cdb.c
@@ -1,11 +1,11 @@
/* ISC license. */
-#include <skalibs/diuint.h>
+#include <sys/types.h>
#include <skalibs/cdb.h>
#include <s6/accessrules.h>
-s6_accessrules_result_t s6_accessrules_uidgid_cdb (unsigned int uid, unsigned int gid, struct cdb *c, s6_accessrules_params_t *params)
+s6_accessrules_result_t s6_accessrules_uidgid_cdb (uid_t uid, gid_t gid, struct cdb *c, s6_accessrules_params_t *params)
{
- diuint uidgid = { .left = uid, .right = gid } ;
+ uidgid_t uidgid = { .left = uid, .right = gid } ;
return s6_accessrules_keycheck_uidgid(&uidgid, c, params, &s6_accessrules_backend_cdb) ;
}
diff --git a/src/libs6/s6_accessrules_uidgid_fs.c b/src/libs6/s6_accessrules_uidgid_fs.c
index 848fa89..4ed007b 100644
--- a/src/libs6/s6_accessrules_uidgid_fs.c
+++ b/src/libs6/s6_accessrules_uidgid_fs.c
@@ -1,10 +1,10 @@
/* ISC license. */
-#include <skalibs/diuint.h>
+#include <sys/types.h>
#include <s6/accessrules.h>
-s6_accessrules_result_t s6_accessrules_uidgid_fs (unsigned int uid, unsigned int gid, char const *rulesdir, s6_accessrules_params_t *params)
+s6_accessrules_result_t s6_accessrules_uidgid_fs (uid_t uid, gid_t gid, char const *rulesdir, s6_accessrules_params_t *params)
{
- diuint uidgid = { .left = uid, .right = gid } ;
+ uidgid_t uidgid = { .left = uid, .right = gid } ;
return s6_accessrules_keycheck_uidgid(&uidgid, (void *)rulesdir, params, &s6_accessrules_backend_fs) ;
}
diff --git a/src/libs6/s6_fdholder_delete_async.c b/src/libs6/s6_fdholder_delete_async.c
index 6452efa..21caab3 100644
--- a/src/libs6/s6_fdholder_delete_async.c
+++ b/src/libs6/s6_fdholder_delete_async.c
@@ -1,5 +1,6 @@
/* ISC license. */
+#include <sys/types.h>
#include <errno.h>
#include <skalibs/bytestr.h>
#include <skalibs/siovec.h>
@@ -8,7 +9,7 @@
int s6_fdholder_delete_async (s6_fdholder_t *a, char const *id)
{
- unsigned int idlen = str_len(id) ;
+ size_t idlen = str_len(id) ;
char pack[2] = "D" ;
siovec_t v[2] = { { .s = pack, .len = 2 }, { .s = (char *)id, .len = idlen + 1 } } ;
unixmessage_v_t m = { .v = v, .vlen = 2, .fds = 0, .nfds = 0 } ;
diff --git a/src/libs6/s6_fdholder_getdump.c b/src/libs6/s6_fdholder_getdump.c
index 9feba3e..213cad8 100644
--- a/src/libs6/s6_fdholder_getdump.c
+++ b/src/libs6/s6_fdholder_getdump.c
@@ -1,5 +1,7 @@
/* ISC license. */
+#include <sys/types.h>
+#include <stdint.h>
#include <errno.h>
#include <skalibs/uint32.h>
#include <skalibs/allreadwrite.h>
@@ -14,7 +16,7 @@
int s6_fdholder_getdump (s6_fdholder_t *a, genalloc *g, tain_t const *deadline, tain_t *stamp)
{
unixmessage_t m = { .s = "?", .len = 1, .fds = 0, .nfds = 0 } ;
- uint32 ntot, n ;
+ uint32_t ntot, n ;
unsigned int oldlen = genalloc_len(s6_fdholder_fd_t, g) ;
unsigned int i = 0 ;
int ok ;
@@ -37,19 +39,19 @@ int s6_fdholder_getdump (s6_fdholder_t *a, genalloc *g, tain_t const *deadline,
if (ok)
{
s6_fdholder_fd_t *tab = genalloc_s(s6_fdholder_fd_t, g) + genalloc_len(s6_fdholder_fd_t, g) ;
- unsigned int i = 0 ;
- for (; i < m.nfds ; i++)
+ unsigned int j = 0 ;
+ for (; j < m.nfds ; i++)
{
unsigned char thislen ;
if (m.len < TAIN_PACK + 3) goto droperr ;
- tain_unpack(m.s, &tab[i].limit) ;
+ tain_unpack(m.s, &tab[j].limit) ;
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[i].id, thislen, m.s) ;
- byte_zero(tab[i].id + thislen, S6_FDHOLDER_ID_SIZE + 1 - thislen) ;
- m.s += (unsigned int)thislen + 1 ; m.len -= (unsigned int)thislen + 1 ;
- tab[i].fd = m.fds[i] ;
+ byte_copy(tab[j].id, thislen, m.s) ;
+ byte_zero(tab[j].id + thislen, S6_FDHOLDER_ID_SIZE + 1 - thislen) ;
+ m.s += (size_t)thislen + 1 ; m.len -= (size_t)thislen + 1 ;
+ tab[j].fd = m.fds[j] ;
}
genalloc_setlen(s6_fdholder_fd_t, g, genalloc_len(s6_fdholder_fd_t, g) + m.nfds) ;
}
@@ -65,8 +67,8 @@ int s6_fdholder_getdump (s6_fdholder_t *a, genalloc *g, tain_t const *deadline,
err:
{
int e = errno ;
- i = genalloc_len(s6_fdholder_fd_t, g) ;
- while (i-- > oldlen) fd_close(genalloc_s(s6_fdholder_fd_t, g)[i].fd) ;
+ size_t j = genalloc_len(s6_fdholder_fd_t, g) ;
+ while (j-- > oldlen) fd_close(genalloc_s(s6_fdholder_fd_t, g)[j].fd) ;
genalloc_setlen(s6_fdholder_fd_t, g, oldlen) ;
errno = e ;
}
diff --git a/src/libs6/s6_fdholder_list_cb.c b/src/libs6/s6_fdholder_list_cb.c
index 59d01a5..8bf5faf 100644
--- a/src/libs6/s6_fdholder_list_cb.c
+++ b/src/libs6/s6_fdholder_list_cb.c
@@ -1,5 +1,6 @@
/* ISC license. */
+#include <stdint.h>
#include <errno.h>
#include <skalibs/uint32.h>
#include <skalibs/bytestr.h>
@@ -10,7 +11,7 @@
int s6_fdholder_list_cb (unixmessage_t const *m, void *p)
{
- uint32 n ;
+ uint32_t n ;
register s6_fdholder_list_result_t *res = p ;
if (m->nfds) goto droperr ;
if (!m->len) goto err ;
diff --git a/src/libs6/s6_fdholder_retrieve_async.c b/src/libs6/s6_fdholder_retrieve_async.c
index bc7077c..5336544 100644
--- a/src/libs6/s6_fdholder_retrieve_async.c
+++ b/src/libs6/s6_fdholder_retrieve_async.c
@@ -1,5 +1,6 @@
/* ISC license. */
+#include <sys/types.h>
#include <errno.h>
#include <skalibs/bytestr.h>
#include <skalibs/tai.h>
@@ -9,7 +10,7 @@
int s6_fdholder_retrieve_maybe_delete_async (s6_fdholder_t *a, char const *id, int dodelete)
{
- unsigned int idlen = str_len(id) ;
+ size_t idlen = str_len(id) ;
char pack[3] = "R" ;
siovec_t v[2] = { { .s = pack, .len = 3 }, { .s = (char *)id, .len = idlen + 1 } } ;
unixmessage_v_t m = { .v = v, .vlen = 2, .fds = 0, .nfds = 0 } ;
diff --git a/src/libs6/s6_fdholder_setdump.c b/src/libs6/s6_fdholder_setdump.c
index b6fb7c4..5982b95 100644
--- a/src/libs6/s6_fdholder_setdump.c
+++ b/src/libs6/s6_fdholder_setdump.c
@@ -1,5 +1,7 @@
/* ISC license. */
+#include <sys/types.h>
+#include <stdint.h>
#include <errno.h>
#include <skalibs/uint32.h>
#include <skalibs/allreadwrite.h>
@@ -12,12 +14,12 @@
int s6_fdholder_setdump (s6_fdholder_t *a, s6_fdholder_fd_t const *list, unsigned int ntot, tain_t const *deadline, tain_t *stamp)
{
- uint32 trips ;
+ uint32_t trips ;
if (!ntot) return 1 ;
unsigned int i = 0 ;
for (; i < ntot ; i++)
{
- unsigned int zpos = byte_chr(list[i].id, S6_FDHOLDER_ID_SIZE + 1, 0) ;
+ size_t zpos = byte_chr(list[i].id, S6_FDHOLDER_ID_SIZE + 1, 0) ;
if (!zpos || zpos >= S6_FDHOLDER_ID_SIZE + 1) return (errno = EINVAL, 0) ;
}
{
@@ -45,7 +47,7 @@ int s6_fdholder_setdump (s6_fdholder_t *a, s6_fdholder_fd_t const *list, unsigne
v[0].s = "." ; v[0].len = 1 ;
for (; j < n ; j++, list++, ntot--)
{
- unsigned int len = str_len(list->id) ;
+ 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 ;
tain_pack(pack + j * (TAIN_PACK+1), &list->limit) ;
diff --git a/src/libs6/s6_fdholder_store_async.c b/src/libs6/s6_fdholder_store_async.c
index 2113b32..6a5482a 100644
--- a/src/libs6/s6_fdholder_store_async.c
+++ b/src/libs6/s6_fdholder_store_async.c
@@ -1,5 +1,6 @@
/* ISC license. */
+#include <sys/types.h>
#include <errno.h>
#include <skalibs/bytestr.h>
#include <skalibs/tai.h>
@@ -9,7 +10,7 @@
int s6_fdholder_store_async (s6_fdholder_t *a, int fd, char const *id, tain_t const *limit)
{
- unsigned int idlen = str_len(id) ;
+ size_t idlen = str_len(id) ;
char pack[2 + TAIN_PACK] = "S" ;
siovec_t v[2] = { { .s = pack, .len = 2 + TAIN_PACK }, { .s = (char *)id, .len = idlen + 1 } } ;
unixmessage_v_t m = { .v = v, .vlen = 2, .fds = &fd, .nfds = 1 } ;
diff --git a/src/libs6/s6_supervise_lock_mode.c b/src/libs6/s6_supervise_lock_mode.c
index ff3e11e..cda4ac2 100644
--- a/src/libs6/s6_supervise_lock_mode.c
+++ b/src/libs6/s6_supervise_lock_mode.c
@@ -10,7 +10,7 @@
int s6_supervise_lock_mode (char const *subdir, unsigned int subdirmode, unsigned int controlmode)
{
- unsigned int subdirlen = str_len(subdir) ;
+ size_t subdirlen = str_len(subdir) ;
int fdctl, fdctlw, fdlock ;
char control[subdirlen + 9] ;
char lock[subdirlen + 6] ;
diff --git a/src/libs6/s6_svc_ok.c b/src/libs6/s6_svc_ok.c
index 37c317c..de30fd7 100644
--- a/src/libs6/s6_svc_ok.c
+++ b/src/libs6/s6_svc_ok.c
@@ -1,5 +1,6 @@
/* ISC license. */
+#include <sys/types.h>
#include <errno.h>
#include <skalibs/bytestr.h>
#include <skalibs/djbunix.h>
@@ -7,8 +8,8 @@
int s6_svc_ok (char const *dir)
{
+ size_t dirlen = str_len(dir) ;
int fd ;
- unsigned int dirlen = str_len(dir) ;
char fn[dirlen + 9 + sizeof(S6_SUPERVISE_CTLDIR)] ;
byte_copy(fn, dirlen, dir) ;
fn[dirlen] = '/' ;
diff --git a/src/libs6/s6_svc_write.c b/src/libs6/s6_svc_write.c
index ea9eee5..03bf648 100644
--- a/src/libs6/s6_svc_write.c
+++ b/src/libs6/s6_svc_write.c
@@ -1,11 +1,12 @@
/* ISC license. */
+#include <sys/types.h>
#include <errno.h>
#include <skalibs/allreadwrite.h>
#include <skalibs/djbunix.h>
#include <s6/s6-supervise.h>
-int s6_svc_write (char const *fifo, char const *data, unsigned int datalen)
+int s6_svc_write (char const *fifo, char const *data, size_t datalen)
{
int fd = open_write(fifo) ;
if (fd < 0) return (errno == ENXIO) ? 0 : -1 ;
diff --git a/src/libs6/s6_svc_writectl.c b/src/libs6/s6_svc_writectl.c
index 2e308b9..26c0fb6 100644
--- a/src/libs6/s6_svc_writectl.c
+++ b/src/libs6/s6_svc_writectl.c
@@ -1,12 +1,13 @@
/* ISC license. */
+#include <sys/types.h>
#include <skalibs/bytestr.h>
#include <s6/s6-supervise.h>
-int s6_svc_writectl (char const *service, char const *subdir, char const *s, unsigned int len)
+int s6_svc_writectl (char const *service, char const *subdir, char const *s, size_t len)
{
- unsigned int svlen = str_len(service) ;
- unsigned int sublen = str_len(subdir) ;
+ size_t svlen = str_len(service) ;
+ size_t sublen = str_len(subdir) ;
char fn[svlen + sublen + 10] ;
byte_copy(fn, svlen, service) ;
fn[svlen] = '/' ;
diff --git a/src/libs6/s6_svstatus_pack.c b/src/libs6/s6_svstatus_pack.c
index cc92621..c7afe24 100644
--- a/src/libs6/s6_svstatus_pack.c
+++ b/src/libs6/s6_svstatus_pack.c
@@ -1,5 +1,6 @@
/* ISC license. */
+#include <stdint.h>
#include <skalibs/uint16.h>
#include <skalibs/uint64.h>
#include <skalibs/tai.h>
@@ -10,7 +11,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) ;
- uint16_pack_big(pack + 32, (uint16)sv->wstat) ;
+ uint16_pack_big(pack + 32, (uint16_t)sv->wstat) ;
pack[34] =
sv->flagpaused |
(sv->flagfinishing << 1) |
diff --git a/src/libs6/s6_svstatus_read.c b/src/libs6/s6_svstatus_read.c
index 334dc47..6b6ae4e 100644
--- a/src/libs6/s6_svstatus_read.c
+++ b/src/libs6/s6_svstatus_read.c
@@ -1,12 +1,13 @@
/* ISC license. */
+#include <sys/types.h>
#include <skalibs/bytestr.h>
#include <skalibs/djbunix.h>
#include <s6/s6-supervise.h>
int s6_svstatus_read (char const *dir, s6_svstatus_t *status)
{
- unsigned int n = str_len(dir) ;
+ size_t n = str_len(dir) ;
char pack[S6_SVSTATUS_SIZE] ;
char tmp[n + 1 + sizeof(S6_SVSTATUS_FILENAME)] ;
byte_copy(tmp, n, dir) ;
diff --git a/src/libs6/s6_svstatus_unpack.c b/src/libs6/s6_svstatus_unpack.c
index 2e78dcb..6ec2f02 100644
--- a/src/libs6/s6_svstatus_unpack.c
+++ b/src/libs6/s6_svstatus_unpack.c
@@ -1,6 +1,6 @@
/* ISC license. */
-#include <sys/types.h>
+#include <stdint.h>
#include <skalibs/uint16.h>
#include <skalibs/uint64.h>
#include <skalibs/tai.h>
@@ -9,7 +9,7 @@
void s6_svstatus_unpack (char const *pack, s6_svstatus_t *sv)
{
uint64 pid ;
- uint16 wstat ;
+ uint16_t wstat ;
tain_unpack(pack, &sv->stamp) ;
tain_unpack(pack + 12, &sv->readystamp) ;
uint64_unpack_big(pack + 24, &pid) ;
diff --git a/src/libs6/s6_svstatus_write.c b/src/libs6/s6_svstatus_write.c
index e07d744..935db9c 100644
--- a/src/libs6/s6_svstatus_write.c
+++ b/src/libs6/s6_svstatus_write.c
@@ -1,12 +1,13 @@
/* ISC license. */
+#include <sys/types.h>
#include <skalibs/bytestr.h>
#include <skalibs/djbunix.h>
#include <s6/s6-supervise.h>
int s6_svstatus_write (char const *dir, s6_svstatus_t const *status)
{
- unsigned int n = str_len(dir) ;
+ size_t n = str_len(dir) ;
char pack[S6_SVSTATUS_SIZE] ;
char tmp[n + 1 + sizeof(S6_SVSTATUS_FILENAME)] ;
byte_copy(tmp, n, dir) ;
diff --git a/src/libs6/s6lock_acquire.c b/src/libs6/s6lock_acquire.c
index b0fef54..2bf6171 100644
--- a/src/libs6/s6lock_acquire.c
+++ b/src/libs6/s6lock_acquire.c
@@ -1,5 +1,7 @@
/* ISC license. */
+#include <sys/types.h>
+#include <stdint.h>
#include <errno.h>
#include <skalibs/uint16.h>
#include <skalibs/uint32.h>
@@ -10,18 +12,19 @@
#include <skalibs/skaclient.h>
#include <s6/s6lock.h>
-int s6lock_acquire (s6lock_t *a, uint16 *u, char const *path, uint32 options, tain_t const *limit, tain_t const *deadline, tain_t *stamp)
+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)
{
- unsigned int pathlen = str_len(path) ;
+ size_t pathlen = str_len(path) ;
char err ;
char tmp[23] = "--<" ;
siovec_t v[2] = { { .s = tmp, .len = 23 }, { .s = (char *)path, .len = pathlen + 1 } } ;
unsigned int i ;
+ if (pathlen > UINT32_MAX) return (errno = ENAMETOOLONG, 0) ;
if (!gensetdyn_new(&a->data, &i)) return 0 ;
- uint16_pack_big(tmp, (uint16)i) ;
+ uint16_pack_big(tmp, (uint16_t)i) ;
uint32_pack_big(tmp+3, options) ;
tain_pack(tmp+7, limit) ;
- uint32_pack_big(tmp+19, (uint32)pathlen) ;
+ uint32_pack_big(tmp+19, (uint32_t)pathlen) ;
if (!skaclient_sendv(&a->connection, v, 2, &skaclient_default_cb, &err, deadline, stamp))
{
gensetdyn_delete(&a->data, i) ;
diff --git a/src/libs6/s6lock_check.c b/src/libs6/s6lock_check.c
index e794128..8bdbae0 100644
--- a/src/libs6/s6lock_check.c
+++ b/src/libs6/s6lock_check.c
@@ -1,12 +1,12 @@
/* ISC license. */
+#include <stdint.h>
#include <errno.h>
#include <skalibs/error.h>
-#include <skalibs/uint16.h>
#include <skalibs/gensetdyn.h>
#include <s6/s6lock.h>
-int s6lock_check (s6lock_t *a, uint16 id)
+int s6lock_check (s6lock_t *a, uint16_t id)
{
char *p = GENSETDYN_P(char, &a->data, id) ;
switch (*p)
diff --git a/src/libs6/s6lock_end.c b/src/libs6/s6lock_end.c
index c460efd..74e83f1 100644
--- a/src/libs6/s6lock_end.c
+++ b/src/libs6/s6lock_end.c
@@ -1,5 +1,6 @@
/* ISC license. */
+#include <stdint.h>
#include <skalibs/genalloc.h>
#include <skalibs/gensetdyn.h>
#include <skalibs/skaclient.h>
@@ -8,7 +9,7 @@
void s6lock_end (s6lock_t *a)
{
gensetdyn_free(&a->data) ;
- genalloc_free(uint16, &a->list) ;
+ genalloc_free(uint16_t, &a->list) ;
skaclient_end(&a->connection) ;
*a = s6lock_zero ;
}
diff --git a/src/libs6/s6lock_release.c b/src/libs6/s6lock_release.c
index 95e863f..344ace4 100644
--- a/src/libs6/s6lock_release.c
+++ b/src/libs6/s6lock_release.c
@@ -1,5 +1,6 @@
/* ISC license. */
+#include <stdint.h>
#include <errno.h>
#include <skalibs/error.h>
#include <skalibs/uint16.h>
@@ -8,7 +9,7 @@
#include <skalibs/skaclient.h>
#include <s6/s6lock.h>
-int s6lock_release (s6lock_t *a, uint16 i, tain_t const *deadline, tain_t *stamp)
+int s6lock_release (s6lock_t *a, uint16_t i, tain_t const *deadline, tain_t *stamp)
{
char *p = GENSETDYN_P(char, &a->data, i) ;
if ((*p != EBUSY) && !error_isagain(*p))
diff --git a/src/libs6/s6lock_start.c b/src/libs6/s6lock_start.c
index 3f60b6f..c527bee 100644
--- a/src/libs6/s6lock_start.c
+++ b/src/libs6/s6lock_start.c
@@ -1,7 +1,5 @@
/* ISC license. */
-#include <errno.h>
-#include <skalibs/environ.h>
#include <skalibs/tai.h>
#include <skalibs/skaclient.h>
#include <s6/s6lock.h>
diff --git a/src/libs6/s6lock_update.c b/src/libs6/s6lock_update.c
index 6e6a2a0..a56c276 100644
--- a/src/libs6/s6lock_update.c
+++ b/src/libs6/s6lock_update.c
@@ -1,5 +1,6 @@
/* ISC license. */
+#include <stdint.h>
#include <errno.h>
#include <skalibs/error.h>
#include <skalibs/uint16.h>
@@ -13,19 +14,19 @@ static int msghandler (unixmessage_t const *m, void *context)
{
s6lock_t *a = (s6lock_t *)context ;
char *p ;
- uint16 id ;
+ uint16_t id ;
if (m->len != 3 || m->nfds) return (errno = EPROTO, 0) ;
uint16_unpack_big(m->s, &id) ;
p = GENSETDYN_P(char, &a->data, id) ;
if (*p == EBUSY) *p = m->s[2] ;
else if (error_isagain(*p)) *p = m->s[2] ? m->s[2] : EBUSY ;
else return (errno = EPROTO, 0) ;
- if (!genalloc_append(uint16, &a->list, &id)) return 0 ;
+ if (!genalloc_append(uint16_t, &a->list, &id)) return 0 ;
return 1 ;
}
int s6lock_update (s6lock_t *a)
{
- genalloc_setlen(uint16, &a->list, 0) ;
+ genalloc_setlen(uint16_t, &a->list, 0) ;
return skaclient_update(&a->connection, &msghandler, a) ;
}
diff --git a/src/libs6/s6lock_wait_and.c b/src/libs6/s6lock_wait_and.c
index 460cc07..30c7a43 100644
--- a/src/libs6/s6lock_wait_and.c
+++ b/src/libs6/s6lock_wait_and.c
@@ -1,14 +1,14 @@
/* ISC license. */
+#include <stdint.h>
#include <errno.h>
-#include <skalibs/uint16.h>
#include <skalibs/tai.h>
#include <skalibs/iopause.h>
#include <s6/s6lock.h>
-int s6lock_wait_and (s6lock_t *a, uint16 const *idlist, unsigned int n, tain_t const *deadline, tain_t *stamp)
+int s6lock_wait_and (s6lock_t *a, uint16_t const *idlist, unsigned int n, tain_t const *deadline, tain_t *stamp)
{
- iopause_fd x = { -1, IOPAUSE_READ, 0 } ;
+ iopause_fd x = { .fd = -1, .events = IOPAUSE_READ, .revents = 0 } ;
x.fd = s6lock_fd(a) ;
for (; n ; n--, idlist++)
{
diff --git a/src/libs6/s6lock_wait_or.c b/src/libs6/s6lock_wait_or.c
index 8fa44ef..1a4d468 100644
--- a/src/libs6/s6lock_wait_or.c
+++ b/src/libs6/s6lock_wait_or.c
@@ -1,13 +1,13 @@
/* ISC license. */
+#include <stdint.h>
#include <errno.h>
-#include <skalibs/uint16.h>
#include <skalibs/tai.h>
#include <skalibs/iopause.h>
#include <skalibs/error.h>
#include <s6/s6lock.h>
-int s6lock_wait_or (s6lock_t *a, uint16 const *idlist, unsigned int n, tain_t const *deadline, tain_t *stamp)
+int s6lock_wait_or (s6lock_t *a, uint16_t const *idlist, unsigned int n, tain_t const *deadline, tain_t *stamp)
{
iopause_fd x = { -1, IOPAUSE_READ | IOPAUSE_EXCEPT, 0 } ;
x.fd = s6lock_fd(a) ;
diff --git a/src/libs6/s6lockd.c b/src/libs6/s6lockd.c
index 22378e3..e8c8cb6 100644
--- a/src/libs6/s6lockd.c
+++ b/src/libs6/s6lockd.c
@@ -1,5 +1,7 @@
/* ISC license. */
+#include <sys/types.h>
+#include <stdint.h>
#include <unistd.h>
#include <errno.h>
#include <signal.h>
@@ -28,14 +30,14 @@ struct s6lockio_s
unsigned int pid ;
tain_t limit ;
int p[2] ;
- uint16 id ; /* given by client */
+ uint16_t id ; /* given by client */
} ;
#define S6LOCKIO_ZERO { 0, 0, TAIN_ZERO, { -1, -1 }, 0 }
static s6lockio_t const szero = S6LOCKIO_ZERO ;
static genalloc a = GENALLOC_ZERO ; /* array of s6lockio_t */
-static void s6lockio_free (s6lockio_t_ref p)
+static void s6lockio_free (s6lockio_t *p)
{
register int e = errno ;
fd_close(p->p[1]) ;
@@ -47,12 +49,12 @@ static void s6lockio_free (s6lockio_t_ref p)
static void cleanup (void)
{
- register unsigned int i = genalloc_len(s6lockio_t, &a) ;
+ register 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) ;
}
-static void trig (uint16 id, char e)
+static void trig (uint16_t id, char e)
{
char pack[3] ;
unixmessage_t m = { .s = pack, .len = 3, .fds = 0, .nfds = 0 } ;
@@ -77,7 +79,7 @@ static void answer (char c)
static void remove (unsigned int i)
{
- register unsigned int n = genalloc_len(s6lockio_t, &a) - 1 ;
+ register 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) ;
@@ -104,7 +106,7 @@ static void handle_signals (void)
static int parse_protocol (unixmessage_t const *m, void *context)
{
- uint16 id ;
+ uint16_t id ;
if (m->len < 3 || m->nfds)
{
cleanup() ;
@@ -115,7 +117,7 @@ static int parse_protocol (unixmessage_t const *m, void *context)
{
case '>' : /* release */
{
- register unsigned int i = genalloc_len(s6lockio_t, &a) ;
+ register size_t i = genalloc_len(s6lockio_t, &a) ;
for (; i ; i--) if (genalloc_s(s6lockio_t, &a)[i-1].id == id) break ;
if (i)
{
@@ -130,7 +132,7 @@ static int parse_protocol (unixmessage_t const *m, void *context)
s6lockio_t f = S6LOCKIO_ZERO ;
char const *cargv[3] = { S6LOCKD_HELPER_PROG, 0, 0 } ;
char const *cenvp[2] = { 0, 0 } ;
- uint32 options, pathlen ;
+ uint32_t options, pathlen ;
if (m->len < 23)
{
answer(EPROTO) ;
@@ -209,7 +211,7 @@ int main (int argc, char const *const *argv)
for (;;)
{
- register unsigned int n = genalloc_len(s6lockio_t, &a) ;
+ register size_t n = genalloc_len(s6lockio_t, &a) ;
iopause_fd x[4 + n] ;
unsigned int i = 0 ;
int r ;
@@ -272,12 +274,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_ref p = genalloc_s(s6lockio_t, &a) + i ;
+ register 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 int r = sanitize_read(fd_read(p->p[0], &c, 1)) ;
+ register 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 8f0d2cc..112c853 100644
--- a/src/pipe-tools/s6-ftrig-listen.c
+++ b/src/pipe-tools/s6-ftrig-listen.c
@@ -1,5 +1,7 @@
/* ISC license. */
+#include <sys/types.h>
+#include <stdint.h>
#include <errno.h>
#include <signal.h>
#include <unistd.h>
@@ -69,9 +71,9 @@ int main (int argc, char const **argv, char const *const *envp)
x[1].fd = ftrigr_fd(&a) ;
{
- int pid = 0 ;
+ pid_t pid = 0 ;
unsigned int idlen = argc1 >> 1 ;
- uint16 ids[idlen] ;
+ uint16_t ids[idlen] ;
for (; i < idlen ; i++)
{
ids[i] = ftrigr_subscribe_g(&a, argv[i<<1], argv[(i<<1)+1], 0, &deadline) ;
diff --git a/src/pipe-tools/s6-ftrig-listen1.c b/src/pipe-tools/s6-ftrig-listen1.c
index ffb43cc..f5f7814 100644
--- a/src/pipe-tools/s6-ftrig-listen1.c
+++ b/src/pipe-tools/s6-ftrig-listen1.c
@@ -1,5 +1,7 @@
/* ISC license. */
+#include <sys/types.h>
+#include <stdint.h>
#include <errno.h>
#include <signal.h>
#include <unistd.h>
@@ -31,8 +33,8 @@ int main (int argc, char const *const *argv, char const *const *envp)
iopause_fd x[2] = { { -1, IOPAUSE_READ, 0 }, { -1, IOPAUSE_READ, 0 } } ;
tain_t deadline, tto ;
ftrigr_t a = FTRIGR_ZERO ;
- int pid ;
- uint16 id ;
+ pid_t pid ;
+ uint16_t id ;
PROG = "s6-ftrig-listen1" ;
{
unsigned int t = 0 ;
diff --git a/src/pipe-tools/s6-ftrig-wait.c b/src/pipe-tools/s6-ftrig-wait.c
index 772ce86..40d458e 100644
--- a/src/pipe-tools/s6-ftrig-wait.c
+++ b/src/pipe-tools/s6-ftrig-wait.c
@@ -1,5 +1,6 @@
/* ISC license. */
+#include <stdint.h>
#include <errno.h>
#include <skalibs/allreadwrite.h>
#include <skalibs/sgetopt.h>
@@ -14,7 +15,7 @@ int main (int argc, char const *const *argv)
{
tain_t deadline, tto ;
ftrigr_t a = FTRIGR_ZERO ;
- uint16 id ;
+ uint16_t id ;
char pack[2] = " \n" ;
PROG = "s6-ftrig-wait" ;
{
diff --git a/src/pipe-tools/s6-mkfifodir.c b/src/pipe-tools/s6-mkfifodir.c
index 4f5151a..268d822 100644
--- a/src/pipe-tools/s6-mkfifodir.c
+++ b/src/pipe-tools/s6-mkfifodir.c
@@ -1,7 +1,8 @@
/* ISC license. */
+#include <sys/types.h>
#include <skalibs/sgetopt.h>
-#include <skalibs/uint.h>
+#include <skalibs/gidstuff.h>
#include <skalibs/strerr2.h>
#include <s6/ftrigw.h>
@@ -10,7 +11,7 @@
int main (int argc, char const *const *argv)
{
subgetopt_t l = SUBGETOPT_ZERO ;
- int gid = -1 ;
+ gid_t gid = -1 ;
int force = 0 ;
PROG = "s6-mkfifodir" ;
for (;;)
@@ -20,13 +21,7 @@ int main (int argc, char const *const *argv)
switch (opt)
{
case 'f' : force = 1 ; break ;
- case 'g' :
- {
- unsigned int g ;
- if (!uint0_scan(l.arg, &g)) strerr_dieusage(100, USAGE) ;
- gid = (int)g ;
- break ;
- }
+ case 'g' : if (!gid0_scan(l.arg, &gid)) strerr_dieusage(100, USAGE) ; break ;
default : strerr_dieusage(100, USAGE) ;
}
}
diff --git a/src/supervision/s6-supervise.c b/src/supervision/s6-supervise.c
index 2e8fa38..8006e9f 100644
--- a/src/supervision/s6-supervise.c
+++ b/src/supervision/s6-supervise.c
@@ -72,7 +72,7 @@ static inline void announce (void)
static int read_uint (char const *file, unsigned int *fd)
{
char buf[UINT_FMT + 1] ;
- register int r = openreadnclose_nb(file, buf, UINT_FMT) ;
+ register ssize_t r = openreadnclose_nb(file, buf, UINT_FMT) ;
if (r < 0)
{
if (errno != ENOENT) strerr_warnwu2sys("open ", file) ;
@@ -476,7 +476,7 @@ static action_t_ref const actions[5][25] =
static inline void handle_notifyfd (void)
{
char buf[4096] ;
- register int r = 1 ;
+ register ssize_t r = 1 ;
while (r > 0)
{
r = sanitize_read(fd_read(notifyfd, buf, 4096)) ;
@@ -538,12 +538,12 @@ static inline void handle_control (int fd)
for (;;)
{
char c ;
- register int r = sanitize_read(fd_read(fd, &c, 1)) ;
+ register 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 unsigned int pos = byte_chr("abqhkti12fFpcyoduxOX", 20, c) ;
+ register size_t pos = byte_chr("abqhkti12fFpcyoduxOX", 20, c) ;
if (pos < 20) (*actions[state][V_a + pos])() ;
}
}
@@ -556,8 +556,8 @@ 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]) ;
{
- register unsigned int proglen = str_len(PROG) ;
- register unsigned int namelen = str_len(argv[1]) ;
+ size_t proglen = str_len(PROG) ;
+ size_t namelen = str_len(argv[1]) ;
char progname[proglen + namelen + 2] ;
byte_copy(progname, proglen, PROG) ;
progname[proglen] = ' ' ;
diff --git a/src/supervision/s6-svc.c b/src/supervision/s6-svc.c
index cc92618..c929806 100644
--- a/src/supervision/s6-svc.c
+++ b/src/supervision/s6-svc.c
@@ -1,5 +1,6 @@
/* ISC license. */
+#include <sys/types.h>
#include <unistd.h>
#include <errno.h>
#include <skalibs/uint.h>
@@ -71,7 +72,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
if (datalen <= 1) return 0 ;
if (updown[1] == 'U' || updown[1] == 'R')
{
- unsigned int arglen = str_len(argv[0]) ;
+ size_t arglen = str_len(argv[0]) ;
char fn[arglen + 17] ;
byte_copy(fn, arglen, argv[0]) ;
byte_copy(fn + arglen, 17, "/notification-fd") ;
diff --git a/src/supervision/s6-svlisten.c b/src/supervision/s6-svlisten.c
index e53fa76..319a4c3 100644
--- a/src/supervision/s6-svlisten.c
+++ b/src/supervision/s6-svlisten.c
@@ -1,8 +1,8 @@
/* ISC license. */
#include <sys/types.h>
+#include <stdint.h>
#include <skalibs/sgetopt.h>
-#include <skalibs/uint16.h>
#include <skalibs/uint.h>
#include <skalibs/bitarray.h>
#include <skalibs/tai.h>
@@ -64,7 +64,7 @@ int main (int argc, char const **argv, char const *const *envp)
{
s6_svlisten_t foo = S6_SVLISTEN_ZERO ;
pid_t pid ;
- uint16 ids[argc1] ;
+ uint16_t ids[argc1] ;
unsigned char upstate[bitarray_div8(argc1)] ;
unsigned char readystate[bitarray_div8(argc1)] ;
s6_svlisten_init(argc1, argv, &foo, ids, upstate, readystate, &deadline) ;
diff --git a/src/supervision/s6-svlisten.h b/src/supervision/s6-svlisten.h
index a5d36dd..8f01907 100644
--- a/src/supervision/s6-svlisten.h
+++ b/src/supervision/s6-svlisten.h
@@ -3,7 +3,7 @@
#ifndef S6_SVLISTEN_H
#define S6_SVLISTEN_H
-#include <skalibs/uint16.h>
+#include <stdint.h>
#include <skalibs/tai.h>
#include <s6/ftrigr.h>
@@ -15,7 +15,7 @@ struct s6_svlisten_s
{
ftrigr_t a ;
unsigned int n ;
- uint16 *ids ;
+ uint16_t *ids ;
unsigned char *upstate ;
unsigned char *readystate ;
} ;
@@ -23,7 +23,7 @@ struct s6_svlisten_s
extern void s6_svlisten_signal_handler (void) ;
extern int s6_svlisten_selfpipe_init (void) ;
-extern void s6_svlisten_init (int, char const *const *, s6_svlisten_t *, uint16 *, unsigned char *, unsigned char *, tain_t const *) ;
+extern void s6_svlisten_init (int, char const *const *, s6_svlisten_t *, uint16_t *, unsigned char *, unsigned char *, tain_t const *) ;
extern int s6_svlisten_loop (s6_svlisten_t *, int, int, int, tain_t const *, int, action_func_t_ref) ;
#endif
diff --git a/src/supervision/s6-svlisten1.c b/src/supervision/s6-svlisten1.c
index a669403..f5608f0 100644
--- a/src/supervision/s6-svlisten1.c
+++ b/src/supervision/s6-svlisten1.c
@@ -1,8 +1,8 @@
/* ISC license. */
#include <sys/types.h>
+#include <stdint.h>
#include <skalibs/sgetopt.h>
-#include <skalibs/uint16.h>
#include <skalibs/uint.h>
#include <skalibs/tai.h>
#include <skalibs/strerr2.h>
@@ -19,7 +19,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
pid_t pid ;
int spfd ;
int wantup = 1, wantready = 0, wantrestart = 0 ;
- uint16 id ;
+ uint16_t id ;
unsigned char upstate, readystate ;
PROG = "s6-svlisten1" ;
{
diff --git a/src/supervision/s6-svscan.c b/src/supervision/s6-svscan.c
index 28ce830..cf8714c 100644
--- a/src/supervision/s6-svscan.c
+++ b/src/supervision/s6-svscan.c
@@ -36,7 +36,7 @@ struct svinfo_s
dev_t dev ;
ino_t ino ;
tain_t restartafter[2] ;
- int pid[2] ;
+ pid_t pid[2] ;
int p[2] ;
unsigned int flagactive : 1 ;
unsigned int flaglog : 1 ;
@@ -151,7 +151,7 @@ static void handle_diverted_signals (void)
default :
{
char const *name = sig_name(sig) ;
- unsigned int len = str_len(name) ;
+ size_t len = str_len(name) ;
char fn[SIGNAL_PROG_LEN + len + 1] ;
char const *const newargv[2] = { fn, 0 } ;
byte_copy(fn, SIGNAL_PROG_LEN, SIGNAL_PROG) ;
@@ -168,8 +168,8 @@ static void handle_control (int fd)
for (;;)
{
char c ;
- int r = sanitize_read(fd_read(fd, &c, 1)) ;
- if (r == -1) panic("read control pipe") ;
+ ssize_t r = sanitize_read(fd_read(fd, &c, 1)) ;
+ if (r < 0) panic("read control pipe") ;
else if (!r) break ;
else switch (c)
{
@@ -282,7 +282,7 @@ static void reap (void)
static void trystart (unsigned int i, char const *name, int islog)
{
- int pid = fork() ;
+ pid_t pid = fork() ;
switch (pid)
{
case -1 :
@@ -314,7 +314,7 @@ static void retrydirlater (void)
static void check (char const *name)
{
struct stat st ;
- unsigned int namelen ;
+ size_t namelen ;
unsigned int i = 0 ;
if (name[0] == '.') return ;
if (stat(name, &st) == -1)
diff --git a/src/supervision/s6-svstat.c b/src/supervision/s6-svstat.c
index 4a413af..2a0f1aa 100644
--- a/src/supervision/s6-svstat.c
+++ b/src/supervision/s6-svstat.c
@@ -51,7 +51,7 @@ int main (int argc, char const *const *argv)
if (tain_future(&status.stamp)) tain_copynow(&status.stamp) ;
{
- unsigned int dirlen = str_len(*argv) ;
+ size_t dirlen = str_len(*argv) ;
char fn[dirlen + 6] ;
byte_copy(fn, dirlen, *argv) ;
byte_copy(fn + dirlen, 6, "/down") ;
diff --git a/src/supervision/s6-svwait.c b/src/supervision/s6-svwait.c
index 1793347..3f05b75 100644
--- a/src/supervision/s6-svwait.c
+++ b/src/supervision/s6-svwait.c
@@ -1,7 +1,7 @@
/* ISC license. */
+#include <stdint.h>
#include <skalibs/sgetopt.h>
-#include <skalibs/uint16.h>
#include <skalibs/uint.h>
#include <skalibs/bitarray.h>
#include <skalibs/tai.h>
@@ -46,7 +46,7 @@ int main (int argc, char const *const *argv)
{
s6_svlisten_t foo = S6_SVLISTEN_ZERO ;
- uint16 ids[argc] ;
+ uint16_t ids[argc] ;
unsigned char upstate[bitarray_div8(argc)] ;
unsigned char readystate[bitarray_div8(argc)] ;
s6_svlisten_init(argc, argv, &foo, ids, upstate, readystate, &deadline) ;
diff --git a/src/supervision/s6_svlisten_loop.c b/src/supervision/s6_svlisten_loop.c
index f9c603f..40c7b88 100644
--- a/src/supervision/s6_svlisten_loop.c
+++ b/src/supervision/s6_svlisten_loop.c
@@ -1,5 +1,7 @@
/* ISC license. */
+#include <sys/types.h>
+#include <stdint.h>
#include <unistd.h>
#include <errno.h>
#include <skalibs/bytestr.h>
@@ -13,7 +15,7 @@
#include <s6/s6-supervise.h>
#include "s6-svlisten.h"
-void s6_svlisten_init (int argc, char const *const *argv, s6_svlisten_t *foo, uint16 *ids, unsigned char *upstate, unsigned char *readystate, tain_t const *deadline)
+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 ;
foo->n = (unsigned int)argc ;
@@ -24,7 +26,7 @@ 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 ;
- unsigned int len = str_len(argv[i]) ;
+ size_t len = str_len(argv[i]) ;
char s[len + 1 + sizeof(S6_SUPERVISE_EVENTDIR)] ;
byte_copy(s, len, argv[i]) ;
s[len] = '/' ;