Age | Commit message (Collapse) | Author |
|
|
|
This lets you have struct arrays with a string as the first member, ala:
struct {char *name; int x, y} blah thingy[] = TAGGED_ARRAY(BLAH,
{"one", 1, 2}, {"two", 3, 4}, {"three", 5, 6}
);
And it produces #defines for the array index of each, ala:
#define BLAH_one 0
#define BLAH_two 1
#define BLAH_three 2
So you can use thingy[BLAH_two].x and still reorder the elements at will.
Note: if you screw up the array initializers, temporarily replace
TAGGED_ARRAY(BLAH, with { and the ); with }; and the compiler will give you
better error messages. (With the macro the compiler reports errors on the
TAGGED_ARRAY line, not where the comma is missing in its contents.)
Currently the TAGGED_ARRAY( and ); must be on their own lines, and the
{ and start of each attached string must be on the same line.
|
|
and slot numers into a structure. (Keeping multiple arrays in sync may have
been efficient but it was ugly.) Fix duplicate command name copying that
corrupted the name of kernel threads. Tighten up slot[] docs.
|
|
Valgrind complains that we add uninitalized memory to totals[] fields we never
read from. (If we didn't set it in entrylen() we don't use it during display,
they're testing the same flags), but valgrind doesn't understand that.
|
|
out.
Keep the low 32 bits of FLAG_x constants as 32 bit numbers so that at least
on little endian platforms it's still normal 32 bit math outside of lib/args.c.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Includes tests for the new feature, and a failure case for the minimal
perms test as well.
Also some typo fixing / massaging the help text so it fits in 80
columns.
|
|
|
|
move slot[] documentation into C code, add PR %VSZ VIRT RES SHR
|
|
Even though ext2 has a comment that it has to be at the start, I added swap
to the start of the array (oops). The test suite was also wrong (it was
matching the _incorrect_ output).
|
|
|
|
|
|
|
|
|
|
|
|
instead of carving up toybuf by hand. This makes breaking out the field
conversion logic into its own function less expensive.
|
|
Change readfileat() to pass back length of read.
|
|
1) It read st_dev instead of st_mode.
2) It reversed the semantics of absolute vs minimal ('-' prefixed) tests.
Add tests for these, and move the "unterminated -exec" test into the "Still
fails" section because it's still dumping core for me.
|
|
|
|
|
|
|
|
|
|
Four-digit years were being mangled by the code for two-digit years.
Move all the two-digit year code into the "we only saw two digits" case.
Add some new tests and fix existing tests.
|
|
functions to read major()/minor(), fix printf format warnings in error msg.
|
|
|
|
|
|
Both Android and GNU interpret -n to mean "show numeric users and groups",
despite what POSIX says.
|
|
This is equivalent to Android's historical "NAME" column, showing the
first element of /proc/pid/cmdline.
|
|
Also WOULD_EXIT(x, thingy()) to set a variable to 1 or 0 showing whether or
not thingy() tried to exit. I'd love to be able to do "x = NOEXIT(thingy());"
but haven't figured out a syntax to make that work yet...
|
|
|
|
|
|
ticks _is_ 100...
|
|
|
|
Collate some repeated increments, remove some useless coments.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
seldom ends well). Instead add -DBUILD_FOR_HOST to $HOSTCC and wrap #ifdefs
around problematic (smack) includes from toys.h.
|
|
(The help infrastructure can collate and alphebetize short options,
long options haven't got a standardized help text format. Not a hard
requirement to have a short opt, but it's nice.)
|
|
"comm" is the command name without arguments, and "cmd" the command
line including arguments. Confusingly, "command" is a synonym for
the *latter*, not the former.
This implementation of "comm" matches the GNU ps behavior where the
names are truncated, but Android historically used the full name
from /proc/pid/cmdline instead, so this patch isn't sufficient to
let us match the Android behavior.
|
|
I actually thought ps was segfaulting, and it wasn't until I was in gdb
that I even noticed there was an error message at all, and even then I
had to read the source to work out what it was trying to tell me.
Before:
$ ps -o user,pid,ppid,vsize,rss,nice,wchan,addr,unknown,stat,cmd
ps: -o 'user,pid,ppid,vsize,rss,nice,wchan,addr,unknown,stat,cmd'@41
USER PID PPID VSZ RSS NI WCHAN ADDR$
After:
$ ps -o user,pid,ppid,vsize,rss,nice,wchan,addr,unknown,stat,cmd
ps: bad -o field 'user,pid,ppid,vsize,rss,nice,wchan,addr,unknown,stat,cmd'
^
|
|
|