about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2017-01-08 18:52:14 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2017-01-08 18:52:14 +0000
commit9be4af55521d653cfb1c5037412e937f800888c7 (patch)
treee79c0cdf1cb15bde9c13e54a5bbf87ad34ce0013 /src
parent2ece041307a67f02ab1592f623d9d63cbed13489 (diff)
downloads6-linux-utils-9be4af55521d653cfb1c5037412e937f800888c7.tar.gz
s6-linux-utils-9be4af55521d653cfb1c5037412e937f800888c7.tar.xz
s6-linux-utils-9be4af55521d653cfb1c5037412e937f800888c7.zip
Types fix, first pass
 Deeper fixes need to be done if the avltree.h API ever changes.
Diffstat (limited to 'src')
-rw-r--r--src/minutils/s6-devd.c7
-rw-r--r--src/minutils/s6-logwatch.c21
-rw-r--r--src/minutils/s6-ps.c26
-rw-r--r--src/minutils/s6-ps.h46
-rw-r--r--src/minutils/s6-swapoff.c5
-rw-r--r--src/minutils/s6-uevent-listener.c4
-rw-r--r--src/minutils/s6-uevent-spawner.c11
-rw-r--r--src/minutils/s6-umount.c3
-rw-r--r--src/minutils/s6ps_grcache.c15
-rw-r--r--src/minutils/s6ps_otree.c2
-rw-r--r--src/minutils/s6ps_pfield.c104
-rw-r--r--src/minutils/s6ps_pwcache.c11
-rw-r--r--src/minutils/s6ps_statparse.c39
-rw-r--r--src/minutils/s6ps_ttycache.c41
-rw-r--r--src/minutils/s6ps_wchan.c27
15 files changed, 192 insertions, 170 deletions
diff --git a/src/minutils/s6-devd.c b/src/minutils/s6-devd.c
index 74f2d41..58508a5 100644
--- a/src/minutils/s6-devd.c
+++ b/src/minutils/s6-devd.c
@@ -1,5 +1,6 @@
 /* ISC license. */
 
+#include <sys/types.h>
 #include <skalibs/uint.h>
 #include <skalibs/sgetopt.h>
 #include <skalibs/strerr2.h>
