diff options
author | gad <gad@FreeBSD.org> | 2004-06-20 23:40:54 +0000 |
---|---|---|
committer | gad <gad@FreeBSD.org> | 2004-06-20 23:40:54 +0000 |
commit | bc86b22810eed37052800ae9d83fe8b80010e0dd (patch) | |
tree | 9b339ad8f456e3d8b5d54d13202af46c1e0b6383 | |
parent | d7e5b117c40a64820465a4c4cfc34ba57fbf955f (diff) | |
download | FreeBSD-src-bc86b22810eed37052800ae9d83fe8b80010e0dd.zip FreeBSD-src-bc86b22810eed37052800ae9d83fe8b80010e0dd.tar.gz |
Add the `-O emul' format option, which prints the name of the system-call
emulation environment the process is in. "emul" as a keyword is picked
up from OpenBSD.
PR: bin/65803
Submitted by: Cyrille Lefevre
-rw-r--r-- | bin/ps/extern.h | 1 | ||||
-rw-r--r-- | bin/ps/keyword.c | 3 | ||||
-rw-r--r-- | bin/ps/print.c | 9 |
3 files changed, 13 insertions, 0 deletions
diff --git a/bin/ps/extern.h b/bin/ps/extern.h index ca12a79..3642fc9 100644 --- a/bin/ps/extern.h +++ b/bin/ps/extern.h @@ -48,6 +48,7 @@ void command(KINFO *, VARENT *); void cputime(KINFO *, VARENT *); int donlist(void); void elapsed(KINFO *, VARENT *); +void emulname(KINFO *, VARENT *); VARENT *find_varentry(VAR *); const char *fmt_argv(char **, char *, size_t); double getpcpu(const KINFO *); diff --git a/bin/ps/keyword.c b/bin/ps/keyword.c index f5aa959..6764b90 100644 --- a/bin/ps/keyword.c +++ b/bin/ps/keyword.c @@ -57,6 +57,7 @@ static int vcmp(const void *, const void *); #define KOFF(x) offsetof(struct kinfo_proc, x) #define ROFF(x) offsetof(struct rusage, x) +#define EMULLEN 13 /* enough for "FreeBSD ELF32" */ #define LWPFMT "d" #define LWPLEN 6 #define NLWPFMT "d" @@ -85,6 +86,8 @@ static VAR var[] = { {"cpu", "CPU", NULL, 0, kvar, NULL, 3, KOFF(ki_estcpu), UINT, "d", 0}, {"cputime", "", "time", 0, NULL, NULL, 0, 0, CHAR, NULL, 0}, + {"emul", "EMUL", NULL, LJUST, emulname, NULL, EMULLEN, 0, CHAR, + NULL, 0}, {"etime", "ELAPSED", NULL, USER, elapsed, NULL, 12, 0, CHAR, NULL, 0}, {"f", "F", NULL, 0, kvar, NULL, 7, KOFF(ki_flag), INT, "x", 0}, {"flags", "", "f", 0, NULL, NULL, 0, 0, CHAR, NULL, 0}, diff --git a/bin/ps/print.c b/bin/ps/print.c index 76e29ab..01e7e1c 100644 --- a/bin/ps/print.c +++ b/bin/ps/print.c @@ -750,6 +750,15 @@ rvar(KINFO *k, VARENT *ve) } void +emulname(KINFO *k, VARENT *ve) +{ + VAR *v; + + v = ve->var; + printf("%-*s", v->width, *k->ki_p->ki_emul ? k->ki_p->ki_emul : "-"); +} + +void label(KINFO *k, VARENT *ve) { char *string; |