]> CyberLeo.Net >> Repos - FreeBSD/releng/8.1.git/blob - sys/compat/freebsd32/freebsd32.h
Copy stable/8 to releng/8.1 in preparation for 8.1-RC1.
[FreeBSD/releng/8.1.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         u_int32_t tv_sec;
56         u_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         struct timespec32 st_birthtimespec;
156         unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec32));
157         unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec32));
158 };
159
160 struct jail32_v0 {
161         u_int32_t       version;
162         uint32_t        path;
163         uint32_t        hostname;
164         u_int32_t       ip_number;
165 };
166
167 struct jail32 {
168         uint32_t        version;
169         uint32_t        path;
170         uint32_t        hostname;
171         uint32_t        jailname;
172         uint32_t        ip4s;
173         uint32_t        ip6s;
174         uint32_t        ip4;
175         uint32_t        ip6;
176 };
177
178 struct sigaction32 {
179         u_int32_t       sa_u;
180         int             sa_flags;
181         sigset_t        sa_mask;
182 };
183
184 struct thr_param32 {
185         uint32_t start_func;
186         uint32_t arg;
187         uint32_t stack_base;
188         uint32_t stack_size;
189         uint32_t tls_base;
190         uint32_t tls_size;
191         uint32_t child_tid;
192         uint32_t parent_tid;
193         int32_t  flags;
194         uint32_t rtp;
195         uint32_t spare[3];
196 };
197
198 struct i386_ldt_args32 {
199         uint32_t start;
200         uint32_t descs;
201         uint32_t num;
202 };
203
204 /*
205  * Alternative layouts for <sys/procfs.h>
206  */
207 struct prstatus32 {
208         int     pr_version;
209         u_int   pr_statussz;
210         u_int   pr_gregsetsz;
211         u_int   pr_fpregsetsz;
212         int     pr_osreldate;
213         int     pr_cursig;
214         pid_t   pr_pid;
215         struct reg32 pr_reg;
216 };
217
218 struct prpsinfo32 {
219         int     pr_version;
220         u_int   pr_psinfosz;
221         char    pr_fname[PRFNAMESZ+1];
222         char    pr_psargs[PRARGSZ+1];
223 };
224
225 struct mq_attr32 {
226         int     mq_flags;
227         int     mq_maxmsg;
228         int     mq_msgsize;
229         int     mq_curmsgs;
230         int     __reserved[4];
231 };
232
233 struct kinfo_proc32 {
234         int     ki_structsize;
235         int     ki_layout;
236         uint32_t ki_args;
237         uint32_t ki_paddr;
238         uint32_t ki_addr;
239         uint32_t ki_tracep;
240         uint32_t ki_textvp;
241         uint32_t ki_fd;
242         uint32_t ki_vmspace;
243         uint32_t ki_wchan;
244         pid_t   ki_pid;
245         pid_t   ki_ppid;
246         pid_t   ki_pgid;
247         pid_t   ki_tpgid;
248         pid_t   ki_sid;
249         pid_t   ki_tsid;
250         short   ki_jobc;
251         short   ki_spare_short1;
252         dev_t   ki_tdev;
253         sigset_t ki_siglist;
254         sigset_t ki_sigmask;
255         sigset_t ki_sigignore;
256         sigset_t ki_sigcatch;
257         uid_t   ki_uid;
258         uid_t   ki_ruid;
259         uid_t   ki_svuid;
260         gid_t   ki_rgid;
261         gid_t   ki_svgid;
262         short   ki_ngroups;
263         short   ki_spare_short2;
264         gid_t   ki_groups[KI_NGROUPS];
265         uint32_t ki_size;
266         int32_t ki_rssize;
267         int32_t ki_swrss;
268         int32_t ki_tsize;
269         int32_t ki_dsize;
270         int32_t ki_ssize;
271         u_short ki_xstat;
272         u_short ki_acflag;
273         fixpt_t ki_pctcpu;
274         u_int   ki_estcpu;
275         u_int   ki_slptime;
276         u_int   ki_swtime;
277         int     ki_spareint1;
278         u_int64_t ki_runtime;
279         struct  timeval32 ki_start;
280         struct  timeval32 ki_childtime;
281         int     ki_flag;
282         int     ki_kiflag;
283         int     ki_traceflag;
284         char    ki_stat;
285         signed char ki_nice;
286         char    ki_lock;
287         char    ki_rqindex;
288         u_char  ki_oncpu;
289         u_char  ki_lastcpu;
290         char    ki_ocomm[OCOMMLEN+1];
291         char    ki_wmesg[WMESGLEN+1];
292         char    ki_login[LOGNAMELEN+1];
293         char    ki_lockname[LOCKNAMELEN+1];
294         char    ki_comm[COMMLEN+1];
295         char    ki_emul[KI_EMULNAMELEN+1];
296         char    ki_sparestrings[68];
297         int     ki_spareints[KI_NSPARE_INT];
298         u_int   ki_cr_flags;
299         int     ki_jid;
300         int     ki_numthreads;
301         lwpid_t ki_tid;
302         struct  priority ki_pri;
303         struct  rusage32 ki_rusage;
304         struct  rusage32 ki_rusage_ch;
305         uint32_t ki_pcb;
306         uint32_t ki_kstack;
307         uint32_t ki_udata;
308         uint32_t ki_spareptrs[KI_NSPARE_PTR];   /* spare room for growth */
309         int     ki_sparelongs[KI_NSPARE_LONG];
310         int     ki_sflag;
311         int     ki_tdflags;
312 };
313
314 #endif /* !_COMPAT_FREEBSD32_FREEBSD32_H_ */