Mercurial > hg > toybox
comparison toys/other/pmap.c @ 1043:acf7bb2b99e2 draft
Introduce libbuf analogous to toybuf but for use by lib/*.c. Change readfile() semantics to be able to read into an existing buffer, or malloc its own if that's NULL.
author | Rob Landley <rob@landley.net> |
---|---|
date | Tue, 03 Sep 2013 17:56:28 -0500 |
parents | 9686469a857a |
children | ac4a0cde89c2 |
comparison
equal
deleted
inserted
replaced
1042:cbc467592b2e | 1043:acf7bb2b99e2 |
---|---|
33 long long start, end, pss, tpss = 0, dirty, tdirty = 0, swap, tswap = 0, | 33 long long start, end, pss, tpss = 0, dirty, tdirty = 0, swap, tswap = 0, |
34 total = 0; | 34 total = 0; |
35 int count, xx = 0; | 35 int count, xx = 0; |
36 | 36 |
37 snprintf(toybuf, sizeof(toybuf), "/proc/%u/cmdline", pid); | 37 snprintf(toybuf, sizeof(toybuf), "/proc/%u/cmdline", pid); |
38 line = readfile(toybuf); | 38 line = readfile(toybuf, 0, 0); |
39 if (!line) error_msg("No %lu", (long)pid); | 39 if (!line) error_msg("No %lu", (long)pid); |
40 xprintf("%u: %s\n", (int)pid, line); | 40 xprintf("%u: %s\n", (int)pid, line); |
41 free(line); | 41 free(line); |
42 | 42 |
43 // Header | 43 // Header |