2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
4 * Copyright (c) 2001 Doug Rabson
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 #ifndef _COMPAT_FREEBSD32_FREEBSD32_H_
32 #define _COMPAT_FREEBSD32_FREEBSD32_H_
34 #include <sys/procfs.h>
35 #include <sys/socket.h>
38 #define PTRIN(v) (void *)(uintptr_t) (v)
39 #define PTROUT(v) (u_int32_t)(uintptr_t) (v)
41 #define CP(src,dst,fld) do { (dst).fld = (src).fld; } while (0)
42 #define PTRIN_CP(src,dst,fld) \
43 do { (dst).fld = PTRIN((src).fld); } while (0)
44 #define PTROUT_CP(src,dst,fld) \
45 do { (dst).fld = PTROUT((src).fld); } while (0)
48 * i386 is the only arch with a 32-bit time_t
51 typedef int32_t time32_t;
53 typedef int64_t time32_t;
60 #define TV_CP(src,dst,fld) do { \
61 CP((src).fld,(dst).fld,tv_sec); \
62 CP((src).fld,(dst).fld,tv_usec); \
69 #define TS_CP(src,dst,fld) do { \
70 CP((src).fld,(dst).fld,tv_sec); \
71 CP((src).fld,(dst).fld,tv_nsec); \
75 struct timespec32 it_interval;
76 struct timespec32 it_value;
78 #define ITS_CP(src, dst) do { \
79 TS_CP((src), (dst), it_interval); \
80 TS_CP((src), (dst), it_value); \
87 #define BT_CP(src, dst, fld) do { \
88 CP((src).fld, (dst).fld, sec); \
89 *(uint64_t *)&(dst).fld.frac[0] = (src).fld.frac; \
93 struct timeval32 ru_utime;
94 struct timeval32 ru_stime;
112 struct rusage32 wru_self;
113 struct rusage32 wru_children;
117 struct timeval32 it_interval;
118 struct timeval32 it_value;
121 #define FREEBSD4_MFSNAMELEN 16
122 #define FREEBSD4_MNAMELEN (88 - 2 * sizeof(int32_t))
138 int32_t f_syncwrites;
139 int32_t f_asyncwrites;
140 char f_fstypename[FREEBSD4_MFSNAMELEN];
141 char f_mntonname[FREEBSD4_MNAMELEN];
143 int32_t f_asyncreads;
145 char f_mntfromname[FREEBSD4_MNAMELEN];
146 int16_t f_spares2 __packed;
157 socklen_t msg_namelen;
160 u_int32_t msg_control;
161 socklen_t msg_controllen;
165 #if defined(__amd64__)
166 #define __STAT32_TIME_T_EXT 1
174 u_int16_t st_padding0;
177 u_int32_t st_padding1;
179 #ifdef __STAT32_TIME_T_EXT
180 __int32_t st_atim_ext;
182 struct timespec32 st_atim;
183 #ifdef __STAT32_TIME_T_EXT
184 __int32_t st_mtim_ext;
186 struct timespec32 st_mtim;
187 #ifdef __STAT32_TIME_T_EXT
188 __int32_t st_ctim_ext;
190 struct timespec32 st_ctim;
191 #ifdef __STAT32_TIME_T_EXT
192 __int32_t st_btim_ext;
194 struct timespec32 st_birthtim;
197 u_int32_t st_blksize;
200 u_int64_t st_spare[10];
202 struct freebsd11_stat32 {
210 struct timespec32 st_atim;
211 struct timespec32 st_mtim;
212 struct timespec32 st_ctim;
215 u_int32_t st_blksize;
219 struct timespec32 st_birthtim;
220 unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec32));
221 unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec32));
233 struct timespec32 st_atim;
234 struct timespec32 st_mtim;
235 struct timespec32 st_ctim;
236 __int32_t st_blksize;
280 struct i386_ldt_args32 {
294 struct kinfo_proc32 {
312 short ki_spare_short1;
313 uint32_t ki_tdev_freebsd11;
316 sigset_t ki_sigignore;
317 sigset_t ki_sigcatch;
324 short ki_spare_short2;
325 gid_t ki_groups[KI_NGROUPS];
339 u_int64_t ki_runtime;
340 struct timeval32 ki_start;
341 struct timeval32 ki_childtime;
350 u_char ki_lastcpu_old;
351 char ki_tdname[TDNAMLEN+1];
352 char ki_wmesg[WMESGLEN+1];
353 char ki_login[LOGNAMELEN+1];
354 char ki_lockname[LOCKNAMELEN+1];
355 char ki_comm[COMMLEN+1];
356 char ki_emul[KI_EMULNAMELEN+1];
357 char ki_loginclass[LOGINCLASSLEN+1];
358 char ki_moretdname[MAXCOMLEN-TDNAMLEN+1];
359 char ki_sparestrings[46];
360 int ki_spareints[KI_NSPARE_INT];
371 struct priority ki_pri;
372 struct rusage32 ki_rusage;
373 struct rusage32 ki_rusage_ch;
378 uint32_t ki_spareptrs[KI_NSPARE_PTR]; /* spare room for growth */
379 int ki_sparelongs[KI_NSPARE_LONG];
384 struct kinfo_sigtramp32 {
385 uint32_t ksigtramp_start;
386 uint32_t ksigtramp_end;
387 uint32_t ksigtramp_spare[4];
390 struct kld32_file_stat_1 {
391 int version; /* set to sizeof(struct kld_file_stat_1) */
392 char name[MAXPATHLEN];
395 uint32_t address; /* load address */
396 uint32_t size; /* size in bytes */
399 struct kld32_file_stat {
400 int version; /* set to sizeof(struct kld_file_stat) */
401 char name[MAXPATHLEN];
404 uint32_t address; /* load address */
405 uint32_t size; /* size in bytes */
406 char pathname[MAXPATHLEN];
409 struct procctl_reaper_pids32 {
415 #endif /* !_COMPAT_FREEBSD32_FREEBSD32_H_ */