version 1.47, 2009/10/27 23:59:49 |
version 1.48, 2011/04/10 03:20:59 |
|
|
struct utmp utmp; |
struct utmp utmp; |
dev_t tdev; /* dev_t of terminal */ |
dev_t tdev; /* dev_t of terminal */ |
time_t idle; /* idle time of terminal in seconds */ |
time_t idle; /* idle time of terminal in seconds */ |
struct kinfo_proc2 *kp; /* `most interesting' proc */ |
struct kinfo_proc *kp; /* `most interesting' proc */ |
} *ep, *ehead = NULL, **nextp = &ehead; |
} *ep, *ehead = NULL, **nextp = &ehead; |
|
|
static void pr_args(struct kinfo_proc2 *); |
static void pr_args(struct kinfo_proc *); |
static void pr_header(time_t *, int); |
static void pr_header(time_t *, int); |
static struct stat |
static struct stat |
*ttystat(char *); |
*ttystat(char *); |
|
|
main(int argc, char *argv[]) |
main(int argc, char *argv[]) |
{ |
{ |
extern char *__progname; |
extern char *__progname; |
struct kinfo_proc2 *kp; |
struct kinfo_proc *kp; |
struct hostent *hp; |
struct hostent *hp; |
struct stat *stp; |
struct stat *stp; |
FILE *ut; |
FILE *ut; |
|
|
#define WUSED (sizeof(HEADER) - sizeof("WHAT")) |
#define WUSED (sizeof(HEADER) - sizeof("WHAT")) |
(void)puts(HEADER); |
(void)puts(HEADER); |
|
|
kp = kvm_getproc2(kd, KERN_PROC_ALL, 0, sizeof(*kp), &nentries); |
kp = kvm_getprocs(kd, KERN_PROC_ALL, 0, sizeof(*kp), &nentries); |
if (kp == NULL) |
if (kp == NULL) |
errx(1, "%s", kvm_geterr(kd)); |
errx(1, "%s", kvm_geterr(kd)); |
for (i = 0; i < nentries; i++, kp++) { |
for (i = 0; i < nentries; i++, kp++) { |
|
|
} |
} |
|
|
static void |
static void |
pr_args(struct kinfo_proc2 *kp) |
pr_args(struct kinfo_proc *kp) |
{ |
{ |
char **argv, *str; |
char **argv, *str; |
int left; |
int left; |
|
|
if (kp == NULL) |
if (kp == NULL) |
goto nothing; /* XXX - can this happen? */ |
goto nothing; /* XXX - can this happen? */ |
left = argwidth; |
left = argwidth; |
argv = kvm_getargv2(kd, kp, argwidth+60); /* +60 for ftpd snip */ |
argv = kvm_getargv(kd, kp, argwidth+60); /* +60 for ftpd snip */ |
if (argv == NULL) |
if (argv == NULL) |
goto nothing; |
goto nothing; |
|
|