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 rusage32 {
64 struct timeval32 ru_utime;
65 struct timeval32 ru_stime;
66 int32_t ru_maxrss;
67 int32_t ru_ixrss;
68 int32_t ru_idrss;
69 int32_t ru_isrss;
70 int32_t ru_minflt;
71 int32_t ru_majflt;
72 int32_t ru_nswap;
73 int32_t ru_inblock;
74 int32_t ru_oublock;
75 int32_t ru_msgsnd;
76 int32_t ru_msgrcv;
77 int32_t ru_nsignals;
78 int32_t ru_nvcsw;
79 int32_t ru_nivcsw;
80 };
81
82 struct itimerval32 {
83 struct timeval32 it_interval;
84 struct timeval32 it_value;
85 };
86
87 #define FREEBSD4_MNAMELEN (88 - 2 * sizeof(int32_t)) /* size of on/from name bufs */
88
89 /* 4.x version */
90 struct statfs32 {
91 int32_t f_spare2;
92 int32_t f_bsize;
93 int32_t f_iosize;
94 int32_t f_blocks;
95 int32_t f_bfree;
96 int32_t f_bavail;
97 int32_t f_files;
98 int32_t f_ffree;
99 fsid_t f_fsid;
100 uid_t f_owner;
101 int32_t f_type;
102 int32_t f_flags;
103 int32_t f_syncwrites;
104 int32_t f_asyncwrites;
105 char f_fstypename[MFSNAMELEN];
106 char f_mntonname[FREEBSD4_MNAMELEN];
107 int32_t f_syncreads;
108 int32_t f_asyncreads;
109 int16_t f_spares1;
110 char f_mntfromname[FREEBSD4_MNAMELEN];
111 int16_t f_spares2 __packed;
112 int32_t f_spare[2];
113 };
114
115 struct kevent32 {
116 u_int32_t ident; /* identifier for this event */
117 short filter; /* filter for event */
118 u_short flags;
119 u_int fflags;
120 int32_t data;
121 u_int32_t udata; /* opaque user data identifier */
122 };
123
124 struct iovec32 {
125 u_int32_t iov_base;
126 int iov_len;
127 };
128
129 struct msghdr32 {
130 u_int32_t msg_name;
131 socklen_t msg_namelen;
132 u_int32_t msg_iov;
133 int msg_iovlen;
134 u_int32_t msg_control;
135 socklen_t msg_controllen;
136 int msg_flags;
137 };
138
139 struct stat32 {
140 dev_t st_dev;
141 ino_t st_ino;
142 mode_t st_mode;
143 nlink_t st_nlink;
144 uid_t st_uid;
145 gid_t st_gid;
146 dev_t st_rdev;
147 struct timespec32 st_atimespec;
148 struct timespec32 st_mtimespec;
149 struct timespec32 st_ctimespec;
150 off_t st_size;
151 int64_t st_blocks;
152 u_int32_t st_blksize;
153 u_int32_t st_flags;
154 u_int32_t st_gen;
155 int32_t st_lspare;
156 struct timespec32 st_birthtimespec;
157 unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec32));
158 unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec32));
159 };
160
161 struct ostat32 {
162 __uint16_t st_dev;
163 ino_t st_ino;
164 mode_t st_mode;
165 nlink_t st_nlink;
166 __uint16_t st_uid;
167 __uint16_t st_gid;
168 __uint16_t st_rdev;
169 __int32_t st_size;
170 struct timespec32 st_atim;
171 struct timespec32 st_mtim;
172 struct timespec32 st_ctim;
173 __int32_t st_blksize;
174 __int32_t st_blocks;
175 u_int32_t st_flags;
176 __uint32_t st_gen;
177 };
178
179 struct jail32_v0 {
180 u_int32_t version;
181 uint32_t path;
182 uint32_t hostname;
183 u_int32_t ip_number;
184 };
185
186 struct jail32 {
187 uint32_t version;
188 uint32_t path;
189 uint32_t hostname;
190 uint32_t jailname;
191 uint32_t ip4s;
192 uint32_t ip6s;
193 uint32_t ip4;
194 uint32_t ip6;
195 };
196
197 struct sigaction32 {
198 u_int32_t sa_u;
199 int sa_flags;
200 sigset_t sa_mask;
201 };
202
203 struct thr_param32 {
204 uint32_t start_func;
205 uint32_t arg;
206 uint32_t stack_base;
207 uint32_t stack_size;
208 uint32_t tls_base;
209 uint32_t tls_size;
210 uint32_t child_tid;
211 uint32_t parent_tid;
212 int32_t flags;
213 uint32_t rtp;
214 uint32_t spare[3];
215 };
216
217 struct i386_ldt_args32 {
218 uint32_t start;
219 uint32_t descs;
220 uint32_t num;
221 };
222
223 /*
224 * Alternative layouts for <sys/procfs.h>
225 */
226 struct prstatus32 {
227 int pr_version;
228 u_int pr_statussz;
229 u_int pr_gregsetsz;
230 u_int pr_fpregsetsz;
231 int pr_osreldate;
232 int pr_cursig;
233 pid_t pr_pid;
234 struct reg32 pr_reg;
235 };
236
237 struct prpsinfo32 {
238 int pr_version;
239 u_int pr_psinfosz;
240 char pr_fname[PRFNAMESZ+1];
241 char pr_psargs[PRARGSZ+1];
242 };
243
244 struct thrmisc32 {
245 char pr_tname[MAXCOMLEN+1];
246 u_int _pad;
247 };
248
249 struct mq_attr32 {
250 int mq_flags;
251 int mq_maxmsg;
252 int mq_msgsize;
253 int mq_curmsgs;
254 int __reserved[4];
255 };
256
257 struct kinfo_proc32 {
258 int ki_structsize;
259 int ki_layout;
260 uint32_t ki_args;
261 uint32_t ki_paddr;
262 uint32_t ki_addr;
263 uint32_t ki_tracep;
264 uint32_t ki_textvp;
265 uint32_t ki_fd;
266 uint32_t ki_vmspace;
267 uint32_t ki_wchan;
268 pid_t ki_pid;
269 pid_t ki_ppid;
270 pid_t ki_pgid;
271 pid_t ki_tpgid;
272 pid_t ki_sid;
273 pid_t ki_tsid;
274 short ki_jobc;
275 short ki_spare_short1;
276 dev_t ki_tdev;
277 sigset_t ki_siglist;
278 sigset_t ki_sigmask;
279 sigset_t ki_sigignore;
280 sigset_t ki_sigcatch;
281 uid_t ki_uid;
282 uid_t ki_ruid;
283 uid_t ki_svuid;
284 gid_t ki_rgid;
285 gid_t ki_svgid;
286 short ki_ngroups;
287 short ki_spare_short2;
288 gid_t ki_groups[KI_NGROUPS];
289 uint32_t ki_size;
290 int32_t ki_rssize;
291 int32_t ki_swrss;
292 int32_t ki_tsize;
293 int32_t ki_dsize;
294 int32_t ki_ssize;
295 u_short ki_xstat;
296 u_short ki_acflag;
297 fixpt_t ki_pctcpu;
298 u_int ki_estcpu;
299 u_int ki_slptime;
300 u_int ki_swtime;
301 u_int ki_cow;
302 u_int64_t ki_runtime;
303 struct timeval32 ki_start;
304 struct timeval32 ki_childtime;
305 int ki_flag;
306 int ki_kiflag;
307 int ki_traceflag;
308 char ki_stat;
309 signed char ki_nice;
310 char ki_lock;
311 char ki_rqindex;
312 u_char ki_oncpu;
313 u_char ki_lastcpu;
314 char ki_ocomm[OCOMMLEN+1];
315 char ki_wmesg[WMESGLEN+1];
316 char ki_login[LOGNAMELEN+1];
317 char ki_lockname[LOCKNAMELEN+1];
318 char ki_comm[COMMLEN+1];
319 char ki_emul[KI_EMULNAMELEN+1];
320 char ki_sparestrings[68];
321 int ki_spareints[KI_NSPARE_INT];
322 u_int ki_cr_flags;
323 int ki_jid;
324 int ki_numthreads;
325 lwpid_t ki_tid;
326 struct priority ki_pri;
327 struct rusage32 ki_rusage;
328 struct rusage32 ki_rusage_ch;
329 uint32_t ki_pcb;
330 uint32_t ki_kstack;
331 uint32_t ki_udata;
332 uint32_t ki_tdaddr;
333 uint32_t ki_spareptrs[KI_NSPARE_PTR]; /* spare room for growth */
334 int ki_sparelongs[KI_NSPARE_LONG];
335 int ki_sflag;
336 int ki_tdflags;
337 };
338
339 struct kld32_file_stat_1 {
340 int version; /* set to sizeof(struct kld_file_stat_1) */
341 char name[MAXPATHLEN];
342 int refs;
343 int id;
344 uint32_t address; /* load address */
345 uint32_t size; /* size in bytes */
346 };
347
348 struct kld32_file_stat {
349 int version; /* set to sizeof(struct kld_file_stat) */
350 char name[MAXPATHLEN];
351 int refs;
352 int id;
353 uint32_t address; /* load address */
354 uint32_t size; /* size in bytes */
355 char pathname[MAXPATHLEN];
356 };
357
358 #endif /* !_COMPAT_FREEBSD32_FREEBSD32_H_ */
Cache object: ce5c0a31af67f7b10fdb3c322555f264
|