@@ -11,7 +12,8 @@
 
 static inline int check_targ (char const *s)
 {
-  unsigned int t = 0, pos = 0 ;
+  size_t pos = 0 ;
+  unsigned int t = 0 ;
   pos += uint_scan(s + pos, &t) ;
   if (s[pos] && s[pos++] != ':') return 0 ;
   if (!t) return 1 ;
@@ -50,7 +52,8 @@ int main (int argc, char const *const *argv, char const *const *envp)
   if (!argc) strerr_dieusage(100, USAGE) ;
 
   {
-    unsigned int m = 0, pos = 0 ;
+    size_t pos = 0 ;
+    unsigned int m = 0 ;
     char fmt[UINT_FMT * 3] ;
     char const *newargv[argc + 15] ;
     newargv[m++] = S6_LINUX_UTILS_BINPREFIX "s6-uevent-listener" ;
diff --git a/src/minutils/s6-logwatch.c b/src/minutils/s6-logwatch.c
index a2c493d..66ff442 100644
--- a/src/minutils/s6-logwatch.c
+++ b/src/minutils/s6-logwatch.c
@@ -1,5 +1,6 @@
 /* ISC license. */
 
+#include <sys/types.h>
 #include <errno.h>
 #include <unistd.h>
 #include <signal.h>
@@ -36,15 +37,15 @@ static void X (void)
   strerr_diefu1x(101, "follow file state changes (race condition triggered). Sorry.") ;
 }
 
-static unsigned long nbcat (int fdcurrent)
+static size_t nbcat (int fdcurrent)
 {
   char buf[N+1] ;
   buffer b = BUFFER_INIT(&buffer_read, fdcurrent, buf, N+1) ;
   siovec_t v[2] ;
-  unsigned long bytes = 0 ;
+  size_t bytes = 0 ;
   for (;;)
   {
-    int r = sanitize_read(buffer_fill(&b)) ;
+    ssize_t r = sanitize_read(buffer_fill(&b)) ;
     if (!r) break ;
     if (r < 0)
     {
@@ -85,8 +86,8 @@ int main (int argc, char const *const *argv)
   if (chdir(dir) < 0) strerr_diefu2sys(111, "chdir to ", dir) ;
   {
     iopause_fd x[1] = { { -1, IOPAUSE_READ, 0 } } ;
+    size_t pos = 0 ;
     int fdcurrent = -1 ;
-    unsigned long pos = 0 ;
     int w ;
     bstate_t state = B_TAILING ;
     x[0].fd = inotify_init() ;
@@ -103,20 +104,20 @@ int main (int argc, char const *const *argv)
 
     for (;;)
     {
-      int r ;
+      int rr ;
       if (!bufalloc_flush(bufalloc_1)) strerr_diefu1sys(111, "write to stdout") ;
-      r = iopause(x, 1, 0, 0) ;
-      if (r < 0) strerr_diefu1sys(111, "iopause") ;
+      rr = iopause(x, 1, 0, 0) ;
+      if (rr < 0) strerr_diefu1sys(111, "iopause") ;
       if (x[0].revents & IOPAUSE_READ)
       {
         char iebuf[IESIZE] ;
         while (bufalloc_len(bufalloc_1) < maxlen)
         {
-          unsigned int i = 0 ;
-          r = sanitize_read(fd_read(x[0].fd, iebuf, IESIZE)) ;
+          size_t i = 0 ;
+          ssize_t r = sanitize_read(fd_read(x[0].fd, iebuf, IESIZE)) ;
           if (r < 0) strerr_diefu1sys(111, "read from inotify fd") ;
           if (!r) break ;
-          while (i < (unsigned int)r)
+          while (i < (size_t)r)
           {
             struct inotify_event *ie = (struct inotify_event *)(iebuf + i) ;
             if ((ie->wd != w) || !ie->len || str_diff(ie->name, "current")) goto cont ;
diff --git a/src/minutils/s6-ps.c b/src/minutils/s6-ps.c
index f4f06bd..2b435bc 100644
--- a/src/minutils/s6-ps.c
+++ b/src/minutils/s6-ps.c
@@ -49,7 +49,7 @@
 
 void *left_dtok (unsigned int d, void *x)
 {
-  return (void *)&genalloc_s(diuint, (genalloc *)x)[d].left ;
+  return (void *)&genalloc_s(dius_t, (genalloc *)x)[d].left ;
 }
 
 int uint_cmp (void const *a, void const *b, void *x)
@@ -81,7 +81,7 @@ static inline unsigned int fieldscan (char const *s, pfield_t *list, uint64 *fbf
   int cont = 1 ;
   for (; cont ; n++)
   {
-    unsigned int len = str_chr(s, ',') ;
+    size_t len = str_chr(s, ',') ;
     register pfield_t i = 0 ;
     if (!len) strerr_dief3x(100, "invalid", " (empty)", " field for -o option") ;
     if (!s[len]) cont = 0 ;
@@ -103,9 +103,9 @@ static inline unsigned int fieldscan (char const *s, pfield_t *list, uint64 *fbf
   return n ;
 }
 
-static int slurpit (unsigned int dirfd, stralloc *data, char const *buf, char const *what, unsigned int *len)
+static int slurpit (unsigned int dirfd, stralloc *data, char const *buf, char const *what, size_t *len)
 {
-  unsigned int start = data->len ;
+  size_t start = data->len ;
   int fd = open_readat(dirfd, what) ;
   if (fd < 0) return 0 ;
   if (!slurp(data, fd)) strerr_diefu4sys(111, "slurp ", buf, "/", what) ;
@@ -119,10 +119,10 @@ int main (int argc, char const *const *argv)
   genalloc pscans = GENALLOC_ZERO ; /* array of pscan_t */
   pfield_t fieldlist[PFIELD_PHAIL] = { PFIELD_USER, PFIELD_PID, PFIELD_TTY, PFIELD_STATE, PFIELD_START, PFIELD_ARGS } ;
   uint64 fbf = (1 << PFIELD_USER) | (1 << PFIELD_PID) | (1 << PFIELD_TTY) | (1 << PFIELD_STATE) | (1 << PFIELD_START) | (1 << PFIELD_ARGS) ;
-  unsigned int mypos = 0 ;
+  size_t mypos = 0 ;
   unsigned int nfields = 6 ;
   pscan_t *p ;
-  unsigned int n ;
+  size_t n ;
   unsigned int spacing = 2 ;
   int flagtree = 0 ;
   char const *wchanfile = 0 ;
@@ -211,7 +211,7 @@ int main (int argc, char const *const *argv)
 
   {
     int needstatdir = !!(fbf & ((1 << PFIELD_USER) | (1 << PFIELD_GROUP))) ;
-    unsigned int mypid = getpid() ;
+    pid_t mypid = getpid() ;
     DIR *dir = opendir("/proc") ;
     direntry *d ;
     char buf[25] = "/proc/" ;
@@ -220,11 +220,13 @@ int main (int argc, char const *const *argv)
     for (;;)
     {
       pscan_t pscan = PSCAN_ZERO ;
+      uint64 u ;
       int dirfd ;
       errno = 0 ;
       d = readdir(dir) ;
       if (!d) break ;
-      if (!uint0_scan(d->d_name, &pscan.pid)) continue ;
+      if (!uint640_scan(d->d_name, &u)) continue ;
+      pscan.pid = u ;
       strcpy(buf+6, d->d_name) ;
       dirfd = open_read(buf) ;
       if (dirfd < 0) continue ;
@@ -320,9 +322,9 @@ int main (int argc, char const *const *argv)
     }
 
     {
-      unsigned int fmtpos[n][nfields] ;
-      unsigned int fmtlen[n][nfields] ;
-      unsigned int maxlen[nfields] ;
+      size_t fmtpos[n][nfields] ;
+      size_t fmtlen[n][nfields] ;
+      size_t maxlen[nfields] ;
       unsigned int maxspaces = 0 ;
       for (i = 0 ; i < nfields ; i++) maxlen[i] = str_len(s6ps_fieldheaders[fieldlist[i]]) ;
       for (i = 0 ; i < n ; i++)
@@ -349,7 +351,7 @@ int main (int argc, char const *const *argv)
         for (i = 0 ; i < nfields ; i++)
         {
           register unsigned int rightformatted = !!(((uint64)1 << fieldlist[i]) & RIGHTFORMATTED) ;
-          register unsigned int len = str_len(s6ps_fieldheaders[fieldlist[i]]) ;
+          register size_t len = str_len(s6ps_fieldheaders[fieldlist[i]]) ;
           if (rightformatted && (buffer_put(buffer_1, spaces, maxlen[i] - len) < (int)(maxlen[i] - len)))
             goto nowrite ;
           if (buffer_put(buffer_1, s6ps_fieldheaders[fieldlist[i]], len) < (int)len)
diff --git a/src/minutils/s6-ps.h b/src/minutils/s6-ps.h
index 3e7d84a..3e5508c 100644
--- a/src/minutils/s6-ps.h
+++ b/src/minutils/s6-ps.h
@@ -4,12 +4,22 @@
 #define _S6PS_H_
 
 #include <sys/types.h>
-#include <skalibs/uint32.h>
+#include <stdint.h>
 #include <skalibs/uint64.h>
 #include <skalibs/stralloc.h>
 #include <skalibs/tai.h>
 #include <skalibs/avltreen.h>
 
+
+typedef struct dius_s dius_t, *dius_t_ref ;
+struct dius_s
+{
+  unsigned int left ;
+  size_t right ;
+} ;
+#define DIUS_ZERO { .left = 0, .right = 0 }
+
+
  /* pfield: the output fields */
 
 typedef enum pfield_e pfield_t, *pfield_t_ref ;
@@ -60,20 +70,20 @@ typedef struct pscan_s pscan_t, *pscan_t_ref ;
 struct pscan_s
 {
   stralloc data ;
-  unsigned int pid ;
+  pid_t pid ;
   signed int height ;
-  unsigned int statlen ;
-  unsigned int commlen ;
-  unsigned int cmdlen ;
-  unsigned int envlen ;
+  size_t statlen ;
+  size_t commlen ;
+  size_t cmdlen ;
+  size_t envlen ;
   uid_t uid ;
   gid_t gid ;
-  uint32 ppid ;
+  pid_t ppid ;
   unsigned int state ;
-  uint32 pgrp ;
-  uint32 session ;
-  uint32 ttynr ;
-  int tpgid ;
+  pid_t pgrp ;
+  pid_t session ;
+  dev_t ttynr ;
+  pid_t tpgid ;
   uint64 utime ;
   uint64 stime ;
   uint64 cutime ;
@@ -86,9 +96,9 @@ struct pscan_s
   uint64 rss ;
   uint64 rsslim ;
   uint64 wchan ;
-  uint32 cpuno ;
-  uint32 rtprio ;
-  uint32 policy ;
+  uint32_t cpuno ;
+  uint32_t rtprio ;
+  uint32_t policy ;
 } ;
 
 #define PSCAN_ZERO \
@@ -130,7 +140,7 @@ extern void s6ps_otree (pscan_t *, unsigned int, avltreen *, unsigned int *) ;
 
 extern int s6ps_compute_boottime (pscan_t *, unsigned int) ;
 
-typedef int pfieldfmt_func_t (pscan_t *, unsigned int *, unsigned int *) ;
+typedef int pfieldfmt_func_t (pscan_t *, size_t *, size_t *) ;
 typedef pfieldfmt_func_t *pfieldfmt_func_t_ref ;
 
 extern pfieldfmt_func_t_ref *s6ps_pfield_fmt ;
@@ -139,13 +149,13 @@ extern void *left_dtok (unsigned int, void *) ;
 extern int uint_cmp (void const *, void const *, void *) ;
 extern int s6ps_pwcache_init (void) ;
 extern void s6ps_pwcache_finish (void) ;
-extern int s6ps_pwcache_lookup (stralloc *, unsigned int) ;
+extern int s6ps_pwcache_lookup (stralloc *, uid_t) ;
 extern int s6ps_grcache_init (void) ;
 extern void s6ps_grcache_finish (void) ;
-extern int s6ps_grcache_lookup (stralloc *, unsigned int) ;
+extern int s6ps_grcache_lookup (stralloc *, gid_t) ;
 extern int s6ps_ttycache_init (void) ;
 extern void s6ps_ttycache_finish (void) ;
-extern int s6ps_ttycache_lookup (stralloc *, uint32) ;
+extern int s6ps_ttycache_lookup (stralloc *, dev_t) ;
 extern int s6ps_wchan_init (char const *) ;
 extern void s6ps_wchan_finish (void) ;
 extern int s6ps_wchan_lookup (stralloc *, uint64) ;
diff --git a/src/minutils/s6-swapoff.c b/src/minutils/s6-swapoff.c
index 1067040..80df1ec 100644
--- a/src/minutils/s6-swapoff.c
+++ b/src/minutils/s6-swapoff.c
@@ -1,5 +1,6 @@
 /* ISC license. */
 
+#include <sys/types.h>
 #include <errno.h>
 #include <skalibs/bytestr.h>
 #include <skalibs/buffer.h>
@@ -12,7 +13,7 @@ extern int swapoff (char const *) ;
 
 #define USAGE "s6-swapoff device <or> s6-swapoff -a"
 
-#define BUFSIZE 4096
+#define BUFSIZE 4095
 
 static int swapoffall ( )
 {
@@ -27,7 +28,7 @@ static int swapoffall ( )
   if (skagetln(&b, &sa, '\n') < 0) strerr_diefu1sys(111, "skagetln") ;
   for (;;)
   {
-    unsigned int n ;
+    size_t n ;
     sa.len = 0 ;
     r = skagetln(&b, &sa, '\n') ;
     if (r < 0) strerr_diefu1sys(111, "skagetln") ;
diff --git a/src/minutils/s6-uevent-listener.c b/src/minutils/s6-uevent-listener.c
index f6e9c4b..d620081 100644
--- a/src/minutils/s6-uevent-listener.c
+++ b/src/minutils/s6-uevent-listener.c
@@ -36,7 +36,7 @@ static pid_t pid ;
 
 static inline int fd_recvmsg (int fd, struct msghdr *hdr)
 {
-  int r ;
+  ssize_t r ;
   do r = recvmsg(fd, hdr, MSG_DONTWAIT) ;
   while ((r == -1) && (errno == EINTR)) ;
   return r ;
@@ -110,7 +110,7 @@ static inline void handle_netlink (void)
     .msg_flags = 0
   } ;
   siovec_t v[2] ;
-  register int r ;
+  register ssize_t r ;
   buffer_wpeek(&b1, v) ;
   siovec_trunc(v, 2, siovec_len(v, 2) - 1) ;
   iovec_from_siovec(iov, v, 2) ;
diff --git a/src/minutils/s6-uevent-spawner.c b/src/minutils/s6-uevent-spawner.c
index 6ccc4ce..e6c0927 100644
--- a/src/minutils/s6-uevent-spawner.c
+++ b/src/minutils/s6-uevent-spawner.c
@@ -46,8 +46,8 @@ static inline void on_event (char const *const *argv, char const *const *envp, c
 {
   posix_spawnattr_t attr ;
   posix_spawn_file_actions_t actions ;
-  unsigned int envlen = env_len(envp) ;
-  unsigned int n = envlen + 1 + byte_count(s, len, '\0') ;
+  size_t envlen = env_len(envp) ;
+  size_t n = envlen + 1 + byte_count(s, len, '\0') ;
   pid_t mypid ;
   int e ;
   char const *v[n] ;
@@ -134,8 +134,8 @@ static inline void handle_stdin (stralloc *sa, char const *linevar, char const *
 {
   while (!pid)
   {
-    unsigned int start ;
-    register int r ;
+    size_t start ;
+    register ssize_t r ;
     if (!sa->len && linevar)
       if (!stralloc_cats(sa, linevar) || !stralloc_catb(sa, "=", 1))
         dienomem() ;
@@ -162,7 +162,8 @@ static inline void handle_stdin (stralloc *sa, char const *linevar, char const *
 
 static inline int make_ttos (char const *s)
 {
-  unsigned int tlife = 0, tterm = 0, tkill = 0, pos = 0 ;
+  size_t pos = 0 ;
+  unsigned int tlife = 0, tterm = 0, tkill = 0 ;
   pos += uint_scan(s + pos, &tlife) ;
   if (s[pos] && s[pos++] != ':') return 0 ;
   if (!tlife) return 1 ;
diff --git a/src/minutils/s6-umount.c b/src/minutils/s6-umount.c
index 966b455..31773cb 100644
--- a/src/minutils/s6-umount.c
+++ b/src/minutils/s6-umount.c
@@ -1,5 +1,6 @@
 /* ISC license. */
 
+#include <sys/types.h>
 #include <sys/mount.h>
 #include <skalibs/bytestr.h>
 #include <skalibs/buffer.h>
@@ -28,7 +29,7 @@ static int umountall ( )
   buffer_init(&b, &buffer_read, fd, buf, BUFSIZE+1) ;
   for (;;)
   {
-    unsigned int n, p ;
+    size_t n, p ;
     if (line >= MAXLINES) strerr_dief1x(111, "/proc/mounts too big") ;
     sa.len = 0 ;
     r = skagetln(&b, &sa, '\n') ;
diff --git a/src/minutils/s6ps_grcache.c b/src/minutils/s6ps_grcache.c
index 1fe9380..9a0d133 100644
--- a/src/minutils/s6ps_grcache.c
+++ b/src/minutils/s6ps_grcache.c
@@ -4,7 +4,6 @@
 #include <grp.h>
 #include <errno.h>
 #include <skalibs/uint.h>
-#include <skalibs/diuint.h>
 #include <skalibs/stralloc.h>
 #include <skalibs/genalloc.h>
 #include <skalibs/skamisc.h>
@@ -23,18 +22,18 @@ int s6ps_grcache_init (void)
 void s6ps_grcache_finish (void)
 {
   avltree_free(&grcache_tree) ;
-  genalloc_free(diuint, &grcache_index) ;
+  genalloc_free(dius_t, &grcache_index) ;
 }
 
-int s6ps_grcache_lookup (stralloc *sa, unsigned int gid)
+int s6ps_grcache_lookup (stralloc *sa, gid_t gid)
 {
   int wasnull = !satmp.s ;
-  diuint d = { .left = gid, .right = satmp.len } ;
+  dius_t d = { .left = (unsigned int)gid, .right = satmp.len } ;
   unsigned int i ;
   if (!avltree_search(&grcache_tree, &d.left, &i))
   {
     struct group *gr ;
-    unsigned int n = genalloc_len(diuint, &grcache_index) ;
+    unsigned int n = genalloc_len(dius_t, &grcache_index) ;
     errno = 0 ;
     gr = getgrgid(gid) ;
     if (!gr)
@@ -46,15 +45,15 @@ int s6ps_grcache_lookup (stralloc *sa, unsigned int gid)
       stralloc_catb(&satmp, ")", 2) ;
     }
     else if (!stralloc_cats(&satmp, gr->gr_name) || !stralloc_0(&satmp)) return 0 ;
-    if (!genalloc_append(diuint, &grcache_index, &d)) goto err ;
+    if (!genalloc_append(dius_t, &grcache_index, &d)) goto err ;
     if (!avltree_insert(&grcache_tree, n))
     {
-      genalloc_setlen(diuint, &grcache_index, n) ;
+      genalloc_setlen(dius_t, &grcache_index, n) ;
       goto err ;
     }
     i = n ;
   }
-  return stralloc_cats(sa, satmp.s + genalloc_s(diuint, &grcache_index)[i].right) ;
+  return stralloc_cats(sa, satmp.s + genalloc_s(dius_t, &grcache_index)[i].right) ;
  err:
   {
     register int e = errno ;
diff --git a/src/minutils/s6ps_otree.c b/src/minutils/s6ps_otree.c
index b5f72b4..447906e 100644
--- a/src/minutils/s6ps_otree.c
+++ b/src/minutils/s6ps_otree.c
@@ -4,6 +4,8 @@
 #include <skalibs/avltreen.h>
 #include "s6-ps.h"
 
+/* XXX: need to change all the types if the libdatastruct API changes */
+
 typedef struct ptreeiter_s ptreeiter_t, *ptreeiter_t_ref ;
 struct ptreeiter_s
 {
diff --git a/src/minutils/s6ps_pfield.c b/src/minutils/s6ps_pfield.c
index 3a960a4..ded0b41 100644
--- a/src/minutils/s6ps_pfield.c
+++ b/src/minutils/s6ps_pfield.c
@@ -94,7 +94,7 @@ char const *const *s6ps_opttable = opttable ;
 
 static tain_t boottime = TAIN_EPOCH ;
 
-static int fmt_32 (pscan_t *p, unsigned int *pos, unsigned int *len, uint32 u)
+static int fmt_32 (pscan_t *p, size_t *pos, size_t *len, uint32 u)
 {
   if (!stralloc_readyplus(&p->data, UINT32_FMT)) return 0 ;
   *pos = p->data.len ;
@@ -103,7 +103,7 @@ static int fmt_32 (pscan_t *p, unsigned int *pos, unsigned int *len, uint32 u)
   return 1 ;
 }
 
-static int fmt_64 (pscan_t *p, unsigned int *pos, unsigned int *len, uint64 u)
+static int fmt_64 (pscan_t *p, size_t *pos, size_t *len, uint64 u)
 {                                                          
   if (!stralloc_readyplus(&p->data, UINT64_FMT)) return 0 ;
   *pos = p->data.len ;
@@ -112,7 +112,7 @@ static int fmt_64 (pscan_t *p, unsigned int *pos, unsigned int *len, uint64 u)
   return 1 ;
 }                                                          
 
-static int fmt_i (pscan_t *p, unsigned int *pos, unsigned int *len, int d)
+static int fmt_i (pscan_t *p, size_t *pos, size_t *len, int d)
 {
   if (!stralloc_readyplus(&p->data, UINT32_FMT+1)) return 0 ;
   *pos = p->data.len ;
@@ -121,19 +121,19 @@ static int fmt_i (pscan_t *p, unsigned int *pos, unsigned int *len, int d)
   return 1 ;
 }
 
-static int fmt_pid (pscan_t *p, unsigned int *pos, unsigned int *len)
+static int fmt_pid (pscan_t *p, size_t *pos, size_t *len)
 {
-  return fmt_32(p, pos, len, p->pid) ;
+  return fmt_64(p, pos, len, p->pid) ;
 }
 
-static int fmt_comm (pscan_t *p, unsigned int *pos, unsigned int *len)
+static int fmt_comm (pscan_t *p, size_t *pos, size_t *len)
 {
   *pos = p->statlen ;
   *len = p->commlen ;
   return 1 ;
 }
 
-static int fmt_s (pscan_t *p, unsigned int *pos, unsigned int *len)
+static int fmt_s (pscan_t *p, size_t *pos, size_t *len)
 {
   if (!stralloc_readyplus(&p->data, 4)) return 0 ;
   *pos = p->data.len ;
@@ -148,26 +148,26 @@ static int fmt_s (pscan_t *p, unsigned int *pos, unsigned int *len)
   return 1 ;
 }
 
-static int fmt_ppid (pscan_t *p, unsigned int *pos, unsigned int *len)
+static int fmt_ppid (pscan_t *p, size_t *pos, size_t *len)
 {
-  return fmt_32(p, pos, len, p->ppid) ;
+  return fmt_64(p, pos, len, p->ppid) ;
 }
 
-static int fmt_pgrp (pscan_t *p, unsigned int *pos, unsigned int *len)
+static int fmt_pgrp (pscan_t *p, size_t *pos, size_t *len)
 {
-  return fmt_32(p, pos, len, p->pgrp) ;
+  return fmt_64(p, pos, len, p->pgrp) ;
 }
 
-static int fmt_session (pscan_t *p, unsigned int *pos, unsigned int *len)
+static int fmt_session (pscan_t *p, size_t *pos, size_t *len)
 {
-  return fmt_32(p, pos, len, p->session) ;
+  return fmt_64(p, pos, len, p->session) ;
 }
 
-static int fmt_ttynr(pscan_t *p, unsigned int *pos, unsigned int *len)
+static int fmt_ttynr(pscan_t *p, size_t *pos, size_t *len)
 {
   if (p->ttynr)
   {
-    unsigned int tmppos = p->data.len ;
+    size_t tmppos = p->data.len ;
     if (!s6ps_ttycache_lookup(&p->data, p->ttynr)) return 0 ;
     *pos = tmppos ;
     *len = p->data.len - tmppos ;
@@ -181,9 +181,9 @@ static int fmt_ttynr(pscan_t *p, unsigned int *pos, unsigned int *len)
   return 1 ;
 }
 
-static int fmt_tpgid (pscan_t *p, unsigned int *pos, unsigned int *len)
+static int fmt_tpgid (pscan_t *p, size_t *pos, size_t *len)
 {
-  return fmt_i(p, pos, len, p->tpgid) ;
+  return p->tpgid < 0 ? fmt_i(p, pos, len, -1) : fmt_64(p, pos, len, p->tpgid) ;
 }
 
 static unsigned int gethz (void)
@@ -220,7 +220,7 @@ int s6ps_compute_boottime (pscan_t *p, unsigned int mypos)
   }
 }
 
-static int fmt_jiffies (pscan_t *p, unsigned int *pos, unsigned int *len, uint64 j)
+static int fmt_jiffies (pscan_t *p, size_t *pos, size_t *len, uint64 j)
 {
   unsigned int hz = gethz() ;
   uint32 hrs, mins, secs, hfrac ;
@@ -261,45 +261,45 @@ static int fmt_jiffies (pscan_t *p, unsigned int *pos, unsigned int *len, uint64
   return 1 ;
 }
 
-static int fmt_utime (pscan_t *p, unsigned int *pos, unsigned int *len)
+static int fmt_utime (pscan_t *p, size_t *pos, size_t *len)
 {
   return fmt_jiffies(p, pos, len, p->utime) ;
 }
 
-static int fmt_stime (pscan_t *p, unsigned int *pos, unsigned int *len)
+static int fmt_stime (pscan_t *p, size_t *pos, size_t *len)
 {
   return fmt_jiffies(p, pos, len, p->stime) ;
 }
 
-static int fmt_cutime (pscan_t *p, unsigned int *pos, unsigned int *len)
+static int fmt_cutime (pscan_t *p, size_t *pos, size_t *len)
 {
   return fmt_jiffies(p, pos, len, p->utime + p->cutime) ;
 }
 
-static int fmt_cstime (pscan_t *p, unsigned int *pos, unsigned int *len)
+static int fmt_cstime (pscan_t *p, size_t *pos, size_t *len)
 {
   return fmt_jiffies(p, pos, len, p->stime + p->cstime) ;
 }
 
-static int fmt_prio (pscan_t *p, unsigned int *pos, unsigned int *len)
+static int fmt_prio (pscan_t *p, size_t *pos, size_t *len)
 {
   return fmt_i(p, pos, len, p->prio) ;
 }
 
-static int fmt_nice (pscan_t *p, unsigned int *pos, unsigned int *len)
+static int fmt_nice (pscan_t *p, size_t *pos, size_t *len)
 {
   return fmt_i(p, pos, len, p->nice) ;
 }
 
-static int fmt_threads (pscan_t *p, unsigned int *pos, unsigned int *len)
+static int fmt_threads (pscan_t *p, size_t *pos, size_t *len)
 {
   return fmt_32(p, pos, len, p->threads) ;
 }
 
-static int fmt_timedate (pscan_t *p, unsigned int *pos, unsigned int *len, struct tm const *tm)
+static int fmt_timedate (pscan_t *p, size_t *pos, size_t *len, struct tm const *tm)
 {
   static struct tm nowtm = { .tm_year = 0 } ;
-  unsigned int tmplen ;
+  size_t tmplen ;
   char *tmpstrf = "%F" ;
   if (!nowtm.tm_year && !localtm_from_tai(&nowtm, tain_secp(&STAMP), 1)) return 0 ;
   if (!stralloc_readyplus(&p->data, 20)) return 0 ;
@@ -315,7 +315,7 @@ static int fmt_timedate (pscan_t *p, unsigned int *pos, unsigned int *len, struc
   return 1 ;
 }
 
-static int fmt_start (pscan_t *p, unsigned int *pos, unsigned int *len)
+static int fmt_start (pscan_t *p, size_t *pos, size_t *len)
 {
   struct tm starttm ;
   unsigned int hz = gethz() ;
@@ -343,53 +343,53 @@ static unsigned int getpgsz (void)
   return pgsz ;
 }
 
-static int fmt_vsize (pscan_t *p, unsigned int *pos, unsigned int *len)
+static int fmt_vsize (pscan_t *p, size_t *pos, size_t *len)
 {
   return fmt_64(p, pos, len, p->vsize / 1024) ;
 }
 
-static int fmt_rss (pscan_t *p, unsigned int *pos, unsigned int *len)
+static int fmt_rss (pscan_t *p, size_t *pos, size_t *len)
 {
   return fmt_64(p, pos, len, p->rss * (getpgsz() / 1024)) ;
 }
 
-static int fmt_rsslim (pscan_t *p, unsigned int *pos, unsigned int *len)
+static int fmt_rsslim (pscan_t *p, size_t *pos, size_t *len)
 {
   return fmt_64(p, pos, len, p->rsslim / 1024) ;
 }
 
-static int fmt_cpuno (pscan_t *p, unsigned int *pos, unsigned int *len)
+static int fmt_cpuno (pscan_t *p, size_t *pos, size_t *len)
 {
   return fmt_32(p, pos, len, p->cpuno) ;
 }
 
-static int fmt_rtprio (pscan_t *p, unsigned int *pos, unsigned int *len)
+static int fmt_rtprio (pscan_t *p, size_t *pos, size_t *len)
 {
   return fmt_32(p, pos, len, p->rtprio) ;
 }
 
-static int fmt_policy (pscan_t *p, unsigned int *pos, unsigned int *len)
+static int fmt_policy (pscan_t *p, size_t *pos, size_t *len)
 {
   static char const *const policies[8] = { "NORMAL", "FIFO", "RR", "BATCH", "ISO", "IDLE", "UNKNOWN", "UNKNOWN" } ;
-  unsigned int tmppos = p->data.len ;
+  size_t tmppos = p->data.len ;
   if (!stralloc_cats(&p->data, policies[p->policy & 7])) return 0 ;
   *pos = tmppos ;
   *len = p->data.len - tmppos ;
   return 1 ;
 }
 
-static int fmt_user (pscan_t *p, unsigned int *pos, unsigned int *len)
+static int fmt_user (pscan_t *p, size_t *pos, size_t *len)
 {
-  unsigned int tmppos = p->data.len ;
+  size_t tmppos = p->data.len ;
   if (!s6ps_pwcache_lookup(&p->data, p->uid)) return 0 ;
   *pos = tmppos ;
   *len = p->data.len - tmppos ;
   return 1 ;
 }
 
-static int fmt_group (pscan_t *p, unsigned int *pos, unsigned int *len)
+static int fmt_group (pscan_t *p, size_t *pos, size_t *len)
 {
-  unsigned int tmppos = p->data.len ;
+  size_t tmppos = p->data.len ;
   if (!s6ps_grcache_lookup(&p->data, p->gid)) return 0 ;
   *pos = tmppos ;
   *len = p->data.len - tmppos ;
@@ -407,7 +407,7 @@ static uint64 gettotalmem (void)
   return totalmem ;
 }
 
-static int percent (stralloc *sa, unsigned int n, unsigned int *pos, unsigned int *len)
+static int percent (stralloc *sa, unsigned int n, size_t *pos, size_t *len)
 {
   if (!stralloc_readyplus(sa, UINT64_FMT+1)) return 0 ;
   *pos = sa->len ;
@@ -419,22 +419,22 @@ static int percent (stralloc *sa, unsigned int n, unsigned int *pos, unsigned in
   return 1 ;
 }
 
-static int fmt_pmem (pscan_t *p, unsigned int *pos, unsigned int *len)
+static int fmt_pmem (pscan_t *p, size_t *pos, size_t *len)
 {
   uint64 l = gettotalmem() ;
   return l ? percent(&p->data, p->rss * getpgsz() * 10000 / l, pos, len) : 0 ;
 }
 
-static int fmt_wchan (pscan_t *p, unsigned int *pos, unsigned int *len)
+static int fmt_wchan (pscan_t *p, size_t *pos, size_t *len)
 {
-  unsigned int tmppos = p->data.len ;
+  size_t tmppos = p->data.len ;
   if (!s6ps_wchan_lookup(&p->data, p->wchan)) return 0 ;
   *len = p->data.len - tmppos ;
   *pos = tmppos ;
   return 1 ;
 }
 
-static int fmt_args (pscan_t *p, unsigned int *pos, unsigned int *len)
+static int fmt_args (pscan_t *p, size_t *pos, size_t *len)
 {
   if (!stralloc_readyplus(&p->data, (p->height << 2) + (p->cmdlen ? p->cmdlen : p->commlen + (p->data.s[p->state] == 'Z' ? 11 : 3))))
     return 0 ;
@@ -451,7 +451,7 @@ static int fmt_args (pscan_t *p, unsigned int *pos, unsigned int *len)
   {
     register char const *r = p->data.s + p->statlen + p->commlen ;
     register char *w = p->data.s + p->data.len ;
-    register unsigned int i = p->cmdlen ;
+    register size_t i = p->cmdlen ;
     while (i--)
     {
       register char c = *r++ ;
@@ -470,9 +470,9 @@ static int fmt_args (pscan_t *p, unsigned int *pos, unsigned int *len)
   return 1 ;
 }
 
-static int fmt_env (pscan_t *p, unsigned int *pos, unsigned int *len)
+static int fmt_env (pscan_t *p, size_t *pos, size_t *len)
 {
-  register unsigned int i = 0 ;
+  register size_t i = 0 ;
   if (!p->envlen)
   {
     if (!stralloc_catb(&p->data, "*", 1)) return 0 ;
@@ -497,23 +497,23 @@ static uint64 gettotalj (uint64 j)
   return j ;
 }
 
-static int fmt_pcpu (pscan_t *p, unsigned int *pos, unsigned int *len)
+static int fmt_pcpu (pscan_t *p, size_t *pos, size_t *len)
 {
   return percent(&p->data, 10000 * (p->utime + p->stime) / gettotalj(p->start), pos, len) ;
 }
 
 
-static int fmt_ttime (pscan_t *p, unsigned int *pos, unsigned int *len) 
+static int fmt_ttime (pscan_t *p, size_t *pos, size_t *len) 
 {
   return fmt_jiffies(p, pos, len, p->utime + p->stime) ;
 }
 
-static int fmt_cttime (pscan_t *p, unsigned int *pos, unsigned int *len)
+static int fmt_cttime (pscan_t *p, size_t *pos, size_t *len)
 {
   return fmt_jiffies(p, pos, len, p->utime + p->stime + p->cutime + p->cstime) ;
 }
 
-static int fmt_tstart (pscan_t *p, unsigned int *pos, unsigned int *len)
+static int fmt_tstart (pscan_t *p, size_t *pos, size_t *len)
 {
   unsigned int hz = gethz() ;
   tain_t blah = { .sec = { .x = p->start / hz }, .nano = (p->start % hz) * (1000000000 / hz) } ;
@@ -525,7 +525,7 @@ static int fmt_tstart (pscan_t *p, unsigned int *pos, unsigned int *len)
   return 1 ;
 }
 
-static int fmt_cpcpu (pscan_t *p, unsigned int *pos, unsigned int *len)
+static int fmt_cpcpu (pscan_t *p, size_t *pos, size_t *len)
 {
   return percent(&p->data, 10000 * (p->utime + p->stime + p->cutime + p->cstime) / gettotalj(p->start), pos, len) ;
 }
diff --git a/src/minutils/s6ps_pwcache.c b/src/minutils/s6ps_pwcache.c
index 4c78460..abee250 100644
--- a/src/minutils/s6ps_pwcache.c
+++ b/src/minutils/s6ps_pwcache.c
@@ -4,7 +4,6 @@
 #include <pwd.h>
 #include <errno.h>
 #include <skalibs/uint.h>
-#include <skalibs/diuint.h>
 #include <skalibs/stralloc.h>
 #include <skalibs/genalloc.h>
 #include <skalibs/skamisc.h>
@@ -23,18 +22,18 @@ int s6ps_pwcache_init (void)
 void s6ps_pwcache_finish (void)
 {
   avltree_free(&pwcache_tree) ;
-  genalloc_free(diuint, &pwcache_index) ;
+  genalloc_free(dius_t, &pwcache_index) ;
 }
 
-int s6ps_pwcache_lookup (stralloc *sa, unsigned int uid)
+int s6ps_pwcache_lookup (stralloc *sa, uid_t uid)
 {
   int wasnull = !satmp.s ;
-  diuint d = { .left = uid, .right = satmp.len } ;
+  dius_t d = { .left = (unsigned int)uid, .right = satmp.len } ;
   unsigned int i ;
   if (!avltree_search(&pwcache_tree, &d.left, &i))
   {
     struct passwd *pw ;
-    unsigned int n = genalloc_len(diuint, &pwcache_index) ;
+    size_t n = genalloc_len(dius_t, &pwcache_index) ;
     errno = 0 ;
     pw = getpwuid(uid) ;
     if (!pw)
@@ -49,7 +48,7 @@ int s6ps_pwcache_lookup (stralloc *sa, unsigned int uid)
     if (!genalloc_append(diuint, &pwcache_index, &d)) goto err ;
     if (!avltree_insert(&pwcache_tree, n))
     {
-      genalloc_setlen(diuint, &pwcache_index, n) ;
+      genalloc_setlen(dius_t, &pwcache_index, n) ;
       goto err ;
     }
     i = n ;
diff --git a/src/minutils/s6ps_statparse.c b/src/minutils/s6ps_statparse.c
index d8bc39e..b49ee28 100644
--- a/src/minutils/s6ps_statparse.c
+++ b/src/minutils/s6ps_statparse.c
@@ -1,5 +1,6 @@
 /* ISC license. */
 
+#include <sys/types.h>
 #include <errno.h>
 #include <skalibs/uint32.h>
 #include <skalibs/uint64.h>
@@ -15,34 +16,50 @@
 
 #define STATVARS 41
 
-typedef unsigned int scanfunc_t (char const *, void *) ;
+typedef size_t scanfunc_t (char const *, void *) ;
 typedef scanfunc_t *scanfunc_t_ref ;
 
-static unsigned int f32 (char const *s, void *u32)
+static size_t f32 (char const *s, void *u32)
 {
   uint32 *u = u32 ;
   return uint32_scan(s, u) ;
 }
 
-static unsigned int f64 (char const *s, void *u64)
+static size_t f64 (char const *s, void *u64)
 {
   uint64 *u = u64 ;
   return uint64_scan(s, u) ;
 }
 
-static unsigned int fint (char const *s, void *i)
+static size_t fint (char const *s, void *i)
 {
   int *d = i ;
   return int_scan(s, d) ;
 }
 
+static size_t fpid (char const *s, void *p)
+{
+  uint64 u ;
+  register size_t l = uint64_scan(s, &u) ;
+  *(pid_t *)p = u ;
+  return l ;
+}
+
+static size_t fdev (char const *s, void *p)
+{
+  uint64 u ;
+  register size_t l = uint64_scan(s, &u) ;
+  *(dev_t *)p = u ;
+  return l ;
+}
+
 static scanfunc_t_ref scanfuncs[STATVARS] =
 {
-  &f32, /* ppid */
-  &f32, /* pgrp */
-  &f32, /* session */
-  &f32, /* tty_nr */
-  &fint, /* tpgid */
+  &fpid, /* ppid */
+  &fpid, /* pgrp */
+  &fpid, /* session */
+  &fdev, /* tty_nr */
+  &fpid, /* tpgid */
   &f32, /* flags */
   &f32, /* minflt */
   &f32, /* cminflt */
@@ -85,7 +102,7 @@ int s6ps_statparse (pscan_t *p)
 {
   uint64 dummy64 ;
   uint32 dummy32 ;
-  unsigned int pos = 0 ;
+  size_t pos = 0 ;
   void *scanresults[STATVARS] =
   {
     &p->ppid,
@@ -145,7 +162,7 @@ int s6ps_statparse (pscan_t *p)
   p->state = pos++ ;
   for (; i < STATVARS ; i++)
   {
-    unsigned int w ;
+    size_t w ;
     if (pos + 1 > p->statlen) return 0 ;
     if (p->data.s[pos++] != ' ') return 0 ;
     w = (*scanfuncs[i])(p->data.s + pos, scanresults[i]) ;
diff --git a/src/minutils/s6ps_ttycache.c b/src/minutils/s6ps_ttycache.c
index c50c3ea..dcbbc54 100644
--- a/src/minutils/s6ps_ttycache.c
+++ b/src/minutils/s6ps_ttycache.c
@@ -9,8 +9,6 @@
 #include <errno.h>
 #include <skalibs/bytestr.h>
 #include <skalibs/uint.h>
-#include <skalibs/uint32.h>
-#include <skalibs/diuint32.h>
 #include <skalibs/buffer.h>
 #include <skalibs/stralloc.h>
 #include <skalibs/genalloc.h>
@@ -22,32 +20,19 @@
 static avltree ttycache_tree = AVLTREE_ZERO ;
 static genalloc ttycache_index = GENALLOC_ZERO ;
 
-static void *left32_dtok (unsigned int d, void *x)
-{
-  return (void *)&genalloc_s(diuint32, (genalloc *)x)[d].left ;
-}
-
-static int uint32_cmp (void const *a, void const *b, void *x)
-{
-  register uint32 aa = *(uint32 *)a ;
-  register uint32 bb = *(uint32 *)b ;
-  (void)x ;
-  return (aa < bb) ? -1 : (aa > bb) ;
-}
-
 int s6ps_ttycache_init (void)
 {
-  avltree_init(&ttycache_tree, 5, 3, 8, &left32_dtok, &uint32_cmp, &ttycache_index) ;
+  avltree_init(&ttycache_tree, 5, 3, 8, &left_dtok, &uint_cmp, &ttycache_index) ;
   return 1 ;
 }
 
 void s6ps_ttycache_finish (void)
 {
   avltree_free(&ttycache_tree) ;
-  genalloc_free(diuint, &ttycache_index) ;
+  genalloc_free(dius_t, &ttycache_index) ;
 }
 
-static int check (char const *s, uint32 ttynr)
+static int check (char const *s, dev_t ttynr)
 {
   struct stat st ;
   if (stat(s, &st) < 0) return 0 ;
@@ -57,7 +42,7 @@ static int check (char const *s, uint32 ttynr)
 
  /* No blind scanning of all /dev or /sys/devices, kthx */
 
-static int ttyguess (stralloc *sa, uint32 ttynr)
+static int ttyguess (stralloc *sa, dev_t ttynr)
 {
   unsigned int maj = major(ttynr), min = minor(ttynr) ;
 
@@ -80,7 +65,7 @@ static int ttyguess (stralloc *sa, uint32 ttynr)
   {
     int fd ;
     char path[23 + 2 * UINT_FMT] = "/sys/dev/char/" ;
-    register unsigned int pos = 14 ;
+    register size_t pos = 14 ;
     pos += uint_fmt(path + pos, maj) ;
     path[pos++] = ':' ;
     pos += uint_fmt(path + pos, min) ;
@@ -90,7 +75,7 @@ static int ttyguess (stralloc *sa, uint32 ttynr)
     {
       char buf[4097] ;
       buffer b = BUFFER_INIT(&buffer_read, fd, buf, 4097) ;
-      unsigned int start = satmp.len ;
+      size_t start = satmp.len ;
       register int r ;
       for (;;)
       {
@@ -114,7 +99,7 @@ static int ttyguess (stralloc *sa, uint32 ttynr)
  /* Fallback: print explicit maj:min */
   {
     char tmp[3 + 2 * UINT_FMT] = "(" ;
-    register unsigned int pos = 1 ;
+    register size_t pos = 1 ;
     pos += uint_fmt(tmp + pos, maj) ;
     tmp[pos++] = ':' ;
     pos += uint_fmt(tmp + pos, min) ;
@@ -124,24 +109,24 @@ static int ttyguess (stralloc *sa, uint32 ttynr)
   }
 }
 
-int s6ps_ttycache_lookup (stralloc *sa, uint32 ttynr)
+int s6ps_ttycache_lookup (stralloc *sa, dev_t ttynr)
 {
   int wasnull = !satmp.s ;
-  diuint32 d = { .left = ttynr, .right = satmp.len } ;
+  dius_t d = { .left = (unsigned int)ttynr, .right = satmp.len } ;
   unsigned int i ;
   if (!avltree_search(&ttycache_tree, &d.left, &i))
   {
-    unsigned int n = genalloc_len(diuint32, &ttycache_index) ;
+    size_t n = genalloc_len(dius_t, &ttycache_index) ;
     if (!ttyguess(&satmp, ttynr)) return 0 ;
-    if (!genalloc_append(diuint32, &ttycache_index, &d)) goto err ;
+    if (!genalloc_append(dius_t, &ttycache_index, &d)) goto err ;
     if (!avltree_insert(&ttycache_tree, n))
     {
-      genalloc_setlen(diuint32, &ttycache_index, n) ;
+      genalloc_setlen(dius_t, &ttycache_index, n) ;
       goto err ;
     }
     i = n ;
   }
-  return stralloc_cats(sa, satmp.s + genalloc_s(diuint32, &ttycache_index)[i].right) ;
+  return stralloc_cats(sa, satmp.s + genalloc_s(dius_t, &ttycache_index)[i].right) ;
  err:
   {
     register int e = errno ;
diff --git a/src/minutils/s6ps_wchan.c b/src/minutils/s6ps_wchan.c
index e702ba9..77ac671 100644
--- a/src/minutils/s6ps_wchan.c
+++ b/src/minutils/s6ps_wchan.c
@@ -1,5 +1,6 @@
 /* ISC license. */
 
+#include <sys/types.h>
 #include <sys/utsname.h>
 #include <skalibs/uint64.h>
 #include <skalibs/bytestr.h>
@@ -21,7 +22,7 @@ int s6ps_wchan_init (char const *file)
   {
     char *files[3] = { "/proc/kallsyms", 0, "/boot/System.map" } ;
     struct utsname uts ;
-    unsigned int n ;
+    size_t n ;
     if (uname(&uts) < 0) return 0 ;
     n = str_len(uts.release) ;
     {
@@ -37,15 +38,15 @@ int s6ps_wchan_init (char const *file)
     }
   }
   {
-    unsigned int i = 0 ;
-    if (!genalloc_append(unsigned int, &ind, &i)) goto err2 ;
+    size_t i = 0 ;
+    if (!genalloc_append(size_t, &ind, &i)) goto err2 ;
     for (i = 1 ; i <= sysmap.len ; i++)
       if (sysmap.s[i-1] == '\n')
-        if (!genalloc_append(unsigned int, &ind, &i)) goto err ;
+        if (!genalloc_append(size_t, &ind, &i)) goto err ;
   }
   return 1 ;
  err:
-  genalloc_free(unsigned int, &ind) ;
+  genalloc_free(size_t, &ind) ;
  err2:
   stralloc_free(&sysmap) ;
   return 0 ;
@@ -53,13 +54,13 @@ int s6ps_wchan_init (char const *file)
 
 void s6ps_wchan_finish (void)
 {
-  genalloc_free(unsigned int, &ind) ;
+  genalloc_free(size_t, &ind) ;
   stralloc_free(&sysmap) ;
 }
 
-static inline unsigned int lookup (uint64 addr, unsigned int *i)
+static inline size_t lookup (uint64 addr, size_t *i)
 {
-  unsigned int low = 0, mid, high = genalloc_len(unsigned int, &ind), len ;
+  size_t low = 0, mid, high = genalloc_len(size_t, &ind), len ;
   for (;;)
   {
     uint64 cur ;
@@ -81,12 +82,12 @@ int s6ps_wchan_lookup (stralloc *sa, uint64 addr)
   if (!addr) return stralloc_catb(sa, "-", 1) ;
   if (sysmap.len)
   {
-    unsigned int i ;
-    unsigned int len = lookup(addr, &i) ;
-    register unsigned int pos ;
+    size_t i ;
+    size_t len = lookup(addr, &i) ;
+    register size_t pos ;
     if (!len) return stralloc_catb(sa, "?", 1) ;
-    pos = genalloc_s(unsigned int, &ind)[i] + len + 3 ;
-    return stralloc_catb(sa, sysmap.s + pos, genalloc_s(unsigned int, &ind)[i+1] - 1 - pos) ;
+    pos = genalloc_s(size_t, &ind)[i] + len + 3 ;
+    return stralloc_catb(sa, sysmap.s + pos, genalloc_s(size_t, &ind)[i+1] - 1 - pos) ;
   }
   if (!stralloc_readyplus(sa, UINT64_FMT + 3)) return 0 ;
   stralloc_catb(sa, "(0x", 3) ;