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
This commit is contained in:
Garance A Drosehn 2004-06-20 23:40:54 +00:00
parent 5526395941
commit 15b87b531e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=130830
3 changed files with 13 additions and 0 deletions

View File

@ -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 *);

View File

@ -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},

View File

@ -749,6 +749,15 @@ rvar(KINFO *k, VARENT *ve)
(void)printf("%*s", v->width, "-");
}
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)
{