Changeset View
Changeset View
Standalone View
Standalone View
usr.bin/procstat/procstat_basic.c
/*- | /*- | ||||
* Copyright (c) 2007 Robert N. M. Watson | * Copyright (c) 2007 Robert N. M. Watson | ||||
* Copyright (c) 2015 Allan Jude <allanjude@freebsd.org> | |||||
* All rights reserved. | * All rights reserved. | ||||
* | * | ||||
* Redistribution and use in source and binary forms, with or without | * Redistribution and use in source and binary forms, with or without | ||||
* modification, are permitted provided that the following conditions | * modification, are permitted provided that the following conditions | ||||
* are met: | * are met: | ||||
* 1. Redistributions of source code must retain the above copyright | * 1. Redistributions of source code must retain the above copyright | ||||
* notice, this list of conditions and the following disclaimer. | * notice, this list of conditions and the following disclaimer. | ||||
* 2. Redistributions in binary form must reproduce the above copyright | * 2. Redistributions in binary form must reproduce the above copyright | ||||
Show All 26 Lines | |||||
#include "procstat.h" | #include "procstat.h" | ||||
void | void | ||||
procstat_basic(struct kinfo_proc *kipp) | procstat_basic(struct kinfo_proc *kipp) | ||||
{ | { | ||||
if (!hflag) | if (!hflag) | ||||
printf("%5s %5s %5s %5s %5s %3s %-8s %-9s %-13s %-12s\n", | xo_emit("{T:/%5s %5s %5s %5s %5s %3s %-8s %-9s %-13s %-12s}\n", | ||||
"PID", "PPID", "PGID", "SID", "TSID", "THR", "LOGIN", | "PID", "PPID", "PGID", "SID", "TSID", "THR", "LOGIN", | ||||
"WCHAN", "EMUL", "COMM"); | "WCHAN", "EMUL", "COMM"); | ||||
printf("%5d ", kipp->ki_pid); | xo_emit("{k:process_id/%5d/%d} ", kipp->ki_pid); | ||||
printf("%5d ", kipp->ki_ppid); | xo_emit("{:parent_process_id/%5d/%d} ", kipp->ki_ppid); | ||||
printf("%5d ", kipp->ki_pgid); | xo_emit("{:process_group_id/%5d/%d} ", kipp->ki_pgid); | ||||
printf("%5d ", kipp->ki_sid); | xo_emit("{:session_id/%5d/%d} ", kipp->ki_sid); | ||||
printf("%5d ", kipp->ki_tsid); | xo_emit("{:terminal_session_id/%5d/%d} ", kipp->ki_tsid); | ||||
printf("%3d ", kipp->ki_numthreads); | xo_emit("{:threads/%3d/%d} ", kipp->ki_numthreads); | ||||
printf("%-8s ", strlen(kipp->ki_login) ? kipp->ki_login : "-"); | xo_emit("{:login/%-8s/%s} ", strlen(kipp->ki_login) ? kipp->ki_login : "-"); | ||||
marcel: Long line. | |||||
if (kipp->ki_kiflag & KI_LOCKBLOCK) { | if (kipp->ki_kiflag & KI_LOCKBLOCK) { | ||||
printf("*%-8s ", strlen(kipp->ki_lockname) ? | xo_emit("{:lockname/*%-8s/%s} ", strlen(kipp->ki_lockname) ? | ||||
kipp->ki_lockname : "-"); | kipp->ki_lockname : "-"); | ||||
} else { | } else { | ||||
printf("%-9s ", strlen(kipp->ki_wmesg) ? | xo_emit("{:wait_channel/%-9s/%s} ", strlen(kipp->ki_wmesg) ? | ||||
kipp->ki_wmesg : "-"); | kipp->ki_wmesg : "-"); | ||||
} | } | ||||
printf("%-13s ", strcmp(kipp->ki_emul, "null") ? kipp->ki_emul : "-"); | xo_emit("{:emulation/%-13s/%s} ", strcmp(kipp->ki_emul, "null") ? kipp->ki_emul : "-"); | ||||
printf("%-12s\n", kipp->ki_comm); | xo_emit("{:command/%-12s/%s}\n", kipp->ki_comm); | ||||
} | } |
Long line.