Print this page
2989 Eliminate use of LOGNAME_MAX in ON
1166 useradd have warning with name more 8 chars
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/cmd/prstat/prstat.h
+++ new/usr/src/cmd/prstat/prstat.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
↓ open down ↓ |
12 lines elided |
↑ open up ↑ |
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21
22 22 /*
23 + * Copyright (c) 2013 Gary Mills
24 + *
23 25 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 26 * Use is subject to license terms.
25 27 *
26 28 * Portions Copyright 2009 Chad Mynhier
27 29 */
28 30
29 31 #ifndef _PRSTAT_H
30 32 #define _PRSTAT_H
31 33
32 34 #include <sys/sysmacros.h>
33 35 #include <sys/time.h>
34 36 #include <sys/types.h>
35 37 #include <procfs.h>
36 38
37 39 #ifdef __cplusplus
38 40 extern "C" {
39 41 #endif
40 42
41 43 /*
42 44 * FRC2PCT macro is used to convert 16-bit binary fractions in the range
43 45 * 0.0 to 1.0 with binary point to the right of the high order bit
44 46 * (i.e. 1.0 == 0x8000) to percentage value.
45 47 */
46 48
47 49 #define FRC2PCT(pp) (((float)(pp))/0x8000*100)
48 50
49 51 #define TIME2NSEC(__t)\
50 52 (hrtime_t)(((hrtime_t)__t.tv_sec * (hrtime_t)NANOSEC) + (hrtime_t)__t.tv_nsec)
51 53 #define TIME2SEC(__t)\
52 54 (hrtime_t)(__t.tv_sec)
53 55
54 56 /*
55 57 * List of available output modes
56 58 */
57 59 #define OPT_PSINFO 0x0001 /* read process's data from "psinfo" */
58 60 #define OPT_LWPS 0x0002 /* report about all lwps */
59 61 #define OPT_USERS 0x0004 /* report about most active users */
60 62 #define OPT_UNUSED 0x0008 /* reserved for future use */
61 63 #define OPT_REALTIME 0x0010 /* real-time scheduling class flag */
62 64 #define OPT_MSACCT 0x0020 /* microstate accounting flag */
63 65 #define OPT_TERMCAP 0x0040 /* use termcap data to move cursor */
64 66 #define OPT_SPLIT 0x0080 /* split-screen mode flag */
65 67 #define OPT_TTY 0x0100 /* report results to tty or file */
↓ open down ↓ |
33 lines elided |
↑ open up ↑ |
66 68 #define OPT_FULLSCREEN 0x0200 /* full-screen mode flag */
67 69 #define OPT_USEHOME 0x0400 /* use 'home' to move cursor up */
68 70 #define OPT_TASKS 0x0800 /* report about system tasks */
69 71 #define OPT_PROJECTS 0x1000 /* report about system projects */
70 72 #define OPT_ZONES 0x2000 /* report about zones */
71 73 #define OPT_PSETS 0x4000 /* report for specified psets */
72 74 #define OPT_LGRP 0x8000 /* report home lgroups */
73 75 #define OPT_UDATE 0x20000 /* print unix timestamp */
74 76 #define OPT_DDATE 0x40000 /* print timestamp in date(1) format */
75 77 #define OPT_NORESOLVE 0x80000 /* no nsswitch lookups */
78 +#define OPT_TRUNC 0x100000 /* truncate long names */
76 79
77 80 /*
78 81 * Flags to keep track of process or lwp status
79 82 */
80 83 #define LWP_ALIVE 0x0008 /* this pid/lwp still exists */
81 84 #define LWP_REPRESENT 0x0010 /* this LWP represents the process */
82 85
83 86 /*
84 87 * Possible list types
85 88 */
86 89 #define LT_LWPS 0x0001
87 90 #define LT_USERS 0x0002
88 91 #define LT_TASKS 0x0004
89 92 #define LT_PROJECTS 0x0008
90 93 #define LT_ZONES 0x0010
91 94 #define LT_LGRPS 0x0020
92 95
93 96 /*
94 97 * Linked list of per-process or per-lwp statistics
95 98 */
96 99 typedef struct lwp_info {
97 100 psinfo_t li_info; /* data read from psinfo file */
98 101 prusage_t li_usage; /* data read from usage file */
99 102 ulong_t li_key; /* value of the key for this lwp */
100 103 int li_flags; /* process/lwp flags */
101 104 float li_usr; /* user level CPU time */
102 105 float li_sys; /* system call CPU time */
103 106 float li_trp; /* other system trap CPU time */
104 107 float li_tfl; /* text page fault sleep time */
105 108 float li_dfl; /* data page fault sleep time */
106 109 float li_lck; /* user lock wait sleep time */
107 110 float li_slp; /* all other sleep time */
108 111 float li_lat; /* wait-cpu (latency) time */
109 112 ulong_t li_vcx; /* voluntary context switches */
110 113 ulong_t li_icx; /* involuntary context switches */
111 114 ulong_t li_scl; /* system calls */
112 115 ulong_t li_sig; /* received signals */
113 116 struct lwp_info *li_next; /* pointer to next lwp */
114 117 struct lwp_info *li_prev; /* pointer to previous lwp */
115 118 } lwp_info_t;
116 119
117 120 /*
118 121 * Linked list of collective per-uid, per-taskid, per-projid or per-lgroup
119 122 * statistics
120 123 */
121 124 typedef struct id_info {
122 125 uid_t id_uid; /* user id */
123 126 taskid_t id_taskid; /* task id */
124 127 projid_t id_projid; /* project id */
125 128 zoneid_t id_zoneid; /* zone id */
126 129 int id_lgroup; /* lgroup id */
127 130 uint_t id_nproc; /* number of processes */
128 131 boolean_t id_sizematch; /* size/rssize from getvmusage() */
129 132 size_t id_size; /* memory usage */
130 133 size_t id_rssize; /* resident set size */
131 134 ulong_t id_time; /* cpu time (in secs) */
132 135 float id_pctcpu; /* percentage of cpu usage */
133 136 float id_pctmem; /* percentage of memory usage */
134 137 ulong_t id_key; /* sort key value */
135 138 struct id_info *id_next; /* pointer to next entry */
136 139 struct id_info *id_prev; /* pointer to previous entry */
137 140 } id_info_t;
138 141
139 142 typedef ulong_t (*keyfunc_t)(void *);
140 143
141 144 /*
142 145 * Per-list structure
143 146 */
144 147 typedef struct list {
145 148 int l_type; /* list type */
146 149 int l_count; /* number of entries in the list */
147 150 void *l_head; /* pointer to the head of the list */
148 151 void *l_tail; /* pointer to the tail of the list */
149 152
150 153 int l_size; /* number of allocated pointers */
151 154 int l_used; /* number of used pointers */
152 155 int l_sortorder; /* sorting order for the list */
153 156 keyfunc_t l_func; /* pointer to key function */
154 157 void **l_ptrs; /* pointer to an array of pointers */
155 158 } list_t;
156 159
157 160 /*
158 161 * Command line options
159 162 */
160 163 typedef struct optdesc {
161 164 int o_interval; /* interval between updates */
162 165 int o_ntop; /* number of lines in top half */
163 166 int o_nbottom; /* number of lines in bottom half */
164 167 int o_count; /* number of iterations */
165 168 int o_outpmode; /* selected output mode */
166 169 int o_sortorder; /* +1 ascending, -1 descending */
167 170 } optdesc_t;
168 171
169 172 #ifdef __cplusplus
170 173 }
171 174 #endif
172 175
173 176 #endif /* _PRSTAT_H */
↓ open down ↓ |
88 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX