xref: /original-bsd/bin/ps/ps.h (revision 06194916)
1 /*-
2  * Copyright (c) 1990, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  *
7  *	@(#)ps.h	8.1 (Berkeley) 05/31/93
8  */
9 
10 #define	UNLIMITED	0	/* unlimited terminal width */
11 enum type { CHAR, UCHAR, SHORT, USHORT, LONG, ULONG, KPTR };
12 
13 struct usave {
14 	struct	timeval u_start;
15 	struct	rusage u_ru;
16 	struct	rusage u_cru;
17 	char	u_acflag;
18 	char	u_valid;
19 };
20 
21 #define KI_PROC(ki) (&(ki)->ki_p->kp_proc)
22 #define KI_EPROC(ki) (&(ki)->ki_p->kp_eproc)
23 
24 typedef struct kinfo {
25 	struct kinfo_proc *ki_p;	/* proc structure */
26 	struct usave ki_u;	/* interesting parts of user */
27 	char *ki_args;		/* exec args */
28 	char *ki_env;		/* environment */
29 } KINFO;
30 
31 /* Variables. */
32 typedef struct varent {
33 	struct varent *next;
34 	struct var *var;
35 } VARENT;
36 
37 typedef struct var {
38 	char	*name;		/* name(s) of variable */
39 	char	*header;	/* default header */
40 	char	*alias;		/* aliases */
41 #define	COMM	0x01		/* needs exec arguments and environment (XXX) */
42 #define	LJUST	0x02		/* left adjust on output (trailing blanks) */
43 #define	USER	0x04		/* needs user structure */
44 	u_int	flag;
45 				/* output routine */
46 	void	(*oproc) __P((struct kinfo *, struct varent *));
47 	short	width;		/* printing width */
48 	/*
49 	 * The following (optional) elements are hooks for passing information
50 	 * to the generic output routines: pvar, evar, uvar (those which print
51 	 * simple elements from well known structures: proc, eproc, usave)
52 	 */
53 	int	off;		/* offset in structure */
54 	enum	type type;	/* type of element */
55 	char	*fmt;		/* printf format */
56 	char	*time;		/* time format */
57 	/*
58 	 * glue to link selected fields together
59 	 */
60 } VAR;
61 
62 #include "extern.h"
63