summaryrefslogtreecommitdiff
path: root/src/libs6
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs6')
-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
43 files changed, 151 insertions, 113 deletions
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)
{