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 35 #define PTRIN(v) (void *)(uintptr_t) (v) 36 #define PTROUT(v) (u_int32_t)(uintptr_t) (v) 37 38 #define CP(src,dst,fld) do { (dst).fld = (src).fld; } while (0) 39 #define PTRIN_CP(src,dst,fld) \ 40 do { (dst).fld = PTRIN((src).fld); } while (0) 41 #define PTROUT_CP(src,dst,fld) \ 42 do { (dst).fld = PTROUT((src).fld); } while (0) 43 44 struct timeval32 { 45 int32_t tv_sec; 46 int32_t tv_usec; 47 }; 48 #define TV_CP(src,dst,fld) do { \ 49 CP((src).fld,(dst).fld,tv_sec); \ 50 CP((src).fld,(dst).fld,tv_usec); \ 51 } while (0) 52 53 struct timespec32 { 54 u_int32_t tv_sec; 55 u_int32_t tv_nsec; 56 }; 57 #define TS_CP(src,dst,fld) do { \ 58 CP((src).fld,(dst).fld,tv_sec); \ 59 CP((src).fld,(dst).fld,tv_nsec); \ 60 } while (0); 61 62 struct rusage32 { 63 struct timeval32 ru_utime; 64 struct timeval32 ru_stime; 65 int32_t ru_maxrss; 66 int32_t ru_ixrss; 67 int32_t ru_idrss; 68 int32_t ru_isrss; 69 int32_t ru_minflt; 70 int32_t ru_majflt; 71 int32_t ru_nswap; 72 int32_t ru_inblock; 73 int32_t ru_oublock; 74 int32_t ru_msgsnd; 75 int32_t ru_msgrcv; 76 int32_t ru_nsignals; 77 int32_t ru_nvcsw; 78 int32_t ru_nivcsw; 79 }; 80 81 struct itimerval32 { 82 struct timeval32 it_interval; 83 struct timeval32 it_value; 84 }; 85 86 #define FREEBSD4_MNAMELEN (88 - 2 * sizeof(int32_t)) /* size of on/from name bufs */ 87 88 /* 4.x version */ 89 struct statfs32 { 90 int32_t f_spare2; 91 int32_t f_bsize; 92 int32_t f_iosize; 93 int32_t f_blocks; 94 int32_t f_bfree; 95 int32_t f_bavail; 96 int32_t f_files; 97 int32_t f_ffree; 98 fsid_t f_fsid; 99 uid_t f_owner; 100 int32_t f_type; 101 int32_t f_flags; 102 int32_t f_syncwrites; 103 int32_t f_asyncwrites; 104 char f_fstypename[MFSNAMELEN]; 105 char f_mntonname[FREEBSD4_MNAMELEN]; 106 int32_t f_syncreads; 107 int32_t f_asyncreads; 108 int16_t f_spares1; 109 char f_mntfromname[FREEBSD4_MNAMELEN]; 110 int16_t f_spares2 __packed; 111 int32_t f_spare[2]; 112 }; 113 114 struct kevent32 { 115 u_int32_t ident; /* identifier for this event */ 116 short filter; /* filter for event */ 117 u_short flags; 118 u_int fflags; 119 int32_t data; 120 u_int32_t udata; /* opaque user data identifier */ 121 }; 122 123 struct iovec32 { 124 u_int32_t iov_base; 125 int iov_len; 126 }; 127 128 struct msghdr32 { 129 u_int32_t msg_name; 130 socklen_t msg_namelen; 131 u_int32_t msg_iov; 132 int msg_iovlen; 133 u_int32_t msg_control; 134 socklen_t msg_controllen; 135 int msg_flags; 136 }; 137 138 struct stat32 { 139 dev_t st_dev; 140 ino_t st_ino; 141 mode_t st_mode; 142 nlink_t st_nlink; 143 uid_t st_uid; 144 gid_t st_gid; 145 dev_t st_rdev; 146 struct timespec32 st_atimespec; 147 struct timespec32 st_mtimespec; 148 struct timespec32 st_ctimespec; 149 off_t st_size; 150 int64_t st_blocks; 151 u_int32_t st_blksize; 152 u_int32_t st_flags; 153 u_int32_t st_gen; 154 struct timespec32 st_birthtimespec; 155 unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec32)); 156 unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec32)); 157 }; 158 159 struct jail32_v0 { 160 u_int32_t version; 161 uint32_t path; 162 uint32_t hostname; 163 u_int32_t ip_number; 164 }; 165 166 struct jail32 { 167 uint32_t version; 168 uint32_t path; 169 uint32_t hostname; 170 uint32_t jailname; 171 uint32_t ip4s; 172 uint32_t ip6s; 173 uint32_t ip4; 174 uint32_t ip6; 175 }; 176 177 struct sigaction32 { 178 u_int32_t sa_u; 179 int sa_flags; 180 sigset_t sa_mask; 181 }; 182 183 struct thr_param32 { 184 uint32_t start_func; 185 uint32_t arg; 186 uint32_t stack_base; 187 uint32_t stack_size; 188 uint32_t tls_base; 189 uint32_t tls_size; 190 uint32_t child_tid; 191 uint32_t parent_tid; 192 int32_t flags; 193 uint32_t rtp; 194 uint32_t spare[3]; 195 }; 196 197 struct i386_ldt_args32 { 198 uint32_t start; 199 uint32_t descs; 200 uint32_t num; 201 }; 202 203 /* 204 * Alternative layouts for <sys/procfs.h> 205 */ 206 struct prstatus32 { 207 int pr_version; 208 u_int pr_statussz; 209 u_int pr_gregsetsz; 210 u_int pr_fpregsetsz; 211 int pr_osreldate; 212 int pr_cursig; 213 pid_t pr_pid; 214 struct reg32 pr_reg; 215 }; 216 217 struct prpsinfo32 { 218 int pr_version; 219 u_int pr_psinfosz; 220 char pr_fname[PRFNAMESZ+1]; 221 char pr_psargs[PRARGSZ+1]; 222 }; 223 224 #endif /* !_COMPAT_FREEBSD32_FREEBSD32_H_ */ 225