ps.h revision 130816
1141296Sdas/*- 2141296Sdas * Copyright (c) 1990, 1993 32116Sjkh * The Regents of the University of California. All rights reserved. 42116Sjkh * 52116Sjkh * Redistribution and use in source and binary forms, with or without 62116Sjkh * modification, are permitted provided that the following conditions 7141296Sdas * are met: 82116Sjkh * 1. Redistributions of source code must retain the above copyright 9141296Sdas * notice, this list of conditions and the following disclaimer. 102116Sjkh * 2. Redistributions in binary form must reproduce the above copyright 112116Sjkh * notice, this list of conditions and the following disclaimer in the 122116Sjkh * documentation and/or other materials provided with the distribution. 132116Sjkh * 4. Neither the name of the University nor the names of its contributors 14176720Sdas * may be used to endorse or promote products derived from this software 15176720Sdas * without specific prior written permission. 162116Sjkh * 172116Sjkh * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 182116Sjkh * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 192116Sjkh * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 202116Sjkh * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 212116Sjkh * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22141296Sdas * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23141296Sdas * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 242116Sjkh * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25141296Sdas * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 262116Sjkh * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 272116Sjkh * SUCH DAMAGE. 282116Sjkh * 292116Sjkh * @(#)ps.h 8.1 (Berkeley) 5/31/93 302116Sjkh * $FreeBSD: head/bin/ps/ps.h 130816 2004-06-20 21:25:10Z gad $ 312116Sjkh */ 322116Sjkh 332116Sjkh#define UNLIMITED 0 /* unlimited terminal width */ 34141296Sdasenum type { CHAR, UCHAR, SHORT, USHORT, INT, UINT, LONG, ULONG, KPTR, PGTOK }; 35141296Sdas 36141296Sdastypedef struct kinfo { 372116Sjkh struct kinfo_proc *ki_p; /* kinfo_proc structure */ 382116Sjkh char *ki_args; /* exec args */ 392116Sjkh char *ki_env; /* environment */ 402116Sjkh int ki_valid; /* 1 => uarea stuff valid */ 412116Sjkh double ki_pcpu; /* calculated in main() */ 422116Sjkh segsz_t ki_memsize; /* calculated in main() */ 432116Sjkh} KINFO; 442116Sjkh 452116Sjkh/* Variables. */ 46141296Sdastypedef struct varent { 472116Sjkh const char *header; 482116Sjkh struct varent *next; 492116Sjkh struct var *var; 502116Sjkh} VARENT; 51141296Sdas 522116Sjkhtypedef struct var { 532116Sjkh const char *name; /* name(s) of variable */ 542116Sjkh const char *header; /* default header */ 552116Sjkh const char *alias; /* aliases */ 562116Sjkh#define COMM 0x01 /* needs exec arguments and environment (XXX) */ 572116Sjkh#define LJUST 0x02 /* left adjust on output (trailing blanks) */ 582116Sjkh#define USER 0x04 /* needs user structure */ 592116Sjkh#define DSIZ 0x08 /* field size is dynamic*/ 602116Sjkh#define INF127 0x10 /* values >127 displayed as 127 */ 612116Sjkh u_int flag; 622116Sjkh /* output routine */ 63141296Sdas void (*oproc)(struct kinfo *, struct varent *); 64141296Sdas /* sizing routine*/ 652116Sjkh int (*sproc)(struct kinfo *); 66141296Sdas short width; /* printing width */ 672116Sjkh /* 682116Sjkh * The following (optional) elements are hooks for passing information 692116Sjkh * to the generic output routine pvar (which prints simple elements 702116Sjkh * from the well known kinfo_proc structure). 712116Sjkh */ 722116Sjkh size_t off; /* offset in structure */ 732116Sjkh enum type type; /* type of element */ 742116Sjkh const char *fmt; /* printf format */ 752116Sjkh short dwidth; /* dynamic printing width */ 76141296Sdas /* 772116Sjkh * glue to link selected fields together 782116Sjkh */ 792116Sjkh} VAR; 802116Sjkh 812116Sjkh#include "extern.h" 822116Sjkh