summaryrefslogtreecommitdiff
path: root/src/minutils/s6ps_wchan.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/minutils/s6ps_wchan.c')
-rw-r--r--src/minutils/s6ps_wchan.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/src/minutils/s6ps_wchan.c b/src/minutils/s6ps_wchan.c
index 77ac671..209e1ef 100644
--- a/src/minutils/s6ps_wchan.c
+++ b/src/minutils/s6ps_wchan.c
@@ -1,9 +1,8 @@
/* ISC license. */
-#include <sys/types.h>
+#include <string.h>
#include <sys/utsname.h>
#include <skalibs/uint64.h>
-#include <skalibs/bytestr.h>
#include <skalibs/stralloc.h>
#include <skalibs/genalloc.h>
#include <skalibs/djbunix.h>
@@ -24,13 +23,13 @@ int s6ps_wchan_init (char const *file)
struct utsname uts ;
size_t n ;
if (uname(&uts) < 0) return 0 ;
- n = str_len(uts.release) ;
+ n = strlen(uts.release) ;
{
char buf[18 + n] ;
- register unsigned int i = 0 ;
- byte_copy(buf, 16, "/boot/System.map") ;
+ unsigned int i = 0 ;
+ memcpy(buf, "/boot/System.map", 16) ;
buf[16] = '-' ;
- byte_copy(buf + 17, n + 1, uts.release) ;
+ memcpy(buf + 17, uts.release, n + 1) ;
files[1] = buf ;
for (; i < 3 ; i++)
if (openslurpclose(&sysmap, files[i])) break ;
@@ -58,14 +57,14 @@ void s6ps_wchan_finish (void)
stralloc_free(&sysmap) ;
}
-static inline size_t lookup (uint64 addr, size_t *i)
+static inline size_t lookup (uint64_t addr, size_t *i)
{
size_t low = 0, mid, high = genalloc_len(size_t, &ind), len ;
for (;;)
{
- uint64 cur ;
+ uint64_t cur ;
mid = (low + high) >> 1 ;
- len = uint64_xscan(sysmap.s + genalloc_s(unsigned int, &ind)[mid], &cur) ;
+ len = uint64_xscan(sysmap.s + genalloc_s(size_t, &ind)[mid], &cur) ;
if (!len) return 0 ;
if (cur == addr) break ;
if (mid == low) return 0 ;
@@ -75,16 +74,14 @@ static inline size_t lookup (uint64 addr, size_t *i)
return len ;
}
-int s6ps_wchan_lookup (stralloc *sa, uint64 addr)
+int s6ps_wchan_lookup (stralloc *sa, uint64_t addr)
{
if (addr == (sizeof(void *) == 8 ? 0xffffffffffffffffULL : 0xffffffffUL))
return stralloc_catb(sa, "*", 1) ;
if (!addr) return stralloc_catb(sa, "-", 1) ;
if (sysmap.len)
{
- size_t i ;
- size_t len = lookup(addr, &i) ;
- register size_t pos ;
+ size_t i, pos, len = lookup(addr, &i) ;
if (!len) return stralloc_catb(sa, "?", 1) ;
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) ;