Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-src
Path: blob/main/sys/compat/freebsd32/freebsd32.h
39482 views
1
/*-
2
* SPDX-License-Identifier: BSD-2-Clause
3
*
4
* Copyright (c) 2001 Doug Rabson
5
* All rights reserved.
6
*
7
* Redistribution and use in source and binary forms, with or without
8
* modification, are permitted provided that the following conditions
9
* are met:
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.
15
*
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
26
* SUCH DAMAGE.
27
*/
28
29
#ifndef _COMPAT_FREEBSD32_FREEBSD32_H_
30
#define _COMPAT_FREEBSD32_FREEBSD32_H_
31
32
#include <sys/abi_compat.h>
33
#include <sys/procfs.h>
34
#include <sys/socket.h>
35
#include <sys/user.h>
36
#include <sys/_ffcounter.h>
37
38
/*
39
* i386 is the only arch with a 32-bit time_t
40
*/
41
#ifdef __amd64__
42
typedef int32_t time32_t;
43
#else
44
typedef int64_t time32_t;
45
#endif
46
47
struct timeval32 {
48
time32_t tv_sec;
49
int32_t tv_usec;
50
};
51
52
struct timespec32 {
53
time32_t tv_sec;
54
int32_t tv_nsec;
55
};
56
57
struct itimerspec32 {
58
struct timespec32 it_interval;
59
struct timespec32 it_value;
60
};
61
62
struct bintime32 {
63
time32_t sec;
64
uint32_t frac[2];
65
};
66
67
struct ffclock_estimate32 {
68
struct bintime32 update_time;
69
ffcounter update_ffcount;
70
ffcounter leapsec_next;
71
uint64_t period;
72
uint32_t errb_abs;
73
uint32_t errb_rate;
74
uint32_t status;
75
int16_t leapsec_total;
76
int8_t leapsec;
77
int8_t _pad;
78
}
79
#if defined(__amd64__)
80
__attribute__((packed))
81
#endif
82
;
83
#if defined(__amd64__)
84
_Static_assert(sizeof(struct ffclock_estimate32) == 52, "ffclock_estimate32 size");
85
#else
86
_Static_assert(sizeof(struct ffclock_estimate32) == 56, "ffclock_estimate32 size");
87
#endif
88
89
struct rusage32 {
90
struct timeval32 ru_utime;
91
struct timeval32 ru_stime;
92
int32_t ru_maxrss;
93
int32_t ru_ixrss;
94
int32_t ru_idrss;
95
int32_t ru_isrss;
96
int32_t ru_minflt;
97
int32_t ru_majflt;
98
int32_t ru_nswap;
99
int32_t ru_inblock;
100
int32_t ru_oublock;
101
int32_t ru_msgsnd;
102
int32_t ru_msgrcv;
103
int32_t ru_nsignals;
104
int32_t ru_nvcsw;
105
int32_t ru_nivcsw;
106
};
107
108
struct __wrusage32 {
109
struct rusage32 wru_self;
110
struct rusage32 wru_children;
111
};
112
113
struct itimerval32 {
114
struct timeval32 it_interval;
115
struct timeval32 it_value;
116
};
117
118
struct umtx_time32 {
119
struct timespec32 _timeout;
120
uint32_t _flags;
121
uint32_t _clockid;
122
};
123
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;
128
};
129
130
struct umutex32 {
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 */
135
__uint32_t m_pad;
136
__uint32_t m_spare[2];
137
};
138
139
#define FREEBSD4_OMFSNAMELEN 16
140
#define FREEBSD4_OMNAMELEN (88 - 2 * sizeof(int32_t))
141
142
/* 4.x version */
143
struct ostatfs32 {
144
int32_t f_spare2;
145
int32_t f_bsize;
146
int32_t f_iosize;
147
int32_t f_blocks;
148
int32_t f_bfree;
149
int32_t f_bavail;
150
int32_t f_files;
151
int32_t f_ffree;
152
fsid_t f_fsid;
153
uid_t f_owner;
154
int32_t f_type;
155
int32_t f_flags;
156
int32_t f_syncwrites;
157
int32_t f_asyncwrites;
158
char f_fstypename[FREEBSD4_OMFSNAMELEN];
159
char f_mntonname[FREEBSD4_OMNAMELEN];
160
int32_t f_syncreads;
161
int32_t f_asyncreads;
162
int16_t f_spares1;
163
char f_mntfromname[FREEBSD4_OMNAMELEN];
164
int16_t f_spares2 __packed;
165
int32_t f_spare[2];
166
};
167
168
struct nstat32 {
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 */
185
/*
186
* See comment in the definition of struct freebsd11_stat
187
* in sys/stat.h about the following padding.
188
*/
189
unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec32));
190
unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec32));
191
};
192
193
struct iovec32 {
194
uint32_t iov_base;
195
int iov_len;
196
};
197
198
struct msghdr32 {
199
uint32_t msg_name;
200
socklen_t msg_namelen;
201
uint32_t msg_iov;
202
int msg_iovlen;
203
uint32_t msg_control;
204
socklen_t msg_controllen;
205
int msg_flags;
206
};
207
208
#if defined(__amd64__)
209
#define __STAT32_TIME_T_EXT 1
210
#endif
211
212
struct stat32 {
213
dev_t st_dev;
214
ino_t st_ino;
215
nlink_t st_nlink;
216
mode_t st_mode;
217
uint16_t st_bsdflags;
218
uid_t st_uid;
219
gid_t st_gid;
220
uint32_t st_padding1;
221
dev_t st_rdev;
222
#ifdef __STAT32_TIME_T_EXT
223
__int32_t st_atim_ext;
224
#endif
225
struct timespec32 st_atim;
226
#ifdef __STAT32_TIME_T_EXT
227
__int32_t st_mtim_ext;
228
#endif
229
struct timespec32 st_mtim;
230
#ifdef __STAT32_TIME_T_EXT
231
__int32_t st_ctim_ext;
232
#endif
233
struct timespec32 st_ctim;
234
#ifdef __STAT32_TIME_T_EXT
235
__int32_t st_btim_ext;
236
#endif
237
struct timespec32 st_birthtim;
238
off_t st_size;
239
int64_t st_blocks;
240
uint32_t st_blksize;
241
uint32_t st_flags;
242
uint64_t st_gen;
243
uint64_t st_filerev;
244
uint64_t st_spare[9];
245
};
246
struct freebsd11_stat32 {
247
uint32_t st_dev;
248
uint32_t st_ino;
249
mode_t st_mode;
250
uint16_t st_nlink;
251
uid_t st_uid;
252
gid_t st_gid;
253
uint32_t st_rdev;
254
struct timespec32 st_atim;
255
struct timespec32 st_mtim;
256
struct timespec32 st_ctim;
257
off_t st_size;
258
int64_t st_blocks;
259
uint32_t st_blksize;
260
uint32_t st_flags;
261
uint32_t st_gen;
262
int32_t st_lspare;
263
struct timespec32 st_birthtim;
264
unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec32));
265
unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec32));
266
};
267
268
struct ostat32 {
269
__uint16_t st_dev;
270
__uint32_t st_ino;
271
mode_t st_mode;
272
__uint16_t st_nlink;
273
__uint16_t st_uid;
274
__uint16_t st_gid;
275
__uint16_t st_rdev;
276
__int32_t st_size;
277
struct timespec32 st_atim;
278
struct timespec32 st_mtim;
279
struct timespec32 st_ctim;
280
__int32_t st_blksize;
281
__int32_t st_blocks;
282
uint32_t st_flags;
283
__uint32_t st_gen;
284
};
285
286
struct jail32_v0 {
287
uint32_t version;
288
uint32_t path;
289
uint32_t hostname;
290
uint32_t ip_number;
291
};
292
293
struct jail32 {
294
uint32_t version;
295
uint32_t path;
296
uint32_t hostname;
297
uint32_t jailname;
298
uint32_t ip4s;
299
uint32_t ip6s;
300
uint32_t ip4;
301
uint32_t ip6;
302
};
303
304
struct sigaction32 {
305
uint32_t sa_u;
306
int sa_flags;
307
sigset_t sa_mask;
308
};
309
310
struct thr_param32 {
311
uint32_t start_func;
312
uint32_t arg;
313
uint32_t stack_base;
314
uint32_t stack_size;
315
uint32_t tls_base;
316
uint32_t tls_size;
317
uint32_t child_tid;
318
uint32_t parent_tid;
319
int32_t flags;
320
uint32_t rtp;
321
uint32_t spare[3];
322
};
323
324
struct i386_ldt_args32 {
325
uint32_t start;
326
uint32_t descs;
327
uint32_t num;
328
};
329
330
struct mq_attr32 {
331
int mq_flags;
332
int mq_maxmsg;
333
int mq_msgsize;
334
int mq_curmsgs;
335
int __reserved[4];
336
};
337
338
struct kinfo_proc32 {
339
int ki_structsize;
340
int ki_layout;
341
uint32_t ki_args;
342
uint32_t ki_paddr;
343
uint32_t ki_addr;
344
uint32_t ki_tracep;
345
uint32_t ki_textvp;
346
uint32_t ki_fd;
347
uint32_t ki_vmspace;
348
uint32_t ki_wchan;
349
pid_t ki_pid;
350
pid_t ki_ppid;
351
pid_t ki_pgid;
352
pid_t ki_tpgid;
353
pid_t ki_sid;
354
pid_t ki_tsid;
355
short ki_jobc;
356
short ki_spare_short1;
357
uint32_t ki_tdev_freebsd11;
358
sigset_t ki_siglist;
359
sigset_t ki_sigmask;
360
sigset_t ki_sigignore;
361
sigset_t ki_sigcatch;
362
uid_t ki_uid;
363
uid_t ki_ruid;
364
uid_t ki_svuid;
365
gid_t ki_rgid;
366
gid_t ki_svgid;
367
short ki_ngroups;
368
short ki_spare_short2;
369
gid_t ki_groups[KI_NGROUPS];
370
uint32_t ki_size;
371
int32_t ki_rssize;
372
int32_t ki_swrss;
373
int32_t ki_tsize;
374
int32_t ki_dsize;
375
int32_t ki_ssize;
376
u_short ki_xstat;
377
u_short ki_acflag;
378
fixpt_t ki_pctcpu;
379
u_int ki_estcpu;
380
u_int ki_slptime;
381
u_int ki_swtime;
382
u_int ki_cow;
383
uint64_t ki_runtime;
384
struct timeval32 ki_start;
385
struct timeval32 ki_childtime;
386
int ki_flag;
387
int ki_kiflag;
388
int ki_traceflag;
389
char ki_stat;
390
signed char ki_nice;
391
char ki_lock;
392
char ki_rqindex;
393
u_char ki_oncpu_old;
394
u_char ki_lastcpu_old;
395
char ki_tdname[TDNAMLEN+1];
396
char ki_wmesg[WMESGLEN+1];
397
char ki_login[LOGNAMELEN+1];
398
char ki_lockname[LOCKNAMELEN+1];
399
char ki_comm[COMMLEN+1];
400
char ki_emul[KI_EMULNAMELEN+1];
401
char ki_loginclass[LOGINCLASSLEN+1];
402
char ki_moretdname[MAXCOMLEN-TDNAMLEN+1];
403
char ki_sparestrings[46];
404
int ki_spareints[KI_NSPARE_INT];
405
uint64_t ki_tdev;
406
int ki_oncpu;
407
int ki_lastcpu;
408
int ki_tracer;
409
int ki_flag2;
410
int ki_fibnum;
411
u_int ki_cr_flags;
412
int ki_jid;
413
int ki_numthreads;
414
lwpid_t ki_tid;
415
struct priority ki_pri;
416
struct rusage32 ki_rusage;
417
struct rusage32 ki_rusage_ch;
418
uint32_t ki_pcb;
419
uint32_t ki_kstack;
420
uint32_t ki_udata;
421
uint32_t ki_tdaddr;
422
uint32_t ki_uerrmsg;
423
uint32_t ki_spareptrs[KI_NSPARE_PTR]; /* spare room for growth */
424
int ki_sparelongs[KI_NSPARE_LONG];
425
int ki_sflag;
426
int ki_tdflags;
427
};
428
429
struct kinfo_sigtramp32 {
430
uint32_t ksigtramp_start;
431
uint32_t ksigtramp_end;
432
uint32_t ksigtramp_spare[4];
433
};
434
435
struct kinfo_vm_layout32 {
436
uint32_t kvm_min_user_addr;
437
uint32_t kvm_max_user_addr;
438
uint32_t kvm_text_addr;
439
uint32_t kvm_text_size;
440
uint32_t kvm_data_addr;
441
uint32_t kvm_data_size;
442
uint32_t kvm_stack_addr;
443
uint32_t kvm_stack_size;
444
int kvm_map_flags;
445
uint32_t kvm_shp_addr;
446
uint32_t kvm_shp_size;
447
uint32_t kvm_spare[12];
448
};
449
450
#if defined(_WANT_KEVENT32) || defined(_KERNEL)
451
struct kinfo_knote32 {
452
int knt_kq_fd;
453
struct kevent32 knt_event;
454
int knt_status;
455
int knt_extdata;
456
uint32_t knt_spare0[8];
457
union {
458
struct {
459
int knt_vnode_type;
460
uint32_t knt_vnode_fsid[2];
461
uint32_t knt_vnode_fileid[2];
462
char knt_vnode_fullpath[PATH_MAX];
463
} knt_vnode;
464
struct {
465
uint32_t knt_pipe_ino[2];
466
} knt_pipe;
467
};
468
};
469
#endif
470
471
struct kld_file_stat_1_32 {
472
int version; /* set to sizeof(struct kld_file_stat_1) */
473
char name[MAXPATHLEN];
474
int refs;
475
int id;
476
uint32_t address; /* load address */
477
uint32_t size; /* size in bytes */
478
};
479
480
struct kld_file_stat32 {
481
int version; /* set to sizeof(struct kld_file_stat) */
482
char name[MAXPATHLEN];
483
int refs;
484
int id;
485
uint32_t address; /* load address */
486
uint32_t size; /* size in bytes */
487
char pathname[MAXPATHLEN];
488
};
489
490
struct procctl_reaper_pids32 {
491
u_int rp_count;
492
u_int rp_pad0[15];
493
uint32_t rp_pids;
494
};
495
496
struct timex32 {
497
unsigned int modes;
498
int32_t offset;
499
int32_t freq;
500
int32_t maxerror;
501
int32_t esterror;
502
int status;
503
int32_t constant;
504
int32_t precision;
505
int32_t tolerance;
506
int32_t ppsfreq;
507
int32_t jitter;
508
int shift;
509
int32_t stabil;
510
int32_t jitcnt;
511
int32_t calcnt;
512
int32_t errcnt;
513
int32_t stbcnt;
514
};
515
516
struct ptrace_sc_ret32 {
517
uint32_t sr_retval[2];
518
int sr_error;
519
};
520
521
struct ptrace_coredump32 {
522
int pc_fd;
523
uint32_t pc_flags;
524
uint32_t pc_limit1, pc_limit2;
525
};
526
527
struct ptrace_sc_remote32 {
528
struct ptrace_sc_ret32 pscr_ret;
529
u_int pscr_syscall;
530
u_int pscr_nargs;
531
uint32_t pscr_args;
532
};
533
534
#endif /* !_COMPAT_FREEBSD32_FREEBSD32_H_ */
535
536