summaryrefslogtreecommitdiff
path: root/sysdeps/unix/sysv/solaris2/kopensolaris-gnu/sys/old_procfs.h
blob: 33e7354f093de3b25323ecb84d5e9c46c30be025 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
/* Declarations of old procfs structures.
   Copyright (C) 2008 Free Software Foundation, Inc.
   This file is part of the GNU C Library.

   The GNU C Library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 2.1 of the License, or (at your option) any later version.

   The GNU C Library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public
   License along with the GNU C Library; if not, write to the Free
   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
   02111-1307 USA.  */

#ifndef _SYS_OLD_PROCFS_H
#define _SYS_OLD_PROCFS_H	1

#if _STRUCTURED_PROC == 0

#include <sys/types.h>
#include <sys/procset.h>
#include <sys/ucontext.h>
#include <sys/signal.h>
#include <sys/fault.h>
#include <sys/procfs_isa.h>

#define	PIOC		('q'<<8)
#define	PIOCSTATUS	(PIOC|1)
#define	PIOCSTOP	(PIOC|2)
#define	PIOCWSTOP	(PIOC|3)
#define	PIOCRUN		(PIOC|4)
#define	PIOCGTRACE	(PIOC|5)
#define	PIOCSTRACE	(PIOC|6)
#define	PIOCSSIG	(PIOC|7)
#define	PIOCKILL	(PIOC|8)
#define	PIOCUNKILL	(PIOC|9)
#define	PIOCGHOLD	(PIOC|10)
#define	PIOCSHOLD	(PIOC|11)
#define	PIOCMAXSIG	(PIOC|12)
#define	PIOCACTION	(PIOC|13)
#define	PIOCGFAULT	(PIOC|14)
#define	PIOCSFAULT	(PIOC|15)
#define	PIOCCFAULT	(PIOC|16)
#define	PIOCGENTRY	(PIOC|17)
#define	PIOCSENTRY	(PIOC|18)
#define	PIOCGEXIT	(PIOC|19)
#define	PIOCSEXIT	(PIOC|20)
#define	PIOCSFORK	(PIOC|21)
#define	PIOCRFORK	(PIOC|22)
#define	PIOCSRLC	(PIOC|23)
#define	PIOCRRLC	(PIOC|24)
#define	PIOCGREG	(PIOC|25)
#define	PIOCSREG	(PIOC|26)
#define	PIOCGFPREG	(PIOC|27)
#define	PIOCSFPREG	(PIOC|28)
#define	PIOCNICE	(PIOC|29)
#define	PIOCPSINFO	(PIOC|30)
#define	PIOCNMAP	(PIOC|31)
#define	PIOCMAP		(PIOC|32)
#define	PIOCOPENM	(PIOC|33)
#define	PIOCCRED	(PIOC|34)
#define	PIOCGROUPS	(PIOC|35)
#define	PIOCGETPR	(PIOC|36)
#define	PIOCGETU	(PIOC|37)
#define	PIOCSET		(PIOC|38)
#define	PIOCRESET	(PIOC|39)
#define	PIOCUSAGE	(PIOC|43)
#define	PIOCOPENPD	(PIOC|44)
#define	PIOCLWPIDS	(PIOC|45)
#define	PIOCOPENLWP	(PIOC|46)
#define	PIOCLSTATUS	(PIOC|47)
#define	PIOCLUSAGE	(PIOC|48)
#define	PIOCNAUXV	(PIOC|49)
#define	PIOCAUXV	(PIOC|50)
#define	PIOCGXREGSIZE	(PIOC|51)
#define	PIOCGXREG	(PIOC|52)
#define	PIOCSXREG	(PIOC|53)

#define	PIOCNLDT	(PIOC|103)
#define	PIOCLDT		(PIOC|104)

#define PRCLSZ		8
#define PRSYSARGS	8

#endif /* _STRUCTURED_PROC == 0 */

