ps.h revision 109504
1130803Smarcel/*-
2130803Smarcel * Copyright (c) 1990, 1993
3130803Smarcel *	The Regents of the University of California.  All rights reserved.
4130803Smarcel *
5130803Smarcel * Redistribution and use in source and binary forms, with or without
6130803Smarcel * modification, are permitted provided that the following conditions
7130803Smarcel * are met:
8130803Smarcel * 1. Redistributions of source code must retain the above copyright
9130803Smarcel *    notice, this list of conditions and the following disclaimer.
10130803Smarcel * 2. Redistributions in binary form must reproduce the above copyright
11130803Smarcel *    notice, this list of conditions and the following disclaimer in the
12130803Smarcel *    documentation and/or other materials provided with the distribution.
13130803Smarcel * 3. All advertising materials mentioning features or use of this software
14130803Smarcel *    must display the following acknowledgement:
15130803Smarcel *	This product includes software developed by the University of
16130803Smarcel *	California, Berkeley and its contributors.
17130803Smarcel * 4. Neither the name of the University nor the names of its contributors
18130803Smarcel *    may be used to endorse or promote products derived from this software
19130803Smarcel *    without specific prior written permission.
20130803Smarcel *
21130803Smarcel * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22130803Smarcel * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23130803Smarcel * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24130803Smarcel * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25130803Smarcel * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26130803Smarcel * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27130803Smarcel * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28130803Smarcel * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29130803Smarcel * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30130803Smarcel * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31130803Smarcel * SUCH DAMAGE.
32130803Smarcel *
33130803Smarcel *	@(#)ps.h	8.1 (Berkeley) 5/31/93
34130803Smarcel * $FreeBSD: head/bin/ps/ps.h 109504 2003-01-19 00:31:16Z jmallett $
35130803Smarcel */
36130803Smarcel
37130803Smarcel#define	UNLIMITED	0	/* unlimited terminal width */
38130803Smarcelenum type { CHAR, UCHAR, SHORT, USHORT, INT, UINT, LONG, ULONG, KPTR, PGTOK };
39130803Smarcel
40130803Smarceltypedef struct kinfo {
41130803Smarcel	struct kinfo_proc *ki_p;	/* kinfo_proc structure */
42130803Smarcel	char *ki_args;		/* exec args */
43130803Smarcel	char *ki_env;		/* environment */
44130803Smarcel	int ki_valid;		/* 1 => uarea stuff valid */
45130803Smarcel} KINFO;
46130803Smarcel
47130803Smarcel/* Variables. */
48130803Smarceltypedef struct varent {
49130803Smarcel	const char *header;
50130803Smarcel	struct varent *next;
51130803Smarcel	struct var *var;
52130803Smarcel} VARENT;
53130803Smarcel
54130803Smarceltypedef struct var {
55130803Smarcel	const char *name;	/* name(s) of variable */
56130803Smarcel	const char *header;	/* default header */
57130803Smarcel	const char *alias;	/* aliases */
58130803Smarcel#define	COMM	0x01		/* needs exec arguments and environment (XXX) */
59130803Smarcel#define	LJUST	0x02		/* left adjust on output (trailing blanks) */
60130803Smarcel#define	USER	0x04		/* needs user structure */
61130803Smarcel#define	DSIZ	0x08		/* field size is dynamic*/
62130803Smarcel	u_int	flag;
63130803Smarcel				/* output routine */
64130803Smarcel	void	(*oproc)(struct kinfo *, struct varent *);
65130803Smarcel				/* sizing routine*/
66130803Smarcel	int	(*sproc)(struct kinfo *);
67130803Smarcel	short	width;		/* printing width */
68130803Smarcel	/*
69130803Smarcel	 * The following (optional) elements are hooks for passing information
70130803Smarcel	 * to the generic output routine pvar (which prints simple elements
71130803Smarcel	 * from the well known kinfo_proc structure).
72130803Smarcel	 */
73130803Smarcel	size_t	off;		/* offset in structure */
74130803Smarcel	enum	type type;	/* type of element */
75130803Smarcel	const char *fmt;	/* printf format */
76130803Smarcel	short	dwidth;		/* dynamic printing width */
77130803Smarcel	/*
78130803Smarcel	 * glue to link selected fields together
79130803Smarcel	 */
80130803Smarcel} VAR;
81130803Smarcel
82130803Smarcel#include "extern.h"
83130803Smarcel