diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2017-01-08 18:52:14 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2017-01-08 18:52:14 +0000 |
commit | 9be4af55521d653cfb1c5037412e937f800888c7 (patch) | |
tree | e79c0cdf1cb15bde9c13e54a5bbf87ad34ce0013 /src/minutils/s6ps_wchan.c | |
parent | 2ece041307a67f02ab1592f623d9d63cbed13489 (diff) | |
download | s6-linux-utils-9be4af55521d653cfb1c5037412e937f800888c7.tar.xz |
Types fix, first pass
Deeper fixes need to be done if the avltree.h API ever changes.
Diffstat (limited to 'src/minutils/s6ps_wchan.c')
-rw-r--r-- | src/minutils/s6ps_wchan.c | 27 |
1 files changed, 14 insertions, 13 deletions
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) ; |