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/abi_compat.h>
35 #include <sys/procfs.h>
36 #include <sys/socket.h>
38 #include <sys/_ffcounter.h>
41 * i386 is the only arch with a 32-bit time_t
44 typedef int32_t time32_t;
46 typedef int64_t time32_t;
60 struct timespec32 it_interval;
61 struct timespec32 it_value;
69 struct ffclock_estimate32 {
70 struct bintime32 update_time;
71 ffcounter update_ffcount;
72 ffcounter leapsec_next;
77 int16_t leapsec_total;
81 #if defined(__amd64__)
82 __attribute__((packed))
85 #if defined(__amd64__)
86 _Static_assert(sizeof(struct ffclock_estimate32) == 52, "ffclock_estimate32 size");
88 _Static_assert(sizeof(struct ffclock_estimate32) == 56, "ffclock_estimate32 size");
92 struct timeval32 ru_utime;
93 struct timeval32 ru_stime;
111 struct rusage32 wru_self;
112 struct rusage32 wru_children;
116 struct timeval32 it_interval;
117 struct timeval32 it_value;
121 struct timespec32 _timeout;
126 struct umtx_robust_lists_params_compat32 {
127 uint32_t robust_list_offset;
128 uint32_t robust_priv_list_offset;
129 uint32_t robust_inact_offset;
133 volatile __lwpid_t m_owner; /* Owner of the mutex */
134 __uint32_t m_flags; /* Flags of the mutex */
135 __uint32_t m_ceilings[2]; /* Priority protect ceiling */
136 __uint32_t m_rb_lnk; /* Robust linkage */
138 __uint32_t m_spare[2];
141 #define FREEBSD4_OMFSNAMELEN 16
142 #define FREEBSD4_OMNAMELEN (88 - 2 * sizeof(int32_t))
158 int32_t f_syncwrites;
159 int32_t f_asyncwrites;
160 char f_fstypename[FREEBSD4_OMFSNAMELEN];
161 char f_mntonname[FREEBSD4_OMNAMELEN];
163 int32_t f_asyncreads;
165 char f_mntfromname[FREEBSD4_OMNAMELEN];
166 int16_t f_spares2 __packed;
171 __uint32_t st_dev; /* inode's device */
172 __uint32_t st_ino; /* inode's number */
173 __uint32_t st_mode; /* inode protection mode */
174 __uint32_t st_nlink; /* number of hard links */
175 uid_t st_uid; /* user ID of the file's owner */
176 gid_t st_gid; /* group ID of the file's group */
177 __uint32_t st_rdev; /* device type */
178 struct timespec32 st_atim; /* time of last access */
179 struct timespec32 st_mtim; /* time of last data modification */
180 struct timespec32 st_ctim; /* time of last file status change */
181 off_t st_size; /* file size, in bytes */
182 blkcnt_t st_blocks; /* blocks allocated for file */
183 blksize_t st_blksize; /* optimal blocksize for I/O */
184 fflags_t st_flags; /* user defined flags for file */
185 __uint32_t st_gen; /* file generation number */
186 struct timespec32 st_birthtim; /* time of file creation */
188 * See comment in the definition of struct freebsd11_stat
189 * in sys/stat.h about the following padding.
191 unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec32));
192 unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec32));
202 socklen_t msg_namelen;
205 u_int32_t msg_control;
206 socklen_t msg_controllen;
210 #if defined(__amd64__)
211 #define __STAT32_TIME_T_EXT 1
219 u_int16_t st_padding0;
222 u_int32_t st_padding1;
224 #ifdef __STAT32_TIME_T_EXT
225 __int32_t st_atim_ext;
227 struct timespec32 st_atim;
228 #ifdef __STAT32_TIME_T_EXT
229 __int32_t st_mtim_ext;
231 struct timespec32 st_mtim;
232 #ifdef __STAT32_TIME_T_EXT
233 __int32_t st_ctim_ext;
235 struct timespec32 st_ctim;
236 #ifdef __STAT32_TIME_T_EXT
237 __int32_t st_btim_ext;
239 struct timespec32 st_birthtim;
242 u_int32_t st_blksize;
245 u_int64_t st_spare[10];
247 struct freebsd11_stat32 {
255 struct timespec32 st_atim;
256 struct timespec32 st_mtim;
257 struct timespec32 st_ctim;
260 u_int32_t st_blksize;
264 struct timespec32 st_birthtim;
265 unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec32));
266 unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec32));
278 struct timespec32 st_atim;
279 struct timespec32 st_mtim;
280 struct timespec32 st_ctim;
281 __int32_t st_blksize;
325 struct i386_ldt_args32 {
339 struct kinfo_proc32 {
357 short ki_spare_short1;
358 uint32_t ki_tdev_freebsd11;
361 sigset_t ki_sigignore;
362 sigset_t ki_sigcatch;
369 short ki_spare_short2;
370 gid_t ki_groups[KI_NGROUPS];
384 u_int64_t ki_runtime;
385 struct timeval32 ki_start;
386 struct timeval32 ki_childtime;
395 u_char ki_lastcpu_old;
396 char ki_tdname[TDNAMLEN+1];
397 char ki_wmesg[WMESGLEN+1];
398 char ki_login[LOGNAMELEN+1];
399 char ki_lockname[LOCKNAMELEN+1];
400 char ki_comm[COMMLEN+1];
401 char ki_emul[KI_EMULNAMELEN+1];
402 char ki_loginclass[LOGINCLASSLEN+1];
403 char ki_moretdname[MAXCOMLEN-TDNAMLEN+1];
404 char ki_sparestrings[46];
405 int ki_spareints[KI_NSPARE_INT];
416 struct priority ki_pri;
417 struct rusage32 ki_rusage;
418 struct rusage32 ki_rusage_ch;
423 uint32_t ki_spareptrs[KI_NSPARE_PTR]; /* spare room for growth */
424 int ki_sparelongs[KI_NSPARE_LONG];
429 struct kinfo_sigtramp32 {
430 uint32_t ksigtramp_start;
431 uint32_t ksigtramp_end;
432 uint32_t ksigtramp_spare[4];
435 struct kld_file_stat_1_32 {
436 int version; /* set to sizeof(struct kld_file_stat_1) */
437 char name[MAXPATHLEN];
440 uint32_t address; /* load address */
441 uint32_t size; /* size in bytes */
444 struct kld_file_stat32 {
445 int version; /* set to sizeof(struct kld_file_stat) */
446 char name[MAXPATHLEN];
449 uint32_t address; /* load address */
450 uint32_t size; /* size in bytes */
451 char pathname[MAXPATHLEN];
454 struct procctl_reaper_pids32 {
480 struct ptrace_coredump32 {
483 uint32_t pc_limit1, pc_limit2;
486 #endif /* !_COMPAT_FREEBSD32_FREEBSD32_H_ */