typedef struct prstatus
  {
	int pr_flags;
	short pr_why;
	short pr_what;
	siginfo_t pr_info;
	short pr_cursig;
	unsigned short pr_nlwp;
	sigset_t pr_sigpend;
	sigset_t pr_sighold;
	struct sigaltstack pr_altstack;
	struct sigaction pr_action;
	pid_t pr_pid;
	pid_t pr_ppid;
	pid_t pr_pgrp;
	pid_t pr_sid;
	struct timespec pr_utime;
	struct timespec pr_stime;
	struct timespec pr_cutime;
	struct timespec pr_cstime;
	char pr_clname[PRCLSZ];
	short pr_syscall;
	short pr_nsysarg;
	long pr_sysarg[PRSYSARGS];
	id_t pr_who;
	sigset_t pr_lwppend;
	struct ucontext *pr_oldcontext;
	caddr_t pr_brkbase;
	size_t pr_brksize;
	caddr_t pr_stkbase;
	size_t pr_stksize;
	short pr_processor;
	short pr_bind;
	long pr_instr;
	prgregset_t pr_reg;
  } prstatus_t;

#if _STRUCTURED_PROC == 0

#define	PR_STOPPED	0x0001
#define	PR_ISTOP	0x0002
#define	PR_DSTOP	0x0004
#define	PR_ASLEEP	0x0008
#define	PR_FORK		0x0010
#define	PR_RLC		0x0020
#define	PR_PTRACE	0x0040
#define	PR_PCINVAL	0x0080
#define	PR_ISSYS	0x0100
#define	PR_STEP		0x0200
#define	PR_KLC		0x0400
#define	PR_ASYNC	0x0800
#define	PR_PCOMPAT	0x1000
#define	PR_MSACCT	0x2000
#define	PR_BPTADJ	0x4000
#define	PR_ASLWP	0x8000

#define	PR_REQUESTED	1
#define	PR_SIGNALLED	2
#define	PR_SYSENTRY	3
#define	PR_SYSEXIT	4
#define	PR_JOBCONTROL	5
#define	PR_FAULTED	6
#define	PR_SUSPENDED	7
#define	PR_CHECKPOINT	8

#define	PRFNSZ		16
#define	PRARGSZ		80

#endif /* _STRUCTURED_PROC == 0 */

typedef struct prpsinfo
  {
	char pr_state;
	char pr_sname;
	char pr_zomb;
	char pr_nice;
	unsigned int pr_flag;
	uid_t pr_uid;
	gid_t pr_gid;
	pid_t pr_pid;
	pid_t pr_ppid;
	pid_t pr_pgrp;
	pid_t pr_sid;
	caddr_t pr_addr;
	size_t pr_size;
	size_t pr_rssize;
	caddr_t pr_wchan;
	struct timespec pr_start;
	struct timespec pr_time;
	int pr_pri;
	char pr_oldpri;
	char pr_cpu;
	o_dev_t pr_ottydev;
	dev_t pr_lttydev;
	char pr_clname[PRCLSZ];
	char pr_fname[PRFNSZ];
	char pr_psargs[PRARGSZ];
	short pr_syscall;
	short pr_fill;
	struct timespec pr_ctime;
	size_t pr_bysize;
	size_t pr_byrssize;
	int pr_argc;
	char	**pr_argv;
	char	**pr_envp;
	int pr_wstat;
	unsigned short pr_pctcpu;
	unsigned short pr_pctmem;
	uid_t pr_euid;
	gid_t pr_egid;
	id_t pr_aslwpid;
	char pr_dmodel;
	char pr_pad[3];
	int pr_filler[6];
  } prpsinfo_t;

#if _STRUCTURED_PROC == 0

typedef struct prrun
  {
	int pr_flags;
	sigset_t pr_trace;
	sigset_t pr_sighold;
	fltset_t pr_fault;
	caddr_t pr_vaddr;
	int pr_filler[8];
  } prrun_t;

