ps.h revision 1.14
1251018Sgonzo/* $NetBSD: ps.h,v 1.14 1999/05/03 00:17:31 mrg Exp $ */ 2251018Sgonzo 3251018Sgonzo/*- 4251018Sgonzo * Copyright (c) 1990, 1993 5251018Sgonzo * The Regents of the University of California. All rights reserved. 6251018Sgonzo * 7251018Sgonzo * Redistribution and use in source and binary forms, with or without 8251018Sgonzo * modification, are permitted provided that the following conditions 9251018Sgonzo * are met: 10251018Sgonzo * 1. Redistributions of source code must retain the above copyright 11251018Sgonzo * notice, this list of conditions and the following disclaimer. 12251018Sgonzo * 2. Redistributions in binary form must reproduce the above copyright 13251018Sgonzo * notice, this list of conditions and the following disclaimer in the 14251018Sgonzo * documentation and/or other materials provided with the distribution. 15251018Sgonzo * 3. All advertising materials mentioning features or use of this software 16251018Sgonzo * must display the following acknowledgement: 17251018Sgonzo * This product includes software developed by the University of 18251018Sgonzo * California, Berkeley and its contributors. 19251018Sgonzo * 4. Neither the name of the University nor the names of its contributors 20251018Sgonzo * may be used to endorse or promote products derived from this software 21251018Sgonzo * without specific prior written permission. 22251018Sgonzo * 23251018Sgonzo * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 24251018Sgonzo * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25251018Sgonzo * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26251018Sgonzo * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 27251018Sgonzo * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28251018Sgonzo * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29251018Sgonzo * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30277716Sgonzo * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31251018Sgonzo * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32251018Sgonzo * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33251018Sgonzo * SUCH DAMAGE. 34251018Sgonzo * 35251018Sgonzo * @(#)ps.h 8.1 (Berkeley) 5/31/93 36251018Sgonzo */ 37251018Sgonzo 38251018Sgonzo#define UNLIMITED 0 /* unlimited terminal width */ 39251018Sgonzoenum type { 40251018Sgonzo CHAR, UCHAR, SHORT, USHORT, INT, UINT, LONG, ULONG, KPTR, KPTR24, 41251018Sgonzo CHAR, UCHAR, SHORT, USHORT, INT, UINT, LONG, ULONG, KPTR, 42251018Sgonzo INT32, UINT32, SIGLIST 43251018Sgonzo}; 44251018Sgonzo 45252282Sgonzostruct usave { 46252282Sgonzo struct timeval u_start; 47252282Sgonzo struct rusage u_ru; 48251018Sgonzo struct rusage u_cru; 49251018Sgonzo char u_acflag; 50251018Sgonzo char u_valid; 51251018Sgonzo}; 52251018Sgonzo 53251018Sgonzo#define KI_PROC(ki) (&(ki)->ki_p->kp_proc) 54251018Sgonzo#define KI_EPROC(ki) (&(ki)->ki_p->kp_eproc) 55284534Sgonzo 56284534Sgonzotypedef struct kinfo { 57284534Sgonzo struct kinfo_proc *ki_p; /* proc structure */ 58284534Sgonzo struct usave ki_u; /* interesting parts of user */ 59252282Sgonzo} KINFO; 60277716Sgonzo 61252282Sgonzo/* Variables. */ 62277716Sgonzotypedef struct varent { 63277716Sgonzo struct varent *next; 64277716Sgonzo struct var *var; 65252282Sgonzo} VARENT; 66251018Sgonzo 67251018Sgonzotypedef struct var { 68251018Sgonzo char *name; /* name(s) of variable */ 69251018Sgonzo char *header; /* default header */ 70251018Sgonzo char *alias; /* aliases */ 71251018Sgonzo#define COMM 0x01 /* needs exec arguments and environment (XXX) */ 72277716Sgonzo#define LJUST 0x02 /* left adjust on output (trailing blanks) */ 73284534Sgonzo#define USER 0x04 /* needs user structure */ 74277716Sgonzo#define INF127 0x08 /* 127 = infinity: if > 127, print 127. */ 75251018Sgonzo u_int flag; 76251018Sgonzo /* output routine */ 77251018Sgonzo void (*oproc) __P((struct kinfo *, struct varent *)); 78251018Sgonzo short width; /* printing width */ 79251018Sgonzo /* 80251018Sgonzo * The following (optional) elements are hooks for passing information 81251018Sgonzo * to the generic output routines: pvar, evar, uvar (those which print 82251018Sgonzo * simple elements from well known structures: proc, eproc, usave) 83251018Sgonzo */ 84251018Sgonzo int off; /* offset in structure */ 85251018Sgonzo enum type type; /* type of element */ 86251018Sgonzo char *fmt; /* printf format */ 87251018Sgonzo /* 88251018Sgonzo * glue to link selected fields together 89251018Sgonzo */ 90251018Sgonzo} VAR; 91251018Sgonzo 92251018Sgonzo#include "extern.h" 93251018Sgonzo