]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/compat/freebsd32/freebsd32.h
Update our copy of DTS from the ones from Linux 4.14
[FreeBSD/FreeBSD.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 /*
46  * i386 is the only arch with a 32-bit time_t
47  */
48 #ifdef __amd64__
49 typedef int32_t time32_t;
50 #else
51 typedef int64_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 bintime32 {
82         time32_t sec;
83         uint32_t frac[2];
84 };
85 #define BT_CP(src, dst, fld) do {                               \
86         CP((src).fld, (dst).fld, sec);                          \
87         *(uint64_t *)&(dst).fld.frac[0] = (src).fld.frac;       \
88 } while (0)
89
90 struct rusage32 {
91         struct timeval32 ru_utime;
92         struct timeval32 ru_stime;
93         int32_t ru_maxrss;
94         int32_t ru_ixrss;
95         int32_t ru_idrss;
96         int32_t ru_isrss;
97         int32_t ru_minflt;
98         int32_t ru_majflt;
99         int32_t ru_nswap;
100         int32_t ru_inblock;
101         int32_t ru_oublock;
102         int32_t ru_msgsnd;
103         int32_t ru_msgrcv;
104         int32_t ru_nsignals;
105         int32_t ru_nvcsw;
106         int32_t ru_nivcsw;
107 };
108
109 struct wrusage32 {
110         struct rusage32 wru_self;
111         struct rusage32 wru_children;
112 };
113
114 struct itimerval32 {
115         struct timeval32 it_interval;
116         struct timeval32 it_value;
117 };
118
119 #define FREEBSD4_MFSNAMELEN     16
120 #define FREEBSD4_MNAMELEN       (88 - 2 * sizeof(int32_t))
121
122 /* 4.x version */
123 struct statfs32 {
124         int32_t f_spare2;
125         int32_t f_bsize;
126         int32_t f_iosize;
127         int32_t f_blocks;
128         int32_t f_bfree;
129         int32_t f_bavail;
130         int32_t f_files;
131         int32_t f_ffree;
132         fsid_t  f_fsid;
133         uid_t   f_owner;
134         int32_t f_type;
135         int32_t f_flags;
136         int32_t f_syncwrites;
137         int32_t f_asyncwrites;
138         char    f_fstypename[FREEBSD4_MFSNAMELEN];
139         char    f_mntonname[FREEBSD4_MNAMELEN];
140         int32_t f_syncreads;
141         int32_t f_asyncreads;
142         int16_t f_spares1;
143         char    f_mntfromname[FREEBSD4_MNAMELEN];
144         int16_t f_spares2 __packed;
145         int32_t f_spare[2];
146 };
147
148 struct kevent32 {
149         uint32_t        ident;          /* identifier for this event */
150         short           filter;         /* filter for event */
151         u_short         flags;
152         u_int           fflags;
153 #ifndef __amd64__
154         uint32_t        pad0;
155 #endif
156         int32_t         data1, data2;
157         uint32_t        udata;          /* opaque user data identifier */
158 #ifndef __amd64__
159         uint32_t        pad1;
160 #endif
161         uint32_t        ext64[8];
162 };
163
164 struct iovec32 {
165         u_int32_t iov_base;
166         int     iov_len;
167 };
168
169 struct msghdr32 {
170         u_int32_t        msg_name;
171         socklen_t        msg_namelen;
172         u_int32_t        msg_iov;
173         int              msg_iovlen;
174         u_int32_t        msg_control;
175         socklen_t        msg_controllen;
176         int              msg_flags;
177 };
178
179 #if defined(__amd64__)
180 #define __STAT32_TIME_T_EXT     1
181 #endif
182
183 struct stat32 {
184         dev_t st_dev;
185         ino_t st_ino;
186         nlink_t st_nlink;
187         mode_t  st_mode;
188         u_int16_t st_padding0;
189         uid_t   st_uid;
190         gid_t   st_gid;
191         u_int32_t st_padding1;
192         dev_t st_rdev;
193 #ifdef  __STAT32_TIME_T_EXT
194         __int32_t st_atim_ext;
195 #endif
196         struct timespec32 st_atim;
197 #ifdef  __STAT32_TIME_T_EXT
198         __int32_t st_mtim_ext;
199 #endif
200         struct timespec32 st_mtim;
201 #ifdef  __STAT32_TIME_T_EXT
202         __int32_t st_ctim_ext;
203 #endif
204         struct timespec32 st_ctim;
205 #ifdef  __STAT32_TIME_T_EXT
206         __int32_t st_btim_ext;
207 #endif
208         struct timespec32 st_birthtim;
209         off_t   st_size;
210         int64_t st_blocks;
211         u_int32_t st_blksize;
212         u_int32_t st_flags;
213         u_int64_t st_gen;
214         u_int64_t st_spare[10];
215 };
216 struct freebsd11_stat32 {
217         u_int32_t st_dev;
218         u_int32_t st_ino;
219         mode_t  st_mode;
220         u_int16_t st_nlink;
221         uid_t   st_uid;
222         gid_t   st_gid;
223         u_int32_t st_rdev;
224         struct timespec32 st_atim;
225         struct timespec32 st_mtim;
226         struct timespec32 st_ctim;
227         off_t   st_size;
228         int64_t st_blocks;
229         u_int32_t st_blksize;
230         u_int32_t st_flags;
231         u_int32_t st_gen;
232         int32_t st_lspare;
233         struct timespec32 st_birthtim;
234         unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec32));
235         unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec32));
236 };
237
238 struct ostat32 {
239         __uint16_t st_dev;
240         __uint32_t st_ino;
241         mode_t  st_mode;
242         __uint16_t st_nlink;
243         __uint16_t st_uid;
244         __uint16_t st_gid;
245         __uint16_t st_rdev;
246         __int32_t st_size;
247         struct timespec32 st_atim;
248         struct timespec32 st_mtim;
249         struct timespec32 st_ctim;
250         __int32_t st_blksize;
251         __int32_t st_blocks;
252         u_int32_t st_flags;
253         __uint32_t st_gen;
254 };
255
256 struct jail32_v0 {
257         u_int32_t       version;
258         uint32_t        path;
259         uint32_t        hostname;
260         u_int32_t       ip_number;
261 };
262
263 struct jail32 {
264         uint32_t        version;
265         uint32_t        path;
266         uint32_t        hostname;
267         uint32_t        jailname;
268         uint32_t        ip4s;
269         uint32_t        ip6s;
270         uint32_t        ip4;
271         uint32_t        ip6;
272 };
273
274 struct sigaction32 {
275         u_int32_t       sa_u;
276         int             sa_flags;
277         sigset_t        sa_mask;
278 };
279
280 struct thr_param32 {
281         uint32_t start_func;
282         uint32_t arg;
283         uint32_t stack_base;
284         uint32_t stack_size;
285         uint32_t tls_base;
286         uint32_t tls_size;
287         uint32_t child_tid;
288         uint32_t parent_tid;
289         int32_t  flags;
290         uint32_t rtp;
291         uint32_t spare[3];
292 };
293
294 struct i386_ldt_args32 {
295         uint32_t start;
296         uint32_t descs;
297         uint32_t num;
298 };
299
300 struct mq_attr32 {
301         int     mq_flags;
302         int     mq_maxmsg;
303         int     mq_msgsize;
304         int     mq_curmsgs;
305         int     __reserved[4];
306 };
307
308 struct kinfo_proc32 {
309         int     ki_structsize;
310         int     ki_layout;
311         uint32_t ki_args;
312         uint32_t ki_paddr;
313         uint32_t ki_addr;
314         uint32_t ki_tracep;
315         uint32_t ki_textvp;
316         uint32_t ki_fd;
317         uint32_t ki_vmspace;
318         uint32_t ki_wchan;
319         pid_t   ki_pid;
320         pid_t   ki_ppid;
321         pid_t   ki_pgid;
322         pid_t   ki_tpgid;
323         pid_t   ki_sid;
324         pid_t   ki_tsid;
325         short   ki_jobc;
326         short   ki_spare_short1;
327         uint32_t ki_tdev_freebsd11;
328         sigset_t ki_siglist;
329         sigset_t ki_sigmask;
330         sigset_t ki_sigignore;
331         sigset_t ki_sigcatch;
332         uid_t   ki_uid;
333         uid_t   ki_ruid;
334         uid_t   ki_svuid;
335         gid_t   ki_rgid;
336         gid_t   ki_svgid;
337         short   ki_ngroups;
338         short   ki_spare_short2;
339         gid_t   ki_groups[KI_NGROUPS];
340         uint32_t ki_size;
341         int32_t ki_rssize;
342         int32_t ki_swrss;
343         int32_t ki_tsize;
344         int32_t ki_dsize;
345         int32_t ki_ssize;
346         u_short ki_xstat;
347         u_short ki_acflag;
348         fixpt_t ki_pctcpu;
349         u_int   ki_estcpu;
350         u_int   ki_slptime;
351         u_int   ki_swtime;
352         u_int   ki_cow;
353         u_int64_t ki_runtime;
354         struct  timeval32 ki_start;
355         struct  timeval32 ki_childtime;
356         int     ki_flag;
357         int     ki_kiflag;
358         int     ki_traceflag;
359         char    ki_stat;
360         signed char ki_nice;
361         char    ki_lock;
362         char    ki_rqindex;
363         u_char  ki_oncpu_old;
364         u_char  ki_lastcpu_old;
365         char    ki_tdname[TDNAMLEN+1];
366         char    ki_wmesg[WMESGLEN+1];
367         char    ki_login[LOGNAMELEN+1];
368         char    ki_lockname[LOCKNAMELEN+1];
369         char    ki_comm[COMMLEN+1];
370         char    ki_emul[KI_EMULNAMELEN+1];
371         char    ki_loginclass[LOGINCLASSLEN+1];
372         char    ki_moretdname[MAXCOMLEN-TDNAMLEN+1];
373         char    ki_sparestrings[46];
374         int     ki_spareints[KI_NSPARE_INT];
375         uint64_t ki_tdev;
376         int     ki_oncpu;
377         int     ki_lastcpu;
378         int     ki_tracer;
379         int     ki_flag2;
380         int     ki_fibnum;
381         u_int   ki_cr_flags;
382         int     ki_jid;
383         int     ki_numthreads;
384         lwpid_t ki_tid;
385         struct  priority ki_pri;
386         struct  rusage32 ki_rusage;
387         struct  rusage32 ki_rusage_ch;
388         uint32_t ki_pcb;
389         uint32_t ki_kstack;
390         uint32_t ki_udata;
391         uint32_t ki_tdaddr;
392         uint32_t ki_spareptrs[KI_NSPARE_PTR];   /* spare room for growth */
393         int     ki_sparelongs[KI_NSPARE_LONG];
394         int     ki_sflag;
395         int     ki_tdflags;
396 };
397
398 struct kinfo_sigtramp32 {
399         uint32_t ksigtramp_start;
400         uint32_t ksigtramp_end;
401         uint32_t ksigtramp_spare[4];
402 };
403
404 struct kld32_file_stat_1 {
405         int     version;        /* set to sizeof(struct kld_file_stat_1) */
406         char    name[MAXPATHLEN];
407         int     refs;
408         int     id;
409         uint32_t address;       /* load address */
410         uint32_t size;          /* size in bytes */
411 };
412
413 struct kld32_file_stat {
414         int     version;        /* set to sizeof(struct kld_file_stat) */
415         char    name[MAXPATHLEN];
416         int     refs;
417         int     id;
418         uint32_t address;       /* load address */
419         uint32_t size;          /* size in bytes */
420         char    pathname[MAXPATHLEN];
421 };
422
423 struct procctl_reaper_pids32 {
424         u_int   rp_count;
425         u_int   rp_pad0[15];
426         uint32_t rp_pids;
427 };
428
429 #endif /* !_COMPAT_FREEBSD32_FREEBSD32_H_ */