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