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