#define	PRCSIG		0x001
#define	PRCFAULT	0x002
#define	PRSTRACE	0x004
#define	PRSHOLD		0x008
#define	PRSFAULT	0x010
#define	PRSVADDR	0x020
#define	PRSTEP		0x040
#define	PRSABORT	0x080
#define	PRSTOP		0x100

typedef struct prmap
  {
	caddr_t pr_vaddr;
	size_t pr_size;
	off_t pr_off;
	unsigned int pr_mflags;
	unsigned int pr_pagesize;
	long pr_filler[3];
  } prmap_t;

#define	MA_READ		0x04
#define	MA_WRITE	0x02
#define	MA_EXEC		0x01
#define	MA_SHARED	0x08
#define	MA_BREAK	0x10
#define	MA_STACK	0x20

typedef struct prcred
  {
	uid_t pr_euid;
	uid_t pr_ruid;
	uid_t pr_suid;
	gid_t pr_egid;
	gid_t pr_rgid;
	gid_t pr_sgid;
	unsigned int pr_ngroups;
  } prcred_t;

typedef struct prusage
  {
	id_t pr_lwpid;
	int pr_count;
	struct timespec pr_tstamp;
	struct timespec pr_create;
	struct timespec pr_term;
	struct timespec pr_rtime;
	struct timespec pr_utime;
	struct timespec pr_stime;
	struct timespec pr_ttime;
	struct timespec pr_tftime;
	struct timespec pr_dftime;
	struct timespec pr_kftime;
	struct timespec pr_ltime;
	struct timespec pr_slptime;
	struct timespec pr_wtime;
	struct timespec pr_stoptime;
	struct timespec	filltime[6];
	unsigned long pr_minf;
	unsigned long pr_majf;
	unsigned long pr_nswap;
	unsigned long pr_inblk;
	unsigned long pr_oublk;
	unsigned long pr_msnd;
	unsigned long pr_mrcv;
	unsigned long pr_sigs;
	unsigned long pr_vctx;
	unsigned long pr_ictx;
	unsigned long pr_sysc;
	unsigned long pr_ioch;
	unsigned long	filler[10];
  } prusage_t;

typedef struct prpageheader
  {
	struct timespec pr_tstamp;
	unsigned long pr_nmap;
	unsigned long pr_npage;
  } prpageheader_t;

typedef struct prasmap
  {
	caddr_t pr_vaddr;
	size_t pr_npage;
	off_t pr_off;
	unsigned int pr_mflags;
	unsigned int pr_pagesize;
	long pr_filler[3];
  } prasmap_t;

#define	PG_REFERENCED	0x02
#define	PG_MODIFIED	0x01
#define	PG_HWMAPPED	0x04

/* based on sig*set */

#define prfillset(set) \
	{ int __cnt = sizeof (*set) / sizeof (uint32_t); \
	while (--__cnt >= 0) ((uint32_t *)(set))[__cnt] = 0xFFFFFFFF; }

#define premptyset(set) \
	{ int __cnt = sizeof (*set) / sizeof (uint32_t); \
	while (--__cnt >= 0) ((uint32_t *)(set))[__cnt] = 0; }

#define __prmask(flag) \
  (((uint32_t) 1) << (((flag) - 1) % (8 * (int)sizeof (uint32_t))))

# define __prword(flag)	(((flag) - 1) / (8 * (int)sizeof (uint32_t)))

#define praddset(set, flag) \
    (((uint32_t *)(set))[__prword (flag)] |= __prmask (flag))

#define prdelset(set, flag) \
    (((uint32_t *)(set))[__prword (flag)] &= ~__prmask (flag))

#define prismember(set, flag) \
	((((uint32_t *)(set))[__prword (flag)] & __prmask (flag)) ? 1 : 0)

#endif /* _STRUCTURED_PROC == 0 */

#endif /* _SYS_OLD_PROCFS_H */