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