2 * SPDX-License-Identifier: BSD-2-Clause
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
29 #ifndef _COMPAT_FREEBSD32_FREEBSD32_H_
30 #define _COMPAT_FREEBSD32_FREEBSD32_H_
32 #include <sys/abi_compat.h>
33 #include <sys/procfs.h>
34 #include <sys/socket.h>
36 #include <sys/_ffcounter.h>
39 * i386 is the only arch with a 32-bit time_t
42 typedef int32_t time32_t;
44 typedef int64_t time32_t;
58 struct timespec32 it_interval;
59 struct timespec32 it_value;
67 struct ffclock_estimate32 {
68 struct bintime32 update_time;
69 ffcounter update_ffcount;
70 ffcounter leapsec_next;
75 int16_t leapsec_total;
79 #if defined(__amd64__)
80 __attribute__((packed))
83 #if defined(__amd64__)
84 _Static_assert(sizeof(struct ffclock_estimate32) == 52, "ffclock_estimate32 size");
86 _Static_assert(sizeof(struct ffclock_estimate32) == 56, "ffclock_estimate32 size");
90 struct timeval32 ru_utime;
91 struct timeval32 ru_stime;
109 struct rusage32 wru_self;
110 struct rusage32 wru_children;
114 struct timeval32 it_interval;
115 struct timeval32 it_value;
119 struct timespec32 _timeout;
124 struct umtx_robust_lists_params_compat32 {
125 uint32_t robust_list_offset;
126 uint32_t robust_priv_list_offset;
127 uint32_t robust_inact_offset;
131 volatile __lwpid_t m_owner; /* Owner of the mutex */
132 __uint32_t m_flags; /* Flags of the mutex */
133 __uint32_t m_ceilings[2]; /* Priority protect ceiling */
134 __uint32_t m_rb_lnk; /* Robust linkage */
136 __uint32_t m_spare[2];
139 #define FREEBSD4_OMFSNAMELEN 16
140 #define FREEBSD4_OMNAMELEN (88 - 2 * sizeof(int32_t))
156 int32_t f_syncwrites;
157 int32_t f_asyncwrites;
158 char f_fstypename[FREEBSD4_OMFSNAMELEN];
159 char f_mntonname[FREEBSD4_OMNAMELEN];
161 int32_t f_asyncreads;
163 char f_mntfromname[FREEBSD4_OMNAMELEN];
164 int16_t f_spares2 __packed;
169 __uint32_t st_dev; /* inode's device */
170 __uint32_t st_ino; /* inode's number */
171 __uint32_t st_mode; /* inode protection mode */
172 __uint32_t st_nlink; /* number of hard links */
173 uid_t st_uid; /* user ID of the file's owner */
174 gid_t st_gid; /* group ID of the file's group */
175 __uint32_t st_rdev; /* device type */
176 struct timespec32 st_atim; /* time of last access */
177 struct timespec32 st_mtim; /* time of last data modification */
178 struct timespec32 st_ctim; /* time of last file status change */
179 off_t st_size; /* file size, in bytes */
180 blkcnt_t st_blocks; /* blocks allocated for file */
181 blksize_t st_blksize; /* optimal blocksize for I/O */
182 fflags_t st_flags; /* user defined flags for file */
183 __uint32_t st_gen; /* file generation number */
184 struct timespec32 st_birthtim; /* time of file creation */
186 * See comment in the definition of struct freebsd11_stat
187 * in sys/stat.h about the following padding.
189 unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec32));
190 unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec32));
200 socklen_t msg_namelen;
203 uint32_t msg_control;
204 socklen_t msg_controllen;
208 #if defined(__amd64__)
209 #define __STAT32_TIME_T_EXT 1
217 uint16_t st_padding0;
220 uint32_t st_padding1;
222 #ifdef __STAT32_TIME_T_EXT
223 __int32_t st_atim_ext;
225 struct timespec32 st_atim;
226 #ifdef __STAT32_TIME_T_EXT
227 __int32_t st_mtim_ext;
229 struct timespec32 st_mtim;
230 #ifdef __STAT32_TIME_T_EXT
231 __int32_t st_ctim_ext;
233 struct timespec32 st_ctim;
234 #ifdef __STAT32_TIME_T_EXT
235 __int32_t st_btim_ext;
237 struct timespec32 st_birthtim;
243 uint64_t st_spare[10];
245 struct freebsd11_stat32 {
253 struct timespec32 st_atim;
254 struct timespec32 st_mtim;
255 struct timespec32 st_ctim;
262 struct timespec32 st_birthtim;
263 unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec32));
264 unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec32));
276 struct timespec32 st_atim;
277 struct timespec32 st_mtim;
278 struct timespec32 st_ctim;
279 __int32_t st_blksize;
323 struct i386_ldt_args32 {
337 struct kinfo_proc32 {
355 short ki_spare_short1;
356 uint32_t ki_tdev_freebsd11;
359 sigset_t ki_sigignore;
360 sigset_t ki_sigcatch;
367 short ki_spare_short2;
368 gid_t ki_groups[KI_NGROUPS];
383 struct timeval32 ki_start;
384 struct timeval32 ki_childtime;
393 u_char ki_lastcpu_old;
394 char ki_tdname[TDNAMLEN+1];
395 char ki_wmesg[WMESGLEN+1];
396 char ki_login[LOGNAMELEN+1];
397 char ki_lockname[LOCKNAMELEN+1];
398 char ki_comm[COMMLEN+1];
399 char ki_emul[KI_EMULNAMELEN+1];
400 char ki_loginclass[LOGINCLASSLEN+1];
401 char ki_moretdname[MAXCOMLEN-TDNAMLEN+1];
402 char ki_sparestrings[46];
403 int ki_spareints[KI_NSPARE_INT];
414 struct priority ki_pri;
415 struct rusage32 ki_rusage;
416 struct rusage32 ki_rusage_ch;
421 uint32_t ki_spareptrs[KI_NSPARE_PTR]; /* spare room for growth */
422 int ki_sparelongs[KI_NSPARE_LONG];
427 struct kinfo_sigtramp32 {
428 uint32_t ksigtramp_start;
429 uint32_t ksigtramp_end;
430 uint32_t ksigtramp_spare[4];
433 struct kinfo_vm_layout32 {
434 uint32_t kvm_min_user_addr;
435 uint32_t kvm_max_user_addr;
436 uint32_t kvm_text_addr;
437 uint32_t kvm_text_size;
438 uint32_t kvm_data_addr;
439 uint32_t kvm_data_size;
440 uint32_t kvm_stack_addr;
441 uint32_t kvm_stack_size;
443 uint32_t kvm_shp_addr;
444 uint32_t kvm_shp_size;
445 uint32_t kvm_spare[12];
448 struct kld_file_stat_1_32 {
449 int version; /* set to sizeof(struct kld_file_stat_1) */
450 char name[MAXPATHLEN];
453 uint32_t address; /* load address */
454 uint32_t size; /* size in bytes */
457 struct kld_file_stat32 {
458 int version; /* set to sizeof(struct kld_file_stat) */
459 char name[MAXPATHLEN];
462 uint32_t address; /* load address */
463 uint32_t size; /* size in bytes */
464 char pathname[MAXPATHLEN];
467 struct procctl_reaper_pids32 {
493 struct ptrace_sc_ret32 {
494 uint32_t sr_retval[2];
498 struct ptrace_coredump32 {
501 uint32_t pc_limit1, pc_limit2;
504 struct ptrace_sc_remote32 {
505 struct ptrace_sc_ret32 pscr_ret;
511 #endif /* !_COMPAT_FREEBSD32_FREEBSD32_H_ */