ps.h revision 220574
1223328Sgavin/*- 2223328Sgavin * Copyright (c) 1990, 1993 379971Sobrien * The Regents of the University of California. All rights reserved. 479971Sobrien * 5223328Sgavin * Redistribution and use in source and binary forms, with or without 679971Sobrien * modification, are permitted provided that the following conditions 779971Sobrien * are met: 879971Sobrien * 1. Redistributions of source code must retain the above copyright 979971Sobrien * notice, this list of conditions and the following disclaimer. 1079971Sobrien * 2. Redistributions in binary form must reproduce the above copyright 1179971Sobrien * notice, this list of conditions and the following disclaimer in the 1279971Sobrien * documentation and/or other materials provided with the distribution. 1379971Sobrien * 4. Neither the name of the University nor the names of its contributors 1479971Sobrien * may be used to endorse or promote products derived from this software 1579971Sobrien * without specific prior written permission. 1679971Sobrien * 1779971Sobrien * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 1879971Sobrien * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1979971Sobrien * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2079971Sobrien * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2179971Sobrien * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2279971Sobrien * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2379971Sobrien * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2479971Sobrien * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2579971Sobrien * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2679971Sobrien * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2779971Sobrien * SUCH DAMAGE. 2879971Sobrien * 2979971Sobrien * @(#)ps.h 8.1 (Berkeley) 5/31/93 3079971Sobrien * $FreeBSD: head/bin/ps/ps.h 220574 2011-04-12 20:10:15Z trasz $ 3179971Sobrien */ 3279971Sobrien 3379971Sobrien#include <sys/queue.h> 3479971Sobrien 3579971Sobrien#define UNLIMITED 0 /* unlimited terminal width */ 3679971Sobrienenum type { CHAR, UCHAR, SHORT, USHORT, INT, UINT, LONG, ULONG, KPTR, PGTOK }; 3779971Sobrien 3879971Sobrientypedef struct kinfo { 3979971Sobrien struct kinfo_proc *ki_p; /* kinfo_proc structure */ 4079971Sobrien char *ki_args; /* exec args */ 4179971Sobrien char *ki_env; /* environment */ 4279971Sobrien int ki_valid; /* 1 => uarea stuff valid */ 4379971Sobrien double ki_pcpu; /* calculated in main() */ 4479971Sobrien segsz_t ki_memsize; /* calculated in main() */ 4579971Sobrien union { 4679971Sobrien int level; /* used in decendant_sort() */ 4779971Sobrien char *prefix; /* calculated in decendant_sort() */ 4879971Sobrien } ki_d; 49121966Smikeh} KINFO; 5079971Sobrien 5179971Sobrien/* Variables. */ 5279971Sobrientypedef struct varent { 5379971Sobrien STAILQ_ENTRY(varent) next_ve; 5479971Sobrien const char *header; 5579971Sobrien struct var *var; 5679971Sobrien} VARENT; 5779971Sobrien 5879971Sobrientypedef struct var { 5979971Sobrien const char *name; /* name(s) of variable */ 6079971Sobrien const char *header; /* default header */ 6179971Sobrien const char *alias; /* aliases */ 6279971Sobrien#define COMM 0x01 /* needs exec arguments and environment (XXX) */ 6379971Sobrien#define LJUST 0x02 /* left adjust on output (trailing blanks) */ 6479971Sobrien#define USER 0x04 /* needs user structure */ 6579971Sobrien#define INF127 0x10 /* values >127 displayed as 127 */ 6679971Sobrien u_int flag; 6779971Sobrien /* output routine */ 6879971Sobrien void (*oproc)(struct kinfo *, struct varent *); 69146309Smikeh /* sizing routine */ 7079971Sobrien int (*sproc)(struct kinfo *); 7179971Sobrien short width; /* printing width */ 7279971Sobrien /* 7379971Sobrien * The following (optional) elements are hooks for passing information 7479971Sobrien * to the generic output routine pvar (which prints simple elements 7579971Sobrien * from the well known kinfo_proc structure). 7679971Sobrien */ 7779971Sobrien size_t off; /* offset in structure */ 7879971Sobrien enum type type; /* type of element */ 7979971Sobrien const char *fmt; /* printf format */ 8079971Sobrien short dwidth; /* dynamic printing width */ 81146309Smikeh /* 8279971Sobrien * glue to link selected fields together 8379971Sobrien */ 8479971Sobrien} VAR; 8579971Sobrien 8679971Sobrien#include "extern.h" 8779971Sobrien