1 /*-
2 * Copyright (c) 2001 Doug Rabson
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD$
27 */
28
29 #ifndef _COMPAT_FREEBSD32_FREEBSD32_H_
30 #define _COMPAT_FREEBSD32_FREEBSD32_H_
31
32 #include <sys/procfs.h>
33 #include <sys/socket.h>
34 #include <sys/user.h>
35
36 #define PTRIN(v) (void *)(uintptr_t) (v)
37 #define PTROUT(v) (u_int32_t)(uintptr_t) (v)
38
39 #define CP(src,dst,fld) do { (dst).fld = (src).fld; } while (0)
40 #define PTRIN_CP(src,dst,fld) \
41 do { (dst).fld = PTRIN((src).fld); } while (0)
42 #define PTROUT_CP(src,dst,fld) \
43 do { (dst).fld = PTROUT((src).fld); } while (0)
44
45 struct timeval32 {
46 int32_t tv_sec;
47 int32_t tv_usec;
48 };
49 #define TV_CP(src,dst,fld) do { \
50 CP((src).fld,(dst).fld,tv_sec); \
51 CP((src).fld,(dst).fld,tv_usec); \
52 } while (0)
53
54 struct timespec32 {
55 int32_t tv_sec;
56 int32_t tv_nsec;
57 };
58 #define TS_CP(src,dst,fld) do { \
59 CP((src).fld,(dst).fld,tv_sec); \
60 CP((src).fld,(dst).fld,tv_nsec); \
61 } while (0)
62
63 struct itimerspec32 {
64 struct timespec32 it_interval;
65 struct timespec32 it_value;
66 };
67 #define ITS_CP(src, dst) do { \
68 TS_CP((src), (dst), it_interval); \
69 TS_CP((src), (dst), it_value); \
70 } while (0)
71
72 struct rusage32 {
73 struct timeval32 ru_utime;
74 struct timeval32 ru_stime;
75 int32_t ru_maxrss;
76 int32_t ru_ixrss;
77 int32_t ru_idrss;
78 int32_t ru_isrss;
79 int32_t ru_minflt;
80 int32_t ru_majflt;
81 int32_t ru_nswap;
82 int32_t ru_inblock;
83 int32_t ru_oublock;
84 int32_t ru_msgsnd;
85 int32_t ru_msgrcv;
86 int32_t ru_nsignals;
87 int32_t ru_nvcsw;
88 int32_t ru_nivcsw;
89 };
90
91 struct wrusage32 {
92 struct rusage32 wru_self;
93 struct rusage32 wru_children;
94 };
95
96 struct itimerval32 {
97 struct timeval32 it_interval;
98 struct timeval32 it_value;
99 };
100
101 #define FREEBSD4_MNAMELEN (88 - 2 * sizeof(int32_t)) /* size of on/from name bufs */
102
103 /* 4.x version */
104 struct statfs32 {
105 int32_t f_spare2;
106 int32_t f_bsize;
107 int32_t f_iosize;
108 int32_t f_blocks;
109 int32_t f_bfree;
110 int32_t f_bavail;
111 int32_t f_files;
112 int32_t f_ffree;
113 fsid_t f_fsid;
114 uid_t f_owner;
115 int32_t f_type;
116 int32_t f_flags;
117 int32_t f_syncwrites;
118 int32_t f_asyncwrites;
119 char f_fstypename[MFSNAMELEN];
120 char f_mntonname[FREEBSD4_MNAMELEN];
121 int32_t f_syncreads;
122 int32_t f_asyncreads;
123 int16_t f_spares1;
124 char f_mntfromname[FREEBSD4_MNAMELEN];
125 int16_t f_spares2 __packed;
126 int32_t f_spare[2];
127 };
128
129 struct kevent32 {
130 u_int32_t ident; /* identifier for this event */
131 short filter; /* filter for event */
132 u_short flags;
133 u_int fflags;
134 int32_t data;
135 u_int32_t udata; /* opaque user data identifier */
136 };
137
138 struct iovec32 {
139 u_int32_t iov_base;
140 int iov_len;
141 };
142
143 struct msghdr32 {
144 u_int32_t msg_name;
145 socklen_t msg_namelen;
146 u_int32_t msg_iov;
147 int msg_iovlen;
148 u_int32_t msg_control;
149 socklen_t msg_controllen;
150 int msg_flags;
151 };
152
153 struct stat32 {
154 dev_t st_dev;
155 ino_t st_ino;
156 mode_t st_mode;
157 nlink_t st_nlink;
158 uid_t st_uid;
159 gid_t st_gid;
160 dev_t st_rdev;
161 struct timespec32 st_atim;
162 struct timespec32 st_mtim;
163 struct timespec32 st_ctim;
164 off_t st_size;
165 int64_t st_blocks;
166 u_int32_t st_blksize;
167 u_int32_t st_flags;
168 u_int32_t st_gen;
169 int32_t st_lspare;
170 struct timespec32 st_birthtim;
171 unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec32));
172 unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec32));
173 };
174
175 struct ostat32 {
176 __uint16_t st_dev;
177 ino_t st_ino;
178 mode_t st_mode;
179 nlink_t st_nlink;
180 __uint16_t st_uid;
181 __uint16_t st_gid;
182 __uint16_t st_rdev;
183 __int32_t st_size;
184 struct timespec32 st_atim;
185 struct timespec32 st_mtim;
186 struct timespec32 st_ctim;
187 __int32_t st_blksize;
188 __int32_t st_blocks;
189 u_int32_t st_flags;
190 __uint32_t st_gen;
191 };
192
193 struct jail32_v0 {
194 u_int32_t version;
195 uint32_t path;
196 uint32_t hostname;
197 u_int32_t ip_number;
198 };
199
200 struct jail32 {
201 uint32_t version;
202 uint32_t path;
203 uint32_t hostname;
204 uint32_t jailname;
205 uint32_t ip4s;
206 uint32_t ip6s;
207 uint32_t ip4;
208 uint32_t ip6;
209 };
210
211 struct sigaction32 {
212 u_int32_t sa_u;
213 int sa_flags;
214 sigset_t sa_mask;
215 };
216
217 struct thr_param32 {
218 uint32_t start_func;
219 uint32_t arg;
220 uint32_t stack_base;
221 uint32_t stack_size;
222 uint32_t tls_base;
223 uint32_t tls_size;
224 uint32_t child_tid;
225 uint32_t parent_tid;
226 int32_t flags;
227 uint32_t rtp;
228 uint32_t spare[3];
229 };
230
231 struct i386_ldt_args32 {
232 uint32_t start;
233 uint32_t descs;
234 uint32_t num;
235 };
236
237 /*
238 * Alternative layouts for <sys/procfs.h>
239 */
240 struct prstatus32 {
241 int pr_version;
242 u_int pr_statussz;
243 u_int pr_gregsetsz;
244 u_int pr_fpregsetsz;
245 int pr_osreldate;
246 int pr_cursig;
247 pid_t pr_pid;
248 struct reg32 pr_reg;
249 };
250
251 struct prpsinfo32 {
252 int pr_version;
253 u_int pr_psinfosz;
254 char pr_fname[PRFNAMESZ+1];
255 char pr_psargs[PRARGSZ+1];
256 };
257
258 struct thrmisc32 {
259 char pr_tname[MAXCOMLEN+1];
260 u_int _pad;
261 };
262
263 struct mq_attr32 {
264 int mq_flags;
265 int mq_maxmsg;
266 int mq_msgsize;
267 int mq_curmsgs;
268 int __reserved[4];
269 };
270
271 struct kinfo_proc32 {
272 int ki_structsize;
273 int ki_layout;
274 uint32_t ki_args;
275 uint32_t ki_paddr;
276 uint32_t ki_addr;
277 uint32_t ki_tracep;
278 uint32_t ki_textvp;
279 uint32_t ki_fd;
280 uint32_t ki_vmspace;
281 uint32_t ki_wchan;
282 pid_t ki_pid;
283 pid_t ki_ppid;
284 pid_t ki_pgid;
285 pid_t ki_tpgid;
286 pid_t ki_sid;
287 pid_t ki_tsid;
288 short ki_jobc;
289 short ki_spare_short1;
290 dev_t ki_tdev;
291 sigset_t ki_siglist;
292 sigset_t ki_sigmask;
293 sigset_t ki_sigignore;
294 sigset_t ki_sigcatch;
295 uid_t ki_uid;
296 uid_t ki_ruid;
297 uid_t ki_svuid;
298 gid_t ki_rgid;
299 gid_t ki_svgid;
300 short ki_ngroups;
301 short ki_spare_short2;
302 gid_t ki_groups[KI_NGROUPS];
303 uint32_t ki_size;
304 int32_t ki_rssize;
305 int32_t ki_swrss;
306 int32_t ki_tsize;
307 int32_t ki_dsize;
308 int32_t ki_ssize;
309 u_short ki_xstat;
310 u_short ki_acflag;
311 fixpt_t ki_pctcpu;
312 u_int ki_estcpu;
313 u_int ki_slptime;
314 u_int ki_swtime;
315 u_int ki_cow;
316 u_int64_t ki_runtime;
317 struct timeval32 ki_start;
318 struct timeval32 ki_childtime;
319 int ki_flag;
320 int ki_kiflag;
321 int ki_traceflag;
322 char ki_stat;
323 signed char ki_nice;
324 char ki_lock;
325 char ki_rqindex;
326 u_char ki_oncpu;
327 u_char ki_lastcpu;
328 char ki_tdname[TDNAMLEN+1];
329 char ki_wmesg[WMESGLEN+1];
330 char ki_login[LOGNAMELEN+1];
331 char ki_lockname[LOCKNAMELEN+1];
332 char ki_comm[COMMLEN+1];
333 char ki_emul[KI_EMULNAMELEN+1];
334 char ki_loginclass[LOGINCLASSLEN+1];
335 char ki_sparestrings[50];
336 int ki_spareints[KI_NSPARE_INT];
337 int ki_flag2;
338 int ki_fibnum;
339 u_int ki_cr_flags;
340 int ki_jid;
341 int ki_numthreads;
342 lwpid_t ki_tid;
343 struct priority ki_pri;
344 struct rusage32 ki_rusage;
345 struct rusage32 ki_rusage_ch;
346 uint32_t ki_pcb;
347 uint32_t ki_kstack;
348 uint32_t ki_udata;
349 uint32_t ki_tdaddr;
350 uint32_t ki_spareptrs[KI_NSPARE_PTR]; /* spare room for growth */
351 int ki_sparelongs[KI_NSPARE_LONG];
352 int ki_sflag;
353 int ki_tdflags;
354 };
355
356 struct kinfo_sigtramp32 {
357 uint32_t ksigtramp_start;
358 uint32_t ksigtramp_end;
359 uint32_t ksigtramp_spare[4];
360 };
361
362 struct kld32_file_stat_1 {
363 int version; /* set to sizeof(struct kld_file_stat_1) */
364 char name[MAXPATHLEN];
365 int refs;
366 int id;
367 uint32_t address; /* load address */
368 uint32_t size; /* size in bytes */
369 };
370
371 struct kld32_file_stat {
372 int version; /* set to sizeof(struct kld_file_stat) */
373 char name[MAXPATHLEN];
374 int refs;
375 int id;
376 uint32_t address; /* load address */
377 uint32_t size; /* size in bytes */
378 char pathname[MAXPATHLEN];
379 };
380
381 #endif /* !_COMPAT_FREEBSD32_FREEBSD32_H_ */
Cache object: 5f1997fc74aeebbd307ff8fac95b7c2f
|