Home | History | Annotate | only in /src/sys/compat
History log of /src/sys/compat
RevisionDateAuthorComments
 1.7 25-Mar-2019  maxv Remove compat_osf1, discussed on tech-kern@.
 1.6 29-Dec-2018  maxv Retire compat_ibcs2, as discussed on tech-kern@. FreeBSD did the same
recently.
 1.5 26-Nov-2002  lukem branches: 1.5.194; 1.5.196;
Remove KDIR=, since SYS_INCLUDE=symlinks and KDIR are not supported any more.
 1.4 30-Mar-2001  toddpw Our INCSDIR has been pruned from distrib/sets, so don't make it any more.
 1.3 02-Feb-2001  mrg branches: 1.3.2;
add netbsd32 & sunos32 to the (commented) SUBDIR line.
 1.2 03-Oct-1998  christos branches: 1.2.12;
Don't install includes
 1.1 01-Oct-1998  erh Enable linux for includes and syscall building.
 1.2.12.2 21-Apr-2001  bouyer Sync with HEAD
 1.2.12.1 11-Feb-2001  bouyer Sync with HEAD.
 1.3.2.2 11-Dec-2002  thorpej Sync with HEAD.
 1.3.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.5.196.1 10-Jun-2019  christos Sync with HEAD
 1.5.194.1 18-Jan-2019  pgoyette Synch with HEAD
 1.4 25-Mar-2019  maxv Remove compat_osf1, discussed on tech-kern@.
 1.3 29-Dec-2018  maxv Retire compat_ibcs2, as discussed on tech-kern@. FreeBSD did the same
recently.
 1.2 19-Dec-2018  maxv Remove compat_svr4 and compat_svr4_32, as discussed on tech-kern@ recently,
but also as discussed several times in the past.
 1.1 16-Jan-2017  christos branches: 1.1.2; 1.1.4; 1.1.8; 1.1.18; 1.1.20; 1.1.22;
Add a Makefile to rebuild the syscall files for all emulations
 1.1.22.1 10-Jun-2019  christos Sync with HEAD
 1.1.20.2 18-Jan-2019  pgoyette Synch with HEAD
 1.1.20.1 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.1.18.2 03-Dec-2017  jdolecek update from HEAD
 1.1.18.1 16-Jan-2017  jdolecek file Makefile.syscall was added on branch tls-maxphys on 2017-12-03 11:36:52 +0000
 1.1.8.2 21-Apr-2017  bouyer Sync with HEAD
 1.1.8.1 16-Jan-2017  bouyer file Makefile.syscall was added on branch bouyer-socketcan on 2017-04-21 16:53:40 +0000
 1.1.4.2 20-Mar-2017  pgoyette Sync with HEAD
 1.1.4.1 16-Jan-2017  pgoyette file Makefile.syscall was added on branch pgoyette-localcount on 2017-03-20 06:57:23 +0000
 1.1.2.2 05-Feb-2017  skrll Sync with HEAD
 1.1.2.1 16-Jan-2017  skrll file Makefile.syscall was added on branch nick-nhusb on 2017-02-05 13:40:24 +0000
 1.7 14-Jan-2014  christos use new bsd.syscall.mk
 1.6 04-May-2006  tsutsui branches: 1.6.98; 1.6.108; 1.6.114;
aoutm68k_syscalls.c is now required by kdump(1).
 1.5 11-Dec-2005  christos branches: 1.5.4; 1.5.6; 1.5.8; 1.5.10; 1.5.12;
merge ktrace-lwp.
 1.4 10-Sep-2004  jdolecek branches: 1.4.12;
garbage-collect aoutm68k_syscalls.c, it's just taking up space (it's not used)
 1.3 15-Nov-2003  thorpej We have CVS; there is no reason to make .bak files when generating the
syscall tables.
 1.2 26-Oct-2003  lukem Use ${HOST_SH} instead of `sh'.

If necessary, pull in <bsd.sys.mk> to get the definition of HOST_SH;
Makefiles that pull in one of (most of) <bsd.*.mk> will get this anyway.
 1.1 02-Dec-2000  scw branches: 1.1.2; 1.1.26;
Initial cut of COMPAT_AOUT_M68K.
This gets most existing m68k a.out binaries working with m68k ELF
kernels.

There are still some remaining ABI issues to track down; most notably,
some ioctl(2) calls are affected by the change.
 1.1.26.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.26.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.26.1 03-Aug-2004  skrll Sync with HEAD
 1.1.2.2 08-Jan-2001  bouyer Files added on trunk.
 1.1.2.1 02-Dec-2000  bouyer file Makefile was added on branch thorpej_scsipi on 2001-01-08 14:56:43 +0000
 1.4.12.1 21-Jun-2006  yamt sync with head.
 1.5.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.5.10.1 11-May-2006  elad sync with head
 1.5.8.1 24-May-2006  yamt sync with head.
 1.5.6.1 01-Jun-2006  kardel Sync with head.
 1.5.4.1 09-Sep-2006  rpaulo sync with head
 1.6.114.1 18-May-2014  rmind sync with head
 1.6.108.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.6.98.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.30 10-Aug-2018  pgoyette Allow syscall_establish() to install new syscalls when the existing
entry-point is either sys_nomodule or sys_nosys. Update the
makesyscalls.sh script to create a const array of bits to allow
syscall_disestablish() to properly restore the original entry-point.
Update all the initializers of struct emul to initialize the pointer
to the bit array struct emul.

XXX Regen of all files created by makesyscalls.sh will come soon,
XXX followed by a kernel version bump (since struct emul is being
XXX modified).

This commit should address PR kern/45781 and also removes the need
for the work-around for that PR in file

sys/arch/usermode/modules/syscallemu/syscallemu.c
 1.29 06-May-2018  kamil branches: 1.29.2;
Remove an element from struct emul: e_tracesig

e_tracesig used to be implemented for Darwin compat. Nowadays the Darwin
compatiblity layer is gone and there are no other users.

This functionality isn't used where it shall be used in the existing
codebase.

If we want to emulate debugging interfaces in compat layers we would need
to implement that from scratch anyway. We would need to be bug compatible
with other OSes too.

Proposed on tech-kern@.

Welcome to NetBSD 8.99.16!

Sponsored by <The NetBSD Foundation>
 1.28 09-Jan-2018  maya branches: 1.28.2;
remove struct emul's e_fault.

It used to be used by COMPAT_IRIX for the purpose of overriding
uvm_fault (only implemented in MIPS), now removed.

Ride 8.99.12 version bump.
 1.27 19-Feb-2012  rmind Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.
 1.26 15-Oct-2010  tsutsui branches: 1.26.8; 1.26.12;
compat_aoutm68k doesn't require alternative emul path lookup.
 1.25 07-Jul-2010  chs many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
- support new-style (NPTL) linux pthreads on all platforms.
clone() with CLONE_THREAD uses 1 process with many LWPs
instead of separate processes.
- move the contents of sys__lwp_setprivate() into a new
lwp_setprivate() and use that everywhere.
- update linux_release[] and linux32_release[] to "2.6.18".
- adjust placement of emul fork/exec/exit hooks as needed
and adjust other emul code to match.
- convert all struct emul definitions to use named initializers.
- change the pid allocator to allow multiple pids to refer to the same proc.
- remove a few fields from struct proc that are no longer needed.
- disable the non-functional "vdso" code in linux32/amd64,
glibc works fine without it.
- fix a race in the futex code where we could miss a wakeup after
a requeue operation.
- redo futex locking to be a little more efficient.
 1.24 02-Jun-2009  pooka branches: 1.24.2; 1.24.4;
Declare extern syscallnames in a header.
 1.23 19-Nov-2008  ad branches: 1.23.4;
Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.22 28-Apr-2008  martin branches: 1.22.6; 1.22.8;
Remove clause 3 and 4 from TNF licenses
 1.21 04-Dec-2007  dsl branches: 1.21.12; 1.21.14; 1.21.16;
Remove all the __P
 1.20 11-Dec-2005  christos branches: 1.20.44; 1.20.46; 1.20.52; 1.20.56;
merge ktrace-lwp.
 1.19 26-Mar-2005  fvdl branches: 1.19.2;
Fix some things regarding COMPAT_NETBSD32 and limits/VM addresses.

* For sparc64 and amd64, define *SIZ32 VM constants.
* Add a new function pointer to struct emul, pointing at a function
that will return the default VM map address. The default function
is uvm_map_defaultaddr, which just uses the VM_DEFAULT_ADDRESS
macro. This gives emulations control over the default map address,
and allows things to be mapped at the right address (in 32bit range)
for COMPAT_NETBSD32.
* Add code to adjust the data and stack limits when a COMPAT_NETBSD32
or COMPAT_SVR4_32 binary is executed.
* Don't use USRSTACK in kern_resource.c, use p_vmspace->vm_minsaddr
instead (emulations might have set it differently)
* Since this changes struct emul, bump kernel version to 3.99.2

Tested on amd64, compile-tested on sparc64.
 1.18 12-Sep-2004  jdolecek branches: 1.18.4; 1.18.6; 1.18.10;
use native syscallnames[] for SYSCALL_DEBUG
 1.17 20-Dec-2003  fvdl Put back Emmanuel's sigfilter hooks, as decided by Core.
 1.16 20-Dec-2003  manu Introduce lwp_emuldata and the associated hooks. No hook is provided for the
exec case, as the emulation already has the ability to intercept that
with the e_proc_exec hook. It is the responsability of the emulation to
take appropriaye action about lwp_emuldata in e_proc_exec.

Patch reviewed by Christos.
 1.15 05-Dec-2003  jdolecek back the sigfilter emulation hook change off
 1.14 03-Dec-2003  manu Add a sigfilter emulation hook. It is used at the beginning of kpsignal2()
so that a specific emulation has the oportunity to filter out some signals.

if sigfilter returns 0, then no signal is sent by kpsignal2().

There is another place where signals can be generated: trapsignal. Since this
function is already an emulation hook, no call to the sigfilter hook was
introduced in trapsignal.

This is needed to emulate the softsignal feature in COMPAT_DARWIN (signals
sent as Mach exception messages)
 1.13 24-Aug-2003  chs add support for non-executable mappings (where the hardware allows this)
and make the stack and heap non-executable by default. the changes
fall into two basic catagories:

- pmap and trap-handler changes. these are all MD:
= alpha: we already track per-page execute permission with the (software)
PG_EXEC bit, so just have the trap handler pay attention to it.
= i386: use a new GDT segment for %cs for processes that have no
executable mappings above a certain threshold (currently the
bottom of the stack). track per-page execute permission with
the last unused PTE bit.
= powerpc/ibm4xx: just use the hardware exec bit.
= powerpc/oea: we already track per-page exec bits, but the hardware only
implements non-exec mappings at the segment level. so track the
number of executable mappings in each segment and turn on the no-exec
segment bit iff the count is 0. adjust the trap handler to deal.
= sparc (sun4m): fix our use of the hardware protection bits.
fix the trap handler to recognize text faults.
= sparc64: split the existing unified TSB into data and instruction TSBs,
and only load TTEs into the appropriate TSB(s) for the permissions.
fix the trap handler to check for execute permission.
= not yet implemented: amd64, hppa, sh5

- changes in all the emulations that put a signal trampoline on the stack.
instead, we now put the trampoline into a uvm_aobj and map that into
the process separately.

originally from openbsd, adapted for netbsd by me.
 1.12 10-Nov-2002  jdolecek branches: 1.12.6;
handle __HAVE_MINIMAL_EMUL
 1.11 01-Nov-2002  jdolecek set struct emul's nsysent to compat SYS_NSYSENT, not SYS_MAXSYSCALL
 1.10 21-Sep-2002  manu - Introduce a e_fault field in struct proc to provide emulation specific
memory fault handler. IRIX uses irix_vm_fault, and all other emulation
use NULL, which means to use uvm_fault.

- While we are there, explicitely set to NULL the uninitialized fields in
struct emul: e_fault and e_sysctl on most ports

- e_fault is used by the trap handler, for now only on mips. In order to avoid
intrusive modifications in UVM, the function pointed by e_fault does not
has exactly the same protoype as uvm_fault:
int uvm_fault __P((struct vm_map *, vaddr_t, vm_fault_t, vm_prot_t));
int e_fault __P((struct proc *, vaddr_t, vm_fault_t, vm_prot_t));

- In IRIX share groups, all the VM space is shared, except one page.
This bounds us to have different VM spaces and synchronize modifications
to the VM space accross share group members. We need an IRIX specific hook
to the page fault handler in order to propagate VM space modifications
caused by page faults.
 1.9 13-Jul-2002  scw m68k syscall rototill:

- Switch all m68k-based ports over to __HAVE_SYSCALL_INTERN.
- Add systrace glue.
- Define struct mdproc in <m68k/proc.h> instead of <machine/proc.h>.
(They were all defined exactly the same anyway, other than a couple
of the MDP_* flags.)
 1.8 13-Nov-2001  lukem branches: 1.8.8;
add RCSIDs (including regeneration of files as appropriate)
 1.7 18-Sep-2001  jdolecek Make the setregs hook emulation-specific, rather than executable
format specific.
Struct emul has a e_setregs hook back, which points to emulation-specific
setregs function. es_setregs of struct execsw now only points to
optional executable-specific setup function (this is only used for
ECOFF).
 1.6 18-Jun-2001  christos branches: 1.6.2; 1.6.4;
Add an e_trapsignal member to struct emul, so that emulated processes can
send the appropriate signal depending on the trap type.
 1.5 30-May-2001  mrg use _KERNEL_OPT.
 1.4 11-Dec-2000  mycroft branches: 1.4.2; 1.4.4;
Introduce 2 new flags in types.h:
* __HAVE_SYSCALL_INTERN. If this is defined, e_syscall is replaced by
e_syscall_intern, which is called at key places in the kernel. This can be
used to set a MD syscall handler pointer. This obsoletes and replaces the
*_HAS_SEPARATED_SYSCALL flags.
* __HAVE_MINIMAL_EMUL. If this is defined, certain (deprecated) elements in
struct emul are omitted.
 1.3 09-Dec-2000  jdolecek always fill in e_syscall in respective emul_*; if the emulation doesn't
have it's own separated *_syscall() function, use syscall()
 1.2 08-Dec-2000  jdolecek change emulation name from 'netbsd' to 'aoutm68k'
 1.1 02-Dec-2000  scw Initial cut of COMPAT_AOUT_M68K.
This gets most existing m68k a.out binaries working with m68k ELF
kernels.

There are still some remaining ABI issues to track down; most notably,
some ioctl(2) calls are affected by the change.
 1.4.4.6 11-Nov-2002  nathanw Catch up to -current
 1.4.4.5 18-Oct-2002  nathanw Catch up to -current.
 1.4.4.4 01-Aug-2002  nathanw Catch up to -current.
 1.4.4.3 14-Nov-2001  nathanw Catch up to -current.
 1.4.4.2 21-Sep-2001  nathanw Catch up to -current.
 1.4.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.4.2.2 08-Jan-2001  bouyer Files added on trunk.
 1.4.2.1 11-Dec-2000  bouyer file aoutm68k_exec.c was added on branch thorpej_scsipi on 2001-01-08 14:56:43 +0000
 1.6.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.6.2.3 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.6.2.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.6.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.8.8.1 15-Jul-2002  gehenna catch up with -current.
 1.12.6.4 01-Apr-2005  skrll Sync with HEAD.
 1.12.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.12.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.12.6.1 03-Aug-2004  skrll Sync with HEAD
 1.18.10.1 18-Sep-2005  tron Pull up following revision(s) (requested by fvdl in ticket #798):
sys/compat/sunos/sunos_exec.c: revision 1.47
sys/compat/pecoff/pecoff_emul.c: revision 1.11
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.45
sys/arch/amd64/amd64/netbsd32_machdep.c: revision 1.12
sys/sys/proc.h: revision 1.198
sys/compat/mach/mach_exec.c: revision 1.56
sys/compat/freebsd/freebsd_exec.c: revision 1.27
sys/arch/sparc64/include/vmparam.h: revision 1.27
sys/kern/kern_resource.c: revision 1.91
sys/compat/netbsd32/netbsd32_netbsd.c: revision 1.88
sys/compat/osf1/osf1_exec.c: revision 1.39
sys/compat/svr4_32/svr4_32_resource.c: revision 1.5
sys/compat/ultrix/ultrix_misc.c: revision 1.99
sys/compat/svr4_32/svr4_32_exec.h: revision 1.9
sys/kern/exec_elf32.c: revision 1.103
sys/compat/aoutm68k/aoutm68k_exec.c: revision 1.19
sys/compat/sunos32/sunos32_exec.c: revision 1.20
sys/compat/hpux/hpux_exec.c: revision 1.46
sys/compat/darwin/darwin_exec.c: revision 1.40
sys/kern/sysv_shm.c: revision 1.83
sys/uvm/uvm_extern.h: revision 1.99
sys/uvm/uvm_mmap.c: revision 1.89
sys/kern/kern_exec.c: revision 1.195
sys/compat/netbsd32/netbsd32.h: revision 1.31
sys/arch/sparc64/sparc64/svr4_32_machdep.c: revision 1.20
sys/compat/svr4/svr4_exec.c: revision 1.56
sys/compat/irix/irix_exec.c: revision 1.41
sys/compat/ibcs2/ibcs2_exec.c: revision 1.63
sys/compat/svr4_32/svr4_32_exec.c: revision 1.16
sys/arch/amd64/include/vmparam.h: revision 1.8
sys/compat/linux/common/linux_exec.c: revision 1.73
Fix some things regarding COMPAT_NETBSD32 and limits/VM addresses.
* For sparc64 and amd64, define *SIZ32 VM constants.
* Add a new function pointer to struct emul, pointing at a function
that will return the default VM map address. The default function
is uvm_map_defaultaddr, which just uses the VM_DEFAULT_ADDRESS
macro. This gives emulations control over the default map address,
and allows things to be mapped at the right address (in 32bit range)
for COMPAT_NETBSD32.
* Add code to adjust the data and stack limits when a COMPAT_NETBSD32
or COMPAT_SVR4_32 binary is executed.
* Don't use USRSTACK in kern_resource.c, use p_vmspace->vm_minsaddr
instead (emulations might have set it differently)
* Since this changes struct emul, bump kernel version to 3.99.2
Tested on amd64, compile-tested on sparc64.
 1.18.6.1 26-Mar-2005  yamt sync with head.
 1.18.4.1 29-Apr-2005  kent sync with -current
 1.19.2.1 07-Dec-2007  yamt sync with head
 1.20.56.1 08-Dec-2007  ad Sync with head.
 1.20.52.1 08-Dec-2007  mjf Sync with HEAD.
 1.20.46.1 09-Jan-2008  matt sync with HEAD
 1.20.44.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.21.16.4 11-Aug-2010  yamt sync with head.
 1.21.16.3 20-Jun-2009  yamt sync with head
 1.21.16.2 04-May-2009  yamt sync with head.
 1.21.16.1 16-May-2008  yamt sync with head.
 1.21.14.1 18-May-2008  yamt sync with head.
 1.21.12.2 17-Jan-2009  mjf Sync with HEAD.
 1.21.12.1 02-Jun-2008  mjf Sync with HEAD.
 1.22.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.22.6.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.23.4.1 23-Jul-2009  jym Sync with HEAD.
 1.24.4.1 05-Mar-2011  rmind sync with head
 1.24.2.2 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.24.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.26.12.1 24-Feb-2012  mrg sync to -current.
 1.26.8.1 17-Apr-2012  yamt sync with head
 1.28.2.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.28.2.1 21-May-2018  pgoyette Sync with HEAD
 1.29.2.1 10-Jun-2019  christos Sync with HEAD
 1.4 14-Sep-2004  jdolecek remove all alternative path check code, and (empty) ioctl wrapper
 1.3 18-Jan-2003  thorpej branches: 1.3.2;
Merge the nathanw_sa branch.
 1.2 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.1 02-Dec-2000  scw branches: 1.1.2; 1.1.4; 1.1.6;
Initial cut of COMPAT_AOUT_M68K.
This gets most existing m68k a.out binaries working with m68k ELF
kernels.

There are still some remaining ABI issues to track down; most notably,
some ioctl(2) calls are affected by the change.
 1.1.6.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.4.4 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.1.4.3 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.1.4.2 17-Nov-2001  scw Add set/get_context syscall entries and regenerate sources from
syscalls.master.
Also s/proc/lwp/ where appropriate.
 1.1.4.1 14-Nov-2001  nathanw Catch up to -current.
 1.1.2.2 08-Jan-2001  bouyer Files added on trunk.
 1.1.2.1 02-Dec-2000  bouyer file aoutm68k_ioctl.c was added on branch thorpej_scsipi on 2001-01-08 14:56:46 +0000
 1.3.2.3 22-Sep-2004  skrll Fix.
 1.3.2.2 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.2.1 18-Sep-2004  skrll Sync with HEAD.
 1.10 14-Sep-2004  jdolecek remove all alternative path check code, and (empty) ioctl wrapper
 1.9 21-Apr-2004  christos Replace the statfs() family of system calls with statvfs().
Retain binary compatibility.
 1.8 29-Jun-2003  fvdl branches: 1.8.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.7 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.6 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.5 16-Mar-2002  christos make the stackgap_{init,alloc} functions MP friendly (i.e. pass struct proc *
in, instead of using curproc). While there add an optional size argument to
stackgap_init.
 1.4 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.3 30-May-2001  mrg branches: 1.3.2;
use _KERNEL_OPT.
 1.2 22-Jan-2001  jdolecek branches: 1.2.2;
Use CHECK_ALT_SYMLINK() instead CHECK_ALT_EXISTS() where appropriate.
This addresses kern/11757.
 1.1 02-Dec-2000  scw branches: 1.1.2;
Initial cut of COMPAT_AOUT_M68K.
This gets most existing m68k a.out binaries working with m68k ELF
kernels.

There are still some remaining ABI issues to track down; most notably,
some ioctl(2) calls are affected by the change.
 1.1.2.3 11-Feb-2001  bouyer Sync with HEAD.
 1.1.2.2 08-Jan-2001  bouyer Files added on trunk.
 1.1.2.1 02-Dec-2000  bouyer file aoutm68k_misc.c was added on branch thorpej_scsipi on 2001-01-08 14:56:47 +0000
 1.2.2.8 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.2.2.7 03-Jul-2002  nathanw Whitespace.
 1.2.2.6 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.2.2.5 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.2.2.4 18-Nov-2001  scw CHECK_ALT_EXISTS() takes a proc *, not an lwp *.
 1.2.2.3 17-Nov-2001  scw Add set/get_context syscall entries and regenerate sources from
syscalls.master.
Also s/proc/lwp/ where appropriate.
 1.2.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.2.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.3.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.3.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.8.2.5 22-Sep-2004  skrll Fix.
 1.8.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.8.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.8.2.2 03-Aug-2004  skrll Sync with HEAD
 1.8.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.3 07-Mar-2014  christos c99 initializers for struct execsw
 1.2 19-Sep-2013  christos exec modules need to be of the exec kind
 1.1 19-Nov-2008  ad branches: 1.1.4; 1.1.6; 1.1.8; 1.1.12; 1.1.24; 1.1.34; 1.1.38;
Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.1.38.1 18-May-2014  rmind sync with head
 1.1.34.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.24.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.1.12.2 04-May-2009  yamt sync with head.
 1.1.12.1 19-Nov-2008  yamt file aoutm68k_mod.c was added on branch yamt-nfs-mp on 2009-05-04 08:12:17 +0000
 1.1.8.2 19-Jan-2009  skrll Sync with HEAD.
 1.1.8.1 19-Nov-2008  skrll file aoutm68k_mod.c was added on branch nick-hppapmap on 2009-01-19 13:17:16 +0000
 1.1.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.1.6.1 19-Nov-2008  mjf file aoutm68k_mod.c was added on branch mjf-devfs2 on 2009-01-17 13:28:40 +0000
 1.1.4.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.1.4.1 19-Nov-2008  haad file aoutm68k_mod.c was added on branch haad-dm on 2008-12-13 01:13:44 +0000
 1.24 28-Apr-2008  martin branches: 1.24.2;
Remove clause 3 and 4 from TNF licenses
 1.23 23-Mar-2008  ad branches: 1.23.2; 1.23.4;
Make this build again. From isaki@.
 1.22 20-Dec-2007  dsl branches: 1.22.6;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.21 08-Dec-2007  dsl branches: 1.21.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.20 30-Apr-2007  dsl branches: 1.20.6; 1.20.8; 1.20.16;
Rework compat stat() and statvfs() code so that it no longer uses the stackgap.
 1.19 22-Apr-2007  dsl Change the way that emulations locate files within the emulation root to
avoid having to allocate space in the 'stackgap'
- which is very LWP unfriendly.
The additional code for non-emulation namei() is trivial, the reduction for
the emulations is massive.
The vnode for a processes emulation root is saved in the cwdi structure
during process exec.
If the emulation root the TRYEMULROOT flag are set, namei() will do an initial
search for absolute pathnames in the emulation root, if that fails it will
retry from the normal root.
".." at the emulation root will always go to the real root, even in the middle
of paths and when expanding symlinks.
Absolute symlinks found using absolute paths in the emulation root will be
relative to the emulation root (so /usr/lib/xxx.so -> /lib/xxx.so links
inside the emulation root don't need changing).
If the root of the emulation would be returned (for an emulation lookup), then
the real root is returned instead (matching the behaviour of emul_lookup,
but being a cheap comparison here) so that programs that scan "../.."
looking for the root dircetory don't loop forever.
The target for symbolic links is no longer mangled (it used to get the
CHECK_ALT_xxx() treatment, so could get /emul/xxx prepended).
CHECK_ALT_xxx() are no more. Most of the change is deleting them, and adding
TRYEMULROOT to the flags to NDINIT().
A lot of the emulation system call stubs could now be deleted.
 1.18 10-Mar-2007  dsl branches: 1.18.2;
Update all the compat stuff to not use the 'stackgap' for processing
sys_stat() and friends, instead use do_sys_stat() and do_sys_fstat()
that write the answer into a kernel buffer (on stack) that can be
converted to the correct form and written the userspace.
I've test compiled a few kernels, and tested i386 netbsd1.6 ls.
Given I think I've fixed some bugs, it might be 50-50 with new ones.
 1.17 04-Mar-2007  christos branches: 1.17.2;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.16 09-Feb-2007  ad branches: 1.16.2;
Merge newlock2 to head.
 1.15 01-Aug-2006  martin branches: 1.15.4;
Adapt to latest fhandle_t changes.
Pointed out by Havard Eidnes.
 1.14 05-May-2006  tsutsui Update for fhstat(2) versioning.
 1.13 11-Dec-2005  christos branches: 1.13.4; 1.13.6; 1.13.8; 1.13.10; 1.13.12;
merge ktrace-lwp.
 1.12 14-Sep-2005  he This file now needs <compat/sys/stat.h> to build.
 1.11 22-Aug-2005  he Change from using sys___{,f,l}stat13() to sys___{,f,l}stat30() and
associated data structures, following the change to 64-bit inodes.
 1.10 29-Jun-2003  fvdl branches: 1.10.2; 1.10.18;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.9 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.8 02-Apr-2003  he Fill the target st_qspare array with 0, the source field has been reclaimed
for other use by the UFS2 merge, and this is just a filler anyway.
 1.7 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.6 16-Mar-2002  christos make the stackgap_{init,alloc} functions MP friendly (i.e. pass struct proc *
in, instead of using curproc). While there add an optional size argument to
stackgap_init.
 1.5 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.4 30-May-2001  mrg branches: 1.4.2;
use _KERNEL_OPT.
 1.3 07-Apr-2001  tsutsui Allow enabling/disabling /emul/aout alternate path search
on COMPAT_AOUT_M68K environment by options COMPAT_AOUT_ALTPATH.
 1.2 06-Dec-2000  jdolecek branches: 1.2.2; 1.2.4;
make LKM safe
 1.1 02-Dec-2000  scw Initial cut of COMPAT_AOUT_M68K.
This gets most existing m68k a.out binaries working with m68k ELF
kernels.

There are still some remaining ABI issues to track down; most notably,
some ioctl(2) calls are affected by the change.
 1.2.4.8 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.2.4.7 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.2.4.6 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.2.4.5 18-Nov-2001  scw CHECK_ALT_EXISTS() takes a proc *, not an lwp *.
 1.2.4.4 17-Nov-2001  scw Add set/get_context syscall entries and regenerate sources from
syscalls.master.
Also s/proc/lwp/ where appropriate.
 1.2.4.3 14-Nov-2001  nathanw Catch up to -current.
 1.2.4.2 21-Jun-2001  nathanw Catch up to -current.
 1.2.4.1 09-Apr-2001  nathanw Catch up with -current.
 1.2.2.3 21-Apr-2001  bouyer Sync with HEAD
 1.2.2.2 08-Jan-2001  bouyer Files added on trunk.
 1.2.2.1 06-Dec-2000  bouyer file aoutm68k_stat.c was added on branch thorpej_scsipi on 2001-01-08 14:56:47 +0000
 1.4.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.4.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.10.18.6 24-Mar-2008  yamt sync with head.
 1.10.18.5 21-Jan-2008  yamt sync with head
 1.10.18.4 03-Sep-2007  yamt sync with head.
 1.10.18.3 26-Feb-2007  yamt sync with head.
 1.10.18.2 30-Dec-2006  yamt sync with head.
 1.10.18.1 21-Jun-2006  yamt sync with head.
 1.10.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.10.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.10.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.10.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.13.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.13.10.1 11-May-2006  elad sync with head
 1.13.8.2 11-Aug-2006  yamt sync with head
 1.13.8.1 24-May-2006  yamt sync with head.
 1.13.6.1 01-Jun-2006  kardel Sync with head.
 1.13.4.1 09-Sep-2006  rpaulo sync with head
 1.15.4.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.16.2.2 07-May-2007  yamt sync with head.
 1.16.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.17.2.2 27-May-2007  ad Sync with head.
 1.17.2.1 13-Mar-2007  ad Sync with head.
 1.18.2.1 11-Jul-2007  mjf Sync with head.
 1.20.16.1 26-Dec-2007  ad Sync with head.
 1.20.8.1 09-Jan-2008  matt sync with HEAD
 1.20.6.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.21.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.22.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.22.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.23.4.1 16-May-2008  yamt sync with head.
 1.23.2.1 18-May-2008  yamt sync with head.
 1.24.2.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.24.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.8 11-Jan-2009  mhitch Compat a.out stat structures also need to use u_int32_t dev_t.
 1.7 11-Jan-2009  tsutsui Compat a.out stat structures should use compat struct timespec50.
Noticed by mhitch@.
 1.6 28-Apr-2008  martin branches: 1.6.8;
Remove clause 3 and 4 from TNF licenses
 1.5 11-Dec-2005  christos branches: 1.5.70; 1.5.72; 1.5.74;
merge ktrace-lwp.
 1.4 19-Aug-2005  christos 64 bit inode changes.
 1.3 25-Jun-2003  martin branches: 1.3.2; 1.3.18;
#ifdef _KERNEL_OPT police
 1.2 23-Jun-2003  martin Make sure to include opt_foo.h if a defflag option FOO is used.
 1.1 02-Dec-2000  scw branches: 1.1.2;
Initial cut of COMPAT_AOUT_M68K.
This gets most existing m68k a.out binaries working with m68k ELF
kernels.

There are still some remaining ABI issues to track down; most notably,
some ioctl(2) calls are affected by the change.
 1.1.2.2 08-Jan-2001  bouyer Files added on trunk.
 1.1.2.1 02-Dec-2000  bouyer file aoutm68k_stat.h was added on branch thorpej_scsipi on 2001-01-08 14:56:48 +0000
 1.3.18.1 21-Jun-2006  yamt sync with head.
 1.3.2.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.5.74.2 04-May-2009  yamt sync with head.
 1.5.74.1 16-May-2008  yamt sync with head.
 1.5.72.1 18-May-2008  yamt sync with head.
 1.5.70.2 17-Jan-2009  mjf Sync with HEAD.
 1.5.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.6.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.55 18-Jun-2019  christos regen
 1.54 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.53 10-Aug-2018  pgoyette Regen
 1.52 06-Jan-2018  kamil branches: 1.52.2; 1.52.4;
Revert vadvise(2) removal

This system call was used in legacy Lisp code, that was inherited to modern
age and still compiled against supported compat layers (e.g. in clisp,
oaklisp, Franz Lisp).

It used to instruct the kernel about paging policy (G/C aware, flush etc).

Newly compiled code (assuming that it will detect vadvise()) will use the
libc stub for vadvise(). The headers for this interface are gone.

vadvise(2) could be marked as COMPAT_80, but as long as we support ultrix,
sunos or aout68k ABI, don't bother with this.

Requested by <mrg>
 1.51 19-Dec-2017  kamil compat/aoutm68k: Drop SYS_vadvise

The (o)vadvise syscall is dummy since the beginning of NetBSD.

Sponsored by <The NetBSD Foundation>
 1.50 19-Dec-2017  kamil compat/aoutm68k: Drop SYS_sbrk

sbrk - change data segment size

This syscall is dummy since the inception of the project. It's implemented
in userland in libc.

Sponsored by <The NetBSD Foundation>
 1.49 19-Dec-2017  kamil compat aoutm68k: Mark sstk(2) as OBSOL

Remove the sstk(2) syscall support and mark it as obsolete.
It has never been implemented in the kernel.

Sponsored by <The NetBSD Foundation>
 1.48 10-May-2017  riastradh regen
 1.47 16-Jan-2017  christos branches: 1.47.4;
regen
 1.46 13-Jan-2017  christos branches: 1.46.2;
regen
 1.45 24-Sep-2015  christos branches: 1.45.2;
Regen
 1.44 07-Mar-2015  christos regen
 1.43 25-Jan-2014  christos branches: 1.43.6;
regen
 1.42 07-Mar-2011  bouyer Regen: use COMPAT_50 quotactl, not the native one
 1.41 02-Mar-2010  pooka branches: 1.41.2; 1.41.4;
regen:
- remove nfssvc / fs_nfs.h / #ifdef NFS
- make getfh unconditional
 1.40 02-Mar-2010  pooka regen for conditional lfs syscall removal
 1.39 14-Dec-2009  matt branches: 1.39.2;
Regen (new makesyscalls.sh)
 1.38 13-Jan-2009  pooka Regen to prove I didn't screw up the conversion: purely RCSID changes.
 1.37 13-Jan-2009  pooka regen
 1.36 11-Jan-2009  tsutsui Regen from syscalls.master rev 1.31:
> Update for compat_50 stuff. (compile test only)
 1.35 21-Nov-2008  he Commit regenerated files after this change to syscalls.master:

sys_nfssvc() is actually only defined when NFSSERVER is defined,
not when only NFS is defined, according to sys/nfs/files.nfs.
Adapt accordingly. Fixes build of amiga INSTALL kernel.
 1.34 12-Nov-2008  ad Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.
 1.33 21-Jun-2008  he branches: 1.33.2; 1.33.4;
Commit regenerated files after adding include of <sys/sched.h>.
 1.32 23-Apr-2008  ad branches: 1.32.2; 1.32.4; 1.32.6;
Regen.
 1.31 20-Dec-2007  dsl branches: 1.31.6; 1.31.8;
regen
 1.30 12-Nov-2007  dsl branches: 1.30.2;
regen
 1.29 09-Nov-2007  dsl Regen
 1.28 14-Jul-2007  dsl branches: 1.28.6; 1.28.8; 1.28.12; 1.28.14;
Adapt for sys_mount() becoming compat_40_sys_mount(),
 1.27 04-Mar-2007  christos branches: 1.27.2;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.26 01-Sep-2006  matt branches: 1.26.8;
Regen.
 1.25 30-Aug-2006  he Regenerate after dealing with options PTRACE.
 1.24 01-Aug-2006  martin regen
 1.23 13-Jul-2006  pavel regen (sys_getfh -> compat_30_sys_getfh).
 1.22 26-Jun-2006  mrg regenerate.
 1.21 29-May-2006  drochner branches: 1.21.2;
regen
 1.20 07-May-2006  tsutsui branches: 1.20.2;
Regen from syscalls.master rev 1.15:
> Use "#if defined(COMPAT_xx) || !defined(_KERNEL)" so that
> kdump(1) can get all proper syscall names.
 1.19 04-May-2006  christos regen
 1.18 11-Dec-2005  christos branches: 1.18.4; 1.18.6; 1.18.8; 1.18.10; 1.18.12;
merge ktrace-lwp.
 1.17 26-Feb-2005  perry branches: 1.17.4;
regen
 1.16 14-Sep-2004  jdolecek branches: 1.16.4; 1.16.6;
regen:
remove all alternative path check code, and (empty) ioctl wrapper
 1.15 22-Apr-2004  matt Regen for statvfs changes.
 1.14 23-Sep-2003  cl regen
 1.13 22-Sep-2003  cl regen
 1.12 18-Jan-2003  thorpej branches: 1.12.2;
Regen to get correct RCS ID.
 1.11 18-Jan-2003  thorpej Regen: Merge the nathanw_sa branch.
 1.10 01-Nov-2002  jdolecek set nsysent to 512
 1.9 03-May-2002  eeh Regen.
 1.8 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.7 30-May-2001  mrg branches: 1.7.2;
use _KERNEL_OPT.
 1.6 07-Apr-2001  tsutsui Regen from aoutm68k/syscalls.master rev 1.5:
> Allow enabling/disabling /emul/aout alternate path search
> on COMPAT_AOUT_M68K environment by options COMPAT_AOUT_ALTPATH.
 1.5 27-Jan-2001  thorpej branches: 1.5.2;
Regen; getpid(2) is MP-safe.
 1.4 27-Jan-2001  thorpej Regen; add sy_flags.
 1.3 09-Dec-2000  mycroft branches: 1.3.2;
Regen.
 1.2 06-Dec-2000  jdolecek regen
 1.1 02-Dec-2000  scw Initial cut of COMPAT_AOUT_M68K.
This gets most existing m68k a.out binaries working with m68k ELF
kernels.

There are still some remaining ABI issues to track down; most notably,
some ioctl(2) calls are affected by the change.
 1.3.2.4 21-Apr-2001  bouyer Sync with HEAD
 1.3.2.3 11-Feb-2001  bouyer Sync with HEAD.
 1.3.2.2 08-Jan-2001  bouyer Files added on trunk.
 1.3.2.1 09-Dec-2000  bouyer file aoutm68k_syscall.h was added on branch thorpej_scsipi on 2001-01-08 14:56:48 +0000
 1.5.2.7 11-Nov-2002  nathanw Catch up to -current
 1.5.2.6 21-Jun-2002  gmcgarry regen
 1.5.2.5 29-May-2002  nathanw Regen.
 1.5.2.4 17-Nov-2001  scw Add set/get_context syscall entries and regenerate sources from
syscalls.master.
Also s/proc/lwp/ where appropriate.
 1.5.2.3 14-Nov-2001  nathanw Catch up to -current.
 1.5.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.5.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.7.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.7.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.12.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.12.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.12.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.12.2.1 03-Aug-2004  skrll Sync with HEAD
 1.16.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.16.4.1 29-Apr-2005  kent sync with -current
 1.17.4.4 15-Nov-2007  yamt sync with head.
 1.17.4.3 03-Sep-2007  yamt sync with head.
 1.17.4.2 30-Dec-2006  yamt sync with head.
 1.17.4.1 21-Jun-2006  yamt sync with head.
 1.18.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.18.10.1 11-May-2006  elad sync with head
 1.18.8.4 03-Sep-2006  yamt sync with head.
 1.18.8.3 11-Aug-2006  yamt sync with head
 1.18.8.2 26-Jun-2006  yamt sync with head.
 1.18.8.1 24-May-2006  yamt sync with head.
 1.18.6.1 01-Jun-2006  kardel Sync with head.
 1.18.4.1 09-Sep-2006  rpaulo sync with head
 1.20.2.1 19-Jun-2006  chap Sync with head.
 1.21.2.1 13-Jul-2006  gdamore Merge from HEAD.
 1.26.8.1 12-Mar-2007  rmind Sync with HEAD.
 1.27.2.1 15-Jul-2007  ad Sync with head.
 1.28.14.2 27-Dec-2007  mjf Sync with HEAD.
 1.28.14.1 19-Nov-2007  mjf Sync with HEAD.
 1.28.12.1 13-Nov-2007  bouyer Sync with HEAD
 1.28.8.1 09-Jan-2008  matt sync with HEAD
 1.28.6.2 14-Nov-2007  joerg Sync with HEAD.
 1.28.6.1 11-Nov-2007  joerg Sync with HEAD.
 1.30.2.1 26-Dec-2007  ad Sync with head.
 1.31.8.1 18-May-2008  yamt sync with head.
 1.31.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.31.6.2 29-Jun-2008  mjf Sync with HEAD.
 1.31.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.32.6.1 27-Jun-2008  simonb Sync with head.
 1.32.4.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.32.2.2 11-Mar-2010  yamt sync with head
 1.32.2.1 04-May-2009  yamt sync with head.
 1.33.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.33.2.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.39.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.41.4.1 06-Jun-2011  jruoho Sync with HEAD.
 1.41.2.1 21-Apr-2011  rmind sync with head
 1.43.6.1 06-Apr-2015  skrll Sync with HEAD
 1.45.2.1 20-Mar-2017  pgoyette Sync with HEAD
 1.46.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.47.4.1 11-May-2017  pgoyette Sync with HEAD
 1.52.4.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.52.4.1 10-Jun-2019  christos Sync with HEAD
 1.52.2.2 29-Sep-2018  pgoyette Regen
 1.52.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.53 18-Jun-2019  christos regen
 1.52 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.51 10-Aug-2018  pgoyette Regen
 1.50 06-Jan-2018  kamil branches: 1.50.2; 1.50.4;
Revert vadvise(2) removal

This system call was used in legacy Lisp code, that was inherited to modern
age and still compiled against supported compat layers (e.g. in clisp,
oaklisp, Franz Lisp).

It used to instruct the kernel about paging policy (G/C aware, flush etc).

Newly compiled code (assuming that it will detect vadvise()) will use the
libc stub for vadvise(). The headers for this interface are gone.

vadvise(2) could be marked as COMPAT_80, but as long as we support ultrix,
sunos or aout68k ABI, don't bother with this.

Requested by <mrg>
 1.49 19-Dec-2017  kamil compat/aoutm68k: Drop SYS_vadvise

The (o)vadvise syscall is dummy since the beginning of NetBSD.

Sponsored by <The NetBSD Foundation>
 1.48 19-Dec-2017  kamil compat/aoutm68k: Drop SYS_sbrk

sbrk - change data segment size

This syscall is dummy since the inception of the project. It's implemented
in userland in libc.

Sponsored by <The NetBSD Foundation>
 1.47 19-Dec-2017  kamil compat aoutm68k: Mark sstk(2) as OBSOL

Remove the sstk(2) syscall support and mark it as obsolete.
It has never been implemented in the kernel.

Sponsored by <The NetBSD Foundation>
 1.46 10-May-2017  riastradh regen
 1.45 16-Jan-2017  christos branches: 1.45.4;
regen
 1.44 13-Jan-2017  christos branches: 1.44.2;
regen
 1.43 24-Sep-2015  christos branches: 1.43.2;
Regen
 1.42 07-Mar-2015  christos regen
 1.41 25-Jan-2014  christos branches: 1.41.6;
regen
 1.40 07-Mar-2011  bouyer branches: 1.40.14;
Regen: use COMPAT_50 quotactl, not the native one
 1.39 02-Mar-2010  pooka branches: 1.39.2; 1.39.4;
regen:
- remove nfssvc / fs_nfs.h / #ifdef NFS
- make getfh unconditional
 1.38 02-Mar-2010  pooka regen for conditional lfs syscall removal
 1.37 14-Dec-2009  matt branches: 1.37.2;
Regen (new makesyscalls.sh)
 1.36 13-Jan-2009  pooka Regen to prove I didn't screw up the conversion: purely RCSID changes.
 1.35 13-Jan-2009  pooka regen
 1.34 11-Jan-2009  tsutsui Regen from syscalls.master rev 1.31:
> Update for compat_50 stuff. (compile test only)
 1.33 21-Nov-2008  he Commit regenerated files after this change to syscalls.master:

sys_nfssvc() is actually only defined when NFSSERVER is defined,
not when only NFS is defined, according to sys/nfs/files.nfs.
Adapt accordingly. Fixes build of amiga INSTALL kernel.
 1.32 12-Nov-2008  ad Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.
 1.31 21-Jun-2008  he branches: 1.31.2; 1.31.4;
Commit regenerated files after adding include of <sys/sched.h>.
 1.30 23-Apr-2008  ad branches: 1.30.2; 1.30.4; 1.30.6;
Regen.
 1.29 20-Dec-2007  dsl branches: 1.29.6; 1.29.8;
regen
 1.28 12-Nov-2007  dsl branches: 1.28.2; 1.28.6;
regen
 1.27 09-Nov-2007  dsl Regen
 1.26 14-Jul-2007  dsl branches: 1.26.6; 1.26.8; 1.26.12; 1.26.14;
Adapt for sys_mount() becoming compat_40_sys_mount(),
 1.25 01-Sep-2006  matt branches: 1.25.12;
Regen.
 1.24 30-Aug-2006  he Regenerate after dealing with options PTRACE.
 1.23 01-Aug-2006  martin regen
 1.22 13-Jul-2006  pavel regen (sys_getfh -> compat_30_sys_getfh).
 1.21 26-Jun-2006  mrg regenerate.
 1.20 29-May-2006  drochner branches: 1.20.2;
regen
 1.19 07-May-2006  tsutsui branches: 1.19.2;
Regen from syscalls.master rev 1.15:
> Use "#if defined(COMPAT_xx) || !defined(_KERNEL)" so that
> kdump(1) can get all proper syscall names.
 1.18 04-May-2006  christos regen
 1.17 11-Dec-2005  christos branches: 1.17.4; 1.17.6; 1.17.8; 1.17.10; 1.17.12;
merge ktrace-lwp.
 1.16 26-Feb-2005  perry branches: 1.16.4;
regen
 1.15 14-Sep-2004  jdolecek branches: 1.15.4; 1.15.6;
regen:
remove all alternative path check code, and (empty) ioctl wrapper
 1.14 22-Apr-2004  matt Regen for statvfs changes.
 1.13 23-Sep-2003  cl regen
 1.12 22-Sep-2003  cl regen
 1.11 18-Jan-2003  thorpej branches: 1.11.2;
Regen to get correct RCS ID.
 1.10 18-Jan-2003  thorpej Regen: Merge the nathanw_sa branch.
 1.9 03-May-2002  eeh Regen.
 1.8 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.7 30-May-2001  mrg branches: 1.7.2;
use _KERNEL_OPT.
 1.6 07-Apr-2001  tsutsui Regen from aoutm68k/syscalls.master rev 1.5:
> Allow enabling/disabling /emul/aout alternate path search
> on COMPAT_AOUT_M68K environment by options COMPAT_AOUT_ALTPATH.
 1.5 27-Jan-2001  thorpej branches: 1.5.2;
Regen; getpid(2) is MP-safe.
 1.4 27-Jan-2001  thorpej Regen; add sy_flags.
 1.3 09-Dec-2000  mycroft branches: 1.3.2;
Regen.
 1.2 06-Dec-2000  jdolecek regen
 1.1 02-Dec-2000  scw Initial cut of COMPAT_AOUT_M68K.
This gets most existing m68k a.out binaries working with m68k ELF
kernels.

There are still some remaining ABI issues to track down; most notably,
some ioctl(2) calls are affected by the change.
 1.3.2.4 21-Apr-2001  bouyer Sync with HEAD
 1.3.2.3 11-Feb-2001  bouyer Sync with HEAD.
 1.3.2.2 08-Jan-2001  bouyer Files added on trunk.
 1.3.2.1 09-Dec-2000  bouyer file aoutm68k_syscallargs.h was added on branch thorpej_scsipi on 2001-01-08 14:56:49 +0000
 1.5.2.8 11-Nov-2002  nathanw Catch up to -current
 1.5.2.7 21-Jun-2002  gmcgarry regen
 1.5.2.6 20-Jun-2002  nathanw Catch up to -current.
 1.5.2.5 29-May-2002  nathanw Regen.
 1.5.2.4 17-Nov-2001  scw Add set/get_context syscall entries and regenerate sources from
syscalls.master.
Also s/proc/lwp/ where appropriate.
 1.5.2.3 14-Nov-2001  nathanw Catch up to -current.
 1.5.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.5.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.7.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.7.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.11.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.11.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.11.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.11.2.1 03-Aug-2004  skrll Sync with HEAD
 1.15.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.15.4.1 29-Apr-2005  kent sync with -current
 1.16.4.5 21-Jan-2008  yamt sync with head
 1.16.4.4 15-Nov-2007  yamt sync with head.
 1.16.4.3 03-Sep-2007  yamt sync with head.
 1.16.4.2 30-Dec-2006  yamt sync with head.
 1.16.4.1 21-Jun-2006  yamt sync with head.
 1.17.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.17.10.1 11-May-2006  elad sync with head
 1.17.8.4 03-Sep-2006  yamt sync with head.
 1.17.8.3 11-Aug-2006  yamt sync with head
 1.17.8.2 26-Jun-2006  yamt sync with head.
 1.17.8.1 24-May-2006  yamt sync with head.
 1.17.6.1 01-Jun-2006  kardel Sync with head.
 1.17.4.1 09-Sep-2006  rpaulo sync with head
 1.19.2.1 19-Jun-2006  chap Sync with head.
 1.20.2.1 13-Jul-2006  gdamore Merge from HEAD.
 1.25.12.1 15-Jul-2007  ad Sync with head.
 1.26.14.2 27-Dec-2007  mjf Sync with HEAD.
 1.26.14.1 19-Nov-2007  mjf Sync with HEAD.
 1.26.12.1 13-Nov-2007  bouyer Sync with HEAD
 1.26.8.1 09-Jan-2008  matt sync with HEAD
 1.26.6.2 14-Nov-2007  joerg Sync with HEAD.
 1.26.6.1 11-Nov-2007  joerg Sync with HEAD.
 1.28.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.28.2.1 26-Dec-2007  ad Sync with head.
 1.29.8.1 18-May-2008  yamt sync with head.
 1.29.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.29.6.2 29-Jun-2008  mjf Sync with HEAD.
 1.29.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.30.6.1 27-Jun-2008  simonb Sync with head.
 1.30.4.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.30.2.2 11-Mar-2010  yamt sync with head
 1.30.2.1 04-May-2009  yamt sync with head.
 1.31.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.31.2.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.37.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.39.4.1 06-Jun-2011  jruoho Sync with HEAD.
 1.39.2.1 21-Apr-2011  rmind sync with head
 1.40.14.1 03-Dec-2017  jdolecek update from HEAD
 1.41.6.2 28-Aug-2017  skrll Sync with HEAD
 1.41.6.1 06-Apr-2015  skrll Sync with HEAD
 1.43.2.1 20-Mar-2017  pgoyette Sync with HEAD
 1.44.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.45.4.1 11-May-2017  pgoyette Sync with HEAD
 1.50.4.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.50.4.1 10-Jun-2019  christos Sync with HEAD
 1.50.2.2 29-Sep-2018  pgoyette Regen
 1.50.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.52 18-Jun-2019  christos regen
 1.51 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.50 10-Aug-2018  pgoyette Regen
 1.49 06-Jan-2018  kamil branches: 1.49.2; 1.49.4;
Revert vadvise(2) removal

This system call was used in legacy Lisp code, that was inherited to modern
age and still compiled against supported compat layers (e.g. in clisp,
oaklisp, Franz Lisp).

It used to instruct the kernel about paging policy (G/C aware, flush etc).

Newly compiled code (assuming that it will detect vadvise()) will use the
libc stub for vadvise(). The headers for this interface are gone.

vadvise(2) could be marked as COMPAT_80, but as long as we support ultrix,
sunos or aout68k ABI, don't bother with this.

Requested by <mrg>
 1.48 19-Dec-2017  kamil compat/aoutm68k: Drop SYS_vadvise

The (o)vadvise syscall is dummy since the beginning of NetBSD.

Sponsored by <The NetBSD Foundation>
 1.47 19-Dec-2017  kamil compat/aoutm68k: Drop SYS_sbrk

sbrk - change data segment size

This syscall is dummy since the inception of the project. It's implemented
in userland in libc.

Sponsored by <The NetBSD Foundation>
 1.46 19-Dec-2017  kamil compat aoutm68k: Mark sstk(2) as OBSOL

Remove the sstk(2) syscall support and mark it as obsolete.
It has never been implemented in the kernel.

Sponsored by <The NetBSD Foundation>
 1.45 10-May-2017  riastradh regen
 1.44 16-Jan-2017  christos branches: 1.44.4;
regen
 1.43 13-Jan-2017  christos branches: 1.43.2;
regen
 1.42 24-Sep-2015  christos branches: 1.42.2;
Regen
 1.41 07-Mar-2015  christos regen
 1.40 25-Jan-2014  christos branches: 1.40.6;
regen
 1.39 07-Mar-2011  bouyer branches: 1.39.14;
Regen: use COMPAT_50 quotactl, not the native one
 1.38 02-Mar-2010  pooka branches: 1.38.2; 1.38.4;
regen:
- remove nfssvc / fs_nfs.h / #ifdef NFS
- make getfh unconditional
 1.37 02-Mar-2010  pooka regen for conditional lfs syscall removal
 1.36 14-Dec-2009  matt branches: 1.36.2;
Regen (new makesyscalls.sh)
 1.35 13-Jan-2009  pooka Regen to prove I didn't screw up the conversion: purely RCSID changes.
 1.34 13-Jan-2009  pooka regen
 1.33 11-Jan-2009  tsutsui Regen from syscalls.master rev 1.31:
> Update for compat_50 stuff. (compile test only)
 1.32 21-Nov-2008  he Commit regenerated files after this change to syscalls.master:

sys_nfssvc() is actually only defined when NFSSERVER is defined,
not when only NFS is defined, according to sys/nfs/files.nfs.
Adapt accordingly. Fixes build of amiga INSTALL kernel.
 1.31 12-Nov-2008  ad Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.
 1.30 21-Jun-2008  he branches: 1.30.2; 1.30.4;
Commit regenerated files after adding include of <sys/sched.h>.
 1.29 23-Apr-2008  ad branches: 1.29.2; 1.29.4; 1.29.6;
Regen.
 1.28 20-Dec-2007  dsl branches: 1.28.6; 1.28.8;
regen
 1.27 12-Nov-2007  dsl branches: 1.27.2;
regen
 1.26 09-Nov-2007  dsl Regen
 1.25 14-Jul-2007  dsl branches: 1.25.6; 1.25.8; 1.25.12; 1.25.14;
Adapt for sys_mount() becoming compat_40_sys_mount(),
 1.24 09-Feb-2007  ad branches: 1.24.6;
Merge newlock2 to head.
 1.23 01-Sep-2006  matt branches: 1.23.2;
Regen.
 1.22 30-Aug-2006  he Regenerate after dealing with options PTRACE.
 1.21 01-Aug-2006  martin regen
 1.20 13-Jul-2006  pavel regen (sys_getfh -> compat_30_sys_getfh).
 1.19 26-Jun-2006  mrg regenerate.
 1.18 29-May-2006  drochner branches: 1.18.2;
regen
 1.17 07-May-2006  tsutsui branches: 1.17.2; 1.17.4; 1.17.6;
Regen from syscalls.master rev 1.15:
> Use "#if defined(COMPAT_xx) || !defined(_KERNEL)" so that
> kdump(1) can get all proper syscall names.
 1.16 04-May-2006  tsutsui Generate initial aoutm68k_syscalls.c.
 1.15 10-Sep-2004  jdolecek branches: 1.15.6; 1.15.16; 1.15.18; 1.15.20;
garbage-collect aoutm68k_syscalls.c, it's just taking up space (it's not used)
 1.14 22-Apr-2004  matt Regen for statvfs changes.
 1.13 23-Sep-2003  cl regen
 1.12 22-Sep-2003  cl regen
 1.11 18-Jan-2003  thorpej branches: 1.11.2;
Regen to get correct RCS ID.
 1.10 18-Jan-2003  thorpej Regen: Merge the nathanw_sa branch.
 1.9 03-May-2002  eeh Regen.
 1.8 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.7 30-May-2001  mrg branches: 1.7.2;
use _KERNEL_OPT.
 1.6 07-Apr-2001  tsutsui Regen from aoutm68k/syscalls.master rev 1.5:
> Allow enabling/disabling /emul/aout alternate path search
> on COMPAT_AOUT_M68K environment by options COMPAT_AOUT_ALTPATH.
 1.5 27-Jan-2001  thorpej branches: 1.5.2;
Regen; getpid(2) is MP-safe.
 1.4 27-Jan-2001  thorpej Regen; add sy_flags.
 1.3 09-Dec-2000  mycroft branches: 1.3.2;
Regen.
 1.2 06-Dec-2000  jdolecek regen
 1.1 02-Dec-2000  scw Initial cut of COMPAT_AOUT_M68K.
This gets most existing m68k a.out binaries working with m68k ELF
kernels.

There are still some remaining ABI issues to track down; most notably,
some ioctl(2) calls are affected by the change.
 1.3.2.4 21-Apr-2001  bouyer Sync with HEAD
 1.3.2.3 11-Feb-2001  bouyer Sync with HEAD.
 1.3.2.2 08-Jan-2001  bouyer Files added on trunk.
 1.3.2.1 09-Dec-2000  bouyer file aoutm68k_syscalls.c was added on branch thorpej_scsipi on 2001-01-08 14:56:49 +0000
 1.5.2.8 11-Nov-2002  nathanw Catch up to -current
 1.5.2.7 21-Jun-2002  gmcgarry regen
 1.5.2.6 20-Jun-2002  nathanw Catch up to -current.
 1.5.2.5 29-May-2002  nathanw Regen.
 1.5.2.4 17-Nov-2001  scw Add set/get_context syscall entries and regenerate sources from
syscalls.master.
Also s/proc/lwp/ where appropriate.
 1.5.2.3 14-Nov-2001  nathanw Catch up to -current.
 1.5.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.5.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.7.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.7.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.11.2.4 22-Sep-2004  skrll Fix.
 1.11.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.11.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.11.2.1 03-Aug-2004  skrll Sync with HEAD
 1.15.20.4 03-Sep-2006  yamt sync with head.
 1.15.20.3 11-Aug-2006  yamt sync with head
 1.15.20.2 26-Jun-2006  yamt sync with head.
 1.15.20.1 24-May-2006  yamt sync with head.
 1.15.18.1 01-Jun-2006  kardel Sync with head.
 1.15.16.1 09-Sep-2006  rpaulo sync with head
 1.15.6.5 15-Nov-2007  yamt sync with head.
 1.15.6.4 03-Sep-2007  yamt sync with head.
 1.15.6.3 26-Feb-2007  yamt sync with head.
 1.15.6.2 30-Dec-2006  yamt sync with head.
 1.15.6.1 21-Jun-2006  yamt sync with head.
 1.17.6.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.17.6.1 07-May-2006  tron file aoutm68k_syscalls.c was added on branch peter-altq on 2006-05-24 15:48:26 +0000
 1.17.4.1 19-Jun-2006  chap Sync with head.
 1.17.2.2 11-May-2006  elad sync with head
 1.17.2.1 07-May-2006  elad file aoutm68k_syscalls.c was added on branch elad-kernelauth on 2006-05-11 23:27:30 +0000
 1.18.2.1 13-Jul-2006  gdamore Merge from HEAD.
 1.23.2.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.24.6.1 15-Jul-2007  ad Sync with head.
 1.25.14.2 27-Dec-2007  mjf Sync with HEAD.
 1.25.14.1 19-Nov-2007  mjf Sync with HEAD.
 1.25.12.1 13-Nov-2007  bouyer Sync with HEAD
 1.25.8.1 09-Jan-2008  matt sync with HEAD
 1.25.6.2 14-Nov-2007  joerg Sync with HEAD.
 1.25.6.1 11-Nov-2007  joerg Sync with HEAD.
 1.27.2.1 26-Dec-2007  ad Sync with head.
 1.28.8.1 18-May-2008  yamt sync with head.
 1.28.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.28.6.2 29-Jun-2008  mjf Sync with HEAD.
 1.28.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.29.6.1 27-Jun-2008  simonb Sync with head.
 1.29.4.3 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.29.4.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.29.4.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.29.2.2 11-Mar-2010  yamt sync with head
 1.29.2.1 04-May-2009  yamt sync with head.
 1.30.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.30.2.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.36.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.38.4.1 06-Jun-2011  jruoho Sync with HEAD.
 1.38.2.1 21-Apr-2011  rmind sync with head
 1.39.14.1 03-Dec-2017  jdolecek update from HEAD
 1.40.6.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.40.6.1 06-Apr-2015  skrll Sync with HEAD
 1.42.2.1 20-Mar-2017  pgoyette Sync with HEAD
 1.43.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.44.4.1 11-May-2017  pgoyette Sync with HEAD
 1.49.4.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.49.4.1 10-Jun-2019  christos Sync with HEAD
 1.49.2.2 29-Sep-2018  pgoyette Regen
 1.49.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.57 18-Jun-2019  christos regen
 1.56 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.55 10-Aug-2018  pgoyette Regen
 1.54 06-Jan-2018  kamil branches: 1.54.2; 1.54.4;
Revert vadvise(2) removal

This system call was used in legacy Lisp code, that was inherited to modern
age and still compiled against supported compat layers (e.g. in clisp,
oaklisp, Franz Lisp).

It used to instruct the kernel about paging policy (G/C aware, flush etc).

Newly compiled code (assuming that it will detect vadvise()) will use the
libc stub for vadvise(). The headers for this interface are gone.

vadvise(2) could be marked as COMPAT_80, but as long as we support ultrix,
sunos or aout68k ABI, don't bother with this.

Requested by <mrg>
 1.53 19-Dec-2017  kamil compat/aoutm68k: Drop SYS_vadvise

The (o)vadvise syscall is dummy since the beginning of NetBSD.

Sponsored by <The NetBSD Foundation>
 1.52 19-Dec-2017  kamil compat/aoutm68k: Drop SYS_sbrk

sbrk - change data segment size

This syscall is dummy since the inception of the project. It's implemented
in userland in libc.

Sponsored by <The NetBSD Foundation>
 1.51 19-Dec-2017  kamil compat aoutm68k: Mark sstk(2) as OBSOL

Remove the sstk(2) syscall support and mark it as obsolete.
It has never been implemented in the kernel.

Sponsored by <The NetBSD Foundation>
 1.50 10-May-2017  riastradh regen
 1.49 16-Jan-2017  christos branches: 1.49.4;
regen
 1.48 13-Jan-2017  christos branches: 1.48.2;
regen
 1.47 24-Sep-2015  christos branches: 1.47.2;
Regen
 1.46 07-Mar-2015  christos regen
 1.45 25-Jan-2014  christos branches: 1.45.6;
regen
 1.44 07-Mar-2011  bouyer branches: 1.44.4; 1.44.14; 1.44.18;
Regen: use COMPAT_50 quotactl, not the native one
 1.43 02-Mar-2010  pooka branches: 1.43.2; 1.43.4;
regen:
- remove nfssvc / fs_nfs.h / #ifdef NFS
- make getfh unconditional
 1.42 02-Mar-2010  pooka regen for conditional lfs syscall removal
 1.41 14-Dec-2009  matt branches: 1.41.2;
Regen (new makesyscalls.sh)
 1.40 13-Jan-2009  pooka Regen to prove I didn't screw up the conversion: purely RCSID changes.
 1.39 13-Jan-2009  pooka regen
 1.38 11-Jan-2009  tsutsui Regen from syscalls.master rev 1.31:
> Update for compat_50 stuff. (compile test only)
 1.37 21-Nov-2008  he Commit regenerated files after this change to syscalls.master:

sys_nfssvc() is actually only defined when NFSSERVER is defined,
not when only NFS is defined, according to sys/nfs/files.nfs.
Adapt accordingly. Fixes build of amiga INSTALL kernel.
 1.36 12-Nov-2008  ad Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.
 1.35 21-Jun-2008  he branches: 1.35.2; 1.35.4;
Commit regenerated files after adding include of <sys/sched.h>.
 1.34 17-Jun-2008  he <sys/syscallargs.h> now needs <sys/sched.h> included for the cpuset_t type
declaragion, so comply with that so that this builds again.
 1.33 23-Apr-2008  ad branches: 1.33.2; 1.33.4; 1.33.6;
Regen.
 1.32 20-Dec-2007  dsl branches: 1.32.6; 1.32.8;
regen
 1.31 12-Nov-2007  dsl branches: 1.31.2; 1.31.6;
regen
 1.30 09-Nov-2007  dsl Regen
 1.29 14-Jul-2007  dsl branches: 1.29.6; 1.29.8; 1.29.12; 1.29.14;
Adapt for sys_mount() becoming compat_40_sys_mount(),
 1.28 09-Feb-2007  ad branches: 1.28.6;
Merge newlock2 to head.
 1.27 01-Sep-2006  matt branches: 1.27.2;
Regen.
 1.26 30-Aug-2006  he Regenerate after dealing with options PTRACE.
 1.25 01-Aug-2006  martin regen
 1.24 13-Jul-2006  pavel regen (sys_getfh -> compat_30_sys_getfh).
 1.23 26-Jun-2006  mrg regenerate.
 1.22 29-May-2006  drochner branches: 1.22.2;
regen
 1.21 07-May-2006  tsutsui branches: 1.21.2;
Regen from syscalls.master rev 1.15:
> Use "#if defined(COMPAT_xx) || !defined(_KERNEL)" so that
> kdump(1) can get all proper syscall names.
 1.20 04-May-2006  christos regen
 1.19 11-Dec-2005  christos branches: 1.19.4; 1.19.6; 1.19.8; 1.19.10; 1.19.12;
merge ktrace-lwp.
 1.18 22-Aug-2005  he Change from using sys___{,f,l}stat13() to sys___{,f,l}stat30() and
associated data structures, following the change to 64-bit inodes.
 1.17 26-Feb-2005  perry branches: 1.17.4;
regen
 1.16 14-Sep-2004  jdolecek branches: 1.16.4; 1.16.6;
regen:
remove all alternative path check code, and (empty) ioctl wrapper
 1.15 22-Apr-2004  matt Regen for statvfs changes.
 1.14 23-Sep-2003  cl regen
 1.13 22-Sep-2003  cl regen
 1.12 18-Jan-2003  thorpej branches: 1.12.2;
Regen to get correct RCS ID.
 1.11 18-Jan-2003  thorpej Regen: Merge the nathanw_sa branch.
 1.10 01-Nov-2002  jdolecek set nsysent to 512
 1.9 03-May-2002  eeh Regen.
 1.8 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.7 30-May-2001  mrg branches: 1.7.2;
use _KERNEL_OPT.
 1.6 07-Apr-2001  tsutsui Regen from aoutm68k/syscalls.master rev 1.5:
> Allow enabling/disabling /emul/aout alternate path search
> on COMPAT_AOUT_M68K environment by options COMPAT_AOUT_ALTPATH.
 1.5 27-Jan-2001  thorpej branches: 1.5.2;
Regen; getpid(2) is MP-safe.
 1.4 27-Jan-2001  thorpej Regen; add sy_flags.
 1.3 09-Dec-2000  mycroft branches: 1.3.2;
Regen.
 1.2 06-Dec-2000  jdolecek regen
 1.1 02-Dec-2000  scw Initial cut of COMPAT_AOUT_M68K.
This gets most existing m68k a.out binaries working with m68k ELF
kernels.

There are still some remaining ABI issues to track down; most notably,
some ioctl(2) calls are affected by the change.
 1.3.2.4 21-Apr-2001  bouyer Sync with HEAD
 1.3.2.3 11-Feb-2001  bouyer Sync with HEAD.
 1.3.2.2 08-Jan-2001  bouyer Files added on trunk.
 1.3.2.1 09-Dec-2000  bouyer file aoutm68k_sysent.c was added on branch thorpej_scsipi on 2001-01-08 14:56:50 +0000
 1.5.2.8 11-Nov-2002  nathanw Catch up to -current
 1.5.2.7 21-Jun-2002  gmcgarry regen
 1.5.2.6 20-Jun-2002  nathanw Catch up to -current.
 1.5.2.5 29-May-2002  nathanw Regen.
 1.5.2.4 17-Nov-2001  scw Add set/get_context syscall entries and regenerate sources from
syscalls.master.
Also s/proc/lwp/ where appropriate.
 1.5.2.3 14-Nov-2001  nathanw Catch up to -current.
 1.5.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.5.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.7.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.7.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.12.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.12.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.12.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.12.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.12.2.1 03-Aug-2004  skrll Sync with HEAD
 1.16.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.16.4.1 29-Apr-2005  kent sync with -current
 1.17.4.6 21-Jan-2008  yamt sync with head
 1.17.4.5 15-Nov-2007  yamt sync with head.
 1.17.4.4 03-Sep-2007  yamt sync with head.
 1.17.4.3 26-Feb-2007  yamt sync with head.
 1.17.4.2 30-Dec-2006  yamt sync with head.
 1.17.4.1 21-Jun-2006  yamt sync with head.
 1.19.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.19.10.1 11-May-2006  elad sync with head
 1.19.8.4 03-Sep-2006  yamt sync with head.
 1.19.8.3 11-Aug-2006  yamt sync with head
 1.19.8.2 26-Jun-2006  yamt sync with head.
 1.19.8.1 24-May-2006  yamt sync with head.
 1.19.6.1 01-Jun-2006  kardel Sync with head.
 1.19.4.1 09-Sep-2006  rpaulo sync with head
 1.21.2.1 19-Jun-2006  chap Sync with head.
 1.22.2.1 13-Jul-2006  gdamore Merge from HEAD.
 1.27.2.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.28.6.1 15-Jul-2007  ad Sync with head.
 1.29.14.2 27-Dec-2007  mjf Sync with HEAD.
 1.29.14.1 19-Nov-2007  mjf Sync with HEAD.
 1.29.12.1 13-Nov-2007  bouyer Sync with HEAD
 1.29.8.1 09-Jan-2008  matt sync with HEAD
 1.29.6.2 14-Nov-2007  joerg Sync with HEAD.
 1.29.6.1 11-Nov-2007  joerg Sync with HEAD.
 1.31.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.31.2.1 26-Dec-2007  ad Sync with head.
 1.32.8.1 18-May-2008  yamt sync with head.
 1.32.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.32.6.2 29-Jun-2008  mjf Sync with HEAD.
 1.32.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.33.6.2 27-Jun-2008  simonb Sync with head.
 1.33.6.1 18-Jun-2008  simonb Sync with head.
 1.33.4.3 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.33.4.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.33.4.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.33.2.2 11-Mar-2010  yamt sync with head
 1.33.2.1 04-May-2009  yamt sync with head.
 1.35.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.35.2.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.41.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.43.4.1 06-Jun-2011  jruoho Sync with HEAD.
 1.43.2.1 21-Apr-2011  rmind sync with head
 1.44.18.1 18-May-2014  rmind sync with head
 1.44.14.2 03-Dec-2017  jdolecek update from HEAD
 1.44.14.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.44.4.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.45.6.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.45.6.1 06-Apr-2015  skrll Sync with HEAD
 1.47.2.1 20-Mar-2017  pgoyette Sync with HEAD
 1.48.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.49.4.1 11-May-2017  pgoyette Sync with HEAD
 1.54.4.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.54.4.1 10-Jun-2019  christos Sync with HEAD
 1.54.2.2 29-Sep-2018  pgoyette Regen
 1.54.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.2 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.1 02-Dec-2000  scw branches: 1.1.2; 1.1.124; 1.1.126; 1.1.128;
Initial cut of COMPAT_AOUT_M68K.
This gets most existing m68k a.out binaries working with m68k ELF
kernels.

There are still some remaining ABI issues to track down; most notably,
some ioctl(2) calls are affected by the change.
 1.1.128.1 16-May-2008  yamt sync with head.
 1.1.126.1 18-May-2008  yamt sync with head.
 1.1.124.1 02-Jun-2008  mjf Sync with HEAD.
 1.1.2.2 08-Jan-2001  bouyer Files added on trunk.
 1.1.2.1 02-Dec-2000  bouyer file aoutm68k_util.h was added on branch thorpej_scsipi on 2001-01-08 14:56:50 +0000
 1.8 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.7 17-Nov-2014  uebayasi branches: 1.7.18; 1.7.20;
Define compat modules (but without dependencies yet).
 1.6 19-Nov-2008  ad branches: 1.6.26;
Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.5 11-Dec-2005  christos branches: 1.5.70; 1.5.74; 1.5.80; 1.5.84;
merge ktrace-lwp.
 1.4 14-Sep-2004  jdolecek remove all alternative path check code, and (empty) ioctl wrapper
 1.3 12-Sep-2004  he More removal of references to aoutm68k_syscalls.c, following that file's
removal. Allows our m68k ports to build again.
 1.2 07-Apr-2001  tsutsui branches: 1.2.22;
Allow enabling/disabling /emul/aout alternate path search
on COMPAT_AOUT_M68K environment by options COMPAT_AOUT_ALTPATH.
 1.1 02-Dec-2000  scw branches: 1.1.2; 1.1.4;
Initial cut of COMPAT_AOUT_M68K.
This gets most existing m68k a.out binaries working with m68k ELF
kernels.

There are still some remaining ABI issues to track down; most notably,
some ioctl(2) calls are affected by the change.
 1.1.4.1 09-Apr-2001  nathanw Catch up with -current.
 1.1.2.3 21-Apr-2001  bouyer Sync with HEAD
 1.1.2.2 08-Jan-2001  bouyer Files added on trunk.
 1.1.2.1 02-Dec-2000  bouyer file files.aoutm68k was added on branch thorpej_scsipi on 2001-01-08 14:56:51 +0000
 1.2.22.2 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.22.1 18-Sep-2004  skrll Sync with HEAD.
 1.5.84.1 19-Jan-2009  skrll Sync with HEAD.
 1.5.80.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.5.74.1 04-May-2009  yamt sync with head.
 1.5.70.1 17-Jan-2009  mjf Sync with HEAD.
 1.6.26.1 03-Dec-2017  jdolecek update from HEAD
 1.7.20.1 10-Jun-2019  christos Sync with HEAD
 1.7.18.1 12-Mar-2018  pgoyette Update dependencies for modules when they are built-in. Now we don't
(or at least, shouldn't) need reminders in the GENERIC config files
about which module options require other options.

Update branch status doc accordingly.
 1.2 01-Nov-2002  jdolecek set nsysent to 512
 1.1 02-Dec-2000  scw branches: 1.1.2; 1.1.4;
Initial cut of COMPAT_AOUT_M68K.
This gets most existing m68k a.out binaries working with m68k ELF
kernels.

There are still some remaining ABI issues to track down; most notably,
some ioctl(2) calls are affected by the change.
 1.1.4.1 11-Nov-2002  nathanw Catch up to -current
 1.1.2.2 08-Jan-2001  bouyer Files added on trunk.
 1.1.2.1 02-Dec-2000  bouyer file syscalls.conf was added on branch thorpej_scsipi on 2001-01-08 14:56:51 +0000
 1.44 18-Jun-2019  christos fix excl
 1.43 18-Jun-2019  christos add quota check
 1.42 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.41 06-Jan-2018  kamil branches: 1.41.2; 1.41.4;
Revert vadvise(2) removal

This system call was used in legacy Lisp code, that was inherited to modern
age and still compiled against supported compat layers (e.g. in clisp,
oaklisp, Franz Lisp).

It used to instruct the kernel about paging policy (G/C aware, flush etc).

Newly compiled code (assuming that it will detect vadvise()) will use the
libc stub for vadvise(). The headers for this interface are gone.

vadvise(2) could be marked as COMPAT_80, but as long as we support ultrix,
sunos or aout68k ABI, don't bother with this.

Requested by <mrg>
 1.40 19-Dec-2017  kamil compat/aoutm68k: Drop SYS_vadvise

The (o)vadvise syscall is dummy since the beginning of NetBSD.

Sponsored by <The NetBSD Foundation>
 1.39 19-Dec-2017  kamil compat/aoutm68k: Drop SYS_sbrk

sbrk - change data segment size

This syscall is dummy since the inception of the project. It's implemented
in userland in libc.

Sponsored by <The NetBSD Foundation>
 1.38 19-Dec-2017  kamil compat aoutm68k: Mark sstk(2) as OBSOL

Remove the sstk(2) syscall support and mark it as obsolete.
It has never been implemented in the kernel.

Sponsored by <The NetBSD Foundation>
 1.37 07-Mar-2011  bouyer Use the COMPAT_50 quotactl, not the native one.
Should fix build of COMPAT_AOUT_M68K
 1.36 02-Mar-2010  pooka branches: 1.36.2; 1.36.4;
Kill fs_nfs.h and #ifdef NFS by making getfh() support unconditional
and nfssvc unsupport unconditional. nfs server was just a fancy
NOP anyway for all except Ultrix. I know I'm boring but I couldn't
imagine why someone would want to run an Ultrix nfs server (and I
also doubt that it would work anymore with all the changes to fs
exporting etc).
 1.35 02-Mar-2010  pooka -fs_lfs.h
 1.34 02-Mar-2010  pooka Remove lfs syscall support from compat. I can't really imagine
anyone wanting to run lfs megamaid as a e.g. FreeBSD binary.
Besides, the real action has been in fcntl() for >5 years now.
The only place where the compat syscalls might have made the tiniest
bit of sense was netbsd32, but they were unimplemented there.
 1.33 13-Jan-2009  pooka branches: 1.33.4;
Convert the syscalls.master to a format from which it is easier
to parse and generate the compat name and basename (e.g. __stat50
and stat). Use this to autogenerate __RENAME()'s to the rump_syscalls
header so that they can be called e.g. rump_sys_socket() instead
of rump_sys___socket30().
 1.32 13-Jan-2009  pooka Make one UNIMPL consistent with the rest: remove signature.
 1.31 11-Jan-2009  tsutsui Update for compat_50 stuff. (compile test only)
 1.30 21-Nov-2008  he sys_nfssvc() is actually only defined when NFSSERVER is defined,
not when only NFS is defined, according to sys/nfs/files.nfs.
Adapt accordingly. Fixes build of amiga INSTALL kernel.
 1.29 12-Nov-2008  ad Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.
 1.28 21-Jun-2008  he branches: 1.28.2; 1.28.4;
<sys/sycallargs.h> needs <sys/sched.h> now.
 1.27 23-Apr-2008  ad branches: 1.27.2; 1.27.4; 1.27.6;
-SYCALL_MPSAFE
 1.26 12-Nov-2007  dsl branches: 1.26.14; 1.26.16;
syscall() needs to be 'NOARGS INDIR'.
Actually I wonder if this code could use the standard syscall table ?
 1.25 09-Nov-2007  dsl Add arguments to sys_syscall and sys___syscall.
Use MI wrappers for them in netbsd32.
Change prefix for constants from netbsd32 to NETBSD32 (used in #defines etc).
 1.24 14-Jul-2007  dsl branches: 1.24.6; 1.24.8; 1.24.12; 1.24.14;
Change calls from sys_mount() to compat_40_sys_mount()
 1.23 04-Mar-2007  christos branches: 1.23.2;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.22 09-Feb-2007  ad branches: 1.22.2;
Merge newlock2 to head.
 1.21 01-Sep-2006  matt branches: 1.21.2;
Don't conditionalize *sys_ptrace. The lack of sys_ptrace will be dealt
with differently.
 1.20 30-Aug-2006  he Update to deal with options PTRACE.
 1.19 01-Aug-2006  martin Adapt to latest fhandle_t changes.
Pointed out by Havard Eidnes.
 1.18 13-Jul-2006  pavel use the COMPAT_30 getfh. And do it always - don't protect it by
#if defined(NFS) || defined(NFSSERVER).
 1.17 26-Jun-2006  mrg version the socket(2) syscall. for compat30 socket, we use
EPROTONOSUPPORT instead of EAFNOSUPPORT.

from pavel@ with a little bit of clean up from myself.

XXX: netbsd32 (and perhaps other emulations) should be able
XXX: to call the standard socket calls for this i think, but
XXX: revisit this at another time.
 1.16 29-May-2006  drochner branches: 1.16.2;
Remove emulation of ntp_gettime. In preparation for "timecounters" we
will change "struct ntptimeval", so some translation would be necessary.
ntp_gettine is considered dispensable, the only userland program known
to use it is "ntptime".
 1.15 07-May-2006  tsutsui branches: 1.15.2;
Use "#if defined(COMPAT_xx) || !defined(_KERNEL)" so that
kdump(1) can get all proper syscall names.
 1.14 04-May-2006  christos Add compat30 getdents. Pointed out by Izumi Tsutsui.
 1.13 11-Dec-2005  christos branches: 1.13.4; 1.13.6; 1.13.8; 1.13.10; 1.13.12;
merge ktrace-lwp.
 1.12 14-Sep-2004  jdolecek branches: 1.12.12;
remove all alternative path check code, and (empty) ioctl wrapper
 1.11 21-Apr-2004  christos Replace the statfs() family of system calls with statvfs().
Retain binary compatibility.
 1.10 23-Sep-2003  cl catch up with sys___sigaction14 compat_16 rename
 1.9 22-Sep-2003  cl SA_SIGINFO support for m68k (compat aoutm68k)
 1.8 18-Jan-2003  thorpej branches: 1.8.2;
Merge the nathanw_sa branch.
 1.7 03-May-2002  eeh Use #if defined(_LP64) to determine if we're generating 64-bit binaries,
not #if defined(alpha).
 1.6 30-May-2001  mrg branches: 1.6.2;
use _KERNEL_OPT.
 1.5 07-Apr-2001  tsutsui Allow enabling/disabling /emul/aout alternate path search
on COMPAT_AOUT_M68K environment by options COMPAT_AOUT_ALTPATH.
 1.4 27-Jan-2001  thorpej branches: 1.4.2;
getpid(2) is MP-safe.
 1.3 09-Dec-2000  mycroft branches: 1.3.2;
Add the %% separators.
 1.2 06-Dec-2000  jdolecek make LKM safe (need to use if/endif, #if/#endif is filtered out by makesyscalls.sh)
 1.1 02-Dec-2000  scw Initial cut of COMPAT_AOUT_M68K.
This gets most existing m68k a.out binaries working with m68k ELF
kernels.

There are still some remaining ABI issues to track down; most notably,
some ioctl(2) calls are affected by the change.
 1.3.2.4 21-Apr-2001  bouyer Sync with HEAD
 1.3.2.3 11-Feb-2001  bouyer Sync with HEAD.
 1.3.2.2 08-Jan-2001  bouyer Files added on trunk.
 1.3.2.1 09-Dec-2000  bouyer file syscalls.master was added on branch thorpej_scsipi on 2001-01-08 14:56:51 +0000
 1.4.2.6 21-Jun-2002  gmcgarry sys_setlogin -> sys___setlogin syscall rename
 1.4.2.5 20-Jun-2002  nathanw Catch up to -current.
 1.4.2.4 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.4.2.3 17-Nov-2001  scw Add set/get_context syscall entries and regenerate sources from
syscalls.master.
Also s/proc/lwp/ where appropriate.
 1.4.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.4.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.6.2.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.8.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.8.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.8.2.1 03-Aug-2004  skrll Sync with HEAD
 1.12.12.5 15-Nov-2007  yamt sync with head.
 1.12.12.4 03-Sep-2007  yamt sync with head.
 1.12.12.3 26-Feb-2007  yamt sync with head.
 1.12.12.2 30-Dec-2006  yamt sync with head.
 1.12.12.1 21-Jun-2006  yamt sync with head.
 1.13.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.13.10.1 11-May-2006  elad sync with head
 1.13.8.3 11-Aug-2006  yamt sync with head
 1.13.8.2 26-Jun-2006  yamt sync with head.
 1.13.8.1 24-May-2006  yamt sync with head.
 1.13.6.1 01-Jun-2006  kardel Sync with head.
 1.13.4.1 09-Sep-2006  rpaulo sync with head
 1.15.2.1 19-Jun-2006  chap Sync with head.
 1.16.2.1 13-Jul-2006  gdamore Merge from HEAD.
 1.21.2.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.22.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.23.2.1 15-Jul-2007  ad Sync with head.
 1.24.14.1 19-Nov-2007  mjf Sync with HEAD.
 1.24.12.1 13-Nov-2007  bouyer Sync with HEAD
 1.24.8.1 09-Jan-2008  matt sync with HEAD
 1.24.6.2 14-Nov-2007  joerg Sync with HEAD.
 1.24.6.1 11-Nov-2007  joerg Sync with HEAD.
 1.26.16.1 18-May-2008  yamt sync with head.
 1.26.14.3 17-Jan-2009  mjf Sync with HEAD.
 1.26.14.2 29-Jun-2008  mjf Sync with HEAD.
 1.26.14.1 02-Jun-2008  mjf Sync with HEAD.
 1.27.6.1 27-Jun-2008  simonb Sync with head.
 1.27.4.3 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.27.4.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.27.4.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.27.2.2 11-Mar-2010  yamt sync with head
 1.27.2.1 04-May-2009  yamt sync with head.
 1.28.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.28.2.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.33.4.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.36.4.1 06-Jun-2011  jruoho Sync with HEAD.
 1.36.2.1 21-Apr-2011  rmind sync with head
 1.41.4.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.41.4.1 10-Jun-2019  christos Sync with HEAD
 1.41.2.1 29-Sep-2018  pgoyette Conditionalize some compat_30 syscalls appropriately
 1.67 20-Dec-2022  msaitoh Remove sys/compat/common/Makefile.*.

These files are not used anymore. Files for compat code are listed in
sys/comapt/common/files.common and sys/modules/compat_xxx/Makefile.
OK'd by riastradh@ and pgoyette@.
 1.66 25-May-2021  pgoyette PR port-xen/53130 was fixed and closed some time ago, so now we can
belatedly re-enable inclusion of the compat_60 x86 microcode code in
the loadable module. (It was already being included in the built-in
version of the module.)
 1.65 27-Jan-2019  pgoyette branches: 1.65.16; 1.65.18;
Merge the [pgoyette-compat] branch
 1.64 05-Jun-2018  christos branches: 1.64.2;
use the standard rules, instead of rolling our own.
 1.63 20-Dec-2017  maya branches: 1.63.2;
Pass LDFLAGS to ld.

Without this, mips64-ld thinks we want to link our n64 objects with the
default ABI, n32.
 1.62 16-Dec-2017  maxv compat_util.c must be compiled by default in the kernel. It is needed by
generic non-compat code, so it must not depend on anything (libcompat or
whatever option we choose to associate it to).
 1.61 04-Aug-2017  maxv typos
 1.60 05-Nov-2016  pgoyette Move if_43.c back into the shared Makefile.sysio where it really
belongs.

Update the code to invoke the two routines compat_cvtcmd() and
compat_ifioctl() through indirect pointers. Initialize those
pointers in sys/net/if.c and update them in the compat module's
initialization code.

Addresses the issue pointed out in PR kern/51598
 1.59 03-Nov-2016  pgoyette Move if_43.c out of Makefile.sysio and into the main Makefile.

The former location gets included in both libcompat and the compat
module, leading to redefined symbols when the module is loaded. By
moving it to the main Makefile, it gets included only in libcompat.

XXX This still isn't an ideal solution, but it will suffice until
XXX PR kern/51598 is addressed.
 1.58 03-Nov-2016  riastradh Reorganize SRCS lists for libcompat, compat.kmod, sysv_ipc.kmod.

- Share lists between the libcompat and module makefiles.
- Include some omitted entries in compat.kmod:
. if_43.c
. kern_sa_60.c
. kern_time_30.c
. rndpseudo_50.c
. rtsock_14.c
. rtsock_50.c
. rtsock_70.c
. uipc_syscalls_40.c
. uipc_syscalls_50.c
- Exclude a (harmless) spurious entry in sysv_ipc.kmod on LP64 systems:
. kern_ipc_10.c

Should fix broken ifconfig on modular current kernels.

ok pgoyette
 1.57 21-Sep-2016  roy Add ifam_pid and ifam_addrflags to ifa_msghdr.
Re-version RTM_NEWADDR, RTM_DELADDR, RTM_CHGADDR and NET_RT_IFLIST.
Add compat code for old version.
 1.56 06-Apr-2016  roy branches: 1.56.2;
Add sc_pid to sockcred so that SOCK_DGRAM and LOCAL_CREDS socket option
can learn the process id of the AF_LOCAL sender.
Add compat glue for old structure.
 1.55 22-Mar-2016  mrg remove a bunch of "@echo done" from the tail of rules. these messages
were vaguely useful back when we didn't run make -j, but now you end
up with a single line "done" every so often, with no idea what it is
for. very few other targets claim they're done so just remove these.
 1.54 07-Sep-2015  uebayasi Order library object build.
 1.53 07-Sep-2015  uebayasi Sprinkle more done messages.
 1.52 04-Apr-2014  njoly branches: 1.52.6;
Move a few compat 50 syscalls, not applicable to rump kernels, out of
kern_time_50.c to a new source module.
 1.51 29-Mar-2013  christos branches: 1.51.4;
compat glue for new lwp_park()
 1.50 19-Oct-2012  apb Add COMPAT_60 versions of the TIOCPTMGET and TIOCPTSNAME ioctls.
 1.49 19-Feb-2012  matt branches: 1.49.2;
Add compat_60 stub for the SA syscall (all which just call sys_nosys).
 1.48 19-Dec-2011  apb Add COMPAT_50 and COMPAT_NETBSD32 compatibility code for rnd(4)
ioctl commands.

Tested with "rndctl -ls" using an old 32-bit version of rndctl(8)
(built for NetBSD-5.99.56/i386) and a new 64-bit kernel
(NetBSD-5.99.59/amd64).
 1.47 11-Aug-2011  jmcneill branches: 1.47.2; 1.47.6;
add libcompat.o/.po targets for COMPAT_AS=obj
 1.46 17-Jan-2011  pooka Put async i/o compat routines in a separate source module from the
ones related to clock and process management.
 1.45 19-Jan-2009  christos branches: 1.45.6; 1.45.8;
Provide compatibility for pre-christos-time_t sysv sysctls.
 1.44 11-Jan-2009  christos merge christos-time_t
 1.43 14-Nov-2008  ad - Move some more compat code into sys/compat.
- Split 4.3BSD ifioctl stuff into its own file.
- Remove some ifdefs that include small fragments of vfs compat code
which are difficult to relocate elsewhere.
 1.42 24-Feb-2008  martin branches: 1.42.2; 1.42.6; 1.42.12; 1.42.14;
Remove compat code for posix_fadvise
 1.41 27-Jan-2008  martin branches: 1.41.2; 1.41.6;
Implement new version of posix_fadvise as a stub callinig the real
worker function, and compatibility stub doing the same with old argument
sturcture.
 1.40 12-Dec-2007  dsl compat_file.[ch] are no longer used
 1.39 29-May-2007  christos branches: 1.39.8; 1.39.14; 1.39.16; 1.39.18; 1.39.20;
Add a sockaddr_storage member to "struct ifreq" maintaining backwards
compatibility with the older ioctls. This avoids stack smashing and
abuse of "struct sockaddr" when ioctls placed "struct sockaddr_foo's" that
were longer than "struct sockaddr".
XXX: Some of the emulations might be broken; I tried to add code for
them but I did not test them.
 1.38 10-Mar-2007  dsl branches: 1.38.2;
Update all the compat stuff to not use the 'stackgap' for processing
sys_stat() and friends, instead use do_sys_stat() and do_sys_fstat()
that write the answer into a kernel buffer (on stack) that can be
converted to the correct form and written the userspace.
I've test compiled a few kernels, and tested i386 netbsd1.6 ls.
Given I think I've fixed some bugs, it might be 50-50 with new ones.
 1.37 26-Jun-2006  mrg branches: 1.37.10; 1.37.14;
version the socket(2) syscall. for compat30 socket, we use
EPROTONOSUPPORT instead of EAFNOSUPPORT.

from pavel@ with a little bit of clean up from myself.

XXX: netbsd32 (and perhaps other emulations) should be able
XXX: to call the standard socket calls for this i think, but
XXX: revisit this at another time.
 1.36 11-Dec-2005  christos branches: 1.36.4; 1.36.8; 1.36.16;
merge ktrace-lwp.
 1.35 19-Aug-2005  christos 64 bit inode changes.
 1.34 26-Feb-2005  perry branches: 1.34.4;
nuke trailing whitespace
 1.33 21-Apr-2004  christos branches: 1.33.4; 1.33.6;
Replace the statfs() family of system calls with statvfs().
Retain binary compatibility.
 1.32 15-Oct-2003  fvdl Don't put the netbsd32_compat*.c files in the 'compat library'. Unconditionally
compiling these causes a ripple effect making it hard to conditionalize
anything on COMPAT_* in the kernel.
 1.31 08-Dec-2002  manu branches: 1.31.6;
Introduce BSD system calls with alternate patch checking (in /emul) in
compat/common, so that they can be shared by several emulations, and use
them for Darwin.

This removes the ugly dependance on FreeBSD freebsd_file.c for COMPAT_DARWIN
 1.30 02-Nov-2002  perry set LLIBS= so we don't try to check the lint lib against llib-lc.ln
 1.29 18-Jun-2002  wrstuden Updated version of cscope/mkid support. Check libkern and compat lib
for source files. Also include header files in mkid run.
 1.28 29-Apr-2002  mrg branches: 1.28.2; 1.28.4;
build the netbsd32_compat* objects into libcompat.a, so they are available
to emulations not just netbsd itself. rename the compat_10 functions to
match everything else. fixes a problem reported by julian coleman.
 1.27 12-Dec-2001  tv MKfoo=no -> NOfoo
 1.26 14-Nov-2001  tv Preload <bsd.own.mk> before .undef DESTDIR.
 1.25 14-Nov-2001  tv Undefine DESTDIR; we don't want the special DESTDIR <bsd.lib.mk>
handling for kernel libraries.

XXX this build method should be replaced by something more sane
 1.24 25-Aug-1999  thorpej branches: 1.24.14; 1.24.16;
Add compatibility calls for the 1.4 System V IPC *ctl() calls, and
update the 1.0 compat calls.
 1.23 07-May-1999  drochner Build libraries for kernel/standalone code from within their compilation
directories and use .PATH to lookup the source files.
(Formerly, the libs were built from the source dirs, with MAKEOBJDIR
set to the compilation directory.)
This solves 2 problems:
-"mkdep" and "make" are now consistent about the file lookup, this fixes
bad interactions with amd reported in PR bin/7374 (Arne Juul) and
lossage reported by Andrew Gillham ("obj" dirs and relative paths still
don't work well together)
-kernel compile trees can be moved around without forcing a new
"make depend" - fixing PR kern/4021 by Martin Husemann
 1.22 13-Feb-1999  lukem branches: 1.22.4;
convert from NOxxx= to MKxxx=no.
include <bsd.own.mk> if testing a MKxxx variable.
 1.21 28-Apr-1998  kleink Make adding new source files easier and enhance readability by ordering SRCS
items by (Net)BSD version first, then alphabetically.
 1.20 25-Nov-1997  kleink In XPG4.2, the ss_size member of type stack_t (struct sigaltstack) is specified
to be of type size_t; since this imposes an interface change on the Alpha
(sizeof(int) != sizeof(size_t)), allocate a new system call number and make
the previous version a compatibility system call.
 1.19 16-Oct-1997  christos PR/4269: msync is missing MS_*
 1.18 10-Oct-1997  fvdl Add getdirentries backward compat syscall. Provide common function to
signal cookie overflow during emulated getdents and friends.
 1.17 12-Jun-1997  mrg branches: 1.17.4;
bring mrg-vm-swap2 onto mainline.
 1.16 31-May-1997  cjs Back out BUILDDIR and NOINSTALL changes.
 1.15 30-May-1997  cjs branches: 1.15.2;
Use new NOINSTALL option for libraries that are used only during the build
of a program, and not installed into the final system.
 1.14 07-May-1997  mycroft Use libinstall::, not install:, to prevent instaling LIB.
 1.13 22-Oct-1996  explorer branches: 1.13.8;
Spelling error
 1.12 09-Aug-1996  mrg Change reboot(2) to take two arguments: bootopt like normal and also
a boot string for firmware that can do this, such as the SPARC and
the sun3 models. It is currently silently ignored on all other
hardware now, however. The MD function "boot()" has been changed to
also take a char *.
 1.11 08-Aug-1996  mycroft Run the child make in the source directory, so that nothing here needs to be
changed when the compile directory is outside the source tree.
 1.10 30-Jun-1996  christos Fix mysterious dissappearance of the .PATH directive.
 1.9 23-Jun-1996  mycroft Remove the old (broken) setre[ug]id() emulation.
 1.8 18-May-1996  christos branches: 1.8.4;
- Moving cpu_exec_aout_prep_oldzmagic -> exec_aout_prep_oldzmagic.
This is used by the i386, hp300 and mac68k ports.
- Added exec_aout_prep_oldomagic, and exec_aout_prep_oldnmagic
These are just copies of the respective prep functions from
kern_exec.c with text address starting at 0. Maybe a better fix
is to pass the starting address as a third argument so we don't
duplicate code, but this could be the next pass since the functions
are used in many places. These functions are used for BSDI binaries.
 1.7 05-Feb-1996  christos Extracted vm compat functions from vm and added them here where they belong.
 1.6 02-Feb-1996  mycroft Simplify, and add support for passing CPPFLAGS.
 1.5 02-Feb-1996  christos Renamed compat_tty.c to tty_43.c and updated with the newest copy from
kern/tty_compat.c
 1.4 20-Oct-1995  cgd set, don't add to, CFLAGS from COMPATCFLAGS
 1.3 28-Jun-1995  cgd light cleanup, adjustments for the Alpha
 1.2 26-Jun-1995  christos Add the ability to override COMPATREL and COMPATDST similar to libkern
 1.1 24-Jun-1995  christos - Extracted all compat routines from the kern directory and moved here.
- Created compat_util.c and compat_util.h to be used by the compatibility
modules, so they don't duplicate the same code.
- Added prototypes to the stackgap allocation routines.
 1.8.4.2 10-Dec-1996  mycroft Oops; put back .PATH.
 1.8.4.1 10-Dec-1996  mycroft From trunk:
Implement setre[ug]id() for real.
 1.13.8.1 04-May-1997  mrg add vm_swap_12.c here.
 1.15.2.3 19-Oct-1997  cjs Update to 1.19.
 1.15.2.2 13-Oct-1997  cjs Update to 1.18.
 1.15.2.1 22-Jun-1997  cjs Merge mainline up to 1.17.
 1.17.4.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.22.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.24.16.3 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.24.16.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.24.16.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.24.14.6 11-Dec-2002  thorpej Sync with HEAD.
 1.24.14.5 11-Nov-2002  nathanw Catch up to -current
 1.24.14.4 01-Aug-2002  nathanw Catch up to -current.
 1.24.14.3 20-Jun-2002  nathanw Catch up to -current.
 1.24.14.2 08-Jan-2002  nathanw Catch up to -current.
 1.24.14.1 14-Nov-2001  thorpej Merge from -current, required to cross-build kernels properly.
 1.28.4.1 19-Jun-2002  lukem Pull up revision 1.29 (requested by wrstuden in ticket #318):
Updated version of cscope/mkid support. Check libkern and compat lib
for source files. Also include header files in mkid run.
 1.28.2.1 15-Jul-2002  gehenna catch up with -current.
 1.31.6.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.31.6.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.31.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.31.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.31.6.1 03-Aug-2004  skrll Sync with HEAD
 1.33.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.33.4.1 29-Apr-2005  kent sync with -current
 1.34.4.6 27-Feb-2008  yamt sync with head.
 1.34.4.5 04-Feb-2008  yamt sync with head.
 1.34.4.4 21-Jan-2008  yamt sync with head
 1.34.4.3 03-Sep-2007  yamt sync with head.
 1.34.4.2 30-Dec-2006  yamt sync with head.
 1.34.4.1 21-Jun-2006  yamt sync with head.
 1.36.16.1 13-Jul-2006  gdamore Merge from HEAD.
 1.36.8.1 11-Aug-2006  yamt sync with head
 1.36.4.1 09-Sep-2006  rpaulo sync with head
 1.37.14.2 09-Jun-2007  ad Sync with head.
 1.37.14.1 13-Mar-2007  ad Sync with head.
 1.37.10.1 12-Mar-2007  rmind Sync with HEAD.
 1.38.2.1 11-Jul-2007  mjf Sync with head.
 1.39.20.1 13-Dec-2007  bouyer Sync with HEAD
 1.39.18.1 13-Dec-2007  yamt sync with head.
 1.39.16.1 26-Dec-2007  ad Sync with head.
 1.39.14.1 18-Feb-2008  mjf Sync with HEAD.
 1.39.8.1 09-Jan-2008  matt sync with HEAD
 1.41.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.41.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.41.2.1 24-Mar-2008  keiichi sync with head.
 1.42.14.2 03-Mar-2009  skrll Sync with HEAD.
 1.42.14.1 19-Jan-2009  skrll Sync with HEAD.
 1.42.12.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.42.6.1 04-May-2009  yamt sync with head.
 1.42.2.4 27-Nov-2008  christos handle ifdatareq
 1.42.2.3 20-Nov-2008  christos merge with head.
 1.42.2.2 09-Nov-2008  christos garbage collect all the conversion functions and put them in the header
files so that userland can share them. Also fix bugs in them!
 1.42.2.1 29-Mar-2008  christos Welcome to the time_t=long long dev_t=uint64_t branch.
 1.45.8.1 06-Jun-2011  jruoho Sync with HEAD.
 1.45.6.1 05-Mar-2011  rmind sync with head
 1.47.6.2 24-Feb-2012  mrg sync to -current.
 1.47.6.1 18-Feb-2012  mrg merge to -current.
 1.47.2.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.47.2.2 30-Oct-2012  yamt sync with head
 1.47.2.1 17-Apr-2012  yamt sync with head
 1.49.2.4 03-Dec-2017  jdolecek update from HEAD
 1.49.2.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.49.2.2 23-Jun-2013  tls resync from head
 1.49.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.51.4.1 18-May-2014  rmind sync with head
 1.52.6.5 28-Aug-2017  skrll Sync with HEAD
 1.52.6.4 05-Dec-2016  skrll Sync with HEAD
 1.52.6.3 05-Oct-2016  skrll Sync with HEAD
 1.52.6.2 22-Apr-2016  skrll Sync with HEAD
 1.52.6.1 22-Sep-2015  skrll Sync with HEAD
 1.56.2.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.56.2.1 04-Nov-2016  pgoyette Sync with HEAD
 1.63.2.3 25-Jun-2018  pgoyette Sync with HEAD
 1.63.2.2 26-Mar-2018  pgoyette For now, disable CPU_UCODE stuff since we can't build it properly
with XEN. Re-enable it after we get fix for PR kern/53130
 1.63.2.1 18-Mar-2018  pgoyette Move closer to a complete compat_60 module. All that remains is some
tty stuff and some ccd ioctl()s.
 1.64.2.1 10-Jun-2019  christos Sync with HEAD
 1.65.18.1 31-May-2021  cjep sync with head
 1.65.16.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.27 20-Dec-2022  msaitoh Remove sys/compat/common/Makefile.*.

These files are not used anymore. Files for compat code are listed in
sys/comapt/common/files.common and sys/modules/compat_xxx/Makefile.
OK'd by riastradh@ and pgoyette@.
 1.26 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.25 27-May-2018  christos branches: 1.25.2;
- Introduce :q modifier for make variables and make it double escape $'s so
that passing variables to recursive makes with :q works as expected.
- Revert :Q to work as before.
- Adjust makefiles that use recursive make to use :q

Discussed on tech-toolchain@
XXX: pullup 8
 1.24 12-Apr-2018  christos If we are modular, allow us to use modules for compat; don't load all the
compat code in.
 1.23 16-Dec-2017  maxv branches: 1.23.2;
Build libcompat as an object, not as a library. We want all of its
functions compiled in, because compat modules loaded from the filesystem
may depend on them.
 1.22 22-Mar-2016  mrg branches: 1.22.10;
remove a bunch of "@echo done" from the tail of rules. these messages
were vaguely useful back when we didn't run make -j, but now you end
up with a single line "done" every so often, with no idea what it is
for. very few other targets claim they're done so just remove these.
 1.21 06-Sep-2015  uebayasi In kernel lib build, print message when things not only start bug also end.
 1.20 14-Dec-2009  matt branches: 1.20.40;
Merge from matt-nb5-mips64
 1.19 02-Nov-2002  perry branches: 1.19.108; 1.19.128;
Add lint infrastructure
 1.18 05-Dec-2000  sommerfeld branches: 1.18.2;
Have recursive make invocations depend on the .MAKE pseudo-target so
make knows to handle them specially.
 1.17 01-Feb-2000  tsutsui Revert STRIPPROG -> STRIP
 1.16 19-Jan-2000  tsutsui STRIP -> STRIPPROG
 1.15 07-May-1999  drochner branches: 1.15.2;
Build libraries for kernel/standalone code from within their compilation
directories and use .PATH to lookup the source files.
(Formerly, the libs were built from the source dirs, with MAKEOBJDIR
set to the compilation directory.)
This solves 2 problems:
-"mkdep" and "make" are now consistent about the file lookup, this fixes
bad interactions with amd reported in PR bin/7374 (Arne Juul) and
lossage reported by Andrew Gillham ("obj" dirs and relative paths still
don't work well together)
-kernel compile trees can be moved around without forcing a new
"make depend" - fixing PR kern/4021 by Martin Husemann
 1.14 05-Sep-1998  lukem branches: 1.14.8;
distclean is a synonym for cleandir
 1.13 04-Nov-1997  gwr Pass down the values of: AR NM RANLIB
(Fixes PR#4426 from SAITOH Masanobu)
Also pass down LORDER TSORT.
 1.12 23-Jan-1997  cgd clean up substantially. Transform clean, depend, cleandir targets from ::
to :, so they can be used e.g. with <bsd.prog.mk>. Standardize variable
names used to configure kernel libraries.

Variables used by these Makefile.inc's are:

S must be set to the top of the 'sys' tree.
${LIB}DST may be set to the location of the directory where library
objects are to be built. Defaults to ${.OBJDIR}/lib/${lib}.
${LIB}_AS may be set to 'obj' to build a object from the library's
object files. (Otherwise, a library will be built.)
Defaults to 'library'.
${LIB}MISCMAKEFLAGS
Miscellaneous flags to be passed to the library's Makefile when
building. See library's Makefile for more details about
supported flags and their default values.

(where LIB is COMPAT, and lib is compat, in this case.)
 1.11 26-Dec-1996  christos PR/2981: use ${VAR:Q} instead of '${VAR}' to avoid quoting problems
 1.10 23-Sep-1996  ghudson Handle relative paths to the source tree if they begin with '.'.
 1.9 10-Aug-1996  mycroft Add anchors so that only exactly `-I. is modified.
 1.8 10-Aug-1996  mycroft Convert the -I. to -I${.OBJDIR}, so that the `machine symlink is available.
 1.7 08-Aug-1996  mycroft We dont need to pass down COMPATDIR and KERNDIR.
 1.6 08-Aug-1996  mycroft Run the child make in the source directory, so that nothing here needs to be
changed when the compile directory is outside the source tree.
 1.5 20-May-1996  mrg use ' not " when passing variables to a sub-make. pr#1199/pr#1296
 1.4 11-May-1996  mycroft Make `make depend' work for libraries.
 1.3 02-Feb-1996  mycroft Simplify, and add support for passing CPPFLAGS.
 1.2 26-Jun-1995  christos Add the ability to override COMPATREL and COMPATDST similar to libkern
 1.1 24-Jun-1995  christos - Extracted all compat routines from the kern directory and moved here.
- Created compat_util.c and compat_util.h to be used by the compatibility
modules, so they don't duplicate the same code.
- Added prototypes to the stackgap allocation routines.
 1.14.8.1 21-Jun-1999  thorpej Sync w/ -current.
 1.15.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.15.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.18.2.1 11-Nov-2002  nathanw Catch up to -current
 1.19.128.1 21-Aug-2009  matt Pass LDFLAGS
 1.19.108.1 11-Mar-2010  yamt sync with head
 1.20.40.2 22-Apr-2016  skrll Sync with HEAD
 1.20.40.1 22-Sep-2015  skrll Sync with HEAD
 1.22.10.1 09-Jun-2018  martin Pull up following revision(s) (requested by christos in ticket #870):

sys/lib/libgnuefi/Makefile.inc: revision 1.5
external/mit/xorg/xorg-pkg-ver.mk: revision 1.9
sys/arch/i386/stand/lib/Makefile.inc: revision 1.17
sys/compat/common/Makefile.inc: revision 1.25
usr.bin/make/unit-tests/varquote.exp: revision 1.1, 1.2
sys/lib/libsa/Makefile.inc: revision 1.24
usr.bin/make/var.c: revision 1.220
sys/arch/ia64/stand/efi/libefi/Makefile.inc: revision 1.5
sys/arch/hppa/spmath/Makefile.inc: revision 1.10
usr.bin/make/unit-tests/varquote.mk: revision 1.1, 1.2
usr.bin/make/unit-tests/Makefile: revision 1.53
sys/lib/libkern/Makefile.inc: revision 1.45
sys/arch/acorn32/stand/lib/Makefile.inc: revision 1.4
sys/arch/m68k/fpsp/Makefile.inc: revision 1.21
usr.bin/make/make.1: revision 1.273
sys/lib/libz/Makefile.inc: revision 1.17

- Introduce :q modifier for make variables and make it double escape $'s so
that passing variables to recursive makes with :q works as expected.
- Adjust makefiles that use recursive make to use :q

Discussed on tech-toolchain@

XXX: pullup 8
 1.23.2.4 25-Jun-2018  pgoyette Sync with HEAD
 1.23.2.3 16-Apr-2018  pgoyette Sync with HEAD, resolve some conflicts
 1.23.2.2 12-Apr-2018  pgoyette Merge christos's recent changes on HEAD
 1.23.2.1 13-Mar-2018  pgoyette Revert the COMPAT_AS sestting back to library, the documented default.

It doesn't really matter, since we no longer build the library in any
format, but best to make the code match the comments.
 1.25.2.1 10-Jun-2019  christos Sync with HEAD
 1.16 20-Dec-2022  msaitoh Remove sys/compat/common/Makefile.*.

These files are not used anymore. Files for compat code are listed in
sys/comapt/common/files.common and sys/modules/compat_xxx/Makefile.
OK'd by riastradh@ and pgoyette@.
 1.15 10-Nov-2021  msaitoh s/compatability/compatibility/ in comment.
 1.14 09-Aug-2021  andvar fix various typos in compatibility, mainly in comments.
 1.13 27-Jan-2020  pgoyette Split the module glue out from the rest of opencrypto/ocryptodev to
make rump happy.

Rump doesn't have compat modules (the compat code is included in the
relevant librump*.so), so there's no module compat_50 listed in
link_set_modules, and thus ocryptodev's MODULE(...) can't "require"
it.

This fixes the problem of "built-in module compat_50 not found" when
starting up rump_allserver (or rump_server with -l rumpdev_opencrypto).

XXX This does not resolve the long-standing "crypto: unable to
XXX register devsw, error 17" message noted at line 78 of
XXX sys/rump/dev/lib/libopencrypto/opencrypto_component.c
 1.12 17-May-2019  msaitoh branches: 1.12.4;
The max subtype of the ifmedia word is 31. It's too small for Ethernet now.
We currently use use it up to 30. We should extend the limit to be able to use
more than 10Gbps speeds. Our ifmedia(4) is inconvenience and have some problem
so we should redesign the interface, but it's too late for netbsd-9 to do it.
So, we keep the data structure size and modify the structure a bit. The
strategy is almost the same as FreeBSD. Many bits of IFM_OMASK for Ethernet
have not used, so use some of them for Ethernet's subtype.

The differences against FreeBSD are:
- We use NetBSD style compat code (i.e. no SIOCGIFXMEDIA).
- FreeBSD's IFM_ETH_XTYPE's bit location is from 11 to "14" even though
IFM_OMASK is from 8 to "15". We use _IFM_ETH_XTMASK from bit 13 to "15".
- FreeBSD changed the meaning of IFM_TYPE_MATCH(). I think we should
not do it. We keep it not changing and added new IFM_TYPE_SUBTYPE_MATCH()
macro for matching both TYPE and SUBTYPE.
- Added up to 400GBASE-SR16.

New layout of the media word is as follows (from ifmedia_h):

* if_media Options word:
* Bits Use
* ---- -------
* 0-4 Media subtype MAX SUBTYPE == 255 for ETH and 31 for others
* 5-7 Media type
* 8-15 Type specific options
* 16-18 Mode (for multi-mode devices)
* 19 (Reserved for Future Use)
* 20-27 Shared (global) options
* 28-31 Instance
*
* 3 2 1
* 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
* +-------+---------------+-+-----+---------------+-----+---------+
* | | |R| | | | |
* | IMASK | GMASK |F|MMASK+-----+ OMASK |NMASK| TMASK |
* | | |U| |XTMSK| | | |
* +-------+---------------+-+-----+-----+---------+-----+---------+
* <-----> <---> <--->
* IFM_INST() IFM_MODE() IFM_TYPE()
*
* IFM_SUBTYPE(other than ETH)<------->
*
* <---> IFM_SUBTYPE(ETH)<------->
*
*
* <-------------> <------------->
* IFM_OPTIONS()
 1.11 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.10 18-Mar-2018  christos branches: 1.10.2;
factor out the ccd COMPAT_60 code.
 1.9 17-Mar-2018  christos redo the cpu ucode compat code.
 1.8 15-Mar-2018  christos add uvm swap compat code.
 1.7 05-Nov-2016  pgoyette branches: 1.7.2; 1.7.16; 1.7.18;
Move if_43.c back into the shared Makefile.sysio where it really
belongs.

Update the code to invoke the two routines compat_cvtcmd() and
compat_ifioctl() through indirect pointers. Initialize those
pointers in sys/net/if.c and update them in the compat module's
initialization code.

Addresses the issue pointed out in PR kern/51598
 1.6 03-Nov-2016  pgoyette branches: 1.6.2;
Move if_43.c out of Makefile.sysio and into the main Makefile.

The former location gets included in both libcompat and the compat
module, leading to redefined symbols when the module is loaded. By
moving it to the main Makefile, it gets included only in libcompat.

XXX This still isn't an ideal solution, but it will suffice until
XXX PR kern/51598 is addressed.
 1.5 03-Nov-2016  pgoyette Hmmm, if we omit if_43.c from the SRCS list, then we break the i386
build for one of the XEN kernels.

Adding it back to the list. At least the build will be successful.

XXX This is probably not the end of this saga, as we still have the
XXX redefined-symbol issue when loading the compat module on amd64.
XXX But for now, a working build for the vast majority of users
XXX (including our automated test suites) is more important than a
XXX successfully-loadable compat module.
 1.4 03-Nov-2016  pgoyette Really comment out if_43.c this time. (I need sleep and/or caffeine.)
 1.3 03-Nov-2016  pgoyette Use proper characgter to introduce comments!
 1.2 03-Nov-2016  pgoyette if_43.o gets included from libcompat automatically, due to two calls
to compat_cvtcmd() in if.c. Ideally, if.c would be modified to have
a pointer to a no-op compat_cvtcmd() and that pointer would get
replaced by compat_modcmd(MODULE_CMD_INIT, ...) code. But for now,
just don't include it in the compat module at all.
 1.1 03-Nov-2016  riastradh Reorganize SRCS lists for libcompat, compat.kmod, sysv_ipc.kmod.

- Share lists between the libcompat and module makefiles.
- Include some omitted entries in compat.kmod:
. if_43.c
. kern_sa_60.c
. kern_time_30.c
. rndpseudo_50.c
. rtsock_14.c
. rtsock_50.c
. rtsock_70.c
. uipc_syscalls_40.c
. uipc_syscalls_50.c
- Exclude a (harmless) spurious entry in sysv_ipc.kmod on LP64 systems:
. kern_ipc_10.c

Should fix broken ifconfig on modular current kernels.

ok pgoyette
 1.6.2.3 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.6.2.2 04-Nov-2016  pgoyette Sync with HEAD
 1.6.2.1 03-Nov-2016  pgoyette file Makefile.sysio was added on branch pgoyette-localcount on 2016-11-04 14:49:07 +0000
 1.7.18.22 19-Sep-2018  pgoyette Update for new vnd_50.c source file.

Not really necessary to update this, since we're no longer building
the "monolithic" compat module. But let's maintain it correctly, at
least until we delete the file.
 1.7.18.21 17-Apr-2018  pgoyette Finish separating the compat_09 and compat_43 stuff
 1.7.18.20 03-Apr-2018  pgoyette Remove fixed allocation of modules' "required" lists (previously
limited to MAXMODDEPS entries). Update the modctl(MODCTL_STAT)
syscall to return the required data in a new format, and retain
the previous data format in MODCTL_OSTAT. Update the compat_80
and compat_netbsd32 modules as needed.
 1.7.18.19 29-Mar-2018  pgoyette Rename usb_30_subr.c --> usb_subr_30.c for consistency with others
 1.7.18.18 28-Mar-2018  pgoyette Split vnd compat_30 code out of the main driver and into the compat_30
module
 1.7.18.17 28-Mar-2018  pgoyette Initial pass at a compat_30 module.

Still needs some work for dev/vnd and various dev/usb/*
 1.7.18.16 25-Mar-2018  pgoyette Don't add the compat_60_cpu_ucode.c file here. It's already added in
the main Makefile, and doing again here results in trying to link it
twice (with resulting symbol redefinition errors).
 1.7.18.15 25-Mar-2018  pgoyette Include compat code in the modules
 1.7.18.14 25-Mar-2018  pgoyette Undo previous. Clearly this is not the right thing to do! The ucode
support should already be in the kernel.
 1.7.18.13 25-Mar-2018  pgoyette Include the cpu_ucode*.c files in the module for x86 machines
 1.7.18.12 24-Mar-2018  pgoyette Move the compat_50-specific code out of wscons/wsevent.c into its own
source file, which is now part of the compat_50 module.
 1.7.18.11 24-Mar-2018  pgoyette Add fs/puffs compat_50 to the modules
 1.7.18.10 24-Mar-2018  pgoyette Separate the compat_50 and compat_80 dispatching code from the main
body of raidframe, and place into the appropriate compat modules.

Enable building of the compat_80 module.
 1.7.18.9 23-Mar-2018  pgoyette Handle the compat_50 stuff for opencrypto/cryptodev
 1.7.18.8 22-Mar-2018  pgoyette Synch with HEAD, resolve conflicts
 1.7.18.7 21-Mar-2018  pgoyette Move if_spppsubr compat code into the compat50 module.

More prep work for compat80 module (for raidframe)
 1.7.18.6 21-Mar-2018  pgoyette Split the compat_50 code out from the dev/clockctl driver and include
it in the compat_50 and compat modules.
 1.7.18.5 18-Mar-2018  pgoyette Import compat_60 changes for dev/ccd
 1.7.18.4 17-Mar-2018  pgoyette Import christos's changes for the compat_60 cpu_ucode stuff
 1.7.18.3 15-Mar-2018  pgoyette Synch with HEAD
 1.7.18.2 14-Mar-2018  pgoyette Make do_openat()'s handling of path=NULL modular
 1.7.18.1 13-Mar-2018  pgoyette Move the swapstats compat code into the compat_netbsd module.

Without this, a kernel configured without COMPAT_13 and/or COMPAT_50
could not execute the compat swapstats code, even if the compat_netbsd
module had been loaded.
 1.7.16.2 03-Dec-2017  jdolecek update from HEAD
 1.7.16.1 05-Nov-2016  jdolecek file Makefile.sysio was added on branch tls-maxphys on 2017-12-03 11:36:53 +0000
 1.7.2.2 05-Dec-2016  skrll Sync with HEAD
 1.7.2.1 05-Nov-2016  skrll file Makefile.sysio was added on branch nick-nhusb on 2016-12-05 10:54:59 +0000
 1.10.2.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.10.2.1 10-Jun-2019  christos Sync with HEAD
 1.12.4.1 29-Feb-2020  ad Sync with head.
 1.2 20-Dec-2022  msaitoh Remove sys/compat/common/Makefile.*.

These files are not used anymore. Files for compat code are listed in
sys/comapt/common/files.common and sys/modules/compat_xxx/Makefile.
OK'd by riastradh@ and pgoyette@.
 1.1 03-Nov-2016  riastradh branches: 1.1.2; 1.1.4; 1.1.18;
Reorganize SRCS lists for libcompat, compat.kmod, sysv_ipc.kmod.

- Share lists between the libcompat and module makefiles.
- Include some omitted entries in compat.kmod:
. if_43.c
. kern_sa_60.c
. kern_time_30.c
. rndpseudo_50.c
. rtsock_14.c
. rtsock_50.c
. rtsock_70.c
. uipc_syscalls_40.c
. uipc_syscalls_50.c
- Exclude a (harmless) spurious entry in sysv_ipc.kmod on LP64 systems:
. kern_ipc_10.c

Should fix broken ifconfig on modular current kernels.

ok pgoyette
 1.1.18.2 03-Dec-2017  jdolecek update from HEAD
 1.1.18.1 03-Nov-2016  jdolecek file Makefile.sysv was added on branch tls-maxphys on 2017-12-03 11:36:53 +0000
 1.1.4.2 05-Dec-2016  skrll Sync with HEAD
 1.1.4.1 03-Nov-2016  skrll file Makefile.sysv was added on branch nick-nhusb on 2016-12-05 10:54:59 +0000
 1.1.2.2 04-Nov-2016  pgoyette Sync with HEAD
 1.1.2.1 03-Nov-2016  pgoyette file Makefile.sysv was added on branch pgoyette-localcount on 2016-11-04 14:49:07 +0000
 1.5 19-Dec-2020  thorpej malloc(9) -> kmem(9)
 1.4 12-Dec-2019  pgoyette branches: 1.4.8;
Rather than keeping a separate mutex, condvar, and pserialize for each
module hook, we can share a common set of synchronization structures.
This cuts the amount of cacheline_aligned data for these structures by
50%.

Note that we still have a per-hook localcount, since we need to count
individual references.

As discussed with riastradh@

Welcome to 9.99.22 !
 1.3 01-Mar-2019  pgoyette branches: 1.3.4;
Rename the MODULE_*_HOOK() macros to MODULE_HOOK_*() as briefly
discussed on irc.

NFCI intended.

Ride the earlier kernel bump - it;s getting crowded.
 1.2 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.1 28-Mar-2018  pgoyette branches: 1.1.2;
file bio_30.c was initially added on branch pgoyette-compat.
 1.1.2.5 23-Jan-2019  pgoyette Convert the macros for setting and unsetting a hook to generate
in-line code rather than using an intermediary hook##set routine.
Hooks are set and unset only in one place, so the intermediary
routine provides no benefit. IMHO using the macro at the point-
of-call is more readable than using it elsewhere in the code and
then calling the generated intermediary routine (for which you
won't even find its declaration or definition unless you remember
to search for the HOOK_SET macro instead).

NFC intended, will verify with a bulk build and an atf test run.
 1.1.2.4 22-Sep-2018  pgoyette #include "opt_compat_netbsd.h" for all sources that provide compat code.
 1.1.2.3 18-Sep-2018  pgoyette The COMPAT_HOOK macros were renamed to MODULE_HOOK, adjust all callers
 1.1.2.2 17-Sep-2018  pgoyette Adapt (most of) the indirect function pointers to the new MP-safe
mechanism. Still remaining are the compat_netbsd32 stuff, and
some usb subroutines.
 1.1.2.1 28-Mar-2018  pgoyette Initial pass at a compat_30 module.

Still needs some work for dev/vnd and various dev/usb/*
 1.3.4.3 08-Apr-2020  martin Merge changes from current as of 20200406
 1.3.4.2 10-Jun-2019  christos Sync with HEAD
 1.3.4.1 01-Mar-2019  christos file bio_30.c was added on branch phil-wifi on 2019-06-10 22:06:57 +0000
 1.4.8.1 03-Jan-2021  thorpej Sync w/ HEAD.
 1.11 12-Dec-2019  pgoyette Rather than keeping a separate mutex, condvar, and pserialize for each
module hook, we can share a common set of synchronization structures.
This cuts the amount of cacheline_aligned data for these structures by
50%.

Note that we still have a per-hook localcount, since we need to count
individual references.

As discussed with riastradh@

Welcome to 9.99.22 !
 1.10 01-Mar-2019  pgoyette Rename the MODULE_*_HOOK() macros to MODULE_HOOK_*() as briefly
discussed on irc.

NFCI intended.

Ride the earlier kernel bump - it;s getting crowded.
 1.9 27-Jan-2019  christos make this compile again (enable #if 0 code)
 1.8 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.7 19-Mar-2018  martin branches: 1.7.2;
XXX stub it completely for now to make it compile
 1.6 19-Mar-2018  christos XXX: don't reference the global for now so that kernels without ccd build.
 1.5 19-Mar-2018  christos remove another error decl.
 1.4 18-Mar-2018  christos remove error decl
 1.3 18-Mar-2018  christos - use the conditional from the header file
- fix compilation
 1.2 18-Mar-2018  pgoyette Declare 'error' if needed
 1.1 18-Mar-2018  christos branches: 1.1.2;
factor out the ccd COMPAT_60 code.
 1.1.2.9 23-Jan-2019  pgoyette Convert the macros for setting and unsetting a hook to generate
in-line code rather than using an intermediary hook##set routine.
Hooks are set and unset only in one place, so the intermediary
routine provides no benefit. IMHO using the macro at the point-
of-call is more readable than using it elsewhere in the code and
then calling the generated intermediary routine (for which you
won't even find its declaration or definition unless you remember
to search for the HOOK_SET macro instead).

NFC intended, will verify with a bulk build and an atf test run.
 1.1.2.8 18-Sep-2018  pgoyette The COMPAT_HOOK macros were renamed to MODULE_HOOK, adjust all callers
 1.1.2.7 16-Sep-2018  pgoyette Yay - we got the ccd_ioctl_60 stuff to build!

Now we can use that as a template for cleaning up all the others.
 1.1.2.6 20-Mar-2018  pgoyette Initial implementation of sys/kern/kern_stup.c as discussed on tech-kern

For now, we only handle the dev/ccd and NTP needs; more to follow.
 1.1.2.5 19-Mar-2018  pgoyette Stub-out the compat ioctl routine for now to fix compile error on
kernels with no ccd device.
 1.1.2.4 18-Mar-2018  pgoyette Merge changes from HEAD into ccd_60.c

For all of the individual xxx_60_{init,fini} routines, don't force
them to artificially return a status; just make them void. This
simplifies the compat_60_{init,fini} handling of errors that remain.
 1.1.2.3 18-Mar-2018  pgoyette Declare 'error' if needed
 1.1.2.2 18-Mar-2018  pgoyette Import compat_60 changes for dev/ccd
 1.1.2.1 18-Mar-2018  pgoyette file ccd_60.c was added on branch pgoyette-compat on 2018-03-18 21:41:31 +0000
 1.7.2.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.7.2.1 10-Jun-2019  christos Sync with HEAD
 1.4 12-Dec-2019  pgoyette Rather than keeping a separate mutex, condvar, and pserialize for each
module hook, we can share a common set of synchronization structures.
This cuts the amount of cacheline_aligned data for these structures by
50%.

Note that we still have a per-hook localcount, since we need to count
individual references.

As discussed with riastradh@

Welcome to 9.99.22 !
 1.3 01-Mar-2019  pgoyette branches: 1.3.4;
Rename the MODULE_*_HOOK() macros to MODULE_HOOK_*() as briefly
discussed on irc.

NFCI intended.

Ride the earlier kernel bump - it;s getting crowded.
 1.2 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.1 21-Mar-2018  pgoyette branches: 1.1.2;
file clockctl_50.c was initially added on branch pgoyette-compat.
 1.1.2.5 23-Jan-2019  pgoyette Convert the macros for setting and unsetting a hook to generate
in-line code rather than using an intermediary hook##set routine.
Hooks are set and unset only in one place, so the intermediary
routine provides no benefit. IMHO using the macro at the point-
of-call is more readable than using it elsewhere in the code and
then calling the generated intermediary routine (for which you
won't even find its declaration or definition unless you remember
to search for the HOOK_SET macro instead).

NFC intended, will verify with a bulk build and an atf test run.
 1.1.2.4 22-Sep-2018  pgoyette #include "opt_compat_netbsd.h" for all sources that provide compat code.
 1.1.2.3 18-Sep-2018  pgoyette The COMPAT_HOOK macros were renamed to MODULE_HOOK, adjust all callers
 1.1.2.2 17-Sep-2018  pgoyette Adapt (most of) the indirect function pointers to the new MP-safe
mechanism. Still remaining are the compat_netbsd32 stuff, and
some usb subroutines.
 1.1.2.1 21-Mar-2018  pgoyette Split the compat_50 code out from the dev/clockctl driver and include
it in the compat_50 and compat modules.
 1.3.4.3 08-Apr-2020  martin Merge changes from current as of 20200406
 1.3.4.2 10-Jun-2019  christos Sync with HEAD
 1.3.4.1 01-Mar-2019  christos file clockctl_50.c was added on branch phil-wifi on 2019-06-10 22:06:57 +0000
 1.2 27-Jan-2019  pgoyette branches: 1.2.4;
Merge the [pgoyette-compat] branch
 1.1 17-Apr-2018  pgoyette branches: 1.1.2;
file compat_09_mod.c was initially added on branch pgoyette-compat.
 1.1.2.5 22-Sep-2018  pgoyette #include "opt_compat_netbsd.h" for all sources that provide compat code.
 1.1.2.4 15-Sep-2018  pgoyette Since we've already removed the maximum recursion depth for
required modules, there's no need for us to force loading of
the most-recent (ie, "deepest") modules first. So, simplify
the required-modules lists to require only the next-highest
version's module.

This will also make it easier to add new compat_xx modules
for future release versions.
 1.1.2.3 13-Sep-2018  pgoyette When unloading a module with MODULE_CMD_FINI, call the compat_xx_fini()
routine rather than again calling the compat_xx_init() routine!

(Cut&paste strikes again)
 1.1.2.2 10-Sep-2018  pgoyette Remove the monolithic compat and compat_sysv modules. Now that we
don't have aliases, we need to use only the version-specific module
names when resolving dependencies.
 1.1.2.1 17-Apr-2018  pgoyette Actually commit these three files to provide module interfaces
 1.2.4.2 10-Jun-2019  christos Sync with HEAD
 1.2.4.1 27-Jan-2019  christos file compat_09_mod.c was added on branch phil-wifi on 2019-06-10 22:06:57 +0000
 1.3 20-May-2024  christos Rename dup3110 to dup3100 to match historical practice for NetBSD-11,
because we already have kevent100. Fix compat_dup3 to belong in compat_100
not compat_110.
 1.2 28-Jul-2023  christos Add epoll(2) from Theodore Preduta as part of GSoC 2023
 1.1 19-Dec-2022  pgoyette Create compat_100 module infrastructure now that we have branched
for NetBSD-10
 1.2 27-Jan-2019  pgoyette branches: 1.2.4;
Merge the [pgoyette-compat] branch
 1.1 17-Apr-2018  pgoyette branches: 1.1.2;
file compat_10_mod.c was initially added on branch pgoyette-compat.
 1.1.2.5 22-Sep-2018  pgoyette #include "opt_compat_netbsd.h" for all sources that provide compat code.
 1.1.2.4 15-Sep-2018  pgoyette Since we've already removed the maximum recursion depth for
required modules, there's no need for us to force loading of
the most-recent (ie, "deepest") modules first. So, simplify
the required-modules lists to require only the next-highest
version's module.

This will also make it easier to add new compat_xx modules
for future release versions.
 1.1.2.3 13-Sep-2018  pgoyette When unloading a module with MODULE_CMD_FINI, call the compat_xx_fini()
routine rather than again calling the compat_xx_init() routine!

(Cut&paste strikes again)
 1.1.2.2 10-Sep-2018  pgoyette Remove the monolithic compat and compat_sysv modules. Now that we
don't have aliases, we need to use only the version-specific module
names when resolving dependencies.
 1.1.2.1 17-Apr-2018  pgoyette Actually commit these three files to provide module interfaces
 1.2.4.2 10-Jun-2019  christos Sync with HEAD
 1.2.4.1 27-Jan-2019  christos file compat_10_mod.c was added on branch phil-wifi on 2019-06-10 22:06:57 +0000
 1.2 20-May-2024  christos Rename dup3110 to dup3100 to match historical practice for NetBSD-11,
because we already have kevent100. Fix compat_dup3 to belong in compat_100
not compat_110.
 1.1 19-May-2024  christos version dup3
 1.2 27-Jan-2019  pgoyette branches: 1.2.4;
Merge the [pgoyette-compat] branch
 1.1 31-Mar-2018  pgoyette branches: 1.1.2;
file compat_12_mod.c was initially added on branch pgoyette-compat.
 1.1.2.6 22-Sep-2018  pgoyette #include "opt_compat_netbsd.h" for all sources that provide compat code.
 1.1.2.5 15-Sep-2018  pgoyette Since we've already removed the maximum recursion depth for
required modules, there's no need for us to force loading of
the most-recent (ie, "deepest") modules first. So, simplify
the required-modules lists to require only the next-highest
version's module.

This will also make it easier to add new compat_xx modules
for future release versions.
 1.1.2.4 13-Sep-2018  pgoyette When unloading a module with MODULE_CMD_FINI, call the compat_xx_fini()
routine rather than again calling the compat_xx_init() routine!

(Cut&paste strikes again)
 1.1.2.3 10-Sep-2018  pgoyette Remove the monolithic compat and compat_sysv modules. Now that we
don't have aliases, we need to use only the version-specific module
names when resolving dependencies.
 1.1.2.2 01-Apr-2018  pgoyette Update modules' required lists to take advantage of the new unlimited
number of requirements permitted.
 1.1.2.1 31-Mar-2018  pgoyette create the compat_12 module
 1.2.4.2 10-Jun-2019  christos Sync with HEAD
 1.2.4.1 27-Jan-2019  christos file compat_12_mod.c was added on branch phil-wifi on 2019-06-10 22:06:57 +0000
 1.2 27-Jan-2019  pgoyette branches: 1.2.4;
Merge the [pgoyette-compat] branch
 1.1 30-Mar-2018  pgoyette branches: 1.1.2;
file compat_13_mod.c was initially added on branch pgoyette-compat.
 1.1.2.6 22-Sep-2018  pgoyette #include "opt_compat_netbsd.h" for all sources that provide compat code.
 1.1.2.5 15-Sep-2018  pgoyette Since we've already removed the maximum recursion depth for
required modules, there's no need for us to force loading of
the most-recent (ie, "deepest") modules first. So, simplify
the required-modules lists to require only the next-highest
version's module.

This will also make it easier to add new compat_xx modules
for future release versions.
 1.1.2.4 13-Sep-2018  pgoyette When unloading a module with MODULE_CMD_FINI, call the compat_xx_fini()
routine rather than again calling the compat_xx_init() routine!

(Cut&paste strikes again)
 1.1.2.3 10-Sep-2018  pgoyette Remove the monolithic compat and compat_sysv modules. Now that we
don't have aliases, we need to use only the version-specific module
names when resolving dependencies.
 1.1.2.2 01-Apr-2018  pgoyette Update modules' required lists to take advantage of the new unlimited
number of requirements permitted.
 1.1.2.1 30-Mar-2018  pgoyette Add compat_13 module
 1.2.4.2 10-Jun-2019  christos Sync with HEAD
 1.2.4.1 27-Jan-2019  christos file compat_13_mod.c was added on branch phil-wifi on 2019-06-10 22:06:57 +0000
 1.2 27-Jan-2019  pgoyette branches: 1.2.4;
Merge the [pgoyette-compat] branch
 1.1 30-Mar-2018  pgoyette branches: 1.1.2;
file compat_14_mod.c was initially added on branch pgoyette-compat.
 1.1.2.5 22-Sep-2018  pgoyette #include "opt_compat_netbsd.h" for all sources that provide compat code.
 1.1.2.4 15-Sep-2018  pgoyette Since we've already removed the maximum recursion depth for
required modules, there's no need for us to force loading of
the most-recent (ie, "deepest") modules first. So, simplify
the required-modules lists to require only the next-highest
version's module.

This will also make it easier to add new compat_xx modules
for future release versions.
 1.1.2.3 13-Sep-2018  pgoyette When unloading a module with MODULE_CMD_FINI, call the compat_xx_fini()
routine rather than again calling the compat_xx_init() routine!

(Cut&paste strikes again)
 1.1.2.2 10-Sep-2018  pgoyette Remove the monolithic compat and compat_sysv modules. Now that we
don't have aliases, we need to use only the version-specific module
names when resolving dependencies.
 1.1.2.1 30-Mar-2018  pgoyette Extract compat_14 stuff into its own module
 1.2.4.2 10-Jun-2019  christos Sync with HEAD
 1.2.4.1 27-Jan-2019  christos file compat_14_mod.c was added on branch phil-wifi on 2019-06-10 22:06:57 +0000
 1.2 27-Jan-2019  pgoyette branches: 1.2.4;
Merge the [pgoyette-compat] branch
 1.1 30-Mar-2018  pgoyette branches: 1.1.2;
file compat_16_mod.c was initially added on branch pgoyette-compat.
 1.1.2.5 22-Sep-2018  pgoyette #include "opt_compat_netbsd.h" for all sources that provide compat code.
 1.1.2.4 15-Sep-2018  pgoyette Since we've already removed the maximum recursion depth for
required modules, there's no need for us to force loading of
the most-recent (ie, "deepest") modules first. So, simplify
the required-modules lists to require only the next-highest
version's module.

This will also make it easier to add new compat_xx modules
for future release versions.
 1.1.2.3 13-Sep-2018  pgoyette When unloading a module with MODULE_CMD_FINI, call the compat_xx_fini()
routine rather than again calling the compat_xx_init() routine!

(Cut&paste strikes again)
 1.1.2.2 10-Sep-2018  pgoyette Remove the monolithic compat and compat_sysv modules. Now that we
don't have aliases, we need to use only the version-specific module
names when resolving dependencies.
 1.1.2.1 30-Mar-2018  pgoyette Create and build a compat_16 module
 1.2.4.2 10-Jun-2019  christos Sync with HEAD
 1.2.4.1 27-Jan-2019  christos file compat_16_mod.c was added on branch phil-wifi on 2019-06-10 22:06:57 +0000
 1.2 27-Jan-2019  pgoyette branches: 1.2.4;
Merge the [pgoyette-compat] branch
 1.1 30-Mar-2018  pgoyette branches: 1.1.2;
file compat_20_mod.c was initially added on branch pgoyette-compat.
 1.1.2.5 22-Sep-2018  pgoyette #include "opt_compat_netbsd.h" for all sources that provide compat code.
 1.1.2.4 15-Sep-2018  pgoyette Since we've already removed the maximum recursion depth for
required modules, there's no need for us to force loading of
the most-recent (ie, "deepest") modules first. So, simplify
the required-modules lists to require only the next-highest
version's module.

This will also make it easier to add new compat_xx modules
for future release versions.
 1.1.2.3 13-Sep-2018  pgoyette Fix typo - Don't try to re-init the submodule when doing MODULE_CMD_fINI!
 1.1.2.2 10-Sep-2018  pgoyette Remove the monolithic compat and compat_sysv modules. Now that we
don't have aliases, we need to use only the version-specific module
names when resolving dependencies.
 1.1.2.1 30-Mar-2018  pgoyette Create and build the compat_20 module
 1.2.4.2 10-Jun-2019  christos Sync with HEAD
 1.2.4.1 27-Jan-2019  christos file compat_20_mod.c was added on branch phil-wifi on 2019-06-10 22:06:57 +0000
 1.3 28-Dec-2019  pgoyette For the built-in COMPAT_30 module code, make sure to initialize the
uipc_syscalls_30 stuff, notably to include compat_30_socket().

PR kern/54804

XXX Pullup-9 XXX
 1.2 27-Jan-2019  pgoyette branches: 1.2.4; 1.2.6;
Merge the [pgoyette-compat] branch
 1.1 28-Mar-2018  pgoyette branches: 1.1.2;
file compat_30_mod.c was initially added on branch pgoyette-compat.
 1.1.2.9 22-Sep-2018  pgoyette #include "opt_compat_netbsd.h" for all sources that provide compat code.
 1.1.2.8 19-Sep-2018  pgoyette We have some COMPAT_30 code that needs compat_offseterr(), so let's
require the compat_util module.
 1.1.2.7 15-Sep-2018  pgoyette Since we've already removed the maximum recursion depth for
required modules, there's no need for us to force loading of
the most-recent (ie, "deepest") modules first. So, simplify
the required-modules lists to require only the next-highest
version's module.

This will also make it easier to add new compat_xx modules
for future release versions.
 1.1.2.6 13-Sep-2018  pgoyette When unloading a module with MODULE_CMD_FINI, call the compat_xx_fini()
routine rather than again calling the compat_xx_init() routine!

(Cut&paste strikes again)
 1.1.2.5 10-Sep-2018  pgoyette Remove the monolithic compat and compat_sysv modules. Now that we
don't have aliases, we need to use only the version-specific module
names when resolving dependencies.
 1.1.2.4 30-Mar-2018  pgoyette Create the compat_util module for use by version-specific compat code.
(It's automatically included in the monolithic compat module, as well
as in kernels with built-in compat code.)
 1.1.2.3 29-Mar-2018  pgoyette Split out the usb compat_30 code and add it to the module
 1.1.2.2 28-Mar-2018  pgoyette Split vnd compat_30 code out of the main driver and into the compat_30
module
 1.1.2.1 28-Mar-2018  pgoyette Initial pass at a compat_30 module.

Still needs some work for dev/vnd and various dev/usb/*
 1.2.6.1 29-Dec-2019  martin Pull up following revision(s) (requested by pgoyette in ticket #588):
sys/compat/common/compat_30_mod.c: revision 1.3
For the built-in COMPAT_30 module code, make sure to initialize the
uipc_syscalls_30 stuff, notably to include compat_30_socket().
PR kern/54804
XXX Pullup-9 XXX
 1.2.4.3 08-Apr-2020  martin Merge changes from current as of 20200406
 1.2.4.2 10-Jun-2019  christos Sync with HEAD
 1.2.4.1 27-Jan-2019  christos file compat_30_mod.c was added on branch phil-wifi on 2019-06-10 22:06:57 +0000
 1.2 27-Jan-2019  pgoyette branches: 1.2.4;
Merge the [pgoyette-compat] branch
 1.1 27-Mar-2018  pgoyette branches: 1.1.2;
file compat_40_mod.c was initially added on branch pgoyette-compat.
 1.1.2.7 15-Oct-2018  pgoyette Convert a couple more hooks to the MP-safe mechanism.

While here, clean up some headers and remove any that are now empty.
 1.1.2.6 22-Sep-2018  pgoyette #include "opt_compat_netbsd.h" for all sources that provide compat code.
 1.1.2.5 15-Sep-2018  pgoyette Since we've already removed the maximum recursion depth for
required modules, there's no need for us to force loading of
the most-recent (ie, "deepest") modules first. So, simplify
the required-modules lists to require only the next-highest
version's module.

This will also make it easier to add new compat_xx modules
for future release versions.
 1.1.2.4 13-Sep-2018  pgoyette When unloading a module with MODULE_CMD_FINI, call the compat_xx_fini()
routine rather than again calling the compat_xx_init() routine!

(Cut&paste strikes again)
 1.1.2.3 10-Sep-2018  pgoyette Remove the monolithic compat and compat_sysv modules. Now that we
don't have aliases, we need to use only the version-specific module
names when resolving dependencies.
 1.1.2.2 16-Apr-2018  pgoyette Rename if_[45]0_{init,fini} entry points to more appropriate and more
consistent uipc_syscalls_[45]0_{init,fini} and remove some multiple
declarations.
 1.1.2.1 27-Mar-2018  pgoyette Create a compat_40 module
 1.2.4.2 10-Jun-2019  christos Sync with HEAD
 1.2.4.1 27-Jan-2019  christos file compat_40_mod.c was added on branch phil-wifi on 2019-06-10 22:06:57 +0000
 1.3 28-Jan-2019  christos branches: 1.3.4;
- provide a hook for the 43 tty ioctls
- make the 60 tty ioctl hook look the same
- fix the tty code to call both hooks and remove unused lock
 1.2 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.1 17-Apr-2018  pgoyette branches: 1.1.2;
file compat_43_mod.c was initially added on branch pgoyette-compat.
 1.1.2.4 22-Sep-2018  pgoyette #include "opt_compat_netbsd.h" for all sources that provide compat code.
 1.1.2.3 13-Sep-2018  pgoyette When unloading a module with MODULE_CMD_FINI, call the compat_xx_fini()
routine rather than again calling the compat_xx_init() routine!

(Cut&paste strikes again)
 1.1.2.2 10-Sep-2018  pgoyette Remove the monolithic compat and compat_sysv modules. Now that we
don't have aliases, we need to use only the version-specific module
names when resolving dependencies.
 1.1.2.1 17-Apr-2018  pgoyette Actually commit these three files to provide module interfaces
 1.3.4.2 10-Jun-2019  christos Sync with HEAD
 1.3.4.1 28-Jan-2019  christos file compat_43_mod.c was added on branch phil-wifi on 2019-06-10 22:06:57 +0000
 1.4 10-Dec-2021  andvar s/occured/occurred/ in comments, log messages and man pages.
 1.3 15-Apr-2019  pgoyette branches: 1.3.4;
Split the COMPAT_50 socket-timeout stuff out of kern/uipc_socket.c
and into its own source file, which is now included in the compat_50
module.

(Not sure how this got missed during the original [pgoyette-compat] work)
 1.2 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.1 19-Mar-2018  pgoyette branches: 1.1.2;
file compat_50_mod.c was initially added on branch pgoyette-compat.
 1.1.2.18 11-Jan-2019  pgoyette Rework the various sysctl-related routines to call the correct code
for each version. While here, extract the 5.0 specific code instead
of including in the main rtsock.c code.

Also, clean up all the sysctl-related routines to prevent building
more than one copy, no matter how many places rtsock.c gets #include'd
into!
 1.1.2.17 12-Oct-2018  pgoyette Use a MP-safe hook for the rnd_ioctl compat_50 calls.
 1.1.2.16 23-Sep-2018  pgoyette No need to declare the crypto_50 init/fini routines. The compat_50
module no longer needs them, and they're declared static in the
ocryptodev.c code
 1.1.2.15 23-Sep-2018  pgoyette Now that cryptodev_50 is a separate module we can't initialize it
from the generic compat_50 module.
 1.1.2.14 22-Sep-2018  pgoyette Split the raidframe compatability code out into separate modules, since
the driver is already a module. This avoids having to pass a bunch of
function pointers as arguments to raidframe's compat_ioctl().
 1.1.2.13 22-Sep-2018  pgoyette #include "opt_compat_netbsd.h" for all sources that provide compat code.
 1.1.2.12 19-Sep-2018  pgoyette Split out the vnd COMPAT_50 code
 1.1.2.11 15-Sep-2018  pgoyette Since we've already removed the maximum recursion depth for
required modules, there's no need for us to force loading of
the most-recent (ie, "deepest") modules first. So, simplify
the required-modules lists to require only the next-highest
version's module.

This will also make it easier to add new compat_xx modules
for future release versions.
 1.1.2.10 13-Sep-2018  pgoyette When unloading a module with MODULE_CMD_FINI, call the compat_xx_fini()
routine rather than again calling the compat_xx_init() routine!

(Cut&paste strikes again)
 1.1.2.9 10-Sep-2018  pgoyette Remove the monolithic compat and compat_sysv modules. Now that we
don't have aliases, we need to use only the version-specific module
names when resolving dependencies.
 1.1.2.8 16-Apr-2018  pgoyette Rename if_[45]0_{init,fini} entry points to more appropriate and more
consistent uipc_syscalls_[45]0_{init,fini} and remove some multiple
declarations.
 1.1.2.7 24-Mar-2018  pgoyette Move the compat_50-specific code out of wscons/wsevent.c into its own
source file, which is now part of the compat_50 module.
 1.1.2.6 24-Mar-2018  pgoyette Don't include unneeded opt_* files
 1.1.2.5 24-Mar-2018  pgoyette Add raidframe init/fini calls
 1.1.2.4 23-Mar-2018  pgoyette Handle the compat_50 stuff for opencrypto/cryptodev
 1.1.2.3 21-Mar-2018  pgoyette Add a compat_80 module - we need this for some raidframe stuff.

Update other modules to add compat_80 to the required lists.
 1.1.2.2 21-Mar-2018  pgoyette Split the compat_50 code out from the dev/clockctl driver and include
it in the compat_50 and compat modules.
 1.1.2.1 19-Mar-2018  pgoyette Initial pass at a COMPAT_50 module. More to come.
 1.3.4.2 10-Jun-2019  christos Sync with HEAD
 1.3.4.1 15-Apr-2019  christos file compat_50_mod.c was added on branch phil-wifi on 2019-06-10 22:06:57 +0000
 1.4 21-Sep-2022  dholland compat_50_quota: reject invalid quota id types.

Reported-by: syzbot+ce8391eb74a16e1967ab@syzkaller.appspotmail.com
 1.3 09-Mar-2020  pgoyette branches: 1.3.2;
The compat_50_quota code needs quota support from ufs. Add dependency.
 1.2 22-Jan-2020  pgoyette branches: 1.2.2;
Since this used to be part of the compat_50 module, make it depend on
compat_50 rather than compat_60 module.
 1.1 21-Jan-2020  pgoyette Split the compat_50 module into two, separating the QUOTA-related
stuff from the rest of the module. This allows loading of the
(main) compat_50 module on kernels that don't include ``options
QUOTA''.

Welcome to 9.99.40 !

Addresses PR kern/54875
 1.2.2.2 25-Jan-2020  ad Sync with head.
 1.2.2.1 22-Jan-2020  ad file compat_50_quota.c was added on branch ad-namecache on 2020-01-25 22:38:44 +0000
 1.3.2.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.3.2.1 09-Mar-2020  martin file compat_50_quota.c was added on branch phil-wifi on 2020-04-08 14:08:00 +0000
 1.2 27-Jan-2019  pgoyette branches: 1.2.4;
Merge the [pgoyette-compat] branch
 1.1 15-Mar-2018  pgoyette branches: 1.1.2;
file compat_60_mod.c was initially added on branch pgoyette-compat.
 1.1.2.19 22-Sep-2018  pgoyette #include "opt_compat_netbsd.h" for all sources that provide compat code.
 1.1.2.18 15-Sep-2018  pgoyette Since we've already removed the maximum recursion depth for
required modules, there's no need for us to force loading of
the most-recent (ie, "deepest") modules first. So, simplify
the required-modules lists to require only the next-highest
version's module.

This will also make it easier to add new compat_xx modules
for future release versions.
 1.1.2.17 13-Sep-2018  pgoyette When unloading a module with MODULE_CMD_FINI, call the compat_xx_fini()
routine rather than again calling the compat_xx_init() routine!

(Cut&paste strikes again)
 1.1.2.16 10-Sep-2018  pgoyette Remove the monolithic compat and compat_sysv modules. Now that we
don't have aliases, we need to use only the version-specific module
names when resolving dependencies.
 1.1.2.15 31-Mar-2018  pgoyette Re-enable inclusion of CPU_UCODE for i386/amd64. Even though it won't
build correctly on XEN (won't use the XEN ABI), it works fine on real
hardware.
 1.1.2.14 26-Mar-2018  pgoyette For now, disable CPU_UCODE stuff since we can't build it properly
with XEN. Re-enable it after we get fix for PR kern/53130
 1.1.2.13 24-Mar-2018  pgoyette Don't include unneeded opt_* files
 1.1.2.12 21-Mar-2018  pgoyette Add a compat_80 module - we need this for some raidframe stuff.

Update other modules to add compat_80 to the required lists.
 1.1.2.11 19-Mar-2018  pgoyette Initial pass at a COMPAT_50 module. More to come.
 1.1.2.10 18-Mar-2018  pgoyette Merge changes from HEAD into ccd_60.c

For all of the individual xxx_60_{init,fini} routines, don't force
them to artificially return a status; just make them void. This
simplifies the compat_60_{init,fini} handling of errors that remain.
 1.1.2.9 18-Mar-2018  pgoyette Import compat_60 changes for dev/ccd
 1.1.2.8 18-Mar-2018  pgoyette Initial pass at getting the tty stuff properly modularized. Subject
to review and revision.
 1.1.2.7 18-Mar-2018  pgoyette Clean-up for kern_cpu_60 code.

Also, although not strictly necessary, include the kern_sa_60 stuff in
the compat_60 module, for completeness.

Still need to deal with some tty code and the ccd driver to finish off
the compat_60 module.
 1.1.2.6 18-Mar-2018  pgoyette Move closer to a complete compat_60 module. All that remains is some
tty stuff and some ccd ioctl()s.
 1.1.2.5 17-Mar-2018  pgoyette Back out changes on the branch related to kernel microcode compat.

Christos didn't like the way it was done, so waiting for a better
approach/implementation.
 1.1.2.4 17-Mar-2018  pgoyette Move closer to having a compat_60 module
 1.1.2.3 16-Mar-2018  pgoyette Move closer to getting a compat_60 module - still needs more work
 1.1.2.2 16-Mar-2018  pgoyette Initial pass at setting up the compat_60 module.

XXX needs some work to properly handle cpu_ucode stuff.

While here, move details of compat_70 init/fini routines into the
module itself.
 1.1.2.1 15-Mar-2018  pgoyette Initial set-up for compat_60 module
 1.2.4.2 10-Jun-2019  christos Sync with HEAD
 1.2.4.1 27-Jan-2019  christos file compat_60_mod.c was added on branch phil-wifi on 2019-06-10 22:06:58 +0000
 1.3 17-Apr-2019  msaitoh branches: 1.3.4;
KNF. No functional change.
 1.2 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.1 15-Mar-2018  pgoyette branches: 1.1.2;
file compat_70_mod.c was initially added on branch pgoyette-compat.
 1.1.2.12 15-Oct-2018  pgoyette Convert the compat70_unp_addsockcred hook to the MP-safe mechanism.

XXX One more remaining: sysvipc50_sysctl
 1.1.2.11 15-Oct-2018  pgoyette Convert another hook to the MP-sfe mechanism.

XXX still have three more to convert: openat_10, sysvipc50_sysctl and
XXX compat70_unp_addsockcred
 1.1.2.10 22-Sep-2018  pgoyette #include "opt_compat_netbsd.h" for all sources that provide compat code.
 1.1.2.9 15-Sep-2018  pgoyette Since we've already removed the maximum recursion depth for
required modules, there's no need for us to force loading of
the most-recent (ie, "deepest") modules first. So, simplify
the required-modules lists to require only the next-highest
version's module.

This will also make it easier to add new compat_xx modules
for future release versions.
 1.1.2.8 10-Sep-2018  pgoyette Remove the monolithic compat and compat_sysv modules. Now that we
don't have aliases, we need to use only the version-specific module
names when resolving dependencies.
 1.1.2.7 24-Mar-2018  pgoyette Don't include unneeded opt_* files
 1.1.2.6 21-Mar-2018  pgoyette Add a compat_80 module - we need this for some raidframe stuff.

Update other modules to add compat_80 to the required lists.
 1.1.2.5 17-Mar-2018  pgoyette Make all the compat_xx_{init,fini} routines return an int, whether or
not they currently need it.
 1.1.2.4 16-Mar-2018  pgoyette Move closer to getting a compat_60 module - still needs more work
 1.1.2.3 16-Mar-2018  pgoyette Initial pass at setting up the compat_60 module.

XXX needs some work to properly handle cpu_ucode stuff.

While here, move details of compat_70 init/fini routines into the
module itself.
 1.1.2.2 15-Mar-2018  pgoyette Remove some unnecessary #includes
 1.1.2.1 15-Mar-2018  pgoyette Create a separate module for COMPAT_70 code only, and untangle the
70 compat code from the current.
 1.3.4.2 10-Jun-2019  christos Sync with HEAD
 1.3.4.1 17-Apr-2019  christos file compat_70_mod.c was added on branch phil-wifi on 2019-06-10 22:06:58 +0000
 1.5 03-Oct-2019  pgoyette Since we now have a compat_90 module, the compat_80 module should depend
on it.
 1.4 17-May-2019  msaitoh branches: 1.4.2;
The max subtype of the ifmedia word is 31. It's too small for Ethernet now.
We currently use use it up to 30. We should extend the limit to be able to use
more than 10Gbps speeds. Our ifmedia(4) is inconvenience and have some problem
so we should redesign the interface, but it's too late for netbsd-9 to do it.
So, we keep the data structure size and modify the structure a bit. The
strategy is almost the same as FreeBSD. Many bits of IFM_OMASK for Ethernet
have not used, so use some of them for Ethernet's subtype.

The differences against FreeBSD are:
- We use NetBSD style compat code (i.e. no SIOCGIFXMEDIA).
- FreeBSD's IFM_ETH_XTYPE's bit location is from 11 to "14" even though
IFM_OMASK is from 8 to "15". We use _IFM_ETH_XTMASK from bit 13 to "15".
- FreeBSD changed the meaning of IFM_TYPE_MATCH(). I think we should
not do it. We keep it not changing and added new IFM_TYPE_SUBTYPE_MATCH()
macro for matching both TYPE and SUBTYPE.
- Added up to 400GBASE-SR16.

New layout of the media word is as follows (from ifmedia_h):

* if_media Options word:
* Bits Use
* ---- -------
* 0-4 Media subtype MAX SUBTYPE == 255 for ETH and 31 for others
* 5-7 Media type
* 8-15 Type specific options
* 16-18 Mode (for multi-mode devices)
* 19 (Reserved for Future Use)
* 20-27 Shared (global) options
* 28-31 Instance
*
* 3 2 1
* 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
* +-------+---------------+-+-----+---------------+-----+---------+
* | | |R| | | | |
* | IMASK | GMASK |F|MMASK+-----+ OMASK |NMASK| TMASK |
* | | |U| |XTMSK| | | |
* +-------+---------------+-+-----+-----+---------+-----+---------+
* <-----> <---> <--->
* IFM_INST() IFM_MODE() IFM_TYPE()
*
* IFM_SUBTYPE(other than ETH)<------->
*
* <---> IFM_SUBTYPE(ETH)<------->
*
*
* <-------------> <------------->
* IFM_OPTIONS()
 1.3 17-Apr-2019  msaitoh KNF. No functional change.
 1.2 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.1 21-Mar-2018  pgoyette branches: 1.1.2;
file compat_80_mod.c was initially added on branch pgoyette-compat.
 1.1.2.11 22-Sep-2018  pgoyette Split the raidframe compatability code out into separate modules, since
the driver is already a module. This avoids having to pass a bunch of
function pointers as arguments to raidframe's compat_ioctl().
 1.1.2.10 22-Sep-2018  pgoyette #include "opt_compat_netbsd.h" for all sources that provide compat code.
 1.1.2.9 15-Sep-2018  pgoyette Since we've already removed the maximum recursion depth for
required modules, there's no need for us to force loading of
the most-recent (ie, "deepest") modules first. So, simplify
the required-modules lists to require only the next-highest
version's module.

This will also make it easier to add new compat_xx modules
for future release versions.
 1.1.2.8 10-Sep-2018  pgoyette Remove the monolithic compat and compat_sysv modules. Now that we
don't have aliases, we need to use only the version-specific module
names when resolving dependencies.
 1.1.2.7 03-Apr-2018  pgoyette Remove fixed allocation of modules' "required" lists (previously
limited to MAXMODDEPS entries). Update the modctl(MODCTL_STAT)
syscall to return the required data in a new format, and retain
the previous data format in MODCTL_OSTAT. Update the compat_80
and compat_netbsd32 modules as needed.
 1.1.2.6 24-Mar-2018  pgoyette Remove unneeded opt_* includes.

Since raidframe_80_{init,fini} don't return values, don't try to use them!
 1.1.2.5 24-Mar-2018  pgoyette Also add raidframe init/fini for compat_80
 1.1.2.4 24-Mar-2018  pgoyette Separate the compat_50 and compat_80 dispatching code from the main
body of raidframe, and place into the appropriate compat modules.

Enable building of the compat_80 module.
 1.1.2.3 23-Mar-2018  pgoyette For now, the compat_80 module is empty.
 1.1.2.2 21-Mar-2018  pgoyette Move if_spppsubr compat code into the compat50 module.

More prep work for compat80 module (for raidframe)
 1.1.2.1 21-Mar-2018  pgoyette Add a compat_80 module - we need this for some raidframe stuff.

Update other modules to add compat_80 to the required lists.
 1.4.2.3 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.4.2.2 10-Jun-2019  christos Sync with HEAD
 1.4.2.1 17-May-2019  christos file compat_80_mod.c was added on branch phil-wifi on 2019-06-10 22:06:58 +0000
 1.6 09-Dec-2023  oster Allow kernels builds which don't define INET6 to compile compat bits too.
 1.5 09-Dec-2023  pgoyette Modularize the COMPAT_90 code that resulted from the removal of
netinet6/nd6 from the kernel. Now, the minimal compat code can
be successfully loaded and unloaded along with the rest of the
COMPAT_90 code.

XXX pullup-10 - hopefully before RC2
 1.4 19-Dec-2022  pgoyette Create compat_100 module infrastructure now that we have branched
for NetBSD-10
 1.3 04-Jan-2020  pgoyette branches: 1.3.8; 1.3.28;
Resurrect boottime, but only in the compat_90 module (whether built-in
or separately loaded). This will enable running of old vmstat(1) images
on newer kernels.
 1.2 28-Oct-2019  christos Don't ignore EBUSY from disestablish or we can crash by unloading busy
syscalls.
 1.1 22-Sep-2019  christos Add a new member to struct vfsstat and grow the unused members
The new member is caled f_mntfromlabel and it is the dkw_wname
of the corresponding wedge. This is now used by df -W to display
the mountpoint name as NAME=
 1.3.28.1 10-Dec-2023  martin Pull up following revision(s) (requested by pgoyette in ticket #487):

sys/compat/common/compat_90_mod.c: revision 1.5
sys/compat/common/compat_90_mod.c: revision 1.6
sys/netinet6/in6.c: revision 1.290
sys/netinet6/in6.c: revision 1.291
sys/compat/common/files.common: revision 1.11
sys/netinet6/icmp6.c: revision 1.255
sys/compat/common/net_inet6_nd_90.c: revision 1.1
sys/compat/common/net_inet6_nd_90.c: revision 1.2
sys/modules/compat_90/Makefile: revision 1.2
sys/modules/compat_90/Makefile: revision 1.3
sys/netinet6/nd6.c: revision 1.281
sys/compat/common/compat_mod.h: revision 1.10
sys/kern/compat_stub.c: revision 1.23
sys/sys/compat_stub.h: revision 1.27

Identify the need to rework the COMPAT_* code to be more
module-aware.
This is an XXX comment block only, NFCI.

Modularize the COMPAT_90 code that resulted from the removal of
netinet6/nd6 from the kernel. Now, the minimal compat code can
be successfully loaded and unloaded along with the rest of the
COMPAT_90 code.

Allow kernels builds which don't define INET6 to compile compat bits
too.

Default the build of compat_90 module to include IPv6, as is done
for other INET6-sensitive modules (see if_lagg).
 1.3.8.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.3.8.1 04-Jan-2020  martin file compat_90_mod.c was added on branch phil-wifi on 2020-04-13 08:04:13 +0000
 1.18 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.17 15-Aug-2009  matt branches: 1.17.62; 1.17.64;
Include <sys/exec_aout.h> explicitly instead of relying on <sys/exec.h> to
do it for you.
 1.16 13-Aug-2009  matt #include "opt_execfmt.h" and only compile innards if EXEC_AOUT is defined.
 1.15 08-Dec-2007  dsl branches: 1.15.16;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.14 11-Dec-2005  christos branches: 1.14.44; 1.14.46; 1.14.56;
merge ktrace-lwp.
 1.13 26-Feb-2005  perry branches: 1.13.4;
nuke trailing whitespace
 1.12 30-Jan-2005  christos Don't try to map a 0 size bss.
 1.11 19-Nov-2003  christos branches: 1.11.8; 1.11.10;
Don't include malloc.h if you are not going to use it.
 1.10 08-Aug-2003  christos - GC all the setup_stack functions
- add one for linux/i386
 1.9 01-Apr-2003  thorpej branches: 1.9.2;
Use PAGE_SIZE rather than NBPG.
 1.8 10-Dec-2002  thorpej Rename __LDPGSZ to AOUT_LDPGSZ, to accurately reflect what it is.
 1.7 05-Oct-2002  chs count executable image pages as executable for vm-usage purposes.
also, always do the VTEXT vs. v_writecount mutual exclusion
(which we previously skipped if the text or data segment was empty).
 1.6 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.5 13-Nov-2001  lukem branches: 1.5.10;
add RCSIDs (including regeneration of files as appropriate)
 1.4 30-Oct-2001  thorpej - Add a new vnode flag VEXECMAP, which indicates that a vnode has
executable mappings. Stop overloading VTEXT for this purpose (VTEXT
also has another meaning).
- Rename vn_marktext() to vn_markexec(), and use it when executable
mappings of a vnode are established.
- In places where we want to set VTEXT, set it in v_flag directly, rather
than making a function call to do this (it no longer makes sense to
use a function call, since we no longer overload VTEXT with VEXECMAP's
meaning).

VEXECMAP suggested by Chuq Silvers.
 1.3 28-Jun-2000  mrg branches: 1.3.2; 1.3.4; 1.3.8;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.2 11-Apr-2000  chs add a new function vn_marktext() for exec code to let others know
that the vnode is now being used as process text.
 1.1 18-May-1996  christos branches: 1.1.26; 1.1.30;
- Moving cpu_exec_aout_prep_oldzmagic -> exec_aout_prep_oldzmagic.
This is used by the i386, hp300 and mac68k ports.
- Added exec_aout_prep_oldomagic, and exec_aout_prep_oldnmagic
These are just copies of the respective prep functions from
kern_exec.c with text address starting at 0. Maybe a better fix
is to pass the starting address as a third argument so we don't
duplicate code, but this could be the next pass since the functions
are used in many places. These functions are used for BSDI binaries.
 1.1.30.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.1.26.1 04-Jul-1999  chs after setting VTEXT on a vnode, flush any UBC mappings
to try to prevent unnecessary VAC aliases.
 1.3.8.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.3.4.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.3.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.3.2.3 11-Dec-2002  thorpej Sync with HEAD.
 1.3.2.2 18-Oct-2002  nathanw Catch up to -current.
 1.3.2.1 14-Nov-2001  nathanw Catch up to -current.
 1.5.10.2 02-Oct-2003  tron Pull up revision 1.7 (requested by junyoung in ticket #1488):
count executable image pages as executable for vm-usage purposes.
also, always do the VTEXT vs. v_writecount mutual exclusion
(which we previously skipped if the text or data segment was empty).
 1.5.10.1 27-Sep-2003  tron Pull up revision 1.6 (requested by junyoung in ticket #1466):
remove trailing \n in panic(). approved perry.
 1.9.2.6 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.9.2.5 04-Feb-2005  skrll Sync with HEAD.
 1.9.2.4 04-Feb-2005  skrll Adapt to branch.
 1.9.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.9.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.9.2.1 03-Aug-2004  skrll Sync with HEAD
 1.11.10.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.11.10.1 12-Feb-2005  yamt sync with head.
 1.11.8.1 29-Apr-2005  kent sync with -current
 1.13.4.2 21-Jan-2008  yamt sync with head
 1.13.4.1 21-Jun-2006  yamt sync with head.
 1.14.56.1 26-Dec-2007  ad Sync with head.
 1.14.46.1 09-Jan-2008  matt sync with HEAD
 1.14.44.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.15.16.1 19-Aug-2009  yamt sync with head.
 1.17.64.1 10-Jun-2019  christos Sync with HEAD
 1.17.62.1 22-Sep-2018  pgoyette #include "opt_compat_netbsd.h" for all sources that provide compat code.
 1.25 12-Dec-2007  dsl compat_file.[ch] are no longer used
 1.24 08-Dec-2007  dsl branches: 1.24.2; 1.24.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.23 14-Jul-2007  dsl branches: 1.23.6; 1.23.8; 1.23.14; 1.23.16;
Adapt for sys_mount() becoming compat_40_sys_mount(),
 1.22 22-Apr-2007  dsl Change the way that emulations locate files within the emulation root to
avoid having to allocate space in the 'stackgap'
- which is very LWP unfriendly.
The additional code for non-emulation namei() is trivial, the reduction for
the emulations is massive.
The vnode for a processes emulation root is saved in the cwdi structure
during process exec.
If the emulation root the TRYEMULROOT flag are set, namei() will do an initial
search for absolute pathnames in the emulation root, if that fails it will
retry from the normal root.
".." at the emulation root will always go to the real root, even in the middle
of paths and when expanding symlinks.
Absolute symlinks found using absolute paths in the emulation root will be
relative to the emulation root (so /usr/lib/xxx.so -> /lib/xxx.so links
inside the emulation root don't need changing).
If the root of the emulation would be returned (for an emulation lookup), then
the real root is returned instead (matching the behaviour of emul_lookup,
but being a cheap comparison here) so that programs that scan "../.."
looking for the root dircetory don't loop forever.
The target for symbolic links is no longer mangled (it used to get the
CHECK_ALT_xxx() treatment, so could get /emul/xxx prepended).
CHECK_ALT_xxx() are no more. Most of the change is deleting them, and adding
TRYEMULROOT to the flags to NDINIT().
A lot of the emulation system call stubs could now be deleted.
 1.21 04-Mar-2007  christos branches: 1.21.2; 1.21.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.20 09-Feb-2007  ad branches: 1.20.2;
Merge newlock2 to head.
 1.19 14-Jul-2006  christos branches: 1.19.4;
make this compile again.
 1.18 13-Jul-2006  pavel sys_getfh -> compot_30_sys_getfh
 1.17 11-Dec-2005  christos branches: 1.17.4; 1.17.8;
merge ktrace-lwp.
 1.16 19-Aug-2005  christos 64 bit inode changes.
 1.15 29-May-2005  christos branches: 1.15.2;
- sprinkle const.
- add XXXUNCONST to the emul_find() pbuf argument free'ing. XXX: this needs
an api change.
- avoid variable shadowing.
 1.14 26-Feb-2005  perry nuke trailing whitespace
 1.13 24-Jul-2004  manu branches: 1.13.4; 1.13.6;
Add a wrapper for connect that check an alternate path in emulation tree
for AF_LOCAL sockets.
 1.12 21-Apr-2004  christos Replace the statfs() family of system calls with statvfs().
Retain binary compatibility.
 1.11 19-Nov-2003  christos Don't include malloc.h if you are not going to use it.
 1.10 29-Jun-2003  fvdl branches: 1.10.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.9 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.8 05-Jun-2003  christos simplify bsd_sys_bind()
 1.7 05-Jun-2003  manu Ooops, I deleted a debug printf just before committing and one bit was
remaining. While I'm there, fix a typo in a comment.
 1.6 05-Jun-2003  manu Search alternate /emul/* path for AF_LOCAL sockets at bind() time.
 1.5 04-Jun-2003  manu Build again with SA
 1.4 10-Feb-2003  christos include more opt_ files for nfs.
 1.3 10-Feb-2003  christos getfh is needed for NFS server.
 1.2 22-Jan-2003  christos lwp'ify
 1.1 08-Dec-2002  manu branches: 1.1.2;
Introduce BSD system calls with alternate patch checking (in /emul) in
compat/common, so that they can be shared by several emulations, and use
them for Darwin.

This removes the ugly dependance on FreeBSD freebsd_file.c for COMPAT_DARWIN
 1.1.2.2 11-Dec-2002  thorpej Sync with HEAD.
 1.1.2.1 08-Dec-2002  thorpej file compat_file.c was added on branch nathanw_sa on 2002-12-11 06:37:03 +0000
 1.10.2.9 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.10.2.8 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.10.2.7 12-Nov-2004  skrll Adapt to branch.
 1.10.2.6 21-Sep-2004  skrll Fix the sync with head I botched.
 1.10.2.5 18-Sep-2004  skrll Sync with HEAD.
 1.10.2.4 12-Aug-2004  skrll Sync with HEAD.
 1.10.2.3 03-Aug-2004  skrll Sync with HEAD
 1.10.2.2 19-Aug-2003  skrll LWPify
 1.10.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.13.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.13.4.1 29-Apr-2005  kent sync with -current
 1.15.2.5 21-Jan-2008  yamt sync with head
 1.15.2.4 03-Sep-2007  yamt sync with head.
 1.15.2.3 26-Feb-2007  yamt sync with head.
 1.15.2.2 30-Dec-2006  yamt sync with head.
 1.15.2.1 21-Jun-2006  yamt sync with head.
 1.17.8.1 11-Aug-2006  yamt sync with head
 1.17.4.1 09-Sep-2006  rpaulo sync with head
 1.19.4.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.20.2.2 07-May-2007  yamt sync with head.
 1.20.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.21.4.1 11-Jul-2007  mjf Sync with head.
 1.21.2.2 15-Jul-2007  ad Sync with head.
 1.21.2.1 27-May-2007  ad Sync with head.
 1.23.16.1 26-Dec-2007  ad Sync with head.
 1.23.14.1 27-Dec-2007  mjf Sync with HEAD.
 1.23.8.1 23-Mar-2008  matt sync with HEAD
 1.23.6.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.24.4.1 13-Dec-2007  bouyer Sync with HEAD
 1.24.2.1 13-Dec-2007  yamt sync with head.
 1.8 12-Dec-2007  dsl compat_file.[ch] are no longer used
 1.7 30-Apr-2007  dsl branches: 1.7.8; 1.7.14; 1.7.16; 1.7.18; 1.7.20;
Rework compat stat() and statvfs() code so that it no longer uses the stackgap.
 1.6 11-Dec-2005  christos branches: 1.6.26; 1.6.30; 1.6.32;
merge ktrace-lwp.
 1.5 19-Aug-2005  christos 64 bit inode changes.
 1.4 24-Jul-2004  manu branches: 1.4.12;
Add a wrapper for connect that check an alternate path in emulation tree
for AF_LOCAL sockets.
 1.3 05-Jun-2003  manu branches: 1.3.2;
Search alternate /emul/* path for AF_LOCAL sockets at bind() time.
 1.2 22-Jan-2003  christos lwp'ify
 1.1 08-Dec-2002  manu branches: 1.1.2;
Introduce BSD system calls with alternate patch checking (in /emul) in
compat/common, so that they can be shared by several emulations, and use
them for Darwin.

This removes the ugly dependance on FreeBSD freebsd_file.c for COMPAT_DARWIN
 1.1.2.2 11-Dec-2002  thorpej Sync with HEAD.
 1.1.2.1 08-Dec-2002  thorpej file compat_file.h was added on branch nathanw_sa on 2002-12-11 06:37:03 +0000
 1.3.2.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.3.2.1 03-Aug-2004  skrll Sync with HEAD
 1.4.12.3 21-Jan-2008  yamt sync with head
 1.4.12.2 03-Sep-2007  yamt sync with head.
 1.4.12.1 21-Jun-2006  yamt sync with head.
 1.6.32.1 11-Jul-2007  mjf Sync with head.
 1.6.30.1 27-May-2007  ad Sync with head.
 1.6.26.1 07-May-2007  yamt sync with head.
 1.7.20.1 13-Dec-2007  bouyer Sync with HEAD
 1.7.18.1 13-Dec-2007  yamt sync with head.
 1.7.16.1 26-Dec-2007  ad Sync with head.
 1.7.14.1 27-Dec-2007  mjf Sync with HEAD.
 1.7.8.1 23-Mar-2008  matt sync with HEAD
 1.31 01-Jan-2020  pgoyette Emove vestigial remains of the monolithic compat module.
 1.30 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.29 04-May-2018  pgoyette branches: 1.29.2;
Clean up a stray #ifdef _MODULE - it prevented definition of
COMPAT_SIGCONTEXT which in turn prevented building of the
SYS_compat16_sigaction_14 code.

Should address PR kern/53260

XXX Pull-up to netbsd-8
 1.28 12-Apr-2018  christos provide vectors for the ifconf compat code and ifdatareq compat code.
 1.27 18-Mar-2018  christos factor out the ccd COMPAT_60 code.
 1.26 17-Mar-2018  christos redo the cpu ucode compat code.
 1.25 15-Mar-2018  christos add uvm swap compat code.
 1.24 05-Nov-2016  pgoyette branches: 1.24.8; 1.24.14;
Move if_43.c back into the shared Makefile.sysio where it really
belongs.

Update the code to invoke the two routines compat_cvtcmd() and
compat_ifioctl() through indirect pointers. Initialize those
pointers in sys/net/if.c and update them in the compat module's
initialization code.

Addresses the issue pointed out in PR kern/51598
 1.23 05-Dec-2015  pgoyette branches: 1.23.2;
The COMPAT_10 code for SYSVxxx is now part of the sysv_ipc module, so
don't install syscall function pointers from the compat module.
 1.22 11-May-2015  pgoyette Fix the #ifdef _MODULE stuff so that the syscall packages and sysctl stuff
gets handled properly even in built-in module case.

XXX
Whatever was I thinking when I put those conditionals in? And wouldn't it
be a wonderful thing to have some atf regression tests to actually catch
errors in the compat{,_sysv} modules? :)
 1.21 10-May-2015  pgoyette Split the SYSV* compat code out into a separate compat_sysv module.

For monolithic kernels, both modules will be compiled as "built-ins",
while modular environments will be able to load the SYSVSEM, SYSVSHM,
and SYSVMSG code independant from the rest of compat.

This is a necessary precursor step to making the "STD" SYSV* code
into a separate module.

Tested in both monolithic and modular environments with no errors
seen.
 1.20 19-Sep-2013  christos branches: 1.20.6;
exec modules need to be of the exec kind
 1.19 29-Mar-2013  christos branches: 1.19.4;
compat glue for new lwp_park()
 1.18 21-Feb-2013  christos remove empty #if
 1.17 21-Feb-2013  skrll Wrap sysctl_teardown(&compat_clog) with the appropriate #if defined()s
 1.16 21-Feb-2013  pgoyette Move boottime50 and its associated sysctl into the compat module. As
noted on tech-kern. Should fix PR/47579.

OK christos@

Will request pull-up to 6.0 in a few days.
 1.15 22-Jan-2013  christos Simplify the ifdef mess. No functional context.
 1.14 08-Aug-2011  jakllsch branches: 1.14.2; 1.14.8; 1.14.12;
COMPAT_16 code only exists on amd64 in the presence of COMPAT_NETBSD32.
 1.13 06-Mar-2011  bouyer merge the bouyer-quota2 branch. This adds a new on-disk format
to store disk quota usage and limits, integrated with ffs
metadata. Usage is checked by fsck_ffs (no more quotacheck)
and is covered by the WAPBL journal. Enabled with kernel
option QUOTA2 (added where QUOTA was enabled in kernel config files),
turned on with tunefs(8) on a per-filesystem
basis. mount_mfs(8) can also turn quotas on.

See http://mail-index.netbsd.org/tech-kern/2011/02/19/msg010025.html
for details.
 1.12 19-Jan-2011  tsutsui branches: 1.12.2;
Remove includes <sys/mount.h> and <sys/sched.h> added for <sys/syscallargs.h>.
Now they are handled by $sysarghdrextra in sys/kern/syscalls.conf.
 1.11 05-Mar-2010  pooka branches: 1.11.2; 1.11.4;
Reset sendsig_sigcontext_vec at fini to avoid having it point at
garbage and to allow re-init of the module (if DIAGNOSTIC).
 1.10 21-Dec-2009  njoly branches: 1.10.2;
Remove SYS_compat_50_mq_timedreceive/SYS_compat_50_mq_timedsend
duplicate entries.

Fix a KASSERT when unloading the compat kernel module.
 1.9 22-Nov-2009  mbalmer more s/the the/the/
 1.8 19-Jul-2009  rmind - Use #ifdef AIO, instead of #ifdef notyet. Not a solution, but at
least gets it working for MONOLITHIC kernel.
- Similarily add #ifdef MQUEUE for mqueue compat.
- Amend TNF license to be 2-clause. Approved by <christos>.
 1.7 13-Jan-2009  martin branches: 1.7.2; 1.7.4; 1.7.6; 1.7.8;
Add a few missing includes, so the ifdefs work as expected.
 1.6 11-Jan-2009  christos fix lutimes.
 1.5 11-Jan-2009  christos merge christos-time_t
 1.4 19-Nov-2008  cegger branches: 1.4.2; 1.4.6;
make this compile (for next68k)
 1.3 19-Nov-2008  ad Additionally, set emul_netbsd_object=NULL after detaching it.
 1.2 19-Nov-2008  ad compat_modcmd: emul_netbsd_object will be NULL if no exec has taken place
between load and unload of the compat module.
 1.1 19-Nov-2008  ad Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.4.6.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.4.6.1 19-Nov-2008  haad file compat_mod.c was added on branch haad-dm on 2008-12-13 01:13:47 +0000
 1.4.2.2 27-Nov-2008  christos add more 50 compat syscalls.
 1.4.2.1 19-Nov-2008  christos file compat_mod.c was added on branch christos-time_t on 2008-11-27 21:32:02 +0000
 1.7.8.4 11-Mar-2010  yamt sync with head
 1.7.8.3 19-Aug-2009  yamt sync with head.
 1.7.8.2 04-May-2009  yamt sync with head.
 1.7.8.1 13-Jan-2009  yamt file compat_mod.c was added on branch yamt-nfs-mp on 2009-05-04 08:12:17 +0000
 1.7.6.1 23-Jul-2009  jym Sync with HEAD.
 1.7.4.2 19-Jan-2009  skrll Sync with HEAD.
 1.7.4.1 13-Jan-2009  skrll file compat_mod.c was added on branch nick-hppapmap on 2009-01-19 13:17:17 +0000
 1.7.2.2 17-Jan-2009  mjf Sync with HEAD.
 1.7.2.1 13-Jan-2009  mjf file compat_mod.c was added on branch mjf-devfs2 on 2009-01-17 13:28:41 +0000
 1.10.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.11.4.1 06-Jun-2011  jruoho Sync with HEAD.
 1.11.2.2 21-Apr-2011  rmind sync with head
 1.11.2.1 05-Mar-2011  rmind sync with head
 1.12.2.1 15-Feb-2011  bouyer Implement COMPAT_50 quotactl(2)
 1.14.12.4 03-Dec-2017  jdolecek update from HEAD
 1.14.12.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.14.12.2 23-Jun-2013  tls resync from head
 1.14.12.1 25-Feb-2013  tls resync with head
 1.14.8.1 14-Mar-2013  riz Pull up following revision(s) (requested by pgoyette in ticket #837):
sys/compat/common/kern_time_50.c: revision 1.25
sys/kern/init_sysctl.c: revision 1.195
sys/kern/init_main.c: revision 1.447
sys/compat/common/compat_util.h: revision 1.23
sys/compat/common/compat_mod.h: revision 1.1
sys/compat/common/compat_mod.c: revision 1.16
sys/compat/common/compat_mod.c: revision 1.17
sys/compat/common/compat_mod.c: revision 1.18
sys/compat/common/vfs_syscalls_43.c: revision 1.55
Move boottime50 and its associated sysctl into the compat module. As
noted on tech-kern. Should fix PR/47579.
OK christos@
Will request pull-up to 6.0 in a few days.
Wrap sysctl_teardown(&compat_clog) with the appropriate #if defined()s
remove empty #if
 1.14.2.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.14.2.1 23-Jan-2013  yamt sync with head
 1.19.4.1 18-May-2014  rmind sync with head
 1.20.6.3 05-Dec-2016  skrll Sync with HEAD
 1.20.6.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.20.6.1 06-Jun-2015  skrll Sync with HEAD
 1.23.2.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.24.14.37 07-Sep-2018  pgoyette At the request of reviewers, remove the module alias functionality.

We will rely only on module names and duplicate-symbol detection to
detect module conflicts.
 1.24.14.36 21-May-2018  pgoyette Sync with HEAD
 1.24.14.35 17-Apr-2018  pgoyette Ooops - forgot to enable the last couple of alias module names.
 1.24.14.34 17-Apr-2018  pgoyette Finish separating the compat_09 and compat_43 stuff
 1.24.14.33 17-Apr-2018  pgoyette First pass at compat modules for 4.3BSD, NetBSD-0.9, and NetBSD-1.0

XXX Still need to deal with the sysctl stuff and other code shared
XXX between 09 and 43
 1.24.14.32 16-Apr-2018  pgoyette Sync with HEAD, resolve some conflicts
 1.24.14.31 31-Mar-2018  pgoyette Add compat_12 to the alias list, and add compat_80 entry points to the
init-fini list.
 1.24.14.30 31-Mar-2018  pgoyette create the compat_12 module
 1.24.14.29 30-Mar-2018  pgoyette Update list of modules which are included in the monolithic compat_netbsd
module.
 1.24.14.28 30-Mar-2018  pgoyette Add compat_13 module
 1.24.14.27 30-Mar-2018  pgoyette Extract compat_14 stuff into its own module
 1.24.14.26 30-Mar-2018  pgoyette Create and build a compat_16 module
 1.24.14.25 30-Mar-2018  pgoyette Add compat_20 to the list of aliases
 1.24.14.24 30-Mar-2018  pgoyette Create and build the compat_20 module
 1.24.14.23 29-Mar-2018  pgoyette Split out the usb compat_30 code and add it to the module
 1.24.14.22 28-Mar-2018  pgoyette Initial pass at a compat_30 module.

Still needs some work for dev/vnd and various dev/usb/*
 1.24.14.21 27-Mar-2018  pgoyette Create a compat_40 module
 1.24.14.20 25-Mar-2018  pgoyette Now that we have a compat_80 module, make sure it is marked as "included"
in the monolithic compat module
 1.24.14.19 22-Mar-2018  pgoyette Synch with HEAD, resolve conflicts
 1.24.14.18 20-Mar-2018  pgoyette Prep for additional version-specific compat modules; commented out for now.
 1.24.14.17 19-Mar-2018  pgoyette Initial pass at a COMPAT_50 module. More to come.
 1.24.14.16 18-Mar-2018  pgoyette Initial pass at getting the tty stuff properly modularized. Subject
to review and revision.
 1.24.14.15 18-Mar-2018  pgoyette Move closer to a complete compat_60 module. All that remains is some
tty stuff and some ccd ioctl()s.
 1.24.14.14 17-Mar-2018  pgoyette Import christos's changes for the compat_60 cpu_ucode stuff
 1.24.14.13 16-Mar-2018  pgoyette Move closer to getting a compat_60 module - still needs more work
 1.24.14.12 16-Mar-2018  pgoyette Initial pass at setting up the compat_60 module.

XXX needs some work to properly handle cpu_ucode stuff.

While here, move details of compat_70 init/fini routines into the
module itself.
 1.24.14.11 15-Mar-2018  pgoyette Update alias list for included modules for compat_60
 1.24.14.10 15-Mar-2018  pgoyette The big all-inclusive compat module still needs to initialize the
compat_70 stuff.
 1.24.14.9 15-Mar-2018  pgoyette Add alias module name 'compat_70' since the full compat module includes
the entire compat_70 module.
 1.24.14.8 15-Mar-2018  pgoyette Resolve conflicts from sync-with-HEAD
 1.24.14.7 15-Mar-2018  pgoyette Synch with HEAD
 1.24.14.6 14-Mar-2018  pgoyette Make do_openat()'s handling of path=NULL modular
 1.24.14.5 13-Mar-2018  pgoyette Move the swapstats compat code into the compat_netbsd module.

Without this, a kernel configured without COMPAT_13 and/or COMPAT_50
could not execute the compat swapstats code, even if the compat_netbsd
module had been loaded.
 1.24.14.4 08-Mar-2018  pgoyette Include if.h to get IFNAMSIZE
 1.24.14.3 08-Mar-2018  pgoyette Implement vector initialization for ifreqo2n and ifdatareq
 1.24.14.2 06-Mar-2018  pgoyette Use a .h file for declaring the if_40_{init, fini} routines
 1.24.14.1 06-Mar-2018  pgoyette Untangle some networking compat code so we can build a kernel with
networking and MODULAR, but without any actual COMPAT_* code (ie,
assuming that all the compat stuff can be added later via modules).
 1.24.8.1 06-May-2018  martin Pull up following revision(s) (requested by pgoyette in ticket #807):

sys/compat/common/compat_mod.c: revision 1.29

Clean up a stray #ifdef _MODULE - it prevented definition of
COMPAT_SIGCONTEXT which in turn prevented building of the
SYS_compat16_sigaction_14 code.

Should address PR kern/53260

XXX Pull-up to netbsd-8
 1.29.2.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.29.2.1 10-Jun-2019  christos Sync with HEAD
 1.12 20-May-2024  christos Rename dup3110 to dup3100 to match historical practice for NetBSD-11,
because we already have kevent100. Fix compat_dup3 to belong in compat_100
not compat_110.
 1.11 19-May-2024  christos version dup3
 1.10 09-Dec-2023  pgoyette Modularize the COMPAT_90 code that resulted from the removal of
netinet6/nd6 from the kernel. Now, the minimal compat code can
be successfully loaded and unloaded along with the rest of the
COMPAT_90 code.

XXX pullup-10 - hopefully before RC2
 1.9 18-Aug-2023  christos Add linux waitid(2) from GSoC 2023 (Theodore Preduta)
 1.8 28-Jul-2023  christos Add epoll(2) from Theodore Preduta as part of GSoC 2023
 1.7 19-Dec-2022  pgoyette Create compat_100 module infrastructure now that we have branched
for NetBSD-10
 1.6 22-Sep-2019  christos branches: 1.6.26;
Add a new member to struct vfsstat and grow the unused members
The new member is caled f_mntfromlabel and it is the dkw_wname
of the corresponding wedge. This is now used by df -W to display
the mountpoint name as NAME=
 1.5 17-May-2019  msaitoh The max subtype of the ifmedia word is 31. It's too small for Ethernet now.
We currently use use it up to 30. We should extend the limit to be able to use
more than 10Gbps speeds. Our ifmedia(4) is inconvenience and have some problem
so we should redesign the interface, but it's too late for netbsd-9 to do it.
So, we keep the data structure size and modify the structure a bit. The
strategy is almost the same as FreeBSD. Many bits of IFM_OMASK for Ethernet
have not used, so use some of them for Ethernet's subtype.

The differences against FreeBSD are:
- We use NetBSD style compat code (i.e. no SIOCGIFXMEDIA).
- FreeBSD's IFM_ETH_XTYPE's bit location is from 11 to "14" even though
IFM_OMASK is from 8 to "15". We use _IFM_ETH_XTMASK from bit 13 to "15".
- FreeBSD changed the meaning of IFM_TYPE_MATCH(). I think we should
not do it. We keep it not changing and added new IFM_TYPE_SUBTYPE_MATCH()
macro for matching both TYPE and SUBTYPE.
- Added up to 400GBASE-SR16.

New layout of the media word is as follows (from ifmedia_h):

* if_media Options word:
* Bits Use
* ---- -------
* 0-4 Media subtype MAX SUBTYPE == 255 for ETH and 31 for others
* 5-7 Media type
* 8-15 Type specific options
* 16-18 Mode (for multi-mode devices)
* 19 (Reserved for Future Use)
* 20-27 Shared (global) options
* 28-31 Instance
*
* 3 2 1
* 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
* +-------+---------------+-+-----+---------------+-----+---------+
* | | |R| | | | |
* | IMASK | GMASK |F|MMASK+-----+ OMASK |NMASK| TMASK |
* | | |U| |XTMSK| | | |
* +-------+---------------+-+-----+-----+---------+-----+---------+
* <-----> <---> <--->
* IFM_INST() IFM_MODE() IFM_TYPE()
*
* IFM_SUBTYPE(other than ETH)<------->
*
* <---> IFM_SUBTYPE(ETH)<------->
*
*
* <-------------> <------------->
* IFM_OPTIONS()
 1.4 15-Apr-2019  pgoyette Split the COMPAT_50 socket-timeout stuff out of kern/uipc_socket.c
and into its own source file, which is now included in the compat_50
module.

(Not sure how this got missed during the original [pgoyette-compat] work)
 1.3 28-Jan-2019  christos - provide a hook for the 43 tty ioctls
- make the 60 tty ioctl hook look the same
- fix the tty code to call both hooks and remove unused lock
 1.2 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.1 21-Feb-2013  pgoyette branches: 1.1.4; 1.1.6; 1.1.16; 1.1.42; 1.1.44;
Move boottime50 and its associated sysctl into the compat module. As
noted on tech-kern. Should fix PR/47579.

OK christos@

Will request pull-up to 6.0 in a few days.
 1.1.44.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.1.44.1 10-Jun-2019  christos Sync with HEAD
 1.1.42.24 11-Jan-2019  pgoyette Rework the various sysctl-related routines to call the correct code
for each version. While here, extract the 5.0 specific code instead
of including in the main rtsock.c code.

Also, clean up all the sysctl-related routines to prevent building
more than one copy, no matter how many places rtsock.c gets #include'd
into!
 1.1.42.23 12-Oct-2018  pgoyette Use a MP-safe hook for the rnd_ioctl compat_50 calls.
 1.1.42.22 19-Sep-2018  pgoyette Split out the vnd COMPAT_50 code
 1.1.42.21 17-Apr-2018  pgoyette Finish separating the compat_09 and compat_43 stuff
 1.1.42.20 17-Apr-2018  pgoyette First pass at compat modules for 4.3BSD, NetBSD-0.9, and NetBSD-1.0

XXX Still need to deal with the sysctl stuff and other code shared
XXX between 09 and 43
 1.1.42.19 16-Apr-2018  pgoyette Rename if_[45]0_{init,fini} entry points to more appropriate and more
consistent uipc_syscalls_[45]0_{init,fini} and remove some multiple
declarations.
 1.1.42.18 03-Apr-2018  pgoyette Remove fixed allocation of modules' "required" lists (previously
limited to MAXMODDEPS entries). Update the modctl(MODCTL_STAT)
syscall to return the required data in a new format, and retain
the previous data format in MODCTL_OSTAT. Update the compat_80
and compat_netbsd32 modules as needed.
 1.1.42.17 31-Mar-2018  pgoyette create the compat_12 module
 1.1.42.16 30-Mar-2018  pgoyette Add compat_13 module
 1.1.42.15 30-Mar-2018  pgoyette Extract compat_14 stuff into its own module
 1.1.42.14 30-Mar-2018  pgoyette Create and build a compat_16 module
 1.1.42.13 30-Mar-2018  pgoyette Create and build the compat_20 module
 1.1.42.12 29-Mar-2018  pgoyette Split out the usb compat_30 code and add it to the module
 1.1.42.11 28-Mar-2018  pgoyette Split vnd compat_30 code out of the main driver and into the compat_30
module
 1.1.42.10 28-Mar-2018  pgoyette Initial pass at a compat_30 module.

Still needs some work for dev/vnd and various dev/usb/*
 1.1.42.9 27-Mar-2018  pgoyette Create a compat_40 module
 1.1.42.8 23-Mar-2018  pgoyette For now, the compat_80 module is empty.
 1.1.42.7 19-Mar-2018  pgoyette Initial pass at a COMPAT_50 module. More to come.
 1.1.42.6 18-Mar-2018  pgoyette Merge changes from HEAD into ccd_60.c

For all of the individual xxx_60_{init,fini} routines, don't force
them to artificially return a status; just make them void. This
simplifies the compat_60_{init,fini} handling of errors that remain.
 1.1.42.5 18-Mar-2018  pgoyette Clean-up for kern_cpu_60 code.

Also, although not strictly necessary, include the kern_sa_60 stuff in
the compat_60 module, for completeness.

Still need to deal with some tty code and the ccd driver to finish off
the compat_60 module.
 1.1.42.4 18-Mar-2018  pgoyette Move closer to a complete compat_60 module. All that remains is some
tty stuff and some ccd ioctl()s.
 1.1.42.3 17-Mar-2018  pgoyette Make all the compat_xx_{init,fini} routines return an int, whether or
not they currently need it.
 1.1.42.2 16-Mar-2018  pgoyette Move closer to getting a compat_60 module - still needs more work
 1.1.42.1 16-Mar-2018  pgoyette Initial pass at setting up the compat_60 module.

XXX needs some work to properly handle cpu_ucode stuff.

While here, move details of compat_70 init/fini routines into the
module itself.
 1.1.16.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.1.16.1 21-Feb-2013  yamt file compat_mod.h was added on branch yamt-pagecache on 2014-05-22 11:40:15 +0000
 1.1.6.2 14-Mar-2013  riz Pull up following revision(s) (requested by pgoyette in ticket #837):
sys/compat/common/kern_time_50.c: revision 1.25
sys/kern/init_sysctl.c: revision 1.195
sys/kern/init_main.c: revision 1.447
sys/compat/common/compat_util.h: revision 1.23
sys/compat/common/compat_mod.h: revision 1.1
sys/compat/common/compat_mod.c: revision 1.16
sys/compat/common/compat_mod.c: revision 1.17
sys/compat/common/compat_mod.c: revision 1.18
sys/compat/common/vfs_syscalls_43.c: revision 1.55
Move boottime50 and its associated sysctl into the compat module. As
noted on tech-kern. Should fix PR/47579.
OK christos@
Will request pull-up to 6.0 in a few days.
Wrap sysctl_teardown(&compat_clog) with the appropriate #if defined()s
remove empty #if
 1.1.6.1 21-Feb-2013  riz file compat_mod.h was added on branch netbsd-6 on 2013-03-14 16:33:09 +0000
 1.1.4.2 25-Feb-2013  tls resync with head
 1.1.4.1 21-Feb-2013  tls file compat_mod.h was added on branch tls-maxphys on 2013-02-25 00:29:07 +0000
 1.6.26.1 10-Dec-2023  martin Pull up following revision(s) (requested by pgoyette in ticket #487):

sys/compat/common/compat_90_mod.c: revision 1.5
sys/compat/common/compat_90_mod.c: revision 1.6
sys/netinet6/in6.c: revision 1.290
sys/netinet6/in6.c: revision 1.291
sys/compat/common/files.common: revision 1.11
sys/netinet6/icmp6.c: revision 1.255
sys/compat/common/net_inet6_nd_90.c: revision 1.1
sys/compat/common/net_inet6_nd_90.c: revision 1.2
sys/modules/compat_90/Makefile: revision 1.2
sys/modules/compat_90/Makefile: revision 1.3
sys/netinet6/nd6.c: revision 1.281
sys/compat/common/compat_mod.h: revision 1.10
sys/kern/compat_stub.c: revision 1.23
sys/sys/compat_stub.h: revision 1.27

Identify the need to rework the COMPAT_* code to be more
module-aware.
This is an XXX comment block only, NFCI.

Modularize the COMPAT_90 code that resulted from the removal of
netinet6/nd6 from the kernel. Now, the minimal compat code can
be successfully loaded and unloaded along with the rest of the
COMPAT_90 code.

Allow kernels builds which don't define INET6 to compile compat bits
too.

Default the build of compat_90 module to include IPv6, as is done
for other INET6-sensitive modules (see if_lagg).
 1.1 22-Sep-2018  pgoyette branches: 1.1.2;
file compat_raid_50.c was initially added on branch pgoyette-compat.
 1.1.2.3 24-Jan-2019  pgoyette The raidframe compat code lives in sys/dev/raidframe/ so move all the
module stuff there. Update the Makefiles appropriately.
 1.1.2.2 23-Jan-2019  pgoyette Add compat_raid_80 to the required list
 1.1.2.1 22-Sep-2018  pgoyette Split the raidframe compatability code out into separate modules, since
the driver is already a module. This avoids having to pass a bunch of
function pointers as arguments to raidframe's compat_ioctl().
 1.1 22-Sep-2018  pgoyette branches: 1.1.2;
file compat_raid_80.c was initially added on branch pgoyette-compat.
 1.1.2.2 24-Jan-2019  pgoyette The raidframe compat code lives in sys/dev/raidframe/ so move all the
module stuff there. Update the Makefiles appropriately.
 1.1.2.1 22-Sep-2018  pgoyette Split the raidframe compatability code out into separate modules, since
the driver is already a module. This avoids having to pass a bunch of
function pointers as arguments to raidframe's compat_ioctl().
 1.4 01-Nov-2021  thorpej Use "stack_t" instead of "struct sigaltstack", as the former is the
newer standardized name. NFC.
 1.3 05-Jun-2011  dsl Use 'curlwp' here insteald of the 'l' - which isn't passsed as an arg
to the #define, but will always be curlwp.
 1.2 16-Jun-2007  dsl branches: 1.2.2; 1.2.12; 1.2.60; 1.2.66; 1.2.70;
Modify the (recently added) compat_sigaltstack() #define to take the
values of the SS_ONSTACK and SS_DISABLE constants.
Use it to shorten the source files when this action is replicated.
Actually, given the monstrous complexity of sigaltstack1() there is
probably a much better way to do this...
 1.1 03-Jun-2007  dsl branches: 1.1.2;
Add a #define that expands to the compat wrapper for sigaltstack1().
Use it for the netbsd32_compat_13.c version of the code.
 1.1.2.5 15-Jul-2007  ad Sync with head.
 1.1.2.4 15-Jul-2007  ad Sync with head.
 1.1.2.3 09-Jun-2007  ad Sync with head.
 1.1.2.2 09-Jun-2007  ad Sync with head.
 1.1.2.1 03-Jun-2007  ad file compat_sigaltstack.h was added on branch vmlocking on 2007-06-09 21:37:07 +0000
 1.2.70.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.2.66.1 06-Jun-2011  jruoho Sync with HEAD.
 1.2.60.1 12-Jun-2011  rmind sync with head
 1.2.12.2 03-Sep-2007  yamt sync with head.
 1.2.12.1 16-Jun-2007  yamt file compat_sigaltstack.h was added on branch yamt-lazymbuf on 2007-09-03 14:31:49 +0000
 1.2.2.2 11-Jul-2007  mjf Sync with head.
 1.2.2.1 16-Jun-2007  mjf file compat_sigaltstack.h was added on branch mjf-ufs-trans on 2007-07-11 20:03:46 +0000
 1.6 26-Mar-2020  pgoyette When using SYSCTL_SETUP there is no guarantee of the order in which
the set-up functions will be called, so it is perfectly acceptable
for a compat code's routine to be called ahead of the code in other
parts of the kernel.

So make sure that the 2nd level sysctl node ``vfs.generic'' exists
before trying to add the 3rd level entries.

XXX Rather than creating the 2nd level node in two places, we could
XXX add the shared ``vfs.generic'' node to sysctl_init_base.c but
XXX this is left for another day.
 1.5 27-Feb-2020  pgoyette Ooppss - SYSCTL_SETUP() functions return void.
 1.4 27-Feb-2020  pgoyette Remove explicit calls to the sysctl setup routines, since this is now
handled by the module infrastructure.
 1.3 06-Dec-2019  maxv branches: 1.3.2;
Fix a bunch of unimportant "Local variable hides global variable" warnings
from the LGTM bot.
 1.2 27-Jan-2019  pgoyette branches: 1.2.4;
Merge the [pgoyette-compat] branch
 1.1 17-Apr-2018  pgoyette branches: 1.1.2;
file compat_sysctl_09_43.c was initially added on branch pgoyette-compat.
 1.1.2.2 10-Sep-2018  pgoyette Remove the monolithic compat and compat_sysv modules. Now that we
don't have aliases, we need to use only the version-specific module
names when resolving dependencies.
 1.1.2.1 17-Apr-2018  pgoyette Finish separating the compat_09 and compat_43 stuff
 1.2.4.3 08-Apr-2020  martin Merge changes from current as of 20200406
 1.2.4.2 10-Jun-2019  christos Sync with HEAD
 1.2.4.1 27-Jan-2019  christos file compat_sysctl_09_43.c was added on branch phil-wifi on 2019-06-10 22:06:58 +0000
 1.3.2.1 29-Feb-2020  ad Sync with head.
 1.2 27-Jan-2019  pgoyette branches: 1.2.4;
Merge the [pgoyette-compat] branch
 1.1 17-Apr-2018  pgoyette branches: 1.1.2;
file compat_sysv_10_mod.c was initially added on branch pgoyette-compat.
 1.1.2.2 13-Sep-2018  pgoyette Fix some module requirements
 1.1.2.1 17-Apr-2018  pgoyette Split the compat_sysv module into several version-specific modules,
similar to the compat module.
 1.2.4.2 10-Jun-2019  christos Sync with HEAD
 1.2.4.1 27-Jan-2019  christos file compat_sysv_10_mod.c was added on branch phil-wifi on 2019-06-10 22:06:58 +0000
 1.2 27-Jan-2019  pgoyette branches: 1.2.4;
Merge the [pgoyette-compat] branch
 1.1 17-Apr-2018  pgoyette branches: 1.1.2;
file compat_sysv_14_mod.c was initially added on branch pgoyette-compat.
 1.1.2.2 13-Sep-2018  pgoyette Fix some module requirements
 1.1.2.1 17-Apr-2018  pgoyette Split the compat_sysv module into several version-specific modules,
similar to the compat module.
 1.2.4.2 10-Jun-2019  christos Sync with HEAD
 1.2.4.1 27-Jan-2019  christos file compat_sysv_14_mod.c was added on branch phil-wifi on 2019-06-10 22:06:58 +0000
 1.5 12-Dec-2019  pgoyette Rather than keeping a separate mutex, condvar, and pserialize for each
module hook, we can share a common set of synchronization structures.
This cuts the amount of cacheline_aligned data for these structures by
50%.

Note that we still have a per-hook localcount, since we need to count
individual references.

As discussed with riastradh@

Welcome to 9.99.22 !
 1.4 01-Mar-2019  pgoyette branches: 1.4.4;
Rename the MODULE_*_HOOK() macros to MODULE_HOOK_*() as briefly
discussed on irc.

NFCI intended.

Ride the earlier kernel bump - it;s getting crowded.
 1.3 29-Jan-2019  pgoyette Normalize all the compat hooks' names to the form

<subsystem>_<function>_<version>_hook

NFCI

XXX Note that although this introduces a change in the kernel-to-
XXX module interface, we are NOT bumping the kernel version number.
XXX We will bump the version number once the interface stabilizes.
 1.2 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.1 17-Apr-2018  pgoyette branches: 1.1.2;
file compat_sysv_50_mod.c was initially added on branch pgoyette-compat.
 1.1.2.3 23-Jan-2019  pgoyette Convert the macros for setting and unsetting a hook to generate
in-line code rather than using an intermediary hook##set routine.
Hooks are set and unset only in one place, so the intermediary
routine provides no benefit. IMHO using the macro at the point-
of-call is more readable than using it elsewhere in the code and
then calling the generated intermediary routine (for which you
won't even find its declaration or definition unless you remember
to search for the HOOK_SET macro instead).

NFC intended, will verify with a bulk build and an atf test run.
 1.1.2.2 15-Oct-2018  pgoyette Convert the final non-MP-safe "vectored" compat routine to use the
MP-safe mechanism.
 1.1.2.1 17-Apr-2018  pgoyette Split the compat_sysv module into several version-specific modules,
similar to the compat module.
 1.4.4.3 08-Apr-2020  martin Merge changes from current as of 20200406
 1.4.4.2 10-Jun-2019  christos Sync with HEAD
 1.4.4.1 01-Mar-2019  christos file compat_sysv_50_mod.c was added on branch phil-wifi on 2019-06-10 22:06:58 +0000
 1.4 03-Dec-2015  pgoyette branches: 1.4.10;
Merge the compat_sysv module into the sysv_ipc module - it should
never have been a separate module in the first place (my bad).

Adjust dependencies as appropriate.
 1.3 13-May-2015  pgoyette branches: 1.3.2;
The compat_sysv module now depends on sysv_ipc module.
 1.2 11-May-2015  pgoyette Fix the #ifdef _MODULE stuff so that the syscall packages and sysctl stuff
gets handled properly even in built-in module case.

XXX
Whatever was I thinking when I put those conditionals in? And wouldn't it
be a wonderful thing to have some atf regression tests to actually catch
errors in the compat{,_sysv} modules? :)
 1.1 10-May-2015  pgoyette Split the SYSV* compat code out into a separate compat_sysv module.

For monolithic kernels, both modules will be compiled as "built-ins",
while modular environments will be able to load the SYSVSEM, SYSVSHM,
and SYSVMSG code independant from the rest of compat.

This is a necessary precursor step to making the "STD" SYSV* code
into a separate module.

Tested in both monolithic and modular environments with no errors
seen.
 1.3.2.3 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.3.2.2 06-Jun-2015  skrll Sync with HEAD
 1.3.2.1 13-May-2015  skrll file compat_sysv_mod.c was added on branch nick-nhusb on 2015-06-06 14:40:05 +0000
 1.4.10.5 12-Sep-2018  pgoyette Complete removal of the "monolithic" all-version compat_sysvipc module
 1.4.10.4 07-Sep-2018  pgoyette At the request of reviewers, remove the module alias functionality.

We will rely only on module names and duplicate-symbol detection to
detect module conflicts.
 1.4.10.3 04-Sep-2018  pgoyette Use correct module names for the aliases.
 1.4.10.2 17-Apr-2018  pgoyette Split the compat_sysv module into several version-specific modules,
similar to the compat module.
 1.4.10.1 17-Apr-2018  pgoyette Rename sysv_mod.[ch] to compat_sysv_mod.[ch] for consistency with other
files that provide module(7) interfaces.
 1.2 27-Jan-2019  pgoyette branches: 1.2.4;
Merge the [pgoyette-compat] branch
 1.1 17-Apr-2018  pgoyette branches: 1.1.2;
file compat_sysv_mod.h was initially added on branch pgoyette-compat.
 1.1.2.2 15-Oct-2018  pgoyette Convert the final non-MP-safe "vectored" compat routine to use the
MP-safe mechanism.
 1.1.2.1 17-Apr-2018  pgoyette Rename sysv_mod.[ch] to compat_sysv_mod.[ch] for consistency with other
files that provide module(7) interfaces.
 1.2.4.2 10-Jun-2019  christos Sync with HEAD
 1.2.4.1 27-Jan-2019  christos file compat_sysv_mod.h was added on branch phil-wifi on 2019-06-10 22:06:58 +0000
 1.2 02-Feb-1996  christos Renamed compat_tty.c to tty_43.c and updated with the newest copy from
kern/tty_compat.c
 1.1 24-Jun-1995  christos - Extracted all compat routines from the kern directory and moved here.
- Created compat_util.c and compat_util.h to be used by the compatibility
modules, so they don't duplicate the same code.
- Added prototypes to the stackgap allocation routines.
 1.47 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.46 09-Nov-2014  maxv branches: 1.46.18; 1.46.20;
Do not uselessly include <sys/malloc.h>.
 1.45 17-Dec-2013  martin branches: 1.45.4;
Free pathbuf in an error path.
From Maxime Villard.
 1.44 19-Nov-2010  dholland branches: 1.44.8; 1.44.14; 1.44.18; 1.44.20; 1.44.22; 1.44.28;
Introduce struct pathbuf. This is an abstraction to hold a pathname
and the metadata required to interpret it. Callers of namei must now
create a pathbuf and pass it to NDINIT (instead of a string and a
uio_seg), then destroy the pathbuf after the namei session is
complete.

Update all namei call sites accordingly. Add a pathbuf(9) man page and
update namei(9).

The pathbuf interface also now appears in a couple of related
additional places that were passing string/uio_seg pairs that were
later fed into NDINIT. Update other call sites accordingly.
 1.43 14-Dec-2009  mrg branches: 1.43.4;
replace mips:elf_check_itp() and ELFNAME2(netbsd32,probe_noteless) that
it's based upon with a common compat_elf_check_interp().

tested on MALTA64 and sparc64.
 1.42 29-Jun-2009  dholland Convert 67 namei call sites to use namei_simple, in these functions:

check_console, veriexecclose, veriexec_delete, veriexec_file_add,
emul_find_root, coff_load_shlib (sh3 version), coff_load_shlib,
compat_20_sys_statfs, compat_20_netbsd32_statfs,
ELFNAME2(netbsd32,probe_noteless), darwin_sys_statfs,
ibcs2_sys_statfs, ibcs2_sys_statvfs, linux_sys_uselib,
osf1_sys_statfs, sunos_sys_statfs, sunos32_sys_statfs,
ultrix_sys_statfs, do_sys_mount, fss_create_files (3 of 4),
adosfs_mount, cd9660_mount, coda_ioctl, coda_mount, ext2fs_mount,
ffs_mount, filecore_mount, hfs_mount, lfs_mount, msdosfs_mount,
ntfs_mount, sysvbfs_mount, udf_mount, union_mount, sys_chflags,
sys_lchflags, sys_chmod, sys_lchmod, sys_chown, sys_lchown,
sys___posix_chown, sys___posix_lchown, sys_link, do_sys_pstatvfs,
sys_quotactl, sys_revoke, sys_truncate, do_sys_utimes, sys_extattrctl,
sys_extattr_set_file, sys_extattr_set_link, sys_extattr_get_file,
sys_extattr_get_link, sys_extattr_delete_file,
sys_extattr_delete_link, sys_extattr_list_file, sys_extattr_list_link,
sys_setxattr, sys_lsetxattr, sys_getxattr, sys_lgetxattr,
sys_listxattr, sys_llistxattr, sys_removexattr, sys_lremovexattr

All have been scrutinized (several times, in fact) and compile-tested,
but not all have been explicitly tested in action.

XXX: While I haven't (intentionally) changed the use or nonuse of
XXX: TRYEMULROOT in any of these places, I'm not convinced all the
XXX: uses are correct; an audit might be desirable.
 1.41 28-Apr-2008  martin branches: 1.41.10; 1.41.14; 1.41.18; 1.41.20; 1.41.24;
Remove clause 3 and 4 from TNF licenses
 1.40 31-Dec-2007  ad branches: 1.40.6; 1.40.8; 1.40.10;
Remove systrace. Ok core@.
 1.39 08-Dec-2007  pooka branches: 1.39.4;
Remove cn_lwp from struct componentname. curlwp should be used
from on. The NDINIT() macro no longer takes the lwp parameter and
associates the credentials of the calling thread with the namei
structure.
 1.38 08-Dec-2007  dsl ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.37 13-Jul-2007  dsl branches: 1.37.6; 1.37.8; 1.37.14; 1.37.16;
Put the stackgap code under OPT_SYSTRACE.
 1.36 26-Apr-2007  dsl Pass the emulation root string into namei() from emul_find_interp() so that
the ktrace entries for lookups done during exec can have the full filename.
This is rather a hack :-)
 1.35 22-Apr-2007  dsl Change the way that emulations locate files within the emulation root to
avoid having to allocate space in the 'stackgap'
- which is very LWP unfriendly.
The additional code for non-emulation namei() is trivial, the reduction for
the emulations is massive.
The vnode for a processes emulation root is saved in the cwdi structure
during process exec.
If the emulation root the TRYEMULROOT flag are set, namei() will do an initial
search for absolute pathnames in the emulation root, if that fails it will
retry from the normal root.
".." at the emulation root will always go to the real root, even in the middle
of paths and when expanding symlinks.
Absolute symlinks found using absolute paths in the emulation root will be
relative to the emulation root (so /usr/lib/xxx.so -> /lib/xxx.so links
inside the emulation root don't need changing).
If the root of the emulation would be returned (for an emulation lookup), then
the real root is returned instead (matching the behaviour of emul_lookup,
but being a cheap comparison here) so that programs that scan "../.."
looking for the root dircetory don't loop forever.
The target for symbolic links is no longer mangled (it used to get the
CHECK_ALT_xxx() treatment, so could get /emul/xxx prepended).
CHECK_ALT_xxx() are no more. Most of the change is deleting them, and adding
TRYEMULROOT to the flags to NDINIT().
A lot of the emulation system call stubs could now be deleted.
 1.34 04-Mar-2007  christos branches: 1.34.2; 1.34.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.33 24-Nov-2006  wiz branches: 1.33.4;
s/existance/existence/, from Zafer.
 1.32 23-Jul-2006  ad branches: 1.32.4; 1.32.6;
Use the LWP cached credentials where sane.
 1.31 14-May-2006  elad integrate kauth.
 1.30 11-Dec-2005  christos branches: 1.30.4; 1.30.6; 1.30.8; 1.30.10; 1.30.12;
merge ktrace-lwp.
 1.29 29-May-2005  christos branches: 1.29.2;
- sprinkle const.
- add XXXUNCONST to the emul_find() pbuf argument free'ing. XXX: this needs
an api change.
- avoid variable shadowing.
 1.28 26-Feb-2005  perry nuke trailing whitespace
 1.27 29-Jun-2003  fvdl branches: 1.27.2; 1.27.10; 1.27.12;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.26 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.25 29-Nov-2002  jdolecek add emul_find_interp() function: the function looks for interpreter
in alternative emul tree first, and updates interpreter pathname
if found there; if not found in alternative emul tree, pathname
without the emul prefix is checked, and error returned if the file
doesn't exist
 1.24 23-Sep-2002  simonb Remove a meaningless type qualifier on a cast.
 1.23 17-Mar-2002  christos panic if more space than stackgaplen is requested. Maybe I should remove the
size option completely.
 1.22 16-Mar-2002  christos make the stackgap_{init,alloc} functions MP friendly (i.e. pass struct proc *
in, instead of using curproc). While there add an optional size argument to
stackgap_init.
 1.21 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.20 02-Feb-2001  jdolecek branches: 1.20.2; 1.20.4;
emul_find(): actually, the emulation root vnode dance has to be done for
CHECK_ALT_SYMLINK() same way as for CHECK_ALT_EXISTS()
This fixes lossage reported on current-users and kern/12019 by Ross Harvey.
 1.19 22-Jan-2001  jdolecek Introduce CHECK_ALT_SYMLINK() - this checks for alternative location without
following links, hence is usable for checking of presence of a symlink.
Also slighly cleanup EXISTS and CREAT cases - use symbolic constants
instead of 0/1.
This is needed for emulation of readlink(2), lchown(2) and similar.
Addresses kern/11757.
 1.18 20-Nov-2000  jdolecek make const the struct emul * pointers passed/used in stackgap_init(),
stackgap_alloc()
 1.17 28-Sep-2000  eeh Add support for variable end of user stacks needed to support COMPAT_NETBSD32:

`struct vmspace' has a new field `vm_minsaddr' which is the user TOS.

PS_STRINGS is deprecated in favor of curproc->p_pstr which is derived
from `vm_minsaddr'.

Bump the kernel version number.
 1.16 29-Aug-2000  sommerfeld Emulation stackgap sanity checks, based partly on fixes from
FreeBSD-SA00:42.

Change stackgap_alloc to bounds-check the allocation vs. the stack
gap, returning NULL if there isn't room for the allocation.

Change emul_find() to check for a NULL return from stackgap_alloc()
and convert that into ENAMETOOLONG.

Reorder various emulation syscalls so that all *_CHECK_ALT_{EXIST,CREAT}
calls (which turn into emul_find() under the covers come *after* small,
fixed-size stackgap_alloc() calls.

Clean up ibcs2 {get,set}groups.
 1.15 26-Jun-2000  mrg remove redundant vm includes.
 1.14 27-Apr-1999  christos branches: 1.14.2; 1.14.12;
From cgd again: pbuf == path on failure.
 1.13 27-Apr-1999  christos Make the usage consistant and document it:
if the path was given in a user buffer, return the new path in
a user buffer.
if the path was given in a kernel buffer, allocate a new kernel buffer
to return the new path; the caller is responsible for freeing the buffer
if we fail always set the new path to NULL.
This usage broke when I adde the /../ shortcut. Noted by cgd.
 1.12 24-Apr-1999  cgd implement a simple function, emul_flags_translate() to do table-based
flags translation.
 1.11 14-Feb-1999  christos branches: 1.11.2; 1.11.4; 1.11.6;
Provide a way for compat programs to specify files in the normal tree.
We do this using a trick similar to mach's /../; if a path is given as
/..<absolute-path-name>, then we return <absolute-path-name>
 1.10 09-Feb-1999  christos char * and char ** -> const char * and const char **
 1.9 03-Oct-1998  fvdl Assign to TNF completely.
 1.8 05-Sep-1998  christos Assign copyright to TNF.
 1.7 10-Oct-1997  fvdl Add getdirentries backward compat syscall. Provide common function to
signal cookie overflow during emulated getdents and friends.
 1.6 25-Oct-1996  cgd branches: 1.6.10;
make the namei struct members ni_dirp and ni_next, and the componentname
struct member cn_nameptr 'const', since they should never be used to
modify the path name. (Only the pathname buffer, cn_pnbuf, should be
modified.) Propagate the const poisoning to code that uses the namei
and componentname structs.
 1.5 12-Oct-1996  thorpej Don't inline stackgap_init() and stackgap_alloc(). Doing so generates
an include file dependency graph that's much more complicated than
it needs to be, and wastes space in the kernel.
 1.4 14-Mar-1996  christos Fix compiler warnings
 1.3 22-Oct-1995  mycroft Make sure we free the pathname buffer in all error cases.
 1.2 26-Jun-1995  christos branches: 1.2.2;
Fix PR1160... (bug with the new compat_util prefix)
 1.1 24-Jun-1995  christos - Extracted all compat routines from the kern directory and moved here.
- Created compat_util.c and compat_util.h to be used by the compatibility
modules, so they don't duplicate the same code.
- Added prototypes to the stackgap allocation routines.
 1.2.2.1 22-Oct-1995  mycroft Make sure we free the pathname buffer in all error cases.
 1.6.10.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.11.6.1 30-Nov-1999  itojun bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

The branch does not compile at all (due to the lack of ALTQ and some other
source code). Please do not try to modify the branch, this is just for
referenre purposes.

synchronization to latest KAME will take place on HEAD branch soon.
 1.11.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.11.2.3 09-Sep-2000  he Pull up revision 1.16 (requested by simonb):
More carefully check length of user-supplied data, in particular
make sure we don't overrun the available stack gap in stack gap
allocations.
 1.11.2.2 21-Jun-1999  cgd pull up rev(s) 1.12 from trunk. (cgd)
 1.11.2.1 18-Jun-1999  perry pullup 1.12->1.14 (cgd)
 1.14.12.2 18-Oct-2000  tv Pullup by patch [eeh]:
Support userspace at multiple addresses by making PSSTRINGS variable (using
p_psstr), and fix stackgap_init() appropriately.
 1.14.12.1 30-Aug-2000  sommerfeld Pull up:
syssrc/sys/compat/common/compat_util.c 1.16
syssrc/sys/compat/hpux/hpux_file.c 1.14
syssrc/sys/compat/ibcs2/ibcs2_misc.c 1.52
syssrc/sys/compat/ibcs2/ibcs2_stat.c 1.16
syssrc/sys/compat/linux/common/linux_file.c 1.29
syssrc/sys/compat/linux/common/linux_misc_notalpha.c 1.58
syssrc/sys/compat/svr4/svr4_stat.c 1.40
syssrc/sys/compat/svr4/svr4_stream.c 1.40,1.41

Approved by thorpej and jhawk.

Emulation stackgap sanity checks, based partly on fixes from
FreeBSD-SA00:42.

Change stackgap_alloc to bounds-check the allocation vs. the stack
gap, returning NULL if there isn't room for the allocation.

Change emul_find() to check for a NULL return from stackgap_alloc()
and convert that into ENAMETOOLONG.

Reorder various emulation syscalls so that all *_CHECK_ALT_{EXIST,CREAT}
calls (which turn into emul_find() under the covers come *after* small,
fixed-size stackgap_alloc() calls.

Clean up ibcs2 {get,set}groups.

Add range checks to svr4_stream.c
 1.14.2.3 11-Feb-2001  bouyer Sync with HEAD.
 1.14.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.14.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.20.4.3 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.20.4.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.20.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.20.2.6 11-Dec-2002  thorpej Sync with HEAD.
 1.20.2.5 18-Oct-2002  nathanw Catch up to -current.
 1.20.2.4 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.20.2.3 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.20.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.20.2.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.27.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.27.10.1 29-Apr-2005  kent sync with -current
 1.27.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.27.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.27.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.27.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.27.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.29.2.4 21-Jan-2008  yamt sync with head
 1.29.2.3 03-Sep-2007  yamt sync with head.
 1.29.2.2 30-Dec-2006  yamt sync with head.
 1.29.2.1 21-Jun-2006  yamt sync with head.
 1.30.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.30.10.1 08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.30.8.2 11-Aug-2006  yamt sync with head
 1.30.8.1 24-May-2006  yamt sync with head.
 1.30.6.1 01-Jun-2006  kardel Sync with head.
 1.30.4.1 09-Sep-2006  rpaulo sync with head
 1.32.6.1 10-Dec-2006  yamt sync with head.
 1.32.4.1 12-Jan-2007  ad Sync with head.
 1.33.4.2 07-May-2007  yamt sync with head.
 1.33.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.34.4.1 11-Jul-2007  mjf Sync with head.
 1.34.2.2 15-Jul-2007  ad Sync with head.
 1.34.2.1 27-May-2007  ad Sync with head.
 1.37.16.1 26-Dec-2007  ad Sync with head.
 1.37.14.1 18-Feb-2008  mjf Sync with HEAD.
 1.37.8.1 09-Jan-2008  matt sync with HEAD
 1.37.6.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.39.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.40.10.3 11-Mar-2010  yamt sync with head
 1.40.10.2 18-Jul-2009  yamt sync with head.
 1.40.10.1 16-May-2008  yamt sync with head.
 1.40.8.1 18-May-2008  yamt sync with head.
 1.40.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.41.24.2 18-Dec-2013  riz Revert ticket #1893 - netbsd-5 does not have pathbuf_destroy()
 1.41.24.1 17-Dec-2013  bouyer Pull up following revision(s) (requested by martin in ticket #1893):
sys/compat/common/compat_util.c: revision 1.45
Free pathbuf in an error path.
From Maxime Villard.
 1.41.20.2 18-Dec-2013  riz Revert ticket #1893 - netbsd-5 does not have pathbuf_destroy()
 1.41.20.1 17-Dec-2013  bouyer Pull up following revision(s) (requested by martin in ticket #1893):
sys/compat/common/compat_util.c: revision 1.45
Free pathbuf in an error path.
From Maxime Villard.
 1.41.18.1 14-Dec-2009  mrg pullup from -current:
>replace mips:elf_check_itp() and ELFNAME2(netbsd32,probe_noteless) that
>it's based upon with a common compat_elf_check_interp().
>
>tested on MALTA64 and sparc64.
 1.41.14.1 23-Jul-2009  jym Sync with HEAD.
 1.41.10.2 18-Dec-2013  riz Revert ticket #1893 - netbsd-5 does not have pathbuf_destroy()
 1.41.10.1 17-Dec-2013  bouyer Pull up following revision(s) (requested by martin in ticket #1893):
sys/compat/common/compat_util.c: revision 1.45
Free pathbuf in an error path.
From Maxime Villard.
 1.43.4.1 05-Mar-2011  rmind sync with head
 1.44.28.1 17-Dec-2013  bouyer Pull up following revision(s) (requested by martin in ticket #999):
sys/compat/common/compat_util.c: revision 1.45
Free pathbuf in an error path.
From Maxime Villard.
 1.44.22.1 18-May-2014  rmind sync with head
 1.44.20.1 17-Dec-2013  bouyer Pull up following revision(s) (requested by martin in ticket #999):
sys/compat/common/compat_util.c: revision 1.45
Free pathbuf in an error path.
From Maxime Villard.
 1.44.18.2 03-Dec-2017  jdolecek update from HEAD
 1.44.18.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.44.14.1 17-Dec-2013  bouyer Pull up following revision(s) (requested by martin in ticket #999):
sys/compat/common/compat_util.c: revision 1.45
Free pathbuf in an error path.
From Maxime Villard.
 1.44.8.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.45.4.1 17-Jan-2015  martin Pull up following revision(s) (requested by maxv in ticket #427):
sys/compat/svr4/svr4_schedctl.c: revision 1.8
sys/netinet/tcp_timer.c: revision 1.88
sys/miscfs/genfs/layer_vfsops.c: revision 1.45
sys/compat/svr4/svr4_ioctl.c: revision 1.37
sys/ufs/chfs/chfs_vfsops.c: revision 1.14
sys/miscfs/fdesc/fdesc_vfsops.c: revision 1.91
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.30
sys/compat/common/kern_time_50.c: revision 1.28
sys/netinet6/ip6_forward.c: revision 1.74
sys/miscfs/umapfs/umap_vnops.c: revision 1.57
sys/compat/svr4/svr4_fcntl.c: revision 1.74
distrib/sets/lists/comp/mi: revision 1.1931
sys/netinet6/udp6_output.c: revision 1.46
sys/fs/puffs/puffs_compat.c: revision 1.3
sys/fs/udf/udf_rename.c: revision 1.11
sys/compat/svr4/svr4_filio.c: revision 1.24
sys/fs/udf/udf_rename.c: revision 1.12
sys/netinet/tcp_usrreq.c: revision 1.202
sys/miscfs/umapfs/umap_subr.c: revision 1.29
sys/compat/linux/common/linux_fadvise64.c: revision 1.3
sys/netinet/if_atm.c: revision 1.34
sys/miscfs/procfs/procfs_subr.c: revision 1.106
sys/miscfs/genfs/layer_subr.c: revision 1.37
sys/netinet/tcp_sack.c: revision 1.30
sys/compat/freebsd/freebsd_misc.c: revision 1.33
sys/compat/freebsd/freebsd_file.c: revision 1.33
sys/ufs/chfs/chfs_vnode.c: revision 1.12
sys/compat/svr4/svr4_ttold.c: revision 1.34
sys/compat/linux/common/linux_file.c: revision 1.114
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.43
sys/compat/linux/common/linux_signal.c: revision 1.76
sys/compat/common/compat_util.c: revision 1.46
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.18
sys/compat/svr4/svr4_sockio.c: revision 1.36
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.32
sys/compat/svr4/svr4_signal.c: revision 1.66
sys/kern/kern_exec.c: revision 1.410
sys/fs/puffs/puffs_vfsops.c: revision 1.115
sys/compat/svr4/svr4_exec_elf64.c: revision 1.15
sys/compat/linux/arch/i386/linux_machdep.c: revision 1.159
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.50
sys/compat/linux32/common/linux32_misc.c: revision 1.24
sys/netinet/in_pcb.c: revision 1.153
sys/sys/malloc.h: revision 1.116
sys/compat/common/if_43.c: revision 1.9
share/man/man9/Makefile: revision 1.380
sys/netinet/tcp_vtw.c: revision 1.12
sys/miscfs/umapfs/umap_vfsops.c: revision 1.95
sys/ufs/ext2fs/ext2fs_vfsops.c: revision 1.186
sys/compat/common/uipc_syscalls_43.c: revision 1.46
sys/ufs/ext2fs/ext2fs_vnops.c: revision 1.115
sys/fs/puffs/puffs_msgif.c: revision 1.97
sys/compat/svr4/svr4_ipc.c: revision 1.27
sys/compat/linux/common/linux_exec.c: revision 1.117
sys/ufs/ext2fs/ext2fs_readwrite.c: revision 1.66
sys/netinet/tcp_output.c: revision 1.179
sys/compat/svr4/svr4_termios.c: revision 1.28
sys/fs/udf/udf_strat_bootstrap.c: revision 1.4
sys/fs/puffs/puffs_subr.c: revision 1.67
sys/fs/puffs/puffs_node.c: revision 1.36
sys/miscfs/overlay/overlay_vnops.c: revision 1.21
sys/fs/cd9660/cd9660_node.c: revision 1.34
sys/netinet/raw_ip.c: revision 1.146
sys/sys/mallocvar.h: revision 1.13
sys/miscfs/overlay/overlay_vfsops.c: revision 1.63
share/man/man9/malloc.9: revision 1.50
sys/netinet6/dest6.c: revision 1.18
sys/compat/linux/common/linux_uselib.c: revision 1.33
sys/compat/linux/common/linux_socket.c: revision 1.120
share/man/man9/malloc.9: revision 1.51
sys/netinet/tcp_subr.c: revision 1.257
sys/compat/linux/common/linux_socketcall.c: revision 1.45
sys/compat/linux/common/linux_fadvise64_64.c: revision 1.3
sys/compat/freebsd/freebsd_ipc.c: revision 1.17
sys/compat/linux/common/linux_misc_notalpha.c: revision 1.109
sys/compat/linux/arch/alpha/linux_pipe.c: revision 1.17
sys/netinet6/in6_pcb.c: revision 1.132
sys/netinet6/in6_ifattach.c: revision 1.94
sys/compat/svr4/svr4_exec_elf32.c: revision 1.15
sys/miscfs/nullfs/null_vfsops.c: revision 1.90
sys/fs/cd9660/cd9660_util.c: revision 1.12
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.48
sys/compat/freebsd/freebsd_exec_elf32.c: revision 1.20
sys/miscfs/procfs/procfs_vfsops.c: revision 1.94
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.28
sys/compat/linux/common/linux_sched.c: revision 1.67
sys/compat/linux/common/linux_exec_aout.c: revision 1.67
sys/compat/linux/common/linux_pipe.c: revision 1.67
sys/compat/linux/common/linux_llseek.c: revision 1.34
sys/compat/linux/arch/mips/linux_ptrace.c: revision 1.10
Do not uselessly include <sys/malloc.h>.
Cleanup:
- remove struct kmembuckets (dead)
- correctly deadify MALLOC_XX
- remove MALLOC_DEFINE_LIMIT and MALLOC_JUSTDEFINE_LIMIT (dead)
- remove malloc_roundup(), malloc_type_setlimit(), MALLOC_DEFINE_LIMIT()
and MALLOC_JUSTDEFINE_LIMIT() from man 9 malloc
New sentence, new line. Bump date for previous.
Obsolete malloc_roundup(9), malloc_type_setlimit(9) and MALLOC_DEFINE_LIMIT(9)
man pages.
 1.46.20.1 10-Jun-2019  christos Sync with HEAD
 1.46.18.4 22-Sep-2018  pgoyette #include "opt_compat_netbsd.h" for all sources that provide compat code.
 1.46.18.3 10-Sep-2018  pgoyette Remove the monolithic compat and compat_sysv modules. Now that we
don't have aliases, we need to use only the version-specific module
names when resolving dependencies.
 1.46.18.2 30-Mar-2018  pgoyette Create the compat_util module for use by version-specific compat code.
(It's automatically included in the monolithic compat module, as well
as in kernels with built-in compat code.)
 1.46.18.1 06-Mar-2018  pgoyette Move necessary routines out of compat_util.c and into exec_elf.c

Once again, compat_util.c is only for modules, so move it back into
compat/common/files.common and out of kern/files.kern
 1.24 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.23 21-Feb-2013  pgoyette branches: 1.23.36; 1.23.38;
Move boottime50 and its associated sysctl into the compat module. As
noted on tech-kern. Should fix PR/47579.

OK christos@

Will request pull-up to 6.0 in a few days.
 1.22 14-Dec-2009  mrg branches: 1.22.12; 1.22.18; 1.22.22;
replace mips:elf_check_itp() and ELFNAME2(netbsd32,probe_noteless) that
it's based upon with a common compat_elf_check_interp().

tested on MALTA64 and sparc64.
 1.21 19-Nov-2008  ad Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.20 28-Apr-2008  martin branches: 1.20.6; 1.20.8; 1.20.14;
Remove clause 3 and 4 from TNF licenses
 1.19 20-Jan-2008  dsl branches: 1.19.6; 1.19.8; 1.19.10;
Remove stackgap functions externs.
 1.18 22-Apr-2007  dsl branches: 1.18.8; 1.18.14; 1.18.20;
Change the way that emulations locate files within the emulation root to
avoid having to allocate space in the 'stackgap'
- which is very LWP unfriendly.
The additional code for non-emulation namei() is trivial, the reduction for
the emulations is massive.
The vnode for a processes emulation root is saved in the cwdi structure
during process exec.
If the emulation root the TRYEMULROOT flag are set, namei() will do an initial
search for absolute pathnames in the emulation root, if that fails it will
retry from the normal root.
".." at the emulation root will always go to the real root, even in the middle
of paths and when expanding symlinks.
Absolute symlinks found using absolute paths in the emulation root will be
relative to the emulation root (so /usr/lib/xxx.so -> /lib/xxx.so links
inside the emulation root don't need changing).
If the root of the emulation would be returned (for an emulation lookup), then
the real root is returned instead (matching the behaviour of emul_lookup,
but being a cheap comparison here) so that programs that scan "../.."
looking for the root dircetory don't loop forever.
The target for symbolic links is no longer mangled (it used to get the
CHECK_ALT_xxx() treatment, so could get /emul/xxx prepended).
CHECK_ALT_xxx() are no more. Most of the change is deleting them, and adding
TRYEMULROOT to the flags to NDINIT().
A lot of the emulation system call stubs could now be deleted.
 1.17 04-Mar-2007  christos branches: 1.17.2; 1.17.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.16 11-Dec-2005  christos branches: 1.16.26;
merge ktrace-lwp.
 1.15 29-May-2005  christos branches: 1.15.2;
- sprinkle const.
- add XXXUNCONST to the emul_find() pbuf argument free'ing. XXX: this needs
an api change.
- avoid variable shadowing.
 1.14 29-Jun-2003  fvdl branches: 1.14.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.13 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.12 29-Nov-2002  jdolecek add emul_find_interp() function: the function looks for interpreter
in alternative emul tree first, and updates interpreter pathname
if found there; if not found in alternative emul tree, pathname
without the emul prefix is checked, and error returned if the file
doesn't exist
 1.11 29-Nov-2002  jdolecek de-__P()
 1.10 16-Mar-2002  christos make the stackgap_{init,alloc} functions MP friendly (i.e. pass struct proc *
in, instead of using curproc). While there add an optional size argument to
stackgap_init.
 1.9 22-Jan-2001  jdolecek branches: 1.9.2; 1.9.4;
Introduce CHECK_ALT_SYMLINK() - this checks for alternative location without
following links, hence is usable for checking of presence of a symlink.
Also slighly cleanup EXISTS and CREAT cases - use symbolic constants
instead of 0/1.
This is needed for emulation of readlink(2), lchown(2) and similar.
Addresses kern/11757.
 1.8 01-Dec-2000  jdolecek add e_path (emulation path) to struct emul, which replaces emulation-specific
*_emul_path variables

change macros CHECK_ALT_{CREAT|EXIST} to use that, 'root' doesn't need
to be passed explicitly any more and *_CHECK_ALT_{CREAT|EXIST} are removed
change explicit emul_find() calls in probe functions to get the emulation
path from the checked exec switch entry's emulation

remove no longer needed header files

add e_flags and e_syscall to struct emul; these are unsed and empty for now
 1.7 20-Nov-2000  jdolecek make const the struct emul * pointers passed/used in stackgap_init(),
stackgap_alloc()
 1.6 24-Apr-1999  cgd branches: 1.6.2;
implement a simple function, emul_flags_translate() to do table-based
flags translation.
 1.5 09-Feb-1999  christos branches: 1.5.2; 1.5.4; 1.5.6;
char * and char ** -> const char * and const char **
 1.4 05-Sep-1998  christos Assign copyright to TNF.
 1.3 10-Oct-1997  fvdl Add getdirentries backward compat syscall. Provide common function to
signal cookie overflow during emulated getdents and friends.
 1.2 12-Oct-1996  thorpej branches: 1.2.10;
Don't inline stackgap_init() and stackgap_alloc(). Doing so generates
an include file dependency graph that's much more complicated than
it needs to be, and wastes space in the kernel.
 1.1 24-Jun-1995  christos - Extracted all compat routines from the kern directory and moved here.
- Created compat_util.c and compat_util.h to be used by the compatibility
modules, so they don't duplicate the same code.
- Added prototypes to the stackgap allocation routines.
 1.2.10.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.5.6.1 30-Nov-1999  itojun bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

The branch does not compile at all (due to the lack of ALTQ and some other
source code). Please do not try to modify the branch, this is just for
referenre purposes.

synchronization to latest KAME will take place on HEAD branch soon.
 1.5.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.5.2.1 21-Jun-1999  cgd pull up rev(s) 1.6 from trunk. (cgd)
 1.6.2.3 11-Feb-2001  bouyer Sync with HEAD.
 1.6.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.6.2.1 22-Nov-2000  bouyer Sync with HEAD.
 1.9.4.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.9.2.2 11-Dec-2002  thorpej Sync with HEAD.
 1.9.2.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.14.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.14.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.14.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.14.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.15.2.3 21-Jan-2008  yamt sync with head
 1.15.2.2 03-Sep-2007  yamt sync with head.
 1.15.2.1 21-Jun-2006  yamt sync with head.
 1.16.26.2 07-May-2007  yamt sync with head.
 1.16.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.17.4.1 11-Jul-2007  mjf Sync with head.
 1.17.2.1 27-May-2007  ad Sync with head.
 1.18.20.1 20-Jan-2008  bouyer Sync with HEAD
 1.18.14.1 18-Feb-2008  mjf Sync with HEAD.
 1.18.8.1 23-Mar-2008  matt sync with HEAD
 1.19.10.3 11-Mar-2010  yamt sync with head
 1.19.10.2 04-May-2009  yamt sync with head.
 1.19.10.1 16-May-2008  yamt sync with head.
 1.19.8.1 18-May-2008  yamt sync with head.
 1.19.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.19.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.20.14.1 14-Dec-2009  mrg pullup from -current:
>replace mips:elf_check_itp() and ELFNAME2(netbsd32,probe_noteless) that
>it's based upon with a common compat_elf_check_interp().
>
>tested on MALTA64 and sparc64.
 1.20.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.20.6.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.22.22.1 25-Feb-2013  tls resync with head
 1.22.18.1 14-Mar-2013  riz Pull up following revision(s) (requested by pgoyette in ticket #837):
sys/compat/common/kern_time_50.c: revision 1.25
sys/kern/init_sysctl.c: revision 1.195
sys/kern/init_main.c: revision 1.447
sys/compat/common/compat_util.h: revision 1.23
sys/compat/common/compat_mod.h: revision 1.1
sys/compat/common/compat_mod.c: revision 1.16
sys/compat/common/compat_mod.c: revision 1.17
sys/compat/common/compat_mod.c: revision 1.18
sys/compat/common/vfs_syscalls_43.c: revision 1.55
Move boottime50 and its associated sysctl into the compat module. As
noted on tech-kern. Should fix PR/47579.
OK christos@
Will request pull-up to 6.0 in a few days.
Wrap sysctl_teardown(&compat_clog) with the appropriate #if defined()s
remove empty #if
 1.22.12.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.23.38.1 10-Jun-2019  christos Sync with HEAD
 1.23.36.1 07-Mar-2018  pgoyette Move the emul_find_root() and emul_find_interp() to a new file
subr_emul.c

The previous location was in exec_elf.c but that can get built
multiple times for a single kernel, so we could end up with
duplicate symbols.

Thanks to ,rg@ for the heads-up.
 1.14 20-May-2024  christos remove dup line
 1.13 20-May-2024  christos Rename dup3110 to dup3100 to match historical practice for NetBSD-11,
because we already have kevent100. Fix compat_dup3 to belong in compat_100
not compat_110.
 1.12 19-May-2024  christos version dup3
 1.11 09-Dec-2023  pgoyette Modularize the COMPAT_90 code that resulted from the removal of
netinet6/nd6 from the kernel. Now, the minimal compat code can
be successfully loaded and unloaded along with the rest of the
COMPAT_90 code.

XXX pullup-10 - hopefully before RC2
 1.10 18-Aug-2023  christos Add linux waitid(2) from GSoC 2023 (Theodore Preduta)
 1.9 28-Jul-2023  christos Add epoll(2) from Theodore Preduta as part of GSoC 2023
 1.8 19-Dec-2022  pgoyette Create compat_100 module infrastructure now that we have branched
for NetBSD-10
 1.7 09-Aug-2021  andvar branches: 1.7.4;
fix various typos in compatibility, mainly in comments.
 1.6 21-Jan-2020  pgoyette Split the compat_50 module into two, separating the QUOTA-related
stuff from the rest of the module. This allows loading of the
(main) compat_50 module on kernels that don't include ``options
QUOTA''.

Welcome to 9.99.40 !

Addresses PR kern/54875
 1.5 22-Sep-2019  christos branches: 1.5.2;
Add a new member to struct vfsstat and grow the unused members
The new member is caled f_mntfromlabel and it is the dkw_wname
of the corresponding wedge. This is now used by df -W to display
the mountpoint name as NAME=
 1.4 17-May-2019  msaitoh branches: 1.4.2;
The max subtype of the ifmedia word is 31. It's too small for Ethernet now.
We currently use use it up to 30. We should extend the limit to be able to use
more than 10Gbps speeds. Our ifmedia(4) is inconvenience and have some problem
so we should redesign the interface, but it's too late for netbsd-9 to do it.
So, we keep the data structure size and modify the structure a bit. The
strategy is almost the same as FreeBSD. Many bits of IFM_OMASK for Ethernet
have not used, so use some of them for Ethernet's subtype.

The differences against FreeBSD are:
- We use NetBSD style compat code (i.e. no SIOCGIFXMEDIA).
- FreeBSD's IFM_ETH_XTYPE's bit location is from 11 to "14" even though
IFM_OMASK is from 8 to "15". We use _IFM_ETH_XTMASK from bit 13 to "15".
- FreeBSD changed the meaning of IFM_TYPE_MATCH(). I think we should
not do it. We keep it not changing and added new IFM_TYPE_SUBTYPE_MATCH()
macro for matching both TYPE and SUBTYPE.
- Added up to 400GBASE-SR16.

New layout of the media word is as follows (from ifmedia_h):

* if_media Options word:
* Bits Use
* ---- -------
* 0-4 Media subtype MAX SUBTYPE == 255 for ETH and 31 for others
* 5-7 Media type
* 8-15 Type specific options
* 16-18 Mode (for multi-mode devices)
* 19 (Reserved for Future Use)
* 20-27 Shared (global) options
* 28-31 Instance
*
* 3 2 1
* 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
* +-------+---------------+-+-----+---------------+-----+---------+
* | | |R| | | | |
* | IMASK | GMASK |F|MMASK+-----+ OMASK |NMASK| TMASK |
* | | |U| |XTMSK| | | |
* +-------+---------------+-+-----+-----+---------+-----+---------+
* <-----> <---> <--->
* IFM_INST() IFM_MODE() IFM_TYPE()
*
* IFM_SUBTYPE(other than ETH)<------->
*
* <---> IFM_SUBTYPE(ETH)<------->
*
*
* <-------------> <------------->
* IFM_OPTIONS()
 1.3 15-Apr-2019  pgoyette Split the COMPAT_50 socket-timeout stuff out of kern/uipc_socket.c
and into its own source file, which is now included in the compat_50
module.

(Not sure how this got missed during the original [pgoyette-compat] work)
 1.2 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.1 06-Mar-2018  pgoyette branches: 1.1.2;
file files.common was initially added on branch pgoyette-compat.
 1.1.2.40 28-Sep-2018  pgoyette Use the correct attribute - compat_utils vs compat_util
 1.1.2.39 28-Sep-2018  pgoyette Revert previous commit. There are still random unidentified references
to these utility routings.
 1.1.2.38 27-Sep-2018  pgoyette Add dependencies to ensure that the utility routines get included
as built-in module when needed.
 1.1.2.37 22-Sep-2018  pgoyette Missed this in previous files.* changes
 1.1.2.36 19-Sep-2018  pgoyette Split out the vnd COMPAT_50 code
 1.1.2.35 12-Sep-2018  pgoyette Complete removal of the "monolithic" all-version compat_sysvipc module
 1.1.2.34 10-Sep-2018  pgoyette Remove the monolithic compat and compat_sysv modules. Now that we
don't have aliases, we need to use only the version-specific module
names when resolving dependencies.
 1.1.2.33 17-Apr-2018  pgoyette Rename sysv_mod.[ch] to compat_sysv_mod.[ch] for consistency with other
files that provide module(7) interfaces.
 1.1.2.32 17-Apr-2018  pgoyette Finish separating the compat_09 and compat_43 stuff
 1.1.2.31 17-Apr-2018  pgoyette First pass at compat modules for 4.3BSD, NetBSD-0.9, and NetBSD-1.0

XXX Still need to deal with the sysctl stuff and other code shared
XXX between 09 and 43
 1.1.2.30 03-Apr-2018  pgoyette Remove fixed allocation of modules' "required" lists (previously
limited to MAXMODDEPS entries). Update the modctl(MODCTL_STAT)
syscall to return the required data in a new format, and retain
the previous data format in MODCTL_OSTAT. Update the compat_80
and compat_netbsd32 modules as needed.
 1.1.2.29 31-Mar-2018  pgoyette create the compat_12 module
 1.1.2.28 30-Mar-2018  pgoyette Add compat_13 module
 1.1.2.27 30-Mar-2018  pgoyette Extract compat_14 stuff into its own module
 1.1.2.26 30-Mar-2018  pgoyette typo in version dependency
 1.1.2.25 30-Mar-2018  pgoyette Create and build a compat_16 module
 1.1.2.24 30-Mar-2018  pgoyette Create and build the compat_20 module
 1.1.2.23 29-Mar-2018  pgoyette Rename usb_30_subr.c --> usb_subr_30.c for consistency with others
 1.1.2.22 29-Mar-2018  pgoyette Split out the usb compat_30 code and add it to the module
 1.1.2.21 28-Mar-2018  pgoyette Split vnd compat_30 code out of the main driver and into the compat_30
module
 1.1.2.20 28-Mar-2018  pgoyette Initial pass at a compat_30 module.

Still needs some work for dev/vnd and various dev/usb/*
 1.1.2.19 27-Mar-2018  pgoyette Create a compat_40 module
 1.1.2.18 24-Mar-2018  pgoyette Separate the compat_50 and compat_80 dispatching code from the main
body of raidframe, and place into the appropriate compat modules.

Enable building of the compat_80 module.
 1.1.2.17 23-Mar-2018  pgoyette For now, the compat_80 module is empty.
 1.1.2.16 21-Mar-2018  pgoyette Move if_spppsubr compat code into the compat50 module.

More prep work for compat80 module (for raidframe)
 1.1.2.15 21-Mar-2018  pgoyette Split the compat_50 code out from the dev/clockctl driver and include
it in the compat_50 and compat modules.
 1.1.2.14 19-Mar-2018  pgoyette Initial pass at a COMPAT_50 module. More to come.
 1.1.2.13 18-Mar-2018  pgoyette Import compat_60 changes for dev/ccd
 1.1.2.12 18-Mar-2018  pgoyette Move closer to a complete compat_60 module. All that remains is some
tty stuff and some ccd ioctl()s.
 1.1.2.11 16-Mar-2018  pgoyette Move closer to getting a compat_60 module - still needs more work
 1.1.2.10 15-Mar-2018  pgoyette Resolve conflicts from sync-with-HEAD
 1.1.2.9 14-Mar-2018  pgoyette Tag files with their specific compat version required. This way
the files only get included if needed, allowing for subsequent
loading of COMPAT_xx modules for older-than-built-in code.
 1.1.2.8 14-Mar-2018  pgoyette Make do_openat()'s handling of path=NULL modular
 1.1.2.7 13-Mar-2018  pgoyette Move the swapstats compat code into the compat_netbsd module.

Without this, a kernel configured without COMPAT_13 and/or COMPAT_50
could not execute the compat swapstats code, even if the compat_netbsd
module had been loaded.
 1.1.2.6 12-Mar-2018  pgoyette Update dependencies for modules when they are built-in. Now we don't
(or at least, shouldn't) need reminders in the GENERIC config files
about which module options require other options.

Update branch status doc accordingly.
 1.1.2.5 09-Mar-2018  pgoyette More on renaming the new module
 1.1.2.4 09-Mar-2018  pgoyette Split the sysv_ipc module into two pieces: one for contemporary
SYSV* functionality, and one for compatability with previous NetBSD
versions. No need to pull in all of compat just to have a sysv_ipc
module.
 1.1.2.3 06-Mar-2018  pgoyette Move necessary routines out of compat_util.c and into exec_elf.c

Once again, compat_util.c is only for modules, so move it back into
compat/common/files.common and out of kern/files.kern
 1.1.2.2 06-Mar-2018  pgoyette compat_util.c is included in all kernels, so does not need to be
listed here.
 1.1.2.1 06-Mar-2018  pgoyette Add a files.common to list all the compat source files.
 1.4.2.4 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.4.2.3 08-Apr-2020  martin Merge changes from current as of 20200406
 1.4.2.2 10-Jun-2019  christos Sync with HEAD
 1.4.2.1 17-May-2019  christos file files.common was added on branch phil-wifi on 2019-06-10 22:06:58 +0000
 1.5.2.1 25-Jan-2020  ad Sync with head.
 1.7.4.1 10-Dec-2023  martin Pull up following revision(s) (requested by pgoyette in ticket #487):

sys/compat/common/compat_90_mod.c: revision 1.5
sys/compat/common/compat_90_mod.c: revision 1.6
sys/netinet6/in6.c: revision 1.290
sys/netinet6/in6.c: revision 1.291
sys/compat/common/files.common: revision 1.11
sys/netinet6/icmp6.c: revision 1.255
sys/compat/common/net_inet6_nd_90.c: revision 1.1
sys/compat/common/net_inet6_nd_90.c: revision 1.2
sys/modules/compat_90/Makefile: revision 1.2
sys/modules/compat_90/Makefile: revision 1.3
sys/netinet6/nd6.c: revision 1.281
sys/compat/common/compat_mod.h: revision 1.10
sys/kern/compat_stub.c: revision 1.23
sys/sys/compat_stub.h: revision 1.27

Identify the need to rework the COMPAT_* code to be more
module-aware.
This is an XXX comment block only, NFCI.

Modularize the COMPAT_90 code that resulted from the removal of
netinet6/nd6 from the kernel. Now, the minimal compat code can
be successfully loaded and unloaded along with the rest of the
COMPAT_90 code.

Allow kernels builds which don't define INET6 to compile compat bits
too.

Default the build of compat_90 module to include IPv6, as is done
for other INET6-sensitive modules (see if_lagg).
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 26-Feb-2005  perry nuke trailing whitespace
 1.1 23-Apr-1999  cgd branches: 1.1.2; 1.1.38; 1.1.46; 1.1.48;
a quick hack to make generating errno conversion tables from our and other
systems' headers a bit easier. leaves much to be desired, but it's better
than nothing.
 1.1.48.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.1.46.1 29-Apr-2005  kent sync with -current
 1.1.38.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.7 07-Sep-2021  riastradh sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.6 12-Dec-2019  pgoyette Rather than keeping a separate mutex, condvar, and pserialize for each
module hook, we can share a common set of synchronization structures.
This cuts the amount of cacheline_aligned data for these structures by
50%.

Note that we still have a per-hook localcount, since we need to count
individual references.

As discussed with riastradh@

Welcome to 9.99.22 !
 1.5 01-Mar-2019  pgoyette branches: 1.5.4; 1.5.6;
Rename the MODULE_*_HOOK() macros to MODULE_HOOK_*() as briefly
discussed on irc.

NFCI intended.

Ride the earlier kernel bump - it;s getting crowded.
 1.4 29-Jan-2019  pgoyette Normalize all the compat hooks' names to the form

<subsystem>_<function>_<version>_hook

NFCI

XXX Note that although this introduces a change in the kernel-to-
XXX module interface, we are NOT bumping the kernel version number.
XXX We will bump the version number once the interface stabilizes.
 1.3 28-Jan-2019  christos - Don't expose random data conversion functions, but expose the high level
entry point (such as ioctl) instead.
- Attempt to autoload the module before using it.

Naming: Should the names of the hooks be:
<category>_<version>_<function>_hook_t
or:
<category>_<function>_<version>_hook_t

We should make those consistent.
 1.2 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.1 30-Mar-2018  pgoyette branches: 1.1.2;
file ieee80211_20.c was initially added on branch pgoyette-compat.
 1.1.2.3 23-Jan-2019  pgoyette Convert the macros for setting and unsetting a hook to generate
in-line code rather than using an intermediary hook##set routine.
Hooks are set and unset only in one place, so the intermediary
routine provides no benefit. IMHO using the macro at the point-
of-call is more readable than using it elsewhere in the code and
then calling the generated intermediary routine (for which you
won't even find its declaration or definition unless you remember
to search for the HOOK_SET macro instead).

NFC intended, will verify with a bulk build and an atf test run.
 1.1.2.2 21-Sep-2018  pgoyette Adapt the ieee80211_20 code to the new MP-safe mechanism
 1.1.2.1 30-Mar-2018  pgoyette Create and build the compat_20 module
 1.5.6.1 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.5.4.3 08-Apr-2020  martin Merge changes from current as of 20200406
 1.5.4.2 10-Jun-2019  christos Sync with HEAD
 1.5.4.1 01-Mar-2019  christos file ieee80211_20.c was added on branch phil-wifi on 2019-06-10 22:06:58 +0000
 1.5 12-Dec-2019  pgoyette Rather than keeping a separate mutex, condvar, and pserialize for each
module hook, we can share a common set of synchronization structures.
This cuts the amount of cacheline_aligned data for these structures by
50%.

Note that we still have a per-hook localcount, since we need to count
individual references.

As discussed with riastradh@

Welcome to 9.99.22 !
 1.4 01-Mar-2019  pgoyette branches: 1.4.4;
Rename the MODULE_*_HOOK() macros to MODULE_HOOK_*() as briefly
discussed on irc.

NFCI intended.

Ride the earlier kernel bump - it;s getting crowded.
 1.3 29-Jan-2019  pgoyette Rename the if43_20_hook to if43_cvtcmd_20_hook
 1.2 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.1 30-Mar-2018  pgoyette branches: 1.1.2;
file if43_20.c was initially added on branch pgoyette-compat.
 1.1.2.5 23-Jan-2019  pgoyette Convert the macros for setting and unsetting a hook to generate
in-line code rather than using an intermediary hook##set routine.
Hooks are set and unset only in one place, so the intermediary
routine provides no benefit. IMHO using the macro at the point-
of-call is more readable than using it elsewhere in the code and
then calling the generated intermediary routine (for which you
won't even find its declaration or definition unless you remember
to search for the HOOK_SET macro instead).

NFC intended, will verify with a bulk build and an atf test run.
 1.1.2.4 30-Sep-2018  pgoyette atm is gone
 1.1.2.3 22-Sep-2018  pgoyette #include "opt_compat_netbsd.h" for all sources that provide compat code.
 1.1.2.2 21-Sep-2018  pgoyette Clean-up some pre-existing function-pointer code (related to if_43)
to use the new MP-safe mechanism.
 1.1.2.1 30-Mar-2018  pgoyette Create and build the compat_20 module
 1.4.4.3 08-Apr-2020  martin Merge changes from current as of 20200406
 1.4.4.2 10-Jun-2019  christos Sync with HEAD
 1.4.4.1 01-Mar-2019  christos file if43_20.c was added on branch phil-wifi on 2019-06-10 22:06:58 +0000
 1.1 06-Mar-2018  pgoyette branches: 1.1.2;
file if_40.h was initially added on branch pgoyette-compat.
 1.1.2.4 15-Oct-2018  pgoyette Convert a couple more hooks to the MP-safe mechanism.

While here, clean up some headers and remove any that are now empty.
 1.1.2.3 16-Apr-2018  pgoyette Rename if_[45]0_{init,fini} entry points to more appropriate and more
consistent uipc_syscalls_[45]0_{init,fini} and remove some multiple
declarations.
 1.1.2.2 06-Mar-2018  pgoyette Better to add these required headers closer to where they're needed
 1.1.2.1 06-Mar-2018  pgoyette Use a .h file for declaring the if_40_{init, fini} routines
 1.27 30-Mar-2023  riastradh atalk(4): Omit spurious satosat.

The input is already a struct sockaddr_at pointer.
 1.26 28-Sep-2022  msaitoh branches: 1.26.4;
Simplify sys/compat/sys/sockio.h. No functional change intended.

- Move some definitions from sys/compat/sockio.h to compat/net/if.h.
struct oif_data in sockio.h and if_data50 are the same, so remove oif_data.
Do the same thing to oifdatareq, too.
- u_quad_t -> uint64_t. No functional change.
 1.25 12-Jun-2020  roy Remove in-kernel handling of Router Advertisements

This is much better handled by a user-land tool.
Proposed on tech-net here:
https://mail-index.netbsd.org/tech-net/2020/04/22/msg007766.html

Note that the ioctl SIOCGIFINFO_IN6 no longer sets flags. That now
needs to be done using the pre-existing SIOCSIFINFO_FLAGS ioctl.

Compat is fully provided where it makes sense, but trying to turn on
RA handling will obviously throw an error as it no longer exists.

Note that if you use IPv6 temporary addresses, this now needs to be
turned on in dhcpcd.conf(5) rather than in sysctl.conf(5).
 1.24 12-Dec-2019  pgoyette Rather than keeping a separate mutex, condvar, and pserialize for each
module hook, we can share a common set of synchronization structures.
This cuts the amount of cacheline_aligned data for these structures by
50%.

Note that we still have a per-hook localcount, since we need to count
individual references.

As discussed with riastradh@

Welcome to 9.99.22 !
 1.23 23-Sep-2019  maxv Remove unused assignment. Found by the lgtm bot.
 1.22 17-May-2019  msaitoh The max subtype of the ifmedia word is 31. It's too small for Ethernet now.
We currently use use it up to 30. We should extend the limit to be able to use
more than 10Gbps speeds. Our ifmedia(4) is inconvenience and have some problem
so we should redesign the interface, but it's too late for netbsd-9 to do it.
So, we keep the data structure size and modify the structure a bit. The
strategy is almost the same as FreeBSD. Many bits of IFM_OMASK for Ethernet
have not used, so use some of them for Ethernet's subtype.

The differences against FreeBSD are:
- We use NetBSD style compat code (i.e. no SIOCGIFXMEDIA).
- FreeBSD's IFM_ETH_XTYPE's bit location is from 11 to "14" even though
IFM_OMASK is from 8 to "15". We use _IFM_ETH_XTMASK from bit 13 to "15".
- FreeBSD changed the meaning of IFM_TYPE_MATCH(). I think we should
not do it. We keep it not changing and added new IFM_TYPE_SUBTYPE_MATCH()
macro for matching both TYPE and SUBTYPE.
- Added up to 400GBASE-SR16.

New layout of the media word is as follows (from ifmedia_h):

* if_media Options word:
* Bits Use
* ---- -------
* 0-4 Media subtype MAX SUBTYPE == 255 for ETH and 31 for others
* 5-7 Media type
* 8-15 Type specific options
* 16-18 Mode (for multi-mode devices)
* 19 (Reserved for Future Use)
* 20-27 Shared (global) options
* 28-31 Instance
*
* 3 2 1
* 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
* +-------+---------------+-+-----+---------------+-----+---------+
* | | |R| | | | |
* | IMASK | GMASK |F|MMASK+-----+ OMASK |NMASK| TMASK |
* | | |U| |XTMSK| | | |
* +-------+---------------+-+-----+-----+---------+-----+---------+
* <-----> <---> <--->
* IFM_INST() IFM_MODE() IFM_TYPE()
*
* IFM_SUBTYPE(other than ETH)<------->
*
* <---> IFM_SUBTYPE(ETH)<------->
*
*
* <-------------> <------------->
* IFM_OPTIONS()
 1.21 16-Apr-2019  msaitoh Rename ifreqo2n() and ifreqo2n() to IFREQO2N_43() and IFREQN2O_43():
- ifreqo2n() and ifreqn2o() are for COMPAT_43, so add _43 to the name.
- Uppercase to make it clear those are macros.
 1.20 01-Mar-2019  pgoyette Rename the MODULE_*_HOOK() macros to MODULE_HOOK_*() as briefly
discussed on irc.

NFCI intended.

Ride the earlier kernel bump - it;s getting crowded.
 1.19 29-Jan-2019  pgoyette Normalize all the compat hooks' names to the form

<subsystem>_<function>_<version>_hook

NFCI

XXX Note that although this introduces a change in the kernel-to-
XXX module interface, we are NOT bumping the kernel version number.
XXX We will bump the version number once the interface stabilizes.
 1.18 29-Jan-2019  pgoyette Rename the if43_20_hook to if43_cvtcmd_20_hook
 1.17 29-Jan-2019  pgoyette The if43_20_hook function returns an errno; use it to determine whether
to allow conversion of the ioctl cmd --> ncmd

Should address issue reported by msaitoh@ on irc as well as via e-mail
from Patrick Welche and Ryo ONODERA.
 1.16 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.15 06-Sep-2018  maxv Remove the network ATM code.
 1.14 29-Jul-2017  riastradh branches: 1.14.2; 1.14.4;
Kill needless nested extern of vec_compat_cvtcmd/ioctl.

Already declared in if_43.h.
 1.13 05-Nov-2016  pgoyette Move if_43.c back into the shared Makefile.sysio where it really
belongs.

Update the code to invoke the two routines compat_cvtcmd() and
compat_ifioctl() through indirect pointers. Initialize those
pointers in sys/net/if.c and update them in the compat module's
initialization code.

Addresses the issue pointed out in PR kern/51598
 1.12 25-Jul-2016  ozaki-r Apply if_get/if_put to compat_ifioctl
 1.11 11-Jul-2015  njoly branches: 1.11.2;
Handle case where compat_ifioctl() is called with ocmd != cmd, as found in
compat Linux. Do not crash by ensuring that oifr is correctly set.

Fix crash reported by Robert Swindells on tech-kern@.
 1.10 12-May-2015  christos rump is compiled with COMPAT_OSOCK not COMPAT_OIFREQ and the code in if.c
is not handling this case properly. Make this work by checking again if
we need to convert struct ifreq here, and if we do, we do it ourselves.
 1.9 09-Nov-2014  maxv branches: 1.9.2;
Do not uselessly include <sys/malloc.h>.
 1.8 05-Sep-2014  matt Try not to use f_data, use f_{vnode,socket,pipe,mqueue,kqueue,ksem} to get
a correctly typed pointer.
 1.7 01-Jul-2014  rtr branches: 1.7.2;
fix parameter types in pr_ioctl, called xx_control() functions and remove
abuse of pointer to struct mbuf type.

param2 changed to u_long type and uses parameter name 'cmd' (ioctl command)
param3 changed to void * type and uses parameter name 'data'
param4 changed to struct ifnet * and uses parameter name 'ifp'
param5 has been removed (formerly struct lwp *) and uses of 'l' have been
replaced with curlwp from curproc(9).

callers have had (now unnecessary) casts to struct mbuf * removed, called
code has had (now unnecessary) casts to u_long, void * and struct ifnet *
respectively removed.

reviewed by rmind@
 1.6 22-Jun-2014  rtr * split PRU_CONTROL functionality out of xxx_userreq() switches and place
into separate xxx_ioctl() functions.
* place KASSERT(req != PRU_CONTROL) inside xxx_userreq() as it is now
inappropriate for req = PRU_CONTROL in xxx_userreq().
* replace calls to pr_generic() with req = PRU_CONTROL with pr_ioctl().
* remove & fixup references to PRU_CONTROL xxx_userreq() function comments.
* fix various comments references for xxx_userreq() that mentioned
PRU_CONTROL as xxx_userreq() no longer handles the request.

a further change will follow to fix parameter and naming inconsistencies
retained from original code.

Reviewed by rmind@
 1.5 18-May-2014  rmind Add struct pr_usrreqs with a pr_generic function and prepare for the
dismantling of pr_usrreq in the protocols; no functional change intended.
PRU_ATTACH/PRU_DETACH changes will follow soon.

Bump for struct protosw. Welcome to 6.99.62!
 1.4 19-Jan-2011  tsutsui branches: 1.4.16; 1.4.20; 1.4.30;
Remove includes <sys/mount.h> and <sys/sched.h> added for <sys/syscallargs.h>.
Now they are handled by $sysarghdrextra in sys/kern/syscalls.conf.
 1.3 06-Nov-2010  christos branches: 1.3.2;
can't map the old and the new SIO calls the way we did before because the
numbers have changed. Instead provide a switch. Keep the old code there,
to handle cases we did not handle in the first switch, but this is a hack
and should be removed.
 1.2 17-Mar-2009  dyoung branches: 1.2.2; 1.2.6;
#include "opt_compat_netbsd.h" for COMPAT_20.
 1.1 14-Nov-2008  ad branches: 1.1.4; 1.1.6; 1.1.8; 1.1.10;
- Move some more compat code into sys/compat.
- Split 4.3BSD ifioctl stuff into its own file.
- Remove some ifdefs that include small fragments of vfs compat code
which are difficult to relocate elsewhere.
 1.1.10.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.1.8.3 28-Apr-2009  skrll Sync with HEAD.
 1.1.8.2 19-Jan-2009  skrll Sync with HEAD.
 1.1.8.1 14-Nov-2008  skrll file if_43.c was added on branch nick-hppapmap on 2009-01-19 13:17:17 +0000
 1.1.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.1.6.1 14-Nov-2008  mjf file if_43.c was added on branch mjf-devfs2 on 2009-01-17 13:28:41 +0000
 1.1.4.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.1.4.1 14-Nov-2008  haad file if_43.c was added on branch haad-dm on 2008-12-13 01:13:47 +0000
 1.2.6.1 05-Mar-2011  rmind sync with head
 1.2.2.2 04-May-2009  yamt sync with head.
 1.2.2.1 17-Mar-2009  yamt file if_43.c was added on branch yamt-nfs-mp on 2009-05-04 08:12:17 +0000
 1.3.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.4.30.1 10-Aug-2014  tls Rebase.
 1.4.20.1 28-Aug-2013  rmind Checkpoint work in progress:
- Initial split of the protocol user-request method into the following
methods: pr_attach, pr_detach and pr_generic for old the pr_usrreq.
- Adjust socreate(9) and sonewconn(9) to call pr_attach without the
socket lock held (as a preparation for the locking scheme adjustment).
- Adjust all pr_attach routines to assert that PCB is not set.
- Sprinkle various comments, document some routines and their locking.
- Remove M_PCB, replace with kmem(9).
- Fix few bugs spotted on the way.
 1.4.16.2 03-Dec-2017  jdolecek update from HEAD
 1.4.16.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.7.2.1 17-Jan-2015  martin Pull up following revision(s) (requested by maxv in ticket #427):
sys/compat/svr4/svr4_schedctl.c: revision 1.8
sys/netinet/tcp_timer.c: revision 1.88
sys/miscfs/genfs/layer_vfsops.c: revision 1.45
sys/compat/svr4/svr4_ioctl.c: revision 1.37
sys/ufs/chfs/chfs_vfsops.c: revision 1.14
sys/miscfs/fdesc/fdesc_vfsops.c: revision 1.91
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.30
sys/compat/common/kern_time_50.c: revision 1.28
sys/netinet6/ip6_forward.c: revision 1.74
sys/miscfs/umapfs/umap_vnops.c: revision 1.57
sys/compat/svr4/svr4_fcntl.c: revision 1.74
distrib/sets/lists/comp/mi: revision 1.1931
sys/netinet6/udp6_output.c: revision 1.46
sys/fs/puffs/puffs_compat.c: revision 1.3
sys/fs/udf/udf_rename.c: revision 1.11
sys/compat/svr4/svr4_filio.c: revision 1.24
sys/fs/udf/udf_rename.c: revision 1.12
sys/netinet/tcp_usrreq.c: revision 1.202
sys/miscfs/umapfs/umap_subr.c: revision 1.29
sys/compat/linux/common/linux_fadvise64.c: revision 1.3
sys/netinet/if_atm.c: revision 1.34
sys/miscfs/procfs/procfs_subr.c: revision 1.106
sys/miscfs/genfs/layer_subr.c: revision 1.37
sys/netinet/tcp_sack.c: revision 1.30
sys/compat/freebsd/freebsd_misc.c: revision 1.33
sys/compat/freebsd/freebsd_file.c: revision 1.33
sys/ufs/chfs/chfs_vnode.c: revision 1.12
sys/compat/svr4/svr4_ttold.c: revision 1.34
sys/compat/linux/common/linux_file.c: revision 1.114
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.43
sys/compat/linux/common/linux_signal.c: revision 1.76
sys/compat/common/compat_util.c: revision 1.46
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.18
sys/compat/svr4/svr4_sockio.c: revision 1.36
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.32
sys/compat/svr4/svr4_signal.c: revision 1.66
sys/kern/kern_exec.c: revision 1.410
sys/fs/puffs/puffs_vfsops.c: revision 1.115
sys/compat/svr4/svr4_exec_elf64.c: revision 1.15
sys/compat/linux/arch/i386/linux_machdep.c: revision 1.159
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.50
sys/compat/linux32/common/linux32_misc.c: revision 1.24
sys/netinet/in_pcb.c: revision 1.153
sys/sys/malloc.h: revision 1.116
sys/compat/common/if_43.c: revision 1.9
share/man/man9/Makefile: revision 1.380
sys/netinet/tcp_vtw.c: revision 1.12
sys/miscfs/umapfs/umap_vfsops.c: revision 1.95
sys/ufs/ext2fs/ext2fs_vfsops.c: revision 1.186
sys/compat/common/uipc_syscalls_43.c: revision 1.46
sys/ufs/ext2fs/ext2fs_vnops.c: revision 1.115
sys/fs/puffs/puffs_msgif.c: revision 1.97
sys/compat/svr4/svr4_ipc.c: revision 1.27
sys/compat/linux/common/linux_exec.c: revision 1.117
sys/ufs/ext2fs/ext2fs_readwrite.c: revision 1.66
sys/netinet/tcp_output.c: revision 1.179
sys/compat/svr4/svr4_termios.c: revision 1.28
sys/fs/udf/udf_strat_bootstrap.c: revision 1.4
sys/fs/puffs/puffs_subr.c: revision 1.67
sys/fs/puffs/puffs_node.c: revision 1.36
sys/miscfs/overlay/overlay_vnops.c: revision 1.21
sys/fs/cd9660/cd9660_node.c: revision 1.34
sys/netinet/raw_ip.c: revision 1.146
sys/sys/mallocvar.h: revision 1.13
sys/miscfs/overlay/overlay_vfsops.c: revision 1.63
share/man/man9/malloc.9: revision 1.50
sys/netinet6/dest6.c: revision 1.18
sys/compat/linux/common/linux_uselib.c: revision 1.33
sys/compat/linux/common/linux_socket.c: revision 1.120
share/man/man9/malloc.9: revision 1.51
sys/netinet/tcp_subr.c: revision 1.257
sys/compat/linux/common/linux_socketcall.c: revision 1.45
sys/compat/linux/common/linux_fadvise64_64.c: revision 1.3
sys/compat/freebsd/freebsd_ipc.c: revision 1.17
sys/compat/linux/common/linux_misc_notalpha.c: revision 1.109
sys/compat/linux/arch/alpha/linux_pipe.c: revision 1.17
sys/netinet6/in6_pcb.c: revision 1.132
sys/netinet6/in6_ifattach.c: revision 1.94
sys/compat/svr4/svr4_exec_elf32.c: revision 1.15
sys/miscfs/nullfs/null_vfsops.c: revision 1.90
sys/fs/cd9660/cd9660_util.c: revision 1.12
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.48
sys/compat/freebsd/freebsd_exec_elf32.c: revision 1.20
sys/miscfs/procfs/procfs_vfsops.c: revision 1.94
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.28
sys/compat/linux/common/linux_sched.c: revision 1.67
sys/compat/linux/common/linux_exec_aout.c: revision 1.67
sys/compat/linux/common/linux_pipe.c: revision 1.67
sys/compat/linux/common/linux_llseek.c: revision 1.34
sys/compat/linux/arch/mips/linux_ptrace.c: revision 1.10
Do not uselessly include <sys/malloc.h>.
Cleanup:
- remove struct kmembuckets (dead)
- correctly deadify MALLOC_XX
- remove MALLOC_DEFINE_LIMIT and MALLOC_JUSTDEFINE_LIMIT (dead)
- remove malloc_roundup(), malloc_type_setlimit(), MALLOC_DEFINE_LIMIT()
and MALLOC_JUSTDEFINE_LIMIT() from man 9 malloc
New sentence, new line. Bump date for previous.
Obsolete malloc_roundup(9), malloc_type_setlimit(9) and MALLOC_DEFINE_LIMIT(9)
man pages.
 1.9.2.5 28-Aug-2017  skrll Sync with HEAD
 1.9.2.4 05-Dec-2016  skrll Sync with HEAD
 1.9.2.3 05-Oct-2016  skrll Sync with HEAD
 1.9.2.2 22-Sep-2015  skrll Sync with HEAD
 1.9.2.1 06-Jun-2015  skrll Sync with HEAD
 1.11.2.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.11.2.1 26-Jul-2016  pgoyette Sync with HEAD
 1.14.4.3 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.14.4.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.14.4.1 10-Jun-2019  christos Sync with HEAD
 1.14.2.15 23-Jan-2019  pgoyette Convert the macros for setting and unsetting a hook to generate
in-line code rather than using an intermediary hook##set routine.
Hooks are set and unset only in one place, so the intermediary
routine provides no benefit. IMHO using the macro at the point-
of-call is more readable than using it elsewhere in the code and
then calling the generated intermediary routine (for which you
won't even find its declaration or definition unless you remember
to search for the HOOK_SET macro instead).

NFC intended, will verify with a bulk build and an atf test run.
 1.14.2.14 22-Jan-2019  pgoyette Convert the MODULE_{,VOID_}HOOK_CALL macros to do everything in-line
rather than defining an intermediate hook##call function. Almost
all of the hooks are called only once, and although we lose the
ability of doing things like

if (MODULE_HOOK_CALL(...) == 0) ...

we simplify things quite a bit. With this change, we no longer need
to have both declaration and definition macros, and the definition
no longer needs to have both prototype argument list and a "real"
argument list.

FWIW, the above if now needs to written as

int ret;

MODULE_HOOK_CALL(..., ret);
if (ret == 0) ...

with appropriate use of braces {}.
 1.14.2.13 18-Jan-2019  pgoyette Don't restrict hooks to having only int or void types. Pass the hook's
type to the various macros, as needed.

Allows us to reduce diffs to original in at least one or two places (we
no longer have to provide an additional parameter to the hook routine
for returning a non-int return value).
 1.14.2.12 14-Jan-2019  pgoyette Create a variant of the HOOK macros that handles hook routines of
type void, and use them where appropriate.
 1.14.2.11 13-Jan-2019  pgoyette Remove the HOOK2 versions of the MODULE_HOOK macros. There were
only a few uses, and using them led to some lack of clarity in the
code. Instead, we now use two separate hooks, with names that
make it clear(er) what we're doing.

This also positions us to start unraveling some of the rtsock_50
mess, which will need (at least) five hooks.
 1.14.2.10 15-Oct-2018  pgoyette Convert a couple more hooks to the MP-safe mechanism.

While here, clean up some headers and remove any that are now empty.
 1.14.2.9 03-Oct-2018  pgoyette Don't define if_43_{init,fini}() in multiple .h files.
 1.14.2.8 03-Oct-2018  pgoyette Make if_43_{init,fini} return an int, for consistency with all the
related *_{init,fini} routines.
 1.14.2.7 30-Sep-2018  pgoyette Ssync with HEAD
 1.14.2.6 29-Sep-2018  pgoyette In MODULE_HOOK_CALL_DECL we don't need to provide the actual argument
list for calling the hook function, nor do we need to provide the
default value (for when the hook has not been set).
 1.14.2.5 21-Sep-2018  pgoyette Clean-up some pre-existing function-pointer code (related to if_43)
to use the new MP-safe mechanism.
 1.14.2.4 18-Sep-2018  pgoyette The COMPAT_HOOK macros were renamed to MODULE_HOOK, adjust all callers
 1.14.2.3 18-Sep-2018  pgoyette Split the COMPAT_CALL_HOOK to separate the declaration from the
implementation. Some hooks are called from multiple source files,
and the old method resulted in duplicate implementations.

Implement MP-safe hooks for the usb_subr_30 code. Pass the helper
functions as arguments to the compat code so it does not have to
determine if the kernel contains usb code.
 1.14.2.2 17-Sep-2018  pgoyette Adapt (most of) the indirect function pointers to the new MP-safe
mechanism. Still remaining are the compat_netbsd32 stuff, and
some usb subroutines.
 1.14.2.1 30-Mar-2018  pgoyette Create and build the compat_20 module
 1.26.4.1 31-Jul-2023  martin Pull up following revision(s) (requested by riastradh in ticket #278):

sys/netatalk/ddp_output.c: revision 1.22
sys/compat/common/if_43.c: revision 1.27
sys/netatalk/ddp_input.c: revision 1.34
sys/netatalk/at_control.c: revision 1.43

atalk(4): Don't abuse queue(9) internals.

atalk(4): Omit spurious satosat.
The input is already a struct sockaddr_at pointer.
 1.2 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.1 05-Nov-2016  pgoyette branches: 1.1.2; 1.1.4; 1.1.18; 1.1.20; 1.1.22;
Move if_43.c back into the shared Makefile.sysio where it really
belongs.

Update the code to invoke the two routines compat_cvtcmd() and
compat_ifioctl() through indirect pointers. Initialize those
pointers in sys/net/if.c and update them in the compat module's
initialization code.

Addresses the issue pointed out in PR kern/51598
 1.1.22.1 10-Jun-2019  christos Sync with HEAD
 1.1.20.3 15-Oct-2018  pgoyette Convert a couple more hooks to the MP-safe mechanism.

While here, clean up some headers and remove any that are now empty.
 1.1.20.2 03-Oct-2018  pgoyette Don't define if_43_{init,fini}() in multiple .h files.
 1.1.20.1 03-Oct-2018  pgoyette Make if_43_{init,fini} return an int, for consistency with all the
related *_{init,fini} routines.
 1.1.18.2 03-Dec-2017  jdolecek update from HEAD
 1.1.18.1 05-Nov-2016  jdolecek file if_43.h was added on branch tls-maxphys on 2017-12-03 11:36:53 +0000
 1.1.4.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.1.4.1 05-Nov-2016  pgoyette file if_43.h was added on branch pgoyette-localcount on 2017-01-07 08:56:29 +0000
 1.1.2.2 05-Dec-2016  skrll Sync with HEAD
 1.1.2.1 05-Nov-2016  skrll file if_43.h was added on branch nick-nhusb on 2016-12-05 10:54:59 +0000
 1.5 03-Aug-2022  riastradh sys/compat/common/if_media_80.c: Add kernel rcsid.
 1.4 07-Sep-2021  riastradh sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.3 12-Dec-2019  pgoyette Rather than keeping a separate mutex, condvar, and pserialize for each
module hook, we can share a common set of synchronization structures.
This cuts the amount of cacheline_aligned data for these structures by
50%.

Note that we still have a per-hook localcount, since we need to count
individual references.

As discussed with riastradh@

Welcome to 9.99.22 !
 1.2 26-Sep-2019  christos fix sign-compare issues.
 1.1 17-May-2019  msaitoh branches: 1.1.2; 1.1.4;
The max subtype of the ifmedia word is 31. It's too small for Ethernet now.
We currently use use it up to 30. We should extend the limit to be able to use
more than 10Gbps speeds. Our ifmedia(4) is inconvenience and have some problem
so we should redesign the interface, but it's too late for netbsd-9 to do it.
So, we keep the data structure size and modify the structure a bit. The
strategy is almost the same as FreeBSD. Many bits of IFM_OMASK for Ethernet
have not used, so use some of them for Ethernet's subtype.

The differences against FreeBSD are:
- We use NetBSD style compat code (i.e. no SIOCGIFXMEDIA).
- FreeBSD's IFM_ETH_XTYPE's bit location is from 11 to "14" even though
IFM_OMASK is from 8 to "15". We use _IFM_ETH_XTMASK from bit 13 to "15".
- FreeBSD changed the meaning of IFM_TYPE_MATCH(). I think we should
not do it. We keep it not changing and added new IFM_TYPE_SUBTYPE_MATCH()
macro for matching both TYPE and SUBTYPE.
- Added up to 400GBASE-SR16.

New layout of the media word is as follows (from ifmedia_h):

* if_media Options word:
* Bits Use
* ---- -------
* 0-4 Media subtype MAX SUBTYPE == 255 for ETH and 31 for others
* 5-7 Media type
* 8-15 Type specific options
* 16-18 Mode (for multi-mode devices)
* 19 (Reserved for Future Use)
* 20-27 Shared (global) options
* 28-31 Instance
*
* 3 2 1
* 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
* +-------+---------------+-+-----+---------------+-----+---------+
* | | |R| | | | |
* | IMASK | GMASK |F|MMASK+-----+ OMASK |NMASK| TMASK |
* | | |U| |XTMSK| | | |
* +-------+---------------+-+-----+-----+---------+-----+---------+
* <-----> <---> <--->
* IFM_INST() IFM_MODE() IFM_TYPE()
*
* IFM_SUBTYPE(other than ETH)<------->
*
* <---> IFM_SUBTYPE(ETH)<------->
*
*
* <-------------> <------------->
* IFM_OPTIONS()
 1.1.4.1 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.1.2.4 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.1.2.3 08-Apr-2020  martin Merge changes from current as of 20200406
 1.1.2.2 10-Jun-2019  christos Sync with HEAD
 1.1.2.1 17-May-2019  christos file if_media_80.c was added on branch phil-wifi on 2019-06-10 22:06:58 +0000
 1.5 03-Sep-2022  thorpej Remove <net/netisr.h>
 1.4 12-Dec-2019  pgoyette Rather than keeping a separate mutex, condvar, and pserialize for each
module hook, we can share a common set of synchronization structures.
This cuts the amount of cacheline_aligned data for these structures by
50%.

Note that we still have a per-hook localcount, since we need to count
individual references.

As discussed with riastradh@

Welcome to 9.99.22 !
 1.3 01-Mar-2019  pgoyette branches: 1.3.4;
Rename the MODULE_*_HOOK() macros to MODULE_HOOK_*() as briefly
discussed on irc.

NFCI intended.

Ride the earlier kernel bump - it;s getting crowded.
 1.2 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.1 21-Mar-2018  pgoyette branches: 1.1.2;
file if_spppsubr50.c was initially added on branch pgoyette-compat.
 1.1.2.4 23-Jan-2019  pgoyette Convert the macros for setting and unsetting a hook to generate
in-line code rather than using an intermediary hook##set routine.
Hooks are set and unset only in one place, so the intermediary
routine provides no benefit. IMHO using the macro at the point-
of-call is more readable than using it elsewhere in the code and
then calling the generated intermediary routine (for which you
won't even find its declaration or definition unless you remember
to search for the HOOK_SET macro instead).

NFC intended, will verify with a bulk build and an atf test run.
 1.1.2.3 18-Sep-2018  pgoyette The COMPAT_HOOK macros were renamed to MODULE_HOOK, adjust all callers
 1.1.2.2 17-Sep-2018  pgoyette Adapt (most of) the indirect function pointers to the new MP-safe
mechanism. Still remaining are the compat_netbsd32 stuff, and
some usb subroutines.
 1.1.2.1 21-Mar-2018  pgoyette Move if_spppsubr compat code into the compat50 module.

More prep work for compat80 module (for raidframe)
 1.3.4.3 08-Apr-2020  martin Merge changes from current as of 20200406
 1.3.4.2 10-Jun-2019  christos Sync with HEAD
 1.3.4.1 01-Mar-2019  christos file if_spppsubr50.c was added on branch phil-wifi on 2019-06-10 22:06:58 +0000
 1.2 27-Jan-2019  pgoyette branches: 1.2.4;
Merge the [pgoyette-compat] branch
 1.1 21-Mar-2018  pgoyette branches: 1.1.2;
file if_spppsubr50.h was initially added on branch pgoyette-compat.
 1.1.2.1 21-Mar-2018  pgoyette Move if_spppsubr compat code into the compat50 module.

More prep work for compat80 module (for raidframe)
 1.2.4.2 10-Jun-2019  christos Sync with HEAD
 1.2.4.1 27-Jan-2019  christos file if_spppsubr50.h was added on branch phil-wifi on 2019-06-10 22:06:58 +0000
 1.3 29-Jan-2020  ad - Track LWPs in a per-process radixtree. It uses no extra memory in the
single threaded case. Replace scans of p->p_lwps with lookups in the
tree. Find free LIDs for new LWPs in the tree. Replace the hashed sleep
queues for park/unpark with lookups in the tree under cover of a RW lock.

- lwp_wait(): if waiting on a specific LWP, find the LWP via tree lookup and
return EINVAL if it's detached, not ESRCH.

- Group the locks in struct proc at the end of the struct in their own cache
line.

- Add some comments.
 1.2 27-Jan-2019  pgoyette branches: 1.2.6;
Merge the [pgoyette-compat] branch
 1.1 04-Apr-2014  njoly branches: 1.1.4; 1.1.6; 1.1.10; 1.1.34; 1.1.36;
Move a few compat 50 syscalls, not applicable to rump kernels, out of
kern_time_50.c to a new source module.
 1.1.36.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.1.36.1 10-Jun-2019  christos Sync with HEAD
 1.1.34.2 22-Sep-2018  pgoyette #include "opt_compat_netbsd.h" for all sources that provide compat code.
 1.1.34.1 19-Mar-2018  pgoyette Initial pass at a COMPAT_50 module. More to come.
 1.1.10.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.10.1 04-Apr-2014  tls file kern_50.c was added on branch tls-maxphys on 2014-08-20 00:03:31 +0000
 1.1.6.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.1.6.1 04-Apr-2014  yamt file kern_50.c was added on branch yamt-pagecache on 2014-05-22 11:40:15 +0000
 1.1.4.2 18-May-2014  rmind sync with head
 1.1.4.1 04-Apr-2014  rmind file kern_50.c was added on branch rmind-smpnet on 2014-05-18 17:45:31 +0000
 1.2.6.1 29-Feb-2020  ad Sync with head.
 1.4 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.3 18-Mar-2018  christos branches: 1.3.2;
include compat/sys/cpuio.h and multiple include protection.
 1.2 18-Mar-2018  christos finish MD glue for compat ucode module.
 1.1 17-Mar-2018  christos branches: 1.1.2;
redo the cpu ucode compat code.
 1.1.2.6 31-Mar-2018  pgoyette Re-enable inclusion of CPU_UCODE for i386/amd64. Even though it won't
build correctly on XEN (won't use the XEN ABI), it works fine on real
hardware.
 1.1.2.5 18-Mar-2018  pgoyette Merge changes from HEAD into ccd_60.c

For all of the individual xxx_60_{init,fini} routines, don't force
them to artificially return a status; just make them void. This
simplifies the compat_60_{init,fini} handling of errors that remain.
 1.1.2.4 18-Mar-2018  pgoyette Clean-up for kern_cpu_60 code.

Also, although not strictly necessary, include the kern_sa_60 stuff in
the compat_60 module, for completeness.

Still need to deal with some tty code and the ccd driver to finish off
the compat_60 module.
 1.1.2.3 18-Mar-2018  pgoyette Import from -current the MD glue code for compat cpu_ucode
 1.1.2.2 17-Mar-2018  pgoyette Import christos's changes for the compat_60 cpu_ucode stuff
 1.1.2.1 17-Mar-2018  pgoyette file kern_cpu_60.c was added on branch pgoyette-compat on 2018-03-17 21:37:52 +0000
 1.3.2.1 10-Jun-2019  christos Sync with HEAD
 1.2 24-Feb-2008  martin Remove compat code for posix_fadvise
 1.1 27-Jan-2008  martin branches: 1.1.2; 1.1.4; 1.1.6; 1.1.10;
Implement new version of posix_fadvise as a stub callinig the real
worker function, and compatibility stub doing the same with old argument
sturcture.
 1.1.10.1 03-Apr-2008  mjf Sync with HEAD.
 1.1.6.1 24-Mar-2008  keiichi sync with head.
 1.1.4.2 18-Feb-2008  mjf Sync with HEAD.
 1.1.4.1 27-Jan-2008  mjf file kern_descrip_40.c was added on branch mjf-devfs on 2008-02-18 21:05:22 +0000
 1.1.2.3 27-Feb-2008  yamt sync with head.
 1.1.2.2 04-Feb-2008  yamt sync with head.
 1.1.2.1 27-Jan-2008  yamt file kern_descrip_40.c was added on branch yamt-lazymbuf on 2008-02-04 09:23:00 +0000
 1.1 28-Jul-2023  christos Add epoll(2) from Theodore Preduta as part of GSoC 2023
 1.23 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.22 04-Nov-2009  rmind branches: 1.22.62; 1.22.64;
do_sys_wait(): fix previous by checking for ru != NULL. Noticed by
Onno van der Linden. Also, remove redundant arguments (seems that
was_zombie was not used since rev 1.177 ?).
 1.21 20-Dec-2007  dsl branches: 1.21.10; 1.21.12;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.20 19-Oct-2007  ad branches: 1.20.4; 1.20.8;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.19 07-May-2007  dsl branches: 1.19.6; 1.19.8; 1.19.12;
Split sys_wait4() so that compat code can fiddle with the returned 'status'
and 'rusage' without having to copy data to/from stackgap buffers.
The old split (find_stopped_child) could be removed.
amd64 seems to run netbsd32, linux and linux32 emulations. sparc64 compiles.
 1.18 04-Mar-2007  christos branches: 1.18.2; 1.18.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.17 09-Feb-2007  ad branches: 1.17.2;
Merge newlock2 to head.
 1.16 29-Jan-2007  hubertf Remove more duplicate headers.
Patch by Slava Semushin <slava.semushin@gmail.com>

Again, this was tested by comparing obj files from a pristine and a patched
source tree against an i386/ALL kernel, and also for src/sbin/fsck_ffs,
src/sbin/fsdb and src/usr.sbin/makefs. Only changes in assert() line numbers
were detected in 'objdump -d' output.
 1.15 16-Nov-2006  christos __unused removal on arguments; approved by core.
 1.14 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.13 11-Dec-2005  christos branches: 1.13.20; 1.13.22;
merge ktrace-lwp.
 1.12 19-Nov-2003  christos branches: 1.12.16;
Don't include malloc.h if you are not going to use it.
 1.11 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.10 18-Jan-2003  thorpej branches: 1.10.2;
Merge the nathanw_sa branch.
 1.9 25-Sep-2002  thorpej Don't include <sys/map.h>.
 1.8 16-Mar-2002  christos make the stackgap_{init,alloc} functions MP friendly (i.e. pass struct proc *
in, instead of using curproc). While there add an optional size argument to
stackgap_init.
 1.7 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.6 28-Jun-2000  mrg branches: 1.6.2; 1.6.4;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.5 26-Jun-2000  mrg remove/move more mach vm header files:

<vm/pglist.h> -> <uvm/uvm_pglist.h>
<vm/vm_inherit.h> -> <uvm/uvm_inherit.h>
<vm/vm_kern.h> -> into <uvm/uvm_extern.h>
<vm/vm_object.h> -> nothing
<vm/vm_pager.h> -> into <uvm/uvm_pager.h>

also includes a bunch of <vm/vm_page.h> include removals (due to redudancy
with <vm/vm.h>), and a scattering of other similar headers.
 1.4 03-Sep-1997  jonathan branches: 1.4.18;
machine/psl.h is deprecated; move #include <machine/psl.h> inside #ifdef m68k.
 1.3 07-Oct-1995  mycroft branches: 1.3.14;
Prefix names of system call implementation functions with `sys_'.
 1.2 29-Sep-1995  thorpej Fix the declaration of compat_43_wait() (int * -> register_t *), pointed
out by Chris Demetriou.
 1.1 24-Jun-1995  christos - Extracted all compat routines from the kern directory and moved here.
- Created compat_util.c and compat_util.h to be used by the compatibility
modules, so they don't duplicate the same code.
- Added prototypes to the stackgap allocation routines.
 1.3.14.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.4.18.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.6.4.3 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.6.4.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.6.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.6.2.6 18-Oct-2002  nathanw Catch up to -current.
 1.6.2.5 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.6.2.4 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.6.2.3 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.6.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.6.2.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.10.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.10.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.10.2.1 03-Aug-2004  skrll Sync with HEAD
 1.12.16.4 21-Jan-2008  yamt sync with head
 1.12.16.3 27-Oct-2007  yamt sync with head.
 1.12.16.2 03-Sep-2007  yamt sync with head.
 1.12.16.1 26-Feb-2007  yamt sync with head.
 1.13.22.2 10-Dec-2006  yamt sync with head.
 1.13.22.1 22-Oct-2006  yamt sync with head
 1.13.20.3 01-Feb-2007  ad Sync with head.
 1.13.20.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.13.20.1 18-Nov-2006  ad Sync with head.
 1.17.2.2 17-May-2007  yamt sync with head.
 1.17.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.18.4.1 11-Jul-2007  mjf Sync with head.
 1.18.2.2 23-Oct-2007  ad Sync with head.
 1.18.2.1 27-May-2007  ad Sync with head.
 1.19.12.1 25-Oct-2007  bouyer Sync with HEAD.
 1.19.8.2 09-Jan-2008  matt sync with HEAD
 1.19.8.1 06-Nov-2007  matt sync with HEAD
 1.19.6.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.20.8.1 02-Jan-2008  bouyer Sync with HEAD
 1.20.4.1 26-Dec-2007  ad Sync with head.
 1.21.12.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.21.12.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.21.10.1 11-Mar-2010  yamt sync with head
 1.22.64.1 10-Jun-2019  christos Sync with HEAD
 1.22.62.2 22-Sep-2018  pgoyette #include "opt_compat_netbsd.h" for all sources that provide compat code.
 1.22.62.1 17-Apr-2018  pgoyette First pass at compat modules for 4.3BSD, NetBSD-0.9, and NetBSD-1.0

XXX Still need to deal with the sysctl stuff and other code shared
XXX between 09 and 43
 1.22 07-Sep-2021  riastradh sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.21 27-Jan-2019  pgoyette branches: 1.21.4;
Merge the [pgoyette-compat] branch
 1.20 20-Dec-2007  dsl branches: 1.20.12; 1.20.90; 1.20.96; 1.20.98;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.19 04-Mar-2007  christos branches: 1.19.16; 1.19.24; 1.19.28;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.18 09-Feb-2007  ad branches: 1.18.2;
Merge newlock2 to head.
 1.17 16-Nov-2006  christos __unused removal on arguments; approved by core.
 1.16 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.15 11-Dec-2005  christos branches: 1.15.20; 1.15.22;
merge ktrace-lwp.
 1.14 04-Dec-2003  atatat branches: 1.14.16;
Dynamic sysctl.

Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.

Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.

All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.

PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
 1.13 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.12 29-Jun-2003  fvdl branches: 1.12.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.11 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.10 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.9 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.8 14-Jul-2000  thorpej branches: 1.8.2; 1.8.4;
Sprinkle in some const.
 1.7 28-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.6 28-Mar-2000  simonb branches: 1.6.4;
Centralise the declarations of cpu_model, machine, machine_arch,
osrelease, and ostype and remove "extern char foo[];" (for hostname
and domainname too).

Also delete redunctant decl of boottime in kern_info_43.c.
 1.5 21-Feb-1996  cgd branches: 1.5.30;
fourth argument to kern_sysctl() must be a size_t *. simply passing a pointer
to SCARG(uap, len) won't do, because that'd be an int *. copy the value
into a size_t, and pass pointer to that.
 1.4 04-Feb-1996  christos kern_sysctl was missing process argument. Elimited -Wall warnings from
the files that were affected
 1.3 07-Oct-1995  mycroft Prefix names of system call implementation functions with `sys_'.
 1.2 19-Sep-1995  thorpej Make system calls conform to a standard prototype and bring those
prototypes into scope.
 1.1 24-Jun-1995  christos - Extracted all compat routines from the kern directory and moved here.
- Created compat_util.c and compat_util.h to be used by the compatibility
modules, so they don't duplicate the same code.
- Added prototypes to the stackgap allocation routines.
 1.5.30.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.6.4.1 14-Jul-2000  thorpej Pull up rev. 1.8:
Sprinkle in some const.
 1.8.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.8.2.4 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.8.2.3 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.8.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.8.2.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.12.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.12.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.12.2.2 03-Aug-2004  skrll Sync with HEAD
 1.12.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.14.16.4 21-Jan-2008  yamt sync with head
 1.14.16.3 03-Sep-2007  yamt sync with head.
 1.14.16.2 26-Feb-2007  yamt sync with head.
 1.14.16.1 30-Dec-2006  yamt sync with head.
 1.15.22.2 10-Dec-2006  yamt sync with head.
 1.15.22.1 22-Oct-2006  yamt sync with head
 1.15.20.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.15.20.1 18-Nov-2006  ad Sync with head.
 1.18.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.19.28.1 02-Jan-2008  bouyer Sync with HEAD
 1.19.24.1 26-Dec-2007  ad Sync with head.
 1.19.16.1 09-Jan-2008  matt sync with HEAD
 1.20.98.1 10-Jun-2019  christos Sync with HEAD
 1.20.96.2 22-Sep-2018  pgoyette #include "opt_compat_netbsd.h" for all sources that provide compat code.
 1.20.96.1 17-Apr-2018  pgoyette First pass at compat modules for 4.3BSD, NetBSD-0.9, and NetBSD-1.0

XXX Still need to deal with the sysctl stuff and other code shared
XXX between 09 and 43
 1.20.90.1 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1836):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.20.12.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.20.12.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.21.4.1 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.40 07-Sep-2021  riastradh sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.39 30-Jan-2020  christos - make sure size is not used uninitialized
- limit size range
- fix type botch for "size"
from maxv@
 1.38 02-Jan-2020  thorpej branches: 1.38.2;
- Eliminate the global "boottime" variable, which was being accessed
without any synchronization against changes by e.g. clock_settime().
- Replace with new getbinboottime() / getnanoboottime() / getmicroboottime()
functions (naming mirrors that of other time access functions in kern_tc.c).
It returns the (maybe-converted) value of timebasebin, which also tracks
our estimate of when the system was booted (i.e. the legacy "boottime" was
redundant).

XXX There needs to be a lockless synchronization mechanism for reading
timebasebin, but this is a problem in kern_tc.c that pre-existed these
"boottime" changes. At least now the problem is centralized in one location.
 1.37 27-Jan-2019  pgoyette branches: 1.37.4;
Merge the [pgoyette-compat] branch
 1.36 03-Sep-2018  riastradh Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.35 24-Mar-2014  christos branches: 1.35.22; 1.35.28; 1.35.30;
use cpu_getmodel() to get the model name
 1.34 11-Jan-2009  christos branches: 1.34.14; 1.34.24; 1.34.28;
merge christos-time_t
 1.33 24-Apr-2008  ad branches: 1.33.2; 1.33.4; 1.33.10;
Merge proc::p_mutex and proc::p_smutex into a single adaptive mutex, since
we no longer need to guard against access from hardware interrupt handlers.

Additionally, if cloning a process with CLONE_SIGHAND, arrange to have the
child process share the parent's lock so that signal state may be kept in
sync. Partially addresses PR kern/37437.
 1.32 08-Jan-2008  elad branches: 1.32.6; 1.32.8; 1.32.10;
Make compat_43_sys_sethostid() use old_sysctl(), allowing for the removal
of a kauth(9) call.

okay christos@.
 1.31 05-Jan-2008  ad Missing lock acquire.
 1.30 20-Dec-2007  dsl Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.29 04-Mar-2007  christos branches: 1.29.16; 1.29.22; 1.29.24; 1.29.28;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.28 15-Feb-2007  ad branches: 1.28.2;
Count the number of CPUs at boot and stash in 'ncpu'. Eventually should
have each CPU register at attach, so we can figure out the topology for
the scheduler.
 1.27 09-Feb-2007  ad Merge newlock2 to head.
 1.26 04-Jan-2007  elad Consistent usage of KAUTH_GENERIC_ISSUSER.
 1.25 16-Nov-2006  christos __unused removal on arguments; approved by core.
 1.24 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.23 23-Jul-2006  ad branches: 1.23.4; 1.23.6;
Use the LWP cached credentials where sane.
 1.22 14-May-2006  elad integrate kauth.
 1.21 11-Dec-2005  christos branches: 1.21.4; 1.21.6; 1.21.8; 1.21.10; 1.21.12;
merge ktrace-lwp.
 1.20 26-Feb-2005  perry branches: 1.20.4;
nuke trailing whitespace
 1.19 04-Dec-2003  atatat branches: 1.19.8; 1.19.10;
Dynamic sysctl.

Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.

Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.

All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.

PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
 1.18 19-Nov-2003  christos Don't include malloc.h if you are not going to use it.
 1.17 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.16 29-Jun-2003  fvdl branches: 1.16.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.15 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.14 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.13 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.12 28-Jun-2000  mrg branches: 1.12.2; 1.12.4;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.11 30-Mar-2000  augustss Kill register declarations.
 1.10 28-Mar-2000  simonb Centralise the declarations of cpu_model, machine, machine_arch,
osrelease, and ostype and remove "extern char foo[];" (for hostname
and domainname too).

Also delete redunctant decl of boottime in kern_info_43.c.
 1.9 24-Mar-1999  mrg branches: 1.9.8;
completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.
 1.8 10-Feb-1998  mrg - add defopt's for UVM, UVMHIST and PMAP_NEW.
- remove unnecessary UVMHIST_DECL's.
 1.7 05-Feb-1998  mrg initial import of the new virtual memory system, UVM, into -current.

UVM was written by chuck cranor <chuck@maria.wustl.edu>, with some
minor portions derived from the old Mach code. i provided some help
getting swap and paging working, and other bug fixes/ideas. chuck
silvers <chuq@chuq.com> also provided some other fixes.

this is the rest of the MI portion changes.

this will be KNF'd shortly. :-)
 1.6 18-May-1996  christos Support bsdi getkerninfo(SYSINFO,...) call so that the BSDI netscape
calling uname(3) can find out what os it is running on. Tested only with a
bsdi binary that calls getkerninfo directly. Funny thing is that I ran
the same binary on a bsdi machine, and they fill in fewer fields in the
emulation than we do; maybe I went overboard :-)
 1.5 21-Feb-1996  cgd fourth argument to kern_sysctl() must be a size_t *. simply passing a pointer
to SCARG(uap, len) won't do, because that'd be an int *. copy the value
into a size_t, and pass pointer to that.
 1.4 04-Feb-1996  christos kern_sysctl was missing process argument. Elimited -Wall warnings from
the files that were affected
 1.3 07-Oct-1995  mycroft Prefix names of system call implementation functions with `sys_'.
 1.2 19-Sep-1995  thorpej Make system calls conform to a standard prototype and bring those
prototypes into scope.
 1.1 24-Jun-1995  christos - Extracted all compat routines from the kern directory and moved here.
- Created compat_util.c and compat_util.h to be used by the compatibility
modules, so they don't duplicate the same code.
- Added prototypes to the stackgap allocation routines.
 1.9.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.12.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.12.2.4 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.12.2.3 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.12.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.12.2.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.16.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.16.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.16.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.16.2.2 03-Aug-2004  skrll Sync with HEAD
 1.16.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.19.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.19.8.1 29-Apr-2005  kent sync with -current
 1.20.4.5 21-Jan-2008  yamt sync with head
 1.20.4.4 03-Sep-2007  yamt sync with head.
 1.20.4.3 26-Feb-2007  yamt sync with head.
 1.20.4.2 30-Dec-2006  yamt sync with head.
 1.20.4.1 21-Jun-2006  yamt sync with head.
 1.21.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.21.10.3 06-May-2006  christos - Move kauth_cred_t declaration to <sys/types.h>
- Cleanup struct ucred; forward declarations that are unused.
- Don't include <sys/kauth.h> in any header, but include it in the c files
that need it.

Approved by core.
 1.21.10.2 10-Mar-2006  elad generic_authorize() -> kauth_authorize_generic().
 1.21.10.1 08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.21.8.2 11-Aug-2006  yamt sync with head
 1.21.8.1 24-May-2006  yamt sync with head.
 1.21.6.1 01-Jun-2006  kardel Sync with head.
 1.21.4.1 09-Sep-2006  rpaulo sync with head
 1.23.6.2 10-Dec-2006  yamt sync with head.
 1.23.6.1 22-Oct-2006  yamt sync with head
 1.23.4.3 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.23.4.2 12-Jan-2007  ad Sync with head.
 1.23.4.1 18-Nov-2006  ad Sync with head.
 1.28.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.29.28.3 10-Jan-2008  bouyer Sync with HEAD
 1.29.28.2 08-Jan-2008  bouyer Sync with HEAD
 1.29.28.1 02-Jan-2008  bouyer Sync with HEAD
 1.29.24.1 26-Dec-2007  ad Sync with head.
 1.29.22.1 18-Feb-2008  mjf Sync with HEAD.
 1.29.16.2 23-Mar-2008  matt sync with HEAD
 1.29.16.1 09-Jan-2008  matt sync with HEAD
 1.32.10.1 18-May-2008  yamt sync with head.
 1.32.8.2 01-Nov-2008  christos Sync with head.
 1.32.8.1 29-Mar-2008  christos Welcome to the time_t=long long dev_t=uint64_t branch.
 1.32.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.32.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.33.10.1 19-Jan-2009  skrll Sync with HEAD.
 1.33.4.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.33.4.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.33.2.1 04-May-2009  yamt sync with head.
 1.34.28.1 18-May-2014  rmind sync with head
 1.34.24.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.34.14.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.35.30.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.35.30.1 10-Jun-2019  christos Sync with HEAD
 1.35.28.3 22-Sep-2018  pgoyette #include "opt_compat_netbsd.h" for all sources that provide compat code.
 1.35.28.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.35.28.1 17-Apr-2018  pgoyette First pass at compat modules for 4.3BSD, NetBSD-0.9, and NetBSD-1.0

XXX Still need to deal with the sysctl stuff and other code shared
XXX between 09 and 43
 1.35.22.1 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1836):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.37.4.1 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.38.2.1 29-Feb-2020  ad Sync with head.
 1.26 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.25 11-Jan-2009  christos branches: 1.25.64; 1.25.66;
merge christos-time_t
 1.24 14-Nov-2008  ad _KERNEL_OPT
 1.23 20-Dec-2007  dsl branches: 1.23.6; 1.23.8; 1.23.12; 1.23.14; 1.23.18; 1.23.20;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.22 08-Dec-2007  dsl branches: 1.22.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.21 17-Jun-2007  dsl branches: 1.21.6; 1.21.8; 1.21.16;
Call semctl1() directly, not via stackgap and compat_14_sys___semctl().
 1.20 04-Mar-2007  christos branches: 1.20.2; 1.20.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.19 09-Feb-2007  ad branches: 1.19.2;
Merge newlock2 to head.
 1.18 10-Nov-2005  christos branches: 1.18.22;
Include new compat header.
 1.17 19-Nov-2003  christos branches: 1.17.16;
Don't include malloc.h if you are not going to use it.
 1.16 18-Jan-2003  thorpej branches: 1.16.2;
Merge the nathanw_sa branch.
 1.15 28-Sep-2002  scw Add !defined(_LP64) in the appropriate places to correspond with
sys/syscallargs.h.
 1.14 16-Mar-2002  christos make the stackgap_{init,alloc} functions MP friendly (i.e. pass struct proc *
in, instead of using curproc). While there add an optional size argument to
stackgap_init.
 1.13 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.12 27-Jul-2000  mrg branches: 1.12.2; 1.12.4;
fix LP64 warnings.
 1.11 28-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.10 26-Jun-2000  mrg remove/move more mach vm header files:

<vm/pglist.h> -> <uvm/uvm_pglist.h>
<vm/vm_inherit.h> -> <uvm/uvm_inherit.h>
<vm/vm_kern.h> -> into <uvm/uvm_extern.h>
<vm/vm_object.h> -> nothing
<vm/vm_pager.h> -> into <uvm/uvm_pager.h>

also includes a bunch of <vm/vm_page.h> include removals (due to redudancy
with <vm/vm.h>), and a scattering of other similar headers.
 1.9 25-Aug-1999  thorpej branches: 1.9.2;
Add compatibility calls for the 1.4 System V IPC *ctl() calls, and
update the 1.0 compat calls.
 1.8 19-Oct-1998  tron Defopt SYSVMSG, SYSVSEM and SYSVSHM.
 1.7 15-Aug-1998  mycroft Make copyright notices with my name consistent.
 1.6 05-Mar-1998  scottb Modified compat_10_sys_semsys to correctly read in a union arg (a5)
and pass a union pointer arg to sys___semctl
 1.5 22-Jan-1998  mycroft Fix an old typo that caused shmdt() to fail.
 1.4 07-Oct-1995  mycroft branches: 1.4.18;
Prefix names of system call implementation functions with `sys_'.
 1.3 19-Sep-1995  thorpej Make system calls conform to a standard prototype and bring those
prototypes into scope.
 1.2 10-Aug-1995  mycroft Make this compile if one of SYSV{SEM,SHM,MSG} is not defined.
 1.1 24-Jun-1995  christos - Extracted all compat routines from the kern directory and moved here.
- Created compat_util.c and compat_util.h to be used by the compatibility
modules, so they don't duplicate the same code.
- Added prototypes to the stackgap allocation routines.
 1.4.18.2 05-May-1998  mycroft Pull up 1.6, per request of scottb.
 1.4.18.1 29-Jan-1998  mellon Pull up 1.5 (mycroft)
 1.9.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.12.4.3 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.12.4.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.12.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.12.2.6 18-Oct-2002  nathanw Catch up to -current.
 1.12.2.5 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.12.2.4 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.12.2.3 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.12.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.12.2.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.16.2.4 11-Dec-2005  christos Sync with head.
 1.16.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.16.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.16.2.1 03-Aug-2004  skrll Sync with HEAD
 1.17.16.4 21-Jan-2008  yamt sync with head
 1.17.16.3 03-Sep-2007  yamt sync with head.
 1.17.16.2 26-Feb-2007  yamt sync with head.
 1.17.16.1 21-Jun-2006  yamt sync with head.
 1.18.22.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.19.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.20.4.1 11-Jul-2007  mjf Sync with head.
 1.20.2.1 15-Jul-2007  ad Sync with head.
 1.21.16.1 26-Dec-2007  ad Sync with head.
 1.21.8.1 09-Jan-2008  matt sync with HEAD
 1.21.6.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.22.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.23.20.1 19-Jan-2009  skrll Sync with HEAD.
 1.23.18.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.23.14.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.23.14.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.23.12.1 04-May-2009  yamt sync with head.
 1.23.8.3 20-Nov-2008  christos merge with head.
 1.23.8.2 09-Nov-2008  christos garbage collect all the conversion functions and put them in the header
files so that userland can share them. Also fix bugs in them!
 1.23.8.1 29-Mar-2008  christos Welcome to the time_t=long long dev_t=uint64_t branch.
 1.23.6.1 17-Jan-2009  mjf Sync with HEAD.
 1.25.66.1 10-Jun-2019  christos Sync with HEAD
 1.25.64.1 22-Sep-2018  pgoyette #include "opt_compat_netbsd.h" for all sources that provide compat code.
 1.6 12-Dec-2019  pgoyette Rather than keeping a separate mutex, condvar, and pserialize for each
module hook, we can share a common set of synchronization structures.
This cuts the amount of cacheline_aligned data for these structures by
50%.

Note that we still have a per-hook localcount, since we need to count
individual references.

As discussed with riastradh@

Welcome to 9.99.22 !
 1.5 01-Mar-2019  pgoyette branches: 1.5.4;
Rename the MODULE_*_HOOK() macros to MODULE_HOOK_*() as briefly
discussed on irc.

NFCI intended.

Ride the earlier kernel bump - it;s getting crowded.
 1.4 27-Jan-2019  pgoyette Include new header from correct directory
 1.3 27-Jan-2019  christos - autoload the compat_80 for modstat
- move compat struct to a compat header
 1.2 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.1 03-Apr-2018  pgoyette branches: 1.1.2;
file kern_mod_80.c was initially added on branch pgoyette-compat.
 1.1.2.8 23-Jan-2019  pgoyette Convert the macros for setting and unsetting a hook to generate
in-line code rather than using an intermediary hook##set routine.
Hooks are set and unset only in one place, so the intermediary
routine provides no benefit. IMHO using the macro at the point-
of-call is more readable than using it elsewhere in the code and
then calling the generated intermediary routine (for which you
won't even find its declaration or definition unless you remember
to search for the HOOK_SET macro instead).

NFC intended, will verify with a bulk build and an atf test run.
 1.1.2.7 22-Sep-2018  pgoyette #include "opt_compat_netbsd.h" for all sources that provide compat code.
 1.1.2.6 18-Sep-2018  pgoyette The COMPAT_HOOK macros were renamed to MODULE_HOOK, adjust all callers
 1.1.2.5 17-Sep-2018  pgoyette Adapt (most of) the indirect function pointers to the new MP-safe
mechanism. Still remaining are the compat_netbsd32 stuff, and
some usb subroutines.
 1.1.2.4 07-Sep-2018  pgoyette At the request of reviewers, remove the module alias functionality.

We will rely only on module names and duplicate-symbol detection to
detect module conflicts.
 1.1.2.3 06-Sep-2018  pgoyette Remove editor glitch
 1.1.2.2 06-Sep-2018  pgoyette Catch up to recent change on head: min() -> uimin()
 1.1.2.1 03-Apr-2018  pgoyette Remove fixed allocation of modules' "required" lists (previously
limited to MAXMODDEPS entries). Update the modctl(MODCTL_STAT)
syscall to return the required data in a new format, and retain
the previous data format in MODCTL_OSTAT. Update the compat_80
and compat_netbsd32 modules as needed.
 1.5.4.3 08-Apr-2020  martin Merge changes from current as of 20200406
 1.5.4.2 10-Jun-2019  christos Sync with HEAD
 1.5.4.1 01-Mar-2019  christos file kern_mod_80.c was added on branch phil-wifi on 2019-06-10 22:06:58 +0000
 1.4 23-Jun-1996  mycroft Remove the old (broken) setre[ug]id() emulation.
 1.3 07-Oct-1995  mycroft branches: 1.3.6;
Prefix names of system call implementation functions with `sys_'.
 1.2 19-Sep-1995  thorpej Make system calls conform to a standard prototype and bring those
prototypes into scope.
 1.1 24-Jun-1995  christos - Extracted all compat routines from the kern directory and moved here.
- Created compat_util.c and compat_util.h to be used by the compatibility
modules, so they don't duplicate the same code.
- Added prototypes to the stackgap allocation routines.
 1.3.6.1 10-Dec-1996  mycroft From trunk:
Implement setre[ug]id() for real.
 1.23 07-Sep-2021  riastradh sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.22 27-Jan-2019  pgoyette branches: 1.22.4;
Merge the [pgoyette-compat] branch
 1.21 20-Dec-2007  dsl branches: 1.21.12; 1.21.90; 1.21.96; 1.21.98;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.20 12-May-2007  dsl branches: 1.20.8; 1.20.16; 1.20.20;
There is no need to use the stackgap for get/setrlimit.
 1.19 04-Mar-2007  christos branches: 1.19.2; 1.19.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.18 09-Feb-2007  ad branches: 1.18.2;
Merge newlock2 to head.
 1.17 16-Nov-2006  christos __unused removal on arguments; approved by core.
 1.16 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.15 23-Jul-2006  ad branches: 1.15.4; 1.15.6;
Use the LWP cached credentials where sane.
 1.14 11-Dec-2005  christos branches: 1.14.4; 1.14.8;
merge ktrace-lwp.
 1.13 29-May-2005  christos branches: 1.13.2;
- sprinkle const.
- add XXXUNCONST to the emul_find() pbuf argument free'ing. XXX: this needs
an api change.
- avoid variable shadowing.
 1.12 19-Nov-2003  christos Don't include malloc.h if you are not going to use it.
 1.11 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.10 18-Jan-2003  thorpej branches: 1.10.2;
Merge the nathanw_sa branch.
 1.9 13-Nov-2001  lukem branches: 1.9.12;
add RCSIDs (including regeneration of files as appropriate)
 1.8 28-Jun-2000  mrg branches: 1.8.2; 1.8.4;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.7 30-Mar-2000  augustss Kill register declarations.
 1.6 28-Sep-1999  bouyer branches: 1.6.2;
Remplace kern.shortcorename sysctl with a more flexible sheme,
core filename format, which allow to change the name of the core dump,
and to relocate it in a directory. Credits to Bill Sommerfeld for giving me
the idea :)
The default core filename format can be changed by options DEFCORENAME and/or
kern.defcorename
Create a new sysctl tree, proc, which holds per-process values (for now
the corename format, and resources limits). Process is designed by its pid
at the second level name. These values are inherited on fork, and the corename
fomat is reset to defcorename on suid/sgid exec.
Create a p_sugid() function, to take appropriate actions on suid/sgid
exec (for now set the P_SUGID flag and reset the per-proc corename).
Adjust dosetrlimit() to allow changing limits of one proc by another, with
credential controls.
 1.5 15-Oct-1997  mycroft Adjust u_int arguments of some system calls to int, to match user-level
prototypes.
 1.4 14-Mar-1996  christos Fix compiler warnings
 1.3 07-Oct-1995  mycroft Prefix names of system call implementation functions with `sys_'.
 1.2 19-Sep-1995  thorpej Make system calls conform to a standard prototype and bring those
prototypes into scope.
 1.1 24-Jun-1995  christos - Extracted all compat routines from the kern directory and moved here.
- Created compat_util.c and compat_util.h to be used by the compatibility
modules, so they don't duplicate the same code.
- Added prototypes to the stackgap allocation routines.
 1.6.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.8.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.8.2.4 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.8.2.3 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.8.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.8.2.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.9.12.1 18-Dec-2002  gmcgarry Merge pcred and ucred, and poolify. TBD: check backward compatibility
and factor-out some higher-level functionality.
 1.10.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.10.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.10.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.10.2.1 03-Aug-2004  skrll Sync with HEAD
 1.13.2.4 21-Jan-2008  yamt sync with head
 1.13.2.3 03-Sep-2007  yamt sync with head.
 1.13.2.2 26-Feb-2007  yamt sync with head.
 1.13.2.1 30-Dec-2006  yamt sync with head.
 1.14.8.1 11-Aug-2006  yamt sync with head
 1.14.4.1 09-Sep-2006  rpaulo sync with head
 1.15.6.2 10-Dec-2006  yamt sync with head.
 1.15.6.1 22-Oct-2006  yamt sync with head
 1.15.4.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.15.4.1 18-Nov-2006  ad Sync with head.
 1.18.2.2 17-May-2007  yamt sync with head.
 1.18.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.19.4.1 11-Jul-2007  mjf Sync with head.
 1.19.2.1 27-May-2007  ad Sync with head.
 1.20.20.1 02-Jan-2008  bouyer Sync with HEAD
 1.20.16.1 26-Dec-2007  ad Sync with head.
 1.20.8.1 09-Jan-2008  matt sync with HEAD
 1.21.98.1 10-Jun-2019  christos Sync with HEAD
 1.21.96.2 22-Sep-2018  pgoyette #include "opt_compat_netbsd.h" for all sources that provide compat code.
 1.21.96.1 17-Apr-2018  pgoyette First pass at compat modules for 4.3BSD, NetBSD-0.9, and NetBSD-1.0

XXX Still need to deal with the sysctl stuff and other code shared
XXX between 09 and 43
 1.21.90.1 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1836):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.21.12.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.21.12.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.22.4.1 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.2 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.1 19-Feb-2012  matt branches: 1.1.2; 1.1.4; 1.1.42; 1.1.44;
Add compat_60 stub for the SA syscall (all which just call sys_nosys).
 1.1.44.1 10-Jun-2019  christos Sync with HEAD
 1.1.42.4 22-Sep-2018  pgoyette #include "opt_compat_netbsd.h" for all sources that provide compat code.
 1.1.42.3 18-Mar-2018  pgoyette Clean-up for kern_cpu_60 code.

Also, although not strictly necessary, include the kern_sa_60 stuff in
the compat_60 module, for completeness.

Still need to deal with some tty code and the ccd driver to finish off
the compat_60 module.
 1.1.42.2 16-Mar-2018  pgoyette Move closer to getting a compat_60 module - still needs more work
 1.1.42.1 16-Mar-2018  pgoyette Initial pass at setting up the compat_60 module.

XXX needs some work to properly handle cpu_ucode stuff.

While here, move details of compat_70 init/fini routines into the
module itself.
 1.1.4.2 17-Apr-2012  yamt sync with head
 1.1.4.1 19-Feb-2012  yamt file kern_sa_60.c was added on branch yamt-pagecache on 2012-04-17 00:07:14 +0000
 1.1.2.2 24-Feb-2012  mrg sync to -current.
 1.1.2.1 19-Feb-2012  mrg file kern_sa_60.c was added on branch jmcneill-usbmp on 2012-02-24 09:11:38 +0000
 1.4 28-Jul-2023  christos Add epoll(2) from Theodore Preduta as part of GSoC 2023
 1.3 20-Sep-2019  kamil Validate usec ranges in compat_50_sys_select()

Later in the code selcommon() checks for proper timespec, check only
correct usec of timeval before type conversions.
 1.2 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.1 17-Jan-2011  pooka branches: 1.1.4; 1.1.8; 1.1.60; 1.1.62;
Put async i/o compat routines in a separate source module from the
ones related to clock and process management.
 1.1.62.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.1.62.1 10-Jun-2019  christos Sync with HEAD
 1.1.60.2 22-Sep-2018  pgoyette #include "opt_compat_netbsd.h" for all sources that provide compat code.
 1.1.60.1 19-Mar-2018  pgoyette Initial pass at a COMPAT_50 module. More to come.
 1.1.8.2 06-Jun-2011  jruoho Sync with HEAD.
 1.1.8.1 17-Jan-2011  jruoho file kern_select_50.c was added on branch jruoho-x86intr on 2011-06-06 09:07:15 +0000
 1.1.4.2 05-Mar-2011  rmind sync with head
 1.1.4.1 17-Jan-2011  rmind file kern_select_50.c was added on branch rmind-uvmplock on 2011-03-05 20:52:38 +0000
 1.22 07-Sep-2021  riastradh sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.21 27-Jan-2019  pgoyette branches: 1.21.4;
Merge the [pgoyette-compat] branch
 1.20 19-Jan-2011  tsutsui branches: 1.20.50; 1.20.56; 1.20.58;
Remove includes <sys/mount.h> and <sys/sched.h> added for <sys/syscallargs.h>.
Now they are handled by $sysarghdrextra in sys/kern/syscalls.conf.
 1.19 28-Apr-2008  martin branches: 1.19.2; 1.19.22; 1.19.28;
Remove clause 3 and 4 from TNF licenses
 1.18 24-Apr-2008  ad branches: 1.18.2;
Merge proc::p_mutex and proc::p_smutex into a single adaptive mutex, since
we no longer need to guard against access from hardware interrupt handlers.

Additionally, if cloning a process with CLONE_SIGHAND, arrange to have the
child process share the parent's lock so that signal state may be kept in
sync. Partially addresses PR kern/37437.
 1.17 20-Dec-2007  dsl branches: 1.17.6; 1.17.8;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.16 08-Dec-2007  dsl branches: 1.16.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.15 16-Jun-2007  dsl branches: 1.15.6; 1.15.8; 1.15.16;
Modify the (recently added) compat_sigaltstack() #define to take the
values of the SS_ONSTACK and SS_DISABLE constants.
Use it to shorten the source files when this action is replicated.
Actually, given the monstrous complexity of sigaltstack1() there is
probably a much better way to do this...
 1.14 09-Feb-2007  ad branches: 1.14.6; 1.14.8;
Merge newlock2 to head.
 1.13 16-Nov-2006  christos __unused removal on arguments; approved by core.
 1.12 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.11 11-Dec-2005  christos branches: 1.11.20; 1.11.22;
merge ktrace-lwp.
 1.10 13-Sep-2005  christos compat code reorg.
 1.9 18-Jan-2003  thorpej branches: 1.9.2; 1.9.18;
Merge the nathanw_sa branch.
 1.8 26-Nov-2002  christos rename: s/sa_/<compat>sa/g
 1.7 04-Jul-2002  thorpej Add kernel support for having userland provide the signal trampoline:

* struct sigacts gets a new sigact_sigdesc structure, which has the
sigaction and the trampoline/version. Version 0 means "legacy kernel
provided trampoline". Other versions are coordinated with machine-
dependent code in libc.
* sigaction1() grows two more arguments -- the trampoline pointer and
the trampoline version.
* A new __sigaction_sigtramp() system call is provided to register a
trampoline along with a signal handler.
* The handler is no longer passed to sensig() functions. Instead,
sendsig() looks up the handler by peeking in the sigacts for the
process getting the signal (since it has to look in there for the
trampoline anyway).
* Native sendsig() functions now select the appropriate trampoline and
its arguments based on the trampoline version in the sigacts.

Changes to libc to use the new facility will be checked in later. Kernel
version not bumped; we will ride the 1.6C bump made recently.
 1.6 13-Nov-2001  lukem branches: 1.6.8;
add RCSIDs (including regeneration of files as appropriate)
 1.5 30-Mar-2000  augustss branches: 1.5.6; 1.5.8;
Kill register declarations.
 1.4 13-Sep-1998  thorpej branches: 1.4.12;
Put the prototypes for native_sig*_to_sig*() in one place.
 1.3 11-Sep-1998  mycroft Substantial signal handling changes:
* Increase the size of sigset_t to accomodate 128 signals -- adding new
versions of sys_setprocmask(), sys_sigaction(), sys_sigpending() and
sys_sigsuspend() to handle the changed arguments.
* Abstract the guts of sys_sigaltstack(), sys_setprocmask(), sys_sigaction(),
sys_sigpending() and sys_sigsuspend() into separate functions, and call them
from all the emulations rather than hard-coding everything. (Avoids uses
the stackgap crap for these system calls.)
* Add a new flag (p_checksig) to indicate that a process may have signals
pending and userret() needs to do the full (slow) check.
* Eliminate SAS_ALTSTACK; it's exactly the inverse of SS_DISABLE.
* Correct emulation bugs with restoring SS_ONSTACK.
* Make the signal mask in the sigcontext always use the emulated mask format.
* Store signals internally in sigaction structures, rather than maintaining a
bunch of little sigsets for each SA_* bit.
* Keep track of where we put the signal trampoline, rather than figuring it out
in *_sendsig().
* Issue a warning when a non-emulated sigaction bit is observed.
* Add missing emulated signals, and a native SIGPWR (currently not used).
* Implement the `not reset when caught' semantics for relevant signals.

Note: Only code touched by the i386 port has been modified. Other ports and
emulations need to be updated.
 1.2 29-Nov-1997  kleink Modify the recent sigaltstack() interface change to use the __RENAME() scheme;
add __sigaltstack14().
 1.1 25-Nov-1997  kleink In XPG4.2, the ss_size member of type stack_t (struct sigaltstack) is specified
to be of type size_t; since this imposes an interface change on the Alpha
(sizeof(int) != sizeof(size_t)), allocate a new system call number and make
the previous version a compatibility system call.
 1.4.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.5.8.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.5.8.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.5.6.6 11-Dec-2002  thorpej Sync with HEAD.
 1.5.6.5 01-Aug-2002  nathanw Catch up to -current.
 1.5.6.4 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.5.6.3 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.5.6.2 14-Nov-2001  nathanw Catch up to -current.
 1.5.6.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.6.8.1 15-Jul-2002  gehenna catch up with -current.
 1.9.18.4 21-Jan-2008  yamt sync with head
 1.9.18.3 03-Sep-2007  yamt sync with head.
 1.9.18.2 26-Feb-2007  yamt sync with head.
 1.9.18.1 21-Jun-2006  yamt sync with head.
 1.9.2.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.11.22.2 10-Dec-2006  yamt sync with head.
 1.11.22.1 22-Oct-2006  yamt sync with head
 1.11.20.3 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.11.20.2 11-Jan-2007  ad Checkpoint work in progress.
 1.11.20.1 21-Oct-2006  ad Checkpoint work in progress on locking and per-LWP signals. Very much a
a work in progress and there is still a lot to do.
 1.14.8.1 11-Jul-2007  mjf Sync with head.
 1.14.6.1 15-Jul-2007  ad Sync with head.
 1.15.16.1 26-Dec-2007  ad Sync with head.
 1.15.8.1 09-Jan-2008  matt sync with HEAD
 1.15.6.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.16.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.17.8.1 18-May-2008  yamt sync with head.
 1.17.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.18.2.1 16-May-2008  yamt sync with head.
 1.19.28.1 06-Jun-2011  jruoho Sync with HEAD.
 1.19.22.1 05-Mar-2011  rmind sync with head
 1.19.2.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.19.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.20.58.1 10-Jun-2019  christos Sync with HEAD
 1.20.56.2 22-Sep-2018  pgoyette #include "opt_compat_netbsd.h" for all sources that provide compat code.
 1.20.56.1 30-Mar-2018  pgoyette Add compat_13 module
 1.20.50.1 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1836):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.21.4.1 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.10 10-Dec-2024  mlelstv It's __aarch64__, not __arch64__.
 1.9 22-Nov-2024  mlelstv Crude patch to allow building and loading of compat_16 and compat_netbsd32_16 code
on aarch64.
 1.8 02-Dec-2021  ryo branches: 1.8.10;
don't call MODULE_HOOK_SET(), if exec_sigcode_alloc() fails.
 1.7 26-Nov-2021  ryo Fix anonymous memory object leak for sigcode.

- Repeating "modload compat_linux && /emul/linux/bin/ls && modunload compat_linux"
will reproduce this problem.
- It cause in exec_sigcode_map(), anon-object for sigcode was created at
first exec, but it remained even after exec_remove.
- Fixed that the anon-object for sigcode is created at exec_add(), and the
anon-object reference is removed at exec_remove().
- sigobject_lock is no longer needed since it is locked by exec_lock.
- The compat_16 module rewrites the e_sigcode entry in emul_netbsd directly and
does not use exec_add()/exec_remove(), so it needs to call
sigcode_alloc()/sigcode_free() on its own.
 1.6 23-May-2020  ad Move proc_lock into the data segment. It was dynamically allocated because
at the time we had mutex_obj_alloc() but not __cacheline_aligned.
 1.5 12-Dec-2019  pgoyette Rather than keeping a separate mutex, condvar, and pserialize for each
module hook, we can share a common set of synchronization structures.
This cuts the amount of cacheline_aligned data for these structures by
50%.

Note that we still have a per-hook localcount, since we need to count
individual references.

As discussed with riastradh@

Welcome to 9.99.22 !
 1.4 10-Nov-2019  pgoyette Convert the sendsig_sigcontext_16 function pointer to use the new
compat_hook mechanism.

XXX Despite being a kernel<-->module abi change, this should be
XXX pulled up to -9
 1.3 27-Jan-2019  pgoyette branches: 1.3.4;
Merge the [pgoyette-compat] branch
 1.2 19-Feb-2012  rmind branches: 1.2.38; 1.2.40;
Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.
 1.1 14-Nov-2008  ad branches: 1.1.4; 1.1.6; 1.1.8; 1.1.12; 1.1.24; 1.1.28;
- Move some more compat code into sys/compat.
- Split 4.3BSD ifioctl stuff into its own file.
- Remove some ifdefs that include small fragments of vfs compat code
which are difficult to relocate elsewhere.
 1.1.28.1 24-Feb-2012  mrg sync to -current.
 1.1.24.1 17-Apr-2012  yamt sync with head
 1.1.12.2 04-May-2009  yamt sync with head.
 1.1.12.1 14-Nov-2008  yamt file kern_sig_16.c was added on branch yamt-nfs-mp on 2009-05-04 08:12:17 +0000
 1.1.8.2 19-Jan-2009  skrll Sync with HEAD.
 1.1.8.1 14-Nov-2008  skrll file kern_sig_16.c was added on branch nick-hppapmap on 2009-01-19 13:17:17 +0000
 1.1.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.1.6.1 14-Nov-2008  mjf file kern_sig_16.c was added on branch mjf-devfs2 on 2009-01-17 13:28:41 +0000
 1.1.4.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.1.4.1 14-Nov-2008  haad file kern_sig_16.c was added on branch haad-dm on 2008-12-13 01:13:47 +0000
 1.2.40.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.2.40.1 10-Jun-2019  christos Sync with HEAD
 1.2.38.4 22-Sep-2018  pgoyette #include "opt_compat_netbsd.h" for all sources that provide compat code.
 1.2.38.3 04-May-2018  pgoyette Add comment to note that compat_16_sigreturn14 is in MD code!
 1.2.38.2 17-Apr-2018  pgoyette Finish separating the compat_09 and compat_43 stuff
 1.2.38.1 30-Mar-2018  pgoyette Create and build a compat_16 module
 1.3.4.1 11-Nov-2019  martin Pull up following revision(s) (requested by pgoyette in ticket #413):

sys/kern/kern_core.c: revision 1.27 (patch)
sys/kern/kern_sig.c: revision 1.377 (patch)
sys/kern/kern_sig.c: revision 1.378 (patch)
sys/kern/sys_sig.c: revision 1.50
sys/kern/sys_ptrace_common.c: revision 1.70
sys/kern/compat_stub.c: revision 1.16
sys/compat/common/kern_sig_16.c: revision 1.4
sys/kern/compat_stub.c: revision 1.17
sys/sys/compat_stub.h: revision 1.20
sys/sys/signalvar.h: revision 1.98
sys/sys/compat_stub.h: revision 1.21
sys/sys/signalvar.h: revision 1.99

Convert the sendsig_sigcontext_16 function pointer to use the new
compat_hook mechanism.
XXX Despite being a kernel<-->module abi change, this should be
XXX pulled up to -9

-

Convert the coredump_vec modular function pointer to use the new
compat_hook mechanism.
XXX Should be pulled up to -9 despite the kernel <--> module ABI
XXX change.
 1.8.10.1 02-Aug-2025  perseant Sync with HEAD
 1.38 01-Nov-2021  thorpej Use "stack_t" instead of "struct sigaltstack", as the former is the
newer standardized name. NFC.
 1.37 07-Sep-2021  riastradh sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.36 01-Jan-2020  maxv Fix three stack info leaks, found by kMSan when just invoking all syscalls
with a zero page as argument.

MSan: Uninitialized Stack Memory In copyout() At Offset 0, Variable 'sb32' From compat_20_netbsd32_getfsstat()
MSan: Uninitialized Stack Memory In copyout() At Offset 12, Variable 'oss' From compat_43_sys_sigstack()
MSan: Uninitialized Stack Memory In copyout() At Offset 0, Variable 'sb' From compat_50_netbsd32___fhstat40()
 1.35 27-Jan-2019  pgoyette branches: 1.35.4;
Merge the [pgoyette-compat] branch
 1.34 19-Jan-2011  tsutsui branches: 1.34.32; 1.34.44; 1.34.50; 1.34.56; 1.34.58;
Remove includes <sys/mount.h> and <sys/sched.h> added for <sys/syscallargs.h>.
Now they are handled by $sysarghdrextra in sys/kern/syscalls.conf.
 1.33 23-Nov-2009  rmind branches: 1.33.4; 1.33.6;
Use lwp_getpcb() in compat code, clean from struct user.
 1.32 28-Apr-2008  martin branches: 1.32.2;
Remove clause 3 and 4 from TNF licenses
 1.31 24-Apr-2008  ad branches: 1.31.2;
Merge proc::p_mutex and proc::p_smutex into a single adaptive mutex, since
we no longer need to guard against access from hardware interrupt handlers.

Additionally, if cloning a process with CLONE_SIGHAND, arrange to have the
child process share the parent's lock so that signal state may be kept in
sync. Partially addresses PR kern/37437.
 1.30 20-Dec-2007  dsl branches: 1.30.6; 1.30.8;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.29 08-Dec-2007  dsl branches: 1.29.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.28 04-Dec-2007  dsl Remove all the __P
 1.27 19-Oct-2007  ad branches: 1.27.2; 1.27.4;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.26 09-Feb-2007  ad branches: 1.26.6; 1.26.18; 1.26.20; 1.26.24;
Merge newlock2 to head.
 1.25 16-Nov-2006  christos __unused removal on arguments; approved by core.
 1.24 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.23 23-Jul-2006  ad branches: 1.23.4; 1.23.6;
Use the LWP cached credentials where sane.
 1.22 14-May-2006  elad integrate kauth.
 1.21 11-Dec-2005  christos branches: 1.21.4; 1.21.6; 1.21.8; 1.21.10; 1.21.12;
merge ktrace-lwp.
 1.20 13-Sep-2005  christos compat code reorg.
 1.19 06-Sep-2003  christos branches: 1.19.16;
SA_SIGINFO changes
 1.18 18-Jan-2003  thorpej branches: 1.18.2;
Merge the nathanw_sa branch.
 1.17 04-Jul-2002  thorpej Add kernel support for having userland provide the signal trampoline:

* struct sigacts gets a new sigact_sigdesc structure, which has the
sigaction and the trampoline/version. Version 0 means "legacy kernel
provided trampoline". Other versions are coordinated with machine-
dependent code in libc.
* sigaction1() grows two more arguments -- the trampoline pointer and
the trampoline version.
* A new __sigaction_sigtramp() system call is provided to register a
trampoline along with a signal handler.
* The handler is no longer passed to sensig() functions. Instead,
sendsig() looks up the handler by peeking in the sigacts for the
process getting the signal (since it has to look in there for the
trampoline anyway).
* Native sendsig() functions now select the appropriate trampoline and
its arguments based on the trampoline version in the sigacts.

Changes to libc to use the new facility will be checked in later. Kernel
version not bumped; we will ride the 1.6C bump made recently.
 1.16 13-Nov-2001  lukem branches: 1.16.8;
add RCSIDs (including regeneration of files as appropriate)
 1.15 30-May-2001  mrg branches: 1.15.2;
use _KERNEL_OPT.
 1.14 17-Dec-2000  jdolecek branches: 1.14.2;
make LKM safe
 1.13 28-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.12 30-Mar-2000  augustss Kill register declarations.
 1.11 29-Apr-1999  christos branches: 1.11.2;
Make ss_size something reasonable (not 0) so sigaltstack does not fail.
Pull me up plz!
 1.10 14-Sep-1998  pk branches: 1.10.6;
Fix copyout() arguments.
 1.9 11-Sep-1998  mycroft Substantial signal handling changes:
* Increase the size of sigset_t to accomodate 128 signals -- adding new
versions of sys_setprocmask(), sys_sigaction(), sys_sigpending() and
sys_sigsuspend() to handle the changed arguments.
* Abstract the guts of sys_sigaltstack(), sys_setprocmask(), sys_sigaction(),
sys_sigpending() and sys_sigsuspend() into separate functions, and call them
from all the emulations rather than hard-coding everything. (Avoids uses
the stackgap crap for these system calls.)
* Add a new flag (p_checksig) to indicate that a process may have signals
pending and userret() needs to do the full (slow) check.
* Eliminate SAS_ALTSTACK; it's exactly the inverse of SS_DISABLE.
* Correct emulation bugs with restoring SS_ONSTACK.
* Make the signal mask in the sigcontext always use the emulated mask format.
* Store signals internally in sigaction structures, rather than maintaining a
bunch of little sigsets for each SA_* bit.
* Keep track of where we put the signal trampoline, rather than figuring it out
in *_sendsig().
* Issue a warning when a non-emulated sigaction bit is observed.
* Add missing emulated signals, and a native SIGPWR (currently not used).
* Implement the `not reset when caught' semantics for relevant signals.

Note: Only code touched by the i386 port has been modified. Other ports and
emulations need to be updated.
 1.8 05-Jul-1998  jonathan * defopt COMPAT_{09,10,11,12,13} and COMPAT_NOMID.
TODO: revisit interaction between native compat and emul compat usage.
 1.7 14-Mar-1996  christos branches: 1.7.14;
Fix compiler warnings
 1.6 04-Jan-1996  jtc Changed name of sigaltstack's ss_base field to ss_sp to match XPG4.2 and
traditional usage.
 1.5 07-Oct-1995  mycroft Prefix names of system call implementation functions with `sys_'.
 1.4 19-Sep-1995  thorpej Make system calls conform to a standard prototype and bring those
prototypes into scope.
 1.3 17-Aug-1995  mycroft Update for signal handling changes.
 1.2 15-Aug-1995  mycroft Rename ss_flags bits.
 1.1 24-Jun-1995  christos - Extracted all compat routines from the kern directory and moved here.
- Created compat_util.c and compat_util.h to be used by the compatibility
modules, so they don't duplicate the same code.
- Added prototypes to the stackgap allocation routines.
 1.7.14.1 08-Sep-1997  thorpej Significantly restructure the way signal state for a process is stored.
Rather than using bitmasks to redundantly store the information kept
in the process's sigacts (because the sigacts was kept in the u-area),
hang sigacts directly off the process, and access it directly.

Simplify signal setup code tremendously by storing information in
the sigacts as an array of struct sigactions, rather than in a different
format, since userspace uses sigactions.

Make sigacts sharable by adding reference counting.
 1.10.6.1 30-Apr-1999  perry branches: 1.10.6.1.2;
pullup 1.10->1.11 (christos)
 1.10.6.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.11.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.11.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.14.2.6 01-Aug-2002  nathanw Catch up to -current.
 1.14.2.5 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.14.2.4 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.14.2.3 14-Nov-2001  nathanw Catch up to -current.
 1.14.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.14.2.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.15.2.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.15.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.16.8.1 15-Jul-2002  gehenna catch up with -current.
 1.18.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.18.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.18.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.18.2.1 03-Aug-2004  skrll Sync with HEAD
 1.19.16.6 21-Jan-2008  yamt sync with head
 1.19.16.5 07-Dec-2007  yamt sync with head
 1.19.16.4 27-Oct-2007  yamt sync with head.
 1.19.16.3 26-Feb-2007  yamt sync with head.
 1.19.16.2 30-Dec-2006  yamt sync with head.
 1.19.16.1 21-Jun-2006  yamt sync with head.
 1.21.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.21.10.2 06-May-2006  christos - Move kauth_cred_t declaration to <sys/types.h>
- Cleanup struct ucred; forward declarations that are unused.
- Don't include <sys/kauth.h> in any header, but include it in the c files
that need it.

Approved by core.
 1.21.10.1 08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.21.8.2 11-Aug-2006  yamt sync with head
 1.21.8.1 24-May-2006  yamt sync with head.
 1.21.6.1 01-Jun-2006  kardel Sync with head.
 1.21.4.1 09-Sep-2006  rpaulo sync with head
 1.23.6.2 10-Dec-2006  yamt sync with head.
 1.23.6.1 22-Oct-2006  yamt sync with head
 1.23.4.3 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.23.4.2 11-Jan-2007  ad Checkpoint work in progress.
 1.23.4.1 21-Oct-2006  ad Checkpoint work in progress on locking and per-LWP signals. Very much a
a work in progress and there is still a lot to do.
 1.26.24.1 25-Oct-2007  bouyer Sync with HEAD.
 1.26.20.2 09-Jan-2008  matt sync with HEAD
 1.26.20.1 06-Nov-2007  matt sync with HEAD
 1.26.18.2 09-Dec-2007  jmcneill Sync with HEAD.
 1.26.18.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.26.6.1 23-Oct-2007  ad Sync with head.
 1.27.4.2 26-Dec-2007  ad Sync with head.
 1.27.4.1 08-Dec-2007  ad Sync with head.
 1.27.2.2 27-Dec-2007  mjf Sync with HEAD.
 1.27.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.29.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.30.8.1 18-May-2008  yamt sync with head.
 1.30.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.31.2.2 11-Mar-2010  yamt sync with head
 1.31.2.1 16-May-2008  yamt sync with head.
 1.32.2.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.32.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.33.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.33.4.1 05-Mar-2011  rmind sync with head
 1.34.58.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.34.58.1 10-Jun-2019  christos Sync with HEAD
 1.34.56.2 17-Apr-2018  pgoyette Finish separating the compat_09 and compat_43 stuff
 1.34.56.1 17-Apr-2018  pgoyette First pass at compat modules for 4.3BSD, NetBSD-0.9, and NetBSD-1.0

XXX Still need to deal with the sysctl stuff and other code shared
XXX between 09 and 43
 1.34.50.2 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1836):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.34.50.1 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1487:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.34.44.1 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1720:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149 (patch)
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54 (patch)

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.34.32.1 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1720:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149 (patch)
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54 (patch)

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.35.4.2 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.35.4.1 02-Jan-2020  martin Pull up following revision(s) (requested by maxv in ticket #597):

sys/compat/common/kern_sig_43.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.39
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.59
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.44

Fix sizeof mismatch in copyin. This leads to a user-triggerable stack
overflow. On my test build at least, by luck, the compiler orders the
variables in a way that the overflow hits only local structures which
haven't yet been initialized and used, so the overflow is harmless.

Very easily seeable with kASan - just invoke the syscall from a 32bit
binary.

Fix three stack info leaks, found by kMSan when just invoking all syscalls
with a zero page as argument.

MSan: Uninitialized Stack Memory In copyout() At Offset 0, Variable 'sb32' From compat_20_netbsd32_getfsstat()
MSan: Uninitialized Stack Memory In copyout() At Offset 12, Variable 'oss' From compat_43_sys_sigstack()
MSan: Uninitialized Stack Memory In copyout() At Offset 0, Variable 'sb' From compat_50_netbsd32___fhstat40()
 1.8 15-Dec-2019  tsutsui Remove clause 3 and 4 leftovers from TNF licenses in more sources.

Confirmed by martin@ in PR/54760.
 1.7 27-Jan-2019  pgoyette branches: 1.7.4;
Merge the [pgoyette-compat] branch
 1.6 30-Oct-2018  riastradh Paranoia: zero COMPAT_30 ntptimeval and 32-bit ntptimeval too.

These structs don't have padding but safer to keep the code
structured the same way between the various ntp_gettimes in case
anyone makes more copypasta of it for future updates.
 1.5 03-Nov-2016  riastradh branches: 1.5.8; 1.5.14; 1.5.16;
Sprinkle #ifdef _KERNEL_OPT.
 1.4 19-Jan-2011  tsutsui branches: 1.4.16; 1.4.34; 1.4.38;
Remove includes <sys/mount.h> and <sys/sched.h> added for <sys/syscallargs.h>.
Now they are handled by $sysarghdrextra in sys/kern/syscalls.conf.
 1.3 11-Jan-2009  tsutsui branches: 1.3.2; 1.3.4; 1.3.10; 1.3.12;
<sys/syscallargs.h> requires <sys/sched.h> for cpuset_t.
 1.2 11-Jan-2009  christos merge christos-time_t
 1.1 29-Mar-2008  christos branches: 1.1.2; 1.1.6;
file kern_time_30.c was initially added on branch christos-time_t.
 1.1.6.1 04-May-2009  yamt sync with head.
 1.1.2.1 29-Mar-2008  christos new files
 1.3.12.1 06-Jun-2011  jruoho Sync with HEAD.
 1.3.10.1 05-Mar-2011  rmind sync with head
 1.3.4.2 19-Jan-2009  skrll Sync with HEAD.
 1.3.4.1 11-Jan-2009  skrll file kern_time_30.c was added on branch nick-hppapmap on 2009-01-19 13:17:17 +0000
 1.3.2.2 17-Jan-2009  mjf Sync with HEAD.
 1.3.2.1 11-Jan-2009  mjf file kern_time_30.c was added on branch mjf-devfs2 on 2009-01-17 13:28:41 +0000
 1.4.38.1 04-Nov-2016  pgoyette Sync with HEAD
 1.4.34.1 05-Dec-2016  skrll Sync with HEAD
 1.4.16.1 03-Dec-2017  jdolecek update from HEAD
 1.5.16.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.5.16.1 10-Jun-2019  christos Sync with HEAD
 1.5.14.3 26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.5.14.2 22-Sep-2018  pgoyette #include "opt_compat_netbsd.h" for all sources that provide compat code.
 1.5.14.1 28-Mar-2018  pgoyette Initial pass at a compat_30 module.

Still needs some work for dev/vnd and various dev/usb/*
 1.5.8.1 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1839):

sys/compat/common/kern_time_30.c: revision 1.6
sys/compat/netbsd32/netbsd32_time.c: revision 1.50

Paranoia: zero COMPAT_30 ntptimeval and 32-bit ntptimeval too.

These structs don't have padding but safer to keep the code
structured the same way between the various ntp_gettimes in case
anyone makes more copypasta of it for future updates.
 1.7.4.1 18-Dec-2019  martin Pull up following revision(s) (requested by tsutsui in ticket #570):

sys/compat/netbsd32/netbsd32_compat_50_sysv.c: revision 1.3
sys/dev/raidframe/rf_compat50.h: revision 1.6
sys/arch/emips/emips/bus_space.c: revision 1.3
sys/compat/net/if.h: revision 1.5
sys/arch/emips/stand/common/bootinfo.c: revision 1.2
sys/compat/common/sysv_msg_50.c: revision 1.5
sys/compat/common/kern_time_30.c: revision 1.8
sys/arch/emips/stand/common/bootinfo.h: revision 1.2
sys/arch/ia64/include/bus.h: revision 1.4
sys/arch/ia64/ia64/bus_space.c: revision 1.2
sys/compat/common/sysv_shm_50.c: revision 1.5
sys/dev/ic/adw.h: revision 1.15
sys/compat/common/uipc_syscalls_50.c: revision 1.10
sys/arch/emips/ebus/flash_ebus.c: revision 1.22
sys/dev/ic/adv.h: revision 1.15
sys/dev/ic/adwmcode.c: revision 1.18
sys/dev/ic/advlib.c: revision 1.29
sys/arch/hpcarm/include/kloader.h: revision 1.3
sys/dev/usb/uberry.c: revision 1.16
sys/compat/common/sysv_sem_50.c: revision 1.5
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.43
sys/dev/ic/advlib.h: revision 1.21
sys/dev/ic/adv.c: revision 1.50
sys/compat/netinet6/in6_var.h: revision 1.5
sys/arch/hpc/stand/hpcboot/arm/arm_sa1100_asm.asm: revision 1.2
sys/arch/emips/include/loadfile_machdep.h: revision 1.3
sys/arch/emips/stand/common/prom_iface.c: revision 1.7
sys/dev/ic/adw.c: revision 1.56
sys/dev/ic/adwmcode.h: revision 1.12
sys/dev/ic/advmcode.c: revision 1.10
sys/arch/emips/ebus/ace_ebus.c: revision 1.22
sys/compat/netbsd32/netbsd32_compat_60.c: revision 1.5
sys/dev/raidframe/rf_compat50.c: revision 1.13
sys/arch/x68k/dev/intiovar.h: revision 1.15
sys/dev/usb/uipad.c: revision 1.8
sys/arch/zaurus/include/kloader.h: revision 1.3
sys/arch/emips/stand/common/bootxx.c: revision 1.2
sys/dev/ic/adwlib.h: revision 1.23
sys/dev/ic/adwlib.c: revision 1.44
sys/compat/netbsd32/netbsd32_compat_16.c: revision 1.3
sys/arch/amigappc/include/intr.h: revision 1.27
sys/arch/x68k/dev/mfp.c: revision 1.27
sys/arch/arm/at91/at91dbgu.c: revision 1.17
sys/dev/ic/advmcode.h: revision 1.7
sys/compat/ultrix/ultrix_exec.h: revision 1.7
sys/compat/common/vfs_syscalls_50.c: revision 1.24
sys/arch/mips/cavium/octeon_dma.c: revision 1.3
sys/arch/hpc/stand/hpcboot/arm/arm_pxa2x0_asm.asm: revision 1.2

Remove clause 3 and 4 from TNF licenses.
Ok'ed by martin@ in PR/54760.

Remove clause 3 and 4 leftovers from TNF licenses in more sources.
Confirmed by martin@ in PR/54760.
 1.38 19-Jan-2024  christos Add missing decls, make rusage_to_rusage50 static inline.
 1.37 07-Sep-2021  riastradh sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.36 03-Apr-2021  simonb Centralise the setitimer() timer type validation in dosetitimer() as is
done with dogetitimer().
 1.35 27-Feb-2020  pgoyette branches: 1.35.6; 1.35.8;
Remove explicit calls to the sysctl setup routines, since this is now
handled by the module infrastructure.
 1.34 02-Jan-2020  thorpej branches: 1.34.2;
- Eliminate the global "boottime" variable, which was being accessed
without any synchronization against changes by e.g. clock_settime().
- Replace with new getbinboottime() / getnanoboottime() / getmicroboottime()
functions (naming mirrors that of other time access functions in kern_tc.c).
It returns the (maybe-converted) value of timebasebin, which also tracks
our estimate of when the system was booted (i.e. the legacy "boottime" was
redundant).

XXX There needs to be a lockless synchronization mechanism for reading
timebasebin, but this is a problem in kern_tc.c that pre-existed these
"boottime" changes. At least now the problem is centralized in one location.
 1.33 27-Jan-2019  pgoyette branches: 1.33.4;
Merge the [pgoyette-compat] branch
 1.32 30-Oct-2018  riastradh Zero ntptimeval50 too to prevent 4-byte kernel stack disclosure.

From Thomas Barabosch of Fraunhofer FKIE.

XXX pullup-7, pullup-8 (along with rev. 1.60 of kern_ntptime.c)
 1.31 11-Mar-2016  christos branches: 1.31.10; 1.31.16; 1.31.18;
PR/50947: David Binderman: sprinkle parens
 1.30 07-Dec-2015  pgoyette Modularize the clockctl pseudo-device and link to the build.
 1.29 24-Jul-2015  maxv Unused inits (harmless).

Found by Brainy.
 1.28 09-Nov-2014  maxv branches: 1.28.2;
Do not uselessly include <sys/malloc.h>.
 1.27 04-Apr-2014  njoly branches: 1.27.4;
Move a few compat 50 syscalls, not applicable to rump kernels, out of
kern_time_50.c to a new source module.
 1.26 29-Mar-2013  christos branches: 1.26.4;
compat glue for new lwp_park()
 1.25 21-Feb-2013  pgoyette Move boottime50 and its associated sysctl into the compat module. As
noted on tech-kern. Should fix PR/47579.

OK christos@

Will request pull-up to 6.0 in a few days.
 1.24 03-Nov-2012  njoly Move rusage computation to a new getrusage1() function. Adjust all
compat/emulations to make use of it.
 1.23 02-Oct-2012  christos kernel portion of clock_nanosleep()
 1.22 04-Jan-2012  apb branches: 1.22.2; 1.22.6;
Instead of calling clockctl_ioctl directly, lookup the cdevsw and
call its d_ioctl function. This should fix an undefined reference to
`clockctlioctl' when you build a kernel that has COMPAT_50 but does not
have pseudo-device clockctl.
 1.21 04-Jan-2012  apb Provide a COMPAT_50 version of the CLOCKCTL_NTP_ADJTIME ioctl.
When time_t was changed from 32 to 64 bits, this ioctl's number
was changed from _IOWR('C', 0x4, struct clockctl_ntp_adjtime)
to _IOWR('C', 0x8, struct clockctl_ntp_adjtime), but the data
structure did not change, so all the compat code has to do is
change the number and try again.
 1.20 18-Nov-2011  christos branches: 1.20.4;
add a copyin function for sigset so that we can use sigtimedwait1 from
emulations.
 1.19 04-Mar-2011  christos branches: 1.19.4;
PR/44674: Taylor R Campbell: Fix compat copyin and copyout routines which
were obviously broken.
 1.18 19-Jan-2011  tsutsui branches: 1.18.2;
Remove includes <sys/mount.h> and <sys/sched.h> added for <sys/syscallargs.h>.
Now they are handled by $sysarghdrextra in sys/kern/syscalls.conf.
 1.17 17-Jan-2011  pooka Put async i/o compat routines in a separate source module from the
ones related to clock and process management.
 1.16 30-May-2010  drochner branches: 1.16.2;
-fix internal use of sigwaitinfo(2) by sigwait(3): The former returns
the signal number now, as required by POSIX. The latter should just
return 0 on success. Fixes a mysql problem reported by Kurt Schreiner.
-document the new behavior of sigwaitinfo and sigtimedwait
-retain non-POSIX behavior for NetBSD-5 binary compatibility -- the fix
would likely not be polled into the .0-branches, and having 5.0.x and
5.x behave differently would be confusing. Besides that, it was
documented in the manpage all the time.
 1.15 08-Apr-2010  njoly Add a new clock_gettime1() function that holds most of the
clock_gettime syscall code (except for the copyout). Adjust all
corresponding syscalls to make use of it.
 1.14 03-Apr-2010  njoly Move most clock_getres syscall code, except for coypout call, to a new
clock_getres1() function which can be used by emulations. Adjust all
clock_getres syscalls to now make of use it.
 1.13 19-Jan-2010  pooka branches: 1.13.2; 1.13.4;
Get rid of last "easy" kernel symbols starting with __:
__assert -> kern_assert
__sigtimedwait1 -> sigtimedwait1
__wdstart -> wdstart1

The rest are MD and/or shared with userspace, so they will require
a little more involvement than what is available for this quick
"ride the 5.99.24 bump" action.
 1.12 11-Nov-2009  rmind - selcommon/pollcommon: drop redundant l argument.
- Use cached curlwp->l_fd, instead of p->p_fd.
- Inline selscan/pollscan.
 1.11 04-Nov-2009  rmind do_sys_wait(): fix previous by checking for ru != NULL. Noticed by
Onno van der Linden. Also, remove redundant arguments (seems that
was_zombie was not used since rev 1.177 ?).
 1.10 12-Oct-2009  yamt compat_50_sys_aio_suspend:
- fix the buffer size.
- use kmem_alloc instead of kmem_zalloc for buffers which we will
overwrite soon.
 1.9 05-Oct-2009  rmind mq_timedsend/mq_timedreceive: timeout value is absolute, not relative.
While here, drop unecessary (since fdesc API changes) lwp_t arguments.

Bug reported by Stathis Kamperis, thanks!
 1.8 19-Jul-2009  rmind - Use #ifdef AIO, instead of #ifdef notyet. Not a solution, but at
least gets it working for MONOLITHIC kernel.
- Similarily add #ifdef MQUEUE for mqueue compat.
- Amend TNF license to be 2-clause. Approved by <christos>.
 1.7 29-Mar-2009  christos Move the internal poll/select related API's to use timespec instead
of timeval (rides the uvm bump).
 1.6 26-Mar-2009  gmcgarry Replace gcc initialisers with c99 designated initialisers.
 1.5 22-Feb-2009  nakayama - fix copyout size in CLOCKCTL_O?ADJTIME.
- add missing break in CLOCKCTL_NTP_ADJTIME.
 1.4 17-Jan-2009  njoly branches: 1.4.2; 1.4.4;
Convert linux/linux32 wait(4) to use a compat50 rusage structure.
 1.3 14-Jan-2009  njoly branches: 1.3.2;
In rusage_to_rusage50() function, fix memcpy size to include last
struct member (ru_nivcsw) which was missing.

ok by christos.
 1.2 11-Jan-2009  christos merge christos-time_t
 1.1 29-Mar-2008  christos branches: 1.1.2; 1.1.6;
file kern_time_50.c was initially added on branch christos-time_t.
 1.1.6.4 11-Aug-2010  yamt sync with head.
 1.1.6.3 11-Mar-2010  yamt sync with head
 1.1.6.2 19-Aug-2009  yamt sync with head.
 1.1.6.1 04-May-2009  yamt sync with head.
 1.1.2.4 28-Dec-2008  christos for now don't bother with aio and lfs.
 1.1.2.3 28-Dec-2008  christos minor adjustments for module builds.
 1.1.2.2 01-Nov-2008  christos catch up with changes in head.
 1.1.2.1 29-Mar-2008  christos new files
 1.3.2.2 17-Jan-2009  mjf Sync with HEAD.
 1.3.2.1 14-Jan-2009  mjf file kern_time_50.c was added on branch mjf-devfs2 on 2009-01-17 13:28:41 +0000
 1.4.4.2 23-Jul-2009  jym Sync with HEAD.
 1.4.4.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.4.2.4 28-Apr-2009  skrll Sync with HEAD.
 1.4.2.3 03-Mar-2009  skrll Sync with HEAD.
 1.4.2.2 19-Jan-2009  skrll Sync with HEAD.
 1.4.2.1 17-Jan-2009  skrll file kern_time_50.c was added on branch nick-hppapmap on 2009-01-19 13:17:17 +0000
 1.13.4.3 05-Mar-2011  rmind sync with head
 1.13.4.2 03-Jul-2010  rmind sync with head
 1.13.4.1 30-May-2010  rmind sync with head
 1.13.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.13.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.16.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.18.2.1 05-Mar-2011  bouyer Sync with HEAD
 1.19.4.4 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.19.4.3 16-Jan-2013  yamt sync with (a bit old) head
 1.19.4.2 30-Oct-2012  yamt sync with head
 1.19.4.1 17-Apr-2012  yamt sync with head
 1.20.4.1 18-Feb-2012  mrg merge to -current.
 1.22.6.5 03-Dec-2017  jdolecek update from HEAD
 1.22.6.4 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.22.6.3 23-Jun-2013  tls resync from head
 1.22.6.2 25-Feb-2013  tls resync with head
 1.22.6.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.22.2.1 14-Mar-2013  riz Pull up following revision(s) (requested by pgoyette in ticket #837):
sys/compat/common/kern_time_50.c: revision 1.25
sys/kern/init_sysctl.c: revision 1.195
sys/kern/init_main.c: revision 1.447
sys/compat/common/compat_util.h: revision 1.23
sys/compat/common/compat_mod.h: revision 1.1
sys/compat/common/compat_mod.c: revision 1.16
sys/compat/common/compat_mod.c: revision 1.17
sys/compat/common/compat_mod.c: revision 1.18
sys/compat/common/vfs_syscalls_43.c: revision 1.55
Move boottime50 and its associated sysctl into the compat module. As
noted on tech-kern. Should fix PR/47579.
OK christos@
Will request pull-up to 6.0 in a few days.
Wrap sysctl_teardown(&compat_clog) with the appropriate #if defined()s
remove empty #if
 1.26.4.1 18-May-2014  rmind sync with head
 1.27.4.1 17-Jan-2015  martin Pull up following revision(s) (requested by maxv in ticket #427):
sys/compat/svr4/svr4_schedctl.c: revision 1.8
sys/netinet/tcp_timer.c: revision 1.88
sys/miscfs/genfs/layer_vfsops.c: revision 1.45
sys/compat/svr4/svr4_ioctl.c: revision 1.37
sys/ufs/chfs/chfs_vfsops.c: revision 1.14
sys/miscfs/fdesc/fdesc_vfsops.c: revision 1.91
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.30
sys/compat/common/kern_time_50.c: revision 1.28
sys/netinet6/ip6_forward.c: revision 1.74
sys/miscfs/umapfs/umap_vnops.c: revision 1.57
sys/compat/svr4/svr4_fcntl.c: revision 1.74
distrib/sets/lists/comp/mi: revision 1.1931
sys/netinet6/udp6_output.c: revision 1.46
sys/fs/puffs/puffs_compat.c: revision 1.3
sys/fs/udf/udf_rename.c: revision 1.11
sys/compat/svr4/svr4_filio.c: revision 1.24
sys/fs/udf/udf_rename.c: revision 1.12
sys/netinet/tcp_usrreq.c: revision 1.202
sys/miscfs/umapfs/umap_subr.c: revision 1.29
sys/compat/linux/common/linux_fadvise64.c: revision 1.3
sys/netinet/if_atm.c: revision 1.34
sys/miscfs/procfs/procfs_subr.c: revision 1.106
sys/miscfs/genfs/layer_subr.c: revision 1.37
sys/netinet/tcp_sack.c: revision 1.30
sys/compat/freebsd/freebsd_misc.c: revision 1.33
sys/compat/freebsd/freebsd_file.c: revision 1.33
sys/ufs/chfs/chfs_vnode.c: revision 1.12
sys/compat/svr4/svr4_ttold.c: revision 1.34
sys/compat/linux/common/linux_file.c: revision 1.114
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.43
sys/compat/linux/common/linux_signal.c: revision 1.76
sys/compat/common/compat_util.c: revision 1.46
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.18
sys/compat/svr4/svr4_sockio.c: revision 1.36
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.32
sys/compat/svr4/svr4_signal.c: revision 1.66
sys/kern/kern_exec.c: revision 1.410
sys/fs/puffs/puffs_vfsops.c: revision 1.115
sys/compat/svr4/svr4_exec_elf64.c: revision 1.15
sys/compat/linux/arch/i386/linux_machdep.c: revision 1.159
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.50
sys/compat/linux32/common/linux32_misc.c: revision 1.24
sys/netinet/in_pcb.c: revision 1.153
sys/sys/malloc.h: revision 1.116
sys/compat/common/if_43.c: revision 1.9
share/man/man9/Makefile: revision 1.380
sys/netinet/tcp_vtw.c: revision 1.12
sys/miscfs/umapfs/umap_vfsops.c: revision 1.95
sys/ufs/ext2fs/ext2fs_vfsops.c: revision 1.186
sys/compat/common/uipc_syscalls_43.c: revision 1.46
sys/ufs/ext2fs/ext2fs_vnops.c: revision 1.115
sys/fs/puffs/puffs_msgif.c: revision 1.97
sys/compat/svr4/svr4_ipc.c: revision 1.27
sys/compat/linux/common/linux_exec.c: revision 1.117
sys/ufs/ext2fs/ext2fs_readwrite.c: revision 1.66
sys/netinet/tcp_output.c: revision 1.179
sys/compat/svr4/svr4_termios.c: revision 1.28
sys/fs/udf/udf_strat_bootstrap.c: revision 1.4
sys/fs/puffs/puffs_subr.c: revision 1.67
sys/fs/puffs/puffs_node.c: revision 1.36
sys/miscfs/overlay/overlay_vnops.c: revision 1.21
sys/fs/cd9660/cd9660_node.c: revision 1.34
sys/netinet/raw_ip.c: revision 1.146
sys/sys/mallocvar.h: revision 1.13
sys/miscfs/overlay/overlay_vfsops.c: revision 1.63
share/man/man9/malloc.9: revision 1.50
sys/netinet6/dest6.c: revision 1.18
sys/compat/linux/common/linux_uselib.c: revision 1.33
sys/compat/linux/common/linux_socket.c: revision 1.120
share/man/man9/malloc.9: revision 1.51
sys/netinet/tcp_subr.c: revision 1.257
sys/compat/linux/common/linux_socketcall.c: revision 1.45
sys/compat/linux/common/linux_fadvise64_64.c: revision 1.3
sys/compat/freebsd/freebsd_ipc.c: revision 1.17
sys/compat/linux/common/linux_misc_notalpha.c: revision 1.109
sys/compat/linux/arch/alpha/linux_pipe.c: revision 1.17
sys/netinet6/in6_pcb.c: revision 1.132
sys/netinet6/in6_ifattach.c: revision 1.94
sys/compat/svr4/svr4_exec_elf32.c: revision 1.15
sys/miscfs/nullfs/null_vfsops.c: revision 1.90
sys/fs/cd9660/cd9660_util.c: revision 1.12
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.48
sys/compat/freebsd/freebsd_exec_elf32.c: revision 1.20
sys/miscfs/procfs/procfs_vfsops.c: revision 1.94
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.28
sys/compat/linux/common/linux_sched.c: revision 1.67
sys/compat/linux/common/linux_exec_aout.c: revision 1.67
sys/compat/linux/common/linux_pipe.c: revision 1.67
sys/compat/linux/common/linux_llseek.c: revision 1.34
sys/compat/linux/arch/mips/linux_ptrace.c: revision 1.10
Do not uselessly include <sys/malloc.h>.
Cleanup:
- remove struct kmembuckets (dead)
- correctly deadify MALLOC_XX
- remove MALLOC_DEFINE_LIMIT and MALLOC_JUSTDEFINE_LIMIT (dead)
- remove malloc_roundup(), malloc_type_setlimit(), MALLOC_DEFINE_LIMIT()
and MALLOC_JUSTDEFINE_LIMIT() from man 9 malloc
New sentence, new line. Bump date for previous.
Obsolete malloc_roundup(9), malloc_type_setlimit(9) and MALLOC_DEFINE_LIMIT(9)
man pages.
 1.28.2.3 19-Mar-2016  skrll Sync with HEAD
 1.28.2.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.28.2.1 22-Sep-2015  skrll Sync with HEAD
 1.31.18.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.31.18.1 10-Jun-2019  christos Sync with HEAD
 1.31.16.5 26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.31.16.4 22-Sep-2018  pgoyette #include "opt_compat_netbsd.h" for all sources that provide compat code.
 1.31.16.3 13-Sep-2018  pgoyette Remove duplicate syscall package entry for ntp_gettime30. Duplicate
entries cause a panic when disestablishing, since when it looks at the
second entry it finds that the entrypoint doesn't match what's in the
package (it's alrady been reverted to sys_nosys() by the first entry.)
 1.31.16.2 20-Mar-2018  pgoyette Initial implementation of sys/kern/kern_stup.c as discussed on tech-kern

For now, we only handle the dev/ccd and NTP needs; more to follow.
 1.31.16.1 19-Mar-2018  pgoyette Initial pass at a COMPAT_50 module. More to come.
 1.31.10.2 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1838):

sys/compat/common/kern_time_50.c: revision 1.32

Zero ntptimeval50 too to prevent 4-byte kernel stack disclosure.

From Thomas Barabosch of Fraunhofer FKIE.
 1.31.10.1 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1836):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.33.4.1 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.34.2.1 29-Feb-2020  ad Sync with head.
 1.35.8.1 03-Apr-2021  thorpej Sync with HEAD.
 1.35.6.1 03-Apr-2021  thorpej Sync with HEAD.
 1.3 29-Jan-2020  ad - Track LWPs in a per-process radixtree. It uses no extra memory in the
single threaded case. Replace scans of p->p_lwps with lookups in the
tree. Find free LIDs for new LWPs in the tree. Replace the hashed sleep
queues for park/unpark with lookups in the tree under cover of a RW lock.

- lwp_wait(): if waiting on a specific LWP, find the LWP via tree lookup and
return EINVAL if it's detached, not ESRCH.

- Group the locks in struct proc at the end of the struct in their own cache
line.

- Add some comments.
 1.2 27-Jan-2019  pgoyette branches: 1.2.6;
Merge the [pgoyette-compat] branch
 1.1 29-Mar-2013  christos branches: 1.1.4; 1.1.12; 1.1.38; 1.1.40;
compat glue for new lwp_park()
 1.1.40.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.1.40.1 10-Jun-2019  christos Sync with HEAD
 1.1.38.2 22-Sep-2018  pgoyette #include "opt_compat_netbsd.h" for all sources that provide compat code.
 1.1.38.1 18-Mar-2018  pgoyette Move closer to a complete compat_60 module. All that remains is some
tty stuff and some ccd ioctl()s.
 1.1.12.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.1.12.1 29-Mar-2013  yamt file kern_time_60.c was added on branch yamt-pagecache on 2014-05-22 11:40:15 +0000
 1.1.4.2 23-Jun-2013  tls resync from head
 1.1.4.1 29-Mar-2013  tls file kern_time_60.c was added on branch tls-maxphys on 2013-06-23 06:20:15 +0000
 1.2.6.1 29-Feb-2020  ad Sync with head.
 1.4 12-Dec-2019  pgoyette Rather than keeping a separate mutex, condvar, and pserialize for each
module hook, we can share a common set of synchronization structures.
This cuts the amount of cacheline_aligned data for these structures by
50%.

Note that we still have a per-hook localcount, since we need to count
individual references.

As discussed with riastradh@

Welcome to 9.99.22 !
 1.3 27-Sep-2019  pgoyette Actually return the updated pointer-to-mbuf-pointer to the caller
rather than discarding-after-assignment. Introduced from the
[pgoyette-compat] branch work.

Welcome to 9.99.14 !!! (Module hook routine prototype changed.)

Found by the lgtm bot, reported via private Email from maxv@
 1.2 15-Apr-2019  pgoyette branches: 1.2.4; 1.2.6;
Clean up this mess and simplify, so that all the socket options get
handled correctly whether or not the compat_50 module is loaded.
 1.1 15-Apr-2019  pgoyette Split the COMPAT_50 socket-timeout stuff out of kern/uipc_socket.c
and into its own source file, which is now included in the compat_50
module.

(Not sure how this got missed during the original [pgoyette-compat] work)
 1.2.6.1 21-Oct-2019  martin Pull up following revision(s) (requested by pgoyette in ticket #339):

sys/compat/common/kern_uipc_socket_50.c: revision 1.3
sys/sys/compat_stub.h: revision 1.19
sys/kern/uipc_socket.c: revision 1.284

Actually return the updated pointer-to-mbuf-pointer to the caller
rather than discarding-after-assignment. Introduced from the
[pgoyette-compat] branch work.
 1.2.4.4 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.2.4.3 08-Apr-2020  martin Merge changes from current as of 20200406
 1.2.4.2 10-Jun-2019  christos Sync with HEAD
 1.2.4.1 15-Apr-2019  christos file kern_uipc_socket_50.c was added on branch phil-wifi on 2019-06-10 22:06:58 +0000
 1.18 23-Feb-2020  ad Don't bother with kernel_lock for kern_reboot().
 1.17 01-Jan-2020  thorpej branches: 1.17.2;
- Introduce a new global kernel variable "shutting_down" to indicate that
the system is shutting down or rebooting.
- Set this global in a new function called kern_reboot(), which is currently
just a basic wrapper around cpu_reboot().
- Call kern_reboot() instead of cpu_reboot() almost everywhere; a few
places remain where it's still called directly, but those are in early
pre-main() machdep locations.

Eventually, all of the various cpu_reboot() functions should be re-factored
and common functionality moved to kern_reboot(), but that's for another day.
 1.16 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.15 19-Jan-2011  tsutsui branches: 1.15.56; 1.15.58;
Remove includes <sys/mount.h> and <sys/sched.h> added for <sys/syscallargs.h>.
Now they are handled by $sysarghdrextra in sys/kern/syscalls.conf.
 1.14 23-Apr-2008  ad branches: 1.14.4; 1.14.24; 1.14.30;
Grab kernel_lock for cpu_reboot().
 1.13 20-Dec-2007  dsl branches: 1.13.6; 1.13.8;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.12 09-Feb-2007  ad branches: 1.12.20; 1.12.28; 1.12.32;
Merge newlock2 to head.
 1.11 16-Nov-2006  christos __unused removal on arguments; approved by core.
 1.10 14-Nov-2006  elad Clean some KAUTH_GENERIC_ISSUSER usage in compat code.
 1.9 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.8 23-Jul-2006  ad branches: 1.8.4; 1.8.6;
Use the LWP cached credentials where sane.
 1.7 14-May-2006  elad integrate kauth.
 1.6 11-Dec-2005  christos branches: 1.6.4; 1.6.6; 1.6.8; 1.6.10; 1.6.12;
merge ktrace-lwp.
 1.5 07-Aug-2003  agc branches: 1.5.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.4 18-Jan-2003  thorpej branches: 1.4.2;
Merge the nathanw_sa branch.
 1.3 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.2 26-Mar-1997  gwr branches: 1.2.34; 1.2.36;
s/boot/cpu_reboot/
 1.1 09-Aug-1996  mrg Change reboot(2) to take two arguments: bootopt like normal and also
a boot string for firmware that can do this, such as the SPARC and
the sun3 models. It is currently silently ignored on all other
hardware now, however. The MD function "boot()" has been changed to
also take a char *.
 1.2.36.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.34.4 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.2.34.3 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.2.34.2 14-Nov-2001  nathanw Catch up to -current.
 1.2.34.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.4.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.2.1 03-Aug-2004  skrll Sync with HEAD
 1.5.16.4 21-Jan-2008  yamt sync with head
 1.5.16.3 26-Feb-2007  yamt sync with head.
 1.5.16.2 30-Dec-2006  yamt sync with head.
 1.5.16.1 21-Jun-2006  yamt sync with head.
 1.6.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.6.10.3 06-May-2006  christos - Move kauth_cred_t declaration to <sys/types.h>
- Cleanup struct ucred; forward declarations that are unused.
- Don't include <sys/kauth.h> in any header, but include it in the c files
that need it.

Approved by core.
 1.6.10.2 10-Mar-2006  elad generic_authorize() -> kauth_authorize_generic().
 1.6.10.1 08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.6.8.2 11-Aug-2006  yamt sync with head
 1.6.8.1 24-May-2006  yamt sync with head.
 1.6.6.1 01-Jun-2006  kardel Sync with head.
 1.6.4.1 09-Sep-2006  rpaulo sync with head
 1.8.6.2 10-Dec-2006  yamt sync with head.
 1.8.6.1 22-Oct-2006  yamt sync with head
 1.8.4.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.8.4.1 18-Nov-2006  ad Sync with head.
 1.12.32.1 02-Jan-2008  bouyer Sync with HEAD
 1.12.28.1 26-Dec-2007  ad Sync with head.
 1.12.20.1 09-Jan-2008  matt sync with HEAD
 1.13.8.1 18-May-2008  yamt sync with head.
 1.13.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.14.30.1 06-Jun-2011  jruoho Sync with HEAD.
 1.14.24.1 05-Mar-2011  rmind sync with head
 1.14.4.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.14.4.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.15.58.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.15.58.1 10-Jun-2019  christos Sync with HEAD
 1.15.56.2 22-Sep-2018  pgoyette #include "opt_compat_netbsd.h" for all sources that provide compat code.
 1.15.56.1 31-Mar-2018  pgoyette create the compat_12 module
 1.17.2.1 29-Feb-2020  ad Sync with head.
 1.2 09-Dec-2023  oster branches: 1.2.2;

Allow kernels builds which don't define INET6 to compile compat bits too.
 1.1 09-Dec-2023  pgoyette Modularize the COMPAT_90 code that resulted from the removal of
netinet6/nd6 from the kernel. Now, the minimal compat code can
be successfully loaded and unloaded along with the rest of the
COMPAT_90 code.

XXX pullup-10 - hopefully before RC2
 1.2.2.2 10-Dec-2023  martin Pull up following revision(s) (requested by pgoyette in ticket #487):

sys/compat/common/compat_90_mod.c: revision 1.5
sys/compat/common/compat_90_mod.c: revision 1.6
sys/netinet6/in6.c: revision 1.290
sys/netinet6/in6.c: revision 1.291
sys/compat/common/files.common: revision 1.11
sys/netinet6/icmp6.c: revision 1.255
sys/compat/common/net_inet6_nd_90.c: revision 1.1
sys/compat/common/net_inet6_nd_90.c: revision 1.2
sys/modules/compat_90/Makefile: revision 1.2
sys/modules/compat_90/Makefile: revision 1.3
sys/netinet6/nd6.c: revision 1.281
sys/compat/common/compat_mod.h: revision 1.10
sys/kern/compat_stub.c: revision 1.23
sys/sys/compat_stub.h: revision 1.27

Identify the need to rework the COMPAT_* code to be more
module-aware.
This is an XXX comment block only, NFCI.

Modularize the COMPAT_90 code that resulted from the removal of
netinet6/nd6 from the kernel. Now, the minimal compat code can
be successfully loaded and unloaded along with the rest of the
COMPAT_90 code.

Allow kernels builds which don't define INET6 to compile compat bits
too.

Default the build of compat_90 module to include IPv6, as is done
for other INET6-sensitive modules (see if_lagg).
 1.2.2.1 09-Dec-2023  martin file net_inet6_nd_90.c was added on branch netbsd-10 on 2023-12-10 13:06:16 +0000
 1.7 30-Apr-2020  riastradh Omit needless #include <sys/rnd.h>.
 1.6 12-Dec-2019  pgoyette Rather than keeping a separate mutex, condvar, and pserialize for each
module hook, we can share a common set of synchronization structures.
This cuts the amount of cacheline_aligned data for these structures by
50%.

Note that we still have a per-hook localcount, since we need to count
individual references.

As discussed with riastradh@

Welcome to 9.99.22 !
 1.5 26-Sep-2019  christos fix sign-compare issues.
 1.4 01-Mar-2019  pgoyette Rename the MODULE_*_HOOK() macros to MODULE_HOOK_*() as briefly
discussed on irc.

NFCI intended.

Ride the earlier kernel bump - it;s getting crowded.
 1.3 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.2 03-Aug-2012  matt branches: 1.2.38; 1.2.40;
Only do COMPAT_NETBSD32 stuff if _LP64
 1.1 19-Dec-2011  apb branches: 1.1.4; 1.1.6;
Add COMPAT_50 and COMPAT_NETBSD32 compatibility code for rnd(4)
ioctl commands.

Tested with "rndctl -ls" using an old 32-bit version of rndctl(8)
(built for NetBSD-5.99.56/i386) and a new 64-bit kernel
(NetBSD-5.99.59/amd64).
 1.1.6.3 30-Oct-2012  yamt sync with head
 1.1.6.2 17-Apr-2012  yamt sync with head
 1.1.6.1 19-Dec-2011  yamt file rndpseudo_50.c was added on branch yamt-pagecache on 2012-04-17 00:07:14 +0000
 1.1.4.2 18-Feb-2012  mrg merge to -current.
 1.1.4.1 19-Dec-2011  mrg file rndpseudo_50.c was added on branch jmcneill-usbmp on 2012-02-18 07:33:54 +0000
 1.2.40.3 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.2.40.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.2.40.1 10-Jun-2019  christos Sync with HEAD
 1.2.38.3 23-Jan-2019  pgoyette Convert the macros for setting and unsetting a hook to generate
in-line code rather than using an intermediary hook##set routine.
Hooks are set and unset only in one place, so the intermediary
routine provides no benefit. IMHO using the macro at the point-
of-call is more readable than using it elsewhere in the code and
then calling the generated intermediary routine (for which you
won't even find its declaration or definition unless you remember
to search for the HOOK_SET macro instead).

NFC intended, will verify with a bulk build and an atf test run.
 1.2.38.2 12-Oct-2018  pgoyette Use a MP-safe hook for the rnd_ioctl compat_50 calls.
 1.2.38.1 21-Mar-2018  pgoyette Split compat/rndpseudo_50.c into two pieces, one for native compat and
a second piece for compat32. Update both modules accordingly.
 1.10 29-Jan-2020  thorpej Don't reference ifp->if_data directly; use if_export_if_data().
 1.9 12-Dec-2019  pgoyette branches: 1.9.2;
Rather than keeping a separate mutex, condvar, and pserialize for each
module hook, we can share a common set of synchronization structures.
This cuts the amount of cacheline_aligned data for these structures by
50%.

Note that we still have a per-hook localcount, since we need to count
individual references.

As discussed with riastradh@

Welcome to 9.99.22 !
 1.8 01-Mar-2019  pgoyette Rename the MODULE_*_HOOK() macros to MODULE_HOOK_*() as briefly
discussed on irc.

NFCI intended.

Ride the earlier kernel bump - it;s getting crowded.
 1.7 29-Jan-2019  pgoyette Normalize all the compat hooks' names to the form

<subsystem>_<function>_<version>_hook

NFCI

XXX Note that although this introduces a change in the kernel-to-
XXX module interface, we are NOT bumping the kernel version number.
XXX We will bump the version number once the interface stabilizes.
 1.6 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.5 03-Nov-2016  riastradh branches: 1.5.14; 1.5.16;
Sprinkle #ifdef _KERNEL_OPT.
 1.4 17-Jul-2011  joerg branches: 1.4.12; 1.4.30; 1.4.34;
Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.
 1.3 01-Feb-2011  matt Add a new AF/PF_ROUTE which is 64-bit clean which makes the routing socket
interface (and its associated sysctls) act identically for both 32 and 64 bit
programs. The old unclean one remains for backward compatibility.
 1.2 11-Jan-2009  christos branches: 1.2.2; 1.2.4; 1.2.10; 1.2.12; 1.2.14;
merge christos-time_t
 1.1 29-Mar-2008  christos branches: 1.1.2; 1.1.6;
file rtsock_14.c was initially added on branch christos-time_t.
 1.1.6.1 04-May-2009  yamt sync with head.
 1.1.2.1 29-Mar-2008  christos new files
 1.2.14.1 08-Feb-2011  bouyer Sync with HEAD
 1.2.12.1 06-Jun-2011  jruoho Sync with HEAD.
 1.2.10.1 05-Mar-2011  rmind sync with head
 1.2.4.2 19-Jan-2009  skrll Sync with HEAD.
 1.2.4.1 11-Jan-2009  skrll file rtsock_14.c was added on branch nick-hppapmap on 2009-01-19 13:17:17 +0000
 1.2.2.2 17-Jan-2009  mjf Sync with HEAD.
 1.2.2.1 11-Jan-2009  mjf file rtsock_14.c was added on branch mjf-devfs2 on 2009-01-17 13:28:41 +0000
 1.4.34.1 04-Nov-2016  pgoyette Sync with HEAD
 1.4.30.1 05-Dec-2016  skrll Sync with HEAD
 1.4.12.1 03-Dec-2017  jdolecek update from HEAD
 1.5.16.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.5.16.1 10-Jun-2019  christos Sync with HEAD
 1.5.14.7 23-Jan-2019  pgoyette Convert the macros for setting and unsetting a hook to generate
in-line code rather than using an intermediary hook##set routine.
Hooks are set and unset only in one place, so the intermediary
routine provides no benefit. IMHO using the macro at the point-
of-call is more readable than using it elsewhere in the code and
then calling the generated intermediary routine (for which you
won't even find its declaration or definition unless you remember
to search for the HOOK_SET macro instead).

NFC intended, will verify with a bulk build and an atf test run.
 1.5.14.6 14-Jan-2019  pgoyette Create a variant of the HOOK macros that handles hook routines of
type void, and use them where appropriate.
 1.5.14.5 13-Jan-2019  pgoyette Remove the HOOK2 versions of the MODULE_HOOK macros. There were
only a few uses, and using them led to some lack of clarity in the
code. Instead, we now use two separate hooks, with names that
make it clear(er) what we're doing.

This also positions us to start unraveling some of the rtsock_50
mess, which will need (at least) five hooks.
 1.5.14.4 22-Sep-2018  pgoyette #include "opt_compat_netbsd.h" for all sources that provide compat code.
 1.5.14.3 18-Sep-2018  pgoyette The COMPAT_HOOK macros were renamed to MODULE_HOOK, adjust all callers
 1.5.14.2 17-Sep-2018  pgoyette Adapt (most of) the indirect function pointers to the new MP-safe
mechanism. Still remaining are the compat_netbsd32 stuff, and
some usb subroutines.
 1.5.14.1 30-Mar-2018  pgoyette Extract compat_14 stuff into its own module
 1.9.2.1 29-Feb-2020  ad Sync with head.
 1.16 29-Jan-2020  thorpej Don't reference ifp->if_data directly; use if_export_if_data().
 1.15 12-Dec-2019  pgoyette branches: 1.15.2;
Rather than keeping a separate mutex, condvar, and pserialize for each
module hook, we can share a common set of synchronization structures.
This cuts the amount of cacheline_aligned data for these structures by
50%.

Note that we still have a per-hook localcount, since we need to count
individual references.

As discussed with riastradh@

Welcome to 9.99.22 !
 1.14 04-Oct-2019  msaitoh Make clog static. Found by lgtm bot.
 1.13 29-Apr-2019  roy Introduce rt_addrmsg_src which adds RTA_AUTHOR to the message.
Use this when we notify userland of a duplicate address
and set RTA_AUTHOR to the hardware address of the sender.

While here, match the logging diagnostic of INET6 to the simpler one
of INET so it's consistent.
 1.12 29-Apr-2019  roy rtsock: Route address message simplification

Rename rt_newaddrmsg to rt_addrmsg_rt.
Add rt_addrmsg which drops the error and route arguments which are only
needed by one caller.
 1.11 29-Apr-2019  pgoyette Move the set-up of the net.oroute... sysctl tree to compat_50 since
the new AF_ROUTE was introduced in NetBSD-6.0
 1.10 01-Mar-2019  pgoyette Rename the MODULE_*_HOOK() macros to MODULE_HOOK_*() as briefly
discussed on irc.

NFCI intended.

Ride the earlier kernel bump - it;s getting crowded.
 1.9 29-Jan-2019  pgoyette Normalize all the compat hooks' names to the form

<subsystem>_<function>_<version>_hook

NFCI

XXX Note that although this introduces a change in the kernel-to-
XXX module interface, we are NOT bumping the kernel version number.
XXX We will bump the version number once the interface stabilizes.
 1.8 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.7 10-May-2018  nonaka branches: 1.7.2;
Added missing ifi_link_state at compat_50_rt_oifmsg() and compat_50_iflist().
 1.6 16-Dec-2017  maxv branches: 1.6.2;
Build these functions regardless of whether COMPAT_50 or COMPAT_70 are
enabled. They must be there, because they are needed in rtsock.c even
when no compat option is enabled.
 1.5 16-Dec-2017  mrg remove check for netbsd 1.5 without 5.0. it doesn't happen.
 1.4 24-Aug-2015  pooka branches: 1.4.10;
to garnish, dust with _KERNEL_OPT
 1.3 01-Feb-2011  matt branches: 1.3.14; 1.3.32;
Add a new AF/PF_ROUTE which is 64-bit clean which makes the routing socket
interface (and its associated sysctls) act identically for both 32 and 64 bit
programs. The old unclean one remains for backward compatibility.
 1.2 11-Jan-2009  christos branches: 1.2.2; 1.2.4; 1.2.10; 1.2.12; 1.2.14;
merge christos-time_t
 1.1 29-Mar-2008  christos branches: 1.1.2; 1.1.6;
file rtsock_50.c was initially added on branch christos-time_t.
 1.1.6.1 04-May-2009  yamt sync with head.
 1.1.2.1 29-Mar-2008  christos new files
 1.2.14.1 08-Feb-2011  bouyer Sync with HEAD
 1.2.12.1 06-Jun-2011  jruoho Sync with HEAD.
 1.2.10.1 05-Mar-2011  rmind sync with head
 1.2.4.2 19-Jan-2009  skrll Sync with HEAD.
 1.2.4.1 11-Jan-2009  skrll file rtsock_50.c was added on branch nick-hppapmap on 2009-01-19 13:17:17 +0000
 1.2.2.2 17-Jan-2009  mjf Sync with HEAD.
 1.2.2.1 11-Jan-2009  mjf file rtsock_50.c was added on branch mjf-devfs2 on 2009-01-17 13:28:41 +0000
 1.3.32.1 22-Sep-2015  skrll Sync with HEAD
 1.3.14.1 03-Dec-2017  jdolecek update from HEAD
 1.4.10.2 21-Jan-2020  martin Apply patch, requested by pgoyette in ticket #1484:

sys/compat/common/rtsock_50.c (patch)

PR kern/54861:

For MODULAR kernels, we include all of the compat code, even if not
required by the selected COMPAT_xx options. Thus, rtsock_14.c is
included in the kernel.

rtsock_14.c in turn references routines in rtsock_50.c which is also
included in the kernel. However, if the kernel is built without the
COMPAT_50 option, rtsock_50.c ends up being a no-op and doesn't
define any of the routines that rtsock_14.c needs.

Thus, MODULAR kernels which only have COMPAT_60 (or newer) will fail
to link becuase of the undefined symbols.

Fix is to make rtsock_50.c functional if MODULAR kernel option is
specified.
 1.4.10.1 09-Jun-2018  martin Pull up following revision(s) (requested by nonaka in ticket #861):

sys/compat/common/rtsock_50.c: revision 1.7

Added missing ifi_link_state at compat_50_rt_oifmsg() and compat_50_iflist().
 1.6.2.7 23-Jan-2019  pgoyette Convert the macros for setting and unsetting a hook to generate
in-line code rather than using an intermediary hook##set routine.
Hooks are set and unset only in one place, so the intermediary
routine provides no benefit. IMHO using the macro at the point-
of-call is more readable than using it elsewhere in the code and
then calling the generated intermediary routine (for which you
won't even find its declaration or definition unless you remember
to search for the HOOK_SET macro instead).

NFC intended, will verify with a bulk build and an atf test run.
 1.6.2.6 15-Jan-2019  pgoyette Remove a couple of unneeded #include-s

XXX There's probably a lot more clean-up that could happen here!
 1.6.2.5 15-Jan-2019  pgoyette Split sys/net/rtsock.c into two pieces, one of which is applicable only
to -current and one which is shared between -current and COMPAT_50.
 1.6.2.4 14-Jan-2019  pgoyette Create a variant of the HOOK macros that handles hook routines of
type void, and use them where appropriate.
 1.6.2.3 13-Jan-2019  pgoyette Add the required hooks for rtsock_50 and modify the COMPATCALL() macro
to use the hooks. While the rtsock_50 situation is still sub-optimal
(it includes the main rtsock.c with a whole bunch of function and
variable redefinitions via macros), this at least makes it possible to
load the rtsock_50 code separately from more recent code, rather than
the previous requirement that rtsock_50 be built-in.
 1.6.2.2 11-Jan-2019  pgoyette Rework the various sysctl-related routines to call the correct code
for each version. While here, extract the 5.0 specific code instead
of including in the main rtsock.c code.

Also, clean up all the sysctl-related routines to prevent building
more than one copy, no matter how many places rtsock.c gets #include'd
into!
 1.6.2.1 21-May-2018  pgoyette Sync with HEAD
 1.7.2.3 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.7.2.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.7.2.1 10-Jun-2019  christos Sync with HEAD
 1.15.2.1 29-Feb-2020  ad Sync with head.
 1.8 12-Dec-2019  pgoyette Rather than keeping a separate mutex, condvar, and pserialize for each
module hook, we can share a common set of synchronization structures.
This cuts the amount of cacheline_aligned data for these structures by
50%.

Note that we still have a per-hook localcount, since we need to count
individual references.

As discussed with riastradh@

Welcome to 9.99.22 !
 1.7 29-Apr-2019  pgoyette Move the set-up of the net.oroute... sysctl tree to compat_50 since
the new AF_ROUTE was introduced in NetBSD-6.0
 1.6 29-Apr-2019  pgoyette For the rtsock compat code, make sure we create the "oroute" sysctl
tree. Otherwise a 5.2 version of getifaddrs(2) gets errors.

This makes the 5.2 version of ifconfig(8) behave the same on both
NetBSD-8 and -current. HOWEVER, both of them print nothing (for
``ifconfig -l'' command) so there's still a bug somewhere.

As reported originally by der Mouse.
 1.5 01-Mar-2019  pgoyette Rename the MODULE_*_HOOK() macros to MODULE_HOOK_*() as briefly
discussed on irc.

NFCI intended.

Ride the earlier kernel bump - it;s getting crowded.
 1.4 29-Jan-2019  pgoyette Normalize all the compat hooks' names to the form

<subsystem>_<function>_<version>_hook

NFCI

XXX Note that although this introduces a change in the kernel-to-
XXX module interface, we are NOT bumping the kernel version number.
XXX We will bump the version number once the interface stabilizes.
 1.3 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.2 16-Dec-2017  maxv branches: 1.2.2; 1.2.4;
Build these functions regardless of whether COMPAT_50 or COMPAT_70 are
enabled. They must be there, because they are needed in rtsock.c even
when no compat option is enabled.
 1.1 21-Sep-2016  roy branches: 1.1.2; 1.1.4; 1.1.18;
Add ifam_pid and ifam_addrflags to ifa_msghdr.
Re-version RTM_NEWADDR, RTM_DELADDR, RTM_CHGADDR and NET_RT_IFLIST.
Add compat code for old version.
 1.1.18.2 03-Dec-2017  jdolecek update from HEAD
 1.1.18.1 21-Sep-2016  jdolecek file rtsock_70.c was added on branch tls-maxphys on 2017-12-03 11:36:53 +0000
 1.1.4.2 04-Nov-2016  pgoyette Sync with HEAD
 1.1.4.1 21-Sep-2016  pgoyette file rtsock_70.c was added on branch pgoyette-localcount on 2016-11-04 14:49:07 +0000
 1.1.2.2 05-Oct-2016  skrll Sync with HEAD
 1.1.2.1 21-Sep-2016  skrll file rtsock_70.c was added on branch nick-nhusb on 2016-10-05 20:55:37 +0000
 1.2.4.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.2.4.1 10-Jun-2019  christos Sync with HEAD
 1.2.2.5 23-Jan-2019  pgoyette Convert the macros for setting and unsetting a hook to generate
in-line code rather than using an intermediary hook##set routine.
Hooks are set and unset only in one place, so the intermediary
routine provides no benefit. IMHO using the macro at the point-
of-call is more readable than using it elsewhere in the code and
then calling the generated intermediary routine (for which you
won't even find its declaration or definition unless you remember
to search for the HOOK_SET macro instead).

NFC intended, will verify with a bulk build and an atf test run.
 1.2.2.4 14-Jan-2019  pgoyette Create a variant of the HOOK macros that handles hook routines of
type void, and use them where appropriate.
 1.2.2.3 13-Jan-2019  pgoyette Remove the HOOK2 versions of the MODULE_HOOK macros. There were
only a few uses, and using them led to some lack of clarity in the
code. Instead, we now use two separate hooks, with names that
make it clear(er) what we're doing.

This also positions us to start unraveling some of the rtsock_50
mess, which will need (at least) five hooks.
 1.2.2.2 15-Oct-2018  pgoyette Convert a couple more hooks to the MP-safe mechanism.

While here, clean up some headers and remove any that are now empty.
 1.2.2.1 15-Mar-2018  pgoyette Create a separate module for COMPAT_70 code only, and untangle the
70 compat code from the current.
 1.2 20-May-2024  christos Rename dup3110 to dup3100 to match historical practice for NetBSD-11,
because we already have kevent100. Fix compat_dup3 to belong in compat_100
not compat_110.
 1.1 19-May-2024  christos version dup3
 1.2 20-May-2024  martin Fix a few oversights from the renaming of dup3110 to dup3100
 1.1 20-May-2024  christos Rename dup3110 to dup3100 to match historical practice for NetBSD-11,
because we already have kevent100. Fix compat_dup3 to belong in compat_100
not compat_110.
 1.4 12-Dec-2019  pgoyette Rather than keeping a separate mutex, condvar, and pserialize for each
module hook, we can share a common set of synchronization structures.
This cuts the amount of cacheline_aligned data for these structures by
50%.

Note that we still have a per-hook localcount, since we need to count
individual references.

As discussed with riastradh@

Welcome to 9.99.22 !
 1.3 01-Mar-2019  pgoyette branches: 1.3.4;
Rename the MODULE_*_HOOK() macros to MODULE_HOOK_*() as briefly
discussed on irc.

NFCI intended.

Ride the earlier kernel bump - it;s getting crowded.
 1.2 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.1 27-Mar-2018  pgoyette branches: 1.1.2;
file sysmon_power_40.c was initially added on branch pgoyette-compat.
 1.1.2.6 23-Jan-2019  pgoyette Convert the macros for setting and unsetting a hook to generate
in-line code rather than using an intermediary hook##set routine.
Hooks are set and unset only in one place, so the intermediary
routine provides no benefit. IMHO using the macro at the point-
of-call is more readable than using it elsewhere in the code and
then calling the generated intermediary routine (for which you
won't even find its declaration or definition unless you remember
to search for the HOOK_SET macro instead).

NFC intended, will verify with a bulk build and an atf test run.
 1.1.2.5 14-Jan-2019  pgoyette Create a variant of the HOOK macros that handles hook routines of
type void, and use them where appropriate.
 1.1.2.4 22-Sep-2018  pgoyette #include "opt_compat_netbsd.h" for all sources that provide compat code.
 1.1.2.3 18-Sep-2018  pgoyette The COMPAT_HOOK macros were renamed to MODULE_HOOK, adjust all callers
 1.1.2.2 17-Sep-2018  pgoyette Adapt (most of) the indirect function pointers to the new MP-safe
mechanism. Still remaining are the compat_netbsd32 stuff, and
some usb subroutines.
 1.1.2.1 27-Mar-2018  pgoyette Create a compat_40 module
 1.3.4.3 08-Apr-2020  martin Merge changes from current as of 20200406
 1.3.4.2 10-Jun-2019  christos Sync with HEAD
 1.3.4.1 01-Mar-2019  christos file sysmon_power_40.c was added on branch phil-wifi on 2019-06-10 22:06:58 +0000
 1.6 11-Jan-2009  christos merge christos-time_t
 1.5 28-Apr-2008  martin branches: 1.5.8; 1.5.12;
Remove clause 3 and 4 from TNF licenses
 1.4 08-Dec-2007  dsl branches: 1.4.12; 1.4.14; 1.4.16;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.3 11-Nov-2005  christos branches: 1.3.46; 1.3.48; 1.3.58;
Move more compat stuff from sys.
 1.2 13-Nov-2001  lukem branches: 1.2.16; 1.2.32;
add RCSIDs (including regeneration of files as appropriate)
 1.1 25-Aug-1999  thorpej branches: 1.1.14; 1.1.16;
Add compatibility calls for the 1.4 System V IPC *ctl() calls, and
update the 1.0 compat calls.
 1.1.16.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.14.1 14-Nov-2001  nathanw Catch up to -current.
 1.2.32.2 21-Jan-2008  yamt sync with head
 1.2.32.1 21-Jun-2006  yamt sync with head.
 1.2.16.1 11-Dec-2005  christos Sync with head.
 1.3.58.1 26-Dec-2007  ad Sync with head.
 1.3.48.1 09-Jan-2008  matt sync with HEAD
 1.3.46.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.4.16.2 04-May-2009  yamt sync with head.
 1.4.16.1 16-May-2008  yamt sync with head.
 1.4.14.1 18-May-2008  yamt sync with head.
 1.4.12.2 17-Jan-2009  mjf Sync with HEAD.
 1.4.12.1 02-Jun-2008  mjf Sync with HEAD.
 1.5.12.2 09-Nov-2008  christos garbage collect all the conversion functions and put them in the header
files so that userland can share them. Also fix bugs in them!
 1.5.12.1 28-Apr-2008  christos file sysv_ipc_14.c was added on branch christos-time_t on 2008-11-09 23:28:36 +0000
 1.5.8.1 03-Mar-2009  skrll Sync with HEAD.
 1.6 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.5 03-Sep-2018  riastradh Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.4 03-Dec-2015  pgoyette branches: 1.4.16; 1.4.18;
Add comment to #ifdef - it's a long way from its original #if
 1.3 10-May-2015  pgoyette Split the SYSV* compat code out into a separate compat_sysv module.

For monolithic kernels, both modules will be compiled as "built-ins",
while modular environments will be able to load the SYSVSEM, SYSVSHM,
and SYSVMSG code independant from the rest of compat.

This is a necessary precursor step to making the "STD" SYSV* code
into a separate module.

Tested in both monolithic and modular environments with no errors
seen.
 1.2 21-Jan-2009  christos branches: 1.2.4; 1.2.6; 1.2.28; 1.2.46;
compile into nothing if not compat 50.
 1.1 19-Jan-2009  christos Provide compatibility for pre-christos-time_t sysv sysctls.
 1.2.46.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.2.46.1 06-Jun-2015  skrll Sync with HEAD
 1.2.28.1 03-Dec-2017  jdolecek update from HEAD
 1.2.6.2 04-May-2009  yamt sync with head.
 1.2.6.1 21-Jan-2009  yamt file sysv_ipc_50.c was added on branch yamt-nfs-mp on 2009-05-04 08:12:17 +0000
 1.2.4.2 03-Mar-2009  skrll Sync with HEAD.
 1.2.4.1 21-Jan-2009  skrll file sysv_ipc_50.c was added on branch nick-hppapmap on 2009-03-03 18:30:07 +0000
 1.4.18.1 10-Jun-2019  christos Sync with HEAD
 1.4.16.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.4.16.1 10-Mar-2018  pgoyette Put declaration of the 5.0 sysctl routine in a header file
 1.1 09-Mar-2018  pgoyette branches: 1.1.2;
file sysv_ipc_mod.c was initially added on branch pgoyette-compat.
 1.1.2.2 09-Mar-2018  pgoyette More on renaming the new module
 1.1.2.1 09-Mar-2018  pgoyette Split the sysv_ipc module into two pieces: one for contemporary
SYSV* functionality, and one for compatability with previous NetBSD
versions. No need to pull in all of compat just to have a sysv_ipc
module.
 1.1 09-Mar-2018  pgoyette branches: 1.1.2;
file sysv_ipc_mod.h was initially added on branch pgoyette-compat.
 1.1.2.2 09-Mar-2018  pgoyette More on renaming the new module
 1.1.2.1 09-Mar-2018  pgoyette Split the sysv_ipc module into two pieces: one for contemporary
SYSV* functionality, and one for compatability with previous NetBSD
versions. No need to pull in all of compat just to have a sysv_ipc
module.
 1.1 09-Mar-2018  pgoyette branches: 1.1.2;
file sysv_mod.c was initially added on branch pgoyette-compat.
 1.1.2.8 17-Apr-2018  pgoyette Rename sysv_mod.[ch] to compat_sysv_mod.[ch] for consistency with other
files that provide module(7) interfaces.
 1.1.2.7 10-Mar-2018  pgoyette Put declaration of the 5.0 sysctl routine in a header file
 1.1.2.6 09-Mar-2018  pgoyette The last of the rename
 1.1.2.5 09-Mar-2018  pgoyette Include correct header file
 1.1.2.4 09-Mar-2018  pgoyette All the COMPAT_xx macros are already in opt_compat_netbsd.h so no
need to look for them in opt_compat_xx.h
 1.1.2.3 09-Mar-2018  pgoyette Finish renaming the new module.
 1.1.2.2 09-Mar-2018  pgoyette Update dependency: compat_sysv requires sysv_ipc
 1.1.2.1 09-Mar-2018  pgoyette More on renaming the new module
 1.1 09-Mar-2018  pgoyette branches: 1.1.2;
file sysv_mod.h was initially added on branch pgoyette-compat.
 1.1.2.4 17-Apr-2018  pgoyette Rename sysv_mod.[ch] to compat_sysv_mod.[ch] for consistency with other
files that provide module(7) interfaces.
 1.1.2.3 10-Mar-2018  pgoyette Put declaration of the 5.0 sysctl routine in a header file
 1.1.2.2 09-Mar-2018  pgoyette Allocate the function vector only once.
 1.1.2.1 09-Mar-2018  pgoyette More on renaming the new module
 1.20 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.19 19-Jan-2011  tsutsui branches: 1.19.56; 1.19.58;
Remove includes <sys/mount.h> and <sys/sched.h> added for <sys/syscallargs.h>.
Now they are handled by $sysarghdrextra in sys/kern/syscalls.conf.
 1.18 11-Jan-2009  christos branches: 1.18.6; 1.18.8;
merge christos-time_t
 1.17 28-Apr-2008  martin branches: 1.17.2; 1.17.8; 1.17.12;
Remove clause 3 and 4 from TNF licenses
 1.16 20-Dec-2007  dsl branches: 1.16.6; 1.16.8; 1.16.10;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.15 08-Dec-2007  dsl branches: 1.15.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.14 04-Dec-2007  dsl Remove all the __P
 1.13 09-Feb-2007  ad branches: 1.13.18; 1.13.20; 1.13.26; 1.13.28;
Merge newlock2 to head.
 1.12 16-Nov-2006  christos __unused removal on arguments; approved by core.
 1.11 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.10 23-Jul-2006  ad branches: 1.10.4; 1.10.6;
Use the LWP cached credentials where sane.
 1.9 11-Nov-2005  christos branches: 1.9.6; 1.9.10;
Move more compat stuff from sys.
 1.8 10-Nov-2005  christos These two really don't need the new header.
 1.7 10-Nov-2005  christos Include new compat header.
 1.6 26-Feb-2005  perry branches: 1.6.4;
nuke trailing whitespace
 1.5 18-Jan-2003  thorpej branches: 1.5.2; 1.5.10; 1.5.12;
Merge the nathanw_sa branch.
 1.4 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.3 21-Dec-2000  jdolecek branches: 1.3.2; 1.3.4;
don't define SYSVMSG if it's already defined
 1.2 02-Jun-2000  simonb Add new sysctl node "KERN_SYSVIPC_INFO" with "KERN_SYSVIPC_MSG_INFO",
"KERN_SYSVIPC_SEM_INFO" and "KERN_SYSVIPC_SHM_INFO" to return the
info and data structures for the relevent SysV IPC types. The return
structures use fixed-size types and should be compat32 safe. All
user-visible changes are protected with
#if !defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)

Make all variable declarations extern in msg.h, sem.h and shm.h and
add relevent variable declarations to sysv_*.c and remove unneeded
header files from those .c files.

Make compat14 SysV IPC conversion functions and sysctl_file() static.

Change the data pointer to "void *" in sysctl_clockrate(),
sysctl_ntptime(), sysctl_file() and sysctl_doeproc().
 1.1 25-Aug-1999  thorpej branches: 1.1.2; 1.1.10;
Add compatibility calls for the 1.4 System V IPC *ctl() calls, and
update the 1.0 compat calls.
 1.1.10.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.1.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.1.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.3.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.3.2.4 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.3.2.3 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.3.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.3.2.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.5.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.5.10.1 29-Apr-2005  kent sync with -current
 1.5.2.2 11-Dec-2005  christos Sync with head.
 1.5.2.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.6.4.5 21-Jan-2008  yamt sync with head
 1.6.4.4 07-Dec-2007  yamt sync with head
 1.6.4.3 26-Feb-2007  yamt sync with head.
 1.6.4.2 30-Dec-2006  yamt sync with head.
 1.6.4.1 21-Jun-2006  yamt sync with head.
 1.9.10.1 11-Aug-2006  yamt sync with head
 1.9.6.1 09-Sep-2006  rpaulo sync with head
 1.10.6.2 10-Dec-2006  yamt sync with head.
 1.10.6.1 22-Oct-2006  yamt sync with head
 1.10.4.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.10.4.1 18-Nov-2006  ad Sync with head.
 1.13.28.2 26-Dec-2007  ad Sync with head.
 1.13.28.1 08-Dec-2007  ad Sync with head.
 1.13.26.2 27-Dec-2007  mjf Sync with HEAD.
 1.13.26.1 08-Dec-2007  mjf Sync with HEAD.
 1.13.20.1 09-Jan-2008  matt sync with HEAD
 1.13.18.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.15.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.16.10.2 04-May-2009  yamt sync with head.
 1.16.10.1 16-May-2008  yamt sync with head.
 1.16.8.1 18-May-2008  yamt sync with head.
 1.16.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.16.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.17.12.2 09-Nov-2008  christos garbage collect all the conversion functions and put them in the header
files so that userland can share them. Also fix bugs in them!
 1.17.12.1 28-Apr-2008  christos file sysv_msg_14.c was added on branch christos-time_t on 2008-11-09 23:28:36 +0000
 1.17.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.17.2.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.17.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.18.8.1 06-Jun-2011  jruoho Sync with HEAD.
 1.18.6.1 05-Mar-2011  rmind sync with head
 1.19.58.1 10-Jun-2019  christos Sync with HEAD
 1.19.56.1 22-Sep-2018  pgoyette #include "opt_compat_netbsd.h" for all sources that provide compat code.
 1.5 15-Dec-2019  tsutsui Remove clause 3 and 4 leftovers from TNF licenses in more sources.

Confirmed by martin@ in PR/54760.
 1.4 27-Jan-2019  pgoyette branches: 1.4.4;
Merge the [pgoyette-compat] branch
 1.3 19-Jan-2011  tsutsui branches: 1.3.56; 1.3.58;
Remove includes <sys/mount.h> and <sys/sched.h> added for <sys/syscallargs.h>.
Now they are handled by $sysarghdrextra in sys/kern/syscalls.conf.
 1.2 11-Jan-2009  christos branches: 1.2.2; 1.2.4; 1.2.10; 1.2.12;
merge christos-time_t
 1.1 29-Mar-2008  christos branches: 1.1.2; 1.1.6;
file sysv_msg_50.c was initially added on branch christos-time_t.
 1.1.6.1 04-May-2009  yamt sync with head.
 1.1.2.2 09-Nov-2008  christos garbage collect all the conversion functions and put them in the header
files so that userland can share them. Also fix bugs in them!
 1.1.2.1 29-Mar-2008  christos new files
 1.2.12.1 06-Jun-2011  jruoho Sync with HEAD.
 1.2.10.1 05-Mar-2011  rmind sync with head
 1.2.4.2 19-Jan-2009  skrll Sync with HEAD.
 1.2.4.1 11-Jan-2009  skrll file sysv_msg_50.c was added on branch nick-hppapmap on 2009-01-19 13:17:17 +0000
 1.2.2.2 17-Jan-2009  mjf Sync with HEAD.
 1.2.2.1 11-Jan-2009  mjf file sysv_msg_50.c was added on branch mjf-devfs2 on 2009-01-17 13:28:41 +0000
 1.3.58.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.3.58.1 10-Jun-2019  christos Sync with HEAD
 1.3.56.1 22-Sep-2018  pgoyette #include "opt_compat_netbsd.h" for all sources that provide compat code.
 1.4.4.1 18-Dec-2019  martin Pull up following revision(s) (requested by tsutsui in ticket #570):

sys/compat/netbsd32/netbsd32_compat_50_sysv.c: revision 1.3
sys/dev/raidframe/rf_compat50.h: revision 1.6
sys/arch/emips/emips/bus_space.c: revision 1.3
sys/compat/net/if.h: revision 1.5
sys/arch/emips/stand/common/bootinfo.c: revision 1.2
sys/compat/common/sysv_msg_50.c: revision 1.5
sys/compat/common/kern_time_30.c: revision 1.8
sys/arch/emips/stand/common/bootinfo.h: revision 1.2
sys/arch/ia64/include/bus.h: revision 1.4
sys/arch/ia64/ia64/bus_space.c: revision 1.2
sys/compat/common/sysv_shm_50.c: revision 1.5
sys/dev/ic/adw.h: revision 1.15
sys/compat/common/uipc_syscalls_50.c: revision 1.10
sys/arch/emips/ebus/flash_ebus.c: revision 1.22
sys/dev/ic/adv.h: revision 1.15
sys/dev/ic/adwmcode.c: revision 1.18
sys/dev/ic/advlib.c: revision 1.29
sys/arch/hpcarm/include/kloader.h: revision 1.3
sys/dev/usb/uberry.c: revision 1.16
sys/compat/common/sysv_sem_50.c: revision 1.5
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.43
sys/dev/ic/advlib.h: revision 1.21
sys/dev/ic/adv.c: revision 1.50
sys/compat/netinet6/in6_var.h: revision 1.5
sys/arch/hpc/stand/hpcboot/arm/arm_sa1100_asm.asm: revision 1.2
sys/arch/emips/include/loadfile_machdep.h: revision 1.3
sys/arch/emips/stand/common/prom_iface.c: revision 1.7
sys/dev/ic/adw.c: revision 1.56
sys/dev/ic/adwmcode.h: revision 1.12
sys/dev/ic/advmcode.c: revision 1.10
sys/arch/emips/ebus/ace_ebus.c: revision 1.22
sys/compat/netbsd32/netbsd32_compat_60.c: revision 1.5
sys/dev/raidframe/rf_compat50.c: revision 1.13
sys/arch/x68k/dev/intiovar.h: revision 1.15
sys/dev/usb/uipad.c: revision 1.8
sys/arch/zaurus/include/kloader.h: revision 1.3
sys/arch/emips/stand/common/bootxx.c: revision 1.2
sys/dev/ic/adwlib.h: revision 1.23
sys/dev/ic/adwlib.c: revision 1.44
sys/compat/netbsd32/netbsd32_compat_16.c: revision 1.3
sys/arch/amigappc/include/intr.h: revision 1.27
sys/arch/x68k/dev/mfp.c: revision 1.27
sys/arch/arm/at91/at91dbgu.c: revision 1.17
sys/dev/ic/advmcode.h: revision 1.7
sys/compat/ultrix/ultrix_exec.h: revision 1.7
sys/compat/common/vfs_syscalls_50.c: revision 1.24
sys/arch/mips/cavium/octeon_dma.c: revision 1.3
sys/arch/hpc/stand/hpcboot/arm/arm_pxa2x0_asm.asm: revision 1.2

Remove clause 3 and 4 from TNF licenses.
Ok'ed by martin@ in PR/54760.

Remove clause 3 and 4 leftovers from TNF licenses in more sources.
Confirmed by martin@ in PR/54760.
 1.17 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.16 19-Jan-2011  tsutsui branches: 1.16.56; 1.16.58;
Remove includes <sys/mount.h> and <sys/sched.h> added for <sys/syscallargs.h>.
Now they are handled by $sysarghdrextra in sys/kern/syscalls.conf.
 1.15 11-Jan-2009  christos branches: 1.15.6; 1.15.8;
merge christos-time_t
 1.14 28-Apr-2008  martin branches: 1.14.2; 1.14.8; 1.14.12;
Remove clause 3 and 4 from TNF licenses
 1.13 20-Dec-2007  dsl branches: 1.13.6; 1.13.8; 1.13.10;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.12 17-Jun-2007  dsl branches: 1.12.8; 1.12.16; 1.12.20;
Expose semid_ds14_to_native() to otherparts of the system.
Don't leak kernel stack back to userspace.
 1.11 09-Feb-2007  ad branches: 1.11.6; 1.11.8;
Merge newlock2 to head.
 1.10 23-Jul-2006  ad branches: 1.10.4;
Use the LWP cached credentials where sane.
 1.9 10-Nov-2005  christos branches: 1.9.6; 1.9.10;
These two really don't need the new header.
 1.8 10-Nov-2005  christos Include new compat header.
 1.7 13-Sep-2005  christos compat code reorg.
 1.6 26-Feb-2005  perry branches: 1.6.4;
nuke trailing whitespace
 1.5 18-Jan-2003  thorpej branches: 1.5.2; 1.5.10; 1.5.12;
Merge the nathanw_sa branch.
 1.4 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.3 17-Dec-2000  jdolecek branches: 1.3.2; 1.3.4;
make LKM safe
 1.2 02-Jun-2000  simonb Add new sysctl node "KERN_SYSVIPC_INFO" with "KERN_SYSVIPC_MSG_INFO",
"KERN_SYSVIPC_SEM_INFO" and "KERN_SYSVIPC_SHM_INFO" to return the
info and data structures for the relevent SysV IPC types. The return
structures use fixed-size types and should be compat32 safe. All
user-visible changes are protected with
#if !defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)

Make all variable declarations extern in msg.h, sem.h and shm.h and
add relevent variable declarations to sysv_*.c and remove unneeded
header files from those .c files.

Make compat14 SysV IPC conversion functions and sysctl_file() static.

Change the data pointer to "void *" in sysctl_clockrate(),
sysctl_ntptime(), sysctl_file() and sysctl_doeproc().
 1.1 25-Aug-1999  thorpej branches: 1.1.2; 1.1.10;
Add compatibility calls for the 1.4 System V IPC *ctl() calls, and
update the 1.0 compat calls.
 1.1.10.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.1.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.1.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.3.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.3.2.4 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.3.2.3 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.3.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.3.2.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.5.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.5.10.1 29-Apr-2005  kent sync with -current
 1.5.2.3 11-Dec-2005  christos Sync with head.
 1.5.2.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.5.2.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.6.4.5 21-Jan-2008  yamt sync with head
 1.6.4.4 03-Sep-2007  yamt sync with head.
 1.6.4.3 26-Feb-2007  yamt sync with head.
 1.6.4.2 30-Dec-2006  yamt sync with head.
 1.6.4.1 21-Jun-2006  yamt sync with head.
 1.9.10.1 11-Aug-2006  yamt sync with head
 1.9.6.1 09-Sep-2006  rpaulo sync with head
 1.10.4.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.11.8.1 11-Jul-2007  mjf Sync with head.
 1.11.6.1 15-Jul-2007  ad Sync with head.
 1.12.20.1 02-Jan-2008  bouyer Sync with HEAD
 1.12.16.1 26-Dec-2007  ad Sync with head.
 1.12.8.1 09-Jan-2008  matt sync with HEAD
 1.13.10.2 04-May-2009  yamt sync with head.
 1.13.10.1 16-May-2008  yamt sync with head.
 1.13.8.1 18-May-2008  yamt sync with head.
 1.13.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.13.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.14.12.2 09-Nov-2008  christos garbage collect all the conversion functions and put them in the header
files so that userland can share them. Also fix bugs in them!
 1.14.12.1 28-Apr-2008  christos file sysv_sem_14.c was added on branch christos-time_t on 2008-11-09 23:28:36 +0000
 1.14.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.14.2.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.14.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.15.8.1 06-Jun-2011  jruoho Sync with HEAD.
 1.15.6.1 05-Mar-2011  rmind sync with head
 1.16.58.1 10-Jun-2019  christos Sync with HEAD
 1.16.56.1 22-Sep-2018  pgoyette #include "opt_compat_netbsd.h" for all sources that provide compat code.
 1.5 15-Dec-2019  tsutsui Remove clause 3 and 4 leftovers from TNF licenses in more sources.

Confirmed by martin@ in PR/54760.
 1.4 27-Jan-2019  pgoyette branches: 1.4.4;
Merge the [pgoyette-compat] branch
 1.3 19-Jan-2011  tsutsui branches: 1.3.56; 1.3.58;
Remove includes <sys/mount.h> and <sys/sched.h> added for <sys/syscallargs.h>.
Now they are handled by $sysarghdrextra in sys/kern/syscalls.conf.
 1.2 11-Jan-2009  christos branches: 1.2.2; 1.2.4; 1.2.10; 1.2.12;
merge christos-time_t
 1.1 29-Mar-2008  christos branches: 1.1.2; 1.1.6;
file sysv_sem_50.c was initially added on branch christos-time_t.
 1.1.6.1 04-May-2009  yamt sync with head.
 1.1.2.2 09-Nov-2008  christos garbage collect all the conversion functions and put them in the header
files so that userland can share them. Also fix bugs in them!
 1.1.2.1 29-Mar-2008  christos new files
 1.2.12.1 06-Jun-2011  jruoho Sync with HEAD.
 1.2.10.1 05-Mar-2011  rmind sync with head
 1.2.4.2 19-Jan-2009  skrll Sync with HEAD.
 1.2.4.1 11-Jan-2009  skrll file sysv_sem_50.c was added on branch nick-hppapmap on 2009-01-19 13:17:17 +0000
 1.2.2.2 17-Jan-2009  mjf Sync with HEAD.
 1.2.2.1 11-Jan-2009  mjf file sysv_sem_50.c was added on branch mjf-devfs2 on 2009-01-17 13:28:41 +0000
 1.3.58.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.3.58.1 10-Jun-2019  christos Sync with HEAD
 1.3.56.1 22-Sep-2018  pgoyette #include "opt_compat_netbsd.h" for all sources that provide compat code.
 1.4.4.1 18-Dec-2019  martin Pull up following revision(s) (requested by tsutsui in ticket #570):

sys/compat/netbsd32/netbsd32_compat_50_sysv.c: revision 1.3
sys/dev/raidframe/rf_compat50.h: revision 1.6
sys/arch/emips/emips/bus_space.c: revision 1.3
sys/compat/net/if.h: revision 1.5
sys/arch/emips/stand/common/bootinfo.c: revision 1.2
sys/compat/common/sysv_msg_50.c: revision 1.5
sys/compat/common/kern_time_30.c: revision 1.8
sys/arch/emips/stand/common/bootinfo.h: revision 1.2
sys/arch/ia64/include/bus.h: revision 1.4
sys/arch/ia64/ia64/bus_space.c: revision 1.2
sys/compat/common/sysv_shm_50.c: revision 1.5
sys/dev/ic/adw.h: revision 1.15
sys/compat/common/uipc_syscalls_50.c: revision 1.10
sys/arch/emips/ebus/flash_ebus.c: revision 1.22
sys/dev/ic/adv.h: revision 1.15
sys/dev/ic/adwmcode.c: revision 1.18
sys/dev/ic/advlib.c: revision 1.29
sys/arch/hpcarm/include/kloader.h: revision 1.3
sys/dev/usb/uberry.c: revision 1.16
sys/compat/common/sysv_sem_50.c: revision 1.5
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.43
sys/dev/ic/advlib.h: revision 1.21
sys/dev/ic/adv.c: revision 1.50
sys/compat/netinet6/in6_var.h: revision 1.5
sys/arch/hpc/stand/hpcboot/arm/arm_sa1100_asm.asm: revision 1.2
sys/arch/emips/include/loadfile_machdep.h: revision 1.3
sys/arch/emips/stand/common/prom_iface.c: revision 1.7
sys/dev/ic/adw.c: revision 1.56
sys/dev/ic/adwmcode.h: revision 1.12
sys/dev/ic/advmcode.c: revision 1.10
sys/arch/emips/ebus/ace_ebus.c: revision 1.22
sys/compat/netbsd32/netbsd32_compat_60.c: revision 1.5
sys/dev/raidframe/rf_compat50.c: revision 1.13
sys/arch/x68k/dev/intiovar.h: revision 1.15
sys/dev/usb/uipad.c: revision 1.8
sys/arch/zaurus/include/kloader.h: revision 1.3
sys/arch/emips/stand/common/bootxx.c: revision 1.2
sys/dev/ic/adwlib.h: revision 1.23
sys/dev/ic/adwlib.c: revision 1.44
sys/compat/netbsd32/netbsd32_compat_16.c: revision 1.3
sys/arch/amigappc/include/intr.h: revision 1.27
sys/arch/x68k/dev/mfp.c: revision 1.27
sys/arch/arm/at91/at91dbgu.c: revision 1.17
sys/dev/ic/advmcode.h: revision 1.7
sys/compat/ultrix/ultrix_exec.h: revision 1.7
sys/compat/common/vfs_syscalls_50.c: revision 1.24
sys/arch/mips/cavium/octeon_dma.c: revision 1.3
sys/arch/hpc/stand/hpcboot/arm/arm_pxa2x0_asm.asm: revision 1.2

Remove clause 3 and 4 from TNF licenses.
Ok'ed by martin@ in PR/54760.

Remove clause 3 and 4 leftovers from TNF licenses in more sources.
Confirmed by martin@ in PR/54760.
 1.18 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.17 19-Jan-2011  tsutsui branches: 1.17.56; 1.17.58;
Remove includes <sys/mount.h> and <sys/sched.h> added for <sys/syscallargs.h>.
Now they are handled by $sysarghdrextra in sys/kern/syscalls.conf.
 1.16 11-Jan-2009  christos branches: 1.16.6; 1.16.8;
merge christos-time_t
 1.15 28-Apr-2008  martin branches: 1.15.2; 1.15.8; 1.15.12;
Remove clause 3 and 4 from TNF licenses
 1.14 20-Dec-2007  dsl branches: 1.14.6; 1.14.8; 1.14.10;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.13 08-Dec-2007  dsl branches: 1.13.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.12 04-Dec-2007  dsl Remove all the __P
 1.11 09-Feb-2007  ad branches: 1.11.18; 1.11.20; 1.11.26; 1.11.28;
Merge newlock2 to head.
 1.10 16-Nov-2006  christos __unused removal on arguments; approved by core.
 1.9 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.8 23-Jul-2006  ad branches: 1.8.4; 1.8.6;
Use the LWP cached credentials where sane.
 1.7 10-Nov-2005  christos branches: 1.7.6; 1.7.10;
Include new compat header.
 1.6 26-Feb-2005  perry branches: 1.6.4;
nuke trailing whitespace
 1.5 18-Jan-2003  thorpej branches: 1.5.2; 1.5.10; 1.5.12;
Merge the nathanw_sa branch.
 1.4 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.3 17-Dec-2000  jdolecek branches: 1.3.2; 1.3.4;
make LKM safe
 1.2 02-Jun-2000  simonb Add new sysctl node "KERN_SYSVIPC_INFO" with "KERN_SYSVIPC_MSG_INFO",
"KERN_SYSVIPC_SEM_INFO" and "KERN_SYSVIPC_SHM_INFO" to return the
info and data structures for the relevent SysV IPC types. The return
structures use fixed-size types and should be compat32 safe. All
user-visible changes are protected with
#if !defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)

Make all variable declarations extern in msg.h, sem.h and shm.h and
add relevent variable declarations to sysv_*.c and remove unneeded
header files from those .c files.

Make compat14 SysV IPC conversion functions and sysctl_file() static.

Change the data pointer to "void *" in sysctl_clockrate(),
sysctl_ntptime(), sysctl_file() and sysctl_doeproc().
 1.1 25-Aug-1999  thorpej branches: 1.1.2; 1.1.10;
Add compatibility calls for the 1.4 System V IPC *ctl() calls, and
update the 1.0 compat calls.
 1.1.10.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.1.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.1.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.3.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.3.2.4 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.3.2.3 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.3.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.3.2.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.5.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.5.10.1 29-Apr-2005  kent sync with -current
 1.5.2.2 11-Dec-2005  christos Sync with head.
 1.5.2.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.6.4.5 21-Jan-2008  yamt sync with head
 1.6.4.4 07-Dec-2007  yamt sync with head
 1.6.4.3 26-Feb-2007  yamt sync with head.
 1.6.4.2 30-Dec-2006  yamt sync with head.
 1.6.4.1 21-Jun-2006  yamt sync with head.
 1.7.10.1 11-Aug-2006  yamt sync with head
 1.7.6.1 09-Sep-2006  rpaulo sync with head
 1.8.6.2 10-Dec-2006  yamt sync with head.
 1.8.6.1 22-Oct-2006  yamt sync with head
 1.8.4.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.8.4.1 18-Nov-2006  ad Sync with head.
 1.11.28.2 26-Dec-2007  ad Sync with head.
 1.11.28.1 08-Dec-2007  ad Sync with head.
 1.11.26.2 27-Dec-2007  mjf Sync with HEAD.
 1.11.26.1 08-Dec-2007  mjf Sync with HEAD.
 1.11.20.1 09-Jan-2008  matt sync with HEAD
 1.11.18.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.13.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.14.10.2 04-May-2009  yamt sync with head.
 1.14.10.1 16-May-2008  yamt sync with head.
 1.14.8.1 18-May-2008  yamt sync with head.
 1.14.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.14.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.15.12.2 09-Nov-2008  christos garbage collect all the conversion functions and put them in the header
files so that userland can share them. Also fix bugs in them!
 1.15.12.1 28-Apr-2008  christos file sysv_shm_14.c was added on branch christos-time_t on 2008-11-09 23:28:36 +0000
 1.15.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.15.2.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.15.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.16.8.1 06-Jun-2011  jruoho Sync with HEAD.
 1.16.6.1 05-Mar-2011  rmind sync with head
 1.17.58.1 10-Jun-2019  christos Sync with HEAD
 1.17.56.1 22-Sep-2018  pgoyette #include "opt_compat_netbsd.h" for all sources that provide compat code.
 1.5 15-Dec-2019  tsutsui Remove clause 3 and 4 leftovers from TNF licenses in more sources.

Confirmed by martin@ in PR/54760.
 1.4 27-Jan-2019  pgoyette branches: 1.4.4;
Merge the [pgoyette-compat] branch
 1.3 19-Jan-2011  tsutsui branches: 1.3.56; 1.3.58;
Remove includes <sys/mount.h> and <sys/sched.h> added for <sys/syscallargs.h>.
Now they are handled by $sysarghdrextra in sys/kern/syscalls.conf.
 1.2 11-Jan-2009  christos branches: 1.2.2; 1.2.4; 1.2.10; 1.2.12;
merge christos-time_t
 1.1 29-Mar-2008  christos branches: 1.1.2; 1.1.6;
file sysv_shm_50.c was initially added on branch christos-time_t.
 1.1.6.1 04-May-2009  yamt sync with head.
 1.1.2.2 09-Nov-2008  christos garbage collect all the conversion functions and put them in the header
files so that userland can share them. Also fix bugs in them!
 1.1.2.1 29-Mar-2008  christos new files
 1.2.12.1 06-Jun-2011  jruoho Sync with HEAD.
 1.2.10.1 05-Mar-2011  rmind sync with head
 1.2.4.2 19-Jan-2009  skrll Sync with HEAD.
 1.2.4.1 11-Jan-2009  skrll file sysv_shm_50.c was added on branch nick-hppapmap on 2009-01-19 13:17:17 +0000
 1.2.2.2 17-Jan-2009  mjf Sync with HEAD.
 1.2.2.1 11-Jan-2009  mjf file sysv_shm_50.c was added on branch mjf-devfs2 on 2009-01-17 13:28:41 +0000
 1.3.58.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.3.58.1 10-Jun-2019  christos Sync with HEAD
 1.3.56.1 22-Sep-2018  pgoyette #include "opt_compat_netbsd.h" for all sources that provide compat code.
 1.4.4.1 18-Dec-2019  martin Pull up following revision(s) (requested by tsutsui in ticket #570):

sys/compat/netbsd32/netbsd32_compat_50_sysv.c: revision 1.3
sys/dev/raidframe/rf_compat50.h: revision 1.6
sys/arch/emips/emips/bus_space.c: revision 1.3
sys/compat/net/if.h: revision 1.5
sys/arch/emips/stand/common/bootinfo.c: revision 1.2
sys/compat/common/sysv_msg_50.c: revision 1.5
sys/compat/common/kern_time_30.c: revision 1.8
sys/arch/emips/stand/common/bootinfo.h: revision 1.2
sys/arch/ia64/include/bus.h: revision 1.4
sys/arch/ia64/ia64/bus_space.c: revision 1.2
sys/compat/common/sysv_shm_50.c: revision 1.5
sys/dev/ic/adw.h: revision 1.15
sys/compat/common/uipc_syscalls_50.c: revision 1.10
sys/arch/emips/ebus/flash_ebus.c: revision 1.22
sys/dev/ic/adv.h: revision 1.15
sys/dev/ic/adwmcode.c: revision 1.18
sys/dev/ic/advlib.c: revision 1.29
sys/arch/hpcarm/include/kloader.h: revision 1.3
sys/dev/usb/uberry.c: revision 1.16
sys/compat/common/sysv_sem_50.c: revision 1.5
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.43
sys/dev/ic/advlib.h: revision 1.21
sys/dev/ic/adv.c: revision 1.50
sys/compat/netinet6/in6_var.h: revision 1.5
sys/arch/hpc/stand/hpcboot/arm/arm_sa1100_asm.asm: revision 1.2
sys/arch/emips/include/loadfile_machdep.h: revision 1.3
sys/arch/emips/stand/common/prom_iface.c: revision 1.7
sys/dev/ic/adw.c: revision 1.56
sys/dev/ic/adwmcode.h: revision 1.12
sys/dev/ic/advmcode.c: revision 1.10
sys/arch/emips/ebus/ace_ebus.c: revision 1.22
sys/compat/netbsd32/netbsd32_compat_60.c: revision 1.5
sys/dev/raidframe/rf_compat50.c: revision 1.13
sys/arch/x68k/dev/intiovar.h: revision 1.15
sys/dev/usb/uipad.c: revision 1.8
sys/arch/zaurus/include/kloader.h: revision 1.3
sys/arch/emips/stand/common/bootxx.c: revision 1.2
sys/dev/ic/adwlib.h: revision 1.23
sys/dev/ic/adwlib.c: revision 1.44
sys/compat/netbsd32/netbsd32_compat_16.c: revision 1.3
sys/arch/amigappc/include/intr.h: revision 1.27
sys/arch/x68k/dev/mfp.c: revision 1.27
sys/arch/arm/at91/at91dbgu.c: revision 1.17
sys/dev/ic/advmcode.h: revision 1.7
sys/compat/ultrix/ultrix_exec.h: revision 1.7
sys/compat/common/vfs_syscalls_50.c: revision 1.24
sys/arch/mips/cavium/octeon_dma.c: revision 1.3
sys/arch/hpc/stand/hpcboot/arm/arm_pxa2x0_asm.asm: revision 1.2

Remove clause 3 and 4 from TNF licenses.
Ok'ed by martin@ in PR/54760.

Remove clause 3 and 4 leftovers from TNF licenses in more sources.
Confirmed by martin@ in PR/54760.
 1.40 10-Jul-2022  riastradh tty_43: Do unsigned arithmetic to avoid shift into sign bits.

Omit input validation -- it's not a great idea for compatibility with
historical kernels, since they ignored the bits instead of rejecting
them if set. With unsigned arithmetic, we get the same semantics as
was previously assumed (discarding bits that get shifted into the
sign bit or off into oblivion) without the formal undefined
behaviour.

Reported-by: syzbot+e408764cdd8c0c0ff535@syzkaller.appspotmail.com
https://syzkaller.appspot.com/bug?id=8318f0039e68187cd8d27b2c520816fff3f7266a
 1.39 10-Oct-2020  christos TIOCGSID is used by tcgetsid() so it is not really compat :-)
This should reduce loading the compat module.
 1.38 09-Oct-2020  nia tty_43: Check a bitset from userspace is valid before shifting it

Passing a negative value to these legacy compat ioctls results in
left shift on a negative value which is undefined behaviour and results
in the tty (at least, possibly other things) locking up.

The argument to the ioctl should always be > 0. Return EINVAL otherwise.

While here, adjustments to code style to match current guidelines.

Found by UBSan.

Reported-by: syzbot+39cd551a05298b222756@syzkaller.appspotmail.com
 1.37 08-Aug-2020  christos Fix the OTIOCGETD emulation. Line discipline 0 is NTTYDISC.
 1.36 23-May-2020  ad Move proc_lock into the data segment. It was dynamically allocated because
at the time we had mutex_obj_alloc() but not __cacheline_aligned.
 1.35 12-Dec-2019  pgoyette Rather than keeping a separate mutex, condvar, and pserialize for each
module hook, we can share a common set of synchronization structures.
This cuts the amount of cacheline_aligned data for these structures by
50%.

Note that we still have a per-hook localcount, since we need to count
individual references.

As discussed with riastradh@

Welcome to 9.99.22 !
 1.34 01-Mar-2019  pgoyette branches: 1.34.4;
Rename the MODULE_*_HOOK() macros to MODULE_HOOK_*() as briefly
discussed on irc.

NFCI intended.

Ride the earlier kernel bump - it;s getting crowded.
 1.33 29-Jan-2019  pgoyette Normalize all the compat hooks' names to the form

<subsystem>_<function>_<version>_hook

NFCI

XXX Note that although this introduces a change in the kernel-to-
XXX module interface, we are NOT bumping the kernel version number.
XXX We will bump the version number once the interface stabilizes.
 1.32 28-Jan-2019  christos - provide a hook for the 43 tty ioctls
- make the 60 tty ioctl hook look the same
- fix the tty code to call both hooks and remove unused lock
 1.31 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.30 22-May-2014  dholland branches: 1.30.20; 1.30.26; 1.30.28;
Use accessor functions for the tty's table of control characters.
(at least from outside the core tty sources)

Move some xon/xoff code from net/ppp_tty.c to kern/tty.c.
 1.29 19-Nov-2008  ad branches: 1.29.26; 1.29.40;
Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.28 14-Nov-2008  ad - Move some more compat code into sys/compat.
- Split 4.3BSD ifioctl stuff into its own file.
- Remove some ifdefs that include small fragments of vfs compat code
which are difficult to relocate elsewhere.
 1.27 28-Apr-2008  martin branches: 1.27.6; 1.27.8;
Remove clause 3 and 4 from TNF licenses
 1.26 24-Apr-2008  ad branches: 1.26.2;
Network protocol interrupts can now block on locks, so merge the globals
proclist_mutex and proclist_lock into a single adaptive mutex (proc_lock).
Implications:

- Inspecting process state requires thread context, so signals can no longer
be sent from a hardware interrupt handler. Signal activity must be
deferred to a soft interrupt or kthread.

- As the proc state locking is simplified, it's now safe to take exit()
and wait() out from under kernel_lock.

- The system spends less time at IPL_SCHED, and there is less lock activity.
 1.25 23-Apr-2008  ad Fix locking.
 1.24 08-Dec-2007  dsl branches: 1.24.12; 1.24.14;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.23 04-Dec-2007  dsl Remove all the __P
 1.22 04-Mar-2007  christos branches: 1.22.14; 1.22.16; 1.22.22; 1.22.24;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.21 05-Mar-2006  christos branches: 1.21.18;
cleanup more SET/CLR/ISSET lossage
 1.20 11-Dec-2005  christos branches: 1.20.4; 1.20.6; 1.20.8;
merge ktrace-lwp.
 1.19 27-Nov-2005  thorpej Overhaul how TTY line disciplines are handled:
- Replace references to linesw[0] with a ttyldisc_default() function
that returns the default ("termios") line discipline.
- The linesw[] array is gone, replaced by a linked list.
- ttyldisc_add() and ttyldisc_remove() have been replaced by
ttyldisc_attach() and ttyldisc_detach().
- Things that provide line disciplines are now responsible for
registering those disciplines with the system. The linesw
structures are no longer declared in tty_conf.c
- Line disciplines are now refcounted; a lookup causes a reference to
be held. ttyldisc_release() releases the reference. Attempts to
detach an in-use line discipline result in EBUSY.
- Fix function signature lossage in if_sl.c, if_strip.c, and tty_tb.c
that was masked by the old tty_conf.c
- tty_init() is no longer necessary; delete it and its call from main().
 1.18 25-Apr-2004  matt branches: 1.18.12; 1.18.18;
Constify the speedtab arrays
 1.17 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.16 29-Jun-2003  fvdl branches: 1.16.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.15 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.14 17-Mar-2002  atatat Convert ioctl code to use EPASSTHROUGH instead of -1 or ENOTTY for
indicating an unhandled "command". ERESTART is -1, which can lead to
confusion. ERESTART has been moved to -3 and EPASSTHROUGH has been
placed at -4. No ioctl code should now return -1 anywhere. The
ioctl() system call is now properly restartable.
 1.13 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.12 08-Nov-2000  eeh branches: 1.12.2; 1.12.4; 1.12.6;
Don't dereference NULL t_linesw.
 1.11 02-Nov-2000  itohy Adapt to the new line discipline scheme.
 1.10 30-Mar-2000  augustss Kill register declarations.
 1.9 29-Mar-2000  simonb Don't need to include <sys/conf.h> here.
 1.8 01-Mar-1998  fvdl branches: 1.8.14;
Merge with Lite2 + local changes
 1.7 13-Oct-1996  christos Backout previous kprintf change.
 1.6 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.5 20-May-1996  mark cast -1 to a char for comparision with tc->t_brkc so that this test
will work with signed and unsigned chars.
 1.4 18-May-1996  veego Put this into an #ifdef COMPAT_OLDTTY.
look in <sys/tty.h> for more infomations about that.
 1.3 14-Mar-1996  christos Fix compiler warnings
 1.2 10-Feb-1996  christos Don't declare MSG_COMPAT in two places.
More prototype fixes
 1.1 02-Feb-1996  christos Renamed compat_tty.c to tty_43.c and updated with the newest copy from
kern/tty_compat.c
 1.8.14.2 22-Nov-2000  bouyer Sync with HEAD.
 1.8.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.12.6.1 13-Oct-2001  fvdl Revert the t_dev -> t_devvp change in struct tty. The way that tty
structs are currently used (especially by console ttys) aren't
ready for it, and this will require quite a few changes.
 1.12.4.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.12.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.12.2.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.12.2.1 14-Nov-2001  nathanw Catch up to -current.
 1.16.2.5 11-Dec-2005  christos Sync with head.
 1.16.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.16.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.16.2.2 03-Aug-2004  skrll Sync with HEAD
 1.16.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.18.18.1 29-Nov-2005  yamt sync with head.
 1.18.12.4 21-Jan-2008  yamt sync with head
 1.18.12.3 07-Dec-2007  yamt sync with head
 1.18.12.2 03-Sep-2007  yamt sync with head.
 1.18.12.1 21-Jun-2006  yamt sync with head.
 1.20.8.1 13-Mar-2006  yamt sync with head.
 1.20.6.1 22-Apr-2006  simonb Sync with head.
 1.20.4.1 09-Sep-2006  rpaulo sync with head
 1.21.18.1 12-Mar-2007  rmind Sync with HEAD.
 1.22.24.2 26-Dec-2007  ad Sync with head.
 1.22.24.1 08-Dec-2007  ad Sync with head.
 1.22.22.2 27-Dec-2007  mjf Sync with HEAD.
 1.22.22.1 08-Dec-2007  mjf Sync with HEAD.
 1.22.16.1 09-Jan-2008  matt sync with HEAD
 1.22.14.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.24.14.1 18-May-2008  yamt sync with head.
 1.24.12.2 17-Jan-2009  mjf Sync with HEAD.
 1.24.12.1 02-Jun-2008  mjf Sync with HEAD.
 1.26.2.2 04-May-2009  yamt sync with head.
 1.26.2.1 16-May-2008  yamt sync with head.
 1.27.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.27.6.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.29.40.1 10-Aug-2014  tls Rebase.
 1.29.26.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.30.28.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.30.28.1 10-Jun-2019  christos Sync with HEAD
 1.30.26.2 22-Sep-2018  pgoyette #include "opt_compat_netbsd.h" for all sources that provide compat code.
 1.30.26.1 17-Apr-2018  pgoyette First pass at compat modules for 4.3BSD, NetBSD-0.9, and NetBSD-1.0

XXX Still need to deal with the sysctl stuff and other code shared
XXX between 09 and 43
 1.30.20.1 10-Oct-2020  martin Pull up following revision(s) (requested by nia in ticket #1614):

sys/compat/common/tty_43.c: revision 1.38

tty_43: Check a bitset from userspace is valid before shifting it

Passing a negative value to these legacy compat ioctls results in
left shift on a negative value which is undefined behaviour and results
in the tty (at least, possibly other things) locking up.
The argument to the ioctl should always be > 0. Return EINVAL otherwise.

While here, adjustments to code style to match current guidelines.
Found by UBSan.
 1.34.4.1 10-Oct-2020  martin Pull up following revision(s) (requested by nia in ticket #1106):

sys/compat/common/tty_43.c: revision 1.38

tty_43: Check a bitset from userspace is valid before shifting it

Passing a negative value to these legacy compat ioctls results in
left shift on a negative value which is undefined behaviour and results
in the tty (at least, possibly other things) locking up.
The argument to the ioctl should always be > 0. Return EINVAL otherwise.

While here, adjustments to code style to match current guidelines.
Found by UBSan.
 1.11 21-Jul-2021  skrll need <sys/param.h> for COHERENCY_UNIT

Minor KNF along the way.
 1.10 24-Jun-2020  jdolecek branches: 1.10.6;
reduce stack usage in compat_60_ptmget_ioctl() - allocate struct ptmget
via kmem_alloc()
 1.9 12-Dec-2019  pgoyette Rather than keeping a separate mutex, condvar, and pserialize for each
module hook, we can share a common set of synchronization structures.
This cuts the amount of cacheline_aligned data for these structures by
50%.

Note that we still have a per-hook localcount, since we need to count
individual references.

As discussed with riastradh@

Welcome to 9.99.22 !
 1.8 01-Mar-2019  pgoyette Rename the MODULE_*_HOOK() macros to MODULE_HOOK_*() as briefly
discussed on irc.

NFCI intended.

Ride the earlier kernel bump - it;s getting crowded.
 1.7 29-Jan-2019  pgoyette Normalize all the compat hooks' names to the form

<subsystem>_<function>_<version>_hook

NFCI

XXX Note that although this introduces a change in the kernel-to-
XXX module interface, we are NOT bumping the kernel version number.
XXX We will bump the version number once the interface stabilizes.
 1.6 28-Jan-2019  christos - provide a hook for the 43 tty ioctls
- make the 60 tty ioctl hook look the same
- fix the tty code to call both hooks and remove unused lock
 1.5 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.4 22-Oct-2015  christos branches: 1.4.2; 1.4.8; 1.4.16; 1.4.18;
Handle both ioctls in both places :-)
 1.3 19-Oct-2012  apb branches: 1.3.2; 1.3.4; 1.3.18;
Also copy the sfd element of struct ptmget. This somehow
got lost between testing and commit.
 1.2 19-Oct-2012  apb This file getscompiled even if COMPAT_60 is not defined, so
protect most of the contents with #ifdef COMPAT_60
 1.1 19-Oct-2012  apb Add COMPAT_60 versions of the TIOCPTMGET and TIOCPTSNAME ioctls.
 1.3.18.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.3.4.3 03-Dec-2017  jdolecek update from HEAD
 1.3.4.2 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.3.4.1 19-Oct-2012  tls file tty_60.c was added on branch tls-maxphys on 2012-11-20 03:01:53 +0000
 1.3.2.2 30-Oct-2012  yamt sync with head
 1.3.2.1 19-Oct-2012  yamt file tty_60.c was added on branch yamt-pagecache on 2012-10-30 17:20:39 +0000
 1.4.18.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.4.18.1 10-Jun-2019  christos Sync with HEAD
 1.4.16.7 23-Jan-2019  pgoyette Convert the macros for setting and unsetting a hook to generate
in-line code rather than using an intermediary hook##set routine.
Hooks are set and unset only in one place, so the intermediary
routine provides no benefit. IMHO using the macro at the point-
of-call is more readable than using it elsewhere in the code and
then calling the generated intermediary routine (for which you
won't even find its declaration or definition unless you remember
to search for the HOOK_SET macro instead).

NFC intended, will verify with a bulk build and an atf test run.
 1.4.16.6 13-Jan-2019  pgoyette Remove the HOOK2 versions of the MODULE_HOOK macros. There were
only a few uses, and using them led to some lack of clarity in the
code. Instead, we now use two separate hooks, with names that
make it clear(er) what we're doing.

This also positions us to start unraveling some of the rtsock_50
mess, which will need (at least) five hooks.
 1.4.16.5 15-Oct-2018  pgoyette Convert another hook to the MP-sfe mechanism.

XXX still have three more to convert: openat_10, sysvipc50_sysctl and
XXX compat70_unp_addsockcred
 1.4.16.4 04-Sep-2018  pgoyette Separate COMPAT_BSDPTY stuff from tty COMPAT_60 stuff. Enables
building of COMPAT_60 module whether or not COMPAT_BSDPTY is
defined in the kernel.
 1.4.16.3 18-Mar-2018  pgoyette Merge changes from HEAD into ccd_60.c

For all of the individual xxx_60_{init,fini} routines, don't force
them to artificially return a status; just make them void. This
simplifies the compat_60_{init,fini} handling of errors that remain.
 1.4.16.2 18-Mar-2018  pgoyette Initial pass at getting the tty stuff properly modularized. Subject
to review and revision.
 1.4.16.1 08-Mar-2018  pgoyette We don't need to conditionalize the code on COMPAT_60 since we'll
only include the source file when COMPAT_60 is requested (either
by kernel option or module specification)
 1.4.8.1 27-Apr-2017  pgoyette Restore all work from the former pgoyette-localcount branch (which is
now abandoned doe to cvs merge botch).

The branch now builds, and installs via anita. There are still some
problems (cgd is non-functional and all atf tests time-out) but they
will get resolved soon.
 1.4.2.1 20-Jul-2016  pgoyette Adapt machine-independant code to the new {b,c}devsw reference-counting
(using localcount(9)). All callers of {b,c}devsw_lookup() now call
{b,c}devsw_lookup_acquire() which retains a reference on the 'struct
{b,c}devsw'. This reference must be released by the caller once it is
finished with the structure's content (or other data that would disappear
if the 'struct {b,c}devsw' were to disappear).
 1.10.6.1 01-Aug-2021  thorpej Sync with HEAD.
 1.4 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.3 20-Dec-2007  dsl branches: 1.3.12; 1.3.96; 1.3.98;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.2 09-Feb-2007  ad branches: 1.2.20; 1.2.28; 1.2.32;
Merge newlock2 to head.
 1.1 26-Jun-2006  mrg branches: 1.1.2; 1.1.6; 1.1.8; 1.1.10; 1.1.16;
version the socket(2) syscall. for compat30 socket, we use
EPROTONOSUPPORT instead of EAFNOSUPPORT.

from pavel@ with a little bit of clean up from myself.

XXX: netbsd32 (and perhaps other emulations) should be able
XXX: to call the standard socket calls for this i think, but
XXX: revisit this at another time.
 1.1.16.4 21-Jan-2008  yamt sync with head
 1.1.16.3 26-Feb-2007  yamt sync with head.
 1.1.16.2 30-Dec-2006  yamt sync with head.
 1.1.16.1 26-Jun-2006  yamt file uipc_syscalls_30.c was added on branch yamt-lazymbuf on 2006-12-30 20:47:31 +0000
 1.1.10.2 09-Sep-2006  rpaulo sync with head
 1.1.10.1 26-Jun-2006  rpaulo file uipc_syscalls_30.c was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:45:14 +0000
 1.1.8.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.1.6.2 11-Aug-2006  yamt sync with head
 1.1.6.1 26-Jun-2006  yamt file uipc_syscalls_30.c was added on branch yamt-pdpolicy on 2006-08-11 15:43:19 +0000
 1.1.2.2 13-Jul-2006  gdamore Merge from HEAD.
 1.1.2.1 26-Jun-2006  gdamore file uipc_syscalls_30.c was added on branch gdamore-uart on 2006-07-13 17:49:07 +0000
 1.2.32.1 02-Jan-2008  bouyer Sync with HEAD
 1.2.28.1 26-Dec-2007  ad Sync with head.
 1.2.20.1 09-Jan-2008  matt sync with HEAD
 1.3.98.1 10-Jun-2019  christos Sync with HEAD
 1.3.96.2 22-Sep-2018  pgoyette #include "opt_compat_netbsd.h" for all sources that provide compat code.
 1.3.96.1 28-Mar-2018  pgoyette Initial pass at a compat_30 module.

Still needs some work for dev/vnd and various dev/usb/*
 1.3.12.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.3.12.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.24 07-Jul-2022  riastradh ifioctl(9): Don't touch ifconf or ifreq until command is validated.

sys_ioctl validates the data pointer according to the command's size
and direction. But userland may ioctl commands other than
OSIOCGIFCONF or OOSIOCGIFCONF -- and if userland passes an IOC_VOID
command, the argument is passed through verbatim and may be null.

Reported-by: syzbot+19b1bf83e5481273eafc@syzkaller.appspotmail.com
https://syzkaller.appspot.com/bug?id=f4c91a7dcd31901c80d91af6ed01456faf0a7286

Reported-by: syzbot+442c033feb784d055185@syzkaller.appspotmail.com
https://syzkaller.appspot.com/bug?id=4a3a4b92dbe9695046ff17a5474cef52aed23e0b

Reported-by: syzbot+4c87d0cdf7025741ea7a@syzkaller.appspotmail.com
https://syzkaller.appspot.com/bug?id=3e5f42c998e43ad42da40dec3c7873e6aae187e4
 1.23 16-Jul-2020  msaitoh Don't accept negative value.

Reported-by: syzbot+e71a77402d6668f1868d@syzkaller.appspotmail.com
 1.22 22-Feb-2020  maxv pass the address of the field, instead of relying on it being the first
field of the structure, no functional change
 1.21 12-Dec-2019  pgoyette branches: 1.21.2;
Rather than keeping a separate mutex, condvar, and pserialize for each
module hook, we can share a common set of synchronization structures.
This cuts the amount of cacheline_aligned data for these structures by
50%.

Note that we still have a per-hook localcount, since we need to count
individual references.

As discussed with riastradh@

Welcome to 9.99.22 !
 1.20 23-Apr-2019  msaitoh branches: 1.20.2;
KNF. No functional change.
 1.19 18-Apr-2019  christos Zero out the ifreq struct for SIOCGIFCONF to avoid up to 127 bytes of stack
disclosure. From Andy Nguyen, many thanks! This is the compat code part
pointed out by ozaki-r@
 1.18 01-Mar-2019  pgoyette Rename the MODULE_*_HOOK() macros to MODULE_HOOK_*() as briefly
discussed on irc.

NFCI intended.

Ride the earlier kernel bump - it;s getting crowded.
 1.17 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.16 12-Apr-2018  christos branches: 1.16.2;
provide vectors for the ifconf compat code and ifdatareq compat code.
 1.15 22-Nov-2017  martin branches: 1.15.2;
#idef the label next_ifa: just like the only goto using it.
 1.14 22-Nov-2017  ozaki-r Fix and make consistent of usages of psz/psref in ifconf variants
 1.13 14-Mar-2017  ozaki-r branches: 1.13.6;
Use if_acquire and if_release instead of using psref API directly

- Provide if_release for consistency to if_acquire
- Use if_acquire and if_release for ifp iterations
- Make ifnet_psref_class static
 1.12 01-Aug-2016  ozaki-r branches: 1.12.2;
Apply pserialize and psref to struct ifaddr and its variants

This change makes struct ifaddr and its variants (in_ifaddr and in6_ifaddr)
MP-safe by using pserialize and psref. At this moment, pserialize_perform
and psref_target_destroy are disabled because (1) we don't need them
because of softnet_lock (2) they cause a deadlock because of softnet_lock.
So we'll enable them when we remove softnet_lock in the future.
 1.11 07-Jul-2016  ozaki-r branches: 1.11.2;
Switch the address list of intefaces to pslist(9)

As usual, we leave the old list to avoid breaking kvm(3) users.
 1.10 16-Jun-2016  ozaki-r Use curlwp_bind and curlwp_bindx instead of open-coding LP_BOUND
 1.9 12-May-2016  ozaki-r Protect ifnet list with psz and psref

The change ensures that ifnet objects in the ifnet list aren't freed during
list iterations by using pserialize(9) and psref(9).

Note that the change adds a pslist(9) for ifnet but doesn't remove the
original ifnet list (ifnet_list) to avoid breaking kvm(3) users. We
shouldn't use the original list in the kernel anymore.
 1.8 26-Nov-2014  ozaki-r branches: 1.8.2;
Tweak ifconf variants

The tweaks make the code intention clear and make further changes easy.

No functional change.
 1.7 19-Jan-2011  tsutsui branches: 1.7.16; 1.7.32; 1.7.34; 1.7.38;
Remove includes <sys/mount.h> and <sys/sched.h> added for <sys/syscallargs.h>.
Now they are handled by $sysarghdrextra in sys/kern/syscalls.conf.
 1.6 05-Dec-2007  dyoung branches: 1.6.38; 1.6.44;
Use IFADDR_EMPTY().
 1.5 05-Dec-2007  dyoung Use IFADDR_FOREACH().
 1.4 02-Jun-2007  enami branches: 1.4.2; 1.4.4; 1.4.10; 1.4.12; 1.4.14; 1.4.20; 1.4.22;
Reduce difference between compat_ifconf() and ifconf():
- exit on error rather than proceeding to next interface.
- make code simpler.
 1.3 30-May-2007  christos Move the nasty ifdefs in one place. Requested by ad and dyoung.
 1.2 29-May-2007  christos wrap the whole function in COMPAT_40
 1.1 29-May-2007  christos Add a sockaddr_storage member to "struct ifreq" maintaining backwards
compatibility with the older ioctls. This avoids stack smashing and
abuse of "struct sockaddr" when ioctls placed "struct sockaddr_foo's" that
were longer than "struct sockaddr".
XXX: Some of the emulations might be broken; I tried to add code for
them but I did not test them.
 1.4.22.1 08-Dec-2007  ad Sync with head.
 1.4.20.1 08-Dec-2007  mjf Sync with HEAD.
 1.4.14.3 07-Dec-2007  yamt sync with head
 1.4.14.2 03-Sep-2007  yamt sync with head.
 1.4.14.1 02-Jun-2007  yamt file uipc_syscalls_40.c was added on branch yamt-lazymbuf on 2007-09-03 14:31:52 +0000
 1.4.12.1 09-Jan-2008  matt sync with HEAD
 1.4.10.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.4.4.2 11-Jul-2007  mjf Sync with head.
 1.4.4.1 02-Jun-2007  mjf file uipc_syscalls_40.c was added on branch mjf-ufs-trans on 2007-07-11 20:03:49 +0000
 1.4.2.3 09-Jun-2007  ad Sync with head.
 1.4.2.2 09-Jun-2007  ad Sync with head.
 1.4.2.1 02-Jun-2007  ad file uipc_syscalls_40.c was added on branch vmlocking on 2007-06-09 21:37:08 +0000
 1.6.44.1 06-Jun-2011  jruoho Sync with HEAD.
 1.6.38.1 05-Mar-2011  rmind sync with head
 1.7.38.1 19-Apr-2019  martin Pull up following revision(s) via patch (requested by christos in ticket #1689):

sys/compat/linux/common/linux_socket.c: revision 1.145
sys/net/if.c: revision 1.449
sys/compat/linux32/common/linux32_socket.c: revision 1.30
sys/compat/common/uipc_syscalls_40.c: revision 1.19

Zero out the ifreq struct for SIOCGIFCONF to avoid up to 127 bytes of stack
disclosure. From Andy Nguyen, many thanks!

-

Zero out the ifreq struct for SIOCGIFCONF to avoid up to 127 bytes of stack
disclosure. From Andy Nguyen, many thanks! This is the compat code part
pointed out by ozaki-r@
 1.7.34.1 19-Apr-2019  martin Pull up following revision(s) via patch (requested by christos in ticket #1689):

sys/compat/linux/common/linux_socket.c: revision 1.145
sys/net/if.c: revision 1.449
sys/compat/linux32/common/linux32_socket.c: revision 1.30
sys/compat/common/uipc_syscalls_40.c: revision 1.19

Zero out the ifreq struct for SIOCGIFCONF to avoid up to 127 bytes of stack
disclosure. From Andy Nguyen, many thanks!

-

Zero out the ifreq struct for SIOCGIFCONF to avoid up to 127 bytes of stack
disclosure. From Andy Nguyen, many thanks! This is the compat code part
pointed out by ozaki-r@
 1.7.32.1 19-Apr-2019  martin Pull up following revision(s) via patch (requested by christos in ticket #1689):

sys/compat/linux/common/linux_socket.c: revision 1.145
sys/net/if.c: revision 1.449
sys/compat/linux32/common/linux32_socket.c: revision 1.30
sys/compat/common/uipc_syscalls_40.c: revision 1.19

Zero out the ifreq struct for SIOCGIFCONF to avoid up to 127 bytes of stack
disclosure. From Andy Nguyen, many thanks!

-

Zero out the ifreq struct for SIOCGIFCONF to avoid up to 127 bytes of stack
disclosure. From Andy Nguyen, many thanks! This is the compat code part
pointed out by ozaki-r@
 1.7.16.1 03-Dec-2017  jdolecek update from HEAD
 1.8.2.4 28-Aug-2017  skrll Sync with HEAD
 1.8.2.3 05-Oct-2016  skrll Sync with HEAD
 1.8.2.2 09-Jul-2016  skrll Sync with HEAD
 1.8.2.1 29-May-2016  skrll Sync with HEAD
 1.11.2.2 20-Mar-2017  pgoyette Sync with HEAD
 1.11.2.1 06-Aug-2016  pgoyette Sync with HEAD
 1.12.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.13.6.4 17-Jul-2020  martin Pull up following revision(s) (requested by msaitoh in ticket #1576):

sys/net/if.c: revision 1.479
sys/compat/common/uipc_syscalls_40.c: revision 1.23
sys/compat/linux/common/linux_socket.c: revision 1.150
sys/compat/linux32/common/linux32_socket.c: revision 1.31

Don't accept negative value.
 1.13.6.3 19-Apr-2019  martin Pull up following revision(s) (requested by christos in ticket #1233):

sys/compat/linux/common/linux_socket.c: revision 1.145
sys/net/if.c: revision 1.449
sys/compat/linux32/common/linux32_socket.c: revision 1.30
sys/compat/common/uipc_syscalls_40.c: revision 1.19

Zero out the ifreq struct for SIOCGIFCONF to avoid up to 127 bytes of stack
disclosure. From Andy Nguyen, many thanks!

-

Zero out the ifreq struct for SIOCGIFCONF to avoid up to 127 bytes of stack
disclosure. From Andy Nguyen, many thanks! This is the compat code part
pointed out by ozaki-r@
 1.13.6.2 04-Dec-2017  martin Additionaly pull up rev 1.15 for ticket #407, requested by ozaki-r:
#idef the label next_ifa: just like the only goto using it.
 1.13.6.1 30-Nov-2017  martin Pull up following revision(s) (requested by ozaki-r in ticket #407):
sys/compat/linux32/common/linux32_socket.c: revision 1.28
sys/net/if.c: revision 1.400
sys/netipsec/key.c: revision 1.243
sys/compat/linux/common/linux_socket.c: revision 1.139
sys/netinet/ip_carp.c: revision 1.93
sys/netinet6/in6.c: revision 1.252
sys/netinet6/in6.c: revision 1.253
sys/netinet6/in6.c: revision 1.254
sys/net/if_spppsubr.c: revision 1.173
sys/net/if_spppsubr.c: revision 1.174
sys/compat/common/uipc_syscalls_40.c: revision 1.14
Protect IFADDR_READER_FOREACH and obtained ifa with psz/psref
Fix usage of FOREACH macro
key_sad.lock is held there so SAVLIST_WRITER_FOREACH is enough.
Protect IFADDR_READER_FOREACH and obtained ifa with psz/psref
Protect IFADDR_READER_FOREACH and obtained ifa with psz/psref (more)
Fix and make consistent of usages of psz/psref in ifconf variants
Remove unnecessary goto because there is no cleanup code to share (NFC)
Tweak a condition; we don't need to care ifacount to be negative
Fix a race condition of in6_ifinit
in6_ifinit checks the number of IPv6 addresses on a given interface and
if it's zero (i.e., an IPv6 address being assigned to the interface
is the first one), call if_addr_init. However, the actual assignment of
the address (ifa_insert) is out of in6_ifinit. The check and the
assignment must be done atomically.
Fix it by holding in6_ifaddr_lock during in6_ifinit and ifa_insert.
And also add missing pserialize to IFADDR_READER_FOREACH.
 1.15.2.13 23-Jan-2019  pgoyette Convert the macros for setting and unsetting a hook to generate
in-line code rather than using an intermediary hook##set routine.
Hooks are set and unset only in one place, so the intermediary
routine provides no benefit. IMHO using the macro at the point-
of-call is more readable than using it elsewhere in the code and
then calling the generated intermediary routine (for which you
won't even find its declaration or definition unless you remember
to search for the HOOK_SET macro instead).

NFC intended, will verify with a bulk build and an atf test run.
 1.15.2.12 15-Oct-2018  pgoyette Convert a couple more hooks to the MP-safe mechanism.

While here, clean up some headers and remove any that are now empty.
 1.15.2.11 22-Sep-2018  pgoyette #include "opt_compat_netbsd.h" for all sources that provide compat code.
 1.15.2.10 20-Sep-2018  pgoyette Use the MP-safe hooks mechanism for the uipc_syscalls_40 and _50
routines.
 1.15.2.9 16-Apr-2018  pgoyette Rename if_[45]0_{init,fini} entry points to more appropriate and more
consistent uipc_syscalls_[45]0_{init,fini} and remove some multiple
declarations.
 1.15.2.8 16-Apr-2018  pgoyette Sync with HEAD, resolve some conflicts
 1.15.2.7 15-Apr-2018  pgoyette Make compat_ifconf() and compat_ifdatareq() static
 1.15.2.6 12-Apr-2018  pgoyette Merge christos's recent changes on HEAD
 1.15.2.5 08-Mar-2018  pgoyette Remove unnecessary conditionals. These files aren't built unless
their content is needed (via config option or module configuration).
 1.15.2.4 08-Mar-2018  pgoyette Handle ifconf() compat vectors
 1.15.2.3 06-Mar-2018  pgoyette Use a .h file for declaring the if_40_{init, fini} routines
 1.15.2.2 06-Mar-2018  pgoyette Typo in function declaration.
 1.15.2.1 06-Mar-2018  pgoyette Untangle some networking compat code so we can build a kernel with
networking and MODULAR, but without any actual COMPAT_* code (ie,
assuming that all the compat stuff can be added later via modules).
 1.16.2.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.16.2.1 10-Jun-2019  christos Sync with HEAD
 1.20.2.1 17-Jul-2020  martin Pull up following revision(s) (requested by msaitoh in ticket #1018):

sys/net/if.c: revision 1.479
sys/compat/common/uipc_syscalls_40.c: revision 1.23
sys/compat/linux/common/linux_socket.c: revision 1.150
sys/compat/linux32/common/linux32_socket.c: revision 1.31

Don't accept negative value.
 1.21.2.1 29-Feb-2020  ad Sync with head.
 1.51 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.50 06-Sep-2018  maxv Remove the network ATM code.
 1.49 03-May-2018  christos branches: 1.49.2;
Fix COMPAT_NETBSD32 cmsg handling:

1. alignment was wrong for > 1 message
2. macros were doing incorrect pointer comparisons, fortunately ending
the iteration early after the fists cmsg instead of crashing.
3. don't output 32 bit ktrace records for cmsg. 32 bit programs running
under emulation on 64 bit systems should produce 64 bit ktrace records
so that the native ktrace can handle the records; remove extra arguments
that are now not needed (the 32 bit msghdr).
4. output the correct type for cmsg trace records.
5. output all the cmsg records in traces instead of just the first one.

Welcome to 8.99.15 because of the argument removal.

XXX: Really all the code should be changed to use the CMSG_{FIRST,NXT}HDR
macros...
 1.48 16-Mar-2018  christos PR/53103: Timo Buhrmester: linux emulation of sendto(2) broken

The sockargs refactoring broke it, because sockargs only works with a user
address. Added an argument to sockargs to indicate where the address is
coming from. Welcome to 8.99.14.
 1.47 13-Sep-2016  martin branches: 1.47.14;
Make the ktrace record written by do_sys_sendmsg/do_sys_recvmsg overridable
by the caller. Use this in compat_netbsd32 to log the 32bit version, so
the 32bit userland kdump is happy.
 1.46 09-Nov-2014  maxv branches: 1.46.2;
Do not uselessly include <sys/malloc.h>.
 1.45 05-Sep-2014  matt Try not to use f_data, use f_{vnode,socket,pipe,mqueue,kqueue,ksem} to get
a correctly typed pointer.
 1.44 14-Nov-2008  ad branches: 1.44.26; 1.44.42;
- Move some more compat code into sys/compat.
- Split 4.3BSD ifioctl stuff into its own file.
- Remove some ifdefs that include small fragments of vfs compat code
which are difficult to relocate elsewhere.
 1.43 29-Apr-2008  ad branches: 1.43.2; 1.43.6; 1.43.8; 1.43.10;
Remove now bogus assertion.
 1.42 24-Apr-2008  ad branches: 1.42.2;
Merge the socket locking patch:

- Socket layer becomes MP safe.
- Unix protocols become MP safe.
- Allows protocol processing interrupts to safely block on locks.
- Fixes a number of race conditions.

With much feedback from matt@ and plunky@.
 1.41 15-Jan-2008  martin branches: 1.41.6;
#ifdef COMPAT_20 the ioctls only available conditionally. Patch from
Geoff Wing.
 1.40 14-Jan-2008  martin Add net80211 ioctls that I apparently ovelooked when grepping for ioctls
that need "struct ifreq" compat treatment.
This makes for example old (like 4.0) wpa_supplicant work with -current
kernels.
 1.39 20-Dec-2007  dsl Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.38 08-Dec-2007  dsl branches: 1.38.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.37 11-Sep-2007  gdt branches: 1.37.6; 1.37.8;
remove SIOCSIFALIFETIME_IN6 (should have been part of previous commit)
 1.36 20-Aug-2007  martin branches: 1.36.2;
Remove all ioctls from the conversion list that are explicitly defined
to use struct oifreq - the magic size changing makes them fail.
 1.35 20-Aug-2007  martin Sigh - revert previous. Seems we can't avoid the big list, so fill it.
Now both "ifconfig ... create" and "pppoectl -d" work again with old
userland.
 1.34 20-Aug-2007  martin Put back the previous hack to make compat_cvtcmd() work for all the ioctls
that use struct ifreq which have not been explicitly versioned.
If someone feels like fixing it with a list aproach, I think below is
a complete list - the one used in the previous version missed a lot of them.

BIOCGETIF
BIOCSETIF
GREDSOCK
GREGADDRD
GREGADDRS
GREGPROTO
GRESADDRD
GRESADDRS
GRESPROTO
GRESSOCK
SIOCADDMULTI
SIOCDELMULTI
SIOCDIFADDR
SIOCDIFADDR_IN6
SIOCDIFPHYADDR
SIOCGDEFIFACE_IN6
SIOCGIFADDR
SIOCGIFADDR_IN6
SIOCGIFAFLAG_IN6
SIOCGIFALIFETIME_IN6
SIOCGIFBRDADDR
SIOCGIFDLT
SIOCGIFDSTADDR
SIOCGIFDSTADDR_IN6
SIOCGIFFLAGS
SIOCGIFGENERIC
SIOCGIFMETRIC
SIOCGIFMTU
SIOCGIFNETMASK
SIOCGIFNETMASK_IN6
SIOCGIFPDSTADDR
SIOCGIFPDSTADDR_IN6
SIOCGIFPSRCADDR
SIOCGIFPSRCADDR_IN6
SIOCGIFSTAT_ICMP6
SIOCGIFSTAT_IN6
SIOCGPVCSIF
SIOCGVH
SIOCIFCREATE
SIOCIFDESTROY
SIOCSDEFIFACE_IN6
SIOCSIFADDR
SIOCSIFADDR_IN6
SIOCSIFALIFETIME_IN6
SIOCSIFBRDADDR
SIOCSIFDSTADDR
SIOCSIFDSTADDR_IN6
SIOCSIFFLAGS
SIOCSIFGENERIC
SIOCSIFMEDIA
SIOCSIFMETRIC
SIOCSIFMTU
SIOCSIFNETMASK
SIOCSIFNETMASK_IN6
SIOCSNDFLUSH_IN6
SIOCSPFXFLUSH_IN6
SIOCSPVCSIF
SIOCSRTRFLUSH_IN6
SIOCSVH
TAPGIFNAME
 1.33 20-Aug-2007  skd Clean up net compat ioctls, and clean up handling of wireless ioctls.
 1.32 30-Jun-2007  dsl branches: 1.32.2; 1.32.6;
Changes to sompat socket function to avoid the dreaded stackgap.
 1.31 24-Jun-2007  dsl Update to call do_sys_recv() instead of recvit().
 1.30 01-Jun-2007  dsl Split sys_bind() and sys_connect() so that compat code can use common code
once the 'address' has been copied into an mbuf.
Add extra flags for 'struct msghdr.msg_flags' to indicate that the address
and control are already in mbufs, and that the uio structure is in userspace
for sending data, rename sendit() to do_sys_sendmsg() to ensure no old code
passes in random flags.
Changes to compat code to use new functions - removing some stackgap use.
Fix a 'use after free' in compat_43_sys_recvmsg.
I ***THINK*** the code that converts 'cmsg' formatted data is borked!
svr4_stream.c ought to be generated from svr4_32_stream.c during the build.
 1.29 29-May-2007  christos Add a sockaddr_storage member to "struct ifreq" maintaining backwards
compatibility with the older ioctls. This avoids stack smashing and
abuse of "struct sockaddr" when ioctls placed "struct sockaddr_foo's" that
were longer than "struct sockaddr".
XXX: Some of the emulations might be broken; I tried to add code for
them but I did not test them.
 1.28 04-Mar-2007  christos branches: 1.28.2; 1.28.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.27 09-Feb-2007  ad branches: 1.27.2;
Merge newlock2 to head.
 1.26 29-Jan-2007  hubertf Remove more duplicate headers.
Patch by Slava Semushin <slava.semushin@gmail.com>

Again, this was tested by comparing obj files from a pristine and a patched
source tree against an i386/ALL kernel, and also for src/sbin/fsck_ffs,
src/sbin/fsdb and src/usr.sbin/makefs. Only changes in assert() line numbers
were detected in 'objdump -d' output.
 1.25 11-Dec-2005  christos branches: 1.25.20;
merge ktrace-lwp.
 1.24 24-Sep-2005  christos factor out some of the osockaddr, omsghdr code.
 1.23 26-Feb-2005  perry branches: 1.23.4;
nuke trailing whitespace
 1.22 07-Aug-2003  agc branches: 1.22.8; 1.22.10;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.21 29-Jun-2003  fvdl branches: 1.21.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.20 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.19 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.18 16-Mar-2002  christos make the stackgap_{init,alloc} functions MP friendly (i.e. pass struct proc *
in, instead of using curproc). While there add an optional size argument to
stackgap_init.
 1.17 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.16 22-Jul-2001  jdolecek return EMSGSIZE rather than ENOMEM if it would not be possible to
allocate space for accrights within stackgap
comment the copyin() of msg.msg_control in recvmsg() is safe
 1.15 17-Jul-2001  jdolecek Expel MSG_COMPAT/COMPAT_OLDSOCK, make the COMPAT_43 wrappers
arrange things as needed. Unfortunately, the check in sockargs()
have to stay, since 4.3BSD bind(2), connect(2) and sendto(2) were
not versioned at the time :(

This code was tested to pass regression tests.
 1.14 07-Jul-2001  jdolecek branches: 1.14.2;
compat_43_sys_send(): wrap using sys_sendto() rathen than sendit()
compat_43_sys_recv(): wrap using sys_recvfrom() rathen than recvit()
 1.13 25-Jun-2001  jdolecek Back off the sendit()/recvit() change, some have problems with it
 1.12 25-Jun-2001  jdolecek Add 'kernsa' parameter for sendit()/recvit(); if nonzero, msg->msg_name
is supposed to point directly to struct mbuf or struct sockaddr in kernel
space as appropriate, rather than being a pointer to memory in userland.

This is to be used by compat/* when emulation needs to wrap
send{to|msg}(2)/recv{from|msg}(2) and modify the passed struct
sockaddr.
 1.11 30-Mar-2000  augustss branches: 1.11.6;
Kill register declarations.
 1.10 18-Dec-1998  drochner branches: 1.10.8;
solve the COMPAT_OLDSOCK/MSG_COMPAT problem differently:
The source files which need MSG_COMPAT define COMPAT_OLDSOCK.
 1.9 18-Dec-1998  mrg back out previous; it breaks when MSG_COMPAT is not defined (no compatibility modules)
 1.8 14-Dec-1998  mycroft Nuke some #ifdefs that no longer work with COMPAT_43 defopted.
 1.7 04-Aug-1998  kleink UIO_MAXIOV -> IOV_MAX
 1.6 03-Aug-1998  kleink Fix two off-by-one bugs, both present in each recvmsg(2) and sendmsg(2):
* the first one would cause an unnecessary malloc() of iovec storage for
a msg_iovlen of UIO_SMALLIOV although the required amount of memory has
been allocated on the stack.
* the second one would cause a recvmsg() or sendmsg() with a msg_iovlen of
UIO_MAXIOV to fail with EMSGSIZE, which is also a violation of XNS5.
 1.5 14-Mar-1996  christos Fix compiler warnings
 1.4 10-Feb-1996  christos Don't declare MSG_COMPAT in two places.
More prototype fixes
 1.3 07-Oct-1995  mycroft Prefix names of system call implementation functions with `sys_'.
 1.2 19-Sep-1995  thorpej Make system calls conform to a standard prototype and bring those
prototypes into scope.
 1.1 24-Jun-1995  christos - Extracted all compat routines from the kern directory and moved here.
- Created compat_util.c and compat_util.h to be used by the compatibility
modules, so they don't duplicate the same code.
- Added prototypes to the stackgap allocation routines.
 1.10.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.11.6.8 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.11.6.7 03-Jul-2002  nathanw Whitespace.
 1.11.6.6 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.11.6.5 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.11.6.4 14-Nov-2001  nathanw Catch up to -current.
 1.11.6.3 24-Aug-2001  nathanw A few files and lwp/proc conversions I missed in the last big update.
GENERIC runs again.
 1.11.6.2 24-Aug-2001  nathanw Catch up with -current.
 1.11.6.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.14.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.14.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.14.2.1 03-Aug-2001  lukem update to -current
 1.21.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.21.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.21.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.21.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.21.2.2 03-Aug-2004  skrll Sync with HEAD
 1.21.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.22.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.22.8.1 29-Apr-2005  kent sync with -current
 1.23.4.5 21-Jan-2008  yamt sync with head
 1.23.4.4 27-Oct-2007  yamt sync with head.
 1.23.4.3 03-Sep-2007  yamt sync with head.
 1.23.4.2 26-Feb-2007  yamt sync with head.
 1.23.4.1 21-Jun-2006  yamt sync with head.
 1.25.20.2 01-Feb-2007  ad Sync with head.
 1.25.20.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.27.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.28.4.1 11-Jul-2007  mjf Sync with head.
 1.28.2.4 09-Oct-2007  ad Sync with head.
 1.28.2.3 20-Aug-2007  ad Sync with HEAD.
 1.28.2.2 15-Jul-2007  ad Sync with head.
 1.28.2.1 09-Jun-2007  ad Sync with head.
 1.32.6.3 09-Dec-2007  jmcneill Sync with HEAD.
 1.32.6.2 02-Oct-2007  joerg Sync with HEAD.
 1.32.6.1 03-Sep-2007  jmcneill Sync with HEAD.
 1.32.2.1 03-Sep-2007  skrll Sync with HEAD.
 1.36.2.3 23-Mar-2008  matt sync with HEAD
 1.36.2.2 09-Jan-2008  matt sync with HEAD
 1.36.2.1 06-Nov-2007  matt sync with HEAD
 1.37.8.1 26-Dec-2007  ad Sync with head.
 1.37.6.1 18-Feb-2008  mjf Sync with HEAD.
 1.38.4.2 19-Jan-2008  bouyer Sync with HEAD
 1.38.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.41.6.1 17-Jan-2009  mjf Sync with HEAD.
 1.42.2.2 04-May-2009  yamt sync with head.
 1.42.2.1 16-May-2008  yamt sync with head.
 1.43.10.1 16-Feb-2011  bouyer Pull up following revision(s) (requested by chs in ticket #1541):
sys/compat/common/if_43.c: revision 1.3 via patch
sys/net/if.c: revision 1.247 via patch
PR/44054: Onno van der Linden: Stacksmashing in handling of ioctl OOSIO*
parameter.
can't map the old and the new SIO calls the way we did before because the
numbers have changed. Instead provide a switch. Keep the old code there,
to handle cases we did not handle in the first switch, but this is a hack
and should be removed.
 1.43.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.43.6.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.43.2.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.43.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.44.42.1 17-Jan-2015  martin Pull up following revision(s) (requested by maxv in ticket #427):
sys/compat/svr4/svr4_schedctl.c: revision 1.8
sys/netinet/tcp_timer.c: revision 1.88
sys/miscfs/genfs/layer_vfsops.c: revision 1.45
sys/compat/svr4/svr4_ioctl.c: revision 1.37
sys/ufs/chfs/chfs_vfsops.c: revision 1.14
sys/miscfs/fdesc/fdesc_vfsops.c: revision 1.91
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.30
sys/compat/common/kern_time_50.c: revision 1.28
sys/netinet6/ip6_forward.c: revision 1.74
sys/miscfs/umapfs/umap_vnops.c: revision 1.57
sys/compat/svr4/svr4_fcntl.c: revision 1.74
distrib/sets/lists/comp/mi: revision 1.1931
sys/netinet6/udp6_output.c: revision 1.46
sys/fs/puffs/puffs_compat.c: revision 1.3
sys/fs/udf/udf_rename.c: revision 1.11
sys/compat/svr4/svr4_filio.c: revision 1.24
sys/fs/udf/udf_rename.c: revision 1.12
sys/netinet/tcp_usrreq.c: revision 1.202
sys/miscfs/umapfs/umap_subr.c: revision 1.29
sys/compat/linux/common/linux_fadvise64.c: revision 1.3
sys/netinet/if_atm.c: revision 1.34
sys/miscfs/procfs/procfs_subr.c: revision 1.106
sys/miscfs/genfs/layer_subr.c: revision 1.37
sys/netinet/tcp_sack.c: revision 1.30
sys/compat/freebsd/freebsd_misc.c: revision 1.33
sys/compat/freebsd/freebsd_file.c: revision 1.33
sys/ufs/chfs/chfs_vnode.c: revision 1.12
sys/compat/svr4/svr4_ttold.c: revision 1.34
sys/compat/linux/common/linux_file.c: revision 1.114
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.43
sys/compat/linux/common/linux_signal.c: revision 1.76
sys/compat/common/compat_util.c: revision 1.46
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.18
sys/compat/svr4/svr4_sockio.c: revision 1.36
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.32
sys/compat/svr4/svr4_signal.c: revision 1.66
sys/kern/kern_exec.c: revision 1.410
sys/fs/puffs/puffs_vfsops.c: revision 1.115
sys/compat/svr4/svr4_exec_elf64.c: revision 1.15
sys/compat/linux/arch/i386/linux_machdep.c: revision 1.159
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.50
sys/compat/linux32/common/linux32_misc.c: revision 1.24
sys/netinet/in_pcb.c: revision 1.153
sys/sys/malloc.h: revision 1.116
sys/compat/common/if_43.c: revision 1.9
share/man/man9/Makefile: revision 1.380
sys/netinet/tcp_vtw.c: revision 1.12
sys/miscfs/umapfs/umap_vfsops.c: revision 1.95
sys/ufs/ext2fs/ext2fs_vfsops.c: revision 1.186
sys/compat/common/uipc_syscalls_43.c: revision 1.46
sys/ufs/ext2fs/ext2fs_vnops.c: revision 1.115
sys/fs/puffs/puffs_msgif.c: revision 1.97
sys/compat/svr4/svr4_ipc.c: revision 1.27
sys/compat/linux/common/linux_exec.c: revision 1.117
sys/ufs/ext2fs/ext2fs_readwrite.c: revision 1.66
sys/netinet/tcp_output.c: revision 1.179
sys/compat/svr4/svr4_termios.c: revision 1.28
sys/fs/udf/udf_strat_bootstrap.c: revision 1.4
sys/fs/puffs/puffs_subr.c: revision 1.67
sys/fs/puffs/puffs_node.c: revision 1.36
sys/miscfs/overlay/overlay_vnops.c: revision 1.21
sys/fs/cd9660/cd9660_node.c: revision 1.34
sys/netinet/raw_ip.c: revision 1.146
sys/sys/mallocvar.h: revision 1.13
sys/miscfs/overlay/overlay_vfsops.c: revision 1.63
share/man/man9/malloc.9: revision 1.50
sys/netinet6/dest6.c: revision 1.18
sys/compat/linux/common/linux_uselib.c: revision 1.33
sys/compat/linux/common/linux_socket.c: revision 1.120
share/man/man9/malloc.9: revision 1.51
sys/netinet/tcp_subr.c: revision 1.257
sys/compat/linux/common/linux_socketcall.c: revision 1.45
sys/compat/linux/common/linux_fadvise64_64.c: revision 1.3
sys/compat/freebsd/freebsd_ipc.c: revision 1.17
sys/compat/linux/common/linux_misc_notalpha.c: revision 1.109
sys/compat/linux/arch/alpha/linux_pipe.c: revision 1.17
sys/netinet6/in6_pcb.c: revision 1.132
sys/netinet6/in6_ifattach.c: revision 1.94
sys/compat/svr4/svr4_exec_elf32.c: revision 1.15
sys/miscfs/nullfs/null_vfsops.c: revision 1.90
sys/fs/cd9660/cd9660_util.c: revision 1.12
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.48
sys/compat/freebsd/freebsd_exec_elf32.c: revision 1.20
sys/miscfs/procfs/procfs_vfsops.c: revision 1.94
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.28
sys/compat/linux/common/linux_sched.c: revision 1.67
sys/compat/linux/common/linux_exec_aout.c: revision 1.67
sys/compat/linux/common/linux_pipe.c: revision 1.67
sys/compat/linux/common/linux_llseek.c: revision 1.34
sys/compat/linux/arch/mips/linux_ptrace.c: revision 1.10
Do not uselessly include <sys/malloc.h>.
Cleanup:
- remove struct kmembuckets (dead)
- correctly deadify MALLOC_XX
- remove MALLOC_DEFINE_LIMIT and MALLOC_JUSTDEFINE_LIMIT (dead)
- remove malloc_roundup(), malloc_type_setlimit(), MALLOC_DEFINE_LIMIT()
and MALLOC_JUSTDEFINE_LIMIT() from man 9 malloc
New sentence, new line. Bump date for previous.
Obsolete malloc_roundup(9), malloc_type_setlimit(9) and MALLOC_DEFINE_LIMIT(9)
man pages.
 1.44.26.1 03-Dec-2017  jdolecek update from HEAD
 1.46.2.1 05-Oct-2016  skrll Sync with HEAD
 1.47.14.7 30-Sep-2018  pgoyette Ssync with HEAD
 1.47.14.6 22-Sep-2018  pgoyette #include "opt_compat_netbsd.h" for all sources that provide compat code.
 1.47.14.5 21-May-2018  pgoyette Sync with HEAD
 1.47.14.4 04-May-2018  pgoyette Undo merge of changes from HEAD. This will get re-done properly
at the next sync-with-HEAD (which will also pull in other changes
needed).
 1.47.14.3 04-May-2018  pgoyette Merge rev 1.49 from HEAD
 1.47.14.2 17-Apr-2018  pgoyette First pass at compat modules for 4.3BSD, NetBSD-0.9, and NetBSD-1.0

XXX Still need to deal with the sysctl stuff and other code shared
XXX between 09 and 43
 1.47.14.1 22-Mar-2018  pgoyette Synch with HEAD, resolve conflicts
 1.49.2.1 10-Jun-2019  christos Sync with HEAD
 1.12 28-Sep-2022  msaitoh Simplify sys/compat/sys/sockio.h. No functional change intended.

- Move some definitions from sys/compat/sockio.h to compat/net/if.h.
struct oif_data in sockio.h and if_data50 are the same, so remove oif_data.
Do the same thing to oifdatareq, too.
- u_quad_t -> uint64_t. No functional change.
 1.11 29-Jan-2020  thorpej Don't reference ifp->if_data directly; use if_export_if_data().
 1.10 15-Dec-2019  tsutsui branches: 1.10.2;
Remove clause 3 and 4 leftovers from TNF licenses in more sources.

Confirmed by martin@ in PR/54760.
 1.9 12-Dec-2019  pgoyette Rather than keeping a separate mutex, condvar, and pserialize for each
module hook, we can share a common set of synchronization structures.
This cuts the amount of cacheline_aligned data for these structures by
50%.

Note that we still have a per-hook localcount, since we need to count
individual references.

As discussed with riastradh@

Welcome to 9.99.22 !
 1.8 01-Mar-2019  pgoyette branches: 1.8.4;
Rename the MODULE_*_HOOK() macros to MODULE_HOOK_*() as briefly
discussed on irc.

NFCI intended.

Ride the earlier kernel bump - it;s getting crowded.
 1.7 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.6 12-Sep-2018  msaitoh Fix a bug that SIOC[GZ]IFDATA returned old ifreq structure.
 1.5 26-Apr-2018  roy branches: 1.5.2;
Test for valid interface for ioctls that demand it.

Thanks to Robert Swindells for the patch.
 1.4 12-Apr-2018  christos provide vectors for the ifconf compat code and ifdatareq compat code.
 1.3 19-Jan-2011  tsutsui branches: 1.3.56;
Remove includes <sys/mount.h> and <sys/sched.h> added for <sys/syscallargs.h>.
Now they are handled by $sysarghdrextra in sys/kern/syscalls.conf.
 1.2 11-Jan-2009  christos branches: 1.2.2; 1.2.4; 1.2.8; 1.2.12; 1.2.14;
merge christos-time_t
 1.1 27-Nov-2008  christos branches: 1.1.2;
file uipc_syscalls_50.c was initially added on branch christos-time_t.
 1.1.2.1 27-Nov-2008  christos handle ifdatareq
 1.2.14.1 06-Jun-2011  jruoho Sync with HEAD.
 1.2.12.1 05-Mar-2011  rmind sync with head
 1.2.8.2 04-May-2009  yamt sync with head.
 1.2.8.1 11-Jan-2009  yamt file uipc_syscalls_50.c was added on branch yamt-nfs-mp on 2009-05-04 08:12:17 +0000
 1.2.4.2 19-Jan-2009  skrll Sync with HEAD.
 1.2.4.1 11-Jan-2009  skrll file uipc_syscalls_50.c was added on branch nick-hppapmap on 2009-01-19 13:17:17 +0000
 1.2.2.2 17-Jan-2009  mjf Sync with HEAD.
 1.2.2.1 11-Jan-2009  mjf file uipc_syscalls_50.c was added on branch mjf-devfs2 on 2009-01-17 13:28:41 +0000
 1.3.56.13 23-Jan-2019  pgoyette Convert the macros for setting and unsetting a hook to generate
in-line code rather than using an intermediary hook##set routine.
Hooks are set and unset only in one place, so the intermediary
routine provides no benefit. IMHO using the macro at the point-
of-call is more readable than using it elsewhere in the code and
then calling the generated intermediary routine (for which you
won't even find its declaration or definition unless you remember
to search for the HOOK_SET macro instead).

NFC intended, will verify with a bulk build and an atf test run.
 1.3.56.12 15-Oct-2018  pgoyette Convert a couple more hooks to the MP-safe mechanism.

While here, clean up some headers and remove any that are now empty.
 1.3.56.11 30-Sep-2018  pgoyette Ssync with HEAD
 1.3.56.10 22-Sep-2018  pgoyette #include "opt_compat_netbsd.h" for all sources that provide compat code.
 1.3.56.9 20-Sep-2018  pgoyette Use the MP-safe hooks mechanism for the uipc_syscalls_40 and _50
routines.
 1.3.56.8 02-May-2018  pgoyette Synch with HEAD
 1.3.56.7 26-Apr-2018  pgoyette Import rev 1.5 from HEAD
 1.3.56.6 16-Apr-2018  pgoyette Rename if_[45]0_{init,fini} entry points to more appropriate and more
consistent uipc_syscalls_[45]0_{init,fini} and remove some multiple
declarations.
 1.3.56.5 16-Apr-2018  pgoyette Sync with HEAD, resolve some conflicts
 1.3.56.4 12-Apr-2018  pgoyette Merge christos's recent changes on HEAD
 1.3.56.3 08-Mar-2018  pgoyette Remove unnecessary conditionals. These files aren't built unless
their content is needed (via config option or module configuration).
 1.3.56.2 08-Mar-2018  pgoyette Clean up compat routine vectors
 1.3.56.1 08-Mar-2018  pgoyette Implement vector initialization for ifreqo2n and ifdatareq
 1.5.2.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.5.2.1 10-Jun-2019  christos Sync with HEAD
 1.8.4.1 18-Dec-2019  martin Pull up following revision(s) (requested by tsutsui in ticket #570):

sys/compat/netbsd32/netbsd32_compat_50_sysv.c: revision 1.3
sys/dev/raidframe/rf_compat50.h: revision 1.6
sys/arch/emips/emips/bus_space.c: revision 1.3
sys/compat/net/if.h: revision 1.5
sys/arch/emips/stand/common/bootinfo.c: revision 1.2
sys/compat/common/sysv_msg_50.c: revision 1.5
sys/compat/common/kern_time_30.c: revision 1.8
sys/arch/emips/stand/common/bootinfo.h: revision 1.2
sys/arch/ia64/include/bus.h: revision 1.4
sys/arch/ia64/ia64/bus_space.c: revision 1.2
sys/compat/common/sysv_shm_50.c: revision 1.5
sys/dev/ic/adw.h: revision 1.15
sys/compat/common/uipc_syscalls_50.c: revision 1.10
sys/arch/emips/ebus/flash_ebus.c: revision 1.22
sys/dev/ic/adv.h: revision 1.15
sys/dev/ic/adwmcode.c: revision 1.18
sys/dev/ic/advlib.c: revision 1.29
sys/arch/hpcarm/include/kloader.h: revision 1.3
sys/dev/usb/uberry.c: revision 1.16
sys/compat/common/sysv_sem_50.c: revision 1.5
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.43
sys/dev/ic/advlib.h: revision 1.21
sys/dev/ic/adv.c: revision 1.50
sys/compat/netinet6/in6_var.h: revision 1.5
sys/arch/hpc/stand/hpcboot/arm/arm_sa1100_asm.asm: revision 1.2
sys/arch/emips/include/loadfile_machdep.h: revision 1.3
sys/arch/emips/stand/common/prom_iface.c: revision 1.7
sys/dev/ic/adw.c: revision 1.56
sys/dev/ic/adwmcode.h: revision 1.12
sys/dev/ic/advmcode.c: revision 1.10
sys/arch/emips/ebus/ace_ebus.c: revision 1.22
sys/compat/netbsd32/netbsd32_compat_60.c: revision 1.5
sys/dev/raidframe/rf_compat50.c: revision 1.13
sys/arch/x68k/dev/intiovar.h: revision 1.15
sys/dev/usb/uipad.c: revision 1.8
sys/arch/zaurus/include/kloader.h: revision 1.3
sys/arch/emips/stand/common/bootxx.c: revision 1.2
sys/dev/ic/adwlib.h: revision 1.23
sys/dev/ic/adwlib.c: revision 1.44
sys/compat/netbsd32/netbsd32_compat_16.c: revision 1.3
sys/arch/amigappc/include/intr.h: revision 1.27
sys/arch/x68k/dev/mfp.c: revision 1.27
sys/arch/arm/at91/at91dbgu.c: revision 1.17
sys/dev/ic/advmcode.h: revision 1.7
sys/compat/ultrix/ultrix_exec.h: revision 1.7
sys/compat/common/vfs_syscalls_50.c: revision 1.24
sys/arch/mips/cavium/octeon_dma.c: revision 1.3
sys/arch/hpc/stand/hpcboot/arm/arm_pxa2x0_asm.asm: revision 1.2

Remove clause 3 and 4 from TNF licenses.
Ok'ed by martin@ in PR/54760.

Remove clause 3 and 4 leftovers from TNF licenses in more sources.
Confirmed by martin@ in PR/54760.
 1.10.2.1 29-Feb-2020  ad Sync with head.
 1.5 12-Dec-2019  pgoyette Rather than keeping a separate mutex, condvar, and pserialize for each
module hook, we can share a common set of synchronization structures.
This cuts the amount of cacheline_aligned data for these structures by
50%.

Note that we still have a per-hook localcount, since we need to count
individual references.

As discussed with riastradh@

Welcome to 9.99.22 !
 1.4 01-Mar-2019  pgoyette Rename the MODULE_*_HOOK() macros to MODULE_HOOK_*() as briefly
discussed on irc.

NFCI intended.

Ride the earlier kernel bump - it;s getting crowded.
 1.3 29-Jan-2019  pgoyette Normalize all the compat hooks' names to the form

<subsystem>_<function>_<version>_hook

NFCI

XXX Note that although this introduces a change in the kernel-to-
XXX module interface, we are NOT bumping the kernel version number.
XXX We will bump the version number once the interface stabilizes.
 1.2 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.1 06-Apr-2016  roy branches: 1.1.2; 1.1.18; 1.1.20; 1.1.22;
Add sc_pid to sockcred so that SOCK_DGRAM and LOCAL_CREDS socket option
can learn the process id of the AF_LOCAL sender.
Add compat glue for old structure.
 1.1.22.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.1.22.1 10-Jun-2019  christos Sync with HEAD
 1.1.20.6 23-Jan-2019  pgoyette Convert the macros for setting and unsetting a hook to generate
in-line code rather than using an intermediary hook##set routine.
Hooks are set and unset only in one place, so the intermediary
routine provides no benefit. IMHO using the macro at the point-
of-call is more readable than using it elsewhere in the code and
then calling the generated intermediary routine (for which you
won't even find its declaration or definition unless you remember
to search for the HOOK_SET macro instead).

NFC intended, will verify with a bulk build and an atf test run.
 1.1.20.5 18-Jan-2019  pgoyette Don't restrict hooks to having only int or void types. Pass the hook's
type to the various macros, as needed.

Allows us to reduce diffs to original in at least one or two places (we
no longer have to provide an additional parameter to the hook routine
for returning a non-int return value).
 1.1.20.4 14-Jan-2019  pgoyette Create a variant of the HOOK macros that handles hook routines of
type void, and use them where appropriate.
 1.1.20.3 15-Oct-2018  pgoyette Convert the compat70_unp_addsockcred hook to the MP-safe mechanism.

XXX One more remaining: sysvipc50_sysctl
 1.1.20.2 22-Sep-2018  pgoyette #include "opt_compat_netbsd.h" for all sources that provide compat code.
 1.1.20.1 08-Mar-2018  pgoyette No need to compile conditionally, since it won't be compiled at all
unless requested.
 1.1.18.2 03-Dec-2017  jdolecek update from HEAD
 1.1.18.1 06-Apr-2016  jdolecek file uipc_usrreq_70.c was added on branch tls-maxphys on 2017-12-03 11:36:53 +0000
 1.1.2.2 22-Apr-2016  skrll Sync with HEAD
 1.1.2.1 06-Apr-2016  skrll file uipc_usrreq_70.c was added on branch nick-nhusb on 2016-04-22 15:44:12 +0000
 1.1 29-Mar-2018  pgoyette branches: 1.1.2;
file usb_30_subr.c was initially added on branch pgoyette-compat.
 1.1.2.2 29-Mar-2018  pgoyette Rename usb_30_subr.c --> usb_subr_30.c for consistency with others
 1.1.2.1 29-Mar-2018  pgoyette Split out the usb compat_30 code and add it to the module
 1.7 31-Jul-2023  christos Don't call versioned stuff "old". Follow the naming convention for versioning
and name them after the last version of the OS they appeared on.
 1.6 12-Dec-2019  pgoyette Rather than keeping a separate mutex, condvar, and pserialize for each
module hook, we can share a common set of synchronization structures.
This cuts the amount of cacheline_aligned data for these structures by
50%.

Note that we still have a per-hook localcount, since we need to count
individual references.

As discussed with riastradh@

Welcome to 9.99.22 !
 1.5 26-Sep-2019  christos fix sign-compare issues.
 1.4 01-Mar-2019  pgoyette branches: 1.4.4;
Rename the MODULE_*_HOOK() macros to MODULE_HOOK_*() as briefly
discussed on irc.

NFCI intended.

Ride the earlier kernel bump - it;s getting crowded.
 1.3 29-Jan-2019  pgoyette Normalize all the compat hooks' names to the form

<subsystem>_<function>_<version>_hook

NFCI

XXX Note that although this introduces a change in the kernel-to-
XXX module interface, we are NOT bumping the kernel version number.
XXX We will bump the version number once the interface stabilizes.
 1.2 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.1 29-Mar-2018  pgoyette branches: 1.1.2;
file usb_subr_30.c was initially added on branch pgoyette-compat.
 1.1.2.7 23-Jan-2019  pgoyette Convert the macros for setting and unsetting a hook to generate
in-line code rather than using an intermediary hook##set routine.
Hooks are set and unset only in one place, so the intermediary
routine provides no benefit. IMHO using the macro at the point-
of-call is more readable than using it elsewhere in the code and
then calling the generated intermediary routine (for which you
won't even find its declaration or definition unless you remember
to search for the HOOK_SET macro instead).

NFC intended, will verify with a bulk build and an atf test run.
 1.1.2.6 13-Jan-2019  pgoyette Remove the HOOK2 versions of the MODULE_HOOK macros. There were
only a few uses, and using them led to some lack of clarity in the
code. Instead, we now use two separate hooks, with names that
make it clear(er) what we're doing.

This also positions us to start unraveling some of the rtsock_50
mess, which will need (at least) five hooks.
 1.1.2.5 26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.1.2.4 23-Sep-2018  pgoyette Don't try to include usb_verbose.h - it might not exist on platforms
that don't have USB!

It turns out that nothing uses it any.
 1.1.2.3 18-Sep-2018  pgoyette The COMPAT_HOOK macros were renamed to MODULE_HOOK, adjust all callers
 1.1.2.2 18-Sep-2018  pgoyette Split the COMPAT_CALL_HOOK to separate the declaration from the
implementation. Some hooks are called from multiple source files,
and the old method resulted in duplicate implementations.

Implement MP-safe hooks for the usb_subr_30 code. Pass the helper
functions as arguments to the compat code so it does not have to
determine if the kernel contains usb code.
 1.1.2.1 29-Mar-2018  pgoyette Rename usb_30_subr.c --> usb_subr_30.c for consistency with others
 1.4.4.4 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.4.4.3 08-Apr-2020  martin Merge changes from current as of 20200406
 1.4.4.2 10-Jun-2019  christos Sync with HEAD
 1.4.4.1 01-Mar-2019  christos file usb_subr_30.c was added on branch phil-wifi on 2019-06-10 22:06:58 +0000
 1.3 05-Sep-2020  riastradh Round of uvm.h cleanup.

The poorly named uvm.h is generally supposed to be for uvm-internal
users only.

- Narrow it to files that actually need it -- mostly files that need
to query whether curlwp is the pagedaemon, which should maybe be
exposed by an external header.

- Use uvm_extern.h where feasible and uvm_*.h for things not exposed
by it. We should split up uvm_extern.h but this will serve for now
to reduce the uvm.h dependencies.

- Use uvm_stat.h and #ifdef UVMHIST uvm.h for files that use
UVMHIST(ubchist), since ubchist is declared in uvm.h but the
reference evaporates if UVMHIST is not defined, so we reduce header
file dependencies.

- Make uvm_device.h and uvm_swap.h independently includable while
here.

ok chs@
 1.2 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.1 15-Mar-2018  christos branches: 1.1.2; 1.1.4;
add uvm swap compat code.
 1.1.4.1 10-Jun-2019  christos Sync with HEAD
 1.1.2.3 22-Sep-2018  pgoyette #include "opt_compat_netbsd.h" for all sources that provide compat code.
 1.1.2.2 15-Mar-2018  pgoyette Synch with HEAD
 1.1.2.1 15-Mar-2018  pgoyette file uvm_13.c was added on branch pgoyette-compat on 2018-03-15 09:12:05 +0000
 1.3 05-Sep-2020  riastradh Round of uvm.h cleanup.

The poorly named uvm.h is generally supposed to be for uvm-internal
users only.

- Narrow it to files that actually need it -- mostly files that need
to query whether curlwp is the pagedaemon, which should maybe be
exposed by an external header.

- Use uvm_extern.h where feasible and uvm_*.h for things not exposed
by it. We should split up uvm_extern.h but this will serve for now
to reduce the uvm.h dependencies.

- Use uvm_stat.h and #ifdef UVMHIST uvm.h for files that use
UVMHIST(ubchist), since ubchist is declared in uvm.h but the
reference evaporates if UVMHIST is not defined, so we reduce header
file dependencies.

- Make uvm_device.h and uvm_swap.h independently includable while
here.

ok chs@
 1.2 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.1 15-Mar-2018  christos branches: 1.1.2; 1.1.4;
add uvm swap compat code.
 1.1.4.1 10-Jun-2019  christos Sync with HEAD
 1.1.2.3 22-Sep-2018  pgoyette #include "opt_compat_netbsd.h" for all sources that provide compat code.
 1.1.2.2 15-Mar-2018  pgoyette Synch with HEAD
 1.1.2.1 15-Mar-2018  pgoyette file uvm_50.c was added on branch pgoyette-compat on 2018-03-15 09:12:05 +0000
 1.1 13-Mar-2018  pgoyette branches: 1.1.2;
file uvm_stats_13.c was initially added on branch pgoyette-compat.
 1.1.2.2 15-Mar-2018  pgoyette Synch with HEAD
 1.1.2.1 13-Mar-2018  pgoyette Move the swapstats compat code into the compat_netbsd module.

Without this, a kernel configured without COMPAT_13 and/or COMPAT_50
could not execute the compat swapstats code, even if the compat_netbsd
module had been loaded.
 1.1 13-Mar-2018  pgoyette branches: 1.1.2;
file uvm_stats_13.h was initially added on branch pgoyette-compat.
 1.1.2.2 15-Mar-2018  pgoyette Synch with HEAD
 1.1.2.1 13-Mar-2018  pgoyette Move the swapstats compat code into the compat_netbsd module.

Without this, a kernel configured without COMPAT_13 and/or COMPAT_50
could not execute the compat swapstats code, even if the compat_netbsd
module had been loaded.
 1.1 13-Mar-2018  pgoyette branches: 1.1.2;
file uvm_stats_50.c was initially added on branch pgoyette-compat.
 1.1.2.2 15-Mar-2018  pgoyette Synch with HEAD
 1.1.2.1 13-Mar-2018  pgoyette Move the swapstats compat code into the compat_netbsd module.

Without this, a kernel configured without COMPAT_13 and/or COMPAT_50
could not execute the compat swapstats code, even if the compat_netbsd
module had been loaded.
 1.1 13-Mar-2018  pgoyette branches: 1.1.2;
file uvm_stats_50.h was initially added on branch pgoyette-compat.
 1.1.2.2 15-Mar-2018  pgoyette Synch with HEAD
 1.1.2.1 13-Mar-2018  pgoyette Move the swapstats compat code into the compat_netbsd module.

Without this, a kernel configured without COMPAT_13 and/or COMPAT_50
could not execute the compat swapstats code, even if the compat_netbsd
module had been loaded.
 1.5 12-Dec-2019  pgoyette Rather than keeping a separate mutex, condvar, and pserialize for each
module hook, we can share a common set of synchronization structures.
This cuts the amount of cacheline_aligned data for these structures by
50%.

Note that we still have a per-hook localcount, since we need to count
individual references.

As discussed with riastradh@

Welcome to 9.99.22 !
 1.4 01-Mar-2019  pgoyette branches: 1.4.4;
Rename the MODULE_*_HOOK() macros to MODULE_HOOK_*() as briefly
discussed on irc.

NFCI intended.

Ride the earlier kernel bump - it;s getting crowded.
 1.3 29-Jan-2019  pgoyette Normalize all the compat hooks' names to the form

<subsystem>_<function>_<version>_hook

NFCI

XXX Note that although this introduces a change in the kernel-to-
XXX module interface, we are NOT bumping the kernel version number.
XXX We will bump the version number once the interface stabilizes.
 1.2 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.1 14-Mar-2018  pgoyette branches: 1.1.2;
file vfs_syscalls_10.c was initially added on branch pgoyette-compat.
 1.1.2.5 23-Jan-2019  pgoyette Convert the macros for setting and unsetting a hook to generate
in-line code rather than using an intermediary hook##set routine.
Hooks are set and unset only in one place, so the intermediary
routine provides no benefit. IMHO using the macro at the point-
of-call is more readable than using it elsewhere in the code and
then calling the generated intermediary routine (for which you
won't even find its declaration or definition unless you remember
to search for the HOOK_SET macro instead).

NFC intended, will verify with a bulk build and an atf test run.
 1.1.2.4 15-Oct-2018  pgoyette Convert the openat_10 hook to use the MP-safe mechanism

XXX Still to do: compat70_unp_addsockcred and sysvipc50_sysctl
 1.1.2.3 22-Sep-2018  pgoyette #include "opt_compat_netbsd.h" for all sources that provide compat code.
 1.1.2.2 17-Apr-2018  pgoyette First pass at compat modules for 4.3BSD, NetBSD-0.9, and NetBSD-1.0

XXX Still need to deal with the sysctl stuff and other code shared
XXX between 09 and 43
 1.1.2.1 14-Mar-2018  pgoyette Make do_openat()'s handling of path=NULL modular
 1.4.4.3 08-Apr-2020  martin Merge changes from current as of 20200406
 1.4.4.2 10-Jun-2019  christos Sync with HEAD
 1.4.4.1 01-Mar-2019  christos file vfs_syscalls_10.c was added on branch phil-wifi on 2019-06-10 22:06:58 +0000
 1.38 07-Sep-2021  riastradh sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.37 27-Jan-2019  pgoyette branches: 1.37.4;
Merge the [pgoyette-compat] branch
 1.36 03-Sep-2018  riastradh Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.35 03-Dec-2017  christos branches: 1.35.2; 1.35.4;
Make code look the same, in particular zero out the rest of the directory
record.
XXX: pullup-8
 1.34 28-Jul-2017  riastradh Fail, don't panic, on bad dirents from file system.

Controllable via puffs from userland.

From Ilja Van Sprundel.
 1.33 13-Jan-2017  christos branches: 1.33.8;
use bdp, to avoid compiler warning.
 1.32 13-Jan-2017  christos convert strcpy to a bounded copy to avoid compiler warnings, although the
reclen test prevents overflow.
 1.31 05-Sep-2014  matt branches: 1.31.2; 1.31.4;
Try not to use f_data, use f_{vnode,socket,pipe,mqueue,kqueue,ksem} to get
a correctly typed pointer.
 1.30 24-Jan-2014  christos branches: 1.30.4; 1.30.6; 1.30.10;
It is wishful thinking that vn_readdir will return dirent12 structures.
 1.29 19-Jan-2011  tsutsui branches: 1.29.6; 1.29.12; 1.29.16; 1.29.18; 1.29.20; 1.29.26;
Remove includes <sys/mount.h> and <sys/sched.h> added for <sys/syscallargs.h>.
Now they are handled by $sysarghdrextra in sys/kern/syscalls.conf.
 1.28 26-Jan-2009  njoly branches: 1.28.6; 1.28.8;
Make all fstat(2) compat syscalls consistently use do_sys_fstat(),
instead of fd_getfile()/fd_putfile() dance.

ok by christos.
 1.27 11-Jan-2009  christos merge christos-time_t
 1.26 24-Jun-2008  ad branches: 1.26.4;
Replace references to getsock/getvnode.
 1.25 21-Mar-2008  ad branches: 1.25.2; 1.25.6; 1.25.8; 1.25.10;
Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
 1.24 20-Dec-2007  dsl branches: 1.24.6;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.23 12-Dec-2007  dsl compat_file.[ch] are no longer used
 1.22 30-Apr-2007  dsl branches: 1.22.8; 1.22.16; 1.22.18; 1.22.20;
Rework compat stat() and statvfs() code so that it no longer uses the stackgap.
 1.21 10-Mar-2007  dsl branches: 1.21.2; 1.21.4;
Use the support routines from kern_syscalls.c instead of rolling our own code.
 1.20 09-Feb-2007  ad branches: 1.20.2;
Merge newlock2 to head.
 1.19 16-Nov-2006  christos __unused removal on arguments; approved by core.
 1.18 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.17 11-Dec-2005  christos branches: 1.17.20; 1.17.22;
merge ktrace-lwp.
 1.16 13-Sep-2005  christos compat code reorg.
 1.15 19-Nov-2003  christos branches: 1.15.16;
Don't include malloc.h if you are not going to use it.
 1.14 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.13 29-Jun-2003  fvdl branches: 1.13.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.12 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.11 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.10 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.9 14-Jun-2001  thorpej branches: 1.9.2;
Fix a partial construction problem that can cause race conditions
between creation of a file descriptor and close(2) when using kernel
assisted threads. What we do is stick descriptors in the table, but
mark them as "larval". This causes essentially everything to treat
it as a non-existent descriptor, except for fdalloc(), which sees a
filled slot so that it won't (incorrectly) allocate it again. When
a descriptor is fully constructed, the code that has constructed it
marks it as "mature" (which actually clears the "larval" flag), and
things continue to work as normal.

While here, gather all the code that gets a descriptor from the table
into a fd_getfile() function, and call it, rather than having the
same (sometimes incorrect) code copied all over the place.
 1.8 09-Apr-2001  jdolecek Change the first arg to fileops fo_stat routine to struct file *, adjust
callers and appropriate routines to cope. This makes fo_stat more
consistent with rest of fileops routines and also makes the fo_stat
match FreeBSD as an added bonus.
Discussed with Luke Mewburn on tech-kern@.
 1.7 07-Apr-2001  jdolecek Add new 'stat' fileop and call the stat function via f_ops rather
than directly.
For compat syscalls, also add necessary FILE_USE()/FILE_UNUSE().
Now that soo_stat() gets a proc arg, pass it on to usrreq function.
 1.6 30-Mar-2000  augustss branches: 1.6.6;
Kill register declarations.
 1.5 05-May-1999  thorpej branches: 1.5.2;
Add "use counting" to file entries. When closing a file, and it's reference
count is 0, wait for use count to drain before finishing the close.

This is necessary in order for multiple processes to safely share file
descriptor tables.
 1.4 30-Mar-1999  wrstuden branches: 1.4.4;
Explicitly mask mode returned in old stat structure to 16 bits. Also correct
comment (we're converting from a new to an old struct stat).
 1.3 19-Oct-1997  mycroft Copy the whole timespec, not just half of it. Other minor changes.
 1.2 16-Oct-1997  christos add stat12 compatibility calls and rename ostat to stat43
 1.1 10-Oct-1997  fvdl branches: 1.1.2;
Add getdirentries backward compat syscall. Provide common function to
signal cookie overflow during emulated getdents and friends.
 1.1.2.2 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.1.2.1 10-Oct-1997  thorpej file vfs_syscalls_12.c was added on branch marc-pcmcia on 1997-10-14 10:21:17 +0000
 1.4.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.5.2.2 21-Apr-2001  bouyer Sync with HEAD
 1.5.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.6.6.6 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.6.6.5 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.6.6.4 14-Nov-2001  nathanw Catch up to -current.
 1.6.6.3 21-Jun-2001  nathanw Catch up to -current.
 1.6.6.2 09-Apr-2001  nathanw Catch up with -current.
 1.6.6.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.9.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.13.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.13.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.13.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.13.2.2 03-Aug-2004  skrll Sync with HEAD
 1.13.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.15.16.5 24-Mar-2008  yamt sync with head.
 1.15.16.4 21-Jan-2008  yamt sync with head
 1.15.16.3 03-Sep-2007  yamt sync with head.
 1.15.16.2 26-Feb-2007  yamt sync with head.
 1.15.16.1 21-Jun-2006  yamt sync with head.
 1.17.22.2 10-Dec-2006  yamt sync with head.
 1.17.22.1 22-Oct-2006  yamt sync with head
 1.17.20.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.17.20.1 18-Nov-2006  ad Sync with head.
 1.20.2.2 07-May-2007  yamt sync with head.
 1.20.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.21.4.1 11-Jul-2007  mjf Sync with head.
 1.21.2.1 27-May-2007  ad Sync with head.
 1.22.20.2 02-Jan-2008  bouyer Sync with HEAD
 1.22.20.1 13-Dec-2007  bouyer Sync with HEAD
 1.22.18.1 13-Dec-2007  yamt sync with head.
 1.22.16.1 26-Dec-2007  ad Sync with head.
 1.22.8.1 09-Jan-2008  matt sync with HEAD
 1.24.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.24.6.2 29-Jun-2008  mjf Sync with HEAD.
 1.24.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.25.10.1 27-Jun-2008  simonb Sync with head.
 1.25.8.3 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.25.8.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.25.8.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.25.6.1 04-May-2009  yamt sync with head.
 1.25.2.2 01-Nov-2008  christos Sync with head.
 1.25.2.1 29-Mar-2008  christos Welcome to the time_t=long long dev_t=uint64_t branch.
 1.26.4.2 03-Mar-2009  skrll Sync with HEAD.
 1.26.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.28.8.1 06-Jun-2011  jruoho Sync with HEAD.
 1.28.6.1 05-Mar-2011  rmind sync with head
 1.29.26.2 19-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1483):
sys/compat/common/vfs_syscalls_12.c: revision 1.34
sys/compat/svr4_32/svr4_32_misc.c: revision 1.78
sys/compat/sunos32/sunos32_misc.c: revision 1.78
sys/compat/linux/common/linux_misc.c: revision 1.239
sys/compat/osf1/osf1_file.c: revision 1.44
sys/compat/common/vfs_syscalls_43.c: revision 1.60
sys/compat/svr4/svr4_misc.c: revision 1.158
sys/compat/ibcs2/ibcs2_misc.c: revision 1.114
sys/compat/linux/common/linux_file64.c: revision 1.59
sys/compat/linux32/common/linux32_dirent.c: revision 1.18
sys/compat/sunos/sunos_misc.c: revision 1.171
Fail, don't panic, on bad dirents from file system.
Controllable via puffs from userland.
From Ilja Van Sprundel.
 1.29.26.1 12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1469):
sys/compat/common/vfs_syscalls_12.c: revision 1.30
sys/compat/common/vfs_syscalls_43.c: revision 1.56
sys/compat/sys/dirent.h: revision 1.3
It is wishful thinking that vn_readdir will return dirent12 structures.
--
Fix the compat-4.3 getdirentries call (pre d_type). This is used in NetBSD-0.9.
--
add a struct for the 4.3BSD struct direct
 1.29.20.1 18-May-2014  rmind sync with head
 1.29.18.2 19-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1483):
sys/compat/common/vfs_syscalls_12.c: revision 1.34
sys/compat/svr4_32/svr4_32_misc.c: revision 1.78
sys/compat/sunos32/sunos32_misc.c: revision 1.78
sys/compat/linux/common/linux_misc.c: revision 1.239
sys/compat/osf1/osf1_file.c: revision 1.44
sys/compat/common/vfs_syscalls_43.c: revision 1.60
sys/compat/svr4/svr4_misc.c: revision 1.158
sys/compat/ibcs2/ibcs2_misc.c: revision 1.114
sys/compat/linux/common/linux_file64.c: revision 1.59
sys/compat/linux32/common/linux32_dirent.c: revision 1.18
sys/compat/sunos/sunos_misc.c: revision 1.171
Fail, don't panic, on bad dirents from file system.
Controllable via puffs from userland.
From Ilja Van Sprundel.
 1.29.18.1 12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1469):
sys/compat/common/vfs_syscalls_12.c: revision 1.30
sys/compat/common/vfs_syscalls_43.c: revision 1.56
sys/compat/sys/dirent.h: revision 1.3
It is wishful thinking that vn_readdir will return dirent12 structures.
--
Fix the compat-4.3 getdirentries call (pre d_type). This is used in NetBSD-0.9.
--
add a struct for the 4.3BSD struct direct
 1.29.16.2 03-Dec-2017  jdolecek update from HEAD
 1.29.16.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.29.12.2 19-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1483):
sys/compat/common/vfs_syscalls_12.c: revision 1.34
sys/compat/svr4_32/svr4_32_misc.c: revision 1.78
sys/compat/sunos32/sunos32_misc.c: revision 1.78
sys/compat/linux/common/linux_misc.c: revision 1.239
sys/compat/osf1/osf1_file.c: revision 1.44
sys/compat/common/vfs_syscalls_43.c: revision 1.60
sys/compat/svr4/svr4_misc.c: revision 1.158
sys/compat/ibcs2/ibcs2_misc.c: revision 1.114
sys/compat/linux/common/linux_file64.c: revision 1.59
sys/compat/linux32/common/linux32_dirent.c: revision 1.18
sys/compat/sunos/sunos_misc.c: revision 1.171
Fail, don't panic, on bad dirents from file system.
Controllable via puffs from userland.
From Ilja Van Sprundel.
 1.29.12.1 12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1469):
sys/compat/common/vfs_syscalls_12.c: revision 1.30
sys/compat/common/vfs_syscalls_43.c: revision 1.56
sys/compat/sys/dirent.h: revision 1.3
It is wishful thinking that vn_readdir will return dirent12 structures.
--
Fix the compat-4.3 getdirentries call (pre d_type). This is used in NetBSD-0.9.
--
add a struct for the 4.3BSD struct direct
 1.29.6.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.30.10.1 12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1479):
sys/compat/common/vfs_syscalls_12.c: revision 1.34
sys/rump/kern/lib/libsys_sunos/rump_sunos_compat.c: revision 1.2
sys/compat/svr4_32/svr4_32_misc.c: revision 1.78
sys/compat/sunos32/sunos32_misc.c: revision 1.78
sys/compat/linux/common/linux_misc.c: revision 1.239
sys/compat/osf1/osf1_file.c: revision 1.44
sys/compat/common/vfs_syscalls_43.c: revision 1.60
sys/compat/svr4/svr4_misc.c: revision 1.158
sys/compat/ibcs2/ibcs2_misc.c: revision 1.114
sys/compat/linux/common/linux_file64.c: revision 1.59
sys/compat/linux32/common/linux32_dirent.c: revision 1.18
sys/compat/sunos/sunos_misc.c: revision 1.171
Fail, don't panic, on bad dirents from file system.
Controllable via puffs from userland.
From Ilja Van Sprundel.
 1.30.6.1 12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1479):
sys/compat/common/vfs_syscalls_12.c: revision 1.34
sys/rump/kern/lib/libsys_sunos/rump_sunos_compat.c: revision 1.2
sys/compat/svr4_32/svr4_32_misc.c: revision 1.78
sys/compat/sunos32/sunos32_misc.c: revision 1.78
sys/compat/linux/common/linux_misc.c: revision 1.239
sys/compat/osf1/osf1_file.c: revision 1.44
sys/compat/common/vfs_syscalls_43.c: revision 1.60
sys/compat/svr4/svr4_misc.c: revision 1.158
sys/compat/ibcs2/ibcs2_misc.c: revision 1.114
sys/compat/linux/common/linux_file64.c: revision 1.59
sys/compat/linux32/common/linux32_dirent.c: revision 1.18
sys/compat/sunos/sunos_misc.c: revision 1.171
Fail, don't panic, on bad dirents from file system.
Controllable via puffs from userland.
From Ilja Van Sprundel.
 1.30.4.1 12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1479):
sys/compat/common/vfs_syscalls_12.c: revision 1.34
sys/rump/kern/lib/libsys_sunos/rump_sunos_compat.c: revision 1.2
sys/compat/svr4_32/svr4_32_misc.c: revision 1.78
sys/compat/sunos32/sunos32_misc.c: revision 1.78
sys/compat/linux/common/linux_misc.c: revision 1.239
sys/compat/osf1/osf1_file.c: revision 1.44
sys/compat/common/vfs_syscalls_43.c: revision 1.60
sys/compat/svr4/svr4_misc.c: revision 1.158
sys/compat/ibcs2/ibcs2_misc.c: revision 1.114
sys/compat/linux/common/linux_file64.c: revision 1.59
sys/compat/linux32/common/linux32_dirent.c: revision 1.18
sys/compat/sunos/sunos_misc.c: revision 1.171
Fail, don't panic, on bad dirents from file system.
Controllable via puffs from userland.
From Ilja Van Sprundel.
 1.31.4.1 20-Mar-2017  pgoyette Sync with HEAD
 1.31.2.2 28-Aug-2017  skrll Sync with HEAD
 1.31.2.1 05-Feb-2017  skrll Sync with HEAD
 1.33.8.3 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1836):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.33.8.2 10-Dec-2017  snj Pull up following revision(s) (requested by christos in ticket #418):
sys/compat/common/vfs_syscalls_12.c: revision 1.35
sys/compat/common/vfs_syscalls_43.c: revision 1.62
Make code look the same, in particular zero out the rest of the directory
record.
 1.33.8.1 09-Aug-2017  snj Pull up following revision(s) (requested by spz in ticket #193):
sys/compat/common/vfs_syscalls_12.c: revision 1.34
sys/rump/kern/lib/libsys_sunos/rump_sunos_compat.c: revision 1.2
sys/compat/svr4_32/svr4_32_misc.c: revision 1.78
sys/compat/sunos32/sunos32_misc.c: revision 1.78
sys/compat/linux/common/linux_misc.c: revision 1.239
sys/compat/osf1/osf1_file.c: revision 1.44
sys/compat/common/vfs_syscalls_43.c: revision 1.60
sys/compat/svr4/svr4_misc.c: revision 1.158
sys/compat/ibcs2/ibcs2_misc.c: revision 1.114
sys/compat/linux/common/linux_file64.c: revision 1.59
sys/compat/linux32/common/linux32_dirent.c: revision 1.18
sys/compat/sunos/sunos_misc.c: revision 1.171
Fail, don't panic, on bad dirents from file system.
Controllable via puffs from userland.
From Ilja Van Sprundel.
 1.35.4.1 10-Jun-2019  christos Sync with HEAD
 1.35.2.3 22-Sep-2018  pgoyette #include "opt_compat_netbsd.h" for all sources that provide compat code.
 1.35.2.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.35.2.1 31-Mar-2018  pgoyette create the compat_12 module
 1.37.4.1 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.46 28-Jun-2020  christos Fix struct entry size (thanks kre@)
 1.45 17-Jan-2020  ad VFS_VGET(), VFS_ROOT(), VFS_FHTOVP(): give them a "int lktype" argument, to
allow us to get shared locks (or no lock) on the returned vnode. Matches
FreeBSD.
 1.44 04-Oct-2019  christos branches: 1.44.2;
deduplicate the conversion function from statvfs -> statfs12
 1.43 26-Sep-2019  christos fix sign-compare issues.
 1.42 22-Sep-2019  christos Add a new member to struct vfsstat and grow the unused members
The new member is caled f_mntfromlabel and it is the dkw_wname
of the corresponding wedge. This is now used by df -W to display
the mountpoint name as NAME=
 1.41 27-Jan-2019  pgoyette branches: 1.41.4;
Merge the [pgoyette-compat] branch
 1.40 13-Apr-2017  hannken branches: 1.40.10; 1.40.12;
Switch compat_20_sys_getfsstat() to mountlist iterator.
 1.39 24-Jul-2015  maxv branches: 1.39.2; 1.39.4;
Unused inits (harmless).

Found by Brainy.
 1.38 05-Sep-2014  matt branches: 1.38.2;
Try not to use f_data, use f_{vnode,socket,pipe,mqueue,kqueue,ksem} to get
a correctly typed pointer.
 1.37 27-Nov-2013  christos Change the queue.3 *_END(&head) macros to NULL. Since we don't have CIRCLEQ
anymore, all the macros expand to NULL anyway, so this improves readability.
Requested by rmind@
 1.36 23-Nov-2013  christos change the mountlist CIRCLEQ into a TAILQ
 1.35 24-Jun-2010  hannken branches: 1.35.8; 1.35.18; 1.35.22;
Clean up vnode lock operations pass 2:

VOP_UNLOCK(vp, flags) -> VOP_UNLOCK(vp): Remove the unneeded flags argument.

Welcome to 5.99.32.

Discussed on tech-kern.
 1.34 29-Jun-2009  dholland branches: 1.34.2; 1.34.4;
Convert 67 namei call sites to use namei_simple, in these functions:

check_console, veriexecclose, veriexec_delete, veriexec_file_add,
emul_find_root, coff_load_shlib (sh3 version), coff_load_shlib,
compat_20_sys_statfs, compat_20_netbsd32_statfs,
ELFNAME2(netbsd32,probe_noteless), darwin_sys_statfs,
ibcs2_sys_statfs, ibcs2_sys_statvfs, linux_sys_uselib,
osf1_sys_statfs, sunos_sys_statfs, sunos32_sys_statfs,
ultrix_sys_statfs, do_sys_mount, fss_create_files (3 of 4),
adosfs_mount, cd9660_mount, coda_ioctl, coda_mount, ext2fs_mount,
ffs_mount, filecore_mount, hfs_mount, lfs_mount, msdosfs_mount,
ntfs_mount, sysvbfs_mount, udf_mount, union_mount, sys_chflags,
sys_lchflags, sys_chmod, sys_lchmod, sys_chown, sys_lchown,
sys___posix_chown, sys___posix_lchown, sys_link, do_sys_pstatvfs,
sys_quotactl, sys_revoke, sys_truncate, do_sys_utimes, sys_extattrctl,
sys_extattr_set_file, sys_extattr_set_link, sys_extattr_get_file,
sys_extattr_get_link, sys_extattr_delete_file,
sys_extattr_delete_link, sys_extattr_list_file, sys_extattr_list_link,
sys_setxattr, sys_lsetxattr, sys_getxattr, sys_lgetxattr,
sys_listxattr, sys_llistxattr, sys_removexattr, sys_lremovexattr

All have been scrutinized (several times, in fact) and compile-tested,
but not all have been explicitly tested in action.

XXX: While I haven't (intentionally) changed the use or nonuse of
XXX: TRYEMULROOT in any of these places, I'm not convinced all the
XXX: uses are correct; an audit might be desirable.
 1.33 20-Nov-2008  ad branches: 1.33.4;
PR port-amd64 modules/compat missing symbols on amd64

Also, test for compat_??_machdep.c so we don't have to grow more ifdefs
in the makefile.
 1.32 14-Nov-2008  ad _KERNEL_OPT
 1.31 24-Jun-2008  ad branches: 1.31.2; 1.31.4;
Replace references to getsock/getvnode.
 1.30 06-May-2008  ad branches: 1.30.2; 1.30.4;
PR kern/38141 lookup/vfs_busy acquire rwlock recursively

Simplify the mount locking. Remove all the crud to deal with recursion on
the mount lock, and crud to deal with unmount as another weirdo lock.

Hopefully this will once and for all fix the deadlocks with this. With this
commit there are two locks on each mount:

- krwlock_t mnt_unmounting. This is used to prevent unmount across critical
sections like getnewvnode(). It's only ever read locked with rw_tryenter(),
and is only ever write locked in dounmount(). A write hold can't be taken
on this lock if the current LWP could hold a vnode lock.

- kmutex_t mnt_updating. This is taken by threads updating the mount, for
example when going r/o -> r/w, and is only present to serialize updates.
In order to take this lock, a read hold must first be taken on
mnt_unmounting, and the two need to be held across the operation.

One effect of this change: previously if an unmount failed, we would make a
half hearted attempt to back out of it gracefully, but that was unlikely to
work in a lot of cases. Now while an unmount that will be aborted is in
progress, new file operations within the mount will fail instead of being
delayed. That is unlikely to be a problem though, because if the admin
requests unmount of a file system then s(he) has made a decision to deny
access to the resource.
 1.29 05-May-2008  ad Remove unneeded includes.
 1.28 30-Apr-2008  ad PR kern/38135 vfs_busy/vfs_trybusy confusion

The previous fix worked, but it opened a window where mounts could have
disappeared from mountlist while the caller was traversing it using
vfs_trybusy(). Fix that.
 1.27 29-Apr-2008  ad kern/38135 vfs_busy/vfs_trybusy confusion

The symptom was that sometimes file systems would occasionally not appear
in output from 'df' or 'mount' if the system was busy. Resolution:

- Make mount locks work somewhat like vm_map locks.
- vfs_trybusy() now only fails if the mount is gone, or if someone is
unmounting the file system. Simple contention on mnt_lock doesn't
cause it to fail.
- vfs_busy() will wait even if the file system is being unmounted.
 1.26 21-Mar-2008  ad branches: 1.26.2; 1.26.4;
Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
 1.25 30-Jan-2008  ad branches: 1.25.6;
PR kern/37706 (forced unmount of file systems is unsafe):

- Do reference counting for 'struct mount'. Each vnode associated with a
mount takes a reference, and in turn the mount takes a reference to the
vfsops.
- Now that mounts are reference counted, replace the overcomplicated mount
locking inherited from 4.4BSD with a recursable rwlock.
 1.24 07-Jan-2008  ad Don't drop vnode refs until we are done with the mount.
 1.23 20-Dec-2007  dsl Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.22 08-Dec-2007  pooka branches: 1.22.4;
Remove cn_lwp from struct componentname. curlwp should be used
from on. The NDINIT() macro no longer takes the lwp parameter and
associates the credentials of the calling thread with the namei
structure.
 1.21 08-Dec-2007  dsl ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.20 26-Nov-2007  pooka branches: 1.20.2;
Remove the "struct lwp *" argument from all VFS and VOP interfaces.
The general trend is to remove it from all kernel interfaces and
this is a start. In case the calling lwp is desired, curlwp should
be used.

quick consensus on tech-kern
 1.19 01-Nov-2007  oster branches: 1.19.2;
This should be a mutex_enter() instead of a mutex_exit().
Fixes:
Mutex error: mutex_vector_exit: assertion failed: MUTEX_OWNER(mtx->mtx_owner) == curthread
...
mutex_abort(c0aba23c,c07bf8b0,c09c9164,bfbfee34,10) at netbsd:mutex_abort+0x36
mutex_vector_exit(c0aba23c,10,c0aba23c,ca8efc6c,ca8f8540) at netbsd:mutex_vector_exit+0xe2
compat_20_sys_getfsstat(ca8f8540,cb243c48,cb243c68,805eb24,805e000) at netbsd:compat_20_sys_getfsstat+0x1bf
...
 1.18 10-Oct-2007  ad branches: 1.18.2;
Merge from vmlocking:

- Split vnode::v_flag into three fields, depending on field locking.
- simple_lock -> kmutex in a few places.
- Fix some simple locking problems.
 1.17 22-Apr-2007  dsl branches: 1.17.6; 1.17.8; 1.17.10;
Change the way that emulations locate files within the emulation root to
avoid having to allocate space in the 'stackgap'
- which is very LWP unfriendly.
The additional code for non-emulation namei() is trivial, the reduction for
the emulations is massive.
The vnode for a processes emulation root is saved in the cwdi structure
during process exec.
If the emulation root the TRYEMULROOT flag are set, namei() will do an initial
search for absolute pathnames in the emulation root, if that fails it will
retry from the normal root.
".." at the emulation root will always go to the real root, even in the middle
of paths and when expanding symlinks.
Absolute symlinks found using absolute paths in the emulation root will be
relative to the emulation root (so /usr/lib/xxx.so -> /lib/xxx.so links
inside the emulation root don't need changing).
If the root of the emulation would be returned (for an emulation lookup), then
the real root is returned instead (matching the behaviour of emul_lookup,
but being a cheap comparison here) so that programs that scan "../.."
looking for the root dircetory don't loop forever.
The target for symbolic links is no longer mangled (it used to get the
CHECK_ALT_xxx() treatment, so could get /emul/xxx prepended).
CHECK_ALT_xxx() are no more. Most of the change is deleting them, and adding
TRYEMULROOT to the flags to NDINIT().
A lot of the emulation system call stubs could now be deleted.
 1.16 09-Feb-2007  ad branches: 1.16.2; 1.16.6; 1.16.8;
Merge newlock2 to head.
 1.15 16-Nov-2006  christos __unused removal on arguments; approved by core.
 1.14 14-Nov-2006  elad Clean some KAUTH_GENERIC_ISSUSER usage in compat code.
 1.13 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.12 23-Jul-2006  ad branches: 1.12.4; 1.12.6;
Use the LWP cached credentials where sane.
 1.11 13-Jul-2006  martin Fix alignement problems for fhandle_t, exposed by gcc4.1.

While touching all vptofh/fhtovp functions, get rid of VFS_MAXFIDSIZ,
version the getfh(2) syscall and explicitly pass the size available in
the filehandle from userland.

Discussed on tech-kern, with lots of help from yamt (thanks!).
 1.10 30-Jun-2006  drochner -fix for previous: don't malloc() with spinlock held
-wrap some long lines
 1.9 12-Jun-2006  christos branches: 1.9.2;
stack police: don't allocate statvfs on the stack.
 1.8 14-May-2006  elad branches: 1.8.2;
integrate kauth.
 1.7 07-Mar-2006  thorpej branches: 1.7.2; 1.7.4;
Clean up fallout proc_is_traced_p() change:
- proc_is_traced_p() -> trace_is_enabled(), to match trace_enter() and
trace_exit().
- trace_is_enabled() becomes a real function.
- Remove unnecessary include files from various files that used to care
about KTRACE and SYSTRACE, but do no more.
 1.6 11-Dec-2005  christos branches: 1.6.4; 1.6.6; 1.6.8;
merge ktrace-lwp.
 1.5 13-Sep-2005  christos compat code reorg.
 1.4 26-Feb-2005  perry branches: 1.4.4;
nuke trailing whitespace
 1.3 22-May-2004  christos branches: 1.3.2; 1.3.6; 1.3.8;
grr, forgot to take out the &
 1.2 22-May-2004  christos allocate memory for statvfs instead of using the stack.
 1.1 21-Apr-2004  christos Replace the statfs() family of system calls with statvfs().
Retain binary compatibility.
 1.3.8.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.3.6.1 29-Apr-2005  kent sync with -current
 1.3.2.7 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.3.2.6 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.3.2.5 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.2.4 18-Sep-2004  skrll Sync with HEAD.
 1.3.2.3 24-Aug-2004  skrll Undo part of the ktrace/lwp changes. In particular:
* Remove the "lwp *" argument that was added to vget(). Turns out
that nothing actually used it!
* Remove the "lwp *" arguments that were added to VFS_ROOT(), VFS_VGET(),
and VFS_FHTOVP(); all they did was pass it to vget() (which, as noted
above, didn't use it).
* Remove all of the "lwp *" arguments to internal functions that were added
just to appease the above.
 1.3.2.2 03-Aug-2004  skrll Sync with HEAD
 1.3.2.1 22-May-2004  skrll file vfs_syscalls_20.c was added on branch ktrace-lwp on 2004-08-03 10:43:29 +0000
 1.4.4.10 24-Mar-2008  yamt sync with head.
 1.4.4.9 04-Feb-2008  yamt sync with head.
 1.4.4.8 21-Jan-2008  yamt sync with head
 1.4.4.7 07-Dec-2007  yamt sync with head
 1.4.4.6 15-Nov-2007  yamt sync with head.
 1.4.4.5 27-Oct-2007  yamt sync with head.
 1.4.4.4 03-Sep-2007  yamt sync with head.
 1.4.4.3 26-Feb-2007  yamt sync with head.
 1.4.4.2 30-Dec-2006  yamt sync with head.
 1.4.4.1 21-Jun-2006  yamt sync with head.
 1.6.8.4 11-Aug-2006  yamt sync with head
 1.6.8.3 26-Jun-2006  yamt sync with head.
 1.6.8.2 24-May-2006  yamt sync with head.
 1.6.8.1 13-Mar-2006  yamt sync with head.
 1.6.6.2 01-Jun-2006  kardel Sync with head.
 1.6.6.1 22-Apr-2006  simonb Sync with head.
 1.6.4.1 09-Sep-2006  rpaulo sync with head
 1.7.4.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.7.2.4 06-May-2006  christos - Move kauth_cred_t declaration to <sys/types.h>
- Cleanup struct ucred; forward declarations that are unused.
- Don't include <sys/kauth.h> in any header, but include it in the c files
that need it.

Approved by core.
 1.7.2.3 10-Mar-2006  elad generic_authorize() -> kauth_authorize_generic().
 1.7.2.2 08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.7.2.1 07-Mar-2006  elad file vfs_syscalls_20.c was added on branch elad-kernelauth on 2006-03-08 01:48:37 +0000
 1.8.2.1 19-Jun-2006  chap Sync with head.
 1.9.2.1 13-Jul-2006  gdamore Merge from HEAD.
 1.12.6.2 10-Dec-2006  yamt sync with head.
 1.12.6.1 22-Oct-2006  yamt sync with head
 1.12.4.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.12.4.1 18-Nov-2006  ad Sync with head.
 1.16.8.1 11-Jul-2007  mjf Sync with head.
 1.16.6.2 27-May-2007  ad Sync with head.
 1.16.6.1 13-Mar-2007  ad Pull in the initial set of changes for the vmlocking branch.
 1.16.2.1 07-May-2007  yamt sync with head.
 1.17.10.1 14-Oct-2007  yamt sync with head.
 1.17.8.3 23-Mar-2008  matt sync with HEAD
 1.17.8.2 09-Jan-2008  matt sync with HEAD
 1.17.8.1 06-Nov-2007  matt sync with HEAD
 1.17.6.4 09-Dec-2007  jmcneill Sync with HEAD.
 1.17.6.3 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.17.6.2 04-Nov-2007  jmcneill Sync with HEAD.
 1.17.6.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.18.2.1 13-Nov-2007  bouyer Sync with HEAD
 1.19.2.3 18-Feb-2008  mjf Sync with HEAD.
 1.19.2.2 27-Dec-2007  mjf Sync with HEAD.
 1.19.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.20.2.1 26-Dec-2007  ad Sync with head.
 1.22.4.2 08-Jan-2008  bouyer Sync with HEAD
 1.22.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.25.6.4 17-Jan-2009  mjf Sync with HEAD.
 1.25.6.3 29-Jun-2008  mjf Sync with HEAD.
 1.25.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.25.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.26.4.4 11-Aug-2010  yamt sync with head.
 1.26.4.3 18-Jul-2009  yamt sync with head.
 1.26.4.2 04-May-2009  yamt sync with head.
 1.26.4.1 16-May-2008  yamt sync with head.
 1.26.2.1 18-May-2008  yamt sync with head.
 1.30.4.1 27-Jun-2008  simonb Sync with head.
 1.30.2.3 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.30.2.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.30.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.31.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.31.2.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.33.4.1 23-Jul-2009  jym Sync with HEAD.
 1.34.4.1 03-Jul-2010  rmind sync with head
 1.34.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.35.22.1 18-May-2014  rmind sync with head
 1.35.18.2 03-Dec-2017  jdolecek update from HEAD
 1.35.18.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.35.8.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.38.2.2 28-Aug-2017  skrll Sync with HEAD
 1.38.2.1 22-Sep-2015  skrll Sync with HEAD
 1.39.4.1 21-Apr-2017  bouyer Sync with HEAD
 1.39.2.1 26-Apr-2017  pgoyette Sync with HEAD
 1.40.12.3 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.40.12.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.40.12.1 10-Jun-2019  christos Sync with HEAD
 1.40.10.1 30-Mar-2018  pgoyette Create and build the compat_20 module
 1.41.4.1 03-Aug-2022  martin Apply patch, requested by riastradh in ticket #1487:

sys/compat/common/vfs_syscalls_20.c (apply patch)

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.44.2.1 17-Jan-2020  ad Sync with head.
 1.45 12-Mar-2022  riastradh compat_30: Fix thinko in previous.

Let's not go into an infinite loop of stack smashing!
 1.44 12-Mar-2022  riastradh compat_30: Avoid what might be technically undefined behaviour.

Not sure advancing a user pointer by one for the purpose of making an
equality test fail later on is actually likely to be a problem, but
let's just pacify the sanitizer.

Reported-by: syzbot+758b18164c5c444f4249@syzkaller.appspotmail.com
 1.43 07-Sep-2021  riastradh sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.42 15-Aug-2021  christos - memset struct stat to avoid kernel memory disclosure of padded fields
(thanks Trend Micro for the report)
- use do_fhstat
- consistency in argument order of compat functions
 1.41 31-Jan-2020  maxv Fix copyout overflows in fhstat, found by the LGTM bot. Not a big problem
since this syscall is privileged.
 1.40 17-Jan-2020  ad VFS_VGET(), VFS_ROOT(), VFS_FHTOVP(): give them a "int lktype" argument, to
allow us to get shared locks (or no lock) on the returned vnode. Matches
FreeBSD.
 1.39 22-Sep-2019  christos branches: 1.39.2;
Add a new member to struct vfsstat and grow the unused members
The new member is caled f_mntfromlabel and it is the dkw_wname
of the corresponding wedge. This is now used by df -W to display
the mountpoint name as NAME=
 1.38 27-Jan-2019  pgoyette branches: 1.38.4;
Merge the [pgoyette-compat] branch
 1.37 03-Sep-2018  riastradh Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.36 20-Oct-2014  christos branches: 1.36.12; 1.36.18; 1.36.20;
simplify
 1.35 20-Oct-2014  maxv Memory leak, triggerable from root only.

Found by my code scanner.

ok christos@
 1.34 05-Sep-2014  matt Try not to use f_data, use f_{vnode,socket,pipe,mqueue,kqueue,ksem} to get
a correctly typed pointer.
 1.33 19-Nov-2010  dholland branches: 1.33.18; 1.33.34;
Introduce struct pathbuf. This is an abstraction to hold a pathname
and the metadata required to interpret it. Callers of namei must now
create a pathbuf and pass it to NDINIT (instead of a string and a
uio_seg), then destroy the pathbuf after the namei session is
complete.

Update all namei call sites accordingly. Add a pathbuf(9) man page and
update namei(9).

The pathbuf interface also now appears in a couple of related
additional places that were passing string/uio_seg pairs that were
later fed into NDINIT. Update other call sites accordingly.
 1.32 24-Jun-2010  hannken Clean up vnode lock operations pass 2:

VOP_UNLOCK(vp, flags) -> VOP_UNLOCK(vp): Remove the unneeded flags argument.

Welcome to 5.99.32.

Discussed on tech-kern.
 1.31 03-Mar-2010  he branches: 1.31.2;
When implementing "read directory", when there are too many empty entries
in a row, and we need to try to read the next block, and have passed a
non-NULL cookie pointer to VOP_READDIR, ensure that we free the cookie
buffer before re-doing VOP_READDIR, so that we don't leak memory.
This fix is similar to nfs_serv.c revisions 1.115 + 1.124.

This should fix the long-standing problem observed by e.g. using Linux-
emulated programs to take backup of servers, which is one of the problems
which were reported in PR#42661.

Thanks to pooka@ for the hints for traversing the VOP* layer.
 1.30 26-Jan-2009  njoly branches: 1.30.4;
Make all fstat(2) compat syscalls consistently use do_sys_fstat(),
instead of fd_getfile()/fd_putfile() dance.

ok by christos.
 1.29 11-Jan-2009  christos merge christos-time_t
 1.28 24-Jun-2008  ad branches: 1.28.4; 1.28.6; 1.28.12;
Replace references to getsock/getvnode.
 1.27 28-Apr-2008  martin branches: 1.27.2; 1.27.4;
Remove clause 3 and 4 from TNF licenses
 1.26 21-Mar-2008  ad branches: 1.26.2; 1.26.4; 1.26.6;
Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
 1.25 20-Dec-2007  dsl branches: 1.25.6;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.24 08-Dec-2007  pooka branches: 1.24.4;
Remove cn_lwp from struct componentname. curlwp should be used
from on. The NDINIT() macro no longer takes the lwp parameter and
associates the credentials of the calling thread with the namei
structure.
 1.23 30-Apr-2007  dsl branches: 1.23.6; 1.23.8; 1.23.16;
Split the statvfs functions so that the 'work' is done to a kernel buffer
which can either be copied directly to userspace, or converted then copied.
Saves replicating a lot of code in the compat functions (esp. for
getvfsstat) at a cast of an extra function call in the non-emulated case -
which is unlikely to be measurable given the other costs of the actions
involved (even on vax).
Remove dofhstat() and dofhstatvfs() (and the last caller).
Remove some redundant stackgap_init() calls.
 1.22 22-Apr-2007  dsl Change the way that emulations locate files within the emulation root to
avoid having to allocate space in the 'stackgap'
- which is very LWP unfriendly.
The additional code for non-emulation namei() is trivial, the reduction for
the emulations is massive.
The vnode for a processes emulation root is saved in the cwdi structure
during process exec.
If the emulation root the TRYEMULROOT flag are set, namei() will do an initial
search for absolute pathnames in the emulation root, if that fails it will
retry from the normal root.
".." at the emulation root will always go to the real root, even in the middle
of paths and when expanding symlinks.
Absolute symlinks found using absolute paths in the emulation root will be
relative to the emulation root (so /usr/lib/xxx.so -> /lib/xxx.so links
inside the emulation root don't need changing).
If the root of the emulation would be returned (for an emulation lookup), then
the real root is returned instead (matching the behaviour of emul_lookup,
but being a cheap comparison here) so that programs that scan "../.."
looking for the root dircetory don't loop forever.
The target for symbolic links is no longer mangled (it used to get the
CHECK_ALT_xxx() treatment, so could get /emul/xxx prepended).
CHECK_ALT_xxx() are no more. Most of the change is deleting them, and adding
TRYEMULROOT to the flags to NDINIT().
A lot of the emulation system call stubs could now be deleted.
 1.21 10-Mar-2007  dsl branches: 1.21.2; 1.21.4;
Use the support routines from kern_syscalls.c instead of rolling our own code.
 1.20 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.19 09-Feb-2007  ad branches: 1.19.2;
Merge newlock2 to head.
 1.18 16-Nov-2006  christos branches: 1.18.2;
__unused removal on arguments; approved by core.
 1.17 14-Nov-2006  elad Clean some KAUTH_GENERIC_ISSUSER usage in compat code.
 1.16 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.15 04-Aug-2006  yamt branches: 1.15.4; 1.15.6;
compat_30_sys_getfh: check the size of filehandle. remove an unnecessary cast.
 1.14 04-Aug-2006  yamt some filehandle syscall related changes.

- remove the support of variable-sized filehandle from compat version of
syscalls. (strictly speaking, it breaks abi. i don't think it's a problem
because this feature is short-lived and there are no affected in-tree
filesystems.)
- unify vfs_copyinfh_alloc and vfs_copyinfh_alloc_size.
- vfs_copyinfh_alloc_size: check fhsize strictly.
- reduce code duplication between compat and current syscalls.
 1.13 31-Jul-2006  martin Make filehandles opaque to userland
 1.12 23-Jul-2006  ad Use the LWP cached credentials where sane.
 1.11 13-Jul-2006  yamt compat_30_sys_getfh: s/fhandle_t/struct compat_30_fhandle/ (fix overrun.)
 1.10 13-Jul-2006  martin Fix alignement problems for fhandle_t, exposed by gcc4.1.

While touching all vptofh/fhtovp functions, get rid of VFS_MAXFIDSIZ,
version the getfh(2) syscall and explicitly pass the size available in
the filehandle from userland.

Discussed on tech-kern, with lots of help from yamt (thanks!).
 1.9 14-May-2006  elad branches: 1.9.4; 1.9.6;
integrate kauth.
 1.8 04-May-2006  christos fhstat needs to be versioned too (for ino_t). Pointed out by Izumi Tsutsui
 1.7 01-Mar-2006  yamt branches: 1.7.2; 1.7.4; 1.7.6;
merge yamt-uio_vmspace branch.

- use vmspace rather than proc or lwp where appropriate.
the latter is more natural to specify an address space.
(and less likely to be abused for random purposes.)
- fix a swdmover race.
 1.6 11-Dec-2005  christos branches: 1.6.2; 1.6.4; 1.6.6;
merge ktrace-lwp.
 1.5 13-Sep-2005  christos branches: 1.5.6;
compat code reorg.
 1.4 19-Aug-2005  yamt compat_30_sys_getdents: netbsd 1.2 -> 3.0 in comments/messages.
 1.3 19-Aug-2005  yamt compat_30_sys_getdents: don't leak kernel stack garbage to userland.
 1.2 19-Aug-2005  christos change a hard-coded 0xf to _DIRENT_ALIGN (thanks yamt)
 1.1 19-Aug-2005  christos 64 bit inode changes.
 1.5.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.5.6.1 13-Sep-2005  skrll file vfs_syscalls_30.c was added on branch ktrace-lwp on 2005-11-10 14:00:40 +0000
 1.6.6.2 01-Jun-2006  kardel Sync with head.
 1.6.6.1 22-Apr-2006  simonb Sync with head.
 1.6.4.1 09-Sep-2006  rpaulo sync with head
 1.6.2.1 31-Dec-2005  yamt adapt some random parts of kernel to uio_vmspace.
 1.7.6.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.7.4.2 12-May-2006  elad adapt to kauth kpi, include sys/kauth.h where needed..
 1.7.4.1 11-May-2006  elad sync with head
 1.7.2.2 11-Aug-2006  yamt sync with head
 1.7.2.1 24-May-2006  yamt sync with head.
 1.9.6.7 24-Mar-2008  yamt sync with head.
 1.9.6.6 21-Jan-2008  yamt sync with head
 1.9.6.5 03-Sep-2007  yamt sync with head.
 1.9.6.4 26-Feb-2007  yamt sync with head.
 1.9.6.3 30-Dec-2006  yamt sync with head.
 1.9.6.2 21-Jun-2006  yamt sync with head.
 1.9.6.1 14-May-2006  yamt file vfs_syscalls_30.c was added on branch yamt-lazymbuf on 2006-06-21 14:58:32 +0000
 1.9.4.1 13-Jul-2006  gdamore Merge from HEAD.
 1.15.6.2 10-Dec-2006  yamt sync with head.
 1.15.6.1 22-Oct-2006  yamt sync with head
 1.15.4.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.15.4.1 18-Nov-2006  ad Sync with head.
 1.18.2.1 12-Jun-2010  riz Pull up following revision(s) (requested by he in ticket #1387):
sys/compat/svr4/svr4_misc.c: revision 1.149
sys/compat/linux/common/linux_misc.c: revision 1.214
sys/compat/common/vfs_syscalls_30.c: revision 1.31
sys/compat/sunos/sunos_misc.c: revision 1.166
sys/compat/linux/common/linux_file64.c: revision 1.50
sys/compat/svr4_32/svr4_32_misc.c: revision 1.68
sys/compat/ibcs2/ibcs2_misc.c: revision 1.110
sys/compat/linux32/common/linux32_dirent.c: revision 1.10
sys/compat/sunos32/sunos32_misc.c: revision 1.69
sys/compat/irix/irix_dirent.c: revision 1.24
sys/compat/osf1/osf1_file.c: revision 1.38
When implementing "read directory", when there are too many empty entries
in a row, and we need to try to read the next block, and have passed a
non-NULL cookie pointer to VOP_READDIR, ensure that we free the cookie
buffer before re-doing VOP_READDIR, so that we don't leak memory.
This fix is similar to nfs_serv.c revisions 1.115 + 1.124.
This should fix the long-standing problem observed by e.g. using Linux-
emulated programs to take backup of servers, which is one of the problems
which were reported in PR#42661.
Thanks to pooka@ for the hints for traversing the VOP* layer.
 1.19.2.2 07-May-2007  yamt sync with head.
 1.19.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.21.4.1 11-Jul-2007  mjf Sync with head.
 1.21.2.1 27-May-2007  ad Sync with head.
 1.23.16.1 26-Dec-2007  ad Sync with head.
 1.23.8.1 09-Jan-2008  matt sync with HEAD
 1.23.6.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.24.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.25.6.4 17-Jan-2009  mjf Sync with HEAD.
 1.25.6.3 29-Jun-2008  mjf Sync with HEAD.
 1.25.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.25.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.26.6.4 11-Aug-2010  yamt sync with head.
 1.26.6.3 11-Mar-2010  yamt sync with head
 1.26.6.2 04-May-2009  yamt sync with head.
 1.26.6.1 16-May-2008  yamt sync with head.
 1.26.4.1 18-May-2008  yamt sync with head.
 1.26.2.3 09-Nov-2008  christos fix fhstat.
 1.26.2.2 01-Nov-2008  christos Sync with head.
 1.26.2.1 29-Mar-2008  christos Welcome to the time_t=long long dev_t=uint64_t branch.
 1.27.4.1 27-Jun-2008  simonb Sync with head.
 1.27.2.3 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.27.2.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.27.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.28.12.1 21-Apr-2010  matt sync to netbsd-5
 1.28.6.1 17-Mar-2010  snj Pull up following revision(s) (requested by he in ticket #1323):
sys/compat/common/vfs_syscalls_30.c: revision 1.31
sys/compat/ibcs2/ibcs2_misc.c: revision 1.110
sys/compat/irix/irix_dirent.c: revision 1.24
sys/compat/linux/common/linux_file64.c: revision 1.50
sys/compat/linux/common/linux_misc.c: revision 1.214
sys/compat/linux32/common/linux32_dirent.c: revision 1.10
sys/compat/sunos/sunos_misc.c: revision 1.166
sys/compat/sunos32/sunos32_misc.c: revision 1.69
sys/compat/svr4/svr4_misc.c: revision 1.149
sys/compat/svr4_32/svr4_32_misc.c: revision 1.68
When implementing "read directory", when there are too many empty entries
in a row, and we need to try to read the next block, and have passed a
non-NULL cookie pointer to VOP_READDIR, ensure that we free the cookie
buffer before re-doing VOP_READDIR, so that we don't leak memory.
This fix is similar to nfs_serv.c revisions 1.115 + 1.124.
This should fix the long-standing problem observed by e.g. using Linux-
emulated programs to take backup of servers, which is one of the problems
which were reported in PR#42661.
Thanks to pooka@ for the hints for traversing the VOP* layer.
 1.28.4.2 03-Mar-2009  skrll Sync with HEAD.
 1.28.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.30.4.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.30.4.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.31.2.2 05-Mar-2011  rmind sync with head
 1.31.2.1 03-Jul-2010  rmind sync with head
 1.33.34.1 29-Dec-2014  martin Pull up following revision(s) (requested by maxv in ticket #353):
sys/ufs/chfs/chfs_vfsops.c: revision 1.12
sys/compat/common/vfs_syscalls_30.c: revision 1.35
sys/compat/linux/common/linux_uselib.c: revision 1.31
sys/compat/linux/common/linux_uselib.c: revision 1.32
Resource leak.
Memory leaks.
Reject non-regular files.
 1.33.18.1 03-Dec-2017  jdolecek update from HEAD
 1.36.20.3 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.36.20.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.36.20.1 10-Jun-2019  christos Sync with HEAD
 1.36.18.3 22-Sep-2018  pgoyette #include "opt_compat_netbsd.h" for all sources that provide compat code.
 1.36.18.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.36.18.1 28-Mar-2018  pgoyette Initial pass at a compat_30 module.

Still needs some work for dev/vnd and various dev/usb/*
 1.36.12.2 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1836):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.36.12.1 15-Aug-2021  martin Pull up following revision(s) (requested by christos in ticket #1691):

sys/compat/common/vfs_syscalls_43.c: revision 1.67
sys/compat/common/vfs_syscalls_50.c: revision 1.26
sys/compat/common/vfs_syscalls_30.c: revision 1.42

- memset struct stat to avoid kernel memory disclosure of padded fields
(thanks Trend Micro for the report)
- use do_fhstat
- consistency in argument order of compat functions
 1.38.4.2 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.38.4.1 15-Aug-2021  martin Pull up following revision(s) (requested by christos in ticket #1337):

sys/compat/common/vfs_syscalls_43.c: revision 1.67
sys/compat/common/vfs_syscalls_50.c: revision 1.26
sys/compat/common/vfs_syscalls_30.c: revision 1.42

- memset struct stat to avoid kernel memory disclosure of padded fields
(thanks Trend Micro for the report)
- use do_fhstat
- consistency in argument order of compat functions
 1.39.2.2 29-Feb-2020  ad Sync with head.
 1.39.2.1 17-Jan-2020  ad Sync with head.
 1.5 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.4 23-Oct-2015  maxv branches: 1.4.16; 1.4.18;
Change do_sys_mount() so that it only takes as argument the type of the
drive instead of its associated vfsops. Makes it more friendly, and allows
compat binaries to autoload VFS modules if needed.

sent on tech-kern@, ok christos@
 1.3 19-Jan-2011  tsutsui branches: 1.3.16; 1.3.34;
Remove includes <sys/mount.h> and <sys/sched.h> added for <sys/syscallargs.h>.
Now they are handled by $sysarghdrextra in sys/kern/syscalls.conf.
 1.2 16-Nov-2008  martin branches: 1.2.4; 1.2.6; 1.2.8; 1.2.12; 1.2.16; 1.2.18;
Make it compile
 1.1 14-Nov-2008  ad - Move some more compat code into sys/compat.
- Split 4.3BSD ifioctl stuff into its own file.
- Remove some ifdefs that include small fragments of vfs compat code
which are difficult to relocate elsewhere.
 1.2.18.1 06-Jun-2011  jruoho Sync with HEAD.
 1.2.16.1 05-Mar-2011  rmind sync with head
 1.2.12.2 04-May-2009  yamt sync with head.
 1.2.12.1 16-Nov-2008  yamt file vfs_syscalls_40.c was added on branch yamt-nfs-mp on 2009-05-04 08:12:17 +0000
 1.2.8.2 19-Jan-2009  skrll Sync with HEAD.
 1.2.8.1 16-Nov-2008  skrll file vfs_syscalls_40.c was added on branch nick-hppapmap on 2009-01-19 13:17:17 +0000
 1.2.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.2.6.1 16-Nov-2008  mjf file vfs_syscalls_40.c was added on branch mjf-devfs2 on 2009-01-17 13:28:41 +0000
 1.2.4.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.2.4.1 16-Nov-2008  haad file vfs_syscalls_40.c was added on branch haad-dm on 2008-12-13 01:13:47 +0000
 1.3.34.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.3.16.1 03-Dec-2017  jdolecek update from HEAD
 1.4.18.1 10-Jun-2019  christos Sync with HEAD
 1.4.16.2 22-Sep-2018  pgoyette #include "opt_compat_netbsd.h" for all sources that provide compat code.
 1.4.16.1 27-Mar-2018  pgoyette Create a compat_40 module
 1.68 07-Sep-2021  riastradh sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.67 15-Aug-2021  christos - memset struct stat to avoid kernel memory disclosure of padded fields
(thanks Trend Micro for the report)
- use do_fhstat
- consistency in argument order of compat functions
 1.66 24-Jun-2020  jdolecek remove special handling for symbolic links for COMPAT_43 lstat, it's
not necessary; this removes the only places in kernel which did namei
LOOKUP with LOCKPARENT

fixes diagnostic KASSERT() in namei() code

Reported-by: syzbot+628382ecf1438e53d08d@syzkaller.appspotmail.com
 1.65 27-Feb-2020  pgoyette Include all of the vfs syscalls in the syscall_package, not just oquota.

Should fix PR kern/55025

XXX pullup-9
 1.64 27-Jan-2019  pgoyette branches: 1.64.4; 1.64.6;
Merge the [pgoyette-compat] branch
 1.63 03-Sep-2018  riastradh Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.62 03-Dec-2017  christos branches: 1.62.2; 1.62.4;
Make code look the same, in particular zero out the rest of the directory
record.
XXX: pullup-8
 1.61 29-Jul-2017  riastradh Declare mountcompatnames in sys/vfs_syscalls.h to kill nested extern.
 1.60 28-Jul-2017  riastradh Fail, don't panic, on bad dirents from file system.

Controllable via puffs from userland.

From Ilja Van Sprundel.
 1.59 13-Jan-2017  christos branches: 1.59.8;
convert strcpy to a bounded copy to avoid compiler warnings, although the
reclen test prevents overflow.
 1.58 20-Aug-2016  mrg fill in the tv_nsec parts of the converted timespec in cvtstat().
 1.57 05-Sep-2014  matt branches: 1.57.2; 1.57.4;
Try not to use f_data, use f_{vnode,socket,pipe,mqueue,kqueue,ksem} to get
a correctly typed pointer.
 1.56 28-Jan-2014  christos branches: 1.56.4; 1.56.6;
Fix the compat-4.3 getdirentries call (pre d_type). This is used in NetBSD-0.9.
 1.55 21-Feb-2013  pgoyette branches: 1.55.2;
Move boottime50 and its associated sysctl into the compat module. As
noted on tech-kern. Should fix PR/47579.

OK christos@

Will request pull-up to 6.0 in a few days.
 1.54 19-Nov-2010  dholland branches: 1.54.8; 1.54.14; 1.54.18; 1.54.20;
Introduce struct pathbuf. This is an abstraction to hold a pathname
and the metadata required to interpret it. Callers of namei must now
create a pathbuf and pass it to NDINIT (instead of a string and a
uio_seg), then destroy the pathbuf after the namei session is
complete.

Update all namei call sites accordingly. Add a pathbuf(9) man page and
update namei(9).

The pathbuf interface also now appears in a couple of related
additional places that were passing string/uio_seg pairs that were
later fed into NDINIT. Update other call sites accordingly.
 1.53 24-Jun-2010  hannken Clean up vnode lock operations pass 2:

VOP_UNLOCK(vp, flags) -> VOP_UNLOCK(vp): Remove the unneeded flags argument.

Welcome to 5.99.32.

Discussed on tech-kern.
 1.52 02-Mar-2010  pooka branches: 1.52.2;
fs_union.h is not used here anymore ... diudau
 1.51 08-Jan-2010  pooka branches: 1.51.2;
The VATTR_NULL/VREF/VHOLD/HOLDRELE() macros lost their will to live
years ago when the kernel was modified to not alter ABI based on
DIAGNOSTIC, and now just call the respective function interfaces
(in lowercase). Plenty of mix'n match upper/lowercase has creeped
into the tree since then. Nuke the macros and convert all callsites
to lowercase.

no functional change
 1.50 17-Mar-2009  dyoung Add #include "opt_compat_netbsd.h" for COMPAT_09.
 1.49 26-Jan-2009  njoly branches: 1.49.2;
Make all fstat(2) compat syscalls consistently use do_sys_fstat(),
instead of fd_getfile()/fd_putfile() dance.

ok by christos.
 1.48 19-Nov-2008  ad Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.47 24-Jun-2008  ad branches: 1.47.2; 1.47.4;
Replace references to getsock/getvnode.
 1.46 21-Mar-2008  ad branches: 1.46.4; 1.46.6; 1.46.8;
Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
 1.45 20-Dec-2007  dsl branches: 1.45.6;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.44 08-Dec-2007  pooka branches: 1.44.4;
Remove cn_lwp from struct componentname. curlwp should be used
from on. The NDINIT() macro no longer takes the lwp parameter and
associates the credentials of the calling thread with the namei
structure.
 1.43 08-Dec-2007  dsl ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.42 04-Dec-2007  dsl Remove all the __P
 1.41 26-Nov-2007  pooka branches: 1.41.2;
Remove the "struct lwp *" argument from all VFS and VOP interfaces.
The general trend is to remove it from all kernel interfaces and
this is a start. In case the calling lwp is desired, curlwp should
be used.

quick consensus on tech-kern
 1.40 10-Oct-2007  ad branches: 1.40.4;
Merge from vmlocking:

- Split vnode::v_flag into three fields, depending on field locking.
- simple_lock -> kmutex in a few places.
- Fix some simple locking problems.
 1.39 17-Jul-2007  christos branches: 1.39.6; 1.39.8; 1.39.10;
MFSNAMELEN only belongs in compat.
 1.38 22-Apr-2007  dsl Change the way that emulations locate files within the emulation root to
avoid having to allocate space in the 'stackgap'
- which is very LWP unfriendly.
The additional code for non-emulation namei() is trivial, the reduction for
the emulations is massive.
The vnode for a processes emulation root is saved in the cwdi structure
during process exec.
If the emulation root the TRYEMULROOT flag are set, namei() will do an initial
search for absolute pathnames in the emulation root, if that fails it will
retry from the normal root.
".." at the emulation root will always go to the real root, even in the middle
of paths and when expanding symlinks.
Absolute symlinks found using absolute paths in the emulation root will be
relative to the emulation root (so /usr/lib/xxx.so -> /lib/xxx.so links
inside the emulation root don't need changing).
If the root of the emulation would be returned (for an emulation lookup), then
the real root is returned instead (matching the behaviour of emul_lookup,
but being a cheap comparison here) so that programs that scan "../.."
looking for the root dircetory don't loop forever.
The target for symbolic links is no longer mangled (it used to get the
CHECK_ALT_xxx() treatment, so could get /emul/xxx prepended).
CHECK_ALT_xxx() are no more. Most of the change is deleting them, and adding
TRYEMULROOT to the flags to NDINIT().
A lot of the emulation system call stubs could now be deleted.
 1.37 10-Mar-2007  dsl branches: 1.37.2; 1.37.4;
Use the support routines from kern_syscalls.c instead of rolling our own code.
 1.36 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.35 09-Feb-2007  ad branches: 1.35.2;
Merge newlock2 to head.
 1.34 16-Nov-2006  christos __unused removal on arguments; approved by core.
 1.33 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.32 01-Mar-2006  yamt branches: 1.32.14; 1.32.16;
merge yamt-uio_vmspace branch.

- use vmspace rather than proc or lwp where appropriate.
the latter is more natural to specify an address space.
(and less likely to be abused for random purposes.)
- fix a swdmover race.
 1.31 11-Dec-2005  christos branches: 1.31.2; 1.31.4; 1.31.6;
merge ktrace-lwp.
 1.30 13-Sep-2005  christos compat code reorg.
 1.29 26-Feb-2005  perry branches: 1.29.4;
nuke trailing whitespace
 1.28 15-Aug-2004  mycroft branches: 1.28.4; 1.28.6;
Fixing age old cruft:
* Rather than using mnt_maxsymlinklen to indicate that a file systems returns
d_type fields(!), add a new internal flag, IMNT_DTYPE.

Add 3 new elements to ufsmount:
* um_maxsymlinklen, replaces mnt_maxsymlinklen (which never should have existed
in the first place).
* um_dirblksiz, which tracks the current directory block size, eliminating the
FS-specific checks littered throughout the code. This may be used later to
make the block size variable.
* um_maxfilesize, which is the maximum file size, possibly adjusted lower due
to implementation issues.

Sync some bug fixes from FFS into ext2fs, particularly:
* ffs_lookup.c 1.21, 1.28, 1.33, 1.48
* ffs_inode.c 1.43, 1.44, 1.45, 1.66, 1.67
* ffs_vnops.c 1.84, 1.85, 1.86

Clean up some crappy pointer frobnication.
 1.27 19-Nov-2003  christos - don't use MALLOC for non constant counts
- check malloc() size.
 1.26 19-Nov-2003  christos Don't include malloc.h if you are not going to use it.
 1.25 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.24 29-Jun-2003  fvdl branches: 1.24.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.23 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.22 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.21 25-Nov-2002  thorpej Avoid strict-alias warnings.
 1.20 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.19 14-Jun-2001  thorpej branches: 1.19.2; 1.19.4;
Fix a partial construction problem that can cause race conditions
between creation of a file descriptor and close(2) when using kernel
assisted threads. What we do is stick descriptors in the table, but
mark them as "larval". This causes essentially everything to treat
it as a non-existent descriptor, except for fdalloc(), which sees a
filled slot so that it won't (incorrectly) allocate it again. When
a descriptor is fully constructed, the code that has constructed it
marks it as "mature" (which actually clears the "larval" flag), and
things continue to work as normal.

While here, gather all the code that gets a descriptor from the table
into a fd_getfile() function, and call it, rather than having the
same (sometimes incorrect) code copied all over the place.
 1.18 30-May-2001  mrg use _KERNEL_OPT.
 1.17 09-Apr-2001  jdolecek Change the first arg to fileops fo_stat routine to struct file *, adjust
callers and appropriate routines to cope. This makes fo_stat more
consistent with rest of fileops routines and also makes the fo_stat
match FreeBSD as an added bonus.
Discussed with Luke Mewburn on tech-kern@.
 1.16 07-Apr-2001  jdolecek Add new 'stat' fileop and call the stat function via f_ops rather
than directly.
For compat syscalls, also add necessary FILE_USE()/FILE_UNUSE().
Now that soo_stat() gets a proc arg, pass it on to usrreq function.
 1.15 29-Nov-2000  jdolecek branches: 1.15.2;
LKMify
 1.14 26-Jul-2000  pk lstat: since namei() returns an error (EISDIR) if there is no parent to lock,
retry the lookup without LOCKPARENT if that happens. This is safe, since
need to have LOCKPARENT only if the vnode is of type VLNK.
 1.13 30-Mar-2000  augustss Kill register declarations.
 1.12 05-May-1999  thorpej branches: 1.12.2;
Add "use counting" to file entries. When closing a file, and it's reference
count is 0, wait for use count to drain before finishing the close.

This is necessary in order for multiple processes to safely share file
descriptor tables.
 1.11 30-Mar-1999  wrstuden branches: 1.11.4;
Explicitly mask mode returned in old stat structure to 16 bits. Also correct
comment (we're converting from a new to an old struct stat).
 1.10 01-Mar-1998  fvdl Merge with Lite2 + local changes
 1.9 19-Feb-1998  thorpej Include the UNION option header.
 1.8 16-Oct-1997  christos add stat12 compatibility calls and rename ostat to stat43
 1.7 10-Oct-1997  fvdl u_long -> off_t, I missed the big endian case. From Juergen Hannken-Illjes
 1.6 10-Oct-1997  fvdl Add getdirentries backward compat syscall. Provide common function to
signal cookie overflow during emulated getdents and friends.
 1.5 06-Jun-1997  christos branches: 1.5.4;
PR/3701: Arne H. Juul: olstat can't stat "/", because it still pretended
that symlinks don't have inodes.
 1.4 14-Mar-1996  christos Fix compiler warnings
 1.3 07-Oct-1995  mycroft Prefix names of system call implementation functions with `sys_'.
 1.2 19-Sep-1995  thorpej Make system calls conform to a standard prototype and bring those
prototypes into scope.
 1.1 24-Jun-1995  christos - Extracted all compat routines from the kern directory and moved here.
- Created compat_util.c and compat_util.h to be used by the compatibility
modules, so they don't duplicate the same code.
- Added prototypes to the stackgap allocation routines.
 1.5.4.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.11.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.12.2.3 21-Apr-2001  bouyer Sync with HEAD
 1.12.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.12.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.15.2.7 11-Dec-2002  thorpej Sync with HEAD.
 1.15.2.6 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.15.2.5 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.15.2.4 14-Nov-2001  nathanw Catch up to -current.
 1.15.2.3 21-Jun-2001  nathanw Catch up to -current.
 1.15.2.2 09-Apr-2001  nathanw Catch up with -current.
 1.15.2.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.19.4.1 18-Sep-2001  fvdl Various changes to make cloning devices possible:

* Add an extra argument (struct vnode **) to VOP_OPEN. If it is
not NULL, specfs will create a cloned (aliased) vnode during
the call, and return it there. The caller should release and
unlock the original vnode if a new vnode was returned. The
new vnode is returned locked.

* Add a flag field to the cdevsw and bdevsw structures.
DF_CLONING indicates that it wants a new vnode for each
open (XXX is there a better way? devprop?)

* If a device is cloning, always call the close entry
point for a VOP_CLOSE.


Also, rewrite cons.c to do the right thing with vnodes. Use VOPs
rather then direct device entry calls. Suggested by mycroft@

Light to moderate testing done an i386 system (arch doesn't matter
though, these are MI changes).
 1.19.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.24.2.7 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.24.2.6 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.24.2.5 21-Sep-2004  skrll Fix the sync with head I botched.
 1.24.2.4 18-Sep-2004  skrll Sync with HEAD.
 1.24.2.3 25-Aug-2004  skrll Sync with HEAD.
 1.24.2.2 03-Aug-2004  skrll Sync with HEAD
 1.24.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.28.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.28.4.1 29-Apr-2005  kent sync with -current
 1.29.4.8 24-Mar-2008  yamt sync with head.
 1.29.4.7 21-Jan-2008  yamt sync with head
 1.29.4.6 07-Dec-2007  yamt sync with head
 1.29.4.5 27-Oct-2007  yamt sync with head.
 1.29.4.4 03-Sep-2007  yamt sync with head.
 1.29.4.3 26-Feb-2007  yamt sync with head.
 1.29.4.2 30-Dec-2006  yamt sync with head.
 1.29.4.1 21-Jun-2006  yamt sync with head.
 1.31.6.1 22-Apr-2006  simonb Sync with head.
 1.31.4.1 09-Sep-2006  rpaulo sync with head
 1.31.2.1 31-Dec-2005  yamt adapt some random parts of kernel to uio_vmspace.
 1.32.16.2 10-Dec-2006  yamt sync with head.
 1.32.16.1 22-Oct-2006  yamt sync with head
 1.32.14.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.32.14.1 18-Nov-2006  ad Sync with head.
 1.35.2.2 07-May-2007  yamt sync with head.
 1.35.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.37.4.1 11-Jul-2007  mjf Sync with head.
 1.37.2.4 20-Aug-2007  ad Sync with HEAD.
 1.37.2.3 17-Jun-2007  ad - Increase the number of thread priorities from 128 to 256. How the space
is set up is to be revisited.
- Implement soft interrupts as kernel threads. A generic implementation
is provided, with hooks for fast-path MD code that can run the interrupt
threads over the top of other threads executing in the kernel.
- Split vnode::v_flag into three fields, depending on how the flag is
locked (by the interlock, by the vnode lock, by the file system).
- Miscellaneous locking fixes and improvements.
 1.37.2.2 27-May-2007  ad Sync with head.
 1.37.2.1 13-May-2007  ad - Pass the error number and residual count to biodone(), and let it handle
setting error indicators. Prepare to eliminate B_ERROR.
- Add a flag argument to brelse() to be set into the buf's flags, instead
of doing it directly. Typically used to set B_INVAL.
- Add a "struct cpu_info *" argument to kthread_create(), to be used to
create bound threads. Change "bool mpsafe" to "int flags".
- Allow exit of LWPs in the IDL state when (l != curlwp).
- More locking fixes & conversion to the new API.
 1.39.10.1 14-Oct-2007  yamt sync with head.
 1.39.8.2 09-Jan-2008  matt sync with HEAD
 1.39.8.1 06-Nov-2007  matt sync with HEAD
 1.39.6.3 09-Dec-2007  jmcneill Sync with HEAD.
 1.39.6.2 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.39.6.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.40.4.2 27-Dec-2007  mjf Sync with HEAD.
 1.40.4.1 08-Dec-2007  mjf Sync with HEAD.
 1.41.2.2 26-Dec-2007  ad Sync with head.
 1.41.2.1 08-Dec-2007  ad Sync with head.
 1.44.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.45.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.45.6.2 29-Jun-2008  mjf Sync with HEAD.
 1.45.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.46.8.1 27-Jun-2008  simonb Sync with head.
 1.46.6.3 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.46.6.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.46.6.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.46.4.3 11-Aug-2010  yamt sync with head.
 1.46.4.2 11-Mar-2010  yamt sync with head
 1.46.4.1 04-May-2009  yamt sync with head.
 1.47.4.3 28-Apr-2009  skrll Sync with HEAD.
 1.47.4.2 03-Mar-2009  skrll Sync with HEAD.
 1.47.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.47.2.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.49.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.51.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.51.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.52.2.2 05-Mar-2011  rmind sync with head
 1.52.2.1 03-Jul-2010  rmind sync with head
 1.54.20.3 19-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1483):
sys/compat/common/vfs_syscalls_12.c: revision 1.34
sys/compat/svr4_32/svr4_32_misc.c: revision 1.78
sys/compat/sunos32/sunos32_misc.c: revision 1.78
sys/compat/linux/common/linux_misc.c: revision 1.239
sys/compat/osf1/osf1_file.c: revision 1.44
sys/compat/common/vfs_syscalls_43.c: revision 1.60
sys/compat/svr4/svr4_misc.c: revision 1.158
sys/compat/ibcs2/ibcs2_misc.c: revision 1.114
sys/compat/linux/common/linux_file64.c: revision 1.59
sys/compat/linux32/common/linux32_dirent.c: revision 1.18
sys/compat/sunos/sunos_misc.c: revision 1.171
Fail, don't panic, on bad dirents from file system.
Controllable via puffs from userland.
From Ilja Van Sprundel.
 1.54.20.2 12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1469):
sys/compat/common/vfs_syscalls_12.c: revision 1.30
sys/compat/common/vfs_syscalls_43.c: revision 1.56
sys/compat/sys/dirent.h: revision 1.3
It is wishful thinking that vn_readdir will return dirent12 structures.
--
Fix the compat-4.3 getdirentries call (pre d_type). This is used in NetBSD-0.9.
--
add a struct for the 4.3BSD struct direct
 1.54.20.1 27-Aug-2016  bouyer Pull up following revision(s) (requested by mrg in ticket #1400):
sys/compat/common/vfs_syscalls_43.c: revision 1.58
fill in the tv_nsec parts of the converted timespec in cvtstat().
 1.54.18.3 03-Dec-2017  jdolecek update from HEAD
 1.54.18.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.54.18.1 25-Feb-2013  tls resync with head
 1.54.14.4 19-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1483):
sys/compat/common/vfs_syscalls_12.c: revision 1.34
sys/compat/svr4_32/svr4_32_misc.c: revision 1.78
sys/compat/sunos32/sunos32_misc.c: revision 1.78
sys/compat/linux/common/linux_misc.c: revision 1.239
sys/compat/osf1/osf1_file.c: revision 1.44
sys/compat/common/vfs_syscalls_43.c: revision 1.60
sys/compat/svr4/svr4_misc.c: revision 1.158
sys/compat/ibcs2/ibcs2_misc.c: revision 1.114
sys/compat/linux/common/linux_file64.c: revision 1.59
sys/compat/linux32/common/linux32_dirent.c: revision 1.18
sys/compat/sunos/sunos_misc.c: revision 1.171
Fail, don't panic, on bad dirents from file system.
Controllable via puffs from userland.
From Ilja Van Sprundel.
 1.54.14.3 12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1469):
sys/compat/common/vfs_syscalls_12.c: revision 1.30
sys/compat/common/vfs_syscalls_43.c: revision 1.56
sys/compat/sys/dirent.h: revision 1.3
It is wishful thinking that vn_readdir will return dirent12 structures.
--
Fix the compat-4.3 getdirentries call (pre d_type). This is used in NetBSD-0.9.
--
add a struct for the 4.3BSD struct direct
 1.54.14.2 27-Aug-2016  bouyer Pull up following revision(s) (requested by mrg in ticket #1400):
sys/compat/common/vfs_syscalls_43.c: revision 1.58
fill in the tv_nsec parts of the converted timespec in cvtstat().
 1.54.14.1 14-Mar-2013  riz branches: 1.54.14.1.2;
Pull up following revision(s) (requested by pgoyette in ticket #837):
sys/compat/common/kern_time_50.c: revision 1.25
sys/kern/init_sysctl.c: revision 1.195
sys/kern/init_main.c: revision 1.447
sys/compat/common/compat_util.h: revision 1.23
sys/compat/common/compat_mod.h: revision 1.1
sys/compat/common/compat_mod.c: revision 1.16
sys/compat/common/compat_mod.c: revision 1.17
sys/compat/common/compat_mod.c: revision 1.18
sys/compat/common/vfs_syscalls_43.c: revision 1.55
Move boottime50 and its associated sysctl into the compat module. As
noted on tech-kern. Should fix PR/47579.
OK christos@
Will request pull-up to 6.0 in a few days.
Wrap sysctl_teardown(&compat_clog) with the appropriate #if defined()s
remove empty #if
 1.54.14.1.2.3 19-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1483):
sys/compat/common/vfs_syscalls_12.c: revision 1.34
sys/compat/svr4_32/svr4_32_misc.c: revision 1.78
sys/compat/sunos32/sunos32_misc.c: revision 1.78
sys/compat/linux/common/linux_misc.c: revision 1.239
sys/compat/osf1/osf1_file.c: revision 1.44
sys/compat/common/vfs_syscalls_43.c: revision 1.60
sys/compat/svr4/svr4_misc.c: revision 1.158
sys/compat/ibcs2/ibcs2_misc.c: revision 1.114
sys/compat/linux/common/linux_file64.c: revision 1.59
sys/compat/linux32/common/linux32_dirent.c: revision 1.18
sys/compat/sunos/sunos_misc.c: revision 1.171
Fail, don't panic, on bad dirents from file system.
Controllable via puffs from userland.
From Ilja Van Sprundel.
 1.54.14.1.2.2 12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1469):
sys/compat/common/vfs_syscalls_12.c: revision 1.30
sys/compat/common/vfs_syscalls_43.c: revision 1.56
sys/compat/sys/dirent.h: revision 1.3
It is wishful thinking that vn_readdir will return dirent12 structures.
--
Fix the compat-4.3 getdirentries call (pre d_type). This is used in NetBSD-0.9.
--
add a struct for the 4.3BSD struct direct
 1.54.14.1.2.1 27-Aug-2016  bouyer Pull up following revision(s) (requested by mrg in ticket #1400):
sys/compat/common/vfs_syscalls_43.c: revision 1.58
fill in the tv_nsec parts of the converted timespec in cvtstat().
 1.54.8.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.55.2.1 18-May-2014  rmind sync with head
 1.56.6.2 12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1479):
sys/compat/common/vfs_syscalls_12.c: revision 1.34
sys/rump/kern/lib/libsys_sunos/rump_sunos_compat.c: revision 1.2
sys/compat/svr4_32/svr4_32_misc.c: revision 1.78
sys/compat/sunos32/sunos32_misc.c: revision 1.78
sys/compat/linux/common/linux_misc.c: revision 1.239
sys/compat/osf1/osf1_file.c: revision 1.44
sys/compat/common/vfs_syscalls_43.c: revision 1.60
sys/compat/svr4/svr4_misc.c: revision 1.158
sys/compat/ibcs2/ibcs2_misc.c: revision 1.114
sys/compat/linux/common/linux_file64.c: revision 1.59
sys/compat/linux32/common/linux32_dirent.c: revision 1.18
sys/compat/sunos/sunos_misc.c: revision 1.171
Fail, don't panic, on bad dirents from file system.
Controllable via puffs from userland.
From Ilja Van Sprundel.
 1.56.6.1 27-Aug-2016  bouyer Pull up following revision(s) (requested by mrg in ticket #1240):
sys/compat/common/vfs_syscalls_43.c: revision 1.58
fill in the tv_nsec parts of the converted timespec in cvtstat().
 1.56.4.2 12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1479):
sys/compat/common/vfs_syscalls_12.c: revision 1.34
sys/rump/kern/lib/libsys_sunos/rump_sunos_compat.c: revision 1.2
sys/compat/svr4_32/svr4_32_misc.c: revision 1.78
sys/compat/sunos32/sunos32_misc.c: revision 1.78
sys/compat/linux/common/linux_misc.c: revision 1.239
sys/compat/osf1/osf1_file.c: revision 1.44
sys/compat/common/vfs_syscalls_43.c: revision 1.60
sys/compat/svr4/svr4_misc.c: revision 1.158
sys/compat/ibcs2/ibcs2_misc.c: revision 1.114
sys/compat/linux/common/linux_file64.c: revision 1.59
sys/compat/linux32/common/linux32_dirent.c: revision 1.18
sys/compat/sunos/sunos_misc.c: revision 1.171
Fail, don't panic, on bad dirents from file system.
Controllable via puffs from userland.
From Ilja Van Sprundel.
 1.56.4.1 27-Aug-2016  bouyer branches: 1.56.4.1.4;
Pull up following revision(s) (requested by mrg in ticket #1240):
sys/compat/common/vfs_syscalls_43.c: revision 1.58
fill in the tv_nsec parts of the converted timespec in cvtstat().
 1.56.4.1.4.1 12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1479):
sys/compat/common/vfs_syscalls_12.c: revision 1.34
sys/rump/kern/lib/libsys_sunos/rump_sunos_compat.c: revision 1.2
sys/compat/svr4_32/svr4_32_misc.c: revision 1.78
sys/compat/sunos32/sunos32_misc.c: revision 1.78
sys/compat/linux/common/linux_misc.c: revision 1.239
sys/compat/osf1/osf1_file.c: revision 1.44
sys/compat/common/vfs_syscalls_43.c: revision 1.60
sys/compat/svr4/svr4_misc.c: revision 1.158
sys/compat/ibcs2/ibcs2_misc.c: revision 1.114
sys/compat/linux/common/linux_file64.c: revision 1.59
sys/compat/linux32/common/linux32_dirent.c: revision 1.18
sys/compat/sunos/sunos_misc.c: revision 1.171
Fail, don't panic, on bad dirents from file system.
Controllable via puffs from userland.
From Ilja Van Sprundel.
 1.57.4.1 20-Mar-2017  pgoyette Sync with HEAD
 1.57.2.3 28-Aug-2017  skrll Sync with HEAD
 1.57.2.2 05-Feb-2017  skrll Sync with HEAD
 1.57.2.1 05-Oct-2016  skrll Sync with HEAD
 1.59.8.4 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1836):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.59.8.3 15-Aug-2021  martin Pull up following revision(s) (requested by christos in ticket #1691):

sys/compat/common/vfs_syscalls_43.c: revision 1.67
sys/compat/common/vfs_syscalls_50.c: revision 1.26
sys/compat/common/vfs_syscalls_30.c: revision 1.42

- memset struct stat to avoid kernel memory disclosure of padded fields
(thanks Trend Micro for the report)
- use do_fhstat
- consistency in argument order of compat functions
 1.59.8.2 10-Dec-2017  snj Pull up following revision(s) (requested by christos in ticket #418):
sys/compat/common/vfs_syscalls_12.c: revision 1.35
sys/compat/common/vfs_syscalls_43.c: revision 1.62
Make code look the same, in particular zero out the rest of the directory
record.
 1.59.8.1 09-Aug-2017  snj Pull up following revision(s) (requested by spz in ticket #193):
sys/compat/common/vfs_syscalls_12.c: revision 1.34
sys/rump/kern/lib/libsys_sunos/rump_sunos_compat.c: revision 1.2
sys/compat/svr4_32/svr4_32_misc.c: revision 1.78
sys/compat/sunos32/sunos32_misc.c: revision 1.78
sys/compat/linux/common/linux_misc.c: revision 1.239
sys/compat/osf1/osf1_file.c: revision 1.44
sys/compat/common/vfs_syscalls_43.c: revision 1.60
sys/compat/svr4/svr4_misc.c: revision 1.158
sys/compat/ibcs2/ibcs2_misc.c: revision 1.114
sys/compat/linux/common/linux_file64.c: revision 1.59
sys/compat/linux32/common/linux32_dirent.c: revision 1.18
sys/compat/sunos/sunos_misc.c: revision 1.171
Fail, don't panic, on bad dirents from file system.
Controllable via puffs from userland.
From Ilja Van Sprundel.
 1.62.4.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.62.4.1 10-Jun-2019  christos Sync with HEAD
 1.62.2.4 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.62.2.3 17-Apr-2018  pgoyette Finish separating the compat_09 and compat_43 stuff
 1.62.2.2 17-Apr-2018  pgoyette First pass at compat modules for 4.3BSD, NetBSD-0.9, and NetBSD-1.0

XXX Still need to deal with the sysctl stuff and other code shared
XXX between 09 and 43
 1.62.2.1 31-Mar-2018  pgoyette Only need to #include sysctl.h once
 1.64.6.1 29-Feb-2020  ad Sync with head.
 1.64.4.3 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.64.4.2 15-Aug-2021  martin Pull up following revision(s) (requested by christos in ticket #1337):

sys/compat/common/vfs_syscalls_43.c: revision 1.67
sys/compat/common/vfs_syscalls_50.c: revision 1.26
sys/compat/common/vfs_syscalls_30.c: revision 1.42

- memset struct stat to avoid kernel memory disclosure of padded fields
(thanks Trend Micro for the report)
- use do_fhstat
- consistency in argument order of compat functions
 1.64.4.1 27-Feb-2020  martin Pull up following revision(s) (requested by pgoyette in ticket #741):

sys/compat/common/vfs_syscalls_43.c: revision 1.65

Include all of the vfs syscalls in the syscall_package, not just oquota.
Should fix PR kern/55025

XXX pullup-9
 1.26 15-Aug-2021  christos - memset struct stat to avoid kernel memory disclosure of padded fields
(thanks Trend Micro for the report)
- use do_fhstat
- consistency in argument order of compat functions
 1.25 21-Jan-2020  pgoyette Split the compat_50 module into two, separating the QUOTA-related
stuff from the rest of the module. This allows loading of the
(main) compat_50 module on kernels that don't include ``options
QUOTA''.

Welcome to 9.99.40 !

Addresses PR kern/54875
 1.24 15-Dec-2019  tsutsui branches: 1.24.2;
Remove clause 3 and 4 leftovers from TNF licenses in more sources.

Confirmed by martin@ in PR/54760.
 1.23 18-Jun-2019  kamil branches: 1.23.2;
Drop unused retval pointer from do_sys_mknod{,at}()

No functional change intended.
 1.22 17-Jun-2019  christos Add QUOTA ifdef (Paul Goyette)
 1.21 17-Jun-2019  pgoyette Use tabs, not spaces, for indentation. NFCI
 1.20 17-Jun-2019  christos If we don't compile a kernel with QUOTA, we don't support the compat quota
syscalls. XXX: need to fix the modules build.
 1.19 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.18 05-Sep-2014  matt branches: 1.18.12; 1.18.18; 1.18.20;
Try not to use f_data, use f_{vnode,socket,pipe,mqueue,kqueue,ksem} to get
a correctly typed pointer.
 1.17 13-Mar-2012  elad branches: 1.17.2;
Replace the remaining KAUTH_GENERIC_ISSUSER authorization calls with
something meaningful. All relevant documentation has been updated or
written.

Most of these changes were brought up in the following messages:

http://mail-index.netbsd.org/tech-kern/2012/01/18/msg012490.html
http://mail-index.netbsd.org/tech-kern/2012/01/19/msg012502.html
http://mail-index.netbsd.org/tech-kern/2012/02/17/msg012728.html

Thanks to christos, manu, njoly, and jmmv for input.

Huge thanks to pgoyette for spinning these changes through some build
cycles and ATF.
 1.16 01-Feb-2012  dholland Change the syscall API for quotas over to the new non-proplib one.

- struct vfs_quotactl_args -> struct quotactl_args
- add sys/stdint.h to sys/quotactl.h for clean userland build
- install sys/quotactl.h in /usr/include
- update set lists for same
- add new marshalling code in libquota
- add new unmarshalling code in vfs_syscalls.c
- discard proplib interpreter code in vfs_quotactl.c
- add dispatching code for the 14 quotactl ops in vfs_quotactl.c
- mark the proplib quotactl syscall obsolete
- add a new syscall number for the new quotactl syscall
- change the name of the syscall to __quotactl()
- remove the decl of the old quotactl from quota/quotaprop.h
- add a decl of the new quotactl to sys/quotactl.h
- update the libc build
- update ktruss
- remove proplib marshalling code from libquota
- update copy of syscall table in gdb ppc sources
- hack rumphijack to accomodate new quotactl name (as I recall,
pooka wanted such a name change to simplify something, but I
don't really see what/how)

This change appears to require a kernel version bump for rumpish
reasons.
 1.15 29-Jan-2012  dholland Some further tidying for the COMPAT_50 quotactl code. Mostly cosmetic,
but also use PNBUF_GET() and PNBUF_PUT() for a path buffer instead of
malloc with M_TEMP.
 1.14 29-Jan-2012  dholland Remove the proplib goop from the COMPAT_50 code for the old quotactl;
use the new VFS_QUOTACTL instead.
 1.13 29-Jan-2012  dholland Rename static inline "helper" functions:
ufsclass2qtype -> quota_idtype_to_ufs
qtype2ufsclass -> quota_idtype_from_ufs

The reason for the direction of "ufs" changing is that the old names
were among the symbols using "ufs" to mean "fs-independent". So the
old names were for translating "ufsclass" (fs-independent quota id
type) to "qtype" (ufs-specific quota id type) and vice versa.

These functions are used in only two places, both of which are
inappropriate, so at some point they should probably be removed.
They're also identity transformations so not particularly helpful,
unless one were to make a careful and concerted effort to distinguish
the ufs quota code numbers from the fs-independent ones. This has not
been done and is probably impossible without support from a program
verifier, and maybe not even then.

They are static inline, so no compat concerns arise.

Also adjust the symbols they use to avoid <quota/quotaprop.h>.
 1.12 29-Jan-2012  dholland Add vfs_quotactl() in between the syscall and VFS_QUOTACTL. Call it
from the COMPAT_50 code as well as the current sys_quotactl instead
of going directly to VFS_QUOTACTL. Doesn't actually do anything yet.
 1.11 29-Jan-2012  dholland Change dqblk_to_quotaval() from quota1_subr.c to dqblk_to_quotavals(),
and pass in two single quotaval structs (for blocks and inodes)
instead of an array of (implicitly) QUOTA_NLIMITS quotaval structs
indexed by constants from quotaprop.h.

Note: because this code is used by COMPAT_50 as well as ufs, this
change requires a kernel version bump. (The code is also used by
edquota, but via .PATH so it's not ABI-sensitive there.)
 1.10 25-Nov-2011  dholland branches: 1.10.2;
Rename struct ufs_quota_entry -> struct quotaval.
 1.9 20-Nov-2011  dholland Reshuffle decls among the quota headers so everything is in the place
it should be:
- stuff for the proplib interface goes in <quota/quotaprop.h>
- stuff for userlevel only goes in <quota/quota.h>
- stuff shared between user and kernel goes in <sys/quota.h>

Note that <quota/quota.h> and <quota/quotaprop.h> are expected to be
moved or removed later on... one thing at a time.

Update include directives in other files as needed.
 1.8 24-Mar-2011  bouyer branches: 1.8.4;
Add a new libquota library, which contains some blocks to build and/or
parse quota plists; as well as a getfsquota() function to retrieve quotas
for a single id from a single filesystem (whatever filesystem this is:
a local quota-enabled fs or NFS). This is build on functions getufsquota()
(for local filesystems with UFS-like quotas) and getnfsquota();
which are also available to userland programs.
move functions from quota2_subr.c to libquota or libprop as appropriate,
and ajust in-tree quota tools.
move some declarations from kernel headers to either sys/quota.h or
quota/quota.h as appropriate. ufs/ufs/quota.h still installed because
it's needed by other installed ufs headers.
ufs/ufs/quota1.h still installed as a quick&dirty way to get a code
using the old quotactl() to compile (just include ufs/ufs/quota1.h instead of
ufs/ufs/quota.h - old code won't compile without this change and this is
on purpose).
Discussed on tech-kern@ and tech-net@ (long thread, but not much about
libquota itself ...)
 1.7 06-Mar-2011  bouyer merge the bouyer-quota2 branch. This adds a new on-disk format
to store disk quota usage and limits, integrated with ffs
metadata. Usage is checked by fsck_ffs (no more quotacheck)
and is covered by the WAPBL journal. Enabled with kernel
option QUOTA2 (added where QUOTA was enabled in kernel config files),
turned on with tunefs(8) on a per-filesystem
basis. mount_mfs(8) can also turn quotas on.

See http://mail-index.netbsd.org/tech-kern/2011/02/19/msg010025.html
for details.
 1.6 13-Jul-2010  pooka branches: 1.6.2; 1.6.4;
Don't leak kernel stack into userspace.
 1.5 09-Aug-2009  haad branches: 1.5.2; 1.5.4;
Add enum uio_seg argument to do_sys_mknod and do_sys_mkdir so these functions
can be called from kernel, too.

Change needed for zfs device node creation, until we have propoer devfs.

Oked by ad@.
 1.4 26-Jan-2009  njoly Make all fstat(2) compat syscalls consistently use do_sys_fstat(),
instead of fd_getfile()/fd_putfile() dance.

ok by christos.
 1.3 11-Jan-2009  christos branches: 1.3.2; 1.3.4;
*utimes should allow NULL tvp.
 1.2 11-Jan-2009  christos merge christos-time_t
 1.1 29-Mar-2008  christos branches: 1.1.2; 1.1.6;
file vfs_syscalls_50.c was initially added on branch christos-time_t.
 1.1.6.3 11-Aug-2010  yamt sync with head.
 1.1.6.2 19-Aug-2009  yamt sync with head.
 1.1.6.1 04-May-2009  yamt sync with head.
 1.1.2.4 28-Dec-2008  christos for now don't bother with aio and lfs.
 1.1.2.3 09-Nov-2008  christos fix fhstat.
 1.1.2.2 26-Apr-2008  christos fix broken futimes.
 1.1.2.1 29-Mar-2008  christos new files
 1.3.4.3 03-Mar-2009  skrll Sync with HEAD.
 1.3.4.2 19-Jan-2009  skrll Sync with HEAD.
 1.3.4.1 11-Jan-2009  skrll file vfs_syscalls_50.c was added on branch nick-hppapmap on 2009-01-19 13:17:17 +0000
 1.3.2.2 17-Jan-2009  mjf Sync with HEAD.
 1.3.2.1 11-Jan-2009  mjf file vfs_syscalls_50.c was added on branch mjf-devfs2 on 2009-01-17 13:28:41 +0000
 1.5.4.2 21-Apr-2011  rmind sync with head
 1.5.4.1 05-Mar-2011  rmind sync with head
 1.5.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.6.4.1 15-Feb-2011  bouyer Implement COMPAT_50 quotactl(2)
 1.6.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.8.4.1 17-Apr-2012  yamt sync with head
 1.10.2.2 05-Apr-2012  mrg sync to latest -current.
 1.10.2.1 18-Feb-2012  mrg merge to -current.
 1.17.2.1 03-Dec-2017  jdolecek update from HEAD
 1.18.20.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.18.20.1 10-Jun-2019  christos Sync with HEAD
 1.18.18.2 22-Sep-2018  pgoyette #include "opt_compat_netbsd.h" for all sources that provide compat code.
 1.18.18.1 19-Mar-2018  pgoyette Initial pass at a COMPAT_50 module. More to come.
 1.18.12.1 15-Aug-2021  martin Pull up following revision(s) (requested by christos in ticket #1691):

sys/compat/common/vfs_syscalls_43.c: revision 1.67
sys/compat/common/vfs_syscalls_50.c: revision 1.26
sys/compat/common/vfs_syscalls_30.c: revision 1.42

- memset struct stat to avoid kernel memory disclosure of padded fields
(thanks Trend Micro for the report)
- use do_fhstat
- consistency in argument order of compat functions
 1.23.2.2 15-Aug-2021  martin Pull up following revision(s) (requested by christos in ticket #1337):

sys/compat/common/vfs_syscalls_43.c: revision 1.67
sys/compat/common/vfs_syscalls_50.c: revision 1.26
sys/compat/common/vfs_syscalls_30.c: revision 1.42

- memset struct stat to avoid kernel memory disclosure of padded fields
(thanks Trend Micro for the report)
- use do_fhstat
- consistency in argument order of compat functions
 1.23.2.1 18-Dec-2019  martin Pull up following revision(s) (requested by tsutsui in ticket #570):

sys/compat/netbsd32/netbsd32_compat_50_sysv.c: revision 1.3
sys/dev/raidframe/rf_compat50.h: revision 1.6
sys/arch/emips/emips/bus_space.c: revision 1.3
sys/compat/net/if.h: revision 1.5
sys/arch/emips/stand/common/bootinfo.c: revision 1.2
sys/compat/common/sysv_msg_50.c: revision 1.5
sys/compat/common/kern_time_30.c: revision 1.8
sys/arch/emips/stand/common/bootinfo.h: revision 1.2
sys/arch/ia64/include/bus.h: revision 1.4
sys/arch/ia64/ia64/bus_space.c: revision 1.2
sys/compat/common/sysv_shm_50.c: revision 1.5
sys/dev/ic/adw.h: revision 1.15
sys/compat/common/uipc_syscalls_50.c: revision 1.10
sys/arch/emips/ebus/flash_ebus.c: revision 1.22
sys/dev/ic/adv.h: revision 1.15
sys/dev/ic/adwmcode.c: revision 1.18
sys/dev/ic/advlib.c: revision 1.29
sys/arch/hpcarm/include/kloader.h: revision 1.3
sys/dev/usb/uberry.c: revision 1.16
sys/compat/common/sysv_sem_50.c: revision 1.5
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.43
sys/dev/ic/advlib.h: revision 1.21
sys/dev/ic/adv.c: revision 1.50
sys/compat/netinet6/in6_var.h: revision 1.5
sys/arch/hpc/stand/hpcboot/arm/arm_sa1100_asm.asm: revision 1.2
sys/arch/emips/include/loadfile_machdep.h: revision 1.3
sys/arch/emips/stand/common/prom_iface.c: revision 1.7
sys/dev/ic/adw.c: revision 1.56
sys/dev/ic/adwmcode.h: revision 1.12
sys/dev/ic/advmcode.c: revision 1.10
sys/arch/emips/ebus/ace_ebus.c: revision 1.22
sys/compat/netbsd32/netbsd32_compat_60.c: revision 1.5
sys/dev/raidframe/rf_compat50.c: revision 1.13
sys/arch/x68k/dev/intiovar.h: revision 1.15
sys/dev/usb/uipad.c: revision 1.8
sys/arch/zaurus/include/kloader.h: revision 1.3
sys/arch/emips/stand/common/bootxx.c: revision 1.2
sys/dev/ic/adwlib.h: revision 1.23
sys/dev/ic/adwlib.c: revision 1.44
sys/compat/netbsd32/netbsd32_compat_16.c: revision 1.3
sys/arch/amigappc/include/intr.h: revision 1.27
sys/arch/x68k/dev/mfp.c: revision 1.27
sys/arch/arm/at91/at91dbgu.c: revision 1.17
sys/dev/ic/advmcode.h: revision 1.7
sys/compat/ultrix/ultrix_exec.h: revision 1.7
sys/compat/common/vfs_syscalls_50.c: revision 1.24
sys/arch/mips/cavium/octeon_dma.c: revision 1.3
sys/arch/hpc/stand/hpcboot/arm/arm_pxa2x0_asm.asm: revision 1.2

Remove clause 3 and 4 from TNF licenses.
Ok'ed by martin@ in PR/54760.

Remove clause 3 and 4 leftovers from TNF licenses in more sources.
Confirmed by martin@ in PR/54760.
 1.24.2.1 25-Jan-2020  ad Sync with head.
 1.1 22-Sep-2019  christos branches: 1.1.8;
Add a new member to struct vfsstat and grow the unused members
The new member is caled f_mntfromlabel and it is the dkw_wname
of the corresponding wedge. This is now used by df -W to display
the mountpoint name as NAME=
 1.1.8.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.1.8.1 22-Sep-2019  martin file vfs_syscalls_90.c was added on branch phil-wifi on 2020-04-13 08:04:14 +0000
 1.21 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.20 19-Jan-2011  tsutsui branches: 1.20.56; 1.20.58;
Remove includes <sys/mount.h> and <sys/sched.h> added for <sys/syscallargs.h>.
Now they are handled by $sysarghdrextra in sys/kern/syscalls.conf.
 1.19 17-Jun-2008  tsutsui branches: 1.19.18; 1.19.24;
Include <sys/sched.h> before <sys/syscallargs.h> for cpuset_t.
 1.18 29-May-2008  mrg branches: 1.18.2;
remove clause #3 from my license where there are no other
copyright holders involved.
 1.17 20-Dec-2007  dsl branches: 1.17.6; 1.17.8; 1.17.10; 1.17.12;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.16 04-Mar-2007  christos branches: 1.16.16; 1.16.24; 1.16.28;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.15 09-Feb-2007  ad branches: 1.15.2;
Merge newlock2 to head.
 1.14 11-Dec-2005  christos branches: 1.14.20;
merge ktrace-lwp.
 1.13 29-May-2005  christos branches: 1.13.2;
- sprinkle const.
- add XXXUNCONST to the emul_find() pbuf argument free'ing. XXX: this needs
an api change.
- avoid variable shadowing.
 1.12 20-Jan-2003  simonb branches: 1.12.2;
The Double-Semi-Colon Police.
 1.11 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.10 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.9 29-Aug-1998  mrg branches: 1.9.24; 1.9.26;
move <vm/vm_swap.h> to <sys/swap.h>. <vm/vm_swap.h> still works for now (goes away later)
 1.8 20-Oct-1997  thorpej Fix the shared library versioning snafu caused by the recent changes
to the stat(2) family and msync(2). This uses a primitive function
versioning scheme.

This reverts the libc shared library major version from 13 to 12, and
adds a few new interfaces to bring us to libc version 12.20.

From Frank van der Linden <fvdl@NetBSD.ORG>.
 1.7 16-Oct-1997  christos PR/4269: msync is missing MS_*
 1.6 10-Oct-1997  mrg remove advertising clause from all my licenses.
 1.5 13-Jun-1997  thorpej branches: 1.5.4;
Don't #ifdef compat_12_sys_swapon() so that it can be used by other compat
modules.
 1.4 12-Jun-1997  mrg put the front end into libc.
 1.3 12-Jun-1997  mrg make this sys_swapon() for now.
 1.2 12-Jun-1997  mrg bring mrg-vm-swap2 onto mainline.
 1.1 14-Feb-1997  mrg branches: 1.1.2;
file vm_swap_12.c was initially added on branch mrg-vm-swap.
 1.1.2.2 14-Feb-1997  mrg branches: 1.1.2.2.2;
make this more likely to work; follow naming conventions
 1.1.2.1 14-Feb-1997  mrg emulate old swapon().
 1.1.2.2.2.3 01-Jun-1997  mrg it is called sys_swapctl() now.
 1.1.2.2.2.2 06-May-1997  pk Cast away `const' from old swapon's `name' argument.
Include <sys/systm.h>
 1.1.2.2.2.1 06-May-1997  mrg add <sys/syscallargs.h> as required, and <sys/mount.h> as previous requires.
 1.5.4.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.9.26.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.9.24.3 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.9.24.2 14-Nov-2001  nathanw Catch up to -current.
 1.9.24.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.12.2.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.13.2.3 21-Jan-2008  yamt sync with head
 1.13.2.2 03-Sep-2007  yamt sync with head.
 1.13.2.1 26-Feb-2007  yamt sync with head.
 1.14.20.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.15.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.16.28.1 02-Jan-2008  bouyer Sync with HEAD
 1.16.24.1 26-Dec-2007  ad Sync with head.
 1.16.16.1 09-Jan-2008  matt sync with HEAD
 1.17.12.3 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.17.12.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.17.12.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.17.10.1 04-May-2009  yamt sync with head.
 1.17.8.1 04-Jun-2008  yamt sync with head
 1.17.6.2 29-Jun-2008  mjf Sync with HEAD.
 1.17.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.18.2.1 18-Jun-2008  simonb Sync with head.
 1.19.24.1 06-Jun-2011  jruoho Sync with HEAD.
 1.19.18.1 05-Mar-2011  rmind sync with head
 1.20.58.1 10-Jun-2019  christos Sync with HEAD
 1.20.56.2 22-Sep-2018  pgoyette #include "opt_compat_netbsd.h" for all sources that provide compat code.
 1.20.56.1 31-Mar-2018  pgoyette create the compat_12 module
 1.21 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.20 29-Apr-2017  christos branches: 1.20.8; 1.20.10;
remove extra S
 1.19 29-Apr-2017  christos move MAP_COPY in compat
 1.18 08-Feb-2011  rmind branches: 1.18.14; 1.18.32; 1.18.46;
Remove clause 3 (UCB advertising clause) from the University of Utah
copyright. Confirmed by Mike Hibler, mike at cs.utah.edu - thanks!
Also, merge UCB and Utah copyright texts back into one, as they
originally were.

Extra verification by snj@.
 1.17 19-Jan-2011  tsutsui branches: 1.17.2;
Remove includes <sys/mount.h> and <sys/sched.h> added for <sys/syscallargs.h>.
Now they are handled by $sysarghdrextra in sys/kern/syscalls.conf.
 1.16 20-Dec-2007  dsl branches: 1.16.12; 1.16.32; 1.16.38;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.15 04-Mar-2007  christos branches: 1.15.16; 1.15.24; 1.15.28;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.14 09-Feb-2007  ad branches: 1.14.2;
Merge newlock2 to head.
 1.13 16-Nov-2006  christos __unused removal on arguments; approved by core.
 1.12 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.11 11-Dec-2005  christos branches: 1.11.20; 1.11.22;
merge ktrace-lwp.
 1.10 27-Oct-2004  david branches: 1.10.12;
Bounds check syscall arguments where appropriate
 1.9 07-Aug-2003  agc branches: 1.9.2;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.8 18-Jan-2003  thorpej branches: 1.8.2;
Merge the nathanw_sa branch.
 1.7 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.6 28-Jun-2000  mrg branches: 1.6.2; 1.6.4;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.5 25-Jun-2000  mrg remove some redundant <vm/vm_xxx.h> includes
 1.4 30-Mar-2000  augustss Kill register declarations.
 1.3 29-Mar-2000  simonb Don't need to include <sys/conf.h> here.
 1.2 01-Apr-1999  drochner branches: 1.2.8;
remove unneeded <vm/*> includes
 1.1 05-Feb-1996  christos Extracted vm compat functions from vm and added them here where they belong.
 1.2.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.6.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.6.2.4 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.6.2.3 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.6.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.6.2.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.8.2.4 02-Nov-2004  skrll Sync with HEAD.
 1.8.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.8.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.8.2.1 03-Aug-2004  skrll Sync with HEAD
 1.9.2.1 12-Nov-2004  jmc Pullup rev 1.10 (requested by david in ticket #946)

Bounds check syscall arguments where appropriate.
 1.10.12.4 21-Jan-2008  yamt sync with head
 1.10.12.3 03-Sep-2007  yamt sync with head.
 1.10.12.2 26-Feb-2007  yamt sync with head.
 1.10.12.1 30-Dec-2006  yamt sync with head.
 1.11.22.2 10-Dec-2006  yamt sync with head.
 1.11.22.1 22-Oct-2006  yamt sync with head
 1.11.20.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.11.20.1 18-Nov-2006  ad Sync with head.
 1.14.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.15.28.1 02-Jan-2008  bouyer Sync with HEAD
 1.15.24.1 26-Dec-2007  ad Sync with head.
 1.15.16.1 09-Jan-2008  matt sync with HEAD
 1.16.38.1 06-Jun-2011  jruoho Sync with HEAD.
 1.16.32.1 05-Mar-2011  rmind sync with head
 1.16.12.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.16.12.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.17.2.1 17-Feb-2011  bouyer Sync with HEAD
 1.18.46.1 02-May-2017  pgoyette Sync with HEAD - tag prg-localcount2-base1
 1.18.32.1 28-Aug-2017  skrll Sync with HEAD
 1.18.14.1 03-Dec-2017  jdolecek update from HEAD
 1.20.10.1 10-Jun-2019  christos Sync with HEAD
 1.20.8.2 22-Sep-2018  pgoyette #include "opt_compat_netbsd.h" for all sources that provide compat code.
 1.20.8.1 17-Apr-2018  pgoyette First pass at compat modules for 4.3BSD, NetBSD-0.9, and NetBSD-1.0

XXX Still need to deal with the sysctl stuff and other code shared
XXX between 09 and 43
 1.7 16-Oct-1997  christos Rename to vm_12.c
 1.6 10-Oct-1997  mrg remove advertising clause from all my licenses.
 1.5 13-Jun-1997  thorpej branches: 1.5.4;
Don't #ifdef compat_12_sys_swapon() so that it can be used by other compat
modules.
 1.4 12-Jun-1997  mrg put the front end into libc.
 1.3 12-Jun-1997  mrg make this sys_swapon() for now.
 1.2 12-Jun-1997  mrg bring mrg-vm-swap2 onto mainline.
 1.1 14-Feb-1997  mrg branches: 1.1.2;
file vm_swap_12.c was initially added on branch mrg-vm-swap.
 1.1.2.2 14-Feb-1997  mrg branches: 1.1.2.2.2;
make this more likely to work; follow naming conventions
 1.1.2.1 14-Feb-1997  mrg emulate old swapon().
 1.1.2.2.2.3 01-Jun-1997  mrg it is called sys_swapctl() now.
 1.1.2.2.2.2 06-May-1997  pk Cast away `const' from old swapon's `name' argument.
Include <sys/systm.h>
 1.1.2.2.2.1 06-May-1997  mrg add <sys/syscallargs.h> as required, and <sys/mount.h> as previous requires.
 1.5.4.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.4 12-Dec-2019  pgoyette Rather than keeping a separate mutex, condvar, and pserialize for each
module hook, we can share a common set of synchronization structures.
This cuts the amount of cacheline_aligned data for these structures by
50%.

Note that we still have a per-hook localcount, since we need to count
individual references.

As discussed with riastradh@

Welcome to 9.99.22 !
 1.3 01-Mar-2019  pgoyette branches: 1.3.4;
Rename the MODULE_*_HOOK() macros to MODULE_HOOK_*() as briefly
discussed on irc.

NFCI intended.

Ride the earlier kernel bump - it;s getting crowded.
 1.2 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.1 28-Mar-2018  pgoyette branches: 1.1.2;
file vnd_30.c was initially added on branch pgoyette-compat.
 1.1.2.5 23-Jan-2019  pgoyette Convert the macros for setting and unsetting a hook to generate
in-line code rather than using an intermediary hook##set routine.
Hooks are set and unset only in one place, so the intermediary
routine provides no benefit. IMHO using the macro at the point-
of-call is more readable than using it elsewhere in the code and
then calling the generated intermediary routine (for which you
won't even find its declaration or definition unless you remember
to search for the HOOK_SET macro instead).

NFC intended, will verify with a bulk build and an atf test run.
 1.1.2.4 22-Sep-2018  pgoyette #include "opt_compat_netbsd.h" for all sources that provide compat code.
 1.1.2.3 18-Sep-2018  pgoyette The COMPAT_HOOK macros were renamed to MODULE_HOOK, adjust all callers
 1.1.2.2 17-Sep-2018  pgoyette Adapt (most of) the indirect function pointers to the new MP-safe
mechanism. Still remaining are the compat_netbsd32 stuff, and
some usb subroutines.
 1.1.2.1 28-Mar-2018  pgoyette Split vnd compat_30 code out of the main driver and into the compat_30
module
 1.3.4.3 08-Apr-2020  martin Merge changes from current as of 20200406
 1.3.4.2 10-Jun-2019  christos Sync with HEAD
 1.3.4.1 01-Mar-2019  christos file vnd_30.c was added on branch phil-wifi on 2019-06-10 22:06:58 +0000
 1.5 12-Dec-2019  pgoyette Rather than keeping a separate mutex, condvar, and pserialize for each
module hook, we can share a common set of synchronization structures.
This cuts the amount of cacheline_aligned data for these structures by
50%.

Note that we still have a per-hook localcount, since we need to count
individual references.

As discussed with riastradh@

Welcome to 9.99.22 !
 1.4 14-Apr-2019  pgoyette branches: 1.4.4;
Only need to #include sys/vnode.h once
 1.3 01-Mar-2019  pgoyette Rename the MODULE_*_HOOK() macros to MODULE_HOOK_*() as briefly
discussed on irc.

NFCI intended.

Ride the earlier kernel bump - it;s getting crowded.
 1.2 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.1 19-Sep-2018  pgoyette branches: 1.1.2;
file vnd_50.c was initially added on branch pgoyette-compat.
 1.1.2.3 23-Jan-2019  pgoyette Convert the macros for setting and unsetting a hook to generate
in-line code rather than using an intermediary hook##set routine.
Hooks are set and unset only in one place, so the intermediary
routine provides no benefit. IMHO using the macro at the point-
of-call is more readable than using it elsewhere in the code and
then calling the generated intermediary routine (for which you
won't even find its declaration or definition unless you remember
to search for the HOOK_SET macro instead).

NFC intended, will verify with a bulk build and an atf test run.
 1.1.2.2 22-Sep-2018  pgoyette #include "opt_compat_netbsd.h" for all sources that provide compat code.
 1.1.2.1 19-Sep-2018  pgoyette Split out the vnd COMPAT_50 code
 1.4.4.3 08-Apr-2020  martin Merge changes from current as of 20200406
 1.4.4.2 10-Jun-2019  christos Sync with HEAD
 1.4.4.1 14-Apr-2019  christos file vnd_50.c was added on branch phil-wifi on 2019-06-10 22:06:58 +0000
 1.8 14-Jan-2014  christos use new bsd.syscall.mk
 1.7 11-Dec-2005  christos branches: 1.7.110; 1.7.120; 1.7.126;
merge ktrace-lwp.
 1.6 26-Feb-2005  perry make this rebuild generated files by default
 1.5 15-Nov-2003  thorpej branches: 1.5.8; 1.5.10;
We have CVS; there is no reason to make .bak files when generating the
syscall tables.
 1.4 26-Oct-2003  lukem Use ${HOST_SH} instead of `sh'.

If necessary, pull in <bsd.sys.mk> to get the definition of HOST_SH;
Makefiles that pull in one of (most of) <bsd.*.mk> will get this anyway.
 1.3 10-Dec-1996  mycroft branches: 1.3.62;
Fix pasto.
 1.2 03-Sep-1996  mycroft Give every emulation its own Makefile for the syscall table.
 1.1 10-Oct-1995  mycroft branches: 1.1.6;
FreeBSD binary compatibility module, from Noriyuki Soda.
 1.1.6.2 10-Dec-1996  mycroft Fix pasto.
 1.1.6.1 10-Dec-1996  mycroft From trunk:
Give all the emulations a consistent Makefile.
 1.3.62.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.3.62.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.62.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.62.1 03-Aug-2004  skrll Sync with HEAD
 1.5.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.5.8.1 29-Apr-2005  kent sync with -current
 1.7.126.1 18-May-2014  rmind sync with head
 1.7.120.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.7.110.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.16 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.15 01-Aug-2017  maxv branches: 1.15.2; 1.15.4;
Move arch/i386/i386/freebsd_* into compat/freebsd/. COMPAT_FREEBSD is
i386-specific.
 1.14 29-Jul-2017  maxv Remove exec_aout support in compat_freebsd. The only reason we still have
compat_freebsd is because of tw_cli, and it is an elf32 binary (could test,
manuel sent it to me).
 1.13 17-Nov-2014  uebayasi branches: 1.13.2;
Define compat modules (but without dependencies yet).
 1.12 19-Nov-2008  ad branches: 1.12.26;
Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.11 30-Aug-2006  matt branches: 1.11.52; 1.11.56; 1.11.62; 1.11.66;
Update for options PTRACE
 1.10 11-Dec-2005  christos branches: 1.10.4; 1.10.8;
merge ktrace-lwp.
 1.9 22-Feb-2005  heas branches: 1.9.4;
Add FreeBSD sysctl emulation for their undocumented special OIDs rooted at
OID 0. Only OID 0.3 is implemented for now, it 0.3 is the equivalent of
NetBSD's sysctlgetmibinfo().
This includes a new sysctl kern.osreldate with the value __NetBSD_Version__
for kernels with COMPAT_FREEBSD.

Both of these are used by 3ware's FreeBSD tw_cli, which seems to work now.
 1.8 22-Dec-2002  gmcgarry branches: 1.8.2; 1.8.10; 1.8.12;
Add stubs for scheduler syscalls.
 1.7 08-Dec-2002  manu Now it uses BSD system calls with alternate path checks in compat/common,
Darwin does not need freebsd_file.c anymore.
 1.6 15-Nov-2002  christos it is not kosher to include the same file twice.
 1.5 09-Oct-2002  pooka FreeBSD rfork emulation
 1.4 01-Dec-2000  jdolecek branches: 1.4.2;
split aout and elf32 specific code to separate files
emul_freebsd: add emul flags
EMUL_HAS_SYS___syscall|EMUL_GETPID_PASS_PPID|EMUL_GETID_PASS_EID
 1.3 22-Jan-1998  mycroft branches: 1.3.14;
Put a local copy of the SysV IPC compatibility from compat/common in here, so
it's not dependent on COMPAT_10. Also, fix translation of shmctl(), since
FreeBSD's is a little different.
 1.2 20-Jul-1997  pk branches: 1.2.6;
config.new => config
 1.1 10-Oct-1995  mycroft FreeBSD binary compatibility module, from Noriyuki Soda.
 1.2.6.1 29-Jan-1998  mellon Pull up 1.3 (mycroft)
 1.3.14.1 08-Dec-2000  bouyer Sync with HEAD.
 1.4.2.2 29-Dec-2002  thorpej Sync with HEAD.
 1.4.2.1 18-Oct-2002  nathanw Catch up to -current.
 1.8.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.8.10.1 29-Apr-2005  kent sync with -current
 1.8.2.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.9.4.1 30-Dec-2006  yamt sync with head.
 1.10.8.1 03-Sep-2006  yamt sync with head.
 1.10.4.1 09-Sep-2006  rpaulo sync with head
 1.11.66.1 19-Jan-2009  skrll Sync with HEAD.
 1.11.62.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.11.56.1 04-May-2009  yamt sync with head.
 1.11.52.1 17-Jan-2009  mjf Sync with HEAD.
 1.12.26.1 03-Dec-2017  jdolecek update from HEAD
 1.13.2.1 28-Aug-2017  skrll Sync with HEAD
 1.15.4.1 10-Jun-2019  christos Sync with HEAD
 1.15.2.1 12-Mar-2018  pgoyette Update dependencies for modules when they are built-in. Now we don't
(or at least, shouldn't) need reminders in the GENERIC config files
about which module options require other options.

Update branch status doc accordingly.
 1.42 10-Aug-2018  pgoyette Allow syscall_establish() to install new syscalls when the existing
entry-point is either sys_nomodule or sys_nosys. Update the
makesyscalls.sh script to create a const array of bits to allow
syscall_disestablish() to properly restore the original entry-point.
Update all the initializers of struct emul to initialize the pointer
to the bit array struct emul.

XXX Regen of all files created by makesyscalls.sh will come soon,
XXX followed by a kernel version bump (since struct emul is being
XXX modified).

This commit should address PR kern/45781 and also removes the need
for the work-around for that PR in file

sys/arch/usermode/modules/syscallemu/syscallemu.c
 1.41 06-May-2018  kamil branches: 1.41.2;
Remove an element from struct emul: e_tracesig

e_tracesig used to be implemented for Darwin compat. Nowadays the Darwin
compatiblity layer is gone and there are no other users.

This functionality isn't used where it shall be used in the existing
codebase.

If we want to emulate debugging interfaces in compat layers we would need
to implement that from scratch anyway. We would need to be bug compatible
with other OSes too.

Proposed on tech-kern@.

Welcome to NetBSD 8.99.16!

Sponsored by <The NetBSD Foundation>
 1.40 09-Jan-2018  maya branches: 1.40.2;
remove struct emul's e_fault.

It used to be used by COMPAT_IRIX for the purpose of overriding
uvm_fault (only implemented in MIPS), now removed.

Ride 8.99.12 version bump.
 1.39 08-Aug-2017  maxv Move freebsd_machdep.h into sys/compat/freebsd, and don't install it. Now,
the compat_freebsd files are all contained in sys/compat/freebsd.
 1.38 19-Feb-2012  rmind branches: 1.38.2; 1.38.16;
Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.
 1.37 07-Jul-2010  chs branches: 1.37.8; 1.37.12;
many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
- support new-style (NPTL) linux pthreads on all platforms.
clone() with CLONE_THREAD uses 1 process with many LWPs
instead of separate processes.
- move the contents of sys__lwp_setprivate() into a new
lwp_setprivate() and use that everywhere.
- update linux_release[] and linux32_release[] to "2.6.18".
- adjust placement of emul fork/exec/exit hooks as needed
and adjust other emul code to match.
- convert all struct emul definitions to use named initializers.
- change the pid allocator to allow multiple pids to refer to the same proc.
- remove a few fields from struct proc that are no longer needed.
- disable the non-functional "vdso" code in linux32/amd64,
glibc works fine without it.
- fix a race in the futex code where we could miss a wakeup after
a requeue operation.
- redo futex locking to be a little more efficient.
 1.36 19-Nov-2008  ad branches: 1.36.6; 1.36.8;
Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.35 15-Oct-2008  wrstuden branches: 1.35.2;
Merge wrstuden-revivesa into HEAD.
 1.34 19-Feb-2007  cube branches: 1.34.38; 1.34.42; 1.34.44; 1.34.48;
Introduce a new member to struct emul, e_startlwp, to be used by
sys__lwp_create. It allows using the said syscall under COMPAT_NETBSD32.

The libpthread regression tests now pass on amd64 and sparc64.
 1.33 09-Feb-2007  ad branches: 1.33.2;
Merge newlock2 to head.
 1.32 30-Aug-2006  christos branches: 1.32.2;
fix incomplete initializer
 1.31 11-Dec-2005  christos branches: 1.31.4; 1.31.8;
merge ktrace-lwp.
 1.30 13-Sep-2005  christos compat code reorg.
 1.29 10-Jul-2005  christos define syscall again.
 1.28 10-Jul-2005  christos No point in declaring syscall_intern and syscall in a zillion places.
 1.27 26-Mar-2005  fvdl branches: 1.27.2;
Fix some things regarding COMPAT_NETBSD32 and limits/VM addresses.

* For sparc64 and amd64, define *SIZ32 VM constants.
* Add a new function pointer to struct emul, pointing at a function
that will return the default VM map address. The default function
is uvm_map_defaultaddr, which just uses the VM_DEFAULT_ADDRESS
macro. This gives emulations control over the default map address,
and allows things to be mapped at the right address (in 32bit range)
for COMPAT_NETBSD32.
* Add code to adjust the data and stack limits when a COMPAT_NETBSD32
or COMPAT_SVR4_32 binary is executed.
* Don't use USRSTACK in kern_resource.c, use p_vmspace->vm_minsaddr
instead (emulations might have set it differently)
* Since this changes struct emul, bump kernel version to 3.99.2

Tested on amd64, compile-tested on sparc64.
 1.26 12-Sep-2004  jdolecek branches: 1.26.4; 1.26.6; 1.26.10;
only include emulation syscallnames with SYSCALL_DEBUG, it's not used otherwise
 1.25 20-Dec-2003  fvdl Put back Emmanuel's sigfilter hooks, as decided by Core.
 1.24 20-Dec-2003  manu Introduce lwp_emuldata and the associated hooks. No hook is provided for the
exec case, as the emulation already has the ability to intercept that
with the e_proc_exec hook. It is the responsability of the emulation to
take appropriaye action about lwp_emuldata in e_proc_exec.

Patch reviewed by Christos.
 1.23 05-Dec-2003  jdolecek back the sigfilter emulation hook change off
 1.22 03-Dec-2003  manu Add a sigfilter emulation hook. It is used at the beginning of kpsignal2()
so that a specific emulation has the oportunity to filter out some signals.

if sigfilter returns 0, then no signal is sent by kpsignal2().

There is another place where signals can be generated: trapsignal. Since this
function is already an emulation hook, no call to the sigfilter hook was
introduced in trapsignal.

This is needed to emulate the softsignal feature in COMPAT_DARWIN (signals
sent as Mach exception messages)
 1.21 06-Sep-2003  christos SA_SIGINFO changes
 1.20 24-Aug-2003  chs add support for non-executable mappings (where the hardware allows this)
and make the stack and heap non-executable by default. the changes
fall into two basic catagories:

- pmap and trap-handler changes. these are all MD:
= alpha: we already track per-page execute permission with the (software)
PG_EXEC bit, so just have the trap handler pay attention to it.
= i386: use a new GDT segment for %cs for processes that have no
executable mappings above a certain threshold (currently the
bottom of the stack). track per-page execute permission with
the last unused PTE bit.
= powerpc/ibm4xx: just use the hardware exec bit.
= powerpc/oea: we already track per-page exec bits, but the hardware only
implements non-exec mappings at the segment level. so track the
number of executable mappings in each segment and turn on the no-exec
segment bit iff the count is 0. adjust the trap handler to deal.
= sparc (sun4m): fix our use of the hardware protection bits.
fix the trap handler to recognize text faults.
= sparc64: split the existing unified TSB into data and instruction TSBs,
and only load TTEs into the appropriate TSB(s) for the permissions.
fix the trap handler to check for execute permission.
= not yet implemented: amd64, hppa, sh5

- changes in all the emulations that put a signal trampoline on the stack.
instead, we now put the trampoline into a uvm_aobj and map that into
the process separately.

originally from openbsd, adapted for netbsd by me.
 1.19 01-Nov-2002  jdolecek branches: 1.19.6;
set struct emul's nsysent to compat SYS_NSYSENT, not SYS_MAXSYSCALL
 1.18 21-Sep-2002  manu - Introduce a e_fault field in struct proc to provide emulation specific
memory fault handler. IRIX uses irix_vm_fault, and all other emulation
use NULL, which means to use uvm_fault.

- While we are there, explicitely set to NULL the uninitialized fields in
struct emul: e_fault and e_sysctl on most ports

- e_fault is used by the trap handler, for now only on mips. In order to avoid
intrusive modifications in UVM, the function pointed by e_fault does not
has exactly the same protoype as uvm_fault:
int uvm_fault __P((struct vm_map *, vaddr_t, vm_fault_t, vm_prot_t));
int e_fault __P((struct proc *, vaddr_t, vm_fault_t, vm_prot_t));

- In IRIX share groups, all the VM space is shared, except one page.
This bounds us to have different VM spaces and synchronize modifications
to the VM space accross share group members. We need an IRIX specific hook
to the page fault handler in order to propagate VM space modifications
caused by page faults.
 1.17 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.16 18-Sep-2001  jdolecek Make the setregs hook emulation-specific, rather than executable
format specific.
Struct emul has a e_setregs hook back, which points to emulation-specific
setregs function. es_setregs of struct execsw now only points to
optional executable-specific setup function (this is only used for
ECOFF).
 1.15 18-Jun-2001  christos branches: 1.15.2; 1.15.4;
Add an e_trapsignal member to struct emul, so that emulated processes can
send the appropriate signal depending on the trap type.
 1.14 18-Dec-2000  jdolecek branches: 1.14.2;
separate the freebsd syscall code similarily to other emulations
 1.13 11-Dec-2000  mycroft Introduce 2 new flags in types.h:
* __HAVE_SYSCALL_INTERN. If this is defined, e_syscall is replaced by
e_syscall_intern, which is called at key places in the kernel. This can be
used to set a MD syscall handler pointer. This obsoletes and replaces the
*_HAS_SEPARATED_SYSCALL flags.
* __HAVE_MINIMAL_EMUL. If this is defined, certain (deprecated) elements in
struct emul are omitted.
 1.12 09-Dec-2000  jdolecek always fill in e_syscall in respective emul_*; if the emulation doesn't
have it's own separated *_syscall() function, use syscall()
 1.11 09-Dec-2000  mycroft Get rid of the damn EMUL_GET* flags.
 1.10 01-Dec-2000  jdolecek split aout and elf32 specific code to separate files
emul_freebsd: add emul flags
EMUL_HAS_SYS___syscall|EMUL_GETPID_PASS_PPID|EMUL_GETID_PASS_EID
 1.9 01-Dec-2000  jdolecek add e_path (emulation path) to struct emul, which replaces emulation-specific
*_emul_path variables

change macros CHECK_ALT_{CREAT|EXIST} to use that, 'root' doesn't need
to be passed explicitly any more and *_CHECK_ALT_{CREAT|EXIST} are removed
change explicit emul_find() calls in probe functions to get the emulation
path from the checked exec switch entry's emulation

remove no longer needed header files

add e_flags and e_syscall to struct emul; these are unsed and empty for now
 1.8 21-Nov-2000  jdolecek restructure struct emul and execsw, in preparation to make emulations LKMable:
* move all exec-type specific information from struct emul to execsw[] and
provide single struct emul per emulation
* elf:
- kern/exec_elf32.c:probe_funcs[] is gone, execsw[] how has one entry
per emulation and contains pointer to respective probe function
- interp is allocated via MALLOC() rather than on stack
- elf_args structure is allocated via MALLOC() rather than malloc()
* ecoff: the per-emulation hooks moved from alpha and mips specific code
to OSF1 and Ultrix compat code as appropriate, execsw[] has one entry per
emulation supporting ecoff with appropriate probe function
* the makecmds/probe functions don't set emulation, pointer to emulation is
part of appropriate execsw[] entry
* constify couple of structures
 1.7 13-Nov-2000  jdolecek change the type of *syscallnames[] array to 'const char * const foo[]'
 1.6 28-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.5 25-Oct-1999  kleink branches: 1.5.6;
Update to match new SVR4-style definition names in <sys/exec_elf.h>.
 1.4 09-Feb-1999  christos branches: 1.4.8; 1.4.10; 1.4.12;
PR/6962: Paul Shupak: ELF Freebsd support
 1.3 24-Jan-1998  mycroft Use freebsd_setregs().
 1.2 18-May-1996  christos branches: 1.2.16;
- rename cpu_exec_aout_prep_oldzmagic to exec_aout_prep_oldzmagic
 1.1 10-Oct-1995  mycroft FreeBSD binary compatibility module, from Noriyuki Soda.
 1.2.16.1 29-Jan-1998  mellon Pull up 1.3 (mycroft)
 1.4.12.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.4.10.1 15-Nov-1999  fvdl Sync with -current
 1.4.8.5 05-Jan-2001  bouyer Sync with HEAD
 1.4.8.4 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.4.8.3 08-Dec-2000  bouyer Sync with HEAD.
 1.4.8.2 22-Nov-2000  bouyer Sync with HEAD.
 1.4.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.5.6.1 07-Mar-2002  he Apply patch (requested by jonathan):
Recognize FreeBSD ELFOSABI marked executables.
Patch is revisions 1.3-1.5 of freebsd_exec_elf32.c (new after branch)
 1.14.2.5 11-Nov-2002  nathanw Catch up to -current
 1.14.2.4 18-Oct-2002  nathanw Catch up to -current.
 1.14.2.3 14-Nov-2001  nathanw Catch up to -current.
 1.14.2.2 21-Sep-2001  nathanw Catch up to -current.
 1.14.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.15.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.15.2.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.15.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.19.6.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.19.6.4 01-Apr-2005  skrll Sync with HEAD.
 1.19.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.19.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.19.6.1 03-Aug-2004  skrll Sync with HEAD
 1.26.10.1 18-Sep-2005  tron Pull up following revision(s) (requested by fvdl in ticket #798):
sys/compat/sunos/sunos_exec.c: revision 1.47
sys/compat/pecoff/pecoff_emul.c: revision 1.11
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.45
sys/arch/amd64/amd64/netbsd32_machdep.c: revision 1.12
sys/sys/proc.h: revision 1.198
sys/compat/mach/mach_exec.c: revision 1.56
sys/compat/freebsd/freebsd_exec.c: revision 1.27
sys/arch/sparc64/include/vmparam.h: revision 1.27
sys/kern/kern_resource.c: revision 1.91
sys/compat/netbsd32/netbsd32_netbsd.c: revision 1.88
sys/compat/osf1/osf1_exec.c: revision 1.39
sys/compat/svr4_32/svr4_32_resource.c: revision 1.5
sys/compat/ultrix/ultrix_misc.c: revision 1.99
sys/compat/svr4_32/svr4_32_exec.h: revision 1.9
sys/kern/exec_elf32.c: revision 1.103
sys/compat/aoutm68k/aoutm68k_exec.c: revision 1.19
sys/compat/sunos32/sunos32_exec.c: revision 1.20
sys/compat/hpux/hpux_exec.c: revision 1.46
sys/compat/darwin/darwin_exec.c: revision 1.40
sys/kern/sysv_shm.c: revision 1.83
sys/uvm/uvm_extern.h: revision 1.99
sys/uvm/uvm_mmap.c: revision 1.89
sys/kern/kern_exec.c: revision 1.195
sys/compat/netbsd32/netbsd32.h: revision 1.31
sys/arch/sparc64/sparc64/svr4_32_machdep.c: revision 1.20
sys/compat/svr4/svr4_exec.c: revision 1.56
sys/compat/irix/irix_exec.c: revision 1.41
sys/compat/ibcs2/ibcs2_exec.c: revision 1.63
sys/compat/svr4_32/svr4_32_exec.c: revision 1.16
sys/arch/amd64/include/vmparam.h: revision 1.8
sys/compat/linux/common/linux_exec.c: revision 1.73
Fix some things regarding COMPAT_NETBSD32 and limits/VM addresses.
* For sparc64 and amd64, define *SIZ32 VM constants.
* Add a new function pointer to struct emul, pointing at a function
that will return the default VM map address. The default function
is uvm_map_defaultaddr, which just uses the VM_DEFAULT_ADDRESS
macro. This gives emulations control over the default map address,
and allows things to be mapped at the right address (in 32bit range)
for COMPAT_NETBSD32.
* Add code to adjust the data and stack limits when a COMPAT_NETBSD32
or COMPAT_SVR4_32 binary is executed.
* Don't use USRSTACK in kern_resource.c, use p_vmspace->vm_minsaddr
instead (emulations might have set it differently)
* Since this changes struct emul, bump kernel version to 3.99.2
Tested on amd64, compile-tested on sparc64.
 1.26.6.1 26-Mar-2005  yamt sync with head.
 1.26.4.1 29-Apr-2005  kent sync with -current
 1.27.2.3 26-Feb-2007  yamt sync with head.
 1.27.2.2 30-Dec-2006  yamt sync with head.
 1.27.2.1 21-Jun-2006  yamt sync with head.
 1.31.8.1 03-Sep-2006  yamt sync with head.
 1.31.4.1 09-Sep-2006  rpaulo sync with head
 1.32.2.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.33.2.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.34.48.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.34.48.1 19-Oct-2008  haad Sync with HEAD.
 1.34.44.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.34.42.2 11-Aug-2010  yamt sync with head.
 1.34.42.1 04-May-2009  yamt sync with head.
 1.34.38.1 17-Jan-2009  mjf Sync with HEAD.
 1.35.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.36.8.1 05-Mar-2011  rmind sync with head
 1.36.6.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.37.12.1 24-Feb-2012  mrg sync to -current.
 1.37.8.1 17-Apr-2012  yamt sync with head
 1.38.16.1 28-Aug-2017  skrll Sync with HEAD
 1.38.2.1 03-Dec-2017  jdolecek update from HEAD
 1.40.2.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.40.2.1 21-May-2018  pgoyette Sync with HEAD
 1.41.2.1 10-Jun-2019  christos Sync with HEAD
 1.18 29-Jul-2017  maxv Remove exec_aout support in compat_freebsd. The only reason we still have
compat_freebsd is because of tw_cli, and it is an elf32 binary (could test,
manuel sent it to me).
 1.17 10-Dec-2009  matt branches: 1.17.22; 1.17.40;
Change u_long to vaddr_t/vsize_t in exec code where appropriate (mostly
involves setregs and vmcmds). Should result in no code differences.
 1.16 19-Nov-2008  ad Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.15 04-Dec-2007  dsl branches: 1.15.12; 1.15.16; 1.15.22; 1.15.24;
Remove all the __P
 1.14 11-Dec-2005  christos branches: 1.14.44; 1.14.46; 1.14.52; 1.14.56;
merge ktrace-lwp.
 1.13 26-Feb-2005  perry branches: 1.13.4;
nuke trailing whitespace
 1.12 07-Aug-2003  agc branches: 1.12.8; 1.12.10;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.11 29-Jun-2003  fvdl branches: 1.11.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.10 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.9 19-Feb-2003  jdolecek remove local idea of ELF_AUX_ARGSIZ - since this emul uses elf32_copyargs(),
it shouldn't override the size
 1.8 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.7 10-Dec-2002  thorpej Rename __LDPGSZ to AOUT_LDPGSZ, to accurately reflect what it is.
 1.6 21-Nov-2000  jdolecek branches: 1.6.2;
restructure struct emul and execsw, in preparation to make emulations LKMable:
* move all exec-type specific information from struct emul to execsw[] and
provide single struct emul per emulation
* elf:
- kern/exec_elf32.c:probe_funcs[] is gone, execsw[] how has one entry
per emulation and contains pointer to respective probe function
- interp is allocated via MALLOC() rather than on stack
- elf_args structure is allocated via MALLOC() rather than malloc()
* ecoff: the per-emulation hooks moved from alpha and mips specific code
to OSF1 and Ultrix compat code as appropriate, execsw[] has one entry per
emulation supporting ecoff with appropriate probe function
* the makecmds/probe functions don't set emulation, pointer to emulation is
part of appropriate execsw[] entry
* constify couple of structures
 1.5 30-Apr-1999  cgd branches: 1.5.2;
compute the value to be used for e_arglen via howmany(value, sizeof (char *)),
rather than just "value / sizeof (char *)". While in these cases the latter
works as well, the former's a better example for other uses to copy (since
it handles the non-integral multiple case correctly).
 1.4 09-Feb-1999  christos branches: 1.4.4;
PR/6962: Paul Shupak: ELF Freebsd support
 1.3 24-Jan-1998  mycroft Prototype new functions.
 1.2 05-Jan-1998  perry RCSID Police.
 1.1 10-Oct-1995  mycroft branches: 1.1.18;
FreeBSD binary compatibility module, from Noriyuki Soda.
 1.1.18.1 29-Jan-1998  mellon Pull up 1.3 (mycroft)
 1.4.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.5.2.1 22-Nov-2000  bouyer Sync with HEAD.
 1.6.2.2 11-Dec-2002  thorpej Sync with HEAD.
 1.6.2.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.11.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.11.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.11.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.11.2.2 03-Aug-2004  skrll Sync with HEAD
 1.11.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.12.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.12.8.1 29-Apr-2005  kent sync with -current
 1.13.4.2 07-Dec-2007  yamt sync with head
 1.13.4.1 21-Jun-2006  yamt sync with head.
 1.14.56.1 08-Dec-2007  ad Sync with head.
 1.14.52.1 08-Dec-2007  mjf Sync with HEAD.
 1.14.46.1 09-Jan-2008  matt sync with HEAD
 1.14.44.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.15.24.1 19-Jan-2009  skrll Sync with HEAD.
 1.15.22.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.15.16.2 11-Mar-2010  yamt sync with head
 1.15.16.1 04-May-2009  yamt sync with head.
 1.15.12.1 17-Jan-2009  mjf Sync with HEAD.
 1.17.40.1 28-Aug-2017  skrll Sync with HEAD
 1.17.22.1 03-Dec-2017  jdolecek update from HEAD
 1.10 29-Jul-2017  maxv Remove exec_aout support in compat_freebsd. The only reason we still have
compat_freebsd is because of tw_cli, and it is an elf32 binary (could test,
manuel sent it to me).
 1.9 16-Aug-2009  martin branches: 1.9.22; 1.9.40;
Include <sys/exec_aout.h> for a.out specific defines.
 1.8 08-Dec-2007  dsl branches: 1.8.16;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.7 11-Dec-2005  christos branches: 1.7.44; 1.7.46; 1.7.56;
merge ktrace-lwp.
 1.6 13-Feb-2004  wiz branches: 1.6.16;
Uppercase CPU, plural is CPUs.
 1.5 29-Jun-2003  fvdl branches: 1.5.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.4 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.3 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.2 01-Dec-2000  jdolecek branches: 1.2.2; 1.2.4; 1.2.6;
define EXEC_AOUT before including freebsd_exec.h, so that the a.out stuff
gets defined
 1.1 01-Dec-2000  jdolecek split aout and elf32 specific code to separate files
emul_freebsd: add emul flags
EMUL_HAS_SYS___syscall|EMUL_GETPID_PASS_PPID|EMUL_GETID_PASS_EID
 1.2.6.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.4.1 14-Nov-2001  nathanw Catch up to -current.
 1.2.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.2.2.1 01-Dec-2000  bouyer file freebsd_exec_aout.c was added on branch thorpej_scsipi on 2000-12-08 09:08:11 +0000
 1.5.2.5 04-Feb-2005  skrll Adapt to branch.
 1.5.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.5.2.2 03-Aug-2004  skrll Sync with HEAD
 1.5.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.6.16.2 21-Jan-2008  yamt sync with head
 1.6.16.1 21-Jun-2006  yamt sync with head.
 1.7.56.1 26-Dec-2007  ad Sync with head.
 1.7.46.1 09-Jan-2008  matt sync with HEAD
 1.7.44.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.8.16.1 19-Aug-2009  yamt sync with head.
 1.9.40.1 28-Aug-2017  skrll Sync with HEAD
 1.9.22.1 03-Dec-2017  jdolecek update from HEAD
 1.21 08-Aug-2017  maxv Move freebsd_machdep.h into sys/compat/freebsd, and don't install it. Now,
the compat_freebsd files are all contained in sys/compat/freebsd.
 1.20 09-Nov-2014  maxv branches: 1.20.2;
Do not uselessly include <sys/malloc.h>.
 1.19 24-Jun-2014  maxv branches: 1.19.2;
Remove unused headers.
 1.18 24-Jun-2014  maxv Remove dead code. The kernel already checks for PT_INTERP sections, and puts
their content into "itp". There's no need for re-reading the whole binary and
trying to find this section again. Just use "itp".

DEBUG_FREEBSD_ELF is now unused, so remove its references in amd64/conf/ALL
and i386/conf/ALL.
 1.17 22-Apr-2007  dsl branches: 1.17.78; 1.17.94;
Change the way that emulations locate files within the emulation root to
avoid having to allocate space in the 'stackgap'
- which is very LWP unfriendly.
The additional code for non-emulation namei() is trivial, the reduction for
the emulations is massive.
The vnode for a processes emulation root is saved in the cwdi structure
during process exec.
If the emulation root the TRYEMULROOT flag are set, namei() will do an initial
search for absolute pathnames in the emulation root, if that fails it will
retry from the normal root.
".." at the emulation root will always go to the real root, even in the middle
of paths and when expanding symlinks.
Absolute symlinks found using absolute paths in the emulation root will be
relative to the emulation root (so /usr/lib/xxx.so -> /lib/xxx.so links
inside the emulation root don't need changing).
If the root of the emulation would be returned (for an emulation lookup), then
the real root is returned instead (matching the behaviour of emul_lookup,
but being a cheap comparison here) so that programs that scan "../.."
looking for the root dircetory don't loop forever.
The target for symbolic links is no longer mangled (it used to get the
CHECK_ALT_xxx() treatment, so could get /emul/xxx prepended).
CHECK_ALT_xxx() are no more. Most of the change is deleting them, and adding
TRYEMULROOT to the flags to NDINIT().
A lot of the emulation system call stubs could now be deleted.
 1.16 16-Nov-2006  christos branches: 1.16.4; 1.16.8; 1.16.10;
__unused removal on arguments; approved by core.
 1.15 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.14 11-Dec-2005  christos branches: 1.14.20; 1.14.22;
merge ktrace-lwp.
 1.13 13-Sep-2005  christos compat code reorg.
 1.12 31-Oct-2003  drochner branches: 1.12.16;
adapt for changes to kern/exec_elf32.c
 1.11 29-Jun-2003  fvdl branches: 1.11.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.10 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.9 29-Nov-2002  jdolecek Get the dynamic interpreter location using emul_find_interp(), so that
it checks both the alternative/emul tree, and the non-emul tree.
This makes it possible to run chrooted emulated binaries without need
to setup shadow /emul tree within the chroot hierarchy.
Only tested for COMPAT_LINUX, changes to other compat modules were
mechanical.
Fixes kern/19161 by Christian Groessler.
 1.8 28-Nov-2002  jdolecek back previous off, it makes the probe function mistaken some linux
binaries as freebsd
problem reported in thread 'installing suse_base on current
i386 sets time to 1970' on current-users
 1.7 19-Nov-2002  christos Make the OSABI and the branding optional. Tested by Ben Collver, thanks.
 1.6 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.5 27-Oct-2001  jdolecek Add a comment regarding the ELFOSABI_FREEBSD thing,
and reformat the condition a bit to avoid nested if
 1.4 23-Oct-2001  christos branches: 1.4.2;
KNF.
 1.3 23-Oct-2001  christos PR/14332: Shingo WATANABE: Regognize new ELFOSABI_FREEBSD branded executables.
 1.2 14-Jul-2001  christos rename elf32_read_from to exec_read_from since it is used in many places
now.
 1.1 01-Dec-2000  jdolecek branches: 1.1.2; 1.1.4; 1.1.6;
split aout and elf32 specific code to separate files
emul_freebsd: add emul flags
EMUL_HAS_SYS___syscall|EMUL_GETPID_PASS_PPID|EMUL_GETID_PASS_EID
 1.1.6.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.6.1 03-Aug-2001  lukem update to -current
 1.1.4.3 11-Dec-2002  thorpej Sync with HEAD.
 1.1.4.2 14-Nov-2001  nathanw Catch up to -current.
 1.1.4.1 24-Aug-2001  nathanw Catch up with -current.
 1.1.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.1.2.1 01-Dec-2000  bouyer file freebsd_exec_elf32.c was added on branch thorpej_scsipi on 2000-12-08 09:08:11 +0000
 1.4.2.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.11.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.11.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.11.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.11.2.2 03-Aug-2004  skrll Sync with HEAD
 1.11.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.12.16.3 03-Sep-2007  yamt sync with head.
 1.12.16.2 30-Dec-2006  yamt sync with head.
 1.12.16.1 21-Jun-2006  yamt sync with head.
 1.14.22.2 10-Dec-2006  yamt sync with head.
 1.14.22.1 22-Oct-2006  yamt sync with head
 1.14.20.1 18-Nov-2006  ad Sync with head.
 1.16.10.1 11-Jul-2007  mjf Sync with head.
 1.16.8.1 27-May-2007  ad Sync with head.
 1.16.4.1 07-May-2007  yamt sync with head.
 1.17.94.1 10-Aug-2014  tls Rebase.
 1.17.78.2 03-Dec-2017  jdolecek update from HEAD
 1.17.78.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.19.2.1 17-Jan-2015  martin Pull up following revision(s) (requested by maxv in ticket #427):
sys/compat/svr4/svr4_schedctl.c: revision 1.8
sys/netinet/tcp_timer.c: revision 1.88
sys/miscfs/genfs/layer_vfsops.c: revision 1.45
sys/compat/svr4/svr4_ioctl.c: revision 1.37
sys/ufs/chfs/chfs_vfsops.c: revision 1.14
sys/miscfs/fdesc/fdesc_vfsops.c: revision 1.91
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.30
sys/compat/common/kern_time_50.c: revision 1.28
sys/netinet6/ip6_forward.c: revision 1.74
sys/miscfs/umapfs/umap_vnops.c: revision 1.57
sys/compat/svr4/svr4_fcntl.c: revision 1.74
distrib/sets/lists/comp/mi: revision 1.1931
sys/netinet6/udp6_output.c: revision 1.46
sys/fs/puffs/puffs_compat.c: revision 1.3
sys/fs/udf/udf_rename.c: revision 1.11
sys/compat/svr4/svr4_filio.c: revision 1.24
sys/fs/udf/udf_rename.c: revision 1.12
sys/netinet/tcp_usrreq.c: revision 1.202
sys/miscfs/umapfs/umap_subr.c: revision 1.29
sys/compat/linux/common/linux_fadvise64.c: revision 1.3
sys/netinet/if_atm.c: revision 1.34
sys/miscfs/procfs/procfs_subr.c: revision 1.106
sys/miscfs/genfs/layer_subr.c: revision 1.37
sys/netinet/tcp_sack.c: revision 1.30
sys/compat/freebsd/freebsd_misc.c: revision 1.33
sys/compat/freebsd/freebsd_file.c: revision 1.33
sys/ufs/chfs/chfs_vnode.c: revision 1.12
sys/compat/svr4/svr4_ttold.c: revision 1.34
sys/compat/linux/common/linux_file.c: revision 1.114
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.43
sys/compat/linux/common/linux_signal.c: revision 1.76
sys/compat/common/compat_util.c: revision 1.46
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.18
sys/compat/svr4/svr4_sockio.c: revision 1.36
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.32
sys/compat/svr4/svr4_signal.c: revision 1.66
sys/kern/kern_exec.c: revision 1.410
sys/fs/puffs/puffs_vfsops.c: revision 1.115
sys/compat/svr4/svr4_exec_elf64.c: revision 1.15
sys/compat/linux/arch/i386/linux_machdep.c: revision 1.159
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.50
sys/compat/linux32/common/linux32_misc.c: revision 1.24
sys/netinet/in_pcb.c: revision 1.153
sys/sys/malloc.h: revision 1.116
sys/compat/common/if_43.c: revision 1.9
share/man/man9/Makefile: revision 1.380
sys/netinet/tcp_vtw.c: revision 1.12
sys/miscfs/umapfs/umap_vfsops.c: revision 1.95
sys/ufs/ext2fs/ext2fs_vfsops.c: revision 1.186
sys/compat/common/uipc_syscalls_43.c: revision 1.46
sys/ufs/ext2fs/ext2fs_vnops.c: revision 1.115
sys/fs/puffs/puffs_msgif.c: revision 1.97
sys/compat/svr4/svr4_ipc.c: revision 1.27
sys/compat/linux/common/linux_exec.c: revision 1.117
sys/ufs/ext2fs/ext2fs_readwrite.c: revision 1.66
sys/netinet/tcp_output.c: revision 1.179
sys/compat/svr4/svr4_termios.c: revision 1.28
sys/fs/udf/udf_strat_bootstrap.c: revision 1.4
sys/fs/puffs/puffs_subr.c: revision 1.67
sys/fs/puffs/puffs_node.c: revision 1.36
sys/miscfs/overlay/overlay_vnops.c: revision 1.21
sys/fs/cd9660/cd9660_node.c: revision 1.34
sys/netinet/raw_ip.c: revision 1.146
sys/sys/mallocvar.h: revision 1.13
sys/miscfs/overlay/overlay_vfsops.c: revision 1.63
share/man/man9/malloc.9: revision 1.50
sys/netinet6/dest6.c: revision 1.18
sys/compat/linux/common/linux_uselib.c: revision 1.33
sys/compat/linux/common/linux_socket.c: revision 1.120
share/man/man9/malloc.9: revision 1.51
sys/netinet/tcp_subr.c: revision 1.257
sys/compat/linux/common/linux_socketcall.c: revision 1.45
sys/compat/linux/common/linux_fadvise64_64.c: revision 1.3
sys/compat/freebsd/freebsd_ipc.c: revision 1.17
sys/compat/linux/common/linux_misc_notalpha.c: revision 1.109
sys/compat/linux/arch/alpha/linux_pipe.c: revision 1.17
sys/netinet6/in6_pcb.c: revision 1.132
sys/netinet6/in6_ifattach.c: revision 1.94
sys/compat/svr4/svr4_exec_elf32.c: revision 1.15
sys/miscfs/nullfs/null_vfsops.c: revision 1.90
sys/fs/cd9660/cd9660_util.c: revision 1.12
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.48
sys/compat/freebsd/freebsd_exec_elf32.c: revision 1.20
sys/miscfs/procfs/procfs_vfsops.c: revision 1.94
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.28
sys/compat/linux/common/linux_sched.c: revision 1.67
sys/compat/linux/common/linux_exec_aout.c: revision 1.67
sys/compat/linux/common/linux_pipe.c: revision 1.67
sys/compat/linux/common/linux_llseek.c: revision 1.34
sys/compat/linux/arch/mips/linux_ptrace.c: revision 1.10
Do not uselessly include <sys/malloc.h>.
Cleanup:
- remove struct kmembuckets (dead)
- correctly deadify MALLOC_XX
- remove MALLOC_DEFINE_LIMIT and MALLOC_JUSTDEFINE_LIMIT (dead)
- remove malloc_roundup(), malloc_type_setlimit(), MALLOC_DEFINE_LIMIT()
and MALLOC_JUSTDEFINE_LIMIT() from man 9 malloc
New sentence, new line. Bump date for previous.
Obsolete malloc_roundup(9), malloc_type_setlimit(9) and MALLOC_DEFINE_LIMIT(9)
man pages.
 1.20.2.1 28-Aug-2017  skrll Sync with HEAD
 1.34 23-Oct-2015  maxv Change do_sys_mount() so that it only takes as argument the type of the
drive instead of its associated vfsops. Makes it more friendly, and allows
compat binaries to autoload VFS modules if needed.

sent on tech-kern@, ok christos@
 1.33 09-Nov-2014  maxv branches: 1.33.2;
Do not uselessly include <sys/malloc.h>.
 1.32 02-Mar-2010  pooka branches: 1.32.20; 1.32.36;
regen:
- remove nfssvc / fs_nfs.h / #ifdef NFS
- make getfh unconditional
 1.31 20-Dec-2007  dsl branches: 1.31.10; 1.31.12; 1.31.30;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.30 08-Dec-2007  dsl branches: 1.30.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.29 04-Dec-2007  dsl Remove all the __P
 1.28 17-Jul-2007  christos branches: 1.28.6; 1.28.8; 1.28.14; 1.28.16;
use the compat MFSNAMELEN
 1.27 13-Jul-2007  dsl Remove all the syscall stubs that were only there to get files lookup
up in the alternate path.
 1.26 12-Jul-2007  dsl Change compat mount code to pass do_sys_mount() kernel resident buffers.
Possibly the standard nfs code needs teaching how to set the length and
address family in order to support non-netbsd sockaddr.
There are now no active stackgap() calls in the compat tree.
 1.25 22-Apr-2007  dsl Change the way that emulations locate files within the emulation root to
avoid having to allocate space in the 'stackgap'
- which is very LWP unfriendly.
The additional code for non-emulation namei() is trivial, the reduction for
the emulations is massive.
The vnode for a processes emulation root is saved in the cwdi structure
during process exec.
If the emulation root the TRYEMULROOT flag are set, namei() will do an initial
search for absolute pathnames in the emulation root, if that fails it will
retry from the normal root.
".." at the emulation root will always go to the real root, even in the middle
of paths and when expanding symlinks.
Absolute symlinks found using absolute paths in the emulation root will be
relative to the emulation root (so /usr/lib/xxx.so -> /lib/xxx.so links
inside the emulation root don't need changing).
If the root of the emulation would be returned (for an emulation lookup), then
the real root is returned instead (matching the behaviour of emul_lookup,
but being a cheap comparison here) so that programs that scan "../.."
looking for the root dircetory don't loop forever.
The target for symbolic links is no longer mangled (it used to get the
CHECK_ALT_xxx() treatment, so could get /emul/xxx prepended).
CHECK_ALT_xxx() are no more. Most of the change is deleting them, and adding
TRYEMULROOT to the flags to NDINIT().
A lot of the emulation system call stubs could now be deleted.
 1.24 04-Mar-2007  christos branches: 1.24.2; 1.24.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.23 09-Feb-2007  ad branches: 1.23.2;
Merge newlock2 to head.
 1.22 13-Jul-2006  martin branches: 1.22.4;
Make freebsd_sys_getfh use compat_30_sys_getfh
 1.21 11-Dec-2005  christos branches: 1.21.4; 1.21.8; 1.21.16;
merge ktrace-lwp.
 1.20 21-Apr-2004  christos branches: 1.20.12;
Replace the statfs() family of system calls with statvfs().
Retain binary compatibility.
 1.19 29-Jun-2003  fvdl branches: 1.19.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.18 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.17 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.16 16-Mar-2002  christos make the stackgap_{init,alloc} functions MP friendly (i.e. pass struct proc *
in, instead of using curproc). While there add an optional size argument to
stackgap_init.
 1.15 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.14 30-May-2001  mrg branches: 1.14.2;
use _KERNEL_OPT.
 1.13 22-Jan-2001  jdolecek branches: 1.13.2;
Use CHECK_ALT_SYMLINK() instead CHECK_ALT_EXISTS() where appropriate.
This addresses kern/11757.
 1.12 18-Jan-2001  jdolecek constify
 1.11 01-Dec-2000  jdolecek LKMify
 1.10 01-Dec-2000  jdolecek add e_path (emulation path) to struct emul, which replaces emulation-specific
*_emul_path variables

change macros CHECK_ALT_{CREAT|EXIST} to use that, 'root' doesn't need
to be passed explicitly any more and *_CHECK_ALT_{CREAT|EXIST} are removed
change explicit emul_find() calls in probe functions to get the emulation
path from the checked exec switch entry's emulation

remove no longer needed header files

add e_flags and e_syscall to struct emul; these are unsed and empty for now
 1.9 19-Feb-1998  thorpej branches: 1.9.14;
Include the NFS option header.
 1.8 18-Oct-1997  christos Use stat12; from Enami Tsugutomo
 1.7 16-Oct-1997  christos ostat -> stat43
 1.6 10-Oct-1997  enami New function freebsd_sys_lchown() to emulate FreeBSD lchown(2).
 1.5 31-Jan-1997  thorpej branches: 1.5.8;
NFSCLIENT -> NFS
 1.4 03-Sep-1996  mycroft branches: 1.4.2;
Define execv() and execve() consistently across emulations.
Do path name translation.
 1.3 03-May-1996  christos branches: 1.3.4;
gcc -Wall fixes.
 1.2 07-Nov-1995  gwr ufs ==> ffs
 1.1 10-Oct-1995  mycroft branches: 1.1.2;
FreeBSD binary compatibility module, from Noriyuki Soda.
 1.1.2.1 07-Nov-1995  gwr From Head: ufs ==> ffs
 1.3.4.1 10-Dec-1996  mycroft From trunk:
Do execv() and execve() path name translation consistently across
emulations.
 1.4.2.1 14-Jan-1997  thorpej Snapshot of work-in-progress, committed to private branch.

These changes implement machine-independent root device and file system
selection. Notable features:

- All ports behave in a consistent manner regarding root
device selection.
- No more "options GENERIC"; all kernels have the ability
to boot with RB_ASKNAME to select root device and file system
type.
- Root file system type can be wildcarded; a machine-independent
function will try all possible file systems for the selected
root device until one succeeds.
- If the root file system fails to mount, the operator will
be given the chance to select a new root device and file
system type, rather than having the machine simply panic.
- nfs_mountroot() no longer panics if any part of the NFS
mount process fails; it now returns an error, giving the
operator a chance to recover.
- New, more consistent, config(8) grammar. The constructs:

config netbsd swap generic
config netbsd root on nfs

have been replaced with:

config netbsd root on ? type ?
config netbsd root on ? type nfs

Additionally, the operator may select or wildcard root file
system type in the kernel configuration file:

config netbsd root on cd0a type cd9660

config(8) now requires that a "root" specification be
made. "root" may be wired down or wildcarded. "swap" and
"dump" specifications are optional, and follow previous
semantics.

- config(8) has a new "file-system" keyword, used to configure
file systems into the kernel. Eventually, this will be used
to generate the default vfssw[].

- "options NFSCLIENT" is obsolete, and is replaced by
"file-system NFS". "options NFSSERVER" still exists, since
NFS server support is independent of the NFS file system
client.

- sys/arch/<foo>/<foo>/swapgeneric.c is no longer used, and
will be removed; all information is now generated by config(8).

As of this commit, all ports except arm32 have been updated to use
the new setroot(). Only SPARC, i386, and Alpha ports have been
tested at this time. Port masters should test these changes on their
ports, and report any problems back to me.

More changes are on their way, including RB_ASKNAME support in
nfs_mountroot() (to prompt for server address and path) and, potentially,
the ability to select rarp/bootparam or bootp in nfs_mountroot().
 1.5.8.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.9.14.2 11-Feb-2001  bouyer Sync with HEAD.
 1.9.14.1 08-Dec-2000  bouyer Sync with HEAD.
 1.13.2.6 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.13.2.5 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.13.2.4 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.13.2.3 14-Nov-2001  nathanw Catch up to -current.
 1.13.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.13.2.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.14.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.14.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.19.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.19.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.19.2.2 03-Aug-2004  skrll Sync with HEAD
 1.19.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.20.12.6 21-Jan-2008  yamt sync with head
 1.20.12.5 07-Dec-2007  yamt sync with head
 1.20.12.4 03-Sep-2007  yamt sync with head.
 1.20.12.3 26-Feb-2007  yamt sync with head.
 1.20.12.2 30-Dec-2006  yamt sync with head.
 1.20.12.1 21-Jun-2006  yamt sync with head.
 1.21.16.1 13-Jul-2006  gdamore Merge from HEAD.
 1.21.8.1 11-Aug-2006  yamt sync with head
 1.21.4.1 09-Sep-2006  rpaulo sync with head
 1.22.4.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.23.2.2 07-May-2007  yamt sync with head.
 1.23.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.24.4.1 11-Jul-2007  mjf Sync with head.
 1.24.2.3 20-Aug-2007  ad Sync with HEAD.
 1.24.2.2 15-Jul-2007  ad Sync with head.
 1.24.2.1 27-May-2007  ad Sync with head.
 1.28.16.2 26-Dec-2007  ad Sync with head.
 1.28.16.1 08-Dec-2007  ad Sync with head.
 1.28.14.2 27-Dec-2007  mjf Sync with HEAD.
 1.28.14.1 08-Dec-2007  mjf Sync with HEAD.
 1.28.8.1 09-Jan-2008  matt sync with HEAD
 1.28.6.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.30.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.31.30.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.31.12.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.31.12.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.31.10.1 11-Mar-2010  yamt sync with head
 1.32.36.1 17-Jan-2015  martin Pull up following revision(s) (requested by maxv in ticket #427):
sys/compat/svr4/svr4_schedctl.c: revision 1.8
sys/netinet/tcp_timer.c: revision 1.88
sys/miscfs/genfs/layer_vfsops.c: revision 1.45
sys/compat/svr4/svr4_ioctl.c: revision 1.37
sys/ufs/chfs/chfs_vfsops.c: revision 1.14
sys/miscfs/fdesc/fdesc_vfsops.c: revision 1.91
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.30
sys/compat/common/kern_time_50.c: revision 1.28
sys/netinet6/ip6_forward.c: revision 1.74
sys/miscfs/umapfs/umap_vnops.c: revision 1.57
sys/compat/svr4/svr4_fcntl.c: revision 1.74
distrib/sets/lists/comp/mi: revision 1.1931
sys/netinet6/udp6_output.c: revision 1.46
sys/fs/puffs/puffs_compat.c: revision 1.3
sys/fs/udf/udf_rename.c: revision 1.11
sys/compat/svr4/svr4_filio.c: revision 1.24
sys/fs/udf/udf_rename.c: revision 1.12
sys/netinet/tcp_usrreq.c: revision 1.202
sys/miscfs/umapfs/umap_subr.c: revision 1.29
sys/compat/linux/common/linux_fadvise64.c: revision 1.3
sys/netinet/if_atm.c: revision 1.34
sys/miscfs/procfs/procfs_subr.c: revision 1.106
sys/miscfs/genfs/layer_subr.c: revision 1.37
sys/netinet/tcp_sack.c: revision 1.30
sys/compat/freebsd/freebsd_misc.c: revision 1.33
sys/compat/freebsd/freebsd_file.c: revision 1.33
sys/ufs/chfs/chfs_vnode.c: revision 1.12
sys/compat/svr4/svr4_ttold.c: revision 1.34
sys/compat/linux/common/linux_file.c: revision 1.114
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.43
sys/compat/linux/common/linux_signal.c: revision 1.76
sys/compat/common/compat_util.c: revision 1.46
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.18
sys/compat/svr4/svr4_sockio.c: revision 1.36
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.32
sys/compat/svr4/svr4_signal.c: revision 1.66
sys/kern/kern_exec.c: revision 1.410
sys/fs/puffs/puffs_vfsops.c: revision 1.115
sys/compat/svr4/svr4_exec_elf64.c: revision 1.15
sys/compat/linux/arch/i386/linux_machdep.c: revision 1.159
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.50
sys/compat/linux32/common/linux32_misc.c: revision 1.24
sys/netinet/in_pcb.c: revision 1.153
sys/sys/malloc.h: revision 1.116
sys/compat/common/if_43.c: revision 1.9
share/man/man9/Makefile: revision 1.380
sys/netinet/tcp_vtw.c: revision 1.12
sys/miscfs/umapfs/umap_vfsops.c: revision 1.95
sys/ufs/ext2fs/ext2fs_vfsops.c: revision 1.186
sys/compat/common/uipc_syscalls_43.c: revision 1.46
sys/ufs/ext2fs/ext2fs_vnops.c: revision 1.115
sys/fs/puffs/puffs_msgif.c: revision 1.97
sys/compat/svr4/svr4_ipc.c: revision 1.27
sys/compat/linux/common/linux_exec.c: revision 1.117
sys/ufs/ext2fs/ext2fs_readwrite.c: revision 1.66
sys/netinet/tcp_output.c: revision 1.179
sys/compat/svr4/svr4_termios.c: revision 1.28
sys/fs/udf/udf_strat_bootstrap.c: revision 1.4
sys/fs/puffs/puffs_subr.c: revision 1.67
sys/fs/puffs/puffs_node.c: revision 1.36
sys/miscfs/overlay/overlay_vnops.c: revision 1.21
sys/fs/cd9660/cd9660_node.c: revision 1.34
sys/netinet/raw_ip.c: revision 1.146
sys/sys/mallocvar.h: revision 1.13
sys/miscfs/overlay/overlay_vfsops.c: revision 1.63
share/man/man9/malloc.9: revision 1.50
sys/netinet6/dest6.c: revision 1.18
sys/compat/linux/common/linux_uselib.c: revision 1.33
sys/compat/linux/common/linux_socket.c: revision 1.120
share/man/man9/malloc.9: revision 1.51
sys/netinet/tcp_subr.c: revision 1.257
sys/compat/linux/common/linux_socketcall.c: revision 1.45
sys/compat/linux/common/linux_fadvise64_64.c: revision 1.3
sys/compat/freebsd/freebsd_ipc.c: revision 1.17
sys/compat/linux/common/linux_misc_notalpha.c: revision 1.109
sys/compat/linux/arch/alpha/linux_pipe.c: revision 1.17
sys/netinet6/in6_pcb.c: revision 1.132
sys/netinet6/in6_ifattach.c: revision 1.94
sys/compat/svr4/svr4_exec_elf32.c: revision 1.15
sys/miscfs/nullfs/null_vfsops.c: revision 1.90
sys/fs/cd9660/cd9660_util.c: revision 1.12
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.48
sys/compat/freebsd/freebsd_exec_elf32.c: revision 1.20
sys/miscfs/procfs/procfs_vfsops.c: revision 1.94
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.28
sys/compat/linux/common/linux_sched.c: revision 1.67
sys/compat/linux/common/linux_exec_aout.c: revision 1.67
sys/compat/linux/common/linux_pipe.c: revision 1.67
sys/compat/linux/common/linux_llseek.c: revision 1.34
sys/compat/linux/arch/mips/linux_ptrace.c: revision 1.10
Do not uselessly include <sys/malloc.h>.
Cleanup:
- remove struct kmembuckets (dead)
- correctly deadify MALLOC_XX
- remove MALLOC_DEFINE_LIMIT and MALLOC_JUSTDEFINE_LIMIT (dead)
- remove malloc_roundup(), malloc_type_setlimit(), MALLOC_DEFINE_LIMIT()
and MALLOC_JUSTDEFINE_LIMIT() from man 9 malloc
New sentence, new line. Bump date for previous.
Obsolete malloc_roundup(9), malloc_type_setlimit(9) and MALLOC_DEFINE_LIMIT(9)
man pages.
 1.32.20.1 03-Dec-2017  jdolecek update from HEAD
 1.33.2.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.9 16-Apr-2018  kamil Remove the rnewprocp argument from fork1(9)

It's now unused and it can cause use-after-free scenarios as noted by
<Mateusz Guzik>.

Reference: http://mail-index.netbsd.org/tech-kern/2017/09/08/msg022267.html

Sponsored by <The NetBSD Foundation>
 1.8 08-Aug-2017  maxv branches: 1.8.2;
Move freebsd_machdep.h into sys/compat/freebsd, and don't install it. Now,
the compat_freebsd files are all contained in sys/compat/freebsd.
 1.7 28-Apr-2008  martin branches: 1.7.44; 1.7.64;
Remove clause 3 and 4 from TNF licenses
 1.6 20-Dec-2007  dsl branches: 1.6.6; 1.6.8; 1.6.10;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.5 11-Dec-2005  christos branches: 1.5.46; 1.5.56; 1.5.60;
merge ktrace-lwp.
 1.4 13-Sep-2005  christos compat code reorg.
 1.3 26-Feb-2005  perry branches: 1.3.4;
nuke trailing whitespace
 1.2 18-Jan-2003  thorpej branches: 1.2.2; 1.2.10; 1.2.12;
Merge the nathanw_sa branch.
 1.1 09-Oct-2002  pooka branches: 1.1.2;
FreeBSD rfork emulation
 1.1.2.3 18-Oct-2002  nathanw LWPify freebsd_sys_rfork().
 1.1.2.2 18-Oct-2002  nathanw Catch up to -current.
 1.1.2.1 09-Oct-2002  nathanw file freebsd_fork.c was added on branch nathanw_sa on 2002-10-18 02:40:57 +0000
 1.2.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.2.10.1 29-Apr-2005  kent sync with -current
 1.2.2.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.2.2.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.3.4.2 21-Jan-2008  yamt sync with head
 1.3.4.1 21-Jun-2006  yamt sync with head.
 1.5.60.1 02-Jan-2008  bouyer Sync with HEAD
 1.5.56.1 26-Dec-2007  ad Sync with head.
 1.5.46.1 09-Jan-2008  matt sync with HEAD
 1.6.10.1 16-May-2008  yamt sync with head.
 1.6.8.1 18-May-2008  yamt sync with head.
 1.6.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.7.64.1 28-Aug-2017  skrll Sync with HEAD
 1.7.44.1 03-Dec-2017  jdolecek update from HEAD
 1.8.2.1 22-Apr-2018  pgoyette Sync with HEAD
 1.4 11-Dec-2005  christos merge ktrace-lwp.
 1.3 26-Feb-2005  perry nuke trailing whitespace
 1.2 07-Aug-2003  agc branches: 1.2.8; 1.2.10;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.1 09-Oct-2002  pooka branches: 1.1.2; 1.1.8;
FreeBSD rfork emulation
 1.1.8.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.1.8.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.8.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.8.1 03-Aug-2004  skrll Sync with HEAD
 1.1.2.2 18-Oct-2002  nathanw Catch up to -current.
 1.1.2.1 09-Oct-2002  nathanw file freebsd_fork.h was added on branch nathanw_sa on 2002-10-18 02:40:57 +0000
 1.2.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.2.8.1 29-Apr-2005  kent sync with -current
 1.15 20-Dec-2007  dsl branches: 1.15.12;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.14 08-Dec-2007  dsl branches: 1.14.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.13 29-May-2007  christos branches: 1.13.6; 1.13.8; 1.13.16;
Add a sockaddr_storage member to "struct ifreq" maintaining backwards
compatibility with the older ioctls. This avoids stack smashing and
abuse of "struct sockaddr" when ioctls placed "struct sockaddr_foo's" that
were longer than "struct sockaddr".
XXX: Some of the emulations might be broken; I tried to add code for
them but I did not test them.
 1.12 04-Mar-2007  christos branches: 1.12.2; 1.12.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.11 09-Feb-2007  ad branches: 1.11.2;
Merge newlock2 to head.
 1.10 11-Dec-2005  christos branches: 1.10.20;
merge ktrace-lwp.
 1.9 29-Jun-2003  fvdl branches: 1.9.2; 1.9.18;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.8 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.7 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.6 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.5 01-Dec-2000  jdolecek branches: 1.5.2; 1.5.4;
add e_path (emulation path) to struct emul, which replaces emulation-specific
*_emul_path variables

change macros CHECK_ALT_{CREAT|EXIST} to use that, 'root' doesn't need
to be passed explicitly any more and *_CHECK_ALT_{CREAT|EXIST} are removed
change explicit emul_find() calls in probe functions to get the emulation
path from the checked exec switch entry's emulation

remove no longer needed header files

add e_flags and e_syscall to struct emul; these are unsed and empty for now
 1.4 09-Oct-2000  onoe Map the ioctl number of ifioctl ('i') group as much as possible.
commands are: FreeBSD NetBSD
SIOCALIFADDR 27 28
SIOCGLIFADDR 28 29
SIOCDLIFADDR 29 30
SIOCGIFMTU 51 126
SIOCSIFMTU 52 127
* SIOCGLIFADDR is necessary for cvsup to work.
commands not emulated are:
SIOCGIFPHYS, SIOCSIFPHYS, SIOCGIFSTATUS, SIOCSIFLLADDR
 1.3 06-May-1997  augustss branches: 1.3.22;
Adjust ioctl() encoding before calling OSS audio code.
 1.2 04-Apr-1997  augustss * Move the Linux audio emulation into its own directory and rename it
OSS (aka VoxWare) audio emulation.
* Use the OSS audio emulation for Linux and FreeBSD.
* Add mixer emulation to the OSS emulator.
 1.1 10-Oct-1995  mycroft FreeBSD binary compatibility module, from Noriyuki Soda.
 1.3.22.2 08-Dec-2000  bouyer Sync with HEAD.
 1.3.22.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.5.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.5.2.4 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.5.2.3 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.5.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.5.2.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.9.18.4 21-Jan-2008  yamt sync with head
 1.9.18.3 03-Sep-2007  yamt sync with head.
 1.9.18.2 26-Feb-2007  yamt sync with head.
 1.9.18.1 21-Jun-2006  yamt sync with head.
 1.9.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.9.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.9.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.10.20.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.11.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.12.4.1 11-Jul-2007  mjf Sync with head.
 1.12.2.1 09-Jun-2007  ad Sync with head.
 1.13.16.1 26-Dec-2007  ad Sync with head.
 1.13.8.1 09-Jan-2008  matt sync with HEAD
 1.13.6.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.14.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.15.12.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.15.12.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.7 06-Sep-2015  dholland More on PR 41200: headers that declare ioctls should include sys/ioccom.h.
This covers (I think) all the MI headers outside of external/ (and dist/).
 1.6 29-May-2007  christos branches: 1.6.78; 1.6.98;
Add a sockaddr_storage member to "struct ifreq" maintaining backwards
compatibility with the older ioctls. This avoids stack smashing and
abuse of "struct sockaddr" when ioctls placed "struct sockaddr_foo's" that
were longer than "struct sockaddr".
XXX: Some of the emulations might be broken; I tried to add code for
them but I did not test them.
 1.5 09-Oct-2000  onoe branches: 1.5.40; 1.5.82; 1.5.84;
Map the ioctl number of ifioctl ('i') group as much as possible.
commands are: FreeBSD NetBSD
SIOCALIFADDR 27 28
SIOCGLIFADDR 28 29
SIOCDLIFADDR 29 30
SIOCGIFMTU 51 126
SIOCSIFMTU 52 127
* SIOCGLIFADDR is necessary for cvsup to work.
commands not emulated are:
SIOCGIFPHYS, SIOCSIFPHYS, SIOCGIFSTATUS, SIOCSIFLLADDR
 1.4 04-Oct-1998  veego branches: 1.4.12;
There is no need to include ../linux/linux_ioctl.h.
 1.3 06-May-1997  augustss Adjust ioctl() encoding before calling OSS audio code.
 1.2 04-Apr-1997  augustss * Move the Linux audio emulation into its own directory and rename it
OSS (aka VoxWare) audio emulation.
* Use the OSS audio emulation for Linux and FreeBSD.
* Add mixer emulation to the OSS emulator.
 1.1 10-Oct-1995  mycroft FreeBSD binary compatibility module, from Noriyuki Soda.
 1.4.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.5.84.1 11-Jul-2007  mjf Sync with head.
 1.5.82.1 09-Jun-2007  ad Sync with head.
 1.5.40.1 03-Sep-2007  yamt sync with head.
 1.6.98.1 22-Sep-2015  skrll Sync with HEAD
 1.6.78.1 03-Dec-2017  jdolecek update from HEAD
 1.17 09-Nov-2014  maxv Do not uselessly include <sys/malloc.h>.
 1.16 11-Jan-2009  christos branches: 1.16.24; 1.16.40;
merge christos-time_t
 1.15 20-Dec-2007  dsl branches: 1.15.6; 1.15.8; 1.15.12; 1.15.14; 1.15.20;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.14 08-Dec-2007  dsl branches: 1.14.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.13 09-Feb-2007  ad branches: 1.13.18; 1.13.20; 1.13.28;
Merge newlock2 to head.
 1.12 10-Nov-2005  christos branches: 1.12.22;
need compat/sys/shm.h
 1.11 18-Jan-2003  thorpej branches: 1.11.2; 1.11.18;
Merge the nathanw_sa branch.
 1.10 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.9 30-May-2001  mrg branches: 1.9.2;
use _KERNEL_OPT.
 1.8 29-Nov-2000  jdolecek branches: 1.8.2;
LKMify
 1.7 28-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.6 26-Jun-2000  mrg remove/move more mach vm header files:

<vm/pglist.h> -> <uvm/uvm_pglist.h>
<vm/vm_inherit.h> -> <uvm/uvm_inherit.h>
<vm/vm_kern.h> -> into <uvm/uvm_extern.h>
<vm/vm_object.h> -> nothing
<vm/vm_pager.h> -> into <uvm/uvm_pager.h>

also includes a bunch of <vm/vm_page.h> include removals (due to redudancy
with <vm/vm.h>), and a scattering of other similar headers.
 1.5 25-Aug-1999  thorpej branches: 1.5.2;
Update for new msgctl()/semctl()/shmctl().
 1.4 19-Oct-1998  tron Defopt SYSVMSG, SYSVSEM and SYSVSHM.
 1.3 15-Aug-1998  mycroft Make copyright notices with my name consistent.
 1.2 22-Jan-1998  mycroft branches: 1.2.2;
Fix an old typo that caused shmdt() to fail.
 1.1 22-Jan-1998  mycroft Put a local copy of the SysV IPC compatibility from compat/common in here, so
it's not dependent on COMPAT_10. Also, fix translation of shmctl(), since
FreeBSD's is a little different.
 1.2.2.2 22-Jan-1998  mycroft Fix an old typo that caused shmdt() to fail.
 1.2.2.1 22-Jan-1998  mycroft file freebsd_ipc.c was added on branch netbsd-1-3 on 1998-01-22 17:23:44 +0000
 1.5.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.5.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.8.2.4 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.8.2.3 14-Nov-2001  nathanw Catch up to -current.
 1.8.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.8.2.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.9.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.11.18.3 21-Jan-2008  yamt sync with head
 1.11.18.2 26-Feb-2007  yamt sync with head.
 1.11.18.1 21-Jun-2006  yamt sync with head.
 1.11.2.1 11-Dec-2005  christos Sync with head.
 1.12.22.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.13.28.1 26-Dec-2007  ad Sync with head.
 1.13.20.1 09-Jan-2008  matt sync with HEAD
 1.13.18.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.14.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.15.20.1 19-Jan-2009  skrll Sync with HEAD.
 1.15.14.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.15.14.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.15.12.1 04-May-2009  yamt sync with head.
 1.15.8.1 29-Mar-2008  christos Welcome to the time_t=long long dev_t=uint64_t branch.
 1.15.6.1 17-Jan-2009  mjf Sync with HEAD.
 1.16.40.1 17-Jan-2015  martin Pull up following revision(s) (requested by maxv in ticket #427):
sys/compat/svr4/svr4_schedctl.c: revision 1.8
sys/netinet/tcp_timer.c: revision 1.88
sys/miscfs/genfs/layer_vfsops.c: revision 1.45
sys/compat/svr4/svr4_ioctl.c: revision 1.37
sys/ufs/chfs/chfs_vfsops.c: revision 1.14
sys/miscfs/fdesc/fdesc_vfsops.c: revision 1.91
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.30
sys/compat/common/kern_time_50.c: revision 1.28
sys/netinet6/ip6_forward.c: revision 1.74
sys/miscfs/umapfs/umap_vnops.c: revision 1.57
sys/compat/svr4/svr4_fcntl.c: revision 1.74
distrib/sets/lists/comp/mi: revision 1.1931
sys/netinet6/udp6_output.c: revision 1.46
sys/fs/puffs/puffs_compat.c: revision 1.3
sys/fs/udf/udf_rename.c: revision 1.11
sys/compat/svr4/svr4_filio.c: revision 1.24
sys/fs/udf/udf_rename.c: revision 1.12
sys/netinet/tcp_usrreq.c: revision 1.202
sys/miscfs/umapfs/umap_subr.c: revision 1.29
sys/compat/linux/common/linux_fadvise64.c: revision 1.3
sys/netinet/if_atm.c: revision 1.34
sys/miscfs/procfs/procfs_subr.c: revision 1.106
sys/miscfs/genfs/layer_subr.c: revision 1.37
sys/netinet/tcp_sack.c: revision 1.30
sys/compat/freebsd/freebsd_misc.c: revision 1.33
sys/compat/freebsd/freebsd_file.c: revision 1.33
sys/ufs/chfs/chfs_vnode.c: revision 1.12
sys/compat/svr4/svr4_ttold.c: revision 1.34
sys/compat/linux/common/linux_file.c: revision 1.114
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.43
sys/compat/linux/common/linux_signal.c: revision 1.76
sys/compat/common/compat_util.c: revision 1.46
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.18
sys/compat/svr4/svr4_sockio.c: revision 1.36
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.32
sys/compat/svr4/svr4_signal.c: revision 1.66
sys/kern/kern_exec.c: revision 1.410
sys/fs/puffs/puffs_vfsops.c: revision 1.115
sys/compat/svr4/svr4_exec_elf64.c: revision 1.15
sys/compat/linux/arch/i386/linux_machdep.c: revision 1.159
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.50
sys/compat/linux32/common/linux32_misc.c: revision 1.24
sys/netinet/in_pcb.c: revision 1.153
sys/sys/malloc.h: revision 1.116
sys/compat/common/if_43.c: revision 1.9
share/man/man9/Makefile: revision 1.380
sys/netinet/tcp_vtw.c: revision 1.12
sys/miscfs/umapfs/umap_vfsops.c: revision 1.95
sys/ufs/ext2fs/ext2fs_vfsops.c: revision 1.186
sys/compat/common/uipc_syscalls_43.c: revision 1.46
sys/ufs/ext2fs/ext2fs_vnops.c: revision 1.115
sys/fs/puffs/puffs_msgif.c: revision 1.97
sys/compat/svr4/svr4_ipc.c: revision 1.27
sys/compat/linux/common/linux_exec.c: revision 1.117
sys/ufs/ext2fs/ext2fs_readwrite.c: revision 1.66
sys/netinet/tcp_output.c: revision 1.179
sys/compat/svr4/svr4_termios.c: revision 1.28
sys/fs/udf/udf_strat_bootstrap.c: revision 1.4
sys/fs/puffs/puffs_subr.c: revision 1.67
sys/fs/puffs/puffs_node.c: revision 1.36
sys/miscfs/overlay/overlay_vnops.c: revision 1.21
sys/fs/cd9660/cd9660_node.c: revision 1.34
sys/netinet/raw_ip.c: revision 1.146
sys/sys/mallocvar.h: revision 1.13
sys/miscfs/overlay/overlay_vfsops.c: revision 1.63
share/man/man9/malloc.9: revision 1.50
sys/netinet6/dest6.c: revision 1.18
sys/compat/linux/common/linux_uselib.c: revision 1.33
sys/compat/linux/common/linux_socket.c: revision 1.120
share/man/man9/malloc.9: revision 1.51
sys/netinet/tcp_subr.c: revision 1.257
sys/compat/linux/common/linux_socketcall.c: revision 1.45
sys/compat/linux/common/linux_fadvise64_64.c: revision 1.3
sys/compat/freebsd/freebsd_ipc.c: revision 1.17
sys/compat/linux/common/linux_misc_notalpha.c: revision 1.109
sys/compat/linux/arch/alpha/linux_pipe.c: revision 1.17
sys/netinet6/in6_pcb.c: revision 1.132
sys/netinet6/in6_ifattach.c: revision 1.94
sys/compat/svr4/svr4_exec_elf32.c: revision 1.15
sys/miscfs/nullfs/null_vfsops.c: revision 1.90
sys/fs/cd9660/cd9660_util.c: revision 1.12
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.48
sys/compat/freebsd/freebsd_exec_elf32.c: revision 1.20
sys/miscfs/procfs/procfs_vfsops.c: revision 1.94
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.28
sys/compat/linux/common/linux_sched.c: revision 1.67
sys/compat/linux/common/linux_exec_aout.c: revision 1.67
sys/compat/linux/common/linux_pipe.c: revision 1.67
sys/compat/linux/common/linux_llseek.c: revision 1.34
sys/compat/linux/arch/mips/linux_ptrace.c: revision 1.10
Do not uselessly include <sys/malloc.h>.
Cleanup:
- remove struct kmembuckets (dead)
- correctly deadify MALLOC_XX
- remove MALLOC_DEFINE_LIMIT and MALLOC_JUSTDEFINE_LIMIT (dead)
- remove malloc_roundup(), malloc_type_setlimit(), MALLOC_DEFINE_LIMIT()
and MALLOC_JUSTDEFINE_LIMIT() from man 9 malloc
New sentence, new line. Bump date for previous.
Obsolete malloc_roundup(9), malloc_type_setlimit(9) and MALLOC_DEFINE_LIMIT(9)
man pages.
 1.16.24.1 03-Dec-2017  jdolecek update from HEAD
 1.5 07-Sep-2021  riastradh sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.4 17-Sep-2017  maxv branches: 1.4.2; 1.4.10;
Remove the second argument from USERMODE and KERNELMODE, it is unused
now that we don't have vm86 anymore.
 1.3 12-Aug-2017  maxv branches: 1.3.2;
Remove vm86. Simplifies a number of critical places.

Pass 2.
 1.2 08-Aug-2017  maxv Move freebsd_machdep.h into sys/compat/freebsd, and don't install it. Now,
the compat_freebsd files are all contained in sys/compat/freebsd.
 1.1 01-Aug-2017  maxv Move arch/i386/i386/freebsd_* into compat/freebsd/. COMPAT_FREEBSD is
i386-specific.
 1.3.2.2 28-Aug-2017  skrll Sync with HEAD
 1.3.2.1 12-Aug-2017  skrll file freebsd_machdep.c was added on branch nick-nhusb on 2017-08-28 17:51:58 +0000
 1.4.10.1 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.4.2.2 03-Dec-2017  jdolecek update from HEAD
 1.4.2.1 17-Sep-2017  jdolecek file freebsd_machdep.c was added on branch tls-maxphys on 2017-12-03 11:36:53 +0000
 1.1 08-Aug-2017  maxv branches: 1.1.2; 1.1.4;
Move freebsd_machdep.h into sys/compat/freebsd, and don't install it. Now,
the compat_freebsd files are all contained in sys/compat/freebsd.
 1.1.4.2 03-Dec-2017  jdolecek update from HEAD
 1.1.4.1 08-Aug-2017  jdolecek file freebsd_machdep.h was added on branch tls-maxphys on 2017-12-03 11:36:53 +0000
 1.1.2.2 28-Aug-2017  skrll Sync with HEAD
 1.1.2.1 08-Aug-2017  skrll file freebsd_machdep.h was added on branch nick-nhusb on 2017-08-28 17:51:58 +0000
 1.34 07-Sep-2021  riastradh sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.33 09-Nov-2014  maxv branches: 1.33.12; 1.33.24;
Do not uselessly include <sys/malloc.h>.
 1.32 20-Dec-2007  dsl branches: 1.32.12; 1.32.54; 1.32.72;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.31 08-Dec-2007  dsl branches: 1.31.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.30 15-Aug-2007  ad branches: 1.30.2; 1.30.10;
Changes to make ktrace LKM friendly and reduce ifdef KTRACE. Proposed
on tech-kern.
 1.29 04-Mar-2007  christos branches: 1.29.2; 1.29.10; 1.29.14;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.28 09-Feb-2007  ad branches: 1.28.2;
Merge newlock2 to head.
 1.27 16-Nov-2006  christos __unused removal on arguments; approved by core.
 1.26 22-Oct-2006  christos ktruser checks for length now.
 1.25 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.24 11-Dec-2005  christos branches: 1.24.20; 1.24.22;
merge ktrace-lwp.
 1.23 13-Sep-2005  christos Forgot to reverse the conditional test.
 1.22 12-Sep-2005  christos Range checks are not optional. The omission of this one, allows the user
to corrupt the heap and/or crash the kernel (Christer Oeberg).
 1.21 26-Feb-2005  perry branches: 1.21.2; 1.21.4;
nuke trailing whitespace
 1.20 18-Sep-2003  pooka branches: 1.20.2; 1.20.6; 1.20.8; 1.20.10;
Add a good enuf emulation of the MAP_STACK flag to the mmap()
syscall. This allows programs which use MAP_STACK to work instead
of failing in weird and wonderous ways.
 1.19 29-Jun-2003  fvdl branches: 1.19.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.18 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.17 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.16 26-Nov-2002  christos rename: s/sa_/<compat>sa/g
 1.15 04-Jul-2002  thorpej Add kernel support for having userland provide the signal trampoline:

* struct sigacts gets a new sigact_sigdesc structure, which has the
sigaction and the trampoline/version. Version 0 means "legacy kernel
provided trampoline". Other versions are coordinated with machine-
dependent code in libc.
* sigaction1() grows two more arguments -- the trampoline pointer and
the trampoline version.
* A new __sigaction_sigtramp() system call is provided to register a
trampoline along with a signal handler.
* The handler is no longer passed to sensig() functions. Instead,
sendsig() looks up the handler by peeking in the sigacts for the
process getting the signal (since it has to look in there for the
trampoline anyway).
* Native sendsig() functions now select the appropriate trampoline and
its arguments based on the trampoline version in the sigacts.

Changes to libc to use the new facility will be checked in later. Kernel
version not bumped; we will ride the 1.6C bump made recently.
 1.14 13-Nov-2001  lukem branches: 1.14.8; 1.14.10;
add RCSIDs (including regeneration of files as appropriate)
 1.13 30-May-2001  mrg branches: 1.13.2;
use _KERNEL_OPT.
 1.12 28-Dec-2000  jdolecek branches: 1.12.2;
use NetBSD utrace(2) facilities for FreeBSD utrace(2) emulation;
use id 'FreeBSD utrace'
 1.11 18-Dec-2000  jdolecek make compilable without KTRACE, too
 1.10 17-Dec-2000  jdolecek add emulation of FreeBSD utrace(2)
 1.9 01-Dec-2000  jdolecek LKMify
 1.8 01-Dec-2000  jdolecek add e_path (emulation path) to struct emul, which replaces emulation-specific
*_emul_path variables

change macros CHECK_ALT_{CREAT|EXIST} to use that, 'root' doesn't need
to be passed explicitly any more and *_CHECK_ALT_{CREAT|EXIST} are removed
change explicit emul_find() calls in probe functions to get the emulation
path from the checked exec switch entry's emulation

remove no longer needed header files

add e_flags and e_syscall to struct emul; these are unsed and empty for now
 1.7 07-Aug-2000  bjh21 Second phase of changes to remove ntp_adjtime(2) from the kernel entirely if
NTP is not defined.

Also removes sysctl_ntptime, since that's unreferenced without NTP.

ntp_gettime(2) is left alone, since it doesn't raise SIGSYS, which sys_nosys()
does.
 1.6 18-Jul-2000  onoe implement new signal syscalls in FreeBSD 4.0-RELEASE, using native syscalls:
sigaction, sigprocmask, sigsuspend, and sigpending.
 1.5 21-Apr-2000  minoura branches: 1.5.4;
We have now native issetugid.
 1.4 02-May-1998  christos branches: 1.4.14;
PR/5350: Minoura Makoto: add issetugid() syscall. (with fixes from me)
 1.3 20-Oct-1997  thorpej branches: 1.3.2;
Fix the shared library versioning snafu caused by the recent changes
to the stat(2) family and msync(2). This uses a primitive function
versioning scheme.

This reverts the libc shared library major version from 13 to 12, and
adds a few new interfaces to bring us to libc version 12.20.

From Frank van der Linden <fvdl@NetBSD.ORG>.
 1.2 03-May-1996  christos gcc -Wall fixes.
 1.1 10-Oct-1995  mycroft FreeBSD binary compatibility module, from Noriyuki Soda.
 1.3.2.1 30-Sep-1998  cgd pull up rev 1.4 from trunk (tv)
 1.4.14.3 05-Jan-2001  bouyer Sync with HEAD
 1.4.14.2 08-Dec-2000  bouyer Sync with HEAD.
 1.4.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.5.4.1 06-Mar-2002  he Pull up revisions 1.6-1.7 (requested by jonathan):
Add support for FreeBSD 4.x signals; fixes PR#9769.
 1.12.2.7 11-Dec-2002  thorpej Sync with HEAD.
 1.12.2.6 01-Aug-2002  nathanw Catch up to -current.
 1.12.2.5 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.12.2.4 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.12.2.3 14-Nov-2001  nathanw Catch up to -current.
 1.12.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.12.2.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.13.2.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.13.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.14.10.1 14-Sep-2005  riz Pull up patch (requested by elad in ticket #5867):
Fix a user-controlled length argument from potentially overflowing an
integer. Reported by Christer Oeberg.
 1.14.8.1 15-Jul-2002  gehenna catch up with -current.
 1.19.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.19.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.19.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.19.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.19.2.2 03-Aug-2004  skrll Sync with HEAD
 1.19.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.20.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.20.8.1 29-Apr-2005  kent sync with -current
 1.20.6.2 08-Feb-2007  bouyer Pull up following revision(s) (requested by adrianp in ticket #11023):
sys/kern/kern_ktrace.c: revision 1.110 via patch
sys/sys/ktrace.h: revision 1.45 via patch
sys/compat/freebsd/freebsd_misc.c: revision 1.26 via patch
sys/compat/darwin/darwin_iohidsystem.c: revision 1.35 via patch
sys/compat/darwin/darwin_ktrace.c: revision 1.6 via patch
Due to insufficient length checking it is possible for a user to cause
an integer overflow. Make ktruser return an error instead.
 1.20.6.1 13-Sep-2005  tron branches: 1.20.6.1.2;
Pull up following revision(s) (requested by christos in ticket #5846):
sys/compat/freebsd/freebsd_misc.c: revision 1.22 via patch
Range checks are not optional. The omission of this one, allows the user
to corrupt the heap and/or crash the kernel. (Christer Oeberg)
 1.20.6.1.2.1 08-Feb-2007  bouyer Pull up following revision(s) (requested by adrianp in ticket #11023):
sys/kern/kern_ktrace.c: revision 1.110 via patch
sys/sys/ktrace.h: revision 1.45 via patch
sys/compat/freebsd/freebsd_misc.c: revision 1.26 via patch
sys/compat/darwin/darwin_iohidsystem.c: revision 1.35 via patch
sys/compat/darwin/darwin_ktrace.c: revision 1.6 via patch
Due to insufficient length checking it is possible for a user to cause
an integer overflow. Make ktruser return an error instead.
 1.20.2.2 08-Feb-2007  bouyer Pull up following revision(s) (requested by adrianp in ticket #11023):
sys/kern/kern_ktrace.c: revision 1.110 via patch
sys/sys/ktrace.h: revision 1.45 via patch
sys/compat/freebsd/freebsd_misc.c: revision 1.26 via patch
sys/compat/darwin/darwin_iohidsystem.c: revision 1.35 via patch
sys/compat/darwin/darwin_ktrace.c: revision 1.6 via patch
Due to insufficient length checking it is possible for a user to cause
an integer overflow. Make ktruser return an error instead.
 1.20.2.1 13-Sep-2005  tron Pull up following revision(s) (requested by christos in ticket #5846):
sys/compat/freebsd/freebsd_misc.c: revision 1.22 via patch
Range checks are not optional. The omission of this one, allows the user
to corrupt the heap and/or crash the kernel. (Christer Oeberg)
 1.21.4.5 21-Jan-2008  yamt sync with head
 1.21.4.4 03-Sep-2007  yamt sync with head.
 1.21.4.3 26-Feb-2007  yamt sync with head.
 1.21.4.2 30-Dec-2006  yamt sync with head.
 1.21.4.1 21-Jun-2006  yamt sync with head.
 1.21.2.3 24-Oct-2006  ghen Pull up following revision(s) (requested by adrianp in ticket #1564):
sys/compat/darwin/darwin_ktrace.c: revision 1.6 via patch
sys/compat/darwin/darwin_iohidsystem.c: revision 1.35 via patch
sys/compat/freebsd/freebsd_misc.c: revision 1.26 via patch
sys/kern/kern_ktrace.c: revision 1.110 via patch
sys/sys/ktrace.h: revision 1.45 via patch
make ktruser enforce the maximum buffer length, and return an error.
ktruser checks for length now.
ktruser now returns an error if the buffer length is too big.
 1.21.2.2 13-Sep-2005  tron branches: 1.21.2.2.2;
Pull up following revision(s) (requested by christos in ticket #778):
sys/compat/freebsd/freebsd_misc.c: revision 1.23
Forgot to reverse the conditional test.
 1.21.2.1 13-Sep-2005  tron Pull up following revision(s) (requested by christos in ticket #778):
sys/compat/freebsd/freebsd_misc.c: revision 1.22
Range checks are not optional. The omission of this one, allows the user
to corrupt the heap and/or crash the kernel. (Christer Oeberg)
 1.21.2.2.2.1 24-Oct-2006  ghen Pull up following revision(s) (requested by adrianp in ticket #1564):
sys/compat/darwin/darwin_ktrace.c: revision 1.6 via patch
sys/compat/darwin/darwin_iohidsystem.c: revision 1.35 via patch
sys/compat/freebsd/freebsd_misc.c: revision 1.26 via patch
sys/kern/kern_ktrace.c: revision 1.110 via patch
sys/sys/ktrace.h: revision 1.45 via patch
make ktruser enforce the maximum buffer length, and return an error.
ktruser checks for length now.
ktruser now returns an error if the buffer length is too big.
 1.24.22.2 10-Dec-2006  yamt sync with head.
 1.24.22.1 22-Oct-2006  yamt sync with head
 1.24.20.3 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.24.20.2 18-Nov-2006  ad Sync with head.
 1.24.20.1 24-Oct-2006  ad - Redo LWP locking slightly and fix some races.
- Fix some locking botches.
- Make signal mask / stack per-proc for SA processes.
- Add _lwp_kill().
 1.28.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.29.14.2 09-Dec-2007  jmcneill Sync with HEAD.
 1.29.14.1 16-Aug-2007  jmcneill Sync with HEAD.
 1.29.10.1 03-Sep-2007  skrll Sync with HEAD.
 1.29.2.1 20-Aug-2007  ad Sync with HEAD.
 1.30.10.1 26-Dec-2007  ad Sync with head.
 1.30.2.1 09-Jan-2008  matt sync with HEAD
 1.31.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.32.72.1 17-Jan-2015  martin Pull up following revision(s) (requested by maxv in ticket #427):
sys/compat/svr4/svr4_schedctl.c: revision 1.8
sys/netinet/tcp_timer.c: revision 1.88
sys/miscfs/genfs/layer_vfsops.c: revision 1.45
sys/compat/svr4/svr4_ioctl.c: revision 1.37
sys/ufs/chfs/chfs_vfsops.c: revision 1.14
sys/miscfs/fdesc/fdesc_vfsops.c: revision 1.91
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.30
sys/compat/common/kern_time_50.c: revision 1.28
sys/netinet6/ip6_forward.c: revision 1.74
sys/miscfs/umapfs/umap_vnops.c: revision 1.57
sys/compat/svr4/svr4_fcntl.c: revision 1.74
distrib/sets/lists/comp/mi: revision 1.1931
sys/netinet6/udp6_output.c: revision 1.46
sys/fs/puffs/puffs_compat.c: revision 1.3
sys/fs/udf/udf_rename.c: revision 1.11
sys/compat/svr4/svr4_filio.c: revision 1.24
sys/fs/udf/udf_rename.c: revision 1.12
sys/netinet/tcp_usrreq.c: revision 1.202
sys/miscfs/umapfs/umap_subr.c: revision 1.29
sys/compat/linux/common/linux_fadvise64.c: revision 1.3
sys/netinet/if_atm.c: revision 1.34
sys/miscfs/procfs/procfs_subr.c: revision 1.106
sys/miscfs/genfs/layer_subr.c: revision 1.37
sys/netinet/tcp_sack.c: revision 1.30
sys/compat/freebsd/freebsd_misc.c: revision 1.33
sys/compat/freebsd/freebsd_file.c: revision 1.33
sys/ufs/chfs/chfs_vnode.c: revision 1.12
sys/compat/svr4/svr4_ttold.c: revision 1.34
sys/compat/linux/common/linux_file.c: revision 1.114
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.43
sys/compat/linux/common/linux_signal.c: revision 1.76
sys/compat/common/compat_util.c: revision 1.46
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.18
sys/compat/svr4/svr4_sockio.c: revision 1.36
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.32
sys/compat/svr4/svr4_signal.c: revision 1.66
sys/kern/kern_exec.c: revision 1.410
sys/fs/puffs/puffs_vfsops.c: revision 1.115
sys/compat/svr4/svr4_exec_elf64.c: revision 1.15
sys/compat/linux/arch/i386/linux_machdep.c: revision 1.159
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.50
sys/compat/linux32/common/linux32_misc.c: revision 1.24
sys/netinet/in_pcb.c: revision 1.153
sys/sys/malloc.h: revision 1.116
sys/compat/common/if_43.c: revision 1.9
share/man/man9/Makefile: revision 1.380
sys/netinet/tcp_vtw.c: revision 1.12
sys/miscfs/umapfs/umap_vfsops.c: revision 1.95
sys/ufs/ext2fs/ext2fs_vfsops.c: revision 1.186
sys/compat/common/uipc_syscalls_43.c: revision 1.46
sys/ufs/ext2fs/ext2fs_vnops.c: revision 1.115
sys/fs/puffs/puffs_msgif.c: revision 1.97
sys/compat/svr4/svr4_ipc.c: revision 1.27
sys/compat/linux/common/linux_exec.c: revision 1.117
sys/ufs/ext2fs/ext2fs_readwrite.c: revision 1.66
sys/netinet/tcp_output.c: revision 1.179
sys/compat/svr4/svr4_termios.c: revision 1.28
sys/fs/udf/udf_strat_bootstrap.c: revision 1.4
sys/fs/puffs/puffs_subr.c: revision 1.67
sys/fs/puffs/puffs_node.c: revision 1.36
sys/miscfs/overlay/overlay_vnops.c: revision 1.21
sys/fs/cd9660/cd9660_node.c: revision 1.34
sys/netinet/raw_ip.c: revision 1.146
sys/sys/mallocvar.h: revision 1.13
sys/miscfs/overlay/overlay_vfsops.c: revision 1.63
share/man/man9/malloc.9: revision 1.50
sys/netinet6/dest6.c: revision 1.18
sys/compat/linux/common/linux_uselib.c: revision 1.33
sys/compat/linux/common/linux_socket.c: revision 1.120
share/man/man9/malloc.9: revision 1.51
sys/netinet/tcp_subr.c: revision 1.257
sys/compat/linux/common/linux_socketcall.c: revision 1.45
sys/compat/linux/common/linux_fadvise64_64.c: revision 1.3
sys/compat/freebsd/freebsd_ipc.c: revision 1.17
sys/compat/linux/common/linux_misc_notalpha.c: revision 1.109
sys/compat/linux/arch/alpha/linux_pipe.c: revision 1.17
sys/netinet6/in6_pcb.c: revision 1.132
sys/netinet6/in6_ifattach.c: revision 1.94
sys/compat/svr4/svr4_exec_elf32.c: revision 1.15
sys/miscfs/nullfs/null_vfsops.c: revision 1.90
sys/fs/cd9660/cd9660_util.c: revision 1.12
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.48
sys/compat/freebsd/freebsd_exec_elf32.c: revision 1.20
sys/miscfs/procfs/procfs_vfsops.c: revision 1.94
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.28
sys/compat/linux/common/linux_sched.c: revision 1.67
sys/compat/linux/common/linux_exec_aout.c: revision 1.67
sys/compat/linux/common/linux_pipe.c: revision 1.67
sys/compat/linux/common/linux_llseek.c: revision 1.34
sys/compat/linux/arch/mips/linux_ptrace.c: revision 1.10
Do not uselessly include <sys/malloc.h>.
Cleanup:
- remove struct kmembuckets (dead)
- correctly deadify MALLOC_XX
- remove MALLOC_DEFINE_LIMIT and MALLOC_JUSTDEFINE_LIMIT (dead)
- remove malloc_roundup(), malloc_type_setlimit(), MALLOC_DEFINE_LIMIT()
and MALLOC_JUSTDEFINE_LIMIT() from man 9 malloc
New sentence, new line. Bump date for previous.
Obsolete malloc_roundup(9), malloc_type_setlimit(9) and MALLOC_DEFINE_LIMIT(9)
man pages.
 1.32.54.1 03-Dec-2017  jdolecek update from HEAD
 1.32.12.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.32.12.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.33.24.1 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.33.12.1 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1836):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.4 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.3 11-Dec-2005  christos branches: 1.3.70; 1.3.72; 1.3.74;
merge ktrace-lwp.
 1.2 26-Feb-2005  perry nuke trailing whitespace
 1.1 18-Sep-2003  pooka branches: 1.1.4; 1.1.10; 1.1.12;
Add a good enuf emulation of the MAP_STACK flag to the mmap()
syscall. This allows programs which use MAP_STACK to work instead
of failing in weird and wonderous ways.
 1.1.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.1.10.1 29-Apr-2005  kent sync with -current
 1.1.4.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.1.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.1.4.2 03-Aug-2004  skrll Sync with HEAD
 1.1.4.1 18-Sep-2003  skrll file freebsd_mman.h was added on branch ktrace-lwp on 2004-08-03 10:43:44 +0000
 1.3.74.1 16-May-2008  yamt sync with head.
 1.3.72.1 18-May-2008  yamt sync with head.
 1.3.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.7 05-Feb-2019  pgoyette Update compat_freebsd requirements list to use compat_09 vs compat
 1.6 29-Jul-2017  maxv branches: 1.6.4;
Remove exec_aout support in compat_freebsd. The only reason we still have
compat_freebsd is because of tw_cli, and it is an elf32 binary (could test,
manuel sent it to me).
 1.5 07-Mar-2014  christos branches: 1.5.6;
fix typos
 1.4 07-Mar-2014  christos c99 initializers for struct execsw
 1.3 19-Sep-2013  christos exec modules need to be of the exec kind
 1.2 16-Aug-2009  martin branches: 1.2.12; 1.2.22; 1.2.26;
Add missing include <sys/exec_aout.h>
 1.1 19-Nov-2008  ad branches: 1.1.4; 1.1.6; 1.1.8; 1.1.12;
Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.1.12.3 19-Aug-2009  yamt sync with head.
 1.1.12.2 04-May-2009  yamt sync with head.
 1.1.12.1 19-Nov-2008  yamt file freebsd_mod.c was added on branch yamt-nfs-mp on 2009-05-04 08:12:18 +0000
 1.1.8.2 19-Jan-2009  skrll Sync with HEAD.
 1.1.8.1 19-Nov-2008  skrll file freebsd_mod.c was added on branch nick-hppapmap on 2009-01-19 13:17:21 +0000
 1.1.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.1.6.1 19-Nov-2008  mjf file freebsd_mod.c was added on branch mjf-devfs2 on 2009-01-17 13:28:42 +0000
 1.1.4.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.1.4.1 19-Nov-2008  haad file freebsd_mod.c was added on branch haad-dm on 2008-12-13 01:13:47 +0000
 1.2.26.1 18-May-2014  rmind sync with head
 1.2.22.2 03-Dec-2017  jdolecek update from HEAD
 1.2.22.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.12.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.5.6.1 28-Aug-2017  skrll Sync with HEAD
 1.6.4.1 10-Jun-2019  christos Sync with HEAD
 1.21 08-Aug-2017  maxv Move freebsd_machdep.h into sys/compat/freebsd, and don't install it. Now,
the compat_freebsd files are all contained in sys/compat/freebsd.
 1.20 19-Jan-2014  dsl branches: 1.20.6;
Rip out the code that might once have supported the freebsd ptrace
system calls.
Removes some very dodgy conversions of FP register layouts.
Most of it has been disabled since 2007 when I removed the stackgap.
 1.19 23-Nov-2009  rmind branches: 1.19.12; 1.19.22; 1.19.26;
Use lwp_getpcb() in compat code, clean from struct user.
 1.18 12-Nov-2008  ad Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.
 1.17 20-Dec-2007  dsl branches: 1.17.6; 1.17.10; 1.17.12; 1.17.16; 1.17.18;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.16 08-Dec-2007  dsl branches: 1.16.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.15 23-Jun-2007  dsl branches: 1.15.6; 1.15.8; 1.15.16;
Comment out support for FREEBSD_PT_READ_U and FREEBSD_PT_WRITE_U.
It all looks like a rather broken hack.
If nothing else it accesses userspace without copyin/out.
 1.14 04-Mar-2007  christos branches: 1.14.2; 1.14.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.13 09-Feb-2007  ad branches: 1.13.2;
Merge newlock2 to head.
 1.12 01-Sep-2006  matt branches: 1.12.2;
When calling PTRACE from an LKM, use sysent[SYS_ptrace].sy_call in case
the sys_ptrace symbol isn't present.
 1.11 31-Aug-2006  he Protect the include of "opt_ptrace.h" by _KERNEL_OPT.
 1.10 30-Aug-2006  matt Update for options PTRACE
 1.9 11-Dec-2005  christos branches: 1.9.4; 1.9.8;
merge ktrace-lwp.
 1.8 13-Sep-2005  christos compat code reorg.
 1.7 07-Aug-2003  agc branches: 1.7.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.6 18-Jan-2003  thorpej branches: 1.6.2;
Merge the nathanw_sa branch.
 1.5 16-Mar-2002  christos make the stackgap_{init,alloc} functions MP friendly (i.e. pass struct proc *
in, instead of using curproc). While there add an optional size argument to
stackgap_init.
 1.4 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.3 01-Dec-2000  jdolecek branches: 1.3.2; 1.3.4;
add e_path (emulation path) to struct emul, which replaces emulation-specific
*_emul_path variables

change macros CHECK_ALT_{CREAT|EXIST} to use that, 'root' doesn't need
to be passed explicitly any more and *_CHECK_ALT_{CREAT|EXIST} are removed
change explicit emul_find() calls in probe functions to get the emulation
path from the checked exec switch entry's emulation

remove no longer needed header files

add e_flags and e_syscall to struct emul; these are unsed and empty for now
 1.2 03-May-1996  christos branches: 1.2.30;
gcc -Wall fixes.
 1.1 10-Oct-1995  mycroft FreeBSD binary compatibility module, from Noriyuki Soda.
 1.2.30.1 08-Dec-2000  bouyer Sync with HEAD.
 1.3.4.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.3.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.3.2.5 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.3.2.4 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.3.2.3 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.3.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.3.2.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.6.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.6.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.2.1 03-Aug-2004  skrll Sync with HEAD
 1.7.16.5 21-Jan-2008  yamt sync with head
 1.7.16.4 03-Sep-2007  yamt sync with head.
 1.7.16.3 26-Feb-2007  yamt sync with head.
 1.7.16.2 30-Dec-2006  yamt sync with head.
 1.7.16.1 21-Jun-2006  yamt sync with head.
 1.9.8.1 03-Sep-2006  yamt sync with head.
 1.9.4.1 09-Sep-2006  rpaulo sync with head
 1.12.2.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.13.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.14.4.1 11-Jul-2007  mjf Sync with head.
 1.14.2.1 15-Jul-2007  ad Sync with head.
 1.15.16.1 26-Dec-2007  ad Sync with head.
 1.15.8.1 09-Jan-2008  matt sync with HEAD
 1.15.6.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.16.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.17.18.1 19-Jan-2009  skrll Sync with HEAD.
 1.17.16.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.17.12.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.17.12.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.17.10.2 11-Mar-2010  yamt sync with head
 1.17.10.1 04-May-2009  yamt sync with head.
 1.17.6.1 17-Jan-2009  mjf Sync with HEAD.
 1.19.26.1 18-May-2014  rmind sync with head
 1.19.22.2 03-Dec-2017  jdolecek update from HEAD
 1.19.22.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.19.12.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.20.6.1 28-Aug-2017  skrll Sync with HEAD
 1.7 19-Jan-2014  dsl No longer used.
 1.6 04-Dec-2007  dsl branches: 1.6.50; 1.6.60; 1.6.66;
Remove all the __P
 1.5 04-Mar-2007  christos branches: 1.5.14; 1.5.16; 1.5.22; 1.5.24;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.4 11-Dec-2005  christos branches: 1.4.26;
merge ktrace-lwp.
 1.3 07-Aug-2003  agc branches: 1.3.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.2 13-Oct-1997  lukem branches: 1.2.50;
rcsid fascism
 1.1 10-Oct-1995  mycroft branches: 1.1.14;
FreeBSD binary compatibility module, from Noriyuki Soda.
 1.1.14.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2.50.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.50.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.50.1 03-Aug-2004  skrll Sync with HEAD
 1.3.16.2 07-Dec-2007  yamt sync with head
 1.3.16.1 03-Sep-2007  yamt sync with head.
 1.4.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.5.24.1 08-Dec-2007  ad Sync with head.
 1.5.22.1 08-Dec-2007  mjf Sync with HEAD.
 1.5.16.1 09-Jan-2008  matt sync with HEAD
 1.5.14.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.6.66.1 18-May-2014  rmind sync with head
 1.6.60.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.6.50.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.4 12-May-2008  martin Follow FreeBSD's rev 1.18 (by imp):
Replace (name) with Henric Vestergaard Draboel since it was clear that
this was just cut N paste and '(name)' doesn't make any sense.
 1.3 05-Jan-1998  perry branches: 1.3.146; 1.3.148; 1.3.150; 1.3.152;
RCSID Police.
 1.2 01-Feb-1996  mycroft LOCORE -> _LOCORE
 1.1 10-Oct-1995  mycroft FreeBSD binary compatibility module, from Noriyuki Soda.
 1.3.152.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.3.150.1 16-May-2008  yamt sync with head.
 1.3.148.1 18-May-2008  yamt sync with head.
 1.3.146.1 02-Jun-2008  mjf Sync with HEAD.
 1.23 07-Sep-2021  riastradh sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.22 28-Jun-2014  maxv branches: 1.22.20; 1.22.32;
Empy comment
 1.21 22-Jun-2014  christos simplify and clarify
 1.20 21-Jun-2014  christos Avoid NULL dereference and fix sched param conversion (at least make it
do something). Pointed out by Maxime Villard
 1.19 28-Apr-2008  martin branches: 1.19.10; 1.19.24; 1.19.40; 1.19.44; 1.19.46; 1.19.48; 1.19.56; 1.19.60;
Remove clause 3 and 4 from TNF licenses
 1.18 29-Feb-2008  dogcow branches: 1.18.2; 1.18.4;
Add some of those pesky semicolons, and correct number of args.
 1.17 28-Feb-2008  elad Factor out the guts of get/setparam so it can be used from the compat code.

Make the FreeBSD and Linux compat code convert the parameters to their
native representation and call the native routines.

Remove KAUTH_PROCESS_SCHEDULER_GET/SET.

Update documentation and examples.

XXX: For now, only the Linux compat code does the priority conversion
XXX: right.

Linux priority conversion code from yamt@, thanks!

Okay yamt@.
 1.16 16-Feb-2008  elad branches: 1.16.2; 1.16.6;
Fold KAUTH_REQ_PROCESS_SCHEDULER_* to KAUTH_PROCESS_SCHEDULER_*. In other
words, don't pass an action and a request, and just use a single action to
indicate what is the operation in question.

This is the first step in fixing PR/37986, which calls for policy/priority
checking in the secmodel code. Right now we're lacking room for another
parameter required to make a decision, and this change makes room for such.
 1.15 23-Jan-2008  elad Use KAUTH_ARG(), from hannken@ - thanks!
 1.14 23-Jan-2008  elad Use SCARG() to get pid, we don't have it as a local.

Spotted by hannken@, thanks!
 1.13 23-Jan-2008  elad Tons of process scope changes.

- Add a KAUTH_PROCESS_SCHEDULER action, to handle scheduler related
requests, and add specific requests for set/get scheduler policy and
set/get scheduler parameters.

- Add a KAUTH_PROCESS_KEVENT_FILTER action, to handle kevent(2) related
requests.

- Add a KAUTH_DEVICE_TTY_STI action to handle requests to TIOCSTI.

- Add requests for the KAUTH_PROCESS_CANSEE action, indicating what
process information is being looked at (entry itself, args, env,
open files).

- Add requests for the KAUTH_PROCESS_RLIMIT action indicating set/get.

- Add requests for the KAUTH_PROCESS_CORENAME action indicating set/get.

- Make bsd44 secmodel code handle the newly added rqeuests appropriately.

All of the above make it possible to issue finer-grained kauth(9) calls in
many places, removing some KAUTH_GENERIC_ISSUSER requests.

- Remove the "CAN" from KAUTH_PROCESS_CAN{KTRACE,PROCFS,PTRACE,SIGNAL}.

Discussed with christos@ and yamt@.
 1.12 20-Dec-2007  dsl Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.11 08-Dec-2007  dsl branches: 1.11.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.10 19-Oct-2007  ad branches: 1.10.2; 1.10.4;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.9 09-Mar-2007  ad branches: 1.9.2; 1.9.14; 1.9.16; 1.9.20;
- Make the proclist_lock a mutex. The write:read ratio is unfavourable,
and mutexes are cheaper use than RW locks.
- LOCK_ASSERT -> KASSERT in some places.
- Hold proclist_lock/kernel_lock longer in a couple of places.
 1.8 18-Feb-2007  dsl Factor out the replicated code that verifies that the caller is allowed
to acces the required process into a separate function (hi cut and paste).
Acquire the proclist_lock across p_find().
 1.7 05-Jan-2007  elad branches: 1.7.2;
Consistent usage of KAUTH_GENERIC_ISSUSER.
 1.6 16-Nov-2006  christos __unused removal on arguments; approved by core.
 1.5 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.4 23-Jul-2006  ad branches: 1.4.4; 1.4.6;
Use the LWP cached credentials where sane.
 1.3 14-May-2006  elad integrate kauth.
 1.2 18-Jan-2003  thorpej branches: 1.2.18; 1.2.32; 1.2.34; 1.2.36; 1.2.38; 1.2.40;
Merge the nathanw_sa branch.
 1.1 22-Dec-2002  gmcgarry branches: 1.1.2;
Add stubs for scheduler syscalls.
 1.1.2.3 29-Dec-2002  thorpej Fix a few bogons in LWP'ification.
 1.1.2.2 29-Dec-2002  thorpej Sync with HEAD.
 1.1.2.1 22-Dec-2002  thorpej file freebsd_sched.c was added on branch nathanw_sa on 2002-12-29 19:49:11 +0000
 1.2.40.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.2.38.2 06-May-2006  christos - Move kauth_cred_t declaration to <sys/types.h>
- Cleanup struct ucred; forward declarations that are unused.
- Don't include <sys/kauth.h> in any header, but include it in the c files
that need it.

Approved by core.
 1.2.38.1 08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.2.36.2 11-Aug-2006  yamt sync with head
 1.2.36.1 24-May-2006  yamt sync with head.
 1.2.34.1 01-Jun-2006  kardel Sync with head.
 1.2.32.1 09-Sep-2006  rpaulo sync with head
 1.2.18.9 17-Mar-2008  yamt sync with head.
 1.2.18.8 27-Feb-2008  yamt sync with head.
 1.2.18.7 04-Feb-2008  yamt sync with head.
 1.2.18.6 21-Jan-2008  yamt sync with head
 1.2.18.5 27-Oct-2007  yamt sync with head.
 1.2.18.4 03-Sep-2007  yamt sync with head.
 1.2.18.3 26-Feb-2007  yamt sync with head.
 1.2.18.2 30-Dec-2006  yamt sync with head.
 1.2.18.1 21-Jun-2006  yamt sync with head.
 1.4.6.2 10-Dec-2006  yamt sync with head.
 1.4.6.1 22-Oct-2006  yamt sync with head
 1.4.4.2 12-Jan-2007  ad Sync with head.
 1.4.4.1 18-Nov-2006  ad Sync with head.
 1.7.2.2 12-Mar-2007  rmind Sync with HEAD.
 1.7.2.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.9.20.1 25-Oct-2007  bouyer Sync with HEAD.
 1.9.16.3 23-Mar-2008  matt sync with HEAD
 1.9.16.2 09-Jan-2008  matt sync with HEAD
 1.9.16.1 06-Nov-2007  matt sync with HEAD
 1.9.14.2 09-Dec-2007  jmcneill Sync with HEAD.
 1.9.14.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.9.2.1 23-Oct-2007  ad Sync with head.
 1.10.4.1 26-Dec-2007  ad Sync with head.
 1.10.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.11.4.2 23-Jan-2008  bouyer Sync with HEAD.
 1.11.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.16.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.16.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.16.2.1 24-Mar-2008  keiichi sync with head.
 1.18.4.1 16-May-2008  yamt sync with head.
 1.18.2.1 18-May-2008  yamt sync with head.
 1.19.60.1 10-Aug-2014  tls Rebase.
 1.19.56.1 26-Jun-2014  msaitoh Pull up following revision(s) (requested by maxv in ticket #1086):
sys/compat/freebsd/freebsd_sched.c 1.20-1.21

Avoid NULL dereference and fix sched param conversion (at least make it
do something). Pointed out by Maxime Villard.

Simplify and clarify.
 1.19.48.1 30-Jun-2014  msaitoh Pull up following revision(s) (requested by maxv in ticket #1909):
sys/compat/freebsd/freebsd_sched.c 1.20-1.21

Avoid NULL dereference and fix sched param conversion (at least make it
do something). Pointed out by Maxime Villard.
 1.19.46.1 26-Jun-2014  msaitoh Pull up following revision(s) (requested by maxv in ticket #1086):
sys/compat/freebsd/freebsd_sched.c 1.20-1.21

Avoid NULL dereference and fix sched param conversion (at least make it
do something). Pointed out by Maxime Villard.

Simplify and clarify.
 1.19.44.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.19.40.1 26-Jun-2014  msaitoh Pull up following revision(s) (requested by maxv in ticket #1086):
sys/compat/freebsd/freebsd_sched.c 1.20-1.21

Avoid NULL dereference and fix sched param conversion (at least make it
do something). Pointed out by Maxime Villard.

Simplify and clarify.
 1.19.24.1 30-Jun-2014  msaitoh Pull up following revision(s) (requested by maxv in ticket #1909):
sys/compat/freebsd/freebsd_sched.c 1.20-1.21

Avoid NULL dereference and fix sched param conversion (at least make it
do something). Pointed out by Maxime Villard.
 1.19.10.1 30-Jun-2014  msaitoh Pull up following revision(s) (requested by maxv in ticket #1909):
sys/compat/freebsd/freebsd_sched.c 1.20-1.21

Avoid NULL dereference and fix sched param conversion (at least make it
do something). Pointed out by Maxime Villard.
 1.22.32.1 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.22.20.1 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1836):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.2 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.1 22-Dec-2002  gmcgarry branches: 1.1.2; 1.1.102; 1.1.104; 1.1.106;
Add stubs for scheduler syscalls.
 1.1.106.1 16-May-2008  yamt sync with head.
 1.1.104.1 18-May-2008  yamt sync with head.
 1.1.102.1 02-Jun-2008  mjf Sync with HEAD.
 1.1.2.2 29-Dec-2002  thorpej Sync with HEAD.
 1.1.2.1 22-Dec-2002  thorpej file freebsd_sched.h was added on branch nathanw_sa on 2002-12-29 19:49:11 +0000
 1.1 01-Aug-2017  maxv branches: 1.1.2; 1.1.4;
Move arch/i386/i386/freebsd_* into compat/freebsd/. COMPAT_FREEBSD is
i386-specific.
 1.1.4.2 03-Dec-2017  jdolecek update from HEAD
 1.1.4.1 01-Aug-2017  jdolecek file freebsd_sigcode.S was added on branch tls-maxphys on 2017-12-03 11:36:53 +0000
 1.1.2.2 28-Aug-2017  skrll Sync with HEAD
 1.1.2.1 01-Aug-2017  skrll file freebsd_sigcode.S was added on branch nick-nhusb on 2017-08-28 17:51:58 +0000
 1.8 04-Dec-2007  dsl Remove all the __P
 1.7 11-Dec-2005  christos branches: 1.7.44; 1.7.46; 1.7.52; 1.7.56;
merge ktrace-lwp.
 1.6 26-Mar-2004  drochner branches: 1.6.16;
all ports define __HAVE_SIGINFO now, so remove the CPP conditionals
 1.5 17-Nov-2003  keihan www.netbsd.org -> www.NetBSD.org
 1.4 25-Sep-2003  christos constify sendsig/trapsignal
 1.3 06-Sep-2003  christos SA_SIGINFO changes
 1.2 26-Nov-2002  christos branches: 1.2.6;
rename: s/sa_/<compat>sa/g
 1.1 18-Jul-2000  onoe branches: 1.1.2; 1.1.4; 1.1.16;
implement new signal syscalls in FreeBSD 4.0-RELEASE, using native syscalls:
sigaction, sigprocmask, sigsuspend, and sigpending.
 1.1.16.2 06-Mar-2002  he Pull up revision 1.1 (new, requested by jonathan):
Add support for FreeBSD 4.x signals; fixes PR#9769.
 1.1.16.1 18-Jul-2000  he file freebsd_signal.h was added on branch netbsd-1-5 on 2002-03-06 22:03:18 +0000
 1.1.4.1 11-Dec-2002  thorpej Sync with HEAD.
 1.1.2.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.1.2.1 18-Jul-2000  bouyer file freebsd_signal.h was added on branch thorpej_scsipi on 2000-11-20 18:08:10 +0000
 1.2.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.6.1 03-Aug-2004  skrll Sync with HEAD
 1.6.16.1 07-Dec-2007  yamt sync with head
 1.7.56.1 08-Dec-2007  ad Sync with head.
 1.7.52.1 08-Dec-2007  mjf Sync with HEAD.
 1.7.46.1 09-Jan-2008  matt sync with HEAD
 1.7.44.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.7 05-Oct-2023  ad Arrange to update cached LWP credentials in userret() rather than during
syscall/trap entry, eliminating a test+branch on every syscall/trap.

This wasn't possible in the 3.99.x timeframe when l->l_cred came about
because there wasn't a reliable/timely way to force an ONPROC LWP running on
a remote CPU into the kernel (which is just about the only new thing in
this scheme).
 1.6 06-Apr-2019  kre Revert previous (1.5) and return to the one before that (1.4), and
just allow things to be broken if this is used on a system where
register_t is int (32 bits) and long is 64 bits. Badly broken...
 1.5 06-Apr-2019  kre Revert previous. Instead change ufetch_long() to ufetch_int() in
both calls (and also remove the cast on the earlier).

These replaced fuword, to fetch a register_t (ie: int).
 1.4 06-Apr-2019  kre If using a cast for &code to make it a u_long * is acceptable a
few lines earlier, it should work here too.
 1.3 06-Apr-2019  thorpej Overhaul the API used to fetch and store individual memory cells in
userspace. The old fetch(9) and store(9) APIs (fubyte(), fuword(),
subyte(), suword(), etc.) are retired and replaced with new ufetch(9)
and ustore(9) APIs that can return proper error codes, etc. and are
implemented consistently across all platforms. The interrupt-safe
variants are no longer supported (and several of the existing attempts
at fuswintr(), etc. were buggy and not actually interrupt-safe).

Also augmement the ucas(9) API, making it consistently available on
all plaforms, supporting uniprocessor and multiprocessor systems, even
those that do not have CAS or LL/SC primitives.

Welcome to NetBSD 8.99.37.
 1.2 08-Aug-2017  maxv branches: 1.2.2; 1.2.4; 1.2.8;
Move freebsd_machdep.h into sys/compat/freebsd, and don't install it. Now,
the compat_freebsd files are all contained in sys/compat/freebsd.
 1.1 01-Aug-2017  maxv Move arch/i386/i386/freebsd_* into compat/freebsd/. COMPAT_FREEBSD is
i386-specific.
 1.2.8.1 10-Jun-2019  christos Sync with HEAD
 1.2.4.2 03-Dec-2017  jdolecek update from HEAD
 1.2.4.1 08-Aug-2017  jdolecek file freebsd_syscall.c was added on branch tls-maxphys on 2017-12-03 11:36:53 +0000
 1.2.2.2 28-Aug-2017  skrll Sync with HEAD
 1.2.2.1 08-Aug-2017  skrll file freebsd_syscall.c was added on branch nick-nhusb on 2017-08-28 17:51:58 +0000
 1.90 18-Jun-2019  christos regen
 1.89 10-Aug-2018  pgoyette Regen
 1.88 06-Jan-2018  kamil branches: 1.88.2; 1.88.4;
Revert vadvise(2) removal

This system call was used in legacy Lisp code, that was inherited to modern
age and still compiled against supported compat layers (e.g. in clisp,
oaklisp, Franz Lisp).

It used to instruct the kernel about paging policy (G/C aware, flush etc).

Newly compiled code (assuming that it will detect vadvise()) will use the
libc stub for vadvise(). The headers for this interface are gone.

vadvise(2) could be marked as COMPAT_80, but as long as we support ultrix,
sunos or aout68k ABI, don't bother with this.

Requested by <mrg>
 1.87 19-Dec-2017  kamil compat/freebsd: Drop SYS_vadvise

The (o)vadvise syscall is dummy since the beginning of NetBSD.

Sponsored by <The NetBSD Foundation>
 1.86 19-Dec-2017  kamil compat/freebsd: Drop SYS_sbrk

sbrk - change data segment size

This syscall is dummy since the inception of the project.

Sponsored by <The NetBSD Foundation>
 1.85 19-Dec-2017  kamil compat freebsd: Drop the sstk(2) syscall

sstk(2) has never been implemented by the NetBSD kernel.

Sponsored by <The NetBSD Foundation>
 1.84 10-May-2017  riastradh regen
 1.83 16-Jan-2017  christos branches: 1.83.4;
regen
 1.82 13-Jan-2017  christos branches: 1.82.2;
regen
 1.81 24-Sep-2015  christos branches: 1.81.2;
Regen
 1.80 07-Mar-2015  christos regen
 1.79 07-Nov-2013  njoly branches: 1.79.6;
Regen for dup/dup2/dup3 argument types fix.
 1.78 10-Mar-2012  joerg branches: 1.78.2; 1.78.4;
P1003_1B_SEMAPHORE is no longer optional.
 1.77 06-Mar-2011  bouyer branches: 1.77.4; 1.77.8;
merge the bouyer-quota2 branch. This adds a new on-disk format
to store disk quota usage and limits, integrated with ffs
metadata. Usage is checked by fsck_ffs (no more quotacheck)
and is covered by the WAPBL journal. Enabled with kernel
option QUOTA2 (added where QUOTA was enabled in kernel config files),
turned on with tunefs(8) on a per-filesystem
basis. mount_mfs(8) can also turn quotas on.

See http://mail-index.netbsd.org/tech-kern/2011/02/19/msg010025.html
for details.
 1.76 02-Mar-2010  pooka branches: 1.76.2; 1.76.4; 1.76.6;
regen:
- remove nfssvc / fs_nfs.h / #ifdef NFS
- make getfh unconditional
 1.75 02-Mar-2010  pooka regen for conditional lfs syscall removal
 1.74 14-Dec-2009  matt branches: 1.74.2;
Regen (new makesyscalls.sh)
 1.73 13-Jan-2009  pooka Regen to prove I didn't screw up the conversion: purely RCSID changes.
 1.72 11-Jan-2009  christos merge christos-time_t
 1.71 19-Nov-2008  ad Regen.
 1.70 14-Nov-2008  ad Regen.
 1.69 20-Dec-2007  dsl branches: 1.69.6; 1.69.8; 1.69.12; 1.69.18; 1.69.20;
regen
 1.68 13-Jul-2007  dsl branches: 1.68.8; 1.68.16; 1.68.20;
Update generated files.
 1.67 04-Mar-2007  christos branches: 1.67.2;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.66 01-Sep-2006  matt branches: 1.66.8;
Regen.
 1.65 30-Aug-2006  matt Regen (for PTRACE).
 1.64 31-Jul-2006  martin Make filehandles opaque to userland
 1.63 26-Jun-2006  mrg regenerate.
 1.62 04-May-2006  christos branches: 1.62.4;
Regen
 1.61 11-Dec-2005  christos branches: 1.61.4; 1.61.6; 1.61.8; 1.61.10; 1.61.12;
merge ktrace-lwp.
 1.60 13-Sep-2005  christos compat code reorg.
 1.59 19-Aug-2005  christos 64 bit inode changes.
 1.58 26-Feb-2005  perry branches: 1.58.4;
regen
 1.57 22-Feb-2005  heas Re-gen for sysctl emulation
 1.56 11-May-2004  drochner branches: 1.56.4; 1.56.6;
regen
 1.55 10-May-2004  jonathan Regen src/sys/compat/freebsd_sys{call.h,callargs.h,calls.c,ent.c} from
syscalls.master rev 1.45, with COMPAT_2.0 fix.
 1.54 21-Apr-2004  christos Replace the statfs() family of system calls with statvfs().
Retain binary compatibility.
 1.53 29-Jan-2004  tsarna uuidgen(2) syscall. Originally from FreeBSD, ported by John Franklin in
PR#23470, with minor updates by me. This is only the syscall support
from that PR, for now.

Changes: port over fix from FreeBSD for multicast address generation.
Changed bcopy to memcpy. For now, #ifdef notyet the portions of
kern_uuid.c that are meant to be used by (currently nonexistent) other
things in the kernel. Added syscall to COMPAT_FREEBSD as well, though
that's currently not useful, as any program new enough to use this call
also uses other syscalls we don't (yet) emulate.
 1.52 26-Nov-2003  jdolecek Regen: add new syscalls to the list
 1.51 18-Sep-2003  pooka regen
 1.50 18-Jan-2003  thorpej branches: 1.50.2;
Regen to get correct RCS ID.
 1.49 18-Jan-2003  thorpej Regen: Merge the nathanw_sa branch.
 1.48 22-Dec-2002  gmcgarry Add stubs for scheduler syscalls.
 1.47 09-Oct-2002  pooka regen for rfork
 1.46 03-May-2002  eeh Regen.
 1.45 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.44 27-Oct-2001  jdolecek Regen:
Hook in minherit(2), fhstatfs(2), fhopen(2), fhstat(2).
Adresses kern/8622 by Paul Shupak.
 1.43 30-May-2001  mrg branches: 1.43.2; 1.43.6;
use _KERNEL_OPT.
 1.42 27-Jan-2001  thorpej branches: 1.42.2;
Regen; add sy_flags.
 1.41 17-Dec-2000  jdolecek regen
 1.40 09-Dec-2000  mycroft Regen.
 1.39 09-Dec-2000  mycroft Regen.
 1.38 09-Dec-2000  mycroft Regen.
 1.37 18-Aug-2000  cgd update for changed makesyscalls.master
 1.36 08-Aug-2000  itojun regen
 1.35 07-Aug-2000  bjh21 Second phase of changes to remove ntp_adjtime(2) from the kernel entirely if
NTP is not defined.

Also removes sysctl_ntptime, since that's unreferenced without NTP.

ntp_gettime(2) is left alone, since it doesn't raise SIGSYS, which sys_nosys()
does.
 1.34 18-Jul-2000  onoe implement new signal syscalls in FreeBSD 4.0-RELEASE, using native syscalls:
sigaction, sigprocmask, sigsuspend, and sigpending.
 1.33 23-May-2000  tv branches: 1.33.4;
Add names for many syscalls not yet implemented, including those in
FreeBSD 4.0-RELEASE. Also implement the following using existing NetBSD
syscalls: pread, pwrite, getsid, mlockall, munlockall, __getcwd.
 1.32 21-Apr-2000  minoura Regen.
 1.31 25-Aug-1999  thorpej branches: 1.31.2;
Regen.
 1.30 12-Jul-1999  kleink Regen.
 1.29 09-Jun-1999  drochner regen
 1.28 09-Feb-1999  christos branches: 1.28.4;
Regen
 1.27 10-Dec-1998  christos Regen
 1.26 19-Oct-1998  tron Regen.
 1.25 11-Sep-1998  mycroft Regen.
 1.24 25-Jun-1998  thorpej Regen: defopt NFSSERVER
 1.23 25-Jun-1998  thorpej Regen: defopt KTRACE
 1.22 02-May-1998  christos regen.
 1.21 19-Feb-1998  thorpej Regen: makesyscalls.sh changed.
 1.20 19-Feb-1998  thorpej Regen: syscalls.master and makesyscalls.sh changed.
 1.19 22-Jan-1998  mycroft Regen.
 1.18 22-Jan-1998  mycroft Put a local copy of the SysV IPC compatibility from compat/common in here, so
it's not dependent on COMPAT_10. Also, fix translation of shmctl(), since
FreeBSD's is a little different.
 1.17 09-Jan-1998  thorpej Regen.
 1.16 08-Jan-1998  thorpej Regen: back out RCD ID related changes.
 1.15 05-Jan-1998  perry regened with RCSIDs in place
 1.14 30-Nov-1997  veego Regen.
 1.13 18-Oct-1997  christos branches: 1.13.2;
Regen.
 1.12 16-Oct-1997  christos Regen.
 1.11 16-Oct-1997  mycroft Regen.
 1.10 10-Oct-1997  enami Regen from syscalls.master 1.9.
 1.9 10-Oct-1997  fvdl Regen.
 1.8 13-Jun-1997  thorpej branches: 1.8.4;
Regen: Use compat_12_sys_swapon().
 1.7 31-Jan-1997  thorpej Syscalls.master changed, regen. (NFSCLIENT -> NFS)
 1.6 13-Jan-1997  thorpej branches: 1.6.2;
Regen; makesyscalls.sh emits comments now.
 1.5 20-Sep-1996  christos regen
 1.4 23-Jun-1996  mycroft Catch up with setre[ug]id() changes.
 1.3 10-Oct-1995  mycroft branches: 1.3.4;
Fix minor oversight.
 1.2 10-Oct-1995  mycroft Fix typo.
 1.1 10-Oct-1995  mycroft Output of makesyscalls.sh.
 1.3.4.1 10-Dec-1996  mycroft Regen.
 1.6.2.1 14-Jan-1997  thorpej syscalls.master changed; regen.
 1.8.4.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.13.2.2 30-Sep-1998  cgd regen after pull-up of syscalls.master rev 1.16 from trunk (tv)
 1.13.2.1 29-Jan-1998  mellon Regen
 1.28.4.2 02-Aug-1999  thorpej Regen.
 1.28.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.31.2.3 05-Jan-2001  bouyer Sync with HEAD
 1.31.2.2 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.31.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.33.4.1 06-Mar-2002  he Pull up regenerated files (requested by jonathan):
Add support for FreeBSD 4.x signals; fixes PR#9769.
 1.42.2.7 29-Dec-2002  thorpej Sync with HEAD.
 1.42.2.6 18-Oct-2002  nathanw Catch up to -current.
 1.42.2.5 29-May-2002  nathanw Regen.
 1.42.2.4 28-Feb-2002  nathanw Regen.
 1.42.2.3 14-Nov-2001  nathanw Catch up to -current.
 1.42.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.42.2.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.43.6.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.43.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.43.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.50.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.50.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.50.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.50.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.50.2.1 03-Aug-2004  skrll Sync with HEAD
 1.56.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.56.4.1 29-Apr-2005  kent sync with -current
 1.58.4.4 21-Jan-2008  yamt sync with head
 1.58.4.3 03-Sep-2007  yamt sync with head.
 1.58.4.2 30-Dec-2006  yamt sync with head.
 1.58.4.1 21-Jun-2006  yamt sync with head.
 1.61.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.61.10.1 11-May-2006  elad sync with head
 1.61.8.3 03-Sep-2006  yamt sync with head.
 1.61.8.2 11-Aug-2006  yamt sync with head
 1.61.8.1 24-May-2006  yamt sync with head.
 1.61.6.1 01-Jun-2006  kardel Sync with head.
 1.61.4.1 09-Sep-2006  rpaulo sync with head
 1.62.4.1 13-Jul-2006  gdamore Merge from HEAD.
 1.66.8.1 12-Mar-2007  rmind Sync with HEAD.
 1.67.2.1 15-Jul-2007  ad Sync with head.
 1.68.20.1 02-Jan-2008  bouyer Sync with HEAD
 1.68.16.1 26-Dec-2007  ad Sync with head.
 1.68.8.1 09-Jan-2008  matt sync with HEAD
 1.69.20.1 19-Jan-2009  skrll Sync with HEAD.
 1.69.18.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.69.12.2 11-Mar-2010  yamt sync with head
 1.69.12.1 04-May-2009  yamt sync with head.
 1.69.8.2 20-Nov-2008  christos merge with head.
 1.69.8.1 29-Mar-2008  christos Welcome to the time_t=long long dev_t=uint64_t branch.
 1.69.6.1 17-Jan-2009  mjf Sync with HEAD.
 1.74.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.76.6.1 08-Feb-2011  bouyer Regen: quotactl compat
 1.76.4.1 06-Jun-2011  jruoho Sync with HEAD.
 1.76.2.1 21-Apr-2011  rmind sync with head
 1.77.8.1 11-Mar-2012  mrg sync to latest -current
 1.77.4.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.77.4.1 17-Apr-2012  yamt sync with head
 1.78.4.1 18-May-2014  rmind sync with head
 1.78.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.79.6.1 06-Apr-2015  skrll Sync with HEAD
 1.81.2.1 20-Mar-2017  pgoyette Sync with HEAD
 1.82.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.83.4.1 11-May-2017  pgoyette Sync with HEAD
 1.88.4.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.88.4.1 10-Jun-2019  christos Sync with HEAD
 1.88.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.93 18-Jun-2019  christos regen
 1.92 10-Aug-2018  pgoyette Regen
 1.91 06-Jan-2018  kamil branches: 1.91.2; 1.91.4;
Revert vadvise(2) removal

This system call was used in legacy Lisp code, that was inherited to modern
age and still compiled against supported compat layers (e.g. in clisp,
oaklisp, Franz Lisp).

It used to instruct the kernel about paging policy (G/C aware, flush etc).

Newly compiled code (assuming that it will detect vadvise()) will use the
libc stub for vadvise(). The headers for this interface are gone.

vadvise(2) could be marked as COMPAT_80, but as long as we support ultrix,
sunos or aout68k ABI, don't bother with this.

Requested by <mrg>
 1.90 19-Dec-2017  kamil compat/freebsd: Drop SYS_vadvise

The (o)vadvise syscall is dummy since the beginning of NetBSD.

Sponsored by <The NetBSD Foundation>
 1.89 19-Dec-2017  kamil compat/freebsd: Drop SYS_sbrk

sbrk - change data segment size

This syscall is dummy since the inception of the project.

Sponsored by <The NetBSD Foundation>
 1.88 19-Dec-2017  kamil compat freebsd: Drop the sstk(2) syscall

sstk(2) has never been implemented by the NetBSD kernel.

Sponsored by <The NetBSD Foundation>
 1.87 10-May-2017  riastradh regen
 1.86 16-Jan-2017  christos branches: 1.86.4;
regen
 1.85 13-Jan-2017  christos branches: 1.85.2;
regen
 1.84 24-Sep-2015  christos branches: 1.84.2;
Regen
 1.83 07-Mar-2015  christos regen
 1.82 07-Nov-2013  njoly branches: 1.82.6;
Regen for dup/dup2/dup3 argument types fix.
 1.81 10-Mar-2012  joerg branches: 1.81.2; 1.81.4;
P1003_1B_SEMAPHORE is no longer optional.
 1.80 06-Mar-2011  bouyer branches: 1.80.4; 1.80.8;
merge the bouyer-quota2 branch. This adds a new on-disk format
to store disk quota usage and limits, integrated with ffs
metadata. Usage is checked by fsck_ffs (no more quotacheck)
and is covered by the WAPBL journal. Enabled with kernel
option QUOTA2 (added where QUOTA was enabled in kernel config files),
turned on with tunefs(8) on a per-filesystem
basis. mount_mfs(8) can also turn quotas on.

See http://mail-index.netbsd.org/tech-kern/2011/02/19/msg010025.html
for details.
 1.79 02-Mar-2010  pooka branches: 1.79.2; 1.79.4; 1.79.6;
regen:
- remove nfssvc / fs_nfs.h / #ifdef NFS
- make getfh unconditional
 1.78 02-Mar-2010  pooka regen for conditional lfs syscall removal
 1.77 14-Dec-2009  matt branches: 1.77.2;
Regen (new makesyscalls.sh)
 1.76 13-Jan-2009  pooka Regen to prove I didn't screw up the conversion: purely RCSID changes.
 1.75 11-Jan-2009  christos merge christos-time_t
 1.74 19-Nov-2008  ad Regen.
 1.73 14-Nov-2008  ad Regen.
 1.72 20-Dec-2007  dsl branches: 1.72.6; 1.72.8; 1.72.12; 1.72.18; 1.72.20;
regen
 1.71 13-Jul-2007  dsl branches: 1.71.8; 1.71.16; 1.71.20;
Update generated files.
 1.70 04-Mar-2007  christos branches: 1.70.2;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.69 01-Sep-2006  matt branches: 1.69.8;
Regen.
 1.68 30-Aug-2006  matt Regen (for PTRACE).
 1.67 31-Jul-2006  martin Make filehandles opaque to userland
 1.66 26-Jun-2006  mrg regenerate.
 1.65 14-May-2006  elad branches: 1.65.4;
integrate kauth.
 1.64 04-May-2006  christos Regen
 1.63 11-Dec-2005  christos branches: 1.63.4; 1.63.6; 1.63.8; 1.63.10; 1.63.12;
merge ktrace-lwp.
 1.62 13-Sep-2005  christos compat code reorg.
 1.61 19-Aug-2005  christos 64 bit inode changes.
 1.60 26-Feb-2005  perry branches: 1.60.4;
regen
 1.59 22-Feb-2005  heas Re-gen for sysctl emulation
 1.58 11-May-2004  drochner branches: 1.58.4; 1.58.6;
regen
 1.57 10-May-2004  jonathan Regen src/sys/compat/freebsd_sys{call.h,callargs.h,calls.c,ent.c} from
syscalls.master rev 1.45, with COMPAT_2.0 fix.
 1.56 21-Apr-2004  christos Replace the statfs() family of system calls with statvfs().
Retain binary compatibility.
 1.55 29-Jan-2004  tsarna uuidgen(2) syscall. Originally from FreeBSD, ported by John Franklin in
PR#23470, with minor updates by me. This is only the syscall support
from that PR, for now.

Changes: port over fix from FreeBSD for multicast address generation.
Changed bcopy to memcpy. For now, #ifdef notyet the portions of
kern_uuid.c that are meant to be used by (currently nonexistent) other
things in the kernel. Added syscall to COMPAT_FREEBSD as well, though
that's currently not useful, as any program new enough to use this call
also uses other syscalls we don't (yet) emulate.
 1.54 26-Nov-2003  jdolecek Regen: add new syscalls to the list
 1.53 18-Sep-2003  pooka regen
 1.52 18-Jan-2003  thorpej branches: 1.52.2;
Regen to get correct RCS ID.
 1.51 18-Jan-2003  thorpej Regen: Merge the nathanw_sa branch.
 1.50 22-Dec-2002  gmcgarry Add stubs for scheduler syscalls.
 1.49 09-Oct-2002  pooka regen for rfork
 1.48 03-May-2002  eeh Regen.
 1.47 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.46 27-Oct-2001  jdolecek Regen:
Hook in minherit(2), fhstatfs(2), fhopen(2), fhstat(2).
Adresses kern/8622 by Paul Shupak.
 1.45 30-May-2001  mrg branches: 1.45.2; 1.45.6;
use _KERNEL_OPT.
 1.44 27-Jan-2001  thorpej branches: 1.44.2;
Regen; add sy_flags.
 1.43 17-Dec-2000  jdolecek regen
 1.42 09-Dec-2000  mycroft Regen.
 1.41 09-Dec-2000  mycroft Regen.
 1.40 09-Dec-2000  mycroft Regen.
 1.39 18-Aug-2000  cgd update for changed makesyscalls.master
 1.38 18-Aug-2000  cgd update for changed makesyscalls.sh
 1.37 08-Aug-2000  itojun regen
 1.36 08-Aug-2000  itojun s/#ifdefined/#ifdef/
 1.35 07-Aug-2000  bjh21 Second phase of changes to remove ntp_adjtime(2) from the kernel entirely if
NTP is not defined.

Also removes sysctl_ntptime, since that's unreferenced without NTP.

ntp_gettime(2) is left alone, since it doesn't raise SIGSYS, which sys_nosys()
does.
 1.34 18-Jul-2000  onoe implement new signal syscalls in FreeBSD 4.0-RELEASE, using native syscalls:
sigaction, sigprocmask, sigsuspend, and sigpending.
 1.33 23-May-2000  tv branches: 1.33.4;
Add names for many syscalls not yet implemented, including those in
FreeBSD 4.0-RELEASE. Also implement the following using existing NetBSD
syscalls: pread, pwrite, getsid, mlockall, munlockall, __getcwd.
 1.32 21-Apr-2000  minoura Regen.
 1.31 25-Aug-1999  thorpej branches: 1.31.2;
Regen.
 1.30 12-Jul-1999  kleink Regen.
 1.29 09-Jun-1999  drochner regen
 1.28 09-Feb-1999  christos branches: 1.28.4;
Regen
 1.27 10-Dec-1998  christos Regen
 1.26 19-Oct-1998  tron Regen.
 1.25 03-Oct-1998  eeh Fix big-endian syscall args.
 1.24 11-Sep-1998  mycroft Regen.
 1.23 25-Jun-1998  thorpej Regen: defopt NFSSERVER
 1.22 25-Jun-1998  thorpej Regen: defopt KTRACE
 1.21 02-May-1998  christos regen.
 1.20 19-Feb-1998  thorpej Regen: makesyscalls.sh changed.
 1.19 19-Feb-1998  thorpej Regen: syscalls.master and makesyscalls.sh changed.
 1.18 22-Jan-1998  mycroft Regen.
 1.17 22-Jan-1998  mycroft Put a local copy of the SysV IPC compatibility from compat/common in here, so
it's not dependent on COMPAT_10. Also, fix translation of shmctl(), since
FreeBSD's is a little different.
 1.16 09-Jan-1998  thorpej Regen.
 1.15 08-Jan-1998  thorpej Regen: back out RCD ID related changes.
 1.14 05-Jan-1998  perry regened with RCSIDs in place
 1.13 30-Nov-1997  veego Regen.
 1.12 18-Oct-1997  christos branches: 1.12.2;
Regen.
 1.11 16-Oct-1997  christos Regen.
 1.10 16-Oct-1997  mycroft Regen.
 1.9 10-Oct-1997  enami Regen from syscalls.master 1.9.
 1.8 10-Oct-1997  fvdl Regen.
 1.7 13-Jun-1997  thorpej branches: 1.7.4;
Regen: Use compat_12_sys_swapon().
 1.6 31-Jan-1997  thorpej branches: 1.6.2;
Syscalls.master changed, regen. (NFSCLIENT -> NFS)
 1.5 20-Sep-1996  christos branches: 1.5.2;
regen
 1.4 23-Jun-1996  mycroft Catch up with setre[ug]id() changes.
 1.3 10-Oct-1995  mycroft branches: 1.3.4;
Fix minor oversight.
 1.2 10-Oct-1995  mycroft branches: 1.2.2;
Fix typo.
 1.1 10-Oct-1995  mycroft Output of makesyscalls.sh.
 1.2.2.1 20-Oct-1995  pk getppid => sys_getppid; re-ran makesyscalls.sh. (PR#1643).
 1.3.4.1 10-Dec-1996  mycroft Regen.
 1.5.2.2 14-Jan-1997  thorpej syscalls.master changed; regen.
 1.5.2.1 14-Jan-1997  thorpej Snapshot of work-in-progress, committed to private branch.

These changes implement machine-independent root device and file system
selection. Notable features:

- All ports behave in a consistent manner regarding root
device selection.
- No more "options GENERIC"; all kernels have the ability
to boot with RB_ASKNAME to select root device and file system
type.
- Root file system type can be wildcarded; a machine-independent
function will try all possible file systems for the selected
root device until one succeeds.
- If the root file system fails to mount, the operator will
be given the chance to select a new root device and file
system type, rather than having the machine simply panic.
- nfs_mountroot() no longer panics if any part of the NFS
mount process fails; it now returns an error, giving the
operator a chance to recover.
- New, more consistent, config(8) grammar. The constructs:

config netbsd swap generic
config netbsd root on nfs

have been replaced with:

config netbsd root on ? type ?
config netbsd root on ? type nfs

Additionally, the operator may select or wildcard root file
system type in the kernel configuration file:

config netbsd root on cd0a type cd9660

config(8) now requires that a "root" specification be
made. "root" may be wired down or wildcarded. "swap" and
"dump" specifications are optional, and follow previous
semantics.

- config(8) has a new "file-system" keyword, used to configure
file systems into the kernel. Eventually, this will be used
to generate the default vfssw[].

- "options NFSCLIENT" is obsolete, and is replaced by
"file-system NFS". "options NFSSERVER" still exists, since
NFS server support is independent of the NFS file system
client.

- sys/arch/<foo>/<foo>/swapgeneric.c is no longer used, and
will be removed; all information is now generated by config(8).

As of this commit, all ports except arm32 have been updated to use
the new setroot(). Only SPARC, i386, and Alpha ports have been
tested at this time. Port masters should test these changes on their
ports, and report any problems back to me.

More changes are on their way, including RB_ASKNAME support in
nfs_mountroot() (to prompt for server address and path) and, potentially,
the ability to select rarp/bootparam or bootp in nfs_mountroot().
 1.6.2.1 14-Feb-1997  mrg regen.
 1.7.4.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.12.2.2 30-Sep-1998  cgd regen after pull-up of syscalls.master rev 1.16 from trunk (tv)
 1.12.2.1 29-Jan-1998  mellon Regen
 1.28.4.2 02-Aug-1999  thorpej Regen.
 1.28.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.31.2.3 05-Jan-2001  bouyer Sync with HEAD
 1.31.2.2 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.31.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.33.4.1 06-Mar-2002  he Pull up regenerated files (requested by jonathan):
Add support for FreeBSD 4.x signals; fixes PR#9769.
 1.44.2.8 29-Dec-2002  thorpej Sync with HEAD.
 1.44.2.7 18-Oct-2002  nathanw Catch up to -current.
 1.44.2.6 20-Jun-2002  nathanw Catch up to -current.
 1.44.2.5 29-May-2002  nathanw Regen.
 1.44.2.4 28-Feb-2002  nathanw Regen.
 1.44.2.3 14-Nov-2001  nathanw Catch up to -current.
 1.44.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.44.2.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.45.6.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.45.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.45.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.52.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.52.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.52.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.52.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.52.2.1 03-Aug-2004  skrll Sync with HEAD
 1.58.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.58.4.1 29-Apr-2005  kent sync with -current
 1.60.4.4 21-Jan-2008  yamt sync with head
 1.60.4.3 03-Sep-2007  yamt sync with head.
 1.60.4.2 30-Dec-2006  yamt sync with head.
 1.60.4.1 21-Jun-2006  yamt sync with head.
 1.63.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.63.10.1 11-May-2006  elad sync with head
 1.63.8.3 03-Sep-2006  yamt sync with head.
 1.63.8.2 11-Aug-2006  yamt sync with head
 1.63.8.1 24-May-2006  yamt sync with head.
 1.63.6.1 01-Jun-2006  kardel Sync with head.
 1.63.4.1 09-Sep-2006  rpaulo sync with head
 1.65.4.1 13-Jul-2006  gdamore Merge from HEAD.
 1.69.8.1 12-Mar-2007  rmind Sync with HEAD.
 1.70.2.1 15-Jul-2007  ad Sync with head.
 1.71.20.1 02-Jan-2008  bouyer Sync with HEAD
 1.71.16.1 26-Dec-2007  ad Sync with head.
 1.71.8.1 09-Jan-2008  matt sync with HEAD
 1.72.20.1 19-Jan-2009  skrll Sync with HEAD.
 1.72.18.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.72.12.2 11-Mar-2010  yamt sync with head
 1.72.12.1 04-May-2009  yamt sync with head.
 1.72.8.2 20-Nov-2008  christos merge with head.
 1.72.8.1 29-Mar-2008  christos Welcome to the time_t=long long dev_t=uint64_t branch.
 1.72.6.1 17-Jan-2009  mjf Sync with HEAD.
 1.77.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.79.6.1 08-Feb-2011  bouyer Regen: quotactl compat
 1.79.4.1 06-Jun-2011  jruoho Sync with HEAD.
 1.79.2.1 21-Apr-2011  rmind sync with head
 1.80.8.1 11-Mar-2012  mrg sync to latest -current
 1.80.4.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.80.4.1 17-Apr-2012  yamt sync with head
 1.81.4.1 18-May-2014  rmind sync with head
 1.81.2.2 03-Dec-2017  jdolecek update from HEAD
 1.81.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.82.6.2 28-Aug-2017  skrll Sync with HEAD
 1.82.6.1 06-Apr-2015  skrll Sync with HEAD
 1.84.2.1 20-Mar-2017  pgoyette Sync with HEAD
 1.85.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.86.4.1 11-May-2017  pgoyette Sync with HEAD
 1.91.4.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.91.4.1 10-Jun-2019  christos Sync with HEAD
 1.91.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.91 18-Jun-2019  christos regen
 1.90 10-Aug-2018  pgoyette Regen
 1.89 06-Jan-2018  kamil branches: 1.89.2; 1.89.4;
Revert vadvise(2) removal

This system call was used in legacy Lisp code, that was inherited to modern
age and still compiled against supported compat layers (e.g. in clisp,
oaklisp, Franz Lisp).

It used to instruct the kernel about paging policy (G/C aware, flush etc).

Newly compiled code (assuming that it will detect vadvise()) will use the
libc stub for vadvise(). The headers for this interface are gone.

vadvise(2) could be marked as COMPAT_80, but as long as we support ultrix,
sunos or aout68k ABI, don't bother with this.

Requested by <mrg>
 1.88 19-Dec-2017  kamil compat/freebsd: Drop SYS_vadvise

The (o)vadvise syscall is dummy since the beginning of NetBSD.

Sponsored by <The NetBSD Foundation>
 1.87 19-Dec-2017  kamil compat/freebsd: Drop SYS_sbrk

sbrk - change data segment size

This syscall is dummy since the inception of the project.

Sponsored by <The NetBSD Foundation>
 1.86 19-Dec-2017  kamil compat freebsd: Drop the sstk(2) syscall

sstk(2) has never been implemented by the NetBSD kernel.

Sponsored by <The NetBSD Foundation>
 1.85 08-Aug-2017  maxv Move freebsd_machdep.h into sys/compat/freebsd, and don't install it. Now,
the compat_freebsd files are all contained in sys/compat/freebsd.
 1.84 10-May-2017  riastradh regen
 1.83 16-Jan-2017  christos branches: 1.83.4;
regen
 1.82 13-Jan-2017  christos branches: 1.82.2;
regen
 1.81 24-Sep-2015  christos branches: 1.81.2;
Regen
 1.80 07-Mar-2015  christos regen
 1.79 07-Nov-2013  njoly branches: 1.79.6;
Regen for dup/dup2/dup3 argument types fix.
 1.78 10-Mar-2012  joerg branches: 1.78.2; 1.78.4;
P1003_1B_SEMAPHORE is no longer optional.
 1.77 06-Mar-2011  bouyer branches: 1.77.4; 1.77.8;
merge the bouyer-quota2 branch. This adds a new on-disk format
to store disk quota usage and limits, integrated with ffs
metadata. Usage is checked by fsck_ffs (no more quotacheck)
and is covered by the WAPBL journal. Enabled with kernel
option QUOTA2 (added where QUOTA was enabled in kernel config files),
turned on with tunefs(8) on a per-filesystem
basis. mount_mfs(8) can also turn quotas on.

See http://mail-index.netbsd.org/tech-kern/2011/02/19/msg010025.html
for details.
 1.76 02-Mar-2010  pooka branches: 1.76.2; 1.76.4; 1.76.6;
regen:
- remove nfssvc / fs_nfs.h / #ifdef NFS
- make getfh unconditional
 1.75 02-Mar-2010  pooka regen for conditional lfs syscall removal
 1.74 14-Dec-2009  matt branches: 1.74.2;
Regen (new makesyscalls.sh)
 1.73 13-Jan-2009  pooka Regen to prove I didn't screw up the conversion: purely RCSID changes.
 1.72 11-Jan-2009  christos merge christos-time_t
 1.71 19-Nov-2008  ad Regen.
 1.70 14-Nov-2008  ad Regen.
 1.69 20-Dec-2007  dsl branches: 1.69.6; 1.69.8; 1.69.12; 1.69.18; 1.69.20;
regen
 1.68 13-Jul-2007  dsl branches: 1.68.8; 1.68.16; 1.68.20;
Update generated files.
 1.67 09-Feb-2007  ad branches: 1.67.6;
Merge newlock2 to head.
 1.66 01-Sep-2006  matt branches: 1.66.2;
Regen.
 1.65 30-Aug-2006  matt Regen (for PTRACE).
 1.64 31-Jul-2006  martin Make filehandles opaque to userland
 1.63 26-Jun-2006  mrg regenerate.
 1.62 04-May-2006  christos branches: 1.62.4;
Regen
 1.61 11-Dec-2005  christos branches: 1.61.4; 1.61.6; 1.61.8; 1.61.10; 1.61.12;
merge ktrace-lwp.
 1.60 13-Sep-2005  christos compat code reorg.
 1.59 19-Aug-2005  christos 64 bit inode changes.
 1.58 26-Feb-2005  perry branches: 1.58.4;
regen
 1.57 22-Feb-2005  heas Re-gen for sysctl emulation
 1.56 11-May-2004  drochner branches: 1.56.4; 1.56.6;
regen
 1.55 10-May-2004  jonathan Regen src/sys/compat/freebsd_sys{call.h,callargs.h,calls.c,ent.c} from
syscalls.master rev 1.45, with COMPAT_2.0 fix.
 1.54 21-Apr-2004  christos Replace the statfs() family of system calls with statvfs().
Retain binary compatibility.
 1.53 29-Jan-2004  tsarna uuidgen(2) syscall. Originally from FreeBSD, ported by John Franklin in
PR#23470, with minor updates by me. This is only the syscall support
from that PR, for now.

Changes: port over fix from FreeBSD for multicast address generation.
Changed bcopy to memcpy. For now, #ifdef notyet the portions of
kern_uuid.c that are meant to be used by (currently nonexistent) other
things in the kernel. Added syscall to COMPAT_FREEBSD as well, though
that's currently not useful, as any program new enough to use this call
also uses other syscalls we don't (yet) emulate.
 1.52 26-Nov-2003  jdolecek Regen: add new syscalls to the list
 1.51 18-Sep-2003  pooka regen
 1.50 18-Jan-2003  thorpej branches: 1.50.2;
Regen to get correct RCS ID.
 1.49 18-Jan-2003  thorpej Regen: Merge the nathanw_sa branch.
 1.48 22-Dec-2002  gmcgarry Add stubs for scheduler syscalls.
 1.47 09-Oct-2002  pooka regen for rfork
 1.46 03-May-2002  eeh Regen.
 1.45 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.44 27-Oct-2001  jdolecek Regen:
Hook in minherit(2), fhstatfs(2), fhopen(2), fhstat(2).
Adresses kern/8622 by Paul Shupak.
 1.43 30-May-2001  mrg branches: 1.43.2; 1.43.6;
use _KERNEL_OPT.
 1.42 27-Jan-2001  thorpej branches: 1.42.2;
Regen; add sy_flags.
 1.41 17-Dec-2000  jdolecek regen
 1.40 09-Dec-2000  mycroft Regen.
 1.39 09-Dec-2000  mycroft Regen.
 1.38 09-Dec-2000  mycroft Regen.
 1.37 13-Nov-2000  jdolecek change the type of *syscallnames[] array to 'const char * const foo[]'
 1.36 18-Aug-2000  cgd update for changed makesyscalls.master
 1.35 08-Aug-2000  itojun regen
 1.34 07-Aug-2000  bjh21 Second phase of changes to remove ntp_adjtime(2) from the kernel entirely if
NTP is not defined.

Also removes sysctl_ntptime, since that's unreferenced without NTP.

ntp_gettime(2) is left alone, since it doesn't raise SIGSYS, which sys_nosys()
does.
 1.33 18-Jul-2000  onoe implement new signal syscalls in FreeBSD 4.0-RELEASE, using native syscalls:
sigaction, sigprocmask, sigsuspend, and sigpending.
 1.32 23-May-2000  tv branches: 1.32.4;
Add names for many syscalls not yet implemented, including those in
FreeBSD 4.0-RELEASE. Also implement the following using existing NetBSD
syscalls: pread, pwrite, getsid, mlockall, munlockall, __getcwd.
 1.31 21-Apr-2000  minoura Regen.
 1.30 25-Aug-1999  thorpej branches: 1.30.2;
Regen.
 1.29 12-Jul-1999  kleink Regen.
 1.28 09-Jun-1999  drochner regen
 1.27 09-Feb-1999  christos branches: 1.27.4;
Regen
 1.26 10-Dec-1998  christos Regen
 1.25 19-Oct-1998  tron Regen.
 1.24 11-Sep-1998  mycroft Regen.
 1.23 25-Jun-1998  thorpej Regen: defopt NFSSERVER
 1.22 25-Jun-1998  thorpej Regen: defopt KTRACE
 1.21 02-May-1998  christos regen.
 1.20 19-Feb-1998  thorpej Regen: makesyscalls.sh changed.
 1.19 19-Feb-1998  thorpej Regen: syscalls.master and makesyscalls.sh changed.
 1.18 22-Jan-1998  mycroft Regen.
 1.17 22-Jan-1998  mycroft Put a local copy of the SysV IPC compatibility from compat/common in here, so
it's not dependent on COMPAT_10. Also, fix translation of shmctl(), since
FreeBSD's is a little different.
 1.16 09-Jan-1998  thorpej Regen.
 1.15 08-Jan-1998  thorpej Regen: back out RCD ID related changes.
 1.14 05-Jan-1998  perry regened with RCSIDs in place
 1.13 30-Nov-1997  veego Regen.
 1.12 18-Oct-1997  christos branches: 1.12.2;
Regen.
 1.11 16-Oct-1997  christos Regen.
 1.10 16-Oct-1997  mycroft Regen.
 1.9 10-Oct-1997  enami Regen from syscalls.master 1.9.
 1.8 10-Oct-1997  fvdl Regen.
 1.7 13-Jun-1997  thorpej branches: 1.7.4;
Regen: Use compat_12_sys_swapon().
 1.6 31-Jan-1997  thorpej Syscalls.master changed, regen. (NFSCLIENT -> NFS)
 1.5 20-Sep-1996  christos branches: 1.5.2;
regen
 1.4 23-Jun-1996  mycroft Catch up with setre[ug]id() changes.
 1.3 10-Oct-1995  mycroft branches: 1.3.4;
Fix minor oversight.
 1.2 10-Oct-1995  mycroft Fix typo.
 1.1 10-Oct-1995  mycroft Output of makesyscalls.sh.
 1.3.4.1 10-Dec-1996  mycroft Regen.
 1.5.2.2 14-Jan-1997  thorpej syscalls.master changed; regen.
 1.5.2.1 14-Jan-1997  thorpej Snapshot of work-in-progress, committed to private branch.

These changes implement machine-independent root device and file system
selection. Notable features:

- All ports behave in a consistent manner regarding root
device selection.
- No more "options GENERIC"; all kernels have the ability
to boot with RB_ASKNAME to select root device and file system
type.
- Root file system type can be wildcarded; a machine-independent
function will try all possible file systems for the selected
root device until one succeeds.
- If the root file system fails to mount, the operator will
be given the chance to select a new root device and file
system type, rather than having the machine simply panic.
- nfs_mountroot() no longer panics if any part of the NFS
mount process fails; it now returns an error, giving the
operator a chance to recover.
- New, more consistent, config(8) grammar. The constructs:

config netbsd swap generic
config netbsd root on nfs

have been replaced with:

config netbsd root on ? type ?
config netbsd root on ? type nfs

Additionally, the operator may select or wildcard root file
system type in the kernel configuration file:

config netbsd root on cd0a type cd9660

config(8) now requires that a "root" specification be
made. "root" may be wired down or wildcarded. "swap" and
"dump" specifications are optional, and follow previous
semantics.

- config(8) has a new "file-system" keyword, used to configure
file systems into the kernel. Eventually, this will be used
to generate the default vfssw[].

- "options NFSCLIENT" is obsolete, and is replaced by
"file-system NFS". "options NFSSERVER" still exists, since
NFS server support is independent of the NFS file system
client.

- sys/arch/<foo>/<foo>/swapgeneric.c is no longer used, and
will be removed; all information is now generated by config(8).

As of this commit, all ports except arm32 have been updated to use
the new setroot(). Only SPARC, i386, and Alpha ports have been
tested at this time. Port masters should test these changes on their
ports, and report any problems back to me.

More changes are on their way, including RB_ASKNAME support in
nfs_mountroot() (to prompt for server address and path) and, potentially,
the ability to select rarp/bootparam or bootp in nfs_mountroot().
 1.7.4.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.12.2.2 30-Sep-1998  cgd regen after pull-up of syscalls.master rev 1.16 from trunk (tv)
 1.12.2.1 29-Jan-1998  mellon Regen
 1.27.4.2 02-Aug-1999  thorpej Regen.
 1.27.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.30.2.4 05-Jan-2001  bouyer Sync with HEAD
 1.30.2.3 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.30.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.30.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.32.4.1 06-Mar-2002  he Pull up regenerated files (requested by jonathan):
Add support for FreeBSD 4.x signals; fixes PR#9769.
 1.42.2.8 29-Dec-2002  thorpej Sync with HEAD.
 1.42.2.7 18-Oct-2002  nathanw Catch up to -current.
 1.42.2.6 20-Jun-2002  nathanw Catch up to -current.
 1.42.2.5 29-May-2002  nathanw Regen.
 1.42.2.4 28-Feb-2002  nathanw Regen.
 1.42.2.3 14-Nov-2001  nathanw Catch up to -current.
 1.42.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.42.2.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.43.6.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.43.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.43.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.50.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.50.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.50.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.50.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.50.2.1 03-Aug-2004  skrll Sync with HEAD
 1.56.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.56.4.1 29-Apr-2005  kent sync with -current
 1.58.4.5 21-Jan-2008  yamt sync with head
 1.58.4.4 03-Sep-2007  yamt sync with head.
 1.58.4.3 26-Feb-2007  yamt sync with head.
 1.58.4.2 30-Dec-2006  yamt sync with head.
 1.58.4.1 21-Jun-2006  yamt sync with head.
 1.61.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.61.10.1 11-May-2006  elad sync with head
 1.61.8.3 03-Sep-2006  yamt sync with head.
 1.61.8.2 11-Aug-2006  yamt sync with head
 1.61.8.1 24-May-2006  yamt sync with head.
 1.61.6.1 01-Jun-2006  kardel Sync with head.
 1.61.4.1 09-Sep-2006  rpaulo sync with head
 1.62.4.1 13-Jul-2006  gdamore Merge from HEAD.
 1.66.2.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.67.6.1 15-Jul-2007  ad Sync with head.
 1.68.20.1 02-Jan-2008  bouyer Sync with HEAD
 1.68.16.1 26-Dec-2007  ad Sync with head.
 1.68.8.1 09-Jan-2008  matt sync with HEAD
 1.69.20.1 19-Jan-2009  skrll Sync with HEAD.
 1.69.18.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.69.12.2 11-Mar-2010  yamt sync with head
 1.69.12.1 04-May-2009  yamt sync with head.
 1.69.8.2 20-Nov-2008  christos merge with head.
 1.69.8.1 29-Mar-2008  christos Welcome to the time_t=long long dev_t=uint64_t branch.
 1.69.6.1 17-Jan-2009  mjf Sync with HEAD.
 1.74.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.76.6.1 08-Feb-2011  bouyer Regen: quotactl compat
 1.76.4.1 06-Jun-2011  jruoho Sync with HEAD.
 1.76.2.1 21-Apr-2011  rmind sync with head
 1.77.8.1 11-Mar-2012  mrg sync to latest -current
 1.77.4.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.77.4.1 17-Apr-2012  yamt sync with head
 1.78.4.1 18-May-2014  rmind sync with head
 1.78.2.2 03-Dec-2017  jdolecek update from HEAD
 1.78.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.79.6.3 28-Aug-2017  skrll Sync with HEAD
 1.79.6.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.79.6.1 06-Apr-2015  skrll Sync with HEAD
 1.81.2.1 20-Mar-2017  pgoyette Sync with HEAD
 1.82.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.83.4.1 11-May-2017  pgoyette Sync with HEAD
 1.89.4.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.89.4.1 10-Jun-2019  christos Sync with HEAD
 1.89.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.19 14-Feb-2015  dholland typo in comment
 1.18 18-Oct-2014  snj branches: 1.18.2;
src is too big these days to tolerate superfluous apostrophes. It's
"its", people!
 1.17 10-Oct-2014  maxv I'm not sure reading from an unsanitized userland pointer is a good idea.
Some users might be tempted to give 0x01, in which case the kernel will
crash.
 1.16 25-Feb-2014  pooka branches: 1.16.4;
Ensure that the top level sysctl nodes (kern, vfs, net, ...) exist before
the sysctl link sets are processed, and remove redundancy.

Shaves >13kB off of an amd64 GENERIC, not to mention >1k duplicate
lines of code.
 1.15 19-Nov-2008  ad branches: 1.15.16; 1.15.22; 1.15.26; 1.15.28; 1.15.30; 1.15.36;
Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.14 28-Apr-2008  martin branches: 1.14.2; 1.14.6; 1.14.8; 1.14.10; 1.14.16; 1.14.20;
Remove clause 3 and 4 from TNF licenses
 1.13 22-Apr-2008  ad branches: 1.13.2;
Repair copyright.
 1.12 07-Jan-2008  ad branches: 1.12.6; 1.12.8;
Patch up sysctl locking:

- Lock processes, credentials, filehead etc correctly.
- Acquire a read hold on sysctl_treelock if only doing a query.
- Don't wire down the output buffer. It doesn't work correctly and the code
regularly does long term sleeps with it held - it's not worth it.
- Don't hold locks other than sysctl_lock while doing copyout().
- Drop sysctl_lock while doing copyout / allocating memory in a few places.
- Don't take kernel_lock for sysctl.
- Fix a number of bugs spotted along the way
 1.11 20-Dec-2007  dsl Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.10 08-Dec-2007  dsl branches: 1.10.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.9 15-Aug-2007  ad branches: 1.9.2; 1.9.8; 1.9.10;
Changes to make ktrace LKM friendly and reduce ifdef KTRACE. Proposed
on tech-kern.
 1.8 09-Feb-2007  ad branches: 1.8.6; 1.8.14; 1.8.18;
Merge newlock2 to head.
 1.7 24-Sep-2006  dbj use _KERNEL_OPT instead of _LKM to check whether to include "opt_ktrace.h"
 1.6 24-Sep-2006  dogcow opt_ktrace.h doesn't exist when building LKMs.
 1.5 23-Sep-2006  manu Add sysctl tracing to emulations.
While we are there, fix a bug in FreeBSD sysctl emulation: use copyin for
moving data to the kernel
 1.4 11-Dec-2005  christos branches: 1.4.20; 1.4.22;
merge ktrace-lwp.
 1.3 02-Sep-2005  rpaulo Add a SYSCTL_SETUP_PROTO() so that it compiles fine in the lkm.
 1.2 26-Feb-2005  perry branches: 1.2.2; 1.2.4; 1.2.6; 1.2.8; 1.2.10;
nuke trailing whitespace
 1.1 22-Feb-2005  heas Add FreeBSD sysctl emulation for their undocumented special OIDs rooted at
OID 0. Only OID 0.3 is implemented for now, it 0.3 is the equivalent of
NetBSD's sysctlgetmibinfo().
This includes a new sysctl kern.osreldate with the value __NetBSD_Version__
for kernels with COMPAT_FREEBSD.

Both of these are used by 3ware's FreeBSD tw_cli, which seems to work now.
 1.2.10.5 21-Jan-2008  yamt sync with head
 1.2.10.4 03-Sep-2007  yamt sync with head.
 1.2.10.3 26-Feb-2007  yamt sync with head.
 1.2.10.2 30-Dec-2006  yamt sync with head.
 1.2.10.1 21-Jun-2006  yamt sync with head.
 1.2.8.2 29-Apr-2005  kent sync with -current
 1.2.8.1 26-Feb-2005  kent file freebsd_sysctl.c was added on branch kent-audio2 on 2005-04-29 11:28:31 +0000
 1.2.6.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.2.6.1 26-Feb-2005  yamt file freebsd_sysctl.c was added on branch yamt-km on 2005-03-19 08:33:31 +0000
 1.2.4.2 11-Nov-2006  bouyer Pull up following revision(s) (requested by manu in ticket #1528):
etc/MAKEDEV.tmpl: revision 1.66 via patch
sys/conf/majors: revision 1.30 via patch
sys/dev/pci/twareg.h: revision 1.6 via patch
sys/dev/pci/twa.c: revision 1.13 via patch
sys/dev/pci/twaio.h: revision 1.4 via patch
sys/compat/freebsd/freebsd_sysctl.c: revision 1.5 via patch
Tweak the twa(4) driver so that 3ware command line utility works with
it.
This includes:
- fixing various structure definitions so that the ioctl parameter match
- adding a hw.twa*.driver_version sysctl
- do not refuse multiple device openings, as the management tool will do
it.
I'm not sure we are safe. FreeBSD allows multiple openings, and use
the
open flag only when an attempt to detach the device is done.
Fix a bug in FreeBSD sysctl emulation: use copyin for
moving data to the kernel
 1.2.4.1 13-Sep-2005  tron Pull up following revision(s) (requested by rpaulo in ticket #764):
sys/compat/freebsd/freebsd_sysctl.c: revision 1.3
Add a SYSCTL_SETUP_PROTO() so that it compiles fine in the lkm.
 1.2.2.3 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.2.2.2 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.2.2.1 26-Feb-2005  skrll file freebsd_sysctl.c was added on branch ktrace-lwp on 2005-03-04 16:39:35 +0000
 1.4.22.1 22-Oct-2006  yamt sync with head
 1.4.20.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.4.20.1 18-Nov-2006  ad Sync with head.
 1.8.18.2 09-Dec-2007  jmcneill Sync with HEAD.
 1.8.18.1 16-Aug-2007  jmcneill Sync with HEAD.
 1.8.14.1 03-Sep-2007  skrll Sync with HEAD.
 1.8.6.1 20-Aug-2007  ad Sync with HEAD.
 1.9.10.1 26-Dec-2007  ad Sync with head.
 1.9.8.1 18-Feb-2008  mjf Sync with HEAD.
 1.9.2.1 09-Jan-2008  matt sync with HEAD
 1.10.4.2 08-Jan-2008  bouyer Sync with HEAD
 1.10.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.12.8.1 18-May-2008  yamt sync with head.
 1.12.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.12.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.13.2.2 04-May-2009  yamt sync with head.
 1.13.2.1 16-May-2008  yamt sync with head.
 1.14.20.1 27-Oct-2014  msaitoh Pull up following revision(s) (requested by maxv in ticket #1926):
sys/compat/freebsd/freebsd_sysctl.c: revision 1.17
I'm not sure reading from an unsanitized userland pointer is a good idea.
Some users might be tempted to give 0x01, in which case the kernel will
crash.
 1.14.16.1 27-Oct-2014  msaitoh Pull up following revision(s) (requested by maxv in ticket #1926):
sys/compat/freebsd/freebsd_sysctl.c: revision 1.17
I'm not sure reading from an unsanitized userland pointer is a good idea.
Some users might be tempted to give 0x01, in which case the kernel will
crash.
 1.14.10.1 27-Oct-2014  msaitoh Pull up following revision(s) (requested by maxv in ticket #1926):
sys/compat/freebsd/freebsd_sysctl.c: revision 1.17
I'm not sure reading from an unsanitized userland pointer is a good idea.
Some users might be tempted to give 0x01, in which case the kernel will
crash.
 1.14.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.14.6.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.14.2.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.14.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.15.36.1 19-Oct-2014  snj Pull up following revision(s) (requested by maxv in ticket #1168):
sys/compat/freebsd/freebsd_sysctl.c: revision 1.17
I'm not sure reading from an unsanitized userland pointer is a good idea.
Some users might be tempted to give 0x01, in which case the kernel will
crash.
 1.15.30.1 18-May-2014  rmind sync with head
 1.15.28.1 19-Oct-2014  snj Pull up following revision(s) (requested by maxv in ticket #1168):
sys/compat/freebsd/freebsd_sysctl.c: revision 1.17
I'm not sure reading from an unsanitized userland pointer is a good idea.
Some users might be tempted to give 0x01, in which case the kernel will
crash.
 1.15.26.2 03-Dec-2017  jdolecek update from HEAD
 1.15.26.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.15.22.1 19-Oct-2014  snj Pull up following revision(s) (requested by maxv in ticket #1168):
sys/compat/freebsd/freebsd_sysctl.c: revision 1.17
I'm not sure reading from an unsanitized userland pointer is a good idea.
Some users might be tempted to give 0x01, in which case the kernel will
crash.
 1.15.16.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.16.4.1 18-Oct-2014  martin Pull up following revision(s) (requested by maxv in ticket #146):
sys/compat/freebsd/freebsd_sysctl.c: revision 1.17
I'm not sure reading from an unsanitized userland pointer is a good idea.
Some users might be tempted to give 0x01, in which case the kernel will
crash.
 1.18.2.1 06-Apr-2015  skrll Sync with HEAD
 1.1 19-Nov-2008  ad branches: 1.1.4; 1.1.6; 1.1.8; 1.1.12;
Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.1.12.2 04-May-2009  yamt sync with head.
 1.1.12.1 19-Nov-2008  yamt file freebsd_sysctl.h was added on branch yamt-nfs-mp on 2009-05-04 08:12:18 +0000
 1.1.8.2 19-Jan-2009  skrll Sync with HEAD.
 1.1.8.1 19-Nov-2008  skrll file freebsd_sysctl.h was added on branch nick-hppapmap on 2009-01-19 13:17:22 +0000
 1.1.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.1.6.1 19-Nov-2008  mjf file freebsd_sysctl.h was added on branch mjf-devfs2 on 2009-01-17 13:28:42 +0000
 1.1.4.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.1.4.1 19-Nov-2008  haad file freebsd_sysctl.h was added on branch haad-dm on 2008-12-13 01:13:48 +0000
 1.93 18-Jun-2019  christos regen
 1.92 10-Aug-2018  pgoyette Regen
 1.91 06-Jan-2018  kamil branches: 1.91.2; 1.91.4;
Revert vadvise(2) removal

This system call was used in legacy Lisp code, that was inherited to modern
age and still compiled against supported compat layers (e.g. in clisp,
oaklisp, Franz Lisp).

It used to instruct the kernel about paging policy (G/C aware, flush etc).

Newly compiled code (assuming that it will detect vadvise()) will use the
libc stub for vadvise(). The headers for this interface are gone.

vadvise(2) could be marked as COMPAT_80, but as long as we support ultrix,
sunos or aout68k ABI, don't bother with this.

Requested by <mrg>
 1.90 19-Dec-2017  kamil compat/freebsd: Drop SYS_vadvise

The (o)vadvise syscall is dummy since the beginning of NetBSD.

Sponsored by <The NetBSD Foundation>
 1.89 19-Dec-2017  kamil compat/freebsd: Drop SYS_sbrk

sbrk - change data segment size

This syscall is dummy since the inception of the project.

Sponsored by <The NetBSD Foundation>
 1.88 19-Dec-2017  kamil compat freebsd: Drop the sstk(2) syscall

sstk(2) has never been implemented by the NetBSD kernel.

Sponsored by <The NetBSD Foundation>
 1.87 08-Aug-2017  maxv Move freebsd_machdep.h into sys/compat/freebsd, and don't install it. Now,
the compat_freebsd files are all contained in sys/compat/freebsd.
 1.86 10-May-2017  riastradh regen
 1.85 16-Jan-2017  christos branches: 1.85.4;
regen
 1.84 13-Jan-2017  christos branches: 1.84.2;
regen
 1.83 24-Sep-2015  christos branches: 1.83.2;
Regen
 1.82 07-Mar-2015  christos regen
 1.81 07-Nov-2013  njoly branches: 1.81.6;
Regen for dup/dup2/dup3 argument types fix.
 1.80 10-Mar-2012  joerg branches: 1.80.2; 1.80.4;
P1003_1B_SEMAPHORE is no longer optional.
 1.79 06-Mar-2011  bouyer branches: 1.79.4; 1.79.8;
merge the bouyer-quota2 branch. This adds a new on-disk format
to store disk quota usage and limits, integrated with ffs
metadata. Usage is checked by fsck_ffs (no more quotacheck)
and is covered by the WAPBL journal. Enabled with kernel
option QUOTA2 (added where QUOTA was enabled in kernel config files),
turned on with tunefs(8) on a per-filesystem
basis. mount_mfs(8) can also turn quotas on.

See http://mail-index.netbsd.org/tech-kern/2011/02/19/msg010025.html
for details.
 1.78 02-Mar-2010  pooka branches: 1.78.2; 1.78.4; 1.78.6;
regen:
- remove nfssvc / fs_nfs.h / #ifdef NFS
- make getfh unconditional
 1.77 02-Mar-2010  pooka regen for conditional lfs syscall removal
 1.76 14-Dec-2009  matt branches: 1.76.2;
Regen (new makesyscalls.sh)
 1.75 13-Jan-2009  pooka Regen to prove I didn't screw up the conversion: purely RCSID changes.
 1.74 11-Jan-2009  christos merge christos-time_t
 1.73 19-Nov-2008  ad Regen.
 1.72 14-Nov-2008  ad Regen.
 1.71 20-Dec-2007  dsl branches: 1.71.6; 1.71.8; 1.71.12; 1.71.18; 1.71.20;
regen
 1.70 13-Jul-2007  dsl branches: 1.70.8; 1.70.16; 1.70.20;
Update generated files.
 1.69 09-Feb-2007  ad branches: 1.69.6;
Merge newlock2 to head.
 1.68 01-Sep-2006  matt branches: 1.68.2;
Regen.
 1.67 30-Aug-2006  matt Regen (for PTRACE).
 1.66 31-Jul-2006  martin Make filehandles opaque to userland
 1.65 26-Jun-2006  mrg regenerate.
 1.64 04-May-2006  christos branches: 1.64.4;
Regen
 1.63 11-Dec-2005  christos branches: 1.63.4; 1.63.6; 1.63.8; 1.63.10; 1.63.12;
merge ktrace-lwp.
 1.62 13-Sep-2005  christos compat code reorg.
 1.61 19-Aug-2005  christos 64 bit inode changes.
 1.60 26-Feb-2005  perry branches: 1.60.4;
regen
 1.59 22-Feb-2005  heas Re-gen for sysctl emulation
 1.58 11-May-2004  drochner branches: 1.58.4; 1.58.6;
regen
 1.57 10-May-2004  jonathan Regen src/sys/compat/freebsd_sys{call.h,callargs.h,calls.c,ent.c} from
syscalls.master rev 1.45, with COMPAT_2.0 fix.
 1.56 21-Apr-2004  christos Replace the statfs() family of system calls with statvfs().
Retain binary compatibility.
 1.55 29-Jan-2004  tsarna uuidgen(2) syscall. Originally from FreeBSD, ported by John Franklin in
PR#23470, with minor updates by me. This is only the syscall support
from that PR, for now.

Changes: port over fix from FreeBSD for multicast address generation.
Changed bcopy to memcpy. For now, #ifdef notyet the portions of
kern_uuid.c that are meant to be used by (currently nonexistent) other
things in the kernel. Added syscall to COMPAT_FREEBSD as well, though
that's currently not useful, as any program new enough to use this call
also uses other syscalls we don't (yet) emulate.
 1.54 26-Nov-2003  jdolecek Regen: add new syscalls to the list
 1.53 18-Sep-2003  pooka regen
 1.52 18-Jan-2003  thorpej branches: 1.52.2;
Regen to get correct RCS ID.
 1.51 18-Jan-2003  thorpej Regen: Merge the nathanw_sa branch.
 1.50 22-Dec-2002  gmcgarry Add stubs for scheduler syscalls.
 1.49 09-Oct-2002  pooka regen for rfork
 1.48 03-May-2002  eeh Regen.
 1.47 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.46 27-Oct-2001  jdolecek Regen:
Hook in minherit(2), fhstatfs(2), fhopen(2), fhstat(2).
Adresses kern/8622 by Paul Shupak.
 1.45 30-May-2001  mrg branches: 1.45.2; 1.45.6;
use _KERNEL_OPT.
 1.44 27-Jan-2001  thorpej branches: 1.44.2;
Regen; add sy_flags.
 1.43 17-Dec-2000  jdolecek regen
 1.42 09-Dec-2000  mycroft Regen.
 1.41 09-Dec-2000  mycroft Regen.
 1.40 09-Dec-2000  mycroft Regen.
 1.39 30-Nov-2000  jdolecek LKMify
 1.38 18-Aug-2000  cgd update for changed makesyscalls.master
 1.37 08-Aug-2000  itojun regen
 1.36 07-Aug-2000  bjh21 Second phase of changes to remove ntp_adjtime(2) from the kernel entirely if
NTP is not defined.

Also removes sysctl_ntptime, since that's unreferenced without NTP.

ntp_gettime(2) is left alone, since it doesn't raise SIGSYS, which sys_nosys()
does.
 1.35 18-Jul-2000  onoe implement new signal syscalls in FreeBSD 4.0-RELEASE, using native syscalls:
sigaction, sigprocmask, sigsuspend, and sigpending.
 1.34 23-May-2000  tv branches: 1.34.4;
Add names for many syscalls not yet implemented, including those in
FreeBSD 4.0-RELEASE. Also implement the following using existing NetBSD
syscalls: pread, pwrite, getsid, mlockall, munlockall, __getcwd.
 1.33 21-Apr-2000  minoura Regen.
 1.32 25-Aug-1999  thorpej branches: 1.32.2;
Regen.
 1.31 12-Jul-1999  kleink Regen.
 1.30 09-Jun-1999  drochner regen
 1.29 09-Feb-1999  christos branches: 1.29.4;
Regen
 1.28 10-Dec-1998  christos Regen
 1.27 19-Oct-1998  tron Regen.
 1.26 11-Sep-1998  mycroft Regen.
 1.25 25-Jun-1998  thorpej Regen: defopt NFSSERVER
 1.24 25-Jun-1998  thorpej Regen: defopt KTRACE
 1.23 02-May-1998  christos regen.
 1.22 19-Feb-1998  thorpej Regen: makesyscalls.sh changed.
 1.21 19-Feb-1998  thorpej Regen: syscalls.master and makesyscalls.sh changed.
 1.20 22-Jan-1998  mycroft Regen.
 1.19 22-Jan-1998  mycroft Put a local copy of the SysV IPC compatibility from compat/common in here, so
it's not dependent on COMPAT_10. Also, fix translation of shmctl(), since
FreeBSD's is a little different.
 1.18 09-Jan-1998  thorpej Regen.
 1.17 09-Jan-1998  thorpej Regen.
 1.16 08-Jan-1998  thorpej Regen: back out RCD ID related changes.
 1.15 05-Jan-1998  perry regened with RCSIDs in place
 1.14 30-Nov-1997  veego Regen.
 1.13 18-Oct-1997  christos branches: 1.13.2;
Regen.
 1.12 16-Oct-1997  christos Regen.
 1.11 16-Oct-1997  mycroft Regen.
 1.10 10-Oct-1997  enami Regen from syscalls.master 1.9.
 1.9 10-Oct-1997  fvdl Regen.
 1.8 13-Jun-1997  thorpej branches: 1.8.4;
Regen: Use compat_12_sys_swapon().
 1.7 31-Jan-1997  thorpej branches: 1.7.2;
Syscalls.master changed, regen. (NFSCLIENT -> NFS)
 1.6 20-Sep-1996  christos branches: 1.6.2;
regen
 1.5 23-Jun-1996  mycroft Catch up with setre[ug]id() changes.
 1.4 10-Oct-1995  mycroft branches: 1.4.4;
Fix minor oversight.
 1.3 10-Oct-1995  mycroft branches: 1.3.2;
Fix typo.
 1.2 10-Oct-1995  mycroft Oops; remove something.
 1.1 10-Oct-1995  mycroft Output of makesyscalls.sh.
 1.3.2.1 20-Oct-1995  pk getppid => sys_getppid; re-ran makesyscalls.sh. (PR#1643).
 1.4.4.1 10-Dec-1996  mycroft Regen.
 1.6.2.2 14-Jan-1997  thorpej syscalls.master changed; regen.
 1.6.2.1 14-Jan-1997  thorpej Snapshot of work-in-progress, committed to private branch.

These changes implement machine-independent root device and file system
selection. Notable features:

- All ports behave in a consistent manner regarding root
device selection.
- No more "options GENERIC"; all kernels have the ability
to boot with RB_ASKNAME to select root device and file system
type.
- Root file system type can be wildcarded; a machine-independent
function will try all possible file systems for the selected
root device until one succeeds.
- If the root file system fails to mount, the operator will
be given the chance to select a new root device and file
system type, rather than having the machine simply panic.
- nfs_mountroot() no longer panics if any part of the NFS
mount process fails; it now returns an error, giving the
operator a chance to recover.
- New, more consistent, config(8) grammar. The constructs:

config netbsd swap generic
config netbsd root on nfs

have been replaced with:

config netbsd root on ? type ?
config netbsd root on ? type nfs

Additionally, the operator may select or wildcard root file
system type in the kernel configuration file:

config netbsd root on cd0a type cd9660

config(8) now requires that a "root" specification be
made. "root" may be wired down or wildcarded. "swap" and
"dump" specifications are optional, and follow previous
semantics.

- config(8) has a new "file-system" keyword, used to configure
file systems into the kernel. Eventually, this will be used
to generate the default vfssw[].

- "options NFSCLIENT" is obsolete, and is replaced by
"file-system NFS". "options NFSSERVER" still exists, since
NFS server support is independent of the NFS file system
client.

- sys/arch/<foo>/<foo>/swapgeneric.c is no longer used, and
will be removed; all information is now generated by config(8).

As of this commit, all ports except arm32 have been updated to use
the new setroot(). Only SPARC, i386, and Alpha ports have been
tested at this time. Port masters should test these changes on their
ports, and report any problems back to me.

More changes are on their way, including RB_ASKNAME support in
nfs_mountroot() (to prompt for server address and path) and, potentially,
the ability to select rarp/bootparam or bootp in nfs_mountroot().
 1.7.2.1 14-Feb-1997  mrg regen.
 1.8.4.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.13.2.2 30-Sep-1998  cgd regen after pull-up of syscalls.master rev 1.16 from trunk (tv)
 1.13.2.1 29-Jan-1998  mellon Regen
 1.29.4.2 02-Aug-1999  thorpej Regen.
 1.29.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.32.2.5 11-Feb-2001  bouyer Sync with HEAD.
 1.32.2.4 05-Jan-2001  bouyer Sync with HEAD
 1.32.2.3 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.32.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.32.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.34.4.1 06-Mar-2002  he Pull up regenerated files (requested by jonathan):
Add support for FreeBSD 4.x signals; fixes PR#9769.
 1.44.2.8 29-Dec-2002  thorpej Sync with HEAD.
 1.44.2.7 18-Oct-2002  nathanw Catch up to -current.
 1.44.2.6 20-Jun-2002  nathanw Catch up to -current.
 1.44.2.5 29-May-2002  nathanw Regen.
 1.44.2.4 28-Feb-2002  nathanw Regen.
 1.44.2.3 14-Nov-2001  nathanw Catch up to -current.
 1.44.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.44.2.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.45.6.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.45.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.45.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.52.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.52.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.52.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.52.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.52.2.1 03-Aug-2004  skrll Sync with HEAD
 1.58.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.58.4.1 29-Apr-2005  kent sync with -current
 1.60.4.5 21-Jan-2008  yamt sync with head
 1.60.4.4 03-Sep-2007  yamt sync with head.
 1.60.4.3 26-Feb-2007  yamt sync with head.
 1.60.4.2 30-Dec-2006  yamt sync with head.
 1.60.4.1 21-Jun-2006  yamt sync with head.
 1.63.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.63.10.1 11-May-2006  elad sync with head
 1.63.8.3 03-Sep-2006  yamt sync with head.
 1.63.8.2 11-Aug-2006  yamt sync with head
 1.63.8.1 24-May-2006  yamt sync with head.
 1.63.6.1 01-Jun-2006  kardel Sync with head.
 1.63.4.1 09-Sep-2006  rpaulo sync with head
 1.64.4.1 13-Jul-2006  gdamore Merge from HEAD.
 1.68.2.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.69.6.1 15-Jul-2007  ad Sync with head.
 1.70.20.1 02-Jan-2008  bouyer Sync with HEAD
 1.70.16.1 26-Dec-2007  ad Sync with head.
 1.70.8.1 09-Jan-2008  matt sync with HEAD
 1.71.20.1 19-Jan-2009  skrll Sync with HEAD.
 1.71.18.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.71.12.2 11-Mar-2010  yamt sync with head
 1.71.12.1 04-May-2009  yamt sync with head.
 1.71.8.2 20-Nov-2008  christos merge with head.
 1.71.8.1 29-Mar-2008  christos Welcome to the time_t=long long dev_t=uint64_t branch.
 1.71.6.1 17-Jan-2009  mjf Sync with HEAD.
 1.76.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.78.6.1 08-Feb-2011  bouyer Regen: quotactl compat
 1.78.4.1 06-Jun-2011  jruoho Sync with HEAD.
 1.78.2.1 21-Apr-2011  rmind sync with head
 1.79.8.1 11-Mar-2012  mrg sync to latest -current
 1.79.4.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.79.4.1 17-Apr-2012  yamt sync with head
 1.80.4.1 18-May-2014  rmind sync with head
 1.80.2.2 03-Dec-2017  jdolecek update from HEAD
 1.80.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.81.6.3 28-Aug-2017  skrll Sync with HEAD
 1.81.6.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.81.6.1 06-Apr-2015  skrll Sync with HEAD
 1.83.2.1 20-Mar-2017  pgoyette Sync with HEAD
 1.84.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.85.4.1 11-May-2017  pgoyette Sync with HEAD
 1.91.4.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.91.4.1 10-Jun-2019  christos Sync with HEAD
 1.91.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.4 04-Dec-2007  dsl Remove all the __P
 1.3 16-Sep-2001  wiz branches: 1.3.34; 1.3.90; 1.3.92; 1.3.98; 1.3.102;
Spell 'occurred' with two 'r's.
 1.2 05-Jan-1998  perry branches: 1.2.26; 1.2.28; 1.2.30;
RCSID Police.
 1.1 10-Oct-1995  mycroft FreeBSD binary compatibility module, from Noriyuki Soda.
 1.2.30.1 01-Oct-2001  fvdl Catch up with -current.
 1.2.28.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.26.1 21-Sep-2001  nathanw Catch up to -current.
 1.3.102.1 08-Dec-2007  ad Sync with head.
 1.3.98.1 08-Dec-2007  mjf Sync with HEAD.
 1.3.92.1 09-Jan-2008  matt sync with HEAD
 1.3.90.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.3.34.1 07-Dec-2007  yamt sync with head
 1.3 01-Dec-2000  jdolecek add e_path (emulation path) to struct emul, which replaces emulation-specific
*_emul_path variables

change macros CHECK_ALT_{CREAT|EXIST} to use that, 'root' doesn't need
to be passed explicitly any more and *_CHECK_ALT_{CREAT|EXIST} are removed
change explicit emul_find() calls in probe functions to get the emulation
path from the checked exec switch entry's emulation

remove no longer needed header files

add e_flags and e_syscall to struct emul; these are unsed and empty for now
 1.2 05-Sep-1998  christos branches: 1.2.12;
Assign copyright to TNF.
 1.1 10-Oct-1995  mycroft FreeBSD binary compatibility module, from Noriyuki Soda.
 1.2.12.1 08-Dec-2000  bouyer Sync with HEAD.
 1.3 09-Dec-2000  mycroft Round up the sysent table size.
 1.2 10-Oct-1995  mycroft branches: 1.2.32;
Oops; remove something.
 1.1 10-Oct-1995  mycroft FreeBSD binary compatibility module, from Noriyuki Soda.
 1.2.32.1 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.73 18-Jun-2019  christos add quota option
 1.72 06-Jan-2018  kamil branches: 1.72.4;
Revert vadvise(2) removal

This system call was used in legacy Lisp code, that was inherited to modern
age and still compiled against supported compat layers (e.g. in clisp,
oaklisp, Franz Lisp).

It used to instruct the kernel about paging policy (G/C aware, flush etc).

Newly compiled code (assuming that it will detect vadvise()) will use the
libc stub for vadvise(). The headers for this interface are gone.

vadvise(2) could be marked as COMPAT_80, but as long as we support ultrix,
sunos or aout68k ABI, don't bother with this.

Requested by <mrg>
 1.71 19-Dec-2017  kamil compat/freebsd: Drop SYS_vadvise

The (o)vadvise syscall is dummy since the beginning of NetBSD.

Sponsored by <The NetBSD Foundation>
 1.70 19-Dec-2017  kamil compat/freebsd: Drop SYS_sbrk

sbrk - change data segment size

This syscall is dummy since the inception of the project.

Sponsored by <The NetBSD Foundation>
 1.69 19-Dec-2017  kamil compat freebsd: Drop the sstk(2) syscall

sstk(2) has never been implemented by the NetBSD kernel.

Sponsored by <The NetBSD Foundation>
 1.68 08-Aug-2017  maxv Move freebsd_machdep.h into sys/compat/freebsd, and don't install it. Now,
the compat_freebsd files are all contained in sys/compat/freebsd.
 1.67 07-Nov-2013  njoly branches: 1.67.6;
Fix dup/dup2/dup3 argument types (u_int -> int).
 1.66 10-Mar-2012  joerg branches: 1.66.2; 1.66.4;
P1003_1B_SEMAPHORE is no longer optional.
 1.65 06-Mar-2011  bouyer branches: 1.65.4; 1.65.8;
merge the bouyer-quota2 branch. This adds a new on-disk format
to store disk quota usage and limits, integrated with ffs
metadata. Usage is checked by fsck_ffs (no more quotacheck)
and is covered by the WAPBL journal. Enabled with kernel
option QUOTA2 (added where QUOTA was enabled in kernel config files),
turned on with tunefs(8) on a per-filesystem
basis. mount_mfs(8) can also turn quotas on.

See http://mail-index.netbsd.org/tech-kern/2011/02/19/msg010025.html
for details.
 1.64 02-Mar-2010  pooka branches: 1.64.2; 1.64.4; 1.64.6;
Kill fs_nfs.h and #ifdef NFS by making getfh() support unconditional
and nfssvc unsupport unconditional. nfs server was just a fancy
NOP anyway for all except Ultrix. I know I'm boring but I couldn't
imagine why someone would want to run an Ultrix nfs server (and I
also doubt that it would work anymore with all the changes to fs
exporting etc).
 1.63 02-Mar-2010  pooka Remove lfs syscall support from compat. I can't really imagine
anyone wanting to run lfs megamaid as a e.g. FreeBSD binary.
Besides, the real action has been in fcntl() for >5 years now.
The only place where the compat syscalls might have made the tiniest
bit of sense was netbsd32, but they were unimplemented there.
 1.62 13-Jan-2009  pooka branches: 1.62.4;
Convert the syscalls.master to a format from which it is easier
to parse and generate the compat name and basename (e.g. __stat50
and stat). Use this to autogenerate __RENAME()'s to the rump_syscalls
header so that they can be called e.g. rump_sys_socket() instead
of rump_sys___socket30().
 1.61 11-Jan-2009  christos merge christos-time_t
 1.60 19-Nov-2008  ad Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.59 14-Nov-2008  ad Replace semid_t with intptr_t. No function change. This is a libc/kernel
private interface and so the name change should not affect any third
party code.
 1.58 13-Jul-2007  dsl branches: 1.58.28; 1.58.30; 1.58.34; 1.58.36; 1.58.40; 1.58.44;
Remove all the syscall stubs that were only there to get files lookup
up in the alternate path.
 1.57 04-Mar-2007  christos branches: 1.57.2;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.56 09-Feb-2007  ad branches: 1.56.2;
Merge newlock2 to head.
 1.55 01-Sep-2006  matt branches: 1.55.2;
Don't conditionalize *sys_ptrace. The lack of sys_ptrace will be dealt
with differently.
 1.54 30-Aug-2006  matt Update for options PTRACE
 1.53 31-Jul-2006  martin Step 1 to make filehandles completely opaque to userland
 1.52 26-Jun-2006  mrg version the socket(2) syscall. for compat30 socket, we use
EPROTONOSUPPORT instead of EAFNOSUPPORT.

from pavel@ with a little bit of clean up from myself.

XXX: netbsd32 (and perhaps other emulations) should be able
XXX: to call the standard socket calls for this i think, but
XXX: revisit this at another time.
 1.51 04-May-2006  christos branches: 1.51.4;
fhstat needs to be versioned too (for ino_t). Pointed out by Izumi Tsutsui
 1.50 11-Dec-2005  christos branches: 1.50.4; 1.50.6; 1.50.8; 1.50.10; 1.50.12;
merge ktrace-lwp.
 1.49 13-Sep-2005  christos compat code reorg.
 1.48 19-Aug-2005  christos 64 bit inode changes.
 1.47 22-Feb-2005  heas branches: 1.47.4;
Add FreeBSD sysctl emulation for their undocumented special OIDs rooted at
OID 0. Only OID 0.3 is implemented for now, it 0.3 is the equivalent of
NetBSD's sysctlgetmibinfo().
This includes a new sysctl kern.osreldate with the value __NetBSD_Version__
for kernels with COMPAT_FREEBSD.

Both of these are used by 3ware's FreeBSD tw_cli, which seems to work now.
 1.46 11-May-2004  drochner branches: 1.46.4; 1.46.6;
FreeBSD emulation should not depend on NetBSD binary compatibility
options. Include compat_20_sys_*statfs* unconditionally.
 1.45 10-May-2004  christos Add opt_compat_netbsd.h because we need it for COMPAT_20; pointed out
by Jonathan Stone.
 1.44 21-Apr-2004  christos Replace the statfs() family of system calls with statvfs().
Retain binary compatibility.
 1.43 29-Jan-2004  tsarna uuidgen(2) syscall. Originally from FreeBSD, ported by John Franklin in
PR#23470, with minor updates by me. This is only the syscall support
from that PR, for now.

Changes: port over fix from FreeBSD for multicast address generation.
Changed bcopy to memcpy. For now, #ifdef notyet the portions of
kern_uuid.c that are meant to be used by (currently nonexistent) other
things in the kernel. Added syscall to COMPAT_FREEBSD as well, though
that's currently not useful, as any program new enough to use this call
also uses other syscalls we don't (yet) emulate.
 1.42 26-Nov-2003  jdolecek add the new syscalls to the list
 1.41 18-Sep-2003  pooka Add a good enuf emulation of the MAP_STACK flag to the mmap()
syscall. This allows programs which use MAP_STACK to work instead
of failing in weird and wonderous ways.
 1.40 18-Jan-2003  thorpej branches: 1.40.2;
Merge the nathanw_sa branch.
 1.39 22-Dec-2002  gmcgarry Add scheduler syscalls.
 1.38 09-Oct-2002  pooka FreeBSD rfork emulation
 1.37 03-May-2002  eeh Use #if defined(_LP64) to determine if we're generating 64-bit binaries,
not #if defined(alpha).
 1.36 27-Oct-2001  jdolecek Hook in minherit(2), fhstatfs(2), fhopen(2), fhstat(2).
Adresses kern/8622 by Paul Shupak.
 1.35 30-May-2001  mrg branches: 1.35.2; 1.35.6;
use _KERNEL_OPT.
 1.34 17-Dec-2000  jdolecek branches: 1.34.2;
add emulation of FreeBSD utrace(2)
 1.33 09-Dec-2000  mycroft Get rid of the damn EMUL_GET* flags.
 1.32 09-Dec-2000  mycroft Add the %% separators.
 1.31 30-Nov-2000  jdolecek LKMify
 1.30 08-Aug-2000  itojun s/#ifdefined/#ifdef/
 1.29 07-Aug-2000  bjh21 Changes to syscalls.master to exclude ntp_adjtime(2) entirely if NTP is not
defined. Changes to other files will follow in a moment.
 1.28 18-Jul-2000  onoe implement new signal syscalls in FreeBSD 4.0-RELEASE, using native syscalls:
sigaction, sigprocmask, sigsuspend, and sigpending.
 1.27 23-May-2000  tv branches: 1.27.4;
Add names for many syscalls not yet implemented, including those in
FreeBSD 4.0-RELEASE. Also implement the following using existing NetBSD
syscalls: pread, pwrite, getsid, mlockall, munlockall, __getcwd.
 1.26 21-Apr-2000  minoura We have now native issetugid.
 1.25 25-Aug-1999  thorpej branches: 1.25.2;
Update for new msgctl()/semctl()/shmctl().
 1.24 12-Jul-1999  kleink XSH5: change function signature to `void *sbrk(intptr_t)'.
 1.23 09-Jun-1999  drochner add "sys_" prefix to LFS syscalls
 1.22 09-Feb-1999  christos branches: 1.22.4;
PR/6962: Paul Shupak: FreeBSD-3.0 additions
- const poisoning
 1.21 10-Dec-1998  christos Defopt COMPAT_43
 1.20 19-Oct-1998  tron Defopt SYSVMSG, SYSVSEM and SYSVSHM.
 1.19 11-Sep-1998  mycroft Substantial signal handling changes:
* Increase the size of sigset_t to accomodate 128 signals -- adding new
versions of sys_setprocmask(), sys_sigaction(), sys_sigpending() and
sys_sigsuspend() to handle the changed arguments.
* Abstract the guts of sys_sigaltstack(), sys_setprocmask(), sys_sigaction(),
sys_sigpending() and sys_sigsuspend() into separate functions, and call them
from all the emulations rather than hard-coding everything. (Avoids uses
the stackgap crap for these system calls.)
* Add a new flag (p_checksig) to indicate that a process may have signals
pending and userret() needs to do the full (slow) check.
* Eliminate SAS_ALTSTACK; it's exactly the inverse of SS_DISABLE.
* Correct emulation bugs with restoring SS_ONSTACK.
* Make the signal mask in the sigcontext always use the emulated mask format.
* Store signals internally in sigaction structures, rather than maintaining a
bunch of little sigsets for each SA_* bit.
* Keep track of where we put the signal trampoline, rather than figuring it out
in *_sendsig().
* Issue a warning when a non-emulated sigaction bit is observed.
* Add missing emulated signals, and a native SIGPWR (currently not used).
* Implement the `not reset when caught' semantics for relevant signals.

Note: Only code touched by the i386 port has been modified. Other ports and
emulations need to be updated.
 1.18 25-Jun-1998  thorpej defopt NFSSERVER
 1.17 25-Jun-1998  thorpej defopt KTRACE
 1.16 02-May-1998  christos PR/5350: Minoura Makoto: add issetugid() syscall. (with fixes from me)
 1.15 19-Feb-1998  thorpej Include the NFS option header.
 1.14 22-Jan-1998  mycroft Put a local copy of the SysV IPC compatibility from compat/common in here, so
it's not dependent on COMPAT_10. Also, fix translation of shmctl(), since
FreeBSD's is a little different.
 1.13 30-Nov-1997  veego Change syscall table to use the 1.3 compatibility sigaltstack() function
(fix from kleink).
 1.12 18-Oct-1997  christos branches: 1.12.2;
Use stat12; from Enami Tsugutomo
 1.11 16-Oct-1997  christos ostat -> stat43
 1.10 15-Oct-1997  mycroft Fix a typo inherited from kern/syscalls.master.
 1.9 10-Oct-1997  enami lchown at #254.
 1.8 10-Oct-1997  fvdl Channel FreeBSD getdirentries to our now obsolete getdirentries call.
 1.7 13-Jun-1997  thorpej branches: 1.7.4;
Use compat_12_sys_swapon().
 1.6 31-Jan-1997  thorpej branches: 1.6.2;
NFSCLIENT -> NFS
 1.5 20-Sep-1996  christos branches: 1.5.2;
getlogin -> __getlogin
 1.4 23-Jun-1996  mycroft Catch up with setre[ug]id() changes.
 1.3 10-Oct-1995  mycroft branches: 1.3.4;
Fix minor oversight.
 1.2 10-Oct-1995  mycroft branches: 1.2.2;
Fix typo.
 1.1 10-Oct-1995  mycroft FreeBSD binary compatibility module, from Noriyuki Soda.
 1.2.2.1 20-Oct-1995  pk getppid => sys_getppid; re-ran makesyscalls.sh. (PR#1643).
 1.3.4.1 10-Dec-1996  mycroft From trunk:
Implement setre[ug]id() for real.
 1.5.2.1 14-Jan-1997  thorpej Snapshot of work-in-progress, committed to private branch.

These changes implement machine-independent root device and file system
selection. Notable features:

- All ports behave in a consistent manner regarding root
device selection.
- No more "options GENERIC"; all kernels have the ability
to boot with RB_ASKNAME to select root device and file system
type.
- Root file system type can be wildcarded; a machine-independent
function will try all possible file systems for the selected
root device until one succeeds.
- If the root file system fails to mount, the operator will
be given the chance to select a new root device and file
system type, rather than having the machine simply panic.
- nfs_mountroot() no longer panics if any part of the NFS
mount process fails; it now returns an error, giving the
operator a chance to recover.
- New, more consistent, config(8) grammar. The constructs:

config netbsd swap generic
config netbsd root on nfs

have been replaced with:

config netbsd root on ? type ?
config netbsd root on ? type nfs

Additionally, the operator may select or wildcard root file
system type in the kernel configuration file:

config netbsd root on cd0a type cd9660

config(8) now requires that a "root" specification be
made. "root" may be wired down or wildcarded. "swap" and
"dump" specifications are optional, and follow previous
semantics.

- config(8) has a new "file-system" keyword, used to configure
file systems into the kernel. Eventually, this will be used
to generate the default vfssw[].

- "options NFSCLIENT" is obsolete, and is replaced by
"file-system NFS". "options NFSSERVER" still exists, since
NFS server support is independent of the NFS file system
client.

- sys/arch/<foo>/<foo>/swapgeneric.c is no longer used, and
will be removed; all information is now generated by config(8).

As of this commit, all ports except arm32 have been updated to use
the new setroot(). Only SPARC, i386, and Alpha ports have been
tested at this time. Port masters should test these changes on their
ports, and report any problems back to me.

More changes are on their way, including RB_ASKNAME support in
nfs_mountroot() (to prompt for server address and path) and, potentially,
the ability to select rarp/bootparam or bootp in nfs_mountroot().
 1.6.2.1 12-Feb-1997  mrg initial work for dynamic swap additions.
 1.7.4.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.12.2.2 30-Sep-1998  cgd pull up rev 1.16 from trunk (tv)
 1.12.2.1 29-Jan-1998  mellon Pull up 1.14 (mycroft)
 1.22.4.2 02-Aug-1999  thorpej Update from trunk.
 1.22.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.25.2.4 05-Jan-2001  bouyer Sync with HEAD
 1.25.2.3 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.25.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.25.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.27.4.1 06-Mar-2002  he Pull up revisions 1.28-1.30 (requested by jonathan):
Add support for FreeBSD 4.x signals; fixes PR#9769.
 1.34.2.7 29-Dec-2002  thorpej Sync with HEAD.
 1.34.2.6 18-Oct-2002  nathanw Catch up to -current.
 1.34.2.5 20-Jun-2002  nathanw Catch up to -current.
 1.34.2.4 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.34.2.3 28-Feb-2002  nathanw sys_setlogin() -> sys___setlogin()
 1.34.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.34.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.35.6.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.35.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.35.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.40.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.40.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.40.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.40.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.40.2.1 03-Aug-2004  skrll Sync with HEAD
 1.46.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.46.4.1 29-Apr-2005  kent sync with -current
 1.47.4.4 03-Sep-2007  yamt sync with head.
 1.47.4.3 26-Feb-2007  yamt sync with head.
 1.47.4.2 30-Dec-2006  yamt sync with head.
 1.47.4.1 21-Jun-2006  yamt sync with head.
 1.50.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.50.10.1 11-May-2006  elad sync with head
 1.50.8.2 11-Aug-2006  yamt sync with head
 1.50.8.1 24-May-2006  yamt sync with head.
 1.50.6.1 01-Jun-2006  kardel Sync with head.
 1.50.4.1 09-Sep-2006  rpaulo sync with head
 1.51.4.1 13-Jul-2006  gdamore Merge from HEAD.
 1.55.2.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.56.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.57.2.1 15-Jul-2007  ad Sync with head.
 1.58.44.1 19-Jan-2009  skrll Sync with HEAD.
 1.58.40.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.58.36.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.58.36.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.58.34.2 11-Mar-2010  yamt sync with head
 1.58.34.1 04-May-2009  yamt sync with head.
 1.58.30.2 20-Nov-2008  christos merge with head.
 1.58.30.1 29-Mar-2008  christos Welcome to the time_t=long long dev_t=uint64_t branch.
 1.58.28.1 17-Jan-2009  mjf Sync with HEAD.
 1.62.4.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.64.6.1 08-Feb-2011  bouyer freebsd quotactl uses our COMPAT_50 syscall.
 1.64.4.1 06-Jun-2011  jruoho Sync with HEAD.
 1.64.2.1 21-Apr-2011  rmind sync with head
 1.65.8.1 11-Mar-2012  mrg sync to latest -current
 1.65.4.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.65.4.1 17-Apr-2012  yamt sync with head
 1.66.4.1 18-May-2014  rmind sync with head
 1.66.2.2 03-Dec-2017  jdolecek update from HEAD
 1.66.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.67.6.1 28-Aug-2017  skrll Sync with HEAD
 1.72.4.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.5 16-Jan-2017  christos branches: 1.5.2; 1.5.14;
add Makefile struct
 1.4 03-Oct-1998  christos branches: 1.4.120; 1.4.122;
Remove this file.
 1.3 01-Oct-1998  erh Enable "includes" and "all"(=makesyscalls.sh) targets for alpha, common and i386.
 1.2 01-Oct-1998  erh Kinda moved to compat/linux/Makefile.sc.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.4.122.1 21-Apr-2017  bouyer Sync with HEAD
 1.4.120.1 20-Mar-2017  pgoyette Sync with HEAD
 1.5.14.2 03-Dec-2017  jdolecek update from HEAD
 1.5.14.1 16-Jan-2017  jdolecek file Makefile was added on branch tls-maxphys on 2017-12-03 11:36:53 +0000
 1.5.2.2 05-Feb-2017  skrll Sync with HEAD
 1.5.2.1 16-Jan-2017  skrll file Makefile was added on branch nick-nhusb on 2017-02-05 13:40:24 +0000
 1.7 16-Jan-2017  christos Don't re-define rules for subdir Makefile
 1.6 14-Jan-2014  christos branches: 1.6.6; 1.6.10; 1.6.14;
use new bsd.syscall.mk
 1.5 11-Dec-2005  christos branches: 1.5.110; 1.5.120; 1.5.126;
merge ktrace-lwp.
 1.4 15-Nov-2003  thorpej We have CVS; there is no reason to make .bak files when generating the
syscall tables.
 1.3 26-Oct-2003  lukem Use ${HOST_SH} instead of `sh'.

If necessary, pull in <bsd.sys.mk> to get the definition of HOST_SH;
Makefiles that pull in one of (most of) <bsd.*.mk> will get this anyway.
 1.2 03-Oct-1998  christos branches: 1.2.46;
Attempt to fix the mess.
 1.1 30-Sep-1998  erh Common makefile to process syscalls.master files.
 1.2.46.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.46.3 18-Sep-2004  skrll Sync with HEAD.
 1.2.46.2 06-Aug-2004  skrll Fix merge mistakes.
 1.2.46.1 03-Aug-2004  skrll Sync with HEAD
 1.5.126.1 18-May-2014  rmind sync with head
 1.5.120.2 03-Dec-2017  jdolecek update from HEAD
 1.5.120.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.5.110.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.6.14.1 21-Apr-2017  bouyer Sync with HEAD
 1.6.10.1 20-Mar-2017  pgoyette Sync with HEAD
 1.6.6.1 05-Feb-2017  skrll Sync with HEAD
 1.2 03-Oct-1998  christos Attempt to fix the mess.
 1.1 30-Sep-1998  erh Common makefile to process syscalls.master files.
 1.6 06-Apr-2003  jdolecek this info is now in doc/RESPONSIBLE
 1.5 22-Sep-2001  manu I'm working on Mips
 1.4 01-Jul-2001  jdolecek branches: 1.4.2; 1.4.4;
Add myself to the list, put e-mail addresses within '<' and '>'
 1.3 11-Apr-2001  manu Integrated security review for signal delivery by Wolfgang Solfrank
 1.2 17-Nov-2000  erh branches: 1.2.2;
Provide some more useful information.
 1.1 01-Oct-1998  erh branches: 1.1.12;
Add info on things left to do.
 1.1.12.2 21-Apr-2001  bouyer Sync with HEAD
 1.1.12.1 22-Nov-2000  bouyer Sync with HEAD.
 1.2.2.3 26-Sep-2001  nathanw Catch up to -current.
Again.
 1.2.2.2 24-Aug-2001  nathanw Catch up with -current.
 1.2.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.4.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.4.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.25 03-Jul-2024  rin files.linux: Make compat_linux depended to mqueue

Thanks pgoyette@ for comments.
 1.24 03-Jul-2024  rin files.linux: Hook linux_mqueue.c belatedly for COMPAT_LINUX
 1.23 20-Aug-2023  christos branches: 1.23.6;
add inotify (forgot to commit this)
 1.22 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.21 17-Nov-2014  uebayasi branches: 1.21.18; 1.21.20;
Define compat modules (but without dependencies yet).
 1.20 19-Nov-2008  ad branches: 1.20.26;
Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.19 11-Dec-2005  christos branches: 1.19.70; 1.19.74; 1.19.80; 1.19.84;
merge ktrace-lwp.
 1.18 28-Feb-2005  soren Emulate basic mtio ioctls.
 1.17 03-Feb-2005  christos Add scsi-generic stuff.
 1.16 31-Mar-2002  christos branches: 1.16.10; 1.16.18; 1.16.20;
make signal array handling uniform, and put signal arrays in a separate
file. This is simular to errno array handling.
 1.15 15-Feb-2002  christos - add a real linux_sys___sysctl because the mib numbers are different.
implement only the kernel version getting entries.
- make the signal conversion functions consistent; dest is arg 1.
- make linux_fakedev deal with block and char devices differently.
- add linux_sys_ugetrlimit, and flesh out the regular get/setrlimit so
that they work properly.
- add linux_mmap2 [untested].
- bump kernel to 2.4.18, and make the date be valentine's day :-)
- linux_sys_*stat64 family was totally busted. Fix it.

tested only on i386.

Status:
gdb, telnet, work
jdk-1.4.0 extractor works, jdk still coredumps.

christos
 1.14 13-May-2001  manu branches: 1.14.2;
Improved the accuracy of gettimeofday/settimeofday: Linux stores a srtuct
timezone in the kernel. We now keep track of it for emulated processes.
Tested for powerpc and i386. Untested on m68k, but it should be ok
Alpha has a particular implementation (osf1_sys_gettimeofday), and it has
therefore not been touched.
 1.13 10-Jan-2001  fvdl branches: 1.13.2;
Add linux_blkio.c
 1.12 10-Dec-2000  fvdl Add linux_hdio.c and linux_fdio.c
 1.11 01-Dec-2000  jdolecek put linux_sys_uselib() to separate file linux_uselib.c
 1.10 04-Oct-1999  tron branches: 1.10.2; 1.10.12;
Add emulation for scheduler related syscalls. Although they are dummies
even under Linux the posix thread library for "glibc2" requires them.
 1.9 23-Oct-1998  erh linux_error.c moved to linux_errno.c
 1.8 01-Oct-1998  erh Modified to reflect new file layout. arch/<arch>/conf/files.<arch> should include this file and the appropriate compat/linux/<arch>/files.linux_<arch> file.
 1.7 15-Jan-1998  christos PR/4794: Urban Boquist: Linux cdrom ioctls are missing
 1.6 20-Jul-1997  pk config.new => config
 1.5 04-Apr-1997  augustss * Move the Linux audio emulation into its own directory and rename it
OSS (aka VoxWare) audio emulation.
* Use the OSS audio emulation for Linux and FreeBSD.
* Add mixer emulation to the OSS emulator.
 1.4 08-Mar-1996  mycroft Separate ioctl emulation by group. Add (minimal) audio emulation.
 1.3 14-Aug-1995  mycroft Sort.
 1.2 24-Jun-1995  christos Use compat_util.[ch].
 1.1 17-Apr-1995  cgd config.new file lists
 1.10.12.1 30-Mar-2001  he Pull up revisions 1.12-1.13 (requested by fvdl):
Add some required Linux emulation bits to support the Linux
version of VMware.
 1.10.2.3 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.10.2.2 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.10.2.1 08-Dec-2000  bouyer Sync with HEAD.
 1.13.2.3 17-Apr-2002  nathanw Catch up to -current.
 1.13.2.2 28-Feb-2002  nathanw Catch up to -current.
 1.13.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.14.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.14.2.1 16-Mar-2002  jdolecek Catch up with -current.
 1.16.20.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.16.20.1 12-Feb-2005  yamt sync with head.
 1.16.18.1 29-Apr-2005  kent sync with -current
 1.16.10.2 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.16.10.1 04-Feb-2005  skrll Sync with HEAD.
 1.19.84.1 19-Jan-2009  skrll Sync with HEAD.
 1.19.80.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.19.74.1 04-May-2009  yamt sync with head.
 1.19.70.1 17-Jan-2009  mjf Sync with HEAD.
 1.20.26.1 03-Dec-2017  jdolecek update from HEAD
 1.21.20.1 10-Jun-2019  christos Sync with HEAD
 1.21.18.1 12-Mar-2018  pgoyette Update dependencies for modules when they are built-in. Now we don't
(or at least, shouldn't) need reminders in the GENERIC config files
about which module options require other options.

Update branch status doc accordingly.
 1.23.6.1 02-Aug-2025  perseant Sync with HEAD
 1.6 04-Apr-1997  augustss * Move the Linux audio emulation into its own directory and rename it
OSS (aka VoxWare) audio emulation.
* Use the OSS audio emulation for Linux and FreeBSD.
* Add mixer emulation to the OSS emulator.
 1.5 20-Mar-1997  mycroft Copy back the format we set in SNDCTL_DSP_SETFMT.
 1.4 20-Mar-1997  mycroft SOUND_PCM_WRITE_CHANNELS -> SNDCTL_DSP_CHANNELS, to match current Linux code.
 1.3 19-Mar-1997  mycroft Emulate the SOUND_PCM_WRITE_CHANNELS ioctl. From PR 3356, by Lennart
Augustsson. Also add hooks for mixer ioctls.
 1.2 17-Oct-1996  fvdl Add RCS Id.
 1.1 08-Mar-1996  mycroft Separate ioctl emulation by group. Add (minimal) audio emulation.
 1.4 04-Apr-1997  augustss * Move the Linux audio emulation into its own directory and rename it
OSS (aka VoxWare) audio emulation.
* Use the OSS audio emulation for Linux and FreeBSD.
* Add mixer emulation to the OSS emulator.
 1.3 20-Mar-1997  mycroft SOUND_PCM_WRITE_CHANNELS -> SNDCTL_DSP_CHANNELS, to match current Linux code.
 1.2 19-Mar-1997  mycroft Emulate the SOUND_PCM_WRITE_CHANNELS ioctl. From PR 3356, by Lennart
Augustsson. Also add hooks for mixer ioctls.
 1.1 08-Mar-1996  mycroft Separate ioctl emulation by group. Add (minimal) audio emulation.
 1.2 01-Oct-1998  erh Moved compat/linux/linux_cdrom to common.
 1.1 15-Jan-1998  christos PR/4794: Urban Boquist: Linux cdrom ioctls are missing
 1.4 03-Oct-1998  christos moved via repository copy.
 1.3 01-Oct-1998  erh Add the architechture-wise multiplexing header files. These are the files that should be included by anything that needs a linux compat header. These will then include the appropriate architechture dependent and common header file(s).
 1.2 01-Oct-1998  erh Moved compat/linux/linux_cdrom to common.
 1.1 15-Jan-1998  christos PR/4794: Urban Boquist: Linux cdrom ioctls are missing
 1.6 03-Oct-1998  christos moved via repository copy.
 1.5 01-Oct-1998  erh Add the architechture-wise multiplexing header files. These are the files that should be included by anything that needs a linux compat header. These will then include the appropriate architechture dependent and common header file(s).
 1.4 01-Oct-1998  erh Moved from compat/linux/linux_dirent.h to common.
 1.3 07-Oct-1995  mycroft Prefix names of system call implementation functions with `sys_'.
 1.2 10-Jun-1995  mycroft Rename the dirent fields to match Linux. Make sure the requested buffer
is no larger than MAXBSIZE.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.4 03-Oct-1998  christos moved via repository copy.
 1.3 01-Oct-1998  erh Add the architechture-wise multiplexing header files. These are the files that should be included by anything that needs a linux compat header. These will then include the appropriate architechture dependent and common header file(s).
 1.2 01-Oct-1998  erh Split compat/linux/linux_errno.h into i386 and common parts.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.5 01-Oct-1998  erh Move compat/linux/linux_error.c to common.
 1.4 10-Feb-1998  kleink Map ENOMSG.
 1.3 06-Feb-1998  mikel update errno maps, we now have EIDRM
 1.2 22-Apr-1995  christos - added struct emul to all emulations.
- removed all setup functions.
- added copyargs() functions where needed.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.31 01-Oct-1998  erh Split compat/linux/linux_exec.c into common, elf and a.out parts.
 1.30 11-Sep-1998  mycroft Substantial signal handling changes:
* Increase the size of sigset_t to accomodate 128 signals -- adding new
versions of sys_setprocmask(), sys_sigaction(), sys_sigpending() and
sys_sigsuspend() to handle the changed arguments.
* Abstract the guts of sys_sigaltstack(), sys_setprocmask(), sys_sigaction(),
sys_sigpending() and sys_sigsuspend() into separate functions, and call them
from all the emulations rather than hard-coding everything. (Avoids uses
the stackgap crap for these system calls.)
* Add a new flag (p_checksig) to indicate that a process may have signals
pending and userret() needs to do the full (slow) check.
* Eliminate SAS_ALTSTACK; it's exactly the inverse of SS_DISABLE.
* Correct emulation bugs with restoring SS_ONSTACK.
* Make the signal mask in the sigcontext always use the emulated mask format.
* Store signals internally in sigaction structures, rather than maintaining a
bunch of little sigsets for each SA_* bit.
* Keep track of where we put the signal trampoline, rather than figuring it out
in *_sendsig().
* Issue a warning when a non-emulated sigaction bit is observed.
* Add missing emulated signals, and a native SIGPWR (currently not used).
* Implement the `not reset when caught' semantics for relevant signals.

Note: Only code touched by the i386 port has been modified. Other ports and
emulations need to be updated.
 1.29 05-Sep-1998  christos Assign copyright to TNF.
 1.28 09-Aug-1998  perry bzero->memset, bcopy->memcpy, bcmp->memcmp
 1.27 28-Jul-1998  thorpej Change the "aresid" argument of vn_rdwr() from an int * to a size_t *,
to match the new uio_resid type.
 1.26 24-Jan-1998  mycroft Use linux_setregs().
 1.25 13-Oct-1996  christos branches: 1.25.14;
catch up with Jason's exec.h inclusion.
 1.24 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.23 07-Oct-1996  cgd include <sys/exec.h> rather than <machine/exec.h>
 1.22 05-Oct-1996  jtk update to compile; needs new enum name 'Elf_sht_progbits'
 1.21 03-Oct-1996  cgd kill (re)definitions of EXEC_ELF32. They're no longer necessary
(because of the EXEC_* option changes), and now cause warnings.
 1.20 03-Oct-1996  thorpej Fix a section header check that didn't get updated with the elf32/elf64
changes. Make this compile again with the new EXEC_* options.
 1.19 30-Sep-1996  christos Elf32_sht_progbits -> Elf_sht_progbits
 1.18 27-Sep-1996  cgd slightly clean up some of the changes made when ELF64 support went in
 1.17 26-Sep-1996  cgd adapt ELF-using compat code to use new ELF definitions/code. At this point,
these are restricted to 32-bit ELF, and should be severely cleaned.
 1.16 03-Sep-1996  mycroft Define execv() and execve() consistently across emulations.
Do path name translation.
 1.15 13-Jun-1996  christos Simplify and add comments.
 1.14 13-Jun-1996  christos - Pass the Elf32_Ehdr in the linux probe function, and use it!

Since linux binaries are (mostly) always compiled with gcc, look for
the gcc signature in the .comment section header: "\0 GCC: (GNU) ".
I've changed the probe order in kern/exec_elf.c to probe for linux ELF
binaries first and fall back to SVR4 binaries. This makes statically
linked binaries work for both linux and svr4. Note that gcc-compiled
svr4 binaries, still contain the operating system signature first and
then the GCC signature, so there is no conflict. Yes this is a hack.
 1.13 05-Apr-1996  christos branches: 1.13.4;
Prototyping changes.
 1.12 07-Oct-1995  mycroft Prefix names of system call implementation functions with `sys_'.
 1.11 19-Sep-1995  thorpej Make system calls conform to a standard prototype and bring those
prototypes into scope.
 1.10 14-Aug-1995  mycroft Rearrange #includes.
 1.9 24-Jun-1995  christos Use compat_util.[ch].
 1.8 22-Jun-1995  fvdl * Changed to use generic ELF code from kern/exec_elf.c (which was taken
from the svr4 exec code plus the linux compat mods)
* Include file change
* Add multicast sockopts (from John Brezak)
 1.7 11-Jun-1995  fvdl Don't forget to acknowledge that all the ELF stuff was taken from
Christos' svr4 code.
 1.6 11-Jun-1995  fvdl * Make Linux ELF binaries work. Lots of code duplication, but it will have to do
for now.
* Add a sanity check in linux_uselib
 1.5 16-May-1995  mycroft Generate the new ps_strings format.
 1.4 22-Apr-1995  christos - added struct emul to all emulations.
- removed all setup functions.
- added copyargs() functions where needed.
 1.3 07-Apr-1995  fvdl Handle Linux signal tramp code differently. Some changes because of the
now seperate Linux signal trampoline code. Add linux_sigreturn to
syscalls.master.
 1.2 05-Mar-1995  fvdl Added a few more system calls.
More consistent alternate root file semantics throughout.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.13.4.1 10-Dec-1996  mycroft From trunk:
Do execv() and execve() path name translation consistently across
emulations.
 1.25.14.1 29-Jan-1998  mellon Pull up 1.26 (mycroft)
 1.11 03-Oct-1998  christos moved via repository copy.
 1.10 01-Oct-1998  erh Add the architechture-wise multiplexing header files. These are the files that should be included by anything that needs a linux compat header. These will then include the appropriate architechture dependent and common header file(s).
 1.9 01-Oct-1998  erh Move compat/linux/linux_exec.h to common.
 1.8 24-Jan-1998  mycroft Prototype new functions.
 1.7 26-Sep-1996  cgd branches: 1.7.14;
adapt ELF-using compat code to use new ELF definitions/code. At this point,
these are restricted to 32-bit ELF, and should be severely cleaned.
 1.6 13-Jun-1996  christos - Pass the Elf32_Ehdr in the linux probe function, and use it!

Since linux binaries are (mostly) always compiled with gcc, look for
the gcc signature in the .comment section header: "\0 GCC: (GNU) ".
I've changed the probe order in kern/exec_elf.c to probe for linux ELF
binaries first and fall back to SVR4 binaries. This makes statically
linked binaries work for both linux and svr4. Note that gcc-compiled
svr4 binaries, still contain the operating system signature first and
then the GCC signature, so there is no conflict. Yes this is a hack.
 1.5 07-Oct-1995  mycroft Prefix names of system call implementation functions with `sys_'.
 1.4 22-Jun-1995  fvdl * Changed to use generic ELF code from kern/exec_elf.c (which was taken
from the svr4 exec code plus the linux compat mods)
* Include file change
* Add multicast sockopts (from John Brezak)
 1.3 11-Jun-1995  fvdl * Make Linux ELF binaries work. Lots of code duplication, but it will have to do
for now.
* Add a sanity check in linux_uselib
 1.2 07-Apr-1995  fvdl Handle Linux signal tramp code differently. Some changes because of the
now seperate Linux signal trampoline code. Add linux_sigreturn to
syscalls.master.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.7.14.1 29-Jan-1998  mellon Pull up 1.8 (mycroft)
 1.4 03-Oct-1998  christos moved via repository copy.
 1.3 01-Oct-1998  erh Add the architechture-wise multiplexing header files. These are the files that should be included by anything that needs a linux compat header. These will then include the appropriate architechture dependent and common header file(s).
 1.2 01-Oct-1998  erh Split linux_fcntl.h into i386 and common parts.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.23 01-Oct-1998  erh Split compat/linux/linux_file.c into common and multi-architechture parts.
 1.22 14-Feb-1998  kleink * Use sys___posix_{chown,fchown}() instead of sys_{chown,fchown}().
* Change reference from sys_posix_rename() to sys___posix_rename().
 1.21 20-Oct-1997  thorpej Fix the shared library versioning snafu caused by the recent changes
to the stat(2) family and msync(2). This uses a primitive function
versioning scheme.

This reverts the libc shared library major version from 13 to 12, and
adds a few new interfaces to bring us to libc version 12.20.

From Frank van der Linden <fvdl@NetBSD.ORG>.
 1.20 19-Oct-1997  mycroft Fix bogosity in mknod(2) translation.
 1.19 16-Oct-1997  christos check for st_nlink overflow
 1.18 05-Sep-1997  kleink Add missing preparation of F_GETLK parameters in linux_sys_fcntl(); fixes PR
port-i386/4083 from Matthias Scheler <tron@lyssa.owl.de>, but vastly cleaned
up as previously suggested by myself.
 1.17 27-Jun-1997  kleink branches: 1.17.4;
Use sys_posix_rename() instead of sys_rename() as it's the behaviour of the
native implementation.
 1.16 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.15 20-May-1996  fvdl Update list of Linux syscalls and implement the ones that are likely to be
used and doable.
 1.14 05-Apr-1996  christos Prototyping changes.
 1.13 08-Oct-1995  fvdl Work around calling the NetBSD fcntl(F_{G,S}ETOWN) for now; it is too
restrictive to implement the Linux equivalent (and perhaps too restrictive
overall).
 1.12 07-Oct-1995  mycroft Prefix names of system call implementation functions with `sys_'.
 1.11 19-Sep-1995  thorpej Make system calls conform to a standard prototype and bring those
prototypes into scope.
 1.10 07-Sep-1995  fvdl Fix some bugs & typing problems.
 1.9 27-Aug-1995  fvdl Add a hook for MD ioctl calls, plus a couple of more changes to make
svgalib binaries work on the i386
 1.8 14-Aug-1995  mycroft Rearrange #includes.
 1.7 24-Jul-1995  fvdl mkdir() has 2 arguments.. fixes PR 1248 (from Brad Spencer)
 1.6 03-Jul-1995  fvdl Fix totally bogus implementation of a few fcntl() calls. I think I'll go
live on a deserted island now..
 1.5 24-Jun-1995  christos Use compat_util.[ch].
 1.4 22-Jun-1995  fvdl * Changed to use generic ELF code from kern/exec_elf.c (which was taken
from the svr4 exec code plus the linux compat mods)
* Include file change
* Add multicast sockopts (from John Brezak)
 1.3 04-Apr-1995  mycroft Fix conversion of `type' and `whence' values in struct flock.
 1.2 05-Mar-1995  fvdl Added a few more system calls.
More consistent alternate root file semantics throughout.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.17.4.1 06-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.19 01-Oct-1998  erh Move compat/linux/linux_ioctl.c to common.
 1.18 07-Aug-1998  augustss Add MIDI support. The MIDI devices can be accessed as ``raw'' through
the /dev/rmidiN devices, or with a sequencer interface via /dev/music.
So far the only supported MIDI device is the MPU401 port on SoundBlaster
(and only on SB on isapnp, since we do not have locators with multiple
values yet).
 1.17 15-Jan-1998  christos PR/4794: Urban Boquist: Linux cdrom ioctls are missing
 1.16 04-Apr-1997  augustss * Move the Linux audio emulation into its own directory and rename it
OSS (aka VoxWare) audio emulation.
* Use the OSS audio emulation for Linux and FreeBSD.
* Add mixer emulation to the OSS emulator.
 1.15 19-Mar-1997  mycroft Emulate the SOUND_PCM_WRITE_CHANNELS ioctl. From PR 3356, by Lennart
Augustsson. Also add hooks for mixer ioctls.
 1.14 05-Apr-1996  christos Prototyping changes.
 1.13 08-Mar-1996  mycroft Separate ioctl emulation by group. Add (minimal) audio emulation.
 1.12 27-Feb-1996  mycroft Map SIOCGIFFLAGS and SIOCGIFADDR (et al).
 1.11 27-Feb-1996  mycroft Use OSIOCGIFCONF in previous.
 1.10 27-Feb-1996  mycroft Map SIOCGIFCONF.
 1.9 16-Nov-1995  thorpej Fix transposed copyin() args, from Niklas Hallqvist <niklas@appli.se>.
 1.8 07-Oct-1995  mycroft branches: 1.8.2;
Prefix names of system call implementation functions with `sys_'.
 1.7 19-Sep-1995  thorpej Make system calls conform to a standard prototype and bring those
prototypes into scope.
 1.6 27-Aug-1995  fvdl Add a hook for MD ioctl calls, plus a couple of more changes to make
svgalib binaries work on the i386
 1.5 16-Aug-1995  mycroft Convert 230400 baud.
 1.4 14-Aug-1995  mycroft Rearrange #includes.
 1.3 24-Jun-1995  christos Use compat_util.[ch].
 1.2 22-Jun-1995  fvdl * Changed to use generic ELF code from kern/exec_elf.c (which was taken
from the svr4 exec code plus the linux compat mods)
* Include file change
* Add multicast sockopts (from John Brezak)
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.8.2.1 16-Nov-1995  thorpej Update from trunk; fix transposed copyin() args.
 1.10 03-Oct-1998  christos moved via repository copy.
 1.9 01-Oct-1998  erh Add the architechture-wise multiplexing header files. These are the files that should be included by anything that needs a linux compat header. These will then include the appropriate architechture dependent and common header file(s).
 1.8 01-Oct-1998  erh Split compat/linux/linux_ioctl.h into i386 and common parts.
 1.7 15-Jan-1998  christos PR/4794: Urban Boquist: Linux cdrom ioctls are missing
 1.6 04-Apr-1997  augustss * Move the Linux audio emulation into its own directory and rename it
OSS (aka VoxWare) audio emulation.
* Use the OSS audio emulation for Linux and FreeBSD.
* Add mixer emulation to the OSS emulator.
 1.5 19-Mar-1997  mycroft Emulate the SOUND_PCM_WRITE_CHANNELS ioctl. From PR 3356, by Lennart
Augustsson. Also add hooks for mixer ioctls.
 1.4 05-Apr-1996  christos Prototyping changes.
 1.3 08-Mar-1996  mycroft Separate ioctl emulation by group. Add (minimal) audio emulation.
 1.2 16-Aug-1995  mycroft Convert 230400 baud.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.14 01-Oct-1998  erh Split compat/linux/linux_ipc.c into common and multi-architechture parts. The IPC multiplexer and associated functions are now in linux_ipccall.c
 1.13 22-Jan-1998  mycroft Clean this up a bit.
 1.12 08-May-1997  kleink Fixed copyin() argument botch in shmctl() IPC_STAT handling.
 1.11 15-Nov-1996  fvdl Avoid compiler warnings when none of the SYSV* options is defined.
 1.10 05-Apr-1996  christos Prototyping changes.
 1.9 08-Oct-1995  fvdl Avoid unnecessary copyin() of shmid_ds struct for shmctl(IPC_RMID)
 1.8 07-Oct-1995  mycroft Prefix names of system call implementation functions with `sys_'.
 1.7 19-Sep-1995  thorpej Make system calls conform to a standard prototype and bring those
prototypes into scope.
 1.6 15-Aug-1995  fvdl Implement the rest of the sysv ipc calls ({sem,msg}*())
 1.5 14-Aug-1995  mycroft Rearrange #includes.
 1.4 24-Jun-1995  christos Use compat_util.[ch].
 1.3 22-Jun-1995  fvdl * Changed to use generic ELF code from kern/exec_elf.c (which was taken
from the svr4 exec code plus the linux compat mods)
* Include file change
* Add multicast sockopts (from John Brezak)
 1.2 08-Mar-1995  fvdl Add missing structure conversion for IPC_RMID.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.4 03-Oct-1998  christos moved via repository copy.
 1.3 01-Oct-1998  erh Add the architechture-wise multiplexing header files. These are the files that should be included by anything that needs a linux compat header. These will then include the appropriate architechture dependent and common header file(s).
 1.2 01-Oct-1998  erh Move IPC headers to common. The msg, sem and shm files, in addition to other common structures and to avoid creating several more machine dependent header files, include the syscall arguments for several system calls which don't exist on all architechtures.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.5 03-Oct-1998  christos moved via repository copy.
 1.4 01-Oct-1998  erh Add the architechture-wise multiplexing header files. These are the files that should be included by anything that needs a linux compat header. These will then include the appropriate architechture dependent and common header file(s).
 1.3 01-Oct-1998  erh Move linux/compat/linux_ipccall.h to multiarch. Defines for the IPC multiplexerand associated functions.
 1.2 15-Aug-1995  fvdl Implement the rest of the sysv ipc calls ({sem,msg}*())
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.2 03-Oct-1998  christos moved via repository copy.
 1.1 01-Oct-1998  erh Add the architechture-wise multiplexing header files. These are the files that should be included by anything that needs a linux compat header. These will then include the appropriate architechture dependent and common header file(s).
 1.47 01-Oct-1998  erh Wheeee!: 8-way split of compat/linux/linux_misc.c into common code and multi-architechture functions.
 1.46 11-Sep-1998  mycroft Substantial signal handling changes:
* Increase the size of sigset_t to accomodate 128 signals -- adding new
versions of sys_setprocmask(), sys_sigaction(), sys_sigpending() and
sys_sigsuspend() to handle the changed arguments.
* Abstract the guts of sys_sigaltstack(), sys_setprocmask(), sys_sigaction(),
sys_sigpending() and sys_sigsuspend() into separate functions, and call them
from all the emulations rather than hard-coding everything. (Avoids uses
the stackgap crap for these system calls.)
* Add a new flag (p_checksig) to indicate that a process may have signals
pending and userret() needs to do the full (slow) check.
* Eliminate SAS_ALTSTACK; it's exactly the inverse of SS_DISABLE.
* Correct emulation bugs with restoring SS_ONSTACK.
* Make the signal mask in the sigcontext always use the emulated mask format.
* Store signals internally in sigaction structures, rather than maintaining a
bunch of little sigsets for each SA_* bit.
* Keep track of where we put the signal trampoline, rather than figuring it out
in *_sendsig().
* Issue a warning when a non-emulated sigaction bit is observed.
* Add missing emulated signals, and a native SIGPWR (currently not used).
* Implement the `not reset when caught' semantics for relevant signals.

Note: Only code touched by the i386 port has been modified. Other ports and
emulations need to be updated.
 1.45 08-Sep-1998  rvb ufs_readdir no longer checks if vp->v_type != VDIR so
the individual emulated readdirs must check.
Since netbsd and freebsd return EINVAL for the error
and I don't know what the other platforms do, return
EINVAL for them too.
 1.44 18-Aug-1998  thorpej Add some braces to make egcs happy.
 1.43 07-Jul-1998  thorpej Oops, fix typo, pointed out by Urban Boquist <boquist@cs.chalmers.se>.
 1.42 02-Jul-1998  thorpej Implement the shrinking and no-change bits of the Linux mremap(2) system
call, provided by Urban Boquist <boquist@cs.chalmers.se> in PR #5693.

Add a comment about how one might implement the growing bit of mremap(2).
 1.41 24-Mar-1998  mycroft Fix typo in utime().
 1.40 03-Mar-1998  fvdl Only free cookiebuf when sure that the vop actually allocated it.
 1.39 01-Mar-1998  fvdl Merge with Lite2 + local changes
 1.38 20-Feb-1998  mycroft Linux's getsid(2) does in fact return a pid, not a pointer.
 1.37 14-Feb-1998  thorpej Add a comment clearly describing that Linux's getsid(2) differs from
the XPG4.2 definition in that it returns the kernel virtual address
of the session structure, rather than the process group ID of the
session leader.
 1.36 21-Oct-1997  fvdl branches: 1.36.2;
msync -> __msync13
 1.35 10-Oct-1997  fvdl Fix braino in my interpretation of the eof flag to VOP_READDIR.
 1.34 10-Oct-1997  mycroft Emulate mremap(2) by returning ENOMEM for now. This should be sufficient for
realloc(3) and other uses. From Matthias Scheler in PR 3920.
 1.33 10-Oct-1997  fvdl Signal error when getting a 64 bit offset cookie that can't be stored
in 32 bits. Provide an error message to the user, and return EINVAL.
Also, pay attention to the EOF flag from VOP_READDIR. Correct a
misspell in a panic message.
 1.32 04-Aug-1997  bouyer Fix "missing entries" bug when reading large directories: When reading a
directory and running out of space in the dest buffer, off should point to the
current entry (which was not saved) and not to the next.
I discovered this bug using linux and SunOS emulation over NFS, but seems to
affect other emulations as well.
 1.31 27-Jul-1997  augustss branches: 1.31.2;
Changes to the sudio system:
- It is now possible to handle devices that want "looping" DMA,
e.g. the SoundBlaster correctly. The WSS and SB drivers use this.
To do this several new methods were introduced in audio_hw_if.
- Different silence handling (forced by previous change).
- The audio driver can now be mmap()-ed, but due to problems in
the VM system only for writing for now.
- The OSS (Linux) audio emulation takes advantage of some of the
new features.
 1.30 07-Apr-1997  augustss Add Linux nice() syscall.
 1.29 10-Aug-1996  mycroft sys/dir.h -> sys/dirent.h
 1.28 23-Jun-1996  mycroft Catch up with setre[ug]id() changes.
 1.27 20-May-1996  fvdl branches: 1.27.4;
Update list of Linux syscalls and implement the ones that are likely to be
used and doable.
 1.26 04-Apr-1996  christos - Prototyping changes
- Fix bug that gcc -Wall found in linux_sys_getpgid()
 1.25 03-Apr-1996  mycroft Add explicit return types.
 1.24 18-Dec-1995  fvdl msync, readv and writev were recently added to the Linux kernel; add them
to the emulation as well.
 1.23 09-Dec-1995  mycroft We don't need a private version of fork() here any more.
 1.22 09-Oct-1995  mycroft Use cookies for directory offset, mostly from Greg Hudson.
 1.21 07-Oct-1995  mycroft Prefix names of system call implementation functions with `sys_'.
 1.20 19-Sep-1995  thorpej Make system calls conform to a standard prototype and bring those
prototypes into scope.
 1.19 13-Sep-1995  fvdl Update offset elsewhere in linux_getdents(); still emulate a bug in
Linux, but avoid endless loops.
 1.18 07-Sep-1995  fvdl Fix some bugs & typing problems.
 1.17 23-Aug-1995  fvdl Emulate some syscalls that appear in Linux 1.3: a select() with normal args,
getdents() and flock().
 1.16 21-Aug-1995  fvdl Check for status NULL argument in wait4 and waitpid. From PR #1392
by Thomas EberHardt.
 1.15 21-Aug-1995  mycroft Implement the old and older uname(2) calls.
 1.14 16-Aug-1995  mycroft If updating the timeval would make it negative, zero it instead.
 1.13 16-Aug-1995  mycroft Allow bogus timevals, per Linux.
 1.12 14-Aug-1995  mycroft Export bsd_to_linux_sig[], and use it.
 1.11 14-Aug-1995  mycroft Rearrange #includes.
 1.10 13-Aug-1995  mycroft Linux doesn't allow select(2) to be restarted.
 1.9 24-Jun-1995  christos Use compat_util.[ch].
 1.8 22-Jun-1995  fvdl * Changed to use generic ELF code from kern/exec_elf.c (which was taken
from the svr4 exec code plus the linux compat mods)
* Include file change
* Add multicast sockopts (from John Brezak)
 1.7 11-Jun-1995  fvdl Linux select() returns the amount of time left before a timeout would have
occured in the timeval structure. Emulate this behavior. Reported by
Theo de Raadt.
 1.6 11-Jun-1995  fvdl * Make Linux ELF binaries work. Lots of code duplication, but it will have to do
for now.
* Add a sanity check in linux_uselib
 1.5 10-Jun-1995  mycroft Rename the dirent fields to match Linux. Make sure the requested buffer
is no larger than MAXBSIZE.
 1.4 22-Mar-1995  mycroft Emulate the return value of times() better.
 1.3 21-Mar-1995  mycroft Update to use timer{add,sub}().
 1.2 05-Mar-1995  fvdl Added a few more system calls.
More consistent alternate root file semantics throughout.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.27.4.2 10-Dec-1996  mycroft From trunk:
sys/dir.h -> sys/dirent.h
 1.27.4.1 10-Dec-1996  mycroft From trunk:
Implement setre[ug]id() for real.
 1.31.2.2 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.31.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.36.2.2 08-May-1998  mycroft Pull up 1.41, per request of mycroft.
 1.36.2.1 21-Oct-1997  mycroft file linux_misc.c was added on branch netbsd-1-3 on 1998-05-08 08:43:58 +0000
 1.2 03-Oct-1998  christos moved via repository copy.
 1.1 01-Oct-1998  erh Add the architechture-wise multiplexing header files. These are the files that should be included by anything that needs a linux compat header. These will then include the appropriate architechture dependent and common header file(s).
 1.4 03-Oct-1998  christos moved via repository copy.
 1.3 01-Oct-1998  erh Add the architechture-wise multiplexing header files. These are the files that should be included by anything that needs a linux compat header. These will then include the appropriate architechture dependent and common header file(s).
 1.2 01-Oct-1998  erh Split compat/linux/linux_mmap.h into i386 and common parts.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.5 03-Oct-1998  christos moved via repository copy.
 1.4 01-Oct-1998  erh Add the architechture-wise multiplexing header files. These are the files that should be included by anything that needs a linux compat header. These will then include the appropriate architechture dependent and common header file(s).
 1.3 01-Oct-1998  erh Move IPC headers to common. The msg, sem and shm files, in addition to other common structures and to avoid creating several more machine dependent header files, include the syscall arguments for several system calls which don't exist on all architechtures.
 1.2 15-Aug-1995  fvdl Implement the rest of the sysv ipc calls ({sem,msg}*())
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.4 03-Oct-1998  christos moved via repository copy.
 1.3 01-Oct-1998  erh Add the architechture-wise multiplexing header files. These are the files that should be included by anything that needs a linux compat header. These will then include the appropriate architechture dependent and common header file(s).
 1.2 01-Oct-1998  erh Move IPC headers to common. The msg, sem and shm files, in addition to other common structures and to avoid creating several more machine dependent header files, include the syscall arguments for several system calls which don't exist on all architechtures.
 1.1 15-Aug-1995  fvdl Implement the rest of the sysv ipc calls ({sem,msg}*())
 1.4 03-Oct-1998  christos moved via repository copy.
 1.3 01-Oct-1998  erh Add the architechture-wise multiplexing header files. These are the files that should be included by anything that needs a linux compat header. These will then include the appropriate architechture dependent and common header file(s).
 1.2 01-Oct-1998  erh Move IPC headers to common. The msg, sem and shm files, in addition to other common structures and to avoid creating several more machine dependent header files, include the syscall arguments for several system calls which don't exist on all architechtures.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.2 03-Oct-1998  christos moved via repository copy.
 1.1 01-Oct-1998  erh Add the architechture-wise multiplexing header files. These are the files that should be included by anything that needs a linux compat header. These will then include the appropriate architechture dependent and common header file(s).
 1.14 01-Oct-1998  erh Split compat/linux/linux_signal.c into i386, common and multi-architecture parts.
 1.13 29-Sep-1998  tv Bracket stray printf()s by #ifdef DEBUG.
 1.12 11-Sep-1998  mycroft Substantial signal handling changes:
* Increase the size of sigset_t to accomodate 128 signals -- adding new
versions of sys_setprocmask(), sys_sigaction(), sys_sigpending() and
sys_sigsuspend() to handle the changed arguments.
* Abstract the guts of sys_sigaltstack(), sys_setprocmask(), sys_sigaction(),
sys_sigpending() and sys_sigsuspend() into separate functions, and call them
from all the emulations rather than hard-coding everything. (Avoids uses
the stackgap crap for these system calls.)
* Add a new flag (p_checksig) to indicate that a process may have signals
pending and userret() needs to do the full (slow) check.
* Eliminate SAS_ALTSTACK; it's exactly the inverse of SS_DISABLE.
* Correct emulation bugs with restoring SS_ONSTACK.
* Make the signal mask in the sigcontext always use the emulated mask format.
* Store signals internally in sigaction structures, rather than maintaining a
bunch of little sigsets for each SA_* bit.
* Keep track of where we put the signal trampoline, rather than figuring it out
in *_sendsig().
* Issue a warning when a non-emulated sigaction bit is observed.
* Add missing emulated signals, and a native SIGPWR (currently not used).
* Implement the `not reset when caught' semantics for relevant signals.

Note: Only code touched by the i386 port has been modified. Other ports and
emulations need to be updated.
 1.11 09-Aug-1998  perry bzero->memset, bcopy->memcpy, bcmp->memcmp
 1.10 04-Apr-1996  christos branches: 1.10.16;
- Add missing prototypes
- Fix bugs with reversed arguments that prototyping discovered
 1.9 07-Oct-1995  mycroft Prefix names of system call implementation functions with `sys_'.
 1.8 19-Sep-1995  thorpej Make system calls conform to a standard prototype and bring those
prototypes into scope.
 1.7 14-Aug-1995  mycroft Move signal types into signal.h.
 1.6 13-Aug-1995  mycroft Convert SA_NOMASK and SA_ONESHOT.
Clean up this code a bit.
 1.5 24-Jun-1995  christos Use compat_util.[ch].
 1.4 22-Jun-1995  fvdl * Changed to use generic ELF code from kern/exec_elf.c (which was taken
from the svr4 exec code plus the linux compat mods)
* Include file change
* Add multicast sockopts (from John Brezak)
 1.3 10-Mar-1995  fvdl Add the Linux pause() system call. Fix the arguments to sigsuspend().
 1.2 08-Mar-1995  fvdl Fix typo in comment.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.10.16.2 18-Jan-2001  jdolecek oops, undo previous change, which was committed accidentaly here
 1.10.16.1 18-Jan-2001  jdolecek constify
 1.8 03-Oct-1998  christos moved via repository copy.
 1.7 01-Oct-1998  erh Add the architechture-wise multiplexing header files. These are the files that should be included by anything that needs a linux compat header. These will then include the appropriate architechture dependent and common header file(s).
 1.6 01-Oct-1998  erh Split compat/linux/linux_signal.h into i386 and common parts.
 1.5 11-Sep-1998  mycroft Substantial signal handling changes:
* Increase the size of sigset_t to accomodate 128 signals -- adding new
versions of sys_setprocmask(), sys_sigaction(), sys_sigpending() and
sys_sigsuspend() to handle the changed arguments.
* Abstract the guts of sys_sigaltstack(), sys_setprocmask(), sys_sigaction(),
sys_sigpending() and sys_sigsuspend() into separate functions, and call them
from all the emulations rather than hard-coding everything. (Avoids uses
the stackgap crap for these system calls.)
* Add a new flag (p_checksig) to indicate that a process may have signals
pending and userret() needs to do the full (slow) check.
* Eliminate SAS_ALTSTACK; it's exactly the inverse of SS_DISABLE.
* Correct emulation bugs with restoring SS_ONSTACK.
* Make the signal mask in the sigcontext always use the emulated mask format.
* Store signals internally in sigaction structures, rather than maintaining a
bunch of little sigsets for each SA_* bit.
* Keep track of where we put the signal trampoline, rather than figuring it out
in *_sendsig().
* Issue a warning when a non-emulated sigaction bit is observed.
* Add missing emulated signals, and a native SIGPWR (currently not used).
* Implement the `not reset when caught' semantics for relevant signals.

Note: Only code touched by the i386 port has been modified. Other ports and
emulations need to be updated.
 1.4 27-Aug-1995  fvdl Add a hook for MD ioctl calls, plus a couple of more changes to make
svgalib binaries work on the i386
 1.3 14-Aug-1995  mycroft Export bsd_to_linux_sig[], and use it.
 1.2 14-Aug-1995  mycroft Move signal types into signal.h.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.16 01-Oct-1998  erh Split linux/compat/linux_socket.c into common and multi-architechture parts. linux_socketcall.c contains the socketcall multiplexer.
 1.15 22-Dec-1996  fvdl Make this compile again, including Politically Correct const handling.
 1.14 05-Apr-1996  christos Prototyping changes.
 1.13 08-Mar-1996  mycroft Separate ioctl emulation by group. Add (minimal) audio emulation.
 1.12 07-Oct-1995  mycroft Prefix names of system call implementation functions with `sys_'.
 1.11 19-Sep-1995  thorpej Make system calls conform to a standard prototype and bring those
prototypes into scope.
 1.10 14-Aug-1995  mycroft Rearrange #includes.
 1.9 24-Jun-1995  christos Use compat_util.[ch].
 1.8 22-Jun-1995  fvdl * Changed to use generic ELF code from kern/exec_elf.c (which was taken
from the svr4 exec code plus the linux compat mods)
* Include file change
* Add multicast sockopts (from John Brezak)
 1.7 28-May-1995  mycroft Need netinet/tcp.h.
 1.6 28-May-1995  mycroft Convert TCP socket options.
 1.5 28-May-1995  mycroft Fill in `name' argument to getsockopt() correctly.
 1.4 28-May-1995  mycroft Fix typo.
 1.3 28-May-1995  mycroft Convert IP socket options.
 1.2 28-May-1995  mycroft Get rid of damned `static's.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.6 03-Oct-1998  christos moved via repository copy.
 1.5 01-Oct-1998  erh Add the architechture-wise multiplexing header files. These are the files that should be included by anything that needs a linux compat header. These will then include the appropriate architechture dependent and common header file(s).
 1.4 01-Oct-1998  erh Split linux_socket.h into i386 and common parts.
 1.3 28-May-1995  mycroft Convert TCP socket options.
 1.2 28-May-1995  mycroft Convert IP socket options.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.4 03-Oct-1998  christos moved via repository copy.
 1.3 01-Oct-1998  erh Add the architechture-wise multiplexing header files. These are the files that should be included by anything that needs a linux compat header. These will then include the appropriate architechture dependent and common header file(s).
 1.2 01-Oct-1998  erh Move compat/linux/linux_socketcall.h to multiarch. Defines for the socketcall multiplexer.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.8 03-Oct-1998  christos moved via repository copy.
 1.7 01-Oct-1998  erh Add the architechture-wise multiplexing header files. These are the files that should be included by anything that needs a linux compat header. These will then include the appropriate architechture dependent and common header file(s).
 1.6 01-Oct-1998  erh Move compat/linux/linux_sockio.h to common.
 1.5 08-Mar-1996  mycroft Separate ioctl emulation by group. Add (minimal) audio emulation.
 1.4 27-Feb-1996  mycroft Map SIOCGIFFLAGS and SIOCGIFADDR (et al).
 1.3 27-Feb-1996  mycroft Map SIOCGIFCONF.
 1.2 22-Jun-1995  fvdl * Changed to use generic ELF code from kern/exec_elf.c (which was taken
from the svr4 exec code plus the linux compat mods)
* Include file change
* Add multicast sockopts (from John Brezak)
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.44 23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.43 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.42 11-Dec-2005  christos branches: 1.42.70; 1.42.72; 1.42.74;
merge ktrace-lwp.
 1.41 15-May-2005  fvdl Fix up COMPAT_LINUX support for amd64. Still a work in progress, not
usable yet ("Hello World" runs, but many other things do not work).
 1.40 14-Jan-2002  bjh21 branches: 1.40.16;
Crude first cut at ARMLinux binary compatibility. Successfully runs
"/emul/linux/bin/echo hello, world", dynamically linked.
 1.39 22-Sep-2001  manu Enabled Mips Linux emul in header files
 1.38 19-Jan-2001  manu branches: 1.38.2; 1.38.4; 1.38.6;
Added support for powerpc Linux compatibility
 1.37 15-Dec-1998  itohy branches: 1.37.8;
Added linux compat support on m68k ports.
 1.36 03-Oct-1998  christos Attempt to fix the mess.
 1.35 01-Oct-1998  christos Provide a suitable default so that kdump compiles on architectures
not supported yet.
 1.34 01-Oct-1998  erh Add the architechture-wise multiplexing header files. These are the files that should be included by anything that needs a linux compat header. These will then include the appropriate architechture dependent and common header file(s).
 1.33 01-Oct-1998  erh These syscall table files have been regenerated in compat/linux/i386.
 1.32 11-Sep-1998  mycroft Regen.
 1.31 07-Aug-1998  kleink Regen again, to indicate which master revision these were generated from.
 1.30 05-Aug-1998  perry enable nanosleep in linux emul, per pr-5906 from Soren S. Jorvang
 1.29 20-Feb-1998  mycroft Regen.
 1.28 19-Feb-1998  thorpej Regen: makesyscalls.sh changed.
 1.27 19-Feb-1998  thorpej regen; makesyscalls.sh changed
 1.26 09-Jan-1998  thorpej Regen.
 1.25 08-Jan-1998  thorpej Regen: back out RCD ID related changes.
 1.24 05-Jan-1998  perry regened with RCSIDs in place
 1.23 16-Oct-1997  christos branches: 1.23.2;
Regen.
 1.22 16-Oct-1997  mycroft Regen.
 1.21 10-Oct-1997  mycroft Regen.
 1.20 13-Jun-1997  thorpej branches: 1.20.4;
Regen: Use compat_12_sys_swapon().
 1.19 07-Apr-1997  augustss Regen.
 1.18 13-Jan-1997  thorpej Regen; makesyscalls.sh emits comments now.
 1.17 20-May-1996  fvdl Regen.
 1.16 18-Dec-1995  fvdl syscalls.master changed
 1.15 09-Dec-1995  mycroft Reran makesyscalls.sh.
 1.14 07-Oct-1995  mycroft Reran makesyscalls.sh.
 1.13 07-Sep-1995  fvdl syscalls.master changed
 1.12 27-Aug-1995  fvdl syscalls.master changed
 1.11 23-Aug-1995  fvdl syscalls.master changed
 1.10 21-Aug-1995  mycroft syscalls.master changed.
 1.9 14-Aug-1995  mycroft syscalls.master changed.
 1.8 24-Jul-1995  fvdl syscalls.master changed
 1.7 11-Jun-1995  fvdl Remade these after syscalls.master had changed.
 1.6 06-May-1995  mycroft Add linux_modify_ldt(), if __i386__.
 1.5 22-Apr-1995  christos - added struct emul to all emulations.
- removed all setup functions.
- added copyargs() functions where needed.
 1.4 07-Apr-1995  fvdl syscalls.master was changed, so update these
 1.3 10-Mar-1995  fvdl Update automatically generated syscall files.
 1.2 05-Mar-1995  fvdl Added a few more system calls.
More consistent alternate root file semantics throughout.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.20.4.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.23.2.1 02-Feb-1999  cgd regen for pullup of rev 1.24 of syscalls.master (drochner)
 1.37.8.1 11-Feb-2001  bouyer Sync with HEAD.
 1.38.6.1 01-Oct-2001  fvdl Catch up with -current.
 1.38.4.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.38.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.38.2.2 28-Feb-2002  nathanw Catch up to -current.
 1.38.2.1 26-Sep-2001  nathanw Catch up to -current.
Again.
 1.40.16.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.42.74.1 16-May-2008  yamt sync with head.
 1.42.72.1 18-May-2008  yamt sync with head.
 1.42.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.43 23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.42 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.41 01-Jan-2008  njoly branches: 1.41.6; 1.41.8; 1.41.10;
s/i386/__i386__/.
 1.40 11-Dec-2005  christos branches: 1.40.46; 1.40.52; 1.40.60;
merge ktrace-lwp.
 1.39 15-May-2005  fvdl branches: 1.39.2;
Fix up COMPAT_LINUX support for amd64. Still a work in progress, not
usable yet ("Hello World" runs, but many other things do not work).
 1.38 14-Jan-2002  bjh21 branches: 1.38.16;
Crude first cut at ARMLinux binary compatibility. Successfully runs
"/emul/linux/bin/echo hello, world", dynamically linked.
 1.37 22-Sep-2001  manu Enabled Mips Linux emul in header files
 1.36 19-Jan-2001  manu branches: 1.36.2; 1.36.4; 1.36.6;
Added support for powerpc Linux compatibility
 1.35 15-Dec-1998  itohy branches: 1.35.8;
Added linux compat support on m68k ports.
 1.34 03-Oct-1998  christos Attempt to fix the mess.
 1.33 01-Oct-1998  erh Add the architechture-wise multiplexing header files. These are the files that should be included by anything that needs a linux compat header. These will then include the appropriate architechture dependent and common header file(s).
 1.32 01-Oct-1998  erh These syscall table files have been regenerated in compat/linux/i386.
 1.31 11-Sep-1998  mycroft Regen.
 1.30 07-Aug-1998  kleink Regen again, to indicate which master revision these were generated from.
 1.29 05-Aug-1998  perry enable nanosleep in linux emul, per pr-5906 from Soren S. Jorvang
 1.28 20-Feb-1998  mycroft Regen.
 1.27 19-Feb-1998  thorpej Regen: makesyscalls.sh changed.
 1.26 19-Feb-1998  thorpej regen; makesyscalls.sh changed
 1.25 09-Jan-1998  thorpej Regen.
 1.24 08-Jan-1998  thorpej Regen: back out RCD ID related changes.
 1.23 05-Jan-1998  perry regened with RCSIDs in place
 1.22 16-Oct-1997  christos branches: 1.22.2;
Regen.
 1.21 16-Oct-1997  mycroft Regen.
 1.20 10-Oct-1997  mycroft Regen.
 1.19 13-Jun-1997  thorpej branches: 1.19.4;
Regen: Use compat_12_sys_swapon().
 1.18 07-Apr-1997  augustss Regen.
 1.17 20-May-1996  fvdl branches: 1.17.6;
Regen.
 1.16 18-Dec-1995  fvdl syscalls.master changed
 1.15 09-Dec-1995  mycroft Reran makesyscalls.sh.
 1.14 07-Oct-1995  mycroft Reran makesyscalls.sh.
 1.13 19-Sep-1995  thorpej makesyscalls.sh changed.
 1.12 07-Sep-1995  fvdl syscalls.master changed
 1.11 27-Aug-1995  fvdl syscalls.master changed
 1.10 23-Aug-1995  fvdl syscalls.master changed
 1.9 21-Aug-1995  mycroft syscalls.master changed.
 1.8 14-Aug-1995  mycroft syscalls.master changed.
 1.7 24-Jul-1995  fvdl syscalls.master changed
 1.6 11-Jun-1995  fvdl Remade these after syscalls.master had changed.
 1.5 06-May-1995  mycroft Add linux_modify_ldt(), if __i386__.
 1.4 07-Apr-1995  fvdl syscalls.master was changed, so update these
 1.3 10-Mar-1995  fvdl Update automatically generated syscall files.
 1.2 05-Mar-1995  fvdl Added a few more system calls.
More consistent alternate root file semantics throughout.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.17.6.1 14-Feb-1997  mrg regen.
 1.19.4.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.22.2.1 02-Feb-1999  cgd regen for pullup of rev 1.24 of syscalls.master (drochner)
 1.35.8.1 11-Feb-2001  bouyer Sync with HEAD.
 1.36.6.1 01-Oct-2001  fvdl Catch up with -current.
 1.36.4.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.36.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.36.2.2 28-Feb-2002  nathanw Catch up to -current.
 1.36.2.1 26-Sep-2001  nathanw Catch up to -current.
Again.
 1.38.16.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.39.2.1 21-Jan-2008  yamt sync with head
 1.40.60.1 02-Jan-2008  bouyer Sync with HEAD
 1.40.52.1 18-Feb-2008  mjf Sync with HEAD.
 1.40.46.1 09-Jan-2008  matt sync with HEAD
 1.41.10.1 16-May-2008  yamt sync with head.
 1.41.8.1 18-May-2008  yamt sync with head.
 1.41.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.44 23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.43 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.42 11-Dec-2005  christos branches: 1.42.70; 1.42.72; 1.42.74;
merge ktrace-lwp.
 1.41 15-May-2005  fvdl Fix up COMPAT_LINUX support for amd64. Still a work in progress, not
usable yet ("Hello World" runs, but many other things do not work).
 1.40 14-Jan-2002  bjh21 branches: 1.40.16;
Crude first cut at ARMLinux binary compatibility. Successfully runs
"/emul/linux/bin/echo hello, world", dynamically linked.
 1.39 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.38 14-Oct-2001  manu Added Mips
 1.37 19-Jan-2001  manu branches: 1.37.2; 1.37.4;
Added support for powerpc Linux compatibility
 1.36 15-Nov-2000  onoe Adopt the recent change to makesyscalls.sh (char * -> const char * const)
to make kdump compilable for arch without linux emulation.
 1.35 15-Dec-1998  itohy branches: 1.35.8;
Added linux compat support on m68k ports.
 1.34 03-Oct-1998  christos Attempt to fix the mess.
 1.33 01-Oct-1998  christos Provide a suitable default so that kdump compiles on architectures
not supported yet.
 1.32 01-Oct-1998  erh Architechture-wise multiplexer for linux_syscalls.c. This exists because kdump, et al. include this file.
 1.31 01-Oct-1998  erh These syscall table files have been regenerated in compat/linux/i386.
 1.30 11-Sep-1998  mycroft Regen.
 1.29 07-Aug-1998  kleink Regen again, to indicate which master revision these were generated from.
 1.28 05-Aug-1998  perry enable nanosleep in linux emul, per pr-5906 from Soren S. Jorvang
 1.27 20-Feb-1998  mycroft Regen.
 1.26 19-Feb-1998  thorpej Regen: makesyscalls.sh changed.
 1.25 19-Feb-1998  thorpej regen; makesyscalls.sh changed
 1.24 09-Jan-1998  thorpej Regen.
 1.23 08-Jan-1998  thorpej Regen: back out RCD ID related changes.
 1.22 05-Jan-1998  perry regened with RCSIDs in place
 1.21 16-Oct-1997  christos branches: 1.21.2;
Regen.
 1.20 16-Oct-1997  mycroft Regen.
 1.19 10-Oct-1997  mycroft Regen.
 1.18 13-Jun-1997  thorpej branches: 1.18.4;
Regen: Use compat_12_sys_swapon().
 1.17 07-Apr-1997  augustss Regen.
 1.16 20-May-1996  fvdl Regen.
 1.15 18-Dec-1995  fvdl syscalls.master changed
 1.14 09-Dec-1995  mycroft Reran makesyscalls.sh.
 1.13 07-Oct-1995  mycroft Reran makesyscalls.sh.
 1.12 07-Sep-1995  fvdl syscalls.master changed
 1.11 27-Aug-1995  fvdl syscalls.master changed
 1.10 23-Aug-1995  fvdl syscalls.master changed
 1.9 21-Aug-1995  mycroft syscalls.master changed.
 1.8 14-Aug-1995  mycroft syscalls.master changed.
 1.7 24-Jul-1995  fvdl syscalls.master changed
 1.6 11-Jun-1995  fvdl Remade these after syscalls.master had changed.
 1.5 06-May-1995  mycroft Add linux_modify_ldt(), if __i386__.
 1.4 07-Apr-1995  fvdl syscalls.master was changed, so update these
 1.3 10-Mar-1995  fvdl Update automatically generated syscall files.
 1.2 05-Mar-1995  fvdl Added a few more system calls.
More consistent alternate root file semantics throughout.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.18.4.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.21.2.1 02-Feb-1999  cgd regen for pullup of rev 1.24 of syscalls.master (drochner)
 1.35.8.2 11-Feb-2001  bouyer Sync with HEAD.
 1.35.8.1 22-Nov-2000  bouyer Sync with HEAD.
 1.37.4.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.37.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.37.2.3 28-Feb-2002  nathanw Catch up to -current.
 1.37.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.37.2.1 22-Oct-2001  nathanw Catch up to -current.
 1.40.16.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.42.74.1 16-May-2008  yamt sync with head.
 1.42.72.1 18-May-2008  yamt sync with head.
 1.42.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.34 01-Oct-1998  erh These syscall table files have been regenerated in compat/linux/i386.
 1.33 11-Sep-1998  mycroft Regen.
 1.32 07-Aug-1998  kleink Regen again, to indicate which master revision these were generated from.
 1.31 05-Aug-1998  perry enable nanosleep in linux emul, per pr-5906 from Soren S. Jorvang
 1.30 20-Feb-1998  mycroft Regen.
 1.29 19-Feb-1998  thorpej Regen: makesyscalls.sh changed.
 1.28 19-Feb-1998  thorpej regen; makesyscalls.sh changed
 1.27 09-Jan-1998  thorpej Regen.
 1.26 08-Jan-1998  thorpej Regen: back out RCD ID related changes.
 1.25 05-Jan-1998  perry regened with RCSIDs in place
 1.24 16-Oct-1997  christos branches: 1.24.2;
Regen.
 1.23 16-Oct-1997  mycroft Regen.
 1.22 10-Oct-1997  mycroft Regen.
 1.21 13-Jun-1997  thorpej branches: 1.21.4;
Regen: Use compat_12_sys_swapon().
 1.20 07-Apr-1997  augustss Regen.
 1.19 20-May-1996  fvdl branches: 1.19.6;
Regen.
 1.18 18-Dec-1995  fvdl syscalls.master changed
 1.17 09-Dec-1995  mycroft Reran makesyscalls.sh.
 1.16 09-Dec-1995  mycroft We don't need a private version of fork() here any more.
 1.15 07-Oct-1995  mycroft Reran makesyscalls.sh.
 1.14 19-Sep-1995  thorpej makesyscalls.sh changed.
 1.13 07-Sep-1995  fvdl syscalls.master changed
 1.12 27-Aug-1995  fvdl syscalls.master changed
 1.11 23-Aug-1995  fvdl syscalls.master changed
 1.10 21-Aug-1995  mycroft syscalls.master changed.
 1.9 14-Aug-1995  mycroft syscalls.master changed.
 1.8 24-Jul-1995  fvdl syscalls.master changed
 1.7 11-Jun-1995  fvdl Remade these after syscalls.master had changed.
 1.6 06-May-1995  mycroft Add linux_modify_ldt(), if __i386__.
 1.5 22-Apr-1995  christos - added struct emul to all emulations.
- removed all setup functions.
- added copyargs() functions where needed.
 1.4 07-Apr-1995  fvdl syscalls.master was changed, so update these
 1.3 10-Mar-1995  fvdl Update automatically generated syscall files.
 1.2 05-Mar-1995  fvdl Added a few more system calls.
More consistent alternate root file semantics throughout.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.19.6.1 14-Feb-1997  mrg regen.
 1.21.4.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.24.2.1 02-Feb-1999  cgd regen for pullup of rev 1.24 of syscalls.master (drochner)
 1.1 07-Mar-2015  christos branches: 1.1.2; 1.1.18;
centralize arguments functions
 1.1.18.2 03-Dec-2017  jdolecek update from HEAD
 1.1.18.1 07-Mar-2015  jdolecek file linux_systrace_args.c was added on branch tls-maxphys on 2017-12-03 11:36:53 +0000
 1.1.2.2 06-Apr-2015  skrll Sync with HEAD
 1.1.2.1 07-Mar-2015  skrll file linux_systrace_args.c was added on branch nick-nhusb on 2015-04-06 15:18:05 +0000
 1.4 01-Oct-1998  erh Moved from compat/linux/linux_termios.c to common.
 1.3 05-Apr-1996  christos Prototyping changes.
 1.2 03-Apr-1996  mycroft Add explicit return types.
 1.1 08-Mar-1996  mycroft Separate ioctl emulation by group. Add (minimal) audio emulation.
 1.5 03-Oct-1998  christos moved via repository copy.
 1.4 01-Oct-1998  erh Add the architechture-wise multiplexing header files. These are the files that should be included by anything that needs a linux compat header. These will then include the appropriate architechture dependent and common header file(s).
 1.3 01-Oct-1998  erh Split compat/linux/linux_termios.h into i386 and common parts.
 1.2 05-Jan-1998  perry RCSID Police.
 1.1 08-Mar-1996  mycroft Separate ioctl emulation by group. Add (minimal) audio emulation.
 1.8 03-Oct-1998  christos moved via repository copy.
 1.7 01-Oct-1998  erh Add the architechture-wise multiplexing header files. These are the files that should be included by anything that needs a linux compat header. These will then include the appropriate architechture dependent and common header file(s).
 1.6 01-Oct-1998  erh Split linux_types.h into i386, common and multi-architechture parts.
 1.5 20-May-1996  fvdl Update list of Linux syscalls and implement the ones that are likely to be
used and doable.
 1.4 21-Aug-1995  mycroft Implement the old and older uname(2) calls.
 1.3 14-Aug-1995  mycroft Move signal types into signal.h.
 1.2 05-Mar-1995  fvdl Added a few more system calls.
More consistent alternate root file semantics throughout.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.4 24-Jun-1995  christos Use compat_util.[ch].
 1.3 22-Jun-1995  fvdl * Changed to use generic ELF code from kern/exec_elf.c (which was taken
from the svr4 exec code plus the linux compat mods)
* Include file change
* Add multicast sockopts (from John Brezak)
 1.2 05-Mar-1995  fvdl Added a few more system calls.
More consistent alternate root file semantics throughout.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.9 03-Oct-1998  christos moved via repository copy.
 1.8 01-Oct-1998  erh Add the architechture-wise multiplexing header files. These are the files that should be included by anything that needs a linux compat header. These will then include the appropriate architechture dependent and common header file(s).
 1.7 01-Oct-1998  erh Move compat/linux/linux_util.h to common.
 1.6 05-Sep-1998  christos Assign copyright to TNF.
 1.5 24-Jun-1995  christos Use compat_util.[ch].
 1.4 22-Jun-1995  fvdl * Changed to use generic ELF code from kern/exec_elf.c (which was taken
from the svr4 exec code plus the linux compat mods)
* Include file change
* Add multicast sockopts (from John Brezak)
 1.3 07-Apr-1995  fvdl Handle Linux signal tramp code differently. Some changes because of the
now seperate Linux signal trampoline code. Add linux_sigreturn to
syscalls.master.
 1.2 05-Mar-1995  fvdl Added a few more system calls.
More consistent alternate root file semantics throughout.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.2 01-Oct-1998  erh Moved to compat/linux/i386.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.26 01-Oct-1998  erh Move compat/linux/syscalls.master to i386. Add a few syscalls while I'm here.
 1.25 11-Sep-1998  mycroft Substantial signal handling changes:
* Increase the size of sigset_t to accomodate 128 signals -- adding new
versions of sys_setprocmask(), sys_sigaction(), sys_sigpending() and
sys_sigsuspend() to handle the changed arguments.
* Abstract the guts of sys_sigaltstack(), sys_setprocmask(), sys_sigaction(),
sys_sigpending() and sys_sigsuspend() into separate functions, and call them
from all the emulations rather than hard-coding everything. (Avoids uses
the stackgap crap for these system calls.)
* Add a new flag (p_checksig) to indicate that a process may have signals
pending and userret() needs to do the full (slow) check.
* Eliminate SAS_ALTSTACK; it's exactly the inverse of SS_DISABLE.
* Correct emulation bugs with restoring SS_ONSTACK.
* Make the signal mask in the sigcontext always use the emulated mask format.
* Store signals internally in sigaction structures, rather than maintaining a
bunch of little sigsets for each SA_* bit.
* Keep track of where we put the signal trampoline, rather than figuring it out
in *_sendsig().
* Issue a warning when a non-emulated sigaction bit is observed.
* Add missing emulated signals, and a native SIGPWR (currently not used).
* Implement the `not reset when caught' semantics for relevant signals.

Note: Only code touched by the i386 port has been modified. Other ports and
emulations need to be updated.
 1.24 05-Aug-1998  perry enable nanosleep in linux emul, per pr-5906 from Soren S. Jorvang
 1.23 20-Feb-1998  mycroft Linux's getsid(2) does in fact return a pid, not a pointer.
 1.22 19-Feb-1998  thorpej Change a comment to reflect new makesyscalls.sh behavior.
 1.21 16-Oct-1997  christos branches: 1.21.2;
ostat -> stat43
 1.20 15-Oct-1997  mycroft Fix a typo inherited from kern/syscalls.master.
 1.19 10-Oct-1997  mycroft Emulate mremap(2) by returning ENOMEM for now. This should be sufficient for
realloc(3) and other uses. From Matthias Scheler in PR 3920.
 1.18 13-Jun-1997  thorpej branches: 1.18.4;
Use compat_12_sys_swapon().
 1.17 07-Apr-1997  augustss Add Linux nice() syscall.
 1.16 20-May-1996  fvdl branches: 1.16.6;
Update list of Linux syscalls and implement the ones that are likely to be
used and doable.
 1.15 18-Dec-1995  fvdl msync, readv and writev were recently added to the Linux kernel; add them
to the emulation as well.
 1.14 09-Dec-1995  mycroft We don't need a private version of fork() here any more.
 1.13 07-Oct-1995  mycroft Prefix names of system call implementation functions with `sys_'.
 1.12 07-Sep-1995  fvdl Fix some bugs & typing problems.
 1.11 27-Aug-1995  fvdl Add a hook for MD ioctl calls, plus a couple of more changes to make
svgalib binaries work on the i386
 1.10 23-Aug-1995  fvdl Emulate some syscalls that appear in Linux 1.3: a select() with normal args,
getdents() and flock().
 1.9 21-Aug-1995  mycroft Implement the old and older uname(2) calls.
 1.8 14-Aug-1995  mycroft Rearrange #includes.
 1.7 24-Jul-1995  fvdl mkdir() has 2 arguments.. fixes PR 1248 (from Brad Spencer)
 1.6 11-Jun-1995  fvdl * Make Linux ELF binaries work. Lots of code duplication, but it will have to do
for now.
* Add a sanity check in linux_uselib
 1.5 06-May-1995  mycroft Add linux_modify_ldt(), if __i386__.
 1.4 07-Apr-1995  fvdl Handle Linux signal tramp code differently. Some changes because of the
now seperate Linux signal trampoline code. Add linux_sigreturn to
syscalls.master.
 1.3 10-Mar-1995  fvdl Add the Linux pause() system call. Fix the arguments to sigsuspend().
 1.2 05-Mar-1995  fvdl Added a few more system calls.
More consistent alternate root file semantics throughout.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.16.6.1 12-Feb-1997  mrg initial work for dynamic swap additions.
 1.18.4.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.21.2.1 02-Feb-1999  cgd pull up rev 1.24 from trunk (drochner)
 1.3 24-Nov-2021  ryo add missing SUBDIR aarch64
 1.2 09-Nov-2019  jdolecek don't descend to sparc and sparc64, they don't have syscalls.master
so it just errors out
 1.1 16-Jan-2017  christos branches: 1.1.2; 1.1.4; 1.1.8; 1.1.18; 1.1.22;
add Makefile struct
 1.1.22.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.1.18.2 03-Dec-2017  jdolecek update from HEAD
 1.1.18.1 16-Jan-2017  jdolecek file Makefile was added on branch tls-maxphys on 2017-12-03 11:36:53 +0000
 1.1.8.2 21-Apr-2017  bouyer Sync with HEAD
 1.1.8.1 16-Jan-2017  bouyer file Makefile was added on branch bouyer-socketcan on 2017-04-21 16:53:41 +0000
 1.1.4.2 20-Mar-2017  pgoyette Sync with HEAD
 1.1.4.1 16-Jan-2017  pgoyette file Makefile was added on branch pgoyette-localcount on 2017-03-20 06:57:24 +0000
 1.1.2.2 05-Feb-2017  skrll Sync with HEAD
 1.1.2.1 16-Jan-2017  skrll file Makefile was added on branch nick-nhusb on 2017-02-05 13:40:24 +0000
 1.2 29-May-2024  christos should not be using .include <> but .include "" here.
 1.1 23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.1 23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.3 25-Nov-2021  ryo add support COMPAT_LINUX32 for aarch64
 1.2 12-Oct-2021  andvar fix various typos, mainly in comments.
 1.1 23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.1 23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.3 26-Nov-2021  ryo The internal architecture name of golang is "arm" or "arm64", which has
different naming conventions from netbsd's machine[] or machine_arch[]
("earmv7", "aarch64", etc.) and cannot be used as is.
Instead, use define LINUX_GO_RT0_SIGNATURE_ARCH{32,64}.
 1.2 26-Nov-2021  ryo - LINUX_GO_RT0_SIGNATURE for compat_linux is no longer enabled by default.
it is now defined in each arch same as the other *_SIGNATURE definitions.
- add new LINUX32_GO_RT0_SIGNATURE for compat_linux32, and is defined in amd64 and aarch64.
 1.1 23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.1 23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.4 07-Feb-2024  msaitoh Remove ryo@'s mail addresses.
 1.3 01-Nov-2021  thorpej Use "stack_t" instead of "struct sigaltstack", as the former is the
newer standardized name. NFC.
 1.2 09-Oct-2021  ryo Modularize compat_linux(8) for aarch64.
 1.1 23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.3 30-Nov-2021  ryo - uname should return "aarch64" or "aarch64_be" instead of "evbarm".
- define LINUX_LARGEFILE64 to use rlimit instead of orlimit.
 1.2 25-Nov-2021  ryo add support COMPAT_LINUX32 for aarch64
 1.1 23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.1 23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.1 23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.1 23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.1 23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.1 23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.1 23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.14 26-Oct-2025  christos regen
 1.13 28-Sep-2024  christos regen
 1.12 01-Jul-2024  christos regen
 1.11 29-Jun-2024  christos branches: 1.11.2;
regen
 1.10 19-Aug-2023  christos regen
 1.9 18-Aug-2023  christos regen
 1.8 29-Jul-2023  christos regen
 1.7 29-Jul-2023  rin linux/aarch64: Regen for syscalls.master,v 1.8
 1.6 28-Jul-2023  christos regen
 1.5 10-Jul-2023  christos regen
 1.4 02-Dec-2021  ryo regen
 1.3 25-Nov-2021  ryo regen
 1.2 24-Nov-2021  ryo regen
 1.1 23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.11.2.1 02-Aug-2025  perseant Sync with HEAD
 1.14 26-Oct-2025  christos regen
 1.13 28-Sep-2024  christos regen
 1.12 01-Jul-2024  christos regen
 1.11 29-Jun-2024  christos branches: 1.11.2;
regen
 1.10 19-Aug-2023  christos regen
 1.9 18-Aug-2023  christos regen
 1.8 29-Jul-2023  christos regen
 1.7 29-Jul-2023  rin linux/aarch64: Regen for syscalls.master,v 1.8
 1.6 28-Jul-2023  christos regen
 1.5 10-Jul-2023  christos regen
 1.4 02-Dec-2021  ryo regen
 1.3 25-Nov-2021  ryo regen
 1.2 24-Nov-2021  ryo regen
 1.1 23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.11.2.1 02-Aug-2025  perseant Sync with HEAD
 1.14 26-Oct-2025  christos regen
 1.13 28-Sep-2024  christos regen
 1.12 01-Jul-2024  christos regen
 1.11 29-Jun-2024  christos branches: 1.11.2;
regen
 1.10 19-Aug-2023  christos regen
 1.9 18-Aug-2023  christos regen
 1.8 29-Jul-2023  christos regen
 1.7 29-Jul-2023  rin linux/aarch64: Regen for syscalls.master,v 1.8
 1.6 28-Jul-2023  christos regen
 1.5 10-Jul-2023  christos regen
 1.4 02-Dec-2021  ryo regen
 1.3 25-Nov-2021  ryo regen
 1.2 24-Nov-2021  ryo regen
 1.1 23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.11.2.1 02-Aug-2025  perseant Sync with HEAD
 1.14 26-Oct-2025  christos regen
 1.13 28-Sep-2024  christos regen
 1.12 01-Jul-2024  christos regen
 1.11 29-Jun-2024  christos branches: 1.11.2;
regen
 1.10 19-Aug-2023  christos regen
 1.9 18-Aug-2023  christos regen
 1.8 29-Jul-2023  christos regen
 1.7 29-Jul-2023  rin linux/aarch64: Regen for syscalls.master,v 1.8
 1.6 28-Jul-2023  christos regen
 1.5 10-Jul-2023  christos regen
 1.4 02-Dec-2021  ryo regen
 1.3 25-Nov-2021  ryo regen
 1.2 24-Nov-2021  ryo regen
 1.1 23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.11.2.1 02-Aug-2025  perseant Sync with HEAD
 1.14 26-Oct-2025  christos regen
 1.13 28-Sep-2024  christos regen
 1.12 01-Jul-2024  christos regen
 1.11 29-Jun-2024  christos branches: 1.11.2;
regen
 1.10 19-Aug-2023  christos regen
 1.9 18-Aug-2023  christos regen
 1.8 29-Jul-2023  christos regen
 1.7 29-Jul-2023  rin linux/aarch64: Regen for syscalls.master,v 1.8
 1.6 28-Jul-2023  christos regen
 1.5 10-Jul-2023  christos regen
 1.4 02-Dec-2021  ryo regen
 1.3 25-Nov-2021  ryo regen
 1.2 24-Nov-2021  ryo regen
 1.1 23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.11.2.1 02-Aug-2025  perseant Sync with HEAD
 1.1 23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.1 23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.1 23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.15 26-Oct-2025  christos PR/59722: Ricardo Branco: linux: Add support for semtimedop(2)
 1.14 28-Sep-2024  christos Linux GSoC-2024: renameat2, clone3, sync_file_range, syncfs (Shivraj Jamgade)
 1.13 01-Jul-2024  christos Add linux POSIX message queue support (Ricardo Branco)
 1.12 29-Jun-2024  christos branches: 1.12.2;
From gsoc 2024: Implement faccessat2 and getcpu (Shivraz)
 1.11 19-Aug-2023  christos Add inotify* syscalls GSoC 2023 (Theodore Preduta)
 1.10 18-Aug-2023  christos Add linux waitid(2) from GSoC 2023 (Theodore Preduta)
 1.9 29-Jul-2023  christos Add/fix statx, readahead, close_range. From GSoC 2023 by Theodore Preduta
 1.8 29-Jul-2023  rin linux/aarch64/syscalls.master: Dedup and sort headers. NFC.
 1.7 29-Jul-2023  rin linux/aarch64/syscalls.master: Include linux_misc.h.
 1.6 28-Jul-2023  christos add epoll syscalls
 1.5 10-Jul-2023  christos add memfd_create
 1.4 02-Dec-2021  ryo add prlimit64(2) syscall to COMPAT_LINUX and COMPAT_LINUX32
 1.3 25-Nov-2021  ryo add statx(2) syscall entry
 1.2 24-Nov-2021  ryo add getrandom(2) syscall entry
 1.1 23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.12.2.1 02-Aug-2025  perseant Sync with HEAD
 1.4 29-May-2024  christos should not be using .include <> but .include "" here.
 1.3 08-Apr-2014  njoly Do not include bsd.kinc.mk in each arch Makefile, it's already pulled
by bsd.syscall.mk (from Makefile.inc).
 1.2 03-Oct-1998  christos branches: 1.2.184; 1.2.194; 1.2.200; 1.2.210;
Attempt to fix the mess.
 1.1 30-Sep-1998  erh Initial support for linux compat on the alpha. Not quite working.
 1.2.210.1 10-Aug-2014  tls Rebase.
 1.2.200.1 18-May-2014  rmind sync with head
 1.2.194.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.184.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.11 03-May-2020  thorpej Always clear FUTEX_PRIVATE_FLAG for Linux processes. NetBSD-native futexes
exist in different namespace depending on FUTEX_PRIVATE_FLAG. This appears
not to be the case in Linux, and some futex users will mix private and non-
private ops on the same futex object. Provide a convenience wrapper that
puts this logic in one place witn a comment explaining why.

While here, move the Linux futex wrapper out of its own file and plop
it in linux_misc.c, which is where it lives in the linux32 module.
 1.10 24-Mar-2019  maxv Remove Alpha's compat_linux dependency on compat_osf1. Each function is
copied as-is from compat_osf1 with no functional change. Discussed on
tech-kern@, ok @thorpej.
 1.9 31-May-2011  njoly branches: 1.9.56;
Add needed linux_fadvise64.c
 1.8 07-Jul-2010  chs branches: 1.8.2;
many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
- support new-style (NPTL) linux pthreads on all platforms.
clone() with CLONE_THREAD uses 1 process with many LWPs
instead of separate processes.
- move the contents of sys__lwp_setprivate() into a new
lwp_setprivate() and use that everywhere.
- update linux_release[] and linux32_release[] to "2.6.18".
- adjust placement of emul fork/exec/exit hooks as needed
and adjust other emul code to match.
- convert all struct emul definitions to use named initializers.
- change the pid allocator to allow multiple pids to refer to the same proc.
- remove a few fields from struct proc that are no longer needed.
- disable the non-functional "vdso" code in linux32/amd64,
glibc works fine without it.
- fix a race in the futex code where we could miss a wakeup after
a requeue operation.
- redo futex locking to be a little more efficient.
 1.7 13-Nov-2002  jdolecek branches: 1.7.108; 1.7.130; 1.7.132;
add generic linux compat ELF copyargs function

this gives:
* linux sysconf(_SC_CLK_TCK) gives correct value for linux binaries (hz)
even if hz != 100
* glibc gets proper information on real/effective uid and enables
secure mode for suid binaries

g/c LINUX_COPYARGS_FUNCTION, replaced by linux ELF copyargs function
g/c alpha-specific linux ELF copyargs function and linux ELF defines
 1.6 13-May-2002  matt Make COMPAT_LINUX compile again on Alpha. linux_getdents64 moved but
files.linux_alpha wasn't updated. common/linux_file64.c contains a lot
of syscalls which aren't on Linux/alpha so #ifdef them for alpha.
 1.5 31-Mar-2002  christos bring the reverse signal mapping array into linux_signo.c
 1.4 17-Nov-2000  erh branches: 1.4.2; 1.4.4;
Make the linux compatibilty code work on the alpha. (horay!) (at last!)
Two main changes:
Create a linux_elf64_copyargs that uses the linux specific LinuxAuxInfo
structure. This is only used on the alpha. i386 and m68k use the
standard elf copyargs function.

Since linux's approach to binary compatibilty is to look as much
like osf1 as possible, add all the osf1 syscalls that we have
implemented to the linux syscall table. This includes get/setsysinfo,
ported from FreeBSD.

In order for linux compat to work you must have COMPAT_OSF1, COMPAT_43,
COMPAT_09, COMPAT_12 and COMPAT_13 on also.
 1.3 07-Oct-1998  erh branches: 1.3.12;
Add the sigaction call.
 1.2 07-Oct-1998  erh Files moved. Change the paths here.
 1.1 30-Sep-1998  erh Initial support for linux compat on the alpha. Not quite working.
 1.3.12.1 22-Nov-2000  bouyer Sync with HEAD.
 1.4.4.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.4.2.3 11-Dec-2002  thorpej Sync with HEAD.
 1.4.2.2 20-Jun-2002  nathanw Catch up to -current.
 1.4.2.1 17-Apr-2002  nathanw Catch up to -current.
 1.7.132.2 12-Jun-2011  rmind sync with head
 1.7.132.1 05-Mar-2011  rmind sync with head
 1.7.130.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.7.108.1 11-Aug-2010  yamt sync with head.
 1.8.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.9.56.1 10-Jun-2019  christos Sync with HEAD
 1.8 17-Dec-2013  njoly Cleanup compat linux errnos by adding generic errnos in a single file.
Use it for all arches except alpha and mips.
Add a few missing native to linux errno conversions.
 1.7 28-Apr-2008  martin branches: 1.7.34; 1.7.44; 1.7.50;
Remove clause 3 and 4 from TNF licenses
 1.6 31-Oct-2006  cbiere branches: 1.6.48; 1.6.50; 1.6.52;
Changed error message of ENOPROTOOPT to "Protocol option not available".
 1.5 11-Dec-2005  christos branches: 1.5.20; 1.5.22;
merge ktrace-lwp.
 1.4 26-Feb-2005  perry branches: 1.4.4;
nuke trailing whitespace
 1.3 12-Feb-2001  manu branches: 1.3.24; 1.3.32; 1.3.34;
Clarified comments about the LINUX_SCERR_SIGN macro
 1.2 11-Feb-2001  manu Moved the fix for negative errno returned to userland on the PowerPC to a
more machine independent fashion
 1.1 30-Sep-1998  erh branches: 1.1.12;
New header files for Linux compat on the Alpha.
 1.1.12.1 12-Mar-2001  bouyer Sync with HEAD.
 1.3.34.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.3.32.1 29-Apr-2005  kent sync with -current
 1.3.24.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.4.4.1 30-Dec-2006  yamt sync with head.
 1.5.22.1 10-Dec-2006  yamt sync with head.
 1.5.20.1 18-Nov-2006  ad Sync with head.
 1.6.52.1 16-May-2008  yamt sync with head.
 1.6.50.1 18-May-2008  yamt sync with head.
 1.6.48.1 02-Jun-2008  mjf Sync with HEAD.
 1.7.50.1 18-May-2014  rmind sync with head
 1.7.44.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.7.34.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.13 12-Feb-2017  chs es_arglen is now in units of bytes, update the emulations accordingly.
 1.12 09-Feb-2014  chs branches: 1.12.6; 1.12.10; 1.12.14;
account for the 16 bytes of AT_RANDOM data in the stack setup. fixes PR 48518.
use cprng_strong32() instead of random(). add AT_RANDOM support for linux32.
 1.11 28-Apr-2008  martin branches: 1.11.34; 1.11.44; 1.11.50;
Remove clause 3 and 4 from TNF licenses
 1.10 11-Dec-2005  christos branches: 1.10.70; 1.10.72; 1.10.74;
merge ktrace-lwp.
 1.9 14-Aug-2003  christos remove the args from the macro.
 1.8 08-Aug-2003  christos - GC all the setup_stack functions
- add one for linux/i386
 1.7 13-Nov-2002  jdolecek branches: 1.7.6;
add generic linux compat ELF copyargs function

this gives:
* linux sysconf(_SC_CLK_TCK) gives correct value for linux binaries (hz)
even if hz != 100
* glibc gets proper information on real/effective uid and enables
secure mode for suid binaries

g/c LINUX_COPYARGS_FUNCTION, replaced by linux ELF copyargs function
g/c alpha-specific linux ELF copyargs function and linux ELF defines
 1.6 26-Aug-2002  christos Implement passing AT_{E,R}{U,G}ID in the elf aux vector, like solaris.
- pass struct proc to copyargs.
- eliminate svr4_copyargs, since it is the same as ours now.
 1.5 30-Sep-2001  simonb branches: 1.5.10;
Define LINUX_ATEXIT_SIGNATURE to enable the atexit_signature test; needed
to run Linux/Alpha binaries.
 1.4 29-Jul-2001  christos branches: 1.4.2;
Adjust to the new copyargs() footprint.
 1.3 22-Jun-2001  simonb branches: 1.3.2;
Include <sys/exec_elf.h> as the other arch's linux_exec.h file do.
New linux_trap.c compiles now.
 1.2 17-Nov-2000  erh branches: 1.2.2;
Make the linux compatibilty code work on the alpha. (horay!) (at last!)
Two main changes:
Create a linux_elf64_copyargs that uses the linux specific LinuxAuxInfo
structure. This is only used on the alpha. i386 and m68k use the
standard elf copyargs function.

Since linux's approach to binary compatibilty is to look as much
like osf1 as possible, add all the osf1 syscalls that we have
implemented to the linux syscall table. This includes get/setsysinfo,
ported from FreeBSD.

In order for linux compat to work you must have COMPAT_OSF1, COMPAT_43,
COMPAT_09, COMPAT_12 and COMPAT_13 on also.
 1.1 30-Sep-1998  erh branches: 1.1.12;
New header files for Linux compat on the Alpha.
 1.1.12.1 22-Nov-2000  bouyer Sync with HEAD.
 1.2.2.4 11-Dec-2002  thorpej Sync with HEAD.
 1.2.2.3 27-Aug-2002  nathanw Catch up to -current.
 1.2.2.2 08-Oct-2001  nathanw Catch up to -current.
 1.2.2.1 24-Aug-2001  nathanw Catch up with -current.
 1.3.2.3 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.3.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.3.2.1 03-Aug-2001  lukem update to -current
 1.4.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.5.10.1 29-Aug-2002  gehenna catch up with -current.
 1.7.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.7.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.7.6.1 03-Aug-2004  skrll Sync with HEAD
 1.10.74.1 16-May-2008  yamt sync with head.
 1.10.72.1 18-May-2008  yamt sync with head.
 1.10.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.11.50.1 18-May-2014  rmind sync with head
 1.11.44.2 03-Dec-2017  jdolecek update from HEAD
 1.11.44.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.11.34.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.12.14.1 21-Apr-2017  bouyer Sync with HEAD
 1.12.10.1 20-Mar-2017  pgoyette Sync with HEAD
 1.12.6.1 28-Aug-2017  skrll Sync with HEAD
 1.6 13-Nov-2002  jdolecek branches: 1.6.2;
add generic linux compat ELF copyargs function

this gives:
* linux sysconf(_SC_CLK_TCK) gives correct value for linux binaries (hz)
even if hz != 100
* glibc gets proper information on real/effective uid and enables
secure mode for suid binaries

g/c LINUX_COPYARGS_FUNCTION, replaced by linux ELF copyargs function
g/c alpha-specific linux ELF copyargs function and linux ELF defines
 1.5 26-Aug-2002  christos Implement passing AT_{E,R}{U,G}ID in the elf aux vector, like solaris.
- pass struct proc to copyargs.
- eliminate svr4_copyargs, since it is the same as ours now.
 1.4 13-Nov-2001  lukem branches: 1.4.8;
add RCSIDs (including regeneration of files as appropriate)
 1.3 29-Jul-2001  christos Adjust to the new copyargs() footprint.
 1.2 18-Jan-2001  tv branches: 1.2.2; 1.2.4;
No-op commit to force update to a non-"-kk" revision.
 1.1 17-Nov-2000  erh branches: 1.1.2;
Make the linux compatibilty code work on the alpha. (horay!) (at last!)
Two main changes:
Create a linux_elf64_copyargs that uses the linux specific LinuxAuxInfo
structure. This is only used on the alpha. i386 and m68k use the
standard elf copyargs function.

Since linux's approach to binary compatibilty is to look as much
like osf1 as possible, add all the osf1 syscalls that we have
implemented to the linux syscall table. This includes get/setsysinfo,
ported from FreeBSD.

In order for linux compat to work you must have COMPAT_OSF1, COMPAT_43,
COMPAT_09, COMPAT_12 and COMPAT_13 on also.
 1.1.2.3 11-Feb-2001  bouyer Sync with HEAD.
 1.1.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.1.2.1 17-Nov-2000  bouyer file linux_exec_alpha.c was added on branch thorpej_scsipi on 2000-11-22 16:02:35 +0000
 1.2.4.3 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.2.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.4.1 03-Aug-2001  lukem update to -current
 1.2.2.4 11-Dec-2002  thorpej Sync with HEAD.
 1.2.2.3 27-Aug-2002  nathanw Catch up to -current.
 1.2.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.2.2.1 24-Aug-2001  nathanw Catch up with -current.
 1.4.8.1 29-Aug-2002  gehenna catch up with -current.
 1.6.2.1 18-Dec-2002  gmcgarry Merge pcred and ucred, and poolify. TBD: check backward compatibility
and factor-out some higher-level functionality.
 1.5 25-Jun-2014  njoly Add a few missing open(2) flags (LINUX_O_*). Fix alpha wrong values.
 1.4 02-Nov-2010  chs branches: 1.4.18; 1.4.32;
define LINUX_O_CLOEXEC.
sort definitions by value.
consistently use hex instead of octal for the values.
 1.3 21-Sep-2010  chs implement O_DIRECTORY as standardized in POSIX-2008,
for both native and linux emulations.
this fixes the rest of PR 43695.
 1.2 28-Apr-2008  martin branches: 1.2.20; 1.2.22;
Remove clause 3 and 4 from TNF licenses
 1.1 30-Sep-1998  erh branches: 1.1.144; 1.1.146; 1.1.148;
New header files for Linux compat on the Alpha.
 1.1.148.2 09-Oct-2010  yamt sync with head
 1.1.148.1 16-May-2008  yamt sync with head.
 1.1.146.1 18-May-2008  yamt sync with head.
 1.1.144.1 02-Jun-2008  mjf Sync with HEAD.
 1.2.22.1 05-Mar-2011  rmind sync with head
 1.2.20.2 06-Nov-2010  uebayasi Sync with HEAD.
 1.2.20.1 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.4.32.1 10-Aug-2014  tls Rebase.
 1.4.18.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.3 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.2 10-Dec-2000  fvdl branches: 1.2.122; 1.2.124; 1.2.126;
The gist of the Linux _IOX definitions was the same for all platforms;
move it to the MI linux_ioctl.h and only leave the MD bits in the MD
header files.
 1.1 30-Sep-1998  erh branches: 1.1.12; 1.1.22;
New header files for Linux compat on the Alpha.
 1.1.22.1 30-Mar-2001  he Pull up revision 1.2 (requested by fvdl):
Add some required Linux emulation bits to support the Linux
version of VMware.
 1.1.12.1 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.2.126.1 16-May-2008  yamt sync with head.
 1.2.124.1 18-May-2008  yamt sync with head.
 1.2.122.1 02-Jun-2008  mjf Sync with HEAD.
 1.52 07-Sep-2021  riastradh sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.51 03-Sep-2020  thorpej The conversion of FPU tracking to PCU rendered the fpcurlwp variable
unmaintained, which broke FP status info in the COMPAT_LINUX sigcontext.
Use the new API, which will at least be closer to correct.
 1.50 09-Nov-2014  maxv branches: 1.50.12; 1.50.24;
Do not uselessly include <sys/malloc.h>.
 1.49 18-Nov-2011  christos branches: 1.49.10; 1.49.26;
- add sigtimedwait support.
- merge the siginfo population code.
 1.48 09-Jun-2011  matt branches: 1.48.2;
Adapt to change to PCU.
 1.47 04-Mar-2011  joerg branches: 1.47.2;
Refactor ps_strings access. Based on PK_32, write either the normal
version or the 32bit compat layout in execve1. Introduce a new function
copyin_psstrings for reading it back from userland and converting it to
the native layout. Refactor procfs to share most of the code with the
kern.proc_args sysctl handler.

This material is based upon work partially supported by
The NetBSD Foundation under a contract with Joerg Sonnenberger.
 1.46 07-Jul-2010  chs branches: 1.46.2; 1.46.4;
many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
- support new-style (NPTL) linux pthreads on all platforms.
clone() with CLONE_THREAD uses 1 process with many LWPs
instead of separate processes.
- move the contents of sys__lwp_setprivate() into a new
lwp_setprivate() and use that everywhere.
- update linux_release[] and linux32_release[] to "2.6.18".
- adjust placement of emul fork/exec/exit hooks as needed
and adjust other emul code to match.
- convert all struct emul definitions to use named initializers.
- change the pid allocator to allow multiple pids to refer to the same proc.
- remove a few fields from struct proc that are no longer needed.
- disable the non-functional "vdso" code in linux32/amd64,
glibc works fine without it.
- fix a race in the futex code where we could miss a wakeup after
a requeue operation.
- redo futex locking to be a little more efficient.
 1.45 23-Nov-2009  rmind branches: 1.45.2; 1.45.4;
Use lwp_getpcb() in compat code, clean from struct user.
 1.44 18-Mar-2009  cegger bcopy -> memcpy
 1.43 28-Apr-2008  martin branches: 1.43.2; 1.43.8; 1.43.14;
Remove clause 3 and 4 from TNF licenses
 1.42 24-Apr-2008  ad branches: 1.42.2;
Merge proc::p_mutex and proc::p_smutex into a single adaptive mutex, since
we no longer need to guard against access from hardware interrupt handlers.

Additionally, if cloning a process with CLONE_SIGHAND, arrange to have the
child process share the parent's lock so that signal state may be kept in
sync. Partially addresses PR kern/37437.
 1.41 20-Dec-2007  dsl branches: 1.41.6; 1.41.8;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.40 08-Dec-2007  dsl branches: 1.40.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.39 08-Jul-2007  pooka branches: 1.39.6; 1.39.8; 1.39.16;
fix pasto: sigframe.sf_sc is of type linux_sigcontext
 1.38 04-Mar-2007  yamt branches: 1.38.2; 1.38.4;
fix fallout from caddr_t changes.
 1.37 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.36 09-Feb-2007  ad branches: 1.36.2;
Merge newlock2 to head.
 1.35 23-Jul-2006  ad branches: 1.35.4;
Use the LWP cached credentials where sane.
 1.34 15-May-2006  yamt include kauth.h for kauth_cred_geteuid.
 1.33 14-May-2006  elad integrate kauth.
 1.32 11-Dec-2005  christos branches: 1.32.4; 1.32.6; 1.32.8; 1.32.10; 1.32.12;
merge ktrace-lwp.
 1.31 20-May-2005  fvdl branches: 1.31.2;
Define linux_usertrap function, and set it in struct emul. For all
but amd64, it just returns 0, doing nothing.

For amd64, it implements vsyscalls through cheating: if the faulting
address is in the vsyscall area (which is statically known on Linux/amd64),
and the intruction pointer is too, it must have been a vsyscall. In that
case, retrieve the return address from the user stack, fix up %rip and
%rsp, and just execute the normal system call. It will return as if
the vsyscall has been executed.
 1.30 10-Oct-2003  matt Adapt to SIGINFO changes.
 1.29 26-Sep-2003  simonb Fix "constify sendsig/trapsignal" fallout for non-siginfo'd archs. Test
compiled on most architectures.
 1.28 29-Jun-2003  fvdl branches: 1.28.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.27 29-Jun-2003  simonb Fix 'struct lwp *' lossage.
 1.26 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.25 25-Sep-2002  thorpej Don't include <sys/map.h>.
 1.24 04-Jul-2002  thorpej Add kernel support for having userland provide the signal trampoline:

* struct sigacts gets a new sigact_sigdesc structure, which has the
sigaction and the trampoline/version. Version 0 means "legacy kernel
provided trampoline". Other versions are coordinated with machine-
dependent code in libc.
* sigaction1() grows two more arguments -- the trampoline pointer and
the trampoline version.
* A new __sigaction_sigtramp() system call is provided to register a
trampoline along with a signal handler.
* The handler is no longer passed to sensig() functions. Instead,
sendsig() looks up the handler by peeking in the sigacts for the
process getting the signal (since it has to look in there for the
trampoline anyway).
* Native sendsig() functions now select the appropriate trampoline and
its arguments based on the trampoline version in the sigacts.

Changes to libc to use the new facility will be checked in later. Kernel
version not bumped; we will ride the 1.6C bump made recently.
 1.23 31-Mar-2002  christos branches: 1.23.2;
make signal array handling uniform, and put signal arrays in a separate
file. This is simular to errno array handling.
 1.22 23-Mar-2002  chs make this compile again (PS_STRINGS is gone).
 1.21 18-Feb-2002  christos Resolve alpha compile issues:
- bug with order in args in mask conversion md code.
- flags can be both int and long on the alpha. kludge around that, by not
passing pointers to the conversion function.
- something is wrong with the toolchain look at the void * cast in copyout().
- sa_restorer is in a different place on the aplha. Deal with that, by not
initializing it as before. XXX: this should be changed in the MD signal
definition.
 1.20 15-Feb-2002  christos - add a real linux_sys___sysctl because the mib numbers are different.
implement only the kernel version getting entries.
- make the signal conversion functions consistent; dest is arg 1.
- make linux_fakedev deal with block and char devices differently.
- add linux_sys_ugetrlimit, and flesh out the regular get/setrlimit so
that they work properly.
- add linux_mmap2 [untested].
- bump kernel to 2.4.18, and make the date be valentine's day :-)
- linux_sys_*stat64 family was totally busted. Fix it.

tested only on i386.

Status:
gdb, telnet, work
jdk-1.4.0 extractor works, jdk still coredumps.

christos
 1.19 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.18 30-Sep-2001  simonb DEBUG kernels fill the registers with garbage on process startup and
Linux program don't like that. Explicitly zero out the registers for
DEBUG kernels.
 1.17 30-May-2001  mrg branches: 1.17.2; 1.17.4;
use _KERNEL_OPT.
 1.16 26-Apr-2001  ross o IEEE 754 floating-point completion code.
o Implement the architected FP_C "Floating Point Control Quadword"
 1.15 26-Jan-2001  manu branches: 1.15.2;
Moved include <sys/ioctl.h> so that we can build without WSCONS enabled.
 1.14 27-Dec-2000  sommerfeld Let COMPAT_LINUX build with DEBUG
 1.13 22-Dec-2000  jdolecek split off thread specific stuff from struct sigacts to struct sigctx, leaving
only signal handler array sharable between threads
move other random signal stuff from struct proc to struct sigctx

This addresses kern/10981 by Matthew Orgass.
 1.12 29-Nov-2000  jdolecek LKMify
 1.11 27-Nov-2000  jdolecek don't use linux_emuldata for now, so that this compiles after
rev 1.2 of compat/linux/common/linux_emuldata.h
 1.10 29-Jun-2000  mrg remove include of <vm/vm.h>
 1.9 30-Mar-2000  augustss Kill register declarations.
 1.8 18-Mar-2000  erh Add sigset_t parameter to restore_sigcontext, created by the sigreturn functions. linux_sigreturn still needs to use frame->extramask.
In setup_linux_rt_sigframe copy the signal mask to both possible locations.
 1.7 12-Sep-1999  chs branches: 1.7.2;
eliminate the PMAP_NEW option by making it required for all ports.
ports which previously had no support for PMAP_NEW now implement
the pmap_k* interfaces as wrappers around the non-k versions.
 1.6 24-Mar-1999  mrg completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.
 1.5 03-Jan-1999  erh Make consistent: si_ -> lsi_
 1.4 03-Jan-1999  erh Avoid name clash with standard si_{uid,pid} fields.
 1.3 08-Dec-1998  erh At least make this compile. Add linux compat version of auxillary data eventually to be used to make the emulation work correctly.
 1.2 03-Oct-1998  christos Attempt to fix the mess.
 1.1 01-Oct-1998  erh Alpha version of the linux compat machdep signal and machdep ioctl stuff.
 1.7.2.4 11-Feb-2001  bouyer Sync with HEAD.
 1.7.2.3 05-Jan-2001  bouyer Sync with HEAD
 1.7.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.7.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.15.2.12 18-Oct-2002  nathanw Catch up to -current.
 1.15.2.11 01-Aug-2002  nathanw Catch up to -current.
 1.15.2.10 24-Jun-2002  nathanw Curproc->curlwp renaming.

Change uses of "curproc->l_proc" back to "curproc", which is more like the
original use. Bare uses of "curproc" are now "curlwp".

"curproc" is now #defined in proc.h as ((curlwp) ? (curlwp)->l_proc) : NULL)
so that it is always safe to reference curproc (*de*referencing curproc
is another story, but that's always been true).
 1.15.2.9 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.15.2.8 17-Apr-2002  nathanw Catch up to -current.
 1.15.2.7 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.15.2.6 28-Feb-2002  nathanw Catch up to -current.
 1.15.2.5 14-Nov-2001  nathanw Catch up to -current.
 1.15.2.4 08-Oct-2001  nathanw Catch up to -current.
 1.15.2.3 13-Sep-2001  nathanw A couple more p => l->l_proc inside #ifdef DEBUG.
 1.15.2.2 30-Aug-2001  nathanw First cut at LWP and SA support on the alpha.
Doesn't break in ordinary multiuser mode; LWPs and SAs not yet tested.
 1.15.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.17.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.17.2.5 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.17.2.4 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.17.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.17.2.2 16-Mar-2002  jdolecek Catch up with -current.
 1.17.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.23.2.1 15-Jul-2002  gehenna catch up with -current.
 1.28.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.28.2.4 21-Nov-2004  skrll Adapt to branch. Alpha kernels now compile.
 1.28.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.28.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.28.2.1 03-Aug-2004  skrll Sync with HEAD
 1.31.2.5 21-Jan-2008  yamt sync with head
 1.31.2.4 03-Sep-2007  yamt sync with head.
 1.31.2.3 26-Feb-2007  yamt sync with head.
 1.31.2.2 30-Dec-2006  yamt sync with head.
 1.31.2.1 21-Jun-2006  yamt sync with head.
 1.32.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.32.10.1 08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.32.8.2 11-Aug-2006  yamt sync with head
 1.32.8.1 24-May-2006  yamt sync with head.
 1.32.6.1 01-Jun-2006  kardel Sync with head.
 1.32.4.1 09-Sep-2006  rpaulo sync with head
 1.35.4.3 06-Feb-2007  ad More compat changes.

XXX compat_irix, compat_mach and compat_darwin need work.
 1.35.4.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.35.4.1 11-Jan-2007  ad Checkpoint work in progress.
 1.36.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.38.4.1 11-Jul-2007  mjf Sync with head.
 1.38.2.1 15-Jul-2007  ad Sync with head.
 1.39.16.1 26-Dec-2007  ad Sync with head.
 1.39.8.1 09-Jan-2008  matt sync with HEAD
 1.39.6.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.40.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.41.8.1 18-May-2008  yamt sync with head.
 1.41.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.42.2.4 11-Aug-2010  yamt sync with head.
 1.42.2.3 11-Mar-2010  yamt sync with head
 1.42.2.2 04-May-2009  yamt sync with head.
 1.42.2.1 16-May-2008  yamt sync with head.
 1.43.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.43.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.43.2.3 14-May-2008  wrstuden Per discussion with ad at n dot o, revert signal mask handling
changes.

The l_sigstk changes are most likely totally un-needed as SA will
never use a signal stack - we send an upcall (or will as other
diffs are brought in).

The l_sigmask changes were too controvertial. In all honesty, I
think it's probably best to revert them. The main reason they were
there is the fact that in an SA process, we don't mask signals per
kernel thread, we mask them per user thread. In the kernel, we want
them all to get turned into upcalls. Thus the normal state of
l_sigmask in an SA process is for it to always be empty.

While we are in the process of delivering a signal, we want to
temporarily mask a signal (so we don't recursively exhaust our
upcall stacks). However signal delivery is rare (important, but
rare), and delivering back-to-back signals is even rarer. So rather
than cause every user of a signal mask to be prepared for this very
rare case, we will just add a second check later in the signal
delivery code. Said change is not in this diff.

This also un-compensates all of our compatability code for dealing
with SA. SA is a NetBSD-specific thing, so there's no need for
Irix, Linux, Solaris, SVR4 and so on to cope with it.

As previously, everything other than kern_sa.c compiles in i386
GENERIC as of this checkin. I will switch to ALL soon for compile
testing.
 1.43.2.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.43.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.45.4.2 12-Jun-2011  rmind sync with head
 1.45.4.1 05-Mar-2011  rmind sync with head
 1.45.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.46.4.1 05-Mar-2011  bouyer Sync with HEAD
 1.46.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.47.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.48.2.1 17-Apr-2012  yamt sync with head
 1.49.26.1 17-Jan-2015  martin Pull up following revision(s) (requested by maxv in ticket #427):
sys/compat/svr4/svr4_schedctl.c: revision 1.8
sys/netinet/tcp_timer.c: revision 1.88
sys/miscfs/genfs/layer_vfsops.c: revision 1.45
sys/compat/svr4/svr4_ioctl.c: revision 1.37
sys/ufs/chfs/chfs_vfsops.c: revision 1.14
sys/miscfs/fdesc/fdesc_vfsops.c: revision 1.91
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.30
sys/compat/common/kern_time_50.c: revision 1.28
sys/netinet6/ip6_forward.c: revision 1.74
sys/miscfs/umapfs/umap_vnops.c: revision 1.57
sys/compat/svr4/svr4_fcntl.c: revision 1.74
distrib/sets/lists/comp/mi: revision 1.1931
sys/netinet6/udp6_output.c: revision 1.46
sys/fs/puffs/puffs_compat.c: revision 1.3
sys/fs/udf/udf_rename.c: revision 1.11
sys/compat/svr4/svr4_filio.c: revision 1.24
sys/fs/udf/udf_rename.c: revision 1.12
sys/netinet/tcp_usrreq.c: revision 1.202
sys/miscfs/umapfs/umap_subr.c: revision 1.29
sys/compat/linux/common/linux_fadvise64.c: revision 1.3
sys/netinet/if_atm.c: revision 1.34
sys/miscfs/procfs/procfs_subr.c: revision 1.106
sys/miscfs/genfs/layer_subr.c: revision 1.37
sys/netinet/tcp_sack.c: revision 1.30
sys/compat/freebsd/freebsd_misc.c: revision 1.33
sys/compat/freebsd/freebsd_file.c: revision 1.33
sys/ufs/chfs/chfs_vnode.c: revision 1.12
sys/compat/svr4/svr4_ttold.c: revision 1.34
sys/compat/linux/common/linux_file.c: revision 1.114
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.43
sys/compat/linux/common/linux_signal.c: revision 1.76
sys/compat/common/compat_util.c: revision 1.46
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.18
sys/compat/svr4/svr4_sockio.c: revision 1.36
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.32
sys/compat/svr4/svr4_signal.c: revision 1.66
sys/kern/kern_exec.c: revision 1.410
sys/fs/puffs/puffs_vfsops.c: revision 1.115
sys/compat/svr4/svr4_exec_elf64.c: revision 1.15
sys/compat/linux/arch/i386/linux_machdep.c: revision 1.159
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.50
sys/compat/linux32/common/linux32_misc.c: revision 1.24
sys/netinet/in_pcb.c: revision 1.153
sys/sys/malloc.h: revision 1.116
sys/compat/common/if_43.c: revision 1.9
share/man/man9/Makefile: revision 1.380
sys/netinet/tcp_vtw.c: revision 1.12
sys/miscfs/umapfs/umap_vfsops.c: revision 1.95
sys/ufs/ext2fs/ext2fs_vfsops.c: revision 1.186
sys/compat/common/uipc_syscalls_43.c: revision 1.46
sys/ufs/ext2fs/ext2fs_vnops.c: revision 1.115
sys/fs/puffs/puffs_msgif.c: revision 1.97
sys/compat/svr4/svr4_ipc.c: revision 1.27
sys/compat/linux/common/linux_exec.c: revision 1.117
sys/ufs/ext2fs/ext2fs_readwrite.c: revision 1.66
sys/netinet/tcp_output.c: revision 1.179
sys/compat/svr4/svr4_termios.c: revision 1.28
sys/fs/udf/udf_strat_bootstrap.c: revision 1.4
sys/fs/puffs/puffs_subr.c: revision 1.67
sys/fs/puffs/puffs_node.c: revision 1.36
sys/miscfs/overlay/overlay_vnops.c: revision 1.21
sys/fs/cd9660/cd9660_node.c: revision 1.34
sys/netinet/raw_ip.c: revision 1.146
sys/sys/mallocvar.h: revision 1.13
sys/miscfs/overlay/overlay_vfsops.c: revision 1.63
share/man/man9/malloc.9: revision 1.50
sys/netinet6/dest6.c: revision 1.18
sys/compat/linux/common/linux_uselib.c: revision 1.33
sys/compat/linux/common/linux_socket.c: revision 1.120
share/man/man9/malloc.9: revision 1.51
sys/netinet/tcp_subr.c: revision 1.257
sys/compat/linux/common/linux_socketcall.c: revision 1.45
sys/compat/linux/common/linux_fadvise64_64.c: revision 1.3
sys/compat/freebsd/freebsd_ipc.c: revision 1.17
sys/compat/linux/common/linux_misc_notalpha.c: revision 1.109
sys/compat/linux/arch/alpha/linux_pipe.c: revision 1.17
sys/netinet6/in6_pcb.c: revision 1.132
sys/netinet6/in6_ifattach.c: revision 1.94
sys/compat/svr4/svr4_exec_elf32.c: revision 1.15
sys/miscfs/nullfs/null_vfsops.c: revision 1.90
sys/fs/cd9660/cd9660_util.c: revision 1.12
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.48
sys/compat/freebsd/freebsd_exec_elf32.c: revision 1.20
sys/miscfs/procfs/procfs_vfsops.c: revision 1.94
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.28
sys/compat/linux/common/linux_sched.c: revision 1.67
sys/compat/linux/common/linux_exec_aout.c: revision 1.67
sys/compat/linux/common/linux_pipe.c: revision 1.67
sys/compat/linux/common/linux_llseek.c: revision 1.34
sys/compat/linux/arch/mips/linux_ptrace.c: revision 1.10
Do not uselessly include <sys/malloc.h>.
Cleanup:
- remove struct kmembuckets (dead)
- correctly deadify MALLOC_XX
- remove MALLOC_DEFINE_LIMIT and MALLOC_JUSTDEFINE_LIMIT (dead)
- remove malloc_roundup(), malloc_type_setlimit(), MALLOC_DEFINE_LIMIT()
and MALLOC_JUSTDEFINE_LIMIT() from man 9 malloc
New sentence, new line. Bump date for previous.
Obsolete malloc_roundup(9), malloc_type_setlimit(9) and MALLOC_DEFINE_LIMIT(9)
man pages.
 1.49.10.1 03-Dec-2017  jdolecek update from HEAD
 1.50.24.1 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.50.12.1 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1836):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.12 21-Nov-2011  njoly Adjust setup_linux_rt_sigframe/setup_linux_sigframe prototypes.
 1.11 28-Apr-2008  martin branches: 1.11.34;
Remove clause 3 and 4 from TNF licenses
 1.10 11-Nov-2005  chs branches: 1.10.72; 1.10.74; 1.10.76;
include additional headers that are now needed.
 1.9 10-Oct-2003  matt branches: 1.9.16;
Adapt to SIGINFO changes.
 1.8 26-Sep-2003  simonb Fix "constify sendsig/trapsignal" fallout for non-siginfo'd archs. Test
compiled on most architectures.
 1.7 18-Jan-2003  thorpej branches: 1.7.2;
Merge the nathanw_sa branch.
 1.6 15-Feb-2002  christos - add a real linux_sys___sysctl because the mib numbers are different.
implement only the kernel version getting entries.
- make the signal conversion functions consistent; dest is arg 1.
- make linux_fakedev deal with block and char devices differently.
- add linux_sys_ugetrlimit, and flesh out the regular get/setrlimit so
that they work properly.
- add linux_mmap2 [untested].
- bump kernel to 2.4.18, and make the date be valentine's day :-)
- linux_sys_*stat64 family was totally busted. Fix it.

tested only on i386.

Status:
gdb, telnet, work
jdk-1.4.0 extractor works, jdk still coredumps.

christos
 1.5 14-Dec-2000  mycroft branches: 1.5.2; 1.5.4;
Declare linux_syscall_intern().
 1.4 11-Dec-2000  mycroft Nuke LINUX_MACHDEP_PASS_PPID.
 1.3 01-Dec-2000  jdolecek if LINUX_MACHDEP_PASS_PPID_AND_EUID is defined for given arch, add
flags EMUL_GETPID_PASS_PPID|EMUL_GETID_PASS_EID to emul_linux
define this option for alpha
 1.2 18-Mar-2000  erh Pass a signal mask to restore_sigcontext.
 1.1 30-Sep-1998  erh branches: 1.1.12;
New header files for Linux compat on the Alpha.
 1.1.12.4 05-Jan-2001  bouyer Sync with HEAD
 1.1.12.3 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.1.12.2 08-Dec-2000  bouyer Sync with HEAD.
 1.1.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.5.4.1 16-Mar-2002  jdolecek Catch up with -current.
 1.5.2.2 28-Feb-2002  nathanw Catch up to -current.
 1.5.2.1 30-Aug-2001  nathanw First cut at LWP and SA support on the alpha.
Doesn't break in ordinary multiuser mode; LWPs and SAs not yet tested.
 1.7.2.4 11-Dec-2005  christos Sync with head.
 1.7.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.7.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.7.2.1 03-Aug-2004  skrll Sync with HEAD
 1.9.16.1 21-Jun-2006  yamt sync with head.
 1.10.76.1 16-May-2008  yamt sync with head.
 1.10.74.1 18-May-2008  yamt sync with head.
 1.10.72.1 02-Jun-2008  mjf Sync with HEAD.
 1.11.34.1 17-Apr-2012  yamt sync with head
 1.5 14-Mar-2015  njoly Support Linux MAP_LOCKED mmap flag.
 1.4 28-Apr-2008  martin branches: 1.4.44; 1.4.64;
Remove clause 3 and 4 from TNF licenses
 1.3 11-Dec-2005  christos branches: 1.3.70; 1.3.72; 1.3.74;
merge ktrace-lwp.
 1.2 28-Aug-2004  jdolecek g/c LINUX_MAP_IGNMASK define - it's not used anywhere
 1.1 30-Sep-1998  erh branches: 1.1.46;
New header files for Linux compat on the Alpha.
 1.1.46.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.46.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.46.1 03-Sep-2004  skrll Sync with HEAD
 1.3.74.1 16-May-2008  yamt sync with head.
 1.3.72.1 18-May-2008  yamt sync with head.
 1.3.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.4.64.1 06-Apr-2015  skrll Sync with HEAD
 1.4.44.1 03-Dec-2017  jdolecek update from HEAD
 1.6 01-Oct-2024  riastradh sys/compat/linux/arch: Nix trailing whitespace.

No functional change intended.
 1.5 07-Sep-2021  riastradh branches: 1.5.10;
sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.4 06-Oct-2020  christos make MAXTSIZ optional
 1.3 06-Apr-2019  thorpej branches: 1.3.4; 1.3.6;
Overhaul the API used to fetch and store individual memory cells in
userspace. The old fetch(9) and store(9) APIs (fubyte(), fuword(),
subyte(), suword(), etc.) are retired and replaced with new ufetch(9)
and ustore(9) APIs that can return proper error codes, etc. and are
implemented consistently across all platforms. The interrupt-safe
variants are no longer supported (and several of the existing attempts
at fuswintr(), etc. were buggy and not actually interrupt-safe).

Also augmement the ucas(9) API, making it consistently available on
all plaforms, supporting uniprocessor and multiprocessor systems, even
those that do not have CAS or LL/SC primitives.

Welcome to NetBSD 8.99.37.
 1.2 26-Mar-2019  christos make this compile again.
 1.1 24-Mar-2019  maxv Remove Alpha's compat_linux dependency on compat_osf1. Each function is
copied as-is from compat_osf1 with no functional change. Discussed on
tech-kern@, ok @thorpej.
 1.3.6.1 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.3.4.2 10-Jun-2019  christos Sync with HEAD
 1.3.4.1 06-Apr-2019  christos file linux_osf1.c was added on branch phil-wifi on 2019-06-10 22:06:59 +0000
 1.5.10.1 02-Aug-2025  perseant Sync with HEAD
 1.1 24-Mar-2019  maxv branches: 1.1.4;
Remove Alpha's compat_linux dependency on compat_osf1. Each function is
copied as-is from compat_osf1 with no functional change. Discussed on
tech-kern@, ok @thorpej.
 1.1.4.2 10-Jun-2019  christos Sync with HEAD
 1.1.4.1 24-Mar-2019  christos file linux_osf1.h was added on branch phil-wifi on 2019-06-10 22:06:59 +0000
 1.18 26-Dec-2017  kamil Refactor pipe1() and correct a bug in sys_pipe2() (SYS_pipe2)

sys_pipe2() returns two integers (values), the 2nd one is a copy of the 2nd
file descriptor that lands in fildes[2]. This is a side effect of reusing
the code for sys_pipe() (SYS_pipe) and not cleaning it up.

The first returned value is (on success) 0.

Introduced a small refactoring in pipe1() that it does not operate over
retval[], but on an array int[2]. A user sets retval[] for pipe() when
desired and needed.

This refactoring touches compat code: netbsd32, linux, linux32.

Before the changes on NetBSD/amd64:

$ ktruss -i ./a.out
[...]
15131 1 a.out pipe2(0x7f7fff2e62b8, 0) = 0, 4
[...]

After the changes:

$ ktruss -i ./a.out
[...]
782 1 a.out pipe2(0x7f7fff97e850, 0) = 0
[...]

There should not be a visible change for current users.

Sponsored by <The NetBSD Foundation>
 1.17 09-Nov-2014  maxv Do not uselessly include <sys/malloc.h>.
 1.16 01-Jun-2014  njoly branches: 1.16.2;
Cleanup pipe(2) flags, now that native handle them.
 1.15 14-Apr-2011  he branches: 1.15.14; 1.15.28;
Fix this so that it builds (missing "struct" keyword).
 1.14 14-Apr-2011  christos add the "special" pipe2.
 1.13 28-Apr-2008  martin branches: 1.13.2; 1.13.22; 1.13.28;
Remove clause 3 and 4 from TNF licenses
 1.12 20-Dec-2007  dsl branches: 1.12.6; 1.12.8; 1.12.10;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.11 08-Dec-2007  dsl branches: 1.11.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.10 09-Feb-2007  ad branches: 1.10.18; 1.10.20; 1.10.28;
Merge newlock2 to head.
 1.9 11-Dec-2005  christos branches: 1.9.20;
merge ktrace-lwp.
 1.8 26-Feb-2005  perry branches: 1.8.4;
nuke trailing whitespace
 1.7 18-Jan-2003  thorpej branches: 1.7.2; 1.7.10; 1.7.12;
Merge the nathanw_sa branch.
 1.6 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.5 16-Oct-2000  erh branches: 1.5.2; 1.5.4;
Add sys/proc.h so this compiles.
 1.4 29-Jun-2000  mrg remove include of <vm/vm.h>
 1.3 26-Jun-2000  mrg remove redundant vm includes.
 1.2 03-Oct-1998  christos branches: 1.2.12;
Attempt to fix the mess.
 1.1 01-Oct-1998  erh Alpha specific version of sys_pipe and signal translation array.
 1.2.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.5.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.5.2.4 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.5.2.3 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.5.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.5.2.1 30-Aug-2001  nathanw First cut at LWP and SA support on the alpha.
Doesn't break in ordinary multiuser mode; LWPs and SAs not yet tested.
 1.7.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.7.10.1 29-Apr-2005  kent sync with -current
 1.7.2.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.8.4.2 21-Jan-2008  yamt sync with head
 1.8.4.1 26-Feb-2007  yamt sync with head.
 1.9.20.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.10.28.1 26-Dec-2007  ad Sync with head.
 1.10.20.1 09-Jan-2008  matt sync with HEAD
 1.10.18.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.11.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.12.10.1 16-May-2008  yamt sync with head.
 1.12.8.1 18-May-2008  yamt sync with head.
 1.12.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.13.28.1 06-Jun-2011  jruoho Sync with HEAD.
 1.13.22.1 21-Apr-2011  rmind sync with head
 1.13.2.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.13.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.15.28.1 10-Aug-2014  tls Rebase.
 1.15.14.2 03-Dec-2017  jdolecek update from HEAD
 1.15.14.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.16.2.1 17-Jan-2015  martin Pull up following revision(s) (requested by maxv in ticket #427):
sys/compat/svr4/svr4_schedctl.c: revision 1.8
sys/netinet/tcp_timer.c: revision 1.88
sys/miscfs/genfs/layer_vfsops.c: revision 1.45
sys/compat/svr4/svr4_ioctl.c: revision 1.37
sys/ufs/chfs/chfs_vfsops.c: revision 1.14
sys/miscfs/fdesc/fdesc_vfsops.c: revision 1.91
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.30
sys/compat/common/kern_time_50.c: revision 1.28
sys/netinet6/ip6_forward.c: revision 1.74
sys/miscfs/umapfs/umap_vnops.c: revision 1.57
sys/compat/svr4/svr4_fcntl.c: revision 1.74
distrib/sets/lists/comp/mi: revision 1.1931
sys/netinet6/udp6_output.c: revision 1.46
sys/fs/puffs/puffs_compat.c: revision 1.3
sys/fs/udf/udf_rename.c: revision 1.11
sys/compat/svr4/svr4_filio.c: revision 1.24
sys/fs/udf/udf_rename.c: revision 1.12
sys/netinet/tcp_usrreq.c: revision 1.202
sys/miscfs/umapfs/umap_subr.c: revision 1.29
sys/compat/linux/common/linux_fadvise64.c: revision 1.3
sys/netinet/if_atm.c: revision 1.34
sys/miscfs/procfs/procfs_subr.c: revision 1.106
sys/miscfs/genfs/layer_subr.c: revision 1.37
sys/netinet/tcp_sack.c: revision 1.30
sys/compat/freebsd/freebsd_misc.c: revision 1.33
sys/compat/freebsd/freebsd_file.c: revision 1.33
sys/ufs/chfs/chfs_vnode.c: revision 1.12
sys/compat/svr4/svr4_ttold.c: revision 1.34
sys/compat/linux/common/linux_file.c: revision 1.114
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.43
sys/compat/linux/common/linux_signal.c: revision 1.76
sys/compat/common/compat_util.c: revision 1.46
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.18
sys/compat/svr4/svr4_sockio.c: revision 1.36
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.32
sys/compat/svr4/svr4_signal.c: revision 1.66
sys/kern/kern_exec.c: revision 1.410
sys/fs/puffs/puffs_vfsops.c: revision 1.115
sys/compat/svr4/svr4_exec_elf64.c: revision 1.15
sys/compat/linux/arch/i386/linux_machdep.c: revision 1.159
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.50
sys/compat/linux32/common/linux32_misc.c: revision 1.24
sys/netinet/in_pcb.c: revision 1.153
sys/sys/malloc.h: revision 1.116
sys/compat/common/if_43.c: revision 1.9
share/man/man9/Makefile: revision 1.380
sys/netinet/tcp_vtw.c: revision 1.12
sys/miscfs/umapfs/umap_vfsops.c: revision 1.95
sys/ufs/ext2fs/ext2fs_vfsops.c: revision 1.186
sys/compat/common/uipc_syscalls_43.c: revision 1.46
sys/ufs/ext2fs/ext2fs_vnops.c: revision 1.115
sys/fs/puffs/puffs_msgif.c: revision 1.97
sys/compat/svr4/svr4_ipc.c: revision 1.27
sys/compat/linux/common/linux_exec.c: revision 1.117
sys/ufs/ext2fs/ext2fs_readwrite.c: revision 1.66
sys/netinet/tcp_output.c: revision 1.179
sys/compat/svr4/svr4_termios.c: revision 1.28
sys/fs/udf/udf_strat_bootstrap.c: revision 1.4
sys/fs/puffs/puffs_subr.c: revision 1.67
sys/fs/puffs/puffs_node.c: revision 1.36
sys/miscfs/overlay/overlay_vnops.c: revision 1.21
sys/fs/cd9660/cd9660_node.c: revision 1.34
sys/netinet/raw_ip.c: revision 1.146
sys/sys/mallocvar.h: revision 1.13
sys/miscfs/overlay/overlay_vfsops.c: revision 1.63
share/man/man9/malloc.9: revision 1.50
sys/netinet6/dest6.c: revision 1.18
sys/compat/linux/common/linux_uselib.c: revision 1.33
sys/compat/linux/common/linux_socket.c: revision 1.120
share/man/man9/malloc.9: revision 1.51
sys/netinet/tcp_subr.c: revision 1.257
sys/compat/linux/common/linux_socketcall.c: revision 1.45
sys/compat/linux/common/linux_fadvise64_64.c: revision 1.3
sys/compat/freebsd/freebsd_ipc.c: revision 1.17
sys/compat/linux/common/linux_misc_notalpha.c: revision 1.109
sys/compat/linux/arch/alpha/linux_pipe.c: revision 1.17
sys/netinet6/in6_pcb.c: revision 1.132
sys/netinet6/in6_ifattach.c: revision 1.94
sys/compat/svr4/svr4_exec_elf32.c: revision 1.15
sys/miscfs/nullfs/null_vfsops.c: revision 1.90
sys/fs/cd9660/cd9660_util.c: revision 1.12
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.48
sys/compat/freebsd/freebsd_exec_elf32.c: revision 1.20
sys/miscfs/procfs/procfs_vfsops.c: revision 1.94
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.28
sys/compat/linux/common/linux_sched.c: revision 1.67
sys/compat/linux/common/linux_exec_aout.c: revision 1.67
sys/compat/linux/common/linux_pipe.c: revision 1.67
sys/compat/linux/common/linux_llseek.c: revision 1.34
sys/compat/linux/arch/mips/linux_ptrace.c: revision 1.10
Do not uselessly include <sys/malloc.h>.
Cleanup:
- remove struct kmembuckets (dead)
- correctly deadify MALLOC_XX
- remove MALLOC_DEFINE_LIMIT and MALLOC_JUSTDEFINE_LIMIT (dead)
- remove malloc_roundup(), malloc_type_setlimit(), MALLOC_DEFINE_LIMIT()
and MALLOC_JUSTDEFINE_LIMIT() from man 9 malloc
New sentence, new line. Bump date for previous.
Obsolete malloc_roundup(9), malloc_type_setlimit(9) and MALLOC_DEFINE_LIMIT(9)
man pages.
 1.9 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.8 31-Mar-2002  christos branches: 1.8.108; 1.8.110; 1.8.112;
bring the reverse signal mapping array into linux_signo.c
 1.7 31-Mar-2002  christos make signal array handling uniform, and put signal arrays in a separate
file. This is simular to errno array handling.
 1.6 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.5 18-Jan-2001  jdolecek branches: 1.5.2; 1.5.4;
constify
 1.4 04-Dec-1999  tron Correct signal array size.
 1.3 04-Dec-1999  tron Extend signal mapping array to 64 entries like in the i386 emulation.
 1.2 03-Oct-1998  christos branches: 1.2.12; 1.2.18;
Attempt to fix the mess.
 1.1 01-Oct-1998  erh Alpha specific version of sys_pipe and signal translation array.
 1.2.18.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.2.12.2 11-Feb-2001  bouyer Sync with HEAD.
 1.2.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.5.4.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.5.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.5.2.2 17-Apr-2002  nathanw Catch up to -current.
 1.5.2.1 14-Nov-2001  nathanw Catch up to -current.
 1.8.112.1 16-May-2008  yamt sync with head.
 1.8.110.1 18-May-2008  yamt sync with head.
 1.8.108.1 02-Jun-2008  mjf Sync with HEAD.
 1.7 18-Nov-2011  christos - add sigtimedwait support.
- merge the siginfo population code.
 1.6 08-Jun-2009  njoly branches: 1.6.12;
Various compat linux siginfo fixes.
- alpha: add missing _uid member to SIGCHLD structure.
- amd64: add missing typedef, and fix padding size.
- arm: add missing linux_siginfo definition.
 1.5 23-Nov-2008  njoly branches: 1.5.4;
Move si_code definitions from MD to MI linux_siginfo.h, all archs
(except mips for 3 values) are identical.
While here, remove unused/unneeded LINUX__SI_CODE macro. Only the
lower 16-bits are used for userland si_code.
 1.4 28-Apr-2008  martin branches: 1.4.6; 1.4.8;
Remove clause 3 and 4 from TNF licenses
 1.3 03-Jan-1999  erh branches: 1.3.140; 1.3.142; 1.3.144;
Make consistent: si_ -> lsi_
 1.2 03-Jan-1999  erh Avoid name clash with standard si_{uid,pid} fields.
 1.1 30-Sep-1998  erh New header files for Linux compat on the Alpha.
 1.3.144.3 20-Jun-2009  yamt sync with head
 1.3.144.2 04-May-2009  yamt sync with head.
 1.3.144.1 16-May-2008  yamt sync with head.
 1.3.142.1 18-May-2008  yamt sync with head.
 1.3.140.2 17-Jan-2009  mjf Sync with HEAD.
 1.3.140.1 02-Jun-2008  mjf Sync with HEAD.
 1.4.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.4.6.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.5.4.1 23-Jul-2009  jym Sync with HEAD.
 1.6.12.1 17-Apr-2012  yamt sync with head
 1.10 14-Nov-2015  christos PR/50428: Rin Okuyama: support SA_RESTORER flag for rt_sigaction(2) in the
ports that support it.
 1.9 28-Apr-2008  martin branches: 1.9.44; 1.9.64;
Remove clause 3 and 4 from TNF licenses
 1.8 04-Dec-2007  dsl branches: 1.8.12; 1.8.14; 1.8.16;
Remove all the __P
 1.7 11-Dec-2005  christos branches: 1.7.44; 1.7.46; 1.7.52; 1.7.56;
merge ktrace-lwp.
 1.6 19-Sep-2005  christos MINSIGSTKSZ on linux is different depending on the platform and usually
smaller than ours.
 1.5 19-May-2005  manu branches: 1.5.2;
Add support for Linux SA_RESTORER on amd64.
 1.4 26-Nov-2002  christos branches: 1.4.6;
rename: s/sa_/<compat>sa/g
 1.3 19-Mar-2002  christos - Now that RT-signals fit, fix the array to deliver them. [i386 only].
- jdk-1.4 works perfectly now. :-)
 1.2 10-Dec-1998  erh branches: 1.2.22; 1.2.24;
Whoops, _NSIG->LINUX__NSIG.
 1.1 30-Sep-1998  erh New header files for Linux compat on the Alpha.
 1.2.24.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.2.22.2 11-Dec-2002  thorpej Sync with HEAD.
 1.2.22.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.4.6.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.5.2.2 07-Dec-2007  yamt sync with head
 1.5.2.1 21-Jun-2006  yamt sync with head.
 1.7.56.1 08-Dec-2007  ad Sync with head.
 1.7.52.1 08-Dec-2007  mjf Sync with HEAD.
 1.7.46.1 09-Jan-2008  matt sync with HEAD
 1.7.44.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.8.16.1 16-May-2008  yamt sync with head.
 1.8.14.1 18-May-2008  yamt sync with head.
 1.8.12.1 02-Jun-2008  mjf Sync with HEAD.
 1.9.64.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.9.44.1 03-Dec-2017  jdolecek update from HEAD
 1.6 23-May-2014  njoly Add missing specific LINUX_SOCK_NONBLOCK value for alpha.
 1.5 25-Jan-2014  njoly branches: 1.5.2;
Update linux socket socket options (SO_*). Add common version to its
own file (linux_socket_generic.h); use it for all but alpha and mips.
 1.4 28-Apr-2008  martin branches: 1.4.34; 1.4.44; 1.4.50;
Remove clause 3 and 4 from TNF licenses
 1.3 11-Dec-2005  christos branches: 1.3.70; 1.3.72; 1.3.74;
merge ktrace-lwp.
 1.2 26-Jul-2003  jdolecek add LINUX_SO_PEERNAME, LINUX_SO_TIMESTAMP where it has been missing
fix value for LINUX_SO_DETACH_FILTER on couple places (unused anyway)

g/c LINUX_SCM_TIMESTAMP definition for some archs, it will be defined
in generic linux_socket.h
 1.1 30-Sep-1998  erh branches: 1.1.46;
New header files for Linux compat on the Alpha.
 1.1.46.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.46.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.46.1 03-Aug-2004  skrll Sync with HEAD
 1.3.74.1 16-May-2008  yamt sync with head.
 1.3.72.1 18-May-2008  yamt sync with head.
 1.3.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.4.50.1 18-May-2014  rmind sync with head
 1.4.44.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.4.34.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.5.2.1 10-Aug-2014  tls Rebase.
 1.123 26-Oct-2025  christos regen
 1.122 28-Sep-2024  christos regen
 1.121 01-Jul-2024  christos regen
 1.120 29-Jun-2024  christos branches: 1.120.2;
regen
 1.119 19-Aug-2023  christos regen
 1.118 18-Aug-2023  christos regen
 1.117 29-Jul-2023  christos regen
 1.116 28-Jul-2023  christos regen
 1.115 02-Dec-2021  ryo regen
 1.114 20-Sep-2021  thorpej Regen for preadv(2) / pwritev(2).
 1.113 20-Sep-2021  thorpej Regen for eventfd.
 1.112 19-Sep-2021  thorpej Regen for timerfd.
 1.111 19-Sep-2021  thorpej Regen for POSIX timer syscalls.
 1.110 26-Apr-2020  thorpej branches: 1.110.2;
Regen for native futex calls.
 1.109 09-Nov-2019  jdolecek regen
 1.108 24-Mar-2019  maxv regen
 1.107 10-Aug-2018  pgoyette Regen
 1.106 10-May-2017  riastradh branches: 1.106.8; 1.106.10;
regen
 1.105 03-Feb-2017  christos branches: 1.105.4;
regen
 1.104 03-Feb-2017  martin Regen for accept4
 1.103 16-Jan-2017  christos regen all
 1.102 13-Jan-2017  christos branches: 1.102.2;
regen
 1.101 02-Jan-2017  martin Regen (something apparently went wrong in previous)
 1.100 02-Jan-2017  manu Regen
 1.99 24-Jul-2016  njoly Regen for readlink/readlinkat signatures.
 1.98 25-Oct-2015  njoly branches: 1.98.2;
Regen for posix chown family cleanup.
 1.97 24-Sep-2015  christos regen
 1.96 07-Mar-2015  christos regen
 1.95 22-Nov-2014  njoly branches: 1.95.2;
Regen for ppoll signature fix
 1.94 29-May-2014  njoly branches: 1.94.2;
Regen for utimes(2) change.
 1.93 17-May-2014  njoly Regen for fadvise64 offset types changes.
 1.92 06-May-2014  njoly Regen for mknod device argument type change.
 1.91 04-May-2014  njoly Regen for pread/pwrite 64bit offset argument.
 1.90 08-Apr-2014  njoly Regen.
 1.89 13-Jan-2014  njoly branches: 1.89.2;
Regen.
 1.88 27-Dec-2013  njoly Regen.
 1.87 08-Dec-2013  njoly Regen.
 1.86 19-Nov-2013  chs regen
 1.85 24-Sep-2013  njoly Regen for utimensat(2).
 1.84 15-Sep-2013  njoly Regen.
 1.83 19-Sep-2012  pooka branches: 1.83.2;
regen for ppoll (and, apparently, SYCALL_ARG_PTR)
 1.82 18-Nov-2011  christos branches: 1.82.10;
- add sigtimedwait support.
- merge the siginfo population code.
 1.81 30-May-2011  alnsn branches: 1.81.4;
Regenerate files to pick up correct RCS Ids. Suggested by Chris Badura.
 1.80 30-May-2011  alnsn Add fadvise64 and fadvise64_64 syscalls to compat_linux and compat_linux32.
 1.79 15-Apr-2011  he Regenerate these files after adding pipe2() and dup3().
 1.78 07-Jul-2010  chs branches: 1.78.2;
regen
 1.77 14-Dec-2009  matt branches: 1.77.2; 1.77.4;
Regen (new makesyscalls.sh)
 1.76 24-Nov-2009  njoly Regen for personality(2) update.
 1.75 17-Jun-2009  njoly Regen for sendmsg/recvmsg definitions update.
 1.74 08-Jun-2009  njoly Regen for rt_queueinfo(2) update.
 1.73 17-Jan-2009  njoly branches: 1.73.2;
Regen for wait4 update.
 1.72 15-Jan-2009  njoly Rengen for compat50 update.
 1.71 13-Jan-2009  pooka Regen to prove I didn't screw up the conversion: purely RCSID changes.
 1.70 13-Jan-2009  pooka regen
 1.69 19-Nov-2008  ad Regen.
 1.68 12-Nov-2008  njoly Regen for nanosleep(2) fix.
 1.67 04-Apr-2008  njoly branches: 1.67.4; 1.67.6; 1.67.10; 1.67.12; 1.67.14;
Regen for linux_sys_msync removal.
 1.66 24-Dec-2007  njoly branches: 1.66.6;
Regen for linux_sys_getpgid removal.
 1.65 21-Dec-2007  njoly Regen for getfsuid/setfsgid syscall exchange.
 1.64 20-Dec-2007  dsl regen
 1.63 16-Nov-2007  njoly branches: 1.63.2; 1.63.6;
Regen, for syscalls cleanup.
 1.62 04-Mar-2007  christos branches: 1.62.14; 1.62.16; 1.62.20; 1.62.22;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.61 01-Sep-2006  matt branches: 1.61.8;
Regen.
 1.60 30-Aug-2006  matt Regen
 1.59 10-Jun-2006  christos regen
 1.58 11-Dec-2005  christos branches: 1.58.4; 1.58.8; 1.58.14;
merge ktrace-lwp.
 1.57 16-May-2005  fvdl branches: 1.57.2;
Regen.
 1.56 16-May-2005  fvdl Regen.
 1.55 26-Feb-2005  perry regen
 1.54 26-Feb-2005  perry regen
 1.53 05-Oct-2004  jdolecek branches: 1.53.4; 1.53.6;
regen: generate struct linux_sys_shmget_args for linux_sys_shmget(2)
 1.52 28-Sep-2004  jdolecek regen - now using wrapper for shmget(2)
 1.51 08-Sep-2004  jdolecek regen: add exit_group(2)
 1.50 01-Aug-2004  jdolecek regen - sync syscall lists with Linux kernel 2.6.7
 1.49 01-Aug-2004  jdolecek regen:

connect madvise(2) and mincore(2) - apparently the newer Linux libs
don't stub it anymore, so allow the application to take advantage
of them

the Linux calls appear to be compatible in the flag values and semantics,
so a wrapper is not necessary
 1.48 18-Jan-2003  thorpej branches: 1.48.2; 1.48.4;
Regen to get correct RCS ID.
 1.47 18-Jan-2003  thorpej Regen: Merge the nathanw_sa branch.
 1.46 10-Apr-2002  christos regen
 1.45 22-Mar-2002  christos regen.
 1.44 18-Feb-2002  christos regen
 1.43 18-Feb-2002  christos regen
 1.42 15-Feb-2002  christos - add a real linux_sys___sysctl because the mib numbers are different.
implement only the kernel version getting entries.
- make the signal conversion functions consistent; dest is arg 1.
- make linux_fakedev deal with block and char devices differently.
- add linux_sys_ugetrlimit, and flesh out the regular get/setrlimit so
that they work properly.
- add linux_mmap2 [untested].
- bump kernel to 2.4.18, and make the date be valentine's day :-)
- linux_sys_*stat64 family was totally busted. Fix it.

tested only on i386.

Status:
gdb, telnet, work
jdk-1.4.0 extractor works, jdk still coredumps.

christos
 1.41 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.40 08-Sep-2001  manu Forgotten file in my last commit for removing PowerPC mmap hack in Linux
emulation
 1.39 04-Jul-2001  jdolecek branches: 1.39.2; 1.39.4;
Regen - modify to use linux_* wrappers for syscalls passing/fetching sockaddr
 1.38 30-May-2001  mrg use _KERNEL_OPT.
 1.37 30-Mar-2001  jdolecek regen - use linux_sys_nosys() instead sys_nosys()
 1.36 30-Mar-2001  jdolecek regen
 1.35 30-Mar-2001  jdolecek regen
 1.34 27-Jan-2001  thorpej branches: 1.34.2;
Regen; add sy_flags.
 1.33 29-Dec-2000  fvdl Regen.
 1.32 21-Dec-2000  thorpej Regen.
 1.31 14-Dec-2000  jdolecek regen
 1.30 14-Dec-2000  mycroft Regen.
 1.29 11-Dec-2000  mycroft Regen.
 1.28 11-Dec-2000  mycroft Regen.
 1.27 09-Dec-2000  jdolecek regen
 1.26 09-Dec-2000  mycroft Regen.
 1.25 02-Dec-2000  jdolecek regen after addition of linux_sys_swapoff()
 1.24 01-Dec-2000  jdolecek regen
 1.23 17-Nov-2000  erh Regen.
 1.22 08-Nov-2000  erh Update the names of some unimplemented syscalls to match what linux calls them. Match const in parameters to our sys_writev.
 1.21 01-Nov-2000  jdolecek regen
 1.20 18-Aug-2000  cgd update for changed makesyscalls.master
 1.19 18-Aug-2000  cgd update for new makesyscalls.sh, and also for correct ids for changed
syscalls.master files. (you need to regenerate after checking in
syscalls.master to get the correct ids.)
 1.18 20-Mar-2000  erh branches: 1.18.4;
Regen.
 1.17 18-Mar-2000  erh Regen.
 1.16 18-Mar-2000  erh Regen.
 1.15 18-Mar-2000  erh Regen.
 1.14 16-Dec-1999  tron Regen.
 1.13 05-Dec-1999  tron Regen.
 1.12 04-Oct-1999  tron branches: 1.12.2; 1.12.8;
Regen from "syscalls.master".
 1.11 14-May-1999  thorpej Regen.
 1.10 13-May-1999  thorpej Regen.
 1.9 30-Mar-1999  tron branches: 1.9.4;
Regen.
 1.8 27-Mar-1999  tron Regen.
 1.7 23-Mar-1999  thorpej Regen; pread(2) and pwrite(2).
 1.6 10-Dec-1998  christos Regen
 1.5 19-Oct-1998  tron Regen.
 1.4 07-Oct-1998  erh Regen.
 1.3 04-Oct-1998  fvdl Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.2 03-Oct-1998  christos Attempt to fix the mess.
 1.1 30-Sep-1998  erh Generate.
 1.9.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.12.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.12.2.6 21-Apr-2001  bouyer Sync with HEAD
 1.12.2.5 05-Jan-2001  bouyer Sync with HEAD
 1.12.2.4 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.12.2.3 08-Dec-2000  bouyer Sync with HEAD.
 1.12.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.12.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.18.4.2 01-May-2001  he Pull up regenerated files (requested by jdolecek):
Make it possible to use a different function for unimplemented
syscalls than sys_nosys(), so that the Linux emulation can avoid
posting SIGSYS and instead just return ENOSYS.
 1.18.4.1 30-Mar-2001  he Pull up regenerated files (requested by fvdl):
Add some required Linux emulation bits to support the Linux
version of VMware.
 1.34.2.10 29-May-2002  nathanw Regen.
 1.34.2.9 17-Apr-2002  nathanw Catch up to -current.
 1.34.2.8 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.34.2.7 28-Feb-2002  nathanw Catch up to -current.
 1.34.2.6 14-Nov-2001  nathanw Catch up to -current.
 1.34.2.5 21-Sep-2001  nathanw Catch up to -current.
 1.34.2.4 30-Aug-2001  nathanw First cut at LWP and SA support on the alpha.
Doesn't break in ordinary multiuser mode; LWPs and SAs not yet tested.
 1.34.2.3 24-Aug-2001  nathanw Catch up with -current.
 1.34.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.34.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.39.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.39.2.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.39.2.3 16-Mar-2002  jdolecek Catch up with -current.
 1.39.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.39.2.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.48.4.2 08-Oct-2004  jmc Regen for ticket #884
 1.48.4.1 04-Oct-2004  jmc Regen
 1.48.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.48.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.48.2.4 19-Oct-2004  skrll Sync with HEAD
 1.48.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.48.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.48.2.1 03-Aug-2004  skrll Sync with HEAD
 1.53.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.53.4.1 29-Apr-2005  kent sync with -current
 1.57.2.5 21-Jan-2008  yamt sync with head
 1.57.2.4 07-Dec-2007  yamt sync with head
 1.57.2.3 03-Sep-2007  yamt sync with head.
 1.57.2.2 30-Dec-2006  yamt sync with head.
 1.57.2.1 21-Jun-2006  yamt sync with head.
 1.58.14.1 19-Jun-2006  chap Sync with head.
 1.58.8.2 03-Sep-2006  yamt sync with head.
 1.58.8.1 26-Jun-2006  yamt sync with head.
 1.58.4.1 09-Sep-2006  rpaulo sync with head
 1.61.8.1 12-Mar-2007  rmind Sync with HEAD.
 1.62.22.2 27-Dec-2007  mjf Sync with HEAD.
 1.62.22.1 19-Nov-2007  mjf Sync with HEAD.
 1.62.20.1 18-Nov-2007  bouyer Sync with HEAD
 1.62.16.1 09-Jan-2008  matt sync with HEAD
 1.62.14.1 21-Nov-2007  joerg Sync with HEAD.
 1.63.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.63.2.1 26-Dec-2007  ad Sync with head.
 1.66.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.66.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.67.14.1 20-Nov-2008  snj Regen for ticket 81.
 1.67.12.1 19-Jan-2009  skrll Sync with HEAD.
 1.67.10.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.67.6.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.67.4.4 11-Aug-2010  yamt sync with head.
 1.67.4.3 11-Mar-2010  yamt sync with head
 1.67.4.2 20-Jun-2009  yamt sync with head
 1.67.4.1 04-May-2009  yamt sync with head.
 1.73.2.1 23-Jul-2009  jym Sync with HEAD.
 1.77.4.3 31-May-2011  rmind sync with head
 1.77.4.2 21-Apr-2011  rmind sync with head
 1.77.4.1 05-Mar-2011  rmind sync with head
 1.77.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.78.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.81.4.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.81.4.2 30-Oct-2012  yamt sync with head
 1.81.4.1 17-Apr-2012  yamt sync with head
 1.82.10.3 03-Dec-2017  jdolecek update from HEAD
 1.82.10.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.82.10.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.83.2.1 18-May-2014  rmind sync with head
 1.89.2.1 10-Aug-2014  tls Rebase.
 1.94.2.1 17-Apr-2017  snj regen for ticket 1354
 1.95.2.4 05-Feb-2017  skrll Sync with HEAD
 1.95.2.3 05-Oct-2016  skrll Sync with HEAD
 1.95.2.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.95.2.1 06-Apr-2015  skrll Sync with HEAD
 1.98.2.3 20-Mar-2017  pgoyette Sync with HEAD
 1.98.2.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.98.2.1 26-Jul-2016  pgoyette Sync with HEAD
 1.102.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.105.4.1 11-May-2017  pgoyette Sync with HEAD
 1.106.10.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.106.10.1 10-Jun-2019  christos Sync with HEAD
 1.106.8.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.110.2.2 17-Dec-2020  thorpej Regen for preadv(2) and pwritev(2).
 1.110.2.1 15-Dec-2020  thorpej Regen for eventfd, timerfd, POSIX timers.
 1.120.2.1 02-Aug-2025  perseant Sync with HEAD
 1.122 26-Oct-2025  christos regen
 1.121 28-Sep-2024  christos regen
 1.120 01-Jul-2024  christos regen
 1.119 29-Jun-2024  christos branches: 1.119.2;
regen
 1.118 19-Aug-2023  christos regen
 1.117 18-Aug-2023  christos regen
 1.116 29-Jul-2023  christos regen
 1.115 28-Jul-2023  christos regen
 1.114 02-Dec-2021  ryo regen
 1.113 20-Sep-2021  thorpej Regen for preadv(2) / pwritev(2).
 1.112 20-Sep-2021  thorpej Regen for eventfd.
 1.111 19-Sep-2021  thorpej Regen for timerfd.
 1.110 19-Sep-2021  thorpej Regen for POSIX timer syscalls.
 1.109 26-Apr-2020  thorpej branches: 1.109.2;
Regen for native futex calls.
 1.108 09-Nov-2019  jdolecek regen
 1.107 24-Mar-2019  maxv regen
 1.106 10-Aug-2018  pgoyette Regen
 1.105 10-May-2017  riastradh branches: 1.105.8; 1.105.10;
regen
 1.104 03-Feb-2017  christos branches: 1.104.4;
regen
 1.103 03-Feb-2017  martin Regen for accept4
 1.102 16-Jan-2017  christos regen all
 1.101 13-Jan-2017  christos branches: 1.101.2;
regen
 1.100 02-Jan-2017  martin Regen (something apparently went wrong in previous)
 1.99 02-Jan-2017  manu Regen
 1.98 24-Jul-2016  njoly Regen for readlink/readlinkat signatures.
 1.97 25-Oct-2015  njoly branches: 1.97.2;
Regen for posix chown family cleanup.
 1.96 24-Sep-2015  christos regen
 1.95 07-Mar-2015  christos regen
 1.94 22-Nov-2014  njoly branches: 1.94.2;
Regen for ppoll signature fix
 1.93 29-May-2014  njoly branches: 1.93.2;
Regen for utimes(2) change.
 1.92 17-May-2014  njoly Regen for fadvise64 offset types changes.
 1.91 06-May-2014  njoly Regen for mknod device argument type change.
 1.90 04-May-2014  njoly Regen for pread/pwrite 64bit offset argument.
 1.89 08-Apr-2014  njoly Regen.
 1.88 13-Jan-2014  njoly branches: 1.88.2;
Regen.
 1.87 27-Dec-2013  njoly Regen.
 1.86 08-Dec-2013  njoly Regen.
 1.85 19-Nov-2013  chs regen
 1.84 24-Sep-2013  njoly Regen for utimensat(2).
 1.83 15-Sep-2013  njoly Regen.
 1.82 19-Sep-2012  pooka branches: 1.82.2;
regen for ppoll (and, apparently, SYCALL_ARG_PTR)
 1.81 18-Nov-2011  christos branches: 1.81.10;
- add sigtimedwait support.
- merge the siginfo population code.
 1.80 30-May-2011  alnsn branches: 1.80.4;
Regenerate files to pick up correct RCS Ids. Suggested by Chris Badura.
 1.79 30-May-2011  alnsn Add fadvise64 and fadvise64_64 syscalls to compat_linux and compat_linux32.
 1.78 15-Apr-2011  he Regenerate these files after adding pipe2() and dup3().
 1.77 07-Jul-2010  chs branches: 1.77.2;
regen
 1.76 14-Dec-2009  matt branches: 1.76.2; 1.76.4;
Regen (new makesyscalls.sh)
 1.75 24-Nov-2009  njoly Regen for personality(2) update.
 1.74 17-Jun-2009  njoly Regen for sendmsg/recvmsg definitions update.
 1.73 08-Jun-2009  njoly Regen for rt_queueinfo(2) update.
 1.72 17-Jan-2009  njoly branches: 1.72.2;
Regen for wait4 update.
 1.71 15-Jan-2009  njoly Rengen for compat50 update.
 1.70 13-Jan-2009  pooka Regen to prove I didn't screw up the conversion: purely RCSID changes.
 1.69 13-Jan-2009  pooka regen
 1.68 19-Nov-2008  ad Regen.
 1.67 12-Nov-2008  njoly Regen for nanosleep(2) fix.
 1.66 04-Apr-2008  njoly branches: 1.66.4; 1.66.6; 1.66.10; 1.66.12; 1.66.14;
Regen for linux_sys_msync removal.
 1.65 24-Dec-2007  njoly branches: 1.65.6;
Regen for linux_sys_getpgid removal.
 1.64 21-Dec-2007  njoly Regen for getfsuid/setfsgid syscall exchange.
 1.63 20-Dec-2007  dsl regen
 1.62 16-Nov-2007  njoly branches: 1.62.2; 1.62.6;
Regen, for syscalls cleanup.
 1.61 04-Mar-2007  christos branches: 1.61.14; 1.61.16; 1.61.20; 1.61.22;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.60 01-Sep-2006  matt branches: 1.60.8;
Regen.
 1.59 30-Aug-2006  matt Regen
 1.58 10-Jun-2006  christos regen
 1.57 11-Dec-2005  christos branches: 1.57.4; 1.57.8; 1.57.14;
merge ktrace-lwp.
 1.56 16-May-2005  fvdl branches: 1.56.2;
Regen.
 1.55 16-May-2005  fvdl Regen.
 1.54 26-Feb-2005  perry regen
 1.53 26-Feb-2005  perry regen
 1.52 05-Oct-2004  jdolecek branches: 1.52.4; 1.52.6;
regen: generate struct linux_sys_shmget_args for linux_sys_shmget(2)
 1.51 28-Sep-2004  jdolecek regen - now using wrapper for shmget(2)
 1.50 08-Sep-2004  jdolecek regen: add exit_group(2)
 1.49 01-Aug-2004  jdolecek regen - sync syscall lists with Linux kernel 2.6.7
 1.48 01-Aug-2004  jdolecek regen:

connect madvise(2) and mincore(2) - apparently the newer Linux libs
don't stub it anymore, so allow the application to take advantage
of them

the Linux calls appear to be compatible in the flag values and semantics,
so a wrapper is not necessary
 1.47 18-Jan-2003  thorpej branches: 1.47.2; 1.47.4;
Regen to get correct RCS ID.
 1.46 18-Jan-2003  thorpej Regen: Merge the nathanw_sa branch.
 1.45 10-Apr-2002  christos regen
 1.44 22-Mar-2002  christos regen.
 1.43 18-Feb-2002  christos regen
 1.42 18-Feb-2002  christos regen
 1.41 15-Feb-2002  christos - add a real linux_sys___sysctl because the mib numbers are different.
implement only the kernel version getting entries.
- make the signal conversion functions consistent; dest is arg 1.
- make linux_fakedev deal with block and char devices differently.
- add linux_sys_ugetrlimit, and flesh out the regular get/setrlimit so
that they work properly.
- add linux_mmap2 [untested].
- bump kernel to 2.4.18, and make the date be valentine's day :-)
- linux_sys_*stat64 family was totally busted. Fix it.

tested only on i386.

Status:
gdb, telnet, work
jdk-1.4.0 extractor works, jdk still coredumps.

christos
 1.40 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.39 04-Jul-2001  jdolecek branches: 1.39.2;
Regen - modify to use linux_* wrappers for syscalls passing/fetching sockaddr
 1.38 30-May-2001  mrg use _KERNEL_OPT.
 1.37 30-Mar-2001  jdolecek regen - use linux_sys_nosys() instead sys_nosys()
 1.36 30-Mar-2001  jdolecek regen
 1.35 30-Mar-2001  jdolecek regen
 1.34 27-Jan-2001  thorpej branches: 1.34.2;
Regen; add sy_flags.
 1.33 29-Dec-2000  fvdl Regen.
 1.32 21-Dec-2000  thorpej Regen.
 1.31 14-Dec-2000  jdolecek regen
 1.30 14-Dec-2000  mycroft Regen.
 1.29 11-Dec-2000  mycroft Regen.
 1.28 11-Dec-2000  mycroft Regen.
 1.27 09-Dec-2000  jdolecek regen
 1.26 09-Dec-2000  mycroft Regen.
 1.25 02-Dec-2000  jdolecek regen after addition of linux_sys_swapoff()
 1.24 01-Dec-2000  jdolecek regen
 1.23 17-Nov-2000  erh Regen.
 1.22 08-Nov-2000  erh Update the names of some unimplemented syscalls to match what linux calls them. Match const in parameters to our sys_writev.
 1.21 01-Nov-2000  jdolecek regen
 1.20 18-Aug-2000  cgd update for changed makesyscalls.master
 1.19 18-Aug-2000  cgd update for new makesyscalls.sh, and also for correct ids for changed
syscalls.master files. (you need to regenerate after checking in
syscalls.master to get the correct ids.)
 1.18 20-Mar-2000  erh branches: 1.18.4;
Regen.
 1.17 18-Mar-2000  erh Regen.
 1.16 18-Mar-2000  erh Regen.
 1.15 18-Mar-2000  erh Regen.
 1.14 16-Dec-1999  tron Regen.
 1.13 05-Dec-1999  tron Regen.
 1.12 04-Oct-1999  tron branches: 1.12.2; 1.12.8;
Regen from "syscalls.master".
 1.11 14-May-1999  thorpej Regen.
 1.10 13-May-1999  thorpej Regen.
 1.9 30-Mar-1999  tron branches: 1.9.4;
Regen.
 1.8 27-Mar-1999  tron Regen.
 1.7 23-Mar-1999  thorpej Regen; pread(2) and pwrite(2).
 1.6 10-Dec-1998  christos Regen
 1.5 19-Oct-1998  tron Regen.
 1.4 07-Oct-1998  erh Regen.
 1.3 04-Oct-1998  fvdl Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.2 03-Oct-1998  christos Attempt to fix the mess.
 1.1 30-Sep-1998  erh Generate.
 1.9.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.12.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.12.2.6 21-Apr-2001  bouyer Sync with HEAD
 1.12.2.5 05-Jan-2001  bouyer Sync with HEAD
 1.12.2.4 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.12.2.3 08-Dec-2000  bouyer Sync with HEAD.
 1.12.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.12.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.18.4.2 01-May-2001  he Pull up regenerated files (requested by jdolecek):
Make it possible to use a different function for unimplemented
syscalls than sys_nosys(), so that the Linux emulation can avoid
posting SIGSYS and instead just return ENOSYS.
 1.18.4.1 30-Mar-2001  he Pull up regenerated files (requested by fvdl):
Add some required Linux emulation bits to support the Linux
version of VMware.
 1.34.2.9 29-May-2002  nathanw Regen.
 1.34.2.8 17-Apr-2002  nathanw Catch up to -current.
 1.34.2.7 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.34.2.6 28-Feb-2002  nathanw Catch up to -current.
 1.34.2.5 14-Nov-2001  nathanw Catch up to -current.
 1.34.2.4 30-Aug-2001  nathanw First cut at LWP and SA support on the alpha.
Doesn't break in ordinary multiuser mode; LWPs and SAs not yet tested.
 1.34.2.3 24-Aug-2001  nathanw Catch up with -current.
 1.34.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.34.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.39.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.39.2.2 16-Mar-2002  jdolecek Catch up with -current.
 1.39.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.47.4.2 08-Oct-2004  jmc Regen for ticket #884
 1.47.4.1 04-Oct-2004  jmc Regen
 1.47.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.47.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.47.2.4 19-Oct-2004  skrll Sync with HEAD
 1.47.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.47.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.47.2.1 03-Aug-2004  skrll Sync with HEAD
 1.52.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.52.4.1 29-Apr-2005  kent sync with -current
 1.56.2.5 21-Jan-2008  yamt sync with head
 1.56.2.4 07-Dec-2007  yamt sync with head
 1.56.2.3 03-Sep-2007  yamt sync with head.
 1.56.2.2 30-Dec-2006  yamt sync with head.
 1.56.2.1 21-Jun-2006  yamt sync with head.
 1.57.14.1 19-Jun-2006  chap Sync with head.
 1.57.8.2 03-Sep-2006  yamt sync with head.
 1.57.8.1 26-Jun-2006  yamt sync with head.
 1.57.4.1 09-Sep-2006  rpaulo sync with head
 1.60.8.1 12-Mar-2007  rmind Sync with HEAD.
 1.61.22.2 27-Dec-2007  mjf Sync with HEAD.
 1.61.22.1 19-Nov-2007  mjf Sync with HEAD.
 1.61.20.1 18-Nov-2007  bouyer Sync with HEAD
 1.61.16.1 09-Jan-2008  matt sync with HEAD
 1.61.14.1 21-Nov-2007  joerg Sync with HEAD.
 1.62.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.62.2.1 26-Dec-2007  ad Sync with head.
 1.65.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.65.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.66.14.1 20-Nov-2008  snj Regen for ticket 81.
 1.66.12.1 19-Jan-2009  skrll Sync with HEAD.
 1.66.10.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.66.6.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.66.4.4 11-Aug-2010  yamt sync with head.
 1.66.4.3 11-Mar-2010  yamt sync with head
 1.66.4.2 20-Jun-2009  yamt sync with head
 1.66.4.1 04-May-2009  yamt sync with head.
 1.72.2.1 23-Jul-2009  jym Sync with HEAD.
 1.76.4.3 31-May-2011  rmind sync with head
 1.76.4.2 21-Apr-2011  rmind sync with head
 1.76.4.1 05-Mar-2011  rmind sync with head
 1.76.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.77.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.80.4.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.80.4.2 30-Oct-2012  yamt sync with head
 1.80.4.1 17-Apr-2012  yamt sync with head
 1.81.10.3 03-Dec-2017  jdolecek update from HEAD
 1.81.10.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.81.10.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.82.2.1 18-May-2014  rmind sync with head
 1.88.2.1 10-Aug-2014  tls Rebase.
 1.93.2.1 17-Apr-2017  snj regen for ticket 1354
 1.94.2.5 28-Aug-2017  skrll Sync with HEAD
 1.94.2.4 05-Feb-2017  skrll Sync with HEAD
 1.94.2.3 05-Oct-2016  skrll Sync with HEAD
 1.94.2.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.94.2.1 06-Apr-2015  skrll Sync with HEAD
 1.97.2.3 20-Mar-2017  pgoyette Sync with HEAD
 1.97.2.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.97.2.1 26-Jul-2016  pgoyette Sync with HEAD
 1.101.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.104.4.1 11-May-2017  pgoyette Sync with HEAD
 1.105.10.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.105.10.1 10-Jun-2019  christos Sync with HEAD
 1.105.8.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.109.2.2 17-Dec-2020  thorpej Regen for preadv(2) and pwritev(2).
 1.109.2.1 15-Dec-2020  thorpej Regen for eventfd, timerfd, POSIX timers.
 1.119.2.1 02-Aug-2025  perseant Sync with HEAD
 1.124 26-Oct-2025  christos regen
 1.123 28-Sep-2024  christos regen
 1.122 01-Jul-2024  christos regen
 1.121 29-Jun-2024  christos branches: 1.121.2;
regen
 1.120 19-Aug-2023  christos regen
 1.119 18-Aug-2023  christos regen
 1.118 29-Jul-2023  christos regen
 1.117 28-Jul-2023  christos regen
 1.116 02-Dec-2021  ryo regen
 1.115 20-Sep-2021  thorpej Regen for preadv(2) / pwritev(2).
 1.114 20-Sep-2021  thorpej Regen for eventfd.
 1.113 19-Sep-2021  thorpej Regen for timerfd.
 1.112 19-Sep-2021  thorpej Regen for POSIX timer syscalls.
 1.111 26-Apr-2020  thorpej branches: 1.111.2;
Regen for native futex calls.
 1.110 09-Nov-2019  jdolecek regen
 1.109 24-Mar-2019  maxv regen
 1.108 10-Aug-2018  pgoyette Regen
 1.107 10-May-2017  riastradh branches: 1.107.8; 1.107.10;
regen
 1.106 03-Feb-2017  christos branches: 1.106.4;
regen
 1.105 03-Feb-2017  martin Regen for accept4
 1.104 16-Jan-2017  christos regen all
 1.103 13-Jan-2017  christos branches: 1.103.2;
regen
 1.102 02-Jan-2017  martin Regen (something apparently went wrong in previous)
 1.101 02-Jan-2017  manu Regen
 1.100 24-Jul-2016  njoly Regen for readlink/readlinkat signatures.
 1.99 25-Oct-2015  njoly branches: 1.99.2;
Regen for posix chown family cleanup.
 1.98 24-Sep-2015  christos regen
 1.97 07-Mar-2015  christos regen
 1.96 22-Nov-2014  njoly branches: 1.96.2;
Regen for ppoll signature fix
 1.95 29-May-2014  njoly branches: 1.95.2;
Regen for utimes(2) change.
 1.94 17-May-2014  njoly Regen for fadvise64 offset types changes.
 1.93 06-May-2014  njoly Regen for mknod device argument type change.
 1.92 04-May-2014  njoly Regen for pread/pwrite 64bit offset argument.
 1.91 08-Apr-2014  njoly Regen.
 1.90 13-Jan-2014  njoly branches: 1.90.2;
Regen.
 1.89 27-Dec-2013  njoly Regen.
 1.88 08-Dec-2013  njoly Regen.
 1.87 19-Nov-2013  chs regen
 1.86 24-Sep-2013  njoly Regen for utimensat(2).
 1.85 15-Sep-2013  njoly Regen.
 1.84 19-Sep-2012  pooka branches: 1.84.2;
regen for ppoll (and, apparently, SYCALL_ARG_PTR)
 1.83 18-Nov-2011  christos branches: 1.83.10;
- add sigtimedwait support.
- merge the siginfo population code.
 1.82 30-May-2011  alnsn branches: 1.82.4;
Regenerate files to pick up correct RCS Ids. Suggested by Chris Badura.
 1.81 30-May-2011  alnsn Add fadvise64 and fadvise64_64 syscalls to compat_linux and compat_linux32.
 1.80 15-Apr-2011  he Regenerate these files after adding pipe2() and dup3().
 1.79 07-Jul-2010  chs branches: 1.79.2;
regen
 1.78 14-Dec-2009  matt branches: 1.78.2; 1.78.4;
Regen (new makesyscalls.sh)
 1.77 24-Nov-2009  njoly Regen for personality(2) update.
 1.76 17-Jun-2009  njoly Regen for sendmsg/recvmsg definitions update.
 1.75 08-Jun-2009  njoly Regen for rt_queueinfo(2) update.
 1.74 17-Jan-2009  njoly branches: 1.74.2;
Regen for wait4 update.
 1.73 15-Jan-2009  njoly Rengen for compat50 update.
 1.72 13-Jan-2009  pooka Regen to prove I didn't screw up the conversion: purely RCSID changes.
 1.71 13-Jan-2009  pooka regen
 1.70 19-Nov-2008  ad Regen.
 1.69 12-Nov-2008  njoly Regen for nanosleep(2) fix.
 1.68 04-Apr-2008  njoly branches: 1.68.4; 1.68.6; 1.68.10; 1.68.12; 1.68.14;
Regen for linux_sys_msync removal.
 1.67 24-Dec-2007  njoly branches: 1.67.6;
Regen for linux_sys_getpgid removal.
 1.66 21-Dec-2007  njoly Regen for getfsuid/setfsgid syscall exchange.
 1.65 20-Dec-2007  dsl regen
 1.64 16-Nov-2007  njoly branches: 1.64.2; 1.64.6;
Regen, for syscalls cleanup.
 1.63 09-Feb-2007  ad branches: 1.63.18; 1.63.20; 1.63.24; 1.63.26;
Merge newlock2 to head.
 1.62 01-Sep-2006  matt branches: 1.62.2;
Regen.
 1.61 30-Aug-2006  matt Regen
 1.60 10-Jun-2006  christos regen
 1.59 11-Dec-2005  christos branches: 1.59.4; 1.59.8; 1.59.14;
merge ktrace-lwp.
 1.58 16-May-2005  fvdl branches: 1.58.2;
Regen.
 1.57 16-May-2005  fvdl Regen.
 1.56 26-Feb-2005  perry regen
 1.55 26-Feb-2005  perry regen
 1.54 05-Oct-2004  jdolecek branches: 1.54.4; 1.54.6;
regen: generate struct linux_sys_shmget_args for linux_sys_shmget(2)
 1.53 28-Sep-2004  jdolecek regen - now using wrapper for shmget(2)
 1.52 08-Sep-2004  jdolecek regen: add exit_group(2)
 1.51 01-Aug-2004  jdolecek regen - sync syscall lists with Linux kernel 2.6.7
 1.50 01-Aug-2004  jdolecek regen:

connect madvise(2) and mincore(2) - apparently the newer Linux libs
don't stub it anymore, so allow the application to take advantage
of them

the Linux calls appear to be compatible in the flag values and semantics,
so a wrapper is not necessary
 1.49 18-Jan-2003  thorpej branches: 1.49.2; 1.49.4;
Regen to get correct RCS ID.
 1.48 18-Jan-2003  thorpej Regen: Merge the nathanw_sa branch.
 1.47 10-Apr-2002  christos regen
 1.46 22-Mar-2002  christos regen.
 1.45 18-Feb-2002  christos regen
 1.44 18-Feb-2002  christos regen
 1.43 15-Feb-2002  christos - add a real linux_sys___sysctl because the mib numbers are different.
implement only the kernel version getting entries.
- make the signal conversion functions consistent; dest is arg 1.
- make linux_fakedev deal with block and char devices differently.
- add linux_sys_ugetrlimit, and flesh out the regular get/setrlimit so
that they work properly.
- add linux_mmap2 [untested].
- bump kernel to 2.4.18, and make the date be valentine's day :-)
- linux_sys_*stat64 family was totally busted. Fix it.

tested only on i386.

Status:
gdb, telnet, work
jdk-1.4.0 extractor works, jdk still coredumps.

christos
 1.42 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.41 08-Sep-2001  manu Removed a hack to make PowerPC mmap work. This could have side effects on
alpha and i386. It has been tested and works on i386.
 1.40 04-Jul-2001  jdolecek branches: 1.40.2; 1.40.4;
Regen - modify to use linux_* wrappers for syscalls passing/fetching sockaddr
 1.39 30-May-2001  mrg use _KERNEL_OPT.
 1.38 30-Mar-2001  jdolecek regen - use linux_sys_nosys() instead sys_nosys()
 1.37 30-Mar-2001  jdolecek regen
 1.36 30-Mar-2001  jdolecek regen
 1.35 27-Jan-2001  thorpej branches: 1.35.2;
Regen; add sy_flags.
 1.34 29-Dec-2000  fvdl Regen.
 1.33 21-Dec-2000  thorpej Regen.
 1.32 14-Dec-2000  jdolecek regen
 1.31 14-Dec-2000  mycroft Regen.
 1.30 11-Dec-2000  mycroft Regen.
 1.29 11-Dec-2000  mycroft Regen.
 1.28 09-Dec-2000  jdolecek regen
 1.27 09-Dec-2000  mycroft Regen.
 1.26 02-Dec-2000  jdolecek regen after addition of linux_sys_swapoff()
 1.25 01-Dec-2000  jdolecek regen
 1.24 17-Nov-2000  erh Regen.
 1.23 13-Nov-2000  jdolecek change the type of *syscallnames[] array to 'const char * const foo[]'
 1.22 08-Nov-2000  erh Update the names of some unimplemented syscalls to match what linux calls them. Match const in parameters to our sys_writev.
 1.21 01-Nov-2000  jdolecek regen
 1.20 18-Aug-2000  cgd update for changed makesyscalls.master
 1.19 18-Aug-2000  cgd update for new makesyscalls.sh, and also for correct ids for changed
syscalls.master files. (you need to regenerate after checking in
syscalls.master to get the correct ids.)
 1.18 20-Mar-2000  erh branches: 1.18.4;
Regen.
 1.17 18-Mar-2000  erh Regen.
 1.16 18-Mar-2000  erh Regen.
 1.15 18-Mar-2000  erh Regen.
 1.14 16-Dec-1999  tron Regen.
 1.13 05-Dec-1999  tron Regen.
 1.12 04-Oct-1999  tron branches: 1.12.2; 1.12.8;
Regen from "syscalls.master".
 1.11 14-May-1999  thorpej Regen.
 1.10 13-May-1999  thorpej Regen.
 1.9 30-Mar-1999  tron branches: 1.9.4;
Regen.
 1.8 27-Mar-1999  tron Regen.
 1.7 23-Mar-1999  thorpej Regen; pread(2) and pwrite(2).
 1.6 10-Dec-1998  christos Regen
 1.5 19-Oct-1998  tron Regen.
 1.4 07-Oct-1998  erh Regen.
 1.3 04-Oct-1998  fvdl Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.2 03-Oct-1998  christos Attempt to fix the mess.
 1.1 30-Sep-1998  erh Generate.
 1.9.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.12.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.12.2.6 21-Apr-2001  bouyer Sync with HEAD
 1.12.2.5 05-Jan-2001  bouyer Sync with HEAD
 1.12.2.4 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.12.2.3 08-Dec-2000  bouyer Sync with HEAD.
 1.12.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.12.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.18.4.2 01-May-2001  he Pull up regenerated files (requested by jdolecek):
Make it possible to use a different function for unimplemented
syscalls than sys_nosys(), so that the Linux emulation can avoid
posting SIGSYS and instead just return ENOSYS.
 1.18.4.1 30-Mar-2001  he Pull up regenerated files (requested by fvdl):
Add some required Linux emulation bits to support the Linux
version of VMware.
 1.35.2.9 29-May-2002  nathanw Regen.
 1.35.2.8 17-Apr-2002  nathanw Catch up to -current.
 1.35.2.7 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.35.2.6 28-Feb-2002  nathanw Catch up to -current.
 1.35.2.5 14-Nov-2001  nathanw Catch up to -current.
 1.35.2.4 30-Aug-2001  nathanw First cut at LWP and SA support on the alpha.
Doesn't break in ordinary multiuser mode; LWPs and SAs not yet tested.
 1.35.2.3 24-Aug-2001  nathanw Catch up with -current.
 1.35.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.35.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.40.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.40.2.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.40.2.3 16-Mar-2002  jdolecek Catch up with -current.
 1.40.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.40.2.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.49.4.2 08-Oct-2004  jmc Regen for ticket #884
 1.49.4.1 04-Oct-2004  jmc Regen
 1.49.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.49.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.49.2.4 19-Oct-2004  skrll Sync with HEAD
 1.49.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.49.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.49.2.1 03-Aug-2004  skrll Sync with HEAD
 1.54.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.54.4.1 29-Apr-2005  kent sync with -current
 1.58.2.5 21-Jan-2008  yamt sync with head
 1.58.2.4 07-Dec-2007  yamt sync with head
 1.58.2.3 26-Feb-2007  yamt sync with head.
 1.58.2.2 30-Dec-2006  yamt sync with head.
 1.58.2.1 21-Jun-2006  yamt sync with head.
 1.59.14.1 19-Jun-2006  chap Sync with head.
 1.59.8.2 03-Sep-2006  yamt sync with head.
 1.59.8.1 26-Jun-2006  yamt sync with head.
 1.59.4.1 09-Sep-2006  rpaulo sync with head
 1.62.2.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.63.26.2 27-Dec-2007  mjf Sync with HEAD.
 1.63.26.1 19-Nov-2007  mjf Sync with HEAD.
 1.63.24.1 18-Nov-2007  bouyer Sync with HEAD
 1.63.20.1 09-Jan-2008  matt sync with HEAD
 1.63.18.1 21-Nov-2007  joerg Sync with HEAD.
 1.64.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.64.2.1 26-Dec-2007  ad Sync with head.
 1.67.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.67.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.68.14.1 20-Nov-2008  snj Regen for ticket 81.
 1.68.12.1 19-Jan-2009  skrll Sync with HEAD.
 1.68.10.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.68.6.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.68.6.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.68.4.4 11-Aug-2010  yamt sync with head.
 1.68.4.3 11-Mar-2010  yamt sync with head
 1.68.4.2 20-Jun-2009  yamt sync with head
 1.68.4.1 04-May-2009  yamt sync with head.
 1.74.2.1 23-Jul-2009  jym Sync with HEAD.
 1.78.4.3 31-May-2011  rmind sync with head
 1.78.4.2 21-Apr-2011  rmind sync with head
 1.78.4.1 05-Mar-2011  rmind sync with head
 1.78.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.79.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.82.4.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.82.4.2 30-Oct-2012  yamt sync with head
 1.82.4.1 17-Apr-2012  yamt sync with head
 1.83.10.3 03-Dec-2017  jdolecek update from HEAD
 1.83.10.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.83.10.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.84.2.1 18-May-2014  rmind sync with head
 1.90.2.1 10-Aug-2014  tls Rebase.
 1.95.2.1 17-Apr-2017  snj regen for ticket 1354
 1.96.2.4 05-Feb-2017  skrll Sync with HEAD
 1.96.2.3 05-Oct-2016  skrll Sync with HEAD
 1.96.2.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.96.2.1 06-Apr-2015  skrll Sync with HEAD
 1.99.2.3 20-Mar-2017  pgoyette Sync with HEAD
 1.99.2.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.99.2.1 26-Jul-2016  pgoyette Sync with HEAD
 1.103.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.106.4.1 11-May-2017  pgoyette Sync with HEAD
 1.107.10.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.107.10.1 10-Jun-2019  christos Sync with HEAD
 1.107.8.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.111.2.2 17-Dec-2020  thorpej Regen for preadv(2) and pwritev(2).
 1.111.2.1 15-Dec-2020  thorpej Regen for eventfd, timerfd, POSIX timers.
 1.121.2.1 02-Aug-2025  perseant Sync with HEAD
 1.123 26-Oct-2025  christos regen
 1.122 28-Sep-2024  christos regen
 1.121 01-Jul-2024  christos regen
 1.120 29-Jun-2024  christos branches: 1.120.2;
regen
 1.119 19-Aug-2023  christos regen
 1.118 18-Aug-2023  christos regen
 1.117 29-Jul-2023  christos regen
 1.116 28-Jul-2023  christos regen
 1.115 02-Dec-2021  ryo regen
 1.114 20-Sep-2021  thorpej Regen for preadv(2) / pwritev(2).
 1.113 20-Sep-2021  thorpej Regen for eventfd.
 1.112 19-Sep-2021  thorpej Regen for timerfd.
 1.111 19-Sep-2021  thorpej Regen for POSIX timer syscalls.
 1.110 26-Apr-2020  thorpej branches: 1.110.2;
Regen for native futex calls.
 1.109 09-Nov-2019  jdolecek regen
 1.108 24-Mar-2019  maxv regen
 1.107 10-Aug-2018  pgoyette Regen
 1.106 10-May-2017  riastradh branches: 1.106.8; 1.106.10;
regen
 1.105 03-Feb-2017  christos branches: 1.105.4;
regen
 1.104 03-Feb-2017  martin Regen for accept4
 1.103 16-Jan-2017  christos regen all
 1.102 13-Jan-2017  christos branches: 1.102.2;
regen
 1.101 02-Jan-2017  martin Regen (something apparently went wrong in previous)
 1.100 02-Jan-2017  manu Regen
 1.99 24-Jul-2016  njoly Regen for readlink/readlinkat signatures.
 1.98 25-Oct-2015  njoly branches: 1.98.2;
Regen for posix chown family cleanup.
 1.97 24-Sep-2015  christos regen
 1.96 07-Mar-2015  christos regen
 1.95 22-Nov-2014  njoly branches: 1.95.2;
Regen for ppoll signature fix
 1.94 29-May-2014  njoly branches: 1.94.2;
Regen for utimes(2) change.
 1.93 17-May-2014  njoly Regen for fadvise64 offset types changes.
 1.92 06-May-2014  njoly Regen for mknod device argument type change.
 1.91 04-May-2014  njoly Regen for pread/pwrite 64bit offset argument.
 1.90 08-Apr-2014  njoly Regen.
 1.89 13-Jan-2014  njoly branches: 1.89.2;
Regen.
 1.88 27-Dec-2013  njoly Regen.
 1.87 08-Dec-2013  njoly Regen.
 1.86 19-Nov-2013  chs regen
 1.85 24-Sep-2013  njoly Regen for utimensat(2).
 1.84 15-Sep-2013  njoly Regen.
 1.83 19-Sep-2012  pooka branches: 1.83.2;
regen for ppoll (and, apparently, SYCALL_ARG_PTR)
 1.82 18-Nov-2011  christos branches: 1.82.10;
- add sigtimedwait support.
- merge the siginfo population code.
 1.81 30-May-2011  alnsn branches: 1.81.4;
Regenerate files to pick up correct RCS Ids. Suggested by Chris Badura.
 1.80 30-May-2011  alnsn Add fadvise64 and fadvise64_64 syscalls to compat_linux and compat_linux32.
 1.79 15-Apr-2011  he Regenerate these files after adding pipe2() and dup3().
 1.78 07-Jul-2010  chs branches: 1.78.2;
regen
 1.77 14-Dec-2009  matt branches: 1.77.2; 1.77.4;
Regen (new makesyscalls.sh)
 1.76 24-Nov-2009  njoly Regen for personality(2) update.
 1.75 17-Jun-2009  njoly Regen for sendmsg/recvmsg definitions update.
 1.74 08-Jun-2009  njoly Regen for rt_queueinfo(2) update.
 1.73 17-Jan-2009  njoly branches: 1.73.2;
Regen for wait4 update.
 1.72 15-Jan-2009  njoly Rengen for compat50 update.
 1.71 13-Jan-2009  pooka Regen to prove I didn't screw up the conversion: purely RCSID changes.
 1.70 13-Jan-2009  pooka regen
 1.69 19-Nov-2008  ad Regen.
 1.68 12-Nov-2008  njoly Regen for nanosleep(2) fix.
 1.67 04-Apr-2008  njoly branches: 1.67.4; 1.67.6; 1.67.10; 1.67.12; 1.67.14;
Regen for linux_sys_msync removal.
 1.66 24-Dec-2007  njoly branches: 1.66.6;
Regen for linux_sys_getpgid removal.
 1.65 21-Dec-2007  njoly Regen for getfsuid/setfsgid syscall exchange.
 1.64 20-Dec-2007  dsl regen
 1.63 16-Nov-2007  njoly branches: 1.63.2; 1.63.6;
Regen, for syscalls cleanup.
 1.62 09-Feb-2007  ad branches: 1.62.18; 1.62.20; 1.62.24; 1.62.26;
Merge newlock2 to head.
 1.61 01-Sep-2006  matt branches: 1.61.2;
Regen.
 1.60 30-Aug-2006  matt Regen
 1.59 10-Jun-2006  christos regen
 1.58 11-Dec-2005  christos branches: 1.58.4; 1.58.8; 1.58.14;
merge ktrace-lwp.
 1.57 16-May-2005  fvdl branches: 1.57.2;
Regen.
 1.56 16-May-2005  fvdl Regen.
 1.55 26-Feb-2005  perry regen
 1.54 26-Feb-2005  perry regen
 1.53 05-Oct-2004  jdolecek branches: 1.53.4; 1.53.6;
regen: generate struct linux_sys_shmget_args for linux_sys_shmget(2)
 1.52 28-Sep-2004  jdolecek regen - now using wrapper for shmget(2)
 1.51 08-Sep-2004  jdolecek regen: add exit_group(2)
 1.50 01-Aug-2004  jdolecek regen - sync syscall lists with Linux kernel 2.6.7
 1.49 01-Aug-2004  jdolecek regen:

connect madvise(2) and mincore(2) - apparently the newer Linux libs
don't stub it anymore, so allow the application to take advantage
of them

the Linux calls appear to be compatible in the flag values and semantics,
so a wrapper is not necessary
 1.48 18-Jan-2003  thorpej branches: 1.48.2; 1.48.4;
Regen to get correct RCS ID.
 1.47 18-Jan-2003  thorpej Regen: Merge the nathanw_sa branch.
 1.46 10-Apr-2002  christos regen
 1.45 22-Mar-2002  christos regen.
 1.44 18-Feb-2002  christos regen
 1.43 18-Feb-2002  christos regen
 1.42 15-Feb-2002  christos - add a real linux_sys___sysctl because the mib numbers are different.
implement only the kernel version getting entries.
- make the signal conversion functions consistent; dest is arg 1.
- make linux_fakedev deal with block and char devices differently.
- add linux_sys_ugetrlimit, and flesh out the regular get/setrlimit so
that they work properly.
- add linux_mmap2 [untested].
- bump kernel to 2.4.18, and make the date be valentine's day :-)
- linux_sys_*stat64 family was totally busted. Fix it.

tested only on i386.

Status:
gdb, telnet, work
jdk-1.4.0 extractor works, jdk still coredumps.

christos
 1.41 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.40 04-Jul-2001  jdolecek branches: 1.40.2;
Regen - modify to use linux_* wrappers for syscalls passing/fetching sockaddr
 1.39 30-May-2001  mrg use _KERNEL_OPT.
 1.38 30-Mar-2001  jdolecek regen - use linux_sys_nosys() instead sys_nosys()
 1.37 30-Mar-2001  jdolecek regen
 1.36 30-Mar-2001  jdolecek regen
 1.35 27-Jan-2001  thorpej branches: 1.35.2;
Regen; add sy_flags.
 1.34 29-Dec-2000  fvdl Regen.
 1.33 21-Dec-2000  thorpej Regen.
 1.32 14-Dec-2000  jdolecek regen
 1.31 14-Dec-2000  mycroft Regen.
 1.30 11-Dec-2000  mycroft Regen.
 1.29 11-Dec-2000  mycroft Regen.
 1.28 09-Dec-2000  jdolecek regen
 1.27 09-Dec-2000  mycroft Regen.
 1.26 02-Dec-2000  jdolecek regen after addition of linux_sys_swapoff()
 1.25 01-Dec-2000  jdolecek regen
 1.24 17-Nov-2000  erh Regen.
 1.23 08-Nov-2000  erh Update the names of some unimplemented syscalls to match what linux calls them. Match const in parameters to our sys_writev.
 1.22 01-Nov-2000  jdolecek regen
 1.21 18-Aug-2000  cgd update for changed makesyscalls.master
 1.20 18-Aug-2000  cgd update for new makesyscalls.sh, and also for correct ids for changed
syscalls.master files. (you need to regenerate after checking in
syscalls.master to get the correct ids.)
 1.19 20-Mar-2000  erh branches: 1.19.4;
Regen.
 1.18 18-Mar-2000  erh Regen.
 1.17 18-Mar-2000  erh Regen.
 1.16 18-Mar-2000  erh Regen.
 1.15 16-Dec-1999  tron Regen.
 1.14 05-Dec-1999  tron Regen.
 1.13 04-Oct-1999  tron branches: 1.13.2; 1.13.8;
Regen from "syscalls.master".
 1.12 14-May-1999  thorpej Regen.
 1.11 13-May-1999  thorpej Regen.
 1.10 30-Mar-1999  tron branches: 1.10.4;
Regen.
 1.9 27-Mar-1999  tron Regen.
 1.8 23-Mar-1999  thorpej Regen; pread(2) and pwrite(2).
 1.7 10-Dec-1998  christos Regen
 1.6 08-Dec-1998  erh Add mmap header.
 1.5 19-Oct-1998  tron Regen.
 1.4 07-Oct-1998  erh Regen.
 1.3 04-Oct-1998  fvdl Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.2 03-Oct-1998  christos Attempt to fix the mess.
 1.1 30-Sep-1998  erh Generate.
 1.10.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.13.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.13.2.7 21-Apr-2001  bouyer Sync with HEAD
 1.13.2.6 11-Feb-2001  bouyer Sync with HEAD.
 1.13.2.5 05-Jan-2001  bouyer Sync with HEAD
 1.13.2.4 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.13.2.3 08-Dec-2000  bouyer Sync with HEAD.
 1.13.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.13.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.19.4.2 01-May-2001  he Pull up regenerated files (requested by jdolecek):
Make it possible to use a different function for unimplemented
syscalls than sys_nosys(), so that the Linux emulation can avoid
posting SIGSYS and instead just return ENOSYS.
 1.19.4.1 30-Mar-2001  he Pull up regenerated files (requested by fvdl):
Add some required Linux emulation bits to support the Linux
version of VMware.
 1.35.2.9 29-May-2002  nathanw Regen.
 1.35.2.8 17-Apr-2002  nathanw Catch up to -current.
 1.35.2.7 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.35.2.6 28-Feb-2002  nathanw Catch up to -current.
 1.35.2.5 14-Nov-2001  nathanw Catch up to -current.
 1.35.2.4 30-Aug-2001  nathanw First cut at LWP and SA support on the alpha.
Doesn't break in ordinary multiuser mode; LWPs and SAs not yet tested.
 1.35.2.3 24-Aug-2001  nathanw Catch up with -current.
 1.35.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.35.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.40.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.40.2.2 16-Mar-2002  jdolecek Catch up with -current.
 1.40.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.48.4.2 08-Oct-2004  jmc Regen for ticket #884
 1.48.4.1 04-Oct-2004  jmc Regen
 1.48.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.48.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.48.2.4 19-Oct-2004  skrll Sync with HEAD
 1.48.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.48.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.48.2.1 03-Aug-2004  skrll Sync with HEAD
 1.53.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.53.4.1 29-Apr-2005  kent sync with -current
 1.57.2.5 21-Jan-2008  yamt sync with head
 1.57.2.4 07-Dec-2007  yamt sync with head
 1.57.2.3 26-Feb-2007  yamt sync with head.
 1.57.2.2 30-Dec-2006  yamt sync with head.
 1.57.2.1 21-Jun-2006  yamt sync with head.
 1.58.14.1 19-Jun-2006  chap Sync with head.
 1.58.8.2 03-Sep-2006  yamt sync with head.
 1.58.8.1 26-Jun-2006  yamt sync with head.
 1.58.4.1 09-Sep-2006  rpaulo sync with head
 1.61.2.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.62.26.2 27-Dec-2007  mjf Sync with HEAD.
 1.62.26.1 19-Nov-2007  mjf Sync with HEAD.
 1.62.24.1 18-Nov-2007  bouyer Sync with HEAD
 1.62.20.1 09-Jan-2008  matt sync with HEAD
 1.62.18.1 21-Nov-2007  joerg Sync with HEAD.
 1.63.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.63.2.1 26-Dec-2007  ad Sync with head.
 1.66.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.66.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.67.14.1 20-Nov-2008  snj Regen for ticket 81.
 1.67.12.1 19-Jan-2009  skrll Sync with HEAD.
 1.67.10.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.67.6.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.67.6.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.67.4.4 11-Aug-2010  yamt sync with head.
 1.67.4.3 11-Mar-2010  yamt sync with head
 1.67.4.2 20-Jun-2009  yamt sync with head
 1.67.4.1 04-May-2009  yamt sync with head.
 1.73.2.1 23-Jul-2009  jym Sync with HEAD.
 1.77.4.3 31-May-2011  rmind sync with head
 1.77.4.2 21-Apr-2011  rmind sync with head
 1.77.4.1 05-Mar-2011  rmind sync with head
 1.77.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.78.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.81.4.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.81.4.2 30-Oct-2012  yamt sync with head
 1.81.4.1 17-Apr-2012  yamt sync with head
 1.82.10.3 03-Dec-2017  jdolecek update from HEAD
 1.82.10.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.82.10.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.83.2.1 18-May-2014  rmind sync with head
 1.89.2.1 10-Aug-2014  tls Rebase.
 1.94.2.1 17-Apr-2017  snj regen for ticket 1354
 1.95.2.4 05-Feb-2017  skrll Sync with HEAD
 1.95.2.3 05-Oct-2016  skrll Sync with HEAD
 1.95.2.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.95.2.1 06-Apr-2015  skrll Sync with HEAD
 1.98.2.3 20-Mar-2017  pgoyette Sync with HEAD
 1.98.2.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.98.2.1 26-Jul-2016  pgoyette Sync with HEAD
 1.102.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.105.4.1 11-May-2017  pgoyette Sync with HEAD
 1.106.10.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.106.10.1 10-Jun-2019  christos Sync with HEAD
 1.106.8.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.110.2.2 17-Dec-2020  thorpej Regen for preadv(2) and pwritev(2).
 1.110.2.1 15-Dec-2020  thorpej Regen for eventfd, timerfd, POSIX timers.
 1.120.2.1 02-Aug-2025  perseant Sync with HEAD
 1.4 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.3 26-Aug-2001  manu branches: 1.3.118; 1.3.120; 1.3.122;
Moved LINUX_NCCS from MI file to MD file, because the value is different
on MIPS and sparc machines.
 1.2 20-Jan-2001  manu branches: 1.2.2; 1.2.4;
Moved architecure dependent part of struct linux_termio to architecture
dependent header files.
 1.1 30-Sep-1998  erh branches: 1.1.12;
New header files for Linux compat on the Alpha.
 1.1.12.1 11-Feb-2001  bouyer Sync with HEAD.
 1.2.4.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.2.2.1 21-Sep-2001  nathanw Catch up to -current.
 1.3.122.1 16-May-2008  yamt sync with head.
 1.3.120.1 18-May-2008  yamt sync with head.
 1.3.118.1 02-Jun-2008  mjf Sync with HEAD.
 1.9 01-Oct-2024  riastradh sys/compat/linux/arch: Nix trailing whitespace.

No functional change intended.
 1.8 12-Feb-2023  andvar branches: 1.8.6;
fix typo in the include guard definition.
 1.7 27-Dec-2013  njoly Add struct linux_stat64 definition for alpha, and enable syscalls that
use it.
 1.6 11-Jan-2009  christos branches: 1.6.14; 1.6.24; 1.6.28;
merge christos-time_t
 1.5 28-Apr-2008  martin branches: 1.5.8; 1.5.14;
Remove clause 3 and 4 from TNF licenses
 1.4 11-Dec-2005  christos branches: 1.4.70; 1.4.72; 1.4.74;
merge ktrace-lwp.
 1.3 20-Sep-2004  jdolecek move definition of linux_fsid_t to common/linux_types.h - it's identical
across all Linux archs
 1.2 19-Sep-2004  jdolecek move definition of struct linux_stafs to common/linux_types.h, and use
explicit size types - the structure definition is actually identical
on currently support COMPAT_LINUX archs, so no point to have 6 copies of it
in the tree
 1.1 30-Sep-1998  erh branches: 1.1.46;
New header files for Linux compat on the Alpha.
 1.1.46.1 24-Sep-2004  skrll Sync with HEAD.
 1.4.74.2 04-May-2009  yamt sync with head.
 1.4.74.1 16-May-2008  yamt sync with head.
 1.4.72.1 18-May-2008  yamt sync with head.
 1.4.70.2 17-Jan-2009  mjf Sync with HEAD.
 1.4.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.5.14.2 11-Jan-2009  christos add linux_suseconds_t
 1.5.14.1 28-Apr-2008  christos file linux_types.h was added on branch christos-time_t on 2009-01-11 00:17:51 +0000
 1.5.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.6.28.1 18-May-2014  rmind sync with head
 1.6.24.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.6.14.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.8.6.1 02-Aug-2025  perseant Sync with HEAD
 1.4 28-Jul-2023  christos add epoll syscalls
 1.3 30-Mar-2001  jdolecek Use linux_sys_nosys() instead sys_nosys() here too.
 1.2 14-Dec-2000  mycroft branches: 1.2.2;
Round up sysent[] table size.
 1.1 30-Sep-1998  erh branches: 1.1.12; 1.1.22;
Initial support for linux compat on the alpha. Not quite working.
 1.1.22.1 01-May-2001  he Pull up revision 1.3 (via patch, requested by jdolecek):
Make it possible to use a different function for unimplemented
syscalls than sys_nosys(), so that the Linux emulation can avoid
posting SIGSYS and instead just return ENOSYS.
 1.1.12.2 21-Apr-2001  bouyer Sync with HEAD
 1.1.12.1 05-Jan-2001  bouyer Sync with HEAD
 1.2.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.110 26-Oct-2025  christos PR/59722: Ricardo Branco: linux: Add support for semtimedop(2)
 1.109 28-Sep-2024  christos Linux GSoC-2024: renameat2, clone3, sync_file_range, syncfs (Shivraj Jamgade)
 1.108 01-Jul-2024  christos Add linux POSIX message queue support (Ricardo Branco)
 1.107 29-Jun-2024  christos branches: 1.107.2;
From gsoc 2024: Implement faccessat2 and getcpu (Shivraz)
 1.106 19-Aug-2023  christos Add inotify* syscalls GSoC 2023 (Theodore Preduta)
 1.105 18-Aug-2023  christos Add linux waitid(2) from GSoC 2023 (Theodore Preduta)
 1.104 29-Jul-2023  christos Add/fix statx, readahead, close_range. From GSoC 2023 by Theodore Preduta
 1.103 28-Jul-2023  christos add epoll syscalls
 1.102 02-Dec-2021  ryo add prlimit64(2) syscall to COMPAT_LINUX and COMPAT_LINUX32
 1.101 20-Sep-2021  thorpej Add preadv(2) and pwritev(2) system calls to COMPAT_LINUX and COMPAT_LINUX32.
 1.100 20-Sep-2021  thorpej Add the eventfd system calls to COMPAT_LINUX and COMPAT_LINUX32.
 1.99 19-Sep-2021  thorpej Add the timerfd syscalls to COMPAT_LINUX and COMPAT_LINUX32.
 1.98 19-Sep-2021  thorpej Add the POSIX timer syscalls (timer_create(), timer_settime(), timer_gettime(),
timer_getoverrun(), and timer_delete()) to COMPAT_LINUX and COMPAT_LINUX32.
 1.97 26-Apr-2020  thorpej branches: 1.97.2;
Add a NetBSD native futex implementation, mostly written by riastradh@.
Map the COMPAT_LINUX futex calls to the native ones.
 1.96 09-Nov-2019  jdolecek add dummy implementation of linux fallocate() which just returns EOPNOTSUPP;
this is needed so that glibc falls back to emulation and apps behaving
properly, since EOPNOTSUPP is a documented and expected return code, but
ENOSYS is not

right now there are no filesystems in NetBSD tree supporting the fallocate
VOP, so no point trying to map this to a native call

supposed to help with problem reported in
https://mail-index.netbsd.org/tech-kern/2019/11/03/msg025641.html
 1.95 24-Mar-2019  maxv Remove Alpha's compat_linux dependency on compat_osf1. Each function is
copied as-is from compat_osf1 with no functional change. Discussed on
tech-kern@, ok @thorpej.
 1.94 03-Feb-2017  christos branches: 1.94.14;
add send/recv mmsg and comment on the unimpl ones.
 1.93 03-Feb-2017  martin Add accept4 definitions
 1.92 02-Jan-2017  manu branches: 1.92.2;
Add pselect6 Linux system call.
This lets Matlab R2016A run on NetBSD/amd64
 1.91 24-Jul-2016  njoly Small cleanup. Adjust readlink/readlinkat signatures to reduce diffs with
native.
 1.90 25-Oct-2015  njoly branches: 1.90.2;
Cleanup posix chown family syscalls to match native (alpha, mips and
powerpc).
 1.89 22-Nov-2014  njoly branches: 1.89.2;
Fix ppoll signature (int ->u_int)
 1.88 29-May-2014  njoly branches: 1.88.2;
For utimes(2), use compat_50_sys_utimes() instead of local version.
 1.87 17-May-2014  njoly Fix fadvise64 syscalls to use 64bit offset types.
 1.86 06-May-2014  njoly Reduce diffs between archs; make mknod device argument unsigned.
 1.85 04-May-2014  njoly Fix pread/pwrite syscalls which need a 64bit offset argument.
 1.84 08-Apr-2014  njoly Adjust read/write/readv/writev signature to match native versions.
 1.83 13-Jan-2014  njoly branches: 1.83.2;
Cleanup, and reduce diffs between arches. Make alpha use
linux_sys_{get,set}timeofday like others.
 1.82 27-Dec-2013  njoly Add struct linux_stat64 definition for alpha, and enable syscalls that
use it.
 1.81 08-Dec-2013  njoly Sprinkle a few more linux_umode_t where appropriate.
Reduce diffs between archs.
 1.80 19-Nov-2013  chs add the *at() syscalls.
 1.79 24-Sep-2013  njoly Add utimensat(2) for compat linux.
 1.78 15-Sep-2013  njoly Make alpha use linux_sys_utimes() just like other archs.
 1.77 19-Sep-2012  pooka branches: 1.77.2;
emulate ppoll which is essentially our pollts
 1.76 18-Nov-2011  christos branches: 1.76.10;
add sigtimedwait
 1.75 09-Jul-2011  christos branches: 1.75.2;
the first argument of {g,s}etitimer() is int not u_int.
 1.74 30-May-2011  alnsn Add fadvise64 and fadvise64_64 syscalls to compat_linux and compat_linux32.
 1.73 15-Apr-2011  he Add dup3() and pipe2() for these archs as well.
 1.72 07-Jul-2010  chs branches: 1.72.2;
many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
- support new-style (NPTL) linux pthreads on all platforms.
clone() with CLONE_THREAD uses 1 process with many LWPs
instead of separate processes.
- move the contents of sys__lwp_setprivate() into a new
lwp_setprivate() and use that everywhere.
- update linux_release[] and linux32_release[] to "2.6.18".
- adjust placement of emul fork/exec/exit hooks as needed
and adjust other emul code to match.
- convert all struct emul definitions to use named initializers.
- change the pid allocator to allow multiple pids to refer to the same proc.
- remove a few fields from struct proc that are no longer needed.
- disable the non-functional "vdso" code in linux32/amd64,
glibc works fine without it.
- fix a race in the futex code where we could miss a wakeup after
a requeue operation.
- redo futex locking to be a little more efficient.
 1.71 24-Nov-2009  njoly branches: 1.71.2; 1.71.4;
Update personality(2) to match Linux definition where the argument is an
unsigned long.
 1.70 17-Jun-2009  njoly Add a new linux_msghdr structure, as its size differs on 64bit archs.
Do the needed conversions in sendmsg/recvmsg syscalls, and adjust
their definitions accordingly.
 1.69 08-Jun-2009  njoly Update rt_queueinfo(2) definition, and kill a corresponding comment.
 1.68 17-Jan-2009  njoly branches: 1.68.2;
Convert linux/linux32 wait(4) to use a compat50 rusage structure.
 1.67 15-Jan-2009  njoly Update some syscalls/arguments to use the new compat50 equivalents.
 1.66 13-Jan-2009  pooka Convert the syscalls.master to a format from which it is easier
to parse and generate the compat name and basename (e.g. __stat50
and stat). Use this to autogenerate __RENAME()'s to the rump_syscalls
header so that they can be called e.g. rump_sys_socket() instead
of rump_sys___socket30().
 1.65 13-Jan-2009  pooka Somehow i doubt linux_sys_recvmsg() returns size_t. Make it ssize_t.
(XXX: the actual implementation returns int)
 1.64 19-Nov-2008  ad Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.63 12-Nov-2008  njoly Fix nanosleep(2) on 64-bit archs. Do not call native nanosleep
syscall, but rather a modified version the will take care of `struct
timespec' conversions.
 1.62 04-Apr-2008  njoly branches: 1.62.4; 1.62.6; 1.62.10; 1.62.12; 1.62.14;
Cleanup. Kill linux_sys_msync and use sys___msync13 instead.
No functional changes expected.
 1.61 24-Dec-2007  njoly branches: 1.61.6;
Kill unneeded linux_sys_getpgid and use native sys_getpgid instead.
 1.60 21-Dec-2007  njoly - Fix setfsuid to return uid on success.
- Replace getfsuid, which never existed on Linux, by correct setfsgid
syscall.

ok by christos and dsl.
 1.59 20-Dec-2007  dsl Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.58 16-Nov-2007  njoly branches: 1.58.2; 1.58.6;
Cleanup. Remove a few linux syscalls definitions, now identical to
native ones (with stackgap and ALT_CHECK_xxx removal). No functional
changes expected.
 1.57 04-Mar-2007  christos branches: 1.57.14; 1.57.16; 1.57.20; 1.57.22;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.56 09-Feb-2007  ad branches: 1.56.2;
Merge newlock2 to head.
 1.55 01-Sep-2006  matt branches: 1.55.2;
Don't conditionalize *sys_ptrace. The lack of sys_ptrace will be dealt
with differently.
 1.54 30-Aug-2006  matt Update to deal with options PTRACE
 1.53 10-Jun-2006  christos linux getpriority is off-by-20 so use our own function.
From PR/33671: Nicolas Joly
 1.52 11-Dec-2005  christos branches: 1.52.4; 1.52.8; 1.52.14;
merge ktrace-lwp.
 1.51 16-May-2005  fvdl branches: 1.51.2;
Add clock_* POSIX functions.
 1.50 16-May-2005  fvdl Add *xattr functions (they all return EOPNOTSUPP).
 1.49 26-Feb-2005  perry nuke trailing whitespace
 1.48 05-Oct-2004  jdolecek branches: 1.48.4; 1.48.6;
mark linux_sys_shmget() STD, so that appropriate struct linux_sys_shmget_args
would be defined for use by alpha linux_sysent.c
 1.47 28-Sep-2004  jdolecek add flag for shmget(2) to specify that later shmat(2) for the shared memory
segment should succeed even if the segment would be marked removed; use this
to implement the Linux-compatible semantics of shmat(2)

this fixes the old Linux VMware3 graphics problem with local display,
and possibly other local Linux X clients using MIT-SHM
 1.46 08-Sep-2004  jdolecek implement basic exit_group(2), which just terminates calling thread;
apparently not many apps use thread groups yet, at least not with default
SuSE 9.1 libraries, so this is enough for now
 1.45 01-Aug-2004  jdolecek add entries for #403, #404 (unused)
 1.44 01-Aug-2004  jdolecek sync the syscall lists with Linux kernel 2.6.7
 1.43 01-Aug-2004  jdolecek connect madvise(2) and mincore(2) - apparently the newer Linux libs
don't stub it anymore, so allow the application to take advantage
of them

the Linux calls appear to be compatible in the flag values and semantics,
so a wrapper is not necessary
 1.42 18-Jan-2003  thorpej branches: 1.42.2; 1.42.4;
Merge the nathanw_sa branch.
 1.41 10-Apr-2002  christos add getdents64
 1.40 22-Mar-2002  christos nuke mmap2, add mprotect
 1.39 18-Feb-2002  christos provide linux_sys_getrlimit and linux_sys_setrlimit
 1.38 18-Feb-2002  christos fix comment.
 1.37 15-Feb-2002  christos - add a real linux_sys___sysctl because the mib numbers are different.
implement only the kernel version getting entries.
- make the signal conversion functions consistent; dest is arg 1.
- make linux_fakedev deal with block and char devices differently.
- add linux_sys_ugetrlimit, and flesh out the regular get/setrlimit so
that they work properly.
- add linux_mmap2 [untested].
- bump kernel to 2.4.18, and make the date be valentine's day :-)
- linux_sys_*stat64 family was totally busted. Fix it.

tested only on i386.

Status:
gdb, telnet, work
jdk-1.4.0 extractor works, jdk still coredumps.

christos
 1.36 08-Sep-2001  manu Removed a hack to make PowerPC mmap work. This could have side effects on
alpha and i386. It has been tested and works on i386.
 1.35 04-Jul-2001  jdolecek branches: 1.35.2; 1.35.4;
modify to use linux_* wrappers for syscalls passing/fetching sockaddr
 1.34 30-May-2001  mrg use _KERNEL_OPT.
 1.33 30-Mar-2001  jdolecek Add new syscalls from Linux 2.4.3 to the lists. Not implemented ATM.
 1.32 30-Mar-2001  jdolecek Implement linux_sys_nosys() and use it instead of sys_nosys() for
unimplemented syscalls. Difference is that linux_sys_nosys() doesn't
post SIGSYS to the process. Linux doesn't do that and thus glibc (and
probably other Linux code) doesn't deal with SIGSYS, even through it
generally contains fallback code for ENOSYS case.

This also addresses port-i386/12503, though the issue was already discussed
earlier.
 1.31 29-Dec-2000  fvdl branches: 1.31.2;
Don't pass through link(2) directly, as we need to do altpath checks.
 1.30 21-Dec-2000  thorpej Make an Alpha kernel with COMPAT_LINUX compile again.
 1.29 14-Dec-2000  jdolecek add sysinfo()
 1.28 11-Dec-2000  mycroft getuid -> getuid_with_euid
getgid -> getgid_with_egid
 1.27 11-Dec-2000  mycroft getpid -> getpid_with_ppid
 1.26 09-Dec-2000  jdolecek add more unimplemented syscalls to list
 1.25 09-Dec-2000  mycroft Add the %% separators.
 1.24 02-Dec-2000  jdolecek add emulation of linux swapoff(2)
 1.23 01-Dec-2000  jdolecek replace compat_09_sys_setdomainname() with linux_sys_setdomainname(),
compat_12_sys_swapon() with linux_sys_swapon() - this is to drop dependency
on COMPAT_12/COMPAT_09
 1.22 17-Nov-2000  erh Make the linux compatibilty code work on the alpha. (horay!) (at last!)
Two main changes:
Create a linux_elf64_copyargs that uses the linux specific LinuxAuxInfo
structure. This is only used on the alpha. i386 and m68k use the
standard elf copyargs function.

Since linux's approach to binary compatibilty is to look as much
like osf1 as possible, add all the osf1 syscalls that we have
implemented to the linux syscall table. This includes get/setsysinfo,
ported from FreeBSD.

In order for linux compat to work you must have COMPAT_OSF1, COMPAT_43,
COMPAT_09, COMPAT_12 and COMPAT_13 on also.
 1.21 08-Nov-2000  erh Update the names of some unimplemented syscalls to match what linux calls them. Match const in parameters to our sys_writev.
 1.20 01-Nov-2000  jdolecek support mlockall(), munlockall() - they are same as respective NetBSD syscalls
 1.19 20-Mar-2000  erh branches: 1.19.4;
sys_clone isn't MD on linux.
 1.18 18-Mar-2000  erh Fix the msgrcv prototype.
 1.17 18-Mar-2000  erh Use the new linux_sys_reboot and linux_sys_connect.
 1.16 18-Mar-2000  erh resync NOARGS lines with their definitions in kern/syscalls.master. resync STD lines with what is expected in .c files. (especially wrt adding const). Add missing prototype for setfsuid. Fix ptrace prototype.
 1.15 16-Dec-1999  tron Add ptrace(2).
 1.14 05-Dec-1999  tron Fix incorrect system call number.
 1.13 05-Dec-1999  tron Add proper stub code to make emulation of Linux's pread(2) and pwrite(2)
work. Fixes PR kern/8945 by Dave Sainty.
 1.12 04-Oct-1999  tron branches: 1.12.2; 1.12.8;
Add emulation for scheduler related syscalls. Although they are dummies
even under Linux the posix thread library for "glibc2" requires them.
 1.11 14-May-1999  thorpej Emulate the Linux vfork(2) (which is like OSF/1 vfork(2) and NetBSD's
__vfork14(2)) and {get,set}resuid(2). Linux does not have {get,set}resgid(2)
on their Alpha port!
 1.10 13-May-1999  thorpej Emulate the Linux clone(2) system call.
 1.9 30-Mar-1999  tron branches: 1.9.4;
Add poll() emulation.
 1.8 27-Mar-1999  tron Add emulation for Linux "getcwd" syscall.
 1.7 23-Mar-1999  thorpej Add support for emulating the Linux pread(2) and pwrite(2) system calls;
just call the native NetBSD versions.

PR #7202, Jaromir Dolecek <dolecek@ics.muni.cz>.
 1.6 10-Dec-1998  christos defopt COMPAT_43
 1.5 08-Dec-1998  erh Add mmap header.
 1.4 19-Oct-1998  tron Defopt SYSVMSG, SYSVSEM and SYSVSHM.
 1.3 07-Oct-1998  erh Change sys_mmap to NOARGS. (args defined in linux_sys_mmap.h). Typo: siginfo_t->linux_siginfo_t.
 1.2 03-Oct-1998  christos Attempt to fix the mess.
 1.1 30-Sep-1998  erh Initial support for linux compat on the alpha. Not quite working.
 1.9.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.12.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.12.2.6 21-Apr-2001  bouyer Sync with HEAD
 1.12.2.5 05-Jan-2001  bouyer Sync with HEAD
 1.12.2.4 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.12.2.3 08-Dec-2000  bouyer Sync with HEAD.
 1.12.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.12.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.19.4.2 01-May-2001  he Pull up revision 1.32 (requested by jdolecek):
Make it possible to use a different function for unimplemented
syscalls than sys_nosys(), so that the Linux emulation can avoid
posting SIGSYS and instead just return ENOSYS.
 1.19.4.1 30-Mar-2001  he Pull up revision 1.31 (requested by fvdl):
Add some required Linux emulation bits to support the Linux
version of VMware.
 1.31.2.8 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.31.2.7 17-Apr-2002  nathanw Catch up to -current.
 1.31.2.6 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.31.2.5 28-Feb-2002  nathanw Catch up to -current.
 1.31.2.4 21-Sep-2001  nathanw Catch up to -current.
 1.31.2.3 24-Aug-2001  nathanw Catch up with -current.
 1.31.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.31.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.35.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.35.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.35.2.2 16-Mar-2002  jdolecek Catch up with -current.
 1.35.2.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.42.4.2 08-Oct-2004  jmc Pullup rev 1.48 (requested by jdolecek in ticket #884)

Mmark linux_sys_shmget() STD, so that appropriate struct linux_sys_shmget_args
would be defined for use by alpha linux_sysent.c
 1.42.4.1 04-Oct-2004  jmc Pullup rev 1.47 (requested by jdolecek in ticket #884)

Fix linux handling of SysV-style shared memory. Fixed Linux VMware display
problems.
 1.42.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.42.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.42.2.4 19-Oct-2004  skrll Sync with HEAD
 1.42.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.42.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.42.2.1 03-Aug-2004  skrll Sync with HEAD
 1.48.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.48.4.1 29-Apr-2005  kent sync with -current
 1.51.2.5 21-Jan-2008  yamt sync with head
 1.51.2.4 07-Dec-2007  yamt sync with head
 1.51.2.3 03-Sep-2007  yamt sync with head.
 1.51.2.2 26-Feb-2007  yamt sync with head.
 1.51.2.1 21-Jun-2006  yamt sync with head.
 1.52.14.1 19-Jun-2006  chap Sync with head.
 1.52.8.1 26-Jun-2006  yamt sync with head.
 1.52.4.1 09-Sep-2006  rpaulo sync with head
 1.55.2.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.56.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.57.22.2 27-Dec-2007  mjf Sync with HEAD.
 1.57.22.1 19-Nov-2007  mjf Sync with HEAD.
 1.57.20.1 18-Nov-2007  bouyer Sync with HEAD
 1.57.16.1 09-Jan-2008  matt sync with HEAD
 1.57.14.1 21-Nov-2007  joerg Sync with HEAD.
 1.58.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.58.2.1 26-Dec-2007  ad Sync with head.
 1.61.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.61.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.62.14.1 20-Nov-2008  snj Pull up following revision(s) (requested by njoly in ticket #81):
sys/compat/linux/arch/mips/syscalls.master: revision 1.30
sys/compat/linux/arch/m68k/syscalls.master: revision 1.63
sys/compat/linux32/arch/amd64/syscalls.master: revision 1.39
sys/compat/linux/arch/alpha/syscalls.master: revision 1.63
sys/compat/linux/arch/powerpc/syscalls.master: revision 1.38
sys/compat/linux32/common/linux32_time.c: revision 1.22
sys/compat/linux/arch/amd64/syscalls.master: revision 1.25
sys/compat/linux/arch/i386/syscalls.master: revision 1.94
sys/compat/linux/arch/arm/syscalls.master: revision 1.36
sys/compat/linux/common/linux_time.c: revision 1.26
Fix nanosleep(2) on 64-bit archs. Do not call native nanosleep
syscall, but rather a modified version the will take care of `struct
timespec' conversions.
 1.62.12.1 19-Jan-2009  skrll Sync with HEAD.
 1.62.10.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.62.6.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.62.6.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.62.4.4 11-Aug-2010  yamt sync with head.
 1.62.4.3 11-Mar-2010  yamt sync with head
 1.62.4.2 20-Jun-2009  yamt sync with head
 1.62.4.1 04-May-2009  yamt sync with head.
 1.68.2.1 23-Jul-2009  jym Sync with HEAD.
 1.71.4.3 31-May-2011  rmind sync with head
 1.71.4.2 21-Apr-2011  rmind sync with head
 1.71.4.1 05-Mar-2011  rmind sync with head
 1.71.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.72.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.75.2.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.75.2.2 30-Oct-2012  yamt sync with head
 1.75.2.1 17-Apr-2012  yamt sync with head
 1.76.10.3 03-Dec-2017  jdolecek update from HEAD
 1.76.10.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.76.10.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.77.2.1 18-May-2014  rmind sync with head
 1.83.2.1 10-Aug-2014  tls Rebase.
 1.88.2.1 17-Apr-2017  snj Pull up following revision(s) (requested by manu in ticket #1354):
sys/compat/linux/arch/alpha/syscalls.master: revision 1.92 via patch
sys/compat/linux/arch/amd64/syscalls.master: revision 1.58 via patch
sys/compat/linux/arch/arm/syscalls.master: revision 1.65 via patch
sys/compat/linux/arch/i386/syscalls.master: revision 1.122 via patch
sys/compat/linux/arch/m68k/syscalls.master: revision 1.91 via patch
sys/compat/linux/arch/mips/syscalls.master: revision 1.61 via patch
sys/compat/linux/arch/powerpc/syscalls.master: revision 1.70 via patch
sys/compat/linux/common/linux_misc.c: revision 1.234
sys/compat/linux/common/linux_signal.h: revision 1.31
Add pselect6 Linux system call.
This lets Matlab R2016A run on NetBSD/amd64
 1.89.2.3 05-Feb-2017  skrll Sync with HEAD
 1.89.2.2 05-Oct-2016  skrll Sync with HEAD
 1.89.2.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.90.2.3 20-Mar-2017  pgoyette Sync with HEAD
 1.90.2.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.90.2.1 26-Jul-2016  pgoyette Sync with HEAD
 1.92.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.94.14.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.94.14.1 10-Jun-2019  christos Sync with HEAD
 1.97.2.2 17-Dec-2020  thorpej Add suppport for Linux preadv(2) and pwritev(2). Same as native, except
for the silly way that the offset argument is passed in.
 1.97.2.1 15-Dec-2020  thorpej Add Linux eventfd, timerfd, and POSIX timer calls.
 1.107.2.1 02-Aug-2025  perseant Sync with HEAD
 1.5 01-Oct-2024  riastradh sys/compat/linux/arch: Nix trailing whitespace.

No functional change intended.
 1.4 29-May-2024  christos branches: 1.4.2;
should not be using .include <> but .include "" here.
 1.3 08-Apr-2014  njoly Do not include bsd.kinc.mk in each arch Makefile, it's already pulled
by bsd.syscall.mk (from Makefile.inc).
 1.2 11-Dec-2005  christos branches: 1.2.110; 1.2.120; 1.2.126; 1.2.136;
merge ktrace-lwp.
 1.1 03-May-2005  manu branches: 1.1.8;
First work on COMPAT_LINUX/amd64
Process startup and dynamiclinking work, but processes hang due to
Linux arch_prctl(2) not being really supported yet.
 1.1.8.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.8.1 03-May-2005  skrll file Makefile was added on branch ktrace-lwp on 2005-11-10 14:00:59 +0000
 1.2.136.1 10-Aug-2014  tls Rebase.
 1.2.126.1 18-May-2014  rmind sync with head
 1.2.120.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.110.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.4.2.1 02-Aug-2025  perseant Sync with HEAD
 1.4 23-Feb-2009  rmind Switch Linux futex emulation to native ucas_int(), remove unecessary
futex-specific assembler routines.

Fixes PR/40490. Reviewed by <ad>.
 1.3 26-Oct-2008  christos branches: 1.3.2; 1.3.4; 1.3.8;
catch up with i386 changes.
 1.2 11-Dec-2005  christos branches: 1.2.70; 1.2.80;
merge ktrace-lwp.
 1.1 03-May-2005  manu branches: 1.1.8;
First work on COMPAT_LINUX/amd64
Process startup and dynamiclinking work, but processes hang due to
Linux arch_prctl(2) not being really supported yet.
 1.1.8.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.8.1 03-May-2005  skrll file files.linux_amd64 was added on branch ktrace-lwp on 2005-11-10 14:00:59 +0000
 1.2.80.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.2.70.1 17-Jan-2009  mjf Sync with HEAD.
 1.3.8.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.3.4.1 26-Feb-2009  snj Pull up following revision(s) (requested by rmind in ticket #493):
sys/compat/linux/arch/amd64/files.linux_amd64: revision 1.4
sys/compat/linux/arch/amd64/linux_support.S: file removal
sys/compat/linux/common/linux_futex.c: revision 1.23
sys/compat/linux/arch/i386/linux_support.S: file removal
sys/compat/linux/arch/i386/files.linux_i386: revision 1.10
Switch Linux futex emulation to native ucas_int(), remove unecessary
futex-specific assembler routines.
Fixes PR/40490. Reviewed by <ad>.
 1.3.2.1 03-Mar-2009  skrll Sync with HEAD.
 1.13 12-Oct-2021  andvar fix various typos, mainly in comments.
 1.12 03-May-2020  thorpej Always clear FUTEX_PRIVATE_FLAG for Linux processes. NetBSD-native futexes
exist in different namespace depending on FUTEX_PRIVATE_FLAG. This appears
not to be the case in Linux, and some futex users will mix private and non-
private ops on the same futex object. Provide a convenience wrapper that
puts this logic in one place witn a comment explaining why.

While here, move the Linux futex wrapper out of its own file and plop
it in linux_misc.c, which is where it lives in the linux32 module.
 1.11 30-May-2011  alnsn Add fadvise64 and fadvise64_64 syscalls to compat_linux and compat_linux32.
 1.10 02-Mar-2010  pooka branches: 1.10.2; 1.10.4;
Nuke fs_lfs.h included for unknown reasons (if there was a reason
other than "accident", i hereby declare that reason invalid)
 1.9 19-Nov-2008  ad branches: 1.9.6;
Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.8 17-Oct-2008  njoly branches: 1.8.2;
Remove unneeded linux_sigaction.c
 1.7 15-Aug-2007  ad branches: 1.7.22; 1.7.26; 1.7.28; 1.7.32;
Changes to make ktrace LKM friendly and reduce ifdef KTRACE. Proposed
on tech-kern.
 1.6 09-Feb-2007  ad branches: 1.6.6; 1.6.14; 1.6.18;
Merge newlock2 to head.
 1.5 09-Feb-2006  manu branches: 1.5.14;
Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.4 11-Dec-2005  christos branches: 1.4.2; 1.4.4; 1.4.6;
merge ktrace-lwp.
 1.3 04-Nov-2005  manu branches: 1.3.2;
Implement Linux futex and gettid system calls for amd64
 1.2 31-Oct-2005  manu build fix
 1.1 03-May-2005  manu branches: 1.1.2; 1.1.4;
First work on COMPAT_LINUX/amd64
Process startup and dynamiclinking work, but processes hang due to
Linux arch_prctl(2) not being really supported yet.
 1.1.4.1 02-Nov-2005  yamt sync with head.
 1.1.2.3 03-Sep-2007  yamt sync with head.
 1.1.2.2 26-Feb-2007  yamt sync with head.
 1.1.2.1 21-Jun-2006  yamt sync with head.
 1.3.2.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.3.2.1 04-Nov-2005  skrll file linux_commons.c was added on branch ktrace-lwp on 2005-11-10 14:00:59 +0000
 1.4.6.1 22-Apr-2006  simonb Sync with head.
 1.4.4.1 09-Sep-2006  rpaulo sync with head
 1.4.2.1 18-Feb-2006  yamt sync with head.
 1.5.14.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.6.18.1 16-Aug-2007  jmcneill Sync with HEAD.
 1.6.14.1 03-Sep-2007  skrll Sync with HEAD.
 1.6.6.1 20-Aug-2007  ad Sync with HEAD.
 1.7.32.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.7.32.1 19-Oct-2008  haad Sync with HEAD.
 1.7.28.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.7.28.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.7.26.2 11-Mar-2010  yamt sync with head
 1.7.26.1 04-May-2009  yamt sync with head.
 1.7.22.1 17-Jan-2009  mjf Sync with HEAD.
 1.8.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.9.6.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.10.4.1 06-Jun-2011  jruoho Sync with HEAD.
 1.10.2.1 31-May-2011  rmind sync with head
 1.4 01-Oct-2024  riastradh sys/compat/linux/arch: Nix trailing whitespace.

No functional change intended.
 1.3 17-Dec-2013  njoly branches: 1.3.66;
Cleanup compat linux errnos by adding generic errnos in a single file.
Use it for all arches except alpha and mips.
Add a few missing native to linux errno conversions.
 1.2 11-Dec-2005  christos branches: 1.2.110; 1.2.120; 1.2.126;
merge ktrace-lwp.
 1.1 03-May-2005  manu branches: 1.1.8;
First work on COMPAT_LINUX/amd64
Process startup and dynamiclinking work, but processes hang due to
Linux arch_prctl(2) not being really supported yet.
 1.1.8.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.8.1 03-May-2005  skrll file linux_errno.h was added on branch ktrace-lwp on 2005-11-10 14:00:59 +0000
 1.2.126.1 18-May-2014  rmind sync with head
 1.2.120.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.110.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.3.66.1 02-Aug-2025  perseant Sync with HEAD
 1.7 01-Oct-2024  riastradh sys/compat/linux/arch: Nix trailing whitespace.

No functional change intended.
 1.6 26-Nov-2021  ryo branches: 1.6.10;
- LINUX_GO_RT0_SIGNATURE for compat_linux is no longer enabled by default.
it is now defined in each arch same as the other *_SIGNATURE definitions.
- add new LINUX32_GO_RT0_SIGNATURE for compat_linux32, and is defined in amd64 and aarch64.
 1.5 18-Nov-2013  chs implement AT_RANDOM.
 1.4 07-Aug-2006  manu branches: 1.4.94; 1.4.104; 1.4.110;
Add a new signature test for linux probe function. We look for a .debuglink
section, which is specific to the Linux dynamic interpeter (yes, Linux
can execute it as a stand alone program)
 1.3 16-Dec-2005  christos branches: 1.3.4; 1.3.8;
PR/32303: Nicolas Joly: Fix -current amd64 kernel compilation failure with
options COMPAT_LINUX
 1.2 11-Dec-2005  christos merge ktrace-lwp.
 1.1 03-May-2005  manu branches: 1.1.2; 1.1.8;
First work on COMPAT_LINUX/amd64
Process startup and dynamiclinking work, but processes hang due to
Linux arch_prctl(2) not being really supported yet.
 1.1.8.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.8.1 03-May-2005  skrll file linux_exec.h was added on branch ktrace-lwp on 2005-11-10 14:00:59 +0000
 1.1.2.2 30-Dec-2006  yamt sync with head.
 1.1.2.1 21-Jun-2006  yamt sync with head.
 1.3.8.1 11-Aug-2006  yamt sync with head
 1.3.4.1 09-Sep-2006  rpaulo sync with head
 1.4.110.1 18-May-2014  rmind sync with head
 1.4.104.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.4.94.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.6.10.1 02-Aug-2025  perseant Sync with HEAD
 1.25 01-Oct-2024  riastradh sys/compat/linux/arch: Nix trailing whitespace.

No functional change intended.
 1.24 05-Sep-2020  riastradh branches: 1.24.26;
Round of uvm.h cleanup.

The poorly named uvm.h is generally supposed to be for uvm-internal
users only.

- Narrow it to files that actually need it -- mostly files that need
to query whether curlwp is the pagedaemon, which should maybe be
exposed by an external header.

- Use uvm_extern.h where feasible and uvm_*.h for things not exposed
by it. We should split up uvm_extern.h but this will serve for now
to reduce the uvm.h dependencies.

- Use uvm_stat.h and #ifdef UVMHIST uvm.h for files that use
UVMHIST(ubchist), since ubchist is declared in uvm.h but the
reference evaporates if UVMHIST is not defined, so we reduce header
file dependencies.

- Make uvm_device.h and uvm_swap.h independently includable while
here.

ok chs@
 1.23 12-Jan-2020  ad Tidy up the vnode locking around execve() on ELF images to acquire and
release the locks fewer times. Proposed on tech-kern a very long time go.
 1.22 23-Feb-2014  njoly branches: 1.22.30; 1.22.36;
Use cprng_strong32 for LINUX_AT_RANDOM on amd64 too.
 1.21 21-Feb-2014  maxv Increase LINUX32_ELF_AUX_ENTRIES to avoid overrun in linux32/. Also,
add comments and KASSERTs to make sure people don't forget to increase
XX_AUX_ENTRIES's when adding vectors.

Reported by martin@ (CV), with suggestions from chs@.

ok martin@ chs@
 1.20 18-Nov-2013  chs implement AT_RANDOM.
 1.19 03-Feb-2012  matt branches: 1.19.6; 1.19.10;
Add a hook for freeing an ep_emul_arg. Add a wrapper routine
(exec_free_emul_arg) to call the hook and then clear the ep_emul_arg
and ep_emul_arg_free members in the exec_package.
Change users/accessors to use these routines.
Approved by releng.
 1.18 07-Jul-2010  chs branches: 1.18.8; 1.18.12;
many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
- support new-style (NPTL) linux pthreads on all platforms.
clone() with CLONE_THREAD uses 1 process with many LWPs
instead of separate processes.
- move the contents of sys__lwp_setprivate() into a new
lwp_setprivate() and use that everywhere.
- update linux_release[] and linux32_release[] to "2.6.18".
- adjust placement of emul fork/exec/exit hooks as needed
and adjust other emul code to match.
- convert all struct emul definitions to use named initializers.
- change the pid allocator to allow multiple pids to refer to the same proc.
- remove a few fields from struct proc that are no longer needed.
- disable the non-functional "vdso" code in linux32/amd64,
glibc works fine without it.
- fix a race in the futex code where we could miss a wakeup after
a requeue operation.
- redo futex locking to be a little more efficient.
 1.17 09-Feb-2010  njoly branches: 1.17.2;
Small typo in comment.
 1.16 29-Mar-2009  mrg branches: 1.16.2;
- add new RLIMIT_AS (aka RLIMIT_VMEM) resource that limits the total
address space available to processes. this limit exists in most other
modern unix variants, and like most of them, our defaults are unlimited.
remove the old mmap / rlimit.datasize hack.

- adds the VMCMD_STACK flag to all the stack-creation vmcmd callers.
it is currently unused, but was added a few years ago.

- add a pair of new process size values to kinfo_proc2{}. one is the
total size of the process memory map, and the other is the total size
adjusted for unused stack space (since most processes have a lot of
this...)

- patch sh, and csh to notice RLIMIT_AS. (in some cases, the alias
RLIMIT_VMEM was already present and used if availble.)

- patch ps, top and systat to notice the new k_vm_vsize member of
kinfo_proc2{}.

- update irix, svr4, svr4_32, linux and osf1 emulations to support
this information. (freebsd could be done, but that it's best left
as part of the full-update of compat/freebsd.)


this addresses PR 7897. it also gives correct memory usage values,
which have never been entirely correct (since mmap), and have been
very incorrect since jemalloc() was enabled.

tested on i386 and sparc64, build tested on several other platforms.

thanks to many folks for feedback and testing but most espcially
chuq and yamt for critical suggestions that lead to this patch not
having a special ugliness i wasn't happy with anyway :-)
 1.15 15-Mar-2009  cegger ansify function definitions
 1.14 20-Nov-2008  ad branches: 1.14.4;
PR port-amd64/39964 modules/compat_linux: missing symbols on amd64
 1.13 28-Oct-2008  christos branches: 1.13.2;
populate init_thread_area.
 1.12 26-Oct-2008  christos branches: 1.12.2;
fix include order; machdep needs to be first for LINUX_NPTL to be defined.
 1.11 25-Oct-2008  christos Add preliminary tls support for i386. Does not work yet. From FreeBSD.
 1.10 19-Oct-2007  ad branches: 1.10.16; 1.10.20; 1.10.26;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.9 29-Jan-2007  hubertf branches: 1.9.6; 1.9.18; 1.9.20; 1.9.24;
Remove more duplicate headers.
Patch by Slava Semushin <slava.semushin@gmail.com>

Again, this was tested by comparing obj files from a pristine and a patched
source tree against an i386/ALL kernel, and also for src/sbin/fsck_ffs,
src/sbin/fsdb and src/usr.sbin/makefs. Only changes in assert() line numbers
were detected in 'objdump -d' output.
 1.8 23-Jul-2006  ad branches: 1.8.4;
Use the LWP cached credentials where sane.
 1.7 15-May-2006  yamt include kauth.h for kauth_cred_getgid.
 1.6 14-May-2006  elad integrate kauth.
 1.5 16-Dec-2005  christos branches: 1.5.4; 1.5.6; 1.5.8; 1.5.10; 1.5.12;
PR/32303: Nicolas Joly: Fix -current amd64 kernel compilation failure with
options COMPAT_LINUX
 1.4 14-Dec-2005  christos proc to lwp change
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 20-May-2005  fvdl branches: 1.2.2; 1.2.8;
Define linux_usertrap function, and set it in struct emul. For all
but amd64, it just returns 0, doing nothing.

For amd64, it implements vsyscalls through cheating: if the faulting
address is in the vsyscall area (which is statically known on Linux/amd64),
and the intruction pointer is too, it must have been a vsyscall. In that
case, retrieve the return address from the user stack, fix up %rip and
%rsp, and just execute the normal system call. It will return as if
the vsyscall has been executed.
 1.1 03-May-2005  manu First work on COMPAT_LINUX/amd64
Process startup and dynamiclinking work, but processes hang due to
Linux arch_prctl(2) not being really supported yet.
 1.2.8.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.2.8.1 20-May-2005  skrll file linux_exec_machdep.c was added on branch ktrace-lwp on 2005-11-10 14:00:59 +0000
 1.2.2.4 27-Oct-2007  yamt sync with head.
 1.2.2.3 26-Feb-2007  yamt sync with head.
 1.2.2.2 30-Dec-2006  yamt sync with head.
 1.2.2.1 21-Jun-2006  yamt sync with head.
 1.5.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.5.10.1 08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.5.8.2 11-Aug-2006  yamt sync with head
 1.5.8.1 24-May-2006  yamt sync with head.
 1.5.6.1 01-Jun-2006  kardel Sync with head.
 1.5.4.1 09-Sep-2006  rpaulo sync with head
 1.8.4.1 01-Feb-2007  ad Sync with head.
 1.9.24.1 25-Oct-2007  bouyer Sync with HEAD.
 1.9.20.1 06-Nov-2007  matt sync with HEAD
 1.9.18.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.9.6.1 23-Oct-2007  ad Sync with head.
 1.10.26.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.10.20.3 11-Aug-2010  yamt sync with head.
 1.10.20.2 11-Mar-2010  yamt sync with head
 1.10.20.1 04-May-2009  yamt sync with head.
 1.10.16.1 17-Jan-2009  mjf Sync with HEAD.
 1.12.2.2 28-Apr-2009  skrll Sync with HEAD.
 1.12.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.13.2.1 01-Apr-2009  snj Pull up following revision(s) (requested by mrg in ticket #622):
bin/csh/csh.1: revision 1.46
bin/csh/func.c: revision 1.37
bin/ps/print.c: revision 1.111
bin/ps/ps.c: revision 1.74
bin/sh/miscbltin.c: revision 1.38
bin/sh/sh.1: revision 1.92 via patch
external/bsd/top/dist/machine/m_netbsd.c: revision 1.7
lib/libkvm/kvm_proc.c: revision 1.82
sys/arch/mips/mips/cpu_exec.c: revision 1.55
sys/compat/darwin/darwin_exec.c: revision 1.57
sys/compat/ibcs2/ibcs2_exec.c: revision 1.73
sys/compat/irix/irix_resource.c: revision 1.15
sys/compat/linux/arch/amd64/linux_exec_machdep.c: revision 1.16
sys/compat/linux/arch/i386/linux_exec_machdep.c: revision 1.12
sys/compat/linux/common/linux_limit.h: revision 1.5
sys/compat/osf1/osf1_resource.c: revision 1.14
sys/compat/svr4/svr4_resource.c: revision 1.18
sys/compat/svr4_32/svr4_32_resource.c: revision 1.17
sys/kern/exec_subr.c: revision 1.62
sys/kern/init_sysctl.c: revision 1.160
sys/kern/kern_exec.c: revision 1.288
sys/kern/kern_resource.c: revision 1.151
sys/sys/param.h: patch
sys/sys/resource.h: revision 1.31
sys/sys/sysctl.h: revision 1.184
sys/uvm/uvm_extern.h: revision 1.153
sys/uvm/uvm_glue.c: revision 1.136
sys/uvm/uvm_mmap.c: revision 1.128
usr.bin/systat/ps.c: revision 1.32
- - add new RLIMIT_AS (aka RLIMIT_VMEM) resource that limits the total
address space available to processes. this limit exists in most other
modern unix variants, and like most of them, our defaults are unlimited.
remove the old mmap / rlimit.datasize hack.
- - adds the VMCMD_STACK flag to all the stack-creation vmcmd callers.
it is currently unused, but was added a few years ago.
- - add a pair of new process size values to kinfo_proc2{}. one is the
total size of the process memory map, and the other is the total size
adjusted for unused stack space (since most processes have a lot of
this...)
- - patch sh, and csh to notice RLIMIT_AS. (in some cases, the alias
RLIMIT_VMEM was already present and used if availble.)
- - patch ps, top and systat to notice the new k_vm_vsize member of
kinfo_proc2{}.
- - update irix, svr4, svr4_32, linux and osf1 emulations to support
this information. (freebsd could be done, but that it's best left
as part of the full-update of compat/freebsd.)
this addresses PR 7897. it also gives correct memory usage values,
which have never been entirely correct (since mmap), and have been
very incorrect since jemalloc() was enabled.
tested on i386 and sparc64, build tested on several other platforms.
thanks to many folks for feedback and testing but most espcially
chuq and yamt for critical suggestions that lead to this patch not
having a special ugliness i wasn't happy with anyway :-)
 1.14.4.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.16.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.16.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.17.2.1 05-Mar-2011  rmind sync with head
 1.18.12.1 18-Feb-2012  mrg merge to -current.
 1.18.8.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.18.8.1 17-Apr-2012  yamt sync with head
 1.19.10.1 18-May-2014  rmind sync with head
 1.19.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.22.36.1 17-Jan-2020  ad Sync with head.
 1.22.30.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.24.26.1 02-Aug-2025  perseant Sync with HEAD
 1.6 01-Oct-2024  riastradh sys/compat/linux/arch: Nix trailing whitespace.

No functional change intended.
 1.5 25-Jun-2014  njoly branches: 1.5.64;
Add a few missing open(2) flags (LINUX_O_*). Fix alpha wrong values.
 1.4 02-Nov-2010  chs branches: 1.4.18; 1.4.32;
define LINUX_O_CLOEXEC.
sort definitions by value.
consistently use hex instead of octal for the values.
 1.3 21-Sep-2010  chs implement O_DIRECTORY as standardized in POSIX-2008,
for both native and linux emulations.
this fixes the rest of PR 43695.
 1.2 11-Dec-2005  christos branches: 1.2.74; 1.2.96; 1.2.98;
merge ktrace-lwp.
 1.1 03-May-2005  manu branches: 1.1.8;
First work on COMPAT_LINUX/amd64
Process startup and dynamiclinking work, but processes hang due to
Linux arch_prctl(2) not being really supported yet.
 1.1.8.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.8.1 03-May-2005  skrll file linux_fcntl.h was added on branch ktrace-lwp on 2005-11-10 14:00:59 +0000
 1.2.98.1 05-Mar-2011  rmind sync with head
 1.2.96.2 06-Nov-2010  uebayasi Sync with HEAD.
 1.2.96.1 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.2.74.1 09-Oct-2010  yamt sync with head
 1.4.32.1 10-Aug-2014  tls Rebase.
 1.4.18.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.5.64.1 02-Aug-2025  perseant Sync with HEAD
 1.3 01-Oct-2024  riastradh sys/compat/linux/arch: Nix trailing whitespace.

No functional change intended.
 1.2 11-Dec-2005  christos branches: 1.2.200;
merge ktrace-lwp.
 1.1 03-May-2005  manu branches: 1.1.8;
First work on COMPAT_LINUX/amd64
Process startup and dynamiclinking work, but processes hang due to
Linux arch_prctl(2) not being really supported yet.
 1.1.8.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.8.1 03-May-2005  skrll file linux_ioctl.h was added on branch ktrace-lwp on 2005-11-10 14:00:59 +0000
 1.2.200.1 02-Aug-2025  perseant Sync with HEAD
 1.62 01-Oct-2024  riastradh sys/compat/linux/arch: Nix trailing whitespace.

No functional change intended.
 1.61 27-Oct-2021  thorpej branches: 1.61.10;
Use __SIGTRAMP_SIGCODE_VERSION rather than hard-coding 0.
 1.60 07-Sep-2021  riastradh sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.59 23-Aug-2019  maxv Remove printf.
 1.58 19-May-2019  maxv branches: 1.58.2;
Rename

fpu_save_area_clear -> fpu_clear
fpu_save_area_reset -> fpu_sigreset

Clearer, and reduces a future diff. No real functional change.
 1.57 24-Mar-2019  maxv Fix a tiny race in setregs and linux_setregs. Between the moment we set
pcb_flags to zero, and the moment cpu_segregs64_zero resets pcb_gs, we may
be preempted.

If this happens, and if the calling LWP was a 32bit thread, when switching
back to that LWP, the context switcher sees that PCB_COMPAT32 is not set in
pcb_flags and tries to perform a 64bit context switch; but pcb_gs contains
a 32bit GDT descriptor, and not a 64bit GS.base value. The wrmsr therefore
faults because the value is non-canonical, and this fault is fatal.

Rearrange the code so that the update of pcb_flags and pcb_gs/pcb_fs is non
interruptible. This fixes the problem, tested with a reproducer (which
therefore doesn't work anymore).

Likely fixes PR/53993.
 1.56 01-Jan-2018  maxv branches: 1.56.4;
Use the default %cs, and mask the other segregs.
 1.55 21-Oct-2017  maxv Include opt_user_ldt.h when needed.
 1.54 19-Oct-2017  maxv Always mask the 16 bits of the segregs in the trapframe. We don't zero-
extend the uint64_t's when building it, so we're leaking 48 bits of kernel
stack to userland.

Having said that, it appears that I unintentionally fixed most of this
issue in locore.S::rev1.127 - by building the frame with interrupts
disabled, we are implicitly guaranteeing that the structure doesn't get
overwritten by the kernel. Which means, we are leaking to userland data
that comes from userland anyway.

(still other places with this issue, but I'll fix them differently)
 1.53 15-Oct-2017  maxv Use two separate functions: cpu_segregs32_zero and cpu_segregs64_zero. The
way segment registers work on amd64 will diverge between 32bit and 64bit
LWPs.
 1.52 14-Jul-2017  maxv Don't forget to clean l_md.md_flags, otherwise there may be MDL_COMPAT32,
in which case the kernel would always use iret (slower).
 1.51 13-Feb-2017  maxv branches: 1.51.4; 1.51.6;
Make sure %rip is in userland. This is harmless, since the return to
userland is made with iret instead of sysret in this path. While here, use
size_t.
 1.50 13-Feb-2017  maxv Don't let userland choose %rip. This is the Intel Sysret vulnerability
again.
 1.49 05-Feb-2017  maxv Missing pmap_ldt_cleanup.
 1.48 19-Feb-2014  dsl branches: 1.48.4; 1.48.6; 1.48.8; 1.48.10; 1.48.12; 1.48.14;
Don't rely on pcb.h including x86/include/sysarch.h
 1.47 15-Feb-2014  dsl Remove all references to MDL_USEDFPU and deferred fpu initialisation.
The cost of zeroing the save area on exec is minimal.
This stops the FP registers of a random process being used the first
time an lwp uses the fpu.
sendsig_siginfo() and get_mcontext() now unconditionally copy the FP
registers.
I'll remove the double-copy for signal handlers soon.
get_mcontext() might have been leaking kernel memory to userspace - and
may still do so if i386_use_fxsave is false (short copies).
 1.46 11-Feb-2014  dsl Move sys/arch/amd64/amd64/fpu.c and sys/arch/amd64/include/fpu.h
into sys/arch/x86 in preparation for using the same code for i386.
 1.45 07-Feb-2014  dsl Convert the amd64 build to use x86/cpu_extended_state.h so that the fpu
definitions match those of i386.
Mostly just structure and field renames, in addition:
1) process_xmm_to_s87() and process_s87_to_xmm() moved into
x86/convert_xmm_s87.c so they can be used by amd64's netbsd32 code.
2) The linux signal code simplified to use a structure copy for ths fxsave
data - it matches the hardware definition and won't change.
 1.44 04-Jan-2014  dsl Remove __HAVE_PROCESS_XFPREGS and add the extra parameter for the size
of the fp save area to all the process_read_fpregs() and
process_write_fpregs() functions.
None of the functions have been modified to use the new parameters.
The size is set for all the writes, but some of the arch-specific reads
just pass NULL.
The amd64 (and i386) need variable sized fp register save areas in order
to support AVX and other enhanced register areas.
These functions are rarely called - so the extra argument won't matter.
 1.43 01-Dec-2013  christos revert fpu/pcu changes until we figure out what's wrong; they cause random
freezes
 1.42 18-Nov-2013  chs initialize %ds to something valid to help ptrace().
 1.41 23-Oct-2013  drochner Use the MI "pcu" framework for bookkeeping of npx/fpu states on x86.
This reduces the amount of MD code enormously, and makes it easier
to implement support for newer CPU features which require more fpu
state, or for fpu usage by the kernel.
For access to FPU state across CPUs, an xcall kthread is used now
rather than a dedicated IPI.
No user visible changes intended.
 1.40 08-Jul-2012  dsl branches: 1.40.2; 1.40.4;
The MDP_USEDFPU (amd64 and sh3) and MDP_SSTEP (sh3) are lwp flags not
process ones, rename to MDL_xxx.
 1.39 18-Nov-2011  christos branches: 1.39.6; 1.39.10; 1.39.12;
- add sigtimedwait support.
- merge the siginfo population code.
 1.38 07-Jul-2010  chs branches: 1.38.8;
many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
- support new-style (NPTL) linux pthreads on all platforms.
clone() with CLONE_THREAD uses 1 process with many LWPs
instead of separate processes.
- move the contents of sys__lwp_setprivate() into a new
lwp_setprivate() and use that everywhere.
- update linux_release[] and linux32_release[] to "2.6.18".
- adjust placement of emul fork/exec/exit hooks as needed
and adjust other emul code to match.
- convert all struct emul definitions to use named initializers.
- change the pid allocator to allow multiple pids to refer to the same proc.
- remove a few fields from struct proc that are no longer needed.
- disable the non-functional "vdso" code in linux32/amd64,
glibc works fine without it.
- fix a race in the futex code where we could miss a wakeup after
a requeue operation.
- redo futex locking to be a little more efficient.
 1.37 23-Nov-2009  rmind branches: 1.37.2; 1.37.4;
Use lwp_getpcb() in compat code, clean from struct user.
 1.36 29-May-2009  njoly Add native to linux siginfo si_status translation, used on i386 and
amd64.
 1.35 18-Mar-2009  cegger bzero -> memset
 1.34 26-Oct-2008  christos branches: 1.34.2; 1.34.8;
catch up with i386 changes.
 1.33 19-Oct-2008  njoly Add native to linux siginfo si_code translation, mostly for negative
values. Adjust amd64 and i386 accordingly, not sure about aother archs
i can't test.
 1.32 18-Sep-2008  christos Define a PSL_CLEARSIG macro for the psl flags to be cleared on signal delivery
and use it everywhere.
 1.31 01-Aug-2008  jmcneill linux_sys_rt_sigreturn: properly restore stack flags, pointed out by
Juan RP and modified by myself. ok christos@
 1.30 11-May-2008  jmcneill branches: 1.30.4;
Pull in machine/cpufunc.h for wrmsr definition.
 1.29 24-Apr-2008  ad branches: 1.29.2; 1.29.4;
Merge proc::p_mutex and proc::p_smutex into a single adaptive mutex, since
we no longer need to guard against access from hardware interrupt handlers.

Additionally, if cloning a process with CLONE_SIGHAND, arrange to have the
child process share the parent's lock so that signal state may be kept in
sync. Partially addresses PR kern/37437.
 1.28 05-Jan-2008  dsl branches: 1.28.6; 1.28.8;
Use the new names (_REG_RFLAGS and _REG_RSP) for the indexes of __gregs[]
which match the names of in the trapframe and .S code.
 1.27 20-Dec-2007  dsl Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.26 08-Dec-2007  dsl branches: 1.26.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.25 19-Oct-2007  njoly branches: 1.25.2; 1.25.4;
Add compat_linux and exec_linux_elf lkm support for amd64:
- Add needed COMPAT_OSSAUDIO to GENERIC.
- Add missing includes needed by linux_syscallargs.h.
- Add lkm building.
 1.24 03-Oct-2007  ad branches: 1.24.2;
fxsave() is a function, don't re-use the name.
 1.23 24-May-2007  njoly branches: 1.23.6; 1.23.8; 1.23.10;
Fix restart of interrupted system calls.

- Make linux_sys_rt_sigreturn() return EJUSTRETURN on success.
- Add missing rax to linux_sigcontext structure; and save/restore
its value like other members in linux_sendsig()/linux_sys_rt_sigreturn().

With valuable help from manu.
 1.22 21-May-2007  christos rename si_sigval -> si_value to match POSIX RTS.
 1.21 14-Mar-2007  manu Add ptmx fakedevice hack for amd64
Fix a bug in ioctl handling
 1.20 05-Mar-2007  christos branches: 1.20.2; 1.20.4;
more caddr_t lossage.
 1.19 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.18 17-Feb-2007  pavel Change the process/lwp flags seen by userland via sysctl back to the
P_*/L_* naming convention, and rename the in-kernel flags to avoid
conflict. (P_ -> PK_, L_ -> LW_ ). Add back the (now unused) LSDEAD
constant.

Restores source compatibility with pre-newlock2 tools like ps or top.

Reviewed by Andrew Doran.
 1.17 15-Feb-2007  ad branches: 1.17.2;
Fix Linux compat on amd64.
 1.16 09-Feb-2007  ad Merge newlock2 to head.
 1.15 20-Sep-2006  manu branches: 1.15.2;
Proprely convert devices on amd64
 1.14 23-Aug-2006  manu branches: 1.14.2; 1.14.4;
1) Complete Linux exit_group() emulation
Members of the thread group must die without reporting to the parent and
without going to zombie stage. We do that by reparenting to init before
catching a SIGKILL. The parent will not see the child death.

The thread group leader must report the exit status, even if it exits
because of another thread calling exit_group(). We do that by storing the
exit status in struct linux_emuldata_shared, and the exit hook has the
duty of setting struct proc's p_xstat for the thread group leader.

2) For exit/fork/exec hooks, move the NPTL specific code to separate functions
that are shared between COMPAT_LINUX and COMPAT_LINUX32

3) Fix LINUX_CLONE_PARENT_SETTID semantics
 1.13 16-Dec-2005  christos branches: 1.13.4; 1.13.8;
PR/32303: Nicolas Joly: Fix -current amd64 kernel compilation failure with
options COMPAT_LINUX
 1.12 11-Dec-2005  christos merge ktrace-lwp.
 1.11 05-Nov-2005  manu branches: 1.11.2;
Instead of ifdef'ing __amd64__ all the Linux NPTL stuff, introduce an
ifdef LINUX_NPTL.
Also implement SETTLS flag to Linux clone()
 1.10 04-Nov-2005  manu build fix
 1.9 24-Jun-2005  manu branches: 1.9.2;
More accurate SIGCHLD code and status for siginfo
 1.8 22-Jun-2005  manu Fix siginfo to return the right child's status.
 1.7 22-Jun-2005  manu Implent CLONE_PARENT_SETTID, CLONE_CHILD_CLEARTID, and CLONE_CHILD_SETTID
options to clone(). This makes fork() work on amd64.

clone() prototype has changed and the changes is probably revelant on some
other arches.
 1.6 22-May-2005  fvdl sigreturn doesn't take arguments. Instead, find out where the signal
frame is from the stack pointer in the frame frame.

Also, don't forget to copy %rip back in.
 1.5 22-May-2005  fvdl Use a modified buildcontext function for Linux signals. It doesn't set
the unused segment registers, it just uses the already used values.
 1.4 20-May-2005  fvdl Define linux_usertrap function, and set it in struct emul. For all
but amd64, it just returns 0, doing nothing.

For amd64, it implements vsyscalls through cheating: if the faulting
address is in the vsyscall area (which is statically known on Linux/amd64),
and the intruction pointer is too, it must have been a vsyscall. In that
case, retrieve the return address from the user stack, fix up %rip and
%rsp, and just execute the normal system call. It will return as if
the vsyscall has been executed.
 1.3 19-May-2005  manu Add support for Linux SA_RESTORER on amd64.
 1.2 15-May-2005  fvdl Make the arch_prctl system call use the saved %gs and %fs mechanism.
 1.1 03-May-2005  manu First work on COMPAT_LINUX/amd64
Process startup and dynamiclinking work, but processes hang due to
Linux arch_prctl(2) not being really supported yet.
 1.9.2.6 21-Jan-2008  yamt sync with head
 1.9.2.5 27-Oct-2007  yamt sync with head.
 1.9.2.4 03-Sep-2007  yamt sync with head.
 1.9.2.3 26-Feb-2007  yamt sync with head.
 1.9.2.2 30-Dec-2006  yamt sync with head.
 1.9.2.1 21-Jun-2006  yamt sync with head.
 1.11.2.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.11.2.1 05-Nov-2005  skrll file linux_machdep.c was added on branch ktrace-lwp on 2005-11-10 14:00:59 +0000
 1.13.8.1 03-Sep-2006  yamt sync with head.
 1.13.4.1 09-Sep-2006  rpaulo sync with head
 1.14.4.1 22-Oct-2006  yamt sync with head
 1.14.2.2 06-Feb-2007  ad More compat changes.

XXX compat_irix, compat_mach and compat_darwin need work.
 1.14.2.1 18-Nov-2006  ad Sync with head.
 1.15.2.2 30-May-2007  riz Pull up following revision(s) (requested by njoly in ticket #673):
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.23
sys/compat/linux/arch/amd64/linux_machdep.h: revision 1.9
Fix restart of interrupted system calls.
- Make linux_sys_rt_sigreturn() return EJUSTRETURN on success.
- Add missing rax to linux_sigcontext structure; and save/restore
its value like other members in linux_sendsig()/linux_sys_rt_sigreturn().
With valuable help from manu.
 1.15.2.1 13-May-2007  pavel branches: 1.15.2.1.2;
Pull up following revision(s) (requested by manu in ticket #637):
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.21
sys/compat/linux/arch/amd64/linux_machdep.h: revision 1.7
sys/compat/linux/common/linux_termios.c: revision 1.30
Add ptmx fakedevice hack for amd64
Fix a bug in ioctl handling
 1.15.2.1.2.1 04-Jun-2007  wrstuden Update to today's netbsd-4.
 1.17.2.3 24-Mar-2007  yamt sync with head.
 1.17.2.2 12-Mar-2007  rmind Sync with HEAD.
 1.17.2.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.20.4.1 11-Jul-2007  mjf Sync with head.
 1.20.2.3 09-Oct-2007  ad Sync with head.
 1.20.2.2 27-May-2007  ad Sync with head.
 1.20.2.1 10-Apr-2007  ad Sync with head.
 1.23.10.1 06-Oct-2007  yamt sync with head.
 1.23.8.2 09-Jan-2008  matt sync with HEAD
 1.23.8.1 06-Nov-2007  matt sync with HEAD
 1.23.6.3 09-Dec-2007  jmcneill Sync with HEAD.
 1.23.6.2 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.23.6.1 04-Oct-2007  joerg Sync with HEAD.
 1.24.2.1 25-Oct-2007  bouyer Sync with HEAD.
 1.25.4.1 26-Dec-2007  ad Sync with head.
 1.25.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.26.4.2 08-Jan-2008  bouyer Sync with HEAD
 1.26.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.28.8.1 18-May-2008  yamt sync with head.
 1.28.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.28.6.2 28-Sep-2008  mjf Sync with HEAD.
 1.28.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.29.4.5 24-Sep-2008  wrstuden Merge in changes between wrstuden-revivesa-base-2 and
wrstuden-revivesa-base-3.
 1.29.4.4 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.29.4.3 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.29.4.2 14-May-2008  wrstuden Per discussion with ad at n dot o, revert signal mask handling
changes.

The l_sigstk changes are most likely totally un-needed as SA will
never use a signal stack - we send an upcall (or will as other
diffs are brought in).

The l_sigmask changes were too controvertial. In all honesty, I
think it's probably best to revert them. The main reason they were
there is the fact that in an SA process, we don't mask signals per
kernel thread, we mask them per user thread. In the kernel, we want
them all to get turned into upcalls. Thus the normal state of
l_sigmask in an SA process is for it to always be empty.

While we are in the process of delivering a signal, we want to
temporarily mask a signal (so we don't recursively exhaust our
upcall stacks). However signal delivery is rare (important, but
rare), and delivering back-to-back signals is even rarer. So rather
than cause every user of a signal mask to be prepared for this very
rare case, we will just add a second check later in the signal
delivery code. Said change is not in this diff.

This also un-compensates all of our compatability code for dealing
with SA. SA is a NetBSD-specific thing, so there's no need for
Irix, Linux, Solaris, SVR4 and so on to cope with it.

As previously, everything other than kern_sa.c compiles in i386
GENERIC as of this checkin. I will switch to ALL soon for compile
testing.
 1.29.4.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.29.2.5 11-Aug-2010  yamt sync with head.
 1.29.2.4 11-Mar-2010  yamt sync with head
 1.29.2.3 20-Jun-2009  yamt sync with head
 1.29.2.2 04-May-2009  yamt sync with head.
 1.29.2.1 16-May-2008  yamt sync with head.
 1.30.4.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.30.4.1 19-Oct-2008  haad Sync with HEAD.
 1.34.8.2 23-Jul-2009  jym Sync with HEAD.
 1.34.8.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.34.2.1 28-Apr-2009  skrll Sync with HEAD.
 1.37.4.1 05-Mar-2011  rmind sync with head
 1.37.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.38.8.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.38.8.2 30-Oct-2012  yamt sync with head
 1.38.8.1 17-Apr-2012  yamt sync with head
 1.39.12.1 14-Feb-2017  snj Pull up following revision(s) (requested by maxv in ticket #1433):
sys/compat/linux/arch/amd64/linux_machdep.c: 1.50, 1.51
Don't let userland choose %rip. This is the Intel Sysret vulnerability
again.
--
Make sure %rip is in userland. This is harmless, since the return to
userland is made with iret instead of sysret in this path. While here, use
size_t.
 1.39.10.1 14-Feb-2017  snj Pull up following revision(s) (requested by maxv in ticket #1433):
sys/compat/linux/arch/amd64/linux_machdep.c: 1.50, 1.51
Don't let userland choose %rip. This is the Intel Sysret vulnerability
again.
--
Make sure %rip is in userland. This is harmless, since the return to
userland is made with iret instead of sysret in this path. While here, use
size_t.
 1.39.6.1 14-Feb-2017  snj Pull up following revision(s) (requested by maxv in ticket #1433):
sys/compat/linux/arch/amd64/linux_machdep.c: 1.50, 1.51
Don't let userland choose %rip. This is the Intel Sysret vulnerability
again.
--
Make sure %rip is in userland. This is harmless, since the return to
userland is made with iret instead of sysret in this path. While here, use
size_t.
 1.40.4.1 18-May-2014  rmind sync with head
 1.40.2.2 03-Dec-2017  jdolecek update from HEAD
 1.40.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.48.14.1 21-Apr-2017  bouyer Sync with HEAD
 1.48.12.1 13-Mar-2017  skrll Sync with netbsd-7-1-RELEASE
 1.48.10.2 20-Mar-2017  pgoyette Sync with HEAD
 1.48.10.1 20-Jul-2016  pgoyette Adapt machine-independant code to the new {b,c}devsw reference-counting
(using localcount(9)). All callers of {b,c}devsw_lookup() now call
{b,c}devsw_lookup_acquire() which retains a reference on the 'struct
{b,c}devsw'. This reference must be released by the caller once it is
finished with the structure's content (or other data that would disappear
if the 'struct {b,c}devsw' were to disappear).
 1.48.8.1 14-Feb-2017  snj Pull up following revision(s) (requested by maxv in ticket #1359):
sys/compat/linux/arch/amd64/linux_machdep.c: 1.50, 1.51
Don't let userland choose %rip. This is the Intel Sysret vulnerability
again.
--
Make sure %rip is in userland. This is harmless, since the return to
userland is made with iret instead of sysret in this path. While here, use
size_t.
 1.48.6.1 28-Aug-2017  skrll Sync with HEAD
 1.48.4.2 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1720:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149 (patch)
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54 (patch)

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.48.4.1 14-Feb-2017  snj branches: 1.48.4.1.2;
Pull up following revision(s) (requested by maxv in ticket #1359):
sys/compat/linux/arch/amd64/linux_machdep.c: revisions 1.50, 1.51
Don't let userland choose %rip. This is the Intel Sysret vulnerability
again.
--
Make sure %rip is in userland. This is harmless, since the return to
userland is made with iret instead of sysret in this path. While here, use
size_t.
 1.48.4.1.2.1 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1720:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149 (patch)
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54 (patch)

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.51.6.4 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1836):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.51.6.3 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1487:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.51.6.2 05-Apr-2019  martin Pull up following revision(s) (requested by maxv):

sys/arch/amd64/amd64/netbsd32_machdep.c: revision 1.120
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.57
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.44
sys/arch/amd64/amd64/machdep.c: revision 1.328
sys/arch/amd64/amd64/machdep.c: revision 1.329

Fix a tiny race in setregs and linux_setregs. Between the moment we set
pcb_flags to zero, and the moment cpu_segregs64_zero resets pcb_gs, we may
be preempted.

If this happens, and if the calling LWP was a 32bit thread, when switching
back to that LWP, the context switcher sees that PCB_COMPAT32 is not set in
pcb_flags and tries to perform a 64bit context switch; but pcb_gs contains
a 32bit GDT descriptor, and not a 64bit GS.base value. The wrmsr therefore
faults because the value is non-canonical, and this fault is fatal.

Rearrange the code so that the update of pcb_flags and pcb_gs/pcb_fs is non
interruptible. This fixes the problem, tested with a reproducer (which
therefore doesn't work anymore).

Likely fixes PR/53993.

Disable preemption when setting PCB_COMPAT32, to prevent a context switch
before cpu_fsgs_reload() finishes, otherwise we write garbage in the GDT.

On NetBSD-current it is harmless, however in NetBSD-8 it might cause
panics, because NetBSD-8 uses the old SegRegs model and under this model
we reload %fs and %gs during switches.
 1.51.6.1 04-Sep-2017  snj Pull up following revision(s) (requested by maxv in ticket #257):
sys/compat/linux/arch/amd64/linux_machdep.c: 1.52
sys/arch/amd64/amd64/copy.S: 1.21-1.24
sys/arch/amd64/amd64/locore.S: 1.125
sys/arch/amd64/amd64/machdep.c: 1.256
Fix a bug in ucas_32 and ucas_64. There is a branch where they don't
initialize %rax.
--
style, reduces an incoming diff
00
Split comment, otherwise it is misleading. kcopy operates on kernel
memory, and must *not* be used with userland pages.
--
Move incq outside of the copy section. No functional change, reduces
my smap diff.
--
Remove dumb debug code and outdated comment.
--
Don't forget to clean l_md.md_flags, otherwise there may be MDL_COMPAT32,
in which case the kernel would always use iret (slower).
 1.51.4.1 27-Apr-2017  pgoyette Restore all work from the former pgoyette-localcount branch (which is
now abandoned doe to cvs merge botch).

The branch now builds, and installs via anita. There are still some
problems (cgd is non-functional and all atf tests time-out) but they
will get resolved soon.
 1.56.4.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.56.4.1 10-Jun-2019  christos Sync with HEAD
 1.58.2.2 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.58.2.1 13-Sep-2019  martin Pull up following revision(s) (requested by maxv in ticket #194):

sys/compat/linux/common/linux_socket.c: revision 1.146
sys/compat/linux/common/linux_socket.c: revision 1.147
sys/compat/linux/common/linux_socket.c: revision 1.148
sys/compat/linux/common/linux_socket.c: revision 1.149
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.59
sys/compat/linux32/common/linux32_sysinfo.c: revision 1.8
sys/kern/sysv_shm.c: revision 1.138
sys/compat/linux/common/linux_file64.c: revision 1.61
sys/compat/linux/common/linux_file64.c: revision 1.62
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.58
sys/compat/linux32/common/linux32_dirent.c: revision 1.20
sys/compat/linux32/common/linux32_utsname.c: revision 1.10
sys/compat/linux/common/linux_termios.h: revision 1.22
sys/compat/linux32/common/linux32_termios.c: revision 1.15
sys/compat/linux32/common/linux32_misc.c: revision 1.27
sys/compat/linux32/common/linux32_ioctl.c: revision 1.14
sys/compat/linux/common/linux_statfs.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.57
sys/compat/linux/common/linux_fcntl.h: revision 1.18
sys/compat/linux/common/linux_socket.h: revision 1.24
sys/sys/shm.h: revision 1.54
sys/compat/ossaudio/ossaudio.c: revision 1.75
sys/compat/linux32/common/linux32_signal.c: revision 1.20
sys/miscfs/procfs/procfs_linux.c: revision 1.75
sys/compat/linux/common/linux_signal.c: revision 1.81
sys/compat/linux/common/linux_termios.c: revision 1.38
sys/compat/linux/common/linux_misc.c: revision 1.241
sys/compat/linux/common/linux_misc.c: revision 1.242
sys/compat/linux/common/linux_misc.c: revision 1.243
sys/compat/linux/common/linux_misc.c: revision 1.244

Fix info leaks.

Fix stupid bugs in linux_sys_shmctl(): the index could be out of bound
(page fault) and there was no proper locking.
Maybe we should just remove LINUX_SHM_STAT, like compat_linux32.

Remove printf.

When dealing with an unknown value, set -1, to prevent (harmless)
uninitialized accesses later.

Add a default case, don't call sys_ioctl() with an uninitialized 'com'
argument.

Fix error handling, returns an errno, not -1.

Put the printf under DEBUG_LINUX.


Hum, don't forget the 'pid' argument, otherwise we're not gonna go very
far.

Don't read data from userland directly. This simply does not work on any
recent x86 CPU (thanks to SMAP) and all architectures that forbid direct
access to userland from the kernel. But I guess no one noticed because no
one ever uses compat_linux, right?

Hum, don't pass an mbuf to realloc(). Inspired from copyin32_msg_control().

Fix memory leak.

I don't see the point in having this useless printf, but add a '\n' to it,
so that it at least displays useless stuff correctly.

Hum, remove incorrect assignment. Userland could have passed a smaller
namelen, and the uninitialized bytes from sb_data were being used later in
the network stack.
 1.61.10.1 02-Aug-2025  perseant Sync with HEAD
 1.15 01-Oct-2024  riastradh sys/compat/linux/arch: Nix trailing whitespace.

No functional change intended.
 1.14 07-Feb-2014  dsl branches: 1.14.66;
Convert the amd64 build to use x86/cpu_extended_state.h so that the fpu
definitions match those of i386.
Mostly just structure and field renames, in addition:
1) process_xmm_to_s87() and process_s87_to_xmm() moved into
x86/convert_xmm_s87.c so they can be used by amd64's netbsd32 code.
2) The linux signal code simplified to use a structure copy for ths fxsave
data - it matches the hardware definition and won't change.
 1.13 07-Jul-2010  chs branches: 1.13.8; 1.13.18; 1.13.22;
many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
- support new-style (NPTL) linux pthreads on all platforms.
clone() with CLONE_THREAD uses 1 process with many LWPs
instead of separate processes.
- move the contents of sys__lwp_setprivate() into a new
lwp_setprivate() and use that everywhere.
- update linux_release[] and linux32_release[] to "2.6.18".
- adjust placement of emul fork/exec/exit hooks as needed
and adjust other emul code to match.
- convert all struct emul definitions to use named initializers.
- change the pid allocator to allow multiple pids to refer to the same proc.
- remove a few fields from struct proc that are no longer needed.
- disable the non-functional "vdso" code in linux32/amd64,
glibc works fine without it.
- fix a race in the futex code where we could miss a wakeup after
a requeue operation.
- redo futex locking to be a little more efficient.
 1.12 21-Apr-2008  njoly branches: 1.12.2; 1.12.22; 1.12.24;
Rename LINUX_SHMCTL_FORCEIPC64 define to LINUX_IPC_FORCE64.
 1.11 28-Jan-2008  njoly branches: 1.11.6; 1.11.8;
Make shmctl + {IPC,SHM}_STAT work an amd64, by forcing use of IPC_64.
Following the Linux kernel behaviour.
 1.10 04-Dec-2007  dsl Remove all the __P
 1.9 24-May-2007  njoly branches: 1.9.6; 1.9.8; 1.9.14; 1.9.16;
Fix restart of interrupted system calls.

- Make linux_sys_rt_sigreturn() return EJUSTRETURN on success.
- Add missing rax to linux_sigcontext structure; and save/restore
its value like other members in linux_sendsig()/linux_sys_rt_sigreturn().

With valuable help from manu.
 1.8 23-Apr-2007  manu Linux's uname should return x86_64 as machine_arch
 1.7 14-Mar-2007  manu Add ptmx fakedevice hack for amd64
Fix a bug in ioctl handling
 1.6 14-Mar-2007  njoly Fix compat linux statfs/fstatfs syscalls on amd64.
- Do not use statfs64/fstatfs64 as they have an extra size argument.
- Add full 64bit linux struct statfs support.

ok by manu
 1.5 23-Nov-2005  manu branches: 1.5.24; 1.5.26; 1.5.30; 1.5.32;
- Add Linux tkill and tgkill (partial emulation).
- Fix getrlimit on amd64
 1.4 05-Nov-2005  manu branches: 1.4.2; 1.4.4;
Instead of ifdef'ing __amd64__ all the Linux NPTL stuff, introduce an
ifdef LINUX_NPTL.
Also implement SETTLS flag to Linux clone()
 1.3 04-Nov-2005  manu Fix machine name returned by uname on Linux
 1.2 20-May-2005  fvdl branches: 1.2.2;
Define linux_usertrap function, and set it in struct emul. For all
but amd64, it just returns 0, doing nothing.

For amd64, it implements vsyscalls through cheating: if the faulting
address is in the vsyscall area (which is statically known on Linux/amd64),
and the intruction pointer is too, it must have been a vsyscall. In that
case, retrieve the return address from the user stack, fix up %rip and
%rsp, and just execute the normal system call. It will return as if
the vsyscall has been executed.
 1.1 03-May-2005  manu First work on COMPAT_LINUX/amd64
Process startup and dynamiclinking work, but processes hang due to
Linux arch_prctl(2) not being really supported yet.
 1.2.2.4 04-Feb-2008  yamt sync with head.
 1.2.2.3 07-Dec-2007  yamt sync with head
 1.2.2.2 03-Sep-2007  yamt sync with head.
 1.2.2.1 21-Jun-2006  yamt sync with head.
 1.4.4.1 29-Nov-2005  yamt sync with head.
 1.4.2.3 11-Dec-2005  christos Sync with head.
 1.4.2.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.4.2.1 05-Nov-2005  skrll file linux_machdep.h was added on branch ktrace-lwp on 2005-11-10 14:00:59 +0000
 1.5.32.1 11-Jul-2007  mjf Sync with head.
 1.5.30.2 27-May-2007  ad Sync with head.
 1.5.30.1 10-Apr-2007  ad Sync with head.
 1.5.26.2 07-May-2007  yamt sync with head.
 1.5.26.1 24-Mar-2007  yamt sync with head.
 1.5.24.4 30-May-2007  riz Pull up following revision(s) (requested by njoly in ticket #673):
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.23
sys/compat/linux/arch/amd64/linux_machdep.h: revision 1.9
Fix restart of interrupted system calls.
- Make linux_sys_rt_sigreturn() return EJUSTRETURN on success.
- Add missing rax to linux_sigcontext structure; and save/restore
its value like other members in linux_sendsig()/linux_sys_rt_sigreturn().
With valuable help from manu.
 1.5.24.3 13-May-2007  pavel branches: 1.5.24.3.2;
Pull up following revision(s) (requested by manu in ticket #637):
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.21
sys/compat/linux/arch/amd64/linux_machdep.h: revision 1.7
sys/compat/linux/common/linux_termios.c: revision 1.30
Add ptmx fakedevice hack for amd64
Fix a bug in ioctl handling
 1.5.24.2 29-Apr-2007  bouyer Pull up following revision(s) (requested by manu in ticket #596):
sys/compat/linux/arch/amd64/linux_machdep.h: revision 1.8
sys/compat/linux/common/linux_sysctl.c: revision 1.27
Linux's uname should return x86_64 as machine_arch
 1.5.24.1 20-Apr-2007  bouyer Pull up following revision(s) (requested by njoly in ticket #581):
sys/compat/linux/common/linux_misc.c: revision 1.168
sys/compat/linux/arch/amd64/syscalls.master: revision 1.18
sys/compat/linux/common/linux_types.h: revision 1.25
sys/compat/linux/arch/amd64/linux_machdep.h: revision 1.6
sys/compat/linux/common/linux_misc_notalpha.c: revision 1.87
Fix compat linux statfs/fstatfs syscalls on amd64.
- Do not use statfs64/fstatfs64 as they have an extra size argument.
- Add full 64bit linux struct statfs support.
 1.5.24.3.2.1 04-Jun-2007  wrstuden Update to today's netbsd-4.
 1.9.16.1 08-Dec-2007  ad Sync with head.
 1.9.14.2 18-Feb-2008  mjf Sync with HEAD.
 1.9.14.1 08-Dec-2007  mjf Sync with HEAD.
 1.9.8.2 23-Mar-2008  matt sync with HEAD
 1.9.8.1 09-Jan-2008  matt sync with HEAD
 1.9.6.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.11.8.1 18-May-2008  yamt sync with head.
 1.11.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.12.24.1 05-Mar-2011  rmind sync with head
 1.12.22.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.12.2.1 11-Aug-2010  yamt sync with head.
 1.13.22.1 18-May-2014  rmind sync with head
 1.13.18.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.13.8.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.14.66.1 02-Aug-2025  perseant Sync with HEAD
 1.4 01-Oct-2024  riastradh sys/compat/linux/arch: Nix trailing whitespace.

No functional change intended.
 1.3 14-Mar-2015  njoly branches: 1.3.54;
Support Linux MAP_LOCKED mmap flag.
 1.2 11-Dec-2005  christos branches: 1.2.120; 1.2.140;
merge ktrace-lwp.
 1.1 03-May-2005  manu branches: 1.1.8;
First work on COMPAT_LINUX/amd64
Process startup and dynamiclinking work, but processes hang due to
Linux arch_prctl(2) not being really supported yet.
 1.1.8.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.8.1 03-May-2005  skrll file linux_mmap.h was added on branch ktrace-lwp on 2005-11-10 14:00:59 +0000
 1.2.140.1 06-Apr-2015  skrll Sync with HEAD
 1.2.120.1 03-Dec-2017  jdolecek update from HEAD
 1.3.54.1 02-Aug-2025  perseant Sync with HEAD
 1.3 01-Oct-2024  riastradh sys/compat/linux/arch: Nix trailing whitespace.

No functional change intended.
 1.2 11-Dec-2005  christos branches: 1.2.200;
merge ktrace-lwp.
 1.1 03-May-2005  manu branches: 1.1.8;
First work on COMPAT_LINUX/amd64
Process startup and dynamiclinking work, but processes hang due to
Linux arch_prctl(2) not being really supported yet.
 1.1.8.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.8.1 03-May-2005  skrll file linux_prctl.h was added on branch ktrace-lwp on 2005-11-10 14:00:59 +0000
 1.2.200.1 02-Aug-2025  perseant Sync with HEAD
 1.3 01-Oct-2024  riastradh sys/compat/linux/arch: Nix trailing whitespace.

No functional change intended.
 1.2 11-Dec-2005  christos branches: 1.2.200;
merge ktrace-lwp.
 1.1 19-May-2005  manu branches: 1.1.8;
Add support for Linux SA_RESTORER on amd64.
 1.1.8.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.8.1 19-May-2005  skrll file linux_sigarray.c was added on branch ktrace-lwp on 2005-11-10 14:00:59 +0000
 1.2.200.1 02-Aug-2025  perseant Sync with HEAD
 1.8 01-Oct-2024  riastradh sys/compat/linux/arch: Nix trailing whitespace.

No functional change intended.
 1.7 18-Nov-2011  christos branches: 1.7.88;
- add sigtimedwait support.
- merge the siginfo population code.
 1.6 08-Jun-2009  njoly branches: 1.6.12;
Various compat linux siginfo fixes.
- alpha: add missing _uid member to SIGCHLD structure.
- amd64: add missing typedef, and fix padding size.
- arm: add missing linux_siginfo definition.
 1.5 27-May-2009  njoly Use correct linux_clock_t type for _stime, not native clock_t.
 1.4 23-Nov-2008  njoly branches: 1.4.4;
Move si_code definitions from MD to MI linux_siginfo.h, all archs
(except mips for 3 values) are identical.
While here, remove unused/unneeded LINUX__SI_CODE macro. Only the
lower 16-bits are used for userland si_code.
 1.3 21-Oct-2008  njoly branches: 1.3.2;
Remove LINUX_SI_xxx from MI siginfo.h, that should not have been
committed. Rather add them to amd64 MD header.
Fix compilation failures on non x86 archs.
 1.2 11-Dec-2005  christos branches: 1.2.74; 1.2.80;
merge ktrace-lwp.
 1.1 03-May-2005  manu branches: 1.1.8;
First work on COMPAT_LINUX/amd64
Process startup and dynamiclinking work, but processes hang due to
Linux arch_prctl(2) not being really supported yet.
 1.1.8.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.8.1 03-May-2005  skrll file linux_siginfo.h was added on branch ktrace-lwp on 2005-11-10 14:00:59 +0000
 1.2.80.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.2.74.1 20-Jun-2009  yamt sync with head
 1.3.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.4.4.1 23-Jul-2009  jym Sync with HEAD.
 1.6.12.1 17-Apr-2012  yamt sync with head
 1.7.88.1 02-Aug-2025  perseant Sync with HEAD
 1.6 01-Oct-2024  riastradh sys/compat/linux/arch: Nix trailing whitespace.

No functional change intended.
 1.5 14-Nov-2015  christos branches: 1.5.54;
PR/50428: Rin Okuyama: support SA_RESTORER flag for rt_sigaction(2) in the
ports that support it.
 1.4 11-Dec-2005  christos branches: 1.4.120; 1.4.140;
merge ktrace-lwp.
 1.3 19-Sep-2005  christos branches: 1.3.6;
MINSIGSTKSZ on linux is different depending on the platform and usually
smaller than ours.
 1.2 19-May-2005  manu branches: 1.2.2;
Add support for Linux SA_RESTORER on amd64.
 1.1 03-May-2005  manu First work on COMPAT_LINUX/amd64
Process startup and dynamiclinking work, but processes hang due to
Linux arch_prctl(2) not being really supported yet.
 1.2.2.1 21-Jun-2006  yamt sync with head.
 1.3.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.3.6.1 19-Sep-2005  skrll file linux_signal.h was added on branch ktrace-lwp on 2005-11-10 14:00:59 +0000
 1.4.140.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.4.120.1 03-Dec-2017  jdolecek update from HEAD
 1.5.54.1 02-Aug-2025  perseant Sync with HEAD
 1.4 01-Oct-2024  riastradh sys/compat/linux/arch: Nix trailing whitespace.

No functional change intended.
 1.3 25-Jan-2014  njoly branches: 1.3.66;
Update linux socket socket options (SO_*). Add common version to its
own file (linux_socket_generic.h); use it for all but alpha and mips.
 1.2 11-Dec-2005  christos branches: 1.2.110; 1.2.120; 1.2.126;
merge ktrace-lwp.
 1.1 03-May-2005  manu branches: 1.1.8;
First work on COMPAT_LINUX/amd64
Process startup and dynamiclinking work, but processes hang due to
Linux arch_prctl(2) not being really supported yet.
 1.1.8.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.8.1 03-May-2005  skrll file linux_socket.h was added on branch ktrace-lwp on 2005-11-10 14:00:59 +0000
 1.2.126.1 18-May-2014  rmind sync with head
 1.2.120.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.110.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.3.66.1 02-Aug-2025  perseant Sync with HEAD
 1.3 23-Feb-2009  rmind Switch Linux futex emulation to native ucas_int(), remove unecessary
futex-specific assembler routines.

Fixes PR/40490. Reviewed by <ad>.
 1.2 20-Nov-2008  ad branches: 1.2.4; 1.2.6; 1.2.8;
PR port-amd64/39964 modules/compat_linux: missing symbols on amd64
 1.1 26-Oct-2008  christos branches: 1.1.2; 1.1.4;
catch up with i386 changes.
 1.1.4.1 26-Feb-2009  snj Pull up following revision(s) (requested by rmind in ticket #493):
sys/compat/linux/arch/amd64/files.linux_amd64: revision 1.4
sys/compat/linux/arch/amd64/linux_support.S: file removal
sys/compat/linux/common/linux_futex.c: revision 1.23
sys/compat/linux/arch/i386/linux_support.S: file removal
sys/compat/linux/arch/i386/files.linux_i386: revision 1.10
Switch Linux futex emulation to native ucas_int(), remove unecessary
futex-specific assembler routines.
Fixes PR/40490. Reviewed by <ad>.
 1.1.2.2 03-Mar-2009  skrll Sync with HEAD.
 1.1.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.2.8.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.2.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.2.6.1 20-Nov-2008  mjf file linux_support.S was added on branch mjf-devfs2 on 2009-01-17 13:28:43 +0000
 1.2.4.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.2.4.1 20-Nov-2008  haad file linux_support.S was added on branch haad-dm on 2008-12-13 01:13:53 +0000
 1.85 26-Oct-2025  christos regen
 1.84 28-Sep-2024  christos regen
 1.83 01-Jul-2024  christos regen
 1.82 29-Jun-2024  christos branches: 1.82.2;
regen
 1.81 19-Aug-2023  christos regen
 1.80 18-Aug-2023  christos regen
 1.79 29-Jul-2023  christos regen
 1.78 28-Jul-2023  christos regen
 1.77 10-Jul-2023  christos Regen
 1.76 02-Dec-2021  ryo regen
 1.75 20-Sep-2021  thorpej Regen for preadv(2) / pwritev(2).
 1.74 20-Sep-2021  thorpej Regen for eventfd.
 1.73 19-Sep-2021  thorpej Regen for timerfd.
 1.72 19-Sep-2021  thorpej Regen for POSIX timer syscalls.
 1.71 26-Apr-2020  thorpej branches: 1.71.2;
Regen for native futex calls.
 1.70 09-Nov-2019  jdolecek regen
 1.69 10-Aug-2018  pgoyette Regen
 1.68 10-May-2017  riastradh branches: 1.68.8; 1.68.10;
regen
 1.67 03-Feb-2017  christos branches: 1.67.4;
regen
 1.66 03-Feb-2017  christos add sendmmsg and recvmmsg
 1.65 02-Feb-2017  christos regen
 1.64 16-Jan-2017  christos regen all
 1.63 13-Jan-2017  christos branches: 1.63.2;
regen
 1.62 02-Jan-2017  martin Regen (something apparently went wrong in previous)
 1.61 02-Jan-2017  manu Regen
 1.60 24-Jul-2016  njoly Regen for readlink/readlinkat signatures.
 1.59 27-Oct-2015  njoly branches: 1.59.2;
Regen
 1.58 24-Sep-2015  christos regen
 1.57 31-May-2015  njoly Regen for write(2) size argument fix.
 1.56 07-Mar-2015  christos regen
 1.55 22-Nov-2014  njoly branches: 1.55.2;
Regen for ppoll signature fix
 1.54 31-May-2014  njoly branches: 1.54.2;
Regen for munmap(2) signature.
 1.53 29-May-2014  njoly Regen for utimes(2) change.
 1.52 20-May-2014  njoly Regen for getgroups/setgroups update.
 1.51 17-May-2014  njoly Regen for fadvise64 offset types changes.
 1.50 04-May-2014  njoly Regen for pread/pwrite 64bit offset argument.
 1.49 08-Apr-2014  njoly Regen.
 1.48 08-Dec-2013  njoly branches: 1.48.2;
Regen.
 1.47 18-Nov-2013  chs regen
 1.46 07-Nov-2013  njoly Regen for dup/dup2/dup3 argument types fix.
 1.45 24-Sep-2013  njoly Regen for utimensat(2).
 1.44 08-Apr-2013  pooka branches: 1.44.4;
regen for utimes
 1.43 19-Sep-2012  pooka regen for ppoll (and, apparently, SYCALL_ARG_PTR)
 1.42 18-Nov-2011  christos branches: 1.42.10;
- add sigtimedwait support.
- merge the siginfo population code.
 1.41 30-May-2011  alnsn branches: 1.41.4;
Regenerate files to pick up correct RCS Ids. Suggested by Chris Badura.
 1.40 30-May-2011  alnsn Add fadvise64 and fadvise64_64 syscalls to compat_linux and compat_linux32.
 1.39 10-Apr-2011  christos Regen: Argh:
cat: rumphdr.types: No such file or directory
rm: rumphdr.types: No such file or directory
*** Error code 1
 1.38 07-Jul-2010  chs branches: 1.38.2;
regen
 1.37 14-Dec-2009  matt branches: 1.37.2; 1.37.4;
Regen (new makesyscalls.sh)
 1.36 24-Nov-2009  njoly Regen for personality(2) update.
 1.35 30-Oct-2009  njoly Regen for struct linux_stat64 fix.
 1.34 17-Jun-2009  njoly Regen for sendmsg/recvmsg definitions update.
 1.33 08-Jun-2009  njoly Regen for rt_queueinfo(2) update.
 1.32 17-Jan-2009  njoly branches: 1.32.2;
Regen for wait4 update.
 1.31 15-Jan-2009  njoly Rengen for compat50 update.
 1.30 13-Jan-2009  pooka Regen to prove I didn't screw up the conversion: purely RCSID changes.
 1.29 13-Jan-2009  pooka regen for #include "opt_compat_netbsd.h"
 1.28 11-Jan-2009  christos merge christos-time_t
 1.27 19-Nov-2008  ad branches: 1.27.4;
Regen.
 1.26 19-Nov-2008  njoly Regen for futex timeout argument cleanup/fix.
 1.25 12-Nov-2008  njoly Regen for nanosleep(2) fix.
 1.24 26-Oct-2008  christos branches: 1.24.2; 1.24.4;
regen.
 1.23 04-Apr-2008  njoly branches: 1.23.4; 1.23.6; 1.23.10;
Regen for linux_sys_msync removal.
 1.22 24-Dec-2007  njoly branches: 1.22.6;
Regen for linux_sys_getpgid removal.
 1.21 21-Dec-2007  njoly Regen for getfsuid/setfsgid syscall exchange.
 1.20 20-Dec-2007  dsl regen
 1.19 16-Nov-2007  njoly branches: 1.19.2; 1.19.6;
Regen, for syscalls cleanup.
 1.18 14-Mar-2007  njoly branches: 1.18.10; 1.18.12; 1.18.16; 1.18.18;
Regen (statfs/fstatfs fixes).
 1.17 04-Mar-2007  christos branches: 1.17.2; 1.17.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.16 01-Sep-2006  matt branches: 1.16.6; 1.16.8;
Regen.
 1.15 30-Aug-2006  matt Regen
 1.14 24-Aug-2006  manu The return value for Linux shmat on amd64 does not suffer the same horrible
hack as on i386.
 1.13 25-Jun-2006  manu Regen
 1.12 25-Jun-2006  manu - Complete exit_group() implementation. We now maintain a list of Linux
threads in a processes and kill them properly. The code is a bit too
complicated, but I could not find a simplier way of dealing with it

- Change getpid() and getppid() semantics to match what Linux does,
and implement gettid(). In the Linux kernel, threads are implemnted
as plain old processes. A thread group is just a set of processes,
with the parent called leader. Thread ID, which are returned by gettid(),
are just the PID of the plain old processes, and getpid() returns the
PID of the thread group leader.

- Remove struct linux32_emuldata. COMPAT_LINUX32 uses a lot of COMPAT_LINUX
code, where a struct linux_emuldata is assumed. By having distinct emuldata
structure with different sizes and layouts, we caused kernel memory
corruptions.

- Fix setprioriry() and getpriority()

Thanks to Nicolas Joly for tracking down the problem and providing me the
hardware to fix them.
 1.11 10-Jun-2006  christos branches: 1.11.2;
regen
 1.10 09-Feb-2006  manu branches: 1.10.2; 1.10.8;
Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.9 23-Nov-2005  manu branches: 1.9.2; 1.9.4; 1.9.6;
- Add Linux tkill and tgkill (partial emulation).
- Fix getrlimit on amd64
 1.8 05-Nov-2005  manu branches: 1.8.2; 1.8.4;
regen
 1.7 04-Nov-2005  manu regen
 1.6 18-Oct-2005  joerg Regen.
 1.5 22-Jun-2005  manu branches: 1.5.2;
Implent CLONE_PARENT_SETTID, CLONE_CHILD_CLEARTID, and CLONE_CHILD_SETTID
options to clone(). This makes fork() work on amd64.

clone() prototype has changed and the changes is probably revelant on some
other arches.
 1.4 22-May-2005  fvdl Regen after sigreturn argument change.
 1.3 16-May-2005  fvdl Regen.
 1.2 16-May-2005  fvdl Regen.
 1.1 03-May-2005  manu First work on COMPAT_LINUX/amd64
Process startup and dynamiclinking work, but processes hang due to
Linux arch_prctl(2) not being really supported yet.
 1.5.2.5 21-Jan-2008  yamt sync with head
 1.5.2.4 07-Dec-2007  yamt sync with head
 1.5.2.3 03-Sep-2007  yamt sync with head.
 1.5.2.2 30-Dec-2006  yamt sync with head.
 1.5.2.1 21-Jun-2006  yamt sync with head.
 1.8.4.1 29-Nov-2005  yamt sync with head.
 1.8.2.3 11-Dec-2005  christos Sync with head.
 1.8.2.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.8.2.1 05-Nov-2005  skrll file linux_syscall.h was added on branch ktrace-lwp on 2005-11-10 14:00:59 +0000
 1.9.6.1 22-Apr-2006  simonb Sync with head.
 1.9.4.1 09-Sep-2006  rpaulo sync with head
 1.9.2.1 18-Feb-2006  yamt sync with head.
 1.10.8.1 19-Jun-2006  chap Sync with head.
 1.10.2.2 03-Sep-2006  yamt sync with head.
 1.10.2.1 26-Jun-2006  yamt sync with head.
 1.11.2.1 13-Jul-2006  gdamore Merge from HEAD.
 1.16.8.2 24-Mar-2007  yamt sync with head.
 1.16.8.1 12-Mar-2007  rmind Sync with HEAD.
 1.16.6.1 20-Apr-2007  bouyer regen for ticket #581
 1.17.4.1 11-Jul-2007  mjf Sync with head.
 1.17.2.1 10-Apr-2007  ad Sync with head.
 1.18.18.2 27-Dec-2007  mjf Sync with HEAD.
 1.18.18.1 19-Nov-2007  mjf Sync with HEAD.
 1.18.16.1 18-Nov-2007  bouyer Sync with HEAD
 1.18.12.1 09-Jan-2008  matt sync with HEAD
 1.18.10.1 21-Nov-2007  joerg Sync with HEAD.
 1.19.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.19.2.1 26-Dec-2007  ad Sync with head.
 1.22.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.22.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.23.10.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.23.6.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.23.4.4 11-Aug-2010  yamt sync with head.
 1.23.4.3 11-Mar-2010  yamt sync with head
 1.23.4.2 20-Jun-2009  yamt sync with head
 1.23.4.1 04-May-2009  yamt sync with head.
 1.24.4.1 20-Nov-2008  snj Regen for ticket 81.
 1.24.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.27.4.3 04-Jan-2009  christos need opt_compat_netbsd.h
 1.27.4.2 30-Dec-2008  christos time_t 64 changes.
 1.27.4.1 19-Nov-2008  christos file linux_syscall.h was added on branch christos-time_t on 2008-12-30 19:34:33 +0000
 1.32.2.1 23-Jul-2009  jym Sync with HEAD.
 1.37.4.3 31-May-2011  rmind sync with head
 1.37.4.2 21-Apr-2011  rmind sync with head
 1.37.4.1 05-Mar-2011  rmind sync with head
 1.37.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.38.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.41.4.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.41.4.2 30-Oct-2012  yamt sync with head
 1.41.4.1 17-Apr-2012  yamt sync with head
 1.42.10.4 03-Dec-2017  jdolecek update from HEAD
 1.42.10.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.42.10.2 23-Jun-2013  tls resync from head
 1.42.10.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.44.4.1 18-May-2014  rmind sync with head
 1.48.2.1 10-Aug-2014  tls Rebase.
 1.54.2.1 17-Apr-2017  snj regen for ticket 1354
 1.55.2.5 05-Feb-2017  skrll Sync with HEAD
 1.55.2.4 05-Oct-2016  skrll Sync with HEAD
 1.55.2.3 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.55.2.2 06-Jun-2015  skrll Sync with HEAD
 1.55.2.1 06-Apr-2015  skrll Sync with HEAD
 1.59.2.3 20-Mar-2017  pgoyette Sync with HEAD
 1.59.2.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.59.2.1 26-Jul-2016  pgoyette Sync with HEAD
 1.63.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.67.4.1 11-May-2017  pgoyette Sync with HEAD
 1.68.10.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.68.10.1 10-Jun-2019  christos Sync with HEAD
 1.68.8.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.71.2.2 17-Dec-2020  thorpej Regen for preadv(2) and pwritev(2).
 1.71.2.1 15-Dec-2020  thorpej Regen for eventfd, timerfd, POSIX timers.
 1.82.2.1 02-Aug-2025  perseant Sync with HEAD
 1.85 26-Oct-2025  christos regen
 1.84 28-Sep-2024  christos regen
 1.83 01-Jul-2024  christos regen
 1.82 29-Jun-2024  christos branches: 1.82.2;
regen
 1.81 19-Aug-2023  christos regen
 1.80 18-Aug-2023  christos regen
 1.79 29-Jul-2023  christos regen
 1.78 28-Jul-2023  christos regen
 1.77 10-Jul-2023  christos Regen
 1.76 02-Dec-2021  ryo regen
 1.75 20-Sep-2021  thorpej Regen for preadv(2) / pwritev(2).
 1.74 20-Sep-2021  thorpej Regen for eventfd.
 1.73 19-Sep-2021  thorpej Regen for timerfd.
 1.72 19-Sep-2021  thorpej Regen for POSIX timer syscalls.
 1.71 26-Apr-2020  thorpej branches: 1.71.2;
Regen for native futex calls.
 1.70 09-Nov-2019  jdolecek regen
 1.69 10-Aug-2018  pgoyette Regen
 1.68 10-May-2017  riastradh branches: 1.68.8; 1.68.10;
regen
 1.67 03-Feb-2017  christos branches: 1.67.4;
regen
 1.66 03-Feb-2017  christos add sendmmsg and recvmmsg
 1.65 02-Feb-2017  christos regen
 1.64 16-Jan-2017  christos regen all
 1.63 13-Jan-2017  christos branches: 1.63.2;
regen
 1.62 02-Jan-2017  martin Regen (something apparently went wrong in previous)
 1.61 02-Jan-2017  manu Regen
 1.60 24-Jul-2016  njoly Regen for readlink/readlinkat signatures.
 1.59 27-Oct-2015  njoly branches: 1.59.2;
Regen
 1.58 24-Sep-2015  christos regen
 1.57 31-May-2015  njoly Regen for write(2) size argument fix.
 1.56 07-Mar-2015  christos regen
 1.55 22-Nov-2014  njoly branches: 1.55.2;
Regen for ppoll signature fix
 1.54 31-May-2014  njoly branches: 1.54.2;
Regen for munmap(2) signature.
 1.53 29-May-2014  njoly Regen for utimes(2) change.
 1.52 20-May-2014  njoly Regen for getgroups/setgroups update.
 1.51 17-May-2014  njoly Regen for fadvise64 offset types changes.
 1.50 04-May-2014  njoly Regen for pread/pwrite 64bit offset argument.
 1.49 08-Apr-2014  njoly Regen.
 1.48 08-Dec-2013  njoly branches: 1.48.2;
Regen.
 1.47 18-Nov-2013  chs regen
 1.46 07-Nov-2013  njoly Regen for dup/dup2/dup3 argument types fix.
 1.45 24-Sep-2013  njoly Regen for utimensat(2).
 1.44 08-Apr-2013  pooka branches: 1.44.4;
regen for utimes
 1.43 19-Sep-2012  pooka regen for ppoll (and, apparently, SYCALL_ARG_PTR)
 1.42 18-Nov-2011  christos branches: 1.42.10;
- add sigtimedwait support.
- merge the siginfo population code.
 1.41 30-May-2011  alnsn branches: 1.41.4;
Regenerate files to pick up correct RCS Ids. Suggested by Chris Badura.
 1.40 30-May-2011  alnsn Add fadvise64 and fadvise64_64 syscalls to compat_linux and compat_linux32.
 1.39 10-Apr-2011  christos Regen: Argh:
cat: rumphdr.types: No such file or directory
rm: rumphdr.types: No such file or directory
*** Error code 1
 1.38 07-Jul-2010  chs branches: 1.38.2;
regen
 1.37 14-Dec-2009  matt branches: 1.37.2; 1.37.4;
Regen (new makesyscalls.sh)
 1.36 24-Nov-2009  njoly Regen for personality(2) update.
 1.35 30-Oct-2009  njoly Regen for struct linux_stat64 fix.
 1.34 17-Jun-2009  njoly Regen for sendmsg/recvmsg definitions update.
 1.33 08-Jun-2009  njoly Regen for rt_queueinfo(2) update.
 1.32 17-Jan-2009  njoly branches: 1.32.2;
Regen for wait4 update.
 1.31 15-Jan-2009  njoly Rengen for compat50 update.
 1.30 13-Jan-2009  pooka Regen to prove I didn't screw up the conversion: purely RCSID changes.
 1.29 13-Jan-2009  pooka regen for #include "opt_compat_netbsd.h"
 1.28 11-Jan-2009  christos merge christos-time_t
 1.27 19-Nov-2008  ad branches: 1.27.4;
Regen.
 1.26 19-Nov-2008  njoly Regen for futex timeout argument cleanup/fix.
 1.25 12-Nov-2008  njoly Regen for nanosleep(2) fix.
 1.24 26-Oct-2008  christos branches: 1.24.2; 1.24.4;
regen.
 1.23 04-Apr-2008  njoly branches: 1.23.4; 1.23.6; 1.23.10;
Regen for linux_sys_msync removal.
 1.22 24-Dec-2007  njoly branches: 1.22.6;
Regen for linux_sys_getpgid removal.
 1.21 21-Dec-2007  njoly Regen for getfsuid/setfsgid syscall exchange.
 1.20 20-Dec-2007  dsl regen
 1.19 16-Nov-2007  njoly branches: 1.19.2; 1.19.6;
Regen, for syscalls cleanup.
 1.18 14-Mar-2007  njoly branches: 1.18.10; 1.18.12; 1.18.16; 1.18.18;
Regen (statfs/fstatfs fixes).
 1.17 04-Mar-2007  christos branches: 1.17.2; 1.17.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.16 01-Sep-2006  matt branches: 1.16.6; 1.16.8;
Regen.
 1.15 30-Aug-2006  matt Regen
 1.14 24-Aug-2006  manu The return value for Linux shmat on amd64 does not suffer the same horrible
hack as on i386.
 1.13 25-Jun-2006  manu Regen
 1.12 25-Jun-2006  manu - Complete exit_group() implementation. We now maintain a list of Linux
threads in a processes and kill them properly. The code is a bit too
complicated, but I could not find a simplier way of dealing with it

- Change getpid() and getppid() semantics to match what Linux does,
and implement gettid(). In the Linux kernel, threads are implemnted
as plain old processes. A thread group is just a set of processes,
with the parent called leader. Thread ID, which are returned by gettid(),
are just the PID of the plain old processes, and getpid() returns the
PID of the thread group leader.

- Remove struct linux32_emuldata. COMPAT_LINUX32 uses a lot of COMPAT_LINUX
code, where a struct linux_emuldata is assumed. By having distinct emuldata
structure with different sizes and layouts, we caused kernel memory
corruptions.

- Fix setprioriry() and getpriority()

Thanks to Nicolas Joly for tracking down the problem and providing me the
hardware to fix them.
 1.11 10-Jun-2006  christos branches: 1.11.2;
regen
 1.10 09-Feb-2006  manu branches: 1.10.2; 1.10.8;
Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.9 23-Nov-2005  manu branches: 1.9.2; 1.9.4; 1.9.6;
- Add Linux tkill and tgkill (partial emulation).
- Fix getrlimit on amd64
 1.8 05-Nov-2005  manu branches: 1.8.2; 1.8.4;
regen
 1.7 04-Nov-2005  manu regen
 1.6 18-Oct-2005  joerg Regen.
 1.5 22-Jun-2005  manu branches: 1.5.2;
Implent CLONE_PARENT_SETTID, CLONE_CHILD_CLEARTID, and CLONE_CHILD_SETTID
options to clone(). This makes fork() work on amd64.

clone() prototype has changed and the changes is probably revelant on some
other arches.
 1.4 22-May-2005  fvdl Regen after sigreturn argument change.
 1.3 16-May-2005  fvdl Regen.
 1.2 16-May-2005  fvdl Regen.
 1.1 03-May-2005  manu First work on COMPAT_LINUX/amd64
Process startup and dynamiclinking work, but processes hang due to
Linux arch_prctl(2) not being really supported yet.
 1.5.2.5 21-Jan-2008  yamt sync with head
 1.5.2.4 07-Dec-2007  yamt sync with head
 1.5.2.3 03-Sep-2007  yamt sync with head.
 1.5.2.2 30-Dec-2006  yamt sync with head.
 1.5.2.1 21-Jun-2006  yamt sync with head.
 1.8.4.1 29-Nov-2005  yamt sync with head.
 1.8.2.3 11-Dec-2005  christos Sync with head.
 1.8.2.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.8.2.1 05-Nov-2005  skrll file linux_syscallargs.h was added on branch ktrace-lwp on 2005-11-10 14:00:59 +0000
 1.9.6.1 22-Apr-2006  simonb Sync with head.
 1.9.4.1 09-Sep-2006  rpaulo sync with head
 1.9.2.1 18-Feb-2006  yamt sync with head.
 1.10.8.1 19-Jun-2006  chap Sync with head.
 1.10.2.2 03-Sep-2006  yamt sync with head.
 1.10.2.1 26-Jun-2006  yamt sync with head.
 1.11.2.1 13-Jul-2006  gdamore Merge from HEAD.
 1.16.8.2 24-Mar-2007  yamt sync with head.
 1.16.8.1 12-Mar-2007  rmind Sync with HEAD.
 1.16.6.1 20-Apr-2007  bouyer regen for ticket #581
 1.17.4.1 11-Jul-2007  mjf Sync with head.
 1.17.2.1 10-Apr-2007  ad Sync with head.
 1.18.18.2 27-Dec-2007  mjf Sync with HEAD.
 1.18.18.1 19-Nov-2007  mjf Sync with HEAD.
 1.18.16.1 18-Nov-2007  bouyer Sync with HEAD
 1.18.12.1 09-Jan-2008  matt sync with HEAD
 1.18.10.1 21-Nov-2007  joerg Sync with HEAD.
 1.19.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.19.2.1 26-Dec-2007  ad Sync with head.
 1.22.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.22.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.23.10.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.23.6.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.23.4.4 11-Aug-2010  yamt sync with head.
 1.23.4.3 11-Mar-2010  yamt sync with head
 1.23.4.2 20-Jun-2009  yamt sync with head
 1.23.4.1 04-May-2009  yamt sync with head.
 1.24.4.1 20-Nov-2008  snj Regen for ticket 81.
 1.24.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.27.4.3 04-Jan-2009  christos need opt_compat_netbsd.h
 1.27.4.2 30-Dec-2008  christos time_t 64 changes.
 1.27.4.1 19-Nov-2008  christos file linux_syscallargs.h was added on branch christos-time_t on 2008-12-30 19:34:33 +0000
 1.32.2.1 23-Jul-2009  jym Sync with HEAD.
 1.37.4.3 31-May-2011  rmind sync with head
 1.37.4.2 21-Apr-2011  rmind sync with head
 1.37.4.1 05-Mar-2011  rmind sync with head
 1.37.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.38.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.41.4.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.41.4.2 30-Oct-2012  yamt sync with head
 1.41.4.1 17-Apr-2012  yamt sync with head
 1.42.10.4 03-Dec-2017  jdolecek update from HEAD
 1.42.10.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.42.10.2 23-Jun-2013  tls resync from head
 1.42.10.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.44.4.1 18-May-2014  rmind sync with head
 1.48.2.1 10-Aug-2014  tls Rebase.
 1.54.2.1 17-Apr-2017  snj regen for ticket 1354
 1.55.2.6 28-Aug-2017  skrll Sync with HEAD
 1.55.2.5 05-Feb-2017  skrll Sync with HEAD
 1.55.2.4 05-Oct-2016  skrll Sync with HEAD
 1.55.2.3 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.55.2.2 06-Jun-2015  skrll Sync with HEAD
 1.55.2.1 06-Apr-2015  skrll Sync with HEAD
 1.59.2.3 20-Mar-2017  pgoyette Sync with HEAD
 1.59.2.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.59.2.1 26-Jul-2016  pgoyette Sync with HEAD
 1.63.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.67.4.1 11-May-2017  pgoyette Sync with HEAD
 1.68.10.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.68.10.1 10-Jun-2019  christos Sync with HEAD
 1.68.8.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.71.2.2 17-Dec-2020  thorpej Regen for preadv(2) and pwritev(2).
 1.71.2.1 15-Dec-2020  thorpej Regen for eventfd, timerfd, POSIX timers.
 1.82.2.1 02-Aug-2025  perseant Sync with HEAD
 1.85 26-Oct-2025  christos regen
 1.84 28-Sep-2024  christos regen
 1.83 01-Jul-2024  christos regen
 1.82 29-Jun-2024  christos branches: 1.82.2;
regen
 1.81 19-Aug-2023  christos regen
 1.80 18-Aug-2023  christos regen
 1.79 29-Jul-2023  christos regen
 1.78 28-Jul-2023  christos regen
 1.77 10-Jul-2023  christos Regen
 1.76 02-Dec-2021  ryo regen
 1.75 20-Sep-2021  thorpej Regen for preadv(2) / pwritev(2).
 1.74 20-Sep-2021  thorpej Regen for eventfd.
 1.73 19-Sep-2021  thorpej Regen for timerfd.
 1.72 19-Sep-2021  thorpej Regen for POSIX timer syscalls.
 1.71 26-Apr-2020  thorpej branches: 1.71.2;
Regen for native futex calls.
 1.70 09-Nov-2019  jdolecek regen
 1.69 10-Aug-2018  pgoyette Regen
 1.68 10-May-2017  riastradh branches: 1.68.8; 1.68.10;
regen
 1.67 03-Feb-2017  christos branches: 1.67.4;
regen
 1.66 03-Feb-2017  christos add sendmmsg and recvmmsg
 1.65 02-Feb-2017  christos regen
 1.64 16-Jan-2017  christos regen all
 1.63 13-Jan-2017  christos branches: 1.63.2;
regen
 1.62 02-Jan-2017  martin Regen (something apparently went wrong in previous)
 1.61 02-Jan-2017  manu Regen
 1.60 24-Jul-2016  njoly Regen for readlink/readlinkat signatures.
 1.59 27-Oct-2015  njoly branches: 1.59.2;
Regen
 1.58 24-Sep-2015  christos regen
 1.57 31-May-2015  njoly Regen for write(2) size argument fix.
 1.56 07-Mar-2015  christos regen
 1.55 22-Nov-2014  njoly branches: 1.55.2;
Regen for ppoll signature fix
 1.54 31-May-2014  njoly branches: 1.54.2;
Regen for munmap(2) signature.
 1.53 29-May-2014  njoly Regen for utimes(2) change.
 1.52 20-May-2014  njoly Regen for getgroups/setgroups update.
 1.51 17-May-2014  njoly Regen for fadvise64 offset types changes.
 1.50 04-May-2014  njoly Regen for pread/pwrite 64bit offset argument.
 1.49 08-Apr-2014  njoly Regen.
 1.48 08-Dec-2013  njoly branches: 1.48.2;
Regen.
 1.47 18-Nov-2013  chs regen
 1.46 07-Nov-2013  njoly Regen for dup/dup2/dup3 argument types fix.
 1.45 24-Sep-2013  njoly Regen for utimensat(2).
 1.44 08-Apr-2013  pooka branches: 1.44.4;
regen for utimes
 1.43 19-Sep-2012  pooka regen for ppoll (and, apparently, SYCALL_ARG_PTR)
 1.42 18-Nov-2011  christos branches: 1.42.10;
- add sigtimedwait support.
- merge the siginfo population code.
 1.41 30-May-2011  alnsn branches: 1.41.4;
Regenerate files to pick up correct RCS Ids. Suggested by Chris Badura.
 1.40 30-May-2011  alnsn Add fadvise64 and fadvise64_64 syscalls to compat_linux and compat_linux32.
 1.39 10-Apr-2011  christos Regen: Argh:
cat: rumphdr.types: No such file or directory
rm: rumphdr.types: No such file or directory
*** Error code 1
 1.38 07-Jul-2010  chs branches: 1.38.2;
regen
 1.37 14-Dec-2009  matt branches: 1.37.2; 1.37.4;
Regen (new makesyscalls.sh)
 1.36 24-Nov-2009  njoly Regen for personality(2) update.
 1.35 30-Oct-2009  njoly Regen for struct linux_stat64 fix.
 1.34 17-Jun-2009  njoly Regen for sendmsg/recvmsg definitions update.
 1.33 08-Jun-2009  njoly Regen for rt_queueinfo(2) update.
 1.32 17-Jan-2009  njoly branches: 1.32.2;
Regen for wait4 update.
 1.31 15-Jan-2009  njoly Rengen for compat50 update.
 1.30 13-Jan-2009  pooka Regen to prove I didn't screw up the conversion: purely RCSID changes.
 1.29 13-Jan-2009  pooka regen for #include "opt_compat_netbsd.h"
 1.28 11-Jan-2009  christos merge christos-time_t
 1.27 19-Nov-2008  ad branches: 1.27.4;
Regen.
 1.26 19-Nov-2008  njoly Regen for futex timeout argument cleanup/fix.
 1.25 12-Nov-2008  njoly Regen for nanosleep(2) fix.
 1.24 26-Oct-2008  christos branches: 1.24.2; 1.24.4;
regen.
 1.23 04-Apr-2008  njoly branches: 1.23.4; 1.23.6; 1.23.10;
Regen for linux_sys_msync removal.
 1.22 24-Dec-2007  njoly branches: 1.22.6;
Regen for linux_sys_getpgid removal.
 1.21 21-Dec-2007  njoly Regen for getfsuid/setfsgid syscall exchange.
 1.20 20-Dec-2007  dsl regen
 1.19 16-Nov-2007  njoly branches: 1.19.2; 1.19.6;
Regen, for syscalls cleanup.
 1.18 14-Mar-2007  njoly branches: 1.18.10; 1.18.12; 1.18.16; 1.18.18;
Regen (statfs/fstatfs fixes).
 1.17 09-Feb-2007  ad branches: 1.17.2; 1.17.6; 1.17.8;
Merge newlock2 to head.
 1.16 01-Sep-2006  matt branches: 1.16.2; 1.16.6;
Regen.
 1.15 30-Aug-2006  matt Regen
 1.14 24-Aug-2006  manu The return value for Linux shmat on amd64 does not suffer the same horrible
hack as on i386.
 1.13 25-Jun-2006  manu Regen
 1.12 25-Jun-2006  manu - Complete exit_group() implementation. We now maintain a list of Linux
threads in a processes and kill them properly. The code is a bit too
complicated, but I could not find a simplier way of dealing with it

- Change getpid() and getppid() semantics to match what Linux does,
and implement gettid(). In the Linux kernel, threads are implemnted
as plain old processes. A thread group is just a set of processes,
with the parent called leader. Thread ID, which are returned by gettid(),
are just the PID of the plain old processes, and getpid() returns the
PID of the thread group leader.

- Remove struct linux32_emuldata. COMPAT_LINUX32 uses a lot of COMPAT_LINUX
code, where a struct linux_emuldata is assumed. By having distinct emuldata
structure with different sizes and layouts, we caused kernel memory
corruptions.

- Fix setprioriry() and getpriority()

Thanks to Nicolas Joly for tracking down the problem and providing me the
hardware to fix them.
 1.11 10-Jun-2006  christos branches: 1.11.2;
regen
 1.10 09-Feb-2006  manu branches: 1.10.2; 1.10.8;
Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.9 23-Nov-2005  manu branches: 1.9.2; 1.9.4; 1.9.6;
- Add Linux tkill and tgkill (partial emulation).
- Fix getrlimit on amd64
 1.8 05-Nov-2005  manu branches: 1.8.2; 1.8.4;
regen
 1.7 04-Nov-2005  manu regen
 1.6 18-Oct-2005  joerg Regen.
 1.5 22-Jun-2005  manu branches: 1.5.2;
Implent CLONE_PARENT_SETTID, CLONE_CHILD_CLEARTID, and CLONE_CHILD_SETTID
options to clone(). This makes fork() work on amd64.

clone() prototype has changed and the changes is probably revelant on some
other arches.
 1.4 22-May-2005  fvdl Regen after sigreturn argument change.
 1.3 16-May-2005  fvdl Regen.
 1.2 16-May-2005  fvdl Regen.
 1.1 03-May-2005  manu First work on COMPAT_LINUX/amd64
Process startup and dynamiclinking work, but processes hang due to
Linux arch_prctl(2) not being really supported yet.
 1.5.2.6 21-Jan-2008  yamt sync with head
 1.5.2.5 07-Dec-2007  yamt sync with head
 1.5.2.4 03-Sep-2007  yamt sync with head.
 1.5.2.3 26-Feb-2007  yamt sync with head.
 1.5.2.2 30-Dec-2006  yamt sync with head.
 1.5.2.1 21-Jun-2006  yamt sync with head.
 1.8.4.1 29-Nov-2005  yamt sync with head.
 1.8.2.3 11-Dec-2005  christos Sync with head.
 1.8.2.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.8.2.1 05-Nov-2005  skrll file linux_syscalls.c was added on branch ktrace-lwp on 2005-11-10 14:00:59 +0000
 1.9.6.1 22-Apr-2006  simonb Sync with head.
 1.9.4.1 09-Sep-2006  rpaulo sync with head
 1.9.2.1 18-Feb-2006  yamt sync with head.
 1.10.8.1 19-Jun-2006  chap Sync with head.
 1.10.2.2 03-Sep-2006  yamt sync with head.
 1.10.2.1 26-Jun-2006  yamt sync with head.
 1.11.2.1 13-Jul-2006  gdamore Merge from HEAD.
 1.16.6.1 20-Apr-2007  bouyer regen for ticket #581
 1.16.2.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.17.8.1 11-Jul-2007  mjf Sync with head.
 1.17.6.1 10-Apr-2007  ad Sync with head.
 1.17.2.1 24-Mar-2007  yamt sync with head.
 1.18.18.2 27-Dec-2007  mjf Sync with HEAD.
 1.18.18.1 19-Nov-2007  mjf Sync with HEAD.
 1.18.16.1 18-Nov-2007  bouyer Sync with HEAD
 1.18.12.1 09-Jan-2008  matt sync with HEAD
 1.18.10.1 21-Nov-2007  joerg Sync with HEAD.
 1.19.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.19.2.1 26-Dec-2007  ad Sync with head.
 1.22.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.22.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.23.10.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.23.6.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.23.6.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.23.4.4 11-Aug-2010  yamt sync with head.
 1.23.4.3 11-Mar-2010  yamt sync with head
 1.23.4.2 20-Jun-2009  yamt sync with head
 1.23.4.1 04-May-2009  yamt sync with head.
 1.24.4.1 20-Nov-2008  snj Regen for ticket 81.
 1.24.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.27.4.3 04-Jan-2009  christos need opt_compat_netbsd.h
 1.27.4.2 30-Dec-2008  christos time_t 64 changes.
 1.27.4.1 19-Nov-2008  christos file linux_syscalls.c was added on branch christos-time_t on 2008-12-30 19:34:33 +0000
 1.32.2.1 23-Jul-2009  jym Sync with HEAD.
 1.37.4.3 31-May-2011  rmind sync with head
 1.37.4.2 21-Apr-2011  rmind sync with head
 1.37.4.1 05-Mar-2011  rmind sync with head
 1.37.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.38.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.41.4.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.41.4.2 30-Oct-2012  yamt sync with head
 1.41.4.1 17-Apr-2012  yamt sync with head
 1.42.10.4 03-Dec-2017  jdolecek update from HEAD
 1.42.10.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.42.10.2 23-Jun-2013  tls resync from head
 1.42.10.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.44.4.1 18-May-2014  rmind sync with head
 1.48.2.1 10-Aug-2014  tls Rebase.
 1.54.2.1 17-Apr-2017  snj regen for ticket 1354
 1.55.2.5 05-Feb-2017  skrll Sync with HEAD
 1.55.2.4 05-Oct-2016  skrll Sync with HEAD
 1.55.2.3 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.55.2.2 06-Jun-2015  skrll Sync with HEAD
 1.55.2.1 06-Apr-2015  skrll Sync with HEAD
 1.59.2.3 20-Mar-2017  pgoyette Sync with HEAD
 1.59.2.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.59.2.1 26-Jul-2016  pgoyette Sync with HEAD
 1.63.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.67.4.1 11-May-2017  pgoyette Sync with HEAD
 1.68.10.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.68.10.1 10-Jun-2019  christos Sync with HEAD
 1.68.8.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.71.2.2 17-Dec-2020  thorpej Regen for preadv(2) and pwritev(2).
 1.71.2.1 15-Dec-2020  thorpej Regen for eventfd, timerfd, POSIX timers.
 1.82.2.1 02-Aug-2025  perseant Sync with HEAD
 1.85 26-Oct-2025  christos regen
 1.84 28-Sep-2024  christos regen
 1.83 01-Jul-2024  christos regen
 1.82 29-Jun-2024  christos branches: 1.82.2;
regen
 1.81 19-Aug-2023  christos regen
 1.80 18-Aug-2023  christos regen
 1.79 29-Jul-2023  christos regen
 1.78 28-Jul-2023  christos regen
 1.77 10-Jul-2023  christos Regen
 1.76 02-Dec-2021  ryo regen
 1.75 20-Sep-2021  thorpej Regen for preadv(2) / pwritev(2).
 1.74 20-Sep-2021  thorpej Regen for eventfd.
 1.73 19-Sep-2021  thorpej Regen for timerfd.
 1.72 19-Sep-2021  thorpej Regen for POSIX timer syscalls.
 1.71 26-Apr-2020  thorpej branches: 1.71.2;
Regen for native futex calls.
 1.70 09-Nov-2019  jdolecek regen
 1.69 10-Aug-2018  pgoyette Regen
 1.68 10-May-2017  riastradh branches: 1.68.8; 1.68.10;
regen
 1.67 03-Feb-2017  christos branches: 1.67.4;
regen
 1.66 03-Feb-2017  christos add sendmmsg and recvmmsg
 1.65 02-Feb-2017  christos regen
 1.64 16-Jan-2017  christos regen all
 1.63 13-Jan-2017  christos branches: 1.63.2;
regen
 1.62 02-Jan-2017  martin Regen (something apparently went wrong in previous)
 1.61 02-Jan-2017  manu Regen
 1.60 24-Jul-2016  njoly Regen for readlink/readlinkat signatures.
 1.59 27-Oct-2015  njoly branches: 1.59.2;
Regen
 1.58 24-Sep-2015  christos regen
 1.57 31-May-2015  njoly Regen for write(2) size argument fix.
 1.56 07-Mar-2015  christos regen
 1.55 22-Nov-2014  njoly branches: 1.55.2;
Regen for ppoll signature fix
 1.54 31-May-2014  njoly branches: 1.54.2;
Regen for munmap(2) signature.
 1.53 29-May-2014  njoly Regen for utimes(2) change.
 1.52 20-May-2014  njoly Regen for getgroups/setgroups update.
 1.51 17-May-2014  njoly Regen for fadvise64 offset types changes.
 1.50 04-May-2014  njoly Regen for pread/pwrite 64bit offset argument.
 1.49 08-Apr-2014  njoly Regen.
 1.48 08-Dec-2013  njoly branches: 1.48.2;
Regen.
 1.47 18-Nov-2013  chs regen
 1.46 07-Nov-2013  njoly Regen for dup/dup2/dup3 argument types fix.
 1.45 24-Sep-2013  njoly Regen for utimensat(2).
 1.44 08-Apr-2013  pooka branches: 1.44.4;
regen for utimes
 1.43 19-Sep-2012  pooka regen for ppoll (and, apparently, SYCALL_ARG_PTR)
 1.42 18-Nov-2011  christos branches: 1.42.10;
- add sigtimedwait support.
- merge the siginfo population code.
 1.41 30-May-2011  alnsn branches: 1.41.4;
Regenerate files to pick up correct RCS Ids. Suggested by Chris Badura.
 1.40 30-May-2011  alnsn Add fadvise64 and fadvise64_64 syscalls to compat_linux and compat_linux32.
 1.39 10-Apr-2011  christos Regen: Argh:
cat: rumphdr.types: No such file or directory
rm: rumphdr.types: No such file or directory
*** Error code 1
 1.38 07-Jul-2010  chs branches: 1.38.2;
regen
 1.37 14-Dec-2009  matt branches: 1.37.2; 1.37.4;
Regen (new makesyscalls.sh)
 1.36 24-Nov-2009  njoly Regen for personality(2) update.
 1.35 30-Oct-2009  njoly Regen for struct linux_stat64 fix.
 1.34 17-Jun-2009  njoly Regen for sendmsg/recvmsg definitions update.
 1.33 08-Jun-2009  njoly Regen for rt_queueinfo(2) update.
 1.32 17-Jan-2009  njoly branches: 1.32.2;
Regen for wait4 update.
 1.31 15-Jan-2009  njoly Rengen for compat50 update.
 1.30 13-Jan-2009  pooka Regen to prove I didn't screw up the conversion: purely RCSID changes.
 1.29 13-Jan-2009  pooka regen for #include "opt_compat_netbsd.h"
 1.28 11-Jan-2009  christos merge christos-time_t
 1.27 19-Nov-2008  ad branches: 1.27.4;
Regen.
 1.26 19-Nov-2008  njoly Regen for futex timeout argument cleanup/fix.
 1.25 12-Nov-2008  njoly Regen for nanosleep(2) fix.
 1.24 26-Oct-2008  christos branches: 1.24.2; 1.24.4;
regen.
 1.23 04-Apr-2008  njoly branches: 1.23.4; 1.23.6; 1.23.10;
Regen for linux_sys_msync removal.
 1.22 24-Dec-2007  njoly branches: 1.22.6;
Regen for linux_sys_getpgid removal.
 1.21 21-Dec-2007  njoly Regen for getfsuid/setfsgid syscall exchange.
 1.20 20-Dec-2007  dsl regen
 1.19 16-Nov-2007  njoly branches: 1.19.2; 1.19.6;
Regen, for syscalls cleanup.
 1.18 14-Mar-2007  njoly branches: 1.18.10; 1.18.12; 1.18.16; 1.18.18;
Regen (statfs/fstatfs fixes).
 1.17 09-Feb-2007  ad branches: 1.17.2; 1.17.6; 1.17.8;
Merge newlock2 to head.
 1.16 01-Sep-2006  matt branches: 1.16.2; 1.16.6;
Regen.
 1.15 30-Aug-2006  matt Regen
 1.14 24-Aug-2006  manu The return value for Linux shmat on amd64 does not suffer the same horrible
hack as on i386.
 1.13 25-Jun-2006  manu Regen
 1.12 25-Jun-2006  manu - Complete exit_group() implementation. We now maintain a list of Linux
threads in a processes and kill them properly. The code is a bit too
complicated, but I could not find a simplier way of dealing with it

- Change getpid() and getppid() semantics to match what Linux does,
and implement gettid(). In the Linux kernel, threads are implemnted
as plain old processes. A thread group is just a set of processes,
with the parent called leader. Thread ID, which are returned by gettid(),
are just the PID of the plain old processes, and getpid() returns the
PID of the thread group leader.

- Remove struct linux32_emuldata. COMPAT_LINUX32 uses a lot of COMPAT_LINUX
code, where a struct linux_emuldata is assumed. By having distinct emuldata
structure with different sizes and layouts, we caused kernel memory
corruptions.

- Fix setprioriry() and getpriority()

Thanks to Nicolas Joly for tracking down the problem and providing me the
hardware to fix them.
 1.11 10-Jun-2006  christos branches: 1.11.2;
regen
 1.10 09-Feb-2006  manu branches: 1.10.2; 1.10.8;
Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.9 23-Nov-2005  manu branches: 1.9.2; 1.9.4; 1.9.6;
- Add Linux tkill and tgkill (partial emulation).
- Fix getrlimit on amd64
 1.8 05-Nov-2005  manu branches: 1.8.2; 1.8.4;
regen
 1.7 04-Nov-2005  manu regen
 1.6 18-Oct-2005  joerg Regen.
 1.5 22-Jun-2005  manu branches: 1.5.2;
Implent CLONE_PARENT_SETTID, CLONE_CHILD_CLEARTID, and CLONE_CHILD_SETTID
options to clone(). This makes fork() work on amd64.

clone() prototype has changed and the changes is probably revelant on some
other arches.
 1.4 22-May-2005  fvdl Regen after sigreturn argument change.
 1.3 16-May-2005  fvdl Regen.
 1.2 16-May-2005  fvdl Regen.
 1.1 03-May-2005  manu First work on COMPAT_LINUX/amd64
Process startup and dynamiclinking work, but processes hang due to
Linux arch_prctl(2) not being really supported yet.
 1.5.2.6 21-Jan-2008  yamt sync with head
 1.5.2.5 07-Dec-2007  yamt sync with head
 1.5.2.4 03-Sep-2007  yamt sync with head.
 1.5.2.3 26-Feb-2007  yamt sync with head.
 1.5.2.2 30-Dec-2006  yamt sync with head.
 1.5.2.1 21-Jun-2006  yamt sync with head.
 1.8.4.1 29-Nov-2005  yamt sync with head.
 1.8.2.3 11-Dec-2005  christos Sync with head.
 1.8.2.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.8.2.1 05-Nov-2005  skrll file linux_sysent.c was added on branch ktrace-lwp on 2005-11-10 14:00:59 +0000
 1.9.6.1 22-Apr-2006  simonb Sync with head.
 1.9.4.1 09-Sep-2006  rpaulo sync with head
 1.9.2.1 18-Feb-2006  yamt sync with head.
 1.10.8.1 19-Jun-2006  chap Sync with head.
 1.10.2.2 03-Sep-2006  yamt sync with head.
 1.10.2.1 26-Jun-2006  yamt sync with head.
 1.11.2.1 13-Jul-2006  gdamore Merge from HEAD.
 1.16.6.1 20-Apr-2007  bouyer regen for ticket #581
 1.16.2.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.17.8.1 11-Jul-2007  mjf Sync with head.
 1.17.6.1 10-Apr-2007  ad Sync with head.
 1.17.2.1 24-Mar-2007  yamt sync with head.
 1.18.18.2 27-Dec-2007  mjf Sync with HEAD.
 1.18.18.1 19-Nov-2007  mjf Sync with HEAD.
 1.18.16.1 18-Nov-2007  bouyer Sync with HEAD
 1.18.12.1 09-Jan-2008  matt sync with HEAD
 1.18.10.1 21-Nov-2007  joerg Sync with HEAD.
 1.19.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.19.2.1 26-Dec-2007  ad Sync with head.
 1.22.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.22.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.23.10.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.23.6.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.23.6.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.23.4.4 11-Aug-2010  yamt sync with head.
 1.23.4.3 11-Mar-2010  yamt sync with head
 1.23.4.2 20-Jun-2009  yamt sync with head
 1.23.4.1 04-May-2009  yamt sync with head.
 1.24.4.1 20-Nov-2008  snj Regen for ticket 81.
 1.24.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.27.4.3 04-Jan-2009  christos need opt_compat_netbsd.h
 1.27.4.2 30-Dec-2008  christos time_t 64 changes.
 1.27.4.1 19-Nov-2008  christos file linux_sysent.c was added on branch christos-time_t on 2008-12-30 19:34:33 +0000
 1.32.2.1 23-Jul-2009  jym Sync with HEAD.
 1.37.4.3 31-May-2011  rmind sync with head
 1.37.4.2 21-Apr-2011  rmind sync with head
 1.37.4.1 05-Mar-2011  rmind sync with head
 1.37.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.38.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.41.4.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.41.4.2 30-Oct-2012  yamt sync with head
 1.41.4.1 17-Apr-2012  yamt sync with head
 1.42.10.4 03-Dec-2017  jdolecek update from HEAD
 1.42.10.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.42.10.2 23-Jun-2013  tls resync from head
 1.42.10.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.44.4.1 18-May-2014  rmind sync with head
 1.48.2.1 10-Aug-2014  tls Rebase.
 1.54.2.1 17-Apr-2017  snj regen for ticket 1354
 1.55.2.5 05-Feb-2017  skrll Sync with HEAD
 1.55.2.4 05-Oct-2016  skrll Sync with HEAD
 1.55.2.3 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.55.2.2 06-Jun-2015  skrll Sync with HEAD
 1.55.2.1 06-Apr-2015  skrll Sync with HEAD
 1.59.2.3 20-Mar-2017  pgoyette Sync with HEAD
 1.59.2.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.59.2.1 26-Jul-2016  pgoyette Sync with HEAD
 1.63.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.67.4.1 11-May-2017  pgoyette Sync with HEAD
 1.68.10.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.68.10.1 10-Jun-2019  christos Sync with HEAD
 1.68.8.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.71.2.2 17-Dec-2020  thorpej Regen for preadv(2) and pwritev(2).
 1.71.2.1 15-Dec-2020  thorpej Regen for eventfd, timerfd, POSIX timers.
 1.82.2.1 02-Aug-2025  perseant Sync with HEAD
 1.29 26-Oct-2025  christos regen
 1.28 28-Sep-2024  christos regen
 1.27 01-Jul-2024  christos regen
 1.26 29-Jun-2024  christos branches: 1.26.2;
regen
 1.25 19-Aug-2023  christos regen
 1.24 18-Aug-2023  christos regen
 1.23 29-Jul-2023  christos regen
 1.22 28-Jul-2023  christos regen
 1.21 10-Jul-2023  christos Regen
 1.20 02-Dec-2021  ryo regen
 1.19 20-Sep-2021  thorpej Regen for preadv(2) / pwritev(2).
 1.18 20-Sep-2021  thorpej Regen for eventfd.
 1.17 19-Sep-2021  thorpej Regen for timerfd.
 1.16 19-Sep-2021  thorpej Regen for POSIX timer syscalls.
 1.15 26-Apr-2020  thorpej branches: 1.15.2;
Regen for native futex calls.
 1.14 09-Nov-2019  jdolecek regen
 1.13 10-Aug-2018  pgoyette Regen
 1.12 10-May-2017  riastradh branches: 1.12.8; 1.12.10; 1.12.12;
regen
 1.11 03-Feb-2017  christos branches: 1.11.4;
regen
 1.10 03-Feb-2017  christos add sendmmsg and recvmmsg
 1.9 02-Feb-2017  christos regen
 1.8 16-Jan-2017  christos regen all
 1.7 13-Jan-2017  christos branches: 1.7.2;
regen
 1.6 02-Jan-2017  martin Regen (something apparently went wrong in previous)
 1.5 24-Jul-2016  njoly Regen for readlink/readlinkat signatures.
 1.4 27-Oct-2015  njoly branches: 1.4.2;
Regen
 1.3 24-Sep-2015  christos regen
 1.2 31-May-2015  njoly Regen for write(2) size argument fix.
 1.1 07-Mar-2015  christos branches: 1.1.2;
regen
 1.1.2.6 05-Feb-2017  skrll Sync with HEAD
 1.1.2.5 05-Oct-2016  skrll Sync with HEAD
 1.1.2.4 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.1.2.3 06-Jun-2015  skrll Sync with HEAD
 1.1.2.2 06-Apr-2015  skrll Sync with HEAD
 1.1.2.1 07-Mar-2015  skrll file linux_systrace_args.c was added on branch nick-nhusb on 2015-04-06 15:18:05 +0000
 1.4.2.3 20-Mar-2017  pgoyette Sync with HEAD
 1.4.2.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.4.2.1 26-Jul-2016  pgoyette Sync with HEAD
 1.7.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.11.4.1 11-May-2017  pgoyette Sync with HEAD
 1.12.12.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.12.12.1 10-Jun-2019  christos Sync with HEAD
 1.12.10.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.12.8.2 03-Dec-2017  jdolecek update from HEAD
 1.12.8.1 10-May-2017  jdolecek file linux_systrace_args.c was added on branch tls-maxphys on 2017-12-03 11:36:53 +0000
 1.15.2.2 17-Dec-2020  thorpej Regen for preadv(2) and pwritev(2).
 1.15.2.1 15-Dec-2020  thorpej Regen for eventfd, timerfd, POSIX timers.
 1.26.2.1 02-Aug-2025  perseant Sync with HEAD
 1.4 01-Oct-2024  riastradh sys/compat/linux/arch: Nix trailing whitespace.

No functional change intended.
 1.3 29-Jun-2008  njoly branches: 1.3.120;
Move amd64 MD termois types definitions from linux_termios.h to linux_types.h
following other archs.
 1.2 11-Dec-2005  christos branches: 1.2.70; 1.2.74; 1.2.76; 1.2.78;
merge ktrace-lwp.
 1.1 03-May-2005  manu branches: 1.1.8;
First work on COMPAT_LINUX/amd64
Process startup and dynamiclinking work, but processes hang due to
Linux arch_prctl(2) not being really supported yet.
 1.1.8.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.8.1 03-May-2005  skrll file linux_termios.h was added on branch ktrace-lwp on 2005-11-10 14:00:59 +0000
 1.2.78.1 03-Jul-2008  simonb Sync with head.
 1.2.76.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.2.74.1 04-May-2009  yamt sync with head.
 1.2.70.1 29-Jun-2008  mjf Sync with HEAD.
 1.3.120.1 02-Aug-2025  perseant Sync with HEAD
 1.7 01-Oct-2024  riastradh sys/compat/linux/arch: Nix trailing whitespace.

No functional change intended.
 1.6 11-Jan-2009  christos branches: 1.6.102;
merge christos-time_t
 1.5 29-Jun-2008  njoly branches: 1.5.4; 1.5.10;
Move amd64 MD termois types definitions from linux_termios.h to linux_types.h
following other archs.
 1.4 25-Dec-2007  perry branches: 1.4.6; 1.4.10; 1.4.12; 1.4.14;
Convert many of the uses of __attribute__ to equivalent
__packed, __unused and __dead macros from cdefs.h
 1.3 05-Apr-2007  njoly branches: 1.3.10; 1.3.16; 1.3.18; 1.3.22;
Enable stat/stat64 nsec time support, for amd64 compat linux/linux32.
 1.2 11-Dec-2005  christos branches: 1.2.26; 1.2.30; 1.2.32;
merge ktrace-lwp.
 1.1 03-May-2005  manu branches: 1.1.2; 1.1.8;
First work on COMPAT_LINUX/amd64
Process startup and dynamiclinking work, but processes hang due to
Linux arch_prctl(2) not being really supported yet.
 1.1.8.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.8.1 03-May-2005  skrll file linux_types.h was added on branch ktrace-lwp on 2005-11-10 14:00:59 +0000
 1.1.2.2 21-Jan-2008  yamt sync with head
 1.1.2.1 03-Sep-2007  yamt sync with head.
 1.2.32.1 11-Jul-2007  mjf Sync with head.
 1.2.30.1 10-Apr-2007  ad Sync with head.
 1.2.26.1 15-Apr-2007  yamt sync with head.
 1.3.22.1 02-Jan-2008  bouyer Sync with HEAD
 1.3.18.1 26-Dec-2007  ad Sync with head.
 1.3.16.1 18-Feb-2008  mjf Sync with HEAD.
 1.3.10.1 09-Jan-2008  matt sync with HEAD
 1.4.14.1 03-Jul-2008  simonb Sync with head.
 1.4.12.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.4.10.1 04-May-2009  yamt sync with head.
 1.4.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.4.6.1 29-Jun-2008  mjf Sync with HEAD.
 1.5.10.2 30-Dec-2008  christos time_t 64 changes.
 1.5.10.1 29-Jun-2008  christos file linux_types.h was added on branch christos-time_t on 2008-12-30 19:34:33 +0000
 1.5.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.6.102.1 02-Aug-2025  perseant Sync with HEAD
 1.3 07-Mar-2015  christos Add systrace output file
 1.2 11-Dec-2005  christos branches: 1.2.120; 1.2.140;
merge ktrace-lwp.
 1.1 03-May-2005  manu branches: 1.1.8;
First work on COMPAT_LINUX/amd64
Process startup and dynamiclinking work, but processes hang due to
Linux arch_prctl(2) not being really supported yet.
 1.1.8.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.8.1 03-May-2005  skrll file syscalls.conf was added on branch ktrace-lwp on 2005-11-10 14:00:59 +0000
 1.2.140.1 06-Apr-2015  skrll Sync with HEAD
 1.2.120.1 03-Dec-2017  jdolecek update from HEAD
 1.76 26-Oct-2025  christos PR/59722: Ricardo Branco: linux: Add support for semtimedop(2)
 1.75 28-Sep-2024  christos Linux GSoC-2024: renameat2, clone3, sync_file_range, syncfs (Shivraj Jamgade)
 1.74 01-Jul-2024  christos Add linux POSIX message queue support (Ricardo Branco)
 1.73 29-Jun-2024  christos branches: 1.73.2;
From gsoc 2024: Implement faccessat2 and getcpu (Shivraz)
 1.72 19-Aug-2023  christos Add inotify* syscalls GSoC 2023 (Theodore Preduta)
 1.71 18-Aug-2023  christos Add linux waitid(2) from GSoC 2023 (Theodore Preduta)
 1.70 29-Jul-2023  christos Add/fix statx, readahead, close_range. From GSoC 2023 by Theodore Preduta
 1.69 28-Jul-2023  christos Add epoll(2) from Theodore Preduta as part of GSoC 2023
 1.68 10-Jul-2023  christos Add memfd_create(2) from GSoC 2023 by Theodore Preduta
 1.67 02-Dec-2021  ryo add prlimit64(2) syscall to COMPAT_LINUX and COMPAT_LINUX32
 1.66 20-Sep-2021  thorpej Add preadv(2) and pwritev(2) system calls to COMPAT_LINUX and COMPAT_LINUX32.
 1.65 20-Sep-2021  thorpej Add the eventfd system calls to COMPAT_LINUX and COMPAT_LINUX32.
 1.64 19-Sep-2021  thorpej Add the timerfd syscalls to COMPAT_LINUX and COMPAT_LINUX32.
 1.63 19-Sep-2021  thorpej Add the POSIX timer syscalls (timer_create(), timer_settime(), timer_gettime(),
timer_getoverrun(), and timer_delete()) to COMPAT_LINUX and COMPAT_LINUX32.
 1.62 26-Apr-2020  thorpej branches: 1.62.2;
Add a NetBSD native futex implementation, mostly written by riastradh@.
Map the COMPAT_LINUX futex calls to the native ones.
 1.61 09-Nov-2019  jdolecek add dummy implementation of linux fallocate() which just returns EOPNOTSUPP;
this is needed so that glibc falls back to emulation and apps behaving
properly, since EOPNOTSUPP is a documented and expected return code, but
ENOSYS is not

right now there are no filesystems in NetBSD tree supporting the fallocate
VOP, so no point trying to map this to a native call

supposed to help with problem reported in
https://mail-index.netbsd.org/tech-kern/2019/11/03/msg025641.html
 1.60 03-Feb-2017  christos branches: 1.60.14;
add sendmmsg and recvmmsg
 1.59 02-Feb-2017  christos implement accept4
XXX: mips looks busted (the syscalls file has lots of NOARGS syscalls that
should be STD).
 1.58 02-Jan-2017  manu branches: 1.58.2;
Add pselect6 Linux system call.
This lets Matlab R2016A run on NetBSD/amd64
 1.57 24-Jul-2016  njoly Small cleanup. Adjust readlink/readlinkat signatures to reduce diffs with
native.
 1.56 27-Oct-2015  njoly branches: 1.56.2;
Fix setuid/setgid return type (void -> int) to match native.
 1.55 31-May-2015  njoly Fix write(2) size argument (int -> size_t).
 1.54 07-Mar-2015  christos fix inconsistent names
 1.53 22-Nov-2014  njoly branches: 1.53.2;
Fix ppoll signature (int ->u_int)
 1.52 31-May-2014  njoly branches: 1.52.2;
Fix munmap(2) signature.
 1.51 29-May-2014  njoly For utimes(2), use compat_50_sys_utimes() instead of local version.
 1.50 20-May-2014  njoly Fix getgroups/setgroups signature.
 1.49 17-May-2014  njoly Fix fadvise64 syscalls to use 64bit offset types.
 1.48 04-May-2014  njoly Fix pread/pwrite syscalls which need a 64bit offset argument.
 1.47 08-Apr-2014  njoly Adjust read/write/readv/writev signature to match native versions.
 1.46 08-Dec-2013  njoly branches: 1.46.2;
Sprinkle a few more linux_umode_t where appropriate.
Reduce diffs between archs.
 1.45 18-Nov-2013  chs implement the *at() syscalls.
bring the unimplemented syscall list up to date.
 1.44 07-Nov-2013  njoly Fix dup/dup2/dup3 argument types (u_int -> int).
 1.43 24-Sep-2013  njoly Add utimensat(2) for compat linux.
 1.42 08-Apr-2013  pooka branches: 1.42.4;
support utimes on non-alpha linux platforms
 1.41 19-Sep-2012  pooka emulate ppoll which is essentially our pollts
 1.40 18-Nov-2011  christos branches: 1.40.10;
add sigtimedwait
 1.39 09-Jul-2011  christos branches: 1.39.2;
revert accidental commit from unrelated change. no custom linux fork.
 1.38 09-Jul-2011  christos the first argument of {g,s}etitimer() is int not u_int.
 1.37 30-May-2011  alnsn Add fadvise64 and fadvise64_64 syscalls to compat_linux and compat_linux32.
 1.36 10-Apr-2011  christos add pipe2 and dup3
 1.35 07-Jul-2010  chs branches: 1.35.2;
many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
- support new-style (NPTL) linux pthreads on all platforms.
clone() with CLONE_THREAD uses 1 process with many LWPs
instead of separate processes.
- move the contents of sys__lwp_setprivate() into a new
lwp_setprivate() and use that everywhere.
- update linux_release[] and linux32_release[] to "2.6.18".
- adjust placement of emul fork/exec/exit hooks as needed
and adjust other emul code to match.
- convert all struct emul definitions to use named initializers.
- change the pid allocator to allow multiple pids to refer to the same proc.
- remove a few fields from struct proc that are no longer needed.
- disable the non-functional "vdso" code in linux32/amd64,
glibc works fine without it.
- fix a race in the futex code where we could miss a wakeup after
a requeue operation.
- redo futex locking to be a little more efficient.
 1.34 24-Nov-2009  njoly branches: 1.34.2; 1.34.4;
Update personality(2) to match Linux definition where the argument is an
unsigned long.
 1.33 30-Oct-2009  njoly stat64 syscalls require struct linux_stat64.
 1.32 17-Jun-2009  njoly Add a new linux_msghdr structure, as its size differs on 64bit archs.
Do the needed conversions in sendmsg/recvmsg syscalls, and adjust
their definitions accordingly.
 1.31 08-Jun-2009  njoly Update rt_queueinfo(2) definition, and kill a corresponding comment.
 1.30 17-Jan-2009  njoly branches: 1.30.2;
Convert linux/linux32 wait(4) to use a compat50 rusage structure.
 1.29 15-Jan-2009  njoly Update some syscalls/arguments to use the new compat50 equivalents.
 1.28 13-Jan-2009  pooka Convert the syscalls.master to a format from which it is easier
to parse and generate the compat name and basename (e.g. __stat50
and stat). Use this to autogenerate __RENAME()'s to the rump_syscalls
header so that they can be called e.g. rump_sys_socket() instead
of rump_sys___socket30().
 1.27 11-Jan-2009  christos merge christos-time_t
 1.26 19-Nov-2008  njoly branches: 1.26.4;
futex(2) timeout argument cleanup/fix.
- Use `struct linux_timespec', converted to native structure.
- Ensure that provided values are correct.
- Replace timeval+tvtohz by tstohz.
 1.25 12-Nov-2008  njoly Fix nanosleep(2) on 64-bit archs. Do not call native nanosleep
syscall, but rather a modified version the will take care of `struct
timespec' conversions.
 1.24 26-Oct-2008  christos branches: 1.24.2; 1.24.4;
catch up with i386 changes.
 1.23 04-Apr-2008  njoly branches: 1.23.4; 1.23.6; 1.23.10;
Cleanup. Kill linux_sys_msync and use sys___msync13 instead.
No functional changes expected.
 1.22 24-Dec-2007  njoly branches: 1.22.6;
Kill unneeded linux_sys_getpgid and use native sys_getpgid instead.
 1.21 21-Dec-2007  njoly - Fix setfsuid to return uid on success.
- Replace getfsuid, which never existed on Linux, by correct setfsgid
syscall.

ok by christos and dsl.
 1.20 20-Dec-2007  dsl Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.19 16-Nov-2007  njoly branches: 1.19.2; 1.19.6;
Cleanup. Remove a few linux syscalls definitions, now identical to
native ones (with stackgap and ALT_CHECK_xxx removal). No functional
changes expected.
 1.18 14-Mar-2007  njoly branches: 1.18.10; 1.18.12; 1.18.16; 1.18.18;
Fix compat linux statfs/fstatfs syscalls on amd64.
- Do not use statfs64/fstatfs64 as they have an extra size argument.
- Add full 64bit linux struct statfs support.

ok by manu
 1.17 04-Mar-2007  christos branches: 1.17.2; 1.17.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.16 09-Feb-2007  ad branches: 1.16.2;
Merge newlock2 to head.
 1.15 01-Sep-2006  matt branches: 1.15.2; 1.15.6;
Don't conditionalize *sys_ptrace. The lack of sys_ptrace will be dealt
with differently.
 1.14 30-Aug-2006  matt Update to deal with options PTRACE
 1.13 24-Aug-2006  manu The return value for Linux shmat on amd64 does not suffer the same horrible
hack as on i386.
 1.12 25-Jun-2006  manu - Complete exit_group() implementation. We now maintain a list of Linux
threads in a processes and kill them properly. The code is a bit too
complicated, but I could not find a simplier way of dealing with it

- Change getpid() and getppid() semantics to match what Linux does,
and implement gettid(). In the Linux kernel, threads are implemnted
as plain old processes. A thread group is just a set of processes,
with the parent called leader. Thread ID, which are returned by gettid(),
are just the PID of the plain old processes, and getpid() returns the
PID of the thread group leader.

- Remove struct linux32_emuldata. COMPAT_LINUX32 uses a lot of COMPAT_LINUX
code, where a struct linux_emuldata is assumed. By having distinct emuldata
structure with different sizes and layouts, we caused kernel memory
corruptions.

- Fix setprioriry() and getpriority()

Thanks to Nicolas Joly for tracking down the problem and providing me the
hardware to fix them.
 1.11 10-Jun-2006  christos branches: 1.11.2;
linux getpriority is off-by-20 so use our own function.
From PR/33671: Nicolas Joly
 1.10 09-Feb-2006  manu branches: 1.10.2; 1.10.8;
Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.9 23-Nov-2005  manu branches: 1.9.2; 1.9.4; 1.9.6;
- Add Linux tkill and tgkill (partial emulation).
- Fix getrlimit on amd64
 1.8 05-Nov-2005  manu branches: 1.8.2; 1.8.4;
Implement Linux sched_{set|get}affinity
 1.7 04-Nov-2005  manu Implement Linux futex and gettid system calls for amd64
 1.6 18-Oct-2005  joerg sys_uselib is needed by COMPAT_LINUX for EXEC_AOUT. Since it doesn't get
build when EXEC_AOUT is not defined, the syscalls.master entry has to be
conditionalized. Alpha did so already, so let the other archs catch up
with it.

Go-on: christos
 1.5 22-Jun-2005  manu branches: 1.5.2;
Implent CLONE_PARENT_SETTID, CLONE_CHILD_CLEARTID, and CLONE_CHILD_SETTID
options to clone(). This makes fork() work on amd64.

clone() prototype has changed and the changes is probably revelant on some
other arches.
 1.4 22-May-2005  fvdl Change sigreturn to have no arguments.
 1.3 16-May-2005  fvdl Add clock_* POSIX functions.
 1.2 16-May-2005  fvdl Add *xattr functions (they all return EOPNOTSUPP).
 1.1 03-May-2005  manu First work on COMPAT_LINUX/amd64
Process startup and dynamiclinking work, but processes hang due to
Linux arch_prctl(2) not being really supported yet.
 1.5.2.6 21-Jan-2008  yamt sync with head
 1.5.2.5 07-Dec-2007  yamt sync with head
 1.5.2.4 03-Sep-2007  yamt sync with head.
 1.5.2.3 26-Feb-2007  yamt sync with head.
 1.5.2.2 30-Dec-2006  yamt sync with head.
 1.5.2.1 21-Jun-2006  yamt sync with head.
 1.8.4.1 29-Nov-2005  yamt sync with head.
 1.8.2.3 11-Dec-2005  christos Sync with head.
 1.8.2.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.8.2.1 05-Nov-2005  skrll file syscalls.master was added on branch ktrace-lwp on 2005-11-10 14:00:59 +0000
 1.9.6.1 22-Apr-2006  simonb Sync with head.
 1.9.4.1 09-Sep-2006  rpaulo sync with head
 1.9.2.1 18-Feb-2006  yamt sync with head.
 1.10.8.1 19-Jun-2006  chap Sync with head.
 1.10.2.2 03-Sep-2006  yamt sync with head.
 1.10.2.1 26-Jun-2006  yamt sync with head.
 1.11.2.1 13-Jul-2006  gdamore Merge from HEAD.
 1.15.6.1 20-Apr-2007  bouyer Pull up following revision(s) (requested by njoly in ticket #581):
sys/compat/linux/common/linux_misc.c: revision 1.168
sys/compat/linux/arch/amd64/syscalls.master: revision 1.18
sys/compat/linux/common/linux_types.h: revision 1.25
sys/compat/linux/arch/amd64/linux_machdep.h: revision 1.6
sys/compat/linux/common/linux_misc_notalpha.c: revision 1.87
Fix compat linux statfs/fstatfs syscalls on amd64.
- Do not use statfs64/fstatfs64 as they have an extra size argument.
- Add full 64bit linux struct statfs support.
 1.15.2.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.16.2.2 24-Mar-2007  yamt sync with head.
 1.16.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.17.4.1 11-Jul-2007  mjf Sync with head.
 1.17.2.1 10-Apr-2007  ad Sync with head.
 1.18.18.2 27-Dec-2007  mjf Sync with HEAD.
 1.18.18.1 19-Nov-2007  mjf Sync with HEAD.
 1.18.16.1 18-Nov-2007  bouyer Sync with HEAD
 1.18.12.1 09-Jan-2008  matt sync with HEAD
 1.18.10.1 21-Nov-2007  joerg Sync with HEAD.
 1.19.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.19.2.1 26-Dec-2007  ad Sync with head.
 1.22.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.22.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.23.10.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.23.6.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.23.6.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.23.4.4 11-Aug-2010  yamt sync with head.
 1.23.4.3 11-Mar-2010  yamt sync with head
 1.23.4.2 20-Jun-2009  yamt sync with head
 1.23.4.1 04-May-2009  yamt sync with head.
 1.24.4.1 20-Nov-2008  snj Pull up following revision(s) (requested by njoly in ticket #81):
sys/compat/linux/arch/mips/syscalls.master: revision 1.30
sys/compat/linux/arch/m68k/syscalls.master: revision 1.63
sys/compat/linux32/arch/amd64/syscalls.master: revision 1.39
sys/compat/linux/arch/alpha/syscalls.master: revision 1.63
sys/compat/linux/arch/powerpc/syscalls.master: revision 1.38
sys/compat/linux32/common/linux32_time.c: revision 1.22
sys/compat/linux/arch/amd64/syscalls.master: revision 1.25
sys/compat/linux/arch/i386/syscalls.master: revision 1.94
sys/compat/linux/arch/arm/syscalls.master: revision 1.36
sys/compat/linux/common/linux_time.c: revision 1.26
Fix nanosleep(2) on 64-bit archs. Do not call native nanosleep
syscall, but rather a modified version the will take care of `struct
timespec' conversions.
 1.24.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.26.4.3 04-Jan-2009  christos need opt_compat_netbsd.h
 1.26.4.2 30-Dec-2008  christos time_t 64 changes.
 1.26.4.1 19-Nov-2008  christos file syscalls.master was added on branch christos-time_t on 2008-12-30 19:34:34 +0000
 1.30.2.1 23-Jul-2009  jym Sync with HEAD.
 1.34.4.3 31-May-2011  rmind sync with head
 1.34.4.2 21-Apr-2011  rmind sync with head
 1.34.4.1 05-Mar-2011  rmind sync with head
 1.34.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.35.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.39.2.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.39.2.2 30-Oct-2012  yamt sync with head
 1.39.2.1 17-Apr-2012  yamt sync with head
 1.40.10.4 03-Dec-2017  jdolecek update from HEAD
 1.40.10.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.40.10.2 23-Jun-2013  tls resync from head
 1.40.10.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.42.4.1 18-May-2014  rmind sync with head
 1.46.2.1 10-Aug-2014  tls Rebase.
 1.52.2.1 17-Apr-2017  snj Pull up following revision(s) (requested by manu in ticket #1354):
sys/compat/linux/arch/alpha/syscalls.master: revision 1.92 via patch
sys/compat/linux/arch/amd64/syscalls.master: revision 1.58 via patch
sys/compat/linux/arch/arm/syscalls.master: revision 1.65 via patch
sys/compat/linux/arch/i386/syscalls.master: revision 1.122 via patch
sys/compat/linux/arch/m68k/syscalls.master: revision 1.91 via patch
sys/compat/linux/arch/mips/syscalls.master: revision 1.61 via patch
sys/compat/linux/arch/powerpc/syscalls.master: revision 1.70 via patch
sys/compat/linux/common/linux_misc.c: revision 1.234
sys/compat/linux/common/linux_signal.h: revision 1.31
Add pselect6 Linux system call.
This lets Matlab R2016A run on NetBSD/amd64
 1.53.2.5 05-Feb-2017  skrll Sync with HEAD
 1.53.2.4 05-Oct-2016  skrll Sync with HEAD
 1.53.2.3 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.53.2.2 06-Jun-2015  skrll Sync with HEAD
 1.53.2.1 06-Apr-2015  skrll Sync with HEAD
 1.56.2.3 20-Mar-2017  pgoyette Sync with HEAD
 1.56.2.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.56.2.1 26-Jul-2016  pgoyette Sync with HEAD
 1.58.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.60.14.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.62.2.2 17-Dec-2020  thorpej Add suppport for Linux preadv(2) and pwritev(2). Same as native, except
for the silly way that the offset argument is passed in.
 1.62.2.1 15-Dec-2020  thorpej Add Linux eventfd, timerfd, and POSIX timer calls.
 1.73.2.1 02-Aug-2025  perseant Sync with HEAD
 1.3 29-May-2024  christos should not be using .include <> but .include "" here.
 1.2 08-Apr-2014  njoly Do not include bsd.kinc.mk in each arch Makefile, it's already pulled
by bsd.syscall.mk (from Makefile.inc).
 1.1 14-Jan-2002  bjh21 branches: 1.1.2; 1.1.4; 1.1.158; 1.1.168; 1.1.174; 1.1.184;
Crude first cut at ARMLinux binary compatibility. Successfully runs
"/emul/linux/bin/echo hello, world", dynamically linked.
 1.1.184.1 10-Aug-2014  tls Rebase.
 1.1.174.1 18-May-2014  rmind sync with head
 1.1.168.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.158.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.1.4.2 28-Feb-2002  nathanw Catch up to -current.
 1.1.4.1 14-Jan-2002  nathanw file Makefile was added on branch nathanw_sa on 2002-02-28 04:12:46 +0000
 1.1.2.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.1.2.1 14-Jan-2002  jdolecek file Makefile was added on branch kqueue on 2002-02-11 20:09:28 +0000
 1.4 30-Aug-2006  matt Update to deal with options PTRACE
 1.3 31-Mar-2002  christos branches: 1.3.26; 1.3.40; 1.3.44;
bring the reverse signal mapping array into linux_signo.c
 1.2 23-Jan-2002  bjh21 branches: 1.2.2; 1.2.4;
Add support for the ARM-specific syscalls in ARMLinux. These are invoked
by SWI numbers above 0x9f0000, but we re-map them down to somewhere just
after the end of the usual syscall range, since NetBSD doesn't handle
sparse syscall arrays well.

The only syscall I've actually implemented in this range is cacheflush(),
which was previously being mapped to fork(), causing ... interesting results.
 1.1 14-Jan-2002  bjh21 Crude first cut at ARMLinux binary compatibility. Successfully runs
"/emul/linux/bin/echo hello, world", dynamically linked.
 1.2.4.3 17-Apr-2002  nathanw Catch up to -current.
 1.2.4.2 28-Feb-2002  nathanw Catch up to -current.
 1.2.4.1 23-Jan-2002  nathanw file files.linux_arm was added on branch nathanw_sa on 2002-02-28 04:12:46 +0000
 1.2.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.2.2.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.2.2.1 23-Jan-2002  jdolecek file files.linux_arm was added on branch kqueue on 2002-02-11 20:09:28 +0000
 1.3.44.1 03-Sep-2006  yamt sync with head.
 1.3.40.1 09-Sep-2006  rpaulo sync with head
 1.3.26.1 30-Dec-2006  yamt sync with head.
 1.14 12-Oct-2021  andvar fix various typos, mainly in comments.
 1.13 03-May-2020  thorpej Always clear FUTEX_PRIVATE_FLAG for Linux processes. NetBSD-native futexes
exist in different namespace depending on FUTEX_PRIVATE_FLAG. This appears
not to be the case in Linux, and some futex users will mix private and non-
private ops on the same futex object. Provide a convenience wrapper that
puts this logic in one place witn a comment explaining why.

While here, move the Linux futex wrapper out of its own file and plop
it in linux_misc.c, which is where it lives in the linux32 module.
 1.12 31-May-2011  njoly Fix path for fadvise64 files.
 1.11 30-May-2011  alnsn Add fadvise64 and fadvise64_64 syscalls to compat_linux and compat_linux32.
 1.10 07-Jul-2010  chs branches: 1.10.2;
many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
- support new-style (NPTL) linux pthreads on all platforms.
clone() with CLONE_THREAD uses 1 process with many LWPs
instead of separate processes.
- move the contents of sys__lwp_setprivate() into a new
lwp_setprivate() and use that everywhere.
- update linux_release[] and linux32_release[] to "2.6.18".
- adjust placement of emul fork/exec/exit hooks as needed
and adjust other emul code to match.
- convert all struct emul definitions to use named initializers.
- change the pid allocator to allow multiple pids to refer to the same proc.
- remove a few fields from struct proc that are no longer needed.
- disable the non-functional "vdso" code in linux32/amd64,
glibc works fine without it.
- fix a race in the futex code where we could miss a wakeup after
a requeue operation.
- redo futex locking to be a little more efficient.
 1.9 02-Mar-2010  pooka branches: 1.9.2;
Nuke fs_lfs.h included for unknown reasons (if there was a reason
other than "accident", i hereby declare that reason invalid)
 1.8 19-Nov-2008  ad branches: 1.8.6;
Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.7 02-Feb-2008  dsl branches: 1.7.6; 1.7.10; 1.7.12; 1.7.16; 1.7.18;
Extract the fcntl64() suppoort from linux_file64.c into linux_fcntl64.c
Unravel some of the knots that caused linux_file64.c to be compiled twice
for an amd64 kernel (once for linux and once for linux32) with different
parts being skipped each time.
 1.6 15-Jan-2008  njoly compat linux (and linux32) uid16 functions cleanup and fixes.

- Move uid16 functions to their own file linux_uid16.c, included by
needed archs (arm, i386 and m68k).
- Add new MI types linux_{u,g}id16_t.
- Add macros to handle linux_uid16_t and uid_t conversions.
- Add linux_sys_getres{uid,gid}16 syscalls, to fix an overflow with
bad sizes given to copyout when linux_sys_getres{uid,gid} are used.
- Update arm syscall table to use more uid16 functions.
 1.5 15-Aug-2007  ad branches: 1.5.2; 1.5.8; 1.5.14;
Changes to make ktrace LKM friendly and reduce ifdef KTRACE. Proposed
on tech-kern.
 1.4 09-Feb-2007  ad branches: 1.4.6; 1.4.14; 1.4.18;
Merge newlock2 to head.
 1.3 18-Jan-2003  thorpej branches: 1.3.18; 1.3.48;
Merge the nathanw_sa branch.
 1.2 17-Feb-2002  bjh21 branches: 1.2.2;
linux_sys_break() is marked OBSOL, so don't include it.
 1.1 14-Jan-2002  bjh21 branches: 1.1.2;
Crude first cut at ARMLinux binary compatibility. Successfully runs
"/emul/linux/bin/echo hello, world", dynamically linked.
 1.1.2.3 16-Mar-2002  jdolecek Catch up with -current.
 1.1.2.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.1.2.1 14-Jan-2002  jdolecek file linux_commons.c was added on branch kqueue on 2002-02-11 20:09:28 +0000
 1.2.2.3 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.2.2.2 28-Feb-2002  nathanw Catch up to -current.
 1.2.2.1 17-Feb-2002  nathanw file linux_commons.c was added on branch nathanw_sa on 2002-02-28 04:12:46 +0000
 1.3.48.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.3.18.4 04-Feb-2008  yamt sync with head.
 1.3.18.3 21-Jan-2008  yamt sync with head
 1.3.18.2 03-Sep-2007  yamt sync with head.
 1.3.18.1 26-Feb-2007  yamt sync with head.
 1.4.18.1 16-Aug-2007  jmcneill Sync with HEAD.
 1.4.14.1 03-Sep-2007  skrll Sync with HEAD.
 1.4.6.1 20-Aug-2007  ad Sync with HEAD.
 1.5.14.1 19-Jan-2008  bouyer Sync with HEAD
 1.5.8.1 18-Feb-2008  mjf Sync with HEAD.
 1.5.2.1 23-Mar-2008  matt sync with HEAD
 1.7.18.1 19-Jan-2009  skrll Sync with HEAD.
 1.7.16.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.7.12.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.7.12.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.7.10.3 11-Aug-2010  yamt sync with head.
 1.7.10.2 11-Mar-2010  yamt sync with head
 1.7.10.1 04-May-2009  yamt sync with head.
 1.7.6.1 17-Jan-2009  mjf Sync with HEAD.
 1.8.6.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.8.6.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.9.2.3 12-Jun-2011  rmind sync with head
 1.9.2.2 31-May-2011  rmind sync with head
 1.9.2.1 05-Mar-2011  rmind sync with head
 1.10.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.7 17-Dec-2013  njoly Cleanup compat linux errnos by adding generic errnos in a single file.
Use it for all arches except alpha and mips.
Add a few missing native to linux errno conversions.
 1.6 28-Apr-2008  martin branches: 1.6.34; 1.6.44; 1.6.50;
Remove clause 3 and 4 from TNF licenses
 1.5 11-Dec-2005  christos branches: 1.5.70; 1.5.72; 1.5.74;
merge ktrace-lwp.
 1.4 26-Feb-2005  perry nuke trailing whitespace
 1.3 17-Jan-2002  bjh21 branches: 1.3.2; 1.3.4; 1.3.20; 1.3.28; 1.3.30;
Fix unterminated #ifdef.
 1.2 17-Jan-2002  rjs Add extra error codes from Linux.
 1.1 14-Jan-2002  bjh21 Crude first cut at ARMLinux binary compatibility. Successfully runs
"/emul/linux/bin/echo hello, world", dynamically linked.
 1.3.30.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.3.28.1 29-Apr-2005  kent sync with -current
 1.3.20.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.3.4.2 28-Feb-2002  nathanw Catch up to -current.
 1.3.4.1 17-Jan-2002  nathanw file linux_errno.h was added on branch nathanw_sa on 2002-02-28 04:12:46 +0000
 1.3.2.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.3.2.1 17-Jan-2002  jdolecek file linux_errno.h was added on branch kqueue on 2002-02-11 20:09:30 +0000
 1.5.74.1 16-May-2008  yamt sync with head.
 1.5.72.1 18-May-2008  yamt sync with head.
 1.5.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.6.50.1 18-May-2014  rmind sync with head
 1.6.44.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.6.34.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.12 26-Nov-2021  ryo The internal architecture name of golang is "arm" or "arm64", which has
different naming conventions from netbsd's machine[] or machine_arch[]
("earmv7", "aarch64", etc.) and cannot be used as is.
Instead, use define LINUX_GO_RT0_SIGNATURE_ARCH{32,64}.
 1.11 26-Nov-2021  ryo - LINUX_GO_RT0_SIGNATURE for compat_linux is no longer enabled by default.
it is now defined in each arch same as the other *_SIGNATURE definitions.
- add new LINUX32_GO_RT0_SIGNATURE for compat_linux32, and is defined in amd64 and aarch64.
 1.10 12-Feb-2017  chs es_arglen is now in units of bytes, update the emulations accordingly.
 1.9 09-Feb-2014  chs branches: 1.9.6; 1.9.10; 1.9.14;
account for the 16 bytes of AT_RANDOM data in the stack setup. fixes PR 48518.
use cprng_strong32() instead of random(). add AT_RANDOM support for linux32.
 1.8 28-Apr-2008  martin branches: 1.8.34; 1.8.44; 1.8.50;
Remove clause 3 and 4 from TNF licenses
 1.7 11-Dec-2005  christos branches: 1.7.70; 1.7.72; 1.7.74;
merge ktrace-lwp.
 1.6 14-Aug-2003  christos remove the args from the macro.
 1.5 08-Aug-2003  christos - GC all the setup_stack functions
- add one for linux/i386
 1.4 01-Mar-2003  thorpej branches: 1.4.2;
Do the syscall_plain/syscall_fancy dance on ARM. Shaves a fair number
of cycles off the syscall overhead.

Since all COMPAT_LINUX platforms now support __HAVE_SYSCALL_INTERN,
garbage-collect the LINUX_SYSCALL_FUNCTION stuff.
 1.3 13-Nov-2002  jdolecek add generic linux compat ELF copyargs function

this gives:
* linux sysconf(_SC_CLK_TCK) gives correct value for linux binaries (hz)
even if hz != 100
* glibc gets proper information on real/effective uid and enables
secure mode for suid binaries

g/c LINUX_COPYARGS_FUNCTION, replaced by linux ELF copyargs function
g/c alpha-specific linux ELF copyargs function and linux ELF defines
 1.2 17-Jan-2002  bjh21 branches: 1.2.2; 1.2.4;
On platforms that don't __HAVE_SYSCALL_INTERN, define LINUX_SYSCALL_FUNCTION
to be the value of emul_linux.e_syscall that we want. This allows it to differ
between machines, so I can have a separate linux_syscall() on arm.
 1.1 14-Jan-2002  bjh21 Crude first cut at ARMLinux binary compatibility. Successfully runs
"/emul/linux/bin/echo hello, world", dynamically linked.
 1.2.4.3 11-Dec-2002  thorpej Sync with HEAD.
 1.2.4.2 28-Feb-2002  nathanw Catch up to -current.
 1.2.4.1 17-Jan-2002  nathanw file linux_exec.h was added on branch nathanw_sa on 2002-02-28 04:12:46 +0000
 1.2.2.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.2.2.1 17-Jan-2002  jdolecek file linux_exec.h was added on branch kqueue on 2002-02-11 20:09:30 +0000
 1.4.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.2.1 03-Aug-2004  skrll Sync with HEAD
 1.7.74.1 16-May-2008  yamt sync with head.
 1.7.72.1 18-May-2008  yamt sync with head.
 1.7.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.8.50.1 18-May-2014  rmind sync with head
 1.8.44.2 03-Dec-2017  jdolecek update from HEAD
 1.8.44.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.8.34.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.9.14.1 21-Apr-2017  bouyer Sync with HEAD
 1.9.10.1 20-Mar-2017  pgoyette Sync with HEAD
 1.9.6.1 28-Aug-2017  skrll Sync with HEAD
 1.5 25-Jun-2014  njoly Add a few missing open(2) flags (LINUX_O_*). Fix alpha wrong values.
 1.4 02-Nov-2010  chs branches: 1.4.18; 1.4.32;
define LINUX_O_CLOEXEC.
sort definitions by value.
consistently use hex instead of octal for the values.
 1.3 21-Sep-2010  chs implement O_DIRECTORY as standardized in POSIX-2008,
for both native and linux emulations.
this fixes the rest of PR 43695.
 1.2 28-Apr-2008  martin branches: 1.2.20; 1.2.22;
Remove clause 3 and 4 from TNF licenses
 1.1 14-Jan-2002  bjh21 branches: 1.1.2; 1.1.4; 1.1.118; 1.1.120; 1.1.122;
Crude first cut at ARMLinux binary compatibility. Successfully runs
"/emul/linux/bin/echo hello, world", dynamically linked.
 1.1.122.2 09-Oct-2010  yamt sync with head
 1.1.122.1 16-May-2008  yamt sync with head.
 1.1.120.1 18-May-2008  yamt sync with head.
 1.1.118.1 02-Jun-2008  mjf Sync with HEAD.
 1.1.4.2 28-Feb-2002  nathanw Catch up to -current.
 1.1.4.1 14-Jan-2002  nathanw file linux_fcntl.h was added on branch nathanw_sa on 2002-02-28 04:12:46 +0000
 1.1.2.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.1.2.1 14-Jan-2002  jdolecek file linux_fcntl.h was added on branch kqueue on 2002-02-11 20:09:30 +0000
 1.2.22.1 05-Mar-2011  rmind sync with head
 1.2.20.2 06-Nov-2010  uebayasi Sync with HEAD.
 1.2.20.1 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.4.32.1 10-Aug-2014  tls Rebase.
 1.4.18.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.1 14-Jan-2002  bjh21 branches: 1.1.2; 1.1.4; 1.1.118; 1.1.120; 1.1.122;
Crude first cut at ARMLinux binary compatibility. Successfully runs
"/emul/linux/bin/echo hello, world", dynamically linked.
 1.1.122.1 16-May-2008  yamt sync with head.
 1.1.120.1 18-May-2008  yamt sync with head.
 1.1.118.1 02-Jun-2008  mjf Sync with HEAD.
 1.1.4.2 28-Feb-2002  nathanw Catch up to -current.
 1.1.4.1 14-Jan-2002  nathanw file linux_ioctl.h was added on branch nathanw_sa on 2002-02-28 04:12:46 +0000
 1.1.2.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.1.2.1 14-Jan-2002  jdolecek file linux_ioctl.h was added on branch kqueue on 2002-02-11 20:09:30 +0000
 1.34 07-Sep-2021  riastradh sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.33 01-Feb-2021  skrll G/C some old code that was for acorn26
 1.32 09-Nov-2014  maxv branches: 1.32.12; 1.32.24; 1.32.32;
Do not uselessly include <sys/malloc.h>.
 1.31 18-Aug-2013  matt branches: 1.31.4;
Use <arm/locore.h>
 1.30 16-Aug-2012  matt branches: 1.30.2; 1.30.4;
Rename process_frame to lwp_trapframe
 1.29 07-Jul-2010  chs branches: 1.29.8; 1.29.16;
many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
- support new-style (NPTL) linux pthreads on all platforms.
clone() with CLONE_THREAD uses 1 process with many LWPs
instead of separate processes.
- move the contents of sys__lwp_setprivate() into a new
lwp_setprivate() and use that everywhere.
- update linux_release[] and linux32_release[] to "2.6.18".
- adjust placement of emul fork/exec/exit hooks as needed
and adjust other emul code to match.
- convert all struct emul definitions to use named initializers.
- change the pid allocator to allow multiple pids to refer to the same proc.
- remove a few fields from struct proc that are no longer needed.
- disable the non-functional "vdso" code in linux32/amd64,
glibc works fine without it.
- fix a race in the futex code where we could miss a wakeup after
a requeue operation.
- redo futex locking to be a little more efficient.
 1.28 23-Nov-2009  rmind branches: 1.28.2; 1.28.4;
Use lwp_getpcb() in compat code, clean from struct user.
 1.27 28-Apr-2008  martin branches: 1.27.2;
Remove clause 3 and 4 from TNF licenses
 1.26 24-Apr-2008  ad branches: 1.26.2;
Merge proc::p_mutex and proc::p_smutex into a single adaptive mutex, since
we no longer need to guard against access from hardware interrupt handlers.

Additionally, if cloning a process with CLONE_SIGHAND, arrange to have the
child process share the parent's lock so that signal state may be kept in
sync. Partially addresses PR kern/37437.
 1.25 21-Dec-2007  matt branches: 1.25.6; 1.25.8;
Make this compile again.
 1.24 20-Dec-2007  dsl Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.23 08-Dec-2007  dsl branches: 1.23.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.22 26-Mar-2007  hubertf branches: 1.22.8; 1.22.10; 1.22.18;
Remove duplicate #include <sys/param.h>,
and pull in the <sys/cdefs.h> needed for __KERNEL_RCSID

From: Slava Semushin <php-coder@altlinux.ru>
 1.21 04-Mar-2007  christos branches: 1.21.2; 1.21.4; 1.21.6;
fix caddr_t fallout.
 1.20 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.19 09-Feb-2007  ad branches: 1.19.2;
Merge newlock2 to head.
 1.18 23-Aug-2006  bjh21 branches: 1.18.2;
Use VALID_R15_PSR() to check the context we're restoring in
linux_sys_sigreturn(). Somehow this got missed when I introduced that macro.
 1.17 11-Dec-2005  christos branches: 1.17.4; 1.17.8;
merge ktrace-lwp.
 1.16 13-Sep-2005  christos need linux_syscallargs.h to compile, and remove inline function.
 1.15 20-May-2005  fvdl branches: 1.15.2;
Define linux_usertrap function, and set it in struct emul. For all
but amd64, it just returns 0, doing nothing.

For amd64, it implements vsyscalls through cheating: if the faulting
address is in the vsyscall area (which is statically known on Linux/amd64),
and the intruction pointer is too, it must have been a vsyscall. In that
case, retrieve the return address from the user stack, fix up %rip and
%rsp, and just execute the normal system call. It will return as if
the vsyscall has been executed.
 1.14 26-Feb-2005  perry nuke trailing whitespace
 1.13 10-Oct-2003  matt branches: 1.13.8; 1.13.10;
Adapt ARM Linux compat code to deal with SIGINFO.
 1.12 26-Sep-2003  simonb Fix "constify sendsig/trapsignal" fallout for non-siginfo'd archs. Test
compiled on most architectures.
 1.11 18-Jan-2003  thorpej branches: 1.11.2;
Merge the nathanw_sa branch.
 1.10 25-Sep-2002  thorpej Don't include <sys/map.h>.
 1.9 04-Jul-2002  thorpej Add kernel support for having userland provide the signal trampoline:

* struct sigacts gets a new sigact_sigdesc structure, which has the
sigaction and the trampoline/version. Version 0 means "legacy kernel
provided trampoline". Other versions are coordinated with machine-
dependent code in libc.
* sigaction1() grows two more arguments -- the trampoline pointer and
the trampoline version.
* A new __sigaction_sigtramp() system call is provided to register a
trampoline along with a signal handler.
* The handler is no longer passed to sensig() functions. Instead,
sendsig() looks up the handler by peeking in the sigacts for the
process getting the signal (since it has to look in there for the
trampoline anyway).
* Native sendsig() functions now select the appropriate trampoline and
its arguments based on the trampoline version in the sigacts.

Changes to libc to use the new facility will be checked in later. Kernel
version not bumped; we will ride the 1.6C bump made recently.
 1.8 20-May-2002  jdolecek whitespace fixes
 1.7 31-Mar-2002  christos branches: 1.7.2;
make signal array handling uniform, and put signal arrays in a separate
file. This is simular to errno array handling.
 1.6 17-Feb-2002  bjh21 branches: 1.6.2;
Adapt for changes to limux_old_extra_to_native_sigset() and
native_to_linux_old_extra_sigset().
 1.5 17-Feb-2002  bjh21 linux_sys_rt_sigreturn is currently marked UNIMPL, so leave the stub out.
 1.4 15-Feb-2002  christos - add a real linux_sys___sysctl because the mib numbers are different.
implement only the kernel version getting entries.
- make the signal conversion functions consistent; dest is arg 1.
- make linux_fakedev deal with block and char devices differently.
- add linux_sys_ugetrlimit, and flesh out the regular get/setrlimit so
that they work properly.
- add linux_mmap2 [untested].
- bump kernel to 2.4.18, and make the date be valentine's day :-)
- linux_sys_*stat64 family was totally busted. Fix it.

tested only on i386.

Status:
gdb, telnet, work
jdk-1.4.0 extractor works, jdk still coredumps.

christos
 1.3 02-Feb-2002  bjh21 branches: 1.3.2;
We shouldn't need an icache sync when catching a signal, so don't bother.
 1.2 17-Jan-2002  bjh21 More-or-less working signal handling for Linux processes on ARM.
 1.1 14-Jan-2002  bjh21 Crude first cut at ARMLinux binary compatibility. Successfully runs
"/emul/linux/bin/echo hello, world", dynamically linked.
 1.3.2.6 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.3.2.5 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.3.2.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.3.2.3 16-Mar-2002  jdolecek Catch up with -current.
 1.3.2.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.3.2.1 02-Feb-2002  jdolecek file linux_machdep.c was added on branch kqueue on 2002-02-11 20:09:30 +0000
 1.6.2.9 18-Oct-2002  nathanw Catch up to -current.
 1.6.2.8 01-Aug-2002  nathanw Catch up to -current.
 1.6.2.7 24-Jun-2002  nathanw Curproc->curlwp renaming.

Change uses of "curproc->l_proc" back to "curproc", which is more like the
original use. Bare uses of "curproc" are now "curlwp".

"curproc" is now #defined in proc.h as ((curlwp) ? (curlwp)->l_proc) : NULL)
so that it is always safe to reference curproc (*de*referencing curproc
is another story, but that's always been true).
 1.6.2.6 20-Jun-2002  nathanw Catch up to -current.
 1.6.2.5 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.6.2.4 04-May-2002  thorpej LWP'ify.
 1.6.2.3 17-Apr-2002  nathanw Catch up to -current.
 1.6.2.2 28-Feb-2002  nathanw Catch up to -current.
 1.6.2.1 17-Feb-2002  nathanw file linux_machdep.c was added on branch nathanw_sa on 2002-02-28 04:12:46 +0000
 1.7.2.2 15-Jul-2002  gehenna catch up with -current.
 1.7.2.1 30-May-2002  gehenna Catch up with -current.
 1.11.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.11.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.11.2.4 27-Jan-2005  skrll Adapt to branch.
 1.11.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.11.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.11.2.1 03-Aug-2004  skrll Sync with HEAD
 1.13.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.13.8.1 29-Apr-2005  kent sync with -current
 1.15.2.5 21-Jan-2008  yamt sync with head
 1.15.2.4 03-Sep-2007  yamt sync with head.
 1.15.2.3 26-Feb-2007  yamt sync with head.
 1.15.2.2 30-Dec-2006  yamt sync with head.
 1.15.2.1 21-Jun-2006  yamt sync with head.
 1.17.8.1 03-Sep-2006  yamt sync with head.
 1.17.4.1 09-Sep-2006  rpaulo sync with head
 1.18.2.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.18.2.1 27-Jan-2007  ad More compat changes.
 1.19.2.2 15-Apr-2007  yamt sync with head.
 1.19.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.21.6.1 29-Mar-2007  reinoud Pullup to -current
 1.21.4.1 11-Jul-2007  mjf Sync with head.
 1.21.2.1 10-Apr-2007  ad Sync with head.
 1.22.18.1 26-Dec-2007  ad Sync with head.
 1.22.10.1 09-Jan-2008  matt sync with HEAD
 1.22.8.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.23.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.25.8.1 18-May-2008  yamt sync with head.
 1.25.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.26.2.3 11-Aug-2010  yamt sync with head.
 1.26.2.2 11-Mar-2010  yamt sync with head
 1.26.2.1 16-May-2008  yamt sync with head.
 1.27.2.3 14-May-2008  wrstuden Per discussion with ad at n dot o, revert signal mask handling
changes.

The l_sigstk changes are most likely totally un-needed as SA will
never use a signal stack - we send an upcall (or will as other
diffs are brought in).

The l_sigmask changes were too controvertial. In all honesty, I
think it's probably best to revert them. The main reason they were
there is the fact that in an SA process, we don't mask signals per
kernel thread, we mask them per user thread. In the kernel, we want
them all to get turned into upcalls. Thus the normal state of
l_sigmask in an SA process is for it to always be empty.

While we are in the process of delivering a signal, we want to
temporarily mask a signal (so we don't recursively exhaust our
upcall stacks). However signal delivery is rare (important, but
rare), and delivering back-to-back signals is even rarer. So rather
than cause every user of a signal mask to be prepared for this very
rare case, we will just add a second check later in the signal
delivery code. Said change is not in this diff.

This also un-compensates all of our compatability code for dealing
with SA. SA is a NetBSD-specific thing, so there's no need for
Irix, Linux, Solaris, SVR4 and so on to cope with it.

As previously, everything other than kern_sa.c compiles in i386
GENERIC as of this checkin. I will switch to ALL soon for compile
testing.
 1.27.2.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.27.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.28.4.1 05-Mar-2011  rmind sync with head
 1.28.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.29.16.1 29-Nov-2012  matt Sync with HEAD
 1.29.8.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.29.8.1 30-Oct-2012  yamt sync with head
 1.30.4.1 28-Aug-2013  rmind sync with head
 1.30.2.2 03-Dec-2017  jdolecek update from HEAD
 1.30.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.31.4.1 17-Jan-2015  martin Pull up following revision(s) (requested by maxv in ticket #427):
sys/compat/svr4/svr4_schedctl.c: revision 1.8
sys/netinet/tcp_timer.c: revision 1.88
sys/miscfs/genfs/layer_vfsops.c: revision 1.45
sys/compat/svr4/svr4_ioctl.c: revision 1.37
sys/ufs/chfs/chfs_vfsops.c: revision 1.14
sys/miscfs/fdesc/fdesc_vfsops.c: revision 1.91
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.30
sys/compat/common/kern_time_50.c: revision 1.28
sys/netinet6/ip6_forward.c: revision 1.74
sys/miscfs/umapfs/umap_vnops.c: revision 1.57
sys/compat/svr4/svr4_fcntl.c: revision 1.74
distrib/sets/lists/comp/mi: revision 1.1931
sys/netinet6/udp6_output.c: revision 1.46
sys/fs/puffs/puffs_compat.c: revision 1.3
sys/fs/udf/udf_rename.c: revision 1.11
sys/compat/svr4/svr4_filio.c: revision 1.24
sys/fs/udf/udf_rename.c: revision 1.12
sys/netinet/tcp_usrreq.c: revision 1.202
sys/miscfs/umapfs/umap_subr.c: revision 1.29
sys/compat/linux/common/linux_fadvise64.c: revision 1.3
sys/netinet/if_atm.c: revision 1.34
sys/miscfs/procfs/procfs_subr.c: revision 1.106
sys/miscfs/genfs/layer_subr.c: revision 1.37
sys/netinet/tcp_sack.c: revision 1.30
sys/compat/freebsd/freebsd_misc.c: revision 1.33
sys/compat/freebsd/freebsd_file.c: revision 1.33
sys/ufs/chfs/chfs_vnode.c: revision 1.12
sys/compat/svr4/svr4_ttold.c: revision 1.34
sys/compat/linux/common/linux_file.c: revision 1.114
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.43
sys/compat/linux/common/linux_signal.c: revision 1.76
sys/compat/common/compat_util.c: revision 1.46
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.18
sys/compat/svr4/svr4_sockio.c: revision 1.36
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.32
sys/compat/svr4/svr4_signal.c: revision 1.66
sys/kern/kern_exec.c: revision 1.410
sys/fs/puffs/puffs_vfsops.c: revision 1.115
sys/compat/svr4/svr4_exec_elf64.c: revision 1.15
sys/compat/linux/arch/i386/linux_machdep.c: revision 1.159
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.50
sys/compat/linux32/common/linux32_misc.c: revision 1.24
sys/netinet/in_pcb.c: revision 1.153
sys/sys/malloc.h: revision 1.116
sys/compat/common/if_43.c: revision 1.9
share/man/man9/Makefile: revision 1.380
sys/netinet/tcp_vtw.c: revision 1.12
sys/miscfs/umapfs/umap_vfsops.c: revision 1.95
sys/ufs/ext2fs/ext2fs_vfsops.c: revision 1.186
sys/compat/common/uipc_syscalls_43.c: revision 1.46
sys/ufs/ext2fs/ext2fs_vnops.c: revision 1.115
sys/fs/puffs/puffs_msgif.c: revision 1.97
sys/compat/svr4/svr4_ipc.c: revision 1.27
sys/compat/linux/common/linux_exec.c: revision 1.117
sys/ufs/ext2fs/ext2fs_readwrite.c: revision 1.66
sys/netinet/tcp_output.c: revision 1.179
sys/compat/svr4/svr4_termios.c: revision 1.28
sys/fs/udf/udf_strat_bootstrap.c: revision 1.4
sys/fs/puffs/puffs_subr.c: revision 1.67
sys/fs/puffs/puffs_node.c: revision 1.36
sys/miscfs/overlay/overlay_vnops.c: revision 1.21
sys/fs/cd9660/cd9660_node.c: revision 1.34
sys/netinet/raw_ip.c: revision 1.146
sys/sys/mallocvar.h: revision 1.13
sys/miscfs/overlay/overlay_vfsops.c: revision 1.63
share/man/man9/malloc.9: revision 1.50
sys/netinet6/dest6.c: revision 1.18
sys/compat/linux/common/linux_uselib.c: revision 1.33
sys/compat/linux/common/linux_socket.c: revision 1.120
share/man/man9/malloc.9: revision 1.51
sys/netinet/tcp_subr.c: revision 1.257
sys/compat/linux/common/linux_socketcall.c: revision 1.45
sys/compat/linux/common/linux_fadvise64_64.c: revision 1.3
sys/compat/freebsd/freebsd_ipc.c: revision 1.17
sys/compat/linux/common/linux_misc_notalpha.c: revision 1.109
sys/compat/linux/arch/alpha/linux_pipe.c: revision 1.17
sys/netinet6/in6_pcb.c: revision 1.132
sys/netinet6/in6_ifattach.c: revision 1.94
sys/compat/svr4/svr4_exec_elf32.c: revision 1.15
sys/miscfs/nullfs/null_vfsops.c: revision 1.90
sys/fs/cd9660/cd9660_util.c: revision 1.12
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.48
sys/compat/freebsd/freebsd_exec_elf32.c: revision 1.20
sys/miscfs/procfs/procfs_vfsops.c: revision 1.94
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.28
sys/compat/linux/common/linux_sched.c: revision 1.67
sys/compat/linux/common/linux_exec_aout.c: revision 1.67
sys/compat/linux/common/linux_pipe.c: revision 1.67
sys/compat/linux/common/linux_llseek.c: revision 1.34
sys/compat/linux/arch/mips/linux_ptrace.c: revision 1.10
Do not uselessly include <sys/malloc.h>.
Cleanup:
- remove struct kmembuckets (dead)
- correctly deadify MALLOC_XX
- remove MALLOC_DEFINE_LIMIT and MALLOC_JUSTDEFINE_LIMIT (dead)
- remove malloc_roundup(), malloc_type_setlimit(), MALLOC_DEFINE_LIMIT()
and MALLOC_JUSTDEFINE_LIMIT() from man 9 malloc
New sentence, new line. Bump date for previous.
Obsolete malloc_roundup(9), malloc_type_setlimit(9) and MALLOC_DEFINE_LIMIT(9)
man pages.
 1.32.32.1 03-Apr-2021  thorpej Sync with HEAD.
 1.32.24.1 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.32.12.1 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1836):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.6 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.5 04-Dec-2007  dsl branches: 1.5.12; 1.5.14; 1.5.16;
Remove all the __P
 1.4 01-Mar-2003  thorpej branches: 1.4.18; 1.4.74; 1.4.76; 1.4.82; 1.4.86;
Do the syscall_plain/syscall_fancy dance on ARM. Shaves a fair number
of cycles off the syscall overhead.

Since all COMPAT_LINUX platforms now support __HAVE_SYSCALL_INTERN,
garbage-collect the LINUX_SYSCALL_FUNCTION stuff.
 1.3 15-Feb-2002  christos branches: 1.3.2;
- add a real linux_sys___sysctl because the mib numbers are different.
implement only the kernel version getting entries.
- make the signal conversion functions consistent; dest is arg 1.
- make linux_fakedev deal with block and char devices differently.
- add linux_sys_ugetrlimit, and flesh out the regular get/setrlimit so
that they work properly.
- add linux_mmap2 [untested].
- bump kernel to 2.4.18, and make the date be valentine's day :-)
- linux_sys_*stat64 family was totally busted. Fix it.

tested only on i386.

Status:
gdb, telnet, work
jdk-1.4.0 extractor works, jdk still coredumps.

christos
 1.2 17-Jan-2002  bjh21 branches: 1.2.2;
More-or-less working signal handling for Linux processes on ARM.
 1.1 14-Jan-2002  bjh21 Crude first cut at ARMLinux binary compatibility. Successfully runs
"/emul/linux/bin/echo hello, world", dynamically linked.
 1.2.2.3 16-Mar-2002  jdolecek Catch up with -current.
 1.2.2.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.2.2.1 17-Jan-2002  jdolecek file linux_machdep.h was added on branch kqueue on 2002-02-11 20:09:30 +0000
 1.3.2.2 28-Feb-2002  nathanw Catch up to -current.
 1.3.2.1 15-Feb-2002  nathanw file linux_machdep.h was added on branch nathanw_sa on 2002-02-28 04:12:47 +0000
 1.4.86.1 08-Dec-2007  ad Sync with head.
 1.4.82.1 08-Dec-2007  mjf Sync with HEAD.
 1.4.76.1 09-Jan-2008  matt sync with HEAD
 1.4.74.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.4.18.1 07-Dec-2007  yamt sync with head
 1.5.16.1 16-May-2008  yamt sync with head.
 1.5.14.1 18-May-2008  yamt sync with head.
 1.5.12.1 02-Jun-2008  mjf Sync with HEAD.
 1.5 14-Mar-2015  njoly Support Linux MAP_LOCKED mmap flag.
 1.4 28-Apr-2008  martin branches: 1.4.44; 1.4.64;
Remove clause 3 and 4 from TNF licenses
 1.3 11-Dec-2005  christos branches: 1.3.70; 1.3.72; 1.3.74;
merge ktrace-lwp.
 1.2 28-Aug-2004  jdolecek g/c LINUX_MAP_IGNMASK define - it's not used anywhere
 1.1 14-Jan-2002  bjh21 branches: 1.1.2; 1.1.4; 1.1.20;
Crude first cut at ARMLinux binary compatibility. Successfully runs
"/emul/linux/bin/echo hello, world", dynamically linked.
 1.1.20.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.20.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.20.1 03-Sep-2004  skrll Sync with HEAD
 1.1.4.2 28-Feb-2002  nathanw Catch up to -current.
 1.1.4.1 14-Jan-2002  nathanw file linux_mmap.h was added on branch nathanw_sa on 2002-02-28 04:12:47 +0000
 1.1.2.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.1.2.1 14-Jan-2002  jdolecek file linux_mmap.h was added on branch kqueue on 2002-02-11 20:09:30 +0000
 1.3.74.1 16-May-2008  yamt sync with head.
 1.3.72.1 18-May-2008  yamt sync with head.
 1.3.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.4.64.1 06-Apr-2015  skrll Sync with HEAD
 1.4.44.1 03-Dec-2017  jdolecek update from HEAD
 1.23 07-Sep-2021  riastradh sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.22 23-May-2020  ad Move proc_lock into the data segment. It was dynamically allocated because
at the time we had mutex_obj_alloc() but not __cacheline_aligned.
 1.21 26-Jan-2018  christos branches: 1.21.8;
union was removed
 1.20 28-Aug-2017  kamil Remove the filesystem tracing feature

This is a legacy interface from 4.4BSD, and it was
introduced to overcome shortcomings of ptrace(2) at that time, which are
no longer relevant (performance). Today /proc/#/ctl offers a narrow
subset of ptrace(2) commands and is not applicable for modern
applications use beyond simplistic tracing scenarios.

This removal will simplify kernel internals. Users will still be able to
use all the other /proc files.

This change won't affect other procfs files neither Linux compat
features within mount_procfs(8). /proc/#/ctl isn't available on Linux.

Remove:
- /proc/#/ctl from mount_procfs(8)
- P_FSTRACE note from the documentation of ps(1)
- /proc/#/ctl and filesystem tracing documentation from mount_procfs(8)
- KAUTH_REQ_PROCESS_PROCFS_CTL documentation from kauth(9)
- source code file miscfs/procfs/procfs_ctl.c
- PFSctl and procfs_doctl() from sys/miscfs/procfs/procfs.h
- KAUTH_REQ_PROCESS_PROCFS_CTL from sys/sys/kauth.h
- PSL_FSTRACE (0x00010000) from sys/sys/proc.h
- P_FSTRACE (0x00010000) from sys/sys/sysctl.h

Reduce code complexity after removal of this functionality.

Update TODO.ptrace accordingly: remove two entries about /proc tracing.

Do not keep legacy notes as comments in the headers about removed
PSL_FSTRACE / P_FSTRACE, as this interface had little number of users
(close or equal to zero).

Proposed on tech-kern@.

All filesystem tracing utility users are encouraged to switch to ptrace(2).

Sponsored by <The NetBSD Foundation>
 1.19 13-Oct-2015  pgoyette branches: 1.19.10;
Don't release proc_lock until we're done looking at things that are
protected by the lock, particularly p_stat and p_waited. Found by
Robert Elz.

XXX Pullup to NetBSD-7, -6, -6-0, and -6-1
 1.18 09-Nov-2014  maxv branches: 1.18.2;
Do not uselessly include <sys/malloc.h>.
 1.17 04-Sep-2012  matt branches: 1.17.2; 1.17.14;
Add missing <machine/pcb.h> include
 1.16 07-Jul-2010  chs branches: 1.16.8; 1.16.14; 1.16.18; 1.16.20;
many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
- support new-style (NPTL) linux pthreads on all platforms.
clone() with CLONE_THREAD uses 1 process with many LWPs
instead of separate processes.
- move the contents of sys__lwp_setprivate() into a new
lwp_setprivate() and use that everywhere.
- update linux_release[] and linux32_release[] to "2.6.18".
- adjust placement of emul fork/exec/exit hooks as needed
and adjust other emul code to match.
- convert all struct emul definitions to use named initializers.
- change the pid allocator to allow multiple pids to refer to the same proc.
- remove a few fields from struct proc that are no longer needed.
- disable the non-functional "vdso" code in linux32/amd64,
glibc works fine without it.
- fix a race in the futex code where we could miss a wakeup after
a requeue operation.
- redo futex locking to be a little more efficient.
 1.15 01-Jul-2010  rmind Remove pfind() and pgfind(), fix locking in various broken uses of these.
Rename real routines to proc_find() and pgrp_find(), remove PFIND_* flags
and have consistent behaviour. Provide proc_find_raw() for special cases.
Fix memory leak in sysctl_proc_corename().

COMPAT_LINUX: rework ptrace() locking, minimise differences between
different versions per-arch.

Note: while this change adds some formal cosmetics for COMPAT_DARWIN and
COMPAT_IRIX - locking there is utterly broken (for ages).

Fixes PR/43176.
 1.14 17-Dec-2008  cegger branches: 1.14.4; 1.14.6;
kill MALLOC and FREE macros.
 1.13 28-Apr-2008  martin branches: 1.13.2; 1.13.8;
Remove clause 3 and 4 from TNF licenses
 1.12 23-Apr-2008  ad branches: 1.12.2;
Disable bitrotted linux ptrace interfaces, which are likely now a
security hole. Can be re-enabled at runtime. If you want to repair
them please look at the native implementation.
 1.11 20-Dec-2007  dsl branches: 1.11.6; 1.11.8;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.10 08-Dec-2007  dsl branches: 1.10.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.9 04-Mar-2007  christos branches: 1.9.14; 1.9.16; 1.9.24;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.8 19-Feb-2007  ad Make this build.
 1.7 09-Feb-2007  ad branches: 1.7.2;
Merge newlock2 to head.
 1.6 01-Sep-2006  matt branches: 1.6.2;
When calling PTRACE from an LKM, use sysent[SYS_ptrace].sy_call in case
the sys_ptrace symbol isn't present.
 1.5 30-Aug-2006  matt Update to deal with options PTRACE
 1.4 06-Mar-2006  thorpej Remove SET/CLR/ISSET definitions.
 1.3 18-Jan-2003  thorpej branches: 1.3.18; 1.3.24; 1.3.32; 1.3.34; 1.3.36;
Merge the nathanw_sa branch.
 1.2 27-Jan-2002  bjh21 branches: 1.2.2; 1.2.4;
Add support for PTRACE_GETREGS and PTRACE_SETREGS in ARMLinux emulation.
 1.1 14-Jan-2002  bjh21 Crude first cut at ARMLinux binary compatibility. Successfully runs
"/emul/linux/bin/echo hello, world", dynamically linked.
 1.2.4.4 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.2.4.3 04-May-2002  thorpej LWP'ify.
 1.2.4.2 28-Feb-2002  nathanw Catch up to -current.
 1.2.4.1 27-Jan-2002  nathanw file linux_ptrace.c was added on branch nathanw_sa on 2002-02-28 04:12:47 +0000
 1.2.2.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.2.2.1 27-Jan-2002  jdolecek file linux_ptrace.c was added on branch kqueue on 2002-02-11 20:09:31 +0000
 1.3.36.1 13-Mar-2006  yamt sync with head.
 1.3.34.1 22-Apr-2006  simonb Sync with head.
 1.3.32.1 09-Sep-2006  rpaulo sync with head
 1.3.24.2 07-Mar-2006  he Sorry, committed on branch in error, so back out previous removal
of SET/CLR/ISSET.
 1.3.24.1 07-Mar-2006  he Remove another instance of the macro triplet SET/CLR/ISSET, now found
in <sys/types.h>.
 1.3.18.4 21-Jan-2008  yamt sync with head
 1.3.18.3 03-Sep-2007  yamt sync with head.
 1.3.18.2 26-Feb-2007  yamt sync with head.
 1.3.18.1 21-Jun-2006  yamt sync with head.
 1.6.2.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.7.2.2 12-Mar-2007  rmind Sync with HEAD.
 1.7.2.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.9.24.1 26-Dec-2007  ad Sync with head.
 1.9.16.1 09-Jan-2008  matt sync with HEAD
 1.9.14.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.10.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.11.8.1 18-May-2008  yamt sync with head.
 1.11.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.11.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.12.2.3 11-Aug-2010  yamt sync with head.
 1.12.2.2 04-May-2009  yamt sync with head.
 1.12.2.1 16-May-2008  yamt sync with head.
 1.13.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.13.2.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.13.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.14.6.2 05-Mar-2011  rmind sync with head
 1.14.6.1 03-Jul-2010  rmind sync with head
 1.14.4.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.16.20.1 15-Nov-2015  bouyer Pull up following revision(s) (requested by pgoyette in ticket #1335):
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.31
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.19
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.29
Don't release proc_lock until we're done looking at things that are
protected by the lock, particularly p_stat and p_waited. Found by
Robert Elz.
XXX Pullup to NetBSD-7, -6, -6-0, and -6-1
 1.16.18.1 15-Nov-2015  bouyer Pull up following revision(s) (requested by pgoyette in ticket #1335):
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.31
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.19
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.29
Don't release proc_lock until we're done looking at things that are
protected by the lock, particularly p_stat and p_waited. Found by
Robert Elz.
XXX Pullup to NetBSD-7, -6, -6-0, and -6-1
 1.16.14.1 15-Nov-2015  bouyer Pull up following revision(s) (requested by pgoyette in ticket #1335):
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.31
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.19
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.29
Don't release proc_lock until we're done looking at things that are
protected by the lock, particularly p_stat and p_waited. Found by
Robert Elz.
XXX Pullup to NetBSD-7, -6, -6-0, and -6-1
 1.16.8.1 30-Oct-2012  yamt sync with head
 1.17.14.2 05-Nov-2015  snj Pull up following revision(s) (requested by pgoyette in ticket #998):
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.19
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.31
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.29
Don't release proc_lock until we're done looking at things that are
protected by the lock, particularly p_stat and p_waited. Found by
Robert Elz.
 1.17.14.1 17-Jan-2015  martin branches: 1.17.14.1.2;
Pull up following revision(s) (requested by maxv in ticket #427):
sys/compat/svr4/svr4_schedctl.c: revision 1.8
sys/netinet/tcp_timer.c: revision 1.88
sys/miscfs/genfs/layer_vfsops.c: revision 1.45
sys/compat/svr4/svr4_ioctl.c: revision 1.37
sys/ufs/chfs/chfs_vfsops.c: revision 1.14
sys/miscfs/fdesc/fdesc_vfsops.c: revision 1.91
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.30
sys/compat/common/kern_time_50.c: revision 1.28
sys/netinet6/ip6_forward.c: revision 1.74
sys/miscfs/umapfs/umap_vnops.c: revision 1.57
sys/compat/svr4/svr4_fcntl.c: revision 1.74
distrib/sets/lists/comp/mi: revision 1.1931
sys/netinet6/udp6_output.c: revision 1.46
sys/fs/puffs/puffs_compat.c: revision 1.3
sys/fs/udf/udf_rename.c: revision 1.11
sys/compat/svr4/svr4_filio.c: revision 1.24
sys/fs/udf/udf_rename.c: revision 1.12
sys/netinet/tcp_usrreq.c: revision 1.202
sys/miscfs/umapfs/umap_subr.c: revision 1.29
sys/compat/linux/common/linux_fadvise64.c: revision 1.3
sys/netinet/if_atm.c: revision 1.34
sys/miscfs/procfs/procfs_subr.c: revision 1.106
sys/miscfs/genfs/layer_subr.c: revision 1.37
sys/netinet/tcp_sack.c: revision 1.30
sys/compat/freebsd/freebsd_misc.c: revision 1.33
sys/compat/freebsd/freebsd_file.c: revision 1.33
sys/ufs/chfs/chfs_vnode.c: revision 1.12
sys/compat/svr4/svr4_ttold.c: revision 1.34
sys/compat/linux/common/linux_file.c: revision 1.114
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.43
sys/compat/linux/common/linux_signal.c: revision 1.76
sys/compat/common/compat_util.c: revision 1.46
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.18
sys/compat/svr4/svr4_sockio.c: revision 1.36
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.32
sys/compat/svr4/svr4_signal.c: revision 1.66
sys/kern/kern_exec.c: revision 1.410
sys/fs/puffs/puffs_vfsops.c: revision 1.115
sys/compat/svr4/svr4_exec_elf64.c: revision 1.15
sys/compat/linux/arch/i386/linux_machdep.c: revision 1.159
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.50
sys/compat/linux32/common/linux32_misc.c: revision 1.24
sys/netinet/in_pcb.c: revision 1.153
sys/sys/malloc.h: revision 1.116
sys/compat/common/if_43.c: revision 1.9
share/man/man9/Makefile: revision 1.380
sys/netinet/tcp_vtw.c: revision 1.12
sys/miscfs/umapfs/umap_vfsops.c: revision 1.95
sys/ufs/ext2fs/ext2fs_vfsops.c: revision 1.186
sys/compat/common/uipc_syscalls_43.c: revision 1.46
sys/ufs/ext2fs/ext2fs_vnops.c: revision 1.115
sys/fs/puffs/puffs_msgif.c: revision 1.97
sys/compat/svr4/svr4_ipc.c: revision 1.27
sys/compat/linux/common/linux_exec.c: revision 1.117
sys/ufs/ext2fs/ext2fs_readwrite.c: revision 1.66
sys/netinet/tcp_output.c: revision 1.179
sys/compat/svr4/svr4_termios.c: revision 1.28
sys/fs/udf/udf_strat_bootstrap.c: revision 1.4
sys/fs/puffs/puffs_subr.c: revision 1.67
sys/fs/puffs/puffs_node.c: revision 1.36
sys/miscfs/overlay/overlay_vnops.c: revision 1.21
sys/fs/cd9660/cd9660_node.c: revision 1.34
sys/netinet/raw_ip.c: revision 1.146
sys/sys/mallocvar.h: revision 1.13
sys/miscfs/overlay/overlay_vfsops.c: revision 1.63
share/man/man9/malloc.9: revision 1.50
sys/netinet6/dest6.c: revision 1.18
sys/compat/linux/common/linux_uselib.c: revision 1.33
sys/compat/linux/common/linux_socket.c: revision 1.120
share/man/man9/malloc.9: revision 1.51
sys/netinet/tcp_subr.c: revision 1.257
sys/compat/linux/common/linux_socketcall.c: revision 1.45
sys/compat/linux/common/linux_fadvise64_64.c: revision 1.3
sys/compat/freebsd/freebsd_ipc.c: revision 1.17
sys/compat/linux/common/linux_misc_notalpha.c: revision 1.109
sys/compat/linux/arch/alpha/linux_pipe.c: revision 1.17
sys/netinet6/in6_pcb.c: revision 1.132
sys/netinet6/in6_ifattach.c: revision 1.94
sys/compat/svr4/svr4_exec_elf32.c: revision 1.15
sys/miscfs/nullfs/null_vfsops.c: revision 1.90
sys/fs/cd9660/cd9660_util.c: revision 1.12
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.48
sys/compat/freebsd/freebsd_exec_elf32.c: revision 1.20
sys/miscfs/procfs/procfs_vfsops.c: revision 1.94
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.28
sys/compat/linux/common/linux_sched.c: revision 1.67
sys/compat/linux/common/linux_exec_aout.c: revision 1.67
sys/compat/linux/common/linux_pipe.c: revision 1.67
sys/compat/linux/common/linux_llseek.c: revision 1.34
sys/compat/linux/arch/mips/linux_ptrace.c: revision 1.10
Do not uselessly include <sys/malloc.h>.
Cleanup:
- remove struct kmembuckets (dead)
- correctly deadify MALLOC_XX
- remove MALLOC_DEFINE_LIMIT and MALLOC_JUSTDEFINE_LIMIT (dead)
- remove malloc_roundup(), malloc_type_setlimit(), MALLOC_DEFINE_LIMIT()
and MALLOC_JUSTDEFINE_LIMIT() from man 9 malloc
New sentence, new line. Bump date for previous.
Obsolete malloc_roundup(9), malloc_type_setlimit(9) and MALLOC_DEFINE_LIMIT(9)
man pages.
 1.17.14.1.2.1 05-Nov-2015  snj Pull up following revision(s) (requested by pgoyette in ticket #998):
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.19
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.31
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.29
Don't release proc_lock until we're done looking at things that are
protected by the lock, particularly p_stat and p_waited. Found by
Robert Elz.
 1.17.2.1 03-Dec-2017  jdolecek update from HEAD
 1.18.2.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.19.10.2 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1836):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.19.10.1 12-Apr-2018  martin Pull up following revision(s) (requested by kamil in ticket #713):

sys/modules/procfs/Makefile: revision 1.4
sys/miscfs/procfs/procfs_vfsops.c: revision 1.98
bin/ps/ps.1: revision 1.108
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.32
sys/miscfs/procfs/procfs_vnops.c: revision 1.198
sys/kern/sys_ptrace_common.c: revision 1.23
sys/kern/sys_ptrace_common.c: revision 1.24
sbin/mount_procfs/mount_procfs.8: revision 1.36
sys/kern/sys_ptrace_common.c: revision 1.25
sys/kern/sys_ptrace.c: revision 1.5
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.30
sys/sys/proc.h: revision 1.342
sys/kern/sys_ptrace_common.c: revision 1.26
sys/miscfs/procfs/procfs_ctl.c: file removal
sys/kern/sys_ptrace_common.c: revision 1.27
sys/miscfs/procfs/procfs_subr.c: revision 1.109
sys/kern/sys_ptrace_common.c: revision 1.28
sys/secmodel/extensions/secmodel_extensions.c: revision 1.8
sys/kern/sys_ptrace_common.c: revision 1.29
sys/sys/ptrace.h: revision 1.62
sys/compat/netbsd32/netbsd32_signal.c: revision 1.45
share/man/man9/kauth.9: revision 1.109
sys/miscfs/procfs/files.procfs: revision 1.12
sys/compat/netbsd32/netbsd32.h: revision 1.115
sys/miscfs/procfs/procfs.h: revision 1.72
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.5
sys/kern/kern_sig.c: revision 1.337
sys/sys/kauth.h: revision 1.75
sys/sys/sysctl.h: revision 1.224
sys/kern/sys_ptrace_common.c: revision 1.30
sys/kern/sys_ptrace_common.c: revision 1.31
sys/kern/sys_ptrace_common.c: revision 1.32
sys/kern/sys_ptrace_common.c: revision 1.33
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.20
sys/kern/sys_ptrace_common.c: revision 1.34
sys/kern/sys_ptrace_common.c: revision 1.36
sys/kern/kern_proc.c: revision 1.207
sys/kern/kern_exit.c: revision 1.269
doc/TODO.ptrace: revision 1.29

Make {s,g}et{db,fp,}regs work again for PK_32 processes
XXX: pullup-8

add disgusting magic to handle compat_netbsd32 as a module.

use process_*reg32 instead of struct *reg32.

Remove the filesystem tracing feature

This is a legacy interface from 4.4BSD, and it was
introduced to overcome shortcomings of ptrace(2) at that time, which are
no longer relevant (performance). Today /proc/#/ctl offers a narrow
subset of ptrace(2) commands and is not applicable for modern
applications use beyond simplistic tracing scenarios.

This removal will simplify kernel internals. Users will still be able to
use all the other /proc files.

This change won't affect other procfs files neither Linux compat
features within mount_procfs(8). /proc/#/ctl isn't available on Linux.

Remove:
- /proc/#/ctl from mount_procfs(8)
- P_FSTRACE note from the documentation of ps(1)
- /proc/#/ctl and filesystem tracing documentation from mount_procfs(8)
- KAUTH_REQ_PROCESS_PROCFS_CTL documentation from kauth(9)
- source code file miscfs/procfs/procfs_ctl.c
- PFSctl and procfs_doctl() from sys/miscfs/procfs/procfs.h
- KAUTH_REQ_PROCESS_PROCFS_CTL from sys/sys/kauth.h
- PSL_FSTRACE (0x00010000) from sys/sys/proc.h
- P_FSTRACE (0x00010000) from sys/sys/sysctl.h

Reduce code complexity after removal of this functionality.

Update TODO.ptrace accordingly: remove two entries about /proc tracing.

Do not keep legacy notes as comments in the headers about removed

PSL_FSTRACE / P_FSTRACE, as this interface had little number of users
(close or equal to zero).
Proposed on tech-kern@.

All filesystem tracing utility users are encouraged to switch to ptrace(2).

Sponsored by <The NetBSD Foundation>

untangle the mess:
- factor out common code
- break each ptrace subcall to its own sub-function
.. more to come ...
- reduce ifdef ugliness by moving it up top.
- factor out PT_IO and make PT_{READ,WRITE}_{I,D} use it
- factor out PT_DUMPCORE
- factor out sendsig code
.. more to come ...

handle siginfo requests for ptrace32

ptrace: Partially undo PT_{READ,WRITE}_{I,D} and unbreak these commands

The refactored code did not work and was generating EFAULT.

Sponsored by <The NetBSD Foundation>

Merge the code back; the problem was that since we are reading/writing
to a kernel address for PT_{READ,WRITE}_{I,D} we need the kernel vmspace.
provide separate read and write functions to accomodate register functions
that need a size argument.

don't ignore error from copyout_piod

Use the proper process (the tracee) to get information about lwps and
registers and the tracer for vmspace.

Add new sysctl(3) entry: security.models.extensions.user_set_dbregs

Model this new sysctl(3) entry after "user_set_cpu_affinity" in the same
level of sysctl(3) switches.

Allow to read unconditionally Debug Registers (no change here). This is
convenient as even if a user of a debugger does not use hardware assisted
watchpoints/breakpoints, a debugger can still prompt these values to store
in an internal cache with context of registers. Reading them should have
no security concerns.

Add a paranoid MI switch that prohibits by default setting these registers
by a regular user (non-superuser). Make this switch disabled by default.
There are enough reserved bits out there to allow using them
unconditionally on hardened hosts.

Features shipped with Debug Registers are optional features in debuggers.
There is no reduction in elementary functionality.

Reviewed by <christos>

Sponsored by <The NetBSD Foundation>
 1.21.8.1 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.4 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.3 31-Mar-2002  christos branches: 1.3.108; 1.3.110; 1.3.112;
bring the reverse signal mapping array into linux_signo.c
 1.2 31-Mar-2002  christos make signal array handling uniform, and put signal arrays in a separate
file. This is simular to errno array handling.
 1.1 14-Jan-2002  bjh21 branches: 1.1.2; 1.1.4;
Crude first cut at ARMLinux binary compatibility. Successfully runs
"/emul/linux/bin/echo hello, world", dynamically linked.
 1.1.4.3 17-Apr-2002  nathanw Catch up to -current.
 1.1.4.2 28-Feb-2002  nathanw Catch up to -current.
 1.1.4.1 14-Jan-2002  nathanw file linux_sigarray.c was added on branch nathanw_sa on 2002-02-28 04:12:47 +0000
 1.1.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.2.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.1.2.1 14-Jan-2002  jdolecek file linux_sigarray.c was added on branch kqueue on 2002-02-11 20:09:31 +0000
 1.3.112.1 16-May-2008  yamt sync with head.
 1.3.110.1 18-May-2008  yamt sync with head.
 1.3.108.1 02-Jun-2008  mjf Sync with HEAD.
 1.2 08-Jun-2009  njoly Various compat linux siginfo fixes.
- alpha: add missing _uid member to SIGCHLD structure.
- amd64: add missing typedef, and fix padding size.
- arm: add missing linux_siginfo definition.
 1.1 14-Jan-2002  bjh21 branches: 1.1.2; 1.1.4; 1.1.122; 1.1.138;
Crude first cut at ARMLinux binary compatibility. Successfully runs
"/emul/linux/bin/echo hello, world", dynamically linked.
 1.1.138.1 23-Jul-2009  jym Sync with HEAD.
 1.1.122.1 20-Jun-2009  yamt sync with head
 1.1.4.2 28-Feb-2002  nathanw Catch up to -current.
 1.1.4.1 14-Jan-2002  nathanw file linux_siginfo.h was added on branch nathanw_sa on 2002-02-28 04:12:47 +0000
 1.1.2.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.1.2.1 14-Jan-2002  jdolecek file linux_siginfo.h was added on branch kqueue on 2002-02-11 20:09:31 +0000
 1.9 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.8 04-Dec-2007  dsl branches: 1.8.12; 1.8.14; 1.8.16;
Remove all the __P
 1.7 11-Dec-2005  christos branches: 1.7.44; 1.7.46; 1.7.52; 1.7.56;
merge ktrace-lwp.
 1.6 19-Sep-2005  christos MINSIGSTKSZ on linux is different depending on the platform and usually
smaller than ours.
 1.5 19-May-2005  manu branches: 1.5.2;
Add support for Linux SA_RESTORER on amd64.
 1.4 26-Nov-2002  christos branches: 1.4.6;
rename: s/sa_/<compat>sa/g
 1.3 19-Mar-2002  christos - Now that RT-signals fit, fix the array to deliver them. [i386 only].
- jdk-1.4 works perfectly now. :-)
 1.2 17-Feb-2002  bjh21 branches: 1.2.2;
Add LINUX_SA_NOCLDWAIT.
 1.1 14-Jan-2002  bjh21 branches: 1.1.2;
Crude first cut at ARMLinux binary compatibility. Successfully runs
"/emul/linux/bin/echo hello, world", dynamically linked.
 1.1.2.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.2.3 16-Mar-2002  jdolecek Catch up with -current.
 1.1.2.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.1.2.1 14-Jan-2002  jdolecek file linux_signal.h was added on branch kqueue on 2002-02-11 20:09:31 +0000
 1.2.2.4 11-Dec-2002  thorpej Sync with HEAD.
 1.2.2.3 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.2.2.2 28-Feb-2002  nathanw Catch up to -current.
 1.2.2.1 17-Feb-2002  nathanw file linux_signal.h was added on branch nathanw_sa on 2002-02-28 04:12:47 +0000
 1.4.6.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.5.2.2 07-Dec-2007  yamt sync with head
 1.5.2.1 21-Jun-2006  yamt sync with head.
 1.7.56.1 08-Dec-2007  ad Sync with head.
 1.7.52.1 08-Dec-2007  mjf Sync with HEAD.
 1.7.46.1 09-Jan-2008  matt sync with HEAD
 1.7.44.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.8.16.1 16-May-2008  yamt sync with head.
 1.8.14.1 18-May-2008  yamt sync with head.
 1.8.12.1 02-Jun-2008  mjf Sync with HEAD.
 1.5 25-Jan-2014  njoly Update linux socket socket options (SO_*). Add common version to its
own file (linux_socket_generic.h); use it for all but alpha and mips.
 1.4 28-Apr-2008  martin branches: 1.4.34; 1.4.44; 1.4.50;
Remove clause 3 and 4 from TNF licenses
 1.3 11-Dec-2005  christos branches: 1.3.70; 1.3.72; 1.3.74;
merge ktrace-lwp.
 1.2 26-Jul-2003  jdolecek add LINUX_SO_PEERNAME, LINUX_SO_TIMESTAMP where it has been missing
fix value for LINUX_SO_DETACH_FILTER on couple places (unused anyway)

g/c LINUX_SCM_TIMESTAMP definition for some archs, it will be defined
in generic linux_socket.h
 1.1 14-Jan-2002  bjh21 branches: 1.1.2; 1.1.4; 1.1.20;
Crude first cut at ARMLinux binary compatibility. Successfully runs
"/emul/linux/bin/echo hello, world", dynamically linked.
 1.1.20.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.20.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.20.1 03-Aug-2004  skrll Sync with HEAD
 1.1.4.2 28-Feb-2002  nathanw Catch up to -current.
 1.1.4.1 14-Jan-2002  nathanw file linux_socket.h was added on branch nathanw_sa on 2002-02-28 04:12:48 +0000
 1.1.2.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.1.2.1 14-Jan-2002  jdolecek file linux_socket.h was added on branch kqueue on 2002-02-11 20:09:31 +0000
 1.3.74.1 16-May-2008  yamt sync with head.
 1.3.72.1 18-May-2008  yamt sync with head.
 1.3.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.4.50.1 18-May-2014  rmind sync with head
 1.4.44.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.4.34.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.15 24-Jan-2018  skrll Remove port-acorn26

OK core@
 1.14 07-Jul-2010  chs many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
- support new-style (NPTL) linux pthreads on all platforms.
clone() with CLONE_THREAD uses 1 process with many LWPs
instead of separate processes.
- move the contents of sys__lwp_setprivate() into a new
lwp_setprivate() and use that everywhere.
- update linux_release[] and linux32_release[] to "2.6.18".
- adjust placement of emul fork/exec/exit hooks as needed
and adjust other emul code to match.
- convert all struct emul definitions to use named initializers.
- change the pid allocator to allow multiple pids to refer to the same proc.
- remove a few fields from struct proc that are no longer needed.
- disable the non-functional "vdso" code in linux32/amd64,
glibc works fine without it.
- fix a race in the futex code where we could miss a wakeup after
a requeue operation.
- redo futex locking to be a little more efficient.
 1.13 20-Dec-2007  dsl branches: 1.13.10; 1.13.30; 1.13.32;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.12 11-May-2006  yamt branches: 1.12.34; 1.12.44; 1.12.48;
cleanup user.h.
- remove several #include which are not directly related to
this header anymore. tweak *.c accordingly.
- update comments.
- move some !_KERNEL #include to proc.h because it's more appropriate
place these days.
- whitespace.
 1.11 11-Dec-2005  christos branches: 1.11.4; 1.11.6; 1.11.8; 1.11.10; 1.11.12;
merge ktrace-lwp.
 1.10 26-Feb-2005  perry branches: 1.10.4;
nuke trailing whitespace
 1.9 10-Oct-2003  matt branches: 1.9.8; 1.9.10;
Adapt ARM Linux compat code to deal with SIGINFO.
 1.8 18-Jan-2003  thorpej branches: 1.8.2;
Merge the nathanw_sa branch.
 1.7 24-Mar-2002  bjh21 arm26->acorn26 transition.
 1.6 10-Mar-2002  bjh21 __RCSID -> __KERNEL_RCSID
 1.5 10-Mar-2002  bjh21 Id -> NetBSD in RCSID (oops).
 1.4 02-Feb-2002  bjh21 branches: 1.4.2; 1.4.4;
cpu_cache_syncI_rng -> cpu_icache_sync_range
 1.3 02-Feb-2002  bjh21 Get rid of "unused variable" warnings on arm26.
 1.2 27-Jan-2002  bjh21 Add support for breakpoints to ARMLinux emulation.
 1.1 23-Jan-2002  bjh21 Add support for the ARM-specific syscalls in ARMLinux. These are invoked
by SWI numbers above 0x9f0000, but we re-map them down to somewhere just
after the end of the usual syscall range, since NetBSD doesn't handle
sparse syscall arrays well.

The only syscall I've actually implemented in this range is cacheflush(),
which was previously being mapped to fork(), causing ... interesting results.
 1.4.4.4 04-May-2002  thorpej LWP'ify.
 1.4.4.3 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.4.4.2 28-Feb-2002  nathanw Catch up to -current.
 1.4.4.1 02-Feb-2002  nathanw file linux_sys_machdep.c was added on branch nathanw_sa on 2002-02-28 04:12:48 +0000
 1.4.2.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.4.2.3 16-Mar-2002  jdolecek Catch up with -current.
 1.4.2.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.4.2.1 02-Feb-2002  jdolecek file linux_sys_machdep.c was added on branch kqueue on 2002-02-11 20:09:31 +0000
 1.8.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.8.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.8.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.8.2.1 03-Aug-2004  skrll Sync with HEAD
 1.9.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.9.8.1 29-Apr-2005  kent sync with -current
 1.10.4.2 21-Jan-2008  yamt sync with head
 1.10.4.1 21-Jun-2006  yamt sync with head.
 1.11.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.11.10.1 11-May-2006  elad sync with head
 1.11.8.1 24-May-2006  yamt sync with head.
 1.11.6.1 01-Jun-2006  kardel Sync with head.
 1.11.4.1 09-Sep-2006  rpaulo sync with head
 1.12.48.1 02-Jan-2008  bouyer Sync with HEAD
 1.12.44.1 26-Dec-2007  ad Sync with head.
 1.12.34.1 09-Jan-2008  matt sync with HEAD
 1.13.32.1 05-Mar-2011  rmind sync with head
 1.13.30.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.13.10.1 11-Aug-2010  yamt sync with head.
 1.96 26-Oct-2025  christos regen
 1.95 28-Sep-2024  christos regen
 1.94 01-Jul-2024  christos regen
 1.93 29-Jun-2024  christos branches: 1.93.2;
regen
 1.92 19-Aug-2023  christos regen
 1.91 18-Aug-2023  christos regen
 1.90 29-Jul-2023  christos regen
 1.89 28-Jul-2023  christos regen
 1.88 02-Dec-2021  ryo regen
 1.87 24-Nov-2021  ryo regen
 1.86 20-Sep-2021  thorpej Regen for preadv(2) / pwritev(2).
 1.85 20-Sep-2021  thorpej Regen for eventfd.
 1.84 19-Sep-2021  thorpej Regen for timerfd.
 1.83 19-Sep-2021  thorpej Regen for POSIX timer syscalls.
 1.82 26-Apr-2020  thorpej branches: 1.82.2;
Regen for native futex calls.
 1.81 09-Nov-2019  jdolecek regen
 1.80 10-Aug-2018  pgoyette Regen
 1.79 10-May-2017  riastradh branches: 1.79.8; 1.79.10;
regen
 1.78 03-Feb-2017  christos branches: 1.78.4;
regen
 1.77 03-Feb-2017  martin Regen for accept4
 1.76 16-Jan-2017  christos regen all
 1.75 15-Jan-2017  christos branches: 1.75.2;
regen
 1.74 15-Jan-2017  christos regen
 1.73 15-Jan-2017  christos regen
 1.72 13-Jan-2017  christos regen
 1.71 02-Jan-2017  martin Regen (something apparently went wrong in previous)
 1.70 02-Jan-2017  manu Regen
 1.69 24-Jul-2016  njoly Regen for readlink/readlinkat signatures.
 1.68 23-Mar-2015  ozaki-r branches: 1.68.2;
Regen
 1.67 23-Mar-2015  ozaki-r Regen
 1.66 07-Mar-2015  christos regen
 1.65 22-Nov-2014  njoly branches: 1.65.2;
Regen for ppoll signature fix
 1.64 31-May-2014  njoly branches: 1.64.2;
Regen for munmap(2) signature.
 1.63 29-May-2014  njoly Regen for utimes(2) change.
 1.62 20-May-2014  njoly Regen for getgroups/setgroups update.
 1.61 17-May-2014  njoly Regen for fadvise64 offset types changes.
 1.60 06-May-2014  njoly Regen for mknod device argument type change.
 1.59 04-May-2014  njoly Regen for pread/pwrite 64bit offset argument.
 1.58 08-Apr-2014  njoly Regen.
 1.57 08-Dec-2013  njoly branches: 1.57.2;
Regen.
 1.56 19-Nov-2013  chs regen
 1.55 07-Nov-2013  njoly Regen for dup/dup2/dup3 argument types fix.
 1.54 24-Sep-2013  njoly Regen for utimensat(2).
 1.53 08-Apr-2013  pooka branches: 1.53.4;
regen for utimes
 1.52 19-Sep-2012  pooka regen for ppoll (and, apparently, SYCALL_ARG_PTR)
 1.51 18-Nov-2011  christos branches: 1.51.10;
- add sigtimedwait support.
- merge the siginfo population code.
 1.50 30-May-2011  alnsn branches: 1.50.4;
Regenerate files to pick up correct RCS Ids. Suggested by Chris Badura.
 1.49 30-May-2011  alnsn Add fadvise64 and fadvise64_64 syscalls to compat_linux and compat_linux32.
 1.48 15-Apr-2011  he Regenerate these files after adding pipe2() and dup3().
 1.47 07-Jul-2010  chs branches: 1.47.2;
regen
 1.46 14-Dec-2009  matt branches: 1.46.2; 1.46.4;
Regen (new makesyscalls.sh)
 1.45 24-Nov-2009  njoly Regen for personality(2) update.
 1.44 08-Jun-2009  njoly Regen for rt_queueinfo(2) update.
 1.43 17-Jan-2009  njoly branches: 1.43.2;
Regen for wait4 update.
 1.42 15-Jan-2009  njoly Rengen for compat50 update.
 1.41 13-Jan-2009  pooka Regen to prove I didn't screw up the conversion: purely RCSID changes.
 1.40 13-Jan-2009  rtr actually commit syscalls.master this time
add back blank line between #include <sys/.. and #include <sys/compat/..
regen
 1.39 12-Jan-2009  rtr regen for christos_time_t merge
 1.38 19-Nov-2008  ad Regen.
 1.37 12-Nov-2008  njoly Regen for nanosleep(2) fix.
 1.36 23-Apr-2008  ad branches: 1.36.2; 1.36.4; 1.36.8; 1.36.10; 1.36.12;
Regen.
 1.35 04-Apr-2008  njoly branches: 1.35.2;
Regen for linux_sys_msync removal.
 1.34 15-Jan-2008  njoly branches: 1.34.6;
Regen.
 1.33 24-Dec-2007  njoly Regen for linux_sys_getpgid removal.
 1.32 21-Dec-2007  njoly Regen for getfsuid/setfsgid syscall exchange.
 1.31 20-Dec-2007  dsl regen
 1.30 16-Nov-2007  njoly branches: 1.30.2; 1.30.6;
Regen, for syscalls cleanup.
 1.29 04-Mar-2007  christos branches: 1.29.14; 1.29.16; 1.29.20; 1.29.22;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.28 01-Sep-2006  matt branches: 1.28.8;
Regen.
 1.27 30-Aug-2006  matt Regen
 1.26 10-Jun-2006  christos regen
 1.25 11-Dec-2005  christos branches: 1.25.4; 1.25.8; 1.25.14;
merge ktrace-lwp.
 1.24 16-May-2005  fvdl branches: 1.24.2;
Regen.
 1.23 16-May-2005  fvdl Regen.
 1.22 26-Feb-2005  perry regen
 1.21 26-Feb-2005  perry regen
 1.20 20-Sep-2004  jdolecek branches: 1.20.4; 1.20.6;
regen:
implement support for Linux statfs64() syscall - 64bit variant of statfs()
 1.19 08-Sep-2004  jdolecek regen: add exit_group(2)
 1.18 01-Aug-2004  jdolecek regen:

add stub entries for syscalls added until Linux kernel 2.6.7

move the ARM-specific syscall range up to offset 0x180, to make room
for the new syscalls
 1.17 01-Aug-2004  jdolecek regen:

connect madvise(2) and mincore(2) - apparently the newer Linux libs
don't stub it anymore, so allow the application to take advantage
of them

the Linux calls appear to be compatible in the flag values and semantics,
so a wrapper is not necessary
 1.16 10-Aug-2003  jdolecek regen - added wrapper for Linux ftruncate64()
 1.15 28-Jun-2003  he branches: 1.15.2;
Regenerate after adding include of linux_mmap.h.
 1.14 23-Jun-2003  christos Regen.
 1.13 18-Jan-2003  thorpej Regen to get correct RCS IDs.
 1.12 18-Jan-2003  thorpej Regen: Merge the nathanw_sa branch.
 1.11 12-May-2002  jdolecek branches: 1.11.4;
regen - hook linux_sys_fcntl64()
 1.10 10-Apr-2002  christos regen
 1.9 22-Mar-2002  christos regen
 1.8 17-Feb-2002  bjh21 branches: 1.8.2;
Regen.
 1.7 15-Feb-2002  christos - add a real linux_sys___sysctl because the mib numbers are different.
implement only the kernel version getting entries.
- make the signal conversion functions consistent; dest is arg 1.
- make linux_fakedev deal with block and char devices differently.
- add linux_sys_ugetrlimit, and flesh out the regular get/setrlimit so
that they work properly.
- add linux_mmap2 [untested].
- bump kernel to 2.4.18, and make the date be valentine's day :-)
- linux_sys_*stat64 family was totally busted. Fix it.

tested only on i386.

Status:
gdb, telnet, work
jdk-1.4.0 extractor works, jdk still coredumps.

christos
 1.6 27-Jan-2002  bjh21 branches: 1.6.2;
Regen (breakpoint() implemented).
 1.5 27-Jan-2002  bjh21 Regen (prototype for linux_sys_nosys()).
 1.4 23-Jan-2002  bjh21 Regen (sys_nosys -> linux_sys_nosys).
 1.3 23-Jan-2002  bjh21 Regen (cacheflush() and remove syscall 0).
 1.2 15-Jan-2002  bjh21 Regen.
 1.1 14-Jan-2002  bjh21 Generated files for ARMLinux binary compatibility.
 1.6.2.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.6.2.3 16-Mar-2002  jdolecek Catch up with -current.
 1.6.2.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.6.2.1 27-Jan-2002  jdolecek file linux_syscall.h was added on branch kqueue on 2002-02-11 20:09:31 +0000
 1.8.2.7 20-Jun-2002  nathanw Catch up to -current.
 1.8.2.6 29-May-2002  nathanw Regen.
 1.8.2.5 04-May-2002  thorpej Regen.
 1.8.2.4 17-Apr-2002  nathanw Catch up to -current.
 1.8.2.3 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.8.2.2 28-Feb-2002  nathanw Catch up to -current.
 1.8.2.1 17-Feb-2002  nathanw file linux_syscall.h was added on branch nathanw_sa on 2002-02-28 04:12:48 +0000
 1.11.4.4 14-Jun-2004  jmc Regen for changes in ticket #1708
 1.11.4.3 11-May-2004  tron Regen for ticket 1686.
 1.11.4.2 20-Nov-2003  jmc Regen after fix in syscalls.master from ticket #1427.
 1.11.4.1 22-Oct-2003  jmc Regen files (requested by tv in ticket #1427)

Proper support for mmap2
 1.15.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.15.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.15.2.4 24-Sep-2004  skrll Sync with HEAD.
 1.15.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.15.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.15.2.1 03-Aug-2004  skrll Sync with HEAD
 1.20.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.20.4.1 29-Apr-2005  kent sync with -current
 1.24.2.5 21-Jan-2008  yamt sync with head
 1.24.2.4 07-Dec-2007  yamt sync with head
 1.24.2.3 03-Sep-2007  yamt sync with head.
 1.24.2.2 30-Dec-2006  yamt sync with head.
 1.24.2.1 21-Jun-2006  yamt sync with head.
 1.25.14.1 19-Jun-2006  chap Sync with head.
 1.25.8.2 03-Sep-2006  yamt sync with head.
 1.25.8.1 26-Jun-2006  yamt sync with head.
 1.25.4.1 09-Sep-2006  rpaulo sync with head
 1.28.8.1 12-Mar-2007  rmind Sync with HEAD.
 1.29.22.3 18-Feb-2008  mjf Sync with HEAD.
 1.29.22.2 27-Dec-2007  mjf Sync with HEAD.
 1.29.22.1 19-Nov-2007  mjf Sync with HEAD.
 1.29.20.1 18-Nov-2007  bouyer Sync with HEAD
 1.29.16.2 23-Mar-2008  matt sync with HEAD
 1.29.16.1 09-Jan-2008  matt sync with HEAD
 1.29.14.1 21-Nov-2007  joerg Sync with HEAD.
 1.30.6.2 19-Jan-2008  bouyer Sync with HEAD
 1.30.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.30.2.1 26-Dec-2007  ad Sync with head.
 1.34.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.34.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.35.2.1 18-May-2008  yamt sync with head.
 1.36.12.1 20-Nov-2008  snj Regen for ticket 81.
 1.36.10.1 19-Jan-2009  skrll Sync with HEAD.
 1.36.8.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.36.4.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.36.2.4 11-Aug-2010  yamt sync with head.
 1.36.2.3 11-Mar-2010  yamt sync with head
 1.36.2.2 20-Jun-2009  yamt sync with head
 1.36.2.1 04-May-2009  yamt sync with head.
 1.43.2.1 23-Jul-2009  jym Sync with HEAD.
 1.46.4.3 31-May-2011  rmind sync with head
 1.46.4.2 21-Apr-2011  rmind sync with head
 1.46.4.1 05-Mar-2011  rmind sync with head
 1.46.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.47.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.50.4.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.50.4.2 30-Oct-2012  yamt sync with head
 1.50.4.1 17-Apr-2012  yamt sync with head
 1.51.10.4 03-Dec-2017  jdolecek update from HEAD
 1.51.10.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.51.10.2 23-Jun-2013  tls resync from head
 1.51.10.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.53.4.1 18-May-2014  rmind sync with head
 1.57.2.1 10-Aug-2014  tls Rebase.
 1.64.2.1 17-Apr-2017  snj regen for ticket 1354
 1.65.2.3 05-Feb-2017  skrll Sync with HEAD
 1.65.2.2 05-Oct-2016  skrll Sync with HEAD
 1.65.2.1 06-Apr-2015  skrll Sync with HEAD
 1.68.2.3 20-Mar-2017  pgoyette Sync with HEAD
 1.68.2.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.68.2.1 26-Jul-2016  pgoyette Sync with HEAD
 1.75.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.78.4.1 11-May-2017  pgoyette Sync with HEAD
 1.79.10.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.79.10.1 10-Jun-2019  christos Sync with HEAD
 1.79.8.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.82.2.2 17-Dec-2020  thorpej Regen for preadv(2) and pwritev(2).
 1.82.2.1 15-Dec-2020  thorpej Regen for eventfd, timerfd, POSIX timers.
 1.93.2.1 02-Aug-2025  perseant Sync with HEAD
 1.96 26-Oct-2025  christos regen
 1.95 28-Sep-2024  christos regen
 1.94 01-Jul-2024  christos regen
 1.93 29-Jun-2024  christos branches: 1.93.2;
regen
 1.92 19-Aug-2023  christos regen
 1.91 18-Aug-2023  christos regen
 1.90 29-Jul-2023  christos regen
 1.89 28-Jul-2023  christos regen
 1.88 02-Dec-2021  ryo regen
 1.87 24-Nov-2021  ryo regen
 1.86 20-Sep-2021  thorpej Regen for preadv(2) / pwritev(2).
 1.85 20-Sep-2021  thorpej Regen for eventfd.
 1.84 19-Sep-2021  thorpej Regen for timerfd.
 1.83 19-Sep-2021  thorpej Regen for POSIX timer syscalls.
 1.82 26-Apr-2020  thorpej branches: 1.82.2;
Regen for native futex calls.
 1.81 09-Nov-2019  jdolecek regen
 1.80 10-Aug-2018  pgoyette Regen
 1.79 10-May-2017  riastradh branches: 1.79.8; 1.79.10;
regen
 1.78 03-Feb-2017  christos branches: 1.78.4;
regen
 1.77 03-Feb-2017  martin Regen for accept4
 1.76 16-Jan-2017  christos regen all
 1.75 15-Jan-2017  christos branches: 1.75.2;
regen
 1.74 15-Jan-2017  christos regen
 1.73 15-Jan-2017  christos regen
 1.72 13-Jan-2017  christos regen
 1.71 02-Jan-2017  martin Regen (something apparently went wrong in previous)
 1.70 02-Jan-2017  manu Regen
 1.69 24-Jul-2016  njoly Regen for readlink/readlinkat signatures.
 1.68 23-Mar-2015  ozaki-r branches: 1.68.2;
Regen
 1.67 23-Mar-2015  ozaki-r Regen
 1.66 07-Mar-2015  christos regen
 1.65 22-Nov-2014  njoly branches: 1.65.2;
Regen for ppoll signature fix
 1.64 31-May-2014  njoly branches: 1.64.2;
Regen for munmap(2) signature.
 1.63 29-May-2014  njoly Regen for utimes(2) change.
 1.62 20-May-2014  njoly Regen for getgroups/setgroups update.
 1.61 17-May-2014  njoly Regen for fadvise64 offset types changes.
 1.60 06-May-2014  njoly Regen for mknod device argument type change.
 1.59 04-May-2014  njoly Regen for pread/pwrite 64bit offset argument.
 1.58 08-Apr-2014  njoly Regen.
 1.57 08-Dec-2013  njoly branches: 1.57.2;
Regen.
 1.56 19-Nov-2013  chs regen
 1.55 07-Nov-2013  njoly Regen for dup/dup2/dup3 argument types fix.
 1.54 24-Sep-2013  njoly Regen for utimensat(2).
 1.53 08-Apr-2013  pooka branches: 1.53.4;
regen for utimes
 1.52 19-Sep-2012  pooka regen for ppoll (and, apparently, SYCALL_ARG_PTR)
 1.51 18-Nov-2011  christos branches: 1.51.10;
- add sigtimedwait support.
- merge the siginfo population code.
 1.50 30-May-2011  alnsn branches: 1.50.4;
Regenerate files to pick up correct RCS Ids. Suggested by Chris Badura.
 1.49 30-May-2011  alnsn Add fadvise64 and fadvise64_64 syscalls to compat_linux and compat_linux32.
 1.48 15-Apr-2011  he Regenerate these files after adding pipe2() and dup3().
 1.47 07-Jul-2010  chs branches: 1.47.2;
regen
 1.46 14-Dec-2009  matt branches: 1.46.2; 1.46.4;
Regen (new makesyscalls.sh)
 1.45 24-Nov-2009  njoly Regen for personality(2) update.
 1.44 08-Jun-2009  njoly Regen for rt_queueinfo(2) update.
 1.43 17-Jan-2009  njoly branches: 1.43.2;
Regen for wait4 update.
 1.42 15-Jan-2009  njoly Rengen for compat50 update.
 1.41 13-Jan-2009  pooka Regen to prove I didn't screw up the conversion: purely RCSID changes.
 1.40 13-Jan-2009  rtr actually commit syscalls.master this time
add back blank line between #include <sys/.. and #include <sys/compat/..
regen
 1.39 12-Jan-2009  rtr regen for christos_time_t merge
 1.38 19-Nov-2008  ad Regen.
 1.37 12-Nov-2008  njoly Regen for nanosleep(2) fix.
 1.36 23-Apr-2008  ad branches: 1.36.2; 1.36.4; 1.36.8; 1.36.10; 1.36.12;
Regen.
 1.35 04-Apr-2008  njoly branches: 1.35.2;
Regen for linux_sys_msync removal.
 1.34 15-Jan-2008  njoly branches: 1.34.6;
Regen.
 1.33 24-Dec-2007  njoly Regen for linux_sys_getpgid removal.
 1.32 21-Dec-2007  njoly Regen for getfsuid/setfsgid syscall exchange.
 1.31 20-Dec-2007  dsl regen
 1.30 16-Nov-2007  njoly branches: 1.30.2; 1.30.6;
Regen, for syscalls cleanup.
 1.29 04-Mar-2007  christos branches: 1.29.14; 1.29.16; 1.29.20; 1.29.22;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.28 01-Sep-2006  matt branches: 1.28.8;
Regen.
 1.27 30-Aug-2006  matt Regen
 1.26 10-Jun-2006  christos regen
 1.25 11-Dec-2005  christos branches: 1.25.4; 1.25.8; 1.25.14;
merge ktrace-lwp.
 1.24 16-May-2005  fvdl branches: 1.24.2;
Regen.
 1.23 16-May-2005  fvdl Regen.
 1.22 26-Feb-2005  perry regen
 1.21 26-Feb-2005  perry regen
 1.20 20-Sep-2004  jdolecek branches: 1.20.4; 1.20.6;
regen:
implement support for Linux statfs64() syscall - 64bit variant of statfs()
 1.19 08-Sep-2004  jdolecek regen: add exit_group(2)
 1.18 01-Aug-2004  jdolecek regen:

add stub entries for syscalls added until Linux kernel 2.6.7

move the ARM-specific syscall range up to offset 0x180, to make room
for the new syscalls
 1.17 01-Aug-2004  jdolecek regen:

connect madvise(2) and mincore(2) - apparently the newer Linux libs
don't stub it anymore, so allow the application to take advantage
of them

the Linux calls appear to be compatible in the flag values and semantics,
so a wrapper is not necessary
 1.16 10-Aug-2003  jdolecek regen - added wrapper for Linux ftruncate64()
 1.15 28-Jun-2003  he branches: 1.15.2;
Regenerate after adding include of linux_mmap.h.
 1.14 23-Jun-2003  christos Regen.
 1.13 18-Jan-2003  thorpej Regen to get correct RCS IDs.
 1.12 18-Jan-2003  thorpej Regen: Merge the nathanw_sa branch.
 1.11 12-May-2002  jdolecek branches: 1.11.4;
regen - hook linux_sys_fcntl64()
 1.10 10-Apr-2002  christos regen
 1.9 22-Mar-2002  christos regen
 1.8 17-Feb-2002  bjh21 branches: 1.8.2;
Regen.
 1.7 15-Feb-2002  christos - add a real linux_sys___sysctl because the mib numbers are different.
implement only the kernel version getting entries.
- make the signal conversion functions consistent; dest is arg 1.
- make linux_fakedev deal with block and char devices differently.
- add linux_sys_ugetrlimit, and flesh out the regular get/setrlimit so
that they work properly.
- add linux_mmap2 [untested].
- bump kernel to 2.4.18, and make the date be valentine's day :-)
- linux_sys_*stat64 family was totally busted. Fix it.

tested only on i386.

Status:
gdb, telnet, work
jdk-1.4.0 extractor works, jdk still coredumps.

christos
 1.6 27-Jan-2002  bjh21 branches: 1.6.2;
Regen (breakpoint() implemented).
 1.5 27-Jan-2002  bjh21 Regen (prototype for linux_sys_nosys()).
 1.4 23-Jan-2002  bjh21 Regen (sys_nosys -> linux_sys_nosys).
 1.3 23-Jan-2002  bjh21 Regen (cacheflush() and remove syscall 0).
 1.2 15-Jan-2002  bjh21 Regen.
 1.1 14-Jan-2002  bjh21 Generated files for ARMLinux binary compatibility.
 1.6.2.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.6.2.3 16-Mar-2002  jdolecek Catch up with -current.
 1.6.2.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.6.2.1 27-Jan-2002  jdolecek file linux_syscallargs.h was added on branch kqueue on 2002-02-11 20:09:31 +0000
 1.8.2.7 20-Jun-2002  nathanw Catch up to -current.
 1.8.2.6 29-May-2002  nathanw Regen.
 1.8.2.5 04-May-2002  thorpej Regen.
 1.8.2.4 17-Apr-2002  nathanw Catch up to -current.
 1.8.2.3 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.8.2.2 28-Feb-2002  nathanw Catch up to -current.
 1.8.2.1 17-Feb-2002  nathanw file linux_syscallargs.h was added on branch nathanw_sa on 2002-02-28 04:12:48 +0000
 1.11.4.4 14-Jun-2004  jmc Regen for changes in ticket #1708
 1.11.4.3 11-May-2004  tron Regen for ticket 1686.
 1.11.4.2 20-Nov-2003  jmc Regen after fix in syscalls.master from ticket #1427.
 1.11.4.1 22-Oct-2003  jmc Regen files (requested by tv in ticket #1427)

Proper support for mmap2
 1.15.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.15.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.15.2.4 24-Sep-2004  skrll Sync with HEAD.
 1.15.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.15.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.15.2.1 03-Aug-2004  skrll Sync with HEAD
 1.20.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.20.4.1 29-Apr-2005  kent sync with -current
 1.24.2.5 21-Jan-2008  yamt sync with head
 1.24.2.4 07-Dec-2007  yamt sync with head
 1.24.2.3 03-Sep-2007  yamt sync with head.
 1.24.2.2 30-Dec-2006  yamt sync with head.
 1.24.2.1 21-Jun-2006  yamt sync with head.
 1.25.14.1 19-Jun-2006  chap Sync with head.
 1.25.8.2 03-Sep-2006  yamt sync with head.
 1.25.8.1 26-Jun-2006  yamt sync with head.
 1.25.4.1 09-Sep-2006  rpaulo sync with head
 1.28.8.1 12-Mar-2007  rmind Sync with HEAD.
 1.29.22.3 18-Feb-2008  mjf Sync with HEAD.
 1.29.22.2 27-Dec-2007  mjf Sync with HEAD.
 1.29.22.1 19-Nov-2007  mjf Sync with HEAD.
 1.29.20.1 18-Nov-2007  bouyer Sync with HEAD
 1.29.16.2 23-Mar-2008  matt sync with HEAD
 1.29.16.1 09-Jan-2008  matt sync with HEAD
 1.29.14.1 21-Nov-2007  joerg Sync with HEAD.
 1.30.6.2 19-Jan-2008  bouyer Sync with HEAD
 1.30.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.30.2.1 26-Dec-2007  ad Sync with head.
 1.34.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.34.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.35.2.1 18-May-2008  yamt sync with head.
 1.36.12.1 20-Nov-2008  snj Regen for ticket 81.
 1.36.10.1 19-Jan-2009  skrll Sync with HEAD.
 1.36.8.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.36.4.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.36.2.4 11-Aug-2010  yamt sync with head.
 1.36.2.3 11-Mar-2010  yamt sync with head
 1.36.2.2 20-Jun-2009  yamt sync with head
 1.36.2.1 04-May-2009  yamt sync with head.
 1.43.2.1 23-Jul-2009  jym Sync with HEAD.
 1.46.4.3 31-May-2011  rmind sync with head
 1.46.4.2 21-Apr-2011  rmind sync with head
 1.46.4.1 05-Mar-2011  rmind sync with head
 1.46.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.47.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.50.4.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.50.4.2 30-Oct-2012  yamt sync with head
 1.50.4.1 17-Apr-2012  yamt sync with head
 1.51.10.4 03-Dec-2017  jdolecek update from HEAD
 1.51.10.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.51.10.2 23-Jun-2013  tls resync from head
 1.51.10.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.53.4.1 18-May-2014  rmind sync with head
 1.57.2.1 10-Aug-2014  tls Rebase.
 1.64.2.1 17-Apr-2017  snj regen for ticket 1354
 1.65.2.4 28-Aug-2017  skrll Sync with HEAD
 1.65.2.3 05-Feb-2017  skrll Sync with HEAD
 1.65.2.2 05-Oct-2016  skrll Sync with HEAD
 1.65.2.1 06-Apr-2015  skrll Sync with HEAD
 1.68.2.3 20-Mar-2017  pgoyette Sync with HEAD
 1.68.2.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.68.2.1 26-Jul-2016  pgoyette Sync with HEAD
 1.75.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.78.4.1 11-May-2017  pgoyette Sync with HEAD
 1.79.10.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.79.10.1 10-Jun-2019  christos Sync with HEAD
 1.79.8.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.82.2.2 17-Dec-2020  thorpej Regen for preadv(2) and pwritev(2).
 1.82.2.1 15-Dec-2020  thorpej Regen for eventfd, timerfd, POSIX timers.
 1.93.2.1 02-Aug-2025  perseant Sync with HEAD
 1.96 26-Oct-2025  christos regen
 1.95 28-Sep-2024  christos regen
 1.94 01-Jul-2024  christos regen
 1.93 29-Jun-2024  christos branches: 1.93.2;
regen
 1.92 19-Aug-2023  christos regen
 1.91 18-Aug-2023  christos regen
 1.90 29-Jul-2023  christos regen
 1.89 28-Jul-2023  christos regen
 1.88 02-Dec-2021  ryo regen
 1.87 24-Nov-2021  ryo regen
 1.86 20-Sep-2021  thorpej Regen for preadv(2) / pwritev(2).
 1.85 20-Sep-2021  thorpej Regen for eventfd.
 1.84 19-Sep-2021  thorpej Regen for timerfd.
 1.83 19-Sep-2021  thorpej Regen for POSIX timer syscalls.
 1.82 26-Apr-2020  thorpej branches: 1.82.2;
Regen for native futex calls.
 1.81 09-Nov-2019  jdolecek regen
 1.80 10-Aug-2018  pgoyette Regen
 1.79 10-May-2017  riastradh branches: 1.79.8; 1.79.10;
regen
 1.78 03-Feb-2017  christos branches: 1.78.4;
regen
 1.77 03-Feb-2017  martin Regen for accept4
 1.76 16-Jan-2017  christos regen all
 1.75 15-Jan-2017  christos branches: 1.75.2;
regen
 1.74 15-Jan-2017  christos regen
 1.73 15-Jan-2017  christos regen
 1.72 13-Jan-2017  christos regen
 1.71 02-Jan-2017  martin Regen (something apparently went wrong in previous)
 1.70 02-Jan-2017  manu Regen
 1.69 24-Jul-2016  njoly Regen for readlink/readlinkat signatures.
 1.68 23-Mar-2015  ozaki-r branches: 1.68.2;
Regen
 1.67 23-Mar-2015  ozaki-r Regen
 1.66 07-Mar-2015  christos regen
 1.65 22-Nov-2014  njoly branches: 1.65.2;
Regen for ppoll signature fix
 1.64 31-May-2014  njoly branches: 1.64.2;
Regen for munmap(2) signature.
 1.63 29-May-2014  njoly Regen for utimes(2) change.
 1.62 20-May-2014  njoly Regen for getgroups/setgroups update.
 1.61 17-May-2014  njoly Regen for fadvise64 offset types changes.
 1.60 06-May-2014  njoly Regen for mknod device argument type change.
 1.59 04-May-2014  njoly Regen for pread/pwrite 64bit offset argument.
 1.58 08-Apr-2014  njoly Regen.
 1.57 08-Dec-2013  njoly branches: 1.57.2;
Regen.
 1.56 19-Nov-2013  chs regen
 1.55 07-Nov-2013  njoly Regen for dup/dup2/dup3 argument types fix.
 1.54 24-Sep-2013  njoly Regen for utimensat(2).
 1.53 08-Apr-2013  pooka branches: 1.53.4;
regen for utimes
 1.52 19-Sep-2012  pooka regen for ppoll (and, apparently, SYCALL_ARG_PTR)
 1.51 18-Nov-2011  christos branches: 1.51.10;
- add sigtimedwait support.
- merge the siginfo population code.
 1.50 30-May-2011  alnsn branches: 1.50.4;
Regenerate files to pick up correct RCS Ids. Suggested by Chris Badura.
 1.49 30-May-2011  alnsn Add fadvise64 and fadvise64_64 syscalls to compat_linux and compat_linux32.
 1.48 15-Apr-2011  he Regenerate these files after adding pipe2() and dup3().
 1.47 07-Jul-2010  chs branches: 1.47.2;
regen
 1.46 14-Dec-2009  matt branches: 1.46.2; 1.46.4;
Regen (new makesyscalls.sh)
 1.45 24-Nov-2009  njoly Regen for personality(2) update.
 1.44 08-Jun-2009  njoly Regen for rt_queueinfo(2) update.
 1.43 17-Jan-2009  njoly branches: 1.43.2;
Regen for wait4 update.
 1.42 15-Jan-2009  njoly Rengen for compat50 update.
 1.41 13-Jan-2009  pooka Regen to prove I didn't screw up the conversion: purely RCSID changes.
 1.40 13-Jan-2009  rtr actually commit syscalls.master this time
add back blank line between #include <sys/.. and #include <sys/compat/..
regen
 1.39 12-Jan-2009  rtr regen for christos_time_t merge
 1.38 19-Nov-2008  ad Regen.
 1.37 12-Nov-2008  njoly Regen for nanosleep(2) fix.
 1.36 23-Apr-2008  ad branches: 1.36.2; 1.36.4; 1.36.8; 1.36.10; 1.36.12;
Regen.
 1.35 04-Apr-2008  njoly branches: 1.35.2;
Regen for linux_sys_msync removal.
 1.34 15-Jan-2008  njoly branches: 1.34.6;
Regen.
 1.33 24-Dec-2007  njoly Regen for linux_sys_getpgid removal.
 1.32 21-Dec-2007  njoly Regen for getfsuid/setfsgid syscall exchange.
 1.31 20-Dec-2007  dsl regen
 1.30 16-Nov-2007  njoly branches: 1.30.2; 1.30.6;
Regen, for syscalls cleanup.
 1.29 09-Feb-2007  ad branches: 1.29.18; 1.29.20; 1.29.24; 1.29.26;
Merge newlock2 to head.
 1.28 01-Sep-2006  matt branches: 1.28.2;
Regen.
 1.27 30-Aug-2006  matt Regen
 1.26 10-Jun-2006  christos regen
 1.25 11-Dec-2005  christos branches: 1.25.4; 1.25.8; 1.25.14;
merge ktrace-lwp.
 1.24 16-May-2005  fvdl branches: 1.24.2;
Regen.
 1.23 16-May-2005  fvdl Regen.
 1.22 26-Feb-2005  perry regen
 1.21 26-Feb-2005  perry regen
 1.20 20-Sep-2004  jdolecek branches: 1.20.4; 1.20.6;
regen:
implement support for Linux statfs64() syscall - 64bit variant of statfs()
 1.19 08-Sep-2004  jdolecek regen: add exit_group(2)
 1.18 01-Aug-2004  jdolecek regen:

add stub entries for syscalls added until Linux kernel 2.6.7

move the ARM-specific syscall range up to offset 0x180, to make room
for the new syscalls
 1.17 01-Aug-2004  jdolecek regen:

connect madvise(2) and mincore(2) - apparently the newer Linux libs
don't stub it anymore, so allow the application to take advantage
of them

the Linux calls appear to be compatible in the flag values and semantics,
so a wrapper is not necessary
 1.16 10-Aug-2003  jdolecek regen - added wrapper for Linux ftruncate64()
 1.15 28-Jun-2003  he branches: 1.15.2;
Regenerate after adding include of linux_mmap.h.
 1.14 23-Jun-2003  christos Regen.
 1.13 18-Jan-2003  thorpej Regen to get correct RCS IDs.
 1.12 18-Jan-2003  thorpej Regen: Merge the nathanw_sa branch.
 1.11 12-May-2002  jdolecek branches: 1.11.4;
regen - hook linux_sys_fcntl64()
 1.10 10-Apr-2002  christos regen
 1.9 22-Mar-2002  christos regen
 1.8 17-Feb-2002  bjh21 branches: 1.8.2;
Regen.
 1.7 15-Feb-2002  christos - add a real linux_sys___sysctl because the mib numbers are different.
implement only the kernel version getting entries.
- make the signal conversion functions consistent; dest is arg 1.
- make linux_fakedev deal with block and char devices differently.
- add linux_sys_ugetrlimit, and flesh out the regular get/setrlimit so
that they work properly.
- add linux_mmap2 [untested].
- bump kernel to 2.4.18, and make the date be valentine's day :-)
- linux_sys_*stat64 family was totally busted. Fix it.

tested only on i386.

Status:
gdb, telnet, work
jdk-1.4.0 extractor works, jdk still coredumps.

christos
 1.6 27-Jan-2002  bjh21 branches: 1.6.2;
Regen (breakpoint() implemented).
 1.5 27-Jan-2002  bjh21 Regen (prototype for linux_sys_nosys()).
 1.4 23-Jan-2002  bjh21 Regen (sys_nosys -> linux_sys_nosys).
 1.3 23-Jan-2002  bjh21 Regen (cacheflush() and remove syscall 0).
 1.2 15-Jan-2002  bjh21 Regen.
 1.1 14-Jan-2002  bjh21 Generated files for ARMLinux binary compatibility.
 1.6.2.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.6.2.3 16-Mar-2002  jdolecek Catch up with -current.
 1.6.2.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.6.2.1 27-Jan-2002  jdolecek file linux_syscalls.c was added on branch kqueue on 2002-02-11 20:09:32 +0000
 1.8.2.7 20-Jun-2002  nathanw Catch up to -current.
 1.8.2.6 29-May-2002  nathanw Regen.
 1.8.2.5 04-May-2002  thorpej Regen.
 1.8.2.4 17-Apr-2002  nathanw Catch up to -current.
 1.8.2.3 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.8.2.2 28-Feb-2002  nathanw Catch up to -current.
 1.8.2.1 17-Feb-2002  nathanw file linux_syscalls.c was added on branch nathanw_sa on 2002-02-28 04:12:48 +0000
 1.11.4.4 14-Jun-2004  jmc Regen for changes in ticket #1708
 1.11.4.3 11-May-2004  tron Regen for ticket 1686.
 1.11.4.2 20-Nov-2003  jmc Regen after fix in syscalls.master from ticket #1427.
 1.11.4.1 22-Oct-2003  jmc Regen files (requested by tv in ticket #1427)

Proper support for mmap2
 1.15.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.15.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.15.2.4 24-Sep-2004  skrll Sync with HEAD.
 1.15.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.15.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.15.2.1 03-Aug-2004  skrll Sync with HEAD
 1.20.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.20.4.1 29-Apr-2005  kent sync with -current
 1.24.2.5 21-Jan-2008  yamt sync with head
 1.24.2.4 07-Dec-2007  yamt sync with head
 1.24.2.3 26-Feb-2007  yamt sync with head.
 1.24.2.2 30-Dec-2006  yamt sync with head.
 1.24.2.1 21-Jun-2006  yamt sync with head.
 1.25.14.1 19-Jun-2006  chap Sync with head.
 1.25.8.2 03-Sep-2006  yamt sync with head.
 1.25.8.1 26-Jun-2006  yamt sync with head.
 1.25.4.1 09-Sep-2006  rpaulo sync with head
 1.28.2.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.29.26.3 18-Feb-2008  mjf Sync with HEAD.
 1.29.26.2 27-Dec-2007  mjf Sync with HEAD.
 1.29.26.1 19-Nov-2007  mjf Sync with HEAD.
 1.29.24.1 18-Nov-2007  bouyer Sync with HEAD
 1.29.20.2 23-Mar-2008  matt sync with HEAD
 1.29.20.1 09-Jan-2008  matt sync with HEAD
 1.29.18.1 21-Nov-2007  joerg Sync with HEAD.
 1.30.6.2 19-Jan-2008  bouyer Sync with HEAD
 1.30.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.30.2.1 26-Dec-2007  ad Sync with head.
 1.34.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.34.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.35.2.1 18-May-2008  yamt sync with head.
 1.36.12.1 20-Nov-2008  snj Regen for ticket 81.
 1.36.10.1 19-Jan-2009  skrll Sync with HEAD.
 1.36.8.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.36.4.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.36.4.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.36.2.4 11-Aug-2010  yamt sync with head.
 1.36.2.3 11-Mar-2010  yamt sync with head
 1.36.2.2 20-Jun-2009  yamt sync with head
 1.36.2.1 04-May-2009  yamt sync with head.
 1.43.2.1 23-Jul-2009  jym Sync with HEAD.
 1.46.4.3 31-May-2011  rmind sync with head
 1.46.4.2 21-Apr-2011  rmind sync with head
 1.46.4.1 05-Mar-2011  rmind sync with head
 1.46.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.47.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.50.4.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.50.4.2 30-Oct-2012  yamt sync with head
 1.50.4.1 17-Apr-2012  yamt sync with head
 1.51.10.4 03-Dec-2017  jdolecek update from HEAD
 1.51.10.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.51.10.2 23-Jun-2013  tls resync from head
 1.51.10.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.53.4.1 18-May-2014  rmind sync with head
 1.57.2.1 10-Aug-2014  tls Rebase.
 1.64.2.1 17-Apr-2017  snj regen for ticket 1354
 1.65.2.3 05-Feb-2017  skrll Sync with HEAD
 1.65.2.2 05-Oct-2016  skrll Sync with HEAD
 1.65.2.1 06-Apr-2015  skrll Sync with HEAD
 1.68.2.3 20-Mar-2017  pgoyette Sync with HEAD
 1.68.2.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.68.2.1 26-Jul-2016  pgoyette Sync with HEAD
 1.75.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.78.4.1 11-May-2017  pgoyette Sync with HEAD
 1.79.10.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.79.10.1 10-Jun-2019  christos Sync with HEAD
 1.79.8.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.82.2.2 17-Dec-2020  thorpej Regen for preadv(2) and pwritev(2).
 1.82.2.1 15-Dec-2020  thorpej Regen for eventfd, timerfd, POSIX timers.
 1.93.2.1 02-Aug-2025  perseant Sync with HEAD
 1.96 26-Oct-2025  christos regen
 1.95 28-Sep-2024  christos regen
 1.94 01-Jul-2024  christos regen
 1.93 29-Jun-2024  christos branches: 1.93.2;
regen
 1.92 19-Aug-2023  christos regen
 1.91 18-Aug-2023  christos regen
 1.90 29-Jul-2023  christos regen
 1.89 28-Jul-2023  christos regen
 1.88 02-Dec-2021  ryo regen
 1.87 24-Nov-2021  ryo regen
 1.86 20-Sep-2021  thorpej Regen for preadv(2) / pwritev(2).
 1.85 20-Sep-2021  thorpej Regen for eventfd.
 1.84 19-Sep-2021  thorpej Regen for timerfd.
 1.83 19-Sep-2021  thorpej Regen for POSIX timer syscalls.
 1.82 26-Apr-2020  thorpej branches: 1.82.2;
Regen for native futex calls.
 1.81 09-Nov-2019  jdolecek regen
 1.80 10-Aug-2018  pgoyette Regen
 1.79 10-May-2017  riastradh branches: 1.79.8; 1.79.10;
regen
 1.78 03-Feb-2017  christos branches: 1.78.4;
regen
 1.77 03-Feb-2017  martin Regen for accept4
 1.76 16-Jan-2017  christos regen all
 1.75 15-Jan-2017  christos branches: 1.75.2;
regen
 1.74 15-Jan-2017  christos regen
 1.73 15-Jan-2017  christos regen
 1.72 13-Jan-2017  christos regen
 1.71 02-Jan-2017  martin Regen (something apparently went wrong in previous)
 1.70 02-Jan-2017  manu Regen
 1.69 24-Jul-2016  njoly Regen for readlink/readlinkat signatures.
 1.68 23-Mar-2015  ozaki-r branches: 1.68.2;
Regen
 1.67 23-Mar-2015  ozaki-r Regen
 1.66 07-Mar-2015  christos regen
 1.65 22-Nov-2014  njoly branches: 1.65.2;
Regen for ppoll signature fix
 1.64 31-May-2014  njoly branches: 1.64.2;
Regen for munmap(2) signature.
 1.63 29-May-2014  njoly Regen for utimes(2) change.
 1.62 20-May-2014  njoly Regen for getgroups/setgroups update.
 1.61 17-May-2014  njoly Regen for fadvise64 offset types changes.
 1.60 06-May-2014  njoly Regen for mknod device argument type change.
 1.59 04-May-2014  njoly Regen for pread/pwrite 64bit offset argument.
 1.58 08-Apr-2014  njoly Regen.
 1.57 08-Dec-2013  njoly branches: 1.57.2;
Regen.
 1.56 19-Nov-2013  chs regen
 1.55 07-Nov-2013  njoly Regen for dup/dup2/dup3 argument types fix.
 1.54 24-Sep-2013  njoly Regen for utimensat(2).
 1.53 08-Apr-2013  pooka branches: 1.53.4;
regen for utimes
 1.52 19-Sep-2012  pooka regen for ppoll (and, apparently, SYCALL_ARG_PTR)
 1.51 18-Nov-2011  christos branches: 1.51.10;
- add sigtimedwait support.
- merge the siginfo population code.
 1.50 30-May-2011  alnsn branches: 1.50.4;
Regenerate files to pick up correct RCS Ids. Suggested by Chris Badura.
 1.49 30-May-2011  alnsn Add fadvise64 and fadvise64_64 syscalls to compat_linux and compat_linux32.
 1.48 15-Apr-2011  he Regenerate these files after adding pipe2() and dup3().
 1.47 07-Jul-2010  chs branches: 1.47.2;
regen
 1.46 14-Dec-2009  matt branches: 1.46.2; 1.46.4;
Regen (new makesyscalls.sh)
 1.45 24-Nov-2009  njoly Regen for personality(2) update.
 1.44 08-Jun-2009  njoly Regen for rt_queueinfo(2) update.
 1.43 17-Jan-2009  njoly branches: 1.43.2;
Regen for wait4 update.
 1.42 15-Jan-2009  njoly Rengen for compat50 update.
 1.41 13-Jan-2009  pooka Regen to prove I didn't screw up the conversion: purely RCSID changes.
 1.40 13-Jan-2009  rtr actually commit syscalls.master this time
add back blank line between #include <sys/.. and #include <sys/compat/..
regen
 1.39 12-Jan-2009  rtr regen for christos_time_t merge
 1.38 19-Nov-2008  ad Regen.
 1.37 12-Nov-2008  njoly Regen for nanosleep(2) fix.
 1.36 23-Apr-2008  ad branches: 1.36.2; 1.36.4; 1.36.8; 1.36.10; 1.36.12;
Regen.
 1.35 04-Apr-2008  njoly branches: 1.35.2;
Regen for linux_sys_msync removal.
 1.34 15-Jan-2008  njoly branches: 1.34.6;
Regen.
 1.33 24-Dec-2007  njoly Regen for linux_sys_getpgid removal.
 1.32 21-Dec-2007  njoly Regen for getfsuid/setfsgid syscall exchange.
 1.31 20-Dec-2007  dsl regen
 1.30 16-Nov-2007  njoly branches: 1.30.2; 1.30.6;
Regen, for syscalls cleanup.
 1.29 09-Feb-2007  ad branches: 1.29.18; 1.29.20; 1.29.24; 1.29.26;
Merge newlock2 to head.
 1.28 01-Sep-2006  matt branches: 1.28.2;
Regen.
 1.27 30-Aug-2006  matt Regen
 1.26 10-Jun-2006  christos regen
 1.25 11-Dec-2005  christos branches: 1.25.4; 1.25.8; 1.25.14;
merge ktrace-lwp.
 1.24 16-May-2005  fvdl branches: 1.24.2;
Regen.
 1.23 16-May-2005  fvdl Regen.
 1.22 26-Feb-2005  perry regen
 1.21 26-Feb-2005  perry regen
 1.20 20-Sep-2004  jdolecek branches: 1.20.4; 1.20.6;
regen:
implement support for Linux statfs64() syscall - 64bit variant of statfs()
 1.19 08-Sep-2004  jdolecek regen: add exit_group(2)
 1.18 01-Aug-2004  jdolecek regen:

add stub entries for syscalls added until Linux kernel 2.6.7

move the ARM-specific syscall range up to offset 0x180, to make room
for the new syscalls
 1.17 01-Aug-2004  jdolecek regen:

connect madvise(2) and mincore(2) - apparently the newer Linux libs
don't stub it anymore, so allow the application to take advantage
of them

the Linux calls appear to be compatible in the flag values and semantics,
so a wrapper is not necessary
 1.16 10-Aug-2003  jdolecek regen - added wrapper for Linux ftruncate64()
 1.15 28-Jun-2003  he branches: 1.15.2;
Regenerate after adding include of linux_mmap.h.
 1.14 23-Jun-2003  christos Regen.
 1.13 18-Jan-2003  thorpej Regen to get correct RCS IDs.
 1.12 18-Jan-2003  thorpej Regen: Merge the nathanw_sa branch.
 1.11 12-May-2002  jdolecek branches: 1.11.4;
regen - hook linux_sys_fcntl64()
 1.10 10-Apr-2002  christos regen
 1.9 22-Mar-2002  christos regen
 1.8 17-Feb-2002  bjh21 branches: 1.8.2;
Regen.
 1.7 15-Feb-2002  christos - add a real linux_sys___sysctl because the mib numbers are different.
implement only the kernel version getting entries.
- make the signal conversion functions consistent; dest is arg 1.
- make linux_fakedev deal with block and char devices differently.
- add linux_sys_ugetrlimit, and flesh out the regular get/setrlimit so
that they work properly.
- add linux_mmap2 [untested].
- bump kernel to 2.4.18, and make the date be valentine's day :-)
- linux_sys_*stat64 family was totally busted. Fix it.

tested only on i386.

Status:
gdb, telnet, work
jdk-1.4.0 extractor works, jdk still coredumps.

christos
 1.6 27-Jan-2002  bjh21 branches: 1.6.2;
Regen (breakpoint() implemented).
 1.5 27-Jan-2002  bjh21 Regen (prototype for linux_sys_nosys()).
 1.4 23-Jan-2002  bjh21 Regen (sys_nosys -> linux_sys_nosys).
 1.3 23-Jan-2002  bjh21 Regen (cacheflush() and remove syscall 0).
 1.2 15-Jan-2002  bjh21 Regen.
 1.1 14-Jan-2002  bjh21 Generated files for ARMLinux binary compatibility.
 1.6.2.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.6.2.3 16-Mar-2002  jdolecek Catch up with -current.
 1.6.2.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.6.2.1 27-Jan-2002  jdolecek file linux_sysent.c was added on branch kqueue on 2002-02-11 20:09:32 +0000
 1.8.2.7 20-Jun-2002  nathanw Catch up to -current.
 1.8.2.6 29-May-2002  nathanw Regen.
 1.8.2.5 04-May-2002  thorpej Regen.
 1.8.2.4 17-Apr-2002  nathanw Catch up to -current.
 1.8.2.3 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.8.2.2 28-Feb-2002  nathanw Catch up to -current.
 1.8.2.1 17-Feb-2002  nathanw file linux_sysent.c was added on branch nathanw_sa on 2002-02-28 04:12:48 +0000
 1.11.4.4 14-Jun-2004  jmc Regen for changes in ticket #1708
 1.11.4.3 11-May-2004  tron Regen for ticket 1686.
 1.11.4.2 20-Nov-2003  jmc Regen after fix in syscalls.master from ticket #1427.
 1.11.4.1 22-Oct-2003  jmc Regen files (requested by tv in ticket #1427)

Proper support for mmap2
 1.15.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.15.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.15.2.4 24-Sep-2004  skrll Sync with HEAD.
 1.15.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.15.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.15.2.1 03-Aug-2004  skrll Sync with HEAD
 1.20.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.20.4.1 29-Apr-2005  kent sync with -current
 1.24.2.5 21-Jan-2008  yamt sync with head
 1.24.2.4 07-Dec-2007  yamt sync with head
 1.24.2.3 26-Feb-2007  yamt sync with head.
 1.24.2.2 30-Dec-2006  yamt sync with head.
 1.24.2.1 21-Jun-2006  yamt sync with head.
 1.25.14.1 19-Jun-2006  chap Sync with head.
 1.25.8.2 03-Sep-2006  yamt sync with head.
 1.25.8.1 26-Jun-2006  yamt sync with head.
 1.25.4.1 09-Sep-2006  rpaulo sync with head
 1.28.2.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.29.26.3 18-Feb-2008  mjf Sync with HEAD.
 1.29.26.2 27-Dec-2007  mjf Sync with HEAD.
 1.29.26.1 19-Nov-2007  mjf Sync with HEAD.
 1.29.24.1 18-Nov-2007  bouyer Sync with HEAD
 1.29.20.2 23-Mar-2008  matt sync with HEAD
 1.29.20.1 09-Jan-2008  matt sync with HEAD
 1.29.18.1 21-Nov-2007  joerg Sync with HEAD.
 1.30.6.2 19-Jan-2008  bouyer Sync with HEAD
 1.30.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.30.2.1 26-Dec-2007  ad Sync with head.
 1.34.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.34.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.35.2.1 18-May-2008  yamt sync with head.
 1.36.12.1 20-Nov-2008  snj Regen for ticket 81.
 1.36.10.1 19-Jan-2009  skrll Sync with HEAD.
 1.36.8.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.36.4.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.36.4.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.36.2.4 11-Aug-2010  yamt sync with head.
 1.36.2.3 11-Mar-2010  yamt sync with head
 1.36.2.2 20-Jun-2009  yamt sync with head
 1.36.2.1 04-May-2009  yamt sync with head.
 1.43.2.1 23-Jul-2009  jym Sync with HEAD.
 1.46.4.3 31-May-2011  rmind sync with head
 1.46.4.2 21-Apr-2011  rmind sync with head
 1.46.4.1 05-Mar-2011  rmind sync with head
 1.46.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.47.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.50.4.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.50.4.2 30-Oct-2012  yamt sync with head
 1.50.4.1 17-Apr-2012  yamt sync with head
 1.51.10.4 03-Dec-2017  jdolecek update from HEAD
 1.51.10.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.51.10.2 23-Jun-2013  tls resync from head
 1.51.10.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.53.4.1 18-May-2014  rmind sync with head
 1.57.2.1 10-Aug-2014  tls Rebase.
 1.64.2.1 17-Apr-2017  snj regen for ticket 1354
 1.65.2.3 05-Feb-2017  skrll Sync with HEAD
 1.65.2.2 05-Oct-2016  skrll Sync with HEAD
 1.65.2.1 06-Apr-2015  skrll Sync with HEAD
 1.68.2.3 20-Mar-2017  pgoyette Sync with HEAD
 1.68.2.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.68.2.1 26-Jul-2016  pgoyette Sync with HEAD
 1.75.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.78.4.1 11-May-2017  pgoyette Sync with HEAD
 1.79.10.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.79.10.1 10-Jun-2019  christos Sync with HEAD
 1.79.8.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.82.2.2 17-Dec-2020  thorpej Regen for preadv(2) and pwritev(2).
 1.82.2.1 15-Dec-2020  thorpej Regen for eventfd, timerfd, POSIX timers.
 1.93.2.1 02-Aug-2025  perseant Sync with HEAD
 1.29 26-Oct-2025  christos regen
 1.28 28-Sep-2024  christos regen
 1.27 01-Jul-2024  christos regen
 1.26 29-Jun-2024  christos branches: 1.26.2;
regen
 1.25 19-Aug-2023  christos regen
 1.24 18-Aug-2023  christos regen
 1.23 29-Jul-2023  christos regen
 1.22 28-Jul-2023  christos regen
 1.21 02-Dec-2021  ryo regen
 1.20 24-Nov-2021  ryo regen
 1.19 20-Sep-2021  thorpej Regen for preadv(2) / pwritev(2).
 1.18 20-Sep-2021  thorpej Regen for eventfd.
 1.17 19-Sep-2021  thorpej Regen for timerfd.
 1.16 19-Sep-2021  thorpej Regen for POSIX timer syscalls.
 1.15 26-Apr-2020  thorpej branches: 1.15.2;
Regen for native futex calls.
 1.14 09-Nov-2019  jdolecek regen
 1.13 10-Aug-2018  pgoyette Regen
 1.12 10-May-2017  riastradh branches: 1.12.8; 1.12.10; 1.12.12;
regen
 1.11 03-Feb-2017  christos branches: 1.11.4;
regen
 1.10 03-Feb-2017  martin Regen for accept4
 1.9 16-Jan-2017  christos regen all
 1.8 15-Jan-2017  christos branches: 1.8.2;
regen
 1.7 15-Jan-2017  christos regen
 1.6 15-Jan-2017  christos regen
 1.5 15-Jan-2017  martin Cast pointer to int via intptr_t
 1.4 13-Jan-2017  christos regen
 1.3 02-Jan-2017  martin Regen (something apparently went wrong in previous)
 1.2 24-Jul-2016  njoly Regen for readlink/readlinkat signatures.
 1.1 23-Mar-2015  ozaki-r branches: 1.1.2; 1.1.4;
Regen
 1.1.4.3 20-Mar-2017  pgoyette Sync with HEAD
 1.1.4.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.1.4.1 26-Jul-2016  pgoyette Sync with HEAD
 1.1.2.4 05-Feb-2017  skrll Sync with HEAD
 1.1.2.3 05-Oct-2016  skrll Sync with HEAD
 1.1.2.2 06-Apr-2015  skrll Sync with HEAD
 1.1.2.1 23-Mar-2015  skrll file linux_systrace_args.c was added on branch nick-nhusb on 2015-04-06 15:18:06 +0000
 1.8.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.11.4.1 11-May-2017  pgoyette Sync with HEAD
 1.12.12.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.12.12.1 10-Jun-2019  christos Sync with HEAD
 1.12.10.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.12.8.2 03-Dec-2017  jdolecek update from HEAD
 1.12.8.1 10-May-2017  jdolecek file linux_systrace_args.c was added on branch tls-maxphys on 2017-12-03 11:36:54 +0000
 1.15.2.2 17-Dec-2020  thorpej Regen for preadv(2) and pwritev(2).
 1.15.2.1 15-Dec-2020  thorpej Regen for eventfd, timerfd, POSIX timers.
 1.26.2.1 02-Aug-2025  perseant Sync with HEAD
 1.2 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.1 14-Jan-2002  bjh21 branches: 1.1.2; 1.1.4; 1.1.118; 1.1.120; 1.1.122;
Crude first cut at ARMLinux binary compatibility. Successfully runs
"/emul/linux/bin/echo hello, world", dynamically linked.
 1.1.122.1 16-May-2008  yamt sync with head.
 1.1.120.1 18-May-2008  yamt sync with head.
 1.1.118.1 02-Jun-2008  mjf Sync with HEAD.
 1.1.4.2 28-Feb-2002  nathanw Catch up to -current.
 1.1.4.1 14-Jan-2002  nathanw file linux_termios.h was added on branch nathanw_sa on 2002-02-28 04:12:49 +0000
 1.1.2.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.1.2.1 14-Jan-2002  jdolecek file linux_termios.h was added on branch kqueue on 2002-02-11 20:09:32 +0000
 1.9 21-Mar-2013  pooka Fix stat64 by making it match i386. Other archs might still be broken,
but this is the one I could test.
 1.8 11-Jan-2009  christos branches: 1.8.14; 1.8.24;
merge christos-time_t
 1.7 28-Apr-2008  martin branches: 1.7.8; 1.7.14;
Remove clause 3 and 4 from TNF licenses
 1.6 11-Dec-2005  christos branches: 1.6.70; 1.6.72; 1.6.74;
merge ktrace-lwp.
 1.5 20-Sep-2004  jdolecek move definition of linux_fsid_t to common/linux_types.h - it's identical
across all Linux archs
 1.4 19-Sep-2004  jdolecek move definition of struct linux_stafs to common/linux_types.h, and use
explicit size types - the structure definition is actually identical
on currently support COMPAT_LINUX archs, so no point to have 6 copies of it
in the tree
 1.3 19-May-2002  jdolecek branches: 1.3.8;
On archs with broken linux struct stat64 st_ino, rename linux_stat64's
lst_ino to __lst_ino and lst_ino64 to lst_ino, and define
LINUX_STAT64_HAS_BROKEN_ST_INO. Only assign __lst_ino if this define
is present.

This fixes compile on powerpc archs, and hence port-powerpc/16893.
 1.2 17-Feb-2002  bjh21 branches: 1.2.2; 1.2.10;
Add an lst_ino64 member to struct linux_stat64.
 1.1 14-Jan-2002  bjh21 branches: 1.1.2;
Crude first cut at ARMLinux binary compatibility. Successfully runs
"/emul/linux/bin/echo hello, world", dynamically linked.
 1.1.2.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.2.3 16-Mar-2002  jdolecek Catch up with -current.
 1.1.2.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.1.2.1 14-Jan-2002  jdolecek file linux_types.h was added on branch kqueue on 2002-02-11 20:09:32 +0000
 1.2.10.1 30-May-2002  gehenna Catch up with -current.
 1.2.2.3 20-Jun-2002  nathanw Catch up to -current.
 1.2.2.2 28-Feb-2002  nathanw Catch up to -current.
 1.2.2.1 17-Feb-2002  nathanw file linux_types.h was added on branch nathanw_sa on 2002-02-28 04:12:49 +0000
 1.3.8.1 24-Sep-2004  skrll Sync with HEAD.
 1.6.74.2 04-May-2009  yamt sync with head.
 1.6.74.1 16-May-2008  yamt sync with head.
 1.6.72.1 18-May-2008  yamt sync with head.
 1.6.70.2 17-Jan-2009  mjf Sync with HEAD.
 1.6.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.7.14.2 11-Jan-2009  christos add linux_suseconds_t
 1.7.14.1 28-Apr-2008  christos file linux_types.h was added on branch christos-time_t on 2009-01-11 00:17:51 +0000
 1.7.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.8.24.1 23-Jun-2013  tls resync from head
 1.8.14.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.3 23-Mar-2015  ozaki-r Add linux_systrace_args.c for arm
 1.2 23-Jan-2002  bjh21 branches: 1.2.2; 1.2.4; 1.2.168; 1.2.188;
sys_nosys="linux_sys_nosys", since that's how it should be.
 1.1 14-Jan-2002  bjh21 Crude first cut at ARMLinux binary compatibility. Successfully runs
"/emul/linux/bin/echo hello, world", dynamically linked.
 1.2.188.1 06-Apr-2015  skrll Sync with HEAD
 1.2.168.1 03-Dec-2017  jdolecek update from HEAD
 1.2.4.2 28-Feb-2002  nathanw Catch up to -current.
 1.2.4.1 23-Jan-2002  nathanw file syscalls.conf was added on branch nathanw_sa on 2002-02-28 04:12:49 +0000
 1.2.2.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.2.2.1 23-Jan-2002  jdolecek file syscalls.conf was added on branch kqueue on 2002-02-11 20:09:32 +0000
 1.84 26-Oct-2025  christos remove unimpl
 1.83 26-Oct-2025  christos one more
 1.82 28-Sep-2024  christos Linux GSoC-2024: renameat2, clone3, sync_file_range, syncfs (Shivraj Jamgade)
 1.81 01-Jul-2024  christos Add linux POSIX message queue support (Ricardo Branco)
 1.80 29-Jun-2024  christos branches: 1.80.2;
From gsoc 2024: Implement faccessat2 and getcpu (Shivraz)
 1.79 19-Aug-2023  christos Add inotify* syscalls GSoC 2023 (Theodore Preduta)
 1.78 18-Aug-2023  christos Add linux waitid(2) from GSoC 2023 (Theodore Preduta)
 1.77 29-Jul-2023  christos Add/fix statx, readahead, close_range. From GSoC 2023 by Theodore Preduta
 1.76 28-Jul-2023  christos add epoll syscalls
 1.75 02-Dec-2021  ryo add prlimit64(2) syscall to COMPAT_LINUX and COMPAT_LINUX32
 1.74 24-Nov-2021  ryo add getrandom(2) syscall entry
 1.73 20-Sep-2021  thorpej Add preadv(2) and pwritev(2) system calls to COMPAT_LINUX and COMPAT_LINUX32.
 1.72 20-Sep-2021  thorpej Add the eventfd system calls to COMPAT_LINUX and COMPAT_LINUX32.
 1.71 19-Sep-2021  thorpej Add the timerfd syscalls to COMPAT_LINUX and COMPAT_LINUX32.
 1.70 19-Sep-2021  thorpej Add the POSIX timer syscalls (timer_create(), timer_settime(), timer_gettime(),
timer_getoverrun(), and timer_delete()) to COMPAT_LINUX and COMPAT_LINUX32.
 1.69 26-Apr-2020  thorpej branches: 1.69.2;
Add a NetBSD native futex implementation, mostly written by riastradh@.
Map the COMPAT_LINUX futex calls to the native ones.
 1.68 09-Nov-2019  jdolecek add dummy implementation of linux fallocate() which just returns EOPNOTSUPP;
this is needed so that glibc falls back to emulation and apps behaving
properly, since EOPNOTSUPP is a documented and expected return code, but
ENOSYS is not

right now there are no filesystems in NetBSD tree supporting the fallocate
VOP, so no point trying to map this to a native call

supposed to help with problem reported in
https://mail-index.netbsd.org/tech-kern/2019/11/03/msg025641.html
 1.67 03-Feb-2017  christos branches: 1.67.14;
add send recv mmsg and unimpl
XXX: fix base?
 1.66 03-Feb-2017  martin Add accept4 definitions
 1.65 02-Jan-2017  manu branches: 1.65.2;
Add pselect6 Linux system call.
This lets Matlab R2016A run on NetBSD/amd64
 1.64 24-Jul-2016  njoly Small cleanup. Adjust readlink/readlinkat signatures to reduce diffs with
native.
 1.63 23-Mar-2015  ozaki-r branches: 1.63.2;
Fix inconsistent argument names
 1.62 22-Nov-2014  njoly branches: 1.62.2;
Fix ppoll signature (int ->u_int)
 1.61 31-May-2014  njoly branches: 1.61.2;
Fix munmap(2) signature.
 1.60 29-May-2014  njoly For utimes(2), use compat_50_sys_utimes() instead of local version.
 1.59 20-May-2014  njoly Fix getgroups/setgroups signature.
 1.58 17-May-2014  njoly Fix fadvise64 syscalls to use 64bit offset types.
 1.57 06-May-2014  njoly Reduce diffs between archs; make mknod device argument unsigned.
 1.56 04-May-2014  njoly Fix pread/pwrite syscalls which need a 64bit offset argument.
 1.55 08-Apr-2014  njoly Adjust read/write/readv/writev signature to match native versions.
 1.54 08-Dec-2013  njoly branches: 1.54.2;
Sprinkle a few more linux_umode_t where appropriate.
Reduce diffs between archs.
 1.53 19-Nov-2013  chs add the *at() syscalls.
 1.52 07-Nov-2013  njoly Fix dup/dup2/dup3 argument types (u_int -> int).
 1.51 24-Sep-2013  njoly Add utimensat(2) for compat linux.
 1.50 08-Apr-2013  pooka branches: 1.50.4;
support utimes on non-alpha linux platforms
 1.49 19-Sep-2012  pooka emulate ppoll which is essentially our pollts
 1.48 18-Nov-2011  christos branches: 1.48.10;
add sigtimedwait
 1.47 09-Jul-2011  christos branches: 1.47.2;
the first argument of {g,s}etitimer() is int not u_int.
 1.46 30-May-2011  alnsn Add fadvise64 and fadvise64_64 syscalls to compat_linux and compat_linux32.
 1.45 15-Apr-2011  he Add dup3() and pipe2() for these archs as well.
 1.44 07-Jul-2010  chs branches: 1.44.2;
many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
- support new-style (NPTL) linux pthreads on all platforms.
clone() with CLONE_THREAD uses 1 process with many LWPs
instead of separate processes.
- move the contents of sys__lwp_setprivate() into a new
lwp_setprivate() and use that everywhere.
- update linux_release[] and linux32_release[] to "2.6.18".
- adjust placement of emul fork/exec/exit hooks as needed
and adjust other emul code to match.
- convert all struct emul definitions to use named initializers.
- change the pid allocator to allow multiple pids to refer to the same proc.
- remove a few fields from struct proc that are no longer needed.
- disable the non-functional "vdso" code in linux32/amd64,
glibc works fine without it.
- fix a race in the futex code where we could miss a wakeup after
a requeue operation.
- redo futex locking to be a little more efficient.
 1.43 24-Nov-2009  njoly branches: 1.43.2; 1.43.4;
Update personality(2) to match Linux definition where the argument is an
unsigned long.
 1.42 08-Jun-2009  njoly Update rt_queueinfo(2) definition, and kill a corresponding comment.
 1.41 17-Jan-2009  njoly branches: 1.41.2;
Convert linux/linux32 wait(4) to use a compat50 rusage structure.
 1.40 15-Jan-2009  njoly Update some syscalls/arguments to use the new compat50 equivalents.
 1.39 13-Jan-2009  pooka Convert the syscalls.master to a format from which it is easier
to parse and generate the compat name and basename (e.g. __stat50
and stat). Use this to autogenerate __RENAME()'s to the rump_syscalls
header so that they can be called e.g. rump_sys_socket() instead
of rump_sys___socket30().
 1.38 13-Jan-2009  rtr actually commit syscalls.master this time
add back blank line between #include <sys/.. and #include <sys/compat/..
regen
 1.37 19-Nov-2008  ad Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.36 12-Nov-2008  njoly Fix nanosleep(2) on 64-bit archs. Do not call native nanosleep
syscall, but rather a modified version the will take care of `struct
timespec' conversions.
 1.35 23-Apr-2008  ad branches: 1.35.2; 1.35.4; 1.35.8; 1.35.10; 1.35.12;
-SYCALL_MPSAFE
 1.34 04-Apr-2008  njoly branches: 1.34.2;
Cleanup. Kill linux_sys_msync and use sys___msync13 instead.
No functional changes expected.
 1.33 15-Jan-2008  njoly branches: 1.33.6;
compat linux (and linux32) uid16 functions cleanup and fixes.

- Move uid16 functions to their own file linux_uid16.c, included by
needed archs (arm, i386 and m68k).
- Add new MI types linux_{u,g}id16_t.
- Add macros to handle linux_uid16_t and uid_t conversions.
- Add linux_sys_getres{uid,gid}16 syscalls, to fix an overflow with
bad sizes given to copyout when linux_sys_getres{uid,gid} are used.
- Update arm syscall table to use more uid16 functions.
 1.32 24-Dec-2007  njoly Kill unneeded linux_sys_getpgid and use native sys_getpgid instead.
 1.31 21-Dec-2007  njoly - Fix setfsuid to return uid on success.
- Replace getfsuid, which never existed on Linux, by correct setfsgid
syscall.

ok by christos and dsl.
 1.30 20-Dec-2007  dsl Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.29 16-Nov-2007  njoly branches: 1.29.2; 1.29.6;
Cleanup. Remove a few linux syscalls definitions, now identical to
native ones (with stackgap and ALT_CHECK_xxx removal). No functional
changes expected.
 1.28 04-Mar-2007  christos branches: 1.28.14; 1.28.16; 1.28.20; 1.28.22;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.27 09-Feb-2007  ad branches: 1.27.2;
Merge newlock2 to head.
 1.26 01-Sep-2006  matt branches: 1.26.2;
Don't conditionalize *sys_ptrace. The lack of sys_ptrace will be dealt
with differently.
 1.25 30-Aug-2006  matt Update to deal with options PTRACE
 1.24 10-Jun-2006  christos linux getpriority is off-by-20 so use our own function.
From PR/33671: Nicolas Joly
 1.23 11-Dec-2005  christos branches: 1.23.4; 1.23.8; 1.23.14;
merge ktrace-lwp.
 1.22 16-May-2005  fvdl branches: 1.22.2;
Add clock_* POSIX functions.
 1.21 16-May-2005  fvdl Add *xattr functions (they all return EOPNOTSUPP).
 1.20 26-Feb-2005  perry nuke trailing whitespace
 1.19 20-Sep-2004  jdolecek branches: 1.19.4; 1.19.6;
implement support for Linux statfs64() syscall - 64bit variant of statfs()
 1.18 08-Sep-2004  jdolecek implement basic exit_group(2), which just terminates calling thread;
apparently not many apps use thread groups yet, at least not with default
SuSE 9.1 libraries, so this is enough for now
 1.17 01-Aug-2004  jdolecek add stub entries for syscalls added until Linux kernel 2.6.7

move the ARM-specific syscall range up to offset 0x180, to make room
for the new syscalls
 1.16 01-Aug-2004  jdolecek connect madvise(2) and mincore(2) - apparently the newer Linux libs
don't stub it anymore, so allow the application to take advantage
of them

the Linux calls appear to be compatible in the flag values and semantics,
so a wrapper is not necessary
 1.15 10-Aug-2003  jdolecek add Linux compat arg wrapper for ftruncate64(), and change linux compat
truncate64() wrapper to translate args structure
NetBSD truncate() and ftrucate() have hidden 'pad' argument, so we have
to do the argument translation

Problem found and patch supplied in PR kern/22360 by Ales Krenek

This is the last of syscalls with hidden 'pad' arg we didn't have
wrapper for; all the others (lseek, mmap, pwrite, pread) already had
wrapper before.
 1.14 28-Jun-2003  he branches: 1.14.2;
Need to include linux_mmap.h to get size of struct linux_sys_mmap2_args.
 1.13 23-Jun-2003  christos PR/21937: Todd Vierling: Proper support for mmap2
 1.12 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.11 12-May-2002  jdolecek branches: 1.11.4;
hook in remaining 64bit fs syscalls
make most of stuff in linux_file64.c available unconditionally,
with exception of fcntl64, which is not present on Linux m68k
 1.10 10-Apr-2002  christos add getdents64
 1.9 22-Mar-2002  christos nuke mmap2 add mprotect
 1.8 17-Feb-2002  bjh21 branches: 1.8.2;
getrlimit and setrlimit now have Linux-specific implementations. Use them.
 1.7 15-Feb-2002  christos - add a real linux_sys___sysctl because the mib numbers are different.
implement only the kernel version getting entries.
- make the signal conversion functions consistent; dest is arg 1.
- make linux_fakedev deal with block and char devices differently.
- add linux_sys_ugetrlimit, and flesh out the regular get/setrlimit so
that they work properly.
- add linux_mmap2 [untested].
- bump kernel to 2.4.18, and make the date be valentine's day :-)
- linux_sys_*stat64 family was totally busted. Fix it.

tested only on i386.

Status:
gdb, telnet, work
jdk-1.4.0 extractor works, jdk still coredumps.

christos
 1.6 27-Jan-2002  bjh21 branches: 1.6.2;
Add support for breakpoints to ARMLinux emulation.
 1.5 27-Jan-2002  bjh21 Make syscall 0 an explicit call of linux_sys_nosys, as it is on i386. This
is necessary to get a prototype for linux_sys_nosys generated in syscallargs.h.
 1.4 23-Jan-2002  bjh21 Syscall 0 isn't syscall() on ARMLinux. Mark it UNIMPL instead.
 1.3 23-Jan-2002  bjh21 Add support for the ARM-specific syscalls in ARMLinux. These are invoked
by SWI numbers above 0x9f0000, but we re-map them down to somewhere just
after the end of the usual syscall range, since NetBSD doesn't handle
sparse syscall arrays well.

The only syscall I've actually implemented in this range is cacheflush(),
which was previously being mapped to fork(), causing ... interesting results.
 1.2 15-Jan-2002  bjh21 Shuffle uname calls around. It turns out we don't use the same names as
Linux does, so:
sys_olduname -> linux_sys_oldolduname
sys_uname -> linux_sys_olduname
sys_newuname -> linux_sys_uname
 1.1 14-Jan-2002  bjh21 Crude first cut at ARMLinux binary compatibility. Successfully runs
"/emul/linux/bin/echo hello, world", dynamically linked.
 1.6.2.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.6.2.3 16-Mar-2002  jdolecek Catch up with -current.
 1.6.2.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.6.2.1 27-Jan-2002  jdolecek file syscalls.master was added on branch kqueue on 2002-02-11 20:09:32 +0000
 1.8.2.6 20-Jun-2002  nathanw Catch up to -current.
 1.8.2.5 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.8.2.4 17-Apr-2002  nathanw Catch up to -current.
 1.8.2.3 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.8.2.2 28-Feb-2002  nathanw Catch up to -current.
 1.8.2.1 17-Feb-2002  nathanw file syscalls.master was added on branch nathanw_sa on 2002-02-28 04:12:49 +0000
 1.11.4.4 14-Jun-2004  jmc Pullup patch (requested by skrll in ticket #1708)

Bring netbsd-1-6 inline with -current sources after the mistakes in ticket #1686
 1.11.4.3 11-May-2004  tron Pull up revision 1.15 via patch (requested by wennmach in ticket #1686):
add Linux compat arg wrapper for ftruncate64(), and change linux compat
truncate64() wrapper to translate args structure
NetBSD truncate() and ftrucate() have hidden 'pad' argument, so we have
to do the argument translation
Problem found and patch supplied in PR kern/22360 by Ales Krenek
This is the last of syscalls with hidden 'pad' arg we didn't have
wrapper for; all the others (lseek, mmap, pwrite, pread) already had
wrapper before.
 1.11.4.2 20-Nov-2003  jmc Followup from ticket #1427. Need to include mmap2.h here or it won't compile
 1.11.4.1 22-Oct-2003  jmc Regen files (requested by tv in ticket #1427)

Proper support for mmap2
 1.14.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.14.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.14.2.4 24-Sep-2004  skrll Sync with HEAD.
 1.14.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.14.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.14.2.1 03-Aug-2004  skrll Sync with HEAD
 1.19.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.19.4.1 29-Apr-2005  kent sync with -current
 1.22.2.5 21-Jan-2008  yamt sync with head
 1.22.2.4 07-Dec-2007  yamt sync with head
 1.22.2.3 03-Sep-2007  yamt sync with head.
 1.22.2.2 26-Feb-2007  yamt sync with head.
 1.22.2.1 21-Jun-2006  yamt sync with head.
 1.23.14.1 19-Jun-2006  chap Sync with head.
 1.23.8.1 26-Jun-2006  yamt sync with head.
 1.23.4.1 09-Sep-2006  rpaulo sync with head
 1.26.2.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.27.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.28.22.3 18-Feb-2008  mjf Sync with HEAD.
 1.28.22.2 27-Dec-2007  mjf Sync with HEAD.
 1.28.22.1 19-Nov-2007  mjf Sync with HEAD.
 1.28.20.1 18-Nov-2007  bouyer Sync with HEAD
 1.28.16.2 23-Mar-2008  matt sync with HEAD
 1.28.16.1 09-Jan-2008  matt sync with HEAD
 1.28.14.1 21-Nov-2007  joerg Sync with HEAD.
 1.29.6.2 19-Jan-2008  bouyer Sync with HEAD
 1.29.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.29.2.1 26-Dec-2007  ad Sync with head.
 1.33.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.33.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.34.2.1 18-May-2008  yamt sync with head.
 1.35.12.1 20-Nov-2008  snj Pull up following revision(s) (requested by njoly in ticket #81):
sys/compat/linux/arch/mips/syscalls.master: revision 1.30
sys/compat/linux/arch/m68k/syscalls.master: revision 1.63
sys/compat/linux32/arch/amd64/syscalls.master: revision 1.39
sys/compat/linux/arch/alpha/syscalls.master: revision 1.63
sys/compat/linux/arch/powerpc/syscalls.master: revision 1.38
sys/compat/linux32/common/linux32_time.c: revision 1.22
sys/compat/linux/arch/amd64/syscalls.master: revision 1.25
sys/compat/linux/arch/i386/syscalls.master: revision 1.94
sys/compat/linux/arch/arm/syscalls.master: revision 1.36
sys/compat/linux/common/linux_time.c: revision 1.26
Fix nanosleep(2) on 64-bit archs. Do not call native nanosleep
syscall, but rather a modified version the will take care of `struct
timespec' conversions.
 1.35.10.1 19-Jan-2009  skrll Sync with HEAD.
 1.35.8.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.35.4.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.35.4.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.35.2.4 11-Aug-2010  yamt sync with head.
 1.35.2.3 11-Mar-2010  yamt sync with head
 1.35.2.2 20-Jun-2009  yamt sync with head
 1.35.2.1 04-May-2009  yamt sync with head.
 1.41.2.1 23-Jul-2009  jym Sync with HEAD.
 1.43.4.3 31-May-2011  rmind sync with head
 1.43.4.2 21-Apr-2011  rmind sync with head
 1.43.4.1 05-Mar-2011  rmind sync with head
 1.43.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.44.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.47.2.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.47.2.2 30-Oct-2012  yamt sync with head
 1.47.2.1 17-Apr-2012  yamt sync with head
 1.48.10.4 03-Dec-2017  jdolecek update from HEAD
 1.48.10.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.48.10.2 23-Jun-2013  tls resync from head
 1.48.10.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.50.4.1 18-May-2014  rmind sync with head
 1.54.2.1 10-Aug-2014  tls Rebase.
 1.61.2.1 17-Apr-2017  snj Pull up following revision(s) (requested by manu in ticket #1354):
sys/compat/linux/arch/alpha/syscalls.master: revision 1.92 via patch
sys/compat/linux/arch/amd64/syscalls.master: revision 1.58 via patch
sys/compat/linux/arch/arm/syscalls.master: revision 1.65 via patch
sys/compat/linux/arch/i386/syscalls.master: revision 1.122 via patch
sys/compat/linux/arch/m68k/syscalls.master: revision 1.91 via patch
sys/compat/linux/arch/mips/syscalls.master: revision 1.61 via patch
sys/compat/linux/arch/powerpc/syscalls.master: revision 1.70 via patch
sys/compat/linux/common/linux_misc.c: revision 1.234
sys/compat/linux/common/linux_signal.h: revision 1.31
Add pselect6 Linux system call.
This lets Matlab R2016A run on NetBSD/amd64
 1.62.2.3 05-Feb-2017  skrll Sync with HEAD
 1.62.2.2 05-Oct-2016  skrll Sync with HEAD
 1.62.2.1 06-Apr-2015  skrll Sync with HEAD
 1.63.2.3 20-Mar-2017  pgoyette Sync with HEAD
 1.63.2.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.63.2.1 26-Jul-2016  pgoyette Sync with HEAD
 1.65.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.67.14.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.69.2.2 17-Dec-2020  thorpej Add suppport for Linux preadv(2) and pwritev(2). Same as native, except
for the silly way that the offset argument is passed in.
 1.69.2.1 15-Dec-2020  thorpej Add Linux eventfd, timerfd, and POSIX timer calls.
 1.80.2.1 02-Aug-2025  perseant Sync with HEAD
 1.4 29-May-2024  christos should not be using .include <> but .include "" here.
 1.3 08-Apr-2014  njoly Do not include bsd.kinc.mk in each arch Makefile, it's already pulled
by bsd.syscall.mk (from Makefile.inc).
 1.2 03-Oct-1998  christos branches: 1.2.184; 1.2.194; 1.2.200; 1.2.210;
Attempt to fix the mess.
 1.1 01-Oct-1998  erh New makefiles for includes, syscall gen.
 1.2.210.1 10-Aug-2014  tls Rebase.
 1.2.200.1 18-May-2014  rmind sync with head
 1.2.194.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.184.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.10 23-Feb-2009  rmind Switch Linux futex emulation to native ucas_int(), remove unecessary
futex-specific assembler routines.

Fixes PR/40490. Reviewed by <ad>.
 1.9 26-Oct-2008  christos branches: 1.9.2; 1.9.4; 1.9.8;
futex support fixes from FreeBSD via cube+pengo.
 1.8 30-Aug-2006  matt branches: 1.8.52; 1.8.62;
Update to deal with options PTRACE
 1.7 11-Dec-2005  christos branches: 1.7.4; 1.7.8;
merge ktrace-lwp.
 1.6 13-Nov-2004  christos branches: 1.6.12;
Split out the setup stack function for the benefit of lkms.
XXX: Our lkm system sucks. We really need to be exporting symbols, but
that leads to symbol conflicts.
 1.5 31-Mar-2002  christos branches: 1.5.10;
bring the reverse signal mapping array into linux_signo.c
 1.4 12-Dec-1999  tron branches: 1.4.6; 1.4.8;
Incomplete but already working emulation of Linux's ptrace(2) for i386.
 1.3 03-Jan-1999  erh branches: 1.3.8; 1.3.14;
Speed up compilation by #include-ing C files from common into one file.
 1.2 03-Oct-1998  christos Attempt to fix the mess.
 1.1 01-Oct-1998  erh New list of files for the i386.
 1.3.14.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.3.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.4.8.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.4.6.1 17-Apr-2002  nathanw Catch up to -current.
 1.5.10.1 14-Nov-2004  skrll Sync with HEAD.
 1.6.12.1 30-Dec-2006  yamt sync with head.
 1.7.8.1 03-Sep-2006  yamt sync with head.
 1.7.4.1 09-Sep-2006  rpaulo sync with head
 1.8.62.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.8.52.1 17-Jan-2009  mjf Sync with HEAD.
 1.9.8.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.9.4.1 26-Feb-2009  snj Pull up following revision(s) (requested by rmind in ticket #493):
sys/compat/linux/arch/amd64/files.linux_amd64: revision 1.4
sys/compat/linux/arch/amd64/linux_support.S: file removal
sys/compat/linux/common/linux_futex.c: revision 1.23
sys/compat/linux/arch/i386/linux_support.S: file removal
sys/compat/linux/arch/i386/files.linux_i386: revision 1.10
Switch Linux futex emulation to native ucas_int(), remove unecessary
futex-specific assembler routines.
Fixes PR/40490. Reviewed by <ad>.
 1.9.2.1 03-Mar-2009  skrll Sync with HEAD.
 1.18 12-Oct-2021  andvar fix various typos, mainly in comments.
 1.17 03-May-2020  thorpej Always clear FUTEX_PRIVATE_FLAG for Linux processes. NetBSD-native futexes
exist in different namespace depending on FUTEX_PRIVATE_FLAG. This appears
not to be the case in Linux, and some futex users will mix private and non-
private ops on the same futex object. Provide a convenience wrapper that
puts this logic in one place witn a comment explaining why.

While here, move the Linux futex wrapper out of its own file and plop
it in linux_misc.c, which is where it lives in the linux32 module.
 1.16 31-May-2011  njoly Fix path for fadvise64 files.
 1.15 30-May-2011  alnsn Add fadvise64 and fadvise64_64 syscalls to compat_linux and compat_linux32.
 1.14 02-Mar-2010  pooka branches: 1.14.2; 1.14.4;
Nuke fs_lfs.h included for unknown reasons (if there was a reason
other than "accident", i hereby declare that reason invalid)
 1.13 19-Nov-2008  ad branches: 1.13.6;
Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.12 02-Feb-2008  dsl branches: 1.12.6; 1.12.10; 1.12.12; 1.12.16; 1.12.18;
Extract the fcntl64() suppoort from linux_file64.c into linux_fcntl64.c
Unravel some of the knots that caused linux_file64.c to be compiled twice
for an amd64 kernel (once for linux and once for linux32) with different
parts being skipped each time.
 1.11 15-Jan-2008  njoly compat linux (and linux32) uid16 functions cleanup and fixes.

- Move uid16 functions to their own file linux_uid16.c, included by
needed archs (arm, i386 and m68k).
- Add new MI types linux_{u,g}id16_t.
- Add macros to handle linux_uid16_t and uid_t conversions.
- Add linux_sys_getres{uid,gid}16 syscalls, to fix an overflow with
bad sizes given to copyout when linux_sys_getres{uid,gid} are used.
- Update arm syscall table to use more uid16 functions.
 1.10 15-Aug-2007  ad branches: 1.10.2; 1.10.8; 1.10.14;
Changes to make ktrace LKM friendly and reduce ifdef KTRACE. Proposed
on tech-kern.
 1.9 13-Jun-2007  christos branches: 1.9.2; 1.9.6;
Add futex.
 1.8 09-Feb-2007  ad branches: 1.8.6; 1.8.8;
Merge newlock2 to head.
 1.7 18-Jan-2003  thorpej branches: 1.7.18; 1.7.48;
Merge the nathanw_sa branch.
 1.6 15-Nov-2001  lukem don't need <sys/types.h> when including <sys/param.h>
 1.5 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.4 30-May-2001  mrg branches: 1.4.2;
use _KERNEL_OPT.
 1.3 17-Dec-2000  jdolecek branches: 1.3.2;
make LKM safe
 1.2 12-Dec-2000  jdolecek add emulation of Linux truncate64(2), ftruncate64(2), *stat64(2)
 1.1 03-Jan-1999  erh branches: 1.1.8;
Speed up compilation by #include-ing C files from common into one file.
 1.1.8.2 05-Jan-2001  bouyer Sync with HEAD
 1.1.8.1 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.3.2.4 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.3.2.3 08-Jan-2002  nathanw Catch up to -current.
 1.3.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.3.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.4.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.7.48.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.7.18.4 04-Feb-2008  yamt sync with head.
 1.7.18.3 21-Jan-2008  yamt sync with head
 1.7.18.2 03-Sep-2007  yamt sync with head.
 1.7.18.1 26-Feb-2007  yamt sync with head.
 1.8.8.1 11-Jul-2007  mjf Sync with head.
 1.8.6.2 20-Aug-2007  ad Sync with HEAD.
 1.8.6.1 15-Jul-2007  ad Sync with head.
 1.9.6.1 16-Aug-2007  jmcneill Sync with HEAD.
 1.9.2.1 03-Sep-2007  skrll Sync with HEAD.
 1.10.14.1 19-Jan-2008  bouyer Sync with HEAD
 1.10.8.1 18-Feb-2008  mjf Sync with HEAD.
 1.10.2.1 23-Mar-2008  matt sync with HEAD
 1.12.18.1 19-Jan-2009  skrll Sync with HEAD.
 1.12.16.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.12.12.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.12.12.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.12.10.2 11-Mar-2010  yamt sync with head
 1.12.10.1 04-May-2009  yamt sync with head.
 1.12.6.1 17-Jan-2009  mjf Sync with HEAD.
 1.13.6.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.14.4.1 06-Jun-2011  jruoho Sync with HEAD.
 1.14.2.2 12-Jun-2011  rmind sync with head
 1.14.2.1 31-May-2011  rmind sync with head
 1.11 17-Dec-2013  njoly Cleanup compat linux errnos by adding generic errnos in a single file.
Use it for all arches except alpha and mips.
Add a few missing native to linux errno conversions.
 1.10 28-Apr-2008  martin branches: 1.10.34; 1.10.44; 1.10.50;
Remove clause 3 and 4 from TNF licenses
 1.9 11-Dec-2005  christos branches: 1.9.70; 1.9.72; 1.9.74;
merge ktrace-lwp.
 1.8 26-Feb-2005  perry nuke trailing whitespace
 1.7 12-Feb-2001  manu branches: 1.7.24; 1.7.32; 1.7.34;
Clarified comments about the LINUX_SCERR_SIGN macro
 1.6 11-Feb-2001  manu Moved the fix for negative errno returned to userland on the PowerPC to a
more machine independent fashion
 1.5 18-Jan-2001  jdolecek kill local declaration of native_to_linux_errno[], one in common/linux_errno.h suffices
 1.4 11-Dec-2000  mycroft Introduce 2 new flags in types.h:
* __HAVE_SYSCALL_INTERN. If this is defined, e_syscall is replaced by
e_syscall_intern, which is called at key places in the kernel. This can be
used to set a MD syscall handler pointer. This obsoletes and replaces the
*_HAS_SEPARATED_SYSCALL flags.
* __HAVE_MINIMAL_EMUL. If this is defined, certain (deprecated) elements in
struct emul are omitted.
 1.3 04-Oct-1998  fvdl branches: 1.3.12;
Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.2 01-Oct-1998  erh Split compat/linux/linux_errno.h into i386 and common parts.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.3.12.3 12-Mar-2001  bouyer Sync with HEAD.
 1.3.12.2 11-Feb-2001  bouyer Sync with HEAD.
 1.3.12.1 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.7.34.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.7.32.1 29-Apr-2005  kent sync with -current
 1.7.24.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.9.74.1 16-May-2008  yamt sync with head.
 1.9.72.1 18-May-2008  yamt sync with head.
 1.9.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.10.50.1 18-May-2014  rmind sync with head
 1.10.44.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.10.34.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.14 26-Nov-2021  ryo - LINUX_GO_RT0_SIGNATURE for compat_linux is no longer enabled by default.
it is now defined in each arch same as the other *_SIGNATURE definitions.
- add new LINUX32_GO_RT0_SIGNATURE for compat_linux32, and is defined in amd64 and aarch64.
 1.13 12-Feb-2017  chs es_arglen is now in units of bytes, update the emulations accordingly.
 1.12 09-Feb-2014  chs branches: 1.12.6; 1.12.10; 1.12.14;
account for the 16 bytes of AT_RANDOM data in the stack setup. fixes PR 48518.
use cprng_strong32() instead of random(). add AT_RANDOM support for linux32.
 1.11 21-Mar-2012  chs branches: 1.11.2; 1.11.4;
define LINUX_DEBUGLINK_SIGNATURE for i386 too.
this allows linux ldd to work.
 1.10 17-Nov-2008  ad branches: 1.10.16; 1.10.20; 1.10.22;
LINUX_GCC_SIGNATURE also matches NetBSD/i386 ELF binaries, so disable it.
 1.9 28-Apr-2008  martin branches: 1.9.6; 1.9.8;
Remove clause 3 and 4 from TNF licenses
 1.8 11-Dec-2005  christos branches: 1.8.70; 1.8.72; 1.8.74;
merge ktrace-lwp.
 1.7 21-Aug-2003  dsl branches: 1.7.16;
Hide prototype of linux_exec_setup_stack() inside #ifdef _KERNEL so
that sbin/sysctl will compile.
 1.6 08-Aug-2003  christos - GC all the setup_stack functions
- add one for linux/i386
 1.5 13-Nov-2002  jdolecek branches: 1.5.6;
add generic linux compat ELF copyargs function

this gives:
* linux sysconf(_SC_CLK_TCK) gives correct value for linux binaries (hz)
even if hz != 100
* glibc gets proper information on real/effective uid and enables
secure mode for suid binaries

g/c LINUX_COPYARGS_FUNCTION, replaced by linux ELF copyargs function
g/c alpha-specific linux ELF copyargs function and linux ELF defines
 1.4 21-Nov-2000  jdolecek branches: 1.4.2;
restructure struct emul and execsw, in preparation to make emulations LKMable:
* move all exec-type specific information from struct emul to execsw[] and
provide single struct emul per emulation
* elf:
- kern/exec_elf32.c:probe_funcs[] is gone, execsw[] how has one entry
per emulation and contains pointer to respective probe function
- interp is allocated via MALLOC() rather than on stack
- elf_args structure is allocated via MALLOC() rather than malloc()
* ecoff: the per-emulation hooks moved from alpha and mips specific code
to OSF1 and Ultrix compat code as appropriate, execsw[] has one entry per
emulation supporting ecoff with appropriate probe function
* the makecmds/probe functions don't set emulation, pointer to emulation is
part of appropriate execsw[] entry
* constify couple of structures
 1.3 17-Nov-2000  erh Make the linux compatibilty code work on the alpha. (horay!) (at last!)
Two main changes:
Create a linux_elf64_copyargs that uses the linux specific LinuxAuxInfo
structure. This is only used on the alpha. i386 and m68k use the
standard elf copyargs function.

Since linux's approach to binary compatibilty is to look as much
like osf1 as possible, add all the osf1 syscalls that we have
implemented to the linux syscall table. This includes get/setsysinfo,
ported from FreeBSD.

In order for linux compat to work you must have COMPAT_OSF1, COMPAT_43,
COMPAT_09, COMPAT_12 and COMPAT_13 on also.
 1.2 22-Oct-1998  erh branches: 1.2.12;
Define LINUX_GCC_SIGNATURE.
 1.1 01-Oct-1998  erh Add linux i386 machine type.
 1.2.12.1 22-Nov-2000  bouyer Sync with HEAD.
 1.4.2.1 11-Dec-2002  thorpej Sync with HEAD.
 1.5.6.4 04-Feb-2005  skrll Adapt to branch.
 1.5.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.6.1 03-Aug-2004  skrll Sync with HEAD
 1.7.16.1 21-Jun-2006  yamt sync with head.
 1.8.74.2 04-May-2009  yamt sync with head.
 1.8.74.1 16-May-2008  yamt sync with head.
 1.8.72.1 18-May-2008  yamt sync with head.
 1.8.70.2 17-Jan-2009  mjf Sync with HEAD.
 1.8.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.9.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.9.6.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.10.22.1 25-Mar-2012  bouyer Pull up following revision(s) (requested by chs in ticket #140):
sys/compat/linux/arch/i386/linux_exec.h: revision 1.11
define LINUX_DEBUGLINK_SIGNATURE for i386 too.
this allows linux ldd to work.
 1.10.20.1 05-Apr-2012  mrg sync to latest -current.
 1.10.16.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.10.16.1 17-Apr-2012  yamt sync with head
 1.11.4.1 18-May-2014  rmind sync with head
 1.11.2.2 03-Dec-2017  jdolecek update from HEAD
 1.11.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.12.14.1 21-Apr-2017  bouyer Sync with HEAD
 1.12.10.1 20-Mar-2017  pgoyette Sync with HEAD
 1.12.6.1 28-Aug-2017  skrll Sync with HEAD
 1.20 05-Sep-2020  riastradh Round of uvm.h cleanup.

The poorly named uvm.h is generally supposed to be for uvm-internal
users only.

- Narrow it to files that actually need it -- mostly files that need
to query whether curlwp is the pagedaemon, which should maybe be
exposed by an external header.

- Use uvm_extern.h where feasible and uvm_*.h for things not exposed
by it. We should split up uvm_extern.h but this will serve for now
to reduce the uvm.h dependencies.

- Use uvm_stat.h and #ifdef UVMHIST uvm.h for files that use
UVMHIST(ubchist), since ubchist is declared in uvm.h but the
reference evaporates if UVMHIST is not defined, so we reduce header
file dependencies.

- Make uvm_device.h and uvm_swap.h independently includable while
here.

ok chs@
 1.19 19-Jul-2020  maxv don't include opt_user_ldt.h when it is not needed
 1.18 12-Aug-2017  maxv Remove vm86.

Pass 3.
 1.17 29-Mar-2011  plunky branches: 1.17.14; 1.17.32;
tidy up include pathname to exclude undefined behaviour

"If the characters ', \, ", //, or /* occur in the sequence between
the < and > delimiters, the behavior is undefined."
 1.16 07-Jul-2010  chs branches: 1.16.2;
many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
- support new-style (NPTL) linux pthreads on all platforms.
clone() with CLONE_THREAD uses 1 process with many LWPs
instead of separate processes.
- move the contents of sys__lwp_setprivate() into a new
lwp_setprivate() and use that everywhere.
- update linux_release[] and linux32_release[] to "2.6.18".
- adjust placement of emul fork/exec/exit hooks as needed
and adjust other emul code to match.
- convert all struct emul definitions to use named initializers.
- change the pid allocator to allow multiple pids to refer to the same proc.
- remove a few fields from struct proc that are no longer needed.
- disable the non-functional "vdso" code in linux32/amd64,
glibc works fine without it.
- fix a race in the futex code where we could miss a wakeup after
a requeue operation.
- redo futex locking to be a little more efficient.
 1.15 23-Apr-2010  joerg Use struct segment_descriptor for pcb_fsd and pcb_gsd instead of int[2].
 1.14 23-Nov-2009  rmind branches: 1.14.2; 1.14.4;
Use lwp_getpcb() in compat code, clean from struct user.
 1.13 20-Sep-2009  taca Trying to fix build problem. Thanks to joerg's advise.
 1.12 29-Mar-2009  mrg - add new RLIMIT_AS (aka RLIMIT_VMEM) resource that limits the total
address space available to processes. this limit exists in most other
modern unix variants, and like most of them, our defaults are unlimited.
remove the old mmap / rlimit.datasize hack.

- adds the VMCMD_STACK flag to all the stack-creation vmcmd callers.
it is currently unused, but was added a few years ago.

- add a pair of new process size values to kinfo_proc2{}. one is the
total size of the process memory map, and the other is the total size
adjusted for unused stack space (since most processes have a lot of
this...)

- patch sh, and csh to notice RLIMIT_AS. (in some cases, the alias
RLIMIT_VMEM was already present and used if availble.)

- patch ps, top and systat to notice the new k_vm_vsize member of
kinfo_proc2{}.

- update irix, svr4, svr4_32, linux and osf1 emulations to support
this information. (freebsd could be done, but that it's best left
as part of the full-update of compat/freebsd.)


this addresses PR 7897. it also gives correct memory usage values,
which have never been entirely correct (since mmap), and have been
very incorrect since jemalloc() was enabled.

tested on i386 and sparc64, build tested on several other platforms.

thanks to many folks for feedback and testing but most espcially
chuq and yamt for critical suggestions that lead to this patch not
having a special ugliness i wasn't happy with anyway :-)
 1.11 26-Oct-2008  christos branches: 1.11.2; 1.11.4; 1.11.8;
changes from pengo that make initializing skype more reliable.
 1.10 26-Oct-2008  christos use a symbolic constant instead of 6.
 1.9 26-Oct-2008  christos use GUGS_SEL instead of 3.
 1.8 26-Oct-2008  ad Assert that the segment descriptors we generate for TLS will not allow
privilege elevation.
 1.7 26-Oct-2008  christos don't forget the percpu stuff and load gs immediately.
 1.6 25-Oct-2008  christos Add preliminary tls support for i386. Does not work yet. From FreeBSD.
 1.5 28-Apr-2008  martin branches: 1.5.6;
Remove clause 3 and 4 from TNF licenses
 1.4 19-Oct-2007  ad branches: 1.4.16; 1.4.18; 1.4.20;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.3 11-Dec-2005  christos branches: 1.3.30; 1.3.44; 1.3.46; 1.3.50;
merge ktrace-lwp.
 1.2 26-Feb-2005  perry branches: 1.2.4;
nuke trailing whitespace
 1.1 13-Nov-2004  christos branches: 1.1.2; 1.1.6; 1.1.8;
Split out the setup stack function for the benefit of lkms.
XXX: Our lkm system sucks. We really need to be exporting symbols, but
that leads to symbol conflicts.
 1.1.8.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.1.6.1 29-Apr-2005  kent sync with -current
 1.1.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.1.2.3 04-Feb-2005  skrll Adapt to branch.
 1.1.2.2 14-Nov-2004  skrll Sync with HEAD.
 1.1.2.1 13-Nov-2004  skrll file linux_exec_machdep.c was added on branch ktrace-lwp on 2004-11-14 08:15:33 +0000
 1.2.4.2 27-Oct-2007  yamt sync with head.
 1.2.4.1 21-Jun-2006  yamt sync with head.
 1.3.50.1 25-Oct-2007  bouyer Sync with HEAD.
 1.3.46.1 06-Nov-2007  matt sync with HEAD
 1.3.44.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.3.30.1 23-Oct-2007  ad Sync with head.
 1.4.20.4 11-Aug-2010  yamt sync with head.
 1.4.20.3 11-Mar-2010  yamt sync with head
 1.4.20.2 04-May-2009  yamt sync with head.
 1.4.20.1 16-May-2008  yamt sync with head.
 1.4.18.1 18-May-2008  yamt sync with head.
 1.4.16.2 17-Jan-2009  mjf Sync with HEAD.
 1.4.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.5.6.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.11.8.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.11.4.1 01-Apr-2009  snj Pull up following revision(s) (requested by mrg in ticket #622):
bin/csh/csh.1: revision 1.46
bin/csh/func.c: revision 1.37
bin/ps/print.c: revision 1.111
bin/ps/ps.c: revision 1.74
bin/sh/miscbltin.c: revision 1.38
bin/sh/sh.1: revision 1.92 via patch
external/bsd/top/dist/machine/m_netbsd.c: revision 1.7
lib/libkvm/kvm_proc.c: revision 1.82
sys/arch/mips/mips/cpu_exec.c: revision 1.55
sys/compat/darwin/darwin_exec.c: revision 1.57
sys/compat/ibcs2/ibcs2_exec.c: revision 1.73
sys/compat/irix/irix_resource.c: revision 1.15
sys/compat/linux/arch/amd64/linux_exec_machdep.c: revision 1.16
sys/compat/linux/arch/i386/linux_exec_machdep.c: revision 1.12
sys/compat/linux/common/linux_limit.h: revision 1.5
sys/compat/osf1/osf1_resource.c: revision 1.14
sys/compat/svr4/svr4_resource.c: revision 1.18
sys/compat/svr4_32/svr4_32_resource.c: revision 1.17
sys/kern/exec_subr.c: revision 1.62
sys/kern/init_sysctl.c: revision 1.160
sys/kern/kern_exec.c: revision 1.288
sys/kern/kern_resource.c: revision 1.151
sys/sys/param.h: patch
sys/sys/resource.h: revision 1.31
sys/sys/sysctl.h: revision 1.184
sys/uvm/uvm_extern.h: revision 1.153
sys/uvm/uvm_glue.c: revision 1.136
sys/uvm/uvm_mmap.c: revision 1.128
usr.bin/systat/ps.c: revision 1.32
- - add new RLIMIT_AS (aka RLIMIT_VMEM) resource that limits the total
address space available to processes. this limit exists in most other
modern unix variants, and like most of them, our defaults are unlimited.
remove the old mmap / rlimit.datasize hack.
- - adds the VMCMD_STACK flag to all the stack-creation vmcmd callers.
it is currently unused, but was added a few years ago.
- - add a pair of new process size values to kinfo_proc2{}. one is the
total size of the process memory map, and the other is the total size
adjusted for unused stack space (since most processes have a lot of
this...)
- - patch sh, and csh to notice RLIMIT_AS. (in some cases, the alias
RLIMIT_VMEM was already present and used if availble.)
- - patch ps, top and systat to notice the new k_vm_vsize member of
kinfo_proc2{}.
- - update irix, svr4, svr4_32, linux and osf1 emulations to support
this information. (freebsd could be done, but that it's best left
as part of the full-update of compat/freebsd.)
this addresses PR 7897. it also gives correct memory usage values,
which have never been entirely correct (since mmap), and have been
very incorrect since jemalloc() was enabled.
tested on i386 and sparc64, build tested on several other platforms.
thanks to many folks for feedback and testing but most espcially
chuq and yamt for critical suggestions that lead to this patch not
having a special ugliness i wasn't happy with anyway :-)
 1.11.2.1 28-Apr-2009  skrll Sync with HEAD.
 1.14.4.3 21-Apr-2011  rmind sync with head
 1.14.4.2 05-Mar-2011  rmind sync with head
 1.14.4.1 30-May-2010  rmind sync with head
 1.14.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.14.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.16.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.17.32.1 28-Aug-2017  skrll Sync with HEAD
 1.17.14.1 03-Dec-2017  jdolecek update from HEAD
 1.8 25-Jun-2014  njoly Add a few missing open(2) flags (LINUX_O_*). Fix alpha wrong values.
 1.7 02-Nov-2010  chs branches: 1.7.18; 1.7.32;
define LINUX_O_CLOEXEC.
sort definitions by value.
consistently use hex instead of octal for the values.
 1.6 21-Sep-2010  chs implement O_DIRECTORY as standardized in POSIX-2008,
for both native and linux emulations.
this fixes the rest of PR 43695.
 1.5 28-Apr-2008  martin branches: 1.5.20; 1.5.22;
Remove clause 3 and 4 from TNF licenses
 1.4 30-Sep-2001  manu branches: 1.4.116; 1.4.118; 1.4.120;
Added initial support for fcntl64 system call (file locking is not
implemented)
 1.3 04-Oct-1998  fvdl branches: 1.3.24; 1.3.26; 1.3.28;
Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.2 01-Oct-1998  erh Split linux_fcntl.h into i386 and common parts.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.3.28.1 01-Oct-2001  fvdl Catch up with -current.
 1.3.26.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.3.24.1 08-Oct-2001  nathanw Catch up to -current.
 1.4.120.2 09-Oct-2010  yamt sync with head
 1.4.120.1 16-May-2008  yamt sync with head.
 1.4.118.1 18-May-2008  yamt sync with head.
 1.4.116.1 02-Jun-2008  mjf Sync with HEAD.
 1.5.22.1 05-Mar-2011  rmind sync with head
 1.5.20.2 06-Nov-2010  uebayasi Sync with HEAD.
 1.5.20.1 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.7.32.1 10-Aug-2014  tls Rebase.
 1.7.18.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.11 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.10 10-Dec-2000  fvdl branches: 1.10.122; 1.10.124; 1.10.126;
The gist of the Linux _IOX definitions was the same for all platforms;
move it to the MI linux_ioctl.h and only leave the MD bits in the MD
header files.
 1.9 04-Oct-1998  fvdl branches: 1.9.12; 1.9.22;
Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.8 01-Oct-1998  erh Split compat/linux/linux_ioctl.h into i386 and common parts.
 1.7 15-Jan-1998  christos PR/4794: Urban Boquist: Linux cdrom ioctls are missing
 1.6 04-Apr-1997  augustss * Move the Linux audio emulation into its own directory and rename it
OSS (aka VoxWare) audio emulation.
* Use the OSS audio emulation for Linux and FreeBSD.
* Add mixer emulation to the OSS emulator.
 1.5 19-Mar-1997  mycroft Emulate the SOUND_PCM_WRITE_CHANNELS ioctl. From PR 3356, by Lennart
Augustsson. Also add hooks for mixer ioctls.
 1.4 05-Apr-1996  christos Prototyping changes.
 1.3 08-Mar-1996  mycroft Separate ioctl emulation by group. Add (minimal) audio emulation.
 1.2 16-Aug-1995  mycroft Convert 230400 baud.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.9.22.1 30-Mar-2001  he Pull up revision 1.10 (requested by fvdl):
Add some required Linux emulation bits to support the Linux
version of VMware.
 1.9.12.1 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.10.126.1 16-May-2008  yamt sync with head.
 1.10.124.1 18-May-2008  yamt sync with head.
 1.10.122.1 02-Jun-2008  mjf Sync with HEAD.
 1.169 01-Nov-2021  thorpej Use "stack_t" instead of "struct sigaltstack", as the former is the
newer standardized name. NFC.
 1.168 07-Sep-2021  riastradh sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.167 09-Aug-2021  andvar fix typos in asymmetry, asymmetric(al), symmetrical.
 1.166 19-May-2019  maxv branches: 1.166.2;
Rename

fpu_save_area_clear -> fpu_clear
fpu_save_area_reset -> fpu_sigreset

Clearer, and reduces a future diff. No real functional change.
 1.165 17-Sep-2017  maxv branches: 1.165.4;
Remove the second argument from USERMODE and KERNELMODE, it is unused
now that we don't have vm86 anymore.
 1.164 12-Aug-2017  maxv Remove vm86. Simplifies a number of critical places.

Pass 2.
 1.163 05-Feb-2017  maxv branches: 1.163.4; 1.163.6;
Rename ldt->ldtstore and gdt->gdtstore on i386. It reduces the diff with
amd64, and makes it easier to track down these variables on nxr - 'ldt'
and 'gdt' being common keywords.
 1.162 13-Jul-2016  maxv branches: 1.162.2; 1.162.4;
x86_alldisks can be NULL, so don't dereference it. Not tested, but obvious
enough.
 1.161 08-Dec-2015  christos Fix DIOCGPARTINFO
 1.160 08-Dec-2015  christos Replace DIOCGPART -> DIOCGPARTINFO which returns the data needed instead of
pointers.
 1.159 09-Nov-2014  maxv branches: 1.159.2;
Do not uselessly include <sys/malloc.h>.
 1.158 19-Feb-2014  dsl branches: 1.158.4;
Add explicit #include <x86/fpu.h> instead of relying on pcb.h including it.
 1.157 15-Feb-2014  dsl Remove all references to MDL_USEDFPU and deferred fpu initialisation.
The cost of zeroing the save area on exec is minimal.
This stops the FP registers of a random process being used the first
time an lwp uses the fpu.
sendsig_siginfo() and get_mcontext() now unconditionally copy the FP
registers.
I'll remove the double-copy for signal handlers soon.
get_mcontext() might have been leaking kernel memory to userspace - and
may still do so if i386_use_fxsave is false (short copies).
 1.156 26-Jan-2014  dsl Remove support for 'external' floating point units and the MS-DOS
compatible method of handling floating point exceptions.
Make kernel support for teh fpu non-optional (486SX should still work).
Only 386 cpus support external fpu, and i386 support was removed years ago.
This means that the npx code no longer uses port 0xf0 or interupt 13.
All the "npx at isa" lines go from the configs, arch/i386/isa/npx.c
is now mandatory for all i386 kernels.
I've renamed npxinit() to fpuinit() and npxinit_cpu() to fpuinit_cpu()
to match the very similar amd64 functions.
The fpu of the boot cpu is now initialised by a direct call from
cpu_configure(), this enables FP emulation for a 486SX.
(for amd64 the cr0 values are set in locore.S and similar).
This fixes a long-standing bug in linux_setregs() - which did not
save the fpu regsiters if they were active.
I've test booted a single cpu i386 kernel (using anita).
amd64 builds - none of teh changes should affect it.
The i386 XEN kernels build, but I'm not sure where they set cr0, and
it might have got lost!
 1.155 19-Jan-2014  dsl Flatten the floating point register structures bu moving the
'environment' registers into the main strcuture.
There are x87 instructions that only affect the environment, but that
is no real excuse for all the sub-structures.
Rename fields so that there are far fewer collisions between the two
sets of field names.
 1.154 09-Dec-2013  dsl Missing change to the fxsave structure rename
 1.153 01-Dec-2013  christos revert fpu/pcu changes until we figure out what's wrong; they cause random
freezes
 1.152 23-Oct-2013  drochner Use the MI "pcu" framework for bookkeeping of npx/fpu states on x86.
This reduces the amount of MD code enormously, and makes it easier
to implement support for newer CPU features which require more fpu
state, or for fpu usage by the kernel.
For access to FPU state across CPUs, an xcall kthread is used now
rather than a dedicated IPI.
No user visible changes intended.
 1.151 18-Nov-2011  christos branches: 1.151.10; 1.151.14;
- add sigtimedwait support.
- merge the siginfo population code.
 1.150 04-Mar-2011  joerg branches: 1.150.4;
Refactor ps_strings access. Based on PK_32, write either the normal
version or the 32bit compat layout in execve1. Introduce a new function
copyin_psstrings for reading it back from userland and converting it to
the native layout. Refactor procfs to share most of the code with the
kern.proc_args sysctl handler.

This material is based upon work partially supported by
The NetBSD Foundation under a contract with Joerg Sonnenberger.
 1.149 07-Jul-2010  chs branches: 1.149.2; 1.149.4;
many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
- support new-style (NPTL) linux pthreads on all platforms.
clone() with CLONE_THREAD uses 1 process with many LWPs
instead of separate processes.
- move the contents of sys__lwp_setprivate() into a new
lwp_setprivate() and use that everywhere.
- update linux_release[] and linux32_release[] to "2.6.18".
- adjust placement of emul fork/exec/exit hooks as needed
and adjust other emul code to match.
- convert all struct emul definitions to use named initializers.
- change the pid allocator to allow multiple pids to refer to the same proc.
- remove a few fields from struct proc that are no longer needed.
- disable the non-functional "vdso" code in linux32/amd64,
glibc works fine without it.
- fix a race in the futex code where we could miss a wakeup after
a requeue operation.
- redo futex locking to be a little more efficient.
 1.148 03-Feb-2010  wiz branches: 1.148.2; 1.148.4;
Remove extra parenthesis. Found by cppcheck, reported by
Henning Petersen in PR 42732.
 1.147 05-Jan-2010  mbalmer Remove extra semicolon.
 1.146 23-Nov-2009  rmind Use lwp_getpcb() in compat code, clean from struct user.
 1.145 29-May-2009  njoly Add native to linux siginfo si_status translation, used on i386 and
amd64.
 1.144 23-Apr-2009  njoly Convert si_code value from native to linux.
 1.143 21-Mar-2009  ad PR port-i386/40143 Viewing an mpeg transport stream with mplayer causes crash

Fix numerous problems:

1. LDT updates are not atomic.

2. Number of processes running with private LDTs and/or I/O bitmaps
is not capped. System with high maxprocs can be paniced.

3. LDTR can be leaked over context switch.

4. GDT slot allocations can race, giving the same LDT slot to two procs.

5. Incomplete interrupt/trap frames can be stacked.

6. In some rare cases segment faults are not handled correctly.
 1.142 11-Jan-2009  christos branches: 1.142.2;
merge christos-time_t
 1.141 25-Oct-2008  christos branches: 1.141.2; 1.141.4; 1.141.6;
Add preliminary tls support for i386. Does not work yet. From FreeBSD.
 1.140 21-Oct-2008  njoly Do not use native_to_linux_si_code() outside LINUX_NPTL; until i
figure a better way to handle it.
 1.139 19-Oct-2008  njoly Add native to linux siginfo si_code translation, mostly for negative
values. Adjust amd64 and i386 accordingly, not sure about aother archs
i can't test.
 1.138 18-Sep-2008  christos Define a PSL_CLEARSIG macro for the psl flags to be cleared on signal delivery
and use it everywhere.
 1.137 19-May-2008  njoly branches: 1.137.4;
Fix free() argument in linux_read_ldt.
 1.136 28-Apr-2008  martin branches: 1.136.2;
Remove clause 3 and 4 from TNF licenses
 1.135 24-Apr-2008  ad branches: 1.135.2;
Merge proc::p_mutex and proc::p_smutex into a single adaptive mutex, since
we no longer need to guard against access from hardware interrupt handlers.

Additionally, if cloning a process with CLONE_SIGHAND, arrange to have the
child process share the parent's lock so that signal state may be kept in
sync. Partially addresses PR kern/37437.
 1.134 21-Mar-2008  ad branches: 1.134.2;
Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
 1.133 20-Dec-2007  dsl branches: 1.133.6;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.132 08-Dec-2007  dsl branches: 1.132.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.131 04-Dec-2007  dsl Remove all the __P
 1.130 19-Oct-2007  ad branches: 1.130.2; 1.130.4;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.129 30-Jun-2007  dsl branches: 1.129.6; 1.129.8; 1.129.12;
Call fp->f_ops->fo_ioctl() directly (not by sys_ioctl() for LINUX_VT_GETMODE
and LINUX_VT_SETMODE. One fewer use of the stackgap.
 1.128 23-Jun-2007  dsl Read and write the ldt without using the stackgap.
 1.127 13-Jun-2007  christos Get ready for NPTL but don't turn it on as of yet.
 1.126 21-May-2007  christos rename si_sigval -> si_value to match POSIX RTS.
 1.125 10-May-2007  christos - linux uname -m on x86 returns i{3,4,5,6}86 make it so.
- delete the machine sysctl that never worked, and gc linux_machine.
 1.124 16-Apr-2007  ad Share the sysarch stuff between the x86 ports. PR kern/36046.
 1.123 04-Mar-2007  christos branches: 1.123.2; 1.123.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.122 09-Feb-2007  ad branches: 1.122.2;
Merge newlock2 to head.
 1.121 29-Jan-2007  hubertf Remove more duplicate headers.
Patch by Slava Semushin <slava.semushin@gmail.com>

Again, this was tested by comparing obj files from a pristine and a patched
source tree against an i386/ALL kernel, and also for src/sbin/fsck_ffs,
src/sbin/fsdb and src/usr.sbin/makefs. Only changes in assert() line numbers
were detected in 'objdump -d' output.
 1.120 26-Dec-2006  elad Adapt to recent machdep scope changes.

Pointed out by Kouichirou Hiratsuka, thanks!
 1.119 16-Nov-2006  christos branches: 1.119.2;
__unused removal on arguments; approved by core.
 1.118 14-Nov-2006  elad Clean some KAUTH_GENERIC_ISSUSER usage in compat code.
 1.117 14-Oct-2006  christos sprinkle __unused.
 1.116 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.115 13-Sep-2006  christos branches: 1.115.2;
avoid empty if
 1.114 23-Jul-2006  ad branches: 1.114.4;
Use the LWP cached credentials where sane.
 1.113 14-May-2006  elad integrate kauth.
 1.112 11-Dec-2005  christos branches: 1.112.4; 1.112.6; 1.112.8; 1.112.10; 1.112.12;
merge ktrace-lwp.
 1.111 21-Aug-2005  yamt linux_machdepioctl: remove duplicated FILE_USE/UNUSE.
 1.110 25-Jun-2005  christos branches: 1.110.2;
- include <sys/wait.h> so that this compile
- use the code field directly, instead of redoing the logic.
- XXX: the status field must be wrong. I think that the _WSTATUS()
should not be used directly.
 1.109 24-Jun-2005  manu More accurate SIGCHLD code and status for siginfo
 1.108 22-Jun-2005  manu report the right process status
 1.107 20-May-2005  fvdl Define linux_usertrap function, and set it in struct emul. For all
but amd64, it just returns 0, doing nothing.

For amd64, it implements vsyscalls through cheating: if the faulting
address is in the vsyscall area (which is statically known on Linux/amd64),
and the intruction pointer is too, it must have been a vsyscall. In that
case, retrieve the return address from the user stack, fix up %rip and
%rsp, and just execute the normal system call. It will return as if
the vsyscall has been executed.
 1.106 26-Feb-2005  perry branches: 1.106.2;
nuke trailing whitespace
 1.105 13-Nov-2004  christos branches: 1.105.4; 1.105.6;
Remove setup stack function. It moved to linux_exec_machdep.c.
 1.104 13-Nov-2004  christos Add ptyfs pty device number translation.
 1.103 20-Oct-2004  thorpej Move boot device detection code from i386 and amd64 ports to x86_autoconf.c.
Rename i386_alldisks and x86_64_alldisks to x86_alldisks, adjust other
references to compensate.
 1.102 28-Jan-2004  yamt rename i386 mdlwp flags from MDP_ to MDL_
to avoid confusion with mdproc flags which also have MDP_ prefixes.
 1.101 08-Dec-2003  christos remove error(1) comment.
 1.100 06-Oct-2003  christos Catch up with chuck's stack changes. Don't map the linux stuff executable
and avoid mapping segments that have 0 size.
 1.99 25-Sep-2003  christos constify sendsig/trapsignal
 1.98 21-Sep-2003  jdolecek make compile after last change (!)
 1.97 21-Sep-2003  christos Now that we have siginfo, use it, instead of pretending to have one.
 1.96 06-Sep-2003  christos SA_SIGINFO changes
 1.95 24-Aug-2003  chs add support for non-executable mappings (where the hardware allows this)
and make the stack and heap non-executable by default. the changes
fall into two basic catagories:

- pmap and trap-handler changes. these are all MD:
= alpha: we already track per-page execute permission with the (software)
PG_EXEC bit, so just have the trap handler pay attention to it.
= i386: use a new GDT segment for %cs for processes that have no
executable mappings above a certain threshold (currently the
bottom of the stack). track per-page execute permission with
the last unused PTE bit.
= powerpc/ibm4xx: just use the hardware exec bit.
= powerpc/oea: we already track per-page exec bits, but the hardware only
implements non-exec mappings at the segment level. so track the
number of executable mappings in each segment and turn on the no-exec
segment bit iff the count is 0. adjust the trap handler to deal.
= sparc (sun4m): fix our use of the hardware protection bits.
fix the trap handler to recognize text faults.
= sparc64: split the existing unified TSB into data and instruction TSBs,
and only load TTEs into the appropriate TSB(s) for the permissions.
fix the trap handler to check for execute permission.
= not yet implemented: amd64, hppa, sh5

- changes in all the emulations that put a signal trampoline on the stack.
instead, we now put the trampoline into a uvm_aobj and map that into
the process separately.

originally from openbsd, adapted for netbsd by me.
 1.94 21-Aug-2003  hannken Fix syscall_vm86 argument:
struct trapframe -> struct trapframe *
 1.93 09-Aug-2003  christos Explain a diagnostic message a bit better, and make it a debug only message.
 1.92 08-Aug-2003  christos - GC all the setup_stack functions
- add one for linux/i386
 1.91 02-Aug-2003  jdolecek use copyout() instead of subyte()
 1.90 03-Jul-2003  christos Implement linux_rt_sigreturn for real. Add a hack for more plausible siginfo.
The java segv handler still segv's again inside the signal handler, but our
sample test program now works [gets the proper ucontext].
 1.89 29-Jun-2003  fvdl branches: 1.89.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.88 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.87 21-Mar-2003  dsl Change 'data' argument to fo_ioctl and fo_fcntl from 'caddr_t' to 'void *'.
Avoids a lot of casting and removes the need for some line breaks.
Removed a load of (caddr_t) casts from calls to copyin/copyout as well.
(approved by christos - he has a plan to remove caddr_t...)
 1.86 27-Feb-2003  yamt make compat_linux struct file interlock friendly.
 1.85 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.84 06-Dec-2002  junyoung Fix compile error.
 1.83 06-Dec-2002  christos add a linux_rt_sigframe to support SA_SIGINFO, and use it when SA_SIGINFO
is requested. This appears to be how linuxthreads decides which signal handler
to use.
 1.82 26-Nov-2002  christos rename sa_ -> linux_sa_
first attempt at providing siginfo_t to the signal handler.
 1.81 09-Oct-2002  junyoung Get rid of pcb_flags which is no longer existent.
 1.80 25-Sep-2002  thorpej Don't include <sys/map.h>.
 1.79 06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.78 04-Jul-2002  thorpej Add kernel support for having userland provide the signal trampoline:

* struct sigacts gets a new sigact_sigdesc structure, which has the
sigaction and the trampoline/version. Version 0 means "legacy kernel
provided trampoline". Other versions are coordinated with machine-
dependent code in libc.
* sigaction1() grows two more arguments -- the trampoline pointer and
the trampoline version.
* A new __sigaction_sigtramp() system call is provided to register a
trampoline along with a signal handler.
* The handler is no longer passed to sensig() functions. Instead,
sendsig() looks up the handler by peeking in the sigacts for the
process getting the signal (since it has to look in there for the
trampoline anyway).
* Native sendsig() functions now select the appropriate trampoline and
its arguments based on the trampoline version in the sigacts.

Changes to libc to use the new facility will be checked in later. Kernel
version not bumped; we will ride the 1.6C bump made recently.
 1.77 20-May-2002  jdolecek Fix bug introduced in rev. 1.69 - linux_fakedev() returned always
zero for nontranslated raw devices.
This fixes recently discovered jdb /dev/dsp stdin problem, reported
on current-users by Mark Davies.
 1.76 13-May-2002  simonb branches: 1.76.2;
Remove an unreachable "return 0;".
 1.75 02-Apr-2002  christos save/restore fs and gs; this should be pulled up.
 1.74 31-Mar-2002  christos make signal array handling uniform, and put signal arrays in a separate
file. This is simular to errno array handling.
 1.73 29-Mar-2002  christos 1. fill in the ldt.sd_xx field, for total compat with linux.
2. in setregs, use gdt's instead of ldt's because linux wants to play with
all the ldts. Apparently linuxthreads uses ldt's to allocate space for
pthread_t's.
 1.72 22-Mar-2002  christos sync with current reality and fix debugging.
 1.71 16-Mar-2002  christos make the stackgap_{init,alloc} functions MP friendly (i.e. pass struct proc *
in, instead of using curproc). While there add an optional size argument to
stackgap_init.
 1.70 16-Feb-2002  christos 1. load cr2 now that we have it.
2. ldt_info.base_addr == 0 && ldt_info.limit == 0 means zero the ldt
From Robert V. Barron's wabi patch.
 1.69 15-Feb-2002  christos - add a real linux_sys___sysctl because the mib numbers are different.
implement only the kernel version getting entries.
- make the signal conversion functions consistent; dest is arg 1.
- make linux_fakedev deal with block and char devices differently.
- add linux_sys_ugetrlimit, and flesh out the regular get/setrlimit so
that they work properly.
- add linux_mmap2 [untested].
- bump kernel to 2.4.18, and make the date be valentine's day :-)
- linux_sys_*stat64 family was totally busted. Fix it.

tested only on i386.

Status:
gdb, telnet, work
jdk-1.4.0 extractor works, jdk still coredumps.

christos
 1.68 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.67 02-Aug-2001  thorpej Deal with the SSE FPU save format.
 1.66 15-Jul-2001  jdolecek execute signal handlers on separate signal stack, if it's been provided
 1.65 17-Jun-2001  sommerfeld branches: 1.65.2;
Add %fs/%gs to trap frame and save/restore them on
trap/interrupt/syscall entry from userspace.

Remove special-case "by hand" validation of fs/gs register values as
well as special handling of them in various signal handling paths.

Now, like %ds and %es, they are validated by the hardware on return to
userland.

This paves the way for the use of %fs for per-cpu data on
multiprocessor systems, and fixes an otherwise difficult-to-fix
interaction between threads/clone(2) and USER_LDT.

Discussed in advance with Frank van der Linden.
 1.64 14-Jun-2001  thorpej Fix a partial construction problem that can cause race conditions
between creation of a file descriptor and close(2) when using kernel
assisted threads. What we do is stick descriptors in the table, but
mark them as "larval". This causes essentially everything to treat
it as a non-existent descriptor, except for fdalloc(), which sees a
filled slot so that it won't (incorrectly) allocate it again. When
a descriptor is fully constructed, the code that has constructed it
marks it as "mature" (which actually clears the "larval" flag), and
things continue to work as normal.

While here, gather all the code that gets a descriptor from the table
into a fd_getfile() function, and call it, rather than having the
same (sometimes incorrect) code copied all over the place.
 1.63 30-May-2001  mrg use _KERNEL_OPT.
 1.62 26-Jan-2001  manu branches: 1.62.2;
Moved include <sys/ioctl.h> so that we can build without WSCONS enabled.
 1.61 18-Jan-2001  jdolecek constify
 1.60 18-Jan-2001  fvdl EINVAL -> ENOTTY
 1.59 09-Jan-2001  fvdl Add emulation of KIOCSOUND.
 1.58 29-Dec-2000  fvdl Implement KDGETMODE ioctl.
 1.57 29-Dec-2000  fvdl Under Linux it's possible to return values through the ioctl system
call directly (i.e. not a reference argument, but a direct return
value). So far I have only seen this with binaries that talk
to their own device modules, using non-standard ioctl calls.
Hence, allow for a pass-through ioctl call using PTIOCLINUX to
return EJUSTRETURN, signalling that the return value is in
the 'data' field of the structure, which can then be put in 'retval'.
 1.56 22-Dec-2000  jdolecek split off thread specific stuff from struct sigacts to struct sigctx, leaving
only signal handler array sharable between threads
move other random signal stuff from struct proc to struct sigctx

This addresses kern/10981 by Matthew Orgass.
 1.55 18-Dec-2000  fvdl For unknown ioctls, pass them through to a device using PTIOCLINUX,
so that it may deal with them if it knows them (i.e. LKMs which
deal with Linux binaries).
 1.54 12-Dec-2000  fvdl Allow for passing through of certain ranges of ioctl command values
directly to a device. The device has to be aware of how to handle
with these special ioctls. Useful for LKMs that deal with Linux
binaries.
 1.53 10-Dec-2000  thorpej Fix previous:
- EBADF, not NULL when a file descriptor can't be found.
- Check FIF_WANTCLOSE properly.
 1.52 10-Dec-2000  fvdl Add i386-specific code for a few ioctl calls.
 1.51 29-Nov-2000  jdolecek LKMify
 1.50 11-Jun-2000  veego branches: 1.50.2;
Remove the pcvt support.
 1.49 15-May-2000  jhawk branches: 1.49.2;
Remove conditionization upon XSERVER -- all the code
so conditionalized is already conditionalized on (NWSDISPLAY > 0),
so is wscons-specific. wscons has no conditionalization on XSERVER;
neither should the linux compatibility code.

Removing this is necessary to keep linux X server emulation functionining
after GENERIC rev 1.337 removing "options XSERVER" (relegating it
to the pccons/pcvt-specific, and therefore depricated).
 1.48 30-Mar-2000  augustss Kill register declarations.
 1.47 04-Oct-1999  fvdl branches: 1.47.2;
Handle the newer, larger sigset_t Linux now uses.
 1.46 08-Jan-1999  kleink Rearrange the emulation-specific setregs() entry to set up the FPU control
word *after* calling the native setregs(), which would clobber it again.
 1.45 04-Oct-1998  fvdl Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.44 03-Oct-1998  christos Attempt to fix the mess.
 1.43 01-Oct-1998  erh Moved here from arch/i386/i386/linux_machdep.c.
 1.42 11-Sep-1998  mycroft Substantial signal handling changes:
* Increase the size of sigset_t to accomodate 128 signals -- adding new
versions of sys_setprocmask(), sys_sigaction(), sys_sigpending() and
sys_sigsuspend() to handle the changed arguments.
* Abstract the guts of sys_sigaltstack(), sys_setprocmask(), sys_sigaction(),
sys_sigpending() and sys_sigsuspend() into separate functions, and call them
from all the emulations rather than hard-coding everything. (Avoids uses
the stackgap crap for these system calls.)
* Add a new flag (p_checksig) to indicate that a process may have signals
pending and userret() needs to do the full (slow) check.
* Eliminate SAS_ALTSTACK; it's exactly the inverse of SS_DISABLE.
* Correct emulation bugs with restoring SS_ONSTACK.
* Make the signal mask in the sigcontext always use the emulated mask format.
* Store signals internally in sigaction structures, rather than maintaining a
bunch of little sigsets for each SA_* bit.
* Keep track of where we put the signal trampoline, rather than figuring it out
in *_sendsig().
* Issue a warning when a non-emulated sigaction bit is observed.
* Add missing emulated signals, and a native SIGPWR (currently not used).
* Implement the `not reset when caught' semantics for relevant signals.

Note: Only code touched by the i386 port has been modified. Other ports and
emulations need to be updated.
 1.41 11-Jun-1998  drochner Since wscons can support VT_xxx ioctl()s, enable them if NWSDISPLAY > 0.
Implement KDGKBTYPE and KDGKBENT, this will make X servers happy.
 1.40 08-May-1998  kleink Fix some arithmetics lossage on typeless pointers.
 1.39 24-Jan-1998  mycroft Store the initial NPX control word appropriate for the emulation in the saved
FPU state, and use it when initializing the FPU on demand.
 1.38 24-Jan-1998  mycroft Need foo_exec.h.
 1.37 24-Jan-1998  mycroft Add local versions of setregs(), so I can tweak some registers later.
 1.36 22-Jan-1998  thorpej Generate dependencies on the USER_LDT option.
 1.35 15-Jan-1998  thorpej Generate dependencies on the VM86 option.
 1.34 16-Oct-1997  mycroft branches: 1.34.2;
Pull in vmparam.h as necessary.
 1.33 29-Oct-1996  sommerfe branches: 1.33.12;
Workaround for building linux-emulation LKM.
 1.32 13-Oct-1996  christos backout previous kprintf changes
 1.31 12-Oct-1996  thorpej Need <sys/exec.h> for the PS_STRINGS definition.
 1.30 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.29 03-May-1996  christos Prototype and gcc -Wall cleanups
 1.28 18-Apr-1996  mycroft Turn off the alignment check flag when entering a signal handler.
 1.27 12-Apr-1996  mycroft Turn off the trace flag when delivering a signal.
 1.26 11-Apr-1996  mycroft Export [gs]et_vflags(), and always use them when saving/restoring registers
in VM86 mode.
Allow changing of *all* PSL bits in VM86 mode; some applications don't work
right otherwise, and all the nasty bits are virtualized anyway.
Make sure PSL_VIF, PSL_VIP, and PSL_VM don't show up in the user's view of
the PSL.
 1.25 08-Mar-1996  mycroft Add a message to help us debug Linux compat.
 1.24 04-Jan-1996  jtc Changed name of sigaltstack's ss_base field to ss_sp to match XPG4.2 and
traditional usage.
 1.23 10-Oct-1995  mycroft Switch to user code and data selectors in the GDT while handling signals.
 1.22 10-Oct-1995  mycroft Add USERMODE() and KERNELMODE() macros, and use them.
 1.21 08-Oct-1995  fvdl Implement the KDGKBMODE ioctl for Linux (possible with pcvt 3.32).
 1.20 07-Oct-1995  mycroft Prefix names of system call implementation functions with `sys_'.
 1.19 19-Sep-1995  thorpej Make system calls conform to a standard prototype and bring those
prototypes into scope.
 1.18 08-Sep-1995  fvdl Fix PR #1445 (incorrect ifdef/else/endif), from Bill Sommerfeld via
John Kohl.
 1.17 07-Sep-1995  fvdl Get notion of VT number right.
 1.16 01-Sep-1995  mycroft SA_ONSTACK --> SS_ONSTACK
 1.15 31-Aug-1995  fvdl Only define some vars (one of pcvt-specific type) when pcvt is configured.
Fixes PR #1424 (from Mike Long)
 1.14 30-Aug-1995  fvdl Remove VT-switch disabling hack now that pcvt handles this.
 1.13 27-Aug-1995  fvdl Add some yucky code to emulate Linux VTs well enough to make svgalib
stuff work reasonably well.
 1.12 14-Aug-1995  mycroft Export bsd_to_linux_sig[], and use it.
 1.11 14-Aug-1995  mycroft Rearrange #includes.
 1.10 24-Jun-1995  christos Stackgap_init() now takes an p->p_emul argument.
 1.9 22-Jun-1995  fvdl Include file change.
 1.8 07-May-1995  mycroft Turn off a debugging printf().
 1.7 07-May-1995  mycroft Improve Linux signal emulation, and emulate the modify_ldt() call.
 1.6 06-May-1995  mycroft Add stub for linux_modify_ldt().
 1.5 01-May-1995  mycroft Fix typos.
 1.4 01-May-1995  mycroft Save and restore %fs and %gs across signals.
 1.3 01-May-1995  mycroft Update to match include files. Eliminate _ucodesel, _udatasel, and IdlePTD.
 1.2 22-Apr-1995  christos - added sunos_machdep.c for sun3, atari, amiga and mac68k.
- changed machdep.c and trap.c to use struct emul.
- remove ep_setup references.
- added struct emul to all emulations.
 1.1 07-Apr-1995  fvdl Changes because of proper Linux signal stackframe building, and
seperate signal trampoline code. Ugly hack in trap.c no longer
needed.
 1.33.12.1 08-Sep-1997  thorpej Significantly restructure the way signal state for a process is stored.
Rather than using bitmasks to redundantly store the information kept
in the process's sigacts (because the sigacts was kept in the u-area),
hang sigacts directly off the process, and access it directly.

Simplify signal setup code tremendously by storing information in
the sigacts as an array of struct sigactions, rather than in a different
format, since userspace uses sigactions.

Make sigacts sharable by adding reference counting.
 1.34.2.1 29-Jan-1998  mellon Pull up 1.37-1.39 (mycroft)
 1.47.2.6 11-Feb-2001  bouyer Sync with HEAD.
 1.47.2.5 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.47.2.4 05-Jan-2001  bouyer Sync with HEAD
 1.47.2.3 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.47.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.47.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.49.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.50.2.4 03-Apr-2002  he Pull up revision 1.75 (requested by christos):
Fix restoral of %fs / %gs in i386 emulation code.
 1.50.2.3 17-Jun-2001  he Pull up revision 1.65 (requested by sommerfeld):
Add %fs/%gs to trap frame and save/restore them on trap/interupt/
syscall entry from userspace.

Remove special-case ``by hand'' validation of %fs/%gs register
values s well as special handling of them in various signal
handling paths. Now, like %ds and %es, they are validated by
the hardware on return to userland.

This paves the way for the use of %fs for per-cpu data on multi-
processor systems, and fixes an otherwise difficult-to-fix
interaction between threads/clone(2) and USER_LDT.
 1.50.2.2 15-May-2001  he Pull up revision 1.62 (requested by drochner):
Fix a build problem where COMPAT_LINUX is defined, but wscons is
not present. Fixes PR#12886.
 1.50.2.1 30-Mar-2001  he Pull up revisions 1.52-1.60 (via patch, requested by fvdl):
Add some required Linux emulation bits to support the Linux
version of VMware.
 1.62.2.16 11-Dec-2002  thorpej Sync with HEAD.
 1.62.2.15 18-Oct-2002  nathanw Catch up to -current.
 1.62.2.14 17-Sep-2002  nathanw Catch up to -current.
 1.62.2.13 01-Aug-2002  nathanw Catch up to -current.
 1.62.2.12 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.62.2.11 24-Jun-2002  nathanw Curproc->curlwp renaming.

Change uses of "curproc->l_proc" back to "curproc", which is more like the
original use. Bare uses of "curproc" are now "curlwp".

"curproc" is now #defined in proc.h as ((curlwp) ? (curlwp)->l_proc) : NULL)
so that it is always safe to reference curproc (*de*referencing curproc
is another story, but that's always been true).
 1.62.2.10 20-Jun-2002  nathanw Catch up to -current.
 1.62.2.9 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.62.2.8 17-Apr-2002  nathanw Catch up to -current.
 1.62.2.7 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.62.2.6 28-Feb-2002  nathanw p->p_addr ==> l->l_addr
 1.62.2.5 28-Feb-2002  nathanw Catch up to -current.
 1.62.2.4 14-Nov-2001  nathanw Catch up to -current.
 1.62.2.3 24-Aug-2001  nathanw Catch up with -current.
 1.62.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.62.2.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.65.2.6 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.65.2.5 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.65.2.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.65.2.3 16-Mar-2002  jdolecek Catch up with -current.
 1.65.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.65.2.1 03-Aug-2001  lukem update to -current
 1.76.2.3 15-Jul-2002  gehenna catch up with -current.
 1.76.2.2 30-May-2002  gehenna Catch up with -current.
 1.76.2.1 16-May-2002  gehenna Replace the direct-access to devsw table with calling devsw API.
Replace the block major -> name conversion function with devsw API.
 1.89.2.8 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.89.2.7 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.89.2.6 14-Nov-2004  skrll Sync with HEAD.
 1.89.2.5 02-Nov-2004  skrll Sync with HEAD.
 1.89.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.89.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.89.2.2 03-Aug-2004  skrll Sync with HEAD
 1.89.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.105.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.105.4.1 29-Apr-2005  kent sync with -current
 1.106.2.1 28-Aug-2005  tron Pull up following revision(s) (requested by yamt in ticket #701):
sys/compat/linux/arch/i386/linux_machdep.c: revision 1.111
linux_machdepioctl: remove duplicated FILE_USE/UNUSE.
 1.110.2.8 24-Mar-2008  yamt sync with head.
 1.110.2.7 21-Jan-2008  yamt sync with head
 1.110.2.6 07-Dec-2007  yamt sync with head
 1.110.2.5 27-Oct-2007  yamt sync with head.
 1.110.2.4 03-Sep-2007  yamt sync with head.
 1.110.2.3 26-Feb-2007  yamt sync with head.
 1.110.2.2 30-Dec-2006  yamt sync with head.
 1.110.2.1 21-Jun-2006  yamt sync with head.
 1.112.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.112.10.3 06-May-2006  christos - Move kauth_cred_t declaration to <sys/types.h>
- Cleanup struct ucred; forward declarations that are unused.
- Don't include <sys/kauth.h> in any header, but include it in the c files
that need it.

Approved by core.
 1.112.10.2 10-Mar-2006  elad generic_authorize() -> kauth_authorize_generic().
 1.112.10.1 08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.112.8.3 14-Sep-2006  yamt sync with head.
 1.112.8.2 11-Aug-2006  yamt sync with head
 1.112.8.1 24-May-2006  yamt sync with head.
 1.112.6.1 01-Jun-2006  kardel Sync with head.
 1.112.4.1 09-Sep-2006  rpaulo sync with head
 1.114.4.7 01-Feb-2007  ad Sync with head.
 1.114.4.6 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.114.4.5 19-Jan-2007  ad Fix Linux compatability for i386, others to follow later.
 1.114.4.4 18-Jan-2007  yamt linux_restore_sigcontext: fix an unused variable in the case of !VM86.
 1.114.4.3 12-Jan-2007  ad Sync with head.
 1.114.4.2 18-Nov-2006  ad Sync with head.
 1.114.4.1 24-Oct-2006  ad - Redo LWP locking slightly and fix some races.
- Fix some locking botches.
- Make signal mask / stack per-proc for SA processes.
- Add _lwp_kill().
 1.115.2.2 10-Dec-2006  yamt sync with head.
 1.115.2.1 22-Oct-2006  yamt sync with head
 1.119.2.1 06-Jan-2007  bouyer Pull up following revision(s) (requested by elad in ticket #317):
sys/compat/linux/arch/i386/linux_machdep.c: revision 1.120
sys/dev/wscons/wsdisplay_compat_usl.c: revision 1.38
Adapt to recent machdep scope changes.
Pointed out by Kouichirou Hiratsuka, thanks!
 1.122.2.3 17-May-2007  yamt sync with head.
 1.122.2.2 07-May-2007  yamt sync with head.
 1.122.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.123.4.1 11-Jul-2007  mjf Sync with head.
 1.123.2.3 23-Oct-2007  ad Sync with head.
 1.123.2.2 15-Jul-2007  ad Sync with head.
 1.123.2.1 27-May-2007  ad Sync with head.
 1.129.12.1 25-Oct-2007  bouyer Sync with HEAD.
 1.129.8.2 09-Jan-2008  matt sync with HEAD
 1.129.8.1 06-Nov-2007  matt sync with HEAD
 1.129.6.2 09-Dec-2007  jmcneill Sync with HEAD.
 1.129.6.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.130.4.2 26-Dec-2007  ad Sync with head.
 1.130.4.1 08-Dec-2007  ad Sync with head.
 1.130.2.2 27-Dec-2007  mjf Sync with HEAD.
 1.130.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.132.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.133.6.4 17-Jan-2009  mjf Sync with HEAD.
 1.133.6.3 28-Sep-2008  mjf Sync with HEAD.
 1.133.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.133.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.134.2.2 04-Jun-2008  yamt sync with head
 1.134.2.1 18-May-2008  yamt sync with head.
 1.135.2.5 11-Aug-2010  yamt sync with head.
 1.135.2.4 11-Mar-2010  yamt sync with head
 1.135.2.3 20-Jun-2009  yamt sync with head
 1.135.2.2 04-May-2009  yamt sync with head.
 1.135.2.1 16-May-2008  yamt sync with head.
 1.136.2.5 24-Sep-2008  wrstuden Merge in changes between wrstuden-revivesa-base-2 and
wrstuden-revivesa-base-3.
 1.136.2.4 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.136.2.3 14-May-2008  wrstuden Per discussion with ad at n dot o, revert signal mask handling
changes.

The l_sigstk changes are most likely totally un-needed as SA will
never use a signal stack - we send an upcall (or will as other
diffs are brought in).

The l_sigmask changes were too controvertial. In all honesty, I
think it's probably best to revert them. The main reason they were
there is the fact that in an SA process, we don't mask signals per
kernel thread, we mask them per user thread. In the kernel, we want
them all to get turned into upcalls. Thus the normal state of
l_sigmask in an SA process is for it to always be empty.

While we are in the process of delivering a signal, we want to
temporarily mask a signal (so we don't recursively exhaust our
upcall stacks). However signal delivery is rare (important, but
rare), and delivering back-to-back signals is even rarer. So rather
than cause every user of a signal mask to be prepared for this very
rare case, we will just add a second check later in the signal
delivery code. Said change is not in this diff.

This also un-compensates all of our compatability code for dealing
with SA. SA is a NetBSD-specific thing, so there's no need for
Irix, Linux, Solaris, SVR4 and so on to cope with it.

As previously, everything other than kern_sa.c compiles in i386
GENERIC as of this checkin. I will switch to ALL soon for compile
testing.
 1.136.2.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.136.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.137.4.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.137.4.1 19-Oct-2008  haad Sync with HEAD.
 1.141.6.2 09-Nov-2008  christos account for major and minor being unsigned long long
 1.141.6.1 25-Oct-2008  christos file linux_machdep.c was added on branch christos-time_t on 2008-11-09 02:05:20 +0000
 1.141.4.1 04-Apr-2009  snj Pull up following revision(s) (requested by ad in ticket #656):
sys/arch/amd64/amd64/gdt.c: revision 1.21 via patch
sys/arch/amd64/amd64/machdep.c: revision 1.129 via patch
sys/arch/i386/i386/gdt.c: revision 1.47 via patch
sys/arch/i386/i386/kvm86.c: revision 1.17 via patch
sys/arch/i386/i386/locore.S: revision 1.85 via patch
sys/arch/i386/i386/machdep.c: revision 1.666 via patch
sys/arch/i386/i386/vector.S: revision 1.45 via patch
sys/arch/i386/include/pcb.h: revision 1.47 via patch
sys/arch/x86/include/pmap.h: revision 1.22 via patch
sys/arch/x86/include/sysarch.h: revision 1.8 via patch
sys/arch/x86/x86/pmap.c: revision 1.80 via patch
sys/arch/x86/x86/sys_machdep.c: revision 1.17 via patch
sys/compat/linux/arch/i386/linux_machdep.c: revision 1.143 via patch
sys/kern/init_main.c: revision 1.384 via patch
PR port-i386/40143 Viewing an mpeg transport stream with mplayer causes crash
Fix numerous problems:
1. LDT updates are not atomic.
2. Number of processes running with private LDTs and/or I/O bitmaps
is not capped. System with high maxprocs can be paniced.
3. LDTR can be leaked over context switch.
4. GDT slot allocations can race, giving the same LDT slot to two procs.
5. Incomplete interrupt/trap frames can be stacked.
6. In some rare cases segment faults are not handled correctly.
 1.141.2.2 28-Apr-2009  skrll Sync with HEAD.
 1.141.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.142.2.2 23-Jul-2009  jym Sync with HEAD.
 1.142.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.148.4.1 05-Mar-2011  rmind sync with head
 1.148.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.149.4.1 05-Mar-2011  bouyer Sync with HEAD
 1.149.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.150.4.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.150.4.1 17-Apr-2012  yamt sync with head
 1.151.14.1 18-May-2014  rmind sync with head
 1.151.10.2 03-Dec-2017  jdolecek update from HEAD
 1.151.10.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.158.4.1 17-Jan-2015  martin Pull up following revision(s) (requested by maxv in ticket #427):
sys/compat/svr4/svr4_schedctl.c: revision 1.8
sys/netinet/tcp_timer.c: revision 1.88
sys/miscfs/genfs/layer_vfsops.c: revision 1.45
sys/compat/svr4/svr4_ioctl.c: revision 1.37
sys/ufs/chfs/chfs_vfsops.c: revision 1.14
sys/miscfs/fdesc/fdesc_vfsops.c: revision 1.91
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.30
sys/compat/common/kern_time_50.c: revision 1.28
sys/netinet6/ip6_forward.c: revision 1.74
sys/miscfs/umapfs/umap_vnops.c: revision 1.57
sys/compat/svr4/svr4_fcntl.c: revision 1.74
distrib/sets/lists/comp/mi: revision 1.1931
sys/netinet6/udp6_output.c: revision 1.46
sys/fs/puffs/puffs_compat.c: revision 1.3
sys/fs/udf/udf_rename.c: revision 1.11
sys/compat/svr4/svr4_filio.c: revision 1.24
sys/fs/udf/udf_rename.c: revision 1.12
sys/netinet/tcp_usrreq.c: revision 1.202
sys/miscfs/umapfs/umap_subr.c: revision 1.29
sys/compat/linux/common/linux_fadvise64.c: revision 1.3
sys/netinet/if_atm.c: revision 1.34
sys/miscfs/procfs/procfs_subr.c: revision 1.106
sys/miscfs/genfs/layer_subr.c: revision 1.37
sys/netinet/tcp_sack.c: revision 1.30
sys/compat/freebsd/freebsd_misc.c: revision 1.33
sys/compat/freebsd/freebsd_file.c: revision 1.33
sys/ufs/chfs/chfs_vnode.c: revision 1.12
sys/compat/svr4/svr4_ttold.c: revision 1.34
sys/compat/linux/common/linux_file.c: revision 1.114
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.43
sys/compat/linux/common/linux_signal.c: revision 1.76
sys/compat/common/compat_util.c: revision 1.46
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.18
sys/compat/svr4/svr4_sockio.c: revision 1.36
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.32
sys/compat/svr4/svr4_signal.c: revision 1.66
sys/kern/kern_exec.c: revision 1.410
sys/fs/puffs/puffs_vfsops.c: revision 1.115
sys/compat/svr4/svr4_exec_elf64.c: revision 1.15
sys/compat/linux/arch/i386/linux_machdep.c: revision 1.159
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.50
sys/compat/linux32/common/linux32_misc.c: revision 1.24
sys/netinet/in_pcb.c: revision 1.153
sys/sys/malloc.h: revision 1.116
sys/compat/common/if_43.c: revision 1.9
share/man/man9/Makefile: revision 1.380
sys/netinet/tcp_vtw.c: revision 1.12
sys/miscfs/umapfs/umap_vfsops.c: revision 1.95
sys/ufs/ext2fs/ext2fs_vfsops.c: revision 1.186
sys/compat/common/uipc_syscalls_43.c: revision 1.46
sys/ufs/ext2fs/ext2fs_vnops.c: revision 1.115
sys/fs/puffs/puffs_msgif.c: revision 1.97
sys/compat/svr4/svr4_ipc.c: revision 1.27
sys/compat/linux/common/linux_exec.c: revision 1.117
sys/ufs/ext2fs/ext2fs_readwrite.c: revision 1.66
sys/netinet/tcp_output.c: revision 1.179
sys/compat/svr4/svr4_termios.c: revision 1.28
sys/fs/udf/udf_strat_bootstrap.c: revision 1.4
sys/fs/puffs/puffs_subr.c: revision 1.67
sys/fs/puffs/puffs_node.c: revision 1.36
sys/miscfs/overlay/overlay_vnops.c: revision 1.21
sys/fs/cd9660/cd9660_node.c: revision 1.34
sys/netinet/raw_ip.c: revision 1.146
sys/sys/mallocvar.h: revision 1.13
sys/miscfs/overlay/overlay_vfsops.c: revision 1.63
share/man/man9/malloc.9: revision 1.50
sys/netinet6/dest6.c: revision 1.18
sys/compat/linux/common/linux_uselib.c: revision 1.33
sys/compat/linux/common/linux_socket.c: revision 1.120
share/man/man9/malloc.9: revision 1.51
sys/netinet/tcp_subr.c: revision 1.257
sys/compat/linux/common/linux_socketcall.c: revision 1.45
sys/compat/linux/common/linux_fadvise64_64.c: revision 1.3
sys/compat/freebsd/freebsd_ipc.c: revision 1.17
sys/compat/linux/common/linux_misc_notalpha.c: revision 1.109
sys/compat/linux/arch/alpha/linux_pipe.c: revision 1.17
sys/netinet6/in6_pcb.c: revision 1.132
sys/netinet6/in6_ifattach.c: revision 1.94
sys/compat/svr4/svr4_exec_elf32.c: revision 1.15
sys/miscfs/nullfs/null_vfsops.c: revision 1.90
sys/fs/cd9660/cd9660_util.c: revision 1.12
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.48
sys/compat/freebsd/freebsd_exec_elf32.c: revision 1.20
sys/miscfs/procfs/procfs_vfsops.c: revision 1.94
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.28
sys/compat/linux/common/linux_sched.c: revision 1.67
sys/compat/linux/common/linux_exec_aout.c: revision 1.67
sys/compat/linux/common/linux_pipe.c: revision 1.67
sys/compat/linux/common/linux_llseek.c: revision 1.34
sys/compat/linux/arch/mips/linux_ptrace.c: revision 1.10
Do not uselessly include <sys/malloc.h>.
Cleanup:
- remove struct kmembuckets (dead)
- correctly deadify MALLOC_XX
- remove MALLOC_DEFINE_LIMIT and MALLOC_JUSTDEFINE_LIMIT (dead)
- remove malloc_roundup(), malloc_type_setlimit(), MALLOC_DEFINE_LIMIT()
and MALLOC_JUSTDEFINE_LIMIT() from man 9 malloc
New sentence, new line. Bump date for previous.
Obsolete malloc_roundup(9), malloc_type_setlimit(9) and MALLOC_DEFINE_LIMIT(9)
man pages.
 1.159.2.3 28-Aug-2017  skrll Sync with HEAD
 1.159.2.2 05-Oct-2016  skrll Sync with HEAD
 1.159.2.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.162.4.1 21-Apr-2017  bouyer Sync with HEAD
 1.162.2.2 20-Mar-2017  pgoyette Sync with HEAD
 1.162.2.1 20-Jul-2016  pgoyette Adapt machine-independant code to the new {b,c}devsw reference-counting
(using localcount(9)). All callers of {b,c}devsw_lookup() now call
{b,c}devsw_lookup_acquire() which retains a reference on the 'struct
{b,c}devsw'. This reference must be released by the caller once it is
finished with the structure's content (or other data that would disappear
if the 'struct {b,c}devsw' were to disappear).
 1.163.6.1 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1836):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.163.4.1 27-Apr-2017  pgoyette Restore all work from the former pgoyette-localcount branch (which is
now abandoned doe to cvs merge botch).

The branch now builds, and installs via anita. There are still some
problems (cgd is non-functional and all atf tests time-out) but they
will get resolved soon.
 1.165.4.1 10-Jun-2019  christos Sync with HEAD
 1.166.2.1 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.37 07-Jul-2010  chs many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
- support new-style (NPTL) linux pthreads on all platforms.
clone() with CLONE_THREAD uses 1 process with many LWPs
instead of separate processes.
- move the contents of sys__lwp_setprivate() into a new
lwp_setprivate() and use that everywhere.
- update linux_release[] and linux32_release[] to "2.6.18".
- adjust placement of emul fork/exec/exit hooks as needed
and adjust other emul code to match.
- convert all struct emul definitions to use named initializers.
- change the pid allocator to allow multiple pids to refer to the same proc.
- remove a few fields from struct proc that are no longer needed.
- disable the non-functional "vdso" code in linux32/amd64,
glibc works fine without it.
- fix a race in the futex code where we could miss a wakeup after
a requeue operation.
- redo futex locking to be a little more efficient.
 1.36 12-Nov-2008  ad branches: 1.36.6; 1.36.8;
Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.
 1.35 26-Oct-2008  christos branches: 1.35.2;
use a symbolic constant instead of 6.
 1.34 25-Oct-2008  christos Add preliminary tls support for i386. Does not work yet. From FreeBSD.
 1.33 28-Apr-2008  martin branches: 1.33.6;
Remove clause 3 and 4 from TNF licenses
 1.32 13-Jun-2007  christos branches: 1.32.28; 1.32.30; 1.32.32;
Get ready for NPTL but don't turn it on as of yet.
 1.31 13-Jun-2007  christos cleanup some bitrot; from Matthew Orgass
 1.30 10-May-2007  christos - linux uname -m on x86 returns i{3,4,5,6}86 make it so.
- delete the machine sysctl that never worked, and gc linux_machine.
 1.29 11-Dec-2005  christos branches: 1.29.26; 1.29.30; 1.29.32;
merge ktrace-lwp.
 1.28 13-Nov-2004  christos branches: 1.28.12;
Add ptyfs pty device number translation.
 1.27 06-Sep-2003  christos SA_SIGINFO changes
 1.26 03-Jul-2003  christos Implement linux_rt_sigreturn for real. Add a hack for more plausible siginfo.
The java segv handler still segv's again inside the signal handler, but our
sample test program now works [gets the proper ucontext].
 1.25 06-Dec-2002  christos branches: 1.25.6;
add a linux_rt_sigframe to support SA_SIGINFO, and use it when SA_SIGINFO
is requested. This appears to be how linuxthreads decides which signal handler
to use.
 1.24 26-Nov-2002  christos rename sa_ -> linux_sa_
first attempt at providing siginfo_t to the signal handler.
 1.23 06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.22 04-Jul-2002  thorpej Add kernel support for having userland provide the signal trampoline:

* struct sigacts gets a new sigact_sigdesc structure, which has the
sigaction and the trampoline/version. Version 0 means "legacy kernel
provided trampoline". Other versions are coordinated with machine-
dependent code in libc.
* sigaction1() grows two more arguments -- the trampoline pointer and
the trampoline version.
* A new __sigaction_sigtramp() system call is provided to register a
trampoline along with a signal handler.
* The handler is no longer passed to sensig() functions. Instead,
sendsig() looks up the handler by peeking in the sigacts for the
process getting the signal (since it has to look in there for the
trampoline anyway).
* Native sendsig() functions now select the appropriate trampoline and
its arguments based on the trampoline version in the sigacts.

Changes to libc to use the new facility will be checked in later. Kernel
version not bumped; we will ride the 1.6C bump made recently.
 1.21 15-Feb-2002  christos branches: 1.21.8;
- add a real linux_sys___sysctl because the mib numbers are different.
implement only the kernel version getting entries.
- make the signal conversion functions consistent; dest is arg 1.
- make linux_fakedev deal with block and char devices differently.
- add linux_sys_ugetrlimit, and flesh out the regular get/setrlimit so
that they work properly.
- add linux_mmap2 [untested].
- bump kernel to 2.4.18, and make the date be valentine's day :-)
- linux_sys_*stat64 family was totally busted. Fix it.

tested only on i386.

Status:
gdb, telnet, work
jdk-1.4.0 extractor works, jdk still coredumps.

christos
 1.20 09-Jan-2001  fvdl branches: 1.20.2; 1.20.4;
Add emulation of KIOCSOUND.
 1.19 29-Dec-2000  fvdl Implement KDGETMODE ioctl.
 1.18 14-Dec-2000  mycroft Some namespace hiding I forgot before.
 1.17 12-Dec-2000  fvdl Allow for passing through of certain ranges of ioctl command values
directly to a device. The device has to be aware of how to handle
with these special ioctls. Useful for LKMs that deal with Linux
binaries.
 1.16 11-Dec-2000  mycroft Introduce 2 new flags in types.h:
* __HAVE_SYSCALL_INTERN. If this is defined, e_syscall is replaced by
e_syscall_intern, which is called at key places in the kernel. This can be
used to set a MD syscall handler pointer. This obsoletes and replaces the
*_HAS_SEPARATED_SYSCALL flags.
* __HAVE_MINIMAL_EMUL. If this is defined, certain (deprecated) elements in
struct emul are omitted.
 1.15 10-Dec-2000  fvdl Add i386-specific code for a few ioctl calls.
 1.14 09-Dec-2000  christos how many different prototypes does linux_syscall() need finally? sheesh!
 1.13 02-Dec-2000  jdolecek if machdep define LINUX_MACHDEP_HAS_SEPARATED_SYSCALL is defined, put
linux_syscall() to emul_linux
define LINUX_MACHDEP_HAS_SEPARATED_SYSCALL for i386
 1.12 11-Jun-2000  veego branches: 1.12.2;
Fix a comment.
 1.11 11-Jun-2000  veego Remove the pcvt support.
 1.10 04-Oct-1999  fvdl branches: 1.10.2; 1.10.10;
Handle the newer, larger sigset_t Linux now uses.
 1.9 04-Oct-1998  fvdl Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.8 01-Oct-1998  erh Moved here from arch/i386/include/linux_machdep.h.
 1.7 11-Sep-1998  mycroft Substantial signal handling changes:
* Increase the size of sigset_t to accomodate 128 signals -- adding new
versions of sys_setprocmask(), sys_sigaction(), sys_sigpending() and
sys_sigsuspend() to handle the changed arguments.
* Abstract the guts of sys_sigaltstack(), sys_setprocmask(), sys_sigaction(),
sys_sigpending() and sys_sigsuspend() into separate functions, and call them
from all the emulations rather than hard-coding everything. (Avoids uses
the stackgap crap for these system calls.)
* Add a new flag (p_checksig) to indicate that a process may have signals
pending and userret() needs to do the full (slow) check.
* Eliminate SAS_ALTSTACK; it's exactly the inverse of SS_DISABLE.
* Correct emulation bugs with restoring SS_ONSTACK.
* Make the signal mask in the sigcontext always use the emulated mask format.
* Store signals internally in sigaction structures, rather than maintaining a
bunch of little sigsets for each SA_* bit.
* Keep track of where we put the signal trampoline, rather than figuring it out
in *_sendsig().
* Issue a warning when a non-emulated sigaction bit is observed.
* Add missing emulated signals, and a native SIGPWR (currently not used).
* Implement the `not reset when caught' semantics for relevant signals.

Note: Only code touched by the i386 port has been modified. Other ports and
emulations need to be updated.
 1.6 11-Jun-1998  drochner Since wscons can support VT_xxx ioctl()s, enable them if NWSDISPLAY > 0.
Implement KDGKBTYPE and KDGKBENT, this will make X servers happy.
 1.5 03-May-1996  christos Add missing prototypes.
 1.4 27-Aug-1995  fvdl A couple of definitions added for previous changes.
 1.3 07-May-1995  mycroft Improve Linux signal emulation, and emulate the modify_ldt() call.
 1.2 22-Apr-1995  christos - added sunos_machdep.c for sun3, atari, amiga and mac68k.
- changed machdep.c and trap.c to use struct emul.
- remove ep_setup references.
- added struct emul to all emulations.
 1.1 07-Apr-1995  fvdl Arch dependant defs for Linux. Just signal stackframe definition for now.
 1.10.10.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.10.2.5 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.10.2.4 05-Jan-2001  bouyer Sync with HEAD
 1.10.2.3 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.10.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.10.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.12.2.1 30-Mar-2001  he Pull up revision 1.14-1.20 (via patch, requested by fvdl):
Add some required Linux emulation bits to support the Linux
version of VMware.
 1.20.4.3 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.20.4.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.20.4.1 16-Mar-2002  jdolecek Catch up with -current.
 1.20.2.4 11-Dec-2002  thorpej Sync with HEAD.
 1.20.2.3 17-Sep-2002  nathanw Catch up to -current.
 1.20.2.2 01-Aug-2002  nathanw Catch up to -current.
 1.20.2.1 28-Feb-2002  nathanw Catch up to -current.
 1.21.8.2 15-Jul-2002  gehenna catch up with -current.
 1.21.8.1 16-May-2002  gehenna Remove a hard-coded device major.
 1.25.6.4 14-Nov-2004  skrll Sync with HEAD.
 1.25.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.25.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.25.6.1 03-Aug-2004  skrll Sync with HEAD
 1.28.12.1 03-Sep-2007  yamt sync with head.
 1.29.32.1 11-Jul-2007  mjf Sync with head.
 1.29.30.2 15-Jul-2007  ad Sync with head.
 1.29.30.1 27-May-2007  ad Sync with head.
 1.29.26.1 17-May-2007  yamt sync with head.
 1.32.32.3 11-Aug-2010  yamt sync with head.
 1.32.32.2 04-May-2009  yamt sync with head.
 1.32.32.1 16-May-2008  yamt sync with head.
 1.32.30.1 18-May-2008  yamt sync with head.
 1.32.28.2 17-Jan-2009  mjf Sync with HEAD.
 1.32.28.1 02-Jun-2008  mjf Sync with HEAD.
 1.33.6.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.35.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.36.8.1 05-Mar-2011  rmind sync with head
 1.36.6.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.7 14-Mar-2015  njoly Support Linux MAP_LOCKED mmap flag.
 1.6 28-Apr-2008  martin branches: 1.6.44; 1.6.64;
Remove clause 3 and 4 from TNF licenses
 1.5 11-Dec-2005  christos branches: 1.5.70; 1.5.72; 1.5.74;
merge ktrace-lwp.
 1.4 28-Aug-2004  jdolecek g/c LINUX_MAP_IGNMASK define - it's not used anywhere
 1.3 04-Oct-1998  fvdl branches: 1.3.46;
Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.2 01-Oct-1998  erh Split compat/linux/linux_mmap.h into i386 and common parts.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.3.46.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.46.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.46.1 03-Sep-2004  skrll Sync with HEAD
 1.5.74.1 16-May-2008  yamt sync with head.
 1.5.72.1 18-May-2008  yamt sync with head.
 1.5.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.6.64.1 06-Apr-2015  skrll Sync with HEAD
 1.6.44.1 03-Dec-2017  jdolecek update from HEAD
 1.36 05-Sep-2022  tsutsui G/C ISSET() macro copies. It has been defined in <sys/types.h> since 2006.
 1.35 07-Sep-2021  riastradh sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.34 23-May-2020  ad Move proc_lock into the data segment. It was dynamically allocated because
at the time we had mutex_obj_alloc() but not __cacheline_aligned.
 1.33 03-Sep-2018  riastradh branches: 1.33.4;
Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.32 28-Aug-2017  kamil branches: 1.32.2; 1.32.4;
Remove the filesystem tracing feature

This is a legacy interface from 4.4BSD, and it was
introduced to overcome shortcomings of ptrace(2) at that time, which are
no longer relevant (performance). Today /proc/#/ctl offers a narrow
subset of ptrace(2) commands and is not applicable for modern
applications use beyond simplistic tracing scenarios.

This removal will simplify kernel internals. Users will still be able to
use all the other /proc files.

This change won't affect other procfs files neither Linux compat
features within mount_procfs(8). /proc/#/ctl isn't available on Linux.

Remove:
- /proc/#/ctl from mount_procfs(8)
- P_FSTRACE note from the documentation of ps(1)
- /proc/#/ctl and filesystem tracing documentation from mount_procfs(8)
- KAUTH_REQ_PROCESS_PROCFS_CTL documentation from kauth(9)
- source code file miscfs/procfs/procfs_ctl.c
- PFSctl and procfs_doctl() from sys/miscfs/procfs/procfs.h
- KAUTH_REQ_PROCESS_PROCFS_CTL from sys/sys/kauth.h
- PSL_FSTRACE (0x00010000) from sys/sys/proc.h
- P_FSTRACE (0x00010000) from sys/sys/sysctl.h

Reduce code complexity after removal of this functionality.

Update TODO.ptrace accordingly: remove two entries about /proc tracing.

Do not keep legacy notes as comments in the headers about removed
PSL_FSTRACE / P_FSTRACE, as this interface had little number of users
(close or equal to zero).

Proposed on tech-kern@.

All filesystem tracing utility users are encouraged to switch to ptrace(2).

Sponsored by <The NetBSD Foundation>
 1.31 13-Oct-2015  pgoyette branches: 1.31.10;
Don't release proc_lock until we're done looking at things that are
protected by the lock, particularly p_stat and p_waited. Found by
Robert Elz.

XXX Pullup to NetBSD-7, -6, -6-0, and -6-1
 1.30 09-Nov-2014  maxv branches: 1.30.2;
Do not uselessly include <sys/malloc.h>.
 1.29 21-Sep-2014  christos fix leak
 1.28 15-Apr-2014  maxv branches: 1.28.2;
There are two times the same branches.

} else if (addr == LUSR_OFF(__signal)) {
error = ENOTSUP;
} else if (addr == LUSR_OFF(__signal)) {
error = ENOTSUP;
}

Just delete one of them. Spotted by my code scanner.

ok christos@
 1.27 04-Jan-2014  dsl branches: 1.27.2;
Remove __HAVE_PROCESS_XFPREGS and add the extra parameter for the size
of the fp save area to all the process_read_fpregs() and
process_write_fpregs() functions.
None of the functions have been modified to use the new parameters.
The size is set for all the writes, but some of the arch-specific reads
just pass NULL.
The amd64 (and i386) need variable sized fp register save areas in order
to support AVX and other enhanced register areas.
These functions are rarely called - so the extra argument won't matter.
 1.26 07-Jul-2010  chs branches: 1.26.8; 1.26.14; 1.26.18; 1.26.20; 1.26.22; 1.26.28;
many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
- support new-style (NPTL) linux pthreads on all platforms.
clone() with CLONE_THREAD uses 1 process with many LWPs
instead of separate processes.
- move the contents of sys__lwp_setprivate() into a new
lwp_setprivate() and use that everywhere.
- update linux_release[] and linux32_release[] to "2.6.18".
- adjust placement of emul fork/exec/exit hooks as needed
and adjust other emul code to match.
- convert all struct emul definitions to use named initializers.
- change the pid allocator to allow multiple pids to refer to the same proc.
- remove a few fields from struct proc that are no longer needed.
- disable the non-functional "vdso" code in linux32/amd64,
glibc works fine without it.
- fix a race in the futex code where we could miss a wakeup after
a requeue operation.
- redo futex locking to be a little more efficient.
 1.25 01-Jul-2010  rmind Remove pfind() and pgfind(), fix locking in various broken uses of these.
Rename real routines to proc_find() and pgrp_find(), remove PFIND_* flags
and have consistent behaviour. Provide proc_find_raw() for special cases.
Fix memory leak in sysctl_proc_corename().

COMPAT_LINUX: rework ptrace() locking, minimise differences between
different versions per-arch.

Note: while this change adds some formal cosmetics for COMPAT_DARWIN and
COMPAT_IRIX - locking there is utterly broken (for ages).

Fixes PR/43176.
 1.24 21-Oct-2009  rmind branches: 1.24.2; 1.24.4;
Remove uarea swap-out functionality:

- Addresses the issue described in PR/38828.
- Some simplification in threading and sleepq subsystems.
- Eliminates pmap_collect() and, as a side note, allows pmap optimisations.
- Eliminates XS_CTL_DATA_ONSTACK in scsipi code.
- Avoids few scans on LWP list and thus potentially long holds of proc_lock.
- Cuts ~1.5k lines of code. Reduces amd64 kernel size by ~4k.
- Removes __SWAP_BROKEN cases.

Tested on x86, mips, acorn32 (thanks <mpumford>) and partly tested on
acorn26 (thanks to <bjh21>).

Discussed on <tech-kern>, reviewed by <ad>.
 1.23 17-Dec-2008  cegger kill MALLOC and FREE macros.
 1.22 28-Apr-2008  martin branches: 1.22.2; 1.22.8;
Remove clause 3 and 4 from TNF licenses
 1.21 23-Apr-2008  ad branches: 1.21.2;
Disable bitrotted linux ptrace interfaces, which are likely now a
security hole. Can be re-enabled at runtime. If you want to repair
them please look at the native implementation.
 1.20 20-Dec-2007  dsl branches: 1.20.6; 1.20.8;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.19 08-Dec-2007  dsl branches: 1.19.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.18 09-Jul-2007  ad branches: 1.18.6; 1.18.8; 1.18.16;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.17 04-Mar-2007  christos branches: 1.17.2; 1.17.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.16 09-Feb-2007  ad branches: 1.16.2;
Merge newlock2 to head.
 1.15 01-Sep-2006  matt branches: 1.15.2;
When calling PTRACE from an LKM, use sysent[SYS_ptrace].sy_call in case
the sys_ptrace symbol isn't present.
 1.14 30-Aug-2006  matt Update to deal with options PTRACE
 1.13 11-Dec-2005  christos branches: 1.13.4; 1.13.8;
merge ktrace-lwp.
 1.12 26-Feb-2005  perry branches: 1.12.4;
nuke trailing whitespace
 1.11 18-Jan-2003  thorpej branches: 1.11.2; 1.11.10; 1.11.12;
Merge the nathanw_sa branch.
 1.10 08-Dec-2002  junyoung - Rename struct linux_ctx to linux_fpctx.
- KNF.
 1.9 06-Dec-2002  tron Fix namespace collision caused by recent change to "linux_machdep.h".
 1.8 15-Nov-2001  lukem don't need <sys/types.h> when including <sys/param.h>
 1.7 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.6 15-May-2001  lukem branches: 1.6.2;
delint: fix comments
 1.5 21-Nov-2000  jdolecek branches: 1.5.2;
implement PTRACE_{GET|SET}FPREGS and framework for PTRACE_{PEEK|POKE}USER

this makes it possible to attach to linux process with linux gdb and
see top-most function on traceback; lower functions are not available,
probably due to bad frame setup
it's not possible to setup breakpoints - Linux gdb uses hw breakpoints,
so support for them would need to be written
 1.4 01-Nov-2000  jdolecek branches: 1.4.2;
move definition of LINUX_PTRACE_{SET|GET}(FP)REGS flags to
sys/compat/linux/common/linux_ptrace.h, they seem to be actually MI
 1.3 16-Dec-1999  tron branches: 1.3.2;
Add support for reading and writing non FPU register with ptrace(2).
 1.2 12-Dec-1999  tron Support a few more request types in ptrace(2) emulation.
 1.1 12-Dec-1999  tron Incomplete but already working emulation of Linux's ptrace(2) for i386.
 1.3.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.4.2.3 22-Nov-2000  bouyer Sync with HEAD.
 1.4.2.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.4.2.1 01-Nov-2000  bouyer file linux_ptrace.c was added on branch thorpej_scsipi on 2000-11-20 18:08:19 +0000
 1.5.2.6 11-Dec-2002  thorpej Sync with HEAD.
 1.5.2.5 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.5.2.4 08-Jan-2002  nathanw Catch up to -current.
 1.5.2.3 14-Nov-2001  nathanw Catch up to -current.
 1.5.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.5.2.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.6.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.11.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.11.10.1 29-Apr-2005  kent sync with -current
 1.11.2.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.12.4.4 21-Jan-2008  yamt sync with head
 1.12.4.3 03-Sep-2007  yamt sync with head.
 1.12.4.2 26-Feb-2007  yamt sync with head.
 1.12.4.1 30-Dec-2006  yamt sync with head.
 1.13.8.1 03-Sep-2006  yamt sync with head.
 1.13.4.1 09-Sep-2006  rpaulo sync with head
 1.15.2.3 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.15.2.2 29-Dec-2006  ad Checkpoint work in progress.
 1.15.2.1 17-Nov-2006  ad Checkpoint work in progress.
 1.16.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.17.4.1 11-Jul-2007  mjf Sync with head.
 1.17.2.1 05-Apr-2007  ad Compile fixes.
 1.18.16.1 26-Dec-2007  ad Sync with head.
 1.18.8.1 09-Jan-2008  matt sync with HEAD
 1.18.6.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.19.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.20.8.1 18-May-2008  yamt sync with head.
 1.20.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.20.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.21.2.4 11-Aug-2010  yamt sync with head.
 1.21.2.3 11-Mar-2010  yamt sync with head
 1.21.2.2 04-May-2009  yamt sync with head.
 1.21.2.1 16-May-2008  yamt sync with head.
 1.22.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.22.2.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.22.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.24.4.2 05-Mar-2011  rmind sync with head
 1.24.4.1 03-Jul-2010  rmind sync with head
 1.24.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.26.28.1 15-Nov-2015  bouyer Pull up following revision(s) (requested by pgoyette in ticket #1335):
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.31
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.19
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.29
Don't release proc_lock until we're done looking at things that are
protected by the lock, particularly p_stat and p_waited. Found by
Robert Elz.
XXX Pullup to NetBSD-7, -6, -6-0, and -6-1
 1.26.22.1 18-May-2014  rmind sync with head
 1.26.20.1 15-Nov-2015  bouyer Pull up following revision(s) (requested by pgoyette in ticket #1335):
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.31
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.19
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.29
Don't release proc_lock until we're done looking at things that are
protected by the lock, particularly p_stat and p_waited. Found by
Robert Elz.
XXX Pullup to NetBSD-7, -6, -6-0, and -6-1
 1.26.18.2 03-Dec-2017  jdolecek update from HEAD
 1.26.18.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.26.14.1 15-Nov-2015  bouyer Pull up following revision(s) (requested by pgoyette in ticket #1335):
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.31
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.19
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.29
Don't release proc_lock until we're done looking at things that are
protected by the lock, particularly p_stat and p_waited. Found by
Robert Elz.
XXX Pullup to NetBSD-7, -6, -6-0, and -6-1
 1.26.8.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.27.2.1 10-Aug-2014  tls Rebase.
 1.28.2.3 05-Nov-2015  snj Pull up following revision(s) (requested by pgoyette in ticket #998):
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.19
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.31
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.29
Don't release proc_lock until we're done looking at things that are
protected by the lock, particularly p_stat and p_waited. Found by
Robert Elz.
 1.28.2.2 17-Jan-2015  martin branches: 1.28.2.2.2;
Pull up following revision(s) (requested by maxv in ticket #427):
sys/compat/svr4/svr4_schedctl.c: revision 1.8
sys/netinet/tcp_timer.c: revision 1.88
sys/miscfs/genfs/layer_vfsops.c: revision 1.45
sys/compat/svr4/svr4_ioctl.c: revision 1.37
sys/ufs/chfs/chfs_vfsops.c: revision 1.14
sys/miscfs/fdesc/fdesc_vfsops.c: revision 1.91
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.30
sys/compat/common/kern_time_50.c: revision 1.28
sys/netinet6/ip6_forward.c: revision 1.74
sys/miscfs/umapfs/umap_vnops.c: revision 1.57
sys/compat/svr4/svr4_fcntl.c: revision 1.74
distrib/sets/lists/comp/mi: revision 1.1931
sys/netinet6/udp6_output.c: revision 1.46
sys/fs/puffs/puffs_compat.c: revision 1.3
sys/fs/udf/udf_rename.c: revision 1.11
sys/compat/svr4/svr4_filio.c: revision 1.24
sys/fs/udf/udf_rename.c: revision 1.12
sys/netinet/tcp_usrreq.c: revision 1.202
sys/miscfs/umapfs/umap_subr.c: revision 1.29
sys/compat/linux/common/linux_fadvise64.c: revision 1.3
sys/netinet/if_atm.c: revision 1.34
sys/miscfs/procfs/procfs_subr.c: revision 1.106
sys/miscfs/genfs/layer_subr.c: revision 1.37
sys/netinet/tcp_sack.c: revision 1.30
sys/compat/freebsd/freebsd_misc.c: revision 1.33
sys/compat/freebsd/freebsd_file.c: revision 1.33
sys/ufs/chfs/chfs_vnode.c: revision 1.12
sys/compat/svr4/svr4_ttold.c: revision 1.34
sys/compat/linux/common/linux_file.c: revision 1.114
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.43
sys/compat/linux/common/linux_signal.c: revision 1.76
sys/compat/common/compat_util.c: revision 1.46
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.18
sys/compat/svr4/svr4_sockio.c: revision 1.36
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.32
sys/compat/svr4/svr4_signal.c: revision 1.66
sys/kern/kern_exec.c: revision 1.410
sys/fs/puffs/puffs_vfsops.c: revision 1.115
sys/compat/svr4/svr4_exec_elf64.c: revision 1.15
sys/compat/linux/arch/i386/linux_machdep.c: revision 1.159
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.50
sys/compat/linux32/common/linux32_misc.c: revision 1.24
sys/netinet/in_pcb.c: revision 1.153
sys/sys/malloc.h: revision 1.116
sys/compat/common/if_43.c: revision 1.9
share/man/man9/Makefile: revision 1.380
sys/netinet/tcp_vtw.c: revision 1.12
sys/miscfs/umapfs/umap_vfsops.c: revision 1.95
sys/ufs/ext2fs/ext2fs_vfsops.c: revision 1.186
sys/compat/common/uipc_syscalls_43.c: revision 1.46
sys/ufs/ext2fs/ext2fs_vnops.c: revision 1.115
sys/fs/puffs/puffs_msgif.c: revision 1.97
sys/compat/svr4/svr4_ipc.c: revision 1.27
sys/compat/linux/common/linux_exec.c: revision 1.117
sys/ufs/ext2fs/ext2fs_readwrite.c: revision 1.66
sys/netinet/tcp_output.c: revision 1.179
sys/compat/svr4/svr4_termios.c: revision 1.28
sys/fs/udf/udf_strat_bootstrap.c: revision 1.4
sys/fs/puffs/puffs_subr.c: revision 1.67
sys/fs/puffs/puffs_node.c: revision 1.36
sys/miscfs/overlay/overlay_vnops.c: revision 1.21
sys/fs/cd9660/cd9660_node.c: revision 1.34
sys/netinet/raw_ip.c: revision 1.146
sys/sys/mallocvar.h: revision 1.13
sys/miscfs/overlay/overlay_vfsops.c: revision 1.63
share/man/man9/malloc.9: revision 1.50
sys/netinet6/dest6.c: revision 1.18
sys/compat/linux/common/linux_uselib.c: revision 1.33
sys/compat/linux/common/linux_socket.c: revision 1.120
share/man/man9/malloc.9: revision 1.51
sys/netinet/tcp_subr.c: revision 1.257
sys/compat/linux/common/linux_socketcall.c: revision 1.45
sys/compat/linux/common/linux_fadvise64_64.c: revision 1.3
sys/compat/freebsd/freebsd_ipc.c: revision 1.17
sys/compat/linux/common/linux_misc_notalpha.c: revision 1.109
sys/compat/linux/arch/alpha/linux_pipe.c: revision 1.17
sys/netinet6/in6_pcb.c: revision 1.132
sys/netinet6/in6_ifattach.c: revision 1.94
sys/compat/svr4/svr4_exec_elf32.c: revision 1.15
sys/miscfs/nullfs/null_vfsops.c: revision 1.90
sys/fs/cd9660/cd9660_util.c: revision 1.12
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.48
sys/compat/freebsd/freebsd_exec_elf32.c: revision 1.20
sys/miscfs/procfs/procfs_vfsops.c: revision 1.94
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.28
sys/compat/linux/common/linux_sched.c: revision 1.67
sys/compat/linux/common/linux_exec_aout.c: revision 1.67
sys/compat/linux/common/linux_pipe.c: revision 1.67
sys/compat/linux/common/linux_llseek.c: revision 1.34
sys/compat/linux/arch/mips/linux_ptrace.c: revision 1.10
Do not uselessly include <sys/malloc.h>.
Cleanup:
- remove struct kmembuckets (dead)
- correctly deadify MALLOC_XX
- remove MALLOC_DEFINE_LIMIT and MALLOC_JUSTDEFINE_LIMIT (dead)
- remove malloc_roundup(), malloc_type_setlimit(), MALLOC_DEFINE_LIMIT()
and MALLOC_JUSTDEFINE_LIMIT() from man 9 malloc
New sentence, new line. Bump date for previous.
Obsolete malloc_roundup(9), malloc_type_setlimit(9) and MALLOC_DEFINE_LIMIT(9)
man pages.
 1.28.2.1 30-Oct-2014  martin Pull up following revision(s) (requested by maxv in ticket #163):
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.29
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.26
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.27
Fix four memory leaks in compat/linux.
 1.28.2.2.2.1 05-Nov-2015  snj Pull up following revision(s) (requested by pgoyette in ticket #998):
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.19
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.31
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.29
Don't release proc_lock until we're done looking at things that are
protected by the lock, particularly p_stat and p_waited. Found by
Robert Elz.
 1.30.2.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.31.10.2 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1836):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.31.10.1 12-Apr-2018  martin Pull up following revision(s) (requested by kamil in ticket #713):

sys/modules/procfs/Makefile: revision 1.4
sys/miscfs/procfs/procfs_vfsops.c: revision 1.98
bin/ps/ps.1: revision 1.108
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.32
sys/miscfs/procfs/procfs_vnops.c: revision 1.198
sys/kern/sys_ptrace_common.c: revision 1.23
sys/kern/sys_ptrace_common.c: revision 1.24
sbin/mount_procfs/mount_procfs.8: revision 1.36
sys/kern/sys_ptrace_common.c: revision 1.25
sys/kern/sys_ptrace.c: revision 1.5
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.30
sys/sys/proc.h: revision 1.342
sys/kern/sys_ptrace_common.c: revision 1.26
sys/miscfs/procfs/procfs_ctl.c: file removal
sys/kern/sys_ptrace_common.c: revision 1.27
sys/miscfs/procfs/procfs_subr.c: revision 1.109
sys/kern/sys_ptrace_common.c: revision 1.28
sys/secmodel/extensions/secmodel_extensions.c: revision 1.8
sys/kern/sys_ptrace_common.c: revision 1.29
sys/sys/ptrace.h: revision 1.62
sys/compat/netbsd32/netbsd32_signal.c: revision 1.45
share/man/man9/kauth.9: revision 1.109
sys/miscfs/procfs/files.procfs: revision 1.12
sys/compat/netbsd32/netbsd32.h: revision 1.115
sys/miscfs/procfs/procfs.h: revision 1.72
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.5
sys/kern/kern_sig.c: revision 1.337
sys/sys/kauth.h: revision 1.75
sys/sys/sysctl.h: revision 1.224
sys/kern/sys_ptrace_common.c: revision 1.30
sys/kern/sys_ptrace_common.c: revision 1.31
sys/kern/sys_ptrace_common.c: revision 1.32
sys/kern/sys_ptrace_common.c: revision 1.33
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.20
sys/kern/sys_ptrace_common.c: revision 1.34
sys/kern/sys_ptrace_common.c: revision 1.36
sys/kern/kern_proc.c: revision 1.207
sys/kern/kern_exit.c: revision 1.269
doc/TODO.ptrace: revision 1.29

Make {s,g}et{db,fp,}regs work again for PK_32 processes
XXX: pullup-8

add disgusting magic to handle compat_netbsd32 as a module.

use process_*reg32 instead of struct *reg32.

Remove the filesystem tracing feature

This is a legacy interface from 4.4BSD, and it was
introduced to overcome shortcomings of ptrace(2) at that time, which are
no longer relevant (performance). Today /proc/#/ctl offers a narrow
subset of ptrace(2) commands and is not applicable for modern
applications use beyond simplistic tracing scenarios.

This removal will simplify kernel internals. Users will still be able to
use all the other /proc files.

This change won't affect other procfs files neither Linux compat
features within mount_procfs(8). /proc/#/ctl isn't available on Linux.

Remove:
- /proc/#/ctl from mount_procfs(8)
- P_FSTRACE note from the documentation of ps(1)
- /proc/#/ctl and filesystem tracing documentation from mount_procfs(8)
- KAUTH_REQ_PROCESS_PROCFS_CTL documentation from kauth(9)
- source code file miscfs/procfs/procfs_ctl.c
- PFSctl and procfs_doctl() from sys/miscfs/procfs/procfs.h
- KAUTH_REQ_PROCESS_PROCFS_CTL from sys/sys/kauth.h
- PSL_FSTRACE (0x00010000) from sys/sys/proc.h
- P_FSTRACE (0x00010000) from sys/sys/sysctl.h

Reduce code complexity after removal of this functionality.

Update TODO.ptrace accordingly: remove two entries about /proc tracing.

Do not keep legacy notes as comments in the headers about removed

PSL_FSTRACE / P_FSTRACE, as this interface had little number of users
(close or equal to zero).
Proposed on tech-kern@.

All filesystem tracing utility users are encouraged to switch to ptrace(2).

Sponsored by <The NetBSD Foundation>

untangle the mess:
- factor out common code
- break each ptrace subcall to its own sub-function
.. more to come ...
- reduce ifdef ugliness by moving it up top.
- factor out PT_IO and make PT_{READ,WRITE}_{I,D} use it
- factor out PT_DUMPCORE
- factor out sendsig code
.. more to come ...

handle siginfo requests for ptrace32

ptrace: Partially undo PT_{READ,WRITE}_{I,D} and unbreak these commands

The refactored code did not work and was generating EFAULT.

Sponsored by <The NetBSD Foundation>

Merge the code back; the problem was that since we are reading/writing
to a kernel address for PT_{READ,WRITE}_{I,D} we need the kernel vmspace.
provide separate read and write functions to accomodate register functions
that need a size argument.

don't ignore error from copyout_piod

Use the proper process (the tracee) to get information about lwps and
registers and the tracer for vmspace.

Add new sysctl(3) entry: security.models.extensions.user_set_dbregs

Model this new sysctl(3) entry after "user_set_cpu_affinity" in the same
level of sysctl(3) switches.

Allow to read unconditionally Debug Registers (no change here). This is
convenient as even if a user of a debugger does not use hardware assisted
watchpoints/breakpoints, a debugger can still prompt these values to store
in an internal cache with context of registers. Reading them should have
no security concerns.

Add a paranoid MI switch that prohibits by default setting these registers
by a regular user (non-superuser). Make this switch disabled by default.
There are enough reserved bits out there to allow using them
unconditionally on hardened hosts.

Features shipped with Debug Registers are optional features in debuggers.
There is no reduction in elementary functionality.

Reviewed by <christos>

Sponsored by <The NetBSD Foundation>
 1.32.4.1 10-Jun-2019  christos Sync with HEAD
 1.32.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.33.4.1 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.25 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.24 10-Apr-2002  itojun branches: 1.24.108; 1.24.110; 1.24.112;
revert previous
 1.23 10-Apr-2002  itojun make it compile (missing includes)
 1.22 31-Mar-2002  christos bring the reverse signal mapping array into linux_signo.c
 1.21 31-Mar-2002  christos make signal array handling uniform, and put signal arrays in a separate
file. This is simular to errno array handling.
 1.20 19-Mar-2002  christos - Now that RT-signals fit, fix the array to deliver them. [i386 only].
- jdk-1.4 works perfectly now. :-)
 1.19 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.18 18-Jan-2001  jdolecek branches: 1.18.2; 1.18.4;
constify
 1.17 04-Oct-1999  fvdl branches: 1.17.2;
Handle the newer, larger sigset_t Linux now uses.
 1.16 04-Oct-1998  fvdl Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.15 03-Oct-1998  christos Attempt to fix the mess.
 1.14 01-Oct-1998  erh Split compat/linux/linux_signal.c into i386, common and multi-architecture parts.
 1.13 29-Sep-1998  tv Bracket stray printf()s by #ifdef DEBUG.
 1.12 11-Sep-1998  mycroft Substantial signal handling changes:
* Increase the size of sigset_t to accomodate 128 signals -- adding new
versions of sys_setprocmask(), sys_sigaction(), sys_sigpending() and
sys_sigsuspend() to handle the changed arguments.
* Abstract the guts of sys_sigaltstack(), sys_setprocmask(), sys_sigaction(),
sys_sigpending() and sys_sigsuspend() into separate functions, and call them
from all the emulations rather than hard-coding everything. (Avoids uses
the stackgap crap for these system calls.)
* Add a new flag (p_checksig) to indicate that a process may have signals
pending and userret() needs to do the full (slow) check.
* Eliminate SAS_ALTSTACK; it's exactly the inverse of SS_DISABLE.
* Correct emulation bugs with restoring SS_ONSTACK.
* Make the signal mask in the sigcontext always use the emulated mask format.
* Store signals internally in sigaction structures, rather than maintaining a
bunch of little sigsets for each SA_* bit.
* Keep track of where we put the signal trampoline, rather than figuring it out
in *_sendsig().
* Issue a warning when a non-emulated sigaction bit is observed.
* Add missing emulated signals, and a native SIGPWR (currently not used).
* Implement the `not reset when caught' semantics for relevant signals.

Note: Only code touched by the i386 port has been modified. Other ports and
emulations need to be updated.
 1.11 09-Aug-1998  perry bzero->memset, bcopy->memcpy, bcmp->memcmp
 1.10 04-Apr-1996  christos - Add missing prototypes
- Fix bugs with reversed arguments that prototyping discovered
 1.9 07-Oct-1995  mycroft Prefix names of system call implementation functions with `sys_'.
 1.8 19-Sep-1995  thorpej Make system calls conform to a standard prototype and bring those
prototypes into scope.
 1.7 14-Aug-1995  mycroft Move signal types into signal.h.
 1.6 13-Aug-1995  mycroft Convert SA_NOMASK and SA_ONESHOT.
Clean up this code a bit.
 1.5 24-Jun-1995  christos Use compat_util.[ch].
 1.4 22-Jun-1995  fvdl * Changed to use generic ELF code from kern/exec_elf.c (which was taken
from the svr4 exec code plus the linux compat mods)
* Include file change
* Add multicast sockopts (from John Brezak)
 1.3 10-Mar-1995  fvdl Add the Linux pause() system call. Fix the arguments to sigsuspend().
 1.2 08-Mar-1995  fvdl Fix typo in comment.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.17.2.1 11-Feb-2001  bouyer Sync with HEAD.
 1.18.4.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.18.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.18.2.3 17-Apr-2002  nathanw Catch up to -current.
 1.18.2.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.18.2.1 14-Nov-2001  nathanw Catch up to -current.
 1.24.112.1 16-May-2008  yamt sync with head.
 1.24.110.1 18-May-2008  yamt sync with head.
 1.24.108.1 02-Jun-2008  mjf Sync with HEAD.
 1.8 18-Nov-2011  christos - add sigtimedwait support.
- merge the siginfo population code.
 1.7 23-Nov-2008  njoly branches: 1.7.16;
Move si_code definitions from MD to MI linux_siginfo.h, all archs
(except mips for 3 values) are identical.
While here, remove unused/unneeded LINUX__SI_CODE macro. Only the
lower 16-bits are used for userland si_code.
 1.6 25-Oct-2008  christos branches: 1.6.2;
Add preliminary tls support for i386. Does not work yet. From FreeBSD.
 1.5 28-Apr-2008  martin branches: 1.5.6;
Remove clause 3 and 4 from TNF licenses
 1.4 11-Dec-2005  christos branches: 1.4.70; 1.4.72; 1.4.74;
merge ktrace-lwp.
 1.3 26-Feb-2005  perry nuke trailing whitespace
 1.2 03-Jul-2003  christos branches: 1.2.8; 1.2.10;
Implement linux_rt_sigreturn for real. Add a hack for more plausible siginfo.
The java segv handler still segv's again inside the signal handler, but our
sample test program now works [gets the proper ucontext].
 1.1 05-Sep-2002  christos branches: 1.1.2; 1.1.4; 1.1.10;
Make this match reality [not used yet]
 1.1.10.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.1.10.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.10.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.10.1 03-Aug-2004  skrll Sync with HEAD
 1.1.4.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.1.4.1 05-Sep-2002  jdolecek file linux_siginfo.h was added on branch kqueue on 2002-10-10 18:38:00 +0000
 1.1.2.2 17-Sep-2002  nathanw Catch up to -current.
 1.1.2.1 05-Sep-2002  nathanw file linux_siginfo.h was added on branch nathanw_sa on 2002-09-17 21:19:00 +0000
 1.2.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.2.8.1 29-Apr-2005  kent sync with -current
 1.4.74.2 04-May-2009  yamt sync with head.
 1.4.74.1 16-May-2008  yamt sync with head.
 1.4.72.1 18-May-2008  yamt sync with head.
 1.4.70.2 17-Jan-2009  mjf Sync with HEAD.
 1.4.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.5.6.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.6.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.7.16.1 17-Apr-2012  yamt sync with head
 1.16 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.15 04-Dec-2007  dsl branches: 1.15.12; 1.15.14; 1.15.16;
Remove all the __P
 1.14 11-Dec-2005  christos branches: 1.14.44; 1.14.46; 1.14.52; 1.14.56;
merge ktrace-lwp.
 1.13 19-Sep-2005  christos MINSIGSTKSZ on linux is different depending on the platform and usually
smaller than ours.
 1.12 26-Nov-2002  christos branches: 1.12.6; 1.12.22;
rename sa_ -> linux_sa_
first attempt at providing siginfo_t to the signal handler.
 1.11 19-Mar-2002  christos - Now that RT-signals fit, fix the array to deliver them. [i386 only].
- jdk-1.4 works perfectly now. :-)
 1.10 15-Feb-2002  christos - add a real linux_sys___sysctl because the mib numbers are different.
implement only the kernel version getting entries.
- make the signal conversion functions consistent; dest is arg 1.
- make linux_fakedev deal with block and char devices differently.
- add linux_sys_ugetrlimit, and flesh out the regular get/setrlimit so
that they work properly.
- add linux_mmap2 [untested].
- bump kernel to 2.4.18, and make the date be valentine's day :-)
- linux_sys_*stat64 family was totally busted. Fix it.

tested only on i386.

Status:
gdb, telnet, work
jdk-1.4.0 extractor works, jdk still coredumps.

christos
 1.9 23-Aug-2000  christos branches: 1.9.2; 1.9.4;
add support for syscall 186 [sigaltstack]
 1.8 04-Oct-1999  fvdl branches: 1.8.2;
Handle the newer, larger sigset_t Linux now uses.
 1.7 04-Oct-1998  fvdl Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.6 01-Oct-1998  erh Split compat/linux/linux_signal.h into i386 and common parts.
 1.5 11-Sep-1998  mycroft Substantial signal handling changes:
* Increase the size of sigset_t to accomodate 128 signals -- adding new
versions of sys_setprocmask(), sys_sigaction(), sys_sigpending() and
sys_sigsuspend() to handle the changed arguments.
* Abstract the guts of sys_sigaltstack(), sys_setprocmask(), sys_sigaction(),
sys_sigpending() and sys_sigsuspend() into separate functions, and call them
from all the emulations rather than hard-coding everything. (Avoids uses
the stackgap crap for these system calls.)
* Add a new flag (p_checksig) to indicate that a process may have signals
pending and userret() needs to do the full (slow) check.
* Eliminate SAS_ALTSTACK; it's exactly the inverse of SS_DISABLE.
* Correct emulation bugs with restoring SS_ONSTACK.
* Make the signal mask in the sigcontext always use the emulated mask format.
* Store signals internally in sigaction structures, rather than maintaining a
bunch of little sigsets for each SA_* bit.
* Keep track of where we put the signal trampoline, rather than figuring it out
in *_sendsig().
* Issue a warning when a non-emulated sigaction bit is observed.
* Add missing emulated signals, and a native SIGPWR (currently not used).
* Implement the `not reset when caught' semantics for relevant signals.

Note: Only code touched by the i386 port has been modified. Other ports and
emulations need to be updated.
 1.4 27-Aug-1995  fvdl Add a hook for MD ioctl calls, plus a couple of more changes to make
svgalib binaries work on the i386
 1.3 14-Aug-1995  mycroft Export bsd_to_linux_sig[], and use it.
 1.2 14-Aug-1995  mycroft Move signal types into signal.h.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.8.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.9.4.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.9.4.1 16-Mar-2002  jdolecek Catch up with -current.
 1.9.2.3 11-Dec-2002  thorpej Sync with HEAD.
 1.9.2.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.9.2.1 28-Feb-2002  nathanw Catch up to -current.
 1.12.22.2 07-Dec-2007  yamt sync with head
 1.12.22.1 21-Jun-2006  yamt sync with head.
 1.12.6.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.14.56.1 08-Dec-2007  ad Sync with head.
 1.14.52.1 08-Dec-2007  mjf Sync with HEAD.
 1.14.46.1 09-Jan-2008  matt sync with HEAD
 1.14.44.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.15.16.1 16-May-2008  yamt sync with head.
 1.15.14.1 18-May-2008  yamt sync with head.
 1.15.12.1 02-Jun-2008  mjf Sync with HEAD.
 1.9 25-Jan-2014  njoly Update linux socket socket options (SO_*). Add common version to its
own file (linux_socket_generic.h); use it for all but alpha and mips.
 1.8 28-Apr-2008  martin branches: 1.8.34; 1.8.44; 1.8.50;
Remove clause 3 and 4 from TNF licenses
 1.7 11-Dec-2005  christos branches: 1.7.70; 1.7.72; 1.7.74;
merge ktrace-lwp.
 1.6 26-Jul-2003  jdolecek add LINUX_SO_PEERNAME, LINUX_SO_TIMESTAMP where it has been missing
fix value for LINUX_SO_DETACH_FILTER on couple places (unused anyway)

g/c LINUX_SCM_TIMESTAMP definition for some archs, it will be defined
in generic linux_socket.h
 1.5 04-Oct-1998  fvdl branches: 1.5.46;
Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.4 01-Oct-1998  erh Split linux_socket.h into i386 and common parts.
 1.3 28-May-1995  mycroft Convert TCP socket options.
 1.2 28-May-1995  mycroft Convert IP socket options.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.5.46.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.46.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.46.1 03-Aug-2004  skrll Sync with HEAD
 1.7.74.1 16-May-2008  yamt sync with head.
 1.7.72.1 18-May-2008  yamt sync with head.
 1.7.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.8.50.1 18-May-2014  rmind sync with head
 1.8.44.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.8.34.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.5 23-Feb-2009  rmind Switch Linux futex emulation to native ucas_int(), remove unecessary
futex-specific assembler routines.

Fixes PR/40490. Reviewed by <ad>.
 1.4 14-Nov-2008  ad branches: 1.4.4; 1.4.6; 1.4.8;
Unneeded ifdef
 1.3 26-Oct-2008  jmcneill branches: 1.3.2; 1.3.4;
Need opt_multiprocessor.h for MULTIPROCESSOR definition.
 1.2 26-Oct-2008  christos multiprocessor fixes, from rmind
 1.1 26-Oct-2008  christos futex support fixes from FreeBSD via cube+pengo.
 1.3.4.1 26-Feb-2009  snj Pull up following revision(s) (requested by rmind in ticket #493):
sys/compat/linux/arch/amd64/files.linux_amd64: revision 1.4
sys/compat/linux/arch/amd64/linux_support.S: file removal
sys/compat/linux/common/linux_futex.c: revision 1.23
sys/compat/linux/arch/i386/linux_support.S: file removal
sys/compat/linux/arch/i386/files.linux_i386: revision 1.10
Switch Linux futex emulation to native ucas_int(), remove unecessary
futex-specific assembler routines.
Fixes PR/40490. Reviewed by <ad>.
 1.3.2.2 03-Mar-2009  skrll Sync with HEAD.
 1.3.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.4.8.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.4.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.4.6.1 14-Nov-2008  mjf file linux_support.S was added on branch mjf-devfs2 on 2009-01-17 13:28:43 +0000
 1.4.4.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.4.4.1 14-Nov-2008  haad file linux_support.S was added on branch haad-dm on 2008-12-13 01:13:53 +0000
 1.129 28-Sep-2024  christos regen
 1.128 01-Jul-2024  christos regen
 1.127 29-Jun-2024  christos branches: 1.127.2;
regen
 1.126 19-Aug-2023  christos regen
 1.125 18-Aug-2023  christos regen
 1.124 29-Jul-2023  christos regen
 1.123 28-Jul-2023  christos regen
 1.122 10-Jul-2023  christos regen
 1.121 02-Dec-2021  ryo regen
 1.120 20-Sep-2021  thorpej Regen for preadv(2) / pwritev(2).
 1.119 20-Sep-2021  thorpej Regen for eventfd.
 1.118 19-Sep-2021  thorpej Regen for timerfd.
 1.117 19-Sep-2021  thorpej Regen for POSIX timer syscalls.
 1.116 26-Apr-2020  thorpej branches: 1.116.2;
Regen for native futex calls.
 1.115 09-Nov-2019  jdolecek regen
 1.114 10-Aug-2018  pgoyette Regen
 1.113 10-May-2017  riastradh branches: 1.113.8; 1.113.10;
regen
 1.112 16-Jan-2017  christos branches: 1.112.4;
regen all
 1.111 13-Jan-2017  christos branches: 1.111.2;
regen
 1.110 02-Jan-2017  martin Regen (something apparently went wrong in previous)
 1.109 02-Jan-2017  manu Regen
 1.108 24-Jul-2016  njoly Regen for readlink/readlinkat signatures.
 1.107 24-Sep-2015  christos branches: 1.107.2;
regen
 1.106 23-Mar-2015  ozaki-r Regen
 1.105 07-Mar-2015  christos regen
 1.104 22-Nov-2014  njoly branches: 1.104.2;
Regen for ppoll signature fix
 1.103 31-May-2014  njoly branches: 1.103.2;
Regen for munmap(2) signature.
 1.102 29-May-2014  njoly Regen for utimes(2) change.
 1.101 20-May-2014  njoly Regen for getgroups/setgroups update.
 1.100 17-May-2014  njoly Regen for fadvise64 offset types changes.
 1.99 04-May-2014  njoly Regen for pread/pwrite 64bit offset argument.
 1.98 08-Apr-2014  njoly Regen.
 1.97 18-Nov-2013  chs branches: 1.97.2;
regen
 1.96 07-Nov-2013  njoly Regen for dup/dup2/dup3 argument types fix.
 1.95 24-Sep-2013  njoly Regen for utimensat(2).
 1.94 08-Apr-2013  pooka branches: 1.94.4;
regen for utimes
 1.93 19-Sep-2012  pooka regen for ppoll (and, apparently, SYCALL_ARG_PTR)
 1.92 18-Nov-2011  christos branches: 1.92.10;
- add sigtimedwait support.
- merge the siginfo population code.
 1.91 30-May-2011  alnsn branches: 1.91.4;
Regenerate files to pick up correct RCS Ids. Suggested by Chris Badura.
 1.90 30-May-2011  alnsn Add fadvise64 and fadvise64_64 syscalls to compat_linux and compat_linux32.
 1.89 10-Apr-2011  christos Regen: Argh:
cat: rumphdr.types: No such file or directory
rm: rumphdr.types: No such file or directory
*** Error code 1
 1.88 07-Jul-2010  chs branches: 1.88.2;
regen
 1.87 23-Apr-2010  chs regen
 1.86 14-Dec-2009  matt branches: 1.86.2; 1.86.4;
Regen (new makesyscalls.sh)
 1.85 24-Nov-2009  njoly Regen for personality(2) update.
 1.84 08-Jun-2009  njoly Regen for rt_queueinfo(2) update.
 1.83 17-Jan-2009  njoly branches: 1.83.2;
Regen for wait4 update.
 1.82 13-Jan-2009  pooka Regen to prove I didn't screw up the conversion: purely RCSID changes.
 1.81 11-Jan-2009  christos merge christos-time_t
 1.80 19-Nov-2008  ad Regen.
 1.79 19-Nov-2008  njoly Regen for futex timeout argument cleanup/fix.
 1.78 12-Nov-2008  njoly Regen for nanosleep(2) fix.
 1.77 26-Oct-2008  christos branches: 1.77.2; 1.77.4;
regen
 1.76 26-Oct-2008  christos regen
 1.75 23-Apr-2008  ad branches: 1.75.2; 1.75.4; 1.75.8;
Regen.
 1.74 04-Apr-2008  njoly branches: 1.74.2;
Regen for linux_sys_msync removal.
 1.73 15-Jan-2008  njoly branches: 1.73.6; 1.73.8;
Regen.
 1.72 24-Dec-2007  njoly Regen for linux_sys_getpgid removal.
 1.71 21-Dec-2007  njoly Regen for getfsuid/setfsgid syscall exchange.
 1.70 20-Dec-2007  dsl regen
 1.69 16-Nov-2007  njoly branches: 1.69.2; 1.69.6;
Regen, for syscalls cleanup.
 1.68 13-Jun-2007  christos branches: 1.68.6; 1.68.8; 1.68.12; 1.68.14;
regen
 1.67 13-Jun-2007  christos regen.
 1.66 04-Mar-2007  christos branches: 1.66.2; 1.66.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.65 01-Sep-2006  matt branches: 1.65.8;
Regen.
 1.64 30-Aug-2006  matt Regen
 1.63 10-Jun-2006  christos regen
 1.62 11-Dec-2005  christos branches: 1.62.4; 1.62.8; 1.62.14;
merge ktrace-lwp.
 1.61 06-Nov-2005  manu regen
 1.60 06-Nov-2005  tron Regen with correct RCS Ids.
 1.59 05-Nov-2005  dogcow mirror manu's amd64 changes to implement linux sched_{seg,get}affinity;
the kernel and linux lkm now compile again.
 1.58 18-Oct-2005  joerg Regen.
 1.57 16-May-2005  fvdl branches: 1.57.2;
Regen.
 1.56 16-May-2005  fvdl Regen.
 1.55 26-Feb-2005  perry regen
 1.54 20-Sep-2004  jdolecek branches: 1.54.4; 1.54.6;
regen:
implement support for Linux statfs64() syscall - 64bit variant of statfs()
 1.53 08-Sep-2004  jdolecek regen: add exit_group(2)
 1.52 01-Aug-2004  jdolecek regen - sync syscall lists with Linux kernel 2.6.7
 1.51 01-Aug-2004  jdolecek regen:

connect madvise(2) and mincore(2) - apparently the newer Linux libs
don't stub it anymore, so allow the application to take advantage
of them

the Linux calls appear to be compatible in the flag values and semantics,
so a wrapper is not necessary
 1.50 01-Aug-2004  jdolecek connect madvise(2) and mincore(2) - apparently the newer Linux libs
don't stub it anymore, so allow the application to take advantage
of them

the Linux calls appear to be compatible in the flag values and semantics,
so a wrapper is not necessary
 1.49 10-Aug-2003  jdolecek regen - added wrapper for Linux ftruncate64()
 1.48 03-Jul-2003  christos Regen.
 1.47 23-Jun-2003  christos branches: 1.47.2;
Regen.
 1.46 18-Jan-2003  thorpej Regen for correct RCS IDs.
 1.45 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.44 10-Apr-2002  christos branches: 1.44.4;
regen
 1.43 22-Mar-2002  christos regen
 1.42 15-Feb-2002  christos regen
 1.41 15-Feb-2002  christos - add a real linux_sys___sysctl because the mib numbers are different.
implement only the kernel version getting entries.
- make the signal conversion functions consistent; dest is arg 1.
- make linux_fakedev deal with block and char devices differently.
- add linux_sys_ugetrlimit, and flesh out the regular get/setrlimit so
that they work properly.
- add linux_mmap2 [untested].
- bump kernel to 2.4.18, and make the date be valentine's day :-)
- linux_sys_*stat64 family was totally busted. Fix it.

tested only on i386.

Status:
gdb, telnet, work
jdk-1.4.0 extractor works, jdk still coredumps.

christos
 1.40 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.39 30-Sep-2001  manu Fixes my last commit: only mips really need fcntl64 to work now. i386 and
powerpc could use it later if needed. m68k and alpha should never need it.
 1.38 30-May-2001  mrg branches: 1.38.2; 1.38.4;
use _KERNEL_OPT.
 1.37 13-May-2001  manu Improved the accuracy of gettimeofday/settimeofday: Linux stores a srtuct
timezone in the kernel. We now keep track of it for emulated processes.
Tested for powerpc and i386. Untested on m68k, but it should be ok
Alpha has a particular implementation (osf1_sys_gettimeofday), and it has
therefore not been touched.
 1.36 30-Mar-2001  jdolecek regen
 1.35 30-Mar-2001  jdolecek regen
 1.34 27-Jan-2001  thorpej branches: 1.34.2;
Regen; getpid(2) is MP-safe.
 1.33 27-Jan-2001  thorpej Regen; add sy_flags.
 1.32 29-Dec-2000  fvdl Regen.
 1.31 27-Dec-2000  fvdl Regen.
 1.30 18-Dec-2000  fvdl Regen.
 1.29 13-Dec-2000  augustss Regen.
 1.28 12-Dec-2000  jdolecek regen
 1.27 12-Dec-2000  jdolecek regen
 1.26 11-Dec-2000  mycroft Regen.
 1.25 09-Dec-2000  jdolecek regen
 1.24 09-Dec-2000  mycroft Regen.
 1.23 02-Dec-2000  jdolecek regen after addition of linux_sys_swapoff()
 1.22 01-Dec-2000  jdolecek regen
 1.21 01-Nov-2000  jdolecek regen
 1.20 23-Aug-2000  christos regen
 1.19 18-Aug-2000  cgd update for changed makesyscalls.master
 1.18 18-Aug-2000  cgd update for new makesyscalls.sh, and also for correct ids for changed
syscalls.master files. (you need to regenerate after checking in
syscalls.master to get the correct ids.)
 1.17 18-Mar-2000  erh branches: 1.17.4;
Regen.
 1.16 03-Feb-2000  abs regen
 1.15 12-Dec-1999  tron Regen.
 1.14 05-Dec-1999  tron Regen.
 1.13 04-Dec-1999  tron Regen.
 1.12 04-Oct-1999  tron branches: 1.12.2; 1.12.8;
Regen from "syscalls.master".
 1.11 16-Aug-1999  tron Regen.
 1.10 14-May-1999  thorpej Regen.
 1.9 13-May-1999  thorpej Regen.
 1.8 30-Mar-1999  abs branches: 1.8.2; 1.8.4;
Regenerate (with poll())
 1.7 27-Mar-1999  tron Regen.
 1.6 23-Mar-1999  thorpej Regen; pread(2) and pwrite(2).
 1.5 09-Feb-1999  christos Regen
 1.4 10-Dec-1998  christos Regen
 1.3 04-Oct-1998  fvdl Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.2 03-Oct-1998  christos Attempt to fix the mess.
 1.1 01-Oct-1998  erh Regen.
 1.8.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.8.2.2 15-Aug-2000  he Pull up regenerated files (requested by abs):
Enable basic versions of Linux fsuid calls.
 1.8.2.1 31-Jan-2000  he Pull up generated files (requested by abs):
Enable emulation of vfork(2).
 1.12.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.12.2.7 21-Apr-2001  bouyer Sync with HEAD
 1.12.2.6 11-Feb-2001  bouyer Sync with HEAD.
 1.12.2.5 05-Jan-2001  bouyer Sync with HEAD
 1.12.2.4 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.12.2.3 08-Dec-2000  bouyer Sync with HEAD.
 1.12.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.12.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.17.4.2 01-May-2001  he Pull up regenerated files (requested by jdolecek):
Make it possible to use a different function for unimplemented
syscalls than sys_nosys(), so that the Linux emulation can avoid
posting SIGSYS and instead just return ENOSYS.
 1.17.4.1 30-Mar-2001  he Pull up regenerated files (requested by fvdl):
Add some required Linux emulation bits to support the Linux
version of VMware.
 1.34.2.9 29-May-2002  nathanw Regen.
 1.34.2.8 17-Apr-2002  nathanw Catch up to -current.
 1.34.2.7 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.34.2.6 28-Feb-2002  nathanw Catch up to -current.
 1.34.2.5 14-Nov-2001  nathanw Catch up to -current.
 1.34.2.4 08-Oct-2001  nathanw Catch up to -current.
 1.34.2.3 21-Jun-2001  nathanw Catch up to -current.
 1.34.2.2 09-Apr-2001  nathanw Catch up with -current.
 1.34.2.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.38.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.38.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.38.2.2 16-Mar-2002  jdolecek Catch up with -current.
 1.38.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.44.4.3 14-Jun-2004  jmc Regen for changes in ticket #1708
 1.44.4.2 11-May-2004  tron Regen for ticket 1686.
 1.44.4.1 22-Oct-2003  jmc Regen files (requested by tv in ticket #1427)

Proper support for mmap2
 1.47.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.47.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.47.2.4 24-Sep-2004  skrll Sync with HEAD.
 1.47.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.47.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.47.2.1 03-Aug-2004  skrll Sync with HEAD
 1.54.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.54.4.1 29-Apr-2005  kent sync with -current
 1.57.2.5 21-Jan-2008  yamt sync with head
 1.57.2.4 07-Dec-2007  yamt sync with head
 1.57.2.3 03-Sep-2007  yamt sync with head.
 1.57.2.2 30-Dec-2006  yamt sync with head.
 1.57.2.1 21-Jun-2006  yamt sync with head.
 1.62.14.1 19-Jun-2006  chap Sync with head.
 1.62.8.2 03-Sep-2006  yamt sync with head.
 1.62.8.1 26-Jun-2006  yamt sync with head.
 1.62.4.1 09-Sep-2006  rpaulo sync with head
 1.65.8.1 12-Mar-2007  rmind Sync with HEAD.
 1.66.4.1 11-Jul-2007  mjf Sync with head.
 1.66.2.1 15-Jul-2007  ad Sync with head.
 1.68.14.3 18-Feb-2008  mjf Sync with HEAD.
 1.68.14.2 27-Dec-2007  mjf Sync with HEAD.
 1.68.14.1 19-Nov-2007  mjf Sync with HEAD.
 1.68.12.1 18-Nov-2007  bouyer Sync with HEAD
 1.68.8.2 23-Mar-2008  matt sync with HEAD
 1.68.8.1 09-Jan-2008  matt sync with HEAD
 1.68.6.1 21-Nov-2007  joerg Sync with HEAD.
 1.69.6.2 19-Jan-2008  bouyer Sync with HEAD
 1.69.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.69.2.1 26-Dec-2007  ad Sync with head.
 1.73.8.3 20-Nov-2008  christos merge with head.
 1.73.8.2 01-Nov-2008  christos Sync with head.
 1.73.8.1 29-Mar-2008  christos Welcome to the time_t=long long dev_t=uint64_t branch.
 1.73.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.73.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.74.2.1 18-May-2008  yamt sync with head.
 1.75.8.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.75.4.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.75.2.4 11-Aug-2010  yamt sync with head.
 1.75.2.3 11-Mar-2010  yamt sync with head
 1.75.2.2 20-Jun-2009  yamt sync with head
 1.75.2.1 04-May-2009  yamt sync with head.
 1.77.4.1 20-Nov-2008  snj Regen for ticket 81.
 1.77.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.83.2.1 23-Jul-2009  jym Sync with HEAD.
 1.86.4.4 31-May-2011  rmind sync with head
 1.86.4.3 21-Apr-2011  rmind sync with head
 1.86.4.2 05-Mar-2011  rmind sync with head
 1.86.4.1 30-May-2010  rmind sync with head
 1.86.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.86.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.88.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.91.4.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.91.4.2 30-Oct-2012  yamt sync with head
 1.91.4.1 17-Apr-2012  yamt sync with head
 1.92.10.4 03-Dec-2017  jdolecek update from HEAD
 1.92.10.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.92.10.2 23-Jun-2013  tls resync from head
 1.92.10.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.94.4.1 18-May-2014  rmind sync with head
 1.97.2.1 10-Aug-2014  tls Rebase.
 1.103.2.1 17-Apr-2017  snj regen for ticket 1354
 1.104.2.3 05-Feb-2017  skrll Sync with HEAD
 1.104.2.2 05-Oct-2016  skrll Sync with HEAD
 1.104.2.1 06-Apr-2015  skrll Sync with HEAD
 1.107.2.3 20-Mar-2017  pgoyette Sync with HEAD
 1.107.2.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.107.2.1 26-Jul-2016  pgoyette Sync with HEAD
 1.111.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.112.4.1 11-May-2017  pgoyette Sync with HEAD
 1.113.10.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.113.10.1 10-Jun-2019  christos Sync with HEAD
 1.113.8.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.116.2.2 17-Dec-2020  thorpej Regen for preadv(2) and pwritev(2).
 1.116.2.1 15-Dec-2020  thorpej Regen for eventfd, timerfd, POSIX timers.
 1.127.2.1 02-Aug-2025  perseant Sync with HEAD
 1.129 28-Sep-2024  christos regen
 1.128 01-Jul-2024  christos regen
 1.127 29-Jun-2024  christos branches: 1.127.2;
regen
 1.126 19-Aug-2023  christos regen
 1.125 18-Aug-2023  christos regen
 1.124 29-Jul-2023  christos regen
 1.123 28-Jul-2023  christos regen
 1.122 10-Jul-2023  christos regen
 1.121 02-Dec-2021  ryo regen
 1.120 20-Sep-2021  thorpej Regen for preadv(2) / pwritev(2).
 1.119 20-Sep-2021  thorpej Regen for eventfd.
 1.118 19-Sep-2021  thorpej Regen for timerfd.
 1.117 19-Sep-2021  thorpej Regen for POSIX timer syscalls.
 1.116 26-Apr-2020  thorpej branches: 1.116.2;
Regen for native futex calls.
 1.115 09-Nov-2019  jdolecek regen
 1.114 10-Aug-2018  pgoyette Regen
 1.113 10-May-2017  riastradh branches: 1.113.8; 1.113.10;
regen
 1.112 16-Jan-2017  christos branches: 1.112.4;
regen all
 1.111 13-Jan-2017  christos branches: 1.111.2;
regen
 1.110 02-Jan-2017  martin Regen (something apparently went wrong in previous)
 1.109 02-Jan-2017  manu Regen
 1.108 24-Jul-2016  njoly Regen for readlink/readlinkat signatures.
 1.107 24-Sep-2015  christos branches: 1.107.2;
regen
 1.106 23-Mar-2015  ozaki-r Regen
 1.105 07-Mar-2015  christos regen
 1.104 22-Nov-2014  njoly branches: 1.104.2;
Regen for ppoll signature fix
 1.103 31-May-2014  njoly branches: 1.103.2;
Regen for munmap(2) signature.
 1.102 29-May-2014  njoly Regen for utimes(2) change.
 1.101 20-May-2014  njoly Regen for getgroups/setgroups update.
 1.100 17-May-2014  njoly Regen for fadvise64 offset types changes.
 1.99 04-May-2014  njoly Regen for pread/pwrite 64bit offset argument.
 1.98 08-Apr-2014  njoly Regen.
 1.97 18-Nov-2013  chs branches: 1.97.2;
regen
 1.96 07-Nov-2013  njoly Regen for dup/dup2/dup3 argument types fix.
 1.95 24-Sep-2013  njoly Regen for utimensat(2).
 1.94 08-Apr-2013  pooka branches: 1.94.4;
regen for utimes
 1.93 19-Sep-2012  pooka regen for ppoll (and, apparently, SYCALL_ARG_PTR)
 1.92 18-Nov-2011  christos branches: 1.92.10;
- add sigtimedwait support.
- merge the siginfo population code.
 1.91 30-May-2011  alnsn branches: 1.91.4;
Regenerate files to pick up correct RCS Ids. Suggested by Chris Badura.
 1.90 30-May-2011  alnsn Add fadvise64 and fadvise64_64 syscalls to compat_linux and compat_linux32.
 1.89 10-Apr-2011  christos Regen: Argh:
cat: rumphdr.types: No such file or directory
rm: rumphdr.types: No such file or directory
*** Error code 1
 1.88 07-Jul-2010  chs branches: 1.88.2;
regen
 1.87 23-Apr-2010  chs regen
 1.86 14-Dec-2009  matt branches: 1.86.2; 1.86.4;
Regen (new makesyscalls.sh)
 1.85 24-Nov-2009  njoly Regen for personality(2) update.
 1.84 08-Jun-2009  njoly Regen for rt_queueinfo(2) update.
 1.83 17-Jan-2009  njoly branches: 1.83.2;
Regen for wait4 update.
 1.82 13-Jan-2009  pooka Regen to prove I didn't screw up the conversion: purely RCSID changes.
 1.81 11-Jan-2009  christos merge christos-time_t
 1.80 19-Nov-2008  ad Regen.
 1.79 19-Nov-2008  njoly Regen for futex timeout argument cleanup/fix.
 1.78 12-Nov-2008  njoly Regen for nanosleep(2) fix.
 1.77 26-Oct-2008  christos branches: 1.77.2; 1.77.4;
regen
 1.76 26-Oct-2008  christos regen
 1.75 23-Apr-2008  ad branches: 1.75.2; 1.75.4; 1.75.8;
Regen.
 1.74 04-Apr-2008  njoly branches: 1.74.2;
Regen for linux_sys_msync removal.
 1.73 15-Jan-2008  njoly branches: 1.73.6; 1.73.8;
Regen.
 1.72 24-Dec-2007  njoly Regen for linux_sys_getpgid removal.
 1.71 21-Dec-2007  njoly Regen for getfsuid/setfsgid syscall exchange.
 1.70 20-Dec-2007  dsl regen
 1.69 16-Nov-2007  njoly branches: 1.69.2; 1.69.6;
Regen, for syscalls cleanup.
 1.68 13-Jun-2007  christos branches: 1.68.6; 1.68.8; 1.68.12; 1.68.14;
regen
 1.67 13-Jun-2007  christos regen.
 1.66 04-Mar-2007  christos branches: 1.66.2; 1.66.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.65 01-Sep-2006  matt branches: 1.65.8;
Regen.
 1.64 30-Aug-2006  matt Regen
 1.63 10-Jun-2006  christos regen
 1.62 11-Dec-2005  christos branches: 1.62.4; 1.62.8; 1.62.14;
merge ktrace-lwp.
 1.61 06-Nov-2005  manu regen
 1.60 06-Nov-2005  tron Regen with correct RCS Ids.
 1.59 05-Nov-2005  dogcow mirror manu's amd64 changes to implement linux sched_{seg,get}affinity;
the kernel and linux lkm now compile again.
 1.58 18-Oct-2005  joerg Regen.
 1.57 16-May-2005  fvdl branches: 1.57.2;
Regen.
 1.56 16-May-2005  fvdl Regen.
 1.55 26-Feb-2005  perry regen
 1.54 20-Sep-2004  jdolecek branches: 1.54.4; 1.54.6;
regen:
implement support for Linux statfs64() syscall - 64bit variant of statfs()
 1.53 08-Sep-2004  jdolecek regen: add exit_group(2)
 1.52 01-Aug-2004  jdolecek regen - sync syscall lists with Linux kernel 2.6.7
 1.51 01-Aug-2004  jdolecek regen:

connect madvise(2) and mincore(2) - apparently the newer Linux libs
don't stub it anymore, so allow the application to take advantage
of them

the Linux calls appear to be compatible in the flag values and semantics,
so a wrapper is not necessary
 1.50 01-Aug-2004  jdolecek connect madvise(2) and mincore(2) - apparently the newer Linux libs
don't stub it anymore, so allow the application to take advantage
of them

the Linux calls appear to be compatible in the flag values and semantics,
so a wrapper is not necessary
 1.49 10-Aug-2003  jdolecek regen - added wrapper for Linux ftruncate64()
 1.48 03-Jul-2003  christos Regen.
 1.47 23-Jun-2003  christos branches: 1.47.2;
Regen.
 1.46 18-Jan-2003  thorpej Regen for correct RCS IDs.
 1.45 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.44 10-Apr-2002  christos branches: 1.44.4;
regen
 1.43 22-Mar-2002  christos regen
 1.42 15-Feb-2002  christos regen
 1.41 15-Feb-2002  christos - add a real linux_sys___sysctl because the mib numbers are different.
implement only the kernel version getting entries.
- make the signal conversion functions consistent; dest is arg 1.
- make linux_fakedev deal with block and char devices differently.
- add linux_sys_ugetrlimit, and flesh out the regular get/setrlimit so
that they work properly.
- add linux_mmap2 [untested].
- bump kernel to 2.4.18, and make the date be valentine's day :-)
- linux_sys_*stat64 family was totally busted. Fix it.

tested only on i386.

Status:
gdb, telnet, work
jdk-1.4.0 extractor works, jdk still coredumps.

christos
 1.40 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.39 30-Sep-2001  manu Fixes my last commit: only mips really need fcntl64 to work now. i386 and
powerpc could use it later if needed. m68k and alpha should never need it.
 1.38 30-May-2001  mrg branches: 1.38.2; 1.38.4;
use _KERNEL_OPT.
 1.37 13-May-2001  manu Improved the accuracy of gettimeofday/settimeofday: Linux stores a srtuct
timezone in the kernel. We now keep track of it for emulated processes.
Tested for powerpc and i386. Untested on m68k, but it should be ok
Alpha has a particular implementation (osf1_sys_gettimeofday), and it has
therefore not been touched.
 1.36 30-Mar-2001  jdolecek regen
 1.35 30-Mar-2001  jdolecek regen
 1.34 27-Jan-2001  thorpej branches: 1.34.2;
Regen; getpid(2) is MP-safe.
 1.33 27-Jan-2001  thorpej Regen; add sy_flags.
 1.32 29-Dec-2000  fvdl Regen.
 1.31 27-Dec-2000  fvdl Regen.
 1.30 18-Dec-2000  fvdl Regen.
 1.29 13-Dec-2000  augustss Regen.
 1.28 12-Dec-2000  jdolecek regen
 1.27 12-Dec-2000  jdolecek regen
 1.26 11-Dec-2000  mycroft Regen.
 1.25 09-Dec-2000  jdolecek regen
 1.24 09-Dec-2000  mycroft Regen.
 1.23 02-Dec-2000  jdolecek regen after addition of linux_sys_swapoff()
 1.22 01-Dec-2000  jdolecek regen
 1.21 01-Nov-2000  jdolecek regen
 1.20 23-Aug-2000  christos regen
 1.19 18-Aug-2000  cgd update for changed makesyscalls.master
 1.18 18-Aug-2000  cgd update for new makesyscalls.sh, and also for correct ids for changed
syscalls.master files. (you need to regenerate after checking in
syscalls.master to get the correct ids.)
 1.17 18-Mar-2000  erh branches: 1.17.4;
Regen.
 1.16 03-Feb-2000  abs regen
 1.15 12-Dec-1999  tron Regen.
 1.14 05-Dec-1999  tron Regen.
 1.13 04-Dec-1999  tron Regen.
 1.12 04-Oct-1999  tron branches: 1.12.2; 1.12.8;
Regen from "syscalls.master".
 1.11 16-Aug-1999  tron Regen.
 1.10 14-May-1999  thorpej Regen.
 1.9 13-May-1999  thorpej Regen.
 1.8 30-Mar-1999  abs branches: 1.8.2; 1.8.4;
Regenerate (with poll())
 1.7 27-Mar-1999  tron Regen.
 1.6 23-Mar-1999  thorpej Regen; pread(2) and pwrite(2).
 1.5 09-Feb-1999  christos Regen
 1.4 10-Dec-1998  christos Regen
 1.3 04-Oct-1998  fvdl Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.2 03-Oct-1998  christos Attempt to fix the mess.
 1.1 01-Oct-1998  erh Regen.
 1.8.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.8.2.2 15-Aug-2000  he Pull up regenerated files (requested by abs):
Enable basic versions of Linux fsuid calls.
 1.8.2.1 31-Jan-2000  he Pull up generated files (requested by abs):
Enable emulation of vfork(2).
 1.12.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.12.2.7 21-Apr-2001  bouyer Sync with HEAD
 1.12.2.6 11-Feb-2001  bouyer Sync with HEAD.
 1.12.2.5 05-Jan-2001  bouyer Sync with HEAD
 1.12.2.4 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.12.2.3 08-Dec-2000  bouyer Sync with HEAD.
 1.12.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.12.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.17.4.2 01-May-2001  he Pull up regenerated files (requested by jdolecek):
Make it possible to use a different function for unimplemented
syscalls than sys_nosys(), so that the Linux emulation can avoid
posting SIGSYS and instead just return ENOSYS.
 1.17.4.1 30-Mar-2001  he Pull up regenerated files (requested by fvdl):
Add some required Linux emulation bits to support the Linux
version of VMware.
 1.34.2.9 29-May-2002  nathanw Regen.
 1.34.2.8 17-Apr-2002  nathanw Catch up to -current.
 1.34.2.7 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.34.2.6 28-Feb-2002  nathanw Catch up to -current.
 1.34.2.5 14-Nov-2001  nathanw Catch up to -current.
 1.34.2.4 08-Oct-2001  nathanw Catch up to -current.
 1.34.2.3 21-Jun-2001  nathanw Catch up to -current.
 1.34.2.2 09-Apr-2001  nathanw Catch up with -current.
 1.34.2.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.38.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.38.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.38.2.2 16-Mar-2002  jdolecek Catch up with -current.
 1.38.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.44.4.3 14-Jun-2004  jmc Regen for changes in ticket #1708
 1.44.4.2 11-May-2004  tron Regen for ticket 1686.
 1.44.4.1 22-Oct-2003  jmc Regen files (requested by tv in ticket #1427)

Proper support for mmap2
 1.47.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.47.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.47.2.4 24-Sep-2004  skrll Sync with HEAD.
 1.47.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.47.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.47.2.1 03-Aug-2004  skrll Sync with HEAD
 1.54.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.54.4.1 29-Apr-2005  kent sync with -current
 1.57.2.5 21-Jan-2008  yamt sync with head
 1.57.2.4 07-Dec-2007  yamt sync with head
 1.57.2.3 03-Sep-2007  yamt sync with head.
 1.57.2.2 30-Dec-2006  yamt sync with head.
 1.57.2.1 21-Jun-2006  yamt sync with head.
 1.62.14.1 19-Jun-2006  chap Sync with head.
 1.62.8.2 03-Sep-2006  yamt sync with head.
 1.62.8.1 26-Jun-2006  yamt sync with head.
 1.62.4.1 09-Sep-2006  rpaulo sync with head
 1.65.8.1 12-Mar-2007  rmind Sync with HEAD.
 1.66.4.1 11-Jul-2007  mjf Sync with head.
 1.66.2.1 15-Jul-2007  ad Sync with head.
 1.68.14.3 18-Feb-2008  mjf Sync with HEAD.
 1.68.14.2 27-Dec-2007  mjf Sync with HEAD.
 1.68.14.1 19-Nov-2007  mjf Sync with HEAD.
 1.68.12.1 18-Nov-2007  bouyer Sync with HEAD
 1.68.8.2 23-Mar-2008  matt sync with HEAD
 1.68.8.1 09-Jan-2008  matt sync with HEAD
 1.68.6.1 21-Nov-2007  joerg Sync with HEAD.
 1.69.6.2 19-Jan-2008  bouyer Sync with HEAD
 1.69.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.69.2.1 26-Dec-2007  ad Sync with head.
 1.73.8.3 20-Nov-2008  christos merge with head.
 1.73.8.2 01-Nov-2008  christos Sync with head.
 1.73.8.1 29-Mar-2008  christos Welcome to the time_t=long long dev_t=uint64_t branch.
 1.73.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.73.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.74.2.1 18-May-2008  yamt sync with head.
 1.75.8.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.75.4.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.75.2.4 11-Aug-2010  yamt sync with head.
 1.75.2.3 11-Mar-2010  yamt sync with head
 1.75.2.2 20-Jun-2009  yamt sync with head
 1.75.2.1 04-May-2009  yamt sync with head.
 1.77.4.1 20-Nov-2008  snj Regen for ticket 81.
 1.77.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.83.2.1 23-Jul-2009  jym Sync with HEAD.
 1.86.4.4 31-May-2011  rmind sync with head
 1.86.4.3 21-Apr-2011  rmind sync with head
 1.86.4.2 05-Mar-2011  rmind sync with head
 1.86.4.1 30-May-2010  rmind sync with head
 1.86.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.86.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.88.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.91.4.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.91.4.2 30-Oct-2012  yamt sync with head
 1.91.4.1 17-Apr-2012  yamt sync with head
 1.92.10.4 03-Dec-2017  jdolecek update from HEAD
 1.92.10.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.92.10.2 23-Jun-2013  tls resync from head
 1.92.10.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.94.4.1 18-May-2014  rmind sync with head
 1.97.2.1 10-Aug-2014  tls Rebase.
 1.103.2.1 17-Apr-2017  snj regen for ticket 1354
 1.104.2.4 28-Aug-2017  skrll Sync with HEAD
 1.104.2.3 05-Feb-2017  skrll Sync with HEAD
 1.104.2.2 05-Oct-2016  skrll Sync with HEAD
 1.104.2.1 06-Apr-2015  skrll Sync with HEAD
 1.107.2.3 20-Mar-2017  pgoyette Sync with HEAD
 1.107.2.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.107.2.1 26-Jul-2016  pgoyette Sync with HEAD
 1.111.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.112.4.1 11-May-2017  pgoyette Sync with HEAD
 1.113.10.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.113.10.1 10-Jun-2019  christos Sync with HEAD
 1.113.8.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.116.2.2 17-Dec-2020  thorpej Regen for preadv(2) and pwritev(2).
 1.116.2.1 15-Dec-2020  thorpej Regen for eventfd, timerfd, POSIX timers.
 1.127.2.1 02-Aug-2025  perseant Sync with HEAD
 1.130 28-Sep-2024  christos regen
 1.129 01-Jul-2024  christos regen
 1.128 29-Jun-2024  christos branches: 1.128.2;
regen
 1.127 19-Aug-2023  christos regen
 1.126 18-Aug-2023  christos regen
 1.125 29-Jul-2023  christos regen
 1.124 28-Jul-2023  christos regen
 1.123 10-Jul-2023  christos regen
 1.122 02-Dec-2021  ryo regen
 1.121 20-Sep-2021  thorpej Regen for preadv(2) / pwritev(2).
 1.120 20-Sep-2021  thorpej Regen for eventfd.
 1.119 19-Sep-2021  thorpej Regen for timerfd.
 1.118 19-Sep-2021  thorpej Regen for POSIX timer syscalls.
 1.117 26-Apr-2020  thorpej branches: 1.117.2;
Regen for native futex calls.
 1.116 09-Nov-2019  jdolecek regen
 1.115 10-Aug-2018  pgoyette Regen
 1.114 10-May-2017  riastradh branches: 1.114.8; 1.114.10;
regen
 1.113 16-Jan-2017  christos branches: 1.113.4;
regen all
 1.112 13-Jan-2017  christos branches: 1.112.2;
regen
 1.111 02-Jan-2017  martin Regen (something apparently went wrong in previous)
 1.110 02-Jan-2017  manu Regen
 1.109 24-Jul-2016  njoly Regen for readlink/readlinkat signatures.
 1.108 24-Sep-2015  christos branches: 1.108.2;
regen
 1.107 23-Mar-2015  ozaki-r Regen
 1.106 07-Mar-2015  christos regen
 1.105 22-Nov-2014  njoly branches: 1.105.2;
Regen for ppoll signature fix
 1.104 31-May-2014  njoly branches: 1.104.2;
Regen for munmap(2) signature.
 1.103 29-May-2014  njoly Regen for utimes(2) change.
 1.102 20-May-2014  njoly Regen for getgroups/setgroups update.
 1.101 17-May-2014  njoly Regen for fadvise64 offset types changes.
 1.100 04-May-2014  njoly Regen for pread/pwrite 64bit offset argument.
 1.99 08-Apr-2014  njoly Regen.
 1.98 18-Nov-2013  chs branches: 1.98.2;
regen
 1.97 07-Nov-2013  njoly Regen for dup/dup2/dup3 argument types fix.
 1.96 24-Sep-2013  njoly Regen for utimensat(2).
 1.95 08-Apr-2013  pooka branches: 1.95.4;
regen for utimes
 1.94 19-Sep-2012  pooka regen for ppoll (and, apparently, SYCALL_ARG_PTR)
 1.93 18-Nov-2011  christos branches: 1.93.10;
- add sigtimedwait support.
- merge the siginfo population code.
 1.92 30-May-2011  alnsn branches: 1.92.4;
Regenerate files to pick up correct RCS Ids. Suggested by Chris Badura.
 1.91 30-May-2011  alnsn Add fadvise64 and fadvise64_64 syscalls to compat_linux and compat_linux32.
 1.90 10-Apr-2011  christos Regen: Argh:
cat: rumphdr.types: No such file or directory
rm: rumphdr.types: No such file or directory
*** Error code 1
 1.89 07-Jul-2010  chs branches: 1.89.2;
regen
 1.88 23-Apr-2010  chs regen
 1.87 14-Dec-2009  matt branches: 1.87.2; 1.87.4;
Regen (new makesyscalls.sh)
 1.86 24-Nov-2009  njoly Regen for personality(2) update.
 1.85 08-Jun-2009  njoly Regen for rt_queueinfo(2) update.
 1.84 17-Jan-2009  njoly branches: 1.84.2;
Regen for wait4 update.
 1.83 13-Jan-2009  pooka Regen to prove I didn't screw up the conversion: purely RCSID changes.
 1.82 11-Jan-2009  christos merge christos-time_t
 1.81 19-Nov-2008  ad Regen.
 1.80 19-Nov-2008  njoly Regen for futex timeout argument cleanup/fix.
 1.79 12-Nov-2008  njoly Regen for nanosleep(2) fix.
 1.78 26-Oct-2008  christos branches: 1.78.2; 1.78.4;
regen
 1.77 26-Oct-2008  christos regen
 1.76 23-Apr-2008  ad branches: 1.76.2; 1.76.4; 1.76.8;
Regen.
 1.75 04-Apr-2008  njoly branches: 1.75.2;
Regen for linux_sys_msync removal.
 1.74 15-Jan-2008  njoly branches: 1.74.6; 1.74.8;
Regen.
 1.73 24-Dec-2007  njoly Regen for linux_sys_getpgid removal.
 1.72 21-Dec-2007  njoly Regen for getfsuid/setfsgid syscall exchange.
 1.71 20-Dec-2007  dsl regen
 1.70 16-Nov-2007  njoly branches: 1.70.2; 1.70.6;
Regen, for syscalls cleanup.
 1.69 13-Jun-2007  christos branches: 1.69.6; 1.69.8; 1.69.12; 1.69.14;
regen
 1.68 13-Jun-2007  christos regen.
 1.67 09-Feb-2007  ad branches: 1.67.6; 1.67.8;
Merge newlock2 to head.
 1.66 01-Sep-2006  matt branches: 1.66.2;
Regen.
 1.65 30-Aug-2006  matt Regen
 1.64 10-Jun-2006  christos regen
 1.63 11-Dec-2005  christos branches: 1.63.4; 1.63.8; 1.63.14;
merge ktrace-lwp.
 1.62 06-Nov-2005  manu regen
 1.61 06-Nov-2005  tron Regen with correct RCS Ids.
 1.60 05-Nov-2005  dogcow mirror manu's amd64 changes to implement linux sched_{seg,get}affinity;
the kernel and linux lkm now compile again.
 1.59 18-Oct-2005  joerg Regen.
 1.58 16-May-2005  fvdl branches: 1.58.2;
Regen.
 1.57 16-May-2005  fvdl Regen.
 1.56 26-Feb-2005  perry regen
 1.55 20-Sep-2004  jdolecek branches: 1.55.4; 1.55.6;
regen:
implement support for Linux statfs64() syscall - 64bit variant of statfs()
 1.54 08-Sep-2004  jdolecek regen: add exit_group(2)
 1.53 01-Aug-2004  jdolecek regen - sync syscall lists with Linux kernel 2.6.7
 1.52 01-Aug-2004  jdolecek regen:

connect madvise(2) and mincore(2) - apparently the newer Linux libs
don't stub it anymore, so allow the application to take advantage
of them

the Linux calls appear to be compatible in the flag values and semantics,
so a wrapper is not necessary
 1.51 01-Aug-2004  jdolecek connect madvise(2) and mincore(2) - apparently the newer Linux libs
don't stub it anymore, so allow the application to take advantage
of them

the Linux calls appear to be compatible in the flag values and semantics,
so a wrapper is not necessary
 1.50 10-Aug-2003  jdolecek regen - added wrapper for Linux ftruncate64()
 1.49 03-Jul-2003  christos Regen.
 1.48 23-Jun-2003  christos branches: 1.48.2;
Regen.
 1.47 18-Jan-2003  thorpej Regen for correct RCS IDs.
 1.46 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.45 10-Apr-2002  christos branches: 1.45.4;
regen
 1.44 22-Mar-2002  christos regen
 1.43 15-Feb-2002  christos regen
 1.42 15-Feb-2002  christos - add a real linux_sys___sysctl because the mib numbers are different.
implement only the kernel version getting entries.
- make the signal conversion functions consistent; dest is arg 1.
- make linux_fakedev deal with block and char devices differently.
- add linux_sys_ugetrlimit, and flesh out the regular get/setrlimit so
that they work properly.
- add linux_mmap2 [untested].
- bump kernel to 2.4.18, and make the date be valentine's day :-)
- linux_sys_*stat64 family was totally busted. Fix it.

tested only on i386.

Status:
gdb, telnet, work
jdk-1.4.0 extractor works, jdk still coredumps.

christos
 1.41 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.40 30-Sep-2001  manu Fixes my last commit: only mips really need fcntl64 to work now. i386 and
powerpc could use it later if needed. m68k and alpha should never need it.
 1.39 30-May-2001  mrg branches: 1.39.2; 1.39.4;
use _KERNEL_OPT.
 1.38 13-May-2001  manu Improved the accuracy of gettimeofday/settimeofday: Linux stores a srtuct
timezone in the kernel. We now keep track of it for emulated processes.
Tested for powerpc and i386. Untested on m68k, but it should be ok
Alpha has a particular implementation (osf1_sys_gettimeofday), and it has
therefore not been touched.
 1.37 30-Mar-2001  jdolecek regen
 1.36 30-Mar-2001  jdolecek regen
 1.35 27-Jan-2001  thorpej branches: 1.35.2;
Regen; getpid(2) is MP-safe.
 1.34 27-Jan-2001  thorpej Regen; add sy_flags.
 1.33 29-Dec-2000  fvdl Regen.
 1.32 27-Dec-2000  fvdl Regen.
 1.31 18-Dec-2000  fvdl Regen.
 1.30 13-Dec-2000  augustss Regen.
 1.29 12-Dec-2000  jdolecek regen
 1.28 12-Dec-2000  jdolecek regen
 1.27 11-Dec-2000  mycroft Regen.
 1.26 09-Dec-2000  jdolecek regen
 1.25 09-Dec-2000  mycroft Regen.
 1.24 02-Dec-2000  jdolecek regen after addition of linux_sys_swapoff()
 1.23 01-Dec-2000  jdolecek regen
 1.22 13-Nov-2000  jdolecek change the type of *syscallnames[] array to 'const char * const foo[]'
 1.21 01-Nov-2000  jdolecek regen
 1.20 23-Aug-2000  christos regen
 1.19 18-Aug-2000  cgd update for changed makesyscalls.master
 1.18 18-Aug-2000  cgd update for new makesyscalls.sh, and also for correct ids for changed
syscalls.master files. (you need to regenerate after checking in
syscalls.master to get the correct ids.)
 1.17 18-Mar-2000  erh branches: 1.17.4;
Regen.
 1.16 03-Feb-2000  abs regen
 1.15 12-Dec-1999  tron Regen.
 1.14 05-Dec-1999  tron Regen.
 1.13 04-Dec-1999  tron Regen.
 1.12 04-Oct-1999  tron branches: 1.12.2; 1.12.8;
Regen from "syscalls.master".
 1.11 16-Aug-1999  tron Regen.
 1.10 14-May-1999  thorpej Regen.
 1.9 13-May-1999  thorpej Regen.
 1.8 30-Mar-1999  abs branches: 1.8.2; 1.8.4;
Regenerate (with poll())
 1.7 27-Mar-1999  tron Regen.
 1.6 23-Mar-1999  thorpej Regen; pread(2) and pwrite(2).
 1.5 09-Feb-1999  christos Regen
 1.4 10-Dec-1998  christos Regen
 1.3 04-Oct-1998  fvdl Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.2 03-Oct-1998  christos Attempt to fix the mess.
 1.1 01-Oct-1998  erh Regen.
 1.8.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.8.2.2 15-Aug-2000  he Pull up regenerated files (requested by abs):
Enable basic versions of Linux fsuid calls.
 1.8.2.1 31-Jan-2000  he Pull up generated files (requested by abs):
Enable emulation of vfork(2).
 1.12.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.12.2.7 21-Apr-2001  bouyer Sync with HEAD
 1.12.2.6 11-Feb-2001  bouyer Sync with HEAD.
 1.12.2.5 05-Jan-2001  bouyer Sync with HEAD
 1.12.2.4 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.12.2.3 08-Dec-2000  bouyer Sync with HEAD.
 1.12.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.12.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.17.4.2 01-May-2001  he Pull up regenerated files (requested by jdolecek):
Make it possible to use a different function for unimplemented
syscalls than sys_nosys(), so that the Linux emulation can avoid
posting SIGSYS and instead just return ENOSYS.
 1.17.4.1 30-Mar-2001  he Pull up regenerated files (requested by fvdl):
Add some required Linux emulation bits to support the Linux
version of VMware.
 1.35.2.9 29-May-2002  nathanw Regen.
 1.35.2.8 17-Apr-2002  nathanw Catch up to -current.
 1.35.2.7 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.35.2.6 28-Feb-2002  nathanw Catch up to -current.
 1.35.2.5 14-Nov-2001  nathanw Catch up to -current.
 1.35.2.4 08-Oct-2001  nathanw Catch up to -current.
 1.35.2.3 21-Jun-2001  nathanw Catch up to -current.
 1.35.2.2 09-Apr-2001  nathanw Catch up with -current.
 1.35.2.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.39.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.39.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.39.2.2 16-Mar-2002  jdolecek Catch up with -current.
 1.39.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.45.4.3 14-Jun-2004  jmc Regen for changes in ticket #1708
 1.45.4.2 11-May-2004  tron Regen for ticket 1686.
 1.45.4.1 22-Oct-2003  jmc Regen files (requested by tv in ticket #1427)

Proper support for mmap2
 1.48.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.48.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.48.2.4 24-Sep-2004  skrll Sync with HEAD.
 1.48.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.48.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.48.2.1 03-Aug-2004  skrll Sync with HEAD
 1.55.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.55.4.1 29-Apr-2005  kent sync with -current
 1.58.2.6 21-Jan-2008  yamt sync with head
 1.58.2.5 07-Dec-2007  yamt sync with head
 1.58.2.4 03-Sep-2007  yamt sync with head.
 1.58.2.3 26-Feb-2007  yamt sync with head.
 1.58.2.2 30-Dec-2006  yamt sync with head.
 1.58.2.1 21-Jun-2006  yamt sync with head.
 1.63.14.1 19-Jun-2006  chap Sync with head.
 1.63.8.2 03-Sep-2006  yamt sync with head.
 1.63.8.1 26-Jun-2006  yamt sync with head.
 1.63.4.1 09-Sep-2006  rpaulo sync with head
 1.66.2.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.67.8.1 11-Jul-2007  mjf Sync with head.
 1.67.6.1 15-Jul-2007  ad Sync with head.
 1.69.14.3 18-Feb-2008  mjf Sync with HEAD.
 1.69.14.2 27-Dec-2007  mjf Sync with HEAD.
 1.69.14.1 19-Nov-2007  mjf Sync with HEAD.
 1.69.12.1 18-Nov-2007  bouyer Sync with HEAD
 1.69.8.2 23-Mar-2008  matt sync with HEAD
 1.69.8.1 09-Jan-2008  matt sync with HEAD
 1.69.6.1 21-Nov-2007  joerg Sync with HEAD.
 1.70.6.2 19-Jan-2008  bouyer Sync with HEAD
 1.70.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.70.2.1 26-Dec-2007  ad Sync with head.
 1.74.8.3 20-Nov-2008  christos merge with head.
 1.74.8.2 01-Nov-2008  christos Sync with head.
 1.74.8.1 29-Mar-2008  christos Welcome to the time_t=long long dev_t=uint64_t branch.
 1.74.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.74.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.75.2.1 18-May-2008  yamt sync with head.
 1.76.8.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.76.4.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.76.4.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.76.2.4 11-Aug-2010  yamt sync with head.
 1.76.2.3 11-Mar-2010  yamt sync with head
 1.76.2.2 20-Jun-2009  yamt sync with head
 1.76.2.1 04-May-2009  yamt sync with head.
 1.78.4.1 20-Nov-2008  snj Regen for ticket 81.
 1.78.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.84.2.1 23-Jul-2009  jym Sync with HEAD.
 1.87.4.4 31-May-2011  rmind sync with head
 1.87.4.3 21-Apr-2011  rmind sync with head
 1.87.4.2 05-Mar-2011  rmind sync with head
 1.87.4.1 30-May-2010  rmind sync with head
 1.87.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.87.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.89.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.92.4.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.92.4.2 30-Oct-2012  yamt sync with head
 1.92.4.1 17-Apr-2012  yamt sync with head
 1.93.10.4 03-Dec-2017  jdolecek update from HEAD
 1.93.10.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.93.10.2 23-Jun-2013  tls resync from head
 1.93.10.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.95.4.1 18-May-2014  rmind sync with head
 1.98.2.1 10-Aug-2014  tls Rebase.
 1.104.2.1 17-Apr-2017  snj regen for ticket 1354
 1.105.2.4 05-Feb-2017  skrll Sync with HEAD
 1.105.2.3 05-Oct-2016  skrll Sync with HEAD
 1.105.2.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.105.2.1 06-Apr-2015  skrll Sync with HEAD
 1.108.2.3 20-Mar-2017  pgoyette Sync with HEAD
 1.108.2.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.108.2.1 26-Jul-2016  pgoyette Sync with HEAD
 1.112.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.113.4.1 11-May-2017  pgoyette Sync with HEAD
 1.114.10.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.114.10.1 10-Jun-2019  christos Sync with HEAD
 1.114.8.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.117.2.2 17-Dec-2020  thorpej Regen for preadv(2) and pwritev(2).
 1.117.2.1 15-Dec-2020  thorpej Regen for eventfd, timerfd, POSIX timers.
 1.128.2.1 02-Aug-2025  perseant Sync with HEAD
 1.129 28-Sep-2024  christos regen
 1.128 01-Jul-2024  christos regen
 1.127 29-Jun-2024  christos branches: 1.127.2;
regen
 1.126 19-Aug-2023  christos regen
 1.125 18-Aug-2023  christos regen
 1.124 29-Jul-2023  christos regen
 1.123 28-Jul-2023  christos regen
 1.122 10-Jul-2023  christos regen
 1.121 02-Dec-2021  ryo regen
 1.120 20-Sep-2021  thorpej Regen for preadv(2) / pwritev(2).
 1.119 20-Sep-2021  thorpej Regen for eventfd.
 1.118 19-Sep-2021  thorpej Regen for timerfd.
 1.117 19-Sep-2021  thorpej Regen for POSIX timer syscalls.
 1.116 26-Apr-2020  thorpej branches: 1.116.2;
Regen for native futex calls.
 1.115 09-Nov-2019  jdolecek regen
 1.114 10-Aug-2018  pgoyette Regen
 1.113 10-May-2017  riastradh branches: 1.113.8; 1.113.10;
regen
 1.112 16-Jan-2017  christos branches: 1.112.4;
regen all
 1.111 13-Jan-2017  christos branches: 1.111.2;
regen
 1.110 02-Jan-2017  martin Regen (something apparently went wrong in previous)
 1.109 02-Jan-2017  manu Regen
 1.108 24-Jul-2016  njoly Regen for readlink/readlinkat signatures.
 1.107 24-Sep-2015  christos branches: 1.107.2;
regen
 1.106 23-Mar-2015  ozaki-r Regen
 1.105 07-Mar-2015  christos regen
 1.104 22-Nov-2014  njoly branches: 1.104.2;
Regen for ppoll signature fix
 1.103 31-May-2014  njoly branches: 1.103.2;
Regen for munmap(2) signature.
 1.102 29-May-2014  njoly Regen for utimes(2) change.
 1.101 20-May-2014  njoly Regen for getgroups/setgroups update.
 1.100 17-May-2014  njoly Regen for fadvise64 offset types changes.
 1.99 04-May-2014  njoly Regen for pread/pwrite 64bit offset argument.
 1.98 08-Apr-2014  njoly Regen.
 1.97 18-Nov-2013  chs branches: 1.97.2;
regen
 1.96 07-Nov-2013  njoly Regen for dup/dup2/dup3 argument types fix.
 1.95 24-Sep-2013  njoly Regen for utimensat(2).
 1.94 08-Apr-2013  pooka branches: 1.94.4;
regen for utimes
 1.93 19-Sep-2012  pooka regen for ppoll (and, apparently, SYCALL_ARG_PTR)
 1.92 18-Nov-2011  christos branches: 1.92.10;
- add sigtimedwait support.
- merge the siginfo population code.
 1.91 30-May-2011  alnsn branches: 1.91.4;
Regenerate files to pick up correct RCS Ids. Suggested by Chris Badura.
 1.90 30-May-2011  alnsn Add fadvise64 and fadvise64_64 syscalls to compat_linux and compat_linux32.
 1.89 10-Apr-2011  christos Regen: Argh:
cat: rumphdr.types: No such file or directory
rm: rumphdr.types: No such file or directory
*** Error code 1
 1.88 07-Jul-2010  chs branches: 1.88.2;
regen
 1.87 23-Apr-2010  chs regen
 1.86 14-Dec-2009  matt branches: 1.86.2; 1.86.4;
Regen (new makesyscalls.sh)
 1.85 24-Nov-2009  njoly Regen for personality(2) update.
 1.84 08-Jun-2009  njoly Regen for rt_queueinfo(2) update.
 1.83 17-Jan-2009  njoly branches: 1.83.2;
Regen for wait4 update.
 1.82 13-Jan-2009  pooka Regen to prove I didn't screw up the conversion: purely RCSID changes.
 1.81 11-Jan-2009  christos merge christos-time_t
 1.80 19-Nov-2008  ad Regen.
 1.79 19-Nov-2008  njoly Regen for futex timeout argument cleanup/fix.
 1.78 12-Nov-2008  njoly Regen for nanosleep(2) fix.
 1.77 26-Oct-2008  christos branches: 1.77.2; 1.77.4;
regen
 1.76 26-Oct-2008  christos regen
 1.75 23-Apr-2008  ad branches: 1.75.2; 1.75.4; 1.75.8;
Regen.
 1.74 04-Apr-2008  njoly branches: 1.74.2;
Regen for linux_sys_msync removal.
 1.73 15-Jan-2008  njoly branches: 1.73.6; 1.73.8;
Regen.
 1.72 24-Dec-2007  njoly Regen for linux_sys_getpgid removal.
 1.71 21-Dec-2007  njoly Regen for getfsuid/setfsgid syscall exchange.
 1.70 20-Dec-2007  dsl regen
 1.69 16-Nov-2007  njoly branches: 1.69.2; 1.69.6;
Regen, for syscalls cleanup.
 1.68 13-Jun-2007  christos branches: 1.68.6; 1.68.8; 1.68.12; 1.68.14;
regen
 1.67 13-Jun-2007  christos regen.
 1.66 09-Feb-2007  ad branches: 1.66.6; 1.66.8;
Merge newlock2 to head.
 1.65 01-Sep-2006  matt branches: 1.65.2;
Regen.
 1.64 30-Aug-2006  matt Regen
 1.63 10-Jun-2006  christos regen
 1.62 11-Dec-2005  christos branches: 1.62.4; 1.62.8; 1.62.14;
merge ktrace-lwp.
 1.61 06-Nov-2005  manu regen
 1.60 06-Nov-2005  tron Regen with correct RCS Ids.
 1.59 05-Nov-2005  dogcow mirror manu's amd64 changes to implement linux sched_{seg,get}affinity;
the kernel and linux lkm now compile again.
 1.58 18-Oct-2005  joerg Regen.
 1.57 16-May-2005  fvdl branches: 1.57.2;
Regen.
 1.56 16-May-2005  fvdl Regen.
 1.55 26-Feb-2005  perry regen
 1.54 20-Sep-2004  jdolecek branches: 1.54.4; 1.54.6;
regen:
implement support for Linux statfs64() syscall - 64bit variant of statfs()
 1.53 08-Sep-2004  jdolecek regen: add exit_group(2)
 1.52 01-Aug-2004  jdolecek regen - sync syscall lists with Linux kernel 2.6.7
 1.51 01-Aug-2004  jdolecek regen:

connect madvise(2) and mincore(2) - apparently the newer Linux libs
don't stub it anymore, so allow the application to take advantage
of them

the Linux calls appear to be compatible in the flag values and semantics,
so a wrapper is not necessary
 1.50 01-Aug-2004  jdolecek connect madvise(2) and mincore(2) - apparently the newer Linux libs
don't stub it anymore, so allow the application to take advantage
of them

the Linux calls appear to be compatible in the flag values and semantics,
so a wrapper is not necessary
 1.49 10-Aug-2003  jdolecek regen - added wrapper for Linux ftruncate64()
 1.48 03-Jul-2003  christos Regen.
 1.47 23-Jun-2003  christos branches: 1.47.2;
Regen.
 1.46 18-Jan-2003  thorpej Regen for correct RCS IDs.
 1.45 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.44 10-Apr-2002  christos branches: 1.44.4;
regen
 1.43 22-Mar-2002  christos regen
 1.42 15-Feb-2002  christos regen
 1.41 15-Feb-2002  christos - add a real linux_sys___sysctl because the mib numbers are different.
implement only the kernel version getting entries.
- make the signal conversion functions consistent; dest is arg 1.
- make linux_fakedev deal with block and char devices differently.
- add linux_sys_ugetrlimit, and flesh out the regular get/setrlimit so
that they work properly.
- add linux_mmap2 [untested].
- bump kernel to 2.4.18, and make the date be valentine's day :-)
- linux_sys_*stat64 family was totally busted. Fix it.

tested only on i386.

Status:
gdb, telnet, work
jdk-1.4.0 extractor works, jdk still coredumps.

christos
 1.40 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.39 30-Sep-2001  manu Fixes my last commit: only mips really need fcntl64 to work now. i386 and
powerpc could use it later if needed. m68k and alpha should never need it.
 1.38 30-May-2001  mrg branches: 1.38.2; 1.38.4;
use _KERNEL_OPT.
 1.37 13-May-2001  manu Improved the accuracy of gettimeofday/settimeofday: Linux stores a srtuct
timezone in the kernel. We now keep track of it for emulated processes.
Tested for powerpc and i386. Untested on m68k, but it should be ok
Alpha has a particular implementation (osf1_sys_gettimeofday), and it has
therefore not been touched.
 1.36 30-Mar-2001  jdolecek regen
 1.35 30-Mar-2001  jdolecek regen
 1.34 27-Jan-2001  thorpej branches: 1.34.2;
Regen; getpid(2) is MP-safe.
 1.33 27-Jan-2001  thorpej Regen; add sy_flags.
 1.32 29-Dec-2000  fvdl Regen.
 1.31 27-Dec-2000  fvdl Regen.
 1.30 18-Dec-2000  fvdl Regen.
 1.29 13-Dec-2000  augustss Regen.
 1.28 12-Dec-2000  jdolecek regen
 1.27 12-Dec-2000  jdolecek regen
 1.26 11-Dec-2000  mycroft Regen.
 1.25 09-Dec-2000  jdolecek regen
 1.24 09-Dec-2000  mycroft Regen.
 1.23 02-Dec-2000  jdolecek regen after addition of linux_sys_swapoff()
 1.22 01-Dec-2000  jdolecek regen
 1.21 01-Nov-2000  jdolecek regen
 1.20 23-Aug-2000  christos regen
 1.19 18-Aug-2000  cgd update for changed makesyscalls.master
 1.18 18-Aug-2000  cgd update for new makesyscalls.sh, and also for correct ids for changed
syscalls.master files. (you need to regenerate after checking in
syscalls.master to get the correct ids.)
 1.17 18-Mar-2000  erh branches: 1.17.4;
Regen.
 1.16 03-Feb-2000  abs regen
 1.15 12-Dec-1999  tron Regen.
 1.14 05-Dec-1999  tron Regen.
 1.13 04-Dec-1999  tron Regen.
 1.12 04-Oct-1999  tron branches: 1.12.2; 1.12.8;
Regen from "syscalls.master".
 1.11 16-Aug-1999  tron Regen.
 1.10 14-May-1999  thorpej Regen.
 1.9 13-May-1999  thorpej Regen.
 1.8 30-Mar-1999  abs branches: 1.8.2; 1.8.4;
Regenerate (with poll())
 1.7 27-Mar-1999  tron Regen.
 1.6 23-Mar-1999  thorpej Regen; pread(2) and pwrite(2).
 1.5 09-Feb-1999  christos Regen
 1.4 10-Dec-1998  christos Regen
 1.3 04-Oct-1998  fvdl Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.2 03-Oct-1998  christos Attempt to fix the mess.
 1.1 01-Oct-1998  erh Regen.
 1.8.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.8.2.2 15-Aug-2000  he Pull up regenerated files (requested by abs):
Enable basic versions of Linux fsuid calls.
 1.8.2.1 31-Jan-2000  he Pull up generated files (requested by abs):
Enable emulation of vfork(2).
 1.12.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.12.2.7 21-Apr-2001  bouyer Sync with HEAD
 1.12.2.6 11-Feb-2001  bouyer Sync with HEAD.
 1.12.2.5 05-Jan-2001  bouyer Sync with HEAD
 1.12.2.4 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.12.2.3 08-Dec-2000  bouyer Sync with HEAD.
 1.12.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.12.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.17.4.2 01-May-2001  he Pull up regenerated files (requested by jdolecek):
Make it possible to use a different function for unimplemented
syscalls than sys_nosys(), so that the Linux emulation can avoid
posting SIGSYS and instead just return ENOSYS.
 1.17.4.1 30-Mar-2001  he Pull up regenerated files (requested by fvdl):
Add some required Linux emulation bits to support the Linux
version of VMware.
 1.34.2.9 29-May-2002  nathanw Regen.
 1.34.2.8 17-Apr-2002  nathanw Catch up to -current.
 1.34.2.7 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.34.2.6 28-Feb-2002  nathanw Catch up to -current.
 1.34.2.5 14-Nov-2001  nathanw Catch up to -current.
 1.34.2.4 08-Oct-2001  nathanw Catch up to -current.
 1.34.2.3 21-Jun-2001  nathanw Catch up to -current.
 1.34.2.2 09-Apr-2001  nathanw Catch up with -current.
 1.34.2.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.38.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.38.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.38.2.2 16-Mar-2002  jdolecek Catch up with -current.
 1.38.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.44.4.3 14-Jun-2004  jmc Regen for changes in ticket #1708
 1.44.4.2 11-May-2004  tron Regen for ticket 1686.
 1.44.4.1 22-Oct-2003  jmc Regen files (requested by tv in ticket #1427)

Proper support for mmap2
 1.47.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.47.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.47.2.4 24-Sep-2004  skrll Sync with HEAD.
 1.47.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.47.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.47.2.1 03-Aug-2004  skrll Sync with HEAD
 1.54.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.54.4.1 29-Apr-2005  kent sync with -current
 1.57.2.6 21-Jan-2008  yamt sync with head
 1.57.2.5 07-Dec-2007  yamt sync with head
 1.57.2.4 03-Sep-2007  yamt sync with head.
 1.57.2.3 26-Feb-2007  yamt sync with head.
 1.57.2.2 30-Dec-2006  yamt sync with head.
 1.57.2.1 21-Jun-2006  yamt sync with head.
 1.62.14.1 19-Jun-2006  chap Sync with head.
 1.62.8.2 03-Sep-2006  yamt sync with head.
 1.62.8.1 26-Jun-2006  yamt sync with head.
 1.62.4.1 09-Sep-2006  rpaulo sync with head
 1.65.2.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.66.8.1 11-Jul-2007  mjf Sync with head.
 1.66.6.1 15-Jul-2007  ad Sync with head.
 1.68.14.3 18-Feb-2008  mjf Sync with HEAD.
 1.68.14.2 27-Dec-2007  mjf Sync with HEAD.
 1.68.14.1 19-Nov-2007  mjf Sync with HEAD.
 1.68.12.1 18-Nov-2007  bouyer Sync with HEAD
 1.68.8.2 23-Mar-2008  matt sync with HEAD
 1.68.8.1 09-Jan-2008  matt sync with HEAD
 1.68.6.1 21-Nov-2007  joerg Sync with HEAD.
 1.69.6.2 19-Jan-2008  bouyer Sync with HEAD
 1.69.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.69.2.1 26-Dec-2007  ad Sync with head.
 1.73.8.3 20-Nov-2008  christos merge with head.
 1.73.8.2 01-Nov-2008  christos Sync with head.
 1.73.8.1 29-Mar-2008  christos Welcome to the time_t=long long dev_t=uint64_t branch.
 1.73.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.73.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.74.2.1 18-May-2008  yamt sync with head.
 1.75.8.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.75.4.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.75.4.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.75.2.4 11-Aug-2010  yamt sync with head.
 1.75.2.3 11-Mar-2010  yamt sync with head
 1.75.2.2 20-Jun-2009  yamt sync with head
 1.75.2.1 04-May-2009  yamt sync with head.
 1.77.4.1 20-Nov-2008  snj Regen for ticket 81.
 1.77.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.83.2.1 23-Jul-2009  jym Sync with HEAD.
 1.86.4.4 31-May-2011  rmind sync with head
 1.86.4.3 21-Apr-2011  rmind sync with head
 1.86.4.2 05-Mar-2011  rmind sync with head
 1.86.4.1 30-May-2010  rmind sync with head
 1.86.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.86.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.88.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.91.4.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.91.4.2 30-Oct-2012  yamt sync with head
 1.91.4.1 17-Apr-2012  yamt sync with head
 1.92.10.4 03-Dec-2017  jdolecek update from HEAD
 1.92.10.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.92.10.2 23-Jun-2013  tls resync from head
 1.92.10.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.94.4.1 18-May-2014  rmind sync with head
 1.97.2.1 10-Aug-2014  tls Rebase.
 1.103.2.1 17-Apr-2017  snj regen for ticket 1354
 1.104.2.3 05-Feb-2017  skrll Sync with HEAD
 1.104.2.2 05-Oct-2016  skrll Sync with HEAD
 1.104.2.1 06-Apr-2015  skrll Sync with HEAD
 1.107.2.3 20-Mar-2017  pgoyette Sync with HEAD
 1.107.2.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.107.2.1 26-Jul-2016  pgoyette Sync with HEAD
 1.111.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.112.4.1 11-May-2017  pgoyette Sync with HEAD
 1.113.10.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.113.10.1 10-Jun-2019  christos Sync with HEAD
 1.113.8.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.116.2.2 17-Dec-2020  thorpej Regen for preadv(2) and pwritev(2).
 1.116.2.1 15-Dec-2020  thorpej Regen for eventfd, timerfd, POSIX timers.
 1.127.2.1 02-Aug-2025  perseant Sync with HEAD
 1.24 28-Sep-2024  christos regen
 1.23 01-Jul-2024  christos regen
 1.22 29-Jun-2024  christos branches: 1.22.2;
regen
 1.21 19-Aug-2023  christos regen
 1.20 18-Aug-2023  christos regen
 1.19 29-Jul-2023  christos regen
 1.18 28-Jul-2023  christos regen
 1.17 10-Jul-2023  christos regen
 1.16 02-Dec-2021  ryo regen
 1.15 20-Sep-2021  thorpej Regen for preadv(2) / pwritev(2).
 1.14 20-Sep-2021  thorpej Regen for eventfd.
 1.13 19-Sep-2021  thorpej Regen for timerfd.
 1.12 19-Sep-2021  thorpej Regen for POSIX timer syscalls.
 1.11 26-Apr-2020  thorpej branches: 1.11.2;
Regen for native futex calls.
 1.10 09-Nov-2019  jdolecek regen
 1.9 10-Aug-2018  pgoyette Regen
 1.8 10-May-2017  riastradh branches: 1.8.8; 1.8.10; 1.8.12;
regen
 1.7 16-Jan-2017  christos branches: 1.7.4;
regen all
 1.6 13-Jan-2017  christos branches: 1.6.2;
regen
 1.5 02-Jan-2017  martin Regen (something apparently went wrong in previous)
 1.4 24-Jul-2016  njoly Regen for readlink/readlinkat signatures.
 1.3 24-Sep-2015  christos branches: 1.3.2;
regen
 1.2 23-Mar-2015  ozaki-r branches: 1.2.2;
Regen
 1.1 07-Mar-2015  christos regen
 1.2.2.4 05-Feb-2017  skrll Sync with HEAD
 1.2.2.3 05-Oct-2016  skrll Sync with HEAD
 1.2.2.2 06-Apr-2015  skrll Sync with HEAD
 1.2.2.1 23-Mar-2015  skrll file linux_systrace_args.c was added on branch nick-nhusb on 2015-04-06 15:18:06 +0000
 1.3.2.3 20-Mar-2017  pgoyette Sync with HEAD
 1.3.2.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.3.2.1 26-Jul-2016  pgoyette Sync with HEAD
 1.6.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.7.4.1 11-May-2017  pgoyette Sync with HEAD
 1.8.12.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.8.12.1 10-Jun-2019  christos Sync with HEAD
 1.8.10.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.8.8.2 03-Dec-2017  jdolecek update from HEAD
 1.8.8.1 10-May-2017  jdolecek file linux_systrace_args.c was added on branch tls-maxphys on 2017-12-03 11:36:54 +0000
 1.11.2.2 17-Dec-2020  thorpej Regen for preadv(2) and pwritev(2).
 1.11.2.1 15-Dec-2020  thorpej Regen for eventfd, timerfd, POSIX timers.
 1.22.2.1 02-Aug-2025  perseant Sync with HEAD
 1.10 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.9 26-Mar-2007  njoly branches: 1.9.30; 1.9.32; 1.9.34;
Update i386 LINUX_{TIOCGPTN,TIOCSPTLCK} definitions for latest
linux_ioctl_termios() changes.
 1.8 22-Sep-2006  christos branches: 1.8.4; 1.8.8; 1.8.10; 1.8.12;
Pretend to implement TIOCSPTLCK. Although failing is harmless, there is no
point in doing so.
 1.7 11-Dec-2005  christos branches: 1.7.20; 1.7.22;
merge ktrace-lwp.
 1.6 13-Nov-2004  christos branches: 1.6.12;
add LINUX_TIOCGPTN
 1.5 26-Aug-2001  manu branches: 1.5.20;
Moved LINUX_NCCS from MI file to MD file, because the value is different
on MIPS and sparc machines.
 1.4 20-Jan-2001  manu branches: 1.4.2; 1.4.4;
Moved architecure dependent part of struct linux_termio to architecture
dependent header files.
 1.3 01-Oct-1998  erh branches: 1.3.12;
Split compat/linux/linux_termios.h into i386 and common parts.
 1.2 05-Jan-1998  perry RCSID Police.
 1.1 08-Mar-1996  mycroft Separate ioctl emulation by group. Add (minimal) audio emulation.
 1.3.12.1 11-Feb-2001  bouyer Sync with HEAD.
 1.4.4.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.4.2.1 21-Sep-2001  nathanw Catch up to -current.
 1.5.20.1 14-Nov-2004  skrll Sync with HEAD.
 1.6.12.2 03-Sep-2007  yamt sync with head.
 1.6.12.1 30-Dec-2006  yamt sync with head.
 1.7.22.1 22-Oct-2006  yamt sync with head
 1.7.20.1 18-Nov-2006  ad Sync with head.
 1.8.12.1 29-Mar-2007  reinoud Pullup to -current
 1.8.10.1 11-Jul-2007  mjf Sync with head.
 1.8.8.1 10-Apr-2007  ad Sync with head.
 1.8.4.1 15-Apr-2007  yamt sync with head.
 1.9.34.1 16-May-2008  yamt sync with head.
 1.9.32.1 18-May-2008  yamt sync with head.
 1.9.30.1 02-Jun-2008  mjf Sync with HEAD.
 1.17 11-Jan-2009  christos merge christos-time_t
 1.16 28-Apr-2008  martin branches: 1.16.8;
Remove clause 3 and 4 from TNF licenses
 1.15 11-Dec-2005  christos branches: 1.15.70; 1.15.72; 1.15.74; 1.15.76;
merge ktrace-lwp.
 1.14 10-Mar-2005  christos revert part of previous commit (the block size type and the pad renumbering).
tron says it breaks compat mode.
 1.13 10-Mar-2005  christos Add nanosecond handling on the stat and stat64 code for the i386.
 1.12 20-Sep-2004  jdolecek branches: 1.12.4; 1.12.6;
move definition of linux_fsid_t to common/linux_types.h - it's identical
across all Linux archs
 1.11 19-Sep-2004  jdolecek move definition of struct linux_stafs to common/linux_types.h, and use
explicit size types - the structure definition is actually identical
on currently support COMPAT_LINUX archs, so no point to have 6 copies of it
in the tree
 1.10 19-May-2002  jdolecek branches: 1.10.8;
On archs with broken linux struct stat64 st_ino, rename linux_stat64's
lst_ino to __lst_ino and lst_ino64 to lst_ino, and define
LINUX_STAT64_HAS_BROKEN_ST_INO. Only assign __lst_ino if this define
is present.

This fixes compile on powerpc archs, and hence port-powerpc/16893.
 1.9 15-Feb-2002  christos branches: 1.9.8;
- add a real linux_sys___sysctl because the mib numbers are different.
implement only the kernel version getting entries.
- make the signal conversion functions consistent; dest is arg 1.
- make linux_fakedev deal with block and char devices differently.
- add linux_sys_ugetrlimit, and flesh out the regular get/setrlimit so
that they work properly.
- add linux_mmap2 [untested].
- bump kernel to 2.4.18, and make the date be valentine's day :-)
- linux_sys_*stat64 family was totally busted. Fix it.

tested only on i386.

Status:
gdb, telnet, work
jdk-1.4.0 extractor works, jdk still coredumps.

christos
 1.8 12-Dec-2000  jdolecek branches: 1.8.2; 1.8.4;
define struct linux_stat64 used by linux_sys_*stat64()
 1.7 04-Oct-1998  fvdl branches: 1.7.12;
Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.6 01-Oct-1998  erh Split linux_types.h into i386, common and multi-architechture parts.
 1.5 20-May-1996  fvdl Update list of Linux syscalls and implement the ones that are likely to be
used and doable.
 1.4 21-Aug-1995  mycroft Implement the old and older uname(2) calls.
 1.3 14-Aug-1995  mycroft Move signal types into signal.h.
 1.2 05-Mar-1995  fvdl Added a few more system calls.
More consistent alternate root file semantics throughout.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.7.12.1 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.8.4.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.8.4.1 16-Mar-2002  jdolecek Catch up with -current.
 1.8.2.2 20-Jun-2002  nathanw Catch up to -current.
 1.8.2.1 28-Feb-2002  nathanw Catch up to -current.
 1.9.8.1 30-May-2002  gehenna Catch up with -current.
 1.10.8.2 01-Apr-2005  skrll Sync with HEAD.
 1.10.8.1 24-Sep-2004  skrll Sync with HEAD.
 1.12.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.12.4.1 29-Apr-2005  kent sync with -current
 1.15.76.2 04-May-2009  yamt sync with head.
 1.15.76.1 16-May-2008  yamt sync with head.
 1.15.74.1 18-May-2008  yamt sync with head.
 1.15.72.3 30-Dec-2008  christos it is suseconds_t we want.
 1.15.72.2 01-Nov-2008  christos Sync with head.
 1.15.72.1 29-Mar-2008  christos Welcome to the time_t=long long dev_t=uint64_t branch.
 1.15.70.2 17-Jan-2009  mjf Sync with HEAD.
 1.15.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.16.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.7 07-Mar-2015  christos Add systrace output file
 1.6 11-Dec-2005  christos branches: 1.6.120; 1.6.140;
merge ktrace-lwp.
 1.5 01-Aug-2004  jdolecek sync the syscall lists with Linux kernel 2.6.7
 1.4 30-Mar-2001  jdolecek branches: 1.4.22;
Implement linux_sys_nosys() and use it instead of sys_nosys() for
unimplemented syscalls. Difference is that linux_sys_nosys() doesn't
post SIGSYS to the process. Linux doesn't do that and thus glibc (and
probably other Linux code) doesn't deal with SIGSYS, even through it
generally contains fallback code for ENOSYS case.

This also addresses port-i386/12503, though the issue was already discussed
earlier.
 1.3 11-Dec-2000  mycroft branches: 1.3.2;
Round up sysent table size.
 1.2 01-Oct-1998  erh branches: 1.2.12; 1.2.22;
Moved from compat/linux.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.2.22.1 01-May-2001  he Pull up revision 1.4 (via patch, requested by jdolecek):
Make it possible to use a different function for unimplemented
syscalls than sys_nosys(), so that the Linux emulation can avoid
posting SIGSYS and instead just return ENOSYS.
 1.2.12.2 21-Apr-2001  bouyer Sync with HEAD
 1.2.12.1 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.3.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.4.22.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.22.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.22.1 03-Aug-2004  skrll Sync with HEAD
 1.6.140.1 06-Apr-2015  skrll Sync with HEAD
 1.6.120.1 03-Dec-2017  jdolecek update from HEAD
 1.137 28-Sep-2024  christos Linux GSoC-2024: renameat2, clone3, sync_file_range, syncfs (Shivraj Jamgade)
 1.136 01-Jul-2024  christos Add linux POSIX message queue support (Ricardo Branco)
 1.135 29-Jun-2024  christos branches: 1.135.2;
From gsoc 2024: Implement faccessat2 and getcpu (Shivraz)
 1.134 19-Aug-2023  christos Add inotify* syscalls GSoC 2023 (Theodore Preduta)
 1.133 18-Aug-2023  christos Add linux waitid(2) from GSoC 2023 (Theodore Preduta)
 1.132 29-Jul-2023  christos Add/fix statx, readahead, close_range. From GSoC 2023 by Theodore Preduta
 1.131 28-Jul-2023  christos add epoll syscalls
 1.130 10-Jul-2023  christos Add new syscalls
 1.129 02-Dec-2021  ryo add prlimit64(2) syscall to COMPAT_LINUX and COMPAT_LINUX32
 1.128 20-Sep-2021  thorpej Add preadv(2) and pwritev(2) system calls to COMPAT_LINUX and COMPAT_LINUX32.
 1.127 20-Sep-2021  thorpej Add the eventfd system calls to COMPAT_LINUX and COMPAT_LINUX32.
 1.126 19-Sep-2021  thorpej Add the timerfd syscalls to COMPAT_LINUX and COMPAT_LINUX32.
 1.125 19-Sep-2021  thorpej Add the POSIX timer syscalls (timer_create(), timer_settime(), timer_gettime(),
timer_getoverrun(), and timer_delete()) to COMPAT_LINUX and COMPAT_LINUX32.
 1.124 26-Apr-2020  thorpej branches: 1.124.2;
Add a NetBSD native futex implementation, mostly written by riastradh@.
Map the COMPAT_LINUX futex calls to the native ones.
 1.123 09-Nov-2019  jdolecek add dummy implementation of linux fallocate() which just returns EOPNOTSUPP;
this is needed so that glibc falls back to emulation and apps behaving
properly, since EOPNOTSUPP is a documented and expected return code, but
ENOSYS is not

right now there are no filesystems in NetBSD tree supporting the fallocate
VOP, so no point trying to map this to a native call

supposed to help with problem reported in
https://mail-index.netbsd.org/tech-kern/2019/11/03/msg025641.html
 1.122 02-Jan-2017  manu branches: 1.122.16;
Add pselect6 Linux system call.
This lets Matlab R2016A run on NetBSD/amd64
 1.121 24-Jul-2016  njoly Small cleanup. Adjust readlink/readlinkat signatures to reduce diffs with
native.
 1.120 23-Mar-2015  ozaki-r branches: 1.120.2;
Fix inconsistent argument names
 1.119 22-Nov-2014  njoly branches: 1.119.2;
Fix ppoll signature (int ->u_int)
 1.118 31-May-2014  njoly branches: 1.118.2;
Fix munmap(2) signature.
 1.117 29-May-2014  njoly For utimes(2), use compat_50_sys_utimes() instead of local version.
 1.116 20-May-2014  njoly Fix getgroups/setgroups signature.
 1.115 17-May-2014  njoly Fix fadvise64 syscalls to use 64bit offset types.
 1.114 04-May-2014  njoly Fix pread/pwrite syscalls which need a 64bit offset argument.
 1.113 08-Apr-2014  njoly Adjust read/write/readv/writev signature to match native versions.
 1.112 18-Nov-2013  chs branches: 1.112.2;
implement the *at() syscalls.
bring the unimplemented syscall list up to date.
 1.111 07-Nov-2013  njoly Fix dup/dup2/dup3 argument types (u_int -> int).
 1.110 24-Sep-2013  njoly Add utimensat(2) for compat linux.
 1.109 08-Apr-2013  pooka branches: 1.109.4;
support utimes on non-alpha linux platforms
 1.108 19-Sep-2012  pooka emulate ppoll which is essentially our pollts
 1.107 18-Nov-2011  christos branches: 1.107.10;
add sigtimedwait
 1.106 09-Jul-2011  christos branches: 1.106.2;
the first argument of {g,s}etitimer() is int not u_int.
 1.105 30-May-2011  alnsn Add fadvise64 and fadvise64_64 syscalls to compat_linux and compat_linux32.
 1.104 10-Apr-2011  christos add pipe2 and dup3
 1.103 07-Jul-2010  chs branches: 1.103.2;
many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
- support new-style (NPTL) linux pthreads on all platforms.
clone() with CLONE_THREAD uses 1 process with many LWPs
instead of separate processes.
- move the contents of sys__lwp_setprivate() into a new
lwp_setprivate() and use that everywhere.
- update linux_release[] and linux32_release[] to "2.6.18".
- adjust placement of emul fork/exec/exit hooks as needed
and adjust other emul code to match.
- convert all struct emul definitions to use named initializers.
- change the pid allocator to allow multiple pids to refer to the same proc.
- remove a few fields from struct proc that are no longer needed.
- disable the non-functional "vdso" code in linux32/amd64,
glibc works fine without it.
- fix a race in the futex code where we could miss a wakeup after
a requeue operation.
- redo futex locking to be a little more efficient.
 1.102 23-Apr-2010  chs add missing argument to clone(). the symptom of this was that pthread_join()
would sometimes get stuck, such as in our "mutex2" regression test.
 1.101 24-Nov-2009  njoly branches: 1.101.2; 1.101.4;
Update personality(2) to match Linux definition where the argument is an
unsigned long.
 1.100 08-Jun-2009  njoly Update rt_queueinfo(2) definition, and kill a corresponding comment.
 1.99 17-Jan-2009  njoly branches: 1.99.2;
Convert linux/linux32 wait(4) to use a compat50 rusage structure.
 1.98 13-Jan-2009  pooka Convert the syscalls.master to a format from which it is easier
to parse and generate the compat name and basename (e.g. __stat50
and stat). Use this to autogenerate __RENAME()'s to the rump_syscalls
header so that they can be called e.g. rump_sys_socket() instead
of rump_sys___socket30().
 1.97 11-Jan-2009  christos merge christos-time_t
 1.96 19-Nov-2008  ad Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.95 19-Nov-2008  njoly futex(2) timeout argument cleanup/fix.
- Use `struct linux_timespec', converted to native structure.
- Ensure that provided values are correct.
- Replace timeval+tvtohz by tstohz.
 1.94 12-Nov-2008  njoly Fix nanosleep(2) on 64-bit archs. Do not call native nanosleep
syscall, but rather a modified version the will take care of `struct
timespec' conversions.
 1.93 26-Oct-2008  christos branches: 1.93.2; 1.93.4;
futex support fixes from FreeBSD via cube+pengo.
 1.92 25-Oct-2008  christos Add preliminary tls support for i386. Does not work yet. From FreeBSD.
 1.91 23-Apr-2008  ad branches: 1.91.2; 1.91.4; 1.91.8;
-SYCALL_MPSAFE
 1.90 04-Apr-2008  njoly branches: 1.90.2;
Cleanup. Kill linux_sys_msync and use sys___msync13 instead.
No functional changes expected.
 1.89 15-Jan-2008  njoly branches: 1.89.6; 1.89.8;
compat linux (and linux32) uid16 functions cleanup and fixes.

- Move uid16 functions to their own file linux_uid16.c, included by
needed archs (arm, i386 and m68k).
- Add new MI types linux_{u,g}id16_t.
- Add macros to handle linux_uid16_t and uid_t conversions.
- Add linux_sys_getres{uid,gid}16 syscalls, to fix an overflow with
bad sizes given to copyout when linux_sys_getres{uid,gid} are used.
- Update arm syscall table to use more uid16 functions.
 1.88 24-Dec-2007  njoly Kill unneeded linux_sys_getpgid and use native sys_getpgid instead.
 1.87 21-Dec-2007  njoly - Fix setfsuid to return uid on success.
- Replace getfsuid, which never existed on Linux, by correct setfsgid
syscall.

ok by christos and dsl.
 1.86 20-Dec-2007  dsl Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.85 16-Nov-2007  njoly branches: 1.85.2; 1.85.6;
Cleanup. Remove a few linux syscalls definitions, now identical to
native ones (with stackgap and ALT_CHECK_xxx removal). No functional
changes expected.
 1.84 13-Jun-2007  christos branches: 1.84.6; 1.84.8; 1.84.12; 1.84.14;
Get ready for NPTL but don't turn it on as of yet.
 1.83 13-Jun-2007  christos Add futex.
 1.82 04-Mar-2007  christos branches: 1.82.2; 1.82.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.81 09-Feb-2007  ad branches: 1.81.2;
Merge newlock2 to head.
 1.80 01-Sep-2006  matt branches: 1.80.2;
Don't conditionalize *sys_ptrace. The lack of sys_ptrace will be dealt
with differently.
 1.79 30-Aug-2006  matt Update to deal with options PTRACE
 1.78 10-Jun-2006  christos linux getpriority is off-by-20 so use our own function.
From PR/33671: Nicolas Joly
 1.77 11-Dec-2005  christos branches: 1.77.4; 1.77.8; 1.77.14;
merge ktrace-lwp.
 1.76 06-Nov-2005  manu Back out sched_{set|get}affinity addition because it breaks the
build again on i386 now it is fixed for other archs (Tom's fix and
mine got in colision)
 1.75 05-Nov-2005  dogcow mirror manu's amd64 changes to implement linux sched_{seg,get}affinity;
the kernel and linux lkm now compile again.
 1.74 18-Oct-2005  joerg sys_uselib is needed by COMPAT_LINUX for EXEC_AOUT. Since it doesn't get
build when EXEC_AOUT is not defined, the syscalls.master entry has to be
conditionalized. Alpha did so already, so let the other archs catch up
with it.

Go-on: christos
 1.73 16-May-2005  fvdl branches: 1.73.2;
Add clock_* POSIX functions.
 1.72 16-May-2005  fvdl Add *xattr functions (they all return EOPNOTSUPP).
 1.71 20-Sep-2004  jdolecek implement support for Linux statfs64() syscall - 64bit variant of statfs()
 1.70 08-Sep-2004  jdolecek implement basic exit_group(2), which just terminates calling thread;
apparently not many apps use thread groups yet, at least not with default
SuSE 9.1 libraries, so this is enough for now
 1.69 01-Aug-2004  jdolecek sync the syscall lists with Linux kernel 2.6.7
 1.68 01-Aug-2004  jdolecek connect madvise(2) and mincore(2) - apparently the newer Linux libs
don't stub it anymore, so allow the application to take advantage
of them

the Linux calls appear to be compatible in the flag values and semantics,
so a wrapper is not necessary
 1.67 10-Aug-2003  jdolecek add Linux compat arg wrapper for ftruncate64(), and change linux compat
truncate64() wrapper to translate args structure
NetBSD truncate() and ftrucate() have hidden 'pad' argument, so we have
to do the argument translation

Problem found and patch supplied in PR kern/22360 by Ales Krenek

This is the last of syscalls with hidden 'pad' arg we didn't have
wrapper for; all the others (lseek, mmap, pwrite, pread) already had
wrapper before.
 1.66 03-Jul-2003  christos Implement linux_rt_sigreturn for real. Add a hack for more plausible siginfo.
The java segv handler still segv's again inside the signal handler, but our
sample test program now works [gets the proper ucontext].
 1.65 23-Jun-2003  christos branches: 1.65.2;
PR/21937: Todd Vierling: Proper support for mmap2
 1.64 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.63 10-Apr-2002  christos branches: 1.63.4;
add getdents64
 1.62 22-Mar-2002  christos 1. make sure lines don't wrap
2. fix mmap and call it mmap like other ports do, not mmap2
3. implement fcntl64
4. implement mprotect because linux treats args slightly differently.
 1.61 15-Feb-2002  christos - add a real linux_sys___sysctl because the mib numbers are different.
implement only the kernel version getting entries.
- make the signal conversion functions consistent; dest is arg 1.
- make linux_fakedev deal with block and char devices differently.
- add linux_sys_ugetrlimit, and flesh out the regular get/setrlimit so
that they work properly.
- add linux_mmap2 [untested].
- bump kernel to 2.4.18, and make the date be valentine's day :-)
- linux_sys_*stat64 family was totally busted. Fix it.

tested only on i386.

Status:
gdb, telnet, work
jdk-1.4.0 extractor works, jdk still coredumps.

christos
 1.60 30-Sep-2001  manu Fixes my last commit: only mips really need fcntl64 to work now. i386 and
powerpc could use it later if needed. m68k and alpha should never need it.
 1.59 30-Sep-2001  martin Make i386 kernels compile again.
fcntl64 was still marked UNIMPL, but the implementation existed, causing
a missing prototype warning.
XXX I have no clue if this is the correct fix - someone able to test this
please review it!
 1.58 30-May-2001  mrg branches: 1.58.2; 1.58.4;
use _KERNEL_OPT.
 1.57 13-May-2001  manu Improved the accuracy of gettimeofday/settimeofday: Linux stores a srtuct
timezone in the kernel. We now keep track of it for emulated processes.
Tested for powerpc and i386. Untested on m68k, but it should be ok
Alpha has a particular implementation (osf1_sys_gettimeofday), and it has
therefore not been touched.
 1.56 30-Mar-2001  jdolecek Add new syscalls from Linux 2.4.3 to the lists. Not implemented ATM.
 1.55 30-Mar-2001  jdolecek Implement linux_sys_nosys() and use it instead of sys_nosys() for
unimplemented syscalls. Difference is that linux_sys_nosys() doesn't
post SIGSYS to the process. Linux doesn't do that and thus glibc (and
probably other Linux code) doesn't deal with SIGSYS, even through it
generally contains fallback code for ENOSYS case.

This also addresses port-i386/12503, though the issue was already discussed
earlier.
 1.54 27-Jan-2001  thorpej branches: 1.54.2;
getpid(2) is MP-safe.
 1.53 29-Dec-2000  fvdl Don't pass through link(2) directly, as we need to do altpath checks.
 1.52 27-Dec-2000  fvdl Add all uid and gid calls, and do the right thing for the older 16 bit
ones.
 1.51 18-Dec-2000  fvdl Update for 32 bit Linux uid/gid calls.
 1.50 13-Dec-2000  augustss Add sysinfo.
 1.49 12-Dec-2000  jdolecek actually, we need to wrap sys_truncate() call so that the /emul/linux/...
path is tried first
fix ftruncate64 entry - first arg to ftruncate is int fd, not path
 1.48 12-Dec-2000  jdolecek add emulation of Linux truncate64(2), ftruncate64(2), *stat64(2)
 1.47 09-Dec-2000  jdolecek add more unimplemented syscalls to list
 1.46 09-Dec-2000  mycroft Add the %% separators.
 1.45 02-Dec-2000  jdolecek add emulation of linux swapoff(2)
 1.44 01-Dec-2000  jdolecek replace compat_09_sys_setdomainname() with linux_sys_setdomainname(),
compat_12_sys_swapon() with linux_sys_swapon() - this is to drop dependency
on COMPAT_12/COMPAT_09
 1.43 01-Nov-2000  jdolecek support mlockall(), munlockall() - they are same as respective NetBSD syscalls
 1.42 23-Aug-2000  christos add support for syscall 186 [sigaltstack]
 1.41 18-Mar-2000  erh branches: 1.41.4;
Use linux_sys_reboot instead of sys_reboot.
 1.40 03-Feb-2000  abs Add Linux fsuid system calls - from Witold J. Wnuk in PR kern/9335
 1.39 12-Dec-1999  tron Incomplete but already working emulation of Linux's ptrace(2) for i386.
 1.38 05-Dec-1999  tron Add proper stub code to make emulation of Linux's pread(2) and pwrite(2)
work. Fixes PR kern/8945 by Dave Sainty.
 1.37 04-Dec-1999  tron Consistently call signal number arguments "signum".
 1.36 04-Oct-1999  tron branches: 1.36.2; 1.36.8;
Add emulation for scheduler related syscalls. Although they are dummies
even under Linux the posix thread library for "glibc2" requires them.
 1.35 16-Aug-1999  tron Add stime() to syscalls table.
 1.34 14-May-1999  thorpej Emulate the Linux vfork(2) (which is like NetBSD's __vfork14(2)),
{get,set}resuid(2), and {get,set}resgid(2). Note a few more system
calls that we don't yet emulate.
 1.33 13-May-1999  thorpej Emulate the Linux clone(2) system call.
 1.32 30-Mar-1999  abs branches: 1.32.2; 1.32.4;
Since NetBSD has poll(), use it.
Linux oracle install now gets far enough that I want our DBA around to
see if we can finish the job.
 1.31 27-Mar-1999  tron Add emulation for Linux "getcwd" syscall.
 1.30 23-Mar-1999  thorpej Add support for emulating the Linux pread(2) and pwrite(2) system calls;
just call the native NetBSD versions.

PR #7202, Jaromir Dolecek <dolecek@ics.muni.cz>.
 1.29 09-Feb-1999  christos const poisoning
 1.28 10-Dec-1998  christos defopt COMPAT_43
 1.27 03-Oct-1998  christos Attempt to fix the mess.
 1.26 01-Oct-1998  erh Move compat/linux/syscalls.master to i386. Add a few syscalls while I'm here.
 1.25 11-Sep-1998  mycroft Substantial signal handling changes:
* Increase the size of sigset_t to accomodate 128 signals -- adding new
versions of sys_setprocmask(), sys_sigaction(), sys_sigpending() and
sys_sigsuspend() to handle the changed arguments.
* Abstract the guts of sys_sigaltstack(), sys_setprocmask(), sys_sigaction(),
sys_sigpending() and sys_sigsuspend() into separate functions, and call them
from all the emulations rather than hard-coding everything. (Avoids uses
the stackgap crap for these system calls.)
* Add a new flag (p_checksig) to indicate that a process may have signals
pending and userret() needs to do the full (slow) check.
* Eliminate SAS_ALTSTACK; it's exactly the inverse of SS_DISABLE.
* Correct emulation bugs with restoring SS_ONSTACK.
* Make the signal mask in the sigcontext always use the emulated mask format.
* Store signals internally in sigaction structures, rather than maintaining a
bunch of little sigsets for each SA_* bit.
* Keep track of where we put the signal trampoline, rather than figuring it out
in *_sendsig().
* Issue a warning when a non-emulated sigaction bit is observed.
* Add missing emulated signals, and a native SIGPWR (currently not used).
* Implement the `not reset when caught' semantics for relevant signals.

Note: Only code touched by the i386 port has been modified. Other ports and
emulations need to be updated.
 1.24 05-Aug-1998  perry enable nanosleep in linux emul, per pr-5906 from Soren S. Jorvang
 1.23 20-Feb-1998  mycroft Linux's getsid(2) does in fact return a pid, not a pointer.
 1.22 19-Feb-1998  thorpej Change a comment to reflect new makesyscalls.sh behavior.
 1.21 16-Oct-1997  christos ostat -> stat43
 1.20 15-Oct-1997  mycroft Fix a typo inherited from kern/syscalls.master.
 1.19 10-Oct-1997  mycroft Emulate mremap(2) by returning ENOMEM for now. This should be sufficient for
realloc(3) and other uses. From Matthias Scheler in PR 3920.
 1.18 13-Jun-1997  thorpej branches: 1.18.4;
Use compat_12_sys_swapon().
 1.17 07-Apr-1997  augustss Add Linux nice() syscall.
 1.16 20-May-1996  fvdl branches: 1.16.6;
Update list of Linux syscalls and implement the ones that are likely to be
used and doable.
 1.15 18-Dec-1995  fvdl msync, readv and writev were recently added to the Linux kernel; add them
to the emulation as well.
 1.14 09-Dec-1995  mycroft We don't need a private version of fork() here any more.
 1.13 07-Oct-1995  mycroft Prefix names of system call implementation functions with `sys_'.
 1.12 07-Sep-1995  fvdl Fix some bugs & typing problems.
 1.11 27-Aug-1995  fvdl Add a hook for MD ioctl calls, plus a couple of more changes to make
svgalib binaries work on the i386
 1.10 23-Aug-1995  fvdl Emulate some syscalls that appear in Linux 1.3: a select() with normal args,
getdents() and flock().
 1.9 21-Aug-1995  mycroft Implement the old and older uname(2) calls.
 1.8 14-Aug-1995  mycroft Rearrange #includes.
 1.7 24-Jul-1995  fvdl mkdir() has 2 arguments.. fixes PR 1248 (from Brad Spencer)
 1.6 11-Jun-1995  fvdl * Make Linux ELF binaries work. Lots of code duplication, but it will have to do
for now.
* Add a sanity check in linux_uselib
 1.5 06-May-1995  mycroft Add linux_modify_ldt(), if __i386__.
 1.4 07-Apr-1995  fvdl Handle Linux signal tramp code differently. Some changes because of the
now seperate Linux signal trampoline code. Add linux_sigreturn to
syscalls.master.
 1.3 10-Mar-1995  fvdl Add the Linux pause() system call. Fix the arguments to sigsuspend().
 1.2 05-Mar-1995  fvdl Added a few more system calls.
More consistent alternate root file semantics throughout.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.16.6.1 12-Feb-1997  mrg initial work for dynamic swap additions.
 1.18.4.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.32.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.32.2.2 15-Aug-2000  he Pull up revision 1.40 (requested by abs):
Enable basic versions of Linux fsuid calls.
 1.32.2.1 31-Jan-2000  he Apply patch (requested by abs):
Enable emulation of vfork(2).
 1.36.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.36.2.7 21-Apr-2001  bouyer Sync with HEAD
 1.36.2.6 11-Feb-2001  bouyer Sync with HEAD.
 1.36.2.5 05-Jan-2001  bouyer Sync with HEAD
 1.36.2.4 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.36.2.3 08-Dec-2000  bouyer Sync with HEAD.
 1.36.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.36.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.41.4.2 01-May-2001  he Pull up revision 1.55 (requested by jdolecek):
Make it possible to use a different function for unimplemented
syscalls than sys_nosys(), so that the Linux emulation can avoid
posting SIGSYS and instead just return ENOSYS.
 1.41.4.1 30-Mar-2001  he Pull up revision 1.53 (requested by fvdl):
Add some required Linux emulation bits to support the Linux
version of VMware.
 1.54.2.7 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.54.2.6 17-Apr-2002  nathanw Catch up to -current.
 1.54.2.5 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.54.2.4 28-Feb-2002  nathanw Catch up to -current.
 1.54.2.3 08-Oct-2001  nathanw Catch up to -current.
 1.54.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.54.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.58.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.58.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.58.2.2 16-Mar-2002  jdolecek Catch up with -current.
 1.58.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.63.4.3 14-Jun-2004  jmc Pullup patch (requested by skrll in ticket #1708)

Bring netbsd-1-6 inline with -current sources after the mistakes in ticket #1686
 1.63.4.2 11-May-2004  tron Pull up revision 1.67 via patch (requested by wennmach in ticket #1686):
add Linux compat arg wrapper for ftruncate64(), and change linux compat
truncate64() wrapper to translate args structure
NetBSD truncate() and ftrucate() have hidden 'pad' argument, so we have
to do the argument translation
Problem found and patch supplied in PR kern/22360 by Ales Krenek
This is the last of syscalls with hidden 'pad' arg we didn't have
wrapper for; all the others (lseek, mmap, pwrite, pread) already had
wrapper before.
 1.63.4.1 22-Oct-2003  jmc Regen files (requested by tv in ticket #1427)

Proper support for mmap2
 1.65.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.65.2.4 24-Sep-2004  skrll Sync with HEAD.
 1.65.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.65.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.65.2.1 03-Aug-2004  skrll Sync with HEAD
 1.73.2.5 21-Jan-2008  yamt sync with head
 1.73.2.4 07-Dec-2007  yamt sync with head
 1.73.2.3 03-Sep-2007  yamt sync with head.
 1.73.2.2 26-Feb-2007  yamt sync with head.
 1.73.2.1 21-Jun-2006  yamt sync with head.
 1.77.14.1 19-Jun-2006  chap Sync with head.
 1.77.8.1 26-Jun-2006  yamt sync with head.
 1.77.4.1 09-Sep-2006  rpaulo sync with head
 1.80.2.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.81.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.82.4.1 11-Jul-2007  mjf Sync with head.
 1.82.2.1 15-Jul-2007  ad Sync with head.
 1.84.14.3 18-Feb-2008  mjf Sync with HEAD.
 1.84.14.2 27-Dec-2007  mjf Sync with HEAD.
 1.84.14.1 19-Nov-2007  mjf Sync with HEAD.
 1.84.12.1 18-Nov-2007  bouyer Sync with HEAD
 1.84.8.2 23-Mar-2008  matt sync with HEAD
 1.84.8.1 09-Jan-2008  matt sync with HEAD
 1.84.6.1 21-Nov-2007  joerg Sync with HEAD.
 1.85.6.2 19-Jan-2008  bouyer Sync with HEAD
 1.85.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.85.2.1 26-Dec-2007  ad Sync with head.
 1.89.8.3 20-Nov-2008  christos merge with head.
 1.89.8.2 01-Nov-2008  christos Sync with head.
 1.89.8.1 29-Mar-2008  christos Welcome to the time_t=long long dev_t=uint64_t branch.
 1.89.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.89.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.90.2.1 18-May-2008  yamt sync with head.
 1.91.8.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.91.4.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.91.4.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.91.2.4 11-Aug-2010  yamt sync with head.
 1.91.2.3 11-Mar-2010  yamt sync with head
 1.91.2.2 20-Jun-2009  yamt sync with head
 1.91.2.1 04-May-2009  yamt sync with head.
 1.93.4.1 20-Nov-2008  snj Pull up following revision(s) (requested by njoly in ticket #81):
sys/compat/linux/arch/mips/syscalls.master: revision 1.30
sys/compat/linux/arch/m68k/syscalls.master: revision 1.63
sys/compat/linux32/arch/amd64/syscalls.master: revision 1.39
sys/compat/linux/arch/alpha/syscalls.master: revision 1.63
sys/compat/linux/arch/powerpc/syscalls.master: revision 1.38
sys/compat/linux32/common/linux32_time.c: revision 1.22
sys/compat/linux/arch/amd64/syscalls.master: revision 1.25
sys/compat/linux/arch/i386/syscalls.master: revision 1.94
sys/compat/linux/arch/arm/syscalls.master: revision 1.36
sys/compat/linux/common/linux_time.c: revision 1.26
Fix nanosleep(2) on 64-bit archs. Do not call native nanosleep
syscall, but rather a modified version the will take care of `struct
timespec' conversions.
 1.93.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.99.2.1 23-Jul-2009  jym Sync with HEAD.
 1.101.4.4 31-May-2011  rmind sync with head
 1.101.4.3 21-Apr-2011  rmind sync with head
 1.101.4.2 05-Mar-2011  rmind sync with head
 1.101.4.1 30-May-2010  rmind sync with head
 1.101.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.101.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.103.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.106.2.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.106.2.2 30-Oct-2012  yamt sync with head
 1.106.2.1 17-Apr-2012  yamt sync with head
 1.107.10.4 03-Dec-2017  jdolecek update from HEAD
 1.107.10.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.107.10.2 23-Jun-2013  tls resync from head
 1.107.10.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.109.4.1 18-May-2014  rmind sync with head
 1.112.2.1 10-Aug-2014  tls Rebase.
 1.118.2.1 17-Apr-2017  snj Pull up following revision(s) (requested by manu in ticket #1354):
sys/compat/linux/arch/alpha/syscalls.master: revision 1.92 via patch
sys/compat/linux/arch/amd64/syscalls.master: revision 1.58 via patch
sys/compat/linux/arch/arm/syscalls.master: revision 1.65 via patch
sys/compat/linux/arch/i386/syscalls.master: revision 1.122 via patch
sys/compat/linux/arch/m68k/syscalls.master: revision 1.91 via patch
sys/compat/linux/arch/mips/syscalls.master: revision 1.61 via patch
sys/compat/linux/arch/powerpc/syscalls.master: revision 1.70 via patch
sys/compat/linux/common/linux_misc.c: revision 1.234
sys/compat/linux/common/linux_signal.h: revision 1.31
Add pselect6 Linux system call.
This lets Matlab R2016A run on NetBSD/amd64
 1.119.2.3 05-Feb-2017  skrll Sync with HEAD
 1.119.2.2 05-Oct-2016  skrll Sync with HEAD
 1.119.2.1 06-Apr-2015  skrll Sync with HEAD
 1.120.2.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.120.2.1 26-Jul-2016  pgoyette Sync with HEAD
 1.122.16.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.124.2.2 17-Dec-2020  thorpej Add suppport for Linux preadv(2) and pwritev(2). Same as native, except
for the silly way that the offset argument is passed in.
 1.124.2.1 15-Dec-2020  thorpej Add Linux eventfd, timerfd, and POSIX timer calls.
 1.135.2.1 02-Aug-2025  perseant Sync with HEAD
 1.4 29-May-2024  christos should not be using .include <> but .include "" here.
 1.3 08-Apr-2014  njoly Do not include bsd.kinc.mk in each arch Makefile, it's already pulled
by bsd.syscall.mk (from Makefile.inc).
 1.2 03-Oct-1998  christos branches: 1.2.184; 1.2.194; 1.2.200; 1.2.210;
Attempt to fix the mess.
 1.1 30-Sep-1998  erh Stubs for future development of linux compat architechtures.
 1.2.210.1 10-Aug-2014  tls Rebase.
 1.2.200.1 18-May-2014  rmind sync with head
 1.2.194.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.184.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.8 03-May-2020  thorpej Always clear FUTEX_PRIVATE_FLAG for Linux processes. NetBSD-native futexes
exist in different namespace depending on FUTEX_PRIVATE_FLAG. This appears
not to be the case in Linux, and some futex users will mix private and non-
private ops on the same futex object. Provide a convenience wrapper that
puts this logic in one place witn a comment explaining why.

While here, move the Linux futex wrapper out of its own file and plop
it in linux_misc.c, which is where it lives in the linux32 module.
 1.7 24-Dec-2013  njoly Reduce diffs between arches, add fcntl64() to m68k.
 1.6 30-May-2011  alnsn branches: 1.6.4; 1.6.14; 1.6.18;
Add fadvise64 and fadvise64_64 syscalls to compat_linux and compat_linux32.
 1.5 07-Jul-2010  chs branches: 1.5.2;
many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
- support new-style (NPTL) linux pthreads on all platforms.
clone() with CLONE_THREAD uses 1 process with many LWPs
instead of separate processes.
- move the contents of sys__lwp_setprivate() into a new
lwp_setprivate() and use that everywhere.
- update linux_release[] and linux32_release[] to "2.6.18".
- adjust placement of emul fork/exec/exit hooks as needed
and adjust other emul code to match.
- convert all struct emul definitions to use named initializers.
- change the pid allocator to allow multiple pids to refer to the same proc.
- remove a few fields from struct proc that are no longer needed.
- disable the non-functional "vdso" code in linux32/amd64,
glibc works fine without it.
- fix a race in the futex code where we could miss a wakeup after
a requeue operation.
- redo futex locking to be a little more efficient.
 1.4 15-Jan-2008  njoly branches: 1.4.10; 1.4.30; 1.4.32;
compat linux (and linux32) uid16 functions cleanup and fixes.

- Move uid16 functions to their own file linux_uid16.c, included by
needed archs (arm, i386 and m68k).
- Add new MI types linux_{u,g}id16_t.
- Add macros to handle linux_uid16_t and uid_t conversions.
- Add linux_sys_getres{uid,gid}16 syscalls, to fix an overflow with
bad sizes given to copyout when linux_sys_getres{uid,gid} are used.
- Update arm syscall table to use more uid16 functions.
 1.3 31-Mar-2002  christos branches: 1.3.26; 1.3.84; 1.3.90; 1.3.98;
bring the reverse signal mapping array into linux_signo.c
 1.2 12-Dec-2000  jdolecek branches: 1.2.2; 1.2.4;
add emulation of Linux truncate64(2), ftruncate64(2), *stat64(2)
 1.1 15-Dec-1998  itohy branches: 1.1.8;
Initial support of Linux/m68k compatibility.
 1.1.8.1 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.2.4.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.2.2.1 17-Apr-2002  nathanw Catch up to -current.
 1.3.98.1 19-Jan-2008  bouyer Sync with HEAD
 1.3.90.1 18-Feb-2008  mjf Sync with HEAD.
 1.3.84.1 23-Mar-2008  matt sync with HEAD
 1.3.26.1 21-Jan-2008  yamt sync with head
 1.4.32.2 31-May-2011  rmind sync with head
 1.4.32.1 05-Mar-2011  rmind sync with head
 1.4.30.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.4.10.1 11-Aug-2010  yamt sync with head.
 1.5.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.6.18.1 18-May-2014  rmind sync with head
 1.6.14.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.6.4.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.5 17-Dec-2013  njoly Cleanup compat linux errnos by adding generic errnos in a single file.
Use it for all arches except alpha and mips.
Add a few missing native to linux errno conversions.
 1.4 28-Apr-2008  martin branches: 1.4.34; 1.4.44; 1.4.50;
Remove clause 3 and 4 from TNF licenses
 1.3 12-Feb-2001  manu branches: 1.3.122; 1.3.124; 1.3.126;
Clarified comments about the LINUX_SCERR_SIGN macro
 1.2 11-Feb-2001  manu Moved the fix for negative errno returned to userland on the PowerPC to a
more machine independent fashion
 1.1 15-Dec-1998  itohy branches: 1.1.8;
Initial support of Linux/m68k compatibility.
 1.1.8.1 12-Mar-2001  bouyer Sync with HEAD.
 1.3.126.1 16-May-2008  yamt sync with head.
 1.3.124.1 18-May-2008  yamt sync with head.
 1.3.122.1 02-Jun-2008  mjf Sync with HEAD.
 1.4.50.1 18-May-2014  rmind sync with head
 1.4.44.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.4.34.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.12 12-Feb-2017  chs es_arglen is now in units of bytes, update the emulations accordingly.
 1.11 09-Feb-2014  chs branches: 1.11.6; 1.11.10; 1.11.14;
account for the 16 bytes of AT_RANDOM data in the stack setup. fixes PR 48518.
use cprng_strong32() instead of random(). add AT_RANDOM support for linux32.
 1.10 28-Apr-2008  martin branches: 1.10.34; 1.10.44; 1.10.50;
Remove clause 3 and 4 from TNF licenses
 1.9 11-Dec-2005  christos branches: 1.9.70; 1.9.72; 1.9.74;
merge ktrace-lwp.
 1.8 14-Aug-2003  christos remove the args from the macro.
 1.7 08-Aug-2003  christos - GC all the setup_stack functions
- add one for linux/i386
 1.6 13-Nov-2002  jdolecek branches: 1.6.6;
add generic linux compat ELF copyargs function

this gives:
* linux sysconf(_SC_CLK_TCK) gives correct value for linux binaries (hz)
even if hz != 100
* glibc gets proper information on real/effective uid and enables
secure mode for suid binaries

g/c LINUX_COPYARGS_FUNCTION, replaced by linux ELF copyargs function
g/c alpha-specific linux ELF copyargs function and linux ELF defines
 1.5 13-Jul-2002  scw m68k syscall rototill:

- Switch all m68k-based ports over to __HAVE_SYSCALL_INTERN.
- Add systrace glue.
- Define struct mdproc in <m68k/proc.h> instead of <machine/proc.h>.
(They were all defined exactly the same anyway, other than a couple
of the MDP_* flags.)
 1.4 17-Jan-2002  bjh21 branches: 1.4.8;
On platforms that don't __HAVE_SYSCALL_INTERN, define LINUX_SYSCALL_FUNCTION
to be the value of emul_linux.e_syscall that we want. This allows it to differ
between machines, so I can have a separate linux_syscall() on arm.
 1.3 13-Dec-2000  itohy branches: 1.3.2; 1.3.4;
sync with i386, so that exec_conf.c compiles again
 1.2 17-Nov-2000  erh Make the linux compatibilty code work on the alpha. (horay!) (at last!)
Two main changes:
Create a linux_elf64_copyargs that uses the linux specific LinuxAuxInfo
structure. This is only used on the alpha. i386 and m68k use the
standard elf copyargs function.

Since linux's approach to binary compatibilty is to look as much
like osf1 as possible, add all the osf1 syscalls that we have
implemented to the linux syscall table. This includes get/setsysinfo,
ported from FreeBSD.

In order for linux compat to work you must have COMPAT_OSF1, COMPAT_43,
COMPAT_09, COMPAT_12 and COMPAT_13 on also.
 1.1 15-Dec-1998  itohy branches: 1.1.8;
Initial support of Linux/m68k compatibility.
 1.1.8.2 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.1.8.1 22-Nov-2000  bouyer Sync with HEAD.
 1.3.4.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.3.4.1 11-Feb-2002  jdolecek Sync w/ -current.
 1.3.2.3 11-Dec-2002  thorpej Sync with HEAD.
 1.3.2.2 01-Aug-2002  nathanw Catch up to -current.
 1.3.2.1 28-Feb-2002  nathanw Catch up to -current.
 1.4.8.1 15-Jul-2002  gehenna catch up with -current.
 1.6.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.6.1 03-Aug-2004  skrll Sync with HEAD
 1.9.74.1 16-May-2008  yamt sync with head.
 1.9.72.1 18-May-2008  yamt sync with head.
 1.9.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.10.50.1 18-May-2014  rmind sync with head
 1.10.44.2 03-Dec-2017  jdolecek update from HEAD
 1.10.44.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.10.34.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.11.14.1 21-Apr-2017  bouyer Sync with HEAD
 1.11.10.1 20-Mar-2017  pgoyette Sync with HEAD
 1.11.6.1 28-Aug-2017  skrll Sync with HEAD
 1.5 25-Jun-2014  njoly Add a few missing open(2) flags (LINUX_O_*). Fix alpha wrong values.
 1.4 02-Nov-2010  chs branches: 1.4.18; 1.4.32;
define LINUX_O_CLOEXEC.
sort definitions by value.
consistently use hex instead of octal for the values.
 1.3 28-Apr-2008  martin branches: 1.3.20; 1.3.22;
Remove clause 3 and 4 from TNF licenses
 1.2 30-Sep-2001  manu branches: 1.2.116; 1.2.118; 1.2.120;
Added initial support for fcntl64 system call (file locking is not
implemented)
 1.1 15-Dec-1998  itohy branches: 1.1.20; 1.1.22; 1.1.24;
Initial support of Linux/m68k compatibility.
 1.1.24.1 01-Oct-2001  fvdl Catch up with -current.
 1.1.22.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.20.1 08-Oct-2001  nathanw Catch up to -current.
 1.2.120.1 16-May-2008  yamt sync with head.
 1.2.118.1 18-May-2008  yamt sync with head.
 1.2.116.1 02-Jun-2008  mjf Sync with HEAD.
 1.3.22.1 05-Mar-2011  rmind sync with head
 1.3.20.1 06-Nov-2010  uebayasi Sync with HEAD.
 1.4.32.1 10-Aug-2014  tls Rebase.
 1.4.18.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.3 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.2 10-Dec-2000  fvdl branches: 1.2.122; 1.2.124; 1.2.126;
The gist of the Linux _IOX definitions was the same for all platforms;
move it to the MI linux_ioctl.h and only leave the MD bits in the MD
header files.
 1.1 15-Dec-1998  itohy branches: 1.1.8; 1.1.18;
Initial support of Linux/m68k compatibility.
 1.1.18.1 30-Mar-2001  he Pull up revision 1.2 (requested by fvdl):
Add some required Linux emulation bits to support the Linux
version of VMware.
 1.1.8.1 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.2.126.1 16-May-2008  yamt sync with head.
 1.2.124.1 18-May-2008  yamt sync with head.
 1.2.122.1 02-Jun-2008  mjf Sync with HEAD.
 1.45 01-Oct-2024  riastradh sys/compat/linux/arch: Nix trailing whitespace.

No functional change intended.
 1.44 07-Aug-2022  tsutsui branches: 1.44.10;
Remove extra whitespaces added by an ancient stupid script.
 1.43 07-Sep-2021  riastradh sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.42 07-Jul-2010  chs branches: 1.42.52; 1.42.64;
many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
- support new-style (NPTL) linux pthreads on all platforms.
clone() with CLONE_THREAD uses 1 process with many LWPs
instead of separate processes.
- move the contents of sys__lwp_setprivate() into a new
lwp_setprivate() and use that everywhere.
- update linux_release[] and linux32_release[] to "2.6.18".
- adjust placement of emul fork/exec/exit hooks as needed
and adjust other emul code to match.
- convert all struct emul definitions to use named initializers.
- change the pid allocator to allow multiple pids to refer to the same proc.
- remove a few fields from struct proc that are no longer needed.
- disable the non-functional "vdso" code in linux32/amd64,
glibc works fine without it.
- fix a race in the futex code where we could miss a wakeup after
a requeue operation.
- redo futex locking to be a little more efficient.
 1.41 15-Apr-2009  elad branches: 1.41.2; 1.41.4;
Remove a few KAUTH_GENERIC_ISSUSER in favor of more descriptive
alternatives.

Discussed on tech-kern:

http://mail-index.netbsd.org/tech-kern/2009/04/11/msg004798.html

Input from ad@, christos@, dyoung@, tsutsui@.

Okay ad@.
 1.40 18-Mar-2009  cegger bcopy -> memcpy
 1.39 18-Mar-2009  cegger bzero -> memset
 1.38 28-Apr-2008  martin branches: 1.38.2; 1.38.8; 1.38.14;
Remove clause 3 and 4 from TNF licenses
 1.37 24-Apr-2008  ad branches: 1.37.2;
Merge proc::p_mutex and proc::p_smutex into a single adaptive mutex, since
we no longer need to guard against access from hardware interrupt handlers.

Additionally, if cloning a process with CLONE_SIGHAND, arrange to have the
child process share the parent's lock so that signal state may be kept in
sync. Partially addresses PR kern/37437.
 1.36 20-Dec-2007  dsl branches: 1.36.6; 1.36.8;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.35 08-Dec-2007  dsl branches: 1.35.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.34 04-Dec-2007  dsl Remove all the __P
 1.33 19-Oct-2007  ad branches: 1.33.2; 1.33.4;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.32 04-Mar-2007  tsutsui branches: 1.32.2; 1.32.14; 1.32.16; 1.32.20;
Use (char *) on pointer arith.
 1.31 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.30 09-Feb-2007  ad branches: 1.30.2;
Merge newlock2 to head.
 1.29 04-Jan-2007  elad Consistent usage of KAUTH_GENERIC_ISSUSER.
 1.28 23-Jul-2006  ad branches: 1.28.4;
Use the LWP cached credentials where sane.
 1.27 15-May-2006  yamt include kauth.h for kauth_cred_geteuid, etc.
 1.26 14-May-2006  elad integrate kauth.
 1.25 24-Dec-2005  perry branches: 1.25.4; 1.25.6; 1.25.8; 1.25.10; 1.25.12;
bare asm -> __asm
 1.24 11-Dec-2005  christos merge ktrace-lwp.
 1.23 20-May-2005  fvdl branches: 1.23.2;
Define linux_usertrap function, and set it in struct emul. For all
but amd64, it just returns 0, doing nothing.

For amd64, it implements vsyscalls through cheating: if the faulting
address is in the vsyscall area (which is statically known on Linux/amd64),
and the intruction pointer is too, it must have been a vsyscall. In that
case, retrieve the return address from the user stack, fix up %rip and
%rsp, and just execute the normal system call. It will return as if
the vsyscall has been executed.
 1.22 28-Sep-2003  cl fix fmovem argument reference
 1.21 28-Sep-2003  cl catch up with const sigset_t
 1.20 25-Sep-2003  christos constify sendsig/trapsignal
 1.19 22-Sep-2003  cl SA_SIGINFO support for m68k (emul linux)
 1.18 02-Aug-2003  jdolecek replace fuword() with copyin(), and suword() with copyout()
 1.17 29-Jun-2003  fvdl branches: 1.17.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.16 29-Jun-2003  thorpej Adapt to ktrace/lwp changes.
 1.15 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.14 04-Jul-2002  thorpej Add kernel support for having userland provide the signal trampoline:

* struct sigacts gets a new sigact_sigdesc structure, which has the
sigaction and the trampoline/version. Version 0 means "legacy kernel
provided trampoline". Other versions are coordinated with machine-
dependent code in libc.
* sigaction1() grows two more arguments -- the trampoline pointer and
the trampoline version.
* A new __sigaction_sigtramp() system call is provided to register a
trampoline along with a signal handler.
* The handler is no longer passed to sensig() functions. Instead,
sendsig() looks up the handler by peeking in the sigacts for the
process getting the signal (since it has to look in there for the
trampoline anyway).
* Native sendsig() functions now select the appropriate trampoline and
its arguments based on the trampoline version in the sigacts.

Changes to libc to use the new facility will be checked in later. Kernel
version not bumped; we will ride the 1.6C bump made recently.
 1.13 08-Apr-2002  christos branches: 1.13.2;
PR/16231: Ben Harris: m68k does not compile.
 1.12 31-Mar-2002  christos make signal array handling uniform, and put signal arrays in a separate
file. This is simular to errno array handling.
 1.11 19-Feb-2002  is fix some swapped parameters
 1.10 15-Feb-2002  christos - add a real linux_sys___sysctl because the mib numbers are different.
implement only the kernel version getting entries.
- make the signal conversion functions consistent; dest is arg 1.
- make linux_fakedev deal with block and char devices differently.
- add linux_sys_ugetrlimit, and flesh out the regular get/setrlimit so
that they work properly.
- add linux_mmap2 [untested].
- bump kernel to 2.4.18, and make the date be valentine's day :-)
- linux_sys_*stat64 family was totally busted. Fix it.

tested only on i386.

Status:
gdb, telnet, work
jdk-1.4.0 extractor works, jdk still coredumps.

christos
 1.9 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.8 04-Feb-2001  jmc branches: 1.8.2; 1.8.4;
Back out last change. m68k.h is now in cpu.h (which got updated in between
my noticing this problem here on a sun3).
 1.7 04-Feb-2001  jmc Add m68k/m68k.h to pickup fputype definitions.
 1.6 22-Dec-2000  jdolecek split off thread specific stuff from struct sigacts to struct sigctx, leaving
only signal handler array sharable between threads
move other random signal stuff from struct proc to struct sigctx

This addresses kern/10981 by Matthew Orgass.
 1.5 16-Dec-2000  scw Sprinkle some register prefixes in the asm() statements.
 1.4 19-Apr-1999  kleink branches: 1.4.2;
Move linux_reenter_syscall() to a common location and rename it to
reenter_syscall() - it's going to be shared with COMPAT_SVR4 and soon be
used by native code.
 1.3 02-Mar-1999  itohy branches: 1.3.4;
cachectl -> cachectl1
 1.2 19-Dec-1998  drochner get "opt_compat_xxx.h" includes out of <sys/signal.h>
 1.1 15-Dec-1998  itohy Initial support of Linux/m68k compatibility.
 1.3.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.4.2.1 05-Jan-2001  bouyer Sync with HEAD
 1.8.4.4 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.8.4.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.8.4.2 16-Mar-2002  jdolecek Catch up with -current.
 1.8.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.8.2.8 01-Aug-2002  nathanw Catch up to -current.
 1.8.2.7 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.8.2.6 24-Jun-2002  nathanw Curproc->curlwp renaming.

Change uses of "curproc->l_proc" back to "curproc", which is more like the
original use. Bare uses of "curproc" are now "curlwp".

"curproc" is now #defined in proc.h as ((curlwp) ? (curlwp)->l_proc) : NULL)
so that it is always safe to reference curproc (*de*referencing curproc
is another story, but that's always been true).
 1.8.2.5 21-Jun-2002  gmcgarry LWPify
 1.8.2.4 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.8.2.3 17-Apr-2002  nathanw Catch up to -current.
 1.8.2.2 28-Feb-2002  nathanw Catch up to -current.
 1.8.2.1 14-Nov-2001  nathanw Catch up to -current.
 1.13.2.1 15-Jul-2002  gehenna catch up with -current.
 1.17.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.17.2.4 24-Jan-2005  skrll Adapt to branch.
 1.17.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.17.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.17.2.1 03-Aug-2004  skrll Sync with HEAD
 1.23.2.7 21-Jan-2008  yamt sync with head
 1.23.2.6 07-Dec-2007  yamt sync with head
 1.23.2.5 27-Oct-2007  yamt sync with head.
 1.23.2.4 03-Sep-2007  yamt sync with head.
 1.23.2.3 26-Feb-2007  yamt sync with head.
 1.23.2.2 30-Dec-2006  yamt sync with head.
 1.23.2.1 21-Jun-2006  yamt sync with head.
 1.25.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.25.10.2 10-Mar-2006  elad generic_authorize() -> kauth_authorize_generic().
 1.25.10.1 08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.25.8.2 11-Aug-2006  yamt sync with head
 1.25.8.1 24-May-2006  yamt sync with head.
 1.25.6.1 01-Jun-2006  kardel Sync with head.
 1.25.4.1 09-Sep-2006  rpaulo sync with head
 1.28.4.4 06-Feb-2007  ad More compat changes.

XXX compat_irix, compat_mach and compat_darwin need work.
 1.28.4.3 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.28.4.2 27-Jan-2007  ad More compat changes.
 1.28.4.1 12-Jan-2007  ad Sync with head.
 1.30.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.32.20.1 25-Oct-2007  bouyer Sync with HEAD.
 1.32.16.2 09-Jan-2008  matt sync with HEAD
 1.32.16.1 06-Nov-2007  matt sync with HEAD
 1.32.14.2 09-Dec-2007  jmcneill Sync with HEAD.
 1.32.14.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.32.2.1 23-Oct-2007  ad Sync with head.
 1.33.4.2 26-Dec-2007  ad Sync with head.
 1.33.4.1 08-Dec-2007  ad Sync with head.
 1.33.2.2 27-Dec-2007  mjf Sync with HEAD.
 1.33.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.35.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.36.8.1 18-May-2008  yamt sync with head.
 1.36.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.37.2.3 11-Aug-2010  yamt sync with head.
 1.37.2.2 04-May-2009  yamt sync with head.
 1.37.2.1 16-May-2008  yamt sync with head.
 1.38.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.38.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.38.2.3 14-May-2008  wrstuden Per discussion with ad at n dot o, revert signal mask handling
changes.

The l_sigstk changes are most likely totally un-needed as SA will
never use a signal stack - we send an upcall (or will as other
diffs are brought in).

The l_sigmask changes were too controvertial. In all honesty, I
think it's probably best to revert them. The main reason they were
there is the fact that in an SA process, we don't mask signals per
kernel thread, we mask them per user thread. In the kernel, we want
them all to get turned into upcalls. Thus the normal state of
l_sigmask in an SA process is for it to always be empty.

While we are in the process of delivering a signal, we want to
temporarily mask a signal (so we don't recursively exhaust our
upcall stacks). However signal delivery is rare (important, but
rare), and delivering back-to-back signals is even rarer. So rather
than cause every user of a signal mask to be prepared for this very
rare case, we will just add a second check later in the signal
delivery code. Said change is not in this diff.

This also un-compensates all of our compatability code for dealing
with SA. SA is a NetBSD-specific thing, so there's no need for
Irix, Linux, Solaris, SVR4 and so on to cope with it.

As previously, everything other than kern_sa.c compiles in i386
GENERIC as of this checkin. I will switch to ALL soon for compile
testing.
 1.38.2.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.38.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.41.4.1 05-Mar-2011  rmind sync with head
 1.41.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.42.64.1 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.42.52.1 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1836):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.44.10.1 02-Aug-2025  perseant Sync with HEAD
 1.7 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.6 04-Dec-2007  dsl branches: 1.6.12; 1.6.14; 1.6.16;
Remove all the __P
 1.5 11-Nov-2005  chs branches: 1.5.46; 1.5.48; 1.5.54; 1.5.58;
include additional headers that are now needed.
 1.4 13-Jul-2002  scw branches: 1.4.6; 1.4.22;
m68k syscall rototill:

- Switch all m68k-based ports over to __HAVE_SYSCALL_INTERN.
- Add systrace glue.
- Define struct mdproc in <m68k/proc.h> instead of <machine/proc.h>.
(They were all defined exactly the same anyway, other than a couple
of the MDP_* flags.)
 1.3 15-Feb-2002  christos branches: 1.3.8;
- add a real linux_sys___sysctl because the mib numbers are different.
implement only the kernel version getting entries.
- make the signal conversion functions consistent; dest is arg 1.
- make linux_fakedev deal with block and char devices differently.
- add linux_sys_ugetrlimit, and flesh out the regular get/setrlimit so
that they work properly.
- add linux_mmap2 [untested].
- bump kernel to 2.4.18, and make the date be valentine's day :-)
- linux_sys_*stat64 family was totally busted. Fix it.

tested only on i386.

Status:
gdb, telnet, work
jdk-1.4.0 extractor works, jdk still coredumps.

christos
 1.2 19-Apr-1999  kleink branches: 1.2.14; 1.2.16;
Move linux_reenter_syscall() to a common location and rename it to
reenter_syscall() - it's going to be shared with COMPAT_SVR4 and soon be
used by native code.
 1.1 15-Dec-1998  itohy branches: 1.1.4;
Initial support of Linux/m68k compatibility.
 1.1.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.2.16.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.2.16.1 16-Mar-2002  jdolecek Catch up with -current.
 1.2.14.2 01-Aug-2002  nathanw Catch up to -current.
 1.2.14.1 28-Feb-2002  nathanw Catch up to -current.
 1.3.8.1 15-Jul-2002  gehenna catch up with -current.
 1.4.22.2 07-Dec-2007  yamt sync with head
 1.4.22.1 21-Jun-2006  yamt sync with head.
 1.4.6.1 11-Dec-2005  christos Sync with head.
 1.5.58.1 08-Dec-2007  ad Sync with head.
 1.5.54.1 08-Dec-2007  mjf Sync with HEAD.
 1.5.48.1 09-Jan-2008  matt sync with HEAD
 1.5.46.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.6.16.1 16-May-2008  yamt sync with head.
 1.6.14.1 18-May-2008  yamt sync with head.
 1.6.12.1 02-Jun-2008  mjf Sync with HEAD.
 1.5 14-Mar-2015  njoly Support Linux MAP_LOCKED mmap flag.
 1.4 28-Apr-2008  martin branches: 1.4.44; 1.4.64;
Remove clause 3 and 4 from TNF licenses
 1.3 11-Dec-2005  christos branches: 1.3.70; 1.3.72; 1.3.74;
merge ktrace-lwp.
 1.2 28-Aug-2004  jdolecek g/c LINUX_MAP_IGNMASK define - it's not used anywhere
 1.1 15-Dec-1998  itohy branches: 1.1.42;
Initial support of Linux/m68k compatibility.
 1.1.42.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.42.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.42.1 03-Sep-2004  skrll Sync with HEAD
 1.3.74.1 16-May-2008  yamt sync with head.
 1.3.72.1 18-May-2008  yamt sync with head.
 1.3.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.4.64.1 06-Apr-2015  skrll Sync with HEAD
 1.4.44.1 03-Dec-2017  jdolecek update from HEAD
 1.3 11-Nov-1999  thorpej Add register prefixes.
 1.2 19-Apr-1999  kleink branches: 1.2.2; 1.2.4; 1.2.8;
Move linux_reenter_syscall() to a common location and rename it to
reenter_syscall() - it's going to be shared with COMPAT_SVR4 and soon be
used by native code.
 1.1 15-Dec-1998  itohy branches: 1.1.4;
Initial support of Linux/m68k compatibility.
 1.1.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.2.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.2.4.1 15-Nov-1999  fvdl Sync with -current
 1.2.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.7 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.6 31-Mar-2002  christos branches: 1.6.108; 1.6.110; 1.6.112;
bring the reverse signal mapping array into linux_signo.c
 1.5 31-Mar-2002  christos make signal array handling uniform, and put signal arrays in a separate
file. This is simular to errno array handling.
 1.4 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.3 18-Jan-2001  jdolecek branches: 1.3.2; 1.3.4;
constify
 1.2 04-Dec-1999  tron Extend signal mapping array to 64 entries like in the i386 emulation.
 1.1 15-Dec-1998  itohy branches: 1.1.8; 1.1.14;
Initial support of Linux/m68k compatibility.
 1.1.14.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.1.8.2 11-Feb-2001  bouyer Sync with HEAD.
 1.1.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.3.4.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.3.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.3.2.2 17-Apr-2002  nathanw Catch up to -current.
 1.3.2.1 14-Nov-2001  nathanw Catch up to -current.
 1.6.112.1 16-May-2008  yamt sync with head.
 1.6.110.1 18-May-2008  yamt sync with head.
 1.6.108.1 02-Jun-2008  mjf Sync with HEAD.
 1.6 18-Nov-2011  christos - add sigtimedwait support.
- merge the siginfo population code.
 1.5 23-Nov-2008  njoly branches: 1.5.16;
Move si_code definitions from MD to MI linux_siginfo.h, all archs
(except mips for 3 values) are identical.
While here, remove unused/unneeded LINUX__SI_CODE macro. Only the
lower 16-bits are used for userland si_code.
 1.4 28-Apr-2008  martin branches: 1.4.6; 1.4.8;
Remove clause 3 and 4 from TNF licenses
 1.3 08-Apr-2002  christos branches: 1.3.108; 1.3.110; 1.3.112;
PR/16231: Ben Harris: m68k does not compile.
 1.2 04-Apr-2002  christos use lsi_ like all other linux emulations.
 1.1 15-Dec-1998  itohy branches: 1.1.20; 1.1.22;
Initial support of Linux/m68k compatibility.
 1.1.22.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.20.1 17-Apr-2002  nathanw Catch up to -current.
 1.3.112.2 04-May-2009  yamt sync with head.
 1.3.112.1 16-May-2008  yamt sync with head.
 1.3.110.1 18-May-2008  yamt sync with head.
 1.3.108.2 17-Jan-2009  mjf Sync with HEAD.
 1.3.108.1 02-Jun-2008  mjf Sync with HEAD.
 1.4.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.4.6.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.5.16.1 17-Apr-2012  yamt sync with head
 1.7 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.6 04-Dec-2007  dsl branches: 1.6.12; 1.6.14; 1.6.16;
Remove all the __P
 1.5 11-Dec-2005  christos branches: 1.5.44; 1.5.46; 1.5.52; 1.5.56;
merge ktrace-lwp.
 1.4 19-Sep-2005  christos MINSIGSTKSZ on linux is different depending on the platform and usually
smaller than ours.
 1.3 26-Nov-2002  christos branches: 1.3.6; 1.3.22;
rename: s/sa_/<compat>sa/g
 1.2 19-Mar-2002  christos - Now that RT-signals fit, fix the array to deliver them. [i386 only].
- jdk-1.4 works perfectly now. :-)
 1.1 15-Dec-1998  itohy branches: 1.1.20; 1.1.22;
Initial support of Linux/m68k compatibility.
 1.1.22.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.20.2 11-Dec-2002  thorpej Sync with HEAD.
 1.1.20.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.3.22.2 07-Dec-2007  yamt sync with head
 1.3.22.1 21-Jun-2006  yamt sync with head.
 1.3.6.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.5.56.1 08-Dec-2007  ad Sync with head.
 1.5.52.1 08-Dec-2007  mjf Sync with HEAD.
 1.5.46.1 09-Jan-2008  matt sync with HEAD
 1.5.44.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.6.16.1 16-May-2008  yamt sync with head.
 1.6.14.1 18-May-2008  yamt sync with head.
 1.6.12.1 02-Jun-2008  mjf Sync with HEAD.
 1.5 25-Jan-2014  njoly Update linux socket socket options (SO_*). Add common version to its
own file (linux_socket_generic.h); use it for all but alpha and mips.
 1.4 28-Apr-2008  martin branches: 1.4.34; 1.4.44; 1.4.50;
Remove clause 3 and 4 from TNF licenses
 1.3 11-Dec-2005  christos branches: 1.3.70; 1.3.72; 1.3.74;
merge ktrace-lwp.
 1.2 26-Jul-2003  jdolecek add LINUX_SO_PEERNAME, LINUX_SO_TIMESTAMP where it has been missing
fix value for LINUX_SO_DETACH_FILTER on couple places (unused anyway)

g/c LINUX_SCM_TIMESTAMP definition for some archs, it will be defined
in generic linux_socket.h
 1.1 15-Dec-1998  itohy branches: 1.1.42;
Initial support of Linux/m68k compatibility.
 1.1.42.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.42.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.42.1 03-Aug-2004  skrll Sync with HEAD
 1.3.74.1 16-May-2008  yamt sync with head.
 1.3.72.1 18-May-2008  yamt sync with head.
 1.3.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.4.50.1 18-May-2014  rmind sync with head
 1.4.44.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.4.34.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.120 28-Sep-2024  christos regen
 1.119 01-Jul-2024  christos regen
 1.118 29-Jun-2024  christos branches: 1.118.2;
regen
 1.117 19-Aug-2023  christos regen
 1.116 29-Jul-2023  christos regen
 1.115 28-Jul-2023  christos regen
 1.114 02-Dec-2021  ryo regen
 1.113 24-Nov-2021  ryo regen
 1.112 20-Sep-2021  thorpej Regen for preadv(2) / pwritev(2).
 1.111 20-Sep-2021  thorpej Regen for eventfd.
 1.110 19-Sep-2021  thorpej Regen for timerfd.
 1.109 19-Sep-2021  thorpej Regen for POSIX timer syscalls.
 1.108 26-Apr-2020  thorpej branches: 1.108.2;
Regen for native futex calls.
 1.107 09-Nov-2019  jdolecek regen
 1.106 10-Aug-2018  pgoyette Regen
 1.105 10-May-2017  riastradh branches: 1.105.8; 1.105.10;
regen
 1.104 03-Feb-2017  christos branches: 1.104.4;
regen
 1.103 03-Feb-2017  martin regen
 1.102 16-Jan-2017  christos regen all
 1.101 13-Jan-2017  christos branches: 1.101.2;
regen
 1.100 02-Jan-2017  martin Regen (something apparently went wrong in previous)
 1.99 02-Jan-2017  manu Regen
 1.98 24-Jul-2016  njoly Regen for readlink/readlinkat signatures.
 1.97 24-Sep-2015  christos branches: 1.97.2;
regen
 1.96 07-Mar-2015  christos regen
 1.95 22-Nov-2014  njoly branches: 1.95.2;
Regen for ppoll signature fix
 1.94 31-May-2014  njoly branches: 1.94.2;
Regen for munmap(2) signature.
 1.93 29-May-2014  njoly Regen for utimes(2) change.
 1.92 20-May-2014  njoly Regen for getgroups/setgroups update.
 1.91 17-May-2014  njoly Regen for fadvise64 offset types changes.
 1.90 06-May-2014  njoly Regen for mknod device argument type change.
 1.89 04-May-2014  njoly Regen for pread/pwrite 64bit offset argument.
 1.88 08-Apr-2014  njoly Regen.
 1.87 15-Feb-2014  njoly branches: 1.87.2;
Regen.
 1.86 24-Dec-2013  njoly Regen for fcntl64().
 1.85 08-Dec-2013  njoly Regen.
 1.84 19-Nov-2013  chs regen
 1.83 07-Nov-2013  njoly Regen for dup/dup2/dup3 argument types fix.
 1.82 24-Sep-2013  njoly Regen for utimensat(2).
 1.81 08-Apr-2013  pooka branches: 1.81.4;
regen for utimes
 1.80 19-Sep-2012  pooka regen for ppoll (and, apparently, SYCALL_ARG_PTR)
 1.79 18-Nov-2011  christos branches: 1.79.10;
- add sigtimedwait support.
- merge the siginfo population code.
 1.78 30-May-2011  alnsn branches: 1.78.4;
Regenerate files to pick up correct RCS Ids. Suggested by Chris Badura.
 1.77 30-May-2011  alnsn Add fadvise64 and fadvise64_64 syscalls to compat_linux and compat_linux32.
 1.76 15-Apr-2011  he Regenerate these files after adding pipe2() and dup3().
 1.75 07-Jul-2010  chs branches: 1.75.2;
regen
 1.74 14-Dec-2009  matt branches: 1.74.2; 1.74.4;
Regen (new makesyscalls.sh)
 1.73 24-Nov-2009  njoly Regen for personality(2) update.
 1.72 08-Jun-2009  njoly Regen for rt_queueinfo(2) update.
 1.71 17-Jan-2009  njoly branches: 1.71.2;
Regen for wait4 update.
 1.70 13-Jan-2009  pooka Regen to prove I didn't screw up the conversion: purely RCSID changes.
 1.69 11-Jan-2009  tsutsui Regen from syscalls.master rev 1.64:
> Update for compat_50 stuff. (compile test only)
 1.68 12-Nov-2008  njoly Regen for nanosleep(2) fix.
 1.67 18-Jun-2008  tsutsui branches: 1.67.2; 1.67.4; 1.67.6;
Regen from syscalls.master rev 1.62:
> Include <sys/sched.h> before <sys/syscallargs.h> for cpuset_t.
 1.66 23-Apr-2008  ad branches: 1.66.2; 1.66.4; 1.66.6;
Regen.
 1.65 04-Apr-2008  njoly branches: 1.65.2;
Regen for linux_sys_msync removal.
 1.64 15-Jan-2008  njoly branches: 1.64.6;
Regen.
 1.63 24-Dec-2007  njoly Regen for linux_sys_getpgid removal.
 1.62 21-Dec-2007  njoly Regen for getfsuid/setfsgid syscall exchange.
 1.61 20-Dec-2007  dsl regen
 1.60 16-Nov-2007  njoly branches: 1.60.2; 1.60.6;
Regen, for syscalls cleanup.
 1.59 04-Mar-2007  christos branches: 1.59.14; 1.59.16; 1.59.20; 1.59.22;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.58 01-Sep-2006  matt branches: 1.58.8;
Regen.
 1.57 30-Aug-2006  matt Regen
 1.56 13-Jun-2006  he Regenerate after fixing the getpriority syscall definition.
 1.55 10-Jun-2006  christos regen
 1.54 11-Dec-2005  christos branches: 1.54.4; 1.54.8; 1.54.14;
merge ktrace-lwp.
 1.53 18-Oct-2005  joerg Regen.
 1.52 23-May-2005  jmc branches: 1.52.2;
Regen
 1.51 16-May-2005  fvdl Regen.
 1.50 26-Feb-2005  perry regen
 1.49 01-Aug-2004  jdolecek branches: 1.49.4; 1.49.6;
regen - sync syscall lists with Linux kernel 2.6.7
 1.48 10-Aug-2003  jdolecek regen - added wrapper for Linux ftruncate64()
 1.47 29-Jun-2003  thorpej branches: 1.47.2;
Regen: adapt to linux mmap2 changes.
 1.46 23-Jun-2003  christos Regen.
 1.45 18-Jan-2003  thorpej Regen for correct RCS ID.
 1.44 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.43 01-Nov-2002  jdolecek regen: nsysent set to 256
 1.42 12-May-2002  jdolecek branches: 1.42.4;
regen
 1.41 10-Apr-2002  christos regen
 1.40 22-Mar-2002  christos regen
 1.39 17-Feb-2002  christos regen
 1.38 15-Feb-2002  christos - add a real linux_sys___sysctl because the mib numbers are different.
implement only the kernel version getting entries.
- make the signal conversion functions consistent; dest is arg 1.
- make linux_fakedev deal with block and char devices differently.
- add linux_sys_ugetrlimit, and flesh out the regular get/setrlimit so
that they work properly.
- add linux_mmap2 [untested].
- bump kernel to 2.4.18, and make the date be valentine's day :-)
- linux_sys_*stat64 family was totally busted. Fix it.

tested only on i386.

Status:
gdb, telnet, work
jdk-1.4.0 extractor works, jdk still coredumps.

christos
 1.37 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.36 30-May-2001  mrg branches: 1.36.2;
use _KERNEL_OPT.
 1.35 13-May-2001  manu Improved the accuracy of gettimeofday/settimeofday: Linux stores a srtuct
timezone in the kernel. We now keep track of it for emulated processes.
Tested for powerpc and i386. Untested on m68k, but it should be ok
Alpha has a particular implementation (osf1_sys_gettimeofday), and it has
therefore not been touched.
 1.34 30-Mar-2001  jdolecek regen - use linux_sys_nosys() instead sys_nosys()
 1.33 30-Mar-2001  jdolecek regen
 1.32 30-Mar-2001  jdolecek regen
 1.31 27-Jan-2001  thorpej branches: 1.31.2;
Regen; getpid(2) is MP-safe.
 1.30 27-Jan-2001  thorpej Regen; add sy_flags.
 1.29 29-Dec-2000  fvdl Regen.
 1.28 27-Dec-2000  fvdl Regen.
 1.27 26-Dec-2000  itohy Regen.
 1.26 18-Dec-2000  fvdl Regen.
 1.25 14-Dec-2000  jdolecek regen
 1.24 12-Dec-2000  jdolecek regen
 1.23 12-Dec-2000  jdolecek regen
 1.22 09-Dec-2000  jdolecek regen
 1.21 09-Dec-2000  mycroft Regen.
 1.20 02-Dec-2000  jdolecek regen after addition of linux_sys_swapoff()
 1.19 01-Dec-2000  jdolecek regen
 1.18 01-Nov-2000  jdolecek regen
 1.17 31-Aug-2000  itohy Regen.
 1.16 18-Aug-2000  cgd update for changed makesyscalls.master
 1.15 18-Aug-2000  cgd update for new makesyscalls.sh, and also for correct ids for changed
syscalls.master files. (you need to regenerate after checking in
syscalls.master to get the correct ids.)
 1.14 18-Mar-2000  erh branches: 1.14.4;
Regen.
 1.13 03-Feb-2000  abs regen
 1.12 16-Dec-1999  tron Regen.
 1.11 05-Dec-1999  tron Regen.
 1.10 04-Dec-1999  tron Regen.
 1.9 04-Oct-1999  tron branches: 1.9.2; 1.9.8;
Regen from "syscalls.master".
 1.8 16-Aug-1999  tron Regen.
 1.7 14-May-1999  thorpej Regen.
 1.6 13-May-1999  thorpej Regen.
 1.5 30-Mar-1999  tron branches: 1.5.4;
Regen.
 1.4 27-Mar-1999  tron Regen.
 1.3 23-Mar-1999  thorpej Regen; pread(2) and pwrite(2).
 1.2 10-Feb-1999  itohy Regen.
 1.1 15-Dec-1998  itohy Generated from syscalls.master.
 1.5.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.9.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.9.2.7 21-Apr-2001  bouyer Sync with HEAD
 1.9.2.6 11-Feb-2001  bouyer Sync with HEAD.
 1.9.2.5 05-Jan-2001  bouyer Sync with HEAD
 1.9.2.4 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.9.2.3 08-Dec-2000  bouyer Sync with HEAD.
 1.9.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.9.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.14.4.2 01-May-2001  he Pull up regenerated files (requested by jdolecek):
Make it possible to use a different function for unimplemented
syscalls than sys_nosys(), so that the Linux emulation can avoid
posting SIGSYS and instead just return ENOSYS.
 1.14.4.1 30-Mar-2001  he Pull up regenerated files (requested by fvdl):
Add some required Linux emulation bits to support the Linux
version of VMware.
 1.31.2.9 11-Nov-2002  nathanw Catch up to -current
 1.31.2.8 20-Jun-2002  nathanw Catch up to -current.
 1.31.2.7 29-May-2002  nathanw Regen.
 1.31.2.6 17-Apr-2002  nathanw Catch up to -current.
 1.31.2.5 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.31.2.4 28-Feb-2002  nathanw Catch up to -current.
 1.31.2.3 14-Nov-2001  nathanw Catch up to -current.
 1.31.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.31.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.36.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.36.2.2 16-Mar-2002  jdolecek Catch up with -current.
 1.36.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.42.4.4 27-May-2004  tron Regen for ticket #1701.
 1.42.4.3 11-May-2004  tron Regen for ticket 1686.
 1.42.4.2 20-Nov-2003  jmc Regen after fix in syscalls.master from ticket #1427.
 1.42.4.1 22-Oct-2003  jmc Regen files (requested by tv in ticket #1427)

Proper support for mmap2
 1.47.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.47.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.47.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.47.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.47.2.1 03-Aug-2004  skrll Sync with HEAD
 1.49.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.49.4.1 29-Apr-2005  kent sync with -current
 1.52.2.5 21-Jan-2008  yamt sync with head
 1.52.2.4 07-Dec-2007  yamt sync with head
 1.52.2.3 03-Sep-2007  yamt sync with head.
 1.52.2.2 30-Dec-2006  yamt sync with head.
 1.52.2.1 21-Jun-2006  yamt sync with head.
 1.54.14.1 19-Jun-2006  chap Sync with head.
 1.54.8.2 03-Sep-2006  yamt sync with head.
 1.54.8.1 26-Jun-2006  yamt sync with head.
 1.54.4.1 09-Sep-2006  rpaulo sync with head
 1.58.8.1 12-Mar-2007  rmind Sync with HEAD.
 1.59.22.3 18-Feb-2008  mjf Sync with HEAD.
 1.59.22.2 27-Dec-2007  mjf Sync with HEAD.
 1.59.22.1 19-Nov-2007  mjf Sync with HEAD.
 1.59.20.1 18-Nov-2007  bouyer Sync with HEAD
 1.59.16.2 23-Mar-2008  matt sync with HEAD
 1.59.16.1 09-Jan-2008  matt sync with HEAD
 1.59.14.1 21-Nov-2007  joerg Sync with HEAD.
 1.60.6.2 19-Jan-2008  bouyer Sync with HEAD
 1.60.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.60.2.1 26-Dec-2007  ad Sync with head.
 1.64.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.64.6.2 29-Jun-2008  mjf Sync with HEAD.
 1.64.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.65.2.1 18-May-2008  yamt sync with head.
 1.66.6.1 18-Jun-2008  simonb Sync with head.
 1.66.4.2 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.66.4.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.66.2.4 11-Aug-2010  yamt sync with head.
 1.66.2.3 11-Mar-2010  yamt sync with head
 1.66.2.2 20-Jun-2009  yamt sync with head
 1.66.2.1 04-May-2009  yamt sync with head.
 1.67.6.1 20-Nov-2008  snj Regen for ticket 81.
 1.67.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.67.2.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.71.2.1 23-Jul-2009  jym Sync with HEAD.
 1.74.4.3 31-May-2011  rmind sync with head
 1.74.4.2 21-Apr-2011  rmind sync with head
 1.74.4.1 05-Mar-2011  rmind sync with head
 1.74.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.75.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.78.4.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.78.4.2 30-Oct-2012  yamt sync with head
 1.78.4.1 17-Apr-2012  yamt sync with head
 1.79.10.4 03-Dec-2017  jdolecek update from HEAD
 1.79.10.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.79.10.2 23-Jun-2013  tls resync from head
 1.79.10.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.81.4.1 18-May-2014  rmind sync with head
 1.87.2.1 10-Aug-2014  tls Rebase.
 1.94.2.1 17-Apr-2017  snj regen for ticket 1354
 1.95.2.3 05-Feb-2017  skrll Sync with HEAD
 1.95.2.2 05-Oct-2016  skrll Sync with HEAD
 1.95.2.1 06-Apr-2015  skrll Sync with HEAD
 1.97.2.3 20-Mar-2017  pgoyette Sync with HEAD
 1.97.2.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.97.2.1 26-Jul-2016  pgoyette Sync with HEAD
 1.101.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.104.4.1 11-May-2017  pgoyette Sync with HEAD
 1.105.10.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.105.10.1 10-Jun-2019  christos Sync with HEAD
 1.105.8.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.108.2.2 17-Dec-2020  thorpej Regen for preadv(2) and pwritev(2).
 1.108.2.1 15-Dec-2020  thorpej Regen for eventfd, timerfd, POSIX timers.
 1.118.2.1 02-Aug-2025  perseant Sync with HEAD
 1.119 28-Sep-2024  christos regen
 1.118 01-Jul-2024  christos regen
 1.117 29-Jun-2024  christos branches: 1.117.2;
regen
 1.116 19-Aug-2023  christos regen
 1.115 29-Jul-2023  christos regen
 1.114 28-Jul-2023  christos regen
 1.113 02-Dec-2021  ryo regen
 1.112 24-Nov-2021  ryo regen
 1.111 20-Sep-2021  thorpej Regen for preadv(2) / pwritev(2).
 1.110 20-Sep-2021  thorpej Regen for eventfd.
 1.109 19-Sep-2021  thorpej Regen for timerfd.
 1.108 19-Sep-2021  thorpej Regen for POSIX timer syscalls.
 1.107 26-Apr-2020  thorpej branches: 1.107.2;
Regen for native futex calls.
 1.106 09-Nov-2019  jdolecek regen
 1.105 10-Aug-2018  pgoyette Regen
 1.104 10-May-2017  riastradh branches: 1.104.8; 1.104.10;
regen
 1.103 03-Feb-2017  christos branches: 1.103.4;
regen
 1.102 03-Feb-2017  martin regen
 1.101 16-Jan-2017  christos regen all
 1.100 13-Jan-2017  christos branches: 1.100.2;
regen
 1.99 02-Jan-2017  martin Regen (something apparently went wrong in previous)
 1.98 02-Jan-2017  manu Regen
 1.97 24-Jul-2016  njoly Regen for readlink/readlinkat signatures.
 1.96 24-Sep-2015  christos branches: 1.96.2;
regen
 1.95 07-Mar-2015  christos regen
 1.94 22-Nov-2014  njoly branches: 1.94.2;
Regen for ppoll signature fix
 1.93 31-May-2014  njoly branches: 1.93.2;
Regen for munmap(2) signature.
 1.92 29-May-2014  njoly Regen for utimes(2) change.
 1.91 20-May-2014  njoly Regen for getgroups/setgroups update.
 1.90 17-May-2014  njoly Regen for fadvise64 offset types changes.
 1.89 06-May-2014  njoly Regen for mknod device argument type change.
 1.88 04-May-2014  njoly Regen for pread/pwrite 64bit offset argument.
 1.87 08-Apr-2014  njoly Regen.
 1.86 15-Feb-2014  njoly branches: 1.86.2;
Regen.
 1.85 24-Dec-2013  njoly Regen for fcntl64().
 1.84 08-Dec-2013  njoly Regen.
 1.83 19-Nov-2013  chs regen
 1.82 07-Nov-2013  njoly Regen for dup/dup2/dup3 argument types fix.
 1.81 24-Sep-2013  njoly Regen for utimensat(2).
 1.80 08-Apr-2013  pooka branches: 1.80.4;
regen for utimes
 1.79 19-Sep-2012  pooka regen for ppoll (and, apparently, SYCALL_ARG_PTR)
 1.78 18-Nov-2011  christos branches: 1.78.10;
- add sigtimedwait support.
- merge the siginfo population code.
 1.77 30-May-2011  alnsn branches: 1.77.4;
Regenerate files to pick up correct RCS Ids. Suggested by Chris Badura.
 1.76 30-May-2011  alnsn Add fadvise64 and fadvise64_64 syscalls to compat_linux and compat_linux32.
 1.75 15-Apr-2011  he Regenerate these files after adding pipe2() and dup3().
 1.74 07-Jul-2010  chs branches: 1.74.2;
regen
 1.73 14-Dec-2009  matt branches: 1.73.2; 1.73.4;
Regen (new makesyscalls.sh)
 1.72 24-Nov-2009  njoly Regen for personality(2) update.
 1.71 08-Jun-2009  njoly Regen for rt_queueinfo(2) update.
 1.70 17-Jan-2009  njoly branches: 1.70.2;
Regen for wait4 update.
 1.69 13-Jan-2009  pooka Regen to prove I didn't screw up the conversion: purely RCSID changes.
 1.68 11-Jan-2009  tsutsui Regen from syscalls.master rev 1.64:
> Update for compat_50 stuff. (compile test only)
 1.67 12-Nov-2008  njoly Regen for nanosleep(2) fix.
 1.66 18-Jun-2008  tsutsui branches: 1.66.2; 1.66.4; 1.66.6;
Regen from syscalls.master rev 1.62:
> Include <sys/sched.h> before <sys/syscallargs.h> for cpuset_t.
 1.65 23-Apr-2008  ad branches: 1.65.2; 1.65.4; 1.65.6;
Regen.
 1.64 04-Apr-2008  njoly branches: 1.64.2;
Regen for linux_sys_msync removal.
 1.63 15-Jan-2008  njoly branches: 1.63.6;
Regen.
 1.62 24-Dec-2007  njoly Regen for linux_sys_getpgid removal.
 1.61 21-Dec-2007  njoly Regen for getfsuid/setfsgid syscall exchange.
 1.60 20-Dec-2007  dsl regen
 1.59 16-Nov-2007  njoly branches: 1.59.2; 1.59.6;
Regen, for syscalls cleanup.
 1.58 04-Mar-2007  christos branches: 1.58.14; 1.58.16; 1.58.20; 1.58.22;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.57 01-Sep-2006  matt branches: 1.57.8;
Regen.
 1.56 30-Aug-2006  matt Regen
 1.55 13-Jun-2006  he Regenerate after fixing the getpriority syscall definition.
 1.54 10-Jun-2006  christos regen
 1.53 11-Dec-2005  christos branches: 1.53.4; 1.53.8; 1.53.14;
merge ktrace-lwp.
 1.52 18-Oct-2005  joerg Regen.
 1.51 23-May-2005  jmc branches: 1.51.2;
Regen
 1.50 16-May-2005  fvdl Regen.
 1.49 26-Feb-2005  perry regen
 1.48 01-Aug-2004  jdolecek branches: 1.48.4; 1.48.6;
regen - sync syscall lists with Linux kernel 2.6.7
 1.47 10-Aug-2003  jdolecek regen - added wrapper for Linux ftruncate64()
 1.46 29-Jun-2003  thorpej branches: 1.46.2;
Regen: adapt to linux mmap2 changes.
 1.45 23-Jun-2003  christos Regen.
 1.44 18-Jan-2003  thorpej Regen for correct RCS ID.
 1.43 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.42 12-May-2002  jdolecek branches: 1.42.4;
regen
 1.41 10-Apr-2002  christos regen
 1.40 22-Mar-2002  christos regen
 1.39 17-Feb-2002  christos regen
 1.38 15-Feb-2002  christos - add a real linux_sys___sysctl because the mib numbers are different.
implement only the kernel version getting entries.
- make the signal conversion functions consistent; dest is arg 1.
- make linux_fakedev deal with block and char devices differently.
- add linux_sys_ugetrlimit, and flesh out the regular get/setrlimit so
that they work properly.
- add linux_mmap2 [untested].
- bump kernel to 2.4.18, and make the date be valentine's day :-)
- linux_sys_*stat64 family was totally busted. Fix it.

tested only on i386.

Status:
gdb, telnet, work
jdk-1.4.0 extractor works, jdk still coredumps.

christos
 1.37 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.36 30-May-2001  mrg branches: 1.36.2;
use _KERNEL_OPT.
 1.35 13-May-2001  manu Improved the accuracy of gettimeofday/settimeofday: Linux stores a srtuct
timezone in the kernel. We now keep track of it for emulated processes.
Tested for powerpc and i386. Untested on m68k, but it should be ok
Alpha has a particular implementation (osf1_sys_gettimeofday), and it has
therefore not been touched.
 1.34 30-Mar-2001  jdolecek regen - use linux_sys_nosys() instead sys_nosys()
 1.33 30-Mar-2001  jdolecek regen
 1.32 30-Mar-2001  jdolecek regen
 1.31 27-Jan-2001  thorpej branches: 1.31.2;
Regen; getpid(2) is MP-safe.
 1.30 27-Jan-2001  thorpej Regen; add sy_flags.
 1.29 29-Dec-2000  fvdl Regen.
 1.28 27-Dec-2000  fvdl Regen.
 1.27 26-Dec-2000  itohy Regen.
 1.26 18-Dec-2000  fvdl Regen.
 1.25 14-Dec-2000  jdolecek regen
 1.24 12-Dec-2000  jdolecek regen
 1.23 12-Dec-2000  jdolecek regen
 1.22 09-Dec-2000  jdolecek regen
 1.21 09-Dec-2000  mycroft Regen.
 1.20 02-Dec-2000  jdolecek regen after addition of linux_sys_swapoff()
 1.19 01-Dec-2000  jdolecek regen
 1.18 01-Nov-2000  jdolecek regen
 1.17 31-Aug-2000  itohy Regen.
 1.16 18-Aug-2000  cgd update for changed makesyscalls.master
 1.15 18-Aug-2000  cgd update for new makesyscalls.sh, and also for correct ids for changed
syscalls.master files. (you need to regenerate after checking in
syscalls.master to get the correct ids.)
 1.14 18-Mar-2000  erh branches: 1.14.4;
Regen.
 1.13 03-Feb-2000  abs regen
 1.12 16-Dec-1999  tron Regen.
 1.11 05-Dec-1999  tron Regen.
 1.10 04-Dec-1999  tron Regen.
 1.9 04-Oct-1999  tron branches: 1.9.2; 1.9.8;
Regen from "syscalls.master".
 1.8 16-Aug-1999  tron Regen.
 1.7 14-May-1999  thorpej Regen.
 1.6 13-May-1999  thorpej Regen.
 1.5 30-Mar-1999  tron branches: 1.5.4;
Regen.
 1.4 27-Mar-1999  tron Regen.
 1.3 23-Mar-1999  thorpej Regen; pread(2) and pwrite(2).
 1.2 10-Feb-1999  itohy Regen.
 1.1 15-Dec-1998  itohy Generated from syscalls.master.
 1.5.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.9.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.9.2.7 21-Apr-2001  bouyer Sync with HEAD
 1.9.2.6 11-Feb-2001  bouyer Sync with HEAD.
 1.9.2.5 05-Jan-2001  bouyer Sync with HEAD
 1.9.2.4 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.9.2.3 08-Dec-2000  bouyer Sync with HEAD.
 1.9.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.9.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.14.4.2 01-May-2001  he Pull up regenerated files (requested by jdolecek):
Make it possible to use a different function for unimplemented
syscalls than sys_nosys(), so that the Linux emulation can avoid
posting SIGSYS and instead just return ENOSYS.
 1.14.4.1 30-Mar-2001  he Pull up regenerated files (requested by fvdl):
Add some required Linux emulation bits to support the Linux
version of VMware.
 1.31.2.7 29-May-2002  nathanw Regen.
 1.31.2.6 17-Apr-2002  nathanw Catch up to -current.
 1.31.2.5 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.31.2.4 28-Feb-2002  nathanw Catch up to -current.
 1.31.2.3 14-Nov-2001  nathanw Catch up to -current.
 1.31.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.31.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.36.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.36.2.2 16-Mar-2002  jdolecek Catch up with -current.
 1.36.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.42.4.4 27-May-2004  tron Regen for ticket #1701.
 1.42.4.3 11-May-2004  tron Regen for ticket 1686.
 1.42.4.2 20-Nov-2003  jmc Regen after fix in syscalls.master from ticket #1427.
 1.42.4.1 22-Oct-2003  jmc Regen files (requested by tv in ticket #1427)

Proper support for mmap2
 1.46.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.46.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.46.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.46.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.46.2.1 03-Aug-2004  skrll Sync with HEAD
 1.48.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.48.4.1 29-Apr-2005  kent sync with -current
 1.51.2.5 21-Jan-2008  yamt sync with head
 1.51.2.4 07-Dec-2007  yamt sync with head
 1.51.2.3 03-Sep-2007  yamt sync with head.
 1.51.2.2 30-Dec-2006  yamt sync with head.
 1.51.2.1 21-Jun-2006  yamt sync with head.
 1.53.14.1 19-Jun-2006  chap Sync with head.
 1.53.8.2 03-Sep-2006  yamt sync with head.
 1.53.8.1 26-Jun-2006  yamt sync with head.
 1.53.4.1 09-Sep-2006  rpaulo sync with head
 1.57.8.1 12-Mar-2007  rmind Sync with HEAD.
 1.58.22.3 18-Feb-2008  mjf Sync with HEAD.
 1.58.22.2 27-Dec-2007  mjf Sync with HEAD.
 1.58.22.1 19-Nov-2007  mjf Sync with HEAD.
 1.58.20.1 18-Nov-2007  bouyer Sync with HEAD
 1.58.16.2 23-Mar-2008  matt sync with HEAD
 1.58.16.1 09-Jan-2008  matt sync with HEAD
 1.58.14.1 21-Nov-2007  joerg Sync with HEAD.
 1.59.6.2 19-Jan-2008  bouyer Sync with HEAD
 1.59.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.59.2.1 26-Dec-2007  ad Sync with head.
 1.63.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.63.6.2 29-Jun-2008  mjf Sync with HEAD.
 1.63.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.64.2.1 18-May-2008  yamt sync with head.
 1.65.6.1 18-Jun-2008  simonb Sync with head.
 1.65.4.2 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.65.4.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.65.2.4 11-Aug-2010  yamt sync with head.
 1.65.2.3 11-Mar-2010  yamt sync with head
 1.65.2.2 20-Jun-2009  yamt sync with head
 1.65.2.1 04-May-2009  yamt sync with head.
 1.66.6.1 20-Nov-2008  snj Regen for ticket 81.
 1.66.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.66.2.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.70.2.1 23-Jul-2009  jym Sync with HEAD.
 1.73.4.3 31-May-2011  rmind sync with head
 1.73.4.2 21-Apr-2011  rmind sync with head
 1.73.4.1 05-Mar-2011  rmind sync with head
 1.73.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.74.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.77.4.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.77.4.2 30-Oct-2012  yamt sync with head
 1.77.4.1 17-Apr-2012  yamt sync with head
 1.78.10.4 03-Dec-2017  jdolecek update from HEAD
 1.78.10.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.78.10.2 23-Jun-2013  tls resync from head
 1.78.10.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.80.4.1 18-May-2014  rmind sync with head
 1.86.2.1 10-Aug-2014  tls Rebase.
 1.93.2.1 17-Apr-2017  snj regen for ticket 1354
 1.94.2.4 28-Aug-2017  skrll Sync with HEAD
 1.94.2.3 05-Feb-2017  skrll Sync with HEAD
 1.94.2.2 05-Oct-2016  skrll Sync with HEAD
 1.94.2.1 06-Apr-2015  skrll Sync with HEAD
 1.96.2.3 20-Mar-2017  pgoyette Sync with HEAD
 1.96.2.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.96.2.1 26-Jul-2016  pgoyette Sync with HEAD
 1.100.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.103.4.1 11-May-2017  pgoyette Sync with HEAD
 1.104.10.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.104.10.1 10-Jun-2019  christos Sync with HEAD
 1.104.8.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.107.2.2 17-Dec-2020  thorpej Regen for preadv(2) and pwritev(2).
 1.107.2.1 15-Dec-2020  thorpej Regen for eventfd, timerfd, POSIX timers.
 1.117.2.1 02-Aug-2025  perseant Sync with HEAD
 1.120 28-Sep-2024  christos regen
 1.119 01-Jul-2024  christos regen
 1.118 29-Jun-2024  christos branches: 1.118.2;
regen
 1.117 19-Aug-2023  christos regen
 1.116 29-Jul-2023  christos regen
 1.115 28-Jul-2023  christos regen
 1.114 02-Dec-2021  ryo regen
 1.113 24-Nov-2021  ryo regen
 1.112 20-Sep-2021  thorpej Regen for preadv(2) / pwritev(2).
 1.111 20-Sep-2021  thorpej Regen for eventfd.
 1.110 19-Sep-2021  thorpej Regen for timerfd.
 1.109 19-Sep-2021  thorpej Regen for POSIX timer syscalls.
 1.108 26-Apr-2020  thorpej branches: 1.108.2;
Regen for native futex calls.
 1.107 09-Nov-2019  jdolecek regen
 1.106 10-Aug-2018  pgoyette Regen
 1.105 10-May-2017  riastradh branches: 1.105.8; 1.105.10;
regen
 1.104 03-Feb-2017  christos branches: 1.104.4;
regen
 1.103 03-Feb-2017  martin regen
 1.102 16-Jan-2017  christos regen all
 1.101 13-Jan-2017  christos branches: 1.101.2;
regen
 1.100 02-Jan-2017  martin Regen (something apparently went wrong in previous)
 1.99 02-Jan-2017  manu Regen
 1.98 24-Jul-2016  njoly Regen for readlink/readlinkat signatures.
 1.97 24-Sep-2015  christos branches: 1.97.2;
regen
 1.96 07-Mar-2015  christos regen
 1.95 22-Nov-2014  njoly branches: 1.95.2;
Regen for ppoll signature fix
 1.94 31-May-2014  njoly branches: 1.94.2;
Regen for munmap(2) signature.
 1.93 29-May-2014  njoly Regen for utimes(2) change.
 1.92 20-May-2014  njoly Regen for getgroups/setgroups update.
 1.91 17-May-2014  njoly Regen for fadvise64 offset types changes.
 1.90 06-May-2014  njoly Regen for mknod device argument type change.
 1.89 04-May-2014  njoly Regen for pread/pwrite 64bit offset argument.
 1.88 08-Apr-2014  njoly Regen.
 1.87 15-Feb-2014  njoly branches: 1.87.2;
Regen.
 1.86 24-Dec-2013  njoly Regen for fcntl64().
 1.85 08-Dec-2013  njoly Regen.
 1.84 19-Nov-2013  chs regen
 1.83 07-Nov-2013  njoly Regen for dup/dup2/dup3 argument types fix.
 1.82 24-Sep-2013  njoly Regen for utimensat(2).
 1.81 08-Apr-2013  pooka branches: 1.81.4;
regen for utimes
 1.80 19-Sep-2012  pooka regen for ppoll (and, apparently, SYCALL_ARG_PTR)
 1.79 18-Nov-2011  christos branches: 1.79.10;
- add sigtimedwait support.
- merge the siginfo population code.
 1.78 30-May-2011  alnsn branches: 1.78.4;
Regenerate files to pick up correct RCS Ids. Suggested by Chris Badura.
 1.77 30-May-2011  alnsn Add fadvise64 and fadvise64_64 syscalls to compat_linux and compat_linux32.
 1.76 15-Apr-2011  he Regenerate these files after adding pipe2() and dup3().
 1.75 07-Jul-2010  chs branches: 1.75.2;
regen
 1.74 14-Dec-2009  matt branches: 1.74.2; 1.74.4;
Regen (new makesyscalls.sh)
 1.73 24-Nov-2009  njoly Regen for personality(2) update.
 1.72 08-Jun-2009  njoly Regen for rt_queueinfo(2) update.
 1.71 17-Jan-2009  njoly branches: 1.71.2;
Regen for wait4 update.
 1.70 13-Jan-2009  pooka Regen to prove I didn't screw up the conversion: purely RCSID changes.
 1.69 11-Jan-2009  tsutsui Regen from syscalls.master rev 1.64:
> Update for compat_50 stuff. (compile test only)
 1.68 12-Nov-2008  njoly Regen for nanosleep(2) fix.
 1.67 18-Jun-2008  tsutsui branches: 1.67.2; 1.67.4; 1.67.6;
Regen from syscalls.master rev 1.62:
> Include <sys/sched.h> before <sys/syscallargs.h> for cpuset_t.
 1.66 23-Apr-2008  ad branches: 1.66.2; 1.66.4; 1.66.6;
Regen.
 1.65 04-Apr-2008  njoly branches: 1.65.2;
Regen for linux_sys_msync removal.
 1.64 15-Jan-2008  njoly branches: 1.64.6;
Regen.
 1.63 24-Dec-2007  njoly Regen for linux_sys_getpgid removal.
 1.62 21-Dec-2007  njoly Regen for getfsuid/setfsgid syscall exchange.
 1.61 20-Dec-2007  dsl regen
 1.60 16-Nov-2007  njoly branches: 1.60.2; 1.60.6;
Regen, for syscalls cleanup.
 1.59 09-Feb-2007  ad branches: 1.59.18; 1.59.20; 1.59.24; 1.59.26;
Merge newlock2 to head.
 1.58 01-Sep-2006  matt branches: 1.58.2;
Regen.
 1.57 30-Aug-2006  matt Regen
 1.56 13-Jun-2006  he Regenerate after fixing the getpriority syscall definition.
 1.55 10-Jun-2006  christos regen
 1.54 11-Dec-2005  christos branches: 1.54.4; 1.54.8; 1.54.14;
merge ktrace-lwp.
 1.53 18-Oct-2005  joerg Regen.
 1.52 23-May-2005  jmc branches: 1.52.2;
Regen
 1.51 16-May-2005  fvdl Regen.
 1.50 26-Feb-2005  perry regen
 1.49 01-Aug-2004  jdolecek branches: 1.49.4; 1.49.6;
regen - sync syscall lists with Linux kernel 2.6.7
 1.48 10-Aug-2003  jdolecek regen - added wrapper for Linux ftruncate64()
 1.47 29-Jun-2003  thorpej branches: 1.47.2;
Regen: adapt to linux mmap2 changes.
 1.46 23-Jun-2003  christos Regen.
 1.45 18-Jan-2003  thorpej Regen for correct RCS ID.
 1.44 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.43 12-May-2002  jdolecek branches: 1.43.4;
regen
 1.42 10-Apr-2002  christos regen
 1.41 22-Mar-2002  christos regen
 1.40 17-Feb-2002  christos regen
 1.39 15-Feb-2002  christos - add a real linux_sys___sysctl because the mib numbers are different.
implement only the kernel version getting entries.
- make the signal conversion functions consistent; dest is arg 1.
- make linux_fakedev deal with block and char devices differently.
- add linux_sys_ugetrlimit, and flesh out the regular get/setrlimit so
that they work properly.
- add linux_mmap2 [untested].
- bump kernel to 2.4.18, and make the date be valentine's day :-)
- linux_sys_*stat64 family was totally busted. Fix it.

tested only on i386.

Status:
gdb, telnet, work
jdk-1.4.0 extractor works, jdk still coredumps.

christos
 1.38 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.37 30-May-2001  mrg branches: 1.37.2;
use _KERNEL_OPT.
 1.36 13-May-2001  manu Improved the accuracy of gettimeofday/settimeofday: Linux stores a srtuct
timezone in the kernel. We now keep track of it for emulated processes.
Tested for powerpc and i386. Untested on m68k, but it should be ok
Alpha has a particular implementation (osf1_sys_gettimeofday), and it has
therefore not been touched.
 1.35 30-Mar-2001  jdolecek regen - use linux_sys_nosys() instead sys_nosys()
 1.34 30-Mar-2001  jdolecek regen
 1.33 30-Mar-2001  jdolecek regen
 1.32 27-Jan-2001  thorpej branches: 1.32.2;
Regen; getpid(2) is MP-safe.
 1.31 27-Jan-2001  thorpej Regen; add sy_flags.
 1.30 29-Dec-2000  fvdl Regen.
 1.29 27-Dec-2000  fvdl Regen.
 1.28 26-Dec-2000  itohy Regen.
 1.27 18-Dec-2000  fvdl Regen.
 1.26 14-Dec-2000  jdolecek regen
 1.25 12-Dec-2000  jdolecek regen
 1.24 12-Dec-2000  jdolecek regen
 1.23 09-Dec-2000  jdolecek regen
 1.22 09-Dec-2000  mycroft Regen.
 1.21 02-Dec-2000  jdolecek regen after addition of linux_sys_swapoff()
 1.20 01-Dec-2000  jdolecek regen
 1.19 13-Nov-2000  jdolecek change the type of *syscallnames[] array to 'const char * const foo[]'
 1.18 01-Nov-2000  jdolecek regen
 1.17 31-Aug-2000  itohy Regen.
 1.16 18-Aug-2000  cgd update for changed makesyscalls.master
 1.15 18-Aug-2000  cgd update for new makesyscalls.sh, and also for correct ids for changed
syscalls.master files. (you need to regenerate after checking in
syscalls.master to get the correct ids.)
 1.14 18-Mar-2000  erh branches: 1.14.4;
Regen.
 1.13 03-Feb-2000  abs regen
 1.12 16-Dec-1999  tron Regen.
 1.11 05-Dec-1999  tron Regen.
 1.10 04-Dec-1999  tron Regen.
 1.9 04-Oct-1999  tron branches: 1.9.2; 1.9.8;
Regen from "syscalls.master".
 1.8 16-Aug-1999  tron Regen.
 1.7 14-May-1999  thorpej Regen.
 1.6 13-May-1999  thorpej Regen.
 1.5 30-Mar-1999  tron branches: 1.5.4;
Regen.
 1.4 27-Mar-1999  tron Regen.
 1.3 23-Mar-1999  thorpej Regen; pread(2) and pwrite(2).
 1.2 10-Feb-1999  itohy Regen.
 1.1 15-Dec-1998  itohy Generated from syscalls.master.
 1.5.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.9.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.9.2.7 21-Apr-2001  bouyer Sync with HEAD
 1.9.2.6 11-Feb-2001  bouyer Sync with HEAD.
 1.9.2.5 05-Jan-2001  bouyer Sync with HEAD
 1.9.2.4 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.9.2.3 08-Dec-2000  bouyer Sync with HEAD.
 1.9.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.9.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.14.4.2 01-May-2001  he Pull up regenerated files (requested by jdolecek):
Make it possible to use a different function for unimplemented
syscalls than sys_nosys(), so that the Linux emulation can avoid
posting SIGSYS and instead just return ENOSYS.
 1.14.4.1 30-Mar-2001  he Pull up regenerated files (requested by fvdl):
Add some required Linux emulation bits to support the Linux
version of VMware.
 1.32.2.8 20-Jun-2002  nathanw Catch up to -current.
 1.32.2.7 29-May-2002  nathanw Regen.
 1.32.2.6 17-Apr-2002  nathanw Catch up to -current.
 1.32.2.5 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.32.2.4 28-Feb-2002  nathanw Catch up to -current.
 1.32.2.3 14-Nov-2001  nathanw Catch up to -current.
 1.32.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.32.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.37.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.37.2.2 16-Mar-2002  jdolecek Catch up with -current.
 1.37.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.43.4.4 27-May-2004  tron Regen for ticket #1701.
 1.43.4.3 11-May-2004  tron Regen for ticket 1686.
 1.43.4.2 20-Nov-2003  jmc Regen after fix in syscalls.master from ticket #1427.
 1.43.4.1 22-Oct-2003  jmc Regen files (requested by tv in ticket #1427)

Proper support for mmap2
 1.47.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.47.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.47.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.47.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.47.2.1 03-Aug-2004  skrll Sync with HEAD
 1.49.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.49.4.1 29-Apr-2005  kent sync with -current
 1.52.2.5 21-Jan-2008  yamt sync with head
 1.52.2.4 07-Dec-2007  yamt sync with head
 1.52.2.3 26-Feb-2007  yamt sync with head.
 1.52.2.2 30-Dec-2006  yamt sync with head.
 1.52.2.1 21-Jun-2006  yamt sync with head.
 1.54.14.1 19-Jun-2006  chap Sync with head.
 1.54.8.2 03-Sep-2006  yamt sync with head.
 1.54.8.1 26-Jun-2006  yamt sync with head.
 1.54.4.1 09-Sep-2006  rpaulo sync with head
 1.58.2.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.59.26.3 18-Feb-2008  mjf Sync with HEAD.
 1.59.26.2 27-Dec-2007  mjf Sync with HEAD.
 1.59.26.1 19-Nov-2007  mjf Sync with HEAD.
 1.59.24.1 18-Nov-2007  bouyer Sync with HEAD
 1.59.20.2 23-Mar-2008  matt sync with HEAD
 1.59.20.1 09-Jan-2008  matt sync with HEAD
 1.59.18.1 21-Nov-2007  joerg Sync with HEAD.
 1.60.6.2 19-Jan-2008  bouyer Sync with HEAD
 1.60.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.60.2.1 26-Dec-2007  ad Sync with head.
 1.64.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.64.6.2 29-Jun-2008  mjf Sync with HEAD.
 1.64.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.65.2.1 18-May-2008  yamt sync with head.
 1.66.6.1 18-Jun-2008  simonb Sync with head.
 1.66.4.3 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.66.4.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.66.4.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.66.2.4 11-Aug-2010  yamt sync with head.
 1.66.2.3 11-Mar-2010  yamt sync with head
 1.66.2.2 20-Jun-2009  yamt sync with head
 1.66.2.1 04-May-2009  yamt sync with head.
 1.67.6.1 20-Nov-2008  snj Regen for ticket 81.
 1.67.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.67.2.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.71.2.1 23-Jul-2009  jym Sync with HEAD.
 1.74.4.3 31-May-2011  rmind sync with head
 1.74.4.2 21-Apr-2011  rmind sync with head
 1.74.4.1 05-Mar-2011  rmind sync with head
 1.74.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.75.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.78.4.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.78.4.2 30-Oct-2012  yamt sync with head
 1.78.4.1 17-Apr-2012  yamt sync with head
 1.79.10.4 03-Dec-2017  jdolecek update from HEAD
 1.79.10.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.79.10.2 23-Jun-2013  tls resync from head
 1.79.10.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.81.4.1 18-May-2014  rmind sync with head
 1.87.2.1 10-Aug-2014  tls Rebase.
 1.94.2.1 17-Apr-2017  snj regen for ticket 1354
 1.95.2.4 05-Feb-2017  skrll Sync with HEAD
 1.95.2.3 05-Oct-2016  skrll Sync with HEAD
 1.95.2.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.95.2.1 06-Apr-2015  skrll Sync with HEAD
 1.97.2.3 20-Mar-2017  pgoyette Sync with HEAD
 1.97.2.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.97.2.1 26-Jul-2016  pgoyette Sync with HEAD
 1.101.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.104.4.1 11-May-2017  pgoyette Sync with HEAD
 1.105.10.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.105.10.1 10-Jun-2019  christos Sync with HEAD
 1.105.8.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.108.2.2 17-Dec-2020  thorpej Regen for preadv(2) and pwritev(2).
 1.108.2.1 15-Dec-2020  thorpej Regen for eventfd, timerfd, POSIX timers.
 1.118.2.1 02-Aug-2025  perseant Sync with HEAD
 1.120 28-Sep-2024  christos regen
 1.119 01-Jul-2024  christos regen
 1.118 29-Jun-2024  christos branches: 1.118.2;
regen
 1.117 19-Aug-2023  christos regen
 1.116 29-Jul-2023  christos regen
 1.115 28-Jul-2023  christos regen
 1.114 02-Dec-2021  ryo regen
 1.113 24-Nov-2021  ryo regen
 1.112 20-Sep-2021  thorpej Regen for preadv(2) / pwritev(2).
 1.111 20-Sep-2021  thorpej Regen for eventfd.
 1.110 19-Sep-2021  thorpej Regen for timerfd.
 1.109 19-Sep-2021  thorpej Regen for POSIX timer syscalls.
 1.108 26-Apr-2020  thorpej branches: 1.108.2;
Regen for native futex calls.
 1.107 09-Nov-2019  jdolecek regen
 1.106 10-Aug-2018  pgoyette Regen
 1.105 10-May-2017  riastradh branches: 1.105.8; 1.105.10;
regen
 1.104 03-Feb-2017  christos branches: 1.104.4;
regen
 1.103 03-Feb-2017  martin regen
 1.102 16-Jan-2017  christos regen all
 1.101 13-Jan-2017  christos branches: 1.101.2;
regen
 1.100 02-Jan-2017  martin Regen (something apparently went wrong in previous)
 1.99 02-Jan-2017  manu Regen
 1.98 24-Jul-2016  njoly Regen for readlink/readlinkat signatures.
 1.97 24-Sep-2015  christos branches: 1.97.2;
regen
 1.96 07-Mar-2015  christos regen
 1.95 22-Nov-2014  njoly branches: 1.95.2;
Regen for ppoll signature fix
 1.94 31-May-2014  njoly branches: 1.94.2;
Regen for munmap(2) signature.
 1.93 29-May-2014  njoly Regen for utimes(2) change.
 1.92 20-May-2014  njoly Regen for getgroups/setgroups update.
 1.91 17-May-2014  njoly Regen for fadvise64 offset types changes.
 1.90 06-May-2014  njoly Regen for mknod device argument type change.
 1.89 04-May-2014  njoly Regen for pread/pwrite 64bit offset argument.
 1.88 08-Apr-2014  njoly Regen.
 1.87 15-Feb-2014  njoly branches: 1.87.2;
Regen.
 1.86 24-Dec-2013  njoly Regen for fcntl64().
 1.85 08-Dec-2013  njoly Regen.
 1.84 19-Nov-2013  chs regen
 1.83 07-Nov-2013  njoly Regen for dup/dup2/dup3 argument types fix.
 1.82 24-Sep-2013  njoly Regen for utimensat(2).
 1.81 08-Apr-2013  pooka branches: 1.81.4;
regen for utimes
 1.80 19-Sep-2012  pooka regen for ppoll (and, apparently, SYCALL_ARG_PTR)
 1.79 18-Nov-2011  christos branches: 1.79.10;
- add sigtimedwait support.
- merge the siginfo population code.
 1.78 30-May-2011  alnsn branches: 1.78.4;
Regenerate files to pick up correct RCS Ids. Suggested by Chris Badura.
 1.77 30-May-2011  alnsn Add fadvise64 and fadvise64_64 syscalls to compat_linux and compat_linux32.
 1.76 15-Apr-2011  he Regenerate these files after adding pipe2() and dup3().
 1.75 07-Jul-2010  chs branches: 1.75.2;
regen
 1.74 14-Dec-2009  matt branches: 1.74.2; 1.74.4;
Regen (new makesyscalls.sh)
 1.73 24-Nov-2009  njoly Regen for personality(2) update.
 1.72 08-Jun-2009  njoly Regen for rt_queueinfo(2) update.
 1.71 17-Jan-2009  njoly branches: 1.71.2;
Regen for wait4 update.
 1.70 13-Jan-2009  pooka Regen to prove I didn't screw up the conversion: purely RCSID changes.
 1.69 11-Jan-2009  tsutsui Regen from syscalls.master rev 1.64:
> Update for compat_50 stuff. (compile test only)
 1.68 12-Nov-2008  njoly Regen for nanosleep(2) fix.
 1.67 18-Jun-2008  tsutsui branches: 1.67.2; 1.67.4; 1.67.6;
Regen from syscalls.master rev 1.62:
> Include <sys/sched.h> before <sys/syscallargs.h> for cpuset_t.
 1.66 23-Apr-2008  ad branches: 1.66.2; 1.66.4; 1.66.6;
Regen.
 1.65 04-Apr-2008  njoly branches: 1.65.2;
Regen for linux_sys_msync removal.
 1.64 15-Jan-2008  njoly branches: 1.64.6;
Regen.
 1.63 24-Dec-2007  njoly Regen for linux_sys_getpgid removal.
 1.62 21-Dec-2007  njoly Regen for getfsuid/setfsgid syscall exchange.
 1.61 20-Dec-2007  dsl regen
 1.60 16-Nov-2007  njoly branches: 1.60.2; 1.60.6;
Regen, for syscalls cleanup.
 1.59 09-Feb-2007  ad branches: 1.59.18; 1.59.20; 1.59.24; 1.59.26;
Merge newlock2 to head.
 1.58 01-Sep-2006  matt branches: 1.58.2;
Regen.
 1.57 30-Aug-2006  matt Regen
 1.56 13-Jun-2006  he Regenerate after fixing the getpriority syscall definition.
 1.55 10-Jun-2006  christos regen
 1.54 11-Dec-2005  christos branches: 1.54.4; 1.54.8; 1.54.14;
merge ktrace-lwp.
 1.53 18-Oct-2005  joerg Regen.
 1.52 23-May-2005  jmc branches: 1.52.2;
Regen
 1.51 16-May-2005  fvdl Regen.
 1.50 26-Feb-2005  perry regen
 1.49 01-Aug-2004  jdolecek branches: 1.49.4; 1.49.6;
regen - sync syscall lists with Linux kernel 2.6.7
 1.48 10-Aug-2003  jdolecek regen - added wrapper for Linux ftruncate64()
 1.47 29-Jun-2003  thorpej branches: 1.47.2;
Regen: adapt to linux mmap2 changes.
 1.46 23-Jun-2003  christos Regen.
 1.45 18-Jan-2003  thorpej Regen for correct RCS ID.
 1.44 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.43 01-Nov-2002  jdolecek regen: nsysent set to 256
 1.42 12-May-2002  jdolecek branches: 1.42.4;
regen
 1.41 10-Apr-2002  christos regen
 1.40 22-Mar-2002  christos regen
 1.39 17-Feb-2002  christos regen
 1.38 15-Feb-2002  christos - add a real linux_sys___sysctl because the mib numbers are different.
implement only the kernel version getting entries.
- make the signal conversion functions consistent; dest is arg 1.
- make linux_fakedev deal with block and char devices differently.
- add linux_sys_ugetrlimit, and flesh out the regular get/setrlimit so
that they work properly.
- add linux_mmap2 [untested].
- bump kernel to 2.4.18, and make the date be valentine's day :-)
- linux_sys_*stat64 family was totally busted. Fix it.

tested only on i386.

Status:
gdb, telnet, work
jdk-1.4.0 extractor works, jdk still coredumps.

christos
 1.37 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.36 30-May-2001  mrg branches: 1.36.2;
use _KERNEL_OPT.
 1.35 13-May-2001  manu Improved the accuracy of gettimeofday/settimeofday: Linux stores a srtuct
timezone in the kernel. We now keep track of it for emulated processes.
Tested for powerpc and i386. Untested on m68k, but it should be ok
Alpha has a particular implementation (osf1_sys_gettimeofday), and it has
therefore not been touched.
 1.34 30-Mar-2001  jdolecek regen - use linux_sys_nosys() instead sys_nosys()
 1.33 30-Mar-2001  jdolecek regen
 1.32 30-Mar-2001  jdolecek regen
 1.31 27-Jan-2001  thorpej branches: 1.31.2;
Regen; getpid(2) is MP-safe.
 1.30 27-Jan-2001  thorpej Regen; add sy_flags.
 1.29 29-Dec-2000  fvdl Regen.
 1.28 27-Dec-2000  fvdl Regen.
 1.27 26-Dec-2000  itohy Regen.
 1.26 18-Dec-2000  fvdl Regen.
 1.25 14-Dec-2000  jdolecek regen
 1.24 12-Dec-2000  jdolecek regen
 1.23 12-Dec-2000  jdolecek regen
 1.22 09-Dec-2000  jdolecek regen
 1.21 09-Dec-2000  mycroft Regen.
 1.20 02-Dec-2000  jdolecek regen after addition of linux_sys_swapoff()
 1.19 01-Dec-2000  jdolecek regen
 1.18 01-Nov-2000  jdolecek regen
 1.17 31-Aug-2000  itohy Regen.
 1.16 18-Aug-2000  cgd update for changed makesyscalls.master
 1.15 18-Aug-2000  cgd update for new makesyscalls.sh, and also for correct ids for changed
syscalls.master files. (you need to regenerate after checking in
syscalls.master to get the correct ids.)
 1.14 18-Mar-2000  erh branches: 1.14.4;
Regen.
 1.13 03-Feb-2000  abs regen
 1.12 16-Dec-1999  tron Regen.
 1.11 05-Dec-1999  tron Regen.
 1.10 04-Dec-1999  tron Regen.
 1.9 04-Oct-1999  tron branches: 1.9.2; 1.9.8;
Regen from "syscalls.master".
 1.8 16-Aug-1999  tron Regen.
 1.7 14-May-1999  thorpej Regen.
 1.6 13-May-1999  thorpej Regen.
 1.5 30-Mar-1999  tron branches: 1.5.4;
Regen.
 1.4 27-Mar-1999  tron Regen.
 1.3 23-Mar-1999  thorpej Regen; pread(2) and pwrite(2).
 1.2 10-Feb-1999  itohy Regen.
 1.1 15-Dec-1998  itohy Generated from syscalls.master.
 1.5.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.9.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.9.2.7 21-Apr-2001  bouyer Sync with HEAD
 1.9.2.6 11-Feb-2001  bouyer Sync with HEAD.
 1.9.2.5 05-Jan-2001  bouyer Sync with HEAD
 1.9.2.4 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.9.2.3 08-Dec-2000  bouyer Sync with HEAD.
 1.9.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.9.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.14.4.2 01-May-2001  he Pull up regenerated files (requested by jdolecek):
Make it possible to use a different function for unimplemented
syscalls than sys_nosys(), so that the Linux emulation can avoid
posting SIGSYS and instead just return ENOSYS.
 1.14.4.1 30-Mar-2001  he Pull up regenerated files (requested by fvdl):
Add some required Linux emulation bits to support the Linux
version of VMware.
 1.31.2.9 11-Nov-2002  nathanw Catch up to -current
 1.31.2.8 20-Jun-2002  nathanw Catch up to -current.
 1.31.2.7 29-May-2002  nathanw Regen.
 1.31.2.6 17-Apr-2002  nathanw Catch up to -current.
 1.31.2.5 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.31.2.4 28-Feb-2002  nathanw Catch up to -current.
 1.31.2.3 14-Nov-2001  nathanw Catch up to -current.
 1.31.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.31.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.36.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.36.2.2 16-Mar-2002  jdolecek Catch up with -current.
 1.36.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.42.4.4 27-May-2004  tron Regen for ticket #1701.
 1.42.4.3 11-May-2004  tron Regen for ticket 1686.
 1.42.4.2 20-Nov-2003  jmc Regen after fix in syscalls.master from ticket #1427.
 1.42.4.1 22-Oct-2003  jmc Regen files (requested by tv in ticket #1427)

Proper support for mmap2
 1.47.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.47.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.47.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.47.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.47.2.1 03-Aug-2004  skrll Sync with HEAD
 1.49.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.49.4.1 29-Apr-2005  kent sync with -current
 1.52.2.5 21-Jan-2008  yamt sync with head
 1.52.2.4 07-Dec-2007  yamt sync with head
 1.52.2.3 26-Feb-2007  yamt sync with head.
 1.52.2.2 30-Dec-2006  yamt sync with head.
 1.52.2.1 21-Jun-2006  yamt sync with head.
 1.54.14.1 19-Jun-2006  chap Sync with head.
 1.54.8.2 03-Sep-2006  yamt sync with head.
 1.54.8.1 26-Jun-2006  yamt sync with head.
 1.54.4.1 09-Sep-2006  rpaulo sync with head
 1.58.2.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.59.26.3 18-Feb-2008  mjf Sync with HEAD.
 1.59.26.2 27-Dec-2007  mjf Sync with HEAD.
 1.59.26.1 19-Nov-2007  mjf Sync with HEAD.
 1.59.24.1 18-Nov-2007  bouyer Sync with HEAD
 1.59.20.2 23-Mar-2008  matt sync with HEAD
 1.59.20.1 09-Jan-2008  matt sync with HEAD
 1.59.18.1 21-Nov-2007  joerg Sync with HEAD.
 1.60.6.2 19-Jan-2008  bouyer Sync with HEAD
 1.60.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.60.2.1 26-Dec-2007  ad Sync with head.
 1.64.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.64.6.2 29-Jun-2008  mjf Sync with HEAD.
 1.64.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.65.2.1 18-May-2008  yamt sync with head.
 1.66.6.1 18-Jun-2008  simonb Sync with head.
 1.66.4.3 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.66.4.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.66.4.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.66.2.4 11-Aug-2010  yamt sync with head.
 1.66.2.3 11-Mar-2010  yamt sync with head
 1.66.2.2 20-Jun-2009  yamt sync with head
 1.66.2.1 04-May-2009  yamt sync with head.
 1.67.6.1 20-Nov-2008  snj Regen for ticket 81.
 1.67.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.67.2.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.71.2.1 23-Jul-2009  jym Sync with HEAD.
 1.74.4.3 31-May-2011  rmind sync with head
 1.74.4.2 21-Apr-2011  rmind sync with head
 1.74.4.1 05-Mar-2011  rmind sync with head
 1.74.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.75.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.78.4.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.78.4.2 30-Oct-2012  yamt sync with head
 1.78.4.1 17-Apr-2012  yamt sync with head
 1.79.10.4 03-Dec-2017  jdolecek update from HEAD
 1.79.10.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.79.10.2 23-Jun-2013  tls resync from head
 1.79.10.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.81.4.1 18-May-2014  rmind sync with head
 1.87.2.1 10-Aug-2014  tls Rebase.
 1.94.2.1 17-Apr-2017  snj regen for ticket 1354
 1.95.2.4 05-Feb-2017  skrll Sync with HEAD
 1.95.2.3 05-Oct-2016  skrll Sync with HEAD
 1.95.2.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.95.2.1 06-Apr-2015  skrll Sync with HEAD
 1.97.2.3 20-Mar-2017  pgoyette Sync with HEAD
 1.97.2.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.97.2.1 26-Jul-2016  pgoyette Sync with HEAD
 1.101.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.104.4.1 11-May-2017  pgoyette Sync with HEAD
 1.105.10.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.105.10.1 10-Jun-2019  christos Sync with HEAD
 1.105.8.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.108.2.2 17-Dec-2020  thorpej Regen for preadv(2) and pwritev(2).
 1.108.2.1 15-Dec-2020  thorpej Regen for eventfd, timerfd, POSIX timers.
 1.118.2.1 02-Aug-2025  perseant Sync with HEAD
 1.6 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.5 11-Dec-2005  christos branches: 1.5.70; 1.5.72; 1.5.74;
merge ktrace-lwp.
 1.4 26-Feb-2005  perry nuke trailing whitespace
 1.3 26-Aug-2001  manu branches: 1.3.20; 1.3.28; 1.3.30;
Moved LINUX_NCCS from MI file to MD file, because the value is different
on MIPS and sparc machines.
 1.2 20-Jan-2001  manu branches: 1.2.2; 1.2.4;
Moved architecure dependent part of struct linux_termio to architecture
dependent header files.
 1.1 15-Dec-1998  itohy branches: 1.1.8;
Initial support of Linux/m68k compatibility.
 1.1.8.1 11-Feb-2001  bouyer Sync with HEAD.
 1.2.4.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.2.2.1 21-Sep-2001  nathanw Catch up to -current.
 1.3.30.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.3.28.1 29-Apr-2005  kent sync with -current
 1.3.20.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.5.74.1 16-May-2008  yamt sync with head.
 1.5.72.1 18-May-2008  yamt sync with head.
 1.5.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.9 11-Jan-2009  christos merge christos-time_t
 1.8 28-Apr-2008  martin branches: 1.8.8; 1.8.14;
Remove clause 3 and 4 from TNF licenses
 1.7 11-Dec-2005  christos branches: 1.7.70; 1.7.72; 1.7.74;
merge ktrace-lwp.
 1.6 20-Sep-2004  jdolecek move definition of linux_fsid_t to common/linux_types.h - it's identical
across all Linux archs
 1.5 19-Sep-2004  jdolecek move definition of struct linux_stafs to common/linux_types.h, and use
explicit size types - the structure definition is actually identical
on currently support COMPAT_LINUX archs, so no point to have 6 copies of it
in the tree
 1.4 19-May-2002  jdolecek branches: 1.4.8;
On archs with broken linux struct stat64 st_ino, rename linux_stat64's
lst_ino to __lst_ino and lst_ino64 to lst_ino, and define
LINUX_STAT64_HAS_BROKEN_ST_INO. Only assign __lst_ino if this define
is present.

This fixes compile on powerpc archs, and hence port-powerpc/16893.
 1.3 16-Mar-2002  pooka branches: 1.3.4;
Replace unused padding in struct linux_stat64 by lst_ino64 as found in
linux's m68k struct stat64.

makes linux compat compile again
 1.2 12-Dec-2000  jdolecek branches: 1.2.2; 1.2.4;
define struct linux_stat64 used by linux_sys_*stat64()
 1.1 15-Dec-1998  itohy branches: 1.1.8;
Initial support of Linux/m68k compatibility.
 1.1.8.1 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.2.4.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.2.2.2 20-Jun-2002  nathanw Catch up to -current.
 1.2.2.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.3.4.1 30-May-2002  gehenna Catch up with -current.
 1.4.8.1 24-Sep-2004  skrll Sync with HEAD.
 1.7.74.2 04-May-2009  yamt sync with head.
 1.7.74.1 16-May-2008  yamt sync with head.
 1.7.72.1 18-May-2008  yamt sync with head.
 1.7.70.2 17-Jan-2009  mjf Sync with HEAD.
 1.7.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.8.14.2 11-Jan-2009  christos add linux_suseconds_t
 1.8.14.1 28-Apr-2008  christos file linux_types.h was added on branch christos-time_t on 2009-01-11 00:17:51 +0000
 1.8.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.5 11-Dec-2005  christos merge ktrace-lwp.
 1.4 01-Aug-2004  jdolecek sync the syscall lists with Linux kernel 2.6.7
 1.3 01-Nov-2002  jdolecek branches: 1.3.6;
add appropriate nsysent
 1.2 30-Mar-2001  jdolecek Use linux_sys_nosys() instead sys_nosys() here too.
 1.1 30-Sep-1998  erh branches: 1.1.12; 1.1.22; 1.1.24;
Stubs for future development of linux compat architechtures.
 1.1.24.2 11-Nov-2002  nathanw Catch up to -current
 1.1.24.1 09-Apr-2001  nathanw Catch up with -current.
 1.1.22.1 01-May-2001  he Pull up revision 1.2 (requested by jdolecek):
Make it possible to use a different function for unimplemented
syscalls than sys_nosys(), so that the Linux emulation can avoid
posting SIGSYS and instead just return ENOSYS.
 1.1.12.1 21-Apr-2001  bouyer Sync with HEAD
 1.3.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.6.1 03-Aug-2004  skrll Sync with HEAD
 1.107 28-Sep-2024  christos Linux GSoC-2024: renameat2, clone3, sync_file_range, syncfs (Shivraj Jamgade)
 1.106 01-Jul-2024  christos Add linux POSIX message queue support (Ricardo Branco)
 1.105 29-Jun-2024  christos branches: 1.105.2;
From gsoc 2024: Implement faccessat2 and getcpu (Shivraz)
 1.104 19-Aug-2023  christos Add inotify* syscalls GSoC 2023 (Theodore Preduta)
 1.103 29-Jul-2023  christos Add/fix statx, readahead, close_range. From GSoC 2023 by Theodore Preduta
 1.102 28-Jul-2023  christos add epoll syscalls
 1.101 02-Dec-2021  ryo add prlimit64(2) syscall to COMPAT_LINUX and COMPAT_LINUX32
 1.100 24-Nov-2021  ryo add getrandom(2) syscall entry
 1.99 20-Sep-2021  thorpej Add preadv(2) and pwritev(2) system calls to COMPAT_LINUX and COMPAT_LINUX32.
 1.98 20-Sep-2021  thorpej Add the eventfd system calls to COMPAT_LINUX and COMPAT_LINUX32.
 1.97 19-Sep-2021  thorpej Add the timerfd syscalls to COMPAT_LINUX and COMPAT_LINUX32.
 1.96 19-Sep-2021  thorpej Add the POSIX timer syscalls (timer_create(), timer_settime(), timer_gettime(),
timer_getoverrun(), and timer_delete()) to COMPAT_LINUX and COMPAT_LINUX32.
 1.95 26-Apr-2020  thorpej branches: 1.95.2;
Add a NetBSD native futex implementation, mostly written by riastradh@.
Map the COMPAT_LINUX futex calls to the native ones.
 1.94 09-Nov-2019  jdolecek add dummy implementation of linux fallocate() which just returns EOPNOTSUPP;
this is needed so that glibc falls back to emulation and apps behaving
properly, since EOPNOTSUPP is a documented and expected return code, but
ENOSYS is not

right now there are no filesystems in NetBSD tree supporting the fallocate
VOP, so no point trying to map this to a native call

supposed to help with problem reported in
https://mail-index.netbsd.org/tech-kern/2019/11/03/msg025641.html
 1.93 03-Feb-2017  christos branches: 1.93.14;
and send and recv mmsg and unimpl
 1.92 03-Feb-2017  martin Add accept4
 1.91 02-Jan-2017  manu branches: 1.91.2;
Add pselect6 Linux system call.
This lets Matlab R2016A run on NetBSD/amd64
 1.90 24-Jul-2016  njoly Small cleanup. Adjust readlink/readlinkat signatures to reduce diffs with
native.
 1.89 22-Nov-2014  njoly branches: 1.89.2; 1.89.4;
Fix ppoll signature (int ->u_int)
 1.88 31-May-2014  njoly branches: 1.88.2;
Fix munmap(2) signature.
 1.87 29-May-2014  njoly For utimes(2), use compat_50_sys_utimes() instead of local version.
 1.86 20-May-2014  njoly Fix getgroups/setgroups signature.
 1.85 17-May-2014  njoly Fix fadvise64 syscalls to use 64bit offset types.
 1.84 06-May-2014  njoly Reduce diffs between archs; make mknod device argument unsigned.
 1.83 04-May-2014  njoly Fix pread/pwrite syscalls which need a 64bit offset argument.
 1.82 08-Apr-2014  njoly Adjust read/write/readv/writev signature to match native versions.
 1.81 15-Feb-2014  njoly branches: 1.81.2;
Reduce diffs between archs, add mincore/madvise to m68k.
 1.80 24-Dec-2013  njoly Reduce diffs between arches, add fcntl64() to m68k.
 1.79 08-Dec-2013  njoly Sprinkle a few more linux_umode_t where appropriate.
Reduce diffs between archs.
 1.78 19-Nov-2013  chs add the *at() syscalls.
 1.77 07-Nov-2013  njoly Fix dup/dup2/dup3 argument types (u_int -> int).
 1.76 24-Sep-2013  njoly Add utimensat(2) for compat linux.
 1.75 08-Apr-2013  pooka branches: 1.75.4;
support utimes on non-alpha linux platforms
 1.74 19-Sep-2012  pooka emulate ppoll which is essentially our pollts
 1.73 18-Nov-2011  christos branches: 1.73.10;
add sigtimedwait
 1.72 09-Jul-2011  christos branches: 1.72.2;
the first argument of {g,s}etitimer() is int not u_int.
 1.71 30-May-2011  alnsn Add fadvise64 and fadvise64_64 syscalls to compat_linux and compat_linux32.
 1.70 15-Apr-2011  he Add dup3() and pipe2() for these archs as well.
 1.69 07-Jul-2010  chs branches: 1.69.2;
many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
- support new-style (NPTL) linux pthreads on all platforms.
clone() with CLONE_THREAD uses 1 process with many LWPs
instead of separate processes.
- move the contents of sys__lwp_setprivate() into a new
lwp_setprivate() and use that everywhere.
- update linux_release[] and linux32_release[] to "2.6.18".
- adjust placement of emul fork/exec/exit hooks as needed
and adjust other emul code to match.
- convert all struct emul definitions to use named initializers.
- change the pid allocator to allow multiple pids to refer to the same proc.
- remove a few fields from struct proc that are no longer needed.
- disable the non-functional "vdso" code in linux32/amd64,
glibc works fine without it.
- fix a race in the futex code where we could miss a wakeup after
a requeue operation.
- redo futex locking to be a little more efficient.
 1.68 24-Nov-2009  njoly branches: 1.68.2; 1.68.4;
Update personality(2) to match Linux definition where the argument is an
unsigned long.
 1.67 08-Jun-2009  njoly Update rt_queueinfo(2) definition, and kill a corresponding comment.
 1.66 17-Jan-2009  njoly branches: 1.66.2;
Convert linux/linux32 wait(4) to use a compat50 rusage structure.
 1.65 13-Jan-2009  pooka Convert the syscalls.master to a format from which it is easier
to parse and generate the compat name and basename (e.g. __stat50
and stat). Use this to autogenerate __RENAME()'s to the rump_syscalls
header so that they can be called e.g. rump_sys_socket() instead
of rump_sys___socket30().
 1.64 11-Jan-2009  tsutsui Update for compat_50 stuff. (compile test only)
 1.63 12-Nov-2008  njoly Fix nanosleep(2) on 64-bit archs. Do not call native nanosleep
syscall, but rather a modified version the will take care of `struct
timespec' conversions.
 1.62 18-Jun-2008  tsutsui branches: 1.62.2; 1.62.4; 1.62.6;
Include <sys/sched.h> before <sys/syscallargs.h> for cpuset_t.
 1.61 23-Apr-2008  ad branches: 1.61.2; 1.61.4; 1.61.6;
-SYCALL_MPSAFE
 1.60 04-Apr-2008  njoly branches: 1.60.2;
Cleanup. Kill linux_sys_msync and use sys___msync13 instead.
No functional changes expected.
 1.59 15-Jan-2008  njoly branches: 1.59.6;
compat linux (and linux32) uid16 functions cleanup and fixes.

- Move uid16 functions to their own file linux_uid16.c, included by
needed archs (arm, i386 and m68k).
- Add new MI types linux_{u,g}id16_t.
- Add macros to handle linux_uid16_t and uid_t conversions.
- Add linux_sys_getres{uid,gid}16 syscalls, to fix an overflow with
bad sizes given to copyout when linux_sys_getres{uid,gid} are used.
- Update arm syscall table to use more uid16 functions.
 1.58 24-Dec-2007  njoly Kill unneeded linux_sys_getpgid and use native sys_getpgid instead.
 1.57 21-Dec-2007  njoly - Fix setfsuid to return uid on success.
- Replace getfsuid, which never existed on Linux, by correct setfsgid
syscall.

ok by christos and dsl.
 1.56 20-Dec-2007  dsl Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.55 16-Nov-2007  njoly branches: 1.55.2; 1.55.6;
Cleanup. Remove a few linux syscalls definitions, now identical to
native ones (with stackgap and ALT_CHECK_xxx removal). No functional
changes expected.
 1.54 04-Mar-2007  christos branches: 1.54.14; 1.54.16; 1.54.20; 1.54.22;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.53 09-Feb-2007  ad branches: 1.53.2;
Merge newlock2 to head.
 1.52 01-Sep-2006  matt branches: 1.52.2;
Don't conditionalize *sys_ptrace. The lack of sys_ptrace will be dealt
with differently.
 1.51 30-Aug-2006  matt Update to deal with options PTRACE
 1.50 13-Jun-2006  he We need the argument structure for the getpriority syscall defined, so
change NOARGS to STD.
 1.49 10-Jun-2006  christos linux getpriority is off-by-20 so use our own function.
From PR/33671: Nicolas Joly
 1.48 11-Dec-2005  christos branches: 1.48.4; 1.48.8; 1.48.14;
merge ktrace-lwp.
 1.47 18-Oct-2005  joerg sys_uselib is needed by COMPAT_LINUX for EXEC_AOUT. Since it doesn't get
build when EXEC_AOUT is not defined, the syscalls.master entry has to be
conditionalized. Alpha did so already, so let the other archs catch up
with it.

Go-on: christos
 1.46 23-May-2005  jmc branches: 1.46.2;
Add clock_* POSIX functions.
 1.45 16-May-2005  fvdl Add *xattr functions (they all return EOPNOTSUPP).
 1.44 01-Aug-2004  jdolecek sync the syscall lists with Linux kernel 2.6.7
 1.43 10-Aug-2003  jdolecek add Linux compat arg wrapper for ftruncate64(), and change linux compat
truncate64() wrapper to translate args structure
NetBSD truncate() and ftrucate() have hidden 'pad' argument, so we have
to do the argument translation

Problem found and patch supplied in PR kern/22360 by Ales Krenek

This is the last of syscalls with hidden 'pad' arg we didn't have
wrapper for; all the others (lseek, mmap, pwrite, pread) already had
wrapper before.
 1.42 29-Jun-2003  thorpej branches: 1.42.2;
Adapt to linux mmap2 changes.
 1.41 23-Jun-2003  christos PR/21937: Todd Vierling: Proper support for mmap2
 1.40 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.39 12-May-2002  jdolecek branches: 1.39.4;
update for newer syscalls (from 2.5.15)
Linux m68k doesn't seem to have fcntl64 syscall - oversight?
 1.38 10-Apr-2002  christos add getdents64
 1.37 22-Mar-2002  christos add mprotect, nuke mmap2
 1.36 17-Feb-2002  christos fix rlimit confusion.
 1.35 15-Feb-2002  christos - add a real linux_sys___sysctl because the mib numbers are different.
implement only the kernel version getting entries.
- make the signal conversion functions consistent; dest is arg 1.
- make linux_fakedev deal with block and char devices differently.
- add linux_sys_ugetrlimit, and flesh out the regular get/setrlimit so
that they work properly.
- add linux_mmap2 [untested].
- bump kernel to 2.4.18, and make the date be valentine's day :-)
- linux_sys_*stat64 family was totally busted. Fix it.

tested only on i386.

Status:
gdb, telnet, work
jdk-1.4.0 extractor works, jdk still coredumps.

christos
 1.34 30-May-2001  mrg branches: 1.34.2;
use _KERNEL_OPT.
 1.33 13-May-2001  manu Improved the accuracy of gettimeofday/settimeofday: Linux stores a srtuct
timezone in the kernel. We now keep track of it for emulated processes.
Tested for powerpc and i386. Untested on m68k, but it should be ok
Alpha has a particular implementation (osf1_sys_gettimeofday), and it has
therefore not been touched.
 1.32 30-Mar-2001  jdolecek use UNIMPL instead of NODEF for the dummy syscalls 218, 219
 1.31 30-Mar-2001  jdolecek Add new syscalls from Linux 2.4.3 to the lists. Not implemented ATM.
 1.30 30-Mar-2001  jdolecek Implement linux_sys_nosys() and use it instead of sys_nosys() for
unimplemented syscalls. Difference is that linux_sys_nosys() doesn't
post SIGSYS to the process. Linux doesn't do that and thus glibc (and
probably other Linux code) doesn't deal with SIGSYS, even through it
generally contains fallback code for ENOSYS case.

This also addresses port-i386/12503, though the issue was already discussed
earlier.
 1.29 27-Jan-2001  thorpej branches: 1.29.2;
getpid(2) is MP-safe.
 1.28 29-Dec-2000  fvdl Don't pass through link(2) directly, as we need to do altpath checks.
 1.27 27-Dec-2000  fvdl Add all uid and gid calls, and do the right thing for the older 16 bit
ones.
 1.26 26-Dec-2000  itohy Declare linux_sys_setgid16() (NOARGS -> STD).
Change syscall #182 from linux_sys_lchown() to linux_sys_lchown16().
 1.25 18-Dec-2000  fvdl Update for Linux calls with 32 bit uids/gids.
 1.24 14-Dec-2000  jdolecek add sysinfo()
 1.23 12-Dec-2000  jdolecek actually, we need to wrap sys_truncate() call so that the /emul/linux/...
path is tried first
fix ftruncate64 entry - first arg to ftruncate is int fd, not path
 1.22 12-Dec-2000  jdolecek add emulation of Linux truncate64(2), ftruncate64(2), *stat64(2)
 1.21 09-Dec-2000  jdolecek add more unimplemented syscalls to list
 1.20 09-Dec-2000  mycroft Add the %% separators.
 1.19 09-Dec-2000  mycroft Add the %% separators.
 1.18 02-Dec-2000  jdolecek add emulation of linux swapoff(2)
 1.17 01-Dec-2000  jdolecek replace compat_09_sys_setdomainname() with linux_sys_setdomainname(),
compat_12_sys_swapon() with linux_sys_swapon() - this is to drop dependency
on COMPAT_12/COMPAT_09
 1.16 01-Nov-2000  jdolecek support mlockall(), munlockall() - they are same as respective NetBSD syscalls
 1.15 31-Aug-2000  itohy Add linux_sys_sigaltstack().
 1.14 18-Mar-2000  erh branches: 1.14.4;
Use linux_sys_reboot instead of sys_reboot.
 1.13 03-Feb-2000  abs Add Linux fsuid system calls - from Witold J. Wnuk in PR kern/9335
 1.12 16-Dec-1999  tron Add ptrace(2).
 1.11 05-Dec-1999  tron Add proper stub code to make emulation of Linux's pread(2) and pwrite(2)
work. Fixes PR kern/8945 by Dave Sainty.
 1.10 04-Dec-1999  tron Consistently call signal number arguments "signum".
 1.9 04-Oct-1999  tron branches: 1.9.2; 1.9.8;
Add emulation for scheduler related syscalls. Although they are dummies
even under Linux the posix thread library for "glibc2" requires them.
 1.8 16-Aug-1999  tron Add stime() to syscalls table.
 1.7 14-May-1999  thorpej Emulate the Linux vfork(2) (which is like NetBSD's __vfork14(2)),
{get,set}resuid(2), and {get,set}resgid(2). Note a few more system
calls that we don't yet emulate.
 1.6 13-May-1999  thorpej Emulate the Linux clone(2) system call.
 1.5 30-Mar-1999  tron branches: 1.5.4;
Add poll() emulation.
 1.4 27-Mar-1999  tron Add emulation for Linux "getcwd" syscall.
 1.3 23-Mar-1999  thorpej Add support for emulating the Linux pread(2) and pwrite(2) system calls;
just call the native NetBSD versions.

PR #7202, Jaromir Dolecek <dolecek@ics.muni.cz>.
 1.2 10-Feb-1999  itohy const mania
 1.1 15-Dec-1998  itohy Initial support of Linux/m68k compatibility.
 1.5.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.9.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.9.2.7 21-Apr-2001  bouyer Sync with HEAD
 1.9.2.6 11-Feb-2001  bouyer Sync with HEAD.
 1.9.2.5 05-Jan-2001  bouyer Sync with HEAD
 1.9.2.4 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.9.2.3 08-Dec-2000  bouyer Sync with HEAD.
 1.9.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.9.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.14.4.2 01-May-2001  he Pull up revision 1.30 (requested by jdolecek):
Make it possible to use a different function for unimplemented
syscalls than sys_nosys(), so that the Linux emulation can avoid
posting SIGSYS and instead just return ENOSYS.
 1.14.4.1 30-Mar-2001  he Pull up revision 1.28 (requested by fvdl):
Add some required Linux emulation bits to support the Linux
version of VMware.
 1.29.2.7 20-Jun-2002  nathanw Catch up to -current.
 1.29.2.6 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.29.2.5 17-Apr-2002  nathanw Catch up to -current.
 1.29.2.4 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.29.2.3 28-Feb-2002  nathanw Catch up to -current.
 1.29.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.29.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.34.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.34.2.1 16-Mar-2002  jdolecek Catch up with -current.
 1.39.4.4 27-May-2004  tron Apply patch (requested by skrll in ticket #1701):
Correct incorrect definition of system call 194 (linux_sys_ftruncate64)
caused by the patch for ticket #1686.
 1.39.4.3 11-May-2004  tron Pull up revision 1.43 via patch (requested by wennmach in ticket #1686):
add Linux compat arg wrapper for ftruncate64(), and change linux compat
truncate64() wrapper to translate args structure
NetBSD truncate() and ftrucate() have hidden 'pad' argument, so we have
to do the argument translation
Problem found and patch supplied in PR kern/22360 by Ales Krenek
This is the last of syscalls with hidden 'pad' arg we didn't have
wrapper for; all the others (lseek, mmap, pwrite, pread) already had
wrapper before.
 1.39.4.2 20-Nov-2003  jmc Followup from ticket #1427. Need to include mmap2.h here or it won't compile
 1.39.4.1 22-Oct-2003  jmc Regen files (requested by tv in ticket #1427)

Proper support for mmap2
 1.42.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.42.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.42.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.42.2.1 03-Aug-2004  skrll Sync with HEAD
 1.46.2.5 21-Jan-2008  yamt sync with head
 1.46.2.4 07-Dec-2007  yamt sync with head
 1.46.2.3 03-Sep-2007  yamt sync with head.
 1.46.2.2 26-Feb-2007  yamt sync with head.
 1.46.2.1 21-Jun-2006  yamt sync with head.
 1.48.14.1 19-Jun-2006  chap Sync with head.
 1.48.8.1 26-Jun-2006  yamt sync with head.
 1.48.4.1 09-Sep-2006  rpaulo sync with head
 1.52.2.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.53.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.54.22.3 18-Feb-2008  mjf Sync with HEAD.
 1.54.22.2 27-Dec-2007  mjf Sync with HEAD.
 1.54.22.1 19-Nov-2007  mjf Sync with HEAD.
 1.54.20.1 18-Nov-2007  bouyer Sync with HEAD
 1.54.16.2 23-Mar-2008  matt sync with HEAD
 1.54.16.1 09-Jan-2008  matt sync with HEAD
 1.54.14.1 21-Nov-2007  joerg Sync with HEAD.
 1.55.6.2 19-Jan-2008  bouyer Sync with HEAD
 1.55.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.55.2.1 26-Dec-2007  ad Sync with head.
 1.59.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.59.6.2 29-Jun-2008  mjf Sync with HEAD.
 1.59.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.60.2.1 18-May-2008  yamt sync with head.
 1.61.6.1 18-Jun-2008  simonb Sync with head.
 1.61.4.3 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.61.4.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.61.4.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.61.2.4 11-Aug-2010  yamt sync with head.
 1.61.2.3 11-Mar-2010  yamt sync with head
 1.61.2.2 20-Jun-2009  yamt sync with head
 1.61.2.1 04-May-2009  yamt sync with head.
 1.62.6.1 20-Nov-2008  snj Pull up following revision(s) (requested by njoly in ticket #81):
sys/compat/linux/arch/mips/syscalls.master: revision 1.30
sys/compat/linux/arch/m68k/syscalls.master: revision 1.63
sys/compat/linux32/arch/amd64/syscalls.master: revision 1.39
sys/compat/linux/arch/alpha/syscalls.master: revision 1.63
sys/compat/linux/arch/powerpc/syscalls.master: revision 1.38
sys/compat/linux32/common/linux32_time.c: revision 1.22
sys/compat/linux/arch/amd64/syscalls.master: revision 1.25
sys/compat/linux/arch/i386/syscalls.master: revision 1.94
sys/compat/linux/arch/arm/syscalls.master: revision 1.36
sys/compat/linux/common/linux_time.c: revision 1.26
Fix nanosleep(2) on 64-bit archs. Do not call native nanosleep
syscall, but rather a modified version the will take care of `struct
timespec' conversions.
 1.62.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.62.2.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.66.2.1 23-Jul-2009  jym Sync with HEAD.
 1.68.4.3 31-May-2011  rmind sync with head
 1.68.4.2 21-Apr-2011  rmind sync with head
 1.68.4.1 05-Mar-2011  rmind sync with head
 1.68.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.69.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.72.2.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.72.2.2 30-Oct-2012  yamt sync with head
 1.72.2.1 17-Apr-2012  yamt sync with head
 1.73.10.4 03-Dec-2017  jdolecek update from HEAD
 1.73.10.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.73.10.2 23-Jun-2013  tls resync from head
 1.73.10.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.75.4.1 18-May-2014  rmind sync with head
 1.81.2.1 10-Aug-2014  tls Rebase.
 1.88.2.1 17-Apr-2017  snj Pull up following revision(s) (requested by manu in ticket #1354):
sys/compat/linux/arch/alpha/syscalls.master: revision 1.92 via patch
sys/compat/linux/arch/amd64/syscalls.master: revision 1.58 via patch
sys/compat/linux/arch/arm/syscalls.master: revision 1.65 via patch
sys/compat/linux/arch/i386/syscalls.master: revision 1.122 via patch
sys/compat/linux/arch/m68k/syscalls.master: revision 1.91 via patch
sys/compat/linux/arch/mips/syscalls.master: revision 1.61 via patch
sys/compat/linux/arch/powerpc/syscalls.master: revision 1.70 via patch
sys/compat/linux/common/linux_misc.c: revision 1.234
sys/compat/linux/common/linux_signal.h: revision 1.31
Add pselect6 Linux system call.
This lets Matlab R2016A run on NetBSD/amd64
 1.89.4.3 20-Mar-2017  pgoyette Sync with HEAD
 1.89.4.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.89.4.1 26-Jul-2016  pgoyette Sync with HEAD
 1.89.2.2 05-Feb-2017  skrll Sync with HEAD
 1.89.2.1 05-Oct-2016  skrll Sync with HEAD
 1.91.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.93.14.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.95.2.2 17-Dec-2020  thorpej Add suppport for Linux preadv(2) and pwritev(2). Same as native, except
for the silly way that the offset argument is passed in.
 1.95.2.1 15-Dec-2020  thorpej Add Linux eventfd, timerfd, and POSIX timer calls.
 1.105.2.1 02-Aug-2025  perseant Sync with HEAD
 1.4 29-May-2024  christos should not be using .include <> but .include "" here.
 1.3 08-Apr-2014  njoly Do not include bsd.kinc.mk in each arch Makefile, it's already pulled
by bsd.syscall.mk (from Makefile.inc).
 1.2 03-Oct-1998  christos branches: 1.2.184; 1.2.194; 1.2.200; 1.2.210;
Attempt to fix the mess.
 1.1 30-Sep-1998  erh Stubs for future development of linux compat architechtures.
 1.2.210.1 10-Aug-2014  tls Rebase.
 1.2.200.1 18-May-2014  rmind sync with head
 1.2.194.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.184.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.8 03-May-2020  thorpej Always clear FUTEX_PRIVATE_FLAG for Linux processes. NetBSD-native futexes
exist in different namespace depending on FUTEX_PRIVATE_FLAG. This appears
not to be the case in Linux, and some futex users will mix private and non-
private ops on the same futex object. Provide a convenience wrapper that
puts this logic in one place witn a comment explaining why.

While here, move the Linux futex wrapper out of its own file and plop
it in linux_misc.c, which is where it lives in the linux32 module.
 1.7 30-May-2011  alnsn Add fadvise64 and fadvise64_64 syscalls to compat_linux and compat_linux32.
 1.6 07-Jul-2010  chs branches: 1.6.2;
many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
- support new-style (NPTL) linux pthreads on all platforms.
clone() with CLONE_THREAD uses 1 process with many LWPs
instead of separate processes.
- move the contents of sys__lwp_setprivate() into a new
lwp_setprivate() and use that everywhere.
- update linux_release[] and linux32_release[] to "2.6.18".
- adjust placement of emul fork/exec/exit hooks as needed
and adjust other emul code to match.
- convert all struct emul definitions to use named initializers.
- change the pid allocator to allow multiple pids to refer to the same proc.
- remove a few fields from struct proc that are no longer needed.
- disable the non-functional "vdso" code in linux32/amd64,
glibc works fine without it.
- fix a race in the futex code where we could miss a wakeup after
a requeue operation.
- redo futex locking to be a little more efficient.
 1.5 02-Feb-2008  dsl branches: 1.5.10; 1.5.30; 1.5.32;
Extract the fcntl64() suppoort from linux_file64.c into linux_fcntl64.c
Unravel some of the knots that caused linux_file64.c to be compiled twice
for an amd64 kernel (once for linux and once for linux32) with different
parts being skipped each time.
 1.4 30-Aug-2006  matt branches: 1.4.28; 1.4.34;
Update to deal with options PTRACE
 1.3 31-Mar-2002  christos branches: 1.3.26; 1.3.40; 1.3.44;
bring the reverse signal mapping array into linux_signo.c
 1.2 30-Sep-2001  manu branches: 1.2.2; 1.2.6;
Implements parts of sysmips() and fctnl64() emulation
 1.1 22-Sep-2001  manu branches: 1.1.2;
Initial support for running Linux binaries on the Mips. Both static and
dynamic binaries work on 32 bit mips. Signals are completely broken yet,
and ptrace is not supported.
 1.1.2.4 17-Apr-2002  nathanw Catch up to -current.
 1.1.2.3 08-Oct-2001  nathanw Catch up to -current.
 1.1.2.2 26-Sep-2001  nathanw Catch up to -current.
Again.
 1.1.2.1 22-Sep-2001  nathanw file files.linux_mips was added on branch nathanw_sa on 2001-09-26 19:54:46 +0000
 1.2.6.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.2.6.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.6.1 30-Sep-2001  thorpej file files.linux_mips was added on branch kqueue on 2002-01-10 19:51:32 +0000
 1.2.2.2 01-Oct-2001  fvdl Catch up with -current.
 1.2.2.1 30-Sep-2001  fvdl file files.linux_mips was added on branch thorpej-devvp on 2001-10-01 12:43:37 +0000
 1.3.44.1 03-Sep-2006  yamt sync with head.
 1.3.40.1 09-Sep-2006  rpaulo sync with head
 1.3.26.2 04-Feb-2008  yamt sync with head.
 1.3.26.1 30-Dec-2006  yamt sync with head.
 1.4.34.1 18-Feb-2008  mjf Sync with HEAD.
 1.4.28.1 23-Mar-2008  matt sync with HEAD
 1.5.32.2 31-May-2011  rmind sync with head
 1.5.32.1 05-Mar-2011  rmind sync with head
 1.5.30.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.5.10.1 11-Aug-2010  yamt sync with head.
 1.6.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.7 17-Dec-2013  njoly Cleanup compat linux errnos by adding generic errnos in a single file.
Use it for all arches except alpha and mips.
Add a few missing native to linux errno conversions.
 1.6 28-Apr-2008  martin branches: 1.6.34; 1.6.44; 1.6.50;
Remove clause 3 and 4 from TNF licenses
 1.5 11-Dec-2005  christos branches: 1.5.70; 1.5.72; 1.5.74;
merge ktrace-lwp.
 1.4 26-Feb-2005  perry nuke trailing whitespace
 1.3 19-Jun-2004  manu branches: 1.3.4; 1.3.6;
Fix a reversed errno issue for Linux binaries on mips. While we are there,
fix broken includes for alpha and m68k.
 1.2 02-Sep-2001  manu branches: 1.2.4; 1.2.6; 1.2.24; 1.2.26;
Fixed indent problems
 1.1 26-Aug-2001  manu Preliminary work for Linux/Mips compatibility, more to come soon.
 1.2.26.1 22-Jun-2004  tron Pull up revision 1.3 (requested by manu in ticket #521):
Fix a reversed errno issue for Linux binaries on mips. While we are
there,
fix broken includes for alpha and m68k.
 1.2.24.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.2.24.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.24.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.24.1 03-Aug-2004  skrll Sync with HEAD
 1.2.6.2 21-Sep-2001  nathanw Catch up to -current.
 1.2.6.1 02-Sep-2001  nathanw file linux_errno.h was added on branch nathanw_sa on 2001-09-21 22:35:16 +0000
 1.2.4.2 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.2.4.1 02-Sep-2001  thorpej file linux_errno.h was added on branch kqueue on 2001-09-13 01:15:17 +0000
 1.3.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.3.4.1 29-Apr-2005  kent sync with -current
 1.5.74.1 16-May-2008  yamt sync with head.
 1.5.72.1 18-May-2008  yamt sync with head.
 1.5.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.6.50.1 18-May-2014  rmind sync with head
 1.6.44.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.6.34.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.17 26-Nov-2021  ryo - LINUX_GO_RT0_SIGNATURE for compat_linux is no longer enabled by default.
it is now defined in each arch same as the other *_SIGNATURE definitions.
- add new LINUX32_GO_RT0_SIGNATURE for compat_linux32, and is defined in amd64 and aarch64.
 1.16 12-Feb-2017  chs es_arglen is now in units of bytes, update the emulations accordingly.
 1.15 09-Feb-2014  chs branches: 1.15.6; 1.15.10; 1.15.14;
account for the 16 bytes of AT_RANDOM data in the stack setup. fixes PR 48518.
use cprng_strong32() instead of random(). add AT_RANDOM support for linux32.
 1.14 13-Aug-2009  matt branches: 1.14.12; 1.14.22; 1.14.26;
Don't include EXEC_AOUT stuff by default.
 1.13 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.12 11-Dec-2005  christos branches: 1.12.70; 1.12.72; 1.12.74;
merge ktrace-lwp.
 1.11 26-Feb-2005  perry nuke trailing whitespace
 1.10 14-Aug-2003  christos branches: 1.10.8; 1.10.10;
remove the args from the macro.
 1.9 08-Aug-2003  christos - GC all the setup_stack functions
- add one for linux/i386
 1.8 21-Nov-2002  jdolecek branches: 1.8.6;
g/c also mips-specific linux ELF copyargs function prototype and
linux ELF defines, use generic Aux32Info instead
this also adresses kern/19047 by FUKAUMI Naoki
 1.7 21-Nov-2002  jdolecek g/c local definition of LINUX_ELF_AUX_ENTRIES
 1.6 13-Nov-2002  jdolecek add generic linux compat ELF copyargs function

this gives:
* linux sysconf(_SC_CLK_TCK) gives correct value for linux binaries (hz)
even if hz != 100
* glibc gets proper information on real/effective uid and enables
secure mode for suid binaries

g/c LINUX_COPYARGS_FUNCTION, replaced by linux ELF copyargs function
g/c alpha-specific linux ELF copyargs function and linux ELF defines
 1.5 26-Aug-2002  christos Implement passing AT_{E,R}{U,G}ID in the elf aux vector, like solaris.
- pass struct proc to copyargs.
- eliminate svr4_copyargs, since it is the same as ours now.
 1.4 15-Aug-2002  enami Pull changes done in rev. 1.7 of sys/compat/linux/arch/powerpc/linux_exec.h
so that sysctl(8) compiles again.
 1.3 22-Sep-2001  manu branches: 1.3.10;
Fixed errors in header files
 1.2 02-Sep-2001  manu branches: 1.2.2; 1.2.4; 1.2.6;
Added 64 bits support in header files.
All headers should be common to 32 bits MIPS and 64 bits MIPS now.
 1.1 26-Aug-2001  manu Preliminary work on Linux/mips compatibility. More to come soon...
 1.2.6.5 11-Dec-2002  thorpej Sync with HEAD.
 1.2.6.4 27-Aug-2002  nathanw Catch up to -current.
 1.2.6.3 26-Sep-2001  nathanw Catch up to -current.
Again.
 1.2.6.2 21-Sep-2001  nathanw Catch up to -current.
 1.2.6.1 02-Sep-2001  nathanw file linux_exec.h was added on branch nathanw_sa on 2001-09-21 22:35:16 +0000
 1.2.4.4 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.2.4.3 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.4.2 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.2.4.1 02-Sep-2001  thorpej file linux_exec.h was added on branch kqueue on 2001-09-13 01:15:18 +0000
 1.2.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.3.10.1 29-Aug-2002  gehenna catch up with -current.
 1.8.6.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.8.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.8.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.8.6.1 03-Aug-2004  skrll Sync with HEAD
 1.10.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.10.8.1 29-Apr-2005  kent sync with -current
 1.12.74.2 19-Aug-2009  yamt sync with head.
 1.12.74.1 16-May-2008  yamt sync with head.
 1.12.72.1 18-May-2008  yamt sync with head.
 1.12.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.14.26.1 18-May-2014  rmind sync with head
 1.14.22.2 03-Dec-2017  jdolecek update from HEAD
 1.14.22.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.14.12.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.15.14.1 21-Apr-2017  bouyer Sync with HEAD
 1.15.10.1 20-Mar-2017  pgoyette Sync with HEAD
 1.15.6.1 28-Aug-2017  skrll Sync with HEAD
 1.8 25-Jun-2014  njoly Add a few missing open(2) flags (LINUX_O_*). Fix alpha wrong values.
 1.7 02-Nov-2010  chs branches: 1.7.18; 1.7.32;
define LINUX_O_CLOEXEC.
sort definitions by value.
consistently use hex instead of octal for the values.
 1.6 21-Sep-2010  chs implement O_DIRECTORY as standardized in POSIX-2008,
for both native and linux emulations.
this fixes the rest of PR 43695.
 1.5 28-Apr-2008  martin branches: 1.5.20; 1.5.22;
Remove clause 3 and 4 from TNF licenses
 1.4 11-Dec-2005  christos branches: 1.4.70; 1.4.72; 1.4.74;
merge ktrace-lwp.
 1.3 26-Feb-2005  perry nuke trailing whitespace
 1.2 30-Sep-2001  manu branches: 1.2.18; 1.2.26; 1.2.28;
Added initial support for fcntl64 system call (file locking is not
implemented)
 1.1 26-Aug-2001  manu branches: 1.1.2; 1.1.4; 1.1.6;
Preliminary work on Linux/mips compatibility. More to come soon...
 1.1.6.3 08-Oct-2001  nathanw Catch up to -current.
 1.1.6.2 21-Sep-2001  nathanw Catch up to -current.
 1.1.6.1 26-Aug-2001  nathanw file linux_fcntl.h was added on branch nathanw_sa on 2001-09-21 22:35:16 +0000
 1.1.4.3 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.4.2 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.1.4.1 26-Aug-2001  thorpej file linux_fcntl.h was added on branch kqueue on 2001-09-13 01:15:18 +0000
 1.1.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.2.28.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.2.26.1 29-Apr-2005  kent sync with -current
 1.2.18.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.4.74.2 09-Oct-2010  yamt sync with head
 1.4.74.1 16-May-2008  yamt sync with head.
 1.4.72.1 18-May-2008  yamt sync with head.
 1.4.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.5.22.1 05-Mar-2011  rmind sync with head
 1.5.20.2 06-Nov-2010  uebayasi Sync with HEAD.
 1.5.20.1 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.7.32.1 10-Aug-2014  tls Rebase.
 1.7.18.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.1 26-Aug-2001  manu branches: 1.1.4; 1.1.6; 1.1.122; 1.1.124; 1.1.126;
Preliminary work on Linux/mips compatibility, more to come soon...
 1.1.126.1 16-May-2008  yamt sync with head.
 1.1.124.1 18-May-2008  yamt sync with head.
 1.1.122.1 02-Jun-2008  mjf Sync with HEAD.
 1.1.6.2 21-Sep-2001  nathanw Catch up to -current.
 1.1.6.1 26-Aug-2001  nathanw file linux_ioctl.h was added on branch nathanw_sa on 2001-09-21 22:35:16 +0000
 1.1.4.2 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.1.4.1 26-Aug-2001  thorpej file linux_ioctl.h was added on branch kqueue on 2001-09-13 01:15:18 +0000
 1.45 10-Aug-2025  andvar s/aknowledge/acknowledge/ in comment.
 1.44 07-Sep-2021  riastradh sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.43 09-Nov-2014  maxv branches: 1.43.12; 1.43.24;
Do not uselessly include <sys/malloc.h>.
 1.42 20-Feb-2011  matt branches: 1.42.14; 1.42.30;
Deal with differences in signal delivery between o32/n32/n64.
 1.41 07-Jul-2010  chs branches: 1.41.2; 1.41.4;
many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
- support new-style (NPTL) linux pthreads on all platforms.
clone() with CLONE_THREAD uses 1 process with many LWPs
instead of separate processes.
- move the contents of sys__lwp_setprivate() into a new
lwp_setprivate() and use that everywhere.
- update linux_release[] and linux32_release[] to "2.6.18".
- adjust placement of emul fork/exec/exit hooks as needed
and adjust other emul code to match.
- convert all struct emul definitions to use named initializers.
- change the pid allocator to allow multiple pids to refer to the same proc.
- remove a few fields from struct proc that are no longer needed.
- disable the non-functional "vdso" code in linux32/amd64,
glibc works fine without it.
- fix a race in the futex code where we could miss a wakeup after
a requeue operation.
- redo futex locking to be a little more efficient.
 1.40 14-Dec-2009  matt branches: 1.40.2; 1.40.4;
Merge from matt-nb5-mips64
 1.39 23-Nov-2009  rmind Use lwp_getpcb() in compat code, clean from struct user.
 1.38 28-Apr-2008  martin branches: 1.38.2; 1.38.18;
Remove clause 3 and 4 from TNF licenses
 1.37 24-Apr-2008  ad branches: 1.37.2;
Merge proc::p_mutex and proc::p_smutex into a single adaptive mutex, since
we no longer need to guard against access from hardware interrupt handlers.

Additionally, if cloning a process with CLONE_SIGHAND, arrange to have the
child process share the parent's lock so that signal state may be kept in
sync. Partially addresses PR kern/37437.
 1.36 08-Jan-2008  elad branches: 1.36.6; 1.36.8;
In linux_sys_sysmips(), remove redundant kauth(9) call for LINUX_SETNAME
as the permission check is done by old_sysctl().

okay christos@.
 1.35 20-Dec-2007  dsl Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.34 08-Dec-2007  dsl branches: 1.34.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.33 08-Nov-2007  njoly branches: 1.33.2;
Replace strncpy with strlcpy in compat linux and linux32 uname,
old_uname and oldold_uname syscalls to ensure that all *utsname fields
are always NUL terminated.
 1.32 19-Oct-2007  ad branches: 1.32.2;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.31 13-Jun-2007  christos branches: 1.31.6; 1.31.8; 1.31.12;
cleanup some bitrot; from Matthew Orgass
 1.30 04-Mar-2007  christos branches: 1.30.2; 1.30.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.29 09-Feb-2007  ad branches: 1.29.2;
Merge newlock2 to head.
 1.28 04-Jan-2007  elad Consistent usage of KAUTH_GENERIC_ISSUSER.
 1.27 23-Jul-2006  ad branches: 1.27.4;
Use the LWP cached credentials where sane.
 1.26 15-May-2006  yamt include kauth.h for kauth_authorize_generic.
 1.25 14-May-2006  elad integrate kauth.
 1.24 11-Dec-2005  christos branches: 1.24.4; 1.24.6; 1.24.8; 1.24.10; 1.24.12;
merge ktrace-lwp.
 1.23 20-May-2005  fvdl branches: 1.23.2;
Define linux_usertrap function, and set it in struct emul. For all
but amd64, it just returns 0, doing nothing.

For amd64, it implements vsyscalls through cheating: if the faulting
address is in the vsyscall area (which is statically known on Linux/amd64),
and the intruction pointer is too, it must have been a vsyscall. In that
case, retrieve the return address from the user stack, fix up %rip and
%rsp, and just execute the normal system call. It will return as if
the vsyscall has been executed.
 1.22 26-Feb-2005  perry nuke trailing whitespace
 1.21 19-Jun-2004  manu branches: 1.21.4; 1.21.6;
Build COMPAT_LINUX again on mips after the siginfo change.
 1.20 04-Dec-2003  atatat branches: 1.20.2;
Dynamic sysctl.

Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.

Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.

All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.

PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
 1.19 26-Sep-2003  simonb Fix "constify sendsig/trapsignal" fallout for non-siginfo'd archs. Test
compiled on most architectures.
 1.18 02-Aug-2003  jdolecek use copyin()/copyout() instead of fubyte()/subyte()
also nuke uvm_useracc() check, copyin()/copyout() do this atomically

XXX only compile-tested
 1.17 18-Jan-2003  thorpej branches: 1.17.2;
Merge the nathanw_sa branch.
 1.16 25-Sep-2002  thorpej Don't include <sys/map.h>.
 1.15 04-Jul-2002  thorpej Add kernel support for having userland provide the signal trampoline:

* struct sigacts gets a new sigact_sigdesc structure, which has the
sigaction and the trampoline/version. Version 0 means "legacy kernel
provided trampoline". Other versions are coordinated with machine-
dependent code in libc.
* sigaction1() grows two more arguments -- the trampoline pointer and
the trampoline version.
* A new __sigaction_sigtramp() system call is provided to register a
trampoline along with a signal handler.
* The handler is no longer passed to sensig() functions. Instead,
sendsig() looks up the handler by peeking in the sigacts for the
process getting the signal (since it has to look in there for the
trampoline anyway).
* Native sendsig() functions now select the appropriate trampoline and
its arguments based on the trampoline version in the sigacts.

Changes to libc to use the new facility will be checked in later. Kernel
version not bumped; we will ride the 1.6C bump made recently.
 1.14 20-May-2002  jdolecek whitespace fixes
 1.13 15-Apr-2002  manu branches: 1.13.2;
Do not restore SR on sigreturn: this could enable the user process to gain
unpropre privileges.
 1.12 31-Mar-2002  christos make signal array handling uniform, and put signal arrays in a separate
file. This is simular to errno array handling.
 1.11 17-Feb-2002  rafal Adapt for changes to linux_to_native_sigset() and native_to_linux_sigset().
 1.10 15-Feb-2002  christos - add a real linux_sys___sysctl because the mib numbers are different.
implement only the kernel version getting entries.
- make the signal conversion functions consistent; dest is arg 1.
- make linux_fakedev deal with block and char devices differently.
- add linux_sys_ugetrlimit, and flesh out the regular get/setrlimit so
that they work properly.
- add linux_mmap2 [untested].
- bump kernel to 2.4.18, and make the date be valentine's day :-)
- linux_sys_*stat64 family was totally busted. Fix it.

tested only on i386.

Status:
gdb, telnet, work
jdk-1.4.0 extractor works, jdk still coredumps.

christos
 1.9 20-Nov-2001  manu branches: 1.9.2;
Removed unused (commented out) code
 1.8 20-Nov-2001  manu Fixed the Linux signal trampoline and linux_sys_sigreturn(). Linux signal
delivery now seems fully functionnal.
 1.7 17-Nov-2001  manu Make it build again after recent MIPS cache code changes
 1.6 17-Nov-2001  manu Fixed typos
 1.5 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.4 14-Oct-2001  manu Fixed some mistakes in signal handling (this is still broken)
Added some code to set linux's uname kernel version to 2.4.0 (usefull for
testing with glibc-2.2). This is currently guarded by a #if 0.
 1.3 06-Oct-2001  manu Implements ATOMIC_SET in linux_sys_sysmips
 1.2 30-Sep-2001  manu branches: 1.2.2;
Implements parts of sysmips() and fctnl64() emulation
 1.1 22-Sep-2001  manu branches: 1.1.2;
Initial support for running Linux binaries on the Mips. Both static and
dynamic binaries work on 32 bit mips. Signals are completely broken yet,
and ptrace is not supported.
 1.1.2.14 18-Oct-2002  nathanw Catch up to -current.
 1.1.2.13 01-Aug-2002  nathanw Catch up to -current.
 1.1.2.12 24-Jun-2002  nathanw Curproc->curlwp renaming.

Change uses of "curproc->l_proc" back to "curproc", which is more like the
original use. Bare uses of "curproc" are now "curlwp".

"curproc" is now #defined in proc.h as ((curlwp) ? (curlwp)->l_proc) : NULL)
so that it is always safe to reference curproc (*de*referencing curproc
is another story, but that's always been true).
 1.1.2.11 20-Jun-2002  nathanw Catch up to -current.
 1.1.2.10 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.1.2.9 17-Apr-2002  nathanw Catch up to -current.
 1.1.2.8 28-Feb-2002  nathanw Catch up to -current.
 1.1.2.7 08-Jan-2002  nathanw Catch up to -current.
 1.1.2.6 06-Dec-2001  wdk struct proc -> struct lwp changes for COMPAT_LINUX support on Mips
processors.
 1.1.2.5 14-Nov-2001  nathanw Catch up to -current.
 1.1.2.4 22-Oct-2001  nathanw Catch up to -current.
 1.1.2.3 08-Oct-2001  nathanw Catch up to -current.
 1.1.2.2 26-Sep-2001  nathanw Catch up to -current.
Again.
 1.1.2.1 22-Sep-2001  nathanw file linux_machdep.c was added on branch nathanw_sa on 2001-09-26 19:54:46 +0000
 1.2.2.3 11-Oct-2001  fvdl Catch up with -current. Fix some bogons in the sparc64 kbd/ms
attach code. cd18xx conversion provided by mrg.
 1.2.2.2 01-Oct-2001  fvdl Catch up with -current.
 1.2.2.1 30-Sep-2001  fvdl file linux_machdep.c was added on branch thorpej-devvp on 2001-10-01 12:43:38 +0000
 1.9.2.6 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.9.2.5 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.9.2.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.9.2.3 16-Mar-2002  jdolecek Catch up with -current.
 1.9.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.9.2.1 20-Nov-2001  thorpej file linux_machdep.c was added on branch kqueue on 2002-01-10 19:51:33 +0000
 1.13.2.2 15-Jul-2002  gehenna catch up with -current.
 1.13.2.1 30-May-2002  gehenna Catch up with -current.
 1.17.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.17.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.17.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.17.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.17.2.1 03-Aug-2004  skrll Sync with HEAD
 1.20.2.1 22-Jun-2004  tron Pull up revision 1.21 (requested by manu in ticket #519):
Build COMPAT_LINUX again on mips after the siginfo change.
 1.21.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.21.4.1 29-Apr-2005  kent sync with -current
 1.23.2.7 21-Jan-2008  yamt sync with head
 1.23.2.6 15-Nov-2007  yamt sync with head.
 1.23.2.5 27-Oct-2007  yamt sync with head.
 1.23.2.4 03-Sep-2007  yamt sync with head.
 1.23.2.3 26-Feb-2007  yamt sync with head.
 1.23.2.2 30-Dec-2006  yamt sync with head.
 1.23.2.1 21-Jun-2006  yamt sync with head.
 1.24.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.24.10.2 10-Mar-2006  elad generic_authorize() -> kauth_authorize_generic().
 1.24.10.1 08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.24.8.2 11-Aug-2006  yamt sync with head
 1.24.8.1 24-May-2006  yamt sync with head.
 1.24.6.1 01-Jun-2006  kardel Sync with head.
 1.24.4.1 09-Sep-2006  rpaulo sync with head
 1.27.4.3 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.27.4.2 27-Jan-2007  ad More compat changes.
 1.27.4.1 12-Jan-2007  ad Sync with head.
 1.29.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.30.4.1 11-Jul-2007  mjf Sync with head.
 1.30.2.2 23-Oct-2007  ad Sync with head.
 1.30.2.1 15-Jul-2007  ad Sync with head.
 1.31.12.2 13-Nov-2007  bouyer Sync with HEAD
 1.31.12.1 25-Oct-2007  bouyer Sync with HEAD.
 1.31.8.3 23-Mar-2008  matt sync with HEAD
 1.31.8.2 09-Jan-2008  matt sync with HEAD
 1.31.8.1 06-Nov-2007  matt sync with HEAD
 1.31.6.3 09-Dec-2007  jmcneill Sync with HEAD.
 1.31.6.2 11-Nov-2007  joerg Sync with HEAD.
 1.31.6.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.32.2.3 18-Feb-2008  mjf Sync with HEAD.
 1.32.2.2 27-Dec-2007  mjf Sync with HEAD.
 1.32.2.1 19-Nov-2007  mjf Sync with HEAD.
 1.33.2.1 26-Dec-2007  ad Sync with head.
 1.34.4.2 10-Jan-2008  bouyer Sync with HEAD
 1.34.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.36.8.1 18-May-2008  yamt sync with head.
 1.36.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.37.2.3 11-Aug-2010  yamt sync with head.
 1.37.2.2 11-Mar-2010  yamt sync with head
 1.37.2.1 16-May-2008  yamt sync with head.
 1.38.18.1 21-Aug-2009  matt Adapt to mips changes. Use PRIx*
 1.38.2.3 14-May-2008  wrstuden Per discussion with ad at n dot o, revert signal mask handling
changes.

The l_sigstk changes are most likely totally un-needed as SA will
never use a signal stack - we send an upcall (or will as other
diffs are brought in).

The l_sigmask changes were too controvertial. In all honesty, I
think it's probably best to revert them. The main reason they were
there is the fact that in an SA process, we don't mask signals per
kernel thread, we mask them per user thread. In the kernel, we want
them all to get turned into upcalls. Thus the normal state of
l_sigmask in an SA process is for it to always be empty.

While we are in the process of delivering a signal, we want to
temporarily mask a signal (so we don't recursively exhaust our
upcall stacks). However signal delivery is rare (important, but
rare), and delivering back-to-back signals is even rarer. So rather
than cause every user of a signal mask to be prepared for this very
rare case, we will just add a second check later in the signal
delivery code. Said change is not in this diff.

This also un-compensates all of our compatability code for dealing
with SA. SA is a NetBSD-specific thing, so there's no need for
Irix, Linux, Solaris, SVR4 and so on to cope with it.

As previously, everything other than kern_sa.c compiles in i386
GENERIC as of this checkin. I will switch to ALL soon for compile
testing.
 1.38.2.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.38.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.40.4.1 05-Mar-2011  rmind sync with head
 1.40.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.41.4.1 05-Mar-2011  bouyer Sync with HEAD
 1.41.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.42.30.1 17-Jan-2015  martin Pull up following revision(s) (requested by maxv in ticket #427):
sys/compat/svr4/svr4_schedctl.c: revision 1.8
sys/netinet/tcp_timer.c: revision 1.88
sys/miscfs/genfs/layer_vfsops.c: revision 1.45
sys/compat/svr4/svr4_ioctl.c: revision 1.37
sys/ufs/chfs/chfs_vfsops.c: revision 1.14
sys/miscfs/fdesc/fdesc_vfsops.c: revision 1.91
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.30
sys/compat/common/kern_time_50.c: revision 1.28
sys/netinet6/ip6_forward.c: revision 1.74
sys/miscfs/umapfs/umap_vnops.c: revision 1.57
sys/compat/svr4/svr4_fcntl.c: revision 1.74
distrib/sets/lists/comp/mi: revision 1.1931
sys/netinet6/udp6_output.c: revision 1.46
sys/fs/puffs/puffs_compat.c: revision 1.3
sys/fs/udf/udf_rename.c: revision 1.11
sys/compat/svr4/svr4_filio.c: revision 1.24
sys/fs/udf/udf_rename.c: revision 1.12
sys/netinet/tcp_usrreq.c: revision 1.202
sys/miscfs/umapfs/umap_subr.c: revision 1.29
sys/compat/linux/common/linux_fadvise64.c: revision 1.3
sys/netinet/if_atm.c: revision 1.34
sys/miscfs/procfs/procfs_subr.c: revision 1.106
sys/miscfs/genfs/layer_subr.c: revision 1.37
sys/netinet/tcp_sack.c: revision 1.30
sys/compat/freebsd/freebsd_misc.c: revision 1.33
sys/compat/freebsd/freebsd_file.c: revision 1.33
sys/ufs/chfs/chfs_vnode.c: revision 1.12
sys/compat/svr4/svr4_ttold.c: revision 1.34
sys/compat/linux/common/linux_file.c: revision 1.114
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.43
sys/compat/linux/common/linux_signal.c: revision 1.76
sys/compat/common/compat_util.c: revision 1.46
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.18
sys/compat/svr4/svr4_sockio.c: revision 1.36
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.32
sys/compat/svr4/svr4_signal.c: revision 1.66
sys/kern/kern_exec.c: revision 1.410
sys/fs/puffs/puffs_vfsops.c: revision 1.115
sys/compat/svr4/svr4_exec_elf64.c: revision 1.15
sys/compat/linux/arch/i386/linux_machdep.c: revision 1.159
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.50
sys/compat/linux32/common/linux32_misc.c: revision 1.24
sys/netinet/in_pcb.c: revision 1.153
sys/sys/malloc.h: revision 1.116
sys/compat/common/if_43.c: revision 1.9
share/man/man9/Makefile: revision 1.380
sys/netinet/tcp_vtw.c: revision 1.12
sys/miscfs/umapfs/umap_vfsops.c: revision 1.95
sys/ufs/ext2fs/ext2fs_vfsops.c: revision 1.186
sys/compat/common/uipc_syscalls_43.c: revision 1.46
sys/ufs/ext2fs/ext2fs_vnops.c: revision 1.115
sys/fs/puffs/puffs_msgif.c: revision 1.97
sys/compat/svr4/svr4_ipc.c: revision 1.27
sys/compat/linux/common/linux_exec.c: revision 1.117
sys/ufs/ext2fs/ext2fs_readwrite.c: revision 1.66
sys/netinet/tcp_output.c: revision 1.179
sys/compat/svr4/svr4_termios.c: revision 1.28
sys/fs/udf/udf_strat_bootstrap.c: revision 1.4
sys/fs/puffs/puffs_subr.c: revision 1.67
sys/fs/puffs/puffs_node.c: revision 1.36
sys/miscfs/overlay/overlay_vnops.c: revision 1.21
sys/fs/cd9660/cd9660_node.c: revision 1.34
sys/netinet/raw_ip.c: revision 1.146
sys/sys/mallocvar.h: revision 1.13
sys/miscfs/overlay/overlay_vfsops.c: revision 1.63
share/man/man9/malloc.9: revision 1.50
sys/netinet6/dest6.c: revision 1.18
sys/compat/linux/common/linux_uselib.c: revision 1.33
sys/compat/linux/common/linux_socket.c: revision 1.120
share/man/man9/malloc.9: revision 1.51
sys/netinet/tcp_subr.c: revision 1.257
sys/compat/linux/common/linux_socketcall.c: revision 1.45
sys/compat/linux/common/linux_fadvise64_64.c: revision 1.3
sys/compat/freebsd/freebsd_ipc.c: revision 1.17
sys/compat/linux/common/linux_misc_notalpha.c: revision 1.109
sys/compat/linux/arch/alpha/linux_pipe.c: revision 1.17
sys/netinet6/in6_pcb.c: revision 1.132
sys/netinet6/in6_ifattach.c: revision 1.94
sys/compat/svr4/svr4_exec_elf32.c: revision 1.15
sys/miscfs/nullfs/null_vfsops.c: revision 1.90
sys/fs/cd9660/cd9660_util.c: revision 1.12
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.48
sys/compat/freebsd/freebsd_exec_elf32.c: revision 1.20
sys/miscfs/procfs/procfs_vfsops.c: revision 1.94
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.28
sys/compat/linux/common/linux_sched.c: revision 1.67
sys/compat/linux/common/linux_exec_aout.c: revision 1.67
sys/compat/linux/common/linux_pipe.c: revision 1.67
sys/compat/linux/common/linux_llseek.c: revision 1.34
sys/compat/linux/arch/mips/linux_ptrace.c: revision 1.10
Do not uselessly include <sys/malloc.h>.
Cleanup:
- remove struct kmembuckets (dead)
- correctly deadify MALLOC_XX
- remove MALLOC_DEFINE_LIMIT and MALLOC_JUSTDEFINE_LIMIT (dead)
- remove malloc_roundup(), malloc_type_setlimit(), MALLOC_DEFINE_LIMIT()
and MALLOC_JUSTDEFINE_LIMIT() from man 9 malloc
New sentence, new line. Bump date for previous.
Obsolete malloc_roundup(9), malloc_type_setlimit(9) and MALLOC_DEFINE_LIMIT(9)
man pages.
 1.42.14.1 03-Dec-2017  jdolecek update from HEAD
 1.43.24.1 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.43.12.1 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1836):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.11 20-Feb-2011  matt Deal with differences in signal delivery between o32/n32/n64.
 1.10 12-Nov-2008  ad branches: 1.10.8; 1.10.10; 1.10.12;
Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.
 1.9 28-Apr-2008  martin branches: 1.9.6; 1.9.8;
Remove clause 3 and 4 from TNF licenses
 1.8 04-Dec-2007  dsl branches: 1.8.12; 1.8.14; 1.8.16;
Remove all the __P
 1.7 11-Nov-2005  chs branches: 1.7.46; 1.7.48; 1.7.54; 1.7.58;
include additional headers that are now needed.
 1.6 26-Feb-2005  perry branches: 1.6.4;
nuke trailing whitespace
 1.5 15-Feb-2002  christos branches: 1.5.16; 1.5.24; 1.5.26;
- add a real linux_sys___sysctl because the mib numbers are different.
implement only the kernel version getting entries.
- make the signal conversion functions consistent; dest is arg 1.
- make linux_fakedev deal with block and char devices differently.
- add linux_sys_ugetrlimit, and flesh out the regular get/setrlimit so
that they work properly.
- add linux_mmap2 [untested].
- bump kernel to 2.4.18, and make the date be valentine's day :-)
- linux_sys_*stat64 family was totally busted. Fix it.

tested only on i386.

Status:
gdb, telnet, work
jdk-1.4.0 extractor works, jdk still coredumps.

christos
 1.4 30-Sep-2001  manu Implements parts of sysmips() and fctnl64() emulation
 1.3 22-Sep-2001  manu Fixed errors in header files
 1.2 02-Sep-2001  manu branches: 1.2.2; 1.2.4; 1.2.6;
Added 64 bits support in header files.
All headers should be common to 32 bits MIPS and 64 bits MIPS now.
 1.1 26-Aug-2001  manu Preliminary work on Linux/mips compatibility. More to come soon...
 1.2.6.5 28-Feb-2002  nathanw Catch up to -current.
 1.2.6.4 08-Oct-2001  nathanw Catch up to -current.
 1.2.6.3 26-Sep-2001  nathanw Catch up to -current.
Again.
 1.2.6.2 21-Sep-2001  nathanw Catch up to -current.
 1.2.6.1 02-Sep-2001  nathanw file linux_machdep.h was added on branch nathanw_sa on 2001-09-21 22:35:16 +0000
 1.2.4.4 16-Mar-2002  jdolecek Catch up with -current.
 1.2.4.3 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.4.2 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.2.4.1 02-Sep-2001  thorpej file linux_machdep.h was added on branch kqueue on 2001-09-13 01:15:19 +0000
 1.2.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.5.26.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.5.24.1 29-Apr-2005  kent sync with -current
 1.5.16.2 11-Dec-2005  christos Sync with head.
 1.5.16.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.6.4.2 07-Dec-2007  yamt sync with head
 1.6.4.1 21-Jun-2006  yamt sync with head.
 1.7.58.1 08-Dec-2007  ad Sync with head.
 1.7.54.1 08-Dec-2007  mjf Sync with HEAD.
 1.7.48.1 09-Jan-2008  matt sync with HEAD
 1.7.46.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.8.16.2 04-May-2009  yamt sync with head.
 1.8.16.1 16-May-2008  yamt sync with head.
 1.8.14.1 18-May-2008  yamt sync with head.
 1.8.12.2 17-Jan-2009  mjf Sync with HEAD.
 1.8.12.1 02-Jun-2008  mjf Sync with HEAD.
 1.9.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.9.6.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.10.12.1 05-Mar-2011  bouyer Sync with HEAD
 1.10.10.1 06-Jun-2011  jruoho Sync with HEAD.
 1.10.8.1 05-Mar-2011  rmind sync with head
 1.9 14-Mar-2015  njoly Support Linux MAP_LOCKED mmap flag.
 1.8 28-Apr-2008  martin branches: 1.8.44; 1.8.64;
Remove clause 3 and 4 from TNF licenses
 1.7 11-Dec-2005  christos branches: 1.7.70; 1.7.72; 1.7.74;
merge ktrace-lwp.
 1.6 26-Feb-2005  perry nuke trailing whitespace
 1.5 28-Aug-2004  jdolecek branches: 1.5.4; 1.5.6;
g/c LINUX_MAP_IGNMASK define - it's not used anywhere
 1.4 22-Sep-2001  manu branches: 1.4.18;
Fixed errors in header files
 1.3 02-Sep-2001  manu branches: 1.3.2;
Added some comments
 1.2 26-Aug-2001  manu Preliminary work on Linux/mips compatibility, more to come soon...
 1.1 30-Sep-1998  erh branches: 1.1.24; 1.1.26;
Stubs for future development of linux compat architechtures.
 1.1.26.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.26.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.1.24.2 26-Sep-2001  nathanw Catch up to -current.
Again.
 1.1.24.1 21-Sep-2001  nathanw Catch up to -current.
 1.3.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.4.18.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.4.18.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.18.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.18.1 03-Sep-2004  skrll Sync with HEAD
 1.5.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.5.4.1 29-Apr-2005  kent sync with -current
 1.7.74.1 16-May-2008  yamt sync with head.
 1.7.72.1 18-May-2008  yamt sync with head.
 1.7.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.8.64.1 06-Apr-2015  skrll Sync with HEAD
 1.8.44.1 03-Dec-2017  jdolecek update from HEAD
 1.10 09-Nov-2014  maxv Do not uselessly include <sys/malloc.h>.
 1.9 12-Nov-2008  ad branches: 1.9.26; 1.9.42;
Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.
 1.8 28-Apr-2008  martin branches: 1.8.2; 1.8.6; 1.8.8;
Remove clause 3 and 4 from TNF licenses
 1.7 20-Dec-2007  dsl branches: 1.7.6; 1.7.8; 1.7.10;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.6 09-Feb-2007  ad branches: 1.6.20; 1.6.28; 1.6.32;
Merge newlock2 to head.
 1.5 30-Aug-2006  matt branches: 1.5.2;
Update to deal with options PTRACE
 1.4 18-Jan-2003  thorpej branches: 1.4.18; 1.4.32; 1.4.36;
Merge the nathanw_sa branch.
 1.3 15-Nov-2001  lukem branches: 1.3.2;
don't need <sys/types.h> when including <sys/param.h>
 1.2 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.1 22-Sep-2001  manu branches: 1.1.2; 1.1.4;
Initial support for running Linux binaries on the Mips. Both static and
dynamic binaries work on 32 bit mips. Signals are completely broken yet,
and ptrace is not supported.
 1.1.4.2 01-Oct-2001  fvdl Catch up with -current.
 1.1.4.1 22-Sep-2001  fvdl file linux_ptrace.c was added on branch thorpej-devvp on 2001-10-01 12:43:38 +0000
 1.1.2.6 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.1.2.5 08-Jan-2002  nathanw Catch up to -current.
 1.1.2.4 06-Dec-2001  wdk struct proc -> struct lwp changes for COMPAT_LINUX support on Mips
processors.
 1.1.2.3 14-Nov-2001  nathanw Catch up to -current.
 1.1.2.2 26-Sep-2001  nathanw Catch up to -current.
Again.
 1.1.2.1 22-Sep-2001  nathanw file linux_ptrace.c was added on branch nathanw_sa on 2001-09-26 19:54:47 +0000
 1.3.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.3.2.1 15-Nov-2001  thorpej file linux_ptrace.c was added on branch kqueue on 2002-01-10 19:51:34 +0000
 1.4.36.1 03-Sep-2006  yamt sync with head.
 1.4.32.1 09-Sep-2006  rpaulo sync with head
 1.4.18.3 21-Jan-2008  yamt sync with head
 1.4.18.2 26-Feb-2007  yamt sync with head.
 1.4.18.1 30-Dec-2006  yamt sync with head.
 1.5.2.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.6.32.1 02-Jan-2008  bouyer Sync with HEAD
 1.6.28.1 26-Dec-2007  ad Sync with head.
 1.6.20.1 09-Jan-2008  matt sync with HEAD
 1.7.10.2 04-May-2009  yamt sync with head.
 1.7.10.1 16-May-2008  yamt sync with head.
 1.7.8.1 18-May-2008  yamt sync with head.
 1.7.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.7.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.8.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.8.6.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.8.2.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.8.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.9.42.1 17-Jan-2015  martin Pull up following revision(s) (requested by maxv in ticket #427):
sys/compat/svr4/svr4_schedctl.c: revision 1.8
sys/netinet/tcp_timer.c: revision 1.88
sys/miscfs/genfs/layer_vfsops.c: revision 1.45
sys/compat/svr4/svr4_ioctl.c: revision 1.37
sys/ufs/chfs/chfs_vfsops.c: revision 1.14
sys/miscfs/fdesc/fdesc_vfsops.c: revision 1.91
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.30
sys/compat/common/kern_time_50.c: revision 1.28
sys/netinet6/ip6_forward.c: revision 1.74
sys/miscfs/umapfs/umap_vnops.c: revision 1.57
sys/compat/svr4/svr4_fcntl.c: revision 1.74
distrib/sets/lists/comp/mi: revision 1.1931
sys/netinet6/udp6_output.c: revision 1.46
sys/fs/puffs/puffs_compat.c: revision 1.3
sys/fs/udf/udf_rename.c: revision 1.11
sys/compat/svr4/svr4_filio.c: revision 1.24
sys/fs/udf/udf_rename.c: revision 1.12
sys/netinet/tcp_usrreq.c: revision 1.202
sys/miscfs/umapfs/umap_subr.c: revision 1.29
sys/compat/linux/common/linux_fadvise64.c: revision 1.3
sys/netinet/if_atm.c: revision 1.34
sys/miscfs/procfs/procfs_subr.c: revision 1.106
sys/miscfs/genfs/layer_subr.c: revision 1.37
sys/netinet/tcp_sack.c: revision 1.30
sys/compat/freebsd/freebsd_misc.c: revision 1.33
sys/compat/freebsd/freebsd_file.c: revision 1.33
sys/ufs/chfs/chfs_vnode.c: revision 1.12
sys/compat/svr4/svr4_ttold.c: revision 1.34
sys/compat/linux/common/linux_file.c: revision 1.114
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.43
sys/compat/linux/common/linux_signal.c: revision 1.76
sys/compat/common/compat_util.c: revision 1.46
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.18
sys/compat/svr4/svr4_sockio.c: revision 1.36
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.32
sys/compat/svr4/svr4_signal.c: revision 1.66
sys/kern/kern_exec.c: revision 1.410
sys/fs/puffs/puffs_vfsops.c: revision 1.115
sys/compat/svr4/svr4_exec_elf64.c: revision 1.15
sys/compat/linux/arch/i386/linux_machdep.c: revision 1.159
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.50
sys/compat/linux32/common/linux32_misc.c: revision 1.24
sys/netinet/in_pcb.c: revision 1.153
sys/sys/malloc.h: revision 1.116
sys/compat/common/if_43.c: revision 1.9
share/man/man9/Makefile: revision 1.380
sys/netinet/tcp_vtw.c: revision 1.12
sys/miscfs/umapfs/umap_vfsops.c: revision 1.95
sys/ufs/ext2fs/ext2fs_vfsops.c: revision 1.186
sys/compat/common/uipc_syscalls_43.c: revision 1.46
sys/ufs/ext2fs/ext2fs_vnops.c: revision 1.115
sys/fs/puffs/puffs_msgif.c: revision 1.97
sys/compat/svr4/svr4_ipc.c: revision 1.27
sys/compat/linux/common/linux_exec.c: revision 1.117
sys/ufs/ext2fs/ext2fs_readwrite.c: revision 1.66
sys/netinet/tcp_output.c: revision 1.179
sys/compat/svr4/svr4_termios.c: revision 1.28
sys/fs/udf/udf_strat_bootstrap.c: revision 1.4
sys/fs/puffs/puffs_subr.c: revision 1.67
sys/fs/puffs/puffs_node.c: revision 1.36
sys/miscfs/overlay/overlay_vnops.c: revision 1.21
sys/fs/cd9660/cd9660_node.c: revision 1.34
sys/netinet/raw_ip.c: revision 1.146
sys/sys/mallocvar.h: revision 1.13
sys/miscfs/overlay/overlay_vfsops.c: revision 1.63
share/man/man9/malloc.9: revision 1.50
sys/netinet6/dest6.c: revision 1.18
sys/compat/linux/common/linux_uselib.c: revision 1.33
sys/compat/linux/common/linux_socket.c: revision 1.120
share/man/man9/malloc.9: revision 1.51
sys/netinet/tcp_subr.c: revision 1.257
sys/compat/linux/common/linux_socketcall.c: revision 1.45
sys/compat/linux/common/linux_fadvise64_64.c: revision 1.3
sys/compat/freebsd/freebsd_ipc.c: revision 1.17
sys/compat/linux/common/linux_misc_notalpha.c: revision 1.109
sys/compat/linux/arch/alpha/linux_pipe.c: revision 1.17
sys/netinet6/in6_pcb.c: revision 1.132
sys/netinet6/in6_ifattach.c: revision 1.94
sys/compat/svr4/svr4_exec_elf32.c: revision 1.15
sys/miscfs/nullfs/null_vfsops.c: revision 1.90
sys/fs/cd9660/cd9660_util.c: revision 1.12
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.48
sys/compat/freebsd/freebsd_exec_elf32.c: revision 1.20
sys/miscfs/procfs/procfs_vfsops.c: revision 1.94
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.28
sys/compat/linux/common/linux_sched.c: revision 1.67
sys/compat/linux/common/linux_exec_aout.c: revision 1.67
sys/compat/linux/common/linux_pipe.c: revision 1.67
sys/compat/linux/common/linux_llseek.c: revision 1.34
sys/compat/linux/arch/mips/linux_ptrace.c: revision 1.10
Do not uselessly include <sys/malloc.h>.
Cleanup:
- remove struct kmembuckets (dead)
- correctly deadify MALLOC_XX
- remove MALLOC_DEFINE_LIMIT and MALLOC_JUSTDEFINE_LIMIT (dead)
- remove malloc_roundup(), malloc_type_setlimit(), MALLOC_DEFINE_LIMIT()
and MALLOC_JUSTDEFINE_LIMIT() from man 9 malloc
New sentence, new line. Bump date for previous.
Obsolete malloc_roundup(9), malloc_type_setlimit(9) and MALLOC_DEFINE_LIMIT(9)
man pages.
 1.9.26.1 03-Dec-2017  jdolecek update from HEAD
 1.8 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.7 11-Dec-2005  christos branches: 1.7.70; 1.7.72; 1.7.74;
merge ktrace-lwp.
 1.6 26-Feb-2005  perry nuke trailing whitespace
 1.5 31-Mar-2002  christos branches: 1.5.10; 1.5.18; 1.5.20;
bring the reverse signal mapping array into linux_signo.c
 1.4 31-Mar-2002  christos make signal array handling uniform, and put signal arrays in a separate
file. This is simular to errno array handling.
 1.3 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.2 02-Sep-2001  manu branches: 1.2.4; 1.2.6;
Added some comments
 1.1 26-Aug-2001  manu Preliminary work on Linux/mips compatibility, more to come soon...
 1.2.6.4 17-Apr-2002  nathanw Catch up to -current.
 1.2.6.3 14-Nov-2001  nathanw Catch up to -current.
 1.2.6.2 21-Sep-2001  nathanw Catch up to -current.
 1.2.6.1 02-Sep-2001  nathanw file linux_sigarray.c was added on branch nathanw_sa on 2001-09-21 22:35:16 +0000
 1.2.4.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.2.4.3 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.4.2 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.2.4.1 02-Sep-2001  thorpej file linux_sigarray.c was added on branch kqueue on 2001-09-13 01:15:19 +0000
 1.5.20.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.5.18.1 29-Apr-2005  kent sync with -current
 1.5.10.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.7.74.1 16-May-2008  yamt sync with head.
 1.7.72.1 18-May-2008  yamt sync with head.
 1.7.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.7 18-Nov-2011  christos - add sigtimedwait support.
- merge the siginfo population code.
 1.6 23-Nov-2008  njoly branches: 1.6.16;
Move si_code definitions from MD to MI linux_siginfo.h, all archs
(except mips for 3 values) are identical.
While here, remove unused/unneeded LINUX__SI_CODE macro. Only the
lower 16-bits are used for userland si_code.
 1.5 28-Apr-2008  martin branches: 1.5.6; 1.5.8;
Remove clause 3 and 4 from TNF licenses
 1.4 11-Dec-2005  christos branches: 1.4.70; 1.4.72; 1.4.74;
merge ktrace-lwp.
 1.3 26-Feb-2005  perry nuke trailing whitespace
 1.2 02-Sep-2001  manu branches: 1.2.4; 1.2.6; 1.2.24; 1.2.32; 1.2.34;
Fixed an error in a define
 1.1 26-Aug-2001  manu Preliminary work on Linux/mips compatibility, more to come soon...
 1.2.34.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.2.32.1 29-Apr-2005  kent sync with -current
 1.2.24.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.2.6.2 21-Sep-2001  nathanw Catch up to -current.
 1.2.6.1 02-Sep-2001  nathanw file linux_siginfo.h was added on branch nathanw_sa on 2001-09-21 22:35:16 +0000
 1.2.4.2 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.2.4.1 02-Sep-2001  thorpej file linux_siginfo.h was added on branch kqueue on 2001-09-13 01:15:19 +0000
 1.4.74.2 04-May-2009  yamt sync with head.
 1.4.74.1 16-May-2008  yamt sync with head.
 1.4.72.1 18-May-2008  yamt sync with head.
 1.4.70.2 17-Jan-2009  mjf Sync with HEAD.
 1.4.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.5.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.5.6.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.6.16.1 17-Apr-2012  yamt sync with head
 1.14 14-Nov-2015  christos PR/50428: Rin Okuyama: support SA_RESTORER flag for rt_sigaction(2) in the
ports that support it.
 1.13 28-Apr-2008  martin branches: 1.13.44; 1.13.64;
Remove clause 3 and 4 from TNF licenses
 1.12 04-Dec-2007  dsl branches: 1.12.12; 1.12.14; 1.12.16;
Remove all the __P
 1.11 11-Dec-2005  christos branches: 1.11.44; 1.11.46; 1.11.52; 1.11.56;
merge ktrace-lwp.
 1.10 19-Sep-2005  christos MINSIGSTKSZ on linux is different depending on the platform and usually
smaller than ours.
 1.9 26-Feb-2005  perry branches: 1.9.4;
nuke trailing whitespace
 1.8 26-Nov-2002  christos branches: 1.8.6; 1.8.14; 1.8.16;
rename: s/sa_/<compat>sa/g
 1.7 19-Mar-2002  christos - Now that RT-signals fit, fix the array to deliver them. [i386 only].
- jdk-1.4 works perfectly now. :-)
 1.6 19-Feb-2002  rafal Add LINUX_SA_NOCLDWAIT, LINUX_SA_RESTORER, update LINUX_SA_ALLBITS. Linux
compat on mips builds again now.
 1.5 14-Oct-2001  manu Fixed some mistakes in signal handling (this is still broken)
Added some code to set linux's uname kernel version to 2.4.0 (usefull for
testing with glibc-2.2). This is currently guarded by a #if 0.
 1.4 22-Sep-2001  manu Fixed errors in header files
 1.3 02-Sep-2001  manu branches: 1.3.2; 1.3.4; 1.3.6;
Added 64 bits support in header files.
All headers should be common to 32 bits MIPS and 64 bits MIPS now.
 1.2 02-Sep-2001  manu Fixed indent problems
 1.1 26-Aug-2001  manu Preliminary work on Linux/Mips emulation, more to come soon...
 1.3.6.7 11-Dec-2002  thorpej Sync with HEAD.
 1.3.6.6 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.3.6.5 28-Feb-2002  nathanw Catch up to -current.
 1.3.6.4 22-Oct-2001  nathanw Catch up to -current.
 1.3.6.3 26-Sep-2001  nathanw Catch up to -current.
Again.
 1.3.6.2 21-Sep-2001  nathanw Catch up to -current.
 1.3.6.1 02-Sep-2001  nathanw file linux_signal.h was added on branch nathanw_sa on 2001-09-21 22:35:16 +0000
 1.3.4.5 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.3.4.4 16-Mar-2002  jdolecek Catch up with -current.
 1.3.4.3 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.3.4.2 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.3.4.1 02-Sep-2001  thorpej file linux_signal.h was added on branch kqueue on 2001-09-13 01:15:20 +0000
 1.3.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.8.16.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.8.14.1 29-Apr-2005  kent sync with -current
 1.8.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.8.6.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.9.4.2 07-Dec-2007  yamt sync with head
 1.9.4.1 21-Jun-2006  yamt sync with head.
 1.11.56.1 08-Dec-2007  ad Sync with head.
 1.11.52.1 08-Dec-2007  mjf Sync with HEAD.
 1.11.46.1 09-Jan-2008  matt sync with HEAD
 1.11.44.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.12.16.1 16-May-2008  yamt sync with head.
 1.12.14.1 18-May-2008  yamt sync with head.
 1.12.12.1 02-Jun-2008  mjf Sync with HEAD.
 1.13.64.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.13.44.1 03-Dec-2017  jdolecek update from HEAD
 1.6 25-Jan-2014  njoly Update linux socket socket options (SO_*). Add common version to its
own file (linux_socket_generic.h); use it for all but alpha and mips.
 1.5 28-Apr-2008  martin branches: 1.5.34; 1.5.44; 1.5.50;
Remove clause 3 and 4 from TNF licenses
 1.4 11-Dec-2005  christos branches: 1.4.70; 1.4.72; 1.4.74;
merge ktrace-lwp.
 1.3 26-Feb-2005  perry nuke trailing whitespace
 1.2 26-Jul-2003  jdolecek branches: 1.2.8; 1.2.10;
add LINUX_SO_PEERNAME, LINUX_SO_TIMESTAMP where it has been missing
fix value for LINUX_SO_DETACH_FILTER on couple places (unused anyway)

g/c LINUX_SCM_TIMESTAMP definition for some archs, it will be defined
in generic linux_socket.h
 1.1 26-Aug-2001  manu branches: 1.1.4; 1.1.6; 1.1.24;
Preliminary work on Linux/mips compat, more to come soon...
 1.1.24.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.1.24.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.24.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.24.1 03-Aug-2004  skrll Sync with HEAD
 1.1.6.2 21-Sep-2001  nathanw Catch up to -current.
 1.1.6.1 26-Aug-2001  nathanw file linux_socket.h was added on branch nathanw_sa on 2001-09-21 22:35:17 +0000
 1.1.4.2 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.1.4.1 26-Aug-2001  thorpej file linux_socket.h was added on branch kqueue on 2001-09-13 01:15:20 +0000
 1.2.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.2.8.1 29-Apr-2005  kent sync with -current
 1.4.74.1 16-May-2008  yamt sync with head.
 1.4.72.1 18-May-2008  yamt sync with head.
 1.4.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.5.50.1 18-May-2014  rmind sync with head
 1.5.44.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.5.34.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.93 28-Sep-2024  christos regen
 1.92 01-Jul-2024  christos regen
 1.91 29-Jun-2024  christos branches: 1.91.2;
regen
 1.90 19-Aug-2023  christos regen
 1.89 18-Aug-2023  christos regen
 1.88 29-Jul-2023  christos regen
 1.87 28-Jul-2023  christos regen
 1.86 02-Dec-2021  ryo regen
 1.85 24-Nov-2021  ryo regen
 1.84 20-Sep-2021  thorpej Regen for preadv(2) / pwritev(2).
 1.83 20-Sep-2021  thorpej Regen for eventfd.
 1.82 19-Sep-2021  thorpej Regen for timerfd.
 1.81 19-Sep-2021  thorpej Regen for POSIX timer syscalls.
 1.80 26-Apr-2020  thorpej branches: 1.80.2;
Regen for native futex calls.
 1.79 09-Nov-2019  jdolecek regen
 1.78 10-Aug-2018  pgoyette Regen
 1.77 10-May-2017  riastradh branches: 1.77.8; 1.77.10;
regen
 1.76 09-Feb-2017  christos branches: 1.76.4;
regen
 1.75 09-Feb-2017  christos regen
 1.74 04-Feb-2017  christos regen
 1.73 03-Feb-2017  christos regen
 1.72 02-Feb-2017  christos regen
 1.71 16-Jan-2017  christos regen all
 1.70 13-Jan-2017  christos branches: 1.70.2;
regen
 1.69 02-Jan-2017  martin Regen (something apparently went wrong in previous)
 1.68 02-Jan-2017  manu Regen
 1.67 24-Jul-2016  njoly Regen for readlink/readlinkat signatures.
 1.66 27-Oct-2015  njoly branches: 1.66.2;
Regen.
 1.65 25-Oct-2015  njoly Regen for posix chown family cleanup.
 1.64 24-Sep-2015  christos regen
 1.63 07-Mar-2015  christos regen
 1.62 22-Nov-2014  njoly branches: 1.62.2;
Regen for ppoll signature fix
 1.61 31-May-2014  njoly branches: 1.61.2;
Regen for munmap(2) signature.
 1.60 29-May-2014  njoly Regen for utimes(2) change.
 1.59 20-May-2014  njoly Regen for getgroups/setgroups update.
 1.58 17-May-2014  njoly Regen for fadvise64 offset types changes.
 1.57 06-May-2014  njoly Regen for mknod device argument type change.
 1.56 04-May-2014  njoly Regen for pread/pwrite 64bit offset argument.
 1.55 08-Apr-2014  njoly Regen.
 1.54 08-Dec-2013  njoly branches: 1.54.2;
Regen.
 1.53 19-Nov-2013  chs regen
 1.52 07-Nov-2013  njoly Regen for dup/dup2/dup3 argument types fix.
 1.51 24-Sep-2013  njoly Regen for utimensat(2).
 1.50 08-Apr-2013  pooka branches: 1.50.4;
regen for utimes
 1.49 19-Sep-2012  pooka regen for ppoll (and, apparently, SYCALL_ARG_PTR)
 1.48 18-Nov-2011  christos branches: 1.48.10;
- add sigtimedwait support.
- merge the siginfo population code.
 1.47 30-May-2011  alnsn branches: 1.47.4;
Regenerate files to pick up correct RCS Ids. Suggested by Chris Badura.
 1.46 30-May-2011  alnsn Add fadvise64 and fadvise64_64 syscalls to compat_linux and compat_linux32.
 1.45 15-Apr-2011  he Regenerate these files after adding pipe2() and dup3().
 1.44 20-Feb-2011  matt Regen.
 1.43 07-Jul-2010  chs branches: 1.43.2; 1.43.4;
regen
 1.42 14-Dec-2009  matt branches: 1.42.2; 1.42.4;
Regen (new makesyscalls.sh)
 1.41 24-Nov-2009  njoly Regen for personality(2) update.
 1.40 17-Jun-2009  njoly Regen for sendmsg/recvmsg definitions update.
 1.39 08-Jun-2009  njoly Regen for rt_queueinfo(2) update.
 1.38 17-Jan-2009  njoly branches: 1.38.2;
Regen for wait4 update.
 1.37 15-Jan-2009  njoly Rengen for compat50 update.
 1.36 13-Jan-2009  pooka Regen to prove I didn't screw up the conversion: purely RCSID changes.
 1.35 19-Nov-2008  ad Regen.
 1.34 12-Nov-2008  njoly Regen for nanosleep(2) fix.
 1.33 23-Apr-2008  ad branches: 1.33.2; 1.33.4; 1.33.8; 1.33.10; 1.33.12;
Regen.
 1.32 04-Apr-2008  njoly branches: 1.32.2;
Regen for linux_sys_msync removal.
 1.31 24-Dec-2007  njoly branches: 1.31.6;
Regen for linux_sys_getpgid removal.
 1.30 21-Dec-2007  njoly Regen for getfsuid/setfsgid syscall exchange.
 1.29 20-Dec-2007  dsl regen
 1.28 16-Nov-2007  njoly branches: 1.28.2; 1.28.6;
Regen, for syscalls cleanup.
 1.27 04-Mar-2007  christos branches: 1.27.14; 1.27.16; 1.27.20; 1.27.22;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.26 10-Jun-2006  christos branches: 1.26.12;
regen
 1.25 11-Dec-2005  christos branches: 1.25.4; 1.25.8; 1.25.14;
merge ktrace-lwp.
 1.24 16-May-2005  fvdl branches: 1.24.2;
Regen.
 1.23 16-May-2005  fvdl Regen.
 1.22 26-Feb-2005  perry regen
 1.21 26-Feb-2005  perry regen
 1.20 20-Sep-2004  jdolecek branches: 1.20.4; 1.20.6;
regen:
implement support for Linux statfs64() syscall - 64bit variant of statfs()
 1.19 08-Sep-2004  jdolecek regen: add exit_group(2)
 1.18 01-Aug-2004  jdolecek regen - sync syscall lists with Linux kernel 2.6.7
 1.17 01-Aug-2004  jdolecek regen:

connect madvise(2) and mincore(2) - apparently the newer Linux libs
don't stub it anymore, so allow the application to take advantage
of them

the Linux calls appear to be compatible in the flag values and semantics,
so a wrapper is not necessary
 1.16 10-Aug-2003  jdolecek regen - added wrapper for Linux ftruncate64()
 1.15 23-Jun-2003  christos branches: 1.15.2;
Regen.
 1.14 18-Jan-2003  thorpej Regen for correct RCS ID.
 1.13 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.12 01-Nov-2002  jdolecek nsysent set to 256, and use linux_sys_nosys()
 1.11 10-Apr-2002  christos branches: 1.11.4;
regen
 1.10 22-Mar-2002  christos regen
 1.9 18-Feb-2002  rafal Regen: Use linux_sys_{g,s}setrlimit, remove linux_sys_ugetrlimit since
linux/mips doesn't seem to have one.
 1.8 15-Feb-2002  christos Regen
 1.7 15-Feb-2002  christos - add a real linux_sys___sysctl because the mib numbers are different.
implement only the kernel version getting entries.
- make the signal conversion functions consistent; dest is arg 1.
- make linux_fakedev deal with block and char devices differently.
- add linux_sys_ugetrlimit, and flesh out the regular get/setrlimit so
that they work properly.
- add linux_mmap2 [untested].
- bump kernel to 2.4.18, and make the date be valentine's day :-)
- linux_sys_*stat64 family was totally busted. Fix it.

tested only on i386.

Status:
gdb, telnet, work
jdk-1.4.0 extractor works, jdk still coredumps.

christos
 1.6 20-Nov-2001  manu branches: 1.6.2;
Fixed the Linux signal trampoline and linux_sys_sigreturn(). Linux signal
delivery now seems fully functionnal.
 1.5 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.4 14-Oct-2001  manu Fixed some mistakes in signal handling (this is still broken)
Added some code to set linux's uname kernel version to 2.4.0 (usefull for
testing with glibc-2.2). This is currently guarded by a #if 0.
 1.3 06-Oct-2001  manu Added socket operations to Linux Mips emulation
 1.2 30-Sep-2001  manu branches: 1.2.2;
Implements parts of sysmips() and fctnl64() emulation
 1.1 22-Sep-2001  manu branches: 1.1.2;
More work on Linux compat for Mips: system calls mapping.
 1.1.2.11 11-Nov-2002  nathanw Catch up to -current
 1.1.2.10 29-May-2002  nathanw Regen.
 1.1.2.9 17-Apr-2002  nathanw Catch up to -current.
 1.1.2.8 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.1.2.7 28-Feb-2002  nathanw Catch up to -current.
 1.1.2.6 08-Jan-2002  nathanw Catch up to -current.
 1.1.2.5 06-Dec-2001  wdk struct proc -> struct lwp changes for COMPAT_LINUX support on Mips
processors.
 1.1.2.4 22-Oct-2001  nathanw Catch up to -current.
 1.1.2.3 08-Oct-2001  nathanw Catch up to -current.
 1.1.2.2 26-Sep-2001  nathanw Catch up to -current.
Again.
 1.1.2.1 22-Sep-2001  nathanw file linux_syscall.h was added on branch nathanw_sa on 2001-09-26 19:54:47 +0000
 1.2.2.3 11-Oct-2001  fvdl Catch up with -current. Fix some bogons in the sparc64 kbd/ms
attach code. cd18xx conversion provided by mrg.
 1.2.2.2 01-Oct-2001  fvdl Catch up with -current.
 1.2.2.1 30-Sep-2001  fvdl file linux_syscall.h was added on branch thorpej-devvp on 2001-10-01 12:43:39 +0000
 1.6.2.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.6.2.3 16-Mar-2002  jdolecek Catch up with -current.
 1.6.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.6.2.1 20-Nov-2001  thorpej file linux_syscall.h was added on branch kqueue on 2002-01-10 19:51:34 +0000
 1.11.4.3 14-Jun-2004  jmc Regen for changes in ticket #1708
 1.11.4.2 11-May-2004  tron Regen for ticket 1686.
 1.11.4.1 22-Oct-2003  jmc Regen files (requested by tv in ticket #1427)

Proper support for mmap2
 1.15.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.15.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.15.2.4 24-Sep-2004  skrll Sync with HEAD.
 1.15.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.15.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.15.2.1 03-Aug-2004  skrll Sync with HEAD
 1.20.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.20.4.1 29-Apr-2005  kent sync with -current
 1.24.2.4 21-Jan-2008  yamt sync with head
 1.24.2.3 07-Dec-2007  yamt sync with head
 1.24.2.2 03-Sep-2007  yamt sync with head.
 1.24.2.1 21-Jun-2006  yamt sync with head.
 1.25.14.1 19-Jun-2006  chap Sync with head.
 1.25.8.1 26-Jun-2006  yamt sync with head.
 1.25.4.1 09-Sep-2006  rpaulo sync with head
 1.26.12.1 12-Mar-2007  rmind Sync with HEAD.
 1.27.22.2 27-Dec-2007  mjf Sync with HEAD.
 1.27.22.1 19-Nov-2007  mjf Sync with HEAD.
 1.27.20.1 18-Nov-2007  bouyer Sync with HEAD
 1.27.16.1 09-Jan-2008  matt sync with HEAD
 1.27.14.1 21-Nov-2007  joerg Sync with HEAD.
 1.28.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.28.2.1 26-Dec-2007  ad Sync with head.
 1.31.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.31.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.32.2.1 18-May-2008  yamt sync with head.
 1.33.12.1 20-Nov-2008  snj Regen for ticket 81.
 1.33.10.1 19-Jan-2009  skrll Sync with HEAD.
 1.33.8.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.33.4.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.33.2.4 11-Aug-2010  yamt sync with head.
 1.33.2.3 11-Mar-2010  yamt sync with head
 1.33.2.2 20-Jun-2009  yamt sync with head
 1.33.2.1 04-May-2009  yamt sync with head.
 1.38.2.1 23-Jul-2009  jym Sync with HEAD.
 1.42.4.3 31-May-2011  rmind sync with head
 1.42.4.2 21-Apr-2011  rmind sync with head
 1.42.4.1 05-Mar-2011  rmind sync with head
 1.42.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.43.4.1 05-Mar-2011  bouyer Sync with HEAD
 1.43.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.47.4.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.47.4.2 30-Oct-2012  yamt sync with head
 1.47.4.1 17-Apr-2012  yamt sync with head
 1.48.10.4 03-Dec-2017  jdolecek update from HEAD
 1.48.10.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.48.10.2 23-Jun-2013  tls resync from head
 1.48.10.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.50.4.1 18-May-2014  rmind sync with head
 1.54.2.1 10-Aug-2014  tls Rebase.
 1.61.2.1 17-Apr-2017  snj regen for ticket 1354
 1.62.2.5 28-Aug-2017  skrll Sync with HEAD
 1.62.2.4 05-Feb-2017  skrll Sync with HEAD
 1.62.2.3 05-Oct-2016  skrll Sync with HEAD
 1.62.2.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.62.2.1 06-Apr-2015  skrll Sync with HEAD
 1.66.2.3 20-Mar-2017  pgoyette Sync with HEAD
 1.66.2.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.66.2.1 26-Jul-2016  pgoyette Sync with HEAD
 1.70.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.76.4.1 11-May-2017  pgoyette Sync with HEAD
 1.77.10.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.77.10.1 10-Jun-2019  christos Sync with HEAD
 1.77.8.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.80.2.2 17-Dec-2020  thorpej Regen for preadv(2) and pwritev(2).
 1.80.2.1 15-Dec-2020  thorpej Regen for eventfd, timerfd, POSIX timers.
 1.91.2.1 02-Aug-2025  perseant Sync with HEAD
 1.92 28-Sep-2024  christos regen
 1.91 01-Jul-2024  christos regen
 1.90 29-Jun-2024  christos branches: 1.90.2;
regen
 1.89 19-Aug-2023  christos regen
 1.88 18-Aug-2023  christos regen
 1.87 29-Jul-2023  christos regen
 1.86 28-Jul-2023  christos regen
 1.85 02-Dec-2021  ryo regen
 1.84 24-Nov-2021  ryo regen
 1.83 20-Sep-2021  thorpej Regen for preadv(2) / pwritev(2).
 1.82 20-Sep-2021  thorpej Regen for eventfd.
 1.81 19-Sep-2021  thorpej Regen for timerfd.
 1.80 19-Sep-2021  thorpej Regen for POSIX timer syscalls.
 1.79 26-Apr-2020  thorpej branches: 1.79.2;
Regen for native futex calls.
 1.78 09-Nov-2019  jdolecek regen
 1.77 10-Aug-2018  pgoyette Regen
 1.76 10-May-2017  riastradh branches: 1.76.8; 1.76.10;
regen
 1.75 09-Feb-2017  christos branches: 1.75.4;
regen
 1.74 09-Feb-2017  christos regen
 1.73 04-Feb-2017  christos regen
 1.72 03-Feb-2017  christos regen
 1.71 02-Feb-2017  christos regen
 1.70 16-Jan-2017  christos regen all
 1.69 13-Jan-2017  christos branches: 1.69.2;
regen
 1.68 02-Jan-2017  martin Regen (something apparently went wrong in previous)
 1.67 02-Jan-2017  manu Regen
 1.66 24-Jul-2016  njoly Regen for readlink/readlinkat signatures.
 1.65 27-Oct-2015  njoly branches: 1.65.2;
Regen.
 1.64 25-Oct-2015  njoly Regen for posix chown family cleanup.
 1.63 24-Sep-2015  christos regen
 1.62 07-Mar-2015  christos regen
 1.61 22-Nov-2014  njoly branches: 1.61.2;
Regen for ppoll signature fix
 1.60 31-May-2014  njoly branches: 1.60.2;
Regen for munmap(2) signature.
 1.59 29-May-2014  njoly Regen for utimes(2) change.
 1.58 20-May-2014  njoly Regen for getgroups/setgroups update.
 1.57 17-May-2014  njoly Regen for fadvise64 offset types changes.
 1.56 06-May-2014  njoly Regen for mknod device argument type change.
 1.55 04-May-2014  njoly Regen for pread/pwrite 64bit offset argument.
 1.54 08-Apr-2014  njoly Regen.
 1.53 08-Dec-2013  njoly branches: 1.53.2;
Regen.
 1.52 19-Nov-2013  chs regen
 1.51 07-Nov-2013  njoly Regen for dup/dup2/dup3 argument types fix.
 1.50 24-Sep-2013  njoly Regen for utimensat(2).
 1.49 08-Apr-2013  pooka branches: 1.49.4;
regen for utimes
 1.48 19-Sep-2012  pooka regen for ppoll (and, apparently, SYCALL_ARG_PTR)
 1.47 18-Nov-2011  christos branches: 1.47.10;
- add sigtimedwait support.
- merge the siginfo population code.
 1.46 30-May-2011  alnsn branches: 1.46.4;
Regenerate files to pick up correct RCS Ids. Suggested by Chris Badura.
 1.45 30-May-2011  alnsn Add fadvise64 and fadvise64_64 syscalls to compat_linux and compat_linux32.
 1.44 15-Apr-2011  he Regenerate these files after adding pipe2() and dup3().
 1.43 20-Feb-2011  matt Regen.
 1.42 07-Jul-2010  chs branches: 1.42.2; 1.42.4;
regen
 1.41 14-Dec-2009  matt branches: 1.41.2; 1.41.4;
Regen (new makesyscalls.sh)
 1.40 24-Nov-2009  njoly Regen for personality(2) update.
 1.39 17-Jun-2009  njoly Regen for sendmsg/recvmsg definitions update.
 1.38 08-Jun-2009  njoly Regen for rt_queueinfo(2) update.
 1.37 17-Jan-2009  njoly branches: 1.37.2;
Regen for wait4 update.
 1.36 15-Jan-2009  njoly Rengen for compat50 update.
 1.35 13-Jan-2009  pooka Regen to prove I didn't screw up the conversion: purely RCSID changes.
 1.34 19-Nov-2008  ad Regen.
 1.33 12-Nov-2008  njoly Regen for nanosleep(2) fix.
 1.32 23-Apr-2008  ad branches: 1.32.2; 1.32.4; 1.32.8; 1.32.10; 1.32.12;
Regen.
 1.31 04-Apr-2008  njoly branches: 1.31.2;
Regen for linux_sys_msync removal.
 1.30 24-Dec-2007  njoly branches: 1.30.6;
Regen for linux_sys_getpgid removal.
 1.29 21-Dec-2007  njoly Regen for getfsuid/setfsgid syscall exchange.
 1.28 20-Dec-2007  dsl regen
 1.27 16-Nov-2007  njoly branches: 1.27.2; 1.27.6;
Regen, for syscalls cleanup.
 1.26 04-Mar-2007  christos branches: 1.26.14; 1.26.16; 1.26.20; 1.26.22;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.25 10-Jun-2006  christos branches: 1.25.12;
regen
 1.24 11-Dec-2005  christos branches: 1.24.4; 1.24.8; 1.24.14;
merge ktrace-lwp.
 1.23 16-May-2005  fvdl branches: 1.23.2;
Regen.
 1.22 16-May-2005  fvdl Regen.
 1.21 26-Feb-2005  perry regen
 1.20 26-Feb-2005  perry regen
 1.19 20-Sep-2004  jdolecek branches: 1.19.4; 1.19.6;
regen:
implement support for Linux statfs64() syscall - 64bit variant of statfs()
 1.18 08-Sep-2004  jdolecek regen: add exit_group(2)
 1.17 01-Aug-2004  jdolecek regen - sync syscall lists with Linux kernel 2.6.7
 1.16 01-Aug-2004  jdolecek regen:

connect madvise(2) and mincore(2) - apparently the newer Linux libs
don't stub it anymore, so allow the application to take advantage
of them

the Linux calls appear to be compatible in the flag values and semantics,
so a wrapper is not necessary
 1.15 10-Aug-2003  jdolecek regen - added wrapper for Linux ftruncate64()
 1.14 23-Jun-2003  christos branches: 1.14.2;
Regen.
 1.13 18-Jan-2003  thorpej Regen for correct RCS ID.
 1.12 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.11 10-Apr-2002  christos branches: 1.11.4;
regen
 1.10 22-Mar-2002  christos regen
 1.9 18-Feb-2002  rafal Regen: Use linux_sys_{g,s}setrlimit, remove linux_sys_ugetrlimit since
linux/mips doesn't seem to have one.
 1.8 15-Feb-2002  christos Regen
 1.7 15-Feb-2002  christos - add a real linux_sys___sysctl because the mib numbers are different.
implement only the kernel version getting entries.
- make the signal conversion functions consistent; dest is arg 1.
- make linux_fakedev deal with block and char devices differently.
- add linux_sys_ugetrlimit, and flesh out the regular get/setrlimit so
that they work properly.
- add linux_mmap2 [untested].
- bump kernel to 2.4.18, and make the date be valentine's day :-)
- linux_sys_*stat64 family was totally busted. Fix it.

tested only on i386.

Status:
gdb, telnet, work
jdk-1.4.0 extractor works, jdk still coredumps.

christos
 1.6 20-Nov-2001  manu branches: 1.6.2;
Fixed the Linux signal trampoline and linux_sys_sigreturn(). Linux signal
delivery now seems fully functionnal.
 1.5 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.4 14-Oct-2001  manu Fixed some mistakes in signal handling (this is still broken)
Added some code to set linux's uname kernel version to 2.4.0 (usefull for
testing with glibc-2.2). This is currently guarded by a #if 0.
 1.3 06-Oct-2001  manu Added socket operations to Linux Mips emulation
 1.2 30-Sep-2001  manu branches: 1.2.2;
Implements parts of sysmips() and fctnl64() emulation
 1.1 22-Sep-2001  manu branches: 1.1.2;
More work on Linux compat for Mips: system calls mapping.
 1.1.2.11 29-May-2002  nathanw Regen.
 1.1.2.10 17-Apr-2002  nathanw Catch up to -current.
 1.1.2.9 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.1.2.8 28-Feb-2002  nathanw Catch up to -current.
 1.1.2.7 08-Jan-2002  nathanw Catch up to -current.
 1.1.2.6 06-Dec-2001  wdk struct proc -> struct lwp changes for COMPAT_LINUX support on Mips
processors.
 1.1.2.5 14-Nov-2001  nathanw Catch up to -current.
 1.1.2.4 22-Oct-2001  nathanw Catch up to -current.
 1.1.2.3 08-Oct-2001  nathanw Catch up to -current.
 1.1.2.2 26-Sep-2001  nathanw Catch up to -current.
Again.
 1.1.2.1 22-Sep-2001  nathanw file linux_syscallargs.h was added on branch nathanw_sa on 2001-09-26 19:54:47 +0000
 1.2.2.3 11-Oct-2001  fvdl Catch up with -current. Fix some bogons in the sparc64 kbd/ms
attach code. cd18xx conversion provided by mrg.
 1.2.2.2 01-Oct-2001  fvdl Catch up with -current.
 1.2.2.1 30-Sep-2001  fvdl file linux_syscallargs.h was added on branch thorpej-devvp on 2001-10-01 12:43:40 +0000
 1.6.2.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.6.2.3 16-Mar-2002  jdolecek Catch up with -current.
 1.6.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.6.2.1 20-Nov-2001  thorpej file linux_syscallargs.h was added on branch kqueue on 2002-01-10 19:51:35 +0000
 1.11.4.3 14-Jun-2004  jmc Regen for changes in ticket #1708
 1.11.4.2 11-May-2004  tron Regen for ticket 1686.
 1.11.4.1 22-Oct-2003  jmc Regen files (requested by tv in ticket #1427)

Proper support for mmap2
 1.14.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.14.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.14.2.4 24-Sep-2004  skrll Sync with HEAD.
 1.14.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.14.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.14.2.1 03-Aug-2004  skrll Sync with HEAD
 1.19.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.19.4.1 29-Apr-2005  kent sync with -current
 1.23.2.4 21-Jan-2008  yamt sync with head
 1.23.2.3 07-Dec-2007  yamt sync with head
 1.23.2.2 03-Sep-2007  yamt sync with head.
 1.23.2.1 21-Jun-2006  yamt sync with head.
 1.24.14.1 19-Jun-2006  chap Sync with head.
 1.24.8.1 26-Jun-2006  yamt sync with head.
 1.24.4.1 09-Sep-2006  rpaulo sync with head
 1.25.12.1 12-Mar-2007  rmind Sync with HEAD.
 1.26.22.2 27-Dec-2007  mjf Sync with HEAD.
 1.26.22.1 19-Nov-2007  mjf Sync with HEAD.
 1.26.20.1 18-Nov-2007  bouyer Sync with HEAD
 1.26.16.1 09-Jan-2008  matt sync with HEAD
 1.26.14.1 21-Nov-2007  joerg Sync with HEAD.
 1.27.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.27.2.1 26-Dec-2007  ad Sync with head.
 1.30.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.30.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.31.2.1 18-May-2008  yamt sync with head.
 1.32.12.1 20-Nov-2008  snj Regen for ticket 81.
 1.32.10.1 19-Jan-2009  skrll Sync with HEAD.
 1.32.8.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.32.4.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.32.2.4 11-Aug-2010  yamt sync with head.
 1.32.2.3 11-Mar-2010  yamt sync with head
 1.32.2.2 20-Jun-2009  yamt sync with head
 1.32.2.1 04-May-2009  yamt sync with head.
 1.37.2.1 23-Jul-2009  jym Sync with HEAD.
 1.41.4.3 31-May-2011  rmind sync with head
 1.41.4.2 21-Apr-2011  rmind sync with head
 1.41.4.1 05-Mar-2011  rmind sync with head
 1.41.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.42.4.1 05-Mar-2011  bouyer Sync with HEAD
 1.42.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.46.4.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.46.4.2 30-Oct-2012  yamt sync with head
 1.46.4.1 17-Apr-2012  yamt sync with head
 1.47.10.4 03-Dec-2017  jdolecek update from HEAD
 1.47.10.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.47.10.2 23-Jun-2013  tls resync from head
 1.47.10.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.49.4.1 18-May-2014  rmind sync with head
 1.53.2.1 10-Aug-2014  tls Rebase.
 1.60.2.1 17-Apr-2017  snj regen for ticket 1354
 1.61.2.5 28-Aug-2017  skrll Sync with HEAD
 1.61.2.4 05-Feb-2017  skrll Sync with HEAD
 1.61.2.3 05-Oct-2016  skrll Sync with HEAD
 1.61.2.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.61.2.1 06-Apr-2015  skrll Sync with HEAD
 1.65.2.3 20-Mar-2017  pgoyette Sync with HEAD
 1.65.2.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.65.2.1 26-Jul-2016  pgoyette Sync with HEAD
 1.69.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.75.4.1 11-May-2017  pgoyette Sync with HEAD
 1.76.10.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.76.10.1 10-Jun-2019  christos Sync with HEAD
 1.76.8.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.79.2.2 17-Dec-2020  thorpej Regen for preadv(2) and pwritev(2).
 1.79.2.1 15-Dec-2020  thorpej Regen for eventfd, timerfd, POSIX timers.
 1.90.2.1 02-Aug-2025  perseant Sync with HEAD
 1.92 28-Sep-2024  christos regen
 1.91 01-Jul-2024  christos regen
 1.90 29-Jun-2024  christos branches: 1.90.2;
regen
 1.89 19-Aug-2023  christos regen
 1.88 18-Aug-2023  christos regen
 1.87 29-Jul-2023  christos regen
 1.86 28-Jul-2023  christos regen
 1.85 02-Dec-2021  ryo regen
 1.84 24-Nov-2021  ryo regen
 1.83 20-Sep-2021  thorpej Regen for preadv(2) / pwritev(2).
 1.82 20-Sep-2021  thorpej Regen for eventfd.
 1.81 19-Sep-2021  thorpej Regen for timerfd.
 1.80 19-Sep-2021  thorpej Regen for POSIX timer syscalls.
 1.79 26-Apr-2020  thorpej branches: 1.79.2;
Regen for native futex calls.
 1.78 09-Nov-2019  jdolecek regen
 1.77 10-Aug-2018  pgoyette Regen
 1.76 10-May-2017  riastradh branches: 1.76.8; 1.76.10;
regen
 1.75 09-Feb-2017  christos branches: 1.75.4;
regen
 1.74 09-Feb-2017  christos regen
 1.73 04-Feb-2017  christos regen
 1.72 03-Feb-2017  christos regen
 1.71 02-Feb-2017  christos regen
 1.70 16-Jan-2017  christos regen all
 1.69 13-Jan-2017  christos branches: 1.69.2;
regen
 1.68 02-Jan-2017  martin Regen (something apparently went wrong in previous)
 1.67 02-Jan-2017  manu Regen
 1.66 24-Jul-2016  njoly Regen for readlink/readlinkat signatures.
 1.65 27-Oct-2015  njoly branches: 1.65.2;
Regen.
 1.64 25-Oct-2015  njoly Regen for posix chown family cleanup.
 1.63 24-Sep-2015  christos regen
 1.62 07-Mar-2015  christos regen
 1.61 22-Nov-2014  njoly branches: 1.61.2;
Regen for ppoll signature fix
 1.60 31-May-2014  njoly branches: 1.60.2;
Regen for munmap(2) signature.
 1.59 29-May-2014  njoly Regen for utimes(2) change.
 1.58 20-May-2014  njoly Regen for getgroups/setgroups update.
 1.57 17-May-2014  njoly Regen for fadvise64 offset types changes.
 1.56 06-May-2014  njoly Regen for mknod device argument type change.
 1.55 04-May-2014  njoly Regen for pread/pwrite 64bit offset argument.
 1.54 08-Apr-2014  njoly Regen.
 1.53 08-Dec-2013  njoly branches: 1.53.2;
Regen.
 1.52 19-Nov-2013  chs regen
 1.51 07-Nov-2013  njoly Regen for dup/dup2/dup3 argument types fix.
 1.50 24-Sep-2013  njoly Regen for utimensat(2).
 1.49 08-Apr-2013  pooka branches: 1.49.4;
regen for utimes
 1.48 19-Sep-2012  pooka regen for ppoll (and, apparently, SYCALL_ARG_PTR)
 1.47 18-Nov-2011  christos branches: 1.47.10;
- add sigtimedwait support.
- merge the siginfo population code.
 1.46 30-May-2011  alnsn branches: 1.46.4;
Regenerate files to pick up correct RCS Ids. Suggested by Chris Badura.
 1.45 30-May-2011  alnsn Add fadvise64 and fadvise64_64 syscalls to compat_linux and compat_linux32.
 1.44 15-Apr-2011  he Regenerate these files after adding pipe2() and dup3().
 1.43 20-Feb-2011  matt Regen.
 1.42 07-Jul-2010  chs branches: 1.42.2; 1.42.4;
regen
 1.41 14-Dec-2009  matt branches: 1.41.2; 1.41.4;
Regen (new makesyscalls.sh)
 1.40 24-Nov-2009  njoly Regen for personality(2) update.
 1.39 17-Jun-2009  njoly Regen for sendmsg/recvmsg definitions update.
 1.38 08-Jun-2009  njoly Regen for rt_queueinfo(2) update.
 1.37 17-Jan-2009  njoly branches: 1.37.2;
Regen for wait4 update.
 1.36 15-Jan-2009  njoly Rengen for compat50 update.
 1.35 13-Jan-2009  pooka Regen to prove I didn't screw up the conversion: purely RCSID changes.
 1.34 19-Nov-2008  ad Regen.
 1.33 12-Nov-2008  njoly Regen for nanosleep(2) fix.
 1.32 23-Apr-2008  ad branches: 1.32.2; 1.32.4; 1.32.8; 1.32.10; 1.32.12;
Regen.
 1.31 04-Apr-2008  njoly branches: 1.31.2;
Regen for linux_sys_msync removal.
 1.30 24-Dec-2007  njoly branches: 1.30.6;
Regen for linux_sys_getpgid removal.
 1.29 21-Dec-2007  njoly Regen for getfsuid/setfsgid syscall exchange.
 1.28 20-Dec-2007  dsl regen
 1.27 16-Nov-2007  njoly branches: 1.27.2; 1.27.6;
Regen, for syscalls cleanup.
 1.26 09-Feb-2007  ad branches: 1.26.18; 1.26.20; 1.26.24; 1.26.26;
Merge newlock2 to head.
 1.25 10-Jun-2006  christos branches: 1.25.6;
regen
 1.24 11-Dec-2005  christos branches: 1.24.4; 1.24.8; 1.24.14;
merge ktrace-lwp.
 1.23 16-May-2005  fvdl branches: 1.23.2;
Regen.
 1.22 16-May-2005  fvdl Regen.
 1.21 26-Feb-2005  perry regen
 1.20 26-Feb-2005  perry regen
 1.19 20-Sep-2004  jdolecek branches: 1.19.4; 1.19.6;
regen:
implement support for Linux statfs64() syscall - 64bit variant of statfs()
 1.18 08-Sep-2004  jdolecek regen: add exit_group(2)
 1.17 01-Aug-2004  jdolecek regen - sync syscall lists with Linux kernel 2.6.7
 1.16 01-Aug-2004  jdolecek regen:

connect madvise(2) and mincore(2) - apparently the newer Linux libs
don't stub it anymore, so allow the application to take advantage
of them

the Linux calls appear to be compatible in the flag values and semantics,
so a wrapper is not necessary
 1.15 10-Aug-2003  jdolecek regen - added wrapper for Linux ftruncate64()
 1.14 23-Jun-2003  christos branches: 1.14.2;
Regen.
 1.13 18-Jan-2003  thorpej Regen for correct RCS ID.
 1.12 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.11 10-Apr-2002  christos branches: 1.11.4;
regen
 1.10 22-Mar-2002  christos regen
 1.9 18-Feb-2002  rafal Regen: Use linux_sys_{g,s}setrlimit, remove linux_sys_ugetrlimit since
linux/mips doesn't seem to have one.
 1.8 15-Feb-2002  christos Regen
 1.7 15-Feb-2002  christos - add a real linux_sys___sysctl because the mib numbers are different.
implement only the kernel version getting entries.
- make the signal conversion functions consistent; dest is arg 1.
- make linux_fakedev deal with block and char devices differently.
- add linux_sys_ugetrlimit, and flesh out the regular get/setrlimit so
that they work properly.
- add linux_mmap2 [untested].
- bump kernel to 2.4.18, and make the date be valentine's day :-)
- linux_sys_*stat64 family was totally busted. Fix it.

tested only on i386.

Status:
gdb, telnet, work
jdk-1.4.0 extractor works, jdk still coredumps.

christos
 1.6 20-Nov-2001  manu branches: 1.6.2;
Fixed the Linux signal trampoline and linux_sys_sigreturn(). Linux signal
delivery now seems fully functionnal.
 1.5 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.4 14-Oct-2001  manu Fixed some mistakes in signal handling (this is still broken)
Added some code to set linux's uname kernel version to 2.4.0 (usefull for
testing with glibc-2.2). This is currently guarded by a #if 0.
 1.3 06-Oct-2001  manu Added socket operations to Linux Mips emulation
 1.2 30-Sep-2001  manu branches: 1.2.2;
Implements parts of sysmips() and fctnl64() emulation
 1.1 22-Sep-2001  manu branches: 1.1.2;
More work on Linux compat for Mips: system calls mapping.
 1.1.2.11 29-May-2002  nathanw Regen.
 1.1.2.10 17-Apr-2002  nathanw Catch up to -current.
 1.1.2.9 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.1.2.8 28-Feb-2002  nathanw Catch up to -current.
 1.1.2.7 08-Jan-2002  nathanw Catch up to -current.
 1.1.2.6 06-Dec-2001  wdk struct proc -> struct lwp changes for COMPAT_LINUX support on Mips
processors.
 1.1.2.5 14-Nov-2001  nathanw Catch up to -current.
 1.1.2.4 22-Oct-2001  nathanw Catch up to -current.
 1.1.2.3 08-Oct-2001  nathanw Catch up to -current.
 1.1.2.2 26-Sep-2001  nathanw Catch up to -current.
Again.
 1.1.2.1 22-Sep-2001  nathanw file linux_syscalls.c was added on branch nathanw_sa on 2001-09-26 19:54:47 +0000
 1.2.2.3 11-Oct-2001  fvdl Catch up with -current. Fix some bogons in the sparc64 kbd/ms
attach code. cd18xx conversion provided by mrg.
 1.2.2.2 01-Oct-2001  fvdl Catch up with -current.
 1.2.2.1 30-Sep-2001  fvdl file linux_syscalls.c was added on branch thorpej-devvp on 2001-10-01 12:43:40 +0000
 1.6.2.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.6.2.3 16-Mar-2002  jdolecek Catch up with -current.
 1.6.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.6.2.1 20-Nov-2001  thorpej file linux_syscalls.c was added on branch kqueue on 2002-01-10 19:51:35 +0000
 1.11.4.3 14-Jun-2004  jmc Regen for changes in ticket #1708
 1.11.4.2 11-May-2004  tron Regen for ticket 1686.
 1.11.4.1 22-Oct-2003  jmc Regen files (requested by tv in ticket #1427)

Proper support for mmap2
 1.14.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.14.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.14.2.4 24-Sep-2004  skrll Sync with HEAD.
 1.14.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.14.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.14.2.1 03-Aug-2004  skrll Sync with HEAD
 1.19.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.19.4.1 29-Apr-2005  kent sync with -current
 1.23.2.4 21-Jan-2008  yamt sync with head
 1.23.2.3 07-Dec-2007  yamt sync with head
 1.23.2.2 26-Feb-2007  yamt sync with head.
 1.23.2.1 21-Jun-2006  yamt sync with head.
 1.24.14.1 19-Jun-2006  chap Sync with head.
 1.24.8.1 26-Jun-2006  yamt sync with head.
 1.24.4.1 09-Sep-2006  rpaulo sync with head
 1.25.6.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.26.26.2 27-Dec-2007  mjf Sync with HEAD.
 1.26.26.1 19-Nov-2007  mjf Sync with HEAD.
 1.26.24.1 18-Nov-2007  bouyer Sync with HEAD
 1.26.20.1 09-Jan-2008  matt sync with HEAD
 1.26.18.1 21-Nov-2007  joerg Sync with HEAD.
 1.27.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.27.2.1 26-Dec-2007  ad Sync with head.
 1.30.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.30.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.31.2.1 18-May-2008  yamt sync with head.
 1.32.12.1 20-Nov-2008  snj Regen for ticket 81.
 1.32.10.1 19-Jan-2009  skrll Sync with HEAD.
 1.32.8.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.32.4.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.32.4.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.32.2.4 11-Aug-2010  yamt sync with head.
 1.32.2.3 11-Mar-2010  yamt sync with head
 1.32.2.2 20-Jun-2009  yamt sync with head
 1.32.2.1 04-May-2009  yamt sync with head.
 1.37.2.1 23-Jul-2009  jym Sync with HEAD.
 1.41.4.3 31-May-2011  rmind sync with head
 1.41.4.2 21-Apr-2011  rmind sync with head
 1.41.4.1 05-Mar-2011  rmind sync with head
 1.41.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.42.4.1 05-Mar-2011  bouyer Sync with HEAD
 1.42.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.46.4.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.46.4.2 30-Oct-2012  yamt sync with head
 1.46.4.1 17-Apr-2012  yamt sync with head
 1.47.10.4 03-Dec-2017  jdolecek update from HEAD
 1.47.10.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.47.10.2 23-Jun-2013  tls resync from head
 1.47.10.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.49.4.1 18-May-2014  rmind sync with head
 1.53.2.1 10-Aug-2014  tls Rebase.
 1.60.2.1 17-Apr-2017  snj regen for ticket 1354
 1.61.2.4 05-Feb-2017  skrll Sync with HEAD
 1.61.2.3 05-Oct-2016  skrll Sync with HEAD
 1.61.2.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.61.2.1 06-Apr-2015  skrll Sync with HEAD
 1.65.2.3 20-Mar-2017  pgoyette Sync with HEAD
 1.65.2.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.65.2.1 26-Jul-2016  pgoyette Sync with HEAD
 1.69.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.75.4.1 11-May-2017  pgoyette Sync with HEAD
 1.76.10.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.76.10.1 10-Jun-2019  christos Sync with HEAD
 1.76.8.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.79.2.2 17-Dec-2020  thorpej Regen for preadv(2) and pwritev(2).
 1.79.2.1 15-Dec-2020  thorpej Regen for eventfd, timerfd, POSIX timers.
 1.90.2.1 02-Aug-2025  perseant Sync with HEAD
 1.92 28-Sep-2024  christos regen
 1.91 01-Jul-2024  christos regen
 1.90 29-Jun-2024  christos branches: 1.90.2;
regen
 1.89 19-Aug-2023  christos regen
 1.88 18-Aug-2023  christos regen
 1.87 29-Jul-2023  christos regen
 1.86 28-Jul-2023  christos regen
 1.85 02-Dec-2021  ryo regen
 1.84 24-Nov-2021  ryo regen
 1.83 20-Sep-2021  thorpej Regen for preadv(2) / pwritev(2).
 1.82 20-Sep-2021  thorpej Regen for eventfd.
 1.81 19-Sep-2021  thorpej Regen for timerfd.
 1.80 19-Sep-2021  thorpej Regen for POSIX timer syscalls.
 1.79 26-Apr-2020  thorpej branches: 1.79.2;
Regen for native futex calls.
 1.78 09-Nov-2019  jdolecek regen
 1.77 10-Aug-2018  pgoyette Regen
 1.76 10-May-2017  riastradh branches: 1.76.8; 1.76.10;
regen
 1.75 09-Feb-2017  christos branches: 1.75.4;
regen
 1.74 09-Feb-2017  christos regen
 1.73 04-Feb-2017  christos regen
 1.72 03-Feb-2017  christos regen
 1.71 02-Feb-2017  christos regen
 1.70 16-Jan-2017  christos regen all
 1.69 13-Jan-2017  christos branches: 1.69.2;
regen
 1.68 02-Jan-2017  martin Regen (something apparently went wrong in previous)
 1.67 02-Jan-2017  manu Regen
 1.66 24-Jul-2016  njoly Regen for readlink/readlinkat signatures.
 1.65 27-Oct-2015  njoly branches: 1.65.2;
Regen.
 1.64 25-Oct-2015  njoly Regen for posix chown family cleanup.
 1.63 24-Sep-2015  christos regen
 1.62 07-Mar-2015  christos regen
 1.61 22-Nov-2014  njoly branches: 1.61.2;
Regen for ppoll signature fix
 1.60 31-May-2014  njoly branches: 1.60.2;
Regen for munmap(2) signature.
 1.59 29-May-2014  njoly Regen for utimes(2) change.
 1.58 20-May-2014  njoly Regen for getgroups/setgroups update.
 1.57 17-May-2014  njoly Regen for fadvise64 offset types changes.
 1.56 06-May-2014  njoly Regen for mknod device argument type change.
 1.55 04-May-2014  njoly Regen for pread/pwrite 64bit offset argument.
 1.54 08-Apr-2014  njoly Regen.
 1.53 08-Dec-2013  njoly branches: 1.53.2;
Regen.
 1.52 19-Nov-2013  chs regen
 1.51 07-Nov-2013  njoly Regen for dup/dup2/dup3 argument types fix.
 1.50 24-Sep-2013  njoly Regen for utimensat(2).
 1.49 08-Apr-2013  pooka branches: 1.49.4;
regen for utimes
 1.48 19-Sep-2012  pooka regen for ppoll (and, apparently, SYCALL_ARG_PTR)
 1.47 18-Nov-2011  christos branches: 1.47.10;
- add sigtimedwait support.
- merge the siginfo population code.
 1.46 30-May-2011  alnsn branches: 1.46.4;
Regenerate files to pick up correct RCS Ids. Suggested by Chris Badura.
 1.45 30-May-2011  alnsn Add fadvise64 and fadvise64_64 syscalls to compat_linux and compat_linux32.
 1.44 15-Apr-2011  he Regenerate these files after adding pipe2() and dup3().
 1.43 20-Feb-2011  matt Regen.
 1.42 07-Jul-2010  chs branches: 1.42.2; 1.42.4;
regen
 1.41 14-Dec-2009  matt branches: 1.41.2; 1.41.4;
Regen (new makesyscalls.sh)
 1.40 24-Nov-2009  njoly Regen for personality(2) update.
 1.39 17-Jun-2009  njoly Regen for sendmsg/recvmsg definitions update.
 1.38 08-Jun-2009  njoly Regen for rt_queueinfo(2) update.
 1.37 17-Jan-2009  njoly branches: 1.37.2;
Regen for wait4 update.
 1.36 15-Jan-2009  njoly Rengen for compat50 update.
 1.35 13-Jan-2009  pooka Regen to prove I didn't screw up the conversion: purely RCSID changes.
 1.34 19-Nov-2008  ad Regen.
 1.33 12-Nov-2008  njoly Regen for nanosleep(2) fix.
 1.32 23-Apr-2008  ad branches: 1.32.2; 1.32.4; 1.32.8; 1.32.10; 1.32.12;
Regen.
 1.31 04-Apr-2008  njoly branches: 1.31.2;
Regen for linux_sys_msync removal.
 1.30 24-Dec-2007  njoly branches: 1.30.6;
Regen for linux_sys_getpgid removal.
 1.29 21-Dec-2007  njoly Regen for getfsuid/setfsgid syscall exchange.
 1.28 20-Dec-2007  dsl regen
 1.27 16-Nov-2007  njoly branches: 1.27.2; 1.27.6;
Regen, for syscalls cleanup.
 1.26 09-Feb-2007  ad branches: 1.26.18; 1.26.20; 1.26.24; 1.26.26;
Merge newlock2 to head.
 1.25 10-Jun-2006  christos branches: 1.25.6;
regen
 1.24 11-Dec-2005  christos branches: 1.24.4; 1.24.8; 1.24.14;
merge ktrace-lwp.
 1.23 16-May-2005  fvdl branches: 1.23.2;
Regen.
 1.22 16-May-2005  fvdl Regen.
 1.21 26-Feb-2005  perry regen
 1.20 26-Feb-2005  perry regen
 1.19 20-Sep-2004  jdolecek branches: 1.19.4; 1.19.6;
regen:
implement support for Linux statfs64() syscall - 64bit variant of statfs()
 1.18 08-Sep-2004  jdolecek regen: add exit_group(2)
 1.17 01-Aug-2004  jdolecek regen - sync syscall lists with Linux kernel 2.6.7
 1.16 01-Aug-2004  jdolecek regen:

connect madvise(2) and mincore(2) - apparently the newer Linux libs
don't stub it anymore, so allow the application to take advantage
of them

the Linux calls appear to be compatible in the flag values and semantics,
so a wrapper is not necessary
 1.15 10-Aug-2003  jdolecek regen - added wrapper for Linux ftruncate64()
 1.14 23-Jun-2003  christos branches: 1.14.2;
Regen.
 1.13 18-Jan-2003  thorpej Regen for correct RCS ID.
 1.12 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.11 01-Nov-2002  jdolecek nsysent set to 256, and use linux_sys_nosys()
 1.10 10-Apr-2002  christos branches: 1.10.4;
regen
 1.9 22-Mar-2002  christos regen
 1.8 18-Feb-2002  rafal Regen: Use linux_sys_{g,s}setrlimit, remove linux_sys_ugetrlimit since
linux/mips doesn't seem to have one.
 1.7 15-Feb-2002  christos Regen
 1.6 20-Nov-2001  manu branches: 1.6.2;
Fixed the Linux signal trampoline and linux_sys_sigreturn(). Linux signal
delivery now seems fully functionnal.
 1.5 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.4 14-Oct-2001  manu Fixed some mistakes in signal handling (this is still broken)
Added some code to set linux's uname kernel version to 2.4.0 (usefull for
testing with glibc-2.2). This is currently guarded by a #if 0.
 1.3 06-Oct-2001  manu Added socket operations to Linux Mips emulation
 1.2 30-Sep-2001  manu branches: 1.2.2;
Implements parts of sysmips() and fctnl64() emulation
 1.1 22-Sep-2001  manu branches: 1.1.2;
One file that was missing from a previous commit
 1.1.2.12 11-Nov-2002  nathanw Catch up to -current
 1.1.2.11 29-May-2002  nathanw Regen.
 1.1.2.10 17-Apr-2002  nathanw Catch up to -current.
 1.1.2.9 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.1.2.8 28-Feb-2002  nathanw Catch up to -current.
 1.1.2.7 08-Jan-2002  nathanw Catch up to -current.
 1.1.2.6 06-Dec-2001  wdk struct proc -> struct lwp changes for COMPAT_LINUX support on Mips
processors.
 1.1.2.5 14-Nov-2001  nathanw Catch up to -current.
 1.1.2.4 22-Oct-2001  nathanw Catch up to -current.
 1.1.2.3 08-Oct-2001  nathanw Catch up to -current.
 1.1.2.2 26-Sep-2001  nathanw Catch up to -current.
Again.
 1.1.2.1 22-Sep-2001  nathanw file linux_sysent.c was added on branch nathanw_sa on 2001-09-26 19:54:47 +0000
 1.2.2.3 11-Oct-2001  fvdl Catch up with -current. Fix some bogons in the sparc64 kbd/ms
attach code. cd18xx conversion provided by mrg.
 1.2.2.2 01-Oct-2001  fvdl Catch up with -current.
 1.2.2.1 30-Sep-2001  fvdl file linux_sysent.c was added on branch thorpej-devvp on 2001-10-01 12:43:40 +0000
 1.6.2.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.6.2.3 16-Mar-2002  jdolecek Catch up with -current.
 1.6.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.6.2.1 20-Nov-2001  thorpej file linux_sysent.c was added on branch kqueue on 2002-01-10 19:51:35 +0000
 1.10.4.3 14-Jun-2004  jmc Regen for changes in ticket #1708
 1.10.4.2 11-May-2004  tron Regen for ticket 1686.
 1.10.4.1 22-Oct-2003  jmc Regen files (requested by tv in ticket #1427)

Proper support for mmap2
 1.14.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.14.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.14.2.4 24-Sep-2004  skrll Sync with HEAD.
 1.14.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.14.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.14.2.1 03-Aug-2004  skrll Sync with HEAD
 1.19.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.19.4.1 29-Apr-2005  kent sync with -current
 1.23.2.4 21-Jan-2008  yamt sync with head
 1.23.2.3 07-Dec-2007  yamt sync with head
 1.23.2.2 26-Feb-2007  yamt sync with head.
 1.23.2.1 21-Jun-2006  yamt sync with head.
 1.24.14.1 19-Jun-2006  chap Sync with head.
 1.24.8.1 26-Jun-2006  yamt sync with head.
 1.24.4.1 09-Sep-2006  rpaulo sync with head
 1.25.6.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.26.26.2 27-Dec-2007  mjf Sync with HEAD.
 1.26.26.1 19-Nov-2007  mjf Sync with HEAD.
 1.26.24.1 18-Nov-2007  bouyer Sync with HEAD
 1.26.20.1 09-Jan-2008  matt sync with HEAD
 1.26.18.1 21-Nov-2007  joerg Sync with HEAD.
 1.27.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.27.2.1 26-Dec-2007  ad Sync with head.
 1.30.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.30.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.31.2.1 18-May-2008  yamt sync with head.
 1.32.12.1 20-Nov-2008  snj Regen for ticket 81.
 1.32.10.1 19-Jan-2009  skrll Sync with HEAD.
 1.32.8.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.32.4.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.32.4.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.32.2.4 11-Aug-2010  yamt sync with head.
 1.32.2.3 11-Mar-2010  yamt sync with head
 1.32.2.2 20-Jun-2009  yamt sync with head
 1.32.2.1 04-May-2009  yamt sync with head.
 1.37.2.1 23-Jul-2009  jym Sync with HEAD.
 1.41.4.3 31-May-2011  rmind sync with head
 1.41.4.2 21-Apr-2011  rmind sync with head
 1.41.4.1 05-Mar-2011  rmind sync with head
 1.41.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.42.4.1 05-Mar-2011  bouyer Sync with HEAD
 1.42.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.46.4.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.46.4.2 30-Oct-2012  yamt sync with head
 1.46.4.1 17-Apr-2012  yamt sync with head
 1.47.10.4 03-Dec-2017  jdolecek update from HEAD
 1.47.10.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.47.10.2 23-Jun-2013  tls resync from head
 1.47.10.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.49.4.1 18-May-2014  rmind sync with head
 1.53.2.1 10-Aug-2014  tls Rebase.
 1.60.2.1 17-Apr-2017  snj regen for ticket 1354
 1.61.2.4 05-Feb-2017  skrll Sync with HEAD
 1.61.2.3 05-Oct-2016  skrll Sync with HEAD
 1.61.2.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.61.2.1 06-Apr-2015  skrll Sync with HEAD
 1.65.2.3 20-Mar-2017  pgoyette Sync with HEAD
 1.65.2.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.65.2.1 26-Jul-2016  pgoyette Sync with HEAD
 1.69.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.75.4.1 11-May-2017  pgoyette Sync with HEAD
 1.76.10.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.76.10.1 10-Jun-2019  christos Sync with HEAD
 1.76.8.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.79.2.2 17-Dec-2020  thorpej Regen for preadv(2) and pwritev(2).
 1.79.2.1 15-Dec-2020  thorpej Regen for eventfd, timerfd, POSIX timers.
 1.90.2.1 02-Aug-2025  perseant Sync with HEAD
 1.5 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.4 11-Dec-2005  christos branches: 1.4.70; 1.4.72; 1.4.74;
merge ktrace-lwp.
 1.3 26-Feb-2005  perry nuke trailing whitespace
 1.2 02-Sep-2001  manu branches: 1.2.4; 1.2.6; 1.2.24; 1.2.32; 1.2.34;
Fixed indent problems
 1.1 26-Aug-2001  manu Preliminary work on Linux/Mips emul. More to come soon...
 1.2.34.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.2.32.1 29-Apr-2005  kent sync with -current
 1.2.24.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.2.6.2 21-Sep-2001  nathanw Catch up to -current.
 1.2.6.1 02-Sep-2001  nathanw file linux_termios.h was added on branch nathanw_sa on 2001-09-21 22:35:17 +0000
 1.2.4.2 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.2.4.1 02-Sep-2001  thorpej file linux_termios.h was added on branch kqueue on 2001-09-13 01:15:20 +0000
 1.4.74.1 16-May-2008  yamt sync with head.
 1.4.72.1 18-May-2008  yamt sync with head.
 1.4.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.11 11-Jan-2009  christos merge christos-time_t
 1.10 28-Apr-2008  martin branches: 1.10.8; 1.10.14;
Remove clause 3 and 4 from TNF licenses
 1.9 11-Dec-2005  christos branches: 1.9.70; 1.9.72; 1.9.74;
merge ktrace-lwp.
 1.8 26-Feb-2005  perry nuke trailing whitespace
 1.7 20-Sep-2004  jdolecek branches: 1.7.4; 1.7.6;
move definition of linux_fsid_t to common/linux_types.h - it's identical
across all Linux archs
 1.6 19-Sep-2004  jdolecek move definition of struct linux_stafs to common/linux_types.h, and use
explicit size types - the structure definition is actually identical
on currently support COMPAT_LINUX archs, so no point to have 6 copies of it
in the tree
 1.5 17-Feb-2002  rafal branches: 1.5.16;
the MIPS stat64 struct doesn't have a separate ino64 field, but the ino field
is a u_longlong.
 1.4 06-Oct-2001  manu Added socket operations to Linux Mips emulation
 1.3 22-Sep-2001  manu Fixed errors in header files
 1.2 02-Sep-2001  manu branches: 1.2.2; 1.2.4; 1.2.6;
Added 64 bits support in header files.
All headers should be common to 32 bits MIPS and 64 bits MIPS now.
 1.1 26-Aug-2001  manu Preliminary work on Linux/Mips emul
 1.2.6.5 28-Feb-2002  nathanw Catch up to -current.
 1.2.6.4 22-Oct-2001  nathanw Catch up to -current.
 1.2.6.3 26-Sep-2001  nathanw Catch up to -current.
Again.
 1.2.6.2 21-Sep-2001  nathanw Catch up to -current.
 1.2.6.1 02-Sep-2001  nathanw file linux_types.h was added on branch nathanw_sa on 2001-09-21 22:35:17 +0000
 1.2.4.4 16-Mar-2002  jdolecek Catch up with -current.
 1.2.4.3 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.4.2 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.2.4.1 02-Sep-2001  thorpej file linux_types.h was added on branch kqueue on 2001-09-13 01:15:20 +0000
 1.2.2.2 11-Oct-2001  fvdl Catch up with -current. Fix some bogons in the sparc64 kbd/ms
attach code. cd18xx conversion provided by mrg.
 1.2.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.5.16.2 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.5.16.1 24-Sep-2004  skrll Sync with HEAD.
 1.7.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.7.4.1 29-Apr-2005  kent sync with -current
 1.9.74.2 04-May-2009  yamt sync with head.
 1.9.74.1 16-May-2008  yamt sync with head.
 1.9.72.1 18-May-2008  yamt sync with head.
 1.9.70.2 17-Jan-2009  mjf Sync with HEAD.
 1.9.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.10.14.2 11-Jan-2009  christos add linux_suseconds_t
 1.10.14.1 28-Apr-2008  christos file linux_types.h was added on branch christos-time_t on 2009-01-11 00:17:51 +0000
 1.10.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.4 11-Dec-2005  christos merge ktrace-lwp.
 1.3 01-Aug-2004  jdolecek sync the syscall lists with Linux kernel 2.6.7
 1.2 01-Nov-2002  jdolecek branches: 1.2.6;
add appropriate nsysent, and use linux_sys_nosys as sys_nosys
 1.1 30-Sep-1998  erh branches: 1.1.24;
Stubs for future development of linux compat architechtures.
 1.1.24.1 11-Nov-2002  nathanw Catch up to -current
 1.2.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.6.1 03-Aug-2004  skrll Sync with HEAD
 1.83 01-Oct-2024  riastradh sys/compat/linux/arch/*/syscalls.master: Nix trailing whitespace.

No functional change intended.
 1.82 28-Sep-2024  christos Linux GSoC-2024: renameat2, clone3, sync_file_range, syncfs (Shivraj Jamgade)
 1.81 01-Jul-2024  christos Add linux POSIX message queue support (Ricardo Branco)
 1.80 29-Jun-2024  christos branches: 1.80.2;
From gsoc 2024: Implement faccessat2 and getcpu (Shivraz)
 1.79 19-Aug-2023  christos Add inotify* syscalls GSoC 2023 (Theodore Preduta)
 1.78 18-Aug-2023  christos Add linux waitid(2) from GSoC 2023 (Theodore Preduta)
 1.77 29-Jul-2023  christos typo
 1.76 29-Jul-2023  christos Add/fix statx, readahead, close_range. From GSoC 2023 by Theodore Preduta
 1.75 28-Jul-2023  christos add epoll syscalls
 1.74 02-Dec-2021  ryo add prlimit64(2) syscall to COMPAT_LINUX and COMPAT_LINUX32
 1.73 24-Nov-2021  ryo add getrandom(2) syscall entry
 1.72 20-Sep-2021  thorpej Add preadv(2) and pwritev(2) system calls to COMPAT_LINUX and COMPAT_LINUX32.
 1.71 20-Sep-2021  thorpej Add the eventfd system calls to COMPAT_LINUX and COMPAT_LINUX32.
 1.70 19-Sep-2021  thorpej Add the timerfd syscalls to COMPAT_LINUX and COMPAT_LINUX32.
 1.69 19-Sep-2021  thorpej Add the POSIX timer syscalls (timer_create(), timer_settime(), timer_gettime(),
timer_getoverrun(), and timer_delete()) to COMPAT_LINUX and COMPAT_LINUX32.
 1.68 26-Apr-2020  thorpej branches: 1.68.2;
Add a NetBSD native futex implementation, mostly written by riastradh@.
Map the COMPAT_LINUX futex calls to the native ones.
 1.67 09-Nov-2019  jdolecek add dummy implementation of linux fallocate() which just returns EOPNOTSUPP;
this is needed so that glibc falls back to emulation and apps behaving
properly, since EOPNOTSUPP is a documented and expected return code, but
ENOSYS is not

right now there are no filesystems in NetBSD tree supporting the fallocate
VOP, so no point trying to map this to a native call

supposed to help with problem reported in
https://mail-index.netbsd.org/tech-kern/2019/11/03/msg025641.html
 1.66 09-Feb-2017  christos branches: 1.66.14;
revert listen
 1.65 09-Feb-2017  christos fix listen
 1.64 04-Feb-2017  christos fix broken entries that prevented compilation.
 1.63 03-Feb-2017  christos add missing unimpl and sendmmsg and recvmmsg
 1.62 02-Feb-2017  christos implement accept4
XXX: mips looks busted (the syscalls file has lots of NOARGS syscalls that
should be STD).
 1.61 02-Jan-2017  manu branches: 1.61.2;
Add pselect6 Linux system call.
This lets Matlab R2016A run on NetBSD/amd64
 1.60 24-Jul-2016  njoly Small cleanup. Adjust readlink/readlinkat signatures to reduce diffs with
native.
 1.59 27-Oct-2015  njoly branches: 1.59.2;
Fix wrong gid types from previous.
 1.58 25-Oct-2015  njoly Cleanup posix chown family syscalls to match native (alpha, mips and
powerpc).
 1.57 22-Nov-2014  njoly branches: 1.57.2;
Fix ppoll signature (int ->u_int)
 1.56 31-May-2014  njoly branches: 1.56.2;
Fix munmap(2) signature.
 1.55 29-May-2014  njoly For utimes(2), use compat_50_sys_utimes() instead of local version.
 1.54 20-May-2014  njoly Fix getgroups/setgroups signature.
 1.53 17-May-2014  njoly Fix fadvise64 syscalls to use 64bit offset types.
 1.52 06-May-2014  njoly Reduce diffs between archs; make mknod device argument unsigned.
 1.51 04-May-2014  njoly Fix pread/pwrite syscalls which need a 64bit offset argument.
 1.50 08-Apr-2014  njoly Adjust read/write/readv/writev signature to match native versions.
 1.49 08-Dec-2013  njoly branches: 1.49.2;
Sprinkle a few more linux_umode_t where appropriate.
Reduce diffs between archs.
 1.48 19-Nov-2013  chs add the *at() syscalls.
 1.47 07-Nov-2013  njoly Fix dup/dup2/dup3 argument types (u_int -> int).
 1.46 24-Sep-2013  njoly Add utimensat(2) for compat linux.
 1.45 08-Apr-2013  pooka branches: 1.45.4;
support utimes on non-alpha linux platforms
 1.44 19-Sep-2012  pooka emulate ppoll which is essentially our pollts
 1.43 18-Nov-2011  christos branches: 1.43.10;
add sigtimedwait
 1.42 09-Jul-2011  christos branches: 1.42.2;
the first argument of {g,s}etitimer() is int not u_int.
 1.41 30-May-2011  alnsn Add fadvise64 and fadvise64_64 syscalls to compat_linux and compat_linux32.
 1.40 15-Apr-2011  he Add dup3() and pipe2() for these archs as well.
 1.39 20-Feb-2011  matt Change some ints to longs (for LP64).
 1.38 07-Jul-2010  chs branches: 1.38.2; 1.38.4;
many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
- support new-style (NPTL) linux pthreads on all platforms.
clone() with CLONE_THREAD uses 1 process with many LWPs
instead of separate processes.
- move the contents of sys__lwp_setprivate() into a new
lwp_setprivate() and use that everywhere.
- update linux_release[] and linux32_release[] to "2.6.18".
- adjust placement of emul fork/exec/exit hooks as needed
and adjust other emul code to match.
- convert all struct emul definitions to use named initializers.
- change the pid allocator to allow multiple pids to refer to the same proc.
- remove a few fields from struct proc that are no longer needed.
- disable the non-functional "vdso" code in linux32/amd64,
glibc works fine without it.
- fix a race in the futex code where we could miss a wakeup after
a requeue operation.
- redo futex locking to be a little more efficient.
 1.37 24-Nov-2009  njoly branches: 1.37.2; 1.37.4;
Update personality(2) to match Linux definition where the argument is an
unsigned long.
 1.36 17-Jun-2009  njoly Add a new linux_msghdr structure, as its size differs on 64bit archs.
Do the needed conversions in sendmsg/recvmsg syscalls, and adjust
their definitions accordingly.
 1.35 08-Jun-2009  njoly Update rt_queueinfo(2) definition, and kill a corresponding comment.
 1.34 17-Jan-2009  njoly branches: 1.34.2;
Convert linux/linux32 wait(4) to use a compat50 rusage structure.
 1.33 15-Jan-2009  njoly Update some syscalls/arguments to use the new compat50 equivalents.
 1.32 13-Jan-2009  pooka Convert the syscalls.master to a format from which it is easier
to parse and generate the compat name and basename (e.g. __stat50
and stat). Use this to autogenerate __RENAME()'s to the rump_syscalls
header so that they can be called e.g. rump_sys_socket() instead
of rump_sys___socket30().
 1.31 19-Nov-2008  ad Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.30 12-Nov-2008  njoly Fix nanosleep(2) on 64-bit archs. Do not call native nanosleep
syscall, but rather a modified version the will take care of `struct
timespec' conversions.
 1.29 23-Apr-2008  ad branches: 1.29.2; 1.29.4; 1.29.8; 1.29.10; 1.29.12;
-SYCALL_MPSAFE
 1.28 04-Apr-2008  njoly branches: 1.28.2;
Cleanup. Kill linux_sys_msync and use sys___msync13 instead.
No functional changes expected.
 1.27 24-Dec-2007  njoly branches: 1.27.6;
Kill unneeded linux_sys_getpgid and use native sys_getpgid instead.
 1.26 21-Dec-2007  njoly - Fix setfsuid to return uid on success.
- Replace getfsuid, which never existed on Linux, by correct setfsgid
syscall.

ok by christos and dsl.
 1.25 20-Dec-2007  dsl Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.24 16-Nov-2007  njoly branches: 1.24.2; 1.24.6;
Cleanup. Remove a few linux syscalls definitions, now identical to
native ones (with stackgap and ALT_CHECK_xxx removal). No functional
changes expected.
 1.23 04-Mar-2007  christos branches: 1.23.14; 1.23.16; 1.23.20; 1.23.22;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.22 09-Feb-2007  ad branches: 1.22.2;
Merge newlock2 to head.
 1.21 10-Jun-2006  christos branches: 1.21.6;
linux getpriority is off-by-20 so use our own function.
From PR/33671: Nicolas Joly
 1.20 11-Dec-2005  christos branches: 1.20.4; 1.20.8; 1.20.14;
merge ktrace-lwp.
 1.19 16-May-2005  fvdl branches: 1.19.2;
Add clock_* POSIX functions.
 1.18 16-May-2005  fvdl Add *xattr functions (they all return EOPNOTSUPP).
 1.17 26-Feb-2005  perry nuke trailing whitespace
 1.16 20-Sep-2004  jdolecek branches: 1.16.4; 1.16.6;
implement support for Linux statfs64() syscall - 64bit variant of statfs()
 1.15 08-Sep-2004  jdolecek implement basic exit_group(2), which just terminates calling thread;
apparently not many apps use thread groups yet, at least not with default
SuSE 9.1 libraries, so this is enough for now
 1.14 01-Aug-2004  jdolecek sync the syscall lists with Linux kernel 2.6.7
 1.13 01-Aug-2004  jdolecek connect madvise(2) and mincore(2) - apparently the newer Linux libs
don't stub it anymore, so allow the application to take advantage
of them

the Linux calls appear to be compatible in the flag values and semantics,
so a wrapper is not necessary
 1.12 10-Aug-2003  jdolecek add Linux compat arg wrapper for ftruncate64(), and change linux compat
truncate64() wrapper to translate args structure
NetBSD truncate() and ftrucate() have hidden 'pad' argument, so we have
to do the argument translation

Problem found and patch supplied in PR kern/22360 by Ales Krenek

This is the last of syscalls with hidden 'pad' arg we didn't have
wrapper for; all the others (lseek, mmap, pwrite, pread) already had
wrapper before.
 1.11 23-Jun-2003  christos branches: 1.11.2;
PR/21937: Todd Vierling: Proper support for mmap2
 1.10 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.9 10-Apr-2002  christos branches: 1.9.4;
add getdents64
 1.8 22-Mar-2002  christos add mprotect, nuke mmap2
 1.7 17-Feb-2002  rafal Use linux_sys_{g,s}etrlimit() since there's a common implementation now; but
MIPS has no sys_ugetrlimit, so don't declare it (209 is UNIMPL in the OSS
Linux-mips tree)
 1.6 15-Feb-2002  christos proper comment.
 1.5 15-Feb-2002  christos - add a real linux_sys___sysctl because the mib numbers are different.
implement only the kernel version getting entries.
- make the signal conversion functions consistent; dest is arg 1.
- make linux_fakedev deal with block and char devices differently.
- add linux_sys_ugetrlimit, and flesh out the regular get/setrlimit so
that they work properly.
- add linux_mmap2 [untested].
- bump kernel to 2.4.18, and make the date be valentine's day :-)
- linux_sys_*stat64 family was totally busted. Fix it.

tested only on i386.

Status:
gdb, telnet, work
jdk-1.4.0 extractor works, jdk still coredumps.

christos
 1.4 20-Nov-2001  manu branches: 1.4.2;
Fixed the Linux signal trampoline and linux_sys_sigreturn(). Linux signal
delivery now seems fully functionnal.
 1.3 06-Oct-2001  manu Added socket operations to Linux Mips emulation
 1.2 30-Sep-2001  manu branches: 1.2.2;
Implements parts of sysmips() and fctnl64() emulation
 1.1 22-Sep-2001  manu branches: 1.1.2;
More work on Linux compat for Mips: system calls mapping.
 1.1.2.9 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.1.2.8 17-Apr-2002  nathanw Catch up to -current.
 1.1.2.7 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.1.2.6 28-Feb-2002  nathanw Catch up to -current.
 1.1.2.5 08-Jan-2002  nathanw Catch up to -current.
 1.1.2.4 22-Oct-2001  nathanw Catch up to -current.
 1.1.2.3 08-Oct-2001  nathanw Catch up to -current.
 1.1.2.2 26-Sep-2001  nathanw Catch up to -current.
Again.
 1.1.2.1 22-Sep-2001  nathanw file syscalls.master was added on branch nathanw_sa on 2001-09-26 19:54:47 +0000
 1.2.2.3 11-Oct-2001  fvdl Catch up with -current. Fix some bogons in the sparc64 kbd/ms
attach code. cd18xx conversion provided by mrg.
 1.2.2.2 01-Oct-2001  fvdl Catch up with -current.
 1.2.2.1 30-Sep-2001  fvdl file syscalls.master was added on branch thorpej-devvp on 2001-10-01 12:43:41 +0000
 1.4.2.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.4.2.3 16-Mar-2002  jdolecek Catch up with -current.
 1.4.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.4.2.1 20-Nov-2001  thorpej file syscalls.master was added on branch kqueue on 2002-01-10 19:51:35 +0000
 1.9.4.3 14-Jun-2004  jmc Pullup patch (requested by skrll in ticket #1708)

Bring netbsd-1-6 inline with -current sources after the mistakes in ticket #1686
 1.9.4.2 11-May-2004  tron Pull up revision 1.12 via patch (requested by wennmach in ticket #1686):
add Linux compat arg wrapper for ftruncate64(), and change linux compat
truncate64() wrapper to translate args structure
NetBSD truncate() and ftrucate() have hidden 'pad' argument, so we have
to do the argument translation
Problem found and patch supplied in PR kern/22360 by Ales Krenek
This is the last of syscalls with hidden 'pad' arg we didn't have
wrapper for; all the others (lseek, mmap, pwrite, pread) already had
wrapper before.
 1.9.4.1 22-Oct-2003  jmc Regen files (requested by tv in ticket #1427)

Proper support for mmap2
 1.11.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.11.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.11.2.4 24-Sep-2004  skrll Sync with HEAD.
 1.11.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.11.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.11.2.1 03-Aug-2004  skrll Sync with HEAD
 1.16.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.16.4.1 29-Apr-2005  kent sync with -current
 1.19.2.5 21-Jan-2008  yamt sync with head
 1.19.2.4 07-Dec-2007  yamt sync with head
 1.19.2.3 03-Sep-2007  yamt sync with head.
 1.19.2.2 26-Feb-2007  yamt sync with head.
 1.19.2.1 21-Jun-2006  yamt sync with head.
 1.20.14.1 19-Jun-2006  chap Sync with head.
 1.20.8.1 26-Jun-2006  yamt sync with head.
 1.20.4.1 09-Sep-2006  rpaulo sync with head
 1.21.6.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.22.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.23.22.2 27-Dec-2007  mjf Sync with HEAD.
 1.23.22.1 19-Nov-2007  mjf Sync with HEAD.
 1.23.20.1 18-Nov-2007  bouyer Sync with HEAD
 1.23.16.1 09-Jan-2008  matt sync with HEAD
 1.23.14.1 21-Nov-2007  joerg Sync with HEAD.
 1.24.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.24.2.1 26-Dec-2007  ad Sync with head.
 1.27.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.27.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.28.2.1 18-May-2008  yamt sync with head.
 1.29.12.1 20-Nov-2008  snj Pull up following revision(s) (requested by njoly in ticket #81):
sys/compat/linux/arch/mips/syscalls.master: revision 1.30
sys/compat/linux/arch/m68k/syscalls.master: revision 1.63
sys/compat/linux32/arch/amd64/syscalls.master: revision 1.39
sys/compat/linux/arch/alpha/syscalls.master: revision 1.63
sys/compat/linux/arch/powerpc/syscalls.master: revision 1.38
sys/compat/linux32/common/linux32_time.c: revision 1.22
sys/compat/linux/arch/amd64/syscalls.master: revision 1.25
sys/compat/linux/arch/i386/syscalls.master: revision 1.94
sys/compat/linux/arch/arm/syscalls.master: revision 1.36
sys/compat/linux/common/linux_time.c: revision 1.26
Fix nanosleep(2) on 64-bit archs. Do not call native nanosleep
syscall, but rather a modified version the will take care of `struct
timespec' conversions.
 1.29.10.1 19-Jan-2009  skrll Sync with HEAD.
 1.29.8.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.29.4.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.29.4.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.29.2.4 11-Aug-2010  yamt sync with head.
 1.29.2.3 11-Mar-2010  yamt sync with head
 1.29.2.2 20-Jun-2009  yamt sync with head
 1.29.2.1 04-May-2009  yamt sync with head.
 1.34.2.1 23-Jul-2009  jym Sync with HEAD.
 1.37.4.3 31-May-2011  rmind sync with head
 1.37.4.2 21-Apr-2011  rmind sync with head
 1.37.4.1 05-Mar-2011  rmind sync with head
 1.37.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.38.4.1 05-Mar-2011  bouyer Sync with HEAD
 1.38.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.42.2.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.42.2.2 30-Oct-2012  yamt sync with head
 1.42.2.1 17-Apr-2012  yamt sync with head
 1.43.10.4 03-Dec-2017  jdolecek update from HEAD
 1.43.10.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.43.10.2 23-Jun-2013  tls resync from head
 1.43.10.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.45.4.1 18-May-2014  rmind sync with head
 1.49.2.1 10-Aug-2014  tls Rebase.
 1.56.2.1 17-Apr-2017  snj Pull up following revision(s) (requested by manu in ticket #1354):
sys/compat/linux/arch/alpha/syscalls.master: revision 1.92 via patch
sys/compat/linux/arch/amd64/syscalls.master: revision 1.58 via patch
sys/compat/linux/arch/arm/syscalls.master: revision 1.65 via patch
sys/compat/linux/arch/i386/syscalls.master: revision 1.122 via patch
sys/compat/linux/arch/m68k/syscalls.master: revision 1.91 via patch
sys/compat/linux/arch/mips/syscalls.master: revision 1.61 via patch
sys/compat/linux/arch/powerpc/syscalls.master: revision 1.70 via patch
sys/compat/linux/common/linux_misc.c: revision 1.234
sys/compat/linux/common/linux_signal.h: revision 1.31
Add pselect6 Linux system call.
This lets Matlab R2016A run on NetBSD/amd64
 1.57.2.4 28-Aug-2017  skrll Sync with HEAD
 1.57.2.3 05-Feb-2017  skrll Sync with HEAD
 1.57.2.2 05-Oct-2016  skrll Sync with HEAD
 1.57.2.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.59.2.3 20-Mar-2017  pgoyette Sync with HEAD
 1.59.2.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.59.2.1 26-Jul-2016  pgoyette Sync with HEAD
 1.61.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.66.14.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.68.2.2 17-Dec-2020  thorpej Add suppport for Linux preadv(2) and pwritev(2). Same as native, except
for the silly way that the offset argument is passed in.
 1.68.2.1 15-Dec-2020  thorpej Add Linux eventfd, timerfd, and POSIX timer calls.
 1.80.2.1 02-Aug-2025  perseant Sync with HEAD
 1.4 29-May-2024  christos should not be using .include <> but .include "" here.
 1.3 08-Apr-2014  njoly Do not include bsd.kinc.mk in each arch Makefile, it's already pulled
by bsd.syscall.mk (from Makefile.inc).
 1.2 03-Oct-1998  christos branches: 1.2.184; 1.2.194; 1.2.200; 1.2.210;
Attempt to fix the mess.
 1.1 30-Sep-1998  erh Stubs for future development of linux compat architechtures.
 1.2.210.1 10-Aug-2014  tls Rebase.
 1.2.200.1 18-May-2014  rmind sync with head
 1.2.194.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.184.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.12 03-May-2020  thorpej Always clear FUTEX_PRIVATE_FLAG for Linux processes. NetBSD-native futexes
exist in different namespace depending on FUTEX_PRIVATE_FLAG. This appears
not to be the case in Linux, and some futex users will mix private and non-
private ops on the same futex object. Provide a convenience wrapper that
puts this logic in one place witn a comment explaining why.

While here, move the Linux futex wrapper out of its own file and plop
it in linux_misc.c, which is where it lives in the linux32 module.
 1.11 30-May-2011  alnsn Add fadvise64 and fadvise64_64 syscalls to compat_linux and compat_linux32.
 1.10 07-Jul-2010  chs branches: 1.10.2;
many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
- support new-style (NPTL) linux pthreads on all platforms.
clone() with CLONE_THREAD uses 1 process with many LWPs
instead of separate processes.
- move the contents of sys__lwp_setprivate() into a new
lwp_setprivate() and use that everywhere.
- update linux_release[] and linux32_release[] to "2.6.18".
- adjust placement of emul fork/exec/exit hooks as needed
and adjust other emul code to match.
- convert all struct emul definitions to use named initializers.
- change the pid allocator to allow multiple pids to refer to the same proc.
- remove a few fields from struct proc that are no longer needed.
- disable the non-functional "vdso" code in linux32/amd64,
glibc works fine without it.
- fix a race in the futex code where we could miss a wakeup after
a requeue operation.
- redo futex locking to be a little more efficient.
 1.9 02-Feb-2008  dsl branches: 1.9.10; 1.9.30; 1.9.32;
Extract the fcntl64() suppoort from linux_file64.c into linux_fcntl64.c
Unravel some of the knots that caused linux_file64.c to be compiled twice
for an amd64 kernel (once for linux and once for linux32) with different
parts being skipped each time.
 1.8 01-Sep-2006  matt branches: 1.8.28; 1.8.34;
When calling PTRACE from an LKM, use sysent[SYS_ptrace].sy_call in case
the sys_ptrace symbol isn't present.
 1.7 30-Aug-2006  matt Update to deal with options PTRACE
 1.6 11-Dec-2005  christos branches: 1.6.4; 1.6.8;
merge ktrace-lwp.
 1.5 25-Jul-2004  chs branches: 1.5.12;
remove the LINUX_SP_WRAP hack since it doesn't seem to be needed anymore,
and removing it lets us go back to mapping the stack non-executable again.
 1.4 19-May-2002  jdolecek branches: 1.4.8; 1.4.10;
add missing linux_file64.c, which is needed now
 1.3 31-Mar-2002  christos branches: 1.3.2;
bring the reverse signal mapping array into linux_signo.c
 1.2 03-Sep-2001  manu Fixed indent
 1.1 19-Jan-2001  manu branches: 1.1.2; 1.1.4; 1.1.6;
Added previously created files for powerpc Linux compatibility to the kernel
config system
 1.1.6.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.6.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.1.4.3 20-Jun-2002  nathanw Catch up to -current.
 1.1.4.2 17-Apr-2002  nathanw Catch up to -current.
 1.1.4.1 21-Sep-2001  nathanw Catch up to -current.
 1.1.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.1.2.1 19-Jan-2001  bouyer file files.linux_powerpc was added on branch thorpej_scsipi on 2001-02-11 19:13:49 +0000
 1.3.2.1 30-May-2002  gehenna Catch up with -current.
 1.4.10.1 26-Jul-2004  tron Pull up revision 1.5 (requested by chs in ticket #715):
remove the LINUX_SP_WRAP hack since it doesn't seem to be needed anymore,
and removing it lets us go back to mapping the stack non-executable again.
 1.4.8.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.8.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.8.1 03-Aug-2004  skrll Sync with HEAD
 1.5.12.2 04-Feb-2008  yamt sync with head.
 1.5.12.1 30-Dec-2006  yamt sync with head.
 1.6.8.1 03-Sep-2006  yamt sync with head.
 1.6.4.1 09-Sep-2006  rpaulo sync with head
 1.8.34.1 18-Feb-2008  mjf Sync with HEAD.
 1.8.28.1 23-Mar-2008  matt sync with HEAD
 1.9.32.2 31-May-2011  rmind sync with head
 1.9.32.1 05-Mar-2011  rmind sync with head
 1.9.30.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.9.10.1 11-Aug-2010  yamt sync with head.
 1.10.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.8 17-Dec-2013  njoly Cleanup compat linux errnos by adding generic errnos in a single file.
Use it for all arches except alpha and mips.
Add a few missing native to linux errno conversions.
 1.7 28-Apr-2008  martin branches: 1.7.34; 1.7.44; 1.7.50;
Remove clause 3 and 4 from TNF licenses
 1.6 11-Dec-2005  christos branches: 1.6.70; 1.6.72; 1.6.74;
merge ktrace-lwp.
 1.5 26-Feb-2005  perry nuke trailing whitespace
 1.4 12-Feb-2001  manu branches: 1.4.24; 1.4.32; 1.4.34;
Clarified comments about the LINUX_SCERR_SIGN macro
 1.3 11-Feb-2001  manu Moved the fix for negative errno returned to userland on the PowerPC to a
more machine independent fashion
 1.2 04-Feb-2001  christos branches: 1.2.2;
cosmetic fixes.
 1.1 19-Jan-2001  manu Added Linux errno mapping for powerpc
 1.2.2.3 12-Mar-2001  bouyer Sync with HEAD.
 1.2.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.2.2.1 04-Feb-2001  bouyer file linux_errno.h was added on branch thorpej_scsipi on 2001-02-11 19:13:49 +0000
 1.4.34.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.4.32.1 29-Apr-2005  kent sync with -current
 1.4.24.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.6.74.1 16-May-2008  yamt sync with head.
 1.6.72.1 18-May-2008  yamt sync with head.
 1.6.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.7.50.1 18-May-2014  rmind sync with head
 1.7.44.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.7.34.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.25 26-Nov-2021  ryo - LINUX_GO_RT0_SIGNATURE for compat_linux is no longer enabled by default.
it is now defined in each arch same as the other *_SIGNATURE definitions.
- add new LINUX32_GO_RT0_SIGNATURE for compat_linux32, and is defined in amd64 and aarch64.
 1.24 12-Feb-2017  chs es_arglen is now in units of bytes, update the emulations accordingly.
 1.23 09-Feb-2014  chs branches: 1.23.6; 1.23.10; 1.23.14;
account for the 16 bytes of AT_RANDOM data in the stack setup. fixes PR 48518.
use cprng_strong32() instead of random(). add AT_RANDOM support for linux32.
 1.22 25-Jan-2014  skrll More alignment spellos
 1.21 28-Apr-2008  martin branches: 1.21.34; 1.21.44; 1.21.50;
Remove clause 3 and 4 from TNF licenses
 1.20 11-Dec-2005  christos branches: 1.20.70; 1.20.72; 1.20.74;
merge ktrace-lwp.
 1.19 26-Feb-2005  perry nuke trailing whitespace
 1.18 25-Jul-2004  chs branches: 1.18.4; 1.18.6;
remove the LINUX_SP_WRAP hack since it doesn't seem to be needed anymore,
and removing it lets us go back to mapping the stack non-executable again.
 1.17 16-Jun-2004  manu COMPAT_LINUX/powerpc used the native stack setup routine, but now the
native version does non executable mappings on the stack. This is a
showstopper for Linux binaries.

To fix that we supply a copy f the native stack setup function for Linux
binaries, with the executable bit set.
 1.16 14-Aug-2003  christos branches: 1.16.2;
remove the args from the macro.
 1.15 08-Aug-2003  christos - GC all the setup_stack functions
- add one for linux/i386
 1.14 01-Mar-2003  thorpej branches: 1.14.2;
Do the syscall_plain/syscall_fancy dance on ARM. Shaves a fair number
of cycles off the syscall overhead.

Since all COMPAT_LINUX platforms now support __HAVE_SYSCALL_INTERN,
garbage-collect the LINUX_SYSCALL_FUNCTION stuff.
 1.13 13-Nov-2002  jdolecek add generic linux compat ELF copyargs function

this gives:
* linux sysconf(_SC_CLK_TCK) gives correct value for linux binaries (hz)
even if hz != 100
* glibc gets proper information on real/effective uid and enables
secure mode for suid binaries

g/c LINUX_COPYARGS_FUNCTION, replaced by linux ELF copyargs function
g/c alpha-specific linux ELF copyargs function and linux ELF defines
 1.12 13-Nov-2002  jdolecek need to use Aux32Info explicitly, not AuxInfo alone, to work
within context of kern/exec_conf.c
 1.11 13-Nov-2002  jdolecek eliminate remaining LinuxAuxInfo
 1.10 13-Nov-2002  jdolecek need to use LINUX_ELF_AUX_ENTRIES in LINUX_ELF_AUX_ARGSIZ
how this ever could have worked?
 1.9 13-Nov-2002  jdolecek use generic ELF AuxInfo, no need to define a 'linux' variant here
simplify LINUX_ELF_AUX_ARGSIZ definition, LINUX_SP_WRAP is always defined here
 1.8 26-Aug-2002  christos Implement passing AT_{E,R}{U,G}ID in the elf aux vector, like solaris.
- pass struct proc to copyargs.
- eliminate svr4_copyargs, since it is the same as ours now.
 1.7 12-Aug-2002  mrg don't need systm.h here
 1.6 17-Jan-2002  bjh21 branches: 1.6.8;
On platforms that don't __HAVE_SYSCALL_INTERN, define LINUX_SYSCALL_FUNCTION
to be the value of emul_linux.e_syscall that we want. This allows it to differ
between machines, so I can have a separate linux_syscall() on arm.
 1.5 30-Aug-2001  manu Enable the GCC signature test so that ld.so will be executable (needed for
Linux's ldd)
 1.4 29-Jul-2001  christos Adjust to the new copyargs() footprint.
 1.3 26-Jul-2001  wiz auxilliary -> auxiliary
 1.2 04-Feb-2001  christos branches: 1.2.2; 1.2.4; 1.2.6;
cosmetic fixes.
 1.1 19-Jan-2001  manu Added various header files for initial Linux compatibility on powerpc ports
 1.2.6.4 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.2.6.3 11-Feb-2002  jdolecek Sync w/ -current.
 1.2.6.2 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.2.6.1 03-Aug-2001  lukem update to -current
 1.2.4.6 11-Dec-2002  thorpej Sync with HEAD.
 1.2.4.5 27-Aug-2002  nathanw Catch up to -current.
 1.2.4.4 13-Aug-2002  nathanw Catch up to -current.
 1.2.4.3 28-Feb-2002  nathanw Catch up to -current.
 1.2.4.2 21-Sep-2001  nathanw Catch up to -current.
 1.2.4.1 24-Aug-2001  nathanw Catch up with -current.
 1.2.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.2.2.1 04-Feb-2001  bouyer file linux_exec.h was added on branch thorpej_scsipi on 2001-02-11 19:13:50 +0000
 1.6.8.1 29-Aug-2002  gehenna catch up with -current.
 1.14.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.14.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.14.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.14.2.1 03-Aug-2004  skrll Sync with HEAD
 1.16.2.2 26-Jul-2004  tron Pull up revision 1.18 (requested by chs in ticket #715):
remove the LINUX_SP_WRAP hack since it doesn't seem to be needed anymore,
and removing it lets us go back to mapping the stack non-executable again.
 1.16.2.1 19-Jun-2004  grant Pull up revision 1.17 (requested by manu in ticket #511):

COMPAT_LINUX/powerpc fixes for non-executable stack.
 1.18.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.18.4.1 29-Apr-2005  kent sync with -current
 1.20.74.1 16-May-2008  yamt sync with head.
 1.20.72.1 18-May-2008  yamt sync with head.
 1.20.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.21.50.1 18-May-2014  rmind sync with head
 1.21.44.2 03-Dec-2017  jdolecek update from HEAD
 1.21.44.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.21.34.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.23.14.1 21-Apr-2017  bouyer Sync with HEAD
 1.23.10.1 20-Mar-2017  pgoyette Sync with HEAD
 1.23.6.1 28-Aug-2017  skrll Sync with HEAD
 1.25 07-Sep-2021  riastradh sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.24 21-Feb-2012  rjs branches: 1.24.32; 1.24.44;
Switch to ANSI style declaration.
 1.23 03-Feb-2012  matt branches: 1.23.2;
Add a hook for freeing an ep_emul_arg. Add a wrapper routine
(exec_free_emul_arg) to call the hook and then clear the ep_emul_arg
and ep_emul_arg_free members in the exec_package.
Change users/accessors to use these routines.
Approved by releng.
 1.22 07-Jul-2010  chs branches: 1.22.8; 1.22.12;
many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
- support new-style (NPTL) linux pthreads on all platforms.
clone() with CLONE_THREAD uses 1 process with many LWPs
instead of separate processes.
- move the contents of sys__lwp_setprivate() into a new
lwp_setprivate() and use that everywhere.
- update linux_release[] and linux32_release[] to "2.6.18".
- adjust placement of emul fork/exec/exit hooks as needed
and adjust other emul code to match.
- convert all struct emul definitions to use named initializers.
- change the pid allocator to allow multiple pids to refer to the same proc.
- remove a few fields from struct proc that are no longer needed.
- disable the non-functional "vdso" code in linux32/amd64,
glibc works fine without it.
- fix a race in the futex code where we could miss a wakeup after
a requeue operation.
- redo futex locking to be a little more efficient.
 1.21 28-Apr-2008  martin branches: 1.21.20; 1.21.22;
Remove clause 3 and 4 from TNF licenses
 1.20 23-Jul-2006  ad branches: 1.20.54; 1.20.56; 1.20.58;
Use the LWP cached credentials where sane.
 1.19 15-May-2006  yamt include kauth.h for kauth_cred_getegid, etc.
 1.18 14-May-2006  elad integrate kauth.
 1.17 11-Dec-2005  christos branches: 1.17.4; 1.17.6; 1.17.8; 1.17.10; 1.17.12;
merge ktrace-lwp.
 1.16 26-Feb-2005  perry branches: 1.16.4;
nuke trailing whitespace
 1.15 25-Jul-2004  chs branches: 1.15.4; 1.15.6;
remove the LINUX_SP_WRAP hack since it doesn't seem to be needed anymore,
and removing it lets us go back to mapping the stack non-executable again.
 1.14 18-Jun-2004  manu include <sys/resourcevar.h>. It is not required for building -current,
but it is for -netbsd-2-0. Next step is to pull up the change...
 1.13 16-Jun-2004  manu COMPAT_LINUX/powerpc used the native stack setup routine, but now the
native version does non executable mappings on the stack. This is a
showstopper for Linux binaries.

To fix that we supply a copy f the native stack setup function for Linux
binaries, with the executable bit set.
 1.12 29-Jun-2003  fvdl branches: 1.12.2; 1.12.4;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.11 29-Jun-2003  darrenr 'struct proc *' -> 'struct lwp *' as required to get GENERIC for macppc built
 1.10 01-Apr-2003  thorpej Use PAGE_SIZE rather than NBPG.
 1.9 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.8 13-Nov-2002  jdolecek branches: 1.8.2;
use generic ELF AuxInfo, no need to define a 'linux' variant here
simplify LINUX_ELF_AUX_ARGSIZ definition, LINUX_SP_WRAP is always defined here
 1.7 26-Aug-2002  christos Implement passing AT_{E,R}{U,G}ID in the elf aux vector, like solaris.
- pass struct proc to copyargs.
- eliminate svr4_copyargs, since it is the same as ours now.
 1.6 13-Nov-2001  lukem branches: 1.6.8; 1.6.10;
add RCSIDs (including regeneration of files as appropriate)
 1.5 08-Aug-2001  christos PR/13652: Katsuomi Hamajima: Fix compile error.
 1.4 29-Jul-2001  christos Adjust to the new copyargs() footprint.
 1.3 13-Jun-2001  wiz branches: 1.3.2;
It's "extern int", not "extern".
Macppc kernels with LINUX_COMPAT now compile again.
 1.2 04-Feb-2001  christos branches: 1.2.2; 1.2.4;
cosmetic fixes.
 1.1 19-Jan-2001  manu Added powerpc specific code for Linux compatibility on powerpc ports
 1.2.4.7 11-Dec-2002  thorpej Sync with HEAD.
 1.2.4.6 27-Aug-2002  nathanw Catch up to -current.
 1.2.4.5 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.2.4.4 24-Jun-2002  nathanw LWPify changes.
 1.2.4.3 14-Nov-2001  nathanw Catch up to -current.
 1.2.4.2 24-Aug-2001  nathanw Catch up with -current.
 1.2.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.2.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.2.2.1 04-Feb-2001  bouyer file linux_exec_powerpc.c was added on branch thorpej_scsipi on 2001-02-11 19:13:50 +0000
 1.3.2.4 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.3.2.3 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.3.2.2 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.3.2.1 03-Aug-2001  lukem update to -current
 1.6.10.2 18-Jun-2004  jmc Back out last commit. Only releng commits to the branches w/o prior approval
 1.6.10.1 18-Jun-2004  manu Include resourcevar.h, which is not required for building -current but
is for the 2.0 branch. Next step is a pull-up...
 1.6.8.1 29-Aug-2002  gehenna catch up with -current.
 1.8.2.1 18-Dec-2002  gmcgarry Merge pcred and ucred, and poolify. TBD: check backward compatibility
and factor-out some higher-level functionality.
 1.12.4.3 26-Jul-2004  tron Pull up revision 1.15 (requested by chs in ticket #715):
remove the LINUX_SP_WRAP hack since it doesn't seem to be needed anymore,
and removing it lets us go back to mapping the stack non-executable again.
 1.12.4.2 19-Jun-2004  grant Pull up revision 1.14 (requested by manu in ticket #511):

include <sys/resourcevar.h> for the netbsd-2-0 branch.
 1.12.4.1 19-Jun-2004  grant Pull up revision 1.13 (requested by manu in ticket #511):

COMPAT_LINUX/powerpc fixes for non-executable stack.
 1.12.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.12.2.4 18-Nov-2004  skrll Adapt to branch. macppc release builds.
 1.12.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.12.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.12.2.1 03-Aug-2004  skrll Sync with HEAD
 1.15.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.15.4.1 29-Apr-2005  kent sync with -current
 1.16.4.2 30-Dec-2006  yamt sync with head.
 1.16.4.1 21-Jun-2006  yamt sync with head.
 1.17.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.17.10.1 08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.17.8.2 11-Aug-2006  yamt sync with head
 1.17.8.1 24-May-2006  yamt sync with head.
 1.17.6.1 01-Jun-2006  kardel Sync with head.
 1.17.4.1 09-Sep-2006  rpaulo sync with head
 1.20.58.2 11-Aug-2010  yamt sync with head.
 1.20.58.1 16-May-2008  yamt sync with head.
 1.20.56.1 18-May-2008  yamt sync with head.
 1.20.54.1 02-Jun-2008  mjf Sync with HEAD.
 1.21.22.1 05-Mar-2011  rmind sync with head
 1.21.20.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.22.12.2 24-Feb-2012  mrg sync to -current.
 1.22.12.1 18-Feb-2012  mrg merge to -current.
 1.22.8.1 17-Apr-2012  yamt sync with head
 1.23.2.1 24-Feb-2012  riz Pull up following revision(s) (requested by rjs in ticket #46):
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.24
Switch to ANSI style declaration.
 1.24.44.1 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.24.32.1 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1836):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.10 25-Jun-2014  njoly Add a few missing open(2) flags (LINUX_O_*). Fix alpha wrong values.
 1.9 02-Nov-2010  chs branches: 1.9.18; 1.9.32;
define LINUX_O_CLOEXEC.
sort definitions by value.
consistently use hex instead of octal for the values.
 1.8 21-Sep-2010  chs implement O_DIRECTORY as standardized in POSIX-2008,
for both native and linux emulations.
this fixes the rest of PR 43695.
 1.7 28-Apr-2008  martin branches: 1.7.20; 1.7.22;
Remove clause 3 and 4 from TNF licenses
 1.6 11-Dec-2005  christos branches: 1.6.70; 1.6.72; 1.6.74;
merge ktrace-lwp.
 1.5 26-Feb-2005  perry nuke trailing whitespace
 1.4 30-Sep-2001  manu branches: 1.4.18; 1.4.26; 1.4.28;
Added initial support for fcntl64 system call (file locking is not
implemented)
 1.3 04-Feb-2001  christos branches: 1.3.2; 1.3.4; 1.3.6; 1.3.8;
cosmetic fixes.
 1.2 21-Jan-2001  manu Fixed wrong open() Linux flags definition (octal instead of hexadecimal)
 1.1 19-Jan-2001  manu Added various header files for initial Linux compatibility on powerpc ports
 1.3.8.1 01-Oct-2001  fvdl Catch up with -current.
 1.3.6.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.3.4.1 08-Oct-2001  nathanw Catch up to -current.
 1.3.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.3.2.1 04-Feb-2001  bouyer file linux_fcntl.h was added on branch thorpej_scsipi on 2001-02-11 19:13:50 +0000
 1.4.28.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.4.26.1 29-Apr-2005  kent sync with -current
 1.4.18.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.6.74.2 09-Oct-2010  yamt sync with head
 1.6.74.1 16-May-2008  yamt sync with head.
 1.6.72.1 18-May-2008  yamt sync with head.
 1.6.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.7.22.1 05-Mar-2011  rmind sync with head
 1.7.20.2 06-Nov-2010  uebayasi Sync with HEAD.
 1.7.20.1 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.9.32.1 10-Aug-2014  tls Rebase.
 1.9.18.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.3 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.2 08-Jun-2001  hannken branches: 1.2.120; 1.2.122; 1.2.124;
Close coment of CVS tag.
 1.1 19-Jan-2001  manu branches: 1.1.2; 1.1.4;
Added various header files for initial Linux compatibility on powerpc ports
 1.1.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.1.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.1.2.1 19-Jan-2001  bouyer file linux_ioctl.h was added on branch thorpej_scsipi on 2001-02-11 19:13:51 +0000
 1.2.124.1 16-May-2008  yamt sync with head.
 1.2.122.1 18-May-2008  yamt sync with head.
 1.2.120.1 02-Jun-2008  mjf Sync with HEAD.
 1.51 07-Sep-2021  riastradh sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.50 03-May-2017  chs branches: 1.50.2; 1.50.14;
add missing arg to fpu_discard().
 1.49 16-Mar-2017  chs branches: 1.49.4;
allow pcu_save() and pcu_discard() to be called on other threads,
ptrace needs to use it that way.
 1.48 09-Nov-2014  maxv branches: 1.48.2; 1.48.4; 1.48.6;
Do not uselessly include <sys/malloc.h>.
 1.47 27-Jan-2013  mbalmer branches: 1.47.12;
exitting -> exiting.
 1.46 05-May-2011  matt branches: 1.46.4; 1.46.14;
Adapt to new PCU based FPU code.
 1.45 20-Jan-2011  he save_fpu_lwp() was renamed to fpu_save_lwp(), so follow suit.
 1.44 18-Jan-2011  matt branches: 1.44.2;
Deal with changes in the trapframe.
 1.43 14-Jan-2011  rmind branches: 1.43.2;
Retire struct user, remove sys/user.h inclusions. Note sys/user.h header
as obsolete. Remove USER_TO_UAREA/UAREA_TO_USER macros.

Various #include fixes and review by matt@.
 1.42 07-Jul-2010  chs many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
- support new-style (NPTL) linux pthreads on all platforms.
clone() with CLONE_THREAD uses 1 process with many LWPs
instead of separate processes.
- move the contents of sys__lwp_setprivate() into a new
lwp_setprivate() and use that everywhere.
- update linux_release[] and linux32_release[] to "2.6.18".
- adjust placement of emul fork/exec/exit hooks as needed
and adjust other emul code to match.
- convert all struct emul definitions to use named initializers.
- change the pid allocator to allow multiple pids to refer to the same proc.
- remove a few fields from struct proc that are no longer needed.
- disable the non-functional "vdso" code in linux32/amd64,
glibc works fine without it.
- fix a race in the futex code where we could miss a wakeup after
a requeue operation.
- redo futex locking to be a little more efficient.
 1.41 02-Feb-2010  wiz branches: 1.41.2; 1.41.4;
Missing printf in sys/compat/linux/arch/powerpc/linux_machdep.c
found by cppcheck and reported by Henning Petersen in PR 42720.
 1.40 23-Nov-2009  rmind Use lwp_getpcb() in compat code, clean from struct user.
 1.39 28-Apr-2008  martin branches: 1.39.2; 1.39.22;
Remove clause 3 and 4 from TNF licenses
 1.38 24-Apr-2008  ad branches: 1.38.2;
Merge proc::p_mutex and proc::p_smutex into a single adaptive mutex, since
we no longer need to guard against access from hardware interrupt handlers.

Additionally, if cloning a process with CLONE_SIGHAND, arrange to have the
child process share the parent's lock so that signal state may be kept in
sync. Partially addresses PR kern/37437.
 1.37 20-Dec-2007  dsl branches: 1.37.6; 1.37.8;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.36 08-Dec-2007  dsl branches: 1.36.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.35 19-Oct-2007  ad branches: 1.35.4;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.34 05-Mar-2007  tsutsui branches: 1.34.2; 1.34.14; 1.34.16; 1.34.20;
Use (char *) cast on pointer arith.
 1.33 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.32 09-Feb-2007  ad branches: 1.32.2;
Merge newlock2 to head.
 1.31 11-Dec-2005  christos branches: 1.31.20;
merge ktrace-lwp.
 1.30 20-May-2005  fvdl branches: 1.30.2;
Define linux_usertrap function, and set it in struct emul. For all
but amd64, it just returns 0, doing nothing.

For amd64, it implements vsyscalls through cheating: if the faulting
address is in the vsyscall area (which is statically known on Linux/amd64),
and the intruction pointer is too, it must have been a vsyscall. In that
case, retrieve the return address from the user stack, fix up %rip and
%rsp, and just execute the normal system call. It will return as if
the vsyscall has been executed.
 1.29 26-Feb-2005  perry nuke trailing whitespace
 1.28 17-Apr-2004  matt branches: 1.28.4; 1.28.6;
Switch to using PSL_USEROK_P()
Use new save_fpu_lwp sematics to save or discard the fpu state appropriately.
 1.27 26-Mar-2004  drochner all ports define __HAVE_SIGINFO now, so remove the CPP conditionals
 1.26 08-Oct-2003  thorpej Use ksi_signo accessor macro.
 1.25 26-Sep-2003  simonb Fix "constify sendsig/trapsignal" fallout for non-siginfo'd archs. Test
compiled on most architectures.
 1.24 25-Sep-2003  christos constify sendsig/trapsignal
 1.23 25-Sep-2003  matt Add siginfo support for PowerPC.
 1.22 29-Jun-2003  fvdl branches: 1.22.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.21 29-Jun-2003  darrenr 'struct proc *' -> 'struct lwp *' as required to get GENERIC for macppc built
 1.20 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.19 25-Sep-2002  thorpej Don't include <sys/map.h>.
 1.18 28-Jul-2002  chs restructure the FPU and AltiVEC code so that it works for MP.
 1.17 09-Jul-2002  matt Change fpuproc to curcpu()->ci_fpuproc.
 1.16 04-Jul-2002  thorpej Add kernel support for having userland provide the signal trampoline:

* struct sigacts gets a new sigact_sigdesc structure, which has the
sigaction and the trampoline/version. Version 0 means "legacy kernel
provided trampoline". Other versions are coordinated with machine-
dependent code in libc.
* sigaction1() grows two more arguments -- the trampoline pointer and
the trampoline version.
* A new __sigaction_sigtramp() system call is provided to register a
trampoline along with a signal handler.
* The handler is no longer passed to sensig() functions. Instead,
sendsig() looks up the handler by peeking in the sigacts for the
process getting the signal (since it has to look in there for the
trampoline anyway).
* Native sendsig() functions now select the appropriate trampoline and
its arguments based on the trampoline version in the sigacts.

Changes to libc to use the new facility will be checked in later. Kernel
version not bumped; we will ride the 1.6C bump made recently.
 1.15 20-May-2002  jdolecek whitespace fixes
 1.14 31-Mar-2002  christos branches: 1.14.2;
make signal array handling uniform, and put signal arrays in a separate
file. This is simular to errno array handling.
 1.13 15-Feb-2002  christos - add a real linux_sys___sysctl because the mib numbers are different.
implement only the kernel version getting entries.
- make the signal conversion functions consistent; dest is arg 1.
- make linux_fakedev deal with block and char devices differently.
- add linux_sys_ugetrlimit, and flesh out the regular get/setrlimit so
that they work properly.
- add linux_mmap2 [untested].
- bump kernel to 2.4.18, and make the date be valentine's day :-)
- linux_sys_*stat64 family was totally busted. Fix it.

tested only on i386.

Status:
gdb, telnet, work
jdk-1.4.0 extractor works, jdk still coredumps.

christos
 1.12 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.11 13-Jun-2001  wiz branches: 1.11.2;
#include <machine/fpu.h> for save_fpu()
#ifdef 0 two unused and un-prototyped functions.
Following a hint by Andrw Cagney on port-macppc.
 1.10 30-May-2001  mrg use _KERNEL_OPT.
 1.9 27-May-2001  manu Fixed two typo in comments
 1.8 11-Apr-2001  manu Integrated security review for signal delivery by Wolfgang Solfrank
 1.7 22-Mar-2001  manu Added a missing native to linux signal number translation in linux_sendsig(),
when building the trap frape
 1.6 18-Mar-2001  manu Fixed typos in comments
 1.5 05-Feb-2001  manu branches: 1.5.2; 1.5.4;
Modified a cast so that it builds again
 1.4 04-Feb-2001  christos cosmetic fixes.
 1.3 26-Jan-2001  manu Moved include <sys/ioctl.h> so that we can build without WSCONS enabled.
 1.2 25-Jan-2001  manu Fixed wrong signal handler argument setup. The emulated sigcontext still has some problems.
 1.1 19-Jan-2001  manu Added powerpc specific code for Linux compatibility on powerpc ports
 1.5.4.11 18-Oct-2002  nathanw Catch up to -current.
 1.5.4.10 02-Aug-2002  nathanw LWPify.
 1.5.4.9 01-Aug-2002  nathanw Catch up to -current.
 1.5.4.8 24-Jun-2002  nathanw LWPify changes.
 1.5.4.7 20-Jun-2002  nathanw Catch up to -current.
 1.5.4.6 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.5.4.5 17-Apr-2002  nathanw Catch up to -current.
 1.5.4.4 28-Feb-2002  nathanw Catch up to -current.
 1.5.4.3 14-Nov-2001  nathanw Catch up to -current.
 1.5.4.2 21-Jun-2001  nathanw Catch up to -current.
 1.5.4.1 09-Apr-2001  nathanw Catch up with -current.
 1.5.2.4 21-Apr-2001  bouyer Sync with HEAD
 1.5.2.3 27-Mar-2001  bouyer Sync with HEAD.
 1.5.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.5.2.1 05-Feb-2001  bouyer file linux_machdep.c was added on branch thorpej_scsipi on 2001-02-11 19:13:51 +0000
 1.11.2.5 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.11.2.4 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.11.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.11.2.2 16-Mar-2002  jdolecek Catch up with -current.
 1.11.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.14.2.3 29-Aug-2002  gehenna catch up with -current.
 1.14.2.2 15-Jul-2002  gehenna catch up with -current.
 1.14.2.1 30-May-2002  gehenna Catch up with -current.
 1.22.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.22.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.22.2.4 18-Nov-2004  skrll Adapt to branch. macppc release builds.
 1.22.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.22.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.22.2.1 03-Aug-2004  skrll Sync with HEAD
 1.28.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.28.4.1 29-Apr-2005  kent sync with -current
 1.30.2.5 21-Jan-2008  yamt sync with head
 1.30.2.4 27-Oct-2007  yamt sync with head.
 1.30.2.3 03-Sep-2007  yamt sync with head.
 1.30.2.2 26-Feb-2007  yamt sync with head.
 1.30.2.1 21-Jun-2006  yamt sync with head.
 1.31.20.3 06-Feb-2007  ad More compat changes.

XXX compat_irix, compat_mach and compat_darwin need work.
 1.31.20.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.31.20.1 27-Jan-2007  ad More compat changes.
 1.32.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.34.20.1 25-Oct-2007  bouyer Sync with HEAD.
 1.34.16.2 09-Jan-2008  matt sync with HEAD
 1.34.16.1 06-Nov-2007  matt sync with HEAD
 1.34.14.2 09-Dec-2007  jmcneill Sync with HEAD.
 1.34.14.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.34.2.1 23-Oct-2007  ad Sync with head.
 1.35.4.1 26-Dec-2007  ad Sync with head.
 1.36.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.37.8.1 18-May-2008  yamt sync with head.
 1.37.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.38.2.3 11-Aug-2010  yamt sync with head.
 1.38.2.2 11-Mar-2010  yamt sync with head
 1.38.2.1 16-May-2008  yamt sync with head.
 1.39.22.1 07-Jan-2011  matt Deal with the trapframe changes.
 1.39.2.3 14-May-2008  wrstuden Per discussion with ad at n dot o, revert signal mask handling
changes.

The l_sigstk changes are most likely totally un-needed as SA will
never use a signal stack - we send an upcall (or will as other
diffs are brought in).

The l_sigmask changes were too controvertial. In all honesty, I
think it's probably best to revert them. The main reason they were
there is the fact that in an SA process, we don't mask signals per
kernel thread, we mask them per user thread. In the kernel, we want
them all to get turned into upcalls. Thus the normal state of
l_sigmask in an SA process is for it to always be empty.

While we are in the process of delivering a signal, we want to
temporarily mask a signal (so we don't recursively exhaust our
upcall stacks). However signal delivery is rare (important, but
rare), and delivering back-to-back signals is even rarer. So rather
than cause every user of a signal mask to be prepared for this very
rare case, we will just add a second check later in the signal
delivery code. Said change is not in this diff.

This also un-compensates all of our compatability code for dealing
with SA. SA is a NetBSD-specific thing, so there's no need for
Irix, Linux, Solaris, SVR4 and so on to cope with it.

As previously, everything other than kern_sa.c compiles in i386
GENERIC as of this checkin. I will switch to ALL soon for compile
testing.
 1.39.2.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.39.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.41.4.2 31-May-2011  rmind sync with head
 1.41.4.1 05-Mar-2011  rmind sync with head
 1.41.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.43.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.44.2.1 08-Feb-2011  bouyer Sync with HEAD
 1.46.14.2 03-Dec-2017  jdolecek update from HEAD
 1.46.14.1 25-Feb-2013  tls resync with head
 1.46.4.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.47.12.1 17-Jan-2015  martin Pull up following revision(s) (requested by maxv in ticket #427):
sys/compat/svr4/svr4_schedctl.c: revision 1.8
sys/netinet/tcp_timer.c: revision 1.88
sys/miscfs/genfs/layer_vfsops.c: revision 1.45
sys/compat/svr4/svr4_ioctl.c: revision 1.37
sys/ufs/chfs/chfs_vfsops.c: revision 1.14
sys/miscfs/fdesc/fdesc_vfsops.c: revision 1.91
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.30
sys/compat/common/kern_time_50.c: revision 1.28
sys/netinet6/ip6_forward.c: revision 1.74
sys/miscfs/umapfs/umap_vnops.c: revision 1.57
sys/compat/svr4/svr4_fcntl.c: revision 1.74
distrib/sets/lists/comp/mi: revision 1.1931
sys/netinet6/udp6_output.c: revision 1.46
sys/fs/puffs/puffs_compat.c: revision 1.3
sys/fs/udf/udf_rename.c: revision 1.11
sys/compat/svr4/svr4_filio.c: revision 1.24
sys/fs/udf/udf_rename.c: revision 1.12
sys/netinet/tcp_usrreq.c: revision 1.202
sys/miscfs/umapfs/umap_subr.c: revision 1.29
sys/compat/linux/common/linux_fadvise64.c: revision 1.3
sys/netinet/if_atm.c: revision 1.34
sys/miscfs/procfs/procfs_subr.c: revision 1.106
sys/miscfs/genfs/layer_subr.c: revision 1.37
sys/netinet/tcp_sack.c: revision 1.30
sys/compat/freebsd/freebsd_misc.c: revision 1.33
sys/compat/freebsd/freebsd_file.c: revision 1.33
sys/ufs/chfs/chfs_vnode.c: revision 1.12
sys/compat/svr4/svr4_ttold.c: revision 1.34
sys/compat/linux/common/linux_file.c: revision 1.114
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.43
sys/compat/linux/common/linux_signal.c: revision 1.76
sys/compat/common/compat_util.c: revision 1.46
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.18
sys/compat/svr4/svr4_sockio.c: revision 1.36
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.32
sys/compat/svr4/svr4_signal.c: revision 1.66
sys/kern/kern_exec.c: revision 1.410
sys/fs/puffs/puffs_vfsops.c: revision 1.115
sys/compat/svr4/svr4_exec_elf64.c: revision 1.15
sys/compat/linux/arch/i386/linux_machdep.c: revision 1.159
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.50
sys/compat/linux32/common/linux32_misc.c: revision 1.24
sys/netinet/in_pcb.c: revision 1.153
sys/sys/malloc.h: revision 1.116
sys/compat/common/if_43.c: revision 1.9
share/man/man9/Makefile: revision 1.380
sys/netinet/tcp_vtw.c: revision 1.12
sys/miscfs/umapfs/umap_vfsops.c: revision 1.95
sys/ufs/ext2fs/ext2fs_vfsops.c: revision 1.186
sys/compat/common/uipc_syscalls_43.c: revision 1.46
sys/ufs/ext2fs/ext2fs_vnops.c: revision 1.115
sys/fs/puffs/puffs_msgif.c: revision 1.97
sys/compat/svr4/svr4_ipc.c: revision 1.27
sys/compat/linux/common/linux_exec.c: revision 1.117
sys/ufs/ext2fs/ext2fs_readwrite.c: revision 1.66
sys/netinet/tcp_output.c: revision 1.179
sys/compat/svr4/svr4_termios.c: revision 1.28
sys/fs/udf/udf_strat_bootstrap.c: revision 1.4
sys/fs/puffs/puffs_subr.c: revision 1.67
sys/fs/puffs/puffs_node.c: revision 1.36
sys/miscfs/overlay/overlay_vnops.c: revision 1.21
sys/fs/cd9660/cd9660_node.c: revision 1.34
sys/netinet/raw_ip.c: revision 1.146
sys/sys/mallocvar.h: revision 1.13
sys/miscfs/overlay/overlay_vfsops.c: revision 1.63
share/man/man9/malloc.9: revision 1.50
sys/netinet6/dest6.c: revision 1.18
sys/compat/linux/common/linux_uselib.c: revision 1.33
sys/compat/linux/common/linux_socket.c: revision 1.120
share/man/man9/malloc.9: revision 1.51
sys/netinet/tcp_subr.c: revision 1.257
sys/compat/linux/common/linux_socketcall.c: revision 1.45
sys/compat/linux/common/linux_fadvise64_64.c: revision 1.3
sys/compat/freebsd/freebsd_ipc.c: revision 1.17
sys/compat/linux/common/linux_misc_notalpha.c: revision 1.109
sys/compat/linux/arch/alpha/linux_pipe.c: revision 1.17
sys/netinet6/in6_pcb.c: revision 1.132
sys/netinet6/in6_ifattach.c: revision 1.94
sys/compat/svr4/svr4_exec_elf32.c: revision 1.15
sys/miscfs/nullfs/null_vfsops.c: revision 1.90
sys/fs/cd9660/cd9660_util.c: revision 1.12
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.48
sys/compat/freebsd/freebsd_exec_elf32.c: revision 1.20
sys/miscfs/procfs/procfs_vfsops.c: revision 1.94
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.28
sys/compat/linux/common/linux_sched.c: revision 1.67
sys/compat/linux/common/linux_exec_aout.c: revision 1.67
sys/compat/linux/common/linux_pipe.c: revision 1.67
sys/compat/linux/common/linux_llseek.c: revision 1.34
sys/compat/linux/arch/mips/linux_ptrace.c: revision 1.10
Do not uselessly include <sys/malloc.h>.
Cleanup:
- remove struct kmembuckets (dead)
- correctly deadify MALLOC_XX
- remove MALLOC_DEFINE_LIMIT and MALLOC_JUSTDEFINE_LIMIT (dead)
- remove malloc_roundup(), malloc_type_setlimit(), MALLOC_DEFINE_LIMIT()
and MALLOC_JUSTDEFINE_LIMIT() from man 9 malloc
New sentence, new line. Bump date for previous.
Obsolete malloc_roundup(9), malloc_type_setlimit(9) and MALLOC_DEFINE_LIMIT(9)
man pages.
 1.48.6.1 21-Apr-2017  bouyer Sync with HEAD
 1.48.4.1 20-Mar-2017  pgoyette Sync with HEAD
 1.48.2.1 28-Aug-2017  skrll Sync with HEAD
 1.49.4.1 11-May-2017  pgoyette Sync with HEAD
 1.50.14.1 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.50.2.1 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1836):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.12 19-May-2025  andvar spelling and grammar fixes in comments.
 1.11 03-Dec-2021  andvar branches: 1.11.10;
fix various typos in comments, log messages and documentation.
 1.10 12-Nov-2008  ad Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.
 1.9 28-Apr-2008  martin branches: 1.9.6; 1.9.8;
Remove clause 3 and 4 from TNF licenses
 1.8 04-Dec-2007  dsl branches: 1.8.12; 1.8.14; 1.8.16;
Remove all the __P
 1.7 11-Nov-2005  chs branches: 1.7.46; 1.7.48; 1.7.54; 1.7.58;
include additional headers that are now needed.
 1.6 26-Feb-2005  perry branches: 1.6.4;
nuke trailing whitespace
 1.5 06-Sep-2002  gehenna branches: 1.5.6; 1.5.14; 1.5.16;
Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.4 15-Feb-2002  christos branches: 1.4.8;
- add a real linux_sys___sysctl because the mib numbers are different.
implement only the kernel version getting entries.
- make the signal conversion functions consistent; dest is arg 1.
- make linux_fakedev deal with block and char devices differently.
- add linux_sys_ugetrlimit, and flesh out the regular get/setrlimit so
that they work properly.
- add linux_mmap2 [untested].
- bump kernel to 2.4.18, and make the date be valentine's day :-)
- linux_sys_*stat64 family was totally busted. Fix it.

tested only on i386.

Status:
gdb, telnet, work
jdk-1.4.0 extractor works, jdk still coredumps.

christos
 1.3 27-May-2001  manu branches: 1.3.2;
Fixed two typo in comments
 1.2 12-Apr-2001  manu Fixed an error in a comment
 1.1 19-Jan-2001  manu branches: 1.1.2; 1.1.4;
Added various header files for initial Linux compatibility on powerpc ports
 1.1.4.3 17-Sep-2002  nathanw Catch up to -current.
 1.1.4.2 28-Feb-2002  nathanw Catch up to -current.
 1.1.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.1.2.3 21-Apr-2001  bouyer Sync with HEAD
 1.1.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.1.2.1 19-Jan-2001  bouyer file linux_machdep.h was added on branch thorpej_scsipi on 2001-02-11 19:13:51 +0000
 1.3.2.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.3.2.1 16-Mar-2002  jdolecek Catch up with -current.
 1.4.8.1 16-May-2002  gehenna Remove a hard-coded device major.
 1.5.16.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.5.14.1 29-Apr-2005  kent sync with -current
 1.5.6.2 11-Dec-2005  christos Sync with head.
 1.5.6.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.6.4.2 07-Dec-2007  yamt sync with head
 1.6.4.1 21-Jun-2006  yamt sync with head.
 1.7.58.1 08-Dec-2007  ad Sync with head.
 1.7.54.1 08-Dec-2007  mjf Sync with HEAD.
 1.7.48.1 09-Jan-2008  matt sync with HEAD
 1.7.46.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.8.16.2 04-May-2009  yamt sync with head.
 1.8.16.1 16-May-2008  yamt sync with head.
 1.8.14.1 18-May-2008  yamt sync with head.
 1.8.12.2 17-Jan-2009  mjf Sync with HEAD.
 1.8.12.1 02-Jun-2008  mjf Sync with HEAD.
 1.9.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.9.6.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.11.10.1 02-Aug-2025  perseant Sync with HEAD
 1.7 14-Mar-2015  njoly Support Linux MAP_LOCKED mmap flag.
 1.6 28-Apr-2008  martin branches: 1.6.44; 1.6.64;
Remove clause 3 and 4 from TNF licenses
 1.5 11-Dec-2005  christos branches: 1.5.70; 1.5.72; 1.5.74;
merge ktrace-lwp.
 1.4 26-Feb-2005  perry nuke trailing whitespace
 1.3 08-Sep-2001  manu branches: 1.3.18; 1.3.26; 1.3.28;
Removed a hack to make PowerPC mmap work. This could have side effects on
alpha and i386. It has been tested and works on i386.
 1.2 19-Jan-2001  manu branches: 1.2.2; 1.2.4; 1.2.6;
Added various header files for initial Linux compatibility on powerpc ports
 1.1 30-Sep-1998  erh branches: 1.1.12;
Stubs for future development of linux compat architechtures.
 1.1.12.1 11-Feb-2001  bouyer Sync with HEAD.
 1.2.6.1 01-Oct-2001  fvdl Catch up with -current.
 1.2.4.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.2.2.1 21-Sep-2001  nathanw Catch up to -current.
 1.3.28.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.3.26.1 29-Apr-2005  kent sync with -current
 1.3.18.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.5.74.1 16-May-2008  yamt sync with head.
 1.5.72.1 18-May-2008  yamt sync with head.
 1.5.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.6.64.1 06-Apr-2015  skrll Sync with HEAD
 1.6.44.1 03-Dec-2017  jdolecek update from HEAD
 1.2 08-Sep-2001  manu Removed a hack to make PowerPC mmap work. This could have side effects on
alpha and i386. It has been tested and works on i386.
 1.1 19-Jan-2001  manu branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8;
Added powerpc specific code for Linux compatibility on powerpc ports
 1.1.8.1 01-Oct-2001  fvdl Catch up with -current.
 1.1.6.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.1.4.1 28-Feb-2002  nathanw Catch up to -current.
 1.1.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.1.2.1 19-Jan-2001  bouyer file linux_mmap_powerpc.c was added on branch thorpej_scsipi on 2001-02-11 19:13:52 +0000
 1.34 05-Sep-2022  tsutsui G/C ISSET() macro copies. It has been defined in <sys/types.h> since 2006.
 1.33 07-Sep-2021  riastradh sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.32 23-May-2020  ad Move proc_lock into the data segment. It was dynamically allocated because
at the time we had mutex_obj_alloc() but not __cacheline_aligned.
 1.31 03-Sep-2018  riastradh branches: 1.31.4;
Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.30 28-Aug-2017  kamil branches: 1.30.2; 1.30.4;
Remove the filesystem tracing feature

This is a legacy interface from 4.4BSD, and it was
introduced to overcome shortcomings of ptrace(2) at that time, which are
no longer relevant (performance). Today /proc/#/ctl offers a narrow
subset of ptrace(2) commands and is not applicable for modern
applications use beyond simplistic tracing scenarios.

This removal will simplify kernel internals. Users will still be able to
use all the other /proc files.

This change won't affect other procfs files neither Linux compat
features within mount_procfs(8). /proc/#/ctl isn't available on Linux.

Remove:
- /proc/#/ctl from mount_procfs(8)
- P_FSTRACE note from the documentation of ps(1)
- /proc/#/ctl and filesystem tracing documentation from mount_procfs(8)
- KAUTH_REQ_PROCESS_PROCFS_CTL documentation from kauth(9)
- source code file miscfs/procfs/procfs_ctl.c
- PFSctl and procfs_doctl() from sys/miscfs/procfs/procfs.h
- KAUTH_REQ_PROCESS_PROCFS_CTL from sys/sys/kauth.h
- PSL_FSTRACE (0x00010000) from sys/sys/proc.h
- P_FSTRACE (0x00010000) from sys/sys/sysctl.h

Reduce code complexity after removal of this functionality.

Update TODO.ptrace accordingly: remove two entries about /proc tracing.

Do not keep legacy notes as comments in the headers about removed
PSL_FSTRACE / P_FSTRACE, as this interface had little number of users
(close or equal to zero).

Proposed on tech-kern@.

All filesystem tracing utility users are encouraged to switch to ptrace(2).

Sponsored by <The NetBSD Foundation>
 1.29 13-Oct-2015  pgoyette branches: 1.29.10;
Don't release proc_lock until we're done looking at things that are
protected by the lock, particularly p_stat and p_waited. Found by
Robert Elz.

XXX Pullup to NetBSD-7, -6, -6-0, and -6-1
 1.28 09-Nov-2014  maxv branches: 1.28.2;
Do not uselessly include <sys/malloc.h>.
 1.27 26-Sep-2014  christos set error return on error (from max)
 1.26 21-Sep-2014  christos fix leak
 1.25 15-Apr-2014  maxv branches: 1.25.2;
There are two times the same branches.

} else if (addr == LUSR_OFF(__signal)) {
error = ENOTSUP;
} else if (addr == LUSR_OFF(__signal)) {
error = ENOTSUP;
}

Just delete one of them. Spotted by my code scanner.

ok christos@
 1.24 04-Jan-2014  dsl branches: 1.24.2;
Remove __HAVE_PROCESS_XFPREGS and add the extra parameter for the size
of the fp save area to all the process_read_fpregs() and
process_write_fpregs() functions.
None of the functions have been modified to use the new parameters.
The size is set for all the writes, but some of the arch-specific reads
just pass NULL.
The amd64 (and i386) need variable sized fp register save areas in order
to support AVX and other enhanced register areas.
These functions are rarely called - so the extra argument won't matter.
 1.23 01-Jul-2010  rmind branches: 1.23.8; 1.23.14; 1.23.18; 1.23.20; 1.23.22; 1.23.28;
Remove pfind() and pgfind(), fix locking in various broken uses of these.
Rename real routines to proc_find() and pgrp_find(), remove PFIND_* flags
and have consistent behaviour. Provide proc_find_raw() for special cases.
Fix memory leak in sysctl_proc_corename().

COMPAT_LINUX: rework ptrace() locking, minimise differences between
different versions per-arch.

Note: while this change adds some formal cosmetics for COMPAT_DARWIN and
COMPAT_IRIX - locking there is utterly broken (for ages).

Fixes PR/43176.
 1.22 21-Oct-2009  rmind branches: 1.22.2; 1.22.4;
Remove uarea swap-out functionality:

- Addresses the issue described in PR/38828.
- Some simplification in threading and sleepq subsystems.
- Eliminates pmap_collect() and, as a side note, allows pmap optimisations.
- Eliminates XS_CTL_DATA_ONSTACK in scsipi code.
- Avoids few scans on LWP list and thus potentially long holds of proc_lock.
- Cuts ~1.5k lines of code. Reduces amd64 kernel size by ~4k.
- Removes __SWAP_BROKEN cases.

Tested on x86, mips, acorn32 (thanks <mpumford>) and partly tested on
acorn26 (thanks to <bjh21>).

Discussed on <tech-kern>, reviewed by <ad>.
 1.21 17-Dec-2008  cegger kill MALLOC and FREE macros.
 1.20 12-Nov-2008  ad Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.
 1.19 28-Apr-2008  martin branches: 1.19.2; 1.19.6; 1.19.8;
Remove clause 3 and 4 from TNF licenses
 1.18 23-Apr-2008  ad branches: 1.18.2;
Disable bitrotted linux ptrace interfaces, which are likely now a
security hole. Can be re-enabled at runtime. If you want to repair
them please look at the native implementation.
 1.17 20-Dec-2007  dsl branches: 1.17.6; 1.17.8;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.16 09-Jul-2007  ad branches: 1.16.8; 1.16.16; 1.16.20;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.15 04-Mar-2007  christos branches: 1.15.2; 1.15.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.14 09-Feb-2007  ad branches: 1.14.2;
Merge newlock2 to head.
 1.13 30-Aug-2006  matt branches: 1.13.2;
Update to deal with options PTRACE
 1.12 11-Dec-2005  christos branches: 1.12.4; 1.12.8;
merge ktrace-lwp.
 1.11 26-Feb-2005  perry branches: 1.11.4;
nuke trailing whitespace
 1.10 18-Jan-2003  thorpej branches: 1.10.2; 1.10.10; 1.10.12;
Merge the nathanw_sa branch.
 1.9 15-Nov-2001  lukem don't need <sys/types.h> when including <sys/param.h>
 1.8 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.7 02-Jun-2001  manu branches: 1.7.2;
Fixed a rough buf in ptrace SETFPREGS (was using regs instead of fpregs)
 1.6 28-May-2001  manu Fixed a potential security problem (copyout after an error)
 1.5 27-May-2001  manu Implements correctly PEEKUSER and fixes various serious bugs. The status
of this file is not "officially broken" any more (gdb works).
 1.4 22-May-2001  manu Fixed ptrace() so that it is now possible to get traced process registers.
This makes Linux gdb able to run a Linux binary
 1.3 04-Feb-2001  christos branches: 1.3.2; 1.3.4;
cosmetic fixes.
 1.2 04-Feb-2001  manu Fixed a bug in Linux/powerpc ktrace support (it's still broken, anyway)
 1.1 19-Jan-2001  manu Added powerpc specific code for Linux compatibility on powerpc ports
 1.3.4.5 24-Jun-2002  nathanw LWPify changes.
 1.3.4.4 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.3.4.3 08-Jan-2002  nathanw Catch up to -current.
 1.3.4.2 14-Nov-2001  nathanw Catch up to -current.
 1.3.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.3.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.3.2.1 04-Feb-2001  bouyer file linux_ptrace.c was added on branch thorpej_scsipi on 2001-02-11 19:13:52 +0000
 1.7.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.10.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.10.10.1 29-Apr-2005  kent sync with -current
 1.10.2.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.11.4.4 21-Jan-2008  yamt sync with head
 1.11.4.3 03-Sep-2007  yamt sync with head.
 1.11.4.2 26-Feb-2007  yamt sync with head.
 1.11.4.1 30-Dec-2006  yamt sync with head.
 1.12.8.1 03-Sep-2006  yamt sync with head.
 1.12.4.1 09-Sep-2006  rpaulo sync with head
 1.13.2.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.13.2.1 28-Jan-2007  ad powerpc changes.
 1.14.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.15.4.1 11-Jul-2007  mjf Sync with head.
 1.15.2.1 05-Apr-2007  ad Compile fixes.
 1.16.20.1 02-Jan-2008  bouyer Sync with HEAD
 1.16.16.1 26-Dec-2007  ad Sync with head.
 1.16.8.1 09-Jan-2008  matt sync with HEAD
 1.17.8.1 18-May-2008  yamt sync with head.
 1.17.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.17.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.18.2.4 11-Aug-2010  yamt sync with head.
 1.18.2.3 11-Mar-2010  yamt sync with head
 1.18.2.2 04-May-2009  yamt sync with head.
 1.18.2.1 16-May-2008  yamt sync with head.
 1.19.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.19.6.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.19.2.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.19.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.22.4.1 03-Jul-2010  rmind sync with head
 1.22.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.23.28.1 15-Nov-2015  bouyer Pull up following revision(s) (requested by pgoyette in ticket #1335):
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.31
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.19
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.29
Don't release proc_lock until we're done looking at things that are
protected by the lock, particularly p_stat and p_waited. Found by
Robert Elz.
XXX Pullup to NetBSD-7, -6, -6-0, and -6-1
 1.23.22.1 18-May-2014  rmind sync with head
 1.23.20.1 15-Nov-2015  bouyer Pull up following revision(s) (requested by pgoyette in ticket #1335):
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.31
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.19
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.29
Don't release proc_lock until we're done looking at things that are
protected by the lock, particularly p_stat and p_waited. Found by
Robert Elz.
XXX Pullup to NetBSD-7, -6, -6-0, and -6-1
 1.23.18.2 03-Dec-2017  jdolecek update from HEAD
 1.23.18.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.23.14.1 15-Nov-2015  bouyer Pull up following revision(s) (requested by pgoyette in ticket #1335):
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.31
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.19
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.29
Don't release proc_lock until we're done looking at things that are
protected by the lock, particularly p_stat and p_waited. Found by
Robert Elz.
XXX Pullup to NetBSD-7, -6, -6-0, and -6-1
 1.23.8.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.24.2.1 10-Aug-2014  tls Rebase.
 1.25.2.3 05-Nov-2015  snj Pull up following revision(s) (requested by pgoyette in ticket #998):
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.19
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.31
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.29
Don't release proc_lock until we're done looking at things that are
protected by the lock, particularly p_stat and p_waited. Found by
Robert Elz.
 1.25.2.2 17-Jan-2015  martin branches: 1.25.2.2.2;
Pull up following revision(s) (requested by maxv in ticket #427):
sys/compat/svr4/svr4_schedctl.c: revision 1.8
sys/netinet/tcp_timer.c: revision 1.88
sys/miscfs/genfs/layer_vfsops.c: revision 1.45
sys/compat/svr4/svr4_ioctl.c: revision 1.37
sys/ufs/chfs/chfs_vfsops.c: revision 1.14
sys/miscfs/fdesc/fdesc_vfsops.c: revision 1.91
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.30
sys/compat/common/kern_time_50.c: revision 1.28
sys/netinet6/ip6_forward.c: revision 1.74
sys/miscfs/umapfs/umap_vnops.c: revision 1.57
sys/compat/svr4/svr4_fcntl.c: revision 1.74
distrib/sets/lists/comp/mi: revision 1.1931
sys/netinet6/udp6_output.c: revision 1.46
sys/fs/puffs/puffs_compat.c: revision 1.3
sys/fs/udf/udf_rename.c: revision 1.11
sys/compat/svr4/svr4_filio.c: revision 1.24
sys/fs/udf/udf_rename.c: revision 1.12
sys/netinet/tcp_usrreq.c: revision 1.202
sys/miscfs/umapfs/umap_subr.c: revision 1.29
sys/compat/linux/common/linux_fadvise64.c: revision 1.3
sys/netinet/if_atm.c: revision 1.34
sys/miscfs/procfs/procfs_subr.c: revision 1.106
sys/miscfs/genfs/layer_subr.c: revision 1.37
sys/netinet/tcp_sack.c: revision 1.30
sys/compat/freebsd/freebsd_misc.c: revision 1.33
sys/compat/freebsd/freebsd_file.c: revision 1.33
sys/ufs/chfs/chfs_vnode.c: revision 1.12
sys/compat/svr4/svr4_ttold.c: revision 1.34
sys/compat/linux/common/linux_file.c: revision 1.114
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.43
sys/compat/linux/common/linux_signal.c: revision 1.76
sys/compat/common/compat_util.c: revision 1.46
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.18
sys/compat/svr4/svr4_sockio.c: revision 1.36
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.32
sys/compat/svr4/svr4_signal.c: revision 1.66
sys/kern/kern_exec.c: revision 1.410
sys/fs/puffs/puffs_vfsops.c: revision 1.115
sys/compat/svr4/svr4_exec_elf64.c: revision 1.15
sys/compat/linux/arch/i386/linux_machdep.c: revision 1.159
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.50
sys/compat/linux32/common/linux32_misc.c: revision 1.24
sys/netinet/in_pcb.c: revision 1.153
sys/sys/malloc.h: revision 1.116
sys/compat/common/if_43.c: revision 1.9
share/man/man9/Makefile: revision 1.380
sys/netinet/tcp_vtw.c: revision 1.12
sys/miscfs/umapfs/umap_vfsops.c: revision 1.95
sys/ufs/ext2fs/ext2fs_vfsops.c: revision 1.186
sys/compat/common/uipc_syscalls_43.c: revision 1.46
sys/ufs/ext2fs/ext2fs_vnops.c: revision 1.115
sys/fs/puffs/puffs_msgif.c: revision 1.97
sys/compat/svr4/svr4_ipc.c: revision 1.27
sys/compat/linux/common/linux_exec.c: revision 1.117
sys/ufs/ext2fs/ext2fs_readwrite.c: revision 1.66
sys/netinet/tcp_output.c: revision 1.179
sys/compat/svr4/svr4_termios.c: revision 1.28
sys/fs/udf/udf_strat_bootstrap.c: revision 1.4
sys/fs/puffs/puffs_subr.c: revision 1.67
sys/fs/puffs/puffs_node.c: revision 1.36
sys/miscfs/overlay/overlay_vnops.c: revision 1.21
sys/fs/cd9660/cd9660_node.c: revision 1.34
sys/netinet/raw_ip.c: revision 1.146
sys/sys/mallocvar.h: revision 1.13
sys/miscfs/overlay/overlay_vfsops.c: revision 1.63
share/man/man9/malloc.9: revision 1.50
sys/netinet6/dest6.c: revision 1.18
sys/compat/linux/common/linux_uselib.c: revision 1.33
sys/compat/linux/common/linux_socket.c: revision 1.120
share/man/man9/malloc.9: revision 1.51
sys/netinet/tcp_subr.c: revision 1.257
sys/compat/linux/common/linux_socketcall.c: revision 1.45
sys/compat/linux/common/linux_fadvise64_64.c: revision 1.3
sys/compat/freebsd/freebsd_ipc.c: revision 1.17
sys/compat/linux/common/linux_misc_notalpha.c: revision 1.109
sys/compat/linux/arch/alpha/linux_pipe.c: revision 1.17
sys/netinet6/in6_pcb.c: revision 1.132
sys/netinet6/in6_ifattach.c: revision 1.94
sys/compat/svr4/svr4_exec_elf32.c: revision 1.15
sys/miscfs/nullfs/null_vfsops.c: revision 1.90
sys/fs/cd9660/cd9660_util.c: revision 1.12
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.48
sys/compat/freebsd/freebsd_exec_elf32.c: revision 1.20
sys/miscfs/procfs/procfs_vfsops.c: revision 1.94
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.28
sys/compat/linux/common/linux_sched.c: revision 1.67
sys/compat/linux/common/linux_exec_aout.c: revision 1.67
sys/compat/linux/common/linux_pipe.c: revision 1.67
sys/compat/linux/common/linux_llseek.c: revision 1.34
sys/compat/linux/arch/mips/linux_ptrace.c: revision 1.10
Do not uselessly include <sys/malloc.h>.
Cleanup:
- remove struct kmembuckets (dead)
- correctly deadify MALLOC_XX
- remove MALLOC_DEFINE_LIMIT and MALLOC_JUSTDEFINE_LIMIT (dead)
- remove malloc_roundup(), malloc_type_setlimit(), MALLOC_DEFINE_LIMIT()
and MALLOC_JUSTDEFINE_LIMIT() from man 9 malloc
New sentence, new line. Bump date for previous.
Obsolete malloc_roundup(9), malloc_type_setlimit(9) and MALLOC_DEFINE_LIMIT(9)
man pages.
 1.25.2.1 30-Oct-2014  martin Pull up following revision(s) (requested by maxv in ticket #163):
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.29
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.26
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.27
Fix four memory leaks in compat/linux.
 1.25.2.2.2.1 05-Nov-2015  snj Pull up following revision(s) (requested by pgoyette in ticket #998):
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.19
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.31
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.29
Don't release proc_lock until we're done looking at things that are
protected by the lock, particularly p_stat and p_waited. Found by
Robert Elz.
 1.28.2.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.29.10.2 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1836):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.29.10.1 12-Apr-2018  martin Pull up following revision(s) (requested by kamil in ticket #713):

sys/modules/procfs/Makefile: revision 1.4
sys/miscfs/procfs/procfs_vfsops.c: revision 1.98
bin/ps/ps.1: revision 1.108
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.32
sys/miscfs/procfs/procfs_vnops.c: revision 1.198
sys/kern/sys_ptrace_common.c: revision 1.23
sys/kern/sys_ptrace_common.c: revision 1.24
sbin/mount_procfs/mount_procfs.8: revision 1.36
sys/kern/sys_ptrace_common.c: revision 1.25
sys/kern/sys_ptrace.c: revision 1.5
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.30
sys/sys/proc.h: revision 1.342
sys/kern/sys_ptrace_common.c: revision 1.26
sys/miscfs/procfs/procfs_ctl.c: file removal
sys/kern/sys_ptrace_common.c: revision 1.27
sys/miscfs/procfs/procfs_subr.c: revision 1.109
sys/kern/sys_ptrace_common.c: revision 1.28
sys/secmodel/extensions/secmodel_extensions.c: revision 1.8
sys/kern/sys_ptrace_common.c: revision 1.29
sys/sys/ptrace.h: revision 1.62
sys/compat/netbsd32/netbsd32_signal.c: revision 1.45
share/man/man9/kauth.9: revision 1.109
sys/miscfs/procfs/files.procfs: revision 1.12
sys/compat/netbsd32/netbsd32.h: revision 1.115
sys/miscfs/procfs/procfs.h: revision 1.72
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.5
sys/kern/kern_sig.c: revision 1.337
sys/sys/kauth.h: revision 1.75
sys/sys/sysctl.h: revision 1.224
sys/kern/sys_ptrace_common.c: revision 1.30
sys/kern/sys_ptrace_common.c: revision 1.31
sys/kern/sys_ptrace_common.c: revision 1.32
sys/kern/sys_ptrace_common.c: revision 1.33
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.20
sys/kern/sys_ptrace_common.c: revision 1.34
sys/kern/sys_ptrace_common.c: revision 1.36
sys/kern/kern_proc.c: revision 1.207
sys/kern/kern_exit.c: revision 1.269
doc/TODO.ptrace: revision 1.29

Make {s,g}et{db,fp,}regs work again for PK_32 processes
XXX: pullup-8

add disgusting magic to handle compat_netbsd32 as a module.

use process_*reg32 instead of struct *reg32.

Remove the filesystem tracing feature

This is a legacy interface from 4.4BSD, and it was
introduced to overcome shortcomings of ptrace(2) at that time, which are
no longer relevant (performance). Today /proc/#/ctl offers a narrow
subset of ptrace(2) commands and is not applicable for modern
applications use beyond simplistic tracing scenarios.

This removal will simplify kernel internals. Users will still be able to
use all the other /proc files.

This change won't affect other procfs files neither Linux compat
features within mount_procfs(8). /proc/#/ctl isn't available on Linux.

Remove:
- /proc/#/ctl from mount_procfs(8)
- P_FSTRACE note from the documentation of ps(1)
- /proc/#/ctl and filesystem tracing documentation from mount_procfs(8)
- KAUTH_REQ_PROCESS_PROCFS_CTL documentation from kauth(9)
- source code file miscfs/procfs/procfs_ctl.c
- PFSctl and procfs_doctl() from sys/miscfs/procfs/procfs.h
- KAUTH_REQ_PROCESS_PROCFS_CTL from sys/sys/kauth.h
- PSL_FSTRACE (0x00010000) from sys/sys/proc.h
- P_FSTRACE (0x00010000) from sys/sys/sysctl.h

Reduce code complexity after removal of this functionality.

Update TODO.ptrace accordingly: remove two entries about /proc tracing.

Do not keep legacy notes as comments in the headers about removed

PSL_FSTRACE / P_FSTRACE, as this interface had little number of users
(close or equal to zero).
Proposed on tech-kern@.

All filesystem tracing utility users are encouraged to switch to ptrace(2).

Sponsored by <The NetBSD Foundation>

untangle the mess:
- factor out common code
- break each ptrace subcall to its own sub-function
.. more to come ...
- reduce ifdef ugliness by moving it up top.
- factor out PT_IO and make PT_{READ,WRITE}_{I,D} use it
- factor out PT_DUMPCORE
- factor out sendsig code
.. more to come ...

handle siginfo requests for ptrace32

ptrace: Partially undo PT_{READ,WRITE}_{I,D} and unbreak these commands

The refactored code did not work and was generating EFAULT.

Sponsored by <The NetBSD Foundation>

Merge the code back; the problem was that since we are reading/writing
to a kernel address for PT_{READ,WRITE}_{I,D} we need the kernel vmspace.
provide separate read and write functions to accomodate register functions
that need a size argument.

don't ignore error from copyout_piod

Use the proper process (the tracee) to get information about lwps and
registers and the tracer for vmspace.

Add new sysctl(3) entry: security.models.extensions.user_set_dbregs

Model this new sysctl(3) entry after "user_set_cpu_affinity" in the same
level of sysctl(3) switches.

Allow to read unconditionally Debug Registers (no change here). This is
convenient as even if a user of a debugger does not use hardware assisted
watchpoints/breakpoints, a debugger can still prompt these values to store
in an internal cache with context of registers. Reading them should have
no security concerns.

Add a paranoid MI switch that prohibits by default setting these registers
by a regular user (non-superuser). Make this switch disabled by default.
There are enough reserved bits out there to allow using them
unconditionally on hardened hosts.

Features shipped with Debug Registers are optional features in debuggers.
There is no reduction in elementary functionality.

Reviewed by <christos>

Sponsored by <The NetBSD Foundation>
 1.30.4.1 10-Jun-2019  christos Sync with HEAD
 1.30.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.31.4.1 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.7 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.6 11-Dec-2005  christos branches: 1.6.70; 1.6.72; 1.6.74;
merge ktrace-lwp.
 1.5 26-Feb-2005  perry nuke trailing whitespace
 1.4 31-Mar-2002  christos branches: 1.4.10; 1.4.18; 1.4.20;
bring the reverse signal mapping array into linux_signo.c
 1.3 31-Mar-2002  christos make signal array handling uniform, and put signal arrays in a separate
file. This is simular to errno array handling.
 1.2 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.1 19-Jan-2001  manu branches: 1.1.2; 1.1.4; 1.1.6;
Added powerpc specific code for Linux compatibility on powerpc ports
 1.1.6.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.6.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.4.2 17-Apr-2002  nathanw Catch up to -current.
 1.1.4.1 14-Nov-2001  nathanw Catch up to -current.
 1.1.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.1.2.1 19-Jan-2001  bouyer file linux_sigarray.c was added on branch thorpej_scsipi on 2001-02-11 19:13:53 +0000
 1.4.20.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.4.18.1 29-Apr-2005  kent sync with -current
 1.4.10.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.6.74.1 16-May-2008  yamt sync with head.
 1.6.72.1 18-May-2008  yamt sync with head.
 1.6.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.6 18-Nov-2011  christos - add sigtimedwait support.
- merge the siginfo population code.
 1.5 23-Nov-2008  njoly branches: 1.5.16;
Move si_code definitions from MD to MI linux_siginfo.h, all archs
(except mips for 3 values) are identical.
While here, remove unused/unneeded LINUX__SI_CODE macro. Only the
lower 16-bits are used for userland si_code.
 1.4 28-Apr-2008  martin branches: 1.4.6; 1.4.8;
Remove clause 3 and 4 from TNF licenses
 1.3 11-Dec-2005  christos branches: 1.3.70; 1.3.72; 1.3.74;
merge ktrace-lwp.
 1.2 26-Feb-2005  perry nuke trailing whitespace
 1.1 19-Jan-2001  manu branches: 1.1.2; 1.1.26; 1.1.34; 1.1.36;
Added various header files for initial Linux compatibility on powerpc ports
 1.1.36.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.1.34.1 29-Apr-2005  kent sync with -current
 1.1.26.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.1.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.1.2.1 19-Jan-2001  bouyer file linux_siginfo.h was added on branch thorpej_scsipi on 2001-02-11 19:13:53 +0000
 1.3.74.2 04-May-2009  yamt sync with head.
 1.3.74.1 16-May-2008  yamt sync with head.
 1.3.72.1 18-May-2008  yamt sync with head.
 1.3.70.2 17-Jan-2009  mjf Sync with HEAD.
 1.3.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.4.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.4.6.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.5.16.1 17-Apr-2012  yamt sync with head
 1.11 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.10 04-Dec-2007  dsl branches: 1.10.12; 1.10.14; 1.10.16;
Remove all the __P
 1.9 11-Dec-2005  christos branches: 1.9.44; 1.9.46; 1.9.52; 1.9.56;
merge ktrace-lwp.
 1.8 19-Sep-2005  christos MINSIGSTKSZ on linux is different depending on the platform and usually
smaller than ours.
 1.7 19-May-2005  manu branches: 1.7.2;
Add support for Linux SA_RESTORER on amd64.
 1.6 26-Feb-2005  perry nuke trailing whitespace
 1.5 26-Nov-2002  christos branches: 1.5.6; 1.5.14; 1.5.16;
rename: s/sa_/<compat>sa/g
 1.4 19-Mar-2002  christos - Now that RT-signals fit, fix the array to deliver them. [i386 only].
- jdk-1.4 works perfectly now. :-)
 1.3 19-Feb-2002  nathanw Add LINUX_SA_NOCLDWAIT.
 1.2 26-Aug-2001  manu Fixed a typo in struct naming. This does not seems to impact anything.
 1.1 19-Jan-2001  manu branches: 1.1.2; 1.1.4; 1.1.6;
Added various header files for initial Linux compatibility on powerpc ports
 1.1.6.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.6.2 16-Mar-2002  jdolecek Catch up with -current.
 1.1.6.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.1.4.4 11-Dec-2002  thorpej Sync with HEAD.
 1.1.4.3 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.1.4.2 28-Feb-2002  nathanw Catch up to -current.
 1.1.4.1 21-Sep-2001  nathanw Catch up to -current.
 1.1.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.1.2.1 19-Jan-2001  bouyer file linux_signal.h was added on branch thorpej_scsipi on 2001-02-11 19:13:53 +0000
 1.5.16.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.5.14.1 29-Apr-2005  kent sync with -current
 1.5.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.5.6.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.7.2.2 07-Dec-2007  yamt sync with head
 1.7.2.1 21-Jun-2006  yamt sync with head.
 1.9.56.1 08-Dec-2007  ad Sync with head.
 1.9.52.1 08-Dec-2007  mjf Sync with HEAD.
 1.9.46.1 09-Jan-2008  matt sync with HEAD
 1.9.44.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.10.16.1 16-May-2008  yamt sync with head.
 1.10.14.1 18-May-2008  yamt sync with head.
 1.10.12.1 02-Jun-2008  mjf Sync with HEAD.
 1.7 25-Jan-2014  njoly Update linux socket socket options (SO_*). Add common version to its
own file (linux_socket_generic.h); use it for all but alpha and mips.
 1.6 28-Apr-2008  martin branches: 1.6.34; 1.6.44; 1.6.50;
Remove clause 3 and 4 from TNF licenses
 1.5 11-Dec-2005  christos branches: 1.5.70; 1.5.72; 1.5.74;
merge ktrace-lwp.
 1.4 26-Feb-2005  perry nuke trailing whitespace
 1.3 26-Jul-2003  jdolecek branches: 1.3.8; 1.3.10;
add LINUX_SO_PEERNAME, LINUX_SO_TIMESTAMP where it has been missing
fix value for LINUX_SO_DETACH_FILTER on couple places (unused anyway)

g/c LINUX_SCM_TIMESTAMP definition for some archs, it will be defined
in generic linux_socket.h
 1.2 26-Aug-2001  manu branches: 1.2.20;
Fiexed a typo in a #define
 1.1 19-Jan-2001  manu branches: 1.1.2; 1.1.4; 1.1.6;
Added various header files for initial Linux compatibility on powerpc ports
 1.1.6.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.1.4.1 21-Sep-2001  nathanw Catch up to -current.
 1.1.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.1.2.1 19-Jan-2001  bouyer file linux_socket.h was added on branch thorpej_scsipi on 2001-02-11 19:13:53 +0000
 1.2.20.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.2.20.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.20.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.20.1 03-Aug-2004  skrll Sync with HEAD
 1.3.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.3.8.1 29-Apr-2005  kent sync with -current
 1.5.74.1 16-May-2008  yamt sync with head.
 1.5.72.1 18-May-2008  yamt sync with head.
 1.5.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.6.50.1 18-May-2014  rmind sync with head
 1.6.44.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.6.34.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.3 25-Jul-2004  chs remove the LINUX_SP_WRAP hack since it doesn't seem to be needed anymore,
and removing it lets us go back to mapping the stack non-executable again.
 1.2 19-Jan-2001  manu branches: 1.2.2; 1.2.26; 1.2.28;
Fixed a typo (two instructions dupliated at the end of code that were not reached)
 1.1 19-Jan-2001  manu Added powerpc specific code for Linux compatibility on powerpc ports
 1.2.28.1 26-Jul-2004  tron Pull up file removal (requested by chs in ticket #715):
remove the LINUX_SP_WRAP hack since it doesn't seem to be needed anymore,
and removing it lets us go back to mapping the stack non-executable again.
 1.2.26.1 03-Aug-2004  skrll Sync with HEAD
 1.2.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.2.2.1 19-Jan-2001  bouyer file linux_sp_wrap_powerpc.S was added on branch thorpej_scsipi on 2001-02-11 19:13:54 +0000
 1.99 28-Sep-2024  christos regen
 1.98 01-Jul-2024  christos regen
 1.97 29-Jun-2024  christos branches: 1.97.2;
regen
 1.96 19-Aug-2023  christos regen
 1.95 18-Aug-2023  christos regen
 1.94 29-Jul-2023  christos regen
 1.93 28-Jul-2023  christos regen
 1.92 02-Dec-2021  ryo regen
 1.91 24-Nov-2021  ryo regen
 1.90 20-Sep-2021  thorpej Regen for preadv(2) / pwritev(2).
 1.89 20-Sep-2021  thorpej Regen for eventfd.
 1.88 19-Sep-2021  thorpej Regen for timerfd.
 1.87 19-Sep-2021  thorpej Regen for POSIX timer syscalls.
 1.86 26-Apr-2020  thorpej branches: 1.86.2;
Regen for native futex calls.
 1.85 09-Nov-2019  jdolecek regen
 1.84 10-Aug-2018  pgoyette Regen
 1.83 10-May-2017  riastradh branches: 1.83.8; 1.83.10;
regen
 1.82 03-Feb-2017  christos branches: 1.82.4;
regen
 1.81 03-Feb-2017  martin regen
 1.80 16-Jan-2017  christos regen all
 1.79 13-Jan-2017  christos branches: 1.79.2;
regen
 1.78 02-Jan-2017  martin Regen (something apparently went wrong in previous)
 1.77 02-Jan-2017  manu Regen
 1.76 24-Jul-2016  njoly Regen for readlink/readlinkat signatures.
 1.75 27-Oct-2015  njoly branches: 1.75.2;
Regen.
 1.74 25-Oct-2015  njoly Regen for posix chown family cleanup.
 1.73 24-Sep-2015  christos regen
 1.72 07-Mar-2015  christos regen
 1.71 22-Nov-2014  njoly branches: 1.71.2;
Regen for ppoll signature fix
 1.70 31-May-2014  njoly branches: 1.70.2;
Regen for munmap(2) signature.
 1.69 20-May-2014  njoly Regen for getgroups/setgroups update.
 1.68 17-May-2014  njoly Regen for fadvise64 offset types changes.
 1.67 06-May-2014  njoly Regen for mknod device argument type change.
 1.66 04-May-2014  njoly Regen for pread/pwrite 64bit offset argument.
 1.65 08-Apr-2014  njoly Regen.
 1.64 10-Dec-2013  njoly branches: 1.64.2;
Regen.
 1.63 08-Dec-2013  njoly Regen.
 1.62 07-Nov-2013  njoly Regen for dup/dup2/dup3 argument types fix.
 1.61 24-Sep-2013  njoly Regen for utimensat(2).
 1.60 11-Aug-2013  pooka regen
 1.59 11-Aug-2013  pooka regen
 1.58 08-Apr-2013  pooka branches: 1.58.4;
regen for utimes
 1.57 19-Sep-2012  pooka regen for ppoll (and, apparently, SYCALL_ARG_PTR)
 1.56 18-Nov-2011  christos branches: 1.56.10;
- add sigtimedwait support.
- merge the siginfo population code.
 1.55 31-May-2011  njoly branches: 1.55.4;
Regen for fadvise64_64 typo fix.
 1.54 30-May-2011  alnsn Regenerate files to pick up correct RCS Ids. Suggested by Chris Badura.
 1.53 30-May-2011  alnsn Add fadvise64 and fadvise64_64 syscalls to compat_linux and compat_linux32.
 1.52 15-Apr-2011  he Regenerate these files after adding pipe2() and dup3().
 1.51 07-Jul-2010  chs branches: 1.51.2;
regen
 1.50 14-Dec-2009  matt branches: 1.50.2; 1.50.4;
Regen (new makesyscalls.sh)
 1.49 24-Nov-2009  njoly Regen for personality(2) update.
 1.48 08-Jun-2009  njoly Regen for rt_queueinfo(2) update.
 1.47 17-Jan-2009  njoly branches: 1.47.2;
Regen for wait4 update.
 1.46 15-Jan-2009  njoly Rengen for compat50 update.
 1.45 13-Jan-2009  pooka Regen to prove I didn't screw up the conversion: purely RCSID changes.
 1.44 19-Nov-2008  ad Regen.
 1.43 12-Nov-2008  njoly Regen for nanosleep(2) fix.
 1.42 23-Apr-2008  ad branches: 1.42.2; 1.42.4; 1.42.8; 1.42.10; 1.42.12;
Regen.
 1.41 04-Apr-2008  njoly branches: 1.41.2;
Regen for linux_sys_msync removal.
 1.40 24-Dec-2007  njoly branches: 1.40.6;
Regen for linux_sys_getpgid removal.
 1.39 21-Dec-2007  njoly Regen for getfsuid/setfsgid syscall exchange.
 1.38 20-Dec-2007  dsl regen
 1.37 16-Nov-2007  njoly branches: 1.37.2; 1.37.6;
Regen, for syscalls cleanup.
 1.36 04-Mar-2007  christos branches: 1.36.14; 1.36.16; 1.36.20; 1.36.22;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.35 01-Sep-2006  matt branches: 1.35.8;
Regen.
 1.34 30-Aug-2006  matt Regen
 1.33 10-Jun-2006  christos regen
 1.32 11-Dec-2005  christos branches: 1.32.4; 1.32.8; 1.32.14;
merge ktrace-lwp.
 1.31 18-Oct-2005  christos regen
 1.30 16-May-2005  fvdl branches: 1.30.2;
Regen.
 1.29 16-May-2005  fvdl Regen.
 1.28 26-Feb-2005  perry regen
 1.27 26-Feb-2005  perry regen
 1.26 20-Sep-2004  jdolecek branches: 1.26.4; 1.26.6;
regen:
implement support for Linux statfs64() syscall - 64bit variant of statfs()
 1.25 08-Sep-2004  jdolecek regen: add exit_group(2)
 1.24 01-Aug-2004  jdolecek regen - sync syscall lists with Linux kernel 2.6.7
 1.23 01-Aug-2004  jdolecek regen:

connect madvise(2) and mincore(2) - apparently the newer Linux libs
don't stub it anymore, so allow the application to take advantage
of them

the Linux calls appear to be compatible in the flag values and semantics,
so a wrapper is not necessary
 1.22 10-Aug-2003  jdolecek regen - added wrapper for Linux ftruncate64()
 1.21 23-Jun-2003  christos branches: 1.21.2;
Regen.
 1.20 18-Jan-2003  thorpej Regen for correct RCS ID.
 1.19 18-Jan-2003  thorpej Regen: Merge the nathanw_sa branch.
 1.18 01-Nov-2002  jdolecek regen: nsysent set to 256
 1.17 19-May-2002  jdolecek branches: 1.17.2;
hook in truncate64(2) and ftruncate64(2)
 1.16 12-May-2002  jdolecek branches: 1.16.2;
regen - 64 fs syscalls
 1.15 10-Apr-2002  christos regen
 1.14 22-Mar-2002  christos regen
 1.13 19-Feb-2002  nathanw Regen.
 1.12 15-Feb-2002  christos - add a real linux_sys___sysctl because the mib numbers are different.
implement only the kernel version getting entries.
- make the signal conversion functions consistent; dest is arg 1.
- make linux_fakedev deal with block and char devices differently.
- add linux_sys_ugetrlimit, and flesh out the regular get/setrlimit so
that they work properly.
- add linux_mmap2 [untested].
- bump kernel to 2.4.18, and make the date be valentine's day :-)
- linux_sys_*stat64 family was totally busted. Fix it.

tested only on i386.

Status:
gdb, telnet, work
jdk-1.4.0 extractor works, jdk still coredumps.

christos
 1.11 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.10 08-Sep-2001  manu Removed a hack to make PowerPC mmap work. This could have side effects on
alpha and i386. It has been tested and works on i386.
 1.9 30-May-2001  mrg branches: 1.9.2; 1.9.4;
use _KERNEL_OPT.
 1.8 13-May-2001  manu Improved the accuracy of gettimeofday/settimeofday: Linux stores a srtuct
timezone in the kernel. We now keep track of it for emulated processes.
Tested for powerpc and i386. Untested on m68k, but it should be ok
Alpha has a particular implementation (osf1_sys_gettimeofday), and it has
therefore not been touched.
 1.7 30-Mar-2001  jdolecek regen - use linux_sys_nosys() instead sys_nosys()
 1.6 30-Mar-2001  jdolecek regen
 1.5 30-Mar-2001  jdolecek regen
 1.4 27-Jan-2001  thorpej branches: 1.4.2; 1.4.4;
Regen; getpid(2) is MP-safe.
 1.3 27-Jan-2001  thorpej Regen; add sy_flags.
 1.2 20-Jan-2001  manu Fix the "created from" field of files generated from syscalls.master (this
master file did not have a RCS Id at generation time, hence the problem)
 1.1 19-Jan-2001  manu Added various header files for initial Linux compatibility on powerpc ports
 1.4.4.10 11-Nov-2002  nathanw Catch up to -current
 1.4.4.9 20-Jun-2002  nathanw Catch up to -current.
 1.4.4.8 29-May-2002  nathanw Regen.
 1.4.4.7 17-Apr-2002  nathanw Catch up to -current.
 1.4.4.6 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.4.4.5 28-Feb-2002  nathanw Catch up to -current.
 1.4.4.4 14-Nov-2001  nathanw Catch up to -current.
 1.4.4.3 21-Sep-2001  nathanw Catch up to -current.
 1.4.4.2 21-Jun-2001  nathanw Catch up to -current.
 1.4.4.1 09-Apr-2001  nathanw Catch up with -current.
 1.4.2.3 21-Apr-2001  bouyer Sync with HEAD
 1.4.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.4.2.1 27-Jan-2001  bouyer file linux_syscall.h was added on branch thorpej_scsipi on 2001-02-11 19:13:54 +0000
 1.9.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.9.2.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.9.2.3 16-Mar-2002  jdolecek Catch up with -current.
 1.9.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.9.2.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.16.2.1 30-May-2002  gehenna Catch up with -current.
 1.17.2.3 14-Jun-2004  jmc Regen for changes in ticket #1708
 1.17.2.2 11-May-2004  tron Regen for ticket 1686.
 1.17.2.1 22-Oct-2003  jmc Regen files (requested by tv in ticket #1427)

Proper support for mmap2
 1.21.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.21.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.21.2.4 24-Sep-2004  skrll Sync with HEAD.
 1.21.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.21.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.21.2.1 03-Aug-2004  skrll Sync with HEAD
 1.26.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.26.4.1 29-Apr-2005  kent sync with -current
 1.30.2.5 21-Jan-2008  yamt sync with head
 1.30.2.4 07-Dec-2007  yamt sync with head
 1.30.2.3 03-Sep-2007  yamt sync with head.
 1.30.2.2 30-Dec-2006  yamt sync with head.
 1.30.2.1 21-Jun-2006  yamt sync with head.
 1.32.14.1 19-Jun-2006  chap Sync with head.
 1.32.8.2 03-Sep-2006  yamt sync with head.
 1.32.8.1 26-Jun-2006  yamt sync with head.
 1.32.4.1 09-Sep-2006  rpaulo sync with head
 1.35.8.1 12-Mar-2007  rmind Sync with HEAD.
 1.36.22.2 27-Dec-2007  mjf Sync with HEAD.
 1.36.22.1 19-Nov-2007  mjf Sync with HEAD.
 1.36.20.1 18-Nov-2007  bouyer Sync with HEAD
 1.36.16.1 09-Jan-2008  matt sync with HEAD
 1.36.14.1 21-Nov-2007  joerg Sync with HEAD.
 1.37.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.37.2.1 26-Dec-2007  ad Sync with head.
 1.40.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.40.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.41.2.1 18-May-2008  yamt sync with head.
 1.42.12.1 20-Nov-2008  snj Regen for ticket 81.
 1.42.10.1 19-Jan-2009  skrll Sync with HEAD.
 1.42.8.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.42.4.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.42.2.4 11-Aug-2010  yamt sync with head.
 1.42.2.3 11-Mar-2010  yamt sync with head
 1.42.2.2 20-Jun-2009  yamt sync with head
 1.42.2.1 04-May-2009  yamt sync with head.
 1.47.2.1 23-Jul-2009  jym Sync with HEAD.
 1.50.4.4 12-Jun-2011  rmind sync with head
 1.50.4.3 31-May-2011  rmind sync with head
 1.50.4.2 21-Apr-2011  rmind sync with head
 1.50.4.1 05-Mar-2011  rmind sync with head
 1.50.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.51.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.55.4.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.55.4.2 30-Oct-2012  yamt sync with head
 1.55.4.1 17-Apr-2012  yamt sync with head
 1.56.10.4 03-Dec-2017  jdolecek update from HEAD
 1.56.10.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.56.10.2 23-Jun-2013  tls resync from head
 1.56.10.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.58.4.2 18-May-2014  rmind sync with head
 1.58.4.1 28-Aug-2013  rmind sync with head
 1.64.2.1 10-Aug-2014  tls Rebase.
 1.70.2.1 17-Apr-2017  snj regen for ticket 1354
 1.71.2.4 05-Feb-2017  skrll Sync with HEAD
 1.71.2.3 05-Oct-2016  skrll Sync with HEAD
 1.71.2.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.71.2.1 06-Apr-2015  skrll Sync with HEAD
 1.75.2.3 20-Mar-2017  pgoyette Sync with HEAD
 1.75.2.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.75.2.1 26-Jul-2016  pgoyette Sync with HEAD
 1.79.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.82.4.1 11-May-2017  pgoyette Sync with HEAD
 1.83.10.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.83.10.1 10-Jun-2019  christos Sync with HEAD
 1.83.8.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.86.2.2 17-Dec-2020  thorpej Regen for preadv(2) and pwritev(2).
 1.86.2.1 15-Dec-2020  thorpej Regen for eventfd, timerfd, POSIX timers.
 1.97.2.1 02-Aug-2025  perseant Sync with HEAD
 1.98 28-Sep-2024  christos regen
 1.97 01-Jul-2024  christos regen
 1.96 29-Jun-2024  christos branches: 1.96.2;
regen
 1.95 19-Aug-2023  christos regen
 1.94 18-Aug-2023  christos regen
 1.93 29-Jul-2023  christos regen
 1.92 28-Jul-2023  christos regen
 1.91 02-Dec-2021  ryo regen
 1.90 24-Nov-2021  ryo regen
 1.89 20-Sep-2021  thorpej Regen for preadv(2) / pwritev(2).
 1.88 20-Sep-2021  thorpej Regen for eventfd.
 1.87 19-Sep-2021  thorpej Regen for timerfd.
 1.86 19-Sep-2021  thorpej Regen for POSIX timer syscalls.
 1.85 26-Apr-2020  thorpej branches: 1.85.2;
Regen for native futex calls.
 1.84 09-Nov-2019  jdolecek regen
 1.83 10-Aug-2018  pgoyette Regen
 1.82 10-May-2017  riastradh branches: 1.82.8; 1.82.10;
regen
 1.81 03-Feb-2017  christos branches: 1.81.4;
regen
 1.80 03-Feb-2017  martin regen
 1.79 16-Jan-2017  christos regen all
 1.78 13-Jan-2017  christos branches: 1.78.2;
regen
 1.77 02-Jan-2017  martin Regen (something apparently went wrong in previous)
 1.76 02-Jan-2017  manu Regen
 1.75 24-Jul-2016  njoly Regen for readlink/readlinkat signatures.
 1.74 27-Oct-2015  njoly branches: 1.74.2;
Regen.
 1.73 25-Oct-2015  njoly Regen for posix chown family cleanup.
 1.72 24-Sep-2015  christos regen
 1.71 07-Mar-2015  christos regen
 1.70 22-Nov-2014  njoly branches: 1.70.2;
Regen for ppoll signature fix
 1.69 31-May-2014  njoly branches: 1.69.2;
Regen for munmap(2) signature.
 1.68 20-May-2014  njoly Regen for getgroups/setgroups update.
 1.67 17-May-2014  njoly Regen for fadvise64 offset types changes.
 1.66 06-May-2014  njoly Regen for mknod device argument type change.
 1.65 04-May-2014  njoly Regen for pread/pwrite 64bit offset argument.
 1.64 08-Apr-2014  njoly Regen.
 1.63 10-Dec-2013  njoly branches: 1.63.2;
Regen.
 1.62 08-Dec-2013  njoly Regen.
 1.61 07-Nov-2013  njoly Regen for dup/dup2/dup3 argument types fix.
 1.60 24-Sep-2013  njoly Regen for utimensat(2).
 1.59 11-Aug-2013  pooka regen
 1.58 11-Aug-2013  pooka regen
 1.57 08-Apr-2013  pooka branches: 1.57.4;
regen for utimes
 1.56 19-Sep-2012  pooka regen for ppoll (and, apparently, SYCALL_ARG_PTR)
 1.55 18-Nov-2011  christos branches: 1.55.10;
- add sigtimedwait support.
- merge the siginfo population code.
 1.54 31-May-2011  njoly branches: 1.54.4;
Regen for fadvise64_64 typo fix.
 1.53 30-May-2011  alnsn Regenerate files to pick up correct RCS Ids. Suggested by Chris Badura.
 1.52 30-May-2011  alnsn Add fadvise64 and fadvise64_64 syscalls to compat_linux and compat_linux32.
 1.51 15-Apr-2011  he Regenerate these files after adding pipe2() and dup3().
 1.50 07-Jul-2010  chs branches: 1.50.2;
regen
 1.49 14-Dec-2009  matt branches: 1.49.2; 1.49.4;
Regen (new makesyscalls.sh)
 1.48 24-Nov-2009  njoly Regen for personality(2) update.
 1.47 08-Jun-2009  njoly Regen for rt_queueinfo(2) update.
 1.46 17-Jan-2009  njoly branches: 1.46.2;
Regen for wait4 update.
 1.45 15-Jan-2009  njoly Rengen for compat50 update.
 1.44 13-Jan-2009  pooka Regen to prove I didn't screw up the conversion: purely RCSID changes.
 1.43 19-Nov-2008  ad Regen.
 1.42 12-Nov-2008  njoly Regen for nanosleep(2) fix.
 1.41 23-Apr-2008  ad branches: 1.41.2; 1.41.4; 1.41.8; 1.41.10; 1.41.12;
Regen.
 1.40 04-Apr-2008  njoly branches: 1.40.2;
Regen for linux_sys_msync removal.
 1.39 24-Dec-2007  njoly branches: 1.39.6;
Regen for linux_sys_getpgid removal.
 1.38 21-Dec-2007  njoly Regen for getfsuid/setfsgid syscall exchange.
 1.37 20-Dec-2007  dsl regen
 1.36 16-Nov-2007  njoly branches: 1.36.2; 1.36.6;
Regen, for syscalls cleanup.
 1.35 04-Mar-2007  christos branches: 1.35.14; 1.35.16; 1.35.20; 1.35.22;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.34 01-Sep-2006  matt branches: 1.34.8;
Regen.
 1.33 30-Aug-2006  matt Regen
 1.32 10-Jun-2006  christos regen
 1.31 11-Dec-2005  christos branches: 1.31.4; 1.31.8; 1.31.14;
merge ktrace-lwp.
 1.30 18-Oct-2005  christos regen
 1.29 16-May-2005  fvdl branches: 1.29.2;
Regen.
 1.28 16-May-2005  fvdl Regen.
 1.27 26-Feb-2005  perry regen
 1.26 26-Feb-2005  perry regen
 1.25 20-Sep-2004  jdolecek branches: 1.25.4; 1.25.6;
regen:
implement support for Linux statfs64() syscall - 64bit variant of statfs()
 1.24 08-Sep-2004  jdolecek regen: add exit_group(2)
 1.23 01-Aug-2004  jdolecek regen - sync syscall lists with Linux kernel 2.6.7
 1.22 01-Aug-2004  jdolecek regen:

connect madvise(2) and mincore(2) - apparently the newer Linux libs
don't stub it anymore, so allow the application to take advantage
of them

the Linux calls appear to be compatible in the flag values and semantics,
so a wrapper is not necessary
 1.21 10-Aug-2003  jdolecek regen - added wrapper for Linux ftruncate64()
 1.20 23-Jun-2003  christos branches: 1.20.2;
Regen.
 1.19 18-Jan-2003  thorpej Regen for correct RCS ID.
 1.18 18-Jan-2003  thorpej Regen: Merge the nathanw_sa branch.
 1.17 19-May-2002  jdolecek branches: 1.17.2;
hook in truncate64(2) and ftruncate64(2)
 1.16 12-May-2002  jdolecek branches: 1.16.2;
regen - 64 fs syscalls
 1.15 10-Apr-2002  christos regen
 1.14 22-Mar-2002  christos regen
 1.13 19-Feb-2002  nathanw Regen.
 1.12 15-Feb-2002  christos - add a real linux_sys___sysctl because the mib numbers are different.
implement only the kernel version getting entries.
- make the signal conversion functions consistent; dest is arg 1.
- make linux_fakedev deal with block and char devices differently.
- add linux_sys_ugetrlimit, and flesh out the regular get/setrlimit so
that they work properly.
- add linux_mmap2 [untested].
- bump kernel to 2.4.18, and make the date be valentine's day :-)
- linux_sys_*stat64 family was totally busted. Fix it.

tested only on i386.

Status:
gdb, telnet, work
jdk-1.4.0 extractor works, jdk still coredumps.

christos
 1.11 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.10 08-Sep-2001  manu Removed a hack to make PowerPC mmap work. This could have side effects on
alpha and i386. It has been tested and works on i386.
 1.9 30-May-2001  mrg branches: 1.9.2; 1.9.4;
use _KERNEL_OPT.
 1.8 13-May-2001  manu Improved the accuracy of gettimeofday/settimeofday: Linux stores a srtuct
timezone in the kernel. We now keep track of it for emulated processes.
Tested for powerpc and i386. Untested on m68k, but it should be ok
Alpha has a particular implementation (osf1_sys_gettimeofday), and it has
therefore not been touched.
 1.7 30-Mar-2001  jdolecek regen - use linux_sys_nosys() instead sys_nosys()
 1.6 30-Mar-2001  jdolecek regen
 1.5 30-Mar-2001  jdolecek regen
 1.4 27-Jan-2001  thorpej branches: 1.4.2; 1.4.4;
Regen; getpid(2) is MP-safe.
 1.3 27-Jan-2001  thorpej Regen; add sy_flags.
 1.2 20-Jan-2001  manu Fix the "created from" field of files generated from syscalls.master (this
master file did not have a RCS Id at generation time, hence the problem)
 1.1 19-Jan-2001  manu Added various header files for initial Linux compatibility on powerpc ports
 1.4.4.9 20-Jun-2002  nathanw Catch up to -current.
 1.4.4.8 29-May-2002  nathanw Regen.
 1.4.4.7 17-Apr-2002  nathanw Catch up to -current.
 1.4.4.6 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.4.4.5 28-Feb-2002  nathanw Catch up to -current.
 1.4.4.4 14-Nov-2001  nathanw Catch up to -current.
 1.4.4.3 21-Sep-2001  nathanw Catch up to -current.
 1.4.4.2 21-Jun-2001  nathanw Catch up to -current.
 1.4.4.1 09-Apr-2001  nathanw Catch up with -current.
 1.4.2.3 21-Apr-2001  bouyer Sync with HEAD
 1.4.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.4.2.1 27-Jan-2001  bouyer file linux_syscallargs.h was added on branch thorpej_scsipi on 2001-02-11 19:13:55 +0000
 1.9.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.9.2.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.9.2.3 16-Mar-2002  jdolecek Catch up with -current.
 1.9.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.9.2.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.16.2.1 30-May-2002  gehenna Catch up with -current.
 1.17.2.3 14-Jun-2004  jmc Regen for changes in ticket #1708
 1.17.2.2 11-May-2004  tron Regen for ticket 1686.
 1.17.2.1 22-Oct-2003  jmc Regen files (requested by tv in ticket #1427)

Proper support for mmap2
 1.20.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.20.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.20.2.4 24-Sep-2004  skrll Sync with HEAD.
 1.20.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.20.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.20.2.1 03-Aug-2004  skrll Sync with HEAD
 1.25.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.25.4.1 29-Apr-2005  kent sync with -current
 1.29.2.5 21-Jan-2008  yamt sync with head
 1.29.2.4 07-Dec-2007  yamt sync with head
 1.29.2.3 03-Sep-2007  yamt sync with head.
 1.29.2.2 30-Dec-2006  yamt sync with head.
 1.29.2.1 21-Jun-2006  yamt sync with head.
 1.31.14.1 19-Jun-2006  chap Sync with head.
 1.31.8.2 03-Sep-2006  yamt sync with head.
 1.31.8.1 26-Jun-2006  yamt sync with head.
 1.31.4.1 09-Sep-2006  rpaulo sync with head
 1.34.8.1 12-Mar-2007  rmind Sync with HEAD.
 1.35.22.2 27-Dec-2007  mjf Sync with HEAD.
 1.35.22.1 19-Nov-2007  mjf Sync with HEAD.
 1.35.20.1 18-Nov-2007  bouyer Sync with HEAD
 1.35.16.1 09-Jan-2008  matt sync with HEAD
 1.35.14.1 21-Nov-2007  joerg Sync with HEAD.
 1.36.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.36.2.1 26-Dec-2007  ad Sync with head.
 1.39.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.39.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.40.2.1 18-May-2008  yamt sync with head.
 1.41.12.1 20-Nov-2008  snj Regen for ticket 81.
 1.41.10.1 19-Jan-2009  skrll Sync with HEAD.
 1.41.8.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.41.4.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.41.2.4 11-Aug-2010  yamt sync with head.
 1.41.2.3 11-Mar-2010  yamt sync with head
 1.41.2.2 20-Jun-2009  yamt sync with head
 1.41.2.1 04-May-2009  yamt sync with head.
 1.46.2.1 23-Jul-2009  jym Sync with HEAD.
 1.49.4.4 12-Jun-2011  rmind sync with head
 1.49.4.3 31-May-2011  rmind sync with head
 1.49.4.2 21-Apr-2011  rmind sync with head
 1.49.4.1 05-Mar-2011  rmind sync with head
 1.49.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.50.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.54.4.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.54.4.2 30-Oct-2012  yamt sync with head
 1.54.4.1 17-Apr-2012  yamt sync with head
 1.55.10.4 03-Dec-2017  jdolecek update from HEAD
 1.55.10.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.55.10.2 23-Jun-2013  tls resync from head
 1.55.10.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.57.4.2 18-May-2014  rmind sync with head
 1.57.4.1 28-Aug-2013  rmind sync with head
 1.63.2.1 10-Aug-2014  tls Rebase.
 1.69.2.1 17-Apr-2017  snj regen for ticket 1354
 1.70.2.5 28-Aug-2017  skrll Sync with HEAD
 1.70.2.4 05-Feb-2017  skrll Sync with HEAD
 1.70.2.3 05-Oct-2016  skrll Sync with HEAD
 1.70.2.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.70.2.1 06-Apr-2015  skrll Sync with HEAD
 1.74.2.3 20-Mar-2017  pgoyette Sync with HEAD
 1.74.2.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.74.2.1 26-Jul-2016  pgoyette Sync with HEAD
 1.78.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.81.4.1 11-May-2017  pgoyette Sync with HEAD
 1.82.10.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.82.10.1 10-Jun-2019  christos Sync with HEAD
 1.82.8.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.85.2.2 17-Dec-2020  thorpej Regen for preadv(2) and pwritev(2).
 1.85.2.1 15-Dec-2020  thorpej Regen for eventfd, timerfd, POSIX timers.
 1.96.2.1 02-Aug-2025  perseant Sync with HEAD
 1.98 28-Sep-2024  christos regen
 1.97 01-Jul-2024  christos regen
 1.96 29-Jun-2024  christos branches: 1.96.2;
regen
 1.95 19-Aug-2023  christos regen
 1.94 18-Aug-2023  christos regen
 1.93 29-Jul-2023  christos regen
 1.92 28-Jul-2023  christos regen
 1.91 02-Dec-2021  ryo regen
 1.90 24-Nov-2021  ryo regen
 1.89 20-Sep-2021  thorpej Regen for preadv(2) / pwritev(2).
 1.88 20-Sep-2021  thorpej Regen for eventfd.
 1.87 19-Sep-2021  thorpej Regen for timerfd.
 1.86 19-Sep-2021  thorpej Regen for POSIX timer syscalls.
 1.85 26-Apr-2020  thorpej branches: 1.85.2;
Regen for native futex calls.
 1.84 09-Nov-2019  jdolecek regen
 1.83 10-Aug-2018  pgoyette Regen
 1.82 10-May-2017  riastradh branches: 1.82.8; 1.82.10;
regen
 1.81 03-Feb-2017  christos branches: 1.81.4;
regen
 1.80 03-Feb-2017  martin regen
 1.79 16-Jan-2017  christos regen all
 1.78 13-Jan-2017  christos branches: 1.78.2;
regen
 1.77 02-Jan-2017  martin Regen (something apparently went wrong in previous)
 1.76 02-Jan-2017  manu Regen
 1.75 24-Jul-2016  njoly Regen for readlink/readlinkat signatures.
 1.74 27-Oct-2015  njoly branches: 1.74.2;
Regen.
 1.73 25-Oct-2015  njoly Regen for posix chown family cleanup.
 1.72 24-Sep-2015  christos regen
 1.71 07-Mar-2015  christos regen
 1.70 22-Nov-2014  njoly branches: 1.70.2;
Regen for ppoll signature fix
 1.69 31-May-2014  njoly branches: 1.69.2;
Regen for munmap(2) signature.
 1.68 20-May-2014  njoly Regen for getgroups/setgroups update.
 1.67 17-May-2014  njoly Regen for fadvise64 offset types changes.
 1.66 06-May-2014  njoly Regen for mknod device argument type change.
 1.65 04-May-2014  njoly Regen for pread/pwrite 64bit offset argument.
 1.64 08-Apr-2014  njoly Regen.
 1.63 10-Dec-2013  njoly branches: 1.63.2;
Regen.
 1.62 08-Dec-2013  njoly Regen.
 1.61 07-Nov-2013  njoly Regen for dup/dup2/dup3 argument types fix.
 1.60 24-Sep-2013  njoly Regen for utimensat(2).
 1.59 11-Aug-2013  pooka regen
 1.58 11-Aug-2013  pooka regen
 1.57 08-Apr-2013  pooka branches: 1.57.4;
regen for utimes
 1.56 19-Sep-2012  pooka regen for ppoll (and, apparently, SYCALL_ARG_PTR)
 1.55 18-Nov-2011  christos branches: 1.55.10;
- add sigtimedwait support.
- merge the siginfo population code.
 1.54 31-May-2011  njoly branches: 1.54.4;
Regen for fadvise64_64 typo fix.
 1.53 30-May-2011  alnsn Regenerate files to pick up correct RCS Ids. Suggested by Chris Badura.
 1.52 30-May-2011  alnsn Add fadvise64 and fadvise64_64 syscalls to compat_linux and compat_linux32.
 1.51 15-Apr-2011  he Regenerate these files after adding pipe2() and dup3().
 1.50 07-Jul-2010  chs branches: 1.50.2;
regen
 1.49 14-Dec-2009  matt branches: 1.49.2; 1.49.4;
Regen (new makesyscalls.sh)
 1.48 24-Nov-2009  njoly Regen for personality(2) update.
 1.47 08-Jun-2009  njoly Regen for rt_queueinfo(2) update.
 1.46 17-Jan-2009  njoly branches: 1.46.2;
Regen for wait4 update.
 1.45 15-Jan-2009  njoly Rengen for compat50 update.
 1.44 13-Jan-2009  pooka Regen to prove I didn't screw up the conversion: purely RCSID changes.
 1.43 19-Nov-2008  ad Regen.
 1.42 12-Nov-2008  njoly Regen for nanosleep(2) fix.
 1.41 23-Apr-2008  ad branches: 1.41.2; 1.41.4; 1.41.8; 1.41.10; 1.41.12;
Regen.
 1.40 04-Apr-2008  njoly branches: 1.40.2;
Regen for linux_sys_msync removal.
 1.39 24-Dec-2007  njoly branches: 1.39.6;
Regen for linux_sys_getpgid removal.
 1.38 21-Dec-2007  njoly Regen for getfsuid/setfsgid syscall exchange.
 1.37 20-Dec-2007  dsl regen
 1.36 16-Nov-2007  njoly branches: 1.36.2; 1.36.6;
Regen, for syscalls cleanup.
 1.35 09-Feb-2007  ad branches: 1.35.18; 1.35.20; 1.35.24; 1.35.26;
Merge newlock2 to head.
 1.34 01-Sep-2006  matt branches: 1.34.2;
Regen.
 1.33 30-Aug-2006  matt Regen
 1.32 10-Jun-2006  christos regen
 1.31 11-Dec-2005  christos branches: 1.31.4; 1.31.8; 1.31.14;
merge ktrace-lwp.
 1.30 18-Oct-2005  christos regen
 1.29 16-May-2005  fvdl branches: 1.29.2;
Regen.
 1.28 16-May-2005  fvdl Regen.
 1.27 26-Feb-2005  perry regen
 1.26 26-Feb-2005  perry regen
 1.25 20-Sep-2004  jdolecek branches: 1.25.4; 1.25.6;
regen:
implement support for Linux statfs64() syscall - 64bit variant of statfs()
 1.24 08-Sep-2004  jdolecek regen: add exit_group(2)
 1.23 01-Aug-2004  jdolecek regen - sync syscall lists with Linux kernel 2.6.7
 1.22 01-Aug-2004  jdolecek regen:

connect madvise(2) and mincore(2) - apparently the newer Linux libs
don't stub it anymore, so allow the application to take advantage
of them

the Linux calls appear to be compatible in the flag values and semantics,
so a wrapper is not necessary
 1.21 10-Aug-2003  jdolecek regen - added wrapper for Linux ftruncate64()
 1.20 23-Jun-2003  christos branches: 1.20.2;
Regen.
 1.19 18-Jan-2003  thorpej Regen for correct RCS ID.
 1.18 18-Jan-2003  thorpej Regen: Merge the nathanw_sa branch.
 1.17 19-May-2002  jdolecek branches: 1.17.2;
hook in truncate64(2) and ftruncate64(2)
 1.16 12-May-2002  jdolecek branches: 1.16.2;
regen - 64 fs syscalls
 1.15 10-Apr-2002  christos regen
 1.14 22-Mar-2002  christos regen
 1.13 19-Feb-2002  nathanw Regen.
 1.12 15-Feb-2002  christos - add a real linux_sys___sysctl because the mib numbers are different.
implement only the kernel version getting entries.
- make the signal conversion functions consistent; dest is arg 1.
- make linux_fakedev deal with block and char devices differently.
- add linux_sys_ugetrlimit, and flesh out the regular get/setrlimit so
that they work properly.
- add linux_mmap2 [untested].
- bump kernel to 2.4.18, and make the date be valentine's day :-)
- linux_sys_*stat64 family was totally busted. Fix it.

tested only on i386.

Status:
gdb, telnet, work
jdk-1.4.0 extractor works, jdk still coredumps.

christos
 1.11 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.10 08-Sep-2001  manu Removed a hack to make PowerPC mmap work. This could have side effects on
alpha and i386. It has been tested and works on i386.
 1.9 30-May-2001  mrg branches: 1.9.2; 1.9.4;
use _KERNEL_OPT.
 1.8 13-May-2001  manu Improved the accuracy of gettimeofday/settimeofday: Linux stores a srtuct
timezone in the kernel. We now keep track of it for emulated processes.
Tested for powerpc and i386. Untested on m68k, but it should be ok
Alpha has a particular implementation (osf1_sys_gettimeofday), and it has
therefore not been touched.
 1.7 30-Mar-2001  jdolecek regen - use linux_sys_nosys() instead sys_nosys()
 1.6 30-Mar-2001  jdolecek regen
 1.5 30-Mar-2001  jdolecek regen
 1.4 27-Jan-2001  thorpej branches: 1.4.2; 1.4.4;
Regen; getpid(2) is MP-safe.
 1.3 27-Jan-2001  thorpej Regen; add sy_flags.
 1.2 20-Jan-2001  manu Fix the "created from" field of files generated from syscalls.master (this
master file did not have a RCS Id at generation time, hence the problem)
 1.1 19-Jan-2001  manu Added powerpc specific code for Linux compatibility on powerpc ports
 1.4.4.9 20-Jun-2002  nathanw Catch up to -current.
 1.4.4.8 29-May-2002  nathanw Regen.
 1.4.4.7 17-Apr-2002  nathanw Catch up to -current.
 1.4.4.6 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.4.4.5 28-Feb-2002  nathanw Catch up to -current.
 1.4.4.4 14-Nov-2001  nathanw Catch up to -current.
 1.4.4.3 21-Sep-2001  nathanw Catch up to -current.
 1.4.4.2 21-Jun-2001  nathanw Catch up to -current.
 1.4.4.1 09-Apr-2001  nathanw Catch up with -current.
 1.4.2.3 21-Apr-2001  bouyer Sync with HEAD
 1.4.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.4.2.1 27-Jan-2001  bouyer file linux_syscalls.c was added on branch thorpej_scsipi on 2001-02-11 19:13:55 +0000
 1.9.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.9.2.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.9.2.3 16-Mar-2002  jdolecek Catch up with -current.
 1.9.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.9.2.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.16.2.1 30-May-2002  gehenna Catch up with -current.
 1.17.2.3 14-Jun-2004  jmc Regen for changes in ticket #1708
 1.17.2.2 11-May-2004  tron Regen for ticket 1686.
 1.17.2.1 22-Oct-2003  jmc Regen files (requested by tv in ticket #1427)

Proper support for mmap2
 1.20.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.20.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.20.2.4 24-Sep-2004  skrll Sync with HEAD.
 1.20.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.20.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.20.2.1 03-Aug-2004  skrll Sync with HEAD
 1.25.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.25.4.1 29-Apr-2005  kent sync with -current
 1.29.2.5 21-Jan-2008  yamt sync with head
 1.29.2.4 07-Dec-2007  yamt sync with head
 1.29.2.3 26-Feb-2007  yamt sync with head.
 1.29.2.2 30-Dec-2006  yamt sync with head.
 1.29.2.1 21-Jun-2006  yamt sync with head.
 1.31.14.1 19-Jun-2006  chap Sync with head.
 1.31.8.2 03-Sep-2006  yamt sync with head.
 1.31.8.1 26-Jun-2006  yamt sync with head.
 1.31.4.1 09-Sep-2006  rpaulo sync with head
 1.34.2.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.35.26.2 27-Dec-2007  mjf Sync with HEAD.
 1.35.26.1 19-Nov-2007  mjf Sync with HEAD.
 1.35.24.1 18-Nov-2007  bouyer Sync with HEAD
 1.35.20.1 09-Jan-2008  matt sync with HEAD
 1.35.18.1 21-Nov-2007  joerg Sync with HEAD.
 1.36.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.36.2.1 26-Dec-2007  ad Sync with head.
 1.39.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.39.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.40.2.1 18-May-2008  yamt sync with head.
 1.41.12.1 20-Nov-2008  snj Regen for ticket 81.
 1.41.10.1 19-Jan-2009  skrll Sync with HEAD.
 1.41.8.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.41.4.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.41.4.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.41.2.4 11-Aug-2010  yamt sync with head.
 1.41.2.3 11-Mar-2010  yamt sync with head
 1.41.2.2 20-Jun-2009  yamt sync with head
 1.41.2.1 04-May-2009  yamt sync with head.
 1.46.2.1 23-Jul-2009  jym Sync with HEAD.
 1.49.4.4 12-Jun-2011  rmind sync with head
 1.49.4.3 31-May-2011  rmind sync with head
 1.49.4.2 21-Apr-2011  rmind sync with head
 1.49.4.1 05-Mar-2011  rmind sync with head
 1.49.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.50.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.54.4.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.54.4.2 30-Oct-2012  yamt sync with head
 1.54.4.1 17-Apr-2012  yamt sync with head
 1.55.10.4 03-Dec-2017  jdolecek update from HEAD
 1.55.10.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.55.10.2 23-Jun-2013  tls resync from head
 1.55.10.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.57.4.2 18-May-2014  rmind sync with head
 1.57.4.1 28-Aug-2013  rmind sync with head
 1.63.2.1 10-Aug-2014  tls Rebase.
 1.69.2.1 17-Apr-2017  snj regen for ticket 1354
 1.70.2.4 05-Feb-2017  skrll Sync with HEAD
 1.70.2.3 05-Oct-2016  skrll Sync with HEAD
 1.70.2.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.70.2.1 06-Apr-2015  skrll Sync with HEAD
 1.74.2.3 20-Mar-2017  pgoyette Sync with HEAD
 1.74.2.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.74.2.1 26-Jul-2016  pgoyette Sync with HEAD
 1.78.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.81.4.1 11-May-2017  pgoyette Sync with HEAD
 1.82.10.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.82.10.1 10-Jun-2019  christos Sync with HEAD
 1.82.8.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.85.2.2 17-Dec-2020  thorpej Regen for preadv(2) and pwritev(2).
 1.85.2.1 15-Dec-2020  thorpej Regen for eventfd, timerfd, POSIX timers.
 1.96.2.1 02-Aug-2025  perseant Sync with HEAD
 1.99 28-Sep-2024  christos regen
 1.98 01-Jul-2024  christos regen
 1.97 29-Jun-2024  christos branches: 1.97.2;
regen
 1.96 19-Aug-2023  christos regen
 1.95 18-Aug-2023  christos regen
 1.94 29-Jul-2023  christos regen
 1.93 28-Jul-2023  christos regen
 1.92 02-Dec-2021  ryo regen
 1.91 24-Nov-2021  ryo regen
 1.90 20-Sep-2021  thorpej Regen for preadv(2) / pwritev(2).
 1.89 20-Sep-2021  thorpej Regen for eventfd.
 1.88 19-Sep-2021  thorpej Regen for timerfd.
 1.87 19-Sep-2021  thorpej Regen for POSIX timer syscalls.
 1.86 26-Apr-2020  thorpej branches: 1.86.2;
Regen for native futex calls.
 1.85 09-Nov-2019  jdolecek regen
 1.84 10-Aug-2018  pgoyette Regen
 1.83 10-May-2017  riastradh branches: 1.83.8; 1.83.10;
regen
 1.82 03-Feb-2017  christos branches: 1.82.4;
regen
 1.81 03-Feb-2017  martin regen
 1.80 16-Jan-2017  christos regen all
 1.79 13-Jan-2017  christos branches: 1.79.2;
regen
 1.78 02-Jan-2017  martin Regen (something apparently went wrong in previous)
 1.77 02-Jan-2017  manu Regen
 1.76 24-Jul-2016  njoly Regen for readlink/readlinkat signatures.
 1.75 27-Oct-2015  njoly branches: 1.75.2;
Regen.
 1.74 25-Oct-2015  njoly Regen for posix chown family cleanup.
 1.73 24-Sep-2015  christos regen
 1.72 07-Mar-2015  christos regen
 1.71 22-Nov-2014  njoly branches: 1.71.2;
Regen for ppoll signature fix
 1.70 31-May-2014  njoly branches: 1.70.2;
Regen for munmap(2) signature.
 1.69 20-May-2014  njoly Regen for getgroups/setgroups update.
 1.68 17-May-2014  njoly Regen for fadvise64 offset types changes.
 1.67 06-May-2014  njoly Regen for mknod device argument type change.
 1.66 04-May-2014  njoly Regen for pread/pwrite 64bit offset argument.
 1.65 08-Apr-2014  njoly Regen.
 1.64 10-Dec-2013  njoly branches: 1.64.2;
Regen.
 1.63 08-Dec-2013  njoly Regen.
 1.62 07-Nov-2013  njoly Regen for dup/dup2/dup3 argument types fix.
 1.61 24-Sep-2013  njoly Regen for utimensat(2).
 1.60 11-Aug-2013  pooka regen
 1.59 11-Aug-2013  pooka regen
 1.58 08-Apr-2013  pooka branches: 1.58.4;
regen for utimes
 1.57 19-Sep-2012  pooka regen for ppoll (and, apparently, SYCALL_ARG_PTR)
 1.56 18-Nov-2011  christos branches: 1.56.10;
- add sigtimedwait support.
- merge the siginfo population code.
 1.55 31-May-2011  njoly branches: 1.55.4;
Regen for fadvise64_64 typo fix.
 1.54 30-May-2011  alnsn Regenerate files to pick up correct RCS Ids. Suggested by Chris Badura.
 1.53 30-May-2011  alnsn Add fadvise64 and fadvise64_64 syscalls to compat_linux and compat_linux32.
 1.52 15-Apr-2011  he Regenerate these files after adding pipe2() and dup3().
 1.51 07-Jul-2010  chs branches: 1.51.2;
regen
 1.50 14-Dec-2009  matt branches: 1.50.2; 1.50.4;
Regen (new makesyscalls.sh)
 1.49 24-Nov-2009  njoly Regen for personality(2) update.
 1.48 08-Jun-2009  njoly Regen for rt_queueinfo(2) update.
 1.47 17-Jan-2009  njoly branches: 1.47.2;
Regen for wait4 update.
 1.46 15-Jan-2009  njoly Rengen for compat50 update.
 1.45 13-Jan-2009  pooka Regen to prove I didn't screw up the conversion: purely RCSID changes.
 1.44 19-Nov-2008  ad Regen.
 1.43 12-Nov-2008  njoly Regen for nanosleep(2) fix.
 1.42 23-Apr-2008  ad branches: 1.42.2; 1.42.4; 1.42.8; 1.42.10; 1.42.12;
Regen.
 1.41 04-Apr-2008  njoly branches: 1.41.2;
Regen for linux_sys_msync removal.
 1.40 24-Dec-2007  njoly branches: 1.40.6;
Regen for linux_sys_getpgid removal.
 1.39 21-Dec-2007  njoly Regen for getfsuid/setfsgid syscall exchange.
 1.38 20-Dec-2007  dsl regen
 1.37 16-Nov-2007  njoly branches: 1.37.2; 1.37.6;
Regen, for syscalls cleanup.
 1.36 09-Feb-2007  ad branches: 1.36.18; 1.36.20; 1.36.24; 1.36.26;
Merge newlock2 to head.
 1.35 01-Sep-2006  matt branches: 1.35.2;
Regen.
 1.34 30-Aug-2006  matt Regen
 1.33 10-Jun-2006  christos regen
 1.32 11-Dec-2005  christos branches: 1.32.4; 1.32.8; 1.32.14;
merge ktrace-lwp.
 1.31 18-Oct-2005  christos regen
 1.30 16-May-2005  fvdl branches: 1.30.2;
Regen.
 1.29 16-May-2005  fvdl Regen.
 1.28 26-Feb-2005  perry regen
 1.27 26-Feb-2005  perry regen
 1.26 20-Sep-2004  jdolecek branches: 1.26.4; 1.26.6;
regen:
implement support for Linux statfs64() syscall - 64bit variant of statfs()
 1.25 08-Sep-2004  jdolecek regen: add exit_group(2)
 1.24 01-Aug-2004  jdolecek regen - sync syscall lists with Linux kernel 2.6.7
 1.23 01-Aug-2004  jdolecek regen:

connect madvise(2) and mincore(2) - apparently the newer Linux libs
don't stub it anymore, so allow the application to take advantage
of them

the Linux calls appear to be compatible in the flag values and semantics,
so a wrapper is not necessary
 1.22 10-Aug-2003  jdolecek regen - added wrapper for Linux ftruncate64()
 1.21 23-Jun-2003  christos branches: 1.21.2;
Regen.
 1.20 18-Jan-2003  thorpej Regen for correct RCS ID.
 1.19 18-Jan-2003  thorpej Regen: Merge the nathanw_sa branch.
 1.18 01-Nov-2002  jdolecek regen: nsysent set to 256
 1.17 19-May-2002  jdolecek branches: 1.17.2;
hook in truncate64(2) and ftruncate64(2)
 1.16 12-May-2002  jdolecek branches: 1.16.2;
regen - 64 fs syscalls
 1.15 10-Apr-2002  christos regen
 1.14 22-Mar-2002  christos regen
 1.13 19-Feb-2002  nathanw Regen.
 1.12 15-Feb-2002  christos - add a real linux_sys___sysctl because the mib numbers are different.
implement only the kernel version getting entries.
- make the signal conversion functions consistent; dest is arg 1.
- make linux_fakedev deal with block and char devices differently.
- add linux_sys_ugetrlimit, and flesh out the regular get/setrlimit so
that they work properly.
- add linux_mmap2 [untested].
- bump kernel to 2.4.18, and make the date be valentine's day :-)
- linux_sys_*stat64 family was totally busted. Fix it.

tested only on i386.

Status:
gdb, telnet, work
jdk-1.4.0 extractor works, jdk still coredumps.

christos
 1.11 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.10 08-Sep-2001  manu Removed a hack to make PowerPC mmap work. This could have side effects on
alpha and i386. It has been tested and works on i386.
 1.9 30-May-2001  mrg branches: 1.9.2; 1.9.4;
use _KERNEL_OPT.
 1.8 13-May-2001  manu Improved the accuracy of gettimeofday/settimeofday: Linux stores a srtuct
timezone in the kernel. We now keep track of it for emulated processes.
Tested for powerpc and i386. Untested on m68k, but it should be ok
Alpha has a particular implementation (osf1_sys_gettimeofday), and it has
therefore not been touched.
 1.7 30-Mar-2001  jdolecek regen - use linux_sys_nosys() instead sys_nosys()
 1.6 30-Mar-2001  jdolecek regen
 1.5 30-Mar-2001  jdolecek regen
 1.4 27-Jan-2001  thorpej branches: 1.4.2; 1.4.4;
Regen; getpid(2) is MP-safe.
 1.3 27-Jan-2001  thorpej Regen; add sy_flags.
 1.2 20-Jan-2001  manu Fix the "created from" field of files generated from syscalls.master (this
master file did not have a RCS Id at generation time, hence the problem)
 1.1 19-Jan-2001  manu Added powerpc specific code for Linux compatibility on powerpc ports
 1.4.4.10 11-Nov-2002  nathanw Catch up to -current
 1.4.4.9 20-Jun-2002  nathanw Catch up to -current.
 1.4.4.8 29-May-2002  nathanw Regen.
 1.4.4.7 17-Apr-2002  nathanw Catch up to -current.
 1.4.4.6 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.4.4.5 28-Feb-2002  nathanw Catch up to -current.
 1.4.4.4 14-Nov-2001  nathanw Catch up to -current.
 1.4.4.3 21-Sep-2001  nathanw Catch up to -current.
 1.4.4.2 21-Jun-2001  nathanw Catch up to -current.
 1.4.4.1 09-Apr-2001  nathanw Catch up with -current.
 1.4.2.3 21-Apr-2001  bouyer Sync with HEAD
 1.4.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.4.2.1 27-Jan-2001  bouyer file linux_sysent.c was added on branch thorpej_scsipi on 2001-02-11 19:13:55 +0000
 1.9.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.9.2.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.9.2.3 16-Mar-2002  jdolecek Catch up with -current.
 1.9.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.9.2.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.16.2.1 30-May-2002  gehenna Catch up with -current.
 1.17.2.3 14-Jun-2004  jmc Regen for changes in ticket #1708
 1.17.2.2 11-May-2004  tron Regen for ticket 1686.
 1.17.2.1 22-Oct-2003  jmc Regen files (requested by tv in ticket #1427)

Proper support for mmap2
 1.21.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.21.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.21.2.4 24-Sep-2004  skrll Sync with HEAD.
 1.21.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.21.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.21.2.1 03-Aug-2004  skrll Sync with HEAD
 1.26.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.26.4.1 29-Apr-2005  kent sync with -current
 1.30.2.5 21-Jan-2008  yamt sync with head
 1.30.2.4 07-Dec-2007  yamt sync with head
 1.30.2.3 26-Feb-2007  yamt sync with head.
 1.30.2.2 30-Dec-2006  yamt sync with head.
 1.30.2.1 21-Jun-2006  yamt sync with head.
 1.32.14.1 19-Jun-2006  chap Sync with head.
 1.32.8.2 03-Sep-2006  yamt sync with head.
 1.32.8.1 26-Jun-2006  yamt sync with head.
 1.32.4.1 09-Sep-2006  rpaulo sync with head
 1.35.2.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.36.26.2 27-Dec-2007  mjf Sync with HEAD.
 1.36.26.1 19-Nov-2007  mjf Sync with HEAD.
 1.36.24.1 18-Nov-2007  bouyer Sync with HEAD
 1.36.20.1 09-Jan-2008  matt sync with HEAD
 1.36.18.1 21-Nov-2007  joerg Sync with HEAD.
 1.37.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.37.2.1 26-Dec-2007  ad Sync with head.
 1.40.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.40.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.41.2.1 18-May-2008  yamt sync with head.
 1.42.12.1 20-Nov-2008  snj Regen for ticket 81.
 1.42.10.1 19-Jan-2009  skrll Sync with HEAD.
 1.42.8.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.42.4.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.42.4.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.42.2.4 11-Aug-2010  yamt sync with head.
 1.42.2.3 11-Mar-2010  yamt sync with head
 1.42.2.2 20-Jun-2009  yamt sync with head
 1.42.2.1 04-May-2009  yamt sync with head.
 1.47.2.1 23-Jul-2009  jym Sync with HEAD.
 1.50.4.4 12-Jun-2011  rmind sync with head
 1.50.4.3 31-May-2011  rmind sync with head
 1.50.4.2 21-Apr-2011  rmind sync with head
 1.50.4.1 05-Mar-2011  rmind sync with head
 1.50.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.51.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.55.4.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.55.4.2 30-Oct-2012  yamt sync with head
 1.55.4.1 17-Apr-2012  yamt sync with head
 1.56.10.4 03-Dec-2017  jdolecek update from HEAD
 1.56.10.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.56.10.2 23-Jun-2013  tls resync from head
 1.56.10.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.58.4.2 18-May-2014  rmind sync with head
 1.58.4.1 28-Aug-2013  rmind sync with head
 1.64.2.1 10-Aug-2014  tls Rebase.
 1.70.2.1 17-Apr-2017  snj regen for ticket 1354
 1.71.2.4 05-Feb-2017  skrll Sync with HEAD
 1.71.2.3 05-Oct-2016  skrll Sync with HEAD
 1.71.2.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.71.2.1 06-Apr-2015  skrll Sync with HEAD
 1.75.2.3 20-Mar-2017  pgoyette Sync with HEAD
 1.75.2.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.75.2.1 26-Jul-2016  pgoyette Sync with HEAD
 1.79.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.82.4.1 11-May-2017  pgoyette Sync with HEAD
 1.83.10.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.83.10.1 10-Jun-2019  christos Sync with HEAD
 1.83.8.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.86.2.2 17-Dec-2020  thorpej Regen for preadv(2) and pwritev(2).
 1.86.2.1 15-Dec-2020  thorpej Regen for eventfd, timerfd, POSIX timers.
 1.97.2.1 02-Aug-2025  perseant Sync with HEAD
 1.9 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.8 11-Dec-2005  christos branches: 1.8.70; 1.8.72; 1.8.74;
merge ktrace-lwp.
 1.7 26-Feb-2005  perry nuke trailing whitespace
 1.6 26-Aug-2001  manu branches: 1.6.20; 1.6.28; 1.6.30;
Fixed a lot of mistakes in #define's (hes values instead of octal)
 1.5 26-Aug-2001  manu Moved LINUX_NCCS from MI file to MD file, because the value is different
on MIPS and sparc machines.
 1.4 19-May-2001  manu branches: 1.4.2;
Fixed a typo in a comment
 1.3 20-Jan-2001  manu branches: 1.3.2; 1.3.4;
Fixed wrong ioctl definitions that caused Linux ioctl TCGETS and many other to
fail
 1.2 20-Jan-2001  manu Moved architecure dependent part of struct linux_termio to architecture
dependent header files.
 1.1 19-Jan-2001  manu Added various header files for initial Linux compatibility on powerpc ports
 1.3.4.2 21-Sep-2001  nathanw Catch up to -current.
 1.3.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.3.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.3.2.1 20-Jan-2001  bouyer file linux_termios.h was added on branch thorpej_scsipi on 2001-02-11 19:13:56 +0000
 1.4.2.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.6.30.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.6.28.1 29-Apr-2005  kent sync with -current
 1.6.20.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.8.74.1 16-May-2008  yamt sync with head.
 1.8.72.1 18-May-2008  yamt sync with head.
 1.8.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.8 11-Jan-2009  christos merge christos-time_t
 1.7 28-Apr-2008  martin branches: 1.7.8; 1.7.14;
Remove clause 3 and 4 from TNF licenses
 1.6 11-Dec-2005  christos branches: 1.6.70; 1.6.72; 1.6.74;
merge ktrace-lwp.
 1.5 26-Feb-2005  perry nuke trailing whitespace
 1.4 20-Sep-2004  jdolecek branches: 1.4.4; 1.4.6;
move definition of linux_fsid_t to common/linux_types.h - it's identical
across all Linux archs
 1.3 19-Sep-2004  jdolecek move definition of struct linux_stafs to common/linux_types.h, and use
explicit size types - the structure definition is actually identical
on currently support COMPAT_LINUX archs, so no point to have 6 copies of it
in the tree
 1.2 20-Jan-2001  manu branches: 1.2.2; 1.2.26;
Fixed a typo
 1.1 19-Jan-2001  manu Added various header files for initial Linux compatibility on powerpc ports
 1.2.26.2 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.2.26.1 24-Sep-2004  skrll Sync with HEAD.
 1.2.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.2.2.1 20-Jan-2001  bouyer file linux_types.h was added on branch thorpej_scsipi on 2001-02-11 19:13:56 +0000
 1.4.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.4.4.1 29-Apr-2005  kent sync with -current
 1.6.74.2 04-May-2009  yamt sync with head.
 1.6.74.1 16-May-2008  yamt sync with head.
 1.6.72.1 18-May-2008  yamt sync with head.
 1.6.70.2 17-Jan-2009  mjf Sync with HEAD.
 1.6.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.7.14.2 11-Jan-2009  christos add linux_suseconds_t
 1.7.14.1 28-Apr-2008  christos file linux_types.h was added on branch christos-time_t on 2009-01-11 00:17:51 +0000
 1.7.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.5 11-Dec-2005  christos merge ktrace-lwp.
 1.4 01-Aug-2004  jdolecek sync the syscall lists with Linux kernel 2.6.7
 1.3 01-Nov-2002  jdolecek branches: 1.3.6;
add appropriate nsysent
 1.2 30-Mar-2001  jdolecek Use linux_sys_nosys() instead sys_nosys() here too.
 1.1 30-Sep-1998  erh branches: 1.1.12; 1.1.24;
Stubs for future development of linux compat architechtures.
 1.1.24.2 11-Nov-2002  nathanw Catch up to -current
 1.1.24.1 09-Apr-2001  nathanw Catch up with -current.
 1.1.12.1 21-Apr-2001  bouyer Sync with HEAD
 1.3.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.6.1 03-Aug-2004  skrll Sync with HEAD
 1.88 01-Oct-2024  riastradh sys/compat/linux/arch/*/syscalls.master: Nix trailing whitespace.

No functional change intended.
 1.87 28-Sep-2024  christos Linux GSoC-2024: renameat2, clone3, sync_file_range, syncfs (Shivraj Jamgade)
 1.86 01-Jul-2024  christos Add linux POSIX message queue support (Ricardo Branco)
 1.85 29-Jun-2024  christos branches: 1.85.2;
From gsoc 2024: Implement faccessat2 and getcpu (Shivraz)
 1.84 19-Aug-2023  christos Add inotify* syscalls GSoC 2023 (Theodore Preduta)
 1.83 18-Aug-2023  christos Add linux waitid(2) from GSoC 2023 (Theodore Preduta)
 1.82 29-Jul-2023  christos Add/fix statx, readahead, close_range. From GSoC 2023 by Theodore Preduta
 1.81 28-Jul-2023  christos add epoll syscalls
 1.80 02-Dec-2021  ryo add prlimit64(2) syscall to COMPAT_LINUX and COMPAT_LINUX32
 1.79 24-Nov-2021  ryo add getrandom(2) syscall entry
 1.78 20-Sep-2021  thorpej Add preadv(2) and pwritev(2) system calls to COMPAT_LINUX and COMPAT_LINUX32.
 1.77 20-Sep-2021  thorpej Add the eventfd system calls to COMPAT_LINUX and COMPAT_LINUX32.
 1.76 19-Sep-2021  thorpej Add the timerfd syscalls to COMPAT_LINUX and COMPAT_LINUX32.
 1.75 19-Sep-2021  thorpej Add the POSIX timer syscalls (timer_create(), timer_settime(), timer_gettime(),
timer_getoverrun(), and timer_delete()) to COMPAT_LINUX and COMPAT_LINUX32.
 1.74 26-Apr-2020  thorpej branches: 1.74.2;
Add a NetBSD native futex implementation, mostly written by riastradh@.
Map the COMPAT_LINUX futex calls to the native ones.
 1.73 09-Nov-2019  jdolecek add dummy implementation of linux fallocate() which just returns EOPNOTSUPP;
this is needed so that glibc falls back to emulation and apps behaving
properly, since EOPNOTSUPP is a documented and expected return code, but
ENOSYS is not

right now there are no filesystems in NetBSD tree supporting the fallocate
VOP, so no point trying to map this to a native call

supposed to help with problem reported in
https://mail-index.netbsd.org/tech-kern/2019/11/03/msg025641.html
 1.72 03-Feb-2017  christos branches: 1.72.14;
add unimple sendmmsg secvmmsg
 1.71 03-Feb-2017  martin Add accept4
 1.70 02-Jan-2017  manu branches: 1.70.2;
Add pselect6 Linux system call.
This lets Matlab R2016A run on NetBSD/amd64
 1.69 24-Jul-2016  njoly Small cleanup. Adjust readlink/readlinkat signatures to reduce diffs with
native.
 1.68 27-Oct-2015  njoly branches: 1.68.2;
Fix wrong gid types from previous.
 1.67 25-Oct-2015  njoly Cleanup posix chown family syscalls to match native (alpha, mips and
powerpc).
 1.66 22-Nov-2014  njoly branches: 1.66.2;
Fix ppoll signature (int ->u_int)
 1.65 31-May-2014  njoly branches: 1.65.2;
Fix munmap(2) signature.
 1.64 29-May-2014  njoly For utimes(2), use compat_50_sys_utimes() instead of local version.
 1.63 20-May-2014  njoly Fix getgroups/setgroups signature.
 1.62 17-May-2014  njoly Fix fadvise64 syscalls to use 64bit offset types.
 1.61 06-May-2014  njoly Reduce diffs between archs; make mknod device argument unsigned.
 1.60 04-May-2014  njoly Fix pread/pwrite syscalls which need a 64bit offset argument.
 1.59 08-Apr-2014  njoly Adjust read/write/readv/writev signature to match native versions.
 1.58 10-Dec-2013  njoly branches: 1.58.2;
Add *at() syscalls like other arches.
 1.57 08-Dec-2013  njoly Sprinkle a few more linux_umode_t where appropriate.
Reduce diffs between archs.
 1.56 07-Nov-2013  njoly Fix dup/dup2/dup3 argument types (u_int -> int).
 1.55 24-Sep-2013  njoly Add utimensat(2) for compat linux.
 1.54 11-Aug-2013  pooka Linux treats the data parameter as a pointer/long too. The comments
in the sys/ptrace.h on Linux say it should be an int, but the code
glibc/musl/kernel disagrees.
 1.53 11-Aug-2013  pooka Use long instead of int for ptrace addr. This makes things compile
better on powerpc64 with a compiler which warns about int-to-pointer
casts.
XXX: sys/ptrace.h on Linux says that the addr parameter is a "void *".
 1.52 08-Apr-2013  pooka branches: 1.52.4;
support utimes on non-alpha linux platforms
 1.51 19-Sep-2012  pooka emulate ppoll which is essentially our pollts
 1.50 18-Nov-2011  christos branches: 1.50.10;
add sigtimedwait
 1.49 09-Jul-2011  christos branches: 1.49.2;
the first argument of {g,s}etitimer() is int not u_int.
 1.48 31-May-2011  njoly Small typo in fadvise64_64 args (advise -> advice).
 1.47 30-May-2011  alnsn Add fadvise64 and fadvise64_64 syscalls to compat_linux and compat_linux32.
 1.46 15-Apr-2011  he Add dup3() and pipe2() for these archs as well.
 1.45 07-Jul-2010  chs branches: 1.45.2;
many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
- support new-style (NPTL) linux pthreads on all platforms.
clone() with CLONE_THREAD uses 1 process with many LWPs
instead of separate processes.
- move the contents of sys__lwp_setprivate() into a new
lwp_setprivate() and use that everywhere.
- update linux_release[] and linux32_release[] to "2.6.18".
- adjust placement of emul fork/exec/exit hooks as needed
and adjust other emul code to match.
- convert all struct emul definitions to use named initializers.
- change the pid allocator to allow multiple pids to refer to the same proc.
- remove a few fields from struct proc that are no longer needed.
- disable the non-functional "vdso" code in linux32/amd64,
glibc works fine without it.
- fix a race in the futex code where we could miss a wakeup after
a requeue operation.
- redo futex locking to be a little more efficient.
 1.44 24-Nov-2009  njoly branches: 1.44.2; 1.44.4;
Update personality(2) to match Linux definition where the argument is an
unsigned long.
 1.43 08-Jun-2009  njoly Update rt_queueinfo(2) definition, and kill a corresponding comment.
 1.42 17-Jan-2009  njoly branches: 1.42.2;
Convert linux/linux32 wait(4) to use a compat50 rusage structure.
 1.41 15-Jan-2009  njoly Update some syscalls/arguments to use the new compat50 equivalents.
 1.40 13-Jan-2009  pooka Convert the syscalls.master to a format from which it is easier
to parse and generate the compat name and basename (e.g. __stat50
and stat). Use this to autogenerate __RENAME()'s to the rump_syscalls
header so that they can be called e.g. rump_sys_socket() instead
of rump_sys___socket30().
 1.39 19-Nov-2008  ad Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.38 12-Nov-2008  njoly Fix nanosleep(2) on 64-bit archs. Do not call native nanosleep
syscall, but rather a modified version the will take care of `struct
timespec' conversions.
 1.37 23-Apr-2008  ad branches: 1.37.2; 1.37.4; 1.37.8; 1.37.10; 1.37.12;
-SYCALL_MPSAFE
 1.36 04-Apr-2008  njoly branches: 1.36.2;
Cleanup. Kill linux_sys_msync and use sys___msync13 instead.
No functional changes expected.
 1.35 24-Dec-2007  njoly branches: 1.35.6;
Kill unneeded linux_sys_getpgid and use native sys_getpgid instead.
 1.34 21-Dec-2007  njoly - Fix setfsuid to return uid on success.
- Replace getfsuid, which never existed on Linux, by correct setfsgid
syscall.

ok by christos and dsl.
 1.33 20-Dec-2007  dsl Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.32 16-Nov-2007  njoly branches: 1.32.2; 1.32.6;
Cleanup. Remove a few linux syscalls definitions, now identical to
native ones (with stackgap and ALT_CHECK_xxx removal). No functional
changes expected.
 1.31 04-Mar-2007  christos branches: 1.31.14; 1.31.16; 1.31.20; 1.31.22;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.30 09-Feb-2007  ad branches: 1.30.2;
Merge newlock2 to head.
 1.29 01-Sep-2006  matt branches: 1.29.2;
Don't conditionalize *sys_ptrace. The lack of sys_ptrace will be dealt
with differently.
 1.28 30-Aug-2006  matt Update to deal with options PTRACE
 1.27 10-Jun-2006  christos linux getpriority is off-by-20 so use our own function.
From PR/33671: Nicolas Joly
 1.26 11-Dec-2005  christos branches: 1.26.4; 1.26.8; 1.26.14;
merge ktrace-lwp.
 1.25 18-Oct-2005  christos add the missing %% that confused joerg and the parser.
 1.24 18-Oct-2005  joerg sys_uselib is needed by COMPAT_LINUX for EXEC_AOUT. Since it doesn't get
build when EXEC_AOUT is not defined, the syscalls.master entry has to be
conditionalized. Alpha did so already, so let the other archs catch up
with it.

Go-on: christos
 1.23 16-May-2005  fvdl branches: 1.23.2;
Add clock_* POSIX functions.
 1.22 16-May-2005  fvdl Add *xattr functions (they all return EOPNOTSUPP).
 1.21 26-Feb-2005  perry nuke trailing whitespace
 1.20 20-Sep-2004  jdolecek branches: 1.20.4; 1.20.6;
implement support for Linux statfs64() syscall - 64bit variant of statfs()
 1.19 08-Sep-2004  jdolecek implement basic exit_group(2), which just terminates calling thread;
apparently not many apps use thread groups yet, at least not with default
SuSE 9.1 libraries, so this is enough for now
 1.18 01-Aug-2004  jdolecek sync the syscall lists with Linux kernel 2.6.7
 1.17 01-Aug-2004  jdolecek connect madvise(2) and mincore(2) - apparently the newer Linux libs
don't stub it anymore, so allow the application to take advantage
of them

the Linux calls appear to be compatible in the flag values and semantics,
so a wrapper is not necessary
 1.16 10-Aug-2003  jdolecek add Linux compat arg wrapper for ftruncate64(), and change linux compat
truncate64() wrapper to translate args structure
NetBSD truncate() and ftrucate() have hidden 'pad' argument, so we have
to do the argument translation

Problem found and patch supplied in PR kern/22360 by Ales Krenek

This is the last of syscalls with hidden 'pad' arg we didn't have
wrapper for; all the others (lseek, mmap, pwrite, pread) already had
wrapper before.
 1.15 23-Jun-2003  christos branches: 1.15.2;
PR/21937: Todd Vierling: Proper support for mmap2
 1.14 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.13 19-May-2002  jdolecek branches: 1.13.2;
hook in truncate64(2) and ftruncate64(2)
 1.12 12-May-2002  jdolecek branches: 1.12.2;
hook in remaining 64bit fs syscalls
make most of stuff in linux_file64.c available unconditionally,
with exception of fcntl64, which is not present on Linux m68k
 1.11 10-Apr-2002  christos add getdents64
 1.10 22-Mar-2002  christos nuke mmap2, add mprotect
 1.9 19-Feb-2002  nathanw Add linux_sys_{get,set}rlimit.
 1.8 15-Feb-2002  christos - add a real linux_sys___sysctl because the mib numbers are different.
implement only the kernel version getting entries.
- make the signal conversion functions consistent; dest is arg 1.
- make linux_fakedev deal with block and char devices differently.
- add linux_sys_ugetrlimit, and flesh out the regular get/setrlimit so
that they work properly.
- add linux_mmap2 [untested].
- bump kernel to 2.4.18, and make the date be valentine's day :-)
- linux_sys_*stat64 family was totally busted. Fix it.

tested only on i386.

Status:
gdb, telnet, work
jdk-1.4.0 extractor works, jdk still coredumps.

christos
 1.7 08-Sep-2001  manu Removed a hack to make PowerPC mmap work. This could have side effects on
alpha and i386. It has been tested and works on i386.
 1.6 30-May-2001  mrg branches: 1.6.2; 1.6.4;
use _KERNEL_OPT.
 1.5 13-May-2001  manu Improved the accuracy of gettimeofday/settimeofday: Linux stores a srtuct
timezone in the kernel. We now keep track of it for emulated processes.
Tested for powerpc and i386. Untested on m68k, but it should be ok
Alpha has a particular implementation (osf1_sys_gettimeofday), and it has
therefore not been touched.
 1.4 30-Mar-2001  jdolecek Add new syscalls from Linux 2.4.3 to the lists. Not implemented ATM.
 1.3 30-Mar-2001  jdolecek Implement linux_sys_nosys() and use it instead of sys_nosys() for
unimplemented syscalls. Difference is that linux_sys_nosys() doesn't
post SIGSYS to the process. Linux doesn't do that and thus glibc (and
probably other Linux code) doesn't deal with SIGSYS, even through it
generally contains fallback code for ENOSYS case.

This also addresses port-i386/12503, though the issue was already discussed
earlier.
 1.2 27-Jan-2001  thorpej branches: 1.2.2; 1.2.4;
getpid(2) is MP-safe.
 1.1 19-Jan-2001  manu Added various header files for initial Linux compatibility on powerpc ports
 1.2.4.8 20-Jun-2002  nathanw Catch up to -current.
 1.2.4.7 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.2.4.6 17-Apr-2002  nathanw Catch up to -current.
 1.2.4.5 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.2.4.4 28-Feb-2002  nathanw Catch up to -current.
 1.2.4.3 21-Sep-2001  nathanw Catch up to -current.
 1.2.4.2 21-Jun-2001  nathanw Catch up to -current.
 1.2.4.1 09-Apr-2001  nathanw Catch up with -current.
 1.2.2.3 21-Apr-2001  bouyer Sync with HEAD
 1.2.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.2.2.1 27-Jan-2001  bouyer file syscalls.master was added on branch thorpej_scsipi on 2001-02-11 19:13:56 +0000
 1.6.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.6.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.6.2.2 16-Mar-2002  jdolecek Catch up with -current.
 1.6.2.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.12.2.1 30-May-2002  gehenna Catch up with -current.
 1.13.2.3 14-Jun-2004  jmc Pullup patch (requested by skrll in ticket #1708)

Bring netbsd-1-6 inline with -current sources after the mistakes in ticket #1686
 1.13.2.2 11-May-2004  tron Pull up revision 1.16 via patch (requested by wennmach in ticket #1686):
add Linux compat arg wrapper for ftruncate64(), and change linux compat
truncate64() wrapper to translate args structure
NetBSD truncate() and ftrucate() have hidden 'pad' argument, so we have
to do the argument translation
Problem found and patch supplied in PR kern/22360 by Ales Krenek
This is the last of syscalls with hidden 'pad' arg we didn't have
wrapper for; all the others (lseek, mmap, pwrite, pread) already had
wrapper before.
 1.13.2.1 22-Oct-2003  jmc Regen files (requested by tv in ticket #1427)

Proper support for mmap2
 1.15.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.15.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.15.2.4 24-Sep-2004  skrll Sync with HEAD.
 1.15.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.15.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.15.2.1 03-Aug-2004  skrll Sync with HEAD
 1.20.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.20.4.1 29-Apr-2005  kent sync with -current
 1.23.2.5 21-Jan-2008  yamt sync with head
 1.23.2.4 07-Dec-2007  yamt sync with head
 1.23.2.3 03-Sep-2007  yamt sync with head.
 1.23.2.2 26-Feb-2007  yamt sync with head.
 1.23.2.1 21-Jun-2006  yamt sync with head.
 1.26.14.1 19-Jun-2006  chap Sync with head.
 1.26.8.1 26-Jun-2006  yamt sync with head.
 1.26.4.1 09-Sep-2006  rpaulo sync with head
 1.29.2.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.30.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.31.22.2 27-Dec-2007  mjf Sync with HEAD.
 1.31.22.1 19-Nov-2007  mjf Sync with HEAD.
 1.31.20.1 18-Nov-2007  bouyer Sync with HEAD
 1.31.16.1 09-Jan-2008  matt sync with HEAD
 1.31.14.1 21-Nov-2007  joerg Sync with HEAD.
 1.32.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.32.2.1 26-Dec-2007  ad Sync with head.
 1.35.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.35.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.36.2.1 18-May-2008  yamt sync with head.
 1.37.12.1 20-Nov-2008  snj Pull up following revision(s) (requested by njoly in ticket #81):
sys/compat/linux/arch/mips/syscalls.master: revision 1.30
sys/compat/linux/arch/m68k/syscalls.master: revision 1.63
sys/compat/linux32/arch/amd64/syscalls.master: revision 1.39
sys/compat/linux/arch/alpha/syscalls.master: revision 1.63
sys/compat/linux/arch/powerpc/syscalls.master: revision 1.38
sys/compat/linux32/common/linux32_time.c: revision 1.22
sys/compat/linux/arch/amd64/syscalls.master: revision 1.25
sys/compat/linux/arch/i386/syscalls.master: revision 1.94
sys/compat/linux/arch/arm/syscalls.master: revision 1.36
sys/compat/linux/common/linux_time.c: revision 1.26
Fix nanosleep(2) on 64-bit archs. Do not call native nanosleep
syscall, but rather a modified version the will take care of `struct
timespec' conversions.
 1.37.10.1 19-Jan-2009  skrll Sync with HEAD.
 1.37.8.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.37.4.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.37.4.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.37.2.4 11-Aug-2010  yamt sync with head.
 1.37.2.3 11-Mar-2010  yamt sync with head
 1.37.2.2 20-Jun-2009  yamt sync with head
 1.37.2.1 04-May-2009  yamt sync with head.
 1.42.2.1 23-Jul-2009  jym Sync with HEAD.
 1.44.4.4 12-Jun-2011  rmind sync with head
 1.44.4.3 31-May-2011  rmind sync with head
 1.44.4.2 21-Apr-2011  rmind sync with head
 1.44.4.1 05-Mar-2011  rmind sync with head
 1.44.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.45.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.49.2.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.49.2.2 30-Oct-2012  yamt sync with head
 1.49.2.1 17-Apr-2012  yamt sync with head
 1.50.10.4 03-Dec-2017  jdolecek update from HEAD
 1.50.10.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.50.10.2 23-Jun-2013  tls resync from head
 1.50.10.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.52.4.2 18-May-2014  rmind sync with head
 1.52.4.1 28-Aug-2013  rmind sync with head
 1.58.2.1 10-Aug-2014  tls Rebase.
 1.65.2.1 17-Apr-2017  snj Pull up following revision(s) (requested by manu in ticket #1354):
sys/compat/linux/arch/alpha/syscalls.master: revision 1.92 via patch
sys/compat/linux/arch/amd64/syscalls.master: revision 1.58 via patch
sys/compat/linux/arch/arm/syscalls.master: revision 1.65 via patch
sys/compat/linux/arch/i386/syscalls.master: revision 1.122 via patch
sys/compat/linux/arch/m68k/syscalls.master: revision 1.91 via patch
sys/compat/linux/arch/mips/syscalls.master: revision 1.61 via patch
sys/compat/linux/arch/powerpc/syscalls.master: revision 1.70 via patch
sys/compat/linux/common/linux_misc.c: revision 1.234
sys/compat/linux/common/linux_signal.h: revision 1.31
Add pselect6 Linux system call.
This lets Matlab R2016A run on NetBSD/amd64
 1.66.2.3 05-Feb-2017  skrll Sync with HEAD
 1.66.2.2 05-Oct-2016  skrll Sync with HEAD
 1.66.2.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.68.2.3 20-Mar-2017  pgoyette Sync with HEAD
 1.68.2.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.68.2.1 26-Jul-2016  pgoyette Sync with HEAD
 1.70.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.72.14.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.74.2.2 17-Dec-2020  thorpej Add suppport for Linux preadv(2) and pwritev(2). Same as native, except
for the silly way that the offset argument is passed in.
 1.74.2.1 15-Dec-2020  thorpej Add Linux eventfd, timerfd, and POSIX timer calls.
 1.85.2.1 02-Aug-2025  perseant Sync with HEAD
 1.4 29-May-2024  christos should not be using .include <> but .include "" here.
 1.3 08-Apr-2014  njoly Do not include bsd.kinc.mk in each arch Makefile, it's already pulled
by bsd.syscall.mk (from Makefile.inc).
 1.2 03-Oct-1998  christos branches: 1.2.184; 1.2.194; 1.2.200; 1.2.210;
Attempt to fix the mess.
 1.1 30-Sep-1998  erh Stubs for future development of linux compat architechtures.
 1.2.210.1 10-Aug-2014  tls Rebase.
 1.2.200.1 18-May-2014  rmind sync with head
 1.2.194.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.184.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.5 14-Mar-2015  njoly Support Linux MAP_LOCKED mmap flag.
 1.4 28-Apr-2008  martin branches: 1.4.44; 1.4.64;
Remove clause 3 and 4 from TNF licenses
 1.3 11-Dec-2005  christos branches: 1.3.70; 1.3.72; 1.3.74;
merge ktrace-lwp.
 1.2 28-Aug-2004  jdolecek g/c LINUX_MAP_IGNMASK define - it's not used anywhere
 1.1 30-Sep-1998  erh branches: 1.1.46;
Stubs for future development of linux compat architechtures.
 1.1.46.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.46.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.46.1 03-Sep-2004  skrll Sync with HEAD
 1.3.74.1 16-May-2008  yamt sync with head.
 1.3.72.1 18-May-2008  yamt sync with head.
 1.3.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.4.64.1 06-Apr-2015  skrll Sync with HEAD
 1.4.44.1 03-Dec-2017  jdolecek update from HEAD
 1.2 01-Nov-2002  jdolecek add appropriate sys_nosys and nsysent (not that it matters here too much)
 1.1 30-Sep-1998  erh branches: 1.1.24;
Stubs for future development of linux compat architechtures.
 1.1.24.1 11-Nov-2002  nathanw Catch up to -current
 1.4 29-May-2024  christos should not be using .include <> but .include "" here.
 1.3 08-Apr-2014  njoly Do not include bsd.kinc.mk in each arch Makefile, it's already pulled
by bsd.syscall.mk (from Makefile.inc).
 1.2 03-Oct-1998  christos branches: 1.2.184; 1.2.194; 1.2.200; 1.2.210;
Attempt to fix the mess.
 1.1 30-Sep-1998  erh Stubs for future development of linux compat architechtures.
 1.2.210.1 10-Aug-2014  tls Rebase.
 1.2.200.1 18-May-2014  rmind sync with head
 1.2.194.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.184.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.2 01-Nov-2002  jdolecek add appropriate sys_nosys and nsysent (not that it matters here too much)
 1.1 30-Sep-1998  erh branches: 1.1.24;
Stubs for future development of linux compat architechtures.
 1.1.24.1 11-Nov-2002  nathanw Catch up to -current
 1.2 02-Nov-1999  erh undo confusion.
 1.1 01-Oct-1998  erh branches: 1.1.12; 1.1.14; 1.1.16;
New makefiles for includes, syscall gen.
 1.1.16.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.1.14.1 15-Nov-1999  fvdl Sync with -current
 1.1.12.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck, and commit Makefile which
I forgot in the batch of commits.
 1.18 08-Dec-2015  christos Replace DIOCGPART -> DIOCGPARTINFO which returns the data needed instead of
pointers.
 1.17 21-Mar-2008  ad branches: 1.17.6; 1.17.48; 1.17.68;
Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
 1.16 20-Dec-2007  dsl branches: 1.16.6;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.15 19-Oct-2007  njoly branches: 1.15.4; 1.15.8;
Add compat_linux and exec_linux_elf lkm support for amd64:
- Add needed COMPAT_OSSAUDIO to GENERIC.
- Add missing includes needed by linux_syscallargs.h.
- Add lkm building.
 1.14 04-Mar-2007  christos branches: 1.14.14; 1.14.16; 1.14.20;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.13 09-Feb-2007  ad branches: 1.13.2;
Merge newlock2 to head.
 1.12 16-Nov-2006  christos __unused removal on arguments; approved by core.
 1.11 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.10 11-Dec-2005  christos branches: 1.10.20; 1.10.22;
merge ktrace-lwp.
 1.9 29-Jun-2003  fvdl branches: 1.9.2; 1.9.18;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.8 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.7 21-Mar-2003  dsl Change 'data' argument to fo_ioctl and fo_fcntl from 'caddr_t' to 'void *'.
Avoids a lot of casting and removes the need for some line breaks.
Removed a load of (caddr_t) casts from calls to copyin/copyout as well.
(approved by christos - he has a plan to remove caddr_t...)
 1.6 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.5 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.4 14-Jun-2001  thorpej branches: 1.4.2;
Fix a partial construction problem that can cause race conditions
between creation of a file descriptor and close(2) when using kernel
assisted threads. What we do is stick descriptors in the table, but
mark them as "larval". This causes essentially everything to treat
it as a non-existent descriptor, except for fdalloc(), which sees a
filled slot so that it won't (incorrectly) allocate it again. When
a descriptor is fully constructed, the code that has constructed it
marks it as "mature" (which actually clears the "larval" flag), and
things continue to work as normal.

While here, gather all the code that gets a descriptor from the table
into a fd_getfile() function, and call it, rather than having the
same (sometimes incorrect) code copied all over the place.
 1.3 18-Jan-2001  tv branches: 1.3.2; 1.3.4;
No-op commit to force update to a non-"-kk" revision.
 1.2 10-Jan-2001  fvdl branches: 1.2.2;
Correct copyright year.
 1.1 10-Jan-2001  fvdl Add some BLK* ioctl calls. Currently only the easy and useful ones
are implemented.
 1.2.2.2 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.2.2.1 10-Jan-2001  bouyer file linux_blkio.c was added on branch thorpej_scsipi on 2001-01-18 09:23:13 +0000
 1.3.4.2 30-Mar-2001  he Pull up revisions 1.1-1.3 (new, requested by fvdl):
Add some required Linux emulation bits to support the Linux
version of VMware.
 1.3.4.1 18-Jan-2001  he file linux_blkio.c was added on branch netbsd-1-5 on 2001-03-30 21:36:59 +0000
 1.3.2.3 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.3.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.3.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.4.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.9.18.7 24-Mar-2008  yamt sync with head.
 1.9.18.6 21-Jan-2008  yamt sync with head
 1.9.18.5 27-Oct-2007  yamt sync with head.
 1.9.18.4 03-Sep-2007  yamt sync with head.
 1.9.18.3 26-Feb-2007  yamt sync with head.
 1.9.18.2 30-Dec-2006  yamt sync with head.
 1.9.18.1 21-Jun-2006  yamt sync with head.
 1.9.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.9.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.9.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.10.22.2 10-Dec-2006  yamt sync with head.
 1.10.22.1 22-Oct-2006  yamt sync with head
 1.10.20.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.10.20.1 18-Nov-2006  ad Sync with head.
 1.13.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.14.20.1 25-Oct-2007  bouyer Sync with HEAD.
 1.14.16.2 09-Jan-2008  matt sync with HEAD
 1.14.16.1 06-Nov-2007  matt sync with HEAD
 1.14.14.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.15.8.1 02-Jan-2008  bouyer Sync with HEAD
 1.15.4.1 26-Dec-2007  ad Sync with head.
 1.16.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.17.68.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.17.48.1 03-Dec-2017  jdolecek update from HEAD
 1.17.6.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.17.6.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.2 18-Jan-2001  tv branches: 1.2.4;
No-op commit to force update to a non-"-kk" revision.
 1.1 10-Jan-2001  fvdl branches: 1.1.2;
Add some BLK* ioctl calls. Currently only the easy and useful ones
are implemented.
 1.1.2.2 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.1.2.1 10-Jan-2001  bouyer file linux_blkio.h was added on branch thorpej_scsipi on 2001-01-18 09:23:13 +0000
 1.2.4.2 30-Mar-2001  he Pull up revisions 1.1-1.2 (new, requested by fvdl):
Add some required Linux emulation bits to support the Linux
version of VMware.
 1.2.4.1 18-Jan-2001  he file linux_blkio.h was added on branch netbsd-1-5 on 2001-03-30 21:37:26 +0000
 1.57 23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.56 28-Apr-2008  martin branches: 1.56.2;
Remove clause 3 and 4 from TNF licenses
 1.55 20-Dec-2007  dsl branches: 1.55.6; 1.55.8; 1.55.10;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.54 09-Feb-2007  ad branches: 1.54.20; 1.54.28; 1.54.32;
Merge newlock2 to head.
 1.53 16-Nov-2006  christos __unused removal on arguments; approved by core.
 1.52 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.51 18-Jan-2003  thorpej branches: 1.51.18; 1.51.48; 1.51.50;
Merge the nathanw_sa branch.
 1.50 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.49 04-Oct-1998  fvdl branches: 1.49.24; 1.49.26;
Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.48 03-Oct-1998  christos Attempt to fix the mess.
 1.47 01-Oct-1998  erh Wheeee!: 8-way split of compat/linux/linux_misc.c into common code and multi-architechture functions.
 1.46 11-Sep-1998  mycroft Substantial signal handling changes:
* Increase the size of sigset_t to accomodate 128 signals -- adding new
versions of sys_setprocmask(), sys_sigaction(), sys_sigpending() and
sys_sigsuspend() to handle the changed arguments.
* Abstract the guts of sys_sigaltstack(), sys_setprocmask(), sys_sigaction(),
sys_sigpending() and sys_sigsuspend() into separate functions, and call them
from all the emulations rather than hard-coding everything. (Avoids uses
the stackgap crap for these system calls.)
* Add a new flag (p_checksig) to indicate that a process may have signals
pending and userret() needs to do the full (slow) check.
* Eliminate SAS_ALTSTACK; it's exactly the inverse of SS_DISABLE.
* Correct emulation bugs with restoring SS_ONSTACK.
* Make the signal mask in the sigcontext always use the emulated mask format.
* Store signals internally in sigaction structures, rather than maintaining a
bunch of little sigsets for each SA_* bit.
* Keep track of where we put the signal trampoline, rather than figuring it out
in *_sendsig().
* Issue a warning when a non-emulated sigaction bit is observed.
* Add missing emulated signals, and a native SIGPWR (currently not used).
* Implement the `not reset when caught' semantics for relevant signals.

Note: Only code touched by the i386 port has been modified. Other ports and
emulations need to be updated.
 1.45 08-Sep-1998  rvb ufs_readdir no longer checks if vp->v_type != VDIR so
the individual emulated readdirs must check.
Since netbsd and freebsd return EINVAL for the error
and I don't know what the other platforms do, return
EINVAL for them too.
 1.44 18-Aug-1998  thorpej Add some braces to make egcs happy.
 1.43 07-Jul-1998  thorpej Oops, fix typo, pointed out by Urban Boquist <boquist@cs.chalmers.se>.
 1.42 02-Jul-1998  thorpej Implement the shrinking and no-change bits of the Linux mremap(2) system
call, provided by Urban Boquist <boquist@cs.chalmers.se> in PR #5693.

Add a comment about how one might implement the growing bit of mremap(2).
 1.41 24-Mar-1998  mycroft Fix typo in utime().
 1.40 03-Mar-1998  fvdl Only free cookiebuf when sure that the vop actually allocated it.
 1.39 01-Mar-1998  fvdl Merge with Lite2 + local changes
 1.38 20-Feb-1998  mycroft Linux's getsid(2) does in fact return a pid, not a pointer.
 1.37 14-Feb-1998  thorpej Add a comment clearly describing that Linux's getsid(2) differs from
the XPG4.2 definition in that it returns the kernel virtual address
of the session structure, rather than the process group ID of the
session leader.
 1.36 21-Oct-1997  fvdl branches: 1.36.2;
msync -> __msync13
 1.35 10-Oct-1997  fvdl Fix braino in my interpretation of the eof flag to VOP_READDIR.
 1.34 10-Oct-1997  mycroft Emulate mremap(2) by returning ENOMEM for now. This should be sufficient for
realloc(3) and other uses. From Matthias Scheler in PR 3920.
 1.33 10-Oct-1997  fvdl Signal error when getting a 64 bit offset cookie that can't be stored
in 32 bits. Provide an error message to the user, and return EINVAL.
Also, pay attention to the EOF flag from VOP_READDIR. Correct a
misspell in a panic message.
 1.32 04-Aug-1997  bouyer Fix "missing entries" bug when reading large directories: When reading a
directory and running out of space in the dest buffer, off should point to the
current entry (which was not saved) and not to the next.
I discovered this bug using linux and SunOS emulation over NFS, but seems to
affect other emulations as well.
 1.31 27-Jul-1997  augustss branches: 1.31.2;
Changes to the sudio system:
- It is now possible to handle devices that want "looping" DMA,
e.g. the SoundBlaster correctly. The WSS and SB drivers use this.
To do this several new methods were introduced in audio_hw_if.
- Different silence handling (forced by previous change).
- The audio driver can now be mmap()-ed, but due to problems in
the VM system only for writing for now.
- The OSS (Linux) audio emulation takes advantage of some of the
new features.
 1.30 07-Apr-1997  augustss Add Linux nice() syscall.
 1.29 10-Aug-1996  mycroft sys/dir.h -> sys/dirent.h
 1.28 23-Jun-1996  mycroft Catch up with setre[ug]id() changes.
 1.27 20-May-1996  fvdl branches: 1.27.4;
Update list of Linux syscalls and implement the ones that are likely to be
used and doable.
 1.26 04-Apr-1996  christos - Prototyping changes
- Fix bug that gcc -Wall found in linux_sys_getpgid()
 1.25 03-Apr-1996  mycroft Add explicit return types.
 1.24 18-Dec-1995  fvdl msync, readv and writev were recently added to the Linux kernel; add them
to the emulation as well.
 1.23 09-Dec-1995  mycroft We don't need a private version of fork() here any more.
 1.22 09-Oct-1995  mycroft Use cookies for directory offset, mostly from Greg Hudson.
 1.21 07-Oct-1995  mycroft Prefix names of system call implementation functions with `sys_'.
 1.20 19-Sep-1995  thorpej Make system calls conform to a standard prototype and bring those
prototypes into scope.
 1.19 13-Sep-1995  fvdl Update offset elsewhere in linux_getdents(); still emulate a bug in
Linux, but avoid endless loops.
 1.18 07-Sep-1995  fvdl Fix some bugs & typing problems.
 1.17 23-Aug-1995  fvdl Emulate some syscalls that appear in Linux 1.3: a select() with normal args,
getdents() and flock().
 1.16 21-Aug-1995  fvdl Check for status NULL argument in wait4 and waitpid. From PR #1392
by Thomas EberHardt.
 1.15 21-Aug-1995  mycroft Implement the old and older uname(2) calls.
 1.14 16-Aug-1995  mycroft If updating the timeval would make it negative, zero it instead.
 1.13 16-Aug-1995  mycroft Allow bogus timevals, per Linux.
 1.12 14-Aug-1995  mycroft Export bsd_to_linux_sig[], and use it.
 1.11 14-Aug-1995  mycroft Rearrange #includes.
 1.10 13-Aug-1995  mycroft Linux doesn't allow select(2) to be restarted.
 1.9 24-Jun-1995  christos Use compat_util.[ch].
 1.8 22-Jun-1995  fvdl * Changed to use generic ELF code from kern/exec_elf.c (which was taken
from the svr4 exec code plus the linux compat mods)
* Include file change
* Add multicast sockopts (from John Brezak)
 1.7 11-Jun-1995  fvdl Linux select() returns the amount of time left before a timeout would have
occured in the timeval structure. Emulate this behavior. Reported by
Theo de Raadt.
 1.6 11-Jun-1995  fvdl * Make Linux ELF binaries work. Lots of code duplication, but it will have to do
for now.
* Add a sanity check in linux_uselib
 1.5 10-Jun-1995  mycroft Rename the dirent fields to match Linux. Make sure the requested buffer
is no larger than MAXBSIZE.
 1.4 22-Mar-1995  mycroft Emulate the return value of times() better.
 1.3 21-Mar-1995  mycroft Update to use timer{add,sub}().
 1.2 05-Mar-1995  fvdl Added a few more system calls.
More consistent alternate root file semantics throughout.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.27.4.2 10-Dec-1996  mycroft From trunk:
sys/dir.h -> sys/dirent.h
 1.27.4.1 10-Dec-1996  mycroft From trunk:
Implement setre[ug]id() for real.
 1.31.2.2 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.31.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.36.2.1 08-May-1998  mycroft Pull up 1.41, per request of mycroft.
 1.49.26.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.49.24.3 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.49.24.2 14-Nov-2001  nathanw Catch up to -current.
 1.49.24.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.51.50.2 10-Dec-2006  yamt sync with head.
 1.51.50.1 22-Oct-2006  yamt sync with head
 1.51.48.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.51.48.1 18-Nov-2006  ad Sync with head.
 1.51.18.3 21-Jan-2008  yamt sync with head
 1.51.18.2 26-Feb-2007  yamt sync with head.
 1.51.18.1 30-Dec-2006  yamt sync with head.
 1.54.32.1 02-Jan-2008  bouyer Sync with HEAD
 1.54.28.1 26-Dec-2007  ad Sync with head.
 1.54.20.1 09-Jan-2008  matt sync with HEAD
 1.55.10.1 16-May-2008  yamt sync with head.
 1.55.8.1 18-May-2008  yamt sync with head.
 1.55.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.56.2.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.56.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.29 01-Oct-2024  riastradh sys/compat/linux/common: Nix trailing whitespace, and one blank line.

No functional change intended.
 1.28 07-Sep-2021  riastradh branches: 1.28.10;
sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.27 28-Apr-2008  martin branches: 1.27.2; 1.27.80; 1.27.92;
Remove clause 3 and 4 from TNF licenses
 1.26 21-Mar-2008  ad branches: 1.26.2; 1.26.4;
Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
 1.25 20-Dec-2007  dsl branches: 1.25.6;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.24 19-Oct-2007  njoly branches: 1.24.4; 1.24.8;
Add compat_linux and exec_linux_elf lkm support for amd64:
- Add needed COMPAT_OSSAUDIO to GENERIC.
- Add missing includes needed by linux_syscallargs.h.
- Add lkm building.
 1.23 30-Jun-2007  dsl branches: 1.23.6; 1.23.8; 1.23.12;
Use the new CDIOCREADSUBCHANNEL_BUF and CDIOREADTOCENTRIES_BUF ioctls to
avoid copying into the stackgap.
 1.22 04-Mar-2007  christos branches: 1.22.2; 1.22.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.21 09-Feb-2007  ad branches: 1.21.2;
Merge newlock2 to head.
 1.20 12-Jun-2006  christos branches: 1.20.6;
don't allocate a crapload of struct's on the stack. Use a couple of unions
and use malloc for them.
 1.19 11-Dec-2005  christos branches: 1.19.4; 1.19.8; 1.19.14;
merge ktrace-lwp.
 1.18 26-Feb-2005  perry branches: 1.18.4;
nuke trailing whitespace
 1.17 29-Jun-2003  fvdl branches: 1.17.2; 1.17.10; 1.17.12;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.16 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.15 21-Mar-2003  dsl Change 'data' argument to fo_ioctl and fo_fcntl from 'caddr_t' to 'void *'.
Avoids a lot of casting and removes the need for some line breaks.
Removed a load of (caddr_t) casts from calls to copyin/copyout as well.
(approved by christos - he has a plan to remove caddr_t...)
 1.14 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.13 22-Mar-2002  christos gc debugging printfs.
 1.12 16-Mar-2002  christos make the stackgap_{init,alloc} functions MP friendly (i.e. pass struct proc *
in, instead of using curproc). While there add an optional size argument to
stackgap_init.
 1.11 15-Feb-2002  christos s/printf/uprintf/
 1.10 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.9 14-Jun-2001  thorpej branches: 1.9.2;
Fix a partial construction problem that can cause race conditions
between creation of a file descriptor and close(2) when using kernel
assisted threads. What we do is stick descriptors in the table, but
mark them as "larval". This causes essentially everything to treat
it as a non-existent descriptor, except for fdalloc(), which sees a
filled slot so that it won't (incorrectly) allocate it again. When
a descriptor is fully constructed, the code that has constructed it
marks it as "mature" (which actually clears the "larval" flag), and
things continue to work as normal.

While here, gather all the code that gets a descriptor from the table
into a fd_getfile() function, and call it, rather than having the
same (sometimes incorrect) code copied all over the place.
 1.8 03-Feb-2001  fvdl branches: 1.8.2;
Oops, remove debugging printf.
 1.7 03-Feb-2001  fvdl For the read subchannel ioctl, don't mix up the data and address formats,
and always set the track to 0, like Linux does.
 1.6 10-Dec-2000  fvdl Add some ioctls for harddisk, floppy disk and console handling.
Implement a few extra cdrom ioctl calls.
Make sure to correctly use FILE_USE and FILE_UNUSE.
 1.5 29-Oct-1999  mycroft branches: 1.5.6;
Emulate the Linux DVD_* ioctls(2). This gets us 90% of the way to running the
LiViD DVD player. (See forthcoming mail to current-users.)
XXX NOTE: We should do something to probe capabilities, rather than allowing
these ioctls on any device.
 1.4 03-Oct-1998  christos branches: 1.4.12; 1.4.14; 1.4.16;
Remove stray debugging printfs
 1.3 03-Oct-1998  christos Attempt to fix the mess.
 1.2 01-Oct-1998  erh Moved compat/linux/linux_cdrom to common.
 1.1 15-Jan-1998  christos PR/4794: Urban Boquist: Linux cdrom ioctls are missing
 1.4.16.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.4.14.1 15-Nov-1999  fvdl Sync with -current
 1.4.12.3 11-Feb-2001  bouyer Sync with HEAD.
 1.4.12.2 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.4.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.5.6.1 30-Mar-2001  he Pull up revisions 1.6-1.8 (requested by fvdl):
Add some required Linux emulation bits to support the Linux
version of VMware.
 1.8.2.5 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.8.2.4 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.8.2.3 28-Feb-2002  nathanw Catch up to -current.
 1.8.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.8.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.9.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.9.2.2 16-Mar-2002  jdolecek Catch up with -current.
 1.9.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.17.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.17.10.1 29-Apr-2005  kent sync with -current
 1.17.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.17.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.17.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.17.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.18.4.6 24-Mar-2008  yamt sync with head.
 1.18.4.5 21-Jan-2008  yamt sync with head
 1.18.4.4 27-Oct-2007  yamt sync with head.
 1.18.4.3 03-Sep-2007  yamt sync with head.
 1.18.4.2 26-Feb-2007  yamt sync with head.
 1.18.4.1 21-Jun-2006  yamt sync with head.
 1.19.14.1 19-Jun-2006  chap Sync with head.
 1.19.8.1 26-Jun-2006  yamt sync with head.
 1.19.4.1 09-Sep-2006  rpaulo sync with head
 1.20.6.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.21.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.22.4.1 11-Jul-2007  mjf Sync with head.
 1.22.2.1 15-Jul-2007  ad Sync with head.
 1.23.12.1 25-Oct-2007  bouyer Sync with HEAD.
 1.23.8.2 09-Jan-2008  matt sync with HEAD
 1.23.8.1 06-Nov-2007  matt sync with HEAD
 1.23.6.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.24.8.1 02-Jan-2008  bouyer Sync with HEAD
 1.24.4.1 26-Dec-2007  ad Sync with head.
 1.25.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.25.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.26.4.1 16-May-2008  yamt sync with head.
 1.26.2.1 18-May-2008  yamt sync with head.
 1.27.92.1 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.27.80.1 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1836):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.27.2.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.27.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.28.10.1 02-Aug-2025  perseant Sync with HEAD
 1.8 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.7 11-Dec-2005  christos branches: 1.7.70; 1.7.72; 1.7.74;
merge ktrace-lwp.
 1.6 26-Feb-2005  perry nuke trailing whitespace
 1.5 10-Dec-2000  fvdl branches: 1.5.24; 1.5.32; 1.5.34;
Add some ioctls for harddisk, floppy disk and console handling.
Implement a few extra cdrom ioctl calls.
Make sure to correctly use FILE_USE and FILE_UNUSE.
 1.4 29-Oct-1999  mycroft branches: 1.4.6;
Emulate the Linux DVD_* ioctls(2). This gets us 90% of the way to running the
LiViD DVD player. (See forthcoming mail to current-users.)
XXX NOTE: We should do something to probe capabilities, rather than allowing
these ioctls on any device.
 1.3 03-Oct-1998  christos branches: 1.3.12; 1.3.14; 1.3.16;
Attempt to fix the mess.
 1.2 01-Oct-1998  erh Moved compat/linux/linux_cdrom to common.
 1.1 15-Jan-1998  christos PR/4794: Urban Boquist: Linux cdrom ioctls are missing
 1.3.16.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.3.14.1 15-Nov-1999  fvdl Sync with -current
 1.3.12.2 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.3.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.4.6.1 30-Mar-2001  he Pull up revision 1.5 (requested by fvdl):
Add some required Linux emulation bits to support the Linux
version of VMware.
 1.5.34.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.5.32.1 29-Apr-2005  kent sync with -current
 1.5.24.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.7.74.1 16-May-2008  yamt sync with head.
 1.7.72.1 18-May-2008  yamt sync with head.
 1.7.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.12 11-Sep-2010  chs recent versions of linux (which we now claim to be) supply a BSD-style
d_type value in getdents() results, after the d_name field.
make our emulation do the same. fixes part of PR 43695.
 1.11 28-Apr-2008  martin branches: 1.11.20; 1.11.22;
Remove clause 3 and 4 from TNF licenses
 1.10 11-Dec-2005  christos branches: 1.10.70; 1.10.72; 1.10.74;
merge ktrace-lwp.
 1.9 26-Feb-2005  perry nuke trailing whitespace
 1.8 10-May-2002  tron branches: 1.8.10; 1.8.18; 1.8.20;
Add missing bracket arround macro argument reference.
 1.7 10-Apr-2002  christos implement getdents64; my full java tree builds now.
 1.6 04-Oct-1998  fvdl branches: 1.6.24; 1.6.26;
Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.5 03-Oct-1998  christos Attempt to fix the mess.
 1.4 01-Oct-1998  erh Moved from compat/linux/linux_dirent.h to common.
 1.3 07-Oct-1995  mycroft Prefix names of system call implementation functions with `sys_'.
 1.2 10-Jun-1995  mycroft Rename the dirent fields to match Linux. Make sure the requested buffer
is no larger than MAXBSIZE.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.6.26.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.6.24.2 20-Jun-2002  nathanw Catch up to -current.
 1.6.24.1 17-Apr-2002  nathanw Catch up to -current.
 1.8.20.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.8.18.1 29-Apr-2005  kent sync with -current
 1.8.10.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.10.74.2 09-Oct-2010  yamt sync with head
 1.10.74.1 16-May-2008  yamt sync with head.
 1.10.72.1 18-May-2008  yamt sync with head.
 1.10.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.11.22.1 05-Mar-2011  rmind sync with head
 1.11.20.1 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.20 20-May-2022  andvar s/auxillary/auxiliary/ in comments.
 1.19 26-Apr-2020  thorpej Add a NetBSD native futex implementation, mostly written by riastradh@.
Map the COMPAT_LINUX futex calls to the native ones.
 1.18 02-Nov-2010  chs personality() now interprets its parameter as having
the base personality type in the low byte and
various flags in the upper bytes. for now just mask off
the flags to make sure the base type is one we accept.
store the current personality in the emuldata so that
we can return the expected value for PER_QUERY.
 1.17 07-Jul-2010  chs many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
- support new-style (NPTL) linux pthreads on all platforms.
clone() with CLONE_THREAD uses 1 process with many LWPs
instead of separate processes.
- move the contents of sys__lwp_setprivate() into a new
lwp_setprivate() and use that everywhere.
- update linux_release[] and linux32_release[] to "2.6.18".
- adjust placement of emul fork/exec/exit hooks as needed
and adjust other emul code to match.
- convert all struct emul definitions to use named initializers.
- change the pid allocator to allow multiple pids to refer to the same proc.
- remove a few fields from struct proc that are no longer needed.
- disable the non-functional "vdso" code in linux32/amd64,
glibc works fine without it.
- fix a race in the futex code where we could miss a wakeup after
a requeue operation.
- redo futex locking to be a little more efficient.
 1.16 26-Oct-2008  christos branches: 1.16.14; 1.16.16;
futex support fixes from FreeBSD via cube+pengo.
 1.15 28-Apr-2008  martin branches: 1.15.6;
Remove clause 3 and 4 from TNF licenses
 1.14 04-Mar-2007  christos branches: 1.14.36; 1.14.38; 1.14.40;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.13 05-Feb-2007  njoly branches: 1.13.2;
Add a new linux_emuldata_shared flag value LINUX_LES_USE_NPTL to allow
both NPTL and old linuxthreads behaviour depending on process needs.

Apply to exit_group(), getpid() and getppid() to share them between
compat linux32 (non NPTL) and compat linux (NPTL) on amd64.

ok by manu and christos
 1.12 23-Aug-2006  manu branches: 1.12.2; 1.12.6;
1) Complete Linux exit_group() emulation
Members of the thread group must die without reporting to the parent and
without going to zombie stage. We do that by reparenting to init before
catching a SIGKILL. The parent will not see the child death.

The thread group leader must report the exit status, even if it exits
because of another thread calling exit_group(). We do that by storing the
exit status in struct linux_emuldata_shared, and the exit hook has the
duty of setting struct proc's p_xstat for the thread group leader.

2) For exit/fork/exec hooks, move the NPTL specific code to separate functions
that are shared between COMPAT_LINUX and COMPAT_LINUX32

3) Fix LINUX_CLONE_PARENT_SETTID semantics
 1.11 25-Jun-2006  manu - Complete exit_group() implementation. We now maintain a list of Linux
threads in a processes and kill them properly. The code is a bit too
complicated, but I could not find a simplier way of dealing with it

- Change getpid() and getppid() semantics to match what Linux does,
and implement gettid(). In the Linux kernel, threads are implemnted
as plain old processes. A thread group is just a set of processes,
with the parent called leader. Thread ID, which are returned by gettid(),
are just the PID of the plain old processes, and getpid() returns the
PID of the thread group leader.

- Remove struct linux32_emuldata. COMPAT_LINUX32 uses a lot of COMPAT_LINUX
code, where a struct linux_emuldata is assumed. By having distinct emuldata
structure with different sizes and layouts, we caused kernel memory
corruptions.

- Fix setprioriry() and getpriority()

Thanks to Nicolas Joly for tracking down the problem and providing me the
hardware to fix them.
 1.10 11-Dec-2005  christos branches: 1.10.4; 1.10.8; 1.10.16;
merge ktrace-lwp.
 1.9 05-Nov-2005  manu Instead of ifdef'ing __amd64__ all the Linux NPTL stuff, introduce an
ifdef LINUX_NPTL.
Also implement SETTLS flag to Linux clone()
 1.8 22-Jun-2005  manu branches: 1.8.2;
Implent CLONE_PARENT_SETTID, CLONE_CHILD_CLEARTID, and CLONE_CHILD_SETTID
options to clone(). This makes fork() work on amd64.

clone() prototype has changed and the changes is probably revelant on some
other arches.
 1.7 26-Feb-2005  perry nuke trailing whitespace
 1.6 08-Aug-2004  jdolecek branches: 1.6.4; 1.6.6;
linux processes sharing VM space (via clone() call) must also
share same 'break' value used for brk()/sbrk(), otherwise application SIGSEGVs
quickly once different threads try to adjust data segment size

this fixes linux Mozilla crashes with SuSE 9.1 libraries, and possibly
other linux applications using real threads
 1.5 23-Jun-2003  erh branches: 1.5.2; 1.5.4;
Add copyright+license.
 1.4 15-Feb-2002  christos - add a real linux_sys___sysctl because the mib numbers are different.
implement only the kernel version getting entries.
- make the signal conversion functions consistent; dest is arg 1.
- make linux_fakedev deal with block and char devices differently.
- add linux_sys_ugetrlimit, and flesh out the regular get/setrlimit so
that they work properly.
- add linux_mmap2 [untested].
- bump kernel to 2.4.18, and make the date be valentine's day :-)
- linux_sys_*stat64 family was totally busted. Fix it.

tested only on i386.

Status:
gdb, telnet, work
jdk-1.4.0 extractor works, jdk still coredumps.

christos
 1.3 15-Mar-2001  manu branches: 1.3.2;
Fixed brk() emulation. We now keep track of the processes' idea of the
break value. See http://mail-index.netbsd.org/tech-kern/2001/03/15/0000.html
for more details.
 1.2 21-Nov-2000  jdolecek branches: 1.2.2;
comment out ps_siginfo from struct emuldata for now, add int debugreg[8]
update comment a bit
 1.1 08-Dec-1998  erh branches: 1.1.10;
At least make this compile. Add linux compat version of auxillary data eventually to be used to make the emulation work correctly.
 1.1.10.2 27-Mar-2001  bouyer Sync with HEAD.
 1.1.10.1 22-Nov-2000  bouyer Sync with HEAD.
 1.2.2.2 28-Feb-2002  nathanw Catch up to -current.
 1.2.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.3.2.1 16-Mar-2002  jdolecek Catch up with -current.
 1.5.4.1 15-Aug-2004  tron Pull up revision 1.6 (requested by jdolecek in ticket #762):
linux processes sharing VM space (via clone() call) must also
share same 'break' value used for brk()/sbrk(), otherwise application SIGSEGVs
quickly once different threads try to adjust data segment size
this fixes linux Mozilla crashes with SuSE 9.1 libraries, and possibly
other linux applications using real threads
 1.5.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.5.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.5.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.2.1 12-Aug-2004  skrll Sync with HEAD.
 1.6.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.6.4.1 29-Apr-2005  kent sync with -current
 1.8.2.4 03-Sep-2007  yamt sync with head.
 1.8.2.3 26-Feb-2007  yamt sync with head.
 1.8.2.2 30-Dec-2006  yamt sync with head.
 1.8.2.1 21-Jun-2006  yamt sync with head.
 1.10.16.1 13-Jul-2006  gdamore Merge from HEAD.
 1.10.8.2 03-Sep-2006  yamt sync with head.
 1.10.8.1 26-Jun-2006  yamt sync with head.
 1.10.4.1 09-Sep-2006  rpaulo sync with head
 1.12.6.1 28-Mar-2007  jdc Pull up revision 1.13 (requested by njoly in ticket #523).

Add a new linux_emuldata_shared flag value LINUX_LES_USE_NPTL to allow
both NPTL and old linuxthreads behaviour depending on process needs.

Apply to exit_group(), getpid() and getppid() to share them between
compat linux32 (non NPTL) and compat linux (NPTL) on amd64.

ok by manu and christos
 1.12.2.1 09-Feb-2007  ad Sync with HEAD.
 1.13.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.14.40.3 11-Aug-2010  yamt sync with head.
 1.14.40.2 04-May-2009  yamt sync with head.
 1.14.40.1 16-May-2008  yamt sync with head.
 1.14.38.1 18-May-2008  yamt sync with head.
 1.14.36.2 17-Jan-2009  mjf Sync with HEAD.
 1.14.36.1 02-Jun-2008  mjf Sync with HEAD.
 1.15.6.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.16.16.1 05-Mar-2011  rmind sync with head
 1.16.14.2 06-Nov-2010  uebayasi Sync with HEAD.
 1.16.14.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.16 08-Mar-2020  mgorny PR standards/44921: Add errno consts for robust mutexes

Add the two missing errno.h constants: EOWNERDEAD and ENOTRECOVERABLE.
While technically they're used for robust mutexes which we do not
support at the moment, they are listed in POSIX and used by libc++.
While libc++ can be made to build without it, it just locally redefines
the values then, so we may as well define them globally.
 1.15 22-Dec-2013  njoly branches: 1.15.30;
CTASSERT that native to compat errno translation tables are kept in
sync with native errno list.

Remove extra entries (linux) which resulted in bad translated values,
and add missing ones (ibcs2, osf1 and svr4) which made some out of
bounds accesses.
 1.14 17-Dec-2013  njoly Cleanup compat linux errnos by adding generic errnos in a single file.
Use it for all arches except alpha and mips.
Add a few missing native to linux errno conversions.
 1.13 28-Apr-2008  martin branches: 1.13.34; 1.13.44; 1.13.50;
Remove clause 3 and 4 from TNF licenses
 1.12 13-Nov-2001  lukem branches: 1.12.114; 1.12.116; 1.12.118;
add RCSIDs (including regeneration of files as appropriate)
 1.11 11-Feb-2001  manu branches: 1.11.2; 1.11.4;
Moved the fix for negative errno returned to userland on the PowerPC to a
more machine independent fashion
 1.10 18-Jan-2001  jdolecek constify
 1.9 23-Oct-1998  erh branches: 1.9.12;
Change linux_error to native_to_linux_errno. Add some (unrelated) debugging printfs.
 1.8 23-Oct-1998  erh Moved from linux_error.c,v
 1.7 04-Oct-1998  fvdl Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.6 03-Oct-1998  christos Attempt to fix the mess.
 1.5 01-Oct-1998  erh Move compat/linux/linux_error.c to common.
 1.4 10-Feb-1998  kleink Map ENOMSG.
 1.3 06-Feb-1998  mikel update errno maps, we now have EIDRM
 1.2 22-Apr-1995  christos - added struct emul to all emulations.
- removed all setup functions.
- added copyargs() functions where needed.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.9.12.2 12-Mar-2001  bouyer Sync with HEAD.
 1.9.12.1 11-Feb-2001  bouyer Sync with HEAD.
 1.11.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.11.2.1 14-Nov-2001  nathanw Catch up to -current.
 1.12.118.1 16-May-2008  yamt sync with head.
 1.12.116.1 18-May-2008  yamt sync with head.
 1.12.114.1 02-Jun-2008  mjf Sync with HEAD.
 1.13.50.1 18-May-2014  rmind sync with head
 1.13.44.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.13.34.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.15.30.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.17 22-May-2022  andvar fix various small typos, mainly in comments.
 1.16 23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.15 22-Nov-2014  njoly Do not define LINUX_EDEADLK more than once.
 1.14 17-Dec-2013  njoly Cleanup compat linux errnos by adding generic errnos in a single file.
Use it for all arches except alpha and mips.
Add a few missing native to linux errno conversions.
 1.13 28-Apr-2008  martin branches: 1.13.34; 1.13.44; 1.13.50;
Remove clause 3 and 4 from TNF licenses
 1.12 11-Dec-2005  christos branches: 1.12.70; 1.12.72; 1.12.74;
merge ktrace-lwp.
 1.11 03-May-2005  manu First work on COMPAT_LINUX/amd64
Process startup and dynamiclinking work, but processes hang due to
Linux arch_prctl(2) not being really supported yet.
 1.10 19-Jun-2004  manu Fix a reversed errno issue for Linux binaries on mips. While we are there,
fix broken includes for alpha and m68k.
 1.9 17-Jan-2002  rjs branches: 1.9.16; 1.9.18;
Include arch/arm/linux_errno.h for arm build.
 1.8 19-Jan-2001  manu branches: 1.8.2; 1.8.4;
Added Linux errno mapping for powerpc
 1.7 18-Jan-2001  jdolecek constify
 1.6 24-Oct-1998  christos branches: 1.6.12;
Allow kdump to compile again.
 1.5 23-Oct-1998  erh Change linux_error to native_to_linux_errno. Add some (unrelated) debugging printfs.
 1.4 04-Oct-1998  fvdl Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.3 03-Oct-1998  christos Attempt to fix the mess.
 1.2 01-Oct-1998  erh Split compat/linux/linux_errno.h into i386 and common parts.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.6.12.1 11-Feb-2001  bouyer Sync with HEAD.
 1.8.4.1 11-Feb-2002  jdolecek Sync w/ -current.
 1.8.2.1 28-Feb-2002  nathanw Catch up to -current.
 1.9.18.1 22-Jun-2004  tron Pull up revision 1.10 (requested by manu in ticket #521):
Fix a reversed errno issue for Linux binaries on mips. While we are
there,
fix broken includes for alpha and m68k.
 1.9.16.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.9.16.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.9.16.2 18-Sep-2004  skrll Sync with HEAD.
 1.9.16.1 03-Aug-2004  skrll Sync with HEAD
 1.12.74.1 16-May-2008  yamt sync with head.
 1.12.72.1 18-May-2008  yamt sync with head.
 1.12.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.13.50.1 18-May-2014  rmind sync with head
 1.13.44.2 03-Dec-2017  jdolecek update from HEAD
 1.13.44.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.13.34.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.1 17-Dec-2013  njoly branches: 1.1.4; 1.1.6; 1.1.10;
Cleanup compat linux errnos by adding generic errnos in a single file.
Use it for all arches except alpha and mips.
Add a few missing native to linux errno conversions.
 1.1.10.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.10.1 17-Dec-2013  tls file linux_errno_generic.h was added on branch tls-maxphys on 2014-08-20 00:03:32 +0000
 1.1.6.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.1.6.1 17-Dec-2013  yamt file linux_errno_generic.h was added on branch yamt-pagecache on 2014-05-22 11:40:16 +0000
 1.1.4.2 18-May-2014  rmind sync with head
 1.1.4.1 17-Dec-2013  rmind file linux_errno_generic.h was added on branch rmind-smpnet on 2014-05-18 17:45:32 +0000
 1.8 23-Oct-1998  erh Moved to linux_errno.c,v
 1.7 04-Oct-1998  fvdl Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.6 03-Oct-1998  christos Attempt to fix the mess.
 1.5 01-Oct-1998  erh Move compat/linux/linux_error.c to common.
 1.4 10-Feb-1998  kleink Map ENOMSG.
 1.3 06-Feb-1998  mikel update errno maps, we now have EIDRM
 1.2 22-Apr-1995  christos - added struct emul to all emulations.
- removed all setup functions.
- added copyargs() functions where needed.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.124 03-May-2020  thorpej Always clear FUTEX_PRIVATE_FLAG for Linux processes. NetBSD-native futexes
exist in different namespace depending on FUTEX_PRIVATE_FLAG. This appears
not to be the case in Linux, and some futex users will mix private and non-
private ops on the same futex object. Provide a convenience wrapper that
puts this logic in one place witn a comment explaining why.

While here, move the Linux futex wrapper out of its own file and plop
it in linux_misc.c, which is where it lives in the linux32 module.
 1.123 26-Apr-2020  thorpej Add a NetBSD native futex implementation, mostly written by riastradh@.
Map the COMPAT_LINUX futex calls to the native ones.
 1.122 24-Apr-2020  thorpej Overhaul the way LWP IDs are allocated. Instead of each LWP having it's
own LWP ID space, LWP IDs came from the same number space as PIDs. The
lead LWP of a process gets the PID as its LID. If a multi-LWP process's
lead LWP exits, the PID persists for the process.

In addition to providing system-wide unique thread IDs, this also lets us
eliminate the per-process LWP radix tree, and some associated locks.

Remove the separate "global thread ID" map added previously; it is no longer
needed to provide this functionality.

Nudged in this direction by ad@ and chs@.
 1.121 15-Feb-2020  ad branches: 1.121.4;
PR kern/54922: 9.99.45@20200202 panic: diagnostic assertion linux ldconfig triggers vpp != NULL in exit1()->radixtree.c line 674

Create an lwp_renumber() from the code in emulexec() and use in
linux_e_proc_exec() and linux_e_proc_fork() too.
 1.120 10-Aug-2018  pgoyette branches: 1.120.6;
Allow syscall_establish() to install new syscalls when the existing
entry-point is either sys_nomodule or sys_nosys. Update the
makesyscalls.sh script to create a const array of bits to allow
syscall_disestablish() to properly restore the original entry-point.
Update all the initializers of struct emul to initialize the pointer
to the bit array struct emul.

XXX Regen of all files created by makesyscalls.sh will come soon,
XXX followed by a kernel version bump (since struct emul is being
XXX modified).

This commit should address PR kern/45781 and also removes the need
for the work-around for that PR in file

sys/arch/usermode/modules/syscallemu/syscallemu.c
 1.119 06-May-2018  kamil branches: 1.119.2;
Remove an element from struct emul: e_tracesig

e_tracesig used to be implemented for Darwin compat. Nowadays the Darwin
compatiblity layer is gone and there are no other users.

This functionality isn't used where it shall be used in the existing
codebase.

If we want to emulate debugging interfaces in compat layers we would need
to implement that from scratch anyway. We would need to be bug compatible
with other OSes too.

Proposed on tech-kern@.

Welcome to NetBSD 8.99.16!

Sponsored by <The NetBSD Foundation>
 1.118 09-Jan-2018  maya branches: 1.118.2;
remove struct emul's e_fault.

It used to be used by COMPAT_IRIX for the purpose of overriding
uvm_fault (only implemented in MIPS), now removed.

Ride 8.99.12 version bump.
 1.117 09-Nov-2014  maxv Do not uselessly include <sys/malloc.h>.
 1.116 19-Feb-2012  rmind branches: 1.116.2; 1.116.14;
Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.
 1.115 18-Aug-2011  christos branches: 1.115.2; 1.115.6;
sizeof type -> sizeof *var
 1.114 07-Jul-2010  chs many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
- support new-style (NPTL) linux pthreads on all platforms.
clone() with CLONE_THREAD uses 1 process with many LWPs
instead of separate processes.
- move the contents of sys__lwp_setprivate() into a new
lwp_setprivate() and use that everywhere.
- update linux_release[] and linux32_release[] to "2.6.18".
- adjust placement of emul fork/exec/exit hooks as needed
and adjust other emul code to match.
- convert all struct emul definitions to use named initializers.
- change the pid allocator to allow multiple pids to refer to the same proc.
- remove a few fields from struct proc that are no longer needed.
- disable the non-functional "vdso" code in linux32/amd64,
glibc works fine without it.
- fix a race in the futex code where we could miss a wakeup after
a requeue operation.
- redo futex locking to be a little more efficient.
 1.113 25-Oct-2009  rmind branches: 1.113.2; 1.113.4;
Initialise struct emul members by name (it is readable now and one can search
them in the tree).
 1.112 15-Mar-2009  cegger ansify function definitions
 1.111 14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.110 17-Dec-2008  cegger branches: 1.110.2;
kill MALLOC and FREE macros.
 1.109 19-Nov-2008  ad Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.108 28-Oct-2008  jmcneill Only call release_futexes if LINUX_NPTL
 1.107 26-Oct-2008  christos branches: 1.107.2;
futex support fixes from FreeBSD via cube+pengo.
 1.106 15-Oct-2008  wrstuden Merge wrstuden-revivesa into HEAD.
 1.105 28-Apr-2008  martin branches: 1.105.2; 1.105.6;
Remove clause 3 and 4 from TNF licenses
 1.104 24-Apr-2008  ad branches: 1.104.2;
Network protocol interrupts can now block on locks, so merge the globals
proclist_mutex and proclist_lock into a single adaptive mutex (proc_lock).
Implications:

- Inspecting process state requires thread context, so signals can no longer
be sent from a hardware interrupt handler. Signal activity must be
deferred to a soft interrupt or kthread.

- As the proc state locking is simplified, it's now safe to take exit()
and wait() out from under kernel_lock.

- The system spends less time at IPL_SCHED, and there is less lock activity.
 1.103 23-Apr-2008  ad Sprinkle locking.
 1.102 11-Apr-2008  njoly branches: 1.102.2;
Under NPTL emulation, do not reparent all members of a thread group,
but only the processes that emulate threads (with LINUX_CLONE_THREAD
set).

This fix a problem for child processes that share address space with
the parent. At exit, the child will die silently, leaving the parent
waiting indefinitely for its end ...
 1.101 08-Apr-2008  njoly Cleanup unneeded LINUX_NPTL ifdef/endif.
 1.100 08-Dec-2007  dsl branches: 1.100.12;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.99 04-Dec-2007  dsl Remove all the __P
 1.98 16-Nov-2007  njoly branches: 1.98.2;
Cleanup. Remove a few linux syscalls definitions, now identical to
native ones (with stackgap and ALT_CHECK_xxx removal). No functional
changes expected.
 1.97 19-Oct-2007  njoly branches: 1.97.2;
Add compat_linux and exec_linux_elf lkm support for amd64:
- Add needed COMPAT_OSSAUDIO to GENERIC.
- Add missing includes needed by linux_syscallargs.h.
- Add lkm building.
 1.96 19-Oct-2007  ad machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.95 22-Apr-2007  dsl branches: 1.95.6; 1.95.8; 1.95.12;
Change the way that emulations locate files within the emulation root to
avoid having to allocate space in the 'stackgap'
- which is very LWP unfriendly.
The additional code for non-emulation namei() is trivial, the reduction for
the emulations is massive.
The vnode for a processes emulation root is saved in the cwdi structure
during process exec.
If the emulation root the TRYEMULROOT flag are set, namei() will do an initial
search for absolute pathnames in the emulation root, if that fails it will
retry from the normal root.
".." at the emulation root will always go to the real root, even in the middle
of paths and when expanding symlinks.
Absolute symlinks found using absolute paths in the emulation root will be
relative to the emulation root (so /usr/lib/xxx.so -> /lib/xxx.so links
inside the emulation root don't need changing).
If the root of the emulation would be returned (for an emulation lookup), then
the real root is returned instead (matching the behaviour of emul_lookup,
but being a cheap comparison here) so that programs that scan "../.."
looking for the root dircetory don't loop forever.
The target for symbolic links is no longer mangled (it used to get the
CHECK_ALT_xxx() treatment, so could get /emul/xxx prepended).
CHECK_ALT_xxx() are no more. Most of the change is deleting them, and adding
TRYEMULROOT to the flags to NDINIT().
A lot of the emulation system call stubs could now be deleted.
 1.94 09-Mar-2007  ad branches: 1.94.2; 1.94.4;
- Make the proclist_lock a mutex. The write:read ratio is unfavourable,
and mutexes are cheaper use than RW locks.
- LOCK_ASSERT -> KASSERT in some places.
- Hold proclist_lock/kernel_lock longer in a couple of places.
 1.93 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.92 19-Feb-2007  cube Introduce a new member to struct emul, e_startlwp, to be used by
sys__lwp_create. It allows using the said syscall under COMPAT_NETBSD32.

The libpthread regression tests now pass on amd64 and sparc64.
 1.91 15-Feb-2007  ad branches: 1.91.2;
Fix Linux compat on amd64.
 1.90 09-Feb-2007  ad Merge newlock2 to head.
 1.89 16-Nov-2006  christos __unused removal on arguments; approved by core.
 1.88 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.87 29-Sep-2006  christos Coverity CID 2990: fix memory leak (from Arnaud Lacombe)
 1.86 02-Sep-2006  christos branches: 1.86.2; 1.86.4;
fix incomplete initializer
 1.85 23-Aug-2006  manu 1) Complete Linux exit_group() emulation
Members of the thread group must die without reporting to the parent and
without going to zombie stage. We do that by reparenting to init before
catching a SIGKILL. The parent will not see the child death.

The thread group leader must report the exit status, even if it exits
because of another thread calling exit_group(). We do that by storing the
exit status in struct linux_emuldata_shared, and the exit hook has the
duty of setting struct proc's p_xstat for the thread group leader.

2) For exit/fork/exec hooks, move the NPTL specific code to separate functions
that are shared between COMPAT_LINUX and COMPAT_LINUX32

3) Fix LINUX_CLONE_PARENT_SETTID semantics
 1.84 25-Jun-2006  manu - Complete exit_group() implementation. We now maintain a list of Linux
threads in a processes and kill them properly. The code is a bit too
complicated, but I could not find a simplier way of dealing with it

- Change getpid() and getppid() semantics to match what Linux does,
and implement gettid(). In the Linux kernel, threads are implemnted
as plain old processes. A thread group is just a set of processes,
with the parent called leader. Thread ID, which are returned by gettid(),
are just the PID of the plain old processes, and getpid() returns the
PID of the thread group leader.

- Remove struct linux32_emuldata. COMPAT_LINUX32 uses a lot of COMPAT_LINUX
code, where a struct linux_emuldata is assumed. By having distinct emuldata
structure with different sizes and layouts, we caused kernel memory
corruptions.

- Fix setprioriry() and getpriority()

Thanks to Nicolas Joly for tracking down the problem and providing me the
hardware to fix them.
 1.83 11-Dec-2005  christos branches: 1.83.4; 1.83.8; 1.83.16;
merge ktrace-lwp.
 1.82 23-Nov-2005  manu To awake all processes sleeping on a futex, set maximum value to 0x7fffffff
instead of -1 (0xffffffff): the value is signed...
 1.81 05-Nov-2005  manu branches: 1.81.2;
Implement more of Linux futex(2)
 1.80 05-Nov-2005  manu Fix build when LINUX_NPTL is not defined
 1.79 05-Nov-2005  manu Instead of ifdef'ing __amd64__ all the Linux NPTL stuff, introduce an
ifdef LINUX_NPTL.
Also implement SETTLS flag to Linux clone()
 1.78 04-Nov-2005  manu Implement Linux futex ang gettid
 1.77 22-Jun-2005  manu branches: 1.77.2;
Implent CLONE_PARENT_SETTID, CLONE_CHILD_CLEARTID, and CLONE_CHILD_SETTID
options to clone(). This makes fork() work on amd64.

clone() prototype has changed and the changes is probably revelant on some
other arches.
 1.76 02-Jun-2005  tsutsui Add a const.
 1.75 20-May-2005  fvdl Define linux_usertrap function, and set it in struct emul. For all
but amd64, it just returns 0, doing nothing.

For amd64, it implements vsyscalls through cheating: if the faulting
address is in the vsyscall area (which is statically known on Linux/amd64),
and the intruction pointer is too, it must have been a vsyscall. In that
case, retrieve the return address from the user stack, fix up %rip and
%rsp, and just execute the normal system call. It will return as if
the vsyscall has been executed.
 1.74 26-Mar-2005  christos s/uvm_map_defaultaddr/uvm_default_mapaddr/ HI FRANK!
 1.73 26-Mar-2005  fvdl Fix some things regarding COMPAT_NETBSD32 and limits/VM addresses.

* For sparc64 and amd64, define *SIZ32 VM constants.
* Add a new function pointer to struct emul, pointing at a function
that will return the default VM map address. The default function
is uvm_map_defaultaddr, which just uses the VM_DEFAULT_ADDRESS
macro. This gives emulations control over the default map address,
and allows things to be mapped at the right address (in 32bit range)
for COMPAT_NETBSD32.
* Add code to adjust the data and stack limits when a COMPAT_NETBSD32
or COMPAT_SVR4_32 binary is executed.
* Don't use USRSTACK in kern_resource.c, use p_vmspace->vm_minsaddr
instead (emulations might have set it differently)
* Since this changes struct emul, bump kernel version to 3.99.2

Tested on amd64, compile-tested on sparc64.
 1.72 08-Aug-2004  jdolecek branches: 1.72.4; 1.72.6; 1.72.10;
fix two bugs in previous:
* flags passed from fork1() are FORK_*, not CLONE_*; thus, correct is to check
for FORK_SHAREVM, not CLONE_VM
* fix a reference counting bug
 1.71 08-Aug-2004  jdolecek linux processes sharing VM space (via clone() call) must also
share same 'break' value used for brk()/sbrk(), otherwise application SIGSEGVs
quickly once different threads try to adjust data segment size

this fixes linux Mozilla crashes with SuSE 9.1 libraries, and possibly
other linux applications using real threads
 1.70 20-Dec-2003  fvdl branches: 1.70.2;
Put back Emmanuel's sigfilter hooks, as decided by Core.
 1.69 20-Dec-2003  manu Introduce lwp_emuldata and the associated hooks. No hook is provided for the
exec case, as the emulation already has the ability to intercept that
with the e_proc_exec hook. It is the responsability of the emulation to
take appropriaye action about lwp_emuldata in e_proc_exec.

Patch reviewed by Christos.
 1.68 05-Dec-2003  jdolecek back the sigfilter emulation hook change off
 1.67 04-Dec-2003  atatat Dynamic sysctl.

Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.

Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.

All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.

PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
 1.66 03-Dec-2003  manu Add a sigfilter emulation hook. It is used at the beginning of kpsignal2()
so that a specific emulation has the oportunity to filter out some signals.

if sigfilter returns 0, then no signal is sent by kpsignal2().

There is another place where signals can be generated: trapsignal. Since this
function is already an emulation hook, no call to the sigfilter hook was
introduced in trapsignal.

This is needed to emulate the softsignal feature in COMPAT_DARWIN (signals
sent as Mach exception messages)
 1.65 24-Aug-2003  chs add support for non-executable mappings (where the hardware allows this)
and make the stack and heap non-executable by default. the changes
fall into two basic catagories:

- pmap and trap-handler changes. these are all MD:
= alpha: we already track per-page execute permission with the (software)
PG_EXEC bit, so just have the trap handler pay attention to it.
= i386: use a new GDT segment for %cs for processes that have no
executable mappings above a certain threshold (currently the
bottom of the stack). track per-page execute permission with
the last unused PTE bit.
= powerpc/ibm4xx: just use the hardware exec bit.
= powerpc/oea: we already track per-page exec bits, but the hardware only
implements non-exec mappings at the segment level. so track the
number of executable mappings in each segment and turn on the no-exec
segment bit iff the count is 0. adjust the trap handler to deal.
= sparc (sun4m): fix our use of the hardware protection bits.
fix the trap handler to recognize text faults.
= sparc64: split the existing unified TSB into data and instruction TSBs,
and only load TTEs into the appropriate TSB(s) for the permissions.
fix the trap handler to check for execute permission.
= not yet implemented: amd64, hppa, sh5

- changes in all the emulations that put a signal trampoline on the stack.
instead, we now put the trampoline into a uvm_aobj and map that into
the process separately.

originally from openbsd, adapted for netbsd by me.
 1.64 29-Jun-2003  fvdl branches: 1.64.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.63 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.62 01-Mar-2003  thorpej Do the syscall_plain/syscall_fancy dance on ARM. Shaves a fair number
of cycles off the syscall overhead.

Since all COMPAT_LINUX platforms now support __HAVE_SYSCALL_INTERN,
garbage-collect the LINUX_SYSCALL_FUNCTION stuff.
 1.61 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.60 01-Nov-2002  jdolecek set struct emul's nsysent to compat SYS_NSYSENT, not SYS_MAXSYSCALL
 1.59 21-Sep-2002  manu - Introduce a e_fault field in struct proc to provide emulation specific
memory fault handler. IRIX uses irix_vm_fault, and all other emulation
use NULL, which means to use uvm_fault.

- While we are there, explicitely set to NULL the uninitialized fields in
struct emul: e_fault and e_sysctl on most ports

- e_fault is used by the trap handler, for now only on mips. In order to avoid
intrusive modifications in UVM, the function pointed by e_fault does not
has exactly the same protoype as uvm_fault:
int uvm_fault __P((struct vm_map *, vaddr_t, vm_fault_t, vm_prot_t));
int e_fault __P((struct proc *, vaddr_t, vm_fault_t, vm_prot_t));

- In IRIX share groups, all the VM space is shared, except one page.
This bounds us to have different VM spaces and synchronize modifications
to the VM space accross share group members. We need an IRIX specific hook
to the page fault handler in order to propagate VM space modifications
caused by page faults.
 1.58 02-Apr-2002  jdolecek rename sysctl_linux() to linux_sysctl() and hook it into emul_linux
 1.57 16-Mar-2002  christos make the stackgap_{init,alloc} functions MP friendly (i.e. pass struct proc *
in, instead of using curproc). While there add an optional size argument to
stackgap_init.
 1.56 17-Jan-2002  bjh21 Fix typo in last commit.
 1.55 17-Jan-2002  bjh21 On platforms that don't __HAVE_SYSCALL_INTERN, define LINUX_SYSCALL_FUNCTION
to be the value of emul_linux.e_syscall that we want. This allows it to differ
between machines, so I can have a separate linux_syscall() on arm.
 1.54 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.53 18-Sep-2001  jdolecek Make the setregs hook emulation-specific, rather than executable
format specific.
Struct emul has a e_setregs hook back, which points to emulation-specific
setregs function. es_setregs of struct execsw now only points to
optional executable-specific setup function (this is only used for
ECOFF).
 1.52 18-Jun-2001  christos branches: 1.52.2; 1.52.4;
Add an e_trapsignal member to struct emul, so that emulated processes can
send the appropriate signal depending on the trap type.
 1.51 16-Jun-2001  manu Removed obsoletes EMUL_NO_BSD_ASYNCIO_PIPE and EMUL_NO_SIGIO_ON_READ flags.
Async I/O OS specifities should now handled in OS specific code. Linux
has been done, but other emulation should be handled. See case LINUX_F_SETFL
in sys/compat/linux/common/linux_file.c:linux_sys_fcntl() for more details.

The data that has been collected yet:

Net Free Open Linux SunOS AIX OSF1 Darwin
send SIGIO to write end of pipe Y N N N N N Y Y
send SIGIO to read end of pipe Y Y N N N ? Y ?
send SIGIO to write end of socket Y Y Y N N Y Y Y
send SIGIO to read end of socket Y Y Y Y Y ? Y ?
 1.50 07-May-2001  manu Changed EMUL_BSD_ASYNCIO_PIPE to EMUL_NO_BSD_ASYNCIO_PIPE, so that
the native emulation (NetBSD) does not have a flag.
 1.49 06-May-2001  manu Added two flags to emulation packages:

EMUL_BSD_ASYNCIO_PIPE notes that the emulated binaries expect the original
BSD pipe behavior for asynchronous I/O, which is to fire SIGIO on read() and
write(). OSes without this flag do not expect any SIGIO to be fired on
read() and write() for pipes, even when async I/O was requested. As far as
we know, the OSes that need EMUL_BSD_ASYNCIO_PIPE are NetBSD, OSF/1 and
Darwin.

EMUL_NO_SIGIO_ON_READ notes that the emulated binaries that requested
asynchrnous I/O expect the reader process to be notified by a SIGIO, but
not the writer process. OSes without this flag expect the reader and the
writer to be notified when some data has arrived or when some data have been
read. As far as we know, the OSes that need EMUL_NO_SIGIO_ON_READ are Linux
and SunOS.
 1.48 24-Mar-2001  jdolecek Use parent's vmspace in linux_e_proc_fork() hook, the child does not
have vmspace setup yet. This fixes lossage discussed on current-users,
thread "hard lockups with -current and Netscape", and should fix
kern/12433 by <kawamoto@tenjin.org>, maybe also kern/12455.

XXX Threads forked via linux_sys_clone() should share the brk value
XXX if they share vmspace. This needs to be implemented.
 1.47 22-Mar-2001  itojun do not dereference p_vmspace, if it is not initialized yet (NULL).
 1.46 15-Mar-2001  manu Fixed brk() emulation. We now keep track of the processes' idea of the
break value. See http://mail-index.netbsd.org/tech-kern/2001/03/15/0000.html
for more details.
 1.45 19-Jan-2001  manu branches: 1.45.2;
Added support for powerpc Linux compatibility
 1.44 11-Dec-2000  mycroft Introduce 2 new flags in types.h:
* __HAVE_SYSCALL_INTERN. If this is defined, e_syscall is replaced by
e_syscall_intern, which is called at key places in the kernel. This can be
used to set a MD syscall handler pointer. This obsoletes and replaces the
*_HAS_SEPARATED_SYSCALL flags.
* __HAVE_MINIMAL_EMUL. If this is defined, certain (deprecated) elements in
struct emul are omitted.
 1.43 09-Dec-2000  jdolecek always fill in e_syscall in respective emul_*; if the emulation doesn't
have it's own separated *_syscall() function, use syscall()
 1.42 02-Dec-2000  jdolecek if machdep define LINUX_MACHDEP_HAS_SEPARATED_SYSCALL is defined, put
linux_syscall() to emul_linux
define LINUX_MACHDEP_HAS_SEPARATED_SYSCALL for i386
 1.41 01-Dec-2000  jdolecek if LINUX_MACHDEP_PASS_PPID_AND_EUID is defined for given arch, add
flags EMUL_GETPID_PASS_PPID|EMUL_GETID_PASS_EID to emul_linux
define this option for alpha
 1.40 01-Dec-2000  jdolecek add e_path (emulation path) to struct emul, which replaces emulation-specific
*_emul_path variables

change macros CHECK_ALT_{CREAT|EXIST} to use that, 'root' doesn't need
to be passed explicitly any more and *_CHECK_ALT_{CREAT|EXIST} are removed
change explicit emul_find() calls in probe functions to get the emulation
path from the checked exec switch entry's emulation

remove no longer needed header files

add e_flags and e_syscall to struct emul; these are unsed and empty for now
 1.39 21-Nov-2000  jdolecek (de)allocate linux emuldata on fork/exec/exit as needed
 1.38 21-Nov-2000  jdolecek restructure struct emul and execsw, in preparation to make emulations LKMable:
* move all exec-type specific information from struct emul to execsw[] and
provide single struct emul per emulation
* elf:
- kern/exec_elf32.c:probe_funcs[] is gone, execsw[] how has one entry
per emulation and contains pointer to respective probe function
- interp is allocated via MALLOC() rather than on stack
- elf_args structure is allocated via MALLOC() rather than malloc()
* ecoff: the per-emulation hooks moved from alpha and mips specific code
to OSF1 and Ultrix compat code as appropriate, execsw[] has one entry per
emulation supporting ecoff with appropriate probe function
* the makecmds/probe functions don't set emulation, pointer to emulation is
part of appropriate execsw[] entry
* constify couple of structures
 1.37 29-Jun-2000  mrg remove include of <vm/vm.h>
 1.36 26-Jun-2000  mrg remove redundant vm includes.
 1.35 09-Feb-1999  christos branches: 1.35.8;
const poisoning.
 1.34 07-Oct-1998  erh The siginfo include line is not needed here anymore.
 1.33 04-Oct-1998  fvdl Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.32 03-Oct-1998  christos Attempt to fix the mess.
 1.31 01-Oct-1998  erh Split compat/linux/linux_exec.c into common, elf and a.out parts.
 1.30 11-Sep-1998  mycroft Substantial signal handling changes:
* Increase the size of sigset_t to accomodate 128 signals -- adding new
versions of sys_setprocmask(), sys_sigaction(), sys_sigpending() and
sys_sigsuspend() to handle the changed arguments.
* Abstract the guts of sys_sigaltstack(), sys_setprocmask(), sys_sigaction(),
sys_sigpending() and sys_sigsuspend() into separate functions, and call them
from all the emulations rather than hard-coding everything. (Avoids uses
the stackgap crap for these system calls.)
* Add a new flag (p_checksig) to indicate that a process may have signals
pending and userret() needs to do the full (slow) check.
* Eliminate SAS_ALTSTACK; it's exactly the inverse of SS_DISABLE.
* Correct emulation bugs with restoring SS_ONSTACK.
* Make the signal mask in the sigcontext always use the emulated mask format.
* Store signals internally in sigaction structures, rather than maintaining a
bunch of little sigsets for each SA_* bit.
* Keep track of where we put the signal trampoline, rather than figuring it out
in *_sendsig().
* Issue a warning when a non-emulated sigaction bit is observed.
* Add missing emulated signals, and a native SIGPWR (currently not used).
* Implement the `not reset when caught' semantics for relevant signals.

Note: Only code touched by the i386 port has been modified. Other ports and
emulations need to be updated.
 1.29 05-Sep-1998  christos Assign copyright to TNF.
 1.28 09-Aug-1998  perry bzero->memset, bcopy->memcpy, bcmp->memcmp
 1.27 28-Jul-1998  thorpej Change the "aresid" argument of vn_rdwr() from an int * to a size_t *,
to match the new uio_resid type.
 1.26 24-Jan-1998  mycroft Use linux_setregs().
 1.25 13-Oct-1996  christos branches: 1.25.14;
catch up with Jason's exec.h inclusion.
 1.24 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.23 07-Oct-1996  cgd include <sys/exec.h> rather than <machine/exec.h>
 1.22 05-Oct-1996  jtk update to compile; needs new enum name 'Elf_sht_progbits'
 1.21 03-Oct-1996  cgd kill (re)definitions of EXEC_ELF32. They're no longer necessary
(because of the EXEC_* option changes), and now cause warnings.
 1.20 03-Oct-1996  thorpej Fix a section header check that didn't get updated with the elf32/elf64
changes. Make this compile again with the new EXEC_* options.
 1.19 30-Sep-1996  christos Elf32_sht_progbits -> Elf_sht_progbits
 1.18 27-Sep-1996  cgd slightly clean up some of the changes made when ELF64 support went in
 1.17 26-Sep-1996  cgd adapt ELF-using compat code to use new ELF definitions/code. At this point,
these are restricted to 32-bit ELF, and should be severely cleaned.
 1.16 03-Sep-1996  mycroft Define execv() and execve() consistently across emulations.
Do path name translation.
 1.15 13-Jun-1996  christos Simplify and add comments.
 1.14 13-Jun-1996  christos - Pass the Elf32_Ehdr in the linux probe function, and use it!

Since linux binaries are (mostly) always compiled with gcc, look for
the gcc signature in the .comment section header: "\0 GCC: (GNU) ".
I've changed the probe order in kern/exec_elf.c to probe for linux ELF
binaries first and fall back to SVR4 binaries. This makes statically
linked binaries work for both linux and svr4. Note that gcc-compiled
svr4 binaries, still contain the operating system signature first and
then the GCC signature, so there is no conflict. Yes this is a hack.
 1.13 05-Apr-1996  christos branches: 1.13.4;
Prototyping changes.
 1.12 07-Oct-1995  mycroft Prefix names of system call implementation functions with `sys_'.
 1.11 19-Sep-1995  thorpej Make system calls conform to a standard prototype and bring those
prototypes into scope.
 1.10 14-Aug-1995  mycroft Rearrange #includes.
 1.9 24-Jun-1995  christos Use compat_util.[ch].
 1.8 22-Jun-1995  fvdl * Changed to use generic ELF code from kern/exec_elf.c (which was taken
from the svr4 exec code plus the linux compat mods)
* Include file change
* Add multicast sockopts (from John Brezak)
 1.7 11-Jun-1995  fvdl Don't forget to acknowledge that all the ELF stuff was taken from
Christos' svr4 code.
 1.6 11-Jun-1995  fvdl * Make Linux ELF binaries work. Lots of code duplication, but it will have to do
for now.
* Add a sanity check in linux_uselib
 1.5 16-May-1995  mycroft Generate the new ps_strings format.
 1.4 22-Apr-1995  christos - added struct emul to all emulations.
- removed all setup functions.
- added copyargs() functions where needed.
 1.3 07-Apr-1995  fvdl Handle Linux signal tramp code differently. Some changes because of the
now seperate Linux signal trampoline code. Add linux_sigreturn to
syscalls.master.
 1.2 05-Mar-1995  fvdl Added a few more system calls.
More consistent alternate root file semantics throughout.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.13.4.1 10-Dec-1996  mycroft From trunk:
Do execv() and execve() path name translation consistently across
emulations.
 1.25.14.1 29-Jan-1998  mellon Pull up 1.26 (mycroft)
 1.35.8.6 27-Mar-2001  bouyer Sync with HEAD.
 1.35.8.5 11-Feb-2001  bouyer Sync with HEAD.
 1.35.8.4 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.35.8.3 08-Dec-2000  bouyer Sync with HEAD.
 1.35.8.2 22-Nov-2000  bouyer Sync with HEAD.
 1.35.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.45.2.11 11-Nov-2002  nathanw Catch up to -current
 1.45.2.10 18-Oct-2002  nathanw Catch up to -current.
 1.45.2.9 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.45.2.8 17-Apr-2002  nathanw Catch up to -current.
 1.45.2.7 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.45.2.6 28-Feb-2002  nathanw Catch up to -current.
 1.45.2.5 14-Nov-2001  nathanw Catch up to -current.
 1.45.2.4 21-Sep-2001  nathanw Catch up to -current.
 1.45.2.3 21-Jun-2001  nathanw Catch up to -current.
 1.45.2.2 09-Apr-2001  nathanw Catch up with -current.
 1.45.2.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.52.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.52.2.4 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.52.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.52.2.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.52.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.64.2.8 11-Dec-2005  christos Sync with head.
 1.64.2.7 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.64.2.6 01-Apr-2005  skrll Sync with HEAD.
 1.64.2.5 21-Sep-2004  skrll Fix the sync with head I botched.
 1.64.2.4 18-Sep-2004  skrll Sync with HEAD.
 1.64.2.3 12-Aug-2004  skrll Sync with HEAD.
 1.64.2.2 03-Aug-2004  skrll Sync with HEAD
 1.64.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.70.2.2 15-Aug-2004  tron Pull up revision 1.72 (requested by jdolecek in ticket #762):
fix two bugs in previous:
* flags passed from fork1() are FORK_*, not CLONE_*; thus, correct is to check
for FORK_SHAREVM, not CLONE_VM
* fix a reference counting bug
 1.70.2.1 15-Aug-2004  tron Pull up revision 1.71 (requested by jdolecek in ticket #762):
linux processes sharing VM space (via clone() call) must also
share same 'break' value used for brk()/sbrk(), otherwise application SIGSEGVs
quickly once different threads try to adjust data segment size
this fixes linux Mozilla crashes with SuSE 9.1 libraries, and possibly
other linux applications using real threads
 1.72.10.2 18-Sep-2005  tron Pull up following revision(s) (requested by fvdl in ticket #798):
sys/compat/linux/common/linux_exec.c: revision 1.74
sys/compat/hpux/hpux_exec.c: revision 1.47
s/uvm_map_defaultaddr/uvm_default_mapaddr/ HI FRANK!
 1.72.10.1 18-Sep-2005  tron Pull up following revision(s) (requested by fvdl in ticket #798):
sys/compat/sunos/sunos_exec.c: revision 1.47
sys/compat/pecoff/pecoff_emul.c: revision 1.11
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.45
sys/arch/amd64/amd64/netbsd32_machdep.c: revision 1.12
sys/sys/proc.h: revision 1.198
sys/compat/mach/mach_exec.c: revision 1.56
sys/compat/freebsd/freebsd_exec.c: revision 1.27
sys/arch/sparc64/include/vmparam.h: revision 1.27
sys/kern/kern_resource.c: revision 1.91
sys/compat/netbsd32/netbsd32_netbsd.c: revision 1.88
sys/compat/osf1/osf1_exec.c: revision 1.39
sys/compat/svr4_32/svr4_32_resource.c: revision 1.5
sys/compat/ultrix/ultrix_misc.c: revision 1.99
sys/compat/svr4_32/svr4_32_exec.h: revision 1.9
sys/kern/exec_elf32.c: revision 1.103
sys/compat/aoutm68k/aoutm68k_exec.c: revision 1.19
sys/compat/sunos32/sunos32_exec.c: revision 1.20
sys/compat/hpux/hpux_exec.c: revision 1.46
sys/compat/darwin/darwin_exec.c: revision 1.40
sys/kern/sysv_shm.c: revision 1.83
sys/uvm/uvm_extern.h: revision 1.99
sys/uvm/uvm_mmap.c: revision 1.89
sys/kern/kern_exec.c: revision 1.195
sys/compat/netbsd32/netbsd32.h: revision 1.31
sys/arch/sparc64/sparc64/svr4_32_machdep.c: revision 1.20
sys/compat/svr4/svr4_exec.c: revision 1.56
sys/compat/irix/irix_exec.c: revision 1.41
sys/compat/ibcs2/ibcs2_exec.c: revision 1.63
sys/compat/svr4_32/svr4_32_exec.c: revision 1.16
sys/arch/amd64/include/vmparam.h: revision 1.8
sys/compat/linux/common/linux_exec.c: revision 1.73
Fix some things regarding COMPAT_NETBSD32 and limits/VM addresses.
* For sparc64 and amd64, define *SIZ32 VM constants.
* Add a new function pointer to struct emul, pointing at a function
that will return the default VM map address. The default function
is uvm_map_defaultaddr, which just uses the VM_DEFAULT_ADDRESS
macro. This gives emulations control over the default map address,
and allows things to be mapped at the right address (in 32bit range)
for COMPAT_NETBSD32.
* Add code to adjust the data and stack limits when a COMPAT_NETBSD32
or COMPAT_SVR4_32 binary is executed.
* Don't use USRSTACK in kern_resource.c, use p_vmspace->vm_minsaddr
instead (emulations might have set it differently)
* Since this changes struct emul, bump kernel version to 3.99.2
Tested on amd64, compile-tested on sparc64.
 1.72.6.1 26-Mar-2005  yamt sync with head.
 1.72.4.1 29-Apr-2005  kent sync with -current
 1.77.2.7 21-Jan-2008  yamt sync with head
 1.77.2.6 07-Dec-2007  yamt sync with head
 1.77.2.5 27-Oct-2007  yamt sync with head.
 1.77.2.4 03-Sep-2007  yamt sync with head.
 1.77.2.3 26-Feb-2007  yamt sync with head.
 1.77.2.2 30-Dec-2006  yamt sync with head.
 1.77.2.1 21-Jun-2006  yamt sync with head.
 1.81.2.1 29-Nov-2005  yamt sync with head.
 1.83.16.1 13-Jul-2006  gdamore Merge from HEAD.
 1.83.8.2 03-Sep-2006  yamt sync with head.
 1.83.8.1 26-Jun-2006  yamt sync with head.
 1.83.4.1 09-Sep-2006  rpaulo sync with head
 1.86.4.2 10-Dec-2006  yamt sync with head.
 1.86.4.1 22-Oct-2006  yamt sync with head
 1.86.2.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.86.2.1 18-Nov-2006  ad Sync with head.
 1.91.2.3 07-May-2007  yamt sync with head.
 1.91.2.2 12-Mar-2007  rmind Sync with HEAD.
 1.91.2.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.94.4.1 11-Jul-2007  mjf Sync with head.
 1.94.2.2 23-Oct-2007  ad Sync with head.
 1.94.2.1 27-May-2007  ad Sync with head.
 1.95.12.2 18-Nov-2007  bouyer Sync with HEAD
 1.95.12.1 25-Oct-2007  bouyer Sync with HEAD.
 1.95.8.2 09-Jan-2008  matt sync with HEAD
 1.95.8.1 06-Nov-2007  matt sync with HEAD
 1.95.6.3 09-Dec-2007  jmcneill Sync with HEAD.
 1.95.6.2 21-Nov-2007  joerg Sync with HEAD.
 1.95.6.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.97.2.3 27-Dec-2007  mjf Sync with HEAD.
 1.97.2.2 08-Dec-2007  mjf Sync with HEAD.
 1.97.2.1 19-Nov-2007  mjf Sync with HEAD.
 1.98.2.2 26-Dec-2007  ad Sync with head.
 1.98.2.1 08-Dec-2007  ad Sync with head.
 1.100.12.2 17-Jan-2009  mjf Sync with HEAD.
 1.100.12.1 02-Jun-2008  mjf Sync with HEAD.
 1.102.2.1 18-May-2008  yamt sync with head.
 1.104.2.4 11-Aug-2010  yamt sync with head.
 1.104.2.3 11-Mar-2010  yamt sync with head
 1.104.2.2 04-May-2009  yamt sync with head.
 1.104.2.1 16-May-2008  yamt sync with head.
 1.105.6.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.105.6.1 19-Oct-2008  haad Sync with HEAD.
 1.105.2.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.105.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.107.2.2 28-Apr-2009  skrll Sync with HEAD.
 1.107.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.110.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.113.4.1 05-Mar-2011  rmind sync with head
 1.113.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.115.6.1 24-Feb-2012  mrg sync to -current.
 1.115.2.1 17-Apr-2012  yamt sync with head
 1.116.14.1 17-Jan-2015  martin Pull up following revision(s) (requested by maxv in ticket #427):
sys/compat/svr4/svr4_schedctl.c: revision 1.8
sys/netinet/tcp_timer.c: revision 1.88
sys/miscfs/genfs/layer_vfsops.c: revision 1.45
sys/compat/svr4/svr4_ioctl.c: revision 1.37
sys/ufs/chfs/chfs_vfsops.c: revision 1.14
sys/miscfs/fdesc/fdesc_vfsops.c: revision 1.91
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.30
sys/compat/common/kern_time_50.c: revision 1.28
sys/netinet6/ip6_forward.c: revision 1.74
sys/miscfs/umapfs/umap_vnops.c: revision 1.57
sys/compat/svr4/svr4_fcntl.c: revision 1.74
distrib/sets/lists/comp/mi: revision 1.1931
sys/netinet6/udp6_output.c: revision 1.46
sys/fs/puffs/puffs_compat.c: revision 1.3
sys/fs/udf/udf_rename.c: revision 1.11
sys/compat/svr4/svr4_filio.c: revision 1.24
sys/fs/udf/udf_rename.c: revision 1.12
sys/netinet/tcp_usrreq.c: revision 1.202
sys/miscfs/umapfs/umap_subr.c: revision 1.29
sys/compat/linux/common/linux_fadvise64.c: revision 1.3
sys/netinet/if_atm.c: revision 1.34
sys/miscfs/procfs/procfs_subr.c: revision 1.106
sys/miscfs/genfs/layer_subr.c: revision 1.37
sys/netinet/tcp_sack.c: revision 1.30
sys/compat/freebsd/freebsd_misc.c: revision 1.33
sys/compat/freebsd/freebsd_file.c: revision 1.33
sys/ufs/chfs/chfs_vnode.c: revision 1.12
sys/compat/svr4/svr4_ttold.c: revision 1.34
sys/compat/linux/common/linux_file.c: revision 1.114
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.43
sys/compat/linux/common/linux_signal.c: revision 1.76
sys/compat/common/compat_util.c: revision 1.46
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.18
sys/compat/svr4/svr4_sockio.c: revision 1.36
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.32
sys/compat/svr4/svr4_signal.c: revision 1.66
sys/kern/kern_exec.c: revision 1.410
sys/fs/puffs/puffs_vfsops.c: revision 1.115
sys/compat/svr4/svr4_exec_elf64.c: revision 1.15
sys/compat/linux/arch/i386/linux_machdep.c: revision 1.159
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.50
sys/compat/linux32/common/linux32_misc.c: revision 1.24
sys/netinet/in_pcb.c: revision 1.153
sys/sys/malloc.h: revision 1.116
sys/compat/common/if_43.c: revision 1.9
share/man/man9/Makefile: revision 1.380
sys/netinet/tcp_vtw.c: revision 1.12
sys/miscfs/umapfs/umap_vfsops.c: revision 1.95
sys/ufs/ext2fs/ext2fs_vfsops.c: revision 1.186
sys/compat/common/uipc_syscalls_43.c: revision 1.46
sys/ufs/ext2fs/ext2fs_vnops.c: revision 1.115
sys/fs/puffs/puffs_msgif.c: revision 1.97
sys/compat/svr4/svr4_ipc.c: revision 1.27
sys/compat/linux/common/linux_exec.c: revision 1.117
sys/ufs/ext2fs/ext2fs_readwrite.c: revision 1.66
sys/netinet/tcp_output.c: revision 1.179
sys/compat/svr4/svr4_termios.c: revision 1.28
sys/fs/udf/udf_strat_bootstrap.c: revision 1.4
sys/fs/puffs/puffs_subr.c: revision 1.67
sys/fs/puffs/puffs_node.c: revision 1.36
sys/miscfs/overlay/overlay_vnops.c: revision 1.21
sys/fs/cd9660/cd9660_node.c: revision 1.34
sys/netinet/raw_ip.c: revision 1.146
sys/sys/mallocvar.h: revision 1.13
sys/miscfs/overlay/overlay_vfsops.c: revision 1.63
share/man/man9/malloc.9: revision 1.50
sys/netinet6/dest6.c: revision 1.18
sys/compat/linux/common/linux_uselib.c: revision 1.33
sys/compat/linux/common/linux_socket.c: revision 1.120
share/man/man9/malloc.9: revision 1.51
sys/netinet/tcp_subr.c: revision 1.257
sys/compat/linux/common/linux_socketcall.c: revision 1.45
sys/compat/linux/common/linux_fadvise64_64.c: revision 1.3
sys/compat/freebsd/freebsd_ipc.c: revision 1.17
sys/compat/linux/common/linux_misc_notalpha.c: revision 1.109
sys/compat/linux/arch/alpha/linux_pipe.c: revision 1.17
sys/netinet6/in6_pcb.c: revision 1.132
sys/netinet6/in6_ifattach.c: revision 1.94
sys/compat/svr4/svr4_exec_elf32.c: revision 1.15
sys/miscfs/nullfs/null_vfsops.c: revision 1.90
sys/fs/cd9660/cd9660_util.c: revision 1.12
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.48
sys/compat/freebsd/freebsd_exec_elf32.c: revision 1.20
sys/miscfs/procfs/procfs_vfsops.c: revision 1.94
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.28
sys/compat/linux/common/linux_sched.c: revision 1.67
sys/compat/linux/common/linux_exec_aout.c: revision 1.67
sys/compat/linux/common/linux_pipe.c: revision 1.67
sys/compat/linux/common/linux_llseek.c: revision 1.34
sys/compat/linux/arch/mips/linux_ptrace.c: revision 1.10
Do not uselessly include <sys/malloc.h>.
Cleanup:
- remove struct kmembuckets (dead)
- correctly deadify MALLOC_XX
- remove MALLOC_DEFINE_LIMIT and MALLOC_JUSTDEFINE_LIMIT (dead)
- remove malloc_roundup(), malloc_type_setlimit(), MALLOC_DEFINE_LIMIT()
and MALLOC_JUSTDEFINE_LIMIT() from man 9 malloc
New sentence, new line. Bump date for previous.
Obsolete malloc_roundup(9), malloc_type_setlimit(9) and MALLOC_DEFINE_LIMIT(9)
man pages.
 1.116.2.1 03-Dec-2017  jdolecek update from HEAD
 1.118.2.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.118.2.1 21-May-2018  pgoyette Sync with HEAD
 1.119.2.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.119.2.1 10-Jun-2019  christos Sync with HEAD
 1.120.6.1 29-Feb-2020  ad Sync with head.
 1.121.4.1 25-Apr-2020  bouyer Sync with bouyer-xenpvh-base2 (HEAD)
 1.55 26-Nov-2021  ryo - LINUX_GO_RT0_SIGNATURE for compat_linux is no longer enabled by default.
it is now defined in each arch same as the other *_SIGNATURE definitions.
- add new LINUX32_GO_RT0_SIGNATURE for compat_linux32, and is defined in amd64 and aarch64.
 1.54 23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.53 22-Aug-2018  msaitoh - Cleanup for dynamic sysctl:
- Remove unused *_NAMES macros for sysctl.
- Remove unused *_MAXID for sysctls.
- Move CTL_MACHDEP sysctl definitions for m68k into m68k/include/cpu.h and
use them on all m68k machines.
 1.52 12-Feb-2017  chs branches: 1.52.12; 1.52.14;
es_arglen is now in units of bytes, update the emulations accordingly.
 1.51 21-Feb-2014  maxv branches: 1.51.6; 1.51.10; 1.51.14;
Increase LINUX32_ELF_AUX_ENTRIES to avoid overrun in linux32/. Also,
add comments and KASSERTs to make sure people don't forget to increase
XX_AUX_ENTRIES's when adding vectors.

Reported by martin@ (CV), with suggestions from chs@.

ok martin@ chs@
 1.50 09-Feb-2014  chs account for the 16 bytes of AT_RANDOM data in the stack setup. fixes PR 48518.
use cprng_strong32() instead of random(). add AT_RANDOM support for linux32.
 1.49 18-Nov-2013  chs implement AT_RANDOM.
 1.48 07-Jul-2010  chs branches: 1.48.8; 1.48.18; 1.48.22;
many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
- support new-style (NPTL) linux pthreads on all platforms.
clone() with CLONE_THREAD uses 1 process with many LWPs
instead of separate processes.
- move the contents of sys__lwp_setprivate() into a new
lwp_setprivate() and use that everywhere.
- update linux_release[] and linux32_release[] to "2.6.18".
- adjust placement of emul fork/exec/exit hooks as needed
and adjust other emul code to match.
- convert all struct emul definitions to use named initializers.
- change the pid allocator to allow multiple pids to refer to the same proc.
- remove a few fields from struct proc that are no longer needed.
- disable the non-functional "vdso" code in linux32/amd64,
glibc works fine without it.
- fix a race in the futex code where we could miss a wakeup after
a requeue operation.
- redo futex locking to be a little more efficient.
 1.47 10-Dec-2009  matt branches: 1.47.2; 1.47.4;
Change u_long to vaddr_t/vsize_t in exec code where appropriate (mostly
involves setregs and vmcmds). Should result in no code differences.
 1.46 15-Aug-2009  matt Include <sys/exec_aout.h> explicitly instead of relying on <sys/exec.h> to
do it for you.
 1.45 19-Nov-2008  ad Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.44 25-Oct-2008  christos branches: 1.44.2;
Add preliminary tls support for i386. Does not work yet. From FreeBSD.
 1.43 28-Apr-2008  martin branches: 1.43.6;
Remove clause 3 and 4 from TNF licenses
 1.42 04-Dec-2007  dsl branches: 1.42.12; 1.42.14; 1.42.16;
Remove all the __P
 1.41 15-Feb-2007  ad branches: 1.41.18; 1.41.20; 1.41.26; 1.41.28;
Fix Linux compat on amd64.
 1.40 09-Feb-2007  ad Merge newlock2 to head.
 1.39 23-Aug-2006  manu branches: 1.39.2;
1) Complete Linux exit_group() emulation
Members of the thread group must die without reporting to the parent and
without going to zombie stage. We do that by reparenting to init before
catching a SIGKILL. The parent will not see the child death.

The thread group leader must report the exit status, even if it exits
because of another thread calling exit_group(). We do that by storing the
exit status in struct linux_emuldata_shared, and the exit hook has the
duty of setting struct proc's p_xstat for the thread group leader.

2) For exit/fork/exec hooks, move the NPTL specific code to separate functions
that are shared between COMPAT_LINUX and COMPAT_LINUX32

3) Fix LINUX_CLONE_PARENT_SETTID semantics
 1.38 07-Aug-2006  manu Add a new signature test for linux probe function. We look for a .debuglink
section, which is specific to the Linux dynamic interpeter (yes, Linux
can execute it as a stand alone program)
 1.37 09-Feb-2006  manu branches: 1.37.2;
Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.36 11-Dec-2005  christos branches: 1.36.2; 1.36.4; 1.36.6;
merge ktrace-lwp.
 1.35 20-May-2005  fvdl branches: 1.35.2;
Define linux_usertrap function, and set it in struct emul. For all
but amd64, it just returns 0, doing nothing.

For amd64, it implements vsyscalls through cheating: if the faulting
address is in the vsyscall area (which is statically known on Linux/amd64),
and the intruction pointer is too, it must have been a vsyscall. In that
case, retrieve the return address from the user stack, fix up %rip and
%rsp, and just execute the normal system call. It will return as if
the vsyscall has been executed.
 1.34 03-May-2005  manu First work on COMPAT_LINUX/amd64
Process startup and dynamiclinking work, but processes hang due to
Linux arch_prctl(2) not being really supported yet.
 1.33 26-Feb-2005  perry nuke trailing whitespace
 1.32 26-Mar-2004  drochner branches: 1.32.8; 1.32.10;
all ports define __HAVE_SIGINFO now, so remove the CPP conditionals
 1.31 25-Sep-2003  christos constify sendsig/trapsignal
 1.30 06-Sep-2003  christos SA_SIGINFO changes
 1.29 29-Jun-2003  fvdl branches: 1.29.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.28 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.27 09-Apr-2003  thorpej Use PAGE_SIZE rather than NBPG.
 1.26 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.25 21-Nov-2002  jdolecek back previous off; port can only supply LINUX_ELF_AUX_ENTRIES if it also
overrides the ELF copyargs function
 1.24 15-Nov-2002  wdk Fix LINUX_ELF_AUX_ENTRIES sociability issue with Mips based ports
 1.23 13-Nov-2002  jdolecek add generic linux compat ELF copyargs function

this gives:
* linux sysconf(_SC_CLK_TCK) gives correct value for linux binaries (hz)
even if hz != 100
* glibc gets proper information on real/effective uid and enables
secure mode for suid binaries

g/c LINUX_COPYARGS_FUNCTION, replaced by linux ELF copyargs function
g/c alpha-specific linux ELF copyargs function and linux ELF defines
 1.22 26-Aug-2002  christos Implement passing AT_{E,R}{U,G}ID in the elf aux vector, like solaris.
- pass struct proc to copyargs.
- eliminate svr4_copyargs, since it is the same as ours now.
 1.21 02-Apr-2002  jdolecek branches: 1.21.2;
rename sysctl_linux() to linux_sysctl() and hook it into emul_linux
 1.20 21-Mar-2002  christos Don't bitch if we don't have support for a particular arch. This makes it
easier to include this header from userland binaries [sysctl] on archs that
don't support compat-linux without incurring ifdef hell.
 1.19 20-Mar-2002  christos emulation specific sysctls. Also change the kernel date to nov 11 as requested
by bad.
 1.18 14-Jan-2002  bjh21 Crude first cut at ARMLinux binary compatibility. Successfully runs
"/emul/linux/bin/echo hello, world", dynamically linked.
 1.17 22-Sep-2001  manu Enable Mips Linux emulation in header files
 1.16 29-Jul-2001  christos branches: 1.16.2;
Adjust to the new copyargs() footprint.
 1.15 18-Jun-2001  christos branches: 1.15.2;
Add an e_trapsignal member to struct emul, so that emulated processes can
send the appropriate signal depending on the trap type.
 1.14 19-Jan-2001  manu branches: 1.14.2;
Added Linux compatibility support for powerpc ports
 1.13 21-Nov-2000  jdolecek restructure struct emul and execsw, in preparation to make emulations LKMable:
* move all exec-type specific information from struct emul to execsw[] and
provide single struct emul per emulation
* elf:
- kern/exec_elf32.c:probe_funcs[] is gone, execsw[] how has one entry
per emulation and contains pointer to respective probe function
- interp is allocated via MALLOC() rather than on stack
- elf_args structure is allocated via MALLOC() rather than malloc()
* ecoff: the per-emulation hooks moved from alpha and mips specific code
to OSF1 and Ultrix compat code as appropriate, execsw[] has one entry per
emulation supporting ecoff with appropriate probe function
* the makecmds/probe functions don't set emulation, pointer to emulation is
part of appropriate execsw[] entry
* constify couple of structures
 1.12 15-Dec-1998  itohy branches: 1.12.8;
Added linux compat support on m68k ports.
 1.11 04-Oct-1998  fvdl Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.10 03-Oct-1998  christos Attempt to fix the mess.
 1.9 01-Oct-1998  erh Move compat/linux/linux_exec.h to common.
 1.8 24-Jan-1998  mycroft Prototype new functions.
 1.7 26-Sep-1996  cgd branches: 1.7.14;
adapt ELF-using compat code to use new ELF definitions/code. At this point,
these are restricted to 32-bit ELF, and should be severely cleaned.
 1.6 13-Jun-1996  christos - Pass the Elf32_Ehdr in the linux probe function, and use it!

Since linux binaries are (mostly) always compiled with gcc, look for
the gcc signature in the .comment section header: "\0 GCC: (GNU) ".
I've changed the probe order in kern/exec_elf.c to probe for linux ELF
binaries first and fall back to SVR4 binaries. This makes statically
linked binaries work for both linux and svr4. Note that gcc-compiled
svr4 binaries, still contain the operating system signature first and
then the GCC signature, so there is no conflict. Yes this is a hack.
 1.5 07-Oct-1995  mycroft Prefix names of system call implementation functions with `sys_'.
 1.4 22-Jun-1995  fvdl * Changed to use generic ELF code from kern/exec_elf.c (which was taken
from the svr4 exec code plus the linux compat mods)
* Include file change
* Add multicast sockopts (from John Brezak)
 1.3 11-Jun-1995  fvdl * Make Linux ELF binaries work. Lots of code duplication, but it will have to do
for now.
* Add a sanity check in linux_uselib
 1.2 07-Apr-1995  fvdl Handle Linux signal tramp code differently. Some changes because of the
now seperate Linux signal trampoline code. Add linux_sigreturn to
syscalls.master.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.7.14.1 29-Jan-1998  mellon Pull up 1.8 (mycroft)
 1.12.8.2 11-Feb-2001  bouyer Sync with HEAD.
 1.12.8.1 22-Nov-2000  bouyer Sync with HEAD.
 1.14.2.9 11-Dec-2002  thorpej Sync with HEAD.
 1.14.2.8 27-Aug-2002  nathanw Catch up to -current.
 1.14.2.7 17-Apr-2002  nathanw Catch up to -current.
 1.14.2.6 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.14.2.5 28-Feb-2002  nathanw Catch up to -current.
 1.14.2.4 26-Sep-2001  nathanw Catch up to -current.
Again.
 1.14.2.3 24-Aug-2001  nathanw Catch up with -current.
 1.14.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.14.2.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.15.2.5 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.15.2.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.15.2.3 11-Feb-2002  jdolecek Sync w/ -current.
 1.15.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.15.2.1 03-Aug-2001  lukem update to -current
 1.16.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.21.2.1 29-Aug-2002  gehenna catch up with -current.
 1.29.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.29.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.29.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.29.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.29.2.2 03-Aug-2004  skrll Sync with HEAD
 1.29.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.32.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.32.8.1 29-Apr-2005  kent sync with -current
 1.35.2.4 07-Dec-2007  yamt sync with head
 1.35.2.3 26-Feb-2007  yamt sync with head.
 1.35.2.2 30-Dec-2006  yamt sync with head.
 1.35.2.1 21-Jun-2006  yamt sync with head.
 1.36.6.1 22-Apr-2006  simonb Sync with head.
 1.36.4.1 09-Sep-2006  rpaulo sync with head
 1.36.2.1 18-Feb-2006  yamt sync with head.
 1.37.2.2 03-Sep-2006  yamt sync with head.
 1.37.2.1 11-Aug-2006  yamt sync with head
 1.39.2.1 24-Oct-2006  ad - Redo LWP locking slightly and fix some races.
- Fix some locking botches.
- Make signal mask / stack per-proc for SA processes.
- Add _lwp_kill().
 1.41.28.1 08-Dec-2007  ad Sync with head.
 1.41.26.1 08-Dec-2007  mjf Sync with HEAD.
 1.41.20.1 09-Jan-2008  matt sync with HEAD
 1.41.18.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.42.16.5 11-Aug-2010  yamt sync with head.
 1.42.16.4 11-Mar-2010  yamt sync with head
 1.42.16.3 19-Aug-2009  yamt sync with head.
 1.42.16.2 04-May-2009  yamt sync with head.
 1.42.16.1 16-May-2008  yamt sync with head.
 1.42.14.1 18-May-2008  yamt sync with head.
 1.42.12.2 17-Jan-2009  mjf Sync with HEAD.
 1.42.12.1 02-Jun-2008  mjf Sync with HEAD.
 1.43.6.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.44.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.47.4.1 05-Mar-2011  rmind sync with head
 1.47.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.48.22.1 18-May-2014  rmind sync with head
 1.48.18.2 03-Dec-2017  jdolecek update from HEAD
 1.48.18.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.48.8.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.51.14.1 21-Apr-2017  bouyer Sync with HEAD
 1.51.10.1 20-Mar-2017  pgoyette Sync with HEAD
 1.51.6.1 28-Aug-2017  skrll Sync with HEAD
 1.52.14.1 10-Jun-2019  christos Sync with HEAD
 1.52.12.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.68 18-Oct-2015  maxv Make sure we have space for the aout header.
 1.67 09-Nov-2014  maxv branches: 1.67.2;
Do not uselessly include <sys/malloc.h>.
 1.66 15-Aug-2009  matt branches: 1.66.22; 1.66.38;
Include <sys/exec_aout.h> explicitly instead of relying on <sys/exec.h> to
do it for you.
 1.65 28-Apr-2008  martin branches: 1.65.2;
Remove clause 3 and 4 from TNF licenses
 1.64 08-Dec-2007  dsl branches: 1.64.12; 1.64.14; 1.64.16;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.63 04-Dec-2007  dsl Remove all the __P
 1.62 19-Oct-2007  ad branches: 1.62.2; 1.62.4;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.61 09-Feb-2007  ad branches: 1.61.6; 1.61.18; 1.61.20; 1.61.24;
Merge newlock2 to head.
 1.60 16-Nov-2006  christos __unused removal on arguments; approved by core.
 1.59 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.58 11-Dec-2005  christos branches: 1.58.20; 1.58.22;
merge ktrace-lwp.
 1.57 26-Feb-2005  perry branches: 1.57.4;
nuke trailing whitespace
 1.56 30-Jan-2005  christos Don't try to map a 0 size bss.
 1.55 08-Aug-2003  christos branches: 1.55.8; 1.55.10;
- GC all the setup_stack functions
- add one for linux/i386
 1.54 29-Jun-2003  fvdl branches: 1.54.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.53 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.52 01-Apr-2003  thorpej Use PAGE_SIZE rather than NBPG.
 1.51 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.50 05-Oct-2002  chs count executable image pages as executable for vm-usage purposes.
also, always do the VTEXT vs. v_writecount mutual exclusion
(which we previously skipped if the text or data segment was empty).
 1.49 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.48 26-Aug-2002  christos Implement passing AT_{E,R}{U,G}ID in the elf aux vector, like solaris.
- pass struct proc to copyargs.
- eliminate svr4_copyargs, since it is the same as ours now.
 1.47 13-Nov-2001  lukem branches: 1.47.8; 1.47.10;
add RCSIDs (including regeneration of files as appropriate)
 1.46 30-Oct-2001  thorpej - Add a new vnode flag VEXECMAP, which indicates that a vnode has
executable mappings. Stop overloading VTEXT for this purpose (VTEXT
also has another meaning).
- Rename vn_marktext() to vn_markexec(), and use it when executable
mappings of a vnode are established.
- In places where we want to set VTEXT, set it in v_flag directly, rather
than making a function call to do this (it no longer makes sense to
use a function call, since we no longer overload VTEXT with VEXECMAP's
meaning).

VEXECMAP suggested by Chuq Silvers.
 1.45 29-Jul-2001  christos branches: 1.45.4;
Adjust to the new copyargs() footprint.
 1.44 01-Dec-2000  jdolecek branches: 1.44.2; 1.44.4;
put linux_sys_uselib() to separate file linux_uselib.c
 1.43 01-Dec-2000  jdolecek add e_path (emulation path) to struct emul, which replaces emulation-specific
*_emul_path variables

change macros CHECK_ALT_{CREAT|EXIST} to use that, 'root' doesn't need
to be passed explicitly any more and *_CHECK_ALT_{CREAT|EXIST} are removed
change explicit emul_find() calls in probe functions to get the emulation
path from the checked exec switch entry's emulation

remove no longer needed header files

add e_flags and e_syscall to struct emul; these are unsed and empty for now
 1.42 21-Nov-2000  jdolecek restructure struct emul and execsw, in preparation to make emulations LKMable:
* move all exec-type specific information from struct emul to execsw[] and
provide single struct emul per emulation
* elf:
- kern/exec_elf32.c:probe_funcs[] is gone, execsw[] how has one entry
per emulation and contains pointer to respective probe function
- interp is allocated via MALLOC() rather than on stack
- elf_args structure is allocated via MALLOC() rather than malloc()
* ecoff: the per-emulation hooks moved from alpha and mips specific code
to OSF1 and Ultrix compat code as appropriate, execsw[] has one entry per
emulation supporting ecoff with appropriate probe function
* the makecmds/probe functions don't set emulation, pointer to emulation is
part of appropriate execsw[] entry
* constify couple of structures
 1.41 13-Nov-2000  jdolecek change the type of *syscallnames[] array to 'const char * const foo[]'
 1.40 29-Jun-2000  mrg remove include of <vm/vm.h>
 1.39 26-Jun-2000  mrg remove redundant vm includes.
 1.38 11-Apr-2000  chs add a new function vn_marktext() for exec code to let others know
that the vnode is now being used as process text.
 1.37 09-Feb-1999  christos branches: 1.37.4; 1.37.8;
const poisoning.
 1.36 23-Oct-1998  veego Include linux_errno.h to fix the recent error->errno losage.
 1.35 23-Oct-1998  erh Change linux_error to native_to_linux_errno. Add some (unrelated) debugging printfs.
 1.34 07-Oct-1998  erh The siginfo include line is not needed here anymore.
 1.33 04-Oct-1998  fvdl Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.32 03-Oct-1998  christos Attempt to fix the mess.
 1.31 01-Oct-1998  erh Split compat/linux/linux_exec.c into common, elf and a.out parts.
 1.30 11-Sep-1998  mycroft Substantial signal handling changes:
* Increase the size of sigset_t to accomodate 128 signals -- adding new
versions of sys_setprocmask(), sys_sigaction(), sys_sigpending() and
sys_sigsuspend() to handle the changed arguments.
* Abstract the guts of sys_sigaltstack(), sys_setprocmask(), sys_sigaction(),
sys_sigpending() and sys_sigsuspend() into separate functions, and call them
from all the emulations rather than hard-coding everything. (Avoids uses
the stackgap crap for these system calls.)
* Add a new flag (p_checksig) to indicate that a process may have signals
pending and userret() needs to do the full (slow) check.
* Eliminate SAS_ALTSTACK; it's exactly the inverse of SS_DISABLE.
* Correct emulation bugs with restoring SS_ONSTACK.
* Make the signal mask in the sigcontext always use the emulated mask format.
* Store signals internally in sigaction structures, rather than maintaining a
bunch of little sigsets for each SA_* bit.
* Keep track of where we put the signal trampoline, rather than figuring it out
in *_sendsig().
* Issue a warning when a non-emulated sigaction bit is observed.
* Add missing emulated signals, and a native SIGPWR (currently not used).
* Implement the `not reset when caught' semantics for relevant signals.

Note: Only code touched by the i386 port has been modified. Other ports and
emulations need to be updated.
 1.29 05-Sep-1998  christos Assign copyright to TNF.
 1.28 09-Aug-1998  perry bzero->memset, bcopy->memcpy, bcmp->memcmp
 1.27 28-Jul-1998  thorpej Change the "aresid" argument of vn_rdwr() from an int * to a size_t *,
to match the new uio_resid type.
 1.26 24-Jan-1998  mycroft Use linux_setregs().
 1.25 13-Oct-1996  christos branches: 1.25.14;
catch up with Jason's exec.h inclusion.
 1.24 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.23 07-Oct-1996  cgd include <sys/exec.h> rather than <machine/exec.h>
 1.22 05-Oct-1996  jtk update to compile; needs new enum name 'Elf_sht_progbits'
 1.21 03-Oct-1996  cgd kill (re)definitions of EXEC_ELF32. They're no longer necessary
(because of the EXEC_* option changes), and now cause warnings.
 1.20 03-Oct-1996  thorpej Fix a section header check that didn't get updated with the elf32/elf64
changes. Make this compile again with the new EXEC_* options.
 1.19 30-Sep-1996  christos Elf32_sht_progbits -> Elf_sht_progbits
 1.18 27-Sep-1996  cgd slightly clean up some of the changes made when ELF64 support went in
 1.17 26-Sep-1996  cgd adapt ELF-using compat code to use new ELF definitions/code. At this point,
these are restricted to 32-bit ELF, and should be severely cleaned.
 1.16 03-Sep-1996  mycroft Define execv() and execve() consistently across emulations.
Do path name translation.
 1.15 13-Jun-1996  christos Simplify and add comments.
 1.14 13-Jun-1996  christos - Pass the Elf32_Ehdr in the linux probe function, and use it!

Since linux binaries are (mostly) always compiled with gcc, look for
the gcc signature in the .comment section header: "\0 GCC: (GNU) ".
I've changed the probe order in kern/exec_elf.c to probe for linux ELF
binaries first and fall back to SVR4 binaries. This makes statically
linked binaries work for both linux and svr4. Note that gcc-compiled
svr4 binaries, still contain the operating system signature first and
then the GCC signature, so there is no conflict. Yes this is a hack.
 1.13 05-Apr-1996  christos branches: 1.13.4;
Prototyping changes.
 1.12 07-Oct-1995  mycroft Prefix names of system call implementation functions with `sys_'.
 1.11 19-Sep-1995  thorpej Make system calls conform to a standard prototype and bring those
prototypes into scope.
 1.10 14-Aug-1995  mycroft Rearrange #includes.
 1.9 24-Jun-1995  christos Use compat_util.[ch].
 1.8 22-Jun-1995  fvdl * Changed to use generic ELF code from kern/exec_elf.c (which was taken
from the svr4 exec code plus the linux compat mods)
* Include file change
* Add multicast sockopts (from John Brezak)
 1.7 11-Jun-1995  fvdl Don't forget to acknowledge that all the ELF stuff was taken from
Christos' svr4 code.
 1.6 11-Jun-1995  fvdl * Make Linux ELF binaries work. Lots of code duplication, but it will have to do
for now.
* Add a sanity check in linux_uselib
 1.5 16-May-1995  mycroft Generate the new ps_strings format.
 1.4 22-Apr-1995  christos - added struct emul to all emulations.
- removed all setup functions.
- added copyargs() functions where needed.
 1.3 07-Apr-1995  fvdl Handle Linux signal tramp code differently. Some changes because of the
now seperate Linux signal trampoline code. Add linux_sigreturn to
syscalls.master.
 1.2 05-Mar-1995  fvdl Added a few more system calls.
More consistent alternate root file semantics throughout.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.13.4.1 10-Dec-1996  mycroft From trunk:
Do execv() and execve() path name translation consistently across
emulations.
 1.25.14.1 29-Jan-1998  mellon Pull up 1.26 (mycroft)
 1.37.8.3 08-Dec-2000  bouyer Sync with HEAD.
 1.37.8.2 22-Nov-2000  bouyer Sync with HEAD.
 1.37.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.37.4.1 04-Jul-1999  chs after setting VTEXT on a vnode, flush any UBC mappings
to try to prevent unnecessary VAC aliases.
 1.44.4.4 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.44.4.3 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.44.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.44.4.1 03-Aug-2001  lukem update to -current
 1.44.2.5 18-Oct-2002  nathanw Catch up to -current.
 1.44.2.4 27-Aug-2002  nathanw Catch up to -current.
 1.44.2.3 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.44.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.44.2.1 24-Aug-2001  nathanw Catch up with -current.
 1.45.4.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.47.10.2 02-Oct-2003  tron Pull up revision 1.50 (requested by junyoung in ticket #1488):
count executable image pages as executable for vm-usage purposes.
also, always do the VTEXT vs. v_writecount mutual exclusion
(which we previously skipped if the text or data segment was empty).
 1.47.10.1 27-Sep-2003  tron Pull up revision 1.49 (requested by junyoung in ticket #1466):
remove trailing \n in panic(). approved perry.
 1.47.8.1 29-Aug-2002  gehenna catch up with -current.
 1.54.2.7 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.54.2.6 04-Feb-2005  skrll Sync with HEAD.
 1.54.2.5 04-Feb-2005  skrll Adapt to branch.
 1.54.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.54.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.54.2.2 03-Aug-2004  skrll Sync with HEAD
 1.54.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.55.10.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.55.10.1 12-Feb-2005  yamt sync with head.
 1.55.8.1 29-Apr-2005  kent sync with -current
 1.57.4.6 21-Jan-2008  yamt sync with head
 1.57.4.5 07-Dec-2007  yamt sync with head
 1.57.4.4 27-Oct-2007  yamt sync with head.
 1.57.4.3 26-Feb-2007  yamt sync with head.
 1.57.4.2 30-Dec-2006  yamt sync with head.
 1.57.4.1 21-Jun-2006  yamt sync with head.
 1.58.22.2 10-Dec-2006  yamt sync with head.
 1.58.22.1 22-Oct-2006  yamt sync with head
 1.58.20.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.58.20.1 18-Nov-2006  ad Sync with head.
 1.61.24.1 25-Oct-2007  bouyer Sync with HEAD.
 1.61.20.2 09-Jan-2008  matt sync with HEAD
 1.61.20.1 06-Nov-2007  matt sync with HEAD
 1.61.18.2 09-Dec-2007  jmcneill Sync with HEAD.
 1.61.18.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.61.6.1 23-Oct-2007  ad Sync with head.
 1.62.4.2 26-Dec-2007  ad Sync with head.
 1.62.4.1 08-Dec-2007  ad Sync with head.
 1.62.2.2 27-Dec-2007  mjf Sync with HEAD.
 1.62.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.64.16.2 19-Aug-2009  yamt sync with head.
 1.64.16.1 16-May-2008  yamt sync with head.
 1.64.14.1 18-May-2008  yamt sync with head.
 1.64.12.1 02-Jun-2008  mjf Sync with HEAD.
 1.65.2.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.65.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.66.38.1 17-Jan-2015  martin Pull up following revision(s) (requested by maxv in ticket #427):
sys/compat/svr4/svr4_schedctl.c: revision 1.8
sys/netinet/tcp_timer.c: revision 1.88
sys/miscfs/genfs/layer_vfsops.c: revision 1.45
sys/compat/svr4/svr4_ioctl.c: revision 1.37
sys/ufs/chfs/chfs_vfsops.c: revision 1.14
sys/miscfs/fdesc/fdesc_vfsops.c: revision 1.91
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.30
sys/compat/common/kern_time_50.c: revision 1.28
sys/netinet6/ip6_forward.c: revision 1.74
sys/miscfs/umapfs/umap_vnops.c: revision 1.57
sys/compat/svr4/svr4_fcntl.c: revision 1.74
distrib/sets/lists/comp/mi: revision 1.1931
sys/netinet6/udp6_output.c: revision 1.46
sys/fs/puffs/puffs_compat.c: revision 1.3
sys/fs/udf/udf_rename.c: revision 1.11
sys/compat/svr4/svr4_filio.c: revision 1.24
sys/fs/udf/udf_rename.c: revision 1.12
sys/netinet/tcp_usrreq.c: revision 1.202
sys/miscfs/umapfs/umap_subr.c: revision 1.29
sys/compat/linux/common/linux_fadvise64.c: revision 1.3
sys/netinet/if_atm.c: revision 1.34
sys/miscfs/procfs/procfs_subr.c: revision 1.106
sys/miscfs/genfs/layer_subr.c: revision 1.37
sys/netinet/tcp_sack.c: revision 1.30
sys/compat/freebsd/freebsd_misc.c: revision 1.33
sys/compat/freebsd/freebsd_file.c: revision 1.33
sys/ufs/chfs/chfs_vnode.c: revision 1.12
sys/compat/svr4/svr4_ttold.c: revision 1.34
sys/compat/linux/common/linux_file.c: revision 1.114
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.43
sys/compat/linux/common/linux_signal.c: revision 1.76
sys/compat/common/compat_util.c: revision 1.46
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.18
sys/compat/svr4/svr4_sockio.c: revision 1.36
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.32
sys/compat/svr4/svr4_signal.c: revision 1.66
sys/kern/kern_exec.c: revision 1.410
sys/fs/puffs/puffs_vfsops.c: revision 1.115
sys/compat/svr4/svr4_exec_elf64.c: revision 1.15
sys/compat/linux/arch/i386/linux_machdep.c: revision 1.159
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.50
sys/compat/linux32/common/linux32_misc.c: revision 1.24
sys/netinet/in_pcb.c: revision 1.153
sys/sys/malloc.h: revision 1.116
sys/compat/common/if_43.c: revision 1.9
share/man/man9/Makefile: revision 1.380
sys/netinet/tcp_vtw.c: revision 1.12
sys/miscfs/umapfs/umap_vfsops.c: revision 1.95
sys/ufs/ext2fs/ext2fs_vfsops.c: revision 1.186
sys/compat/common/uipc_syscalls_43.c: revision 1.46
sys/ufs/ext2fs/ext2fs_vnops.c: revision 1.115
sys/fs/puffs/puffs_msgif.c: revision 1.97
sys/compat/svr4/svr4_ipc.c: revision 1.27
sys/compat/linux/common/linux_exec.c: revision 1.117
sys/ufs/ext2fs/ext2fs_readwrite.c: revision 1.66
sys/netinet/tcp_output.c: revision 1.179
sys/compat/svr4/svr4_termios.c: revision 1.28
sys/fs/udf/udf_strat_bootstrap.c: revision 1.4
sys/fs/puffs/puffs_subr.c: revision 1.67
sys/fs/puffs/puffs_node.c: revision 1.36
sys/miscfs/overlay/overlay_vnops.c: revision 1.21
sys/fs/cd9660/cd9660_node.c: revision 1.34
sys/netinet/raw_ip.c: revision 1.146
sys/sys/mallocvar.h: revision 1.13
sys/miscfs/overlay/overlay_vfsops.c: revision 1.63
share/man/man9/malloc.9: revision 1.50
sys/netinet6/dest6.c: revision 1.18
sys/compat/linux/common/linux_uselib.c: revision 1.33
sys/compat/linux/common/linux_socket.c: revision 1.120
share/man/man9/malloc.9: revision 1.51
sys/netinet/tcp_subr.c: revision 1.257
sys/compat/linux/common/linux_socketcall.c: revision 1.45
sys/compat/linux/common/linux_fadvise64_64.c: revision 1.3
sys/compat/freebsd/freebsd_ipc.c: revision 1.17
sys/compat/linux/common/linux_misc_notalpha.c: revision 1.109
sys/compat/linux/arch/alpha/linux_pipe.c: revision 1.17
sys/netinet6/in6_pcb.c: revision 1.132
sys/netinet6/in6_ifattach.c: revision 1.94
sys/compat/svr4/svr4_exec_elf32.c: revision 1.15
sys/miscfs/nullfs/null_vfsops.c: revision 1.90
sys/fs/cd9660/cd9660_util.c: revision 1.12
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.48
sys/compat/freebsd/freebsd_exec_elf32.c: revision 1.20
sys/miscfs/procfs/procfs_vfsops.c: revision 1.94
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.28
sys/compat/linux/common/linux_sched.c: revision 1.67
sys/compat/linux/common/linux_exec_aout.c: revision 1.67
sys/compat/linux/common/linux_pipe.c: revision 1.67
sys/compat/linux/common/linux_llseek.c: revision 1.34
sys/compat/linux/arch/mips/linux_ptrace.c: revision 1.10
Do not uselessly include <sys/malloc.h>.
Cleanup:
- remove struct kmembuckets (dead)
- correctly deadify MALLOC_XX
- remove MALLOC_DEFINE_LIMIT and MALLOC_JUSTDEFINE_LIMIT (dead)
- remove malloc_roundup(), malloc_type_setlimit(), MALLOC_DEFINE_LIMIT()
and MALLOC_JUSTDEFINE_LIMIT() from man 9 malloc
New sentence, new line. Bump date for previous.
Obsolete malloc_roundup(9), malloc_type_setlimit(9) and MALLOC_DEFINE_LIMIT(9)
man pages.
 1.66.22.1 03-Dec-2017  jdolecek update from HEAD
 1.67.2.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.102 26-Nov-2021  ryo The internal architecture name of golang is "arm" or "arm64", which has
different naming conventions from netbsd's machine[] or machine_arch[]
("earmv7", "aarch64", etc.) and cannot be used as is.
Instead, use define LINUX_GO_RT0_SIGNATURE_ARCH{32,64}.
 1.101 26-Nov-2021  ryo - LINUX_GO_RT0_SIGNATURE for compat_linux is no longer enabled by default.
it is now defined in each arch same as the other *_SIGNATURE definitions.
- add new LINUX32_GO_RT0_SIGNATURE for compat_linux32, and is defined in amd64 and aarch64.
 1.100 12-Jan-2020  ad Tidy up the vnode locking around execve() on ELF images to acquire and
release the locks fewer times. Proposed on tech-kern a very long time go.
 1.99 01-Mar-2019  pgoyette branches: 1.99.6;
Rename the MODULE_*_HOOK() macros to MODULE_HOOK_*() as briefly
discussed on irc.

NFCI intended.

Ride the earlier kernel bump - it;s getting crowded.
 1.98 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.97 15-Jul-2018  christos - fix constants and explain limit
- use machine32 instead of hard-coded x86 stuff
 1.96 09-Jul-2018  msaitoh Fix compile error.
 1.95 08-Jul-2018  christos Enable executing linux go binaries by using a special probe function for them.
 1.94 06-Feb-2017  uwe branches: 1.94.12; 1.94.14;
Use ELFOSABI_LINUX instead of a magic number.
 1.93 11-Jun-2015  matt branches: 1.93.2; 1.93.4;
Force *stackp to (uintptr_t) before possibly moving to a smaller pointer size.
 1.92 20-Mar-2015  maxv Zero-fill the ELF auxiliary vectors. Otherwise, on 64bit systems, the
padding between a_v and a_type contains kernel garbage, therefore
exposed to userland.

Original report by uebayasi@
 1.91 15-Apr-2014  maxv branches: 1.91.2; 1.91.4;
A specially-crafted binary could easily control a kernel array index.
Add some checks to ensure that nothing will be read outside the allocated
area. Rewrite the code so that we don't need to allocate the whole section.

Spotted by several developers, patch from chs@/enami@
 1.90 23-Feb-2014  njoly branches: 1.90.2;
Fix wrong KASSERTs. Do not compare size vs. entries count.
 1.89 21-Feb-2014  maxv Increase LINUX32_ELF_AUX_ENTRIES to avoid overrun in linux32/. Also,
add comments and KASSERTs to make sure people don't forget to increase
XX_AUX_ENTRIES's when adding vectors.

Reported by martin@ (CV), with suggestions from chs@.

ok martin@ chs@
 1.88 09-Feb-2014  chs account for the 16 bytes of AT_RANDOM data in the stack setup. fixes PR 48518.
use cprng_strong32() instead of random(). add AT_RANDOM support for linux32.
 1.87 18-Nov-2013  chs implement AT_RANDOM.
 1.86 12-Feb-2012  matt branches: 1.86.2; 1.86.6; 1.86.8; 1.86.10; 1.86.16;
Change old-style function defintions to C89 prototypes.

Approved by releng.
 1.85 03-Feb-2012  matt Add a hook for freeing an ep_emul_arg. Add a wrapper routine
(exec_free_emul_arg) to call the hook and then clear the ep_emul_arg
and ep_emul_arg_free members in the exec_package.
Change users/accessors to use these routines.
Approved by releng.
 1.84 11-Sep-2010  chs branches: 1.84.8; 1.84.12;
always supply an auxiliary vector for linux ELF processes.
static executables (such as newer versions of /sbin/ldconfig)
require this to work properly. since static executables
also don't have a PT_PHDR entry, use the same heuristic as
linux does to provide a value for AT_PHDR in this case.
 1.83 15-Mar-2009  cegger branches: 1.83.2; 1.83.4;
ansify function definitions
 1.82 20-Nov-2008  ad branches: 1.82.4;
PR port-amd64/39964 modules/compat_linux: missing symbols on amd64
 1.81 28-Apr-2008  martin branches: 1.81.2; 1.81.6; 1.81.8; 1.81.10; 1.81.16; 1.81.20;
Remove clause 3 and 4 from TNF licenses
 1.80 19-Oct-2007  ad branches: 1.80.16; 1.80.18; 1.80.20;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.79 22-Apr-2007  dsl branches: 1.79.6; 1.79.8; 1.79.12;
Change the way that emulations locate files within the emulation root to
avoid having to allocate space in the 'stackgap'
- which is very LWP unfriendly.
The additional code for non-emulation namei() is trivial, the reduction for
the emulations is massive.
The vnode for a processes emulation root is saved in the cwdi structure
during process exec.
If the emulation root the TRYEMULROOT flag are set, namei() will do an initial
search for absolute pathnames in the emulation root, if that fails it will
retry from the normal root.
".." at the emulation root will always go to the real root, even in the middle
of paths and when expanding symlinks.
Absolute symlinks found using absolute paths in the emulation root will be
relative to the emulation root (so /usr/lib/xxx.so -> /lib/xxx.so links
inside the emulation root don't need changing).
If the root of the emulation would be returned (for an emulation lookup), then
the real root is returned instead (matching the behaviour of emul_lookup,
but being a cheap comparison here) so that programs that scan "../.."
looking for the root dircetory don't loop forever.
The target for symbolic links is no longer mangled (it used to get the
CHECK_ALT_xxx() treatment, so could get /emul/xxx prepended).
CHECK_ALT_xxx() are no more. Most of the change is deleting them, and adding
TRYEMULROOT to the flags to NDINIT().
A lot of the emulation system call stubs could now be deleted.
 1.78 04-Mar-2007  christos branches: 1.78.2; 1.78.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.77 09-Feb-2007  ad branches: 1.77.2;
Merge newlock2 to head.
 1.76 16-Nov-2006  christos __unused removal on arguments; approved by core.
 1.75 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.74 07-Aug-2006  manu branches: 1.74.4; 1.74.6;
Add a new signature test for linux probe function. We look for a .debuglink
section, which is specific to the Linux dynamic interpeter (yes, Linux
can execute it as a stand alone program)
 1.73 23-Jul-2006  ad Use the LWP cached credentials where sane.
 1.72 14-May-2006  elad integrate kauth.
 1.71 09-Feb-2006  manu branches: 1.71.2; 1.71.4; 1.71.6;
Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.70 11-Dec-2005  christos branches: 1.70.2; 1.70.4; 1.70.6;
merge ktrace-lwp.
 1.69 29-May-2005  christos branches: 1.69.2;
- sprinkle const.
- add XXXUNCONST to the emul_find() pbuf argument free'ing. XXX: this needs
an api change.
- avoid variable shadowing.
 1.68 03-May-2005  manu First work on COMPAT_LINUX/amd64
Process startup and dynamiclinking work, but processes hang due to
Linux arch_prctl(2) not being really supported yet.
 1.67 26-Feb-2005  perry nuke trailing whitespace
 1.66 31-Oct-2003  drochner branches: 1.66.8; 1.66.10;
adapt for changes to kern/exec_elf32.c
 1.65 27-Oct-2003  chs uninitialized variables
 1.64 29-Jun-2003  fvdl branches: 1.64.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.63 29-Jun-2003  darrenr 'struct proc *' -> 'struct lwp *' as required to get GENERIC for macppc built
 1.62 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.61 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.60 29-Nov-2002  jdolecek branches: 1.60.2;
Get the dynamic interpreter location using emul_find_interp(), so that
it checks both the alternative/emul tree, and the non-emul tree.
This makes it possible to run chrooted emulated binaries without need
to setup shadow /emul tree within the chroot hierarchy.
Only tested for COMPAT_LINUX, changes to other compat modules were
mechanical.
Fixes kern/19161 by Christian Groessler.
 1.59 13-Nov-2002  jdolecek add generic linux compat ELF copyargs function

this gives:
* linux sysconf(_SC_CLK_TCK) gives correct value for linux binaries (hz)
even if hz != 100
* glibc gets proper information on real/effective uid and enables
secure mode for suid binaries

g/c LINUX_COPYARGS_FUNCTION, replaced by linux ELF copyargs function
g/c alpha-specific linux ELF copyargs function and linux ELF defines
 1.58 22-Oct-2002  christos remove XXX should die comment from the define; otherwise traditional cpp
screws up the elf name formation.
 1.57 05-Sep-2002  christos check out EI_OSABI and EI_ABIVERSION for linux signatures. This is what
http://upx.sourceforge.net/ binaries are like.
 1.56 22-Mar-2002  christos gc debugging printfs.
 1.55 15-Feb-2002  christos s/printf/uprintf/
 1.54 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.53 30-Aug-2001  manu Changed the way signature tests are done. This makes possible to run
ld.so as an executable on the PowerPC (Linux's ldd does this), and it also
much clearer IMHO.
 1.52 14-Jul-2001  christos rename elf32_read_from to exec_read_from since it is used in many places
now.
 1.51 19-Jan-2001  manu branches: 1.51.2; 1.51.4;
Added a linux_atexit_signature to match Linux statically linked ELF binaries. It
searches for a __libc_atexit ELF section, which is specific to Linux
 1.50 15-Dec-2000  mycroft Tighten up the ELF signature checks, and actually look for the ABI tag added
in newer glibc versions.
 1.49 01-Dec-2000  jdolecek add e_path (emulation path) to struct emul, which replaces emulation-specific
*_emul_path variables

change macros CHECK_ALT_{CREAT|EXIST} to use that, 'root' doesn't need
to be passed explicitly any more and *_CHECK_ALT_{CREAT|EXIST} are removed
change explicit emul_find() calls in probe functions to get the emulation
path from the checked exec switch entry's emulation

remove no longer needed header files

add e_flags and e_syscall to struct emul; these are unsed and empty for now
 1.48 21-Nov-2000  jdolecek restructure struct emul and execsw, in preparation to make emulations LKMable:
* move all exec-type specific information from struct emul to execsw[] and
provide single struct emul per emulation
* elf:
- kern/exec_elf32.c:probe_funcs[] is gone, execsw[] how has one entry
per emulation and contains pointer to respective probe function
- interp is allocated via MALLOC() rather than on stack
- elf_args structure is allocated via MALLOC() rather than malloc()
* ecoff: the per-emulation hooks moved from alpha and mips specific code
to OSF1 and Ultrix compat code as appropriate, execsw[] has one entry per
emulation supporting ecoff with appropriate probe function
* the makecmds/probe functions don't set emulation, pointer to emulation is
part of appropriate execsw[] entry
* constify couple of structures
 1.47 17-Nov-2000  erh Make the linux compatibilty code work on the alpha. (horay!) (at last!)
Two main changes:
Create a linux_elf64_copyargs that uses the linux specific LinuxAuxInfo
structure. This is only used on the alpha. i386 and m68k use the
standard elf copyargs function.

Since linux's approach to binary compatibilty is to look as much
like osf1 as possible, add all the osf1 syscalls that we have
implemented to the linux syscall table. This includes get/setsysinfo,
ported from FreeBSD.

In order for linux compat to work you must have COMPAT_OSF1, COMPAT_43,
COMPAT_09, COMPAT_12 and COMPAT_13 on also.
 1.46 13-Nov-2000  jdolecek change the type of *syscallnames[] array to 'const char * const foo[]'
 1.45 29-Jun-2000  mrg remove include of <vm/vm.h>
 1.44 26-Jun-2000  mrg remove redundant vm includes.
 1.43 25-Oct-1999  kleink Update to match new SVR4-style definition names in <sys/exec_elf.h>.
 1.42 30-Apr-1999  cgd branches: 1.42.2; 1.42.4; 1.42.6;
compute the value to be used for e_arglen via howmany(value, sizeof (char *)),
rather than just "value / sizeof (char *)". While in these cases the latter
works as well, the former's a better example for other uses to copy (since
it handles the non-integral multiple case correctly).
 1.41 09-Feb-1999  christos branches: 1.41.4;
const poisoning.
 1.40 05-Nov-1998  erh Make sure the interpreter string is long enough to check against.
 1.39 23-Oct-1998  veego Include linux_errno.h to fix the recent error->errno losage.
 1.38 23-Oct-1998  erh Change linux_error to native_to_linux_errno. Add some (unrelated) debugging printfs.
 1.37 07-Oct-1998  erh The siginfo include line is not needed here anymore.
 1.36 04-Oct-1998  christos unobfuscate: !strncmp() != 0 -> strncmp() == 0
 1.35 04-Oct-1998  fvdl Fix wrong strncmp test.
 1.34 04-Oct-1998  fvdl Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.33 03-Oct-1998  christos Remove stray debugging printfs
 1.32 03-Oct-1998  christos Attempt to fix the mess.
 1.31 01-Oct-1998  erh Split compat/linux/linux_exec.c into common, elf and a.out parts.
 1.30 11-Sep-1998  mycroft Substantial signal handling changes:
* Increase the size of sigset_t to accomodate 128 signals -- adding new
versions of sys_setprocmask(), sys_sigaction(), sys_sigpending() and
sys_sigsuspend() to handle the changed arguments.
* Abstract the guts of sys_sigaltstack(), sys_setprocmask(), sys_sigaction(),
sys_sigpending() and sys_sigsuspend() into separate functions, and call them
from all the emulations rather than hard-coding everything. (Avoids uses
the stackgap crap for these system calls.)
* Add a new flag (p_checksig) to indicate that a process may have signals
pending and userret() needs to do the full (slow) check.
* Eliminate SAS_ALTSTACK; it's exactly the inverse of SS_DISABLE.
* Correct emulation bugs with restoring SS_ONSTACK.
* Make the signal mask in the sigcontext always use the emulated mask format.
* Store signals internally in sigaction structures, rather than maintaining a
bunch of little sigsets for each SA_* bit.
* Keep track of where we put the signal trampoline, rather than figuring it out
in *_sendsig().
* Issue a warning when a non-emulated sigaction bit is observed.
* Add missing emulated signals, and a native SIGPWR (currently not used).
* Implement the `not reset when caught' semantics for relevant signals.

Note: Only code touched by the i386 port has been modified. Other ports and
emulations need to be updated.
 1.29 05-Sep-1998  christos Assign copyright to TNF.
 1.28 09-Aug-1998  perry bzero->memset, bcopy->memcpy, bcmp->memcmp
 1.27 28-Jul-1998  thorpej Change the "aresid" argument of vn_rdwr() from an int * to a size_t *,
to match the new uio_resid type.
 1.26 24-Jan-1998  mycroft Use linux_setregs().
 1.25 13-Oct-1996  christos branches: 1.25.14;
catch up with Jason's exec.h inclusion.
 1.24 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.23 07-Oct-1996  cgd include <sys/exec.h> rather than <machine/exec.h>
 1.22 05-Oct-1996  jtk update to compile; needs new enum name 'Elf_sht_progbits'
 1.21 03-Oct-1996  cgd kill (re)definitions of EXEC_ELF32. They're no longer necessary
(because of the EXEC_* option changes), and now cause warnings.
 1.20 03-Oct-1996  thorpej Fix a section header check that didn't get updated with the elf32/elf64
changes. Make this compile again with the new EXEC_* options.
 1.19 30-Sep-1996  christos Elf32_sht_progbits -> Elf_sht_progbits
 1.18 27-Sep-1996  cgd slightly clean up some of the changes made when ELF64 support went in
 1.17 26-Sep-1996  cgd adapt ELF-using compat code to use new ELF definitions/code. At this point,
these are restricted to 32-bit ELF, and should be severely cleaned.
 1.16 03-Sep-1996  mycroft Define execv() and execve() consistently across emulations.
Do path name translation.
 1.15 13-Jun-1996  christos Simplify and add comments.
 1.14 13-Jun-1996  christos - Pass the Elf32_Ehdr in the linux probe function, and use it!

Since linux binaries are (mostly) always compiled with gcc, look for
the gcc signature in the .comment section header: "\0 GCC: (GNU) ".
I've changed the probe order in kern/exec_elf.c to probe for linux ELF
binaries first and fall back to SVR4 binaries. This makes statically
linked binaries work for both linux and svr4. Note that gcc-compiled
svr4 binaries, still contain the operating system signature first and
then the GCC signature, so there is no conflict. Yes this is a hack.
 1.13 05-Apr-1996  christos branches: 1.13.4;
Prototyping changes.
 1.12 07-Oct-1995  mycroft Prefix names of system call implementation functions with `sys_'.
 1.11 19-Sep-1995  thorpej Make system calls conform to a standard prototype and bring those
prototypes into scope.
 1.10 14-Aug-1995  mycroft Rearrange #includes.
 1.9 24-Jun-1995  christos Use compat_util.[ch].
 1.8 22-Jun-1995  fvdl * Changed to use generic ELF code from kern/exec_elf.c (which was taken
from the svr4 exec code plus the linux compat mods)
* Include file change
* Add multicast sockopts (from John Brezak)
 1.7 11-Jun-1995  fvdl Don't forget to acknowledge that all the ELF stuff was taken from
Christos' svr4 code.
 1.6 11-Jun-1995  fvdl * Make Linux ELF binaries work. Lots of code duplication, but it will have to do
for now.
* Add a sanity check in linux_uselib
 1.5 16-May-1995  mycroft Generate the new ps_strings format.
 1.4 22-Apr-1995  christos - added struct emul to all emulations.
- removed all setup functions.
- added copyargs() functions where needed.
 1.3 07-Apr-1995  fvdl Handle Linux signal tramp code differently. Some changes because of the
now seperate Linux signal trampoline code. Add linux_sigreturn to
syscalls.master.
 1.2 05-Mar-1995  fvdl Added a few more system calls.
More consistent alternate root file semantics throughout.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.13.4.1 10-Dec-1996  mycroft From trunk:
Do execv() and execve() path name translation consistently across
emulations.
 1.25.14.1 29-Jan-1998  mellon Pull up 1.26 (mycroft)
 1.41.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.42.6.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.42.4.1 15-Nov-1999  fvdl Sync with -current
 1.42.2.5 11-Feb-2001  bouyer Sync with HEAD.
 1.42.2.4 05-Jan-2001  bouyer Sync with HEAD
 1.42.2.3 08-Dec-2000  bouyer Sync with HEAD.
 1.42.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.42.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.51.4.6 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.51.4.5 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.51.4.4 16-Mar-2002  jdolecek Catch up with -current.
 1.51.4.3 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.51.4.2 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.51.4.1 03-Aug-2001  lukem update to -current
 1.51.2.9 11-Dec-2002  thorpej Sync with HEAD.
 1.51.2.8 11-Nov-2002  nathanw Catch up to -current
 1.51.2.7 17-Sep-2002  nathanw Catch up to -current.
 1.51.2.6 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.51.2.5 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.51.2.4 28-Feb-2002  nathanw Catch up to -current.
 1.51.2.3 14-Nov-2001  nathanw Catch up to -current.
 1.51.2.2 21-Sep-2001  nathanw Catch up to -current.
 1.51.2.1 24-Aug-2001  nathanw Catch up with -current.
 1.60.2.1 18-Dec-2002  gmcgarry Merge pcred and ucred, and poolify. TBD: check backward compatibility
and factor-out some higher-level functionality.
 1.64.2.7 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.64.2.6 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.64.2.5 18-Nov-2004  skrll Adapt to branch. macppc release builds.
 1.64.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.64.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.64.2.2 03-Aug-2004  skrll Sync with HEAD
 1.64.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.66.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.66.8.1 29-Apr-2005  kent sync with -current
 1.69.2.5 27-Oct-2007  yamt sync with head.
 1.69.2.4 03-Sep-2007  yamt sync with head.
 1.69.2.3 26-Feb-2007  yamt sync with head.
 1.69.2.2 30-Dec-2006  yamt sync with head.
 1.69.2.1 21-Jun-2006  yamt sync with head.
 1.70.6.2 01-Jun-2006  kardel Sync with head.
 1.70.6.1 22-Apr-2006  simonb Sync with head.
 1.70.4.1 09-Sep-2006  rpaulo sync with head
 1.70.2.1 18-Feb-2006  yamt sync with head.
 1.71.6.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.71.4.2 06-May-2006  christos - Move kauth_cred_t declaration to <sys/types.h>
- Cleanup struct ucred; forward declarations that are unused.
- Don't include <sys/kauth.h> in any header, but include it in the c files
that need it.

Approved by core.
 1.71.4.1 08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.71.2.2 11-Aug-2006  yamt sync with head
 1.71.2.1 24-May-2006  yamt sync with head.
 1.74.6.2 10-Dec-2006  yamt sync with head.
 1.74.6.1 22-Oct-2006  yamt sync with head
 1.74.4.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.74.4.1 18-Nov-2006  ad Sync with head.
 1.77.2.2 07-May-2007  yamt sync with head.
 1.77.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.78.4.1 11-Jul-2007  mjf Sync with head.
 1.78.2.2 23-Oct-2007  ad Sync with head.
 1.78.2.1 27-May-2007  ad Sync with head.
 1.79.12.1 25-Oct-2007  bouyer Sync with HEAD.
 1.79.8.1 06-Nov-2007  matt sync with HEAD
 1.79.6.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.80.20.3 09-Oct-2010  yamt sync with head
 1.80.20.2 04-May-2009  yamt sync with head.
 1.80.20.1 16-May-2008  yamt sync with head.
 1.80.18.1 18-May-2008  yamt sync with head.
 1.80.16.2 17-Jan-2009  mjf Sync with HEAD.
 1.80.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.81.20.1 14-May-2014  msaitoh Pull up following revision(s) (requested by maxv in ticket #1902):
src/sys/compat/linux/common/linux_exec_elf32.c 1.91 via patch

A specially-crafted binary could easily control a kernel array index.
Add some checks to ensure that nothing will be read outside the allocated
area. Rewrite the code so that we don't need to allocate the whole section.

Spotted by several developers, patch from chs@/enami@
 1.81.16.1 14-May-2014  msaitoh Pull up following revision(s) (requested by maxv in ticket #1902):
src/sys/compat/linux/common/linux_exec_elf32.c 1.91 via patch

A specially-crafted binary could easily control a kernel array index.
Add some checks to ensure that nothing will be read outside the allocated
area. Rewrite the code so that we don't need to allocate the whole section.

Spotted by several developers, patch from chs@/enami@
 1.81.10.1 14-May-2014  msaitoh Pull up following revision(s) (requested by maxv in ticket #1902):
src/sys/compat/linux/common/linux_exec_elf32.c 1.91 via patch

A specially-crafted binary could easily control a kernel array index.
Add some checks to ensure that nothing will be read outside the allocated
area. Rewrite the code so that we don't need to allocate the whole section.

Spotted by several developers, patch from chs@/enami@
 1.81.8.2 28-Apr-2009  skrll Sync with HEAD.
 1.81.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.81.6.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.81.2.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.81.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.82.4.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.83.4.1 05-Mar-2011  rmind sync with head
 1.83.2.1 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.84.12.1 18-Feb-2012  mrg merge to -current.
 1.84.8.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.84.8.1 17-Apr-2012  yamt sync with head
 1.86.16.1 21-Apr-2014  bouyer Pull up following revision(s) (requested by maxv in ticket #1051):
sys/compat/linux/common/linux_exec_elf32.c: revision 1.91 via patch
A specially-crafted binary could easily control a kernel array index.
Add some checks to ensure that nothing will be read outside the allocated
area. Rewrite the code so that we don't need to allocate the whole section.
Spotted by several developers, patch from chs@/enami@
 1.86.10.1 18-May-2014  rmind sync with head
 1.86.8.1 21-Apr-2014  bouyer Pull up following revision(s) (requested by maxv in ticket #1051):
sys/compat/linux/common/linux_exec_elf32.c: revision 1.91 via patch
A specially-crafted binary could easily control a kernel array index.
Add some checks to ensure that nothing will be read outside the allocated
area. Rewrite the code so that we don't need to allocate the whole section.
Spotted by several developers, patch from chs@/enami@
 1.86.6.2 03-Dec-2017  jdolecek update from HEAD
 1.86.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.86.2.1 21-Apr-2014  bouyer Pull up following revision(s) (requested by maxv in ticket #1051):
sys/compat/linux/common/linux_exec_elf32.c: revision 1.91 via patch
A specially-crafted binary could easily control a kernel array index.
Add some checks to ensure that nothing will be read outside the allocated
area. Rewrite the code so that we don't need to allocate the whole section.
Spotted by several developers, patch from chs@/enami@
 1.90.2.1 10-Aug-2014  tls Rebase.
 1.91.4.3 28-Aug-2017  skrll Sync with HEAD
 1.91.4.2 22-Sep-2015  skrll Sync with HEAD
 1.91.4.1 06-Apr-2015  skrll Sync with HEAD
 1.91.2.1 29-Mar-2015  martin Pull up following revision(s) (requested by maxv in ticket #650):
sys/compat/netbsd32/netbsd32_exec_elf32.c: revision 1.39
sys/kern/exec_elf.c: revision 1.71
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.18
sys/compat/linux/common/linux_exec_elf32.c: revision 1.92
sys/compat/svr4_32/svr4_32_exec_elf32.c: revision 1.24
Zero-fill the ELF auxiliary vectors. Otherwise, on 64bit systems, the
padding between a_v and a_type contains kernel garbage, therefore
exposed to userland.
Original report by uebayasi@
 1.93.4.1 21-Apr-2017  bouyer Sync with HEAD
 1.93.2.1 20-Mar-2017  pgoyette Sync with HEAD
 1.94.14.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.94.14.1 10-Jun-2019  christos Sync with HEAD
 1.94.12.8 25-Jan-2019  pgoyette Move the netbsd32_machine32_hook into the main kernel with most of
the other hooks.

Although this hook might better belong in compat/netbsd32/ code,
there are some machines without a netbsd32 module (for example, i386
and sgimips) which still have consumers/users of this hook. :(
 1.94.12.7 24-Jan-2019  pgoyette Move the definition around to avoid strange compiler error (something
about trying to set a section attribute on a local variable).
 1.94.12.6 24-Jan-2019  pgoyette revert previous, just define the hook here
 1.94.12.5 24-Jan-2019  pgoyette And include the definition
 1.94.12.4 24-Jan-2019  pgoyette Make sure we declare the hook variable
 1.94.12.3 24-Jan-2019  pgoyette Rework placement of the new netbsd32_machine32_hook
 1.94.12.2 24-Jan-2019  pgoyette Replace weak symbol definition for machine32 with a hook. Our in-kernel
linker doesn't handle weak symbols, so this prevented us from loading the
compat_linux32 module.

XXX There don't seem to be any other consumers of machine32 (nor does
XXX there seem to be any consumers of machine_arch32), even though it
XXX is defined for aarch64, arm32, and riscv).
 1.94.12.1 28-Jul-2018  pgoyette Sync with HEAD
 1.99.6.1 17-Jan-2020  ad Sync with head.
 1.3 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.2 13-Nov-2001  lukem branches: 1.2.114; 1.2.116; 1.2.118;
add RCSIDs (including regeneration of files as appropriate)
 1.1 01-Oct-1998  erh branches: 1.1.24; 1.1.26;
Split compat/linux/linux_exec.c into common, elf and a.out parts.
 1.1.26.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.24.1 14-Nov-2001  nathanw Catch up to -current.
 1.2.118.1 16-May-2008  yamt sync with head.
 1.2.116.1 18-May-2008  yamt sync with head.
 1.2.114.1 02-Jun-2008  mjf Sync with HEAD.
 1.3 09-Nov-2014  maxv Do not uselessly include <sys/malloc.h>.
 1.2 17-May-2014  njoly branches: 1.2.2;
Fix fadvise64 syscalls to use 64bit offset types.
 1.1 30-May-2011  alnsn branches: 1.1.2; 1.1.6; 1.1.18; 1.1.22; 1.1.32;
Add fadvise64 and fadvise64_64 syscalls to compat_linux and compat_linux32.
 1.1.32.1 10-Aug-2014  tls Rebase.
 1.1.22.1 18-May-2014  rmind sync with head
 1.1.18.2 03-Dec-2017  jdolecek update from HEAD
 1.1.18.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.6.2 06-Jun-2011  jruoho Sync with HEAD.
 1.1.6.1 30-May-2011  jruoho file linux_fadvise64.c was added on branch jruoho-x86intr on 2011-06-06 09:07:27 +0000
 1.1.2.2 31-May-2011  rmind sync with head
 1.1.2.1 30-May-2011  rmind file linux_fadvise64.c was added on branch rmind-uvmplock on 2011-05-31 03:04:30 +0000
 1.2.2.1 17-Jan-2015  martin Pull up following revision(s) (requested by maxv in ticket #427):
sys/compat/svr4/svr4_schedctl.c: revision 1.8
sys/netinet/tcp_timer.c: revision 1.88
sys/miscfs/genfs/layer_vfsops.c: revision 1.45
sys/compat/svr4/svr4_ioctl.c: revision 1.37
sys/ufs/chfs/chfs_vfsops.c: revision 1.14
sys/miscfs/fdesc/fdesc_vfsops.c: revision 1.91
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.30
sys/compat/common/kern_time_50.c: revision 1.28
sys/netinet6/ip6_forward.c: revision 1.74
sys/miscfs/umapfs/umap_vnops.c: revision 1.57
sys/compat/svr4/svr4_fcntl.c: revision 1.74
distrib/sets/lists/comp/mi: revision 1.1931
sys/netinet6/udp6_output.c: revision 1.46
sys/fs/puffs/puffs_compat.c: revision 1.3
sys/fs/udf/udf_rename.c: revision 1.11
sys/compat/svr4/svr4_filio.c: revision 1.24
sys/fs/udf/udf_rename.c: revision 1.12
sys/netinet/tcp_usrreq.c: revision 1.202
sys/miscfs/umapfs/umap_subr.c: revision 1.29
sys/compat/linux/common/linux_fadvise64.c: revision 1.3
sys/netinet/if_atm.c: revision 1.34
sys/miscfs/procfs/procfs_subr.c: revision 1.106
sys/miscfs/genfs/layer_subr.c: revision 1.37
sys/netinet/tcp_sack.c: revision 1.30
sys/compat/freebsd/freebsd_misc.c: revision 1.33
sys/compat/freebsd/freebsd_file.c: revision 1.33
sys/ufs/chfs/chfs_vnode.c: revision 1.12
sys/compat/svr4/svr4_ttold.c: revision 1.34
sys/compat/linux/common/linux_file.c: revision 1.114
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.43
sys/compat/linux/common/linux_signal.c: revision 1.76
sys/compat/common/compat_util.c: revision 1.46
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.18
sys/compat/svr4/svr4_sockio.c: revision 1.36
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.32
sys/compat/svr4/svr4_signal.c: revision 1.66
sys/kern/kern_exec.c: revision 1.410
sys/fs/puffs/puffs_vfsops.c: revision 1.115
sys/compat/svr4/svr4_exec_elf64.c: revision 1.15
sys/compat/linux/arch/i386/linux_machdep.c: revision 1.159
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.50
sys/compat/linux32/common/linux32_misc.c: revision 1.24
sys/netinet/in_pcb.c: revision 1.153
sys/sys/malloc.h: revision 1.116
sys/compat/common/if_43.c: revision 1.9
share/man/man9/Makefile: revision 1.380
sys/netinet/tcp_vtw.c: revision 1.12
sys/miscfs/umapfs/umap_vfsops.c: revision 1.95
sys/ufs/ext2fs/ext2fs_vfsops.c: revision 1.186
sys/compat/common/uipc_syscalls_43.c: revision 1.46
sys/ufs/ext2fs/ext2fs_vnops.c: revision 1.115
sys/fs/puffs/puffs_msgif.c: revision 1.97
sys/compat/svr4/svr4_ipc.c: revision 1.27
sys/compat/linux/common/linux_exec.c: revision 1.117
sys/ufs/ext2fs/ext2fs_readwrite.c: revision 1.66
sys/netinet/tcp_output.c: revision 1.179
sys/compat/svr4/svr4_termios.c: revision 1.28
sys/fs/udf/udf_strat_bootstrap.c: revision 1.4
sys/fs/puffs/puffs_subr.c: revision 1.67
sys/fs/puffs/puffs_node.c: revision 1.36
sys/miscfs/overlay/overlay_vnops.c: revision 1.21
sys/fs/cd9660/cd9660_node.c: revision 1.34
sys/netinet/raw_ip.c: revision 1.146
sys/sys/mallocvar.h: revision 1.13
sys/miscfs/overlay/overlay_vfsops.c: revision 1.63
share/man/man9/malloc.9: revision 1.50
sys/netinet6/dest6.c: revision 1.18
sys/compat/linux/common/linux_uselib.c: revision 1.33
sys/compat/linux/common/linux_socket.c: revision 1.120
share/man/man9/malloc.9: revision 1.51
sys/netinet/tcp_subr.c: revision 1.257
sys/compat/linux/common/linux_socketcall.c: revision 1.45
sys/compat/linux/common/linux_fadvise64_64.c: revision 1.3
sys/compat/freebsd/freebsd_ipc.c: revision 1.17
sys/compat/linux/common/linux_misc_notalpha.c: revision 1.109
sys/compat/linux/arch/alpha/linux_pipe.c: revision 1.17
sys/netinet6/in6_pcb.c: revision 1.132
sys/netinet6/in6_ifattach.c: revision 1.94
sys/compat/svr4/svr4_exec_elf32.c: revision 1.15
sys/miscfs/nullfs/null_vfsops.c: revision 1.90
sys/fs/cd9660/cd9660_util.c: revision 1.12
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.48
sys/compat/freebsd/freebsd_exec_elf32.c: revision 1.20
sys/miscfs/procfs/procfs_vfsops.c: revision 1.94
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.28
sys/compat/linux/common/linux_sched.c: revision 1.67
sys/compat/linux/common/linux_exec_aout.c: revision 1.67
sys/compat/linux/common/linux_pipe.c: revision 1.67
sys/compat/linux/common/linux_llseek.c: revision 1.34
sys/compat/linux/arch/mips/linux_ptrace.c: revision 1.10
Do not uselessly include <sys/malloc.h>.
Cleanup:
- remove struct kmembuckets (dead)
- correctly deadify MALLOC_XX
- remove MALLOC_DEFINE_LIMIT and MALLOC_JUSTDEFINE_LIMIT (dead)
- remove malloc_roundup(), malloc_type_setlimit(), MALLOC_DEFINE_LIMIT()
and MALLOC_JUSTDEFINE_LIMIT() from man 9 malloc
New sentence, new line. Bump date for previous.
Obsolete malloc_roundup(9), malloc_type_setlimit(9) and MALLOC_DEFINE_LIMIT(9)
man pages.
 1.3 09-Nov-2014  maxv Do not uselessly include <sys/malloc.h>.
 1.2 06-May-2014  njoly branches: 1.2.2;
Fix c&p error for the length argument in fadvise64_64.
 1.1 30-May-2011  alnsn branches: 1.1.2; 1.1.6; 1.1.8; 1.1.18; 1.1.22; 1.1.32;
Add fadvise64 and fadvise64_64 syscalls to compat_linux and compat_linux32.
 1.1.32.1 10-Aug-2014  tls Rebase.
 1.1.22.1 18-May-2014  rmind sync with head
 1.1.18.2 03-Dec-2017  jdolecek update from HEAD
 1.1.18.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.8.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.1.6.2 06-Jun-2011  jruoho Sync with HEAD.
 1.1.6.1 30-May-2011  jruoho file linux_fadvise64_64.c was added on branch jruoho-x86intr on 2011-06-06 09:07:27 +0000
 1.1.2.2 31-May-2011  rmind sync with head
 1.1.2.1 30-May-2011  rmind file linux_fadvise64_64.c was added on branch rmind-uvmplock on 2011-05-31 03:04:30 +0000
 1.2.2.1 17-Jan-2015  martin Pull up following revision(s) (requested by maxv in ticket #427):
sys/compat/svr4/svr4_schedctl.c: revision 1.8
sys/netinet/tcp_timer.c: revision 1.88
sys/miscfs/genfs/layer_vfsops.c: revision 1.45
sys/compat/svr4/svr4_ioctl.c: revision 1.37
sys/ufs/chfs/chfs_vfsops.c: revision 1.14
sys/miscfs/fdesc/fdesc_vfsops.c: revision 1.91
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.30
sys/compat/common/kern_time_50.c: revision 1.28
sys/netinet6/ip6_forward.c: revision 1.74
sys/miscfs/umapfs/umap_vnops.c: revision 1.57
sys/compat/svr4/svr4_fcntl.c: revision 1.74
distrib/sets/lists/comp/mi: revision 1.1931
sys/netinet6/udp6_output.c: revision 1.46
sys/fs/puffs/puffs_compat.c: revision 1.3
sys/fs/udf/udf_rename.c: revision 1.11
sys/compat/svr4/svr4_filio.c: revision 1.24
sys/fs/udf/udf_rename.c: revision 1.12
sys/netinet/tcp_usrreq.c: revision 1.202
sys/miscfs/umapfs/umap_subr.c: revision 1.29
sys/compat/linux/common/linux_fadvise64.c: revision 1.3
sys/netinet/if_atm.c: revision 1.34
sys/miscfs/procfs/procfs_subr.c: revision 1.106
sys/miscfs/genfs/layer_subr.c: revision 1.37
sys/netinet/tcp_sack.c: revision 1.30
sys/compat/freebsd/freebsd_misc.c: revision 1.33
sys/compat/freebsd/freebsd_file.c: revision 1.33
sys/ufs/chfs/chfs_vnode.c: revision 1.12
sys/compat/svr4/svr4_ttold.c: revision 1.34
sys/compat/linux/common/linux_file.c: revision 1.114
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.43
sys/compat/linux/common/linux_signal.c: revision 1.76
sys/compat/common/compat_util.c: revision 1.46
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.18
sys/compat/svr4/svr4_sockio.c: revision 1.36
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.32
sys/compat/svr4/svr4_signal.c: revision 1.66
sys/kern/kern_exec.c: revision 1.410
sys/fs/puffs/puffs_vfsops.c: revision 1.115
sys/compat/svr4/svr4_exec_elf64.c: revision 1.15
sys/compat/linux/arch/i386/linux_machdep.c: revision 1.159
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.50
sys/compat/linux32/common/linux32_misc.c: revision 1.24
sys/netinet/in_pcb.c: revision 1.153
sys/sys/malloc.h: revision 1.116
sys/compat/common/if_43.c: revision 1.9
share/man/man9/Makefile: revision 1.380
sys/netinet/tcp_vtw.c: revision 1.12
sys/miscfs/umapfs/umap_vfsops.c: revision 1.95
sys/ufs/ext2fs/ext2fs_vfsops.c: revision 1.186
sys/compat/common/uipc_syscalls_43.c: revision 1.46
sys/ufs/ext2fs/ext2fs_vnops.c: revision 1.115
sys/fs/puffs/puffs_msgif.c: revision 1.97
sys/compat/svr4/svr4_ipc.c: revision 1.27
sys/compat/linux/common/linux_exec.c: revision 1.117
sys/ufs/ext2fs/ext2fs_readwrite.c: revision 1.66
sys/netinet/tcp_output.c: revision 1.179
sys/compat/svr4/svr4_termios.c: revision 1.28
sys/fs/udf/udf_strat_bootstrap.c: revision 1.4
sys/fs/puffs/puffs_subr.c: revision 1.67
sys/fs/puffs/puffs_node.c: revision 1.36
sys/miscfs/overlay/overlay_vnops.c: revision 1.21
sys/fs/cd9660/cd9660_node.c: revision 1.34
sys/netinet/raw_ip.c: revision 1.146
sys/sys/mallocvar.h: revision 1.13
sys/miscfs/overlay/overlay_vfsops.c: revision 1.63
share/man/man9/malloc.9: revision 1.50
sys/netinet6/dest6.c: revision 1.18
sys/compat/linux/common/linux_uselib.c: revision 1.33
sys/compat/linux/common/linux_socket.c: revision 1.120
share/man/man9/malloc.9: revision 1.51
sys/netinet/tcp_subr.c: revision 1.257
sys/compat/linux/common/linux_socketcall.c: revision 1.45
sys/compat/linux/common/linux_fadvise64_64.c: revision 1.3
sys/compat/freebsd/freebsd_ipc.c: revision 1.17
sys/compat/linux/common/linux_misc_notalpha.c: revision 1.109
sys/compat/linux/arch/alpha/linux_pipe.c: revision 1.17
sys/netinet6/in6_pcb.c: revision 1.132
sys/netinet6/in6_ifattach.c: revision 1.94
sys/compat/svr4/svr4_exec_elf32.c: revision 1.15
sys/miscfs/nullfs/null_vfsops.c: revision 1.90
sys/fs/cd9660/cd9660_util.c: revision 1.12
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.48
sys/compat/freebsd/freebsd_exec_elf32.c: revision 1.20
sys/miscfs/procfs/procfs_vfsops.c: revision 1.94
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.28
sys/compat/linux/common/linux_sched.c: revision 1.67
sys/compat/linux/common/linux_exec_aout.c: revision 1.67
sys/compat/linux/common/linux_pipe.c: revision 1.67
sys/compat/linux/common/linux_llseek.c: revision 1.34
sys/compat/linux/arch/mips/linux_ptrace.c: revision 1.10
Do not uselessly include <sys/malloc.h>.
Cleanup:
- remove struct kmembuckets (dead)
- correctly deadify MALLOC_XX
- remove MALLOC_DEFINE_LIMIT and MALLOC_JUSTDEFINE_LIMIT (dead)
- remove malloc_roundup(), malloc_type_setlimit(), MALLOC_DEFINE_LIMIT()
and MALLOC_JUSTDEFINE_LIMIT() from man 9 malloc
New sentence, new line. Bump date for previous.
Obsolete malloc_roundup(9), malloc_type_setlimit(9) and MALLOC_DEFINE_LIMIT(9)
man pages.
 1.23 28-Sep-2024  christos Linux GSoC-2024: renameat2, clone3, sync_file_range, syncfs (Shivraj Jamgade)
 1.22 19-Aug-2023  christos branches: 1.22.6;
new inotify support GSoC 2023 (Theodore Preduta)
 1.21 10-Jul-2023  christos Add memfd_create(2) from GSoC 2023 by Theodore Preduta
 1.20 25-Nov-2021  ryo - Add compat_linux statx(2) syscall.
- The AT_EMPTY_PATH processing from the modification of
sys/compat/linux/common/linux_file64.c r1.63 has been separated, and made
common to linux_statat(), so that it can be used not only by
linux32_sys_fstatat64() but also by other *statat() variants.
 1.19 23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.18 23-Aug-2019  maxv When dealing with an unknown value, set -1, to prevent (harmless)
uninitialized accesses later.
 1.17 01-Mar-2015  njoly branches: 1.17.10; 1.17.18; 1.17.22;
Add Linux specific fcntl(2) commands. Support F_DUPFD_CLOEXEC.
 1.16 01-Jun-2014  njoly branches: 1.16.2; 1.16.4; 1.16.10;
Cleanup pipe(2) flags, now that native handle them.
 1.15 24-Sep-2013  njoly branches: 1.15.2;
Add utimensat(2) for compat linux.
 1.14 28-Apr-2008  martin branches: 1.14.34; 1.14.44; 1.14.50;
Remove clause 3 and 4 from TNF licenses
 1.13 21-Mar-2008  ad branches: 1.13.2; 1.13.4;
Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
 1.12 02-Feb-2008  dsl branches: 1.12.6;
Fix the linux32 emulations of fcntl() locking.
The 64bit linux emulation versions can't be used because the lock structure
alignment and field sizes all differ.
Since there need to be 4 different versions of the linux struct flock, and
amd64 kernel needs 3 of them compiled in, rather than replicating the same
code block twice more, move the body of the code into a few #defines
that can be expanded with the correct types in the linux[32]_sys_fcntl[64]()
functions.
Should fix problems running progams like skype running under linux32
emulation on amd64.
 1.11 11-Dec-2005  christos branches: 1.11.46; 1.11.52;
merge ktrace-lwp.
 1.10 03-May-2005  manu branches: 1.10.2;
First work on COMPAT_LINUX/amd64
Process startup and dynamiclinking work, but processes hang due to
Linux arch_prctl(2) not being really supported yet.
 1.9 22-Mar-2002  christos branches: 1.9.10;
implement the locking calls for linux_file64.
 1.8 14-Jan-2002  bjh21 Crude first cut at ARMLinux binary compatibility. Successfully runs
"/emul/linux/bin/echo hello, world", dynamically linked.
 1.7 22-Sep-2001  manu Enable Mips Linux emulation in header files
 1.6 19-Jan-2001  manu branches: 1.6.2; 1.6.4; 1.6.6;
Added Linux compatibility support for powerpc ports
 1.5 15-Dec-1998  itohy branches: 1.5.8;
Added linux compat support on m68k ports.
 1.4 04-Oct-1998  fvdl Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.3 03-Oct-1998  christos Attempt to fix the mess.
 1.2 01-Oct-1998  erh Split linux_fcntl.h into i386 and common parts.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.5.8.1 11-Feb-2001  bouyer Sync with HEAD.
 1.6.6.1 01-Oct-2001  fvdl Catch up with -current.
 1.6.4.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.6.4.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.6.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.6.2.3 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.6.2.2 28-Feb-2002  nathanw Catch up to -current.
 1.6.2.1 26-Sep-2001  nathanw Catch up to -current.
Again.
 1.9.10.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.10.2.2 24-Mar-2008  yamt sync with head.
 1.10.2.1 04-Feb-2008  yamt sync with head.
 1.11.52.1 18-Feb-2008  mjf Sync with HEAD.
 1.11.46.1 23-Mar-2008  matt sync with HEAD
 1.12.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.12.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.13.4.1 16-May-2008  yamt sync with head.
 1.13.2.1 18-May-2008  yamt sync with head.
 1.14.50.1 18-May-2014  rmind sync with head
 1.14.44.2 03-Dec-2017  jdolecek update from HEAD
 1.14.44.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.14.34.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.15.2.1 10-Aug-2014  tls Rebase.
 1.16.10.1 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1720:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149 (patch)
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54 (patch)

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.16.4.1 06-Apr-2015  skrll Sync with HEAD
 1.16.2.1 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1720:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149 (patch)
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54 (patch)

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.17.22.1 13-Sep-2019  martin Pull up following revision(s) (requested by maxv in ticket #194):

sys/compat/linux/common/linux_socket.c: revision 1.146
sys/compat/linux/common/linux_socket.c: revision 1.147
sys/compat/linux/common/linux_socket.c: revision 1.148
sys/compat/linux/common/linux_socket.c: revision 1.149
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.59
sys/compat/linux32/common/linux32_sysinfo.c: revision 1.8
sys/kern/sysv_shm.c: revision 1.138
sys/compat/linux/common/linux_file64.c: revision 1.61
sys/compat/linux/common/linux_file64.c: revision 1.62
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.58
sys/compat/linux32/common/linux32_dirent.c: revision 1.20
sys/compat/linux32/common/linux32_utsname.c: revision 1.10
sys/compat/linux/common/linux_termios.h: revision 1.22
sys/compat/linux32/common/linux32_termios.c: revision 1.15
sys/compat/linux32/common/linux32_misc.c: revision 1.27
sys/compat/linux32/common/linux32_ioctl.c: revision 1.14
sys/compat/linux/common/linux_statfs.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.57
sys/compat/linux/common/linux_fcntl.h: revision 1.18
sys/compat/linux/common/linux_socket.h: revision 1.24
sys/sys/shm.h: revision 1.54
sys/compat/ossaudio/ossaudio.c: revision 1.75
sys/compat/linux32/common/linux32_signal.c: revision 1.20
sys/miscfs/procfs/procfs_linux.c: revision 1.75
sys/compat/linux/common/linux_signal.c: revision 1.81
sys/compat/linux/common/linux_termios.c: revision 1.38
sys/compat/linux/common/linux_misc.c: revision 1.241
sys/compat/linux/common/linux_misc.c: revision 1.242
sys/compat/linux/common/linux_misc.c: revision 1.243
sys/compat/linux/common/linux_misc.c: revision 1.244

Fix info leaks.

Fix stupid bugs in linux_sys_shmctl(): the index could be out of bound
(page fault) and there was no proper locking.
Maybe we should just remove LINUX_SHM_STAT, like compat_linux32.

Remove printf.

When dealing with an unknown value, set -1, to prevent (harmless)
uninitialized accesses later.

Add a default case, don't call sys_ioctl() with an uninitialized 'com'
argument.

Fix error handling, returns an errno, not -1.

Put the printf under DEBUG_LINUX.


Hum, don't forget the 'pid' argument, otherwise we're not gonna go very
far.

Don't read data from userland directly. This simply does not work on any
recent x86 CPU (thanks to SMAP) and all architectures that forbid direct
access to userland from the kernel. But I guess no one noticed because no
one ever uses compat_linux, right?

Hum, don't pass an mbuf to realloc(). Inspired from copyin32_msg_control().

Fix memory leak.

I don't see the point in having this useless printf, but add a '\n' to it,
so that it at least displays useless stuff correctly.

Hum, remove incorrect assignment. Userland could have passed a smaller
namelen, and the uninitialized bytes from sb_data were being used later in
the network stack.
 1.17.18.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.17.10.1 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1487:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.22.6.1 02-Aug-2025  perseant Sync with HEAD
 1.4 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.3 12-Feb-2008  he branches: 1.3.2; 1.3.8; 1.3.10; 1.3.12; 1.3.14;
Need to include <sys/fstypes.h> before <sys/vfs_syscalls.h> to get
fhandle_t defined, which is used in a function prototype in the latter.
 1.2 02-Feb-2008  dsl branches: 1.2.2;
Fix the linux32 emulations of fcntl() locking.
The 64bit linux emulation versions can't be used because the lock structure
alignment and field sizes all differ.
Since there need to be 4 different versions of the linux struct flock, and
amd64 kernel needs 3 of them compiled in, rather than replicating the same
code block twice more, move the body of the code into a few #defines
that can be expanded with the correct types in the linux[32]_sys_fcntl[64]()
functions.
Should fix problems running progams like skype running under linux32
emulation on amd64.
 1.1 02-Feb-2008  dsl Extract the fcntl64() suppoort from linux_file64.c into linux_fcntl64.c
Unravel some of the knots that caused linux_file64.c to be compiled twice
for an amd64 kernel (once for linux and once for linux32) with different
parts being skipped each time.
 1.2.2.3 27-Feb-2008  yamt sync with head.
 1.2.2.2 04-Feb-2008  yamt sync with head.
 1.2.2.1 02-Feb-2008  yamt file linux_fcntl64.c was added on branch yamt-lazymbuf on 2008-02-04 09:23:04 +0000
 1.3.14.1 16-May-2008  yamt sync with head.
 1.3.12.1 18-May-2008  yamt sync with head.
 1.3.10.2 23-Mar-2008  matt sync with HEAD
 1.3.10.1 12-Feb-2008  matt file linux_fcntl64.c was added on branch matt-armv6 on 2008-03-23 02:04:32 +0000
 1.3.8.1 02-Jun-2008  mjf Sync with HEAD.
 1.3.2.2 18-Feb-2008  mjf Sync with HEAD.
 1.3.2.1 12-Feb-2008  mjf file linux_fcntl64.c was added on branch mjf-devfs on 2008-02-18 21:05:26 +0000
 1.14 07-Sep-2021  riastradh sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.13 21-Mar-2008  ad branches: 1.13.6; 1.13.84; 1.13.96;
Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
 1.12 20-Dec-2007  dsl branches: 1.12.6;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.11 19-Oct-2007  njoly branches: 1.11.4; 1.11.8;
Add compat_linux and exec_linux_elf lkm support for amd64:
- Add needed COMPAT_OSSAUDIO to GENERIC.
- Add missing includes needed by linux_syscallargs.h.
- Add lkm building.
 1.10 04-Mar-2007  christos branches: 1.10.14; 1.10.16; 1.10.20;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.9 09-Feb-2007  ad branches: 1.9.2;
Merge newlock2 to head.
 1.8 11-Dec-2005  christos branches: 1.8.20;
merge ktrace-lwp.
 1.7 29-Jun-2003  fvdl branches: 1.7.2; 1.7.18;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.6 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.5 21-Mar-2003  dsl Change 'data' argument to fo_ioctl and fo_fcntl from 'caddr_t' to 'void *'.
Avoids a lot of casting and removes the need for some line breaks.
Removed a load of (caddr_t) casts from calls to copyin/copyout as well.
(approved by christos - he has a plan to remove caddr_t...)
 1.4 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.3 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.2 14-Jun-2001  thorpej branches: 1.2.2;
Fix a partial construction problem that can cause race conditions
between creation of a file descriptor and close(2) when using kernel
assisted threads. What we do is stick descriptors in the table, but
mark them as "larval". This causes essentially everything to treat
it as a non-existent descriptor, except for fdalloc(), which sees a
filled slot so that it won't (incorrectly) allocate it again. When
a descriptor is fully constructed, the code that has constructed it
marks it as "mature" (which actually clears the "larval" flag), and
things continue to work as normal.

While here, gather all the code that gets a descriptor from the table
into a fd_getfile() function, and call it, rather than having the
same (sometimes incorrect) code copied all over the place.
 1.1 10-Dec-2000  fvdl branches: 1.1.2; 1.1.4; 1.1.6;
Add some ioctls for harddisk, floppy disk and console handling.
Implement a few extra cdrom ioctl calls.
Make sure to correctly use FILE_USE and FILE_UNUSE.
 1.1.6.2 30-Mar-2001  he Pull up revision 1.1 (new, requested by fvdl):
Add some required Linux emulation bits to support the Linux
version of VMware.
 1.1.6.1 10-Dec-2000  he file linux_fdio.c was added on branch netbsd-1-5 on 2001-03-30 21:39:58 +0000
 1.1.4.3 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.1.4.2 14-Nov-2001  nathanw Catch up to -current.
 1.1.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.1.2.2 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.1.2.1 10-Dec-2000  bouyer file linux_fdio.c was added on branch thorpej_scsipi on 2000-12-13 15:49:49 +0000
 1.2.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.7.18.6 24-Mar-2008  yamt sync with head.
 1.7.18.5 21-Jan-2008  yamt sync with head
 1.7.18.4 27-Oct-2007  yamt sync with head.
 1.7.18.3 03-Sep-2007  yamt sync with head.
 1.7.18.2 26-Feb-2007  yamt sync with head.
 1.7.18.1 21-Jun-2006  yamt sync with head.
 1.7.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.7.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.7.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.8.20.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.9.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.10.20.1 25-Oct-2007  bouyer Sync with HEAD.
 1.10.16.2 09-Jan-2008  matt sync with HEAD
 1.10.16.1 06-Nov-2007  matt sync with HEAD
 1.10.14.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.11.8.1 02-Jan-2008  bouyer Sync with HEAD
 1.11.4.1 26-Dec-2007  ad Sync with head.
 1.12.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.13.96.1 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.13.84.1 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1836):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.13.6.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.13.6.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.4 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.3 11-Dec-2005  christos branches: 1.3.26;
merge ktrace-lwp.
 1.2 26-Feb-2005  perry branches: 1.2.4;
nuke trailing whitespace
 1.1 10-Dec-2000  fvdl branches: 1.1.2; 1.1.6; 1.1.28; 1.1.36; 1.1.38;
Add some ioctls for harddisk, floppy disk and console handling.
Implement a few extra cdrom ioctl calls.
Make sure to correctly use FILE_USE and FILE_UNUSE.
 1.1.38.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.1.36.1 29-Apr-2005  kent sync with -current
 1.1.28.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.1.6.2 30-Mar-2001  he Pull up revision 1.1 (new, requested by fvdl):
Add some required Linux emulation bits to support the Linux
version of VMware.
 1.1.6.1 10-Dec-2000  he file linux_fdio.h was added on branch netbsd-1-5 on 2001-03-30 21:39:59 +0000
 1.1.2.2 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.1.2.1 10-Dec-2000  bouyer file linux_fdio.h was added on branch thorpej_scsipi on 2000-12-13 15:49:49 +0000
 1.2.4.1 03-Sep-2007  yamt sync with head.
 1.3.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.133 01-Oct-2024  riastradh linux_sys_copy_file_range: Nix unused variable new_size.
 1.132 01-Oct-2024  riastradh linux_sys_copy_file_range: Avoid more UB arithmetic overflow.

Need to check the input offset too, not just the output offset.

No functional change in the non-UB case.
 1.131 01-Oct-2024  riastradh linux_sys_copy_file_range: Avoid UB arithmetic overflow.

No functional change intended in the non-UB case.
 1.130 01-Oct-2024  riastradh sys/compat/linux/common/linux_file.c: KNF

No functional change intended.
 1.129 01-Oct-2024  riastradh linux_sys_copy_file_range: Prune dead branch.

kmem_alloc(KM_SLEEP) can't fail.

No functional change intended.
 1.128 01-Oct-2024  riastradh sys/compat/linux/common/linux_file.c: Fix blank lines and comments.

No functional change intended.
 1.127 01-Oct-2024  riastradh sys/compat/linux/common/linux_file.c: KNF in function heads.

No functional change intended.
 1.126 01-Oct-2024  riastradh sys/compat/linux/common: Nix trailing whitespace, and one blank line.

No functional change intended.
 1.125 28-Sep-2024  christos Linux GSoC-2024: renameat2, clone3, sync_file_range, syncfs (Shivraj Jamgade)
 1.124 29-Jun-2024  christos branches: 1.124.2;
From gsoc 2024: Implement faccessat2 and getcpu (Shivraz)
 1.123 10-Jul-2023  christos Add memfd_create(2) from GSoC 2023 by Theodore Preduta
 1.122 25-Nov-2021  ryo add support COMPAT_LINUX32 for aarch64
 1.121 23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.120 20-Sep-2021  thorpej Add preadv(2) and pwritev(2) system calls to COMPAT_LINUX and COMPAT_LINUX32.
 1.119 07-Sep-2021  riastradh sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.118 23-May-2020  ad branches: 1.118.2;
Move proc_lock into the data segment. It was dynamically allocated because
at the time we had mutex_obj_alloc() but not __cacheline_aligned.
 1.117 09-Nov-2019  jdolecek add dummy implementation of linux fallocate() which just returns EOPNOTSUPP;
this is needed so that glibc falls back to emulation and apps behaving
properly, since EOPNOTSUPP is a documented and expected return code, but
ENOSYS is not

right now there are no filesystems in NetBSD tree supporting the fallocate
VOP, so no point trying to map this to a native call

supposed to help with problem reported in
https://mail-index.netbsd.org/tech-kern/2019/11/03/msg025641.html
 1.116 18-Jun-2019  kamil branches: 1.116.2;
Drop unused retval pointer from do_sys_mknod{,at}()

No functional change intended.
 1.115 01-Mar-2015  njoly branches: 1.115.10; 1.115.18;
Add Linux specific fcntl(2) commands. Support F_DUPFD_CLOEXEC.
 1.114 09-Nov-2014  maxv branches: 1.114.2;
Do not uselessly include <sys/malloc.h>.
 1.113 25-Jun-2014  njoly branches: 1.113.2;
Add support for more open flags that have a native equivalent
(O_NONBLOCK, O_DIRECT and O_NOFOLLOW).
Translate native EFTYPE error (missing on Linux) to expected ELOOP;
when opening symlinks with flag O_NOFOLLOW.
 1.112 01-Jun-2014  njoly Cleanup pipe(2) flags, now that native handle them.
 1.111 18-May-2014  njoly Simplify dup3 emulation to call dodup() directly instead of
sys_dup2()+fd_set_exclose(). While here, add some error conditions.
 1.110 06-May-2014  njoly linux_off_t -> off_t in pwrite() syscall args comment.
 1.109 04-May-2014  njoly Fix pread/pwrite syscalls which need a 64bit offset argument.
 1.108 08-Dec-2013  njoly branches: 1.108.2;
Sprinkle a few more linux_umode_t where appropriate.
Reduce diffs between archs.
 1.107 08-Dec-2013  njoly Add missing syscall argument fd in comment.
 1.106 18-Nov-2013  chs implement the *at() syscalls.
bring the unimplemented syscall list up to date.
 1.105 24-Sep-2013  njoly Add utimensat(2) for compat linux.
 1.104 14-Oct-2011  hannken branches: 1.104.2; 1.104.12; 1.104.16;
Change the vnode locking protocol of VOP_GETATTR() to request at least
a shared lock. Make all calls outside of file systems respect it.

The calls from file systems need review.

No objections from tech-kern.
 1.103 14-Apr-2011  christos move dup3 to a more appropriate place because pipe is "special". Gotta love
linux.
 1.102 10-Apr-2011  christos We have O_CLOEXEC now
 1.101 19-Nov-2010  dholland branches: 1.101.2;
Introduce struct pathbuf. This is an abstraction to hold a pathname
and the metadata required to interpret it. Callers of namei must now
create a pathbuf and pass it to NDINIT (instead of a string and a
uio_seg), then destroy the pathbuf after the namei session is
complete.

Update all namei call sites accordingly. Add a pathbuf(9) man page and
update namei(9).

The pathbuf interface also now appears in a couple of related
additional places that were passing string/uio_seg pairs that were
later fed into NDINIT. Update other call sites accordingly.
 1.100 21-Sep-2010  chs implement O_DIRECTORY as standardized in POSIX-2008,
for both native and linux emulations.
this fixes the rest of PR 43695.
 1.99 01-Jul-2010  rmind Remove pfind() and pgfind(), fix locking in various broken uses of these.
Rename real routines to proc_find() and pgrp_find(), remove PFIND_* flags
and have consistent behaviour. Provide proc_find_raw() for special cases.
Fix memory leak in sysctl_proc_corename().

COMPAT_LINUX: rework ptrace() locking, minimise differences between
different versions per-arch.

Note: while this change adds some formal cosmetics for COMPAT_DARWIN and
COMPAT_IRIX - locking there is utterly broken (for ages).

Fixes PR/43176.
 1.98 09-Aug-2009  haad branches: 1.98.2; 1.98.4;
Add enum uio_seg argument to do_sys_mknod and do_sys_mkdir so these functions
can be called from kernel, too.

Change needed for zfs device node creation, until we have propoer devfs.

Oked by ad@.
 1.97 11-Jan-2009  christos merge christos-time_t
 1.96 28-Apr-2008  martin branches: 1.96.2; 1.96.8;
Remove clause 3 and 4 from TNF licenses
 1.95 24-Apr-2008  ad branches: 1.95.2;
Network protocol interrupts can now block on locks, so merge the globals
proclist_mutex and proclist_lock into a single adaptive mutex (proc_lock).
Implications:

- Inspecting process state requires thread context, so signals can no longer
be sent from a hardware interrupt handler. Signal activity must be
deferred to a soft interrupt or kthread.

- As the proc state locking is simplified, it's now safe to take exit()
and wait() out from under kernel_lock.

- The system spends less time at IPL_SCHED, and there is less lock activity.
 1.94 23-Apr-2008  ad - Use cdev_tty().
- Tweak locking.
 1.93 21-Mar-2008  ad branches: 1.93.2; 1.93.4;
Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
 1.92 02-Feb-2008  dsl branches: 1.92.6;
Fix the linux32 emulations of fcntl() locking.
The 64bit linux emulation versions can't be used because the lock structure
alignment and field sizes all differ.
Since there need to be 4 different versions of the linux struct flock, and
amd64 kernel needs 3 of them compiled in, rather than replicating the same
code block twice more, move the body of the code into a few #defines
that can be expanded with the correct types in the linux[32]_sys_fcntl[64]()
functions.
Should fix problems running progams like skype running under linux32
emulation on amd64.
 1.91 15-Jan-2008  njoly compat linux (and linux32) uid16 functions cleanup and fixes.

- Move uid16 functions to their own file linux_uid16.c, included by
needed archs (arm, i386 and m68k).
- Add new MI types linux_{u,g}id16_t.
- Add macros to handle linux_uid16_t and uid_t conversions.
- Add linux_sys_getres{uid,gid}16 syscalls, to fix an overflow with
bad sizes given to copyout when linux_sys_getres{uid,gid} are used.
- Update arm syscall table to use more uid16 functions.
 1.90 20-Dec-2007  dsl Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.89 08-Dec-2007  pooka branches: 1.89.4;
Remove cn_lwp from struct componentname. curlwp should be used
from on. The NDINIT() macro no longer takes the lwp parameter and
associates the credentials of the calling thread with the namei
structure.
 1.88 08-Dec-2007  dsl ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.87 04-Dec-2007  dsl Remove all the __P
 1.86 26-Nov-2007  pooka branches: 1.86.2;
Remove the "struct lwp *" argument from all VFS and VOP interfaces.
The general trend is to remove it from all kernel interfaces and
this is a start. In case the calling lwp is desired, curlwp should
be used.

quick consensus on tech-kern
 1.85 16-Nov-2007  njoly Cleanup. Remove a few linux syscalls definitions, now identical to
native ones (with stackgap and ALT_CHECK_xxx removal). No functional
changes expected.
 1.84 19-Oct-2007  njoly branches: 1.84.2;
Add compat_linux and exec_linux_elf lkm support for amd64:
- Add needed COMPAT_OSSAUDIO to GENERIC.
- Add missing includes needed by linux_syscallargs.h.
- Add lkm building.
 1.83 12-May-2007  dsl branches: 1.83.6; 1.83.8; 1.83.12;
Split the fcntl locking code out from its copyin/out.
Use to avoid all the stackgap stuff in compat code.
 1.82 22-Apr-2007  dsl Change the way that emulations locate files within the emulation root to
avoid having to allocate space in the 'stackgap'
- which is very LWP unfriendly.
The additional code for non-emulation namei() is trivial, the reduction for
the emulations is massive.
The vnode for a processes emulation root is saved in the cwdi structure
during process exec.
If the emulation root the TRYEMULROOT flag are set, namei() will do an initial
search for absolute pathnames in the emulation root, if that fails it will
retry from the normal root.
".." at the emulation root will always go to the real root, even in the middle
of paths and when expanding symlinks.
Absolute symlinks found using absolute paths in the emulation root will be
relative to the emulation root (so /usr/lib/xxx.so -> /lib/xxx.so links
inside the emulation root don't need changing).
If the root of the emulation would be returned (for an emulation lookup), then
the real root is returned instead (matching the behaviour of emul_lookup,
but being a cheap comparison here) so that programs that scan "../.."
looking for the root dircetory don't loop forever.
The target for symbolic links is no longer mangled (it used to get the
CHECK_ALT_xxx() treatment, so could get /emul/xxx prepended).
CHECK_ALT_xxx() are no more. Most of the change is deleting them, and adding
TRYEMULROOT to the flags to NDINIT().
A lot of the emulation system call stubs could now be deleted.
 1.81 10-Mar-2007  dsl branches: 1.81.2;
Update all the compat stuff to not use the 'stackgap' for processing
sys_stat() and friends, instead use do_sys_stat() and do_sys_fstat()
that write the answer into a kernel buffer (on stack) that can be
converted to the correct form and written the userspace.
I've test compiled a few kernels, and tested i386 netbsd1.6 ls.
Given I think I've fixed some bugs, it might be 50-50 with new ones.
 1.80 09-Mar-2007  ad branches: 1.80.2;
- Make the proclist_lock a mutex. The write:read ratio is unfavourable,
and mutexes are cheaper use than RW locks.
- LOCK_ASSERT -> KASSERT in some places.
- Hold proclist_lock/kernel_lock longer in a couple of places.
 1.79 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.78 17-Feb-2007  dsl Acquire proclist_lock across the calls to p_find() and pg_find().
 1.77 09-Feb-2007  ad branches: 1.77.2;
Merge newlock2 to head.
 1.76 16-Nov-2006  christos __unused removal on arguments; approved by core.
 1.75 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.74 25-Sep-2006  pavel Replace homegrown tests for FIFO (... & S_IFIFO) by S_ISFIFO. The old code
was "correct" by luck - we don't have any other file type whose S_IF* bits
in sys/stat.h overlap with S_IFIFO.

Originally discovered by Paul Stoeber in OpenBSD.
 1.73 23-Jul-2006  ad branches: 1.73.4; 1.73.6;
Use the LWP cached credentials where sane.
 1.72 14-May-2006  elad integrate kauth.
 1.71 11-Dec-2005  christos branches: 1.71.4; 1.71.6; 1.71.8; 1.71.10; 1.71.12;
merge ktrace-lwp.
 1.70 19-Aug-2005  christos 64 bit inode changes.
 1.69 29-May-2005  christos branches: 1.69.2;
- sprinkle const.
- add XXXUNCONST to the emul_find() pbuf argument free'ing. XXX: this needs
an api change.
- avoid variable shadowing.
 1.68 16-May-2005  fvdl Add *xattr functions (they all return EOPNOTSUPP).
 1.67 03-May-2005  manu First work on COMPAT_LINUX/amd64
Process startup and dynamiclinking work, but processes hang due to
Linux arch_prctl(2) not being really supported yet.
 1.66 10-Mar-2005  christos Add nanosecond handling on the stat and stat64 code for the i386.
 1.65 26-Feb-2005  perry nuke trailing whitespace
 1.64 12-Dec-2004  abs branches: 1.64.2; 1.64.4;
Fix comments slighly
 1.63 13-Aug-2004  jdolecek on Linux, unlink() fails with EISDIR if the target is directory,
rather than EPERM; to emulate this properly, translate the error to EISDIR
if the target patch exists and points to a directory

this fixes the 'ant clean' problem reported by Marc Recht on current-users@
with SuSE 9.1 libraries
 1.62 09-Aug-2003  jdolecek branches: 1.62.2;
fix linux_sys_p{read|write}() to actually call correct syscall after
arg massage, i.e. sys_p{read|write} as appropriate; up to now, the functions
called sys_{read|write}() by mistake
 1.61 29-Jun-2003  fvdl branches: 1.61.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.60 29-Jun-2003  jdolecek properly FILE_USE/FILE_UNUSE descriptor in linux_sys_fcntl()
adresses PR kern/21628 by Wolfgang Solfrank
 1.59 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.58 19-Mar-2003  dsl Alternative pid/proc allocater, removes all searches associated with pid
lookup and allocation, and any dependency on NPROC or MAXUSERS.
NO_PID changed to -1 (and renamed NO_PGID) to remove artificial limit
on PID_MAX.
As discussed on tech-kern.
 1.57 27-Feb-2003  yamt make compat_linux struct file interlock friendly.
 1.56 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.55 17-Dec-2002  simonb Use the already-filled-in-but-not-used native syscall args in
linux_sys_mknod().
 1.54 11-Dec-2002  jdolecek linux_sys_mknod(): if creating device file (i.e. !fifo case), mask
the passed device number to only contain lower 16 bits; older glibc
appears to pass some junk in upper bits sometimes, resulting in incorrect
device entries being created

Problem initially analyzed by Thor Lancelot Simon.
 1.53 06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.52 13-May-2002  simonb branches: 1.52.2; 1.52.4;
Remove an unreachable "break" after a return statement.
 1.51 10-Apr-2002  christos implement getdents64; my full java tree builds now.
 1.50 24-Mar-2002  jdolecek add explicit comment a FILE_USE() is not needed here
 1.49 24-Mar-2002  jdolecek Fix problem with assumption non-socket == vnode in F_{G,S}ETOWN different way
(revisions 1.47 & 1.48 effectively backed off):
* for all but vnodes, just fallback to sys_fcntl(); assumming
state of support for F_SETOWN/F_GETOWN and even hardcoding it here is
not right (e.g. rev. 1.47 had this incorrect for DTYPE_PIPE)
* fallback to sys_fcntl() also for vnodes which don't represent tty
* don't need to use FILE_{,UN}USE() here, the code won't block while
using the pointer
* add/fix some comments
 1.48 23-Mar-2002  christos correct placement for FILE_UNUSE [from Izumi Tsutsui]
 1.47 22-Mar-2002  christos - obey FILE_USE and FILE_UNUSE
- don't assume that non sockets point to vnodes.
 1.46 16-Mar-2002  christos make the stackgap_{init,alloc} functions MP friendly (i.e. pass struct proc *
in, instead of using curproc). While there add an optional size argument to
stackgap_init.
 1.45 15-Feb-2002  christos - add a real linux_sys___sysctl because the mib numbers are different.
implement only the kernel version getting entries.
- make the signal conversion functions consistent; dest is arg 1.
- make linux_fakedev deal with block and char devices differently.
- add linux_sys_ugetrlimit, and flesh out the regular get/setrlimit so
that they work properly.
- add linux_mmap2 [untested].
- bump kernel to 2.4.18, and make the date be valentine's day :-)
- linux_sys_*stat64 family was totally busted. Fix it.

tested only on i386.

Status:
gdb, telnet, work
jdk-1.4.0 extractor works, jdk still coredumps.

christos
 1.44 14-Jan-2002  bjh21 Crude first cut at ARMLinux binary compatibility. Successfully runs
"/emul/linux/bin/echo hello, world", dynamically linked.
 1.43 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.42 22-Sep-2001  manu Fixes for mips support
 1.41 04-Sep-2001  jdolecek branches: 1.41.2;
change LINUX_F_SETFL so that SIGIO handling for sockets
matches more closely
add support for NEW_PIPE to the SIGIO hack
 1.40 22-Jul-2001  wiz seperate -> separate
 1.39 16-Jun-2001  manu branches: 1.39.2;
Linux does not send a SIGIO to the write end of a socket,
neither it does send any SIGIO for pipes. If async I/O
was requested, we keep the SS_ASYNC in struct socket flag
set, but we clear SB_ASYNC flags on the sending buffer
(for socket), and on the sending and the receiving buffer
(for pipes).

Because we do not alter to SS_ASYNC in struct socket,
the Linux process keeps a consistent view of async I/O
status if it attemps to read the async flag (SS_ASYNC)

This async I/O problem does matters, since some Linux
a programs such as the JDK request async I/O on pipes,
but they fail if they happen to get a SIGIO to the write
end of the pipe.
 1.38 14-Jun-2001  thorpej Fix a partial construction problem that can cause race conditions
between creation of a file descriptor and close(2) when using kernel
assisted threads. What we do is stick descriptors in the table, but
mark them as "larval". This causes essentially everything to treat
it as a non-existent descriptor, except for fdalloc(), which sees a
filled slot so that it won't (incorrectly) allocate it again. When
a descriptor is fully constructed, the code that has constructed it
marks it as "mature" (which actually clears the "larval" flag), and
things continue to work as normal.

While here, gather all the code that gets a descriptor from the table
into a fd_getfile() function, and call it, rather than having the
same (sometimes incorrect) code copied all over the place.
 1.37 22-Jan-2001  jdolecek branches: 1.37.2;
use CHECK_ALT_SYMLINK() for lstat(2)
don't call stackgap_init() for pwrite(2) and pread(2), it's not necessary
 1.36 22-Jan-2001  jdolecek Use CHECK_ALT_SYMLINK() instead CHECK_ALT_EXISTS() where appropriate.
This addresses kern/11757.
 1.35 19-Jan-2001  manu Added support for powerpc Linux compatibility
 1.34 29-Dec-2000  fvdl Do alternate path checks for link(2).
 1.33 27-Dec-2000  fvdl Use CHECK_ALT_* for chown and lchown, missed in my previous commit.
Get *id16 calls right; most can be passed through directly, but
some need the 16->32 check for -1 values.
 1.32 21-Dec-2000  thorpej Only include the 16-bit chown/fchown/lchown stuff if on i386 or m68k.
This is a little ugly, but hey, so is Linux.
 1.31 18-Dec-2000  fvdl Add seperate entries for 16 bit uid/gid calls, so that border cases
like 0xffff can be handled better (not done yet).
 1.30 01-Dec-2000  jdolecek add e_path (emulation path) to struct emul, which replaces emulation-specific
*_emul_path variables

change macros CHECK_ALT_{CREAT|EXIST} to use that, 'root' doesn't need
to be passed explicitly any more and *_CHECK_ALT_{CREAT|EXIST} are removed
change explicit emul_find() calls in probe functions to get the emulation
path from the checked exec switch entry's emulation

remove no longer needed header files

add e_flags and e_syscall to struct emul; these are unsed and empty for now
 1.29 29-Aug-2000  sommerfeld Emulation stackgap sanity checks, based partly on fixes from
FreeBSD-SA00:42.

Change stackgap_alloc to bounds-check the allocation vs. the stack
gap, returning NULL if there isn't room for the allocation.

Change emul_find() to check for a NULL return from stackgap_alloc()
and convert that into ENAMETOOLONG.

Reorder various emulation syscalls so that all *_CHECK_ALT_{EXIST,CREAT}
calls (which turn into emul_find() under the covers come *after* small,
fixed-size stackgap_alloc() calls.

Clean up ibcs2 {get,set}groups.
 1.28 05-Dec-1999  tron branches: 1.28.4;
Add proper stub code to make emulation of Linux's pread(2) and pwrite(2)
work. Fixes PR kern/8945 by Dave Sainty.
 1.27 09-Feb-1999  christos branches: 1.27.2; 1.27.8; 1.27.14;
const poisoning.
 1.26 07-Oct-1998  erh The siginfo include line is not needed here anymore.
 1.25 04-Oct-1998  fvdl Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.24 03-Oct-1998  christos Attempt to fix the mess.
 1.23 01-Oct-1998  erh Split compat/linux/linux_file.c into common and multi-architechture parts.
 1.22 14-Feb-1998  kleink * Use sys___posix_{chown,fchown}() instead of sys_{chown,fchown}().
* Change reference from sys_posix_rename() to sys___posix_rename().
 1.21 20-Oct-1997  thorpej Fix the shared library versioning snafu caused by the recent changes
to the stat(2) family and msync(2). This uses a primitive function
versioning scheme.

This reverts the libc shared library major version from 13 to 12, and
adds a few new interfaces to bring us to libc version 12.20.

From Frank van der Linden <fvdl@NetBSD.ORG>.
 1.20 19-Oct-1997  mycroft Fix bogosity in mknod(2) translation.
 1.19 16-Oct-1997  christos check for st_nlink overflow
 1.18 05-Sep-1997  kleink Add missing preparation of F_GETLK parameters in linux_sys_fcntl(); fixes PR
port-i386/4083 from Matthias Scheler <tron@lyssa.owl.de>, but vastly cleaned
up as previously suggested by myself.
 1.17 27-Jun-1997  kleink branches: 1.17.4;
Use sys_posix_rename() instead of sys_rename() as it's the behaviour of the
native implementation.
 1.16 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.15 20-May-1996  fvdl Update list of Linux syscalls and implement the ones that are likely to be
used and doable.
 1.14 05-Apr-1996  christos Prototyping changes.
 1.13 08-Oct-1995  fvdl Work around calling the NetBSD fcntl(F_{G,S}ETOWN) for now; it is too
restrictive to implement the Linux equivalent (and perhaps too restrictive
overall).
 1.12 07-Oct-1995  mycroft Prefix names of system call implementation functions with `sys_'.
 1.11 19-Sep-1995  thorpej Make system calls conform to a standard prototype and bring those
prototypes into scope.
 1.10 07-Sep-1995  fvdl Fix some bugs & typing problems.
 1.9 27-Aug-1995  fvdl Add a hook for MD ioctl calls, plus a couple of more changes to make
svgalib binaries work on the i386
 1.8 14-Aug-1995  mycroft Rearrange #includes.
 1.7 24-Jul-1995  fvdl mkdir() has 2 arguments.. fixes PR 1248 (from Brad Spencer)
 1.6 03-Jul-1995  fvdl Fix totally bogus implementation of a few fcntl() calls. I think I'll go
live on a deserted island now..
 1.5 24-Jun-1995  christos Use compat_util.[ch].
 1.4 22-Jun-1995  fvdl * Changed to use generic ELF code from kern/exec_elf.c (which was taken
from the svr4 exec code plus the linux compat mods)
* Include file change
* Add multicast sockopts (from John Brezak)
 1.3 04-Apr-1995  mycroft Fix conversion of `type' and `whence' values in struct flock.
 1.2 05-Mar-1995  fvdl Added a few more system calls.
More consistent alternate root file semantics throughout.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.17.4.1 06-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.27.14.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.27.8.4 11-Feb-2001  bouyer Sync with HEAD.
 1.27.8.3 05-Jan-2001  bouyer Sync with HEAD
 1.27.8.2 08-Dec-2000  bouyer Sync with HEAD.
 1.27.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.27.2.1 09-Sep-2000  he Pull up revision 1.29 (requested by simonb):
More carefully check length of user-supplied data, in particular
make sure we don't overrun the available stack gap in stack gap
allocations.
 1.28.4.2 30-Mar-2001  he Pull up revision 1.34 (via patch, requested by fvdl):
Add some required Linux emulation bits to support the Linux
version of VMware.
 1.28.4.1 30-Aug-2000  sommerfeld Pull up:
syssrc/sys/compat/common/compat_util.c 1.16
syssrc/sys/compat/hpux/hpux_file.c 1.14
syssrc/sys/compat/ibcs2/ibcs2_misc.c 1.52
syssrc/sys/compat/ibcs2/ibcs2_stat.c 1.16
syssrc/sys/compat/linux/common/linux_file.c 1.29
syssrc/sys/compat/linux/common/linux_misc_notalpha.c 1.58
syssrc/sys/compat/svr4/svr4_stat.c 1.40
syssrc/sys/compat/svr4/svr4_stream.c 1.40,1.41

Approved by thorpej and jhawk.

Emulation stackgap sanity checks, based partly on fixes from
FreeBSD-SA00:42.

Change stackgap_alloc to bounds-check the allocation vs. the stack
gap, returning NULL if there isn't room for the allocation.

Change emul_find() to check for a NULL return from stackgap_alloc()
and convert that into ENAMETOOLONG.

Reorder various emulation syscalls so that all *_CHECK_ALT_{EXIST,CREAT}
calls (which turn into emul_find() under the covers come *after* small,
fixed-size stackgap_alloc() calls.

Clean up ibcs2 {get,set}groups.

Add range checks to svr4_stream.c
 1.37.2.14 20-Dec-2002  nathanw LWPify new mkfifo code.
 1.37.2.13 19-Dec-2002  thorpej Sync with HEAD.
 1.37.2.12 17-Sep-2002  nathanw Catch up to -current.
 1.37.2.11 20-Jun-2002  nathanw Catch up to -current.
 1.37.2.10 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.37.2.9 17-Apr-2002  nathanw Catch up to -current.
 1.37.2.8 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.37.2.7 28-Feb-2002  nathanw Catch up to -current.
 1.37.2.6 14-Nov-2001  nathanw Catch up to -current.
 1.37.2.5 26-Sep-2001  nathanw Catch up to -current.
Again.
 1.37.2.4 21-Sep-2001  nathanw Catch up to -current.
 1.37.2.3 24-Aug-2001  nathanw Catch up with -current.
 1.37.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.37.2.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.39.2.7 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.39.2.6 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.39.2.5 16-Mar-2002  jdolecek Catch up with -current.
 1.39.2.4 11-Feb-2002  jdolecek Sync w/ -current.
 1.39.2.3 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.39.2.2 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.39.2.1 03-Aug-2001  lukem update to -current
 1.41.2.2 01-Oct-2001  fvdl Catch up with -current.
 1.41.2.1 07-Sep-2001  thorpej Commit my "devvp" changes to the thorpej-devvp branch. This
replaces the use of dev_t in most places with a struct vnode *.

This will form the basic infrastructure for real cloning device
support (besides being architecurally cleaner -- it'll be good
to get away from using numbers to represent objects).
 1.52.4.1 01-May-2005  tron Pull up revision 1.62 via patch (requested by bad in ticket #5762):
fix linux_sys_p{read|write}() to actually call correct syscall after
arg massage, i.e. sys_p{read|write} as appropriate; up to now, the functions
called sys_{read|write}() by mistake
 1.52.2.1 16-May-2002  gehenna Replace the direct-access to devsw table with calling devsw API.
 1.61.2.9 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.61.2.8 01-Apr-2005  skrll Sync with HEAD.
 1.61.2.7 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.61.2.6 18-Dec-2004  skrll Sync with HEAD.
 1.61.2.5 21-Sep-2004  skrll Fix the sync with head I botched.
 1.61.2.4 18-Sep-2004  skrll Sync with HEAD.
 1.61.2.3 25-Aug-2004  skrll Sync with HEAD.
 1.61.2.2 03-Aug-2004  skrll Sync with HEAD
 1.61.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.62.2.1 15-Aug-2004  tron Pull up revision 1.63 (requested by jdolecek in ticket #764):
on Linux, unlink() fails with EISDIR if the target is directory,
rather than EPERM; to emulate this properly, translate the error to EISDIR
if the target patch exists and points to a directory
this fixes the 'ant clean' problem reported by Marc Recht on current-users@
with SuSE 9.1 libraries
 1.64.4.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.64.2.1 29-Apr-2005  kent sync with -current
 1.69.2.9 24-Mar-2008  yamt sync with head.
 1.69.2.8 04-Feb-2008  yamt sync with head.
 1.69.2.7 21-Jan-2008  yamt sync with head
 1.69.2.6 07-Dec-2007  yamt sync with head
 1.69.2.5 27-Oct-2007  yamt sync with head.
 1.69.2.4 03-Sep-2007  yamt sync with head.
 1.69.2.3 26-Feb-2007  yamt sync with head.
 1.69.2.2 30-Dec-2006  yamt sync with head.
 1.69.2.1 21-Jun-2006  yamt sync with head.
 1.71.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.71.10.1 08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.71.8.2 11-Aug-2006  yamt sync with head
 1.71.8.1 24-May-2006  yamt sync with head.
 1.71.6.1 01-Jun-2006  kardel Sync with head.
 1.71.4.1 09-Sep-2006  rpaulo sync with head
 1.73.6.2 10-Dec-2006  yamt sync with head.
 1.73.6.1 22-Oct-2006  yamt sync with head
 1.73.4.3 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.73.4.2 18-Nov-2006  ad Sync with head.
 1.73.4.1 17-Nov-2006  ad Checkpoint work in progress.
 1.77.2.4 17-May-2007  yamt sync with head.
 1.77.2.3 07-May-2007  yamt sync with head.
 1.77.2.2 12-Mar-2007  rmind Sync with HEAD.
 1.77.2.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.80.2.2 27-May-2007  ad Sync with head.
 1.80.2.1 13-Mar-2007  ad Sync with head.
 1.81.2.1 11-Jul-2007  mjf Sync with head.
 1.83.12.2 18-Nov-2007  bouyer Sync with HEAD
 1.83.12.1 25-Oct-2007  bouyer Sync with HEAD.
 1.83.8.3 23-Mar-2008  matt sync with HEAD
 1.83.8.2 09-Jan-2008  matt sync with HEAD
 1.83.8.1 06-Nov-2007  matt sync with HEAD
 1.83.6.4 09-Dec-2007  jmcneill Sync with HEAD.
 1.83.6.3 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.83.6.2 21-Nov-2007  joerg Sync with HEAD.
 1.83.6.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.84.2.4 18-Feb-2008  mjf Sync with HEAD.
 1.84.2.3 27-Dec-2007  mjf Sync with HEAD.
 1.84.2.2 08-Dec-2007  mjf Sync with HEAD.
 1.84.2.1 19-Nov-2007  mjf Sync with HEAD.
 1.86.2.2 26-Dec-2007  ad Sync with head.
 1.86.2.1 08-Dec-2007  ad Sync with head.
 1.89.4.2 19-Jan-2008  bouyer Sync with HEAD
 1.89.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.92.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.92.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.92.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.93.4.1 18-May-2008  yamt sync with head.
 1.93.2.2 01-Nov-2008  christos Sync with head.
 1.93.2.1 29-Mar-2008  christos Welcome to the time_t=long long dev_t=uint64_t branch.
 1.95.2.5 09-Oct-2010  yamt sync with head
 1.95.2.4 11-Aug-2010  yamt sync with head.
 1.95.2.3 19-Aug-2009  yamt sync with head.
 1.95.2.2 04-May-2009  yamt sync with head.
 1.95.2.1 16-May-2008  yamt sync with head.
 1.96.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.96.2.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.96.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.98.4.3 21-Apr-2011  rmind sync with head
 1.98.4.2 05-Mar-2011  rmind sync with head
 1.98.4.1 03-Jul-2010  rmind sync with head
 1.98.2.2 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.98.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.101.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.104.16.1 18-May-2014  rmind sync with head
 1.104.12.2 03-Dec-2017  jdolecek update from HEAD
 1.104.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.104.2.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.108.2.1 10-Aug-2014  tls Rebase.
 1.113.2.1 17-Jan-2015  martin Pull up following revision(s) (requested by maxv in ticket #427):
sys/compat/svr4/svr4_schedctl.c: revision 1.8
sys/netinet/tcp_timer.c: revision 1.88
sys/miscfs/genfs/layer_vfsops.c: revision 1.45
sys/compat/svr4/svr4_ioctl.c: revision 1.37
sys/ufs/chfs/chfs_vfsops.c: revision 1.14
sys/miscfs/fdesc/fdesc_vfsops.c: revision 1.91
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.30
sys/compat/common/kern_time_50.c: revision 1.28
sys/netinet6/ip6_forward.c: revision 1.74
sys/miscfs/umapfs/umap_vnops.c: revision 1.57
sys/compat/svr4/svr4_fcntl.c: revision 1.74
distrib/sets/lists/comp/mi: revision 1.1931
sys/netinet6/udp6_output.c: revision 1.46
sys/fs/puffs/puffs_compat.c: revision 1.3
sys/fs/udf/udf_rename.c: revision 1.11
sys/compat/svr4/svr4_filio.c: revision 1.24
sys/fs/udf/udf_rename.c: revision 1.12
sys/netinet/tcp_usrreq.c: revision 1.202
sys/miscfs/umapfs/umap_subr.c: revision 1.29
sys/compat/linux/common/linux_fadvise64.c: revision 1.3
sys/netinet/if_atm.c: revision 1.34
sys/miscfs/procfs/procfs_subr.c: revision 1.106
sys/miscfs/genfs/layer_subr.c: revision 1.37
sys/netinet/tcp_sack.c: revision 1.30
sys/compat/freebsd/freebsd_misc.c: revision 1.33
sys/compat/freebsd/freebsd_file.c: revision 1.33
sys/ufs/chfs/chfs_vnode.c: revision 1.12
sys/compat/svr4/svr4_ttold.c: revision 1.34
sys/compat/linux/common/linux_file.c: revision 1.114
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.43
sys/compat/linux/common/linux_signal.c: revision 1.76
sys/compat/common/compat_util.c: revision 1.46
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.18
sys/compat/svr4/svr4_sockio.c: revision 1.36
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.32
sys/compat/svr4/svr4_signal.c: revision 1.66
sys/kern/kern_exec.c: revision 1.410
sys/fs/puffs/puffs_vfsops.c: revision 1.115
sys/compat/svr4/svr4_exec_elf64.c: revision 1.15
sys/compat/linux/arch/i386/linux_machdep.c: revision 1.159
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.50
sys/compat/linux32/common/linux32_misc.c: revision 1.24
sys/netinet/in_pcb.c: revision 1.153
sys/sys/malloc.h: revision 1.116
sys/compat/common/if_43.c: revision 1.9
share/man/man9/Makefile: revision 1.380
sys/netinet/tcp_vtw.c: revision 1.12
sys/miscfs/umapfs/umap_vfsops.c: revision 1.95
sys/ufs/ext2fs/ext2fs_vfsops.c: revision 1.186
sys/compat/common/uipc_syscalls_43.c: revision 1.46
sys/ufs/ext2fs/ext2fs_vnops.c: revision 1.115
sys/fs/puffs/puffs_msgif.c: revision 1.97
sys/compat/svr4/svr4_ipc.c: revision 1.27
sys/compat/linux/common/linux_exec.c: revision 1.117
sys/ufs/ext2fs/ext2fs_readwrite.c: revision 1.66
sys/netinet/tcp_output.c: revision 1.179
sys/compat/svr4/svr4_termios.c: revision 1.28
sys/fs/udf/udf_strat_bootstrap.c: revision 1.4
sys/fs/puffs/puffs_subr.c: revision 1.67
sys/fs/puffs/puffs_node.c: revision 1.36
sys/miscfs/overlay/overlay_vnops.c: revision 1.21
sys/fs/cd9660/cd9660_node.c: revision 1.34
sys/netinet/raw_ip.c: revision 1.146
sys/sys/mallocvar.h: revision 1.13
sys/miscfs/overlay/overlay_vfsops.c: revision 1.63
share/man/man9/malloc.9: revision 1.50
sys/netinet6/dest6.c: revision 1.18
sys/compat/linux/common/linux_uselib.c: revision 1.33
sys/compat/linux/common/linux_socket.c: revision 1.120
share/man/man9/malloc.9: revision 1.51
sys/netinet/tcp_subr.c: revision 1.257
sys/compat/linux/common/linux_socketcall.c: revision 1.45
sys/compat/linux/common/linux_fadvise64_64.c: revision 1.3
sys/compat/freebsd/freebsd_ipc.c: revision 1.17
sys/compat/linux/common/linux_misc_notalpha.c: revision 1.109
sys/compat/linux/arch/alpha/linux_pipe.c: revision 1.17
sys/netinet6/in6_pcb.c: revision 1.132
sys/netinet6/in6_ifattach.c: revision 1.94
sys/compat/svr4/svr4_exec_elf32.c: revision 1.15
sys/miscfs/nullfs/null_vfsops.c: revision 1.90
sys/fs/cd9660/cd9660_util.c: revision 1.12
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.48
sys/compat/freebsd/freebsd_exec_elf32.c: revision 1.20
sys/miscfs/procfs/procfs_vfsops.c: revision 1.94
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.28
sys/compat/linux/common/linux_sched.c: revision 1.67
sys/compat/linux/common/linux_exec_aout.c: revision 1.67
sys/compat/linux/common/linux_pipe.c: revision 1.67
sys/compat/linux/common/linux_llseek.c: revision 1.34
sys/compat/linux/arch/mips/linux_ptrace.c: revision 1.10
Do not uselessly include <sys/malloc.h>.
Cleanup:
- remove struct kmembuckets (dead)
- correctly deadify MALLOC_XX
- remove MALLOC_DEFINE_LIMIT and MALLOC_JUSTDEFINE_LIMIT (dead)
- remove malloc_roundup(), malloc_type_setlimit(), MALLOC_DEFINE_LIMIT()
and MALLOC_JUSTDEFINE_LIMIT() from man 9 malloc
New sentence, new line. Bump date for previous.
Obsolete malloc_roundup(9), malloc_type_setlimit(9) and MALLOC_DEFINE_LIMIT(9)
man pages.
 1.114.2.1 06-Apr-2015  skrll Sync with HEAD
 1.115.18.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.115.10.1 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1836):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.116.2.1 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.118.2.1 17-Dec-2020  thorpej Add suppport for Linux preadv(2) and pwritev(2). Same as native, except
for the silly way that the offset argument is passed in.
 1.124.2.1 02-Aug-2025  perseant Sync with HEAD
 1.68 29-Jul-2023  christos Add/fix statx, readahead, close_range. From GSoC 2023 by Theodore Preduta
 1.67 25-Nov-2021  ryo - Add compat_linux statx(2) syscall.
- The AT_EMPTY_PATH processing from the modification of
sys/compat/linux/common/linux_file64.c r1.63 has been separated, and made
common to linux_statat(), so that it can be used not only by
linux32_sys_fstatat64() but also by other *statat() variants.
 1.66 25-Nov-2021  ryo rename bsd_to_linux_stat() to bsd_to_linux_stat64() to avoid confusion.
There is a static function with the same name in linux/common/linux_file.c.

NFC.
 1.65 25-Nov-2021  ryo rename bsd_to_linux_stat() to bsd_to_linux_stat64() to avoid confusion.
There is a static function with the same name in linux/common/linux_file.c.

NFC.
 1.64 23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.63 21-Sep-2021  rin linux_sys_fstatat64: Add support for AT_EMPTY_PATH flag.

This is required for rtld shipped with glibc 2.33.

Now, userland of Fedora 34 is working fine on NetBSD/amd64.
 1.62 23-Aug-2019  maxv Fix info leaks.
 1.61 23-Aug-2019  maxv Fix info leak.
 1.60 03-Sep-2018  riastradh branches: 1.60.4;
Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.59 28-Jul-2017  riastradh branches: 1.59.2; 1.59.4;
Fail, don't panic, on bad dirents from file system.

Controllable via puffs from userland.

From Ilja Van Sprundel.
 1.58 28-Jan-2017  christos branches: 1.58.6;
copy the terminating NUL (njoly)
 1.57 13-Jan-2017  christos branches: 1.57.2;
fix typo
 1.56 13-Jan-2017  christos convert strcpy to a bounded copy to avoid compiler warnings, although the
reclen test prevents overflow.
 1.55 27-Dec-2013  njoly branches: 1.55.4; 1.55.6; 1.55.8; 1.55.10; 1.55.14;
Add struct linux_stat64 definition for alpha, and enable syscalls that
use it.
 1.54 18-Nov-2013  chs implement the *at() syscalls.
bring the unimplemented syscall list up to date.
 1.53 14-Oct-2011  hannken branches: 1.53.2; 1.53.8; 1.53.12; 1.53.14; 1.53.16; 1.53.22;
Change the vnode locking protocol of VOP_GETATTR() to request at least
a shared lock. Make all calls outside of file systems respect it.

The calls from file systems need review.

No objections from tech-kern.
 1.52 01-Sep-2011  njoly Make linux_sys_getdents64 fails with ENOTDIR instead of EINVAL, when fd
does not refer to a directory.
 1.51 24-Jun-2010  hannken Clean up vnode lock operations pass 2:

VOP_UNLOCK(vp, flags) -> VOP_UNLOCK(vp): Remove the unneeded flags argument.

Welcome to 5.99.32.

Discussed on tech-kern.
 1.50 03-Mar-2010  he branches: 1.50.2;
When implementing "read directory", when there are too many empty entries
in a row, and we need to try to read the next block, and have passed a
non-NULL cookie pointer to VOP_READDIR, ensure that we free the cookie
buffer before re-doing VOP_READDIR, so that we don't leak memory.
This fix is similar to nfs_serv.c revisions 1.115 + 1.124.

This should fix the long-standing problem observed by e.g. using Linux-
emulated programs to take backup of servers, which is one of the problems
which were reported in PR#42661.

Thanks to pooka@ for the hints for traversing the VOP* layer.
 1.49 15-May-2009  pooka branches: 1.49.2;
pad -> PAD
 1.48 24-Jun-2008  ad branches: 1.48.6; 1.48.10; 1.48.14;
Replace references to getsock/getvnode.
 1.47 28-Apr-2008  martin branches: 1.47.2; 1.47.4;
Remove clause 3 and 4 from TNF licenses
 1.46 21-Mar-2008  ad branches: 1.46.2; 1.46.4;
Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
 1.45 02-Feb-2008  dsl branches: 1.45.6;
Extract the fcntl64() suppoort from linux_file64.c into linux_fcntl64.c
Unravel some of the knots that caused linux_file64.c to be compiled twice
for an amd64 kernel (once for linux and once for linux32) with different
parts being skipped each time.
 1.44 20-Dec-2007  dsl Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.43 08-Dec-2007  dsl branches: 1.43.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.42 04-Dec-2007  dsl Remove all the __P
 1.41 26-Nov-2007  pooka branches: 1.41.2;
Remove the "struct lwp *" argument from all VFS and VOP interfaces.
The general trend is to remove it from all kernel interfaces and
this is a start. In case the calling lwp is desired, curlwp should
be used.

quick consensus on tech-kern
 1.40 19-Oct-2007  njoly branches: 1.40.2;
Add compat_linux and exec_linux_elf lkm support for amd64:
- Add needed COMPAT_OSSAUDIO to GENERIC.
- Add missing includes needed by linux_syscallargs.h.
- Add lkm building.
 1.39 12-May-2007  dsl branches: 1.39.6; 1.39.8; 1.39.12;
Split the fcntl locking code out from its copyin/out.
Use to avoid all the stackgap stuff in compat code.
 1.38 22-Apr-2007  dsl Change the way that emulations locate files within the emulation root to
avoid having to allocate space in the 'stackgap'
- which is very LWP unfriendly.
The additional code for non-emulation namei() is trivial, the reduction for
the emulations is massive.
The vnode for a processes emulation root is saved in the cwdi structure
during process exec.
If the emulation root the TRYEMULROOT flag are set, namei() will do an initial
search for absolute pathnames in the emulation root, if that fails it will
retry from the normal root.
".." at the emulation root will always go to the real root, even in the middle
of paths and when expanding symlinks.
Absolute symlinks found using absolute paths in the emulation root will be
relative to the emulation root (so /usr/lib/xxx.so -> /lib/xxx.so links
inside the emulation root don't need changing).
If the root of the emulation would be returned (for an emulation lookup), then
the real root is returned instead (matching the behaviour of emul_lookup,
but being a cheap comparison here) so that programs that scan "../.."
looking for the root dircetory don't loop forever.
The target for symbolic links is no longer mangled (it used to get the
CHECK_ALT_xxx() treatment, so could get /emul/xxx prepended).
CHECK_ALT_xxx() are no more. Most of the change is deleting them, and adding
TRYEMULROOT to the flags to NDINIT().
A lot of the emulation system call stubs could now be deleted.
 1.37 10-Mar-2007  dsl branches: 1.37.2;
Update all the compat stuff to not use the 'stackgap' for processing
sys_stat() and friends, instead use do_sys_stat() and do_sys_fstat()
that write the answer into a kernel buffer (on stack) that can be
converted to the correct form and written the userspace.
I've test compiled a few kernels, and tested i386 netbsd1.6 ls.
Given I think I've fixed some bugs, it might be 50-50 with new ones.
 1.36 04-Mar-2007  christos branches: 1.36.2;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.35 09-Feb-2007  ad branches: 1.35.2;
Merge newlock2 to head.
 1.34 23-Jul-2006  ad branches: 1.34.4; 1.34.8;
Use the LWP cached credentials where sane.
 1.33 14-May-2006  elad integrate kauth.
 1.32 01-Mar-2006  yamt branches: 1.32.2; 1.32.4; 1.32.6;
merge yamt-uio_vmspace branch.

- use vmspace rather than proc or lwp where appropriate.
the latter is more natural to specify an address space.
(and less likely to be abused for random purposes.)
- fix a swdmover race.
 1.31 09-Feb-2006  manu Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.30 11-Dec-2005  christos branches: 1.30.2; 1.30.4; 1.30.6;
merge ktrace-lwp.
 1.29 19-Aug-2005  christos 64 bit inode changes.
 1.28 29-May-2005  christos branches: 1.28.2;
- sprinkle const.
- add XXXUNCONST to the emul_find() pbuf argument free'ing. XXX: this needs
an api change.
- avoid variable shadowing.
 1.27 03-May-2005  manu First work on COMPAT_LINUX/amd64
Process startup and dynamiclinking work, but processes hang due to
Linux arch_prctl(2) not being really supported yet.
 1.26 19-Apr-2005  christos PR/29696: Joel Carnat: NetBSD freezes when accessing smbfs mounted FS with
firefox/linux due to compat getdents() call assumption that all filesystems
support cookies.
 1.25 10-Mar-2005  christos branches: 1.25.2;
Add nanosecond handling on the stat and stat64 code for the i386.
 1.24 26-Feb-2005  perry nuke trailing whitespace
 1.23 17-Sep-2004  skrll branches: 1.23.4; 1.23.6;
There's no need to pass a proc value when using UIO_SYSSPACE with
vn_rdwr(9) and uiomove(9).

OK'd by Jason Thorpe
 1.22 10-Aug-2003  jdolecek add Linux compat arg wrapper for ftruncate64(), and change linux compat
truncate64() wrapper to translate args structure
NetBSD truncate() and ftrucate() have hidden 'pad' argument, so we have
to do the argument translation

Problem found and patch supplied in PR kern/22360 by Ales Krenek

This is the last of syscalls with hidden 'pad' arg we didn't have
wrapper for; all the others (lseek, mmap, pwrite, pread) already had
wrapper before.
 1.21 29-Jun-2003  fvdl branches: 1.21.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.20 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.19 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.18 20-May-2002  jdolecek branches: 1.18.2;
linux_sys_getdents64(): remove the oldcall bug workaround cruft,
it's not needed for this call, and update comment accordingly
 1.17 20-May-2002  jdolecek linux_sys_getdents64(): make the d_off member point to next entry, rather
than current one; this is expected (even documented) behaviour of the
new system call
This fixes the endless loop when reading directories on NFS, though
applications won't see all directory entries due to different problem.
Fix by Matthias Scheler and Charles Hannum.
 1.16 19-May-2002  jdolecek On archs with broken linux struct stat64 st_ino, rename linux_stat64's
lst_ino to __lst_ino and lst_ino64 to lst_ino, and define
LINUX_STAT64_HAS_BROKEN_ST_INO. Only assign __lst_ino if this define
is present.

This fixes compile on powerpc archs, and hence port-powerpc/16893.
 1.15 13-May-2002  matt branches: 1.15.2;
Make COMPAT_LINUX compile again on Alpha. linux_getdents64 moved but
files.linux_alpha wasn't updated. common/linux_file64.c contains a lot
of syscalls which aren't on Linux/alpha so #ifdef them for alpha.
 1.14 13-May-2002  simonb Remove an unreachable "return error;".
 1.13 12-May-2002  jdolecek hook in remaining 64bit fs syscalls
make most of stuff in linux_file64.c available unconditionally,
with exception of fcntl64, which is not present on Linux m68k
 1.12 10-May-2002  tron Remove check for size of field "d_off" in Linux "dirent" structure because
this problem cannot happen with the 64Bit version of the getdents().
 1.11 10-May-2002  tron Move implementation of linux_sys_getdents64() to source file for
Linux 64bit filesystem calls.
 1.10 22-Mar-2002  christos gc debugging printfs.
 1.9 22-Mar-2002  christos implement the locking calls for linux_file64.
 1.8 16-Mar-2002  christos make the stackgap_{init,alloc} functions MP friendly (i.e. pass struct proc *
in, instead of using curproc). While there add an optional size argument to
stackgap_init.
 1.7 15-Feb-2002  christos - add a real linux_sys___sysctl because the mib numbers are different.
implement only the kernel version getting entries.
- make the signal conversion functions consistent; dest is arg 1.
- make linux_fakedev deal with block and char devices differently.
- add linux_sys_ugetrlimit, and flesh out the regular get/setrlimit so
that they work properly.
- add linux_mmap2 [untested].
- bump kernel to 2.4.18, and make the date be valentine's day :-)
- linux_sys_*stat64 family was totally busted. Fix it.

tested only on i386.

Status:
gdb, telnet, work
jdk-1.4.0 extractor works, jdk still coredumps.

christos
 1.6 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.5 14-Oct-2001  manu Fixed a minor problem so that it builds
 1.4 30-Sep-2001  manu Fixes my last commit: only mips really need fcntl64 to work now. i386 and
powerpc could use it later if needed. m68k and alpha should never need it.
 1.3 30-Sep-2001  manu Added initial support for fcntl64 system call (file locking is not
implemented)
 1.2 12-Dec-2000  jdolecek branches: 1.2.2; 1.2.4; 1.2.6; 1.2.8;
add linux_sys_truncate64()
 1.1 12-Dec-2000  jdolecek add emulation of Linux truncate64(2), ftruncate64(2), *stat64(2)
 1.2.8.2 11-Oct-2001  fvdl Catch up with -current. Fix some bogons in the sparc64 kbd/ms
attach code. cd18xx conversion provided by mrg.
 1.2.8.1 01-Oct-2001  fvdl Catch up with -current.
 1.2.6.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.2.6.2 16-Mar-2002  jdolecek Catch up with -current.
 1.2.6.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.4.10 20-Jun-2002  nathanw Catch up to -current.
 1.2.4.9 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.2.4.8 01-Apr-2002  nathanw Re-LWPify linux_sys_fcntl64().
 1.2.4.7 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.2.4.6 28-Feb-2002  nathanw Catch up to -current.
 1.2.4.5 06-Dec-2001  wdk struct proc -> struct lwp changes for COMPAT_LINUX support on Mips
processors.
 1.2.4.4 14-Nov-2001  nathanw Catch up to -current.
 1.2.4.3 22-Oct-2001  nathanw Catch up to -current.
 1.2.4.2 08-Oct-2001  nathanw Catch up to -current.
 1.2.4.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.2.2.2 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.2.2.1 12-Dec-2000  bouyer file linux_file64.c was added on branch thorpej_scsipi on 2000-12-13 15:49:49 +0000
 1.15.2.1 30-May-2002  gehenna Catch up with -current.
 1.18.2.2 14-Jun-2004  jmc Pullup patch (requested by skrll in ticket #1708)

Bring netbsd-1-6 inline with -current sources after the mistakes in ticket #1686
 1.18.2.1 11-May-2004  tron Pull up revision 1.22 via patch (requested by wennmach in ticket #1686):
add Linux compat arg wrapper for ftruncate64(), and change linux compat
truncate64() wrapper to translate args structure
NetBSD truncate() and ftrucate() have hidden 'pad' argument, so we have
to do the argument translation
Problem found and patch supplied in PR kern/22360 by Ales Krenek
This is the last of syscalls with hidden 'pad' arg we didn't have
wrapper for; all the others (lseek, mmap, pwrite, pread) already had
wrapper before.
 1.21.2.7 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.21.2.6 01-Apr-2005  skrll Sync with HEAD.
 1.21.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.21.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.21.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.21.2.2 03-Aug-2004  skrll Sync with HEAD
 1.21.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.23.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.23.4.1 29-Apr-2005  kent sync with -current
 1.25.2.1 01-Oct-2005  tron Pull up following revision(s) (requested by christos in ticket #838):
sys/compat/svr4/svr4_misc.c: revision 1.112
sys/compat/ibcs2/ibcs2_misc.c: revision 1.74
sys/compat/linux/common/linux_misc.c: revision 1.136
sys/compat/irix/irix_dirent.c: revision 1.14
sys/compat/sunos/sunos_misc.c: revision 1.132
sys/compat/svr4_32/svr4_32_misc.c: revision 1.31
sys/compat/sunos32/sunos32_misc.c: revision 1.30
sys/compat/linux/common/linux_file64.c: revision 1.26
PR/29696: Joel Carnat: NetBSD freezes when accessing smbfs mounted FS with
firefox/linux due to compat getdents() call assumption that all filesystems
support cookies.
 1.28.2.9 24-Mar-2008  yamt sync with head.
 1.28.2.8 04-Feb-2008  yamt sync with head.
 1.28.2.7 21-Jan-2008  yamt sync with head
 1.28.2.6 07-Dec-2007  yamt sync with head
 1.28.2.5 27-Oct-2007  yamt sync with head.
 1.28.2.4 03-Sep-2007  yamt sync with head.
 1.28.2.3 26-Feb-2007  yamt sync with head.
 1.28.2.2 30-Dec-2006  yamt sync with head.
 1.28.2.1 21-Jun-2006  yamt sync with head.
 1.30.6.2 01-Jun-2006  kardel Sync with head.
 1.30.6.1 22-Apr-2006  simonb Sync with head.
 1.30.4.1 09-Sep-2006  rpaulo sync with head
 1.30.2.2 18-Feb-2006  yamt sync with head.
 1.30.2.1 31-Dec-2005  yamt adapt some random parts of kernel to uio_vmspace.
 1.32.6.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.32.4.1 08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.32.2.3 11-Aug-2006  yamt revert code which was mistakenly slipped in with 1.32.2.1.
 1.32.2.2 11-Aug-2006  yamt sync with head
 1.32.2.1 24-May-2006  yamt sync with head.
 1.34.8.1 12-Jun-2010  riz Pull up following revision(s) (requested by he in ticket #1387):
sys/compat/svr4/svr4_misc.c: revision 1.149
sys/compat/linux/common/linux_misc.c: revision 1.214
sys/compat/common/vfs_syscalls_30.c: revision 1.31
sys/compat/sunos/sunos_misc.c: revision 1.166
sys/compat/linux/common/linux_file64.c: revision 1.50
sys/compat/svr4_32/svr4_32_misc.c: revision 1.68
sys/compat/ibcs2/ibcs2_misc.c: revision 1.110
sys/compat/linux32/common/linux32_dirent.c: revision 1.10
sys/compat/sunos32/sunos32_misc.c: revision 1.69
sys/compat/irix/irix_dirent.c: revision 1.24
sys/compat/osf1/osf1_file.c: revision 1.38
When implementing "read directory", when there are too many empty entries
in a row, and we need to try to read the next block, and have passed a
non-NULL cookie pointer to VOP_READDIR, ensure that we free the cookie
buffer before re-doing VOP_READDIR, so that we don't leak memory.
This fix is similar to nfs_serv.c revisions 1.115 + 1.124.
This should fix the long-standing problem observed by e.g. using Linux-
emulated programs to take backup of servers, which is one of the problems
which were reported in PR#42661.
Thanks to pooka@ for the hints for traversing the VOP* layer.
 1.34.4.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.35.2.3 17-May-2007  yamt sync with head.
 1.35.2.2 07-May-2007  yamt sync with head.
 1.35.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.36.2.2 27-May-2007  ad Sync with head.
 1.36.2.1 13-Mar-2007  ad Sync with head.
 1.37.2.1 11-Jul-2007  mjf Sync with head.
 1.39.12.1 25-Oct-2007  bouyer Sync with HEAD.
 1.39.8.3 23-Mar-2008  matt sync with HEAD
 1.39.8.2 09-Jan-2008  matt sync with HEAD
 1.39.8.1 06-Nov-2007  matt sync with HEAD
 1.39.6.3 09-Dec-2007  jmcneill Sync with HEAD.
 1.39.6.2 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.39.6.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.40.2.3 18-Feb-2008  mjf Sync with HEAD.
 1.40.2.2 27-Dec-2007  mjf Sync with HEAD.
 1.40.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.41.2.2 26-Dec-2007  ad Sync with head.
 1.41.2.1 08-Dec-2007  ad Sync with head.
 1.43.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.45.6.3 29-Jun-2008  mjf Sync with HEAD.
 1.45.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.45.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.46.4.5 11-Aug-2010  yamt sync with head.
 1.46.4.4 11-Mar-2010  yamt sync with head
 1.46.4.3 16-May-2009  yamt sync with head
 1.46.4.2 04-May-2009  yamt sync with head.
 1.46.4.1 16-May-2008  yamt sync with head.
 1.46.2.1 18-May-2008  yamt sync with head.
 1.47.4.1 27-Jun-2008  simonb Sync with head.
 1.47.2.3 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.47.2.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.47.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.48.14.1 21-Apr-2010  matt sync to netbsd-5
 1.48.10.1 23-Jul-2009  jym Sync with HEAD.
 1.48.6.1 17-Mar-2010  snj Pull up following revision(s) (requested by he in ticket #1323):
sys/compat/common/vfs_syscalls_30.c: revision 1.31
sys/compat/ibcs2/ibcs2_misc.c: revision 1.110
sys/compat/irix/irix_dirent.c: revision 1.24
sys/compat/linux/common/linux_file64.c: revision 1.50
sys/compat/linux/common/linux_misc.c: revision 1.214
sys/compat/linux32/common/linux32_dirent.c: revision 1.10
sys/compat/sunos/sunos_misc.c: revision 1.166
sys/compat/sunos32/sunos32_misc.c: revision 1.69
sys/compat/svr4/svr4_misc.c: revision 1.149
sys/compat/svr4_32/svr4_32_misc.c: revision 1.68
When implementing "read directory", when there are too many empty entries
in a row, and we need to try to read the next block, and have passed a
non-NULL cookie pointer to VOP_READDIR, ensure that we free the cookie
buffer before re-doing VOP_READDIR, so that we don't leak memory.
This fix is similar to nfs_serv.c revisions 1.115 + 1.124.
This should fix the long-standing problem observed by e.g. using Linux-
emulated programs to take backup of servers, which is one of the problems
which were reported in PR#42661.
Thanks to pooka@ for the hints for traversing the VOP* layer.
 1.49.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.49.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.50.2.1 03-Jul-2010  rmind sync with head
 1.53.22.1 19-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1483):
sys/compat/common/vfs_syscalls_12.c: revision 1.34
sys/compat/svr4_32/svr4_32_misc.c: revision 1.78
sys/compat/sunos32/sunos32_misc.c: revision 1.78
sys/compat/linux/common/linux_misc.c: revision 1.239
sys/compat/osf1/osf1_file.c: revision 1.44
sys/compat/common/vfs_syscalls_43.c: revision 1.60
sys/compat/svr4/svr4_misc.c: revision 1.158
sys/compat/ibcs2/ibcs2_misc.c: revision 1.114
sys/compat/linux/common/linux_file64.c: revision 1.59
sys/compat/linux32/common/linux32_dirent.c: revision 1.18
sys/compat/sunos/sunos_misc.c: revision 1.171
Fail, don't panic, on bad dirents from file system.
Controllable via puffs from userland.
From Ilja Van Sprundel.
 1.53.16.1 18-May-2014  rmind sync with head
 1.53.14.1 19-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1483):
sys/compat/common/vfs_syscalls_12.c: revision 1.34
sys/compat/svr4_32/svr4_32_misc.c: revision 1.78
sys/compat/sunos32/sunos32_misc.c: revision 1.78
sys/compat/linux/common/linux_misc.c: revision 1.239
sys/compat/osf1/osf1_file.c: revision 1.44
sys/compat/common/vfs_syscalls_43.c: revision 1.60
sys/compat/svr4/svr4_misc.c: revision 1.158
sys/compat/ibcs2/ibcs2_misc.c: revision 1.114
sys/compat/linux/common/linux_file64.c: revision 1.59
sys/compat/linux32/common/linux32_dirent.c: revision 1.18
sys/compat/sunos/sunos_misc.c: revision 1.171
Fail, don't panic, on bad dirents from file system.
Controllable via puffs from userland.
From Ilja Van Sprundel.
 1.53.12.2 03-Dec-2017  jdolecek update from HEAD
 1.53.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.53.8.1 19-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1483):
sys/compat/common/vfs_syscalls_12.c: revision 1.34
sys/compat/svr4_32/svr4_32_misc.c: revision 1.78
sys/compat/sunos32/sunos32_misc.c: revision 1.78
sys/compat/linux/common/linux_misc.c: revision 1.239
sys/compat/osf1/osf1_file.c: revision 1.44
sys/compat/common/vfs_syscalls_43.c: revision 1.60
sys/compat/svr4/svr4_misc.c: revision 1.158
sys/compat/ibcs2/ibcs2_misc.c: revision 1.114
sys/compat/linux/common/linux_file64.c: revision 1.59
sys/compat/linux32/common/linux32_dirent.c: revision 1.18
sys/compat/sunos/sunos_misc.c: revision 1.171
Fail, don't panic, on bad dirents from file system.
Controllable via puffs from userland.
From Ilja Van Sprundel.
 1.53.2.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.55.14.2 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1720:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149 (patch)
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54 (patch)

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.55.14.1 12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1479):
sys/compat/common/vfs_syscalls_12.c: revision 1.34
sys/rump/kern/lib/libsys_sunos/rump_sunos_compat.c: revision 1.2
sys/compat/svr4_32/svr4_32_misc.c: revision 1.78
sys/compat/sunos32/sunos32_misc.c: revision 1.78
sys/compat/linux/common/linux_misc.c: revision 1.239
sys/compat/osf1/osf1_file.c: revision 1.44
sys/compat/common/vfs_syscalls_43.c: revision 1.60
sys/compat/svr4/svr4_misc.c: revision 1.158
sys/compat/ibcs2/ibcs2_misc.c: revision 1.114
sys/compat/linux/common/linux_file64.c: revision 1.59
sys/compat/linux32/common/linux32_dirent.c: revision 1.18
sys/compat/sunos/sunos_misc.c: revision 1.171
Fail, don't panic, on bad dirents from file system.
Controllable via puffs from userland.
From Ilja Van Sprundel.
 1.55.10.1 20-Mar-2017  pgoyette Sync with HEAD
 1.55.8.1 12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1479):
sys/compat/common/vfs_syscalls_12.c: revision 1.34
sys/rump/kern/lib/libsys_sunos/rump_sunos_compat.c: revision 1.2
sys/compat/svr4_32/svr4_32_misc.c: revision 1.78
sys/compat/sunos32/sunos32_misc.c: revision 1.78
sys/compat/linux/common/linux_misc.c: revision 1.239
sys/compat/osf1/osf1_file.c: revision 1.44
sys/compat/common/vfs_syscalls_43.c: revision 1.60
sys/compat/svr4/svr4_misc.c: revision 1.158
sys/compat/ibcs2/ibcs2_misc.c: revision 1.114
sys/compat/linux/common/linux_file64.c: revision 1.59
sys/compat/linux32/common/linux32_dirent.c: revision 1.18
sys/compat/sunos/sunos_misc.c: revision 1.171
Fail, don't panic, on bad dirents from file system.
Controllable via puffs from userland.
From Ilja Van Sprundel.
 1.55.6.2 28-Aug-2017  skrll Sync with HEAD
 1.55.6.1 05-Feb-2017  skrll Sync with HEAD
 1.55.4.2 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1720:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149 (patch)
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54 (patch)

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.55.4.1 12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1479):
sys/compat/common/vfs_syscalls_12.c: revision 1.34
sys/rump/kern/lib/libsys_sunos/rump_sunos_compat.c: revision 1.2
sys/compat/svr4_32/svr4_32_misc.c: revision 1.78
sys/compat/sunos32/sunos32_misc.c: revision 1.78
sys/compat/linux/common/linux_misc.c: revision 1.239
sys/compat/osf1/osf1_file.c: revision 1.44
sys/compat/common/vfs_syscalls_43.c: revision 1.60
sys/compat/svr4/svr4_misc.c: revision 1.158
sys/compat/ibcs2/ibcs2_misc.c: revision 1.114
sys/compat/linux/common/linux_file64.c: revision 1.59
sys/compat/linux32/common/linux32_dirent.c: revision 1.18
sys/compat/sunos/sunos_misc.c: revision 1.171
Fail, don't panic, on bad dirents from file system.
Controllable via puffs from userland.
From Ilja Van Sprundel.
 1.57.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.58.6.2 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1487:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.58.6.1 09-Aug-2017  snj Pull up following revision(s) (requested by spz in ticket #193):
sys/compat/common/vfs_syscalls_12.c: revision 1.34
sys/rump/kern/lib/libsys_sunos/rump_sunos_compat.c: revision 1.2
sys/compat/svr4_32/svr4_32_misc.c: revision 1.78
sys/compat/sunos32/sunos32_misc.c: revision 1.78
sys/compat/linux/common/linux_misc.c: revision 1.239
sys/compat/osf1/osf1_file.c: revision 1.44
sys/compat/common/vfs_syscalls_43.c: revision 1.60
sys/compat/svr4/svr4_misc.c: revision 1.158
sys/compat/ibcs2/ibcs2_misc.c: revision 1.114
sys/compat/linux/common/linux_file64.c: revision 1.59
sys/compat/linux32/common/linux32_dirent.c: revision 1.18
sys/compat/sunos/sunos_misc.c: revision 1.171
Fail, don't panic, on bad dirents from file system.
Controllable via puffs from userland.
From Ilja Van Sprundel.
 1.59.4.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.59.4.1 10-Jun-2019  christos Sync with HEAD
 1.59.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.60.4.1 13-Sep-2019  martin Pull up following revision(s) (requested by maxv in ticket #194):

sys/compat/linux/common/linux_socket.c: revision 1.146
sys/compat/linux/common/linux_socket.c: revision 1.147
sys/compat/linux/common/linux_socket.c: revision 1.148
sys/compat/linux/common/linux_socket.c: revision 1.149
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.59
sys/compat/linux32/common/linux32_sysinfo.c: revision 1.8
sys/kern/sysv_shm.c: revision 1.138
sys/compat/linux/common/linux_file64.c: revision 1.61
sys/compat/linux/common/linux_file64.c: revision 1.62
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.58
sys/compat/linux32/common/linux32_dirent.c: revision 1.20
sys/compat/linux32/common/linux32_utsname.c: revision 1.10
sys/compat/linux/common/linux_termios.h: revision 1.22
sys/compat/linux32/common/linux32_termios.c: revision 1.15
sys/compat/linux32/common/linux32_misc.c: revision 1.27
sys/compat/linux32/common/linux32_ioctl.c: revision 1.14
sys/compat/linux/common/linux_statfs.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.57
sys/compat/linux/common/linux_fcntl.h: revision 1.18
sys/compat/linux/common/linux_socket.h: revision 1.24
sys/sys/shm.h: revision 1.54
sys/compat/ossaudio/ossaudio.c: revision 1.75
sys/compat/linux32/common/linux32_signal.c: revision 1.20
sys/miscfs/procfs/procfs_linux.c: revision 1.75
sys/compat/linux/common/linux_signal.c: revision 1.81
sys/compat/linux/common/linux_termios.c: revision 1.38
sys/compat/linux/common/linux_misc.c: revision 1.241
sys/compat/linux/common/linux_misc.c: revision 1.242
sys/compat/linux/common/linux_misc.c: revision 1.243
sys/compat/linux/common/linux_misc.c: revision 1.244

Fix info leaks.

Fix stupid bugs in linux_sys_shmctl(): the index could be out of bound
(page fault) and there was no proper locking.
Maybe we should just remove LINUX_SHM_STAT, like compat_linux32.

Remove printf.

When dealing with an unknown value, set -1, to prevent (harmless)
uninitialized accesses later.

Add a default case, don't call sys_ioctl() with an uninitialized 'com'
argument.

Fix error handling, returns an errno, not -1.

Put the printf under DEBUG_LINUX.


Hum, don't forget the 'pid' argument, otherwise we're not gonna go very
far.

Don't read data from userland directly. This simply does not work on any
recent x86 CPU (thanks to SMAP) and all architectures that forbid direct
access to userland from the kernel. But I guess no one noticed because no
one ever uses compat_linux, right?

Hum, don't pass an mbuf to realloc(). Inspired from copyin32_msg_control().

Fix memory leak.

I don't see the point in having this useless printf, but add a '\n' to it,
so that it at least displays useless stuff correctly.

Hum, remove incorrect assignment. Userland could have passed a smaller
namelen, and the uninitialized bytes from sb_data were being used later in
the network stack.
 1.41 03-May-2020  thorpej Always clear FUTEX_PRIVATE_FLAG for Linux processes. NetBSD-native futexes
exist in different namespace depending on FUTEX_PRIVATE_FLAG. This appears
not to be the case in Linux, and some futex users will mix private and non-
private ops on the same futex object. Provide a convenience wrapper that
puts this logic in one place witn a comment explaining why.

While here, move the Linux futex wrapper out of its own file and plop
it in linux_misc.c, which is where it lives in the linux32 module.
 1.40 29-Apr-2020  thorpej Oops, fix a silly mistake in the Linux futex syscall stubs -- we also
copy in the timeout for FUTEX_WAIT_BITSET.
 1.39 26-Apr-2020  thorpej Add a NetBSD native futex implementation, mostly written by riastradh@.
Map the COMPAT_LINUX futex calls to the native ones.
 1.38 14-Mar-2020  ad - Hide the details of SPCF_SHOULDYIELD and related behind a couple of small
functions: preempt_point() and preempt_needed().

- preempt(): if the LWP has exceeded its timeslice in kernel, strip it of
any priority boost gained earlier from blocking.
 1.37 10-Apr-2017  dholland branches: 1.37.14;
Return value pointers should be the last argument.
 1.36 09-Apr-2017  dholland speed limit 80
 1.35 15-Aug-2016  maxv branches: 1.35.2;
Uninitialized var, found by brainy; not tested, but obvious enough
 1.34 20-May-2016  chs branches: 1.34.2;
simplify and fix futex requeuing:
don't wake up all the threads being requeued to have them move themselves
from one list to another (thus defeating the purpose), just change the lists
directly in futex_wake().
 1.33 11-Feb-2014  maxv branches: 1.33.6;
Fix uninitialized variable. Harmless: it does not change the behavior
at all.

ok rmind@ christos@
 1.32 17-Oct-2013  christos remove unused variable
 1.31 18-Jul-2013  njoly Do not make FUTEX_WAIT wait indefinitely for an invalid timeout
(tv_nsec = -1).
 1.30 17-Apr-2013  christos branches: 1.30.4; 1.30.6;
handle timeouts like before.
 1.29 16-Apr-2013  christos Add some more futex gunk and explain why it does not work (yet).
Now skype aborts with a futex timeout, instead of a stack smash leading
to a SEGV.
 1.28 18-Nov-2011  christos branches: 1.28.10;
- add sigtimedwait support.
- merge the siginfo population code.
 1.27 14-Sep-2011  christos branches: 1.27.2;
Can't use RUN_ONCE here to initialize the futex_lock, otherwise we cannot
unload the module.
 1.26 07-Jul-2010  chs many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
- support new-style (NPTL) linux pthreads on all platforms.
clone() with CLONE_THREAD uses 1 process with many LWPs
instead of separate processes.
- move the contents of sys__lwp_setprivate() into a new
lwp_setprivate() and use that everywhere.
- update linux_release[] and linux32_release[] to "2.6.18".
- adjust placement of emul fork/exec/exit hooks as needed
and adjust other emul code to match.
- convert all struct emul definitions to use named initializers.
- change the pid allocator to allow multiple pids to refer to the same proc.
- remove a few fields from struct proc that are no longer needed.
- disable the non-functional "vdso" code in linux32/amd64,
glibc works fine without it.
- fix a race in the futex code where we could miss a wakeup after
a requeue operation.
- redo futex locking to be a little more efficient.
 1.25 01-Jul-2010  rmind Remove pfind() and pgfind(), fix locking in various broken uses of these.
Rename real routines to proc_find() and pgrp_find(), remove PFIND_* flags
and have consistent behaviour. Provide proc_find_raw() for special cases.
Fix memory leak in sysctl_proc_corename().

COMPAT_LINUX: rework ptrace() locking, minimise differences between
different versions per-arch.

Note: while this change adds some formal cosmetics for COMPAT_DARWIN and
COMPAT_IRIX - locking there is utterly broken (for ages).

Fixes PR/43176.
 1.24 14-Mar-2009  christos branches: 1.24.2; 1.24.4;
fix robust_list pointer mess!
 1.23 23-Feb-2009  rmind Switch Linux futex emulation to native ucas_int(), remove unecessary
futex-specific assembler routines.

Fixes PR/40490. Reviewed by <ad>.
 1.22 08-Jan-2009  njoly branches: 1.22.2;
Restore expected FUTEX_WAIT behaviour with NULL timeout argument,
which was broken in my recent timespec cleanup/fix.
 1.21 23-Nov-2008  mrg initialise a variable to avoid a GCC warning.
 1.20 19-Nov-2008  njoly futex(2) timeout argument cleanup/fix.
- Use `struct linux_timespec', converted to native structure.
- Ensure that provided values are correct.
- Replace timeval+tvtohz by tstohz.
 1.19 18-Nov-2008  njoly noisy printf.
 1.18 26-Oct-2008  jmcneill branches: 1.18.2; 1.18.4;
linux_sys_get_robust_list: copyout the entire struct, not the size of the
pointer to it.
 1.17 26-Oct-2008  christos futex support fixes from FreeBSD via cube+pengo.
 1.16 20-Jun-2008  njoly branches: 1.16.2;
Do not return 0 for unsupported/unknown futex operations, but ENOSYS
instead. From Roman Divacky in private email.
 1.15 20-Jun-2008  njoly Fix futex locking. Move all locking to linux_sys_futex function, and
KASSERT that futex_{get,put,sleep,wake} are now called with lock held.
 1.14 05-Jun-2008  njoly branches: 1.14.2;
Add missing cv_destroy in futex_sleep.
 1.13 30-Apr-2008  ad branches: 1.13.2;
Make various bits of debug code compile again.
 1.12 24-Apr-2008  ad branches: 1.12.2;
Network protocol interrupts can now block on locks, so merge the globals
proclist_mutex and proclist_lock into a single adaptive mutex (proc_lock).
Implications:

- Inspecting process state requires thread context, so signals can no longer
be sent from a hardware interrupt handler. Signal activity must be
deferred to a soft interrupt or kthread.

- As the proc state locking is simplified, it's now safe to take exit()
and wait() out from under kernel_lock.

- The system spends less time at IPL_SCHED, and there is less lock activity.
 1.11 23-Apr-2008  ad Fix locking.
 1.10 20-Dec-2007  dsl branches: 1.10.6; 1.10.8;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.9 04-Nov-2007  rmind branches: 1.9.4; 1.9.8;
- Replace lockmgr with mutex;
- Use condvars instead of tsleep/wakeup;
- Replace malloc with kmem;
- Use itimespecfix/tstohz;

Reviewed by <ad>.
 1.8 19-Oct-2007  njoly Add compat_linux and exec_linux_elf lkm support for amd64:
- Add needed COMPAT_OSSAUDIO to GENERIC.
- Add missing includes needed by linux_syscallargs.h.
- Add lkm building.
 1.7 24-Jul-2006  manu branches: 1.7.28; 1.7.30; 1.7.34;
typo
 1.6 09-Jul-2006  manu If the user process requests a non null timeout, make sure we do not turn
it into an infinite timeout because of a conversion
 1.5 23-Nov-2005  manu branches: 1.5.4; 1.5.8; 1.5.16; 1.5.18;
- Add Linux tkill and tgkill (partial emulation).
- Fix getrlimit on amd64
 1.4 09-Nov-2005  manu branches: 1.4.2; 1.4.4;
Prevent integer overflow in timout calculation.
changed DEBUG_LINUX to DEBUG_LINUX_FUTEX so that we have less debug
messages on the console
 1.3 08-Nov-2005  manu Correctly computes futex timeout.
 1.2 05-Nov-2005  manu Implement more of Linux futex(2)
 1.1 04-Nov-2005  manu Implement Linux futex ang gettid
 1.4.4.1 29-Nov-2005  yamt sync with head.
 1.4.2.3 11-Dec-2005  christos Sync with head.
 1.4.2.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.4.2.1 09-Nov-2005  skrll file linux_futex.c was added on branch ktrace-lwp on 2005-11-10 14:01:07 +0000
 1.5.18.6 21-Jan-2008  yamt sync with head
 1.5.18.5 15-Nov-2007  yamt sync with head.
 1.5.18.4 27-Oct-2007  yamt sync with head.
 1.5.18.3 30-Dec-2006  yamt sync with head.
 1.5.18.2 21-Jun-2006  yamt sync with head.
 1.5.18.1 23-Nov-2005  yamt file linux_futex.c was added on branch yamt-lazymbuf on 2006-06-21 14:59:12 +0000
 1.5.16.1 13-Jul-2006  gdamore Merge from HEAD.
 1.5.8.1 11-Aug-2006  yamt sync with head
 1.5.4.1 09-Sep-2006  rpaulo sync with head
 1.7.34.2 13-Nov-2007  bouyer Sync with HEAD
 1.7.34.1 25-Oct-2007  bouyer Sync with HEAD.
 1.7.30.2 09-Jan-2008  matt sync with HEAD
 1.7.30.1 06-Nov-2007  matt sync with HEAD
 1.7.28.2 04-Nov-2007  jmcneill Sync with HEAD.
 1.7.28.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.9.8.1 02-Jan-2008  bouyer Sync with HEAD
 1.9.4.1 26-Dec-2007  ad Sync with head.
 1.10.8.2 17-Jun-2008  yamt sync with head.
 1.10.8.1 18-May-2008  yamt sync with head.
 1.10.6.4 17-Jan-2009  mjf Sync with HEAD.
 1.10.6.3 29-Jun-2008  mjf Sync with HEAD.
 1.10.6.2 05-Jun-2008  mjf Sync with HEAD.

Also fix build.
 1.10.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.12.2.3 11-Aug-2010  yamt sync with head.
 1.12.2.2 04-May-2009  yamt sync with head.
 1.12.2.1 16-May-2008  yamt sync with head.
 1.13.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.14.2.1 27-Jun-2008  simonb Sync with head.
 1.16.2.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.18.4.2 16-Mar-2009  snj Pull up following revision(s) (requested by adrianp in ticket #582):
sys/compat/linux/common/linux_futex.c: revision 1.24 via patch
fix robust_list pointer mess!
 1.18.4.1 26-Feb-2009  snj Pull up following revision(s) (requested by rmind in ticket #493):
sys/compat/linux/arch/amd64/files.linux_amd64: revision 1.4
sys/compat/linux/arch/amd64/linux_support.S: file removal
sys/compat/linux/common/linux_futex.c: revision 1.23
sys/compat/linux/arch/i386/linux_support.S: file removal
sys/compat/linux/arch/i386/files.linux_i386: revision 1.10
Switch Linux futex emulation to native ucas_int(), remove unecessary
futex-specific assembler routines.
Fixes PR/40490. Reviewed by <ad>.
 1.18.2.3 28-Apr-2009  skrll Sync with HEAD.
 1.18.2.2 03-Mar-2009  skrll Sync with HEAD.
 1.18.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.22.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.24.4.2 05-Mar-2011  rmind sync with head
 1.24.4.1 03-Jul-2010  rmind sync with head
 1.24.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.27.2.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.27.2.1 17-Apr-2012  yamt sync with head
 1.28.10.3 03-Dec-2017  jdolecek update from HEAD
 1.28.10.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.28.10.1 23-Jun-2013  tls resync from head
 1.30.6.1 23-Jul-2013  riastradh sync with HEAD
 1.30.4.2 18-May-2014  rmind sync with head
 1.30.4.1 28-Aug-2013  rmind sync with head
 1.33.6.3 28-Aug-2017  skrll Sync with HEAD
 1.33.6.2 05-Oct-2016  skrll Sync with HEAD
 1.33.6.1 29-May-2016  skrll Sync with HEAD
 1.34.2.1 26-Apr-2017  pgoyette Sync with HEAD
 1.35.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.37.14.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.9 26-Apr-2020  thorpej Add a NetBSD native futex implementation, mostly written by riastradh@.
Map the COMPAT_LINUX futex calls to the native ones.
 1.8 10-Apr-2017  dholland Return value pointers should be the last argument.
 1.7 16-Apr-2013  christos branches: 1.7.12; 1.7.16; 1.7.20;
Add some more futex gunk and explain why it does not work (yet).
Now skype aborts with a futex timeout, instead of a stack smash leading
to a SEGV.
 1.6 11-Jan-2013  christos add the futex PI commands (not implemented yet)
PI = Priotity Inheritance
 1.5 14-Sep-2011  christos branches: 1.5.2; 1.5.12;
Can't use RUN_ONCE here to initialize the futex_lock, otherwise we cannot
unload the module.
 1.4 07-Jul-2010  chs many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
- support new-style (NPTL) linux pthreads on all platforms.
clone() with CLONE_THREAD uses 1 process with many LWPs
instead of separate processes.
- move the contents of sys__lwp_setprivate() into a new
lwp_setprivate() and use that everywhere.
- update linux_release[] and linux32_release[] to "2.6.18".
- adjust placement of emul fork/exec/exit hooks as needed
and adjust other emul code to match.
- convert all struct emul definitions to use named initializers.
- change the pid allocator to allow multiple pids to refer to the same proc.
- remove a few fields from struct proc that are no longer needed.
- disable the non-functional "vdso" code in linux32/amd64,
glibc works fine without it.
- fix a race in the futex code where we could miss a wakeup after
a requeue operation.
- redo futex locking to be a little more efficient.
 1.3 26-Oct-2008  christos branches: 1.3.14; 1.3.16;
futex support fixes from FreeBSD via cube+pengo.
 1.2 11-Dec-2005  christos branches: 1.2.18; 1.2.72; 1.2.76; 1.2.82;
merge ktrace-lwp.
 1.1 04-Nov-2005  manu branches: 1.1.2;
Implement Linux futex ang gettid
 1.1.2.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.2.1 04-Nov-2005  skrll file linux_futex.h was added on branch ktrace-lwp on 2005-11-10 14:01:07 +0000
 1.2.82.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.2.76.2 11-Aug-2010  yamt sync with head.
 1.2.76.1 04-May-2009  yamt sync with head.
 1.2.72.1 17-Jan-2009  mjf Sync with HEAD.
 1.2.18.2 21-Jun-2006  yamt sync with head.
 1.2.18.1 11-Dec-2005  yamt file linux_futex.h was added on branch yamt-lazymbuf on 2006-06-21 14:59:12 +0000
 1.3.16.1 05-Mar-2011  rmind sync with head
 1.3.14.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.5.12.3 03-Dec-2017  jdolecek update from HEAD
 1.5.12.2 23-Jun-2013  tls resync from head
 1.5.12.1 25-Feb-2013  tls resync with head
 1.5.2.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.5.2.1 23-Jan-2013  yamt sync with head
 1.7.20.1 21-Apr-2017  bouyer Sync with HEAD
 1.7.16.1 26-Apr-2017  pgoyette Sync with HEAD
 1.7.12.1 28-Aug-2017  skrll Sync with HEAD
 1.19 07-Sep-2021  riastradh sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.18 03-Feb-2019  mrg branches: 1.18.4;
- add or adjust /* FALLTHROUGH */ where appropriate
- add __unreachable() after functions that can return but won't in
this case, and thus can't be marked __dead easily
 1.17 08-Dec-2015  christos branches: 1.17.10; 1.17.18;
Replace DIOCGPART -> DIOCGPARTINFO which returns the data needed instead of
pointers.
 1.16 21-Mar-2008  ad branches: 1.16.6; 1.16.48; 1.16.68;
Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
 1.15 20-Dec-2007  dsl branches: 1.15.6;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.14 19-Oct-2007  njoly branches: 1.14.4; 1.14.8;
Add compat_linux and exec_linux_elf lkm support for amd64:
- Add needed COMPAT_OSSAUDIO to GENERIC.
- Add missing includes needed by linux_syscallargs.h.
- Add lkm building.
 1.13 01-Jul-2007  dsl branches: 1.13.6; 1.13.8; 1.13.12;
Fix LINUX_HDIO_GET_IDENTITY so that it returns the entire 512 byte buffer.
Rely on the code in dev/ata/wd.c doing a relay for the short read needed
for LINUX_HDIO_OBSOLETE_IDENTITY.
 1.12 04-Mar-2007  christos branches: 1.12.2; 1.12.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.11 09-Feb-2007  ad branches: 1.11.2;
Merge newlock2 to head.
 1.10 11-Dec-2005  christos branches: 1.10.20;
merge ktrace-lwp.
 1.9 28-Feb-2005  soren branches: 1.9.4;
Remove duplicate statement.
 1.8 29-Jun-2003  fvdl branches: 1.8.2; 1.8.10; 1.8.12;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.7 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.6 21-Mar-2003  dsl Change 'data' argument to fo_ioctl and fo_fcntl from 'caddr_t' to 'void *'.
Avoids a lot of casting and removes the need for some line breaks.
Removed a load of (caddr_t) casts from calls to copyin/copyout as well.
(approved by christos - he has a plan to remove caddr_t...)
 1.5 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.4 16-Mar-2002  christos make the stackgap_{init,alloc} functions MP friendly (i.e. pass struct proc *
in, instead of using curproc). While there add an optional size argument to
stackgap_init.
 1.3 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.2 14-Jun-2001  thorpej branches: 1.2.2;
Fix a partial construction problem that can cause race conditions
between creation of a file descriptor and close(2) when using kernel
assisted threads. What we do is stick descriptors in the table, but
mark them as "larval". This causes essentially everything to treat
it as a non-existent descriptor, except for fdalloc(), which sees a
filled slot so that it won't (incorrectly) allocate it again. When
a descriptor is fully constructed, the code that has constructed it
marks it as "mature" (which actually clears the "larval" flag), and
things continue to work as normal.

While here, gather all the code that gets a descriptor from the table
into a fd_getfile() function, and call it, rather than having the
same (sometimes incorrect) code copied all over the place.
 1.1 10-Dec-2000  fvdl branches: 1.1.2; 1.1.4; 1.1.6;
Add some ioctls for harddisk, floppy disk and console handling.
Implement a few extra cdrom ioctl calls.
Make sure to correctly use FILE_USE and FILE_UNUSE.
 1.1.6.2 30-Mar-2001  he Pull up revision 1.1 (new, requested by fvdl):
Add some required Linux emulation bits to support the Linux
version of VMware.
 1.1.6.1 10-Dec-2000  he file linux_hdio.c was added on branch netbsd-1-5 on 2001-03-30 21:39:59 +0000
 1.1.4.6 08-Jul-2002  nathanw Revert a change (looked like a typo fix!) for the LINUX_HDIO_GETGEO
ioctl.
 1.1.4.5 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.1.4.4 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.1.4.3 14-Nov-2001  nathanw Catch up to -current.
 1.1.4.2 24-Aug-2001  nathanw A few files and lwp/proc conversions I missed in the last big update.
GENERIC runs again.
 1.1.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.1.2.2 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.1.2.1 10-Dec-2000  bouyer file linux_hdio.c was added on branch thorpej_scsipi on 2000-12-13 15:49:49 +0000
 1.2.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.2.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.8.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.8.10.1 29-Apr-2005  kent sync with -current
 1.8.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.8.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.8.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.8.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.9.4.6 24-Mar-2008  yamt sync with head.
 1.9.4.5 21-Jan-2008  yamt sync with head
 1.9.4.4 27-Oct-2007  yamt sync with head.
 1.9.4.3 03-Sep-2007  yamt sync with head.
 1.9.4.2 26-Feb-2007  yamt sync with head.
 1.9.4.1 21-Jun-2006  yamt sync with head.
 1.10.20.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.11.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.12.4.1 11-Jul-2007  mjf Sync with head.
 1.12.2.1 15-Jul-2007  ad Sync with head.
 1.13.12.1 25-Oct-2007  bouyer Sync with HEAD.
 1.13.8.2 09-Jan-2008  matt sync with HEAD
 1.13.8.1 06-Nov-2007  matt sync with HEAD
 1.13.6.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.14.8.1 02-Jan-2008  bouyer Sync with HEAD
 1.14.4.1 26-Dec-2007  ad Sync with head.
 1.15.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.16.68.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.16.48.1 03-Dec-2017  jdolecek update from HEAD
 1.16.6.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.16.6.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.17.18.1 10-Jun-2019  christos Sync with HEAD
 1.17.10.1 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1836):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.18.4.1 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.1 10-Dec-2000  fvdl branches: 1.1.2; 1.1.6;
Add some ioctls for harddisk, floppy disk and console handling.
Implement a few extra cdrom ioctl calls.
Make sure to correctly use FILE_USE and FILE_UNUSE.
 1.1.6.2 30-Mar-2001  he Pull up revision 1.1 (new, requested by fvdl):
Add some required Linux emulation bits to support the Linux
version of VMware.
 1.1.6.1 10-Dec-2000  he file linux_hdio.h was added on branch netbsd-1-5 on 2001-03-30 21:39:59 +0000
 1.1.2.2 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.1.2.1 10-Dec-2000  bouyer file linux_hdio.h was added on branch thorpej_scsipi on 2000-12-13 15:49:50 +0000
 1.8 27-Jun-2025  andvar Grammar and spelling fixes, mainly in comments. A few in documentation,
logging, test description, and SCSI ASC/ASCQ assignment descriptions.
 1.7 01-Oct-2024  riastradh sys/compat/linux/common: Nix trailing whitespace, and one blank line.

No functional change intended.
 1.6 09-Feb-2024  andvar branches: 1.6.2;
fix spelling mistakes, mainly in comments and log messages.
 1.5 24-Aug-2023  christos fix a locking bug (Theodore Preduta)
 1.4 23-Aug-2023  christos put variable length structure at the end, so that clang does not complain.
 1.3 22-Aug-2023  christos aarch64 does not have sys_inotify_init()...
 1.2 20-Aug-2023  christos fix locking: eliminate using mutex_owned() (Theodore Preduta)
 1.1 19-Aug-2023  christos new inotify support GSoC 2023 (Theodore Preduta)
 1.6.2.1 02-Aug-2025  perseant Sync with HEAD
 1.1 19-Aug-2023  christos new inotify support GSoC 2023 (Theodore Preduta)
 1.60 01-Oct-2024  riastradh sys/compat/linux/common: Nix trailing whitespace, and one blank line.

No functional change intended.
 1.59 19-Sep-2021  thorpej branches: 1.59.10;
Add the timerfd syscalls to COMPAT_LINUX and COMPAT_LINUX32.
 1.58 23-Mar-2014  dholland branches: 1.58.10; 1.58.20; 1.58.42;
typos in comments
 1.57 19-Sep-2012  bouyer branches: 1.57.2;
Add a pass-through ioctl for mfi(4), allowing userland to send raw commands
to the controller. This is compatible with the linux and FreeBSD
implementations.
Add the needed conversion for mfi ioctls in COMPAT_LINUX
Allocate a character major number, and create /dev/mfi0 by default
on amd64 and i386.
This allows (along with a hand-created /emul/linux/proc/devices file)
to run the MegaCLI linux binary provided by LSI.
 1.56 14-Oct-2011  hannken branches: 1.56.2; 1.56.8; 1.56.12;
Change the vnode locking protocol of VOP_GETATTR() to request at least
a shared lock. Make all calls outside of file systems respect it.

The calls from file systems need review.

No objections from tech-kern.
 1.55 19-Jul-2008  jmcneill ioctl compatibility for v4l2 and drm
 1.54 28-Apr-2008  martin branches: 1.54.2; 1.54.4; 1.54.6;
Remove clause 3 and 4 from TNF licenses
 1.53 21-Mar-2008  ad branches: 1.53.2; 1.53.4;
Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
 1.52 20-Dec-2007  dsl branches: 1.52.6;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.51 08-Dec-2007  dsl branches: 1.51.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.50 26-Nov-2007  pooka branches: 1.50.2;
Remove the "struct lwp *" argument from all VFS and VOP interfaces.
The general trend is to remove it from all kernel interfaces and
this is a start. In case the calling lwp is desired, curlwp should
be used.

quick consensus on tech-kern
 1.49 19-Oct-2007  njoly branches: 1.49.2;
Add compat_linux and exec_linux_elf lkm support for amd64:
- Add needed COMPAT_OSSAUDIO to GENERIC.
- Add missing includes needed by linux_syscallargs.h.
- Add lkm building.
 1.48 16-Jun-2007  dsl branches: 1.48.6; 1.48.8; 1.48.12;
Delete stuff in comment about use of stackgap.
 1.47 04-Mar-2007  christos branches: 1.47.2; 1.47.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.46 09-Feb-2007  ad branches: 1.46.2;
Merge newlock2 to head.
 1.45 23-Jul-2006  ad branches: 1.45.4;
Use the LWP cached credentials where sane.
 1.44 14-May-2006  elad integrate kauth.
 1.43 11-Dec-2005  christos branches: 1.43.4; 1.43.6; 1.43.8; 1.43.10; 1.43.12;
merge ktrace-lwp.
 1.42 28-Feb-2005  soren branches: 1.42.4;
Emulate basic mtio ioctls.
 1.41 26-Feb-2005  perry nuke trailing whitespace
 1.40 03-Feb-2005  christos Add linux scsi-generic to work for simple cases. Allows gendalia's change
to limp along. From soren with fixes from me.
 1.39 03-Jun-2004  yamt branches: 1.39.4; 1.39.6;
linux_sys_ioctl: map EPASSTHROUGH to EINVAL as sys_ioctl does.
otherwise, linux_syscall() returns garbage, at least on i386.
(it returns native_to_linux_errno[EPASSTHROUGH] where EPASSTHROUGH == -4.)

i choose EINVAL rather than ENOTTY, because linux's pipe returns it
and i think that it's a common case.
 1.38 29-Jun-2003  fvdl branches: 1.38.2; 1.38.4;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.37 29-Jun-2003  enami Redo previous; struct proc *p is necessary if NSEQUENCER is non zero.
 1.36 28-Jun-2003  bouyer Kill unused variable.
 1.35 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.34 23-Jun-2003  christos PR/21936: Todd Vierling: ioctl 'r' misinterpreted
 1.33 20-Jun-2003  christos PR/21936: Todd Vierling: compat/linux: ioctl 'r' misinterpreted
 1.32 27-Feb-2003  yamt make compat_linux struct file interlock friendly.
 1.31 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.30 22-Oct-2002  simonb Don't call cdevsw_lookup() with an uninitialised variable in
linux_sys_ioctl().
 1.29 06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.28 13-Nov-2001  lukem branches: 1.28.8; 1.28.10;
add RCSIDs (including regeneration of files as appropriate)
 1.27 14-Jun-2001  thorpej branches: 1.27.2; 1.27.4;
Fix a partial construction problem that can cause race conditions
between creation of a file descriptor and close(2) when using kernel
assisted threads. What we do is stick descriptors in the table, but
mark them as "larval". This causes essentially everything to treat
it as a non-existent descriptor, except for fdalloc(), which sees a
filled slot so that it won't (incorrectly) allocate it again. When
a descriptor is fully constructed, the code that has constructed it
marks it as "mature" (which actually clears the "larval" flag), and
things continue to work as normal.

While here, gather all the code that gets a descriptor from the table
into a fd_getfile() function, and call it, rather than having the
same (sometimes incorrect) code copied all over the place.
 1.26 30-May-2001  mrg use _KERNEL_OPT.
 1.25 10-Jan-2001  fvdl branches: 1.25.2;
Declare linux_ioctl_blkio and call it from the main routine.
 1.24 10-Dec-2000  fvdl Add some ioctls for harddisk, floppy disk and console handling.
Implement a few extra cdrom ioctl calls.
Make sure to correctly use FILE_USE and FILE_UNUSE.
 1.23 29-Nov-2000  jdolecek LKMify
 1.22 15-Dec-1998  augustss branches: 1.22.8; 1.22.18;
Slight code rearrangement and more defensive tests for the sequencer device.
 1.21 04-Oct-1998  fvdl Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.20 03-Oct-1998  christos Attempt to fix the mess.
 1.19 01-Oct-1998  erh Move compat/linux/linux_ioctl.c to common.
 1.18 07-Aug-1998  augustss Add MIDI support. The MIDI devices can be accessed as ``raw'' through
the /dev/rmidiN devices, or with a sequencer interface via /dev/music.
So far the only supported MIDI device is the MPU401 port on SoundBlaster
(and only on SB on isapnp, since we do not have locators with multiple
values yet).
 1.17 15-Jan-1998  christos PR/4794: Urban Boquist: Linux cdrom ioctls are missing
 1.16 04-Apr-1997  augustss * Move the Linux audio emulation into its own directory and rename it
OSS (aka VoxWare) audio emulation.
* Use the OSS audio emulation for Linux and FreeBSD.
* Add mixer emulation to the OSS emulator.
 1.15 19-Mar-1997  mycroft Emulate the SOUND_PCM_WRITE_CHANNELS ioctl. From PR 3356, by Lennart
Augustsson. Also add hooks for mixer ioctls.
 1.14 05-Apr-1996  christos Prototyping changes.
 1.13 08-Mar-1996  mycroft Separate ioctl emulation by group. Add (minimal) audio emulation.
 1.12 27-Feb-1996  mycroft Map SIOCGIFFLAGS and SIOCGIFADDR (et al).
 1.11 27-Feb-1996  mycroft Use OSIOCGIFCONF in previous.
 1.10 27-Feb-1996  mycroft Map SIOCGIFCONF.
 1.9 16-Nov-1995  thorpej Fix transposed copyin() args, from Niklas Hallqvist <niklas@appli.se>.
 1.8 07-Oct-1995  mycroft branches: 1.8.2;
Prefix names of system call implementation functions with `sys_'.
 1.7 19-Sep-1995  thorpej Make system calls conform to a standard prototype and bring those
prototypes into scope.
 1.6 27-Aug-1995  fvdl Add a hook for MD ioctl calls, plus a couple of more changes to make
svgalib binaries work on the i386
 1.5 16-Aug-1995  mycroft Convert 230400 baud.
 1.4 14-Aug-1995  mycroft Rearrange #includes.
 1.3 24-Jun-1995  christos Use compat_util.[ch].
 1.2 22-Jun-1995  fvdl * Changed to use generic ELF code from kern/exec_elf.c (which was taken
from the svr4 exec code plus the linux compat mods)
* Include file change
* Add multicast sockopts (from John Brezak)
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.8.2.1 16-Nov-1995  thorpej Update from trunk; fix transposed copyin() args.
 1.22.18.1 30-Mar-2001  he Pull up revisions 1.24-1.25 (requested by fvdl):
Add some required Linux emulation bits to support the Linux
version of VMware.
 1.22.8.3 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.22.8.2 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.22.8.1 08-Dec-2000  bouyer Sync with HEAD.
 1.25.2.6 11-Nov-2002  nathanw Catch up to -current
 1.25.2.5 17-Sep-2002  nathanw Catch up to -current.
 1.25.2.4 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.25.2.3 14-Nov-2001  nathanw Catch up to -current.
 1.25.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.25.2.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.27.4.1 07-Sep-2001  thorpej Commit my "devvp" changes to the thorpej-devvp branch. This
replaces the use of dev_t in most places with a struct vnode *.

This will form the basic infrastructure for real cloning device
support (besides being architecurally cleaner -- it'll be good
to get away from using numbers to represent objects).
 1.27.2.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.27.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.28.10.1 17-Aug-2003  tron Pull up revision 1.33 (requested by tv in ticket #1421):
PR/21936: Todd Vierling: compat/linux: ioctl 'r' misinterpreted
 1.28.8.1 16-May-2002  gehenna Replace the direct-access to devsw table with calling devsw API.
 1.38.4.1 08-Oct-2004  jmc Pullup rev 1.39 (requested by manu in ticket #904)

linux_sys_ioctl: map EPASSTHROUGH to EINVAL as sys_ioctl does.
otherwise, linux_syscall() returns garbage, at least on i386.
 1.38.2.9 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.38.2.8 04-Feb-2005  skrll Sync with HEAD.
 1.38.2.7 21-Nov-2004  skrll Adapt to branch. Alpha kernels now compile.
 1.38.2.6 18-Nov-2004  skrll Adapt to branch. macppc release builds.
 1.38.2.5 21-Sep-2004  skrll Fix the sync with head I botched.
 1.38.2.4 18-Sep-2004  skrll Sync with HEAD.
 1.38.2.3 03-Aug-2004  skrll Sync with HEAD
 1.38.2.2 19-Aug-2003  skrll Fix patch botch. Closes PR 22043.
 1.38.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.39.6.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.39.6.1 12-Feb-2005  yamt sync with head.
 1.39.4.1 29-Apr-2005  kent sync with -current
 1.42.4.8 24-Mar-2008  yamt sync with head.
 1.42.4.7 21-Jan-2008  yamt sync with head
 1.42.4.6 07-Dec-2007  yamt sync with head
 1.42.4.5 27-Oct-2007  yamt sync with head.
 1.42.4.4 03-Sep-2007  yamt sync with head.
 1.42.4.3 26-Feb-2007  yamt sync with head.
 1.42.4.2 30-Dec-2006  yamt sync with head.
 1.42.4.1 21-Jun-2006  yamt sync with head.
 1.43.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.43.10.1 08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.43.8.2 11-Aug-2006  yamt sync with head
 1.43.8.1 24-May-2006  yamt sync with head.
 1.43.6.1 01-Jun-2006  kardel Sync with head.
 1.43.4.1 09-Sep-2006  rpaulo sync with head
 1.45.4.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.46.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.47.4.1 11-Jul-2007  mjf Sync with head.
 1.47.2.1 15-Jul-2007  ad Sync with head.
 1.48.12.1 25-Oct-2007  bouyer Sync with HEAD.
 1.48.8.2 09-Jan-2008  matt sync with HEAD
 1.48.8.1 06-Nov-2007  matt sync with HEAD
 1.48.6.3 09-Dec-2007  jmcneill Sync with HEAD.
 1.48.6.2 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.48.6.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.49.2.2 27-Dec-2007  mjf Sync with HEAD.
 1.49.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.50.2.1 26-Dec-2007  ad Sync with head.
 1.51.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.52.6.3 28-Sep-2008  mjf Sync with HEAD.
 1.52.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.52.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.53.4.2 04-May-2009  yamt sync with head.
 1.53.4.1 16-May-2008  yamt sync with head.
 1.53.2.1 18-May-2008  yamt sync with head.
 1.54.6.1 19-Oct-2008  haad Sync with HEAD.
 1.54.4.1 28-Jul-2008  simonb Sync with head.
 1.54.2.3 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.54.2.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.54.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.56.12.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.56.12.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.56.8.1 24-Oct-2012  riz Pull up following revision(s) (requested by bouyer in ticket #629):
sys/compat/linux/common/linux_ioctl.c: revision 1.57
sys/dev/ic/mfi.c: revision 1.47
sys/conf/majors: revision 1.62
etc/etc.i386/MAKEDEV.conf: revision 1.24
sys/dev/ic/mfivar.h: revision 1.20
etc/MAKEDEV.tmpl: revision 1.159
sys/dev/ic/mfiio.h: revision 1.1
etc/etc.amd64/MAKEDEV.conf: revision 1.19
sys/dev/ic/mfireg.h: revision 1.8
Add a pass-through ioctl for mfi(4), allowing userland to send raw commands
to the controller. This is compatible with the linux and FreeBSD
implementations.
Add the needed conversion for mfi ioctls in COMPAT_LINUX
Allocate a character major number, and create /dev/mfi0 by default
on amd64 and i386.
This allows (along with a hand-created /emul/linux/proc/devices file)
to run the MegaCLI linux binary provided by LSI.
 1.56.2.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.56.2.1 30-Oct-2012  yamt sync with head
 1.57.2.1 18-May-2014  rmind sync with head
 1.58.42.1 15-Dec-2020  thorpej Add Linux eventfd, timerfd, and POSIX timer calls.
 1.58.20.1 27-Apr-2017  pgoyette Restore all work from the former pgoyette-localcount branch (which is
now abandoned doe to cvs merge botch).

The branch now builds, and installs via anita. There are still some
problems (cgd is non-functional and all atf tests time-out) but they
will get resolved soon.
 1.58.10.2 21-Jul-2016  pgoyette simplify for readability
 1.58.10.1 20-Jul-2016  pgoyette Adapt machine-independant code to the new {b,c}devsw reference-counting
(using localcount(9)). All callers of {b,c}devsw_lookup() now call
{b,c}devsw_lookup_acquire() which retains a reference on the 'struct
{b,c}devsw'. This reference must be released by the caller once it is
finished with the structure's content (or other data that would disappear
if the 'struct {b,c}devsw' were to disappear).
 1.59.10.1 02-Aug-2025  perseant Sync with HEAD
 1.30 01-Oct-2024  riastradh sys/compat/linux/common: Nix trailing whitespace, and one blank line.

No functional change intended.
 1.29 23-Sep-2021  ryo branches: 1.29.10;
add support COMPAT_LINUX for aarch64
 1.28 19-Sep-2021  thorpej Add the timerfd syscalls to COMPAT_LINUX and COMPAT_LINUX32.
 1.27 08-Jun-2013  stacktic branches: 1.27.46;
Typo
 1.26 28-Apr-2008  martin branches: 1.26.34; 1.26.44;
Remove clause 3 and 4 from TNF licenses
 1.25 20-Dec-2007  dsl branches: 1.25.6; 1.25.8; 1.25.10;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.24 04-Dec-2007  dsl branches: 1.24.4;
Remove all the __P
 1.23 11-Dec-2005  christos branches: 1.23.44; 1.23.46; 1.23.52; 1.23.56;
merge ktrace-lwp.
 1.22 03-May-2005  manu branches: 1.22.2;
First work on COMPAT_LINUX/amd64
Process startup and dynamiclinking work, but processes hang due to
Linux arch_prctl(2) not being really supported yet.
 1.21 28-Feb-2005  soren Emulate basic mtio ioctls.
 1.20 26-Feb-2005  perry nuke trailing whitespace
 1.19 03-Feb-2005  christos Add linux scsi-generic to work for simple cases. Allows gendalia's change
to limp along. From soren with fixes from me.
 1.18 29-Jun-2003  fvdl branches: 1.18.2; 1.18.10; 1.18.12;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.17 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.16 14-Jan-2002  bjh21 Crude first cut at ARMLinux binary compatibility. Successfully runs
"/emul/linux/bin/echo hello, world", dynamically linked.
 1.15 22-Sep-2001  manu Enable Mips Linux emulation in header files
 1.14 19-Jan-2001  manu branches: 1.14.2; 1.14.4; 1.14.6;
Added Linux compatibility support for powerpc ports
 1.13 10-Jan-2001  fvdl Declare linux_ioctl_blkio and call it from the main routine.
 1.12 10-Dec-2000  fvdl The gist of the Linux _IOX definitions was the same for all platforms;
move it to the MI linux_ioctl.h and only leave the MD bits in the MD
header files.

Add defintions for linux_ioctl_hdio and linux_ioctl_fdio.
 1.11 15-Dec-1998  itohy branches: 1.11.8; 1.11.18;
Added linux compat support on m68k ports.
 1.10 04-Oct-1998  fvdl Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.9 03-Oct-1998  christos Attempt to fix the mess.
 1.8 01-Oct-1998  erh Split compat/linux/linux_ioctl.h into i386 and common parts.
 1.7 15-Jan-1998  christos PR/4794: Urban Boquist: Linux cdrom ioctls are missing
 1.6 04-Apr-1997  augustss * Move the Linux audio emulation into its own directory and rename it
OSS (aka VoxWare) audio emulation.
* Use the OSS audio emulation for Linux and FreeBSD.
* Add mixer emulation to the OSS emulator.
 1.5 19-Mar-1997  mycroft Emulate the SOUND_PCM_WRITE_CHANNELS ioctl. From PR 3356, by Lennart
Augustsson. Also add hooks for mixer ioctls.
 1.4 05-Apr-1996  christos Prototyping changes.
 1.3 08-Mar-1996  mycroft Separate ioctl emulation by group. Add (minimal) audio emulation.
 1.2 16-Aug-1995  mycroft Convert 230400 baud.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.11.18.1 30-Mar-2001  he Pull up revisions 1.12-1.13 (requested by fvdl):
Add some required Linux emulation bits to support the Linux
version of VMware.
 1.11.8.3 11-Feb-2001  bouyer Sync with HEAD.
 1.11.8.2 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.11.8.1 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.14.6.1 01-Oct-2001  fvdl Catch up with -current.
 1.14.4.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.14.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.14.2.2 28-Feb-2002  nathanw Catch up to -current.
 1.14.2.1 26-Sep-2001  nathanw Catch up to -current.
Again.
 1.18.12.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.18.12.1 12-Feb-2005  yamt sync with head.
 1.18.10.1 29-Apr-2005  kent sync with -current
 1.18.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.18.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.18.2.4 04-Feb-2005  skrll Sync with HEAD.
 1.18.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.18.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.18.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.22.2.3 21-Jan-2008  yamt sync with head
 1.22.2.2 07-Dec-2007  yamt sync with head
 1.22.2.1 21-Jun-2006  yamt sync with head.
 1.23.56.2 26-Dec-2007  ad Sync with head.
 1.23.56.1 08-Dec-2007  ad Sync with head.
 1.23.52.2 27-Dec-2007  mjf Sync with HEAD.
 1.23.52.1 08-Dec-2007  mjf Sync with HEAD.
 1.23.46.1 09-Jan-2008  matt sync with HEAD
 1.23.44.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.24.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.25.10.1 16-May-2008  yamt sync with head.
 1.25.8.1 18-May-2008  yamt sync with head.
 1.25.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.26.44.1 23-Jun-2013  tls resync from head
 1.26.34.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.27.46.1 15-Dec-2020  thorpej Add Linux eventfd, timerfd, and POSIX timer calls.
 1.29.10.1 02-Aug-2025  perseant Sync with HEAD
 1.60 26-Oct-2025  christos only compile semtimedop for those who have it.
 1.59 26-Oct-2025  christos PR/59722: Ricardo Branco: linux: Add support for semtimedop(2)
 1.58 27-Jun-2025  andvar Fix various typos, mainly in comments.
 1.57 23-Aug-2019  maxv branches: 1.57.32;
Fix stupid bugs in linux_sys_shmctl(): the index could be out of bound
(page fault) and there was no proper locking.

Maybe we should just remove LINUX_SHM_STAT, like compat_linux32.
 1.56 21-Feb-2019  mrg branches: 1.56.4;
for sysv ipc stat operations, explicitly copy the exported parts
instead of the whole ds structure.

besides triggering a recently added assert in netbsd32, this stops
exposing kernel addresses.

copy the mode clamping to 0777 from sem to shm and msg.


while here, make sure that the compat callers to sysv_ipc clear
the contents of the compat structure before setting the result
members to ensure padding bytes are cleared.

don't set/copy _sem_base, _msg_first, _msg_last or _shm_internal.
even if used, which seems very dodgy, they leak KVAs as well.
possibly this may affect linux binaries, in particular, the
comments around _shm_internal ("XXX Oh well.") may mean apps
rely upon these but hopefully not -- the comments date back to
rev 1.1 in 1995.

the _key, _seq and _msg_cbytes members are exported as before as
i found multiple consumers of these (no less than ipcs(1), and
they appear to be useful for debugging and more.


XXX: the naming of compat functions have too many styles. there
are at least 3 different ones changed here.
 1.55 28-May-2011  alnsn branches: 1.55.30; 1.55.34; 1.55.42; 1.55.48; 1.55.56;
Fix typo in a comment.
 1.54 16-Nov-2009  joerg branches: 1.54.4; 1.54.6;
Make sure to never leak padding space before copyout or copyin
uninitialized fields by explicitly using memset in the conversion
routines.
 1.53 23-Apr-2009  njoly Add IPC_64 support for all semctl(2)/msgctl(2). Needed, at least on
i386 for Linux 2.6 emulation.
 1.52 18-Feb-2009  njoly Add IPC_64 support for all shmctl(2) commands, not only for STAT/SET.
This make it work on i386 under 2.6 emulation.
 1.51 21-May-2008  njoly branches: 1.51.6; 1.51.12;
Add IPC_64 support to msgctl, needed for amd64.
 1.50 28-Apr-2008  martin branches: 1.50.2;
Remove clause 3 and 4 from TNF licenses
 1.49 24-Apr-2008  njoly branches: 1.49.2;
Add IPC_64 support for semctl IPC_STAT/IPC_SET.
 1.48 21-Apr-2008  njoly Add LINUX_IPC_64 support for LINUX_IPC_SET in shmctl. Required, at
least, for amd64 which use LINUX_IPC_FORCE64.
 1.47 21-Apr-2008  njoly Rename LINUX_SHMCTL_FORCEIPC64 define to LINUX_IPC_FORCE64.
 1.46 16-Apr-2008  njoly branches: 1.46.2;
Remove an obsolete comment about SHM_LOCK/SHM_UNLOCK being no-op.
 1.45 15-Apr-2008  njoly Remove unneeded amd64 ifdef/endif.
 1.44 28-Jan-2008  njoly branches: 1.44.6;
Make shmctl + {IPC,SHM}_STAT work an amd64, by forcing use of IPC_64.
Following the Linux kernel behaviour.
 1.43 28-Jan-2008  njoly shmctl fixes.

- SHM_STAT take an index as input, and return the corresponding shmid.
- IPC_INFO and SHM_INFO returns the highest used index.
- SHM_INFO expected the total used pages (not bytes) in shm_tot field
of struct shm_info.
 1.42 20-Dec-2007  dsl Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.41 08-Dec-2007  dsl branches: 1.41.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.40 17-Jun-2007  dsl branches: 1.40.6; 1.40.8; 1.40.14; 1.40.16;
Do the sysv ipc calls without the stackgap.
 1.39 04-Mar-2007  christos branches: 1.39.2; 1.39.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.38 09-Feb-2007  ad branches: 1.38.2;
Merge newlock2 to head.
 1.37 13-Sep-2006  manu Jumbo COMPAT_LINUX/COMPAT_LINUX32 bugfix, with the help of Nicolas Joly
- Fix shmat return value on amd64: it uses no black magic with retval[0]
- Fix integer overflows in sysinfo
- Implement sysinfo, mmap2, sched_getparam, sched_getscheduler, mremap,
and madvise in COMPAT_LINUX32
- Fix improper types used in setgroups16/getgroups16
- Implement mmap2 for COMPAT_LINUX32
- Ifdef debug messages by DEBUG_LINUX
 1.36 24-Aug-2006  manu branches: 1.36.2;
The return value for Linux shmat on amd64 does not suffer the same horrible
hack as on i386.
 1.35 23-Jul-2006  ad Use the LWP cached credentials where sane.
 1.34 09-Feb-2006  dogcow branches: 1.34.2;
make linux emulation compile on i386 again.
 1.33 09-Feb-2006  manu Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.32 10-Nov-2005  christos branches: 1.32.4; 1.32.6; 1.32.8;
More ipc support for linux; makes oracle work. From chuq and
jlrodriguez at terra dot es
 1.31 26-Feb-2005  perry branches: 1.31.4;
nuke trailing whitespace
 1.30 28-Sep-2004  jdolecek branches: 1.30.4; 1.30.6;
add flag for shmget(2) to specify that later shmat(2) for the shared memory
segment should succeed even if the segment would be marked removed; use this
to implement the Linux-compatible semantics of shmat(2)

this fixes the old Linux VMware3 graphics problem with local display,
and possibly other local Linux X clients using MIT-SHM
 1.29 28-Sep-2004  jdolecek fold shmat1() back into sys_shmat(), the change in rev 1.64 is not sufficient
for Linux-compatible shmat() behaviour - shmat() for the removed shared memory
segment must work from all callers, the shared memory id could be passed e.g.
to native X server via MIT-SHM

temporarily remove the functionality, the Linux-compatible semantics
will be reimplemented differently
 1.28 18-Jan-2003  thorpej branches: 1.28.2; 1.28.4;
Merge the nathanw_sa branch.
 1.27 03-Apr-2002  fvdl Use shmat1(), and tell it to find removed segments.
 1.26 16-Mar-2002  christos make the stackgap_{init,alloc} functions MP friendly (i.e. pass struct proc *
in, instead of using curproc). While there add an optional size argument to
stackgap_init.
 1.25 15-Nov-2001  lukem don't need <sys/types.h> when including <sys/param.h>
 1.24 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.23 30-May-2001  mrg branches: 1.23.2;
use _KERNEL_OPT.
 1.22 01-Dec-2000  jdolecek branches: 1.22.2;
make LKM safe
 1.21 25-Aug-1999  thorpej branches: 1.21.2;
Update for new msgctl()/semctl()/shmctl() calls.
 1.20 27-May-1999  tron Add support for SETALL and GETALL to the Linux emulation of semctl()
and improve handling of SETVAL. Patches supplied by YAMAMOTO Jiro in
PR kern/7621.
 1.19 03-Jan-1999  erh branches: 1.19.4;
Undo previous: Put back opt_sysv.h
 1.18 03-Jan-1999  erh Moved opt include to header file.
 1.17 19-Oct-1998  tron Defopt SYSVMSG, SYSVSEM and SYSVSHM.
 1.16 04-Oct-1998  fvdl Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.15 03-Oct-1998  christos Attempt to fix the mess.
 1.14 01-Oct-1998  erh Split compat/linux/linux_ipc.c into common and multi-architechture parts. The IPC multiplexer and associated functions are now in linux_ipccall.c
 1.13 22-Jan-1998  mycroft Clean this up a bit.
 1.12 08-May-1997  kleink Fixed copyin() argument botch in shmctl() IPC_STAT handling.
 1.11 15-Nov-1996  fvdl Avoid compiler warnings when none of the SYSV* options is defined.
 1.10 05-Apr-1996  christos Prototyping changes.
 1.9 08-Oct-1995  fvdl Avoid unnecessary copyin() of shmid_ds struct for shmctl(IPC_RMID)
 1.8 07-Oct-1995  mycroft Prefix names of system call implementation functions with `sys_'.
 1.7 19-Sep-1995  thorpej Make system calls conform to a standard prototype and bring those
prototypes into scope.
 1.6 15-Aug-1995  fvdl Implement the rest of the sysv ipc calls ({sem,msg}*())
 1.5 14-Aug-1995  mycroft Rearrange #includes.
 1.4 24-Jun-1995  christos Use compat_util.[ch].
 1.3 22-Jun-1995  fvdl * Changed to use generic ELF code from kern/exec_elf.c (which was taken
from the svr4 exec code plus the linux compat mods)
* Include file change
* Add multicast sockopts (from John Brezak)
 1.2 08-Mar-1995  fvdl Add missing structure conversion for IPC_RMID.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.19.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.21.2.1 08-Dec-2000  bouyer Sync with HEAD.
 1.22.2.8 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.22.2.7 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.22.2.6 17-Apr-2002  nathanw Catch up to -current.
 1.22.2.5 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.22.2.4 08-Jan-2002  nathanw Catch up to -current.
 1.22.2.3 14-Nov-2001  nathanw Catch up to -current.
 1.22.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.22.2.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.23.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.23.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.28.4.1 04-Oct-2004  jmc Pullup rev 1.29 (requested by jdolecek in ticket #884)

Fix linux handling of SysV-style shared memory. Fixed Linux VMware display
problems.
 1.28.2.3 11-Dec-2005  christos Sync with head.
 1.28.2.2 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.28.2.1 19-Oct-2004  skrll Sync with HEAD
 1.30.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.30.4.1 29-Apr-2005  kent sync with -current
 1.31.4.6 04-Feb-2008  yamt sync with head.
 1.31.4.5 21-Jan-2008  yamt sync with head
 1.31.4.4 03-Sep-2007  yamt sync with head.
 1.31.4.3 26-Feb-2007  yamt sync with head.
 1.31.4.2 30-Dec-2006  yamt sync with head.
 1.31.4.1 21-Jun-2006  yamt sync with head.
 1.32.8.1 22-Apr-2006  simonb Sync with head.
 1.32.6.1 09-Sep-2006  rpaulo sync with head
 1.32.4.1 18-Feb-2006  yamt sync with head.
 1.34.2.3 14-Sep-2006  yamt sync with head.
 1.34.2.2 03-Sep-2006  yamt sync with head.
 1.34.2.1 11-Aug-2006  yamt sync with head
 1.36.2.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.36.2.1 18-Nov-2006  ad Sync with head.
 1.38.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.39.4.1 11-Jul-2007  mjf Sync with head.
 1.39.2.1 15-Jul-2007  ad Sync with head.
 1.40.16.1 26-Dec-2007  ad Sync with head.
 1.40.14.1 18-Feb-2008  mjf Sync with HEAD.
 1.40.8.2 23-Mar-2008  matt sync with HEAD
 1.40.8.1 09-Jan-2008  matt sync with HEAD
 1.40.6.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.41.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.44.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.46.2.2 04-Jun-2008  yamt sync with head
 1.46.2.1 18-May-2008  yamt sync with head.
 1.49.2.3 11-Mar-2010  yamt sync with head
 1.49.2.2 04-May-2009  yamt sync with head.
 1.49.2.1 16-May-2008  yamt sync with head.
 1.50.2.3 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.50.2.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.50.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.51.12.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.51.6.2 28-Apr-2009  skrll Sync with HEAD.
 1.51.6.1 03-Mar-2009  skrll Sync with HEAD.
 1.54.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.54.4.1 31-May-2011  rmind sync with head
 1.55.56.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.55.56.1 10-Jun-2019  christos Sync with HEAD
 1.55.48.2 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1487:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.55.48.1 23-Feb-2019  martin Pull up following revision(s) (requested by mrg in ticket #1195):
sys/compat/sys/ipc.h: revision 1.6
sys/compat/sys/ipc.h: revision 1.7
sys/compat/sys/shm.h: revision 1.8
sys/kern/sysv_shm.c: revision 1.133
sys/compat/sys/sem.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.56
sys/compat/netbsd32/netbsd32_conv.h: revision 1.38
sys/kern/sysv_sem.c: revision 1.96
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.28
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.29
sys/compat/linux32/common/linux32_ipccall.c: revision 1.12
sys/kern/sysv_msg.c: revision 1.73
sys/compat/sys/msg.h: revision 1.6

for sysv ipc stat operations, explicitly copy the exported parts
instead of the whole ds structure.
besides triggering a recently added assert in netbsd32, this stops
exposing kernel addresses.

copy the mode clamping to 0777 from sem to shm and msg.

while here, make sure that the compat callers to sysv_ipc clear
the contents of the compat structure before setting the result
members to ensure padding bytes are cleared.

don't set/copy _sem_base, _msg_first, _msg_last or _shm_internal.
even if used, which seems very dodgy, they leak KVAs as well.
possibly this may affect linux binaries, in particular, the
comments around _shm_internal ("XXX Oh well.") may mean apps
rely upon these but hopefully not -- the comments date back to
rev 1.1 in 1995.

the _key, _seq and _msg_cbytes members are exported as before as
i found multiple consumers of these (no less than ipcs(1), and
they appear to be useful for debugging and more.

XXX: the naming of compat functions have too many styles. there
are at least 3 different ones changed here.

fix naming errors in previous. (this file is no longer compiled, but
this fix makes the pull up more obvious, before deleting this file.)

include libkern.h or strings.h. should fix i386 build issues.
 1.55.42.2 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1720:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149 (patch)
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54 (patch)

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.55.42.1 23-Feb-2019  martin Pull up following revision(s) (requested by mrg in ticket #1679):
sys/compat/sys/ipc.h: revision 1.6
sys/compat/sys/ipc.h: revision 1.7
sys/compat/sys/shm.h: revision 1.8
sys/kern/sysv_shm.c: revision 1.133
sys/compat/sys/sem.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.56
sys/compat/netbsd32/netbsd32_conv.h: revision 1.38
sys/kern/sysv_sem.c: revision 1.96
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.28
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.29
sys/compat/linux32/common/linux32_ipccall.c: revision 1.12
sys/kern/sysv_msg.c: revision 1.73
sys/compat/sys/msg.h: revision 1.6

for sysv ipc stat operations, explicitly copy the exported parts
instead of the whole ds structure.
besides triggering a recently added assert in netbsd32, this stops
exposing kernel addresses.

copy the mode clamping to 0777 from sem to shm and msg.

while here, make sure that the compat callers to sysv_ipc clear
the contents of the compat structure before setting the result
members to ensure padding bytes are cleared.

don't set/copy _sem_base, _msg_first, _msg_last or _shm_internal.
even if used, which seems very dodgy, they leak KVAs as well.
possibly this may affect linux binaries, in particular, the
comments around _shm_internal ("XXX Oh well.") may mean apps
rely upon these but hopefully not -- the comments date back to
rev 1.1 in 1995.

the _key, _seq and _msg_cbytes members are exported as before as
i found multiple consumers of these (no less than ipcs(1), and
they appear to be useful for debugging and more.

XXX: the naming of compat functions have too many styles. there
are at least 3 different ones changed here.

fix naming errors in previous. (this file is no longer compiled, but
this fix makes the pull up more obvious, before deleting this file.)

include libkern.h or strings.h. should fix i386 build issues.
 1.55.34.1 23-Feb-2019  martin Pull up following revision(s) (requested by mrg in ticket #1679):
sys/compat/sys/ipc.h: revision 1.6
sys/compat/sys/ipc.h: revision 1.7
sys/compat/sys/shm.h: revision 1.8
sys/kern/sysv_shm.c: revision 1.133
sys/compat/sys/sem.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.56
sys/compat/netbsd32/netbsd32_conv.h: revision 1.38
sys/kern/sysv_sem.c: revision 1.96
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.28
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.29
sys/compat/linux32/common/linux32_ipccall.c: revision 1.12
sys/kern/sysv_msg.c: revision 1.73
sys/compat/sys/msg.h: revision 1.6

for sysv ipc stat operations, explicitly copy the exported parts
instead of the whole ds structure.
besides triggering a recently added assert in netbsd32, this stops
exposing kernel addresses.

copy the mode clamping to 0777 from sem to shm and msg.

while here, make sure that the compat callers to sysv_ipc clear
the contents of the compat structure before setting the result
members to ensure padding bytes are cleared.

don't set/copy _sem_base, _msg_first, _msg_last or _shm_internal.
even if used, which seems very dodgy, they leak KVAs as well.
possibly this may affect linux binaries, in particular, the
comments around _shm_internal ("XXX Oh well.") may mean apps
rely upon these but hopefully not -- the comments date back to
rev 1.1 in 1995.

the _key, _seq and _msg_cbytes members are exported as before as
i found multiple consumers of these (no less than ipcs(1), and
they appear to be useful for debugging and more.

XXX: the naming of compat functions have too many styles. there
are at least 3 different ones changed here.

fix naming errors in previous. (this file is no longer compiled, but
this fix makes the pull up more obvious, before deleting this file.)

include libkern.h or strings.h. should fix i386 build issues.
 1.55.30.2 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1720:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149 (patch)
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54 (patch)

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.55.30.1 23-Feb-2019  martin Pull up following revision(s) (requested by mrg in ticket #1679):
sys/compat/sys/ipc.h: revision 1.6
sys/compat/sys/ipc.h: revision 1.7
sys/compat/sys/shm.h: revision 1.8
sys/kern/sysv_shm.c: revision 1.133
sys/compat/sys/sem.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.56
sys/compat/netbsd32/netbsd32_conv.h: revision 1.38
sys/kern/sysv_sem.c: revision 1.96
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.28
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.29
sys/compat/linux32/common/linux32_ipccall.c: revision 1.12
sys/kern/sysv_msg.c: revision 1.73
sys/compat/sys/msg.h: revision 1.6

for sysv ipc stat operations, explicitly copy the exported parts
instead of the whole ds structure.
besides triggering a recently added assert in netbsd32, this stops
exposing kernel addresses.

copy the mode clamping to 0777 from sem to shm and msg.

while here, make sure that the compat callers to sysv_ipc clear
the contents of the compat structure before setting the result
members to ensure padding bytes are cleared.

don't set/copy _sem_base, _msg_first, _msg_last or _shm_internal.
even if used, which seems very dodgy, they leak KVAs as well.
possibly this may affect linux binaries, in particular, the
comments around _shm_internal ("XXX Oh well.") may mean apps
rely upon these but hopefully not -- the comments date back to
rev 1.1 in 1995.

the _key, _seq and _msg_cbytes members are exported as before as
i found multiple consumers of these (no less than ipcs(1), and
they appear to be useful for debugging and more.

XXX: the naming of compat functions have too many styles. there
are at least 3 different ones changed here.

fix naming errors in previous. (this file is no longer compiled, but
this fix makes the pull up more obvious, before deleting this file.)

include libkern.h or strings.h. should fix i386 build issues.
 1.56.4.1 13-Sep-2019  martin Pull up following revision(s) (requested by maxv in ticket #194):

sys/compat/linux/common/linux_socket.c: revision 1.146
sys/compat/linux/common/linux_socket.c: revision 1.147
sys/compat/linux/common/linux_socket.c: revision 1.148
sys/compat/linux/common/linux_socket.c: revision 1.149
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.59
sys/compat/linux32/common/linux32_sysinfo.c: revision 1.8
sys/kern/sysv_shm.c: revision 1.138
sys/compat/linux/common/linux_file64.c: revision 1.61
sys/compat/linux/common/linux_file64.c: revision 1.62
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.58
sys/compat/linux32/common/linux32_dirent.c: revision 1.20
sys/compat/linux32/common/linux32_utsname.c: revision 1.10
sys/compat/linux/common/linux_termios.h: revision 1.22
sys/compat/linux32/common/linux32_termios.c: revision 1.15
sys/compat/linux32/common/linux32_misc.c: revision 1.27
sys/compat/linux32/common/linux32_ioctl.c: revision 1.14
sys/compat/linux/common/linux_statfs.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.57
sys/compat/linux/common/linux_fcntl.h: revision 1.18
sys/compat/linux/common/linux_socket.h: revision 1.24
sys/sys/shm.h: revision 1.54
sys/compat/ossaudio/ossaudio.c: revision 1.75
sys/compat/linux32/common/linux32_signal.c: revision 1.20
sys/miscfs/procfs/procfs_linux.c: revision 1.75
sys/compat/linux/common/linux_signal.c: revision 1.81
sys/compat/linux/common/linux_termios.c: revision 1.38
sys/compat/linux/common/linux_misc.c: revision 1.241
sys/compat/linux/common/linux_misc.c: revision 1.242
sys/compat/linux/common/linux_misc.c: revision 1.243
sys/compat/linux/common/linux_misc.c: revision 1.244

Fix info leaks.

Fix stupid bugs in linux_sys_shmctl(): the index could be out of bound
(page fault) and there was no proper locking.
Maybe we should just remove LINUX_SHM_STAT, like compat_linux32.

Remove printf.

When dealing with an unknown value, set -1, to prevent (harmless)
uninitialized accesses later.

Add a default case, don't call sys_ioctl() with an uninitialized 'com'
argument.

Fix error handling, returns an errno, not -1.

Put the printf under DEBUG_LINUX.


Hum, don't forget the 'pid' argument, otherwise we're not gonna go very
far.

Don't read data from userland directly. This simply does not work on any
recent x86 CPU (thanks to SMAP) and all architectures that forbid direct
access to userland from the kernel. But I guess no one noticed because no
one ever uses compat_linux, right?

Hum, don't pass an mbuf to realloc(). Inspired from copyin32_msg_control().

Fix memory leak.

I don't see the point in having this useless printf, but add a '\n' to it,
so that it at least displays useless stuff correctly.

Hum, remove incorrect assignment. Userland could have passed a smaller
namelen, and the uninitialized bytes from sb_data were being used later in
the network stack.
 1.57.32.1 02-Aug-2025  perseant Sync with HEAD
 1.9 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.8 04-Dec-2007  dsl branches: 1.8.12; 1.8.14; 1.8.16;
Remove all the __P
 1.7 10-Nov-2005  christos branches: 1.7.46; 1.7.48; 1.7.54; 1.7.58;
More ipc support for linux; makes oracle work. From chuq and
jlrodriguez at terra dot es
 1.6 30-May-2001  mrg branches: 1.6.22; 1.6.38;
use _KERNEL_OPT.
 1.5 03-Jan-1999  erh branches: 1.5.20;
Grab the sysv options.
 1.4 04-Oct-1998  fvdl Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.3 03-Oct-1998  christos Attempt to fix the mess.
 1.2 01-Oct-1998  erh Move IPC headers to common. The msg, sem and shm files, in addition to other common structures and to avoid creating several more machine dependent header files, include the syscall arguments for several system calls which don't exist on all architechtures.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.5.20.1 21-Jun-2001  nathanw Catch up to -current.
 1.6.38.2 07-Dec-2007  yamt sync with head
 1.6.38.1 21-Jun-2006  yamt sync with head.
 1.6.22.1 11-Dec-2005  christos Sync with head.
 1.7.58.1 08-Dec-2007  ad Sync with head.
 1.7.54.1 08-Dec-2007  mjf Sync with HEAD.
 1.7.48.1 09-Jan-2008  matt sync with HEAD
 1.7.46.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.8.16.1 16-May-2008  yamt sync with head.
 1.8.14.1 18-May-2008  yamt sync with head.
 1.8.12.1 02-Jun-2008  mjf Sync with HEAD.
 1.37 27-Oct-2025  kre Remove a stray }

This looks to have been added in an editing/merge/patch botch in 1.34
(the revision 2 before this one).
 1.36 26-Oct-2025  christos only compile semtimedop for those who have it.
 1.35 26-Oct-2025  christos PR/59722: Ricardo Branco: linux: Add support for semtimedop(2)
 1.34 23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.33 27-Dec-2013  njoly Rename ipcall/socketcall specific defines to avoid conflict with
syscalls definitions. No functional changes.
 1.32 18-Aug-2009  drochner branches: 1.32.12; 1.32.22; 1.32.26;
remove some "inline" from functions which are defined in a .c file
but used elsewhere -- gcc-4.4.1 doesn't like it and I doubt it
had any effect
 1.31 28-Apr-2008  martin branches: 1.31.2;
Remove clause 3 and 4 from TNF licenses
 1.30 20-Dec-2007  dsl branches: 1.30.6; 1.30.8; 1.30.10;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.29 08-Dec-2007  dsl branches: 1.29.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.28 04-Mar-2007  christos branches: 1.28.14; 1.28.16; 1.28.24;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.27 09-Feb-2007  ad branches: 1.27.2;
Merge newlock2 to head.
 1.26 11-Dec-2005  christos branches: 1.26.20;
merge ktrace-lwp.
 1.25 26-Feb-2005  perry branches: 1.25.4;
nuke trailing whitespace
 1.24 28-Sep-2004  jdolecek branches: 1.24.4; 1.24.6;
add flag for shmget(2) to specify that later shmat(2) for the shared memory
segment should succeed even if the segment would be marked removed; use this
to implement the Linux-compatible semantics of shmat(2)

this fixes the old Linux VMware3 graphics problem with local display,
and possibly other local Linux X clients using MIT-SHM
 1.23 18-Jan-2003  thorpej branches: 1.23.2; 1.23.4;
Merge the nathanw_sa branch.
 1.22 15-Nov-2001  lukem don't need <sys/types.h> when including <sys/param.h>
 1.21 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.20 30-May-2001  mrg branches: 1.20.2;
use _KERNEL_OPT.
 1.19 10-Jan-1999  tron branches: 1.19.20;
Revert last changes:
Because "linux_ipccall.h" cannot be included before "sys/shm.h" and
"sys/shm.h" needs to be included after "opt_sysv.h" include "opt_sysv.h"
in "linux_ipccall.c" again.
 1.18 03-Jan-1999  erh Moved sysv opt include to header file.
 1.17 22-Nov-1998  drochner include missing SYSV option header - PR kern/6479 by Urban Boquist
 1.16 04-Oct-1998  fvdl Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.15 03-Oct-1998  christos Attempt to fix the mess.
 1.14 01-Oct-1998  erh Split compat/linux/linux_ipc.c into common and multi-architechture parts. The IPC multiplexer and associated functions are now in linux_ipccall.c
 1.13 22-Jan-1998  mycroft Clean this up a bit.
 1.12 08-May-1997  kleink Fixed copyin() argument botch in shmctl() IPC_STAT handling.
 1.11 15-Nov-1996  fvdl Avoid compiler warnings when none of the SYSV* options is defined.
 1.10 05-Apr-1996  christos Prototyping changes.
 1.9 08-Oct-1995  fvdl Avoid unnecessary copyin() of shmid_ds struct for shmctl(IPC_RMID)
 1.8 07-Oct-1995  mycroft Prefix names of system call implementation functions with `sys_'.
 1.7 19-Sep-1995  thorpej Make system calls conform to a standard prototype and bring those
prototypes into scope.
 1.6 15-Aug-1995  fvdl Implement the rest of the sysv ipc calls ({sem,msg}*())
 1.5 14-Aug-1995  mycroft Rearrange #includes.
 1.4 24-Jun-1995  christos Use compat_util.[ch].
 1.3 22-Jun-1995  fvdl * Changed to use generic ELF code from kern/exec_elf.c (which was taken
from the svr4 exec code plus the linux compat mods)
* Include file change
* Add multicast sockopts (from John Brezak)
 1.2 08-Mar-1995  fvdl Add missing structure conversion for IPC_RMID.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.19.20.5 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.19.20.4 08-Jan-2002  nathanw Catch up to -current.
 1.19.20.3 14-Nov-2001  nathanw Catch up to -current.
 1.19.20.2 21-Jun-2001  nathanw Catch up to -current.
 1.19.20.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.20.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.23.4.1 04-Oct-2004  jmc Pullup rev 1.24 (requested by jdolecek in ticket #884)

Fix linux handling of SysV-style shared memory. Fixed Linux VMware display
problems.
 1.23.2.2 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.23.2.1 19-Oct-2004  skrll Sync with HEAD
 1.24.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.24.4.1 29-Apr-2005  kent sync with -current
 1.25.4.3 21-Jan-2008  yamt sync with head
 1.25.4.2 03-Sep-2007  yamt sync with head.
 1.25.4.1 26-Feb-2007  yamt sync with head.
 1.26.20.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.27.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.28.24.1 26-Dec-2007  ad Sync with head.
 1.28.16.1 09-Jan-2008  matt sync with HEAD
 1.28.14.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.29.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.30.10.2 19-Aug-2009  yamt sync with head.
 1.30.10.1 16-May-2008  yamt sync with head.
 1.30.8.1 18-May-2008  yamt sync with head.
 1.30.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.31.2.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.31.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.32.26.1 18-May-2014  rmind sync with head
 1.32.22.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.32.12.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.18 26-Oct-2025  christos PR/59722: Ricardo Branco: linux: Add support for semtimedop(2)
 1.17 23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.16 27-Dec-2013  njoly Rename ipcall/socketcall specific defines to avoid conflict with
syscalls definitions. No functional changes.
 1.15 18-Aug-2009  drochner branches: 1.15.12; 1.15.22; 1.15.26;
remove some "inline" from functions which are defined in a .c file
but used elsewhere -- gcc-4.4.1 doesn't like it and I doubt it
had any effect
 1.14 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.13 20-Dec-2007  dsl branches: 1.13.6; 1.13.8; 1.13.10;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.12 04-Dec-2007  dsl branches: 1.12.4;
Remove all the __P
 1.11 16-Feb-2006  perry branches: 1.11.38; 1.11.40; 1.11.46; 1.11.50;
Change "inline" back to "__inline" in .h files -- C99 is still too
new, and some apps compile things in C89 mode. C89 keywords stay.

As per core@.
 1.10 11-Dec-2005  christos branches: 1.10.2; 1.10.4; 1.10.6;
merge ktrace-lwp.
 1.9 03-May-2005  manu branches: 1.9.2;
First work on COMPAT_LINUX/amd64
Process startup and dynamiclinking work, but processes hang due to
Linux arch_prctl(2) not being really supported yet.
 1.8 18-Jan-2003  thorpej branches: 1.8.2;
Merge the nathanw_sa branch.
 1.7 10-Jan-1999  tron branches: 1.7.20;
Revert last changes:
Because "linux_ipccall.h" cannot be included before "sys/shm.h" and
"sys/shm.h" needs to be included after "opt_sysv.h" include "opt_sysv.h"
in "linux_ipccall.c" again.
 1.6 03-Jan-1999  erh Grab the sysv options.
 1.5 04-Oct-1998  fvdl Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.4 03-Oct-1998  christos Attempt to fix the mess.
 1.3 01-Oct-1998  erh Move linux/compat/linux_ipccall.h to multiarch. Defines for the IPC multiplexerand associated functions.
 1.2 15-Aug-1995  fvdl Implement the rest of the sysv ipc calls ({sem,msg}*())
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.7.20.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.8.2.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.9.2.3 21-Jan-2008  yamt sync with head
 1.9.2.2 07-Dec-2007  yamt sync with head
 1.9.2.1 21-Jun-2006  yamt sync with head.
 1.10.6.1 22-Apr-2006  simonb Sync with head.
 1.10.4.1 09-Sep-2006  rpaulo sync with head
 1.10.2.1 18-Feb-2006  yamt sync with head.
 1.11.50.2 26-Dec-2007  ad Sync with head.
 1.11.50.1 08-Dec-2007  ad Sync with head.
 1.11.46.2 27-Dec-2007  mjf Sync with HEAD.
 1.11.46.1 08-Dec-2007  mjf Sync with HEAD.
 1.11.40.1 09-Jan-2008  matt sync with HEAD
 1.11.38.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.12.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.13.10.2 19-Aug-2009  yamt sync with head.
 1.13.10.1 16-May-2008  yamt sync with head.
 1.13.8.1 18-May-2008  yamt sync with head.
 1.13.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.15.26.1 18-May-2014  rmind sync with head
 1.15.22.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.15.12.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.10 01-Oct-2024  riastradh sys/compat/linux/common: Nix trailing whitespace, and one blank line.

No functional change intended.
 1.9 12-May-2024  christos branches: 1.9.2;
PR/58240: Ricardo Branco: Add missing limits
 1.8 02-Dec-2021  ryo add prlimit64(2) syscall to COMPAT_LINUX and COMPAT_LINUX32
 1.7 28-Feb-2015  njoly When converting limits from linux32 (int32_t) to native (uint64_t),
cast it to unsigned first to avoid bad side effect for negative
values.
 1.6 22-Sep-2012  joerg branches: 1.6.14;
LINUX_RLIM_INFINITY doesn't fit into the value range for linux32, so
introduce a variant with correct value.
 1.5 29-Mar-2009  mrg branches: 1.5.12; 1.5.22;
- add new RLIMIT_AS (aka RLIMIT_VMEM) resource that limits the total
address space available to processes. this limit exists in most other
modern unix variants, and like most of them, our defaults are unlimited.
remove the old mmap / rlimit.datasize hack.

- adds the VMCMD_STACK flag to all the stack-creation vmcmd callers.
it is currently unused, but was added a few years ago.

- add a pair of new process size values to kinfo_proc2{}. one is the
total size of the process memory map, and the other is the total size
adjusted for unused stack space (since most processes have a lot of
this...)

- patch sh, and csh to notice RLIMIT_AS. (in some cases, the alias
RLIMIT_VMEM was already present and used if availble.)

- patch ps, top and systat to notice the new k_vm_vsize member of
kinfo_proc2{}.

- update irix, svr4, svr4_32, linux and osf1 emulations to support
this information. (freebsd could be done, but that it's best left
as part of the full-update of compat/freebsd.)


this addresses PR 7897. it also gives correct memory usage values,
which have never been entirely correct (since mmap), and have been
very incorrect since jemalloc() was enabled.

tested on i386 and sparc64, build tested on several other platforms.

thanks to many folks for feedback and testing but most espcially
chuq and yamt for critical suggestions that lead to this patch not
having a special ugliness i wasn't happy with anyway :-)
 1.4 15-Mar-2009  cegger ansify function definitions
 1.3 28-Apr-2008  martin branches: 1.3.8; 1.3.10; 1.3.14;
Remove clause 3 and 4 from TNF licenses
 1.2 04-Dec-2007  dsl branches: 1.2.12; 1.2.14; 1.2.16;
Remove all the __P
 1.1 09-Feb-2006  manu branches: 1.1.2; 1.1.10; 1.1.16; 1.1.22; 1.1.46; 1.1.48; 1.1.54; 1.1.58;
Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.1.58.1 08-Dec-2007  ad Sync with head.
 1.1.54.1 08-Dec-2007  mjf Sync with HEAD.
 1.1.48.1 09-Jan-2008  matt sync with HEAD
 1.1.46.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.1.22.2 09-Sep-2006  rpaulo sync with head
 1.1.22.1 09-Feb-2006  rpaulo file linux_limit.h was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:45:52 +0000
 1.1.16.3 07-Dec-2007  yamt sync with head
 1.1.16.2 21-Jun-2006  yamt sync with head.
 1.1.16.1 09-Feb-2006  yamt file linux_limit.h was added on branch yamt-lazymbuf on 2006-06-21 14:59:12 +0000
 1.1.10.2 22-Apr-2006  simonb Sync with head.
 1.1.10.1 09-Feb-2006  simonb file linux_limit.h was added on branch simonb-timecounters on 2006-04-22 11:38:13 +0000
 1.1.2.2 18-Feb-2006  yamt sync with head.
 1.1.2.1 09-Feb-2006  yamt file linux_limit.h was added on branch yamt-uio_vmspace on 2006-02-18 15:38:59 +0000
 1.2.16.2 04-May-2009  yamt sync with head.
 1.2.16.1 16-May-2008  yamt sync with head.
 1.2.14.1 18-May-2008  yamt sync with head.
 1.2.12.1 02-Jun-2008  mjf Sync with HEAD.
 1.3.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.3.10.1 01-Apr-2009  snj Pull up following revision(s) (requested by mrg in ticket #622):
bin/csh/csh.1: revision 1.46
bin/csh/func.c: revision 1.37
bin/ps/print.c: revision 1.111
bin/ps/ps.c: revision 1.74
bin/sh/miscbltin.c: revision 1.38
bin/sh/sh.1: revision 1.92 via patch
external/bsd/top/dist/machine/m_netbsd.c: revision 1.7
lib/libkvm/kvm_proc.c: revision 1.82
sys/arch/mips/mips/cpu_exec.c: revision 1.55
sys/compat/darwin/darwin_exec.c: revision 1.57
sys/compat/ibcs2/ibcs2_exec.c: revision 1.73
sys/compat/irix/irix_resource.c: revision 1.15
sys/compat/linux/arch/amd64/linux_exec_machdep.c: revision 1.16
sys/compat/linux/arch/i386/linux_exec_machdep.c: revision 1.12
sys/compat/linux/common/linux_limit.h: revision 1.5
sys/compat/osf1/osf1_resource.c: revision 1.14
sys/compat/svr4/svr4_resource.c: revision 1.18
sys/compat/svr4_32/svr4_32_resource.c: revision 1.17
sys/kern/exec_subr.c: revision 1.62
sys/kern/init_sysctl.c: revision 1.160
sys/kern/kern_exec.c: revision 1.288
sys/kern/kern_resource.c: revision 1.151
sys/sys/param.h: patch
sys/sys/resource.h: revision 1.31
sys/sys/sysctl.h: revision 1.184
sys/uvm/uvm_extern.h: revision 1.153
sys/uvm/uvm_glue.c: revision 1.136
sys/uvm/uvm_mmap.c: revision 1.128
usr.bin/systat/ps.c: revision 1.32
- - add new RLIMIT_AS (aka RLIMIT_VMEM) resource that limits the total
address space available to processes. this limit exists in most other
modern unix variants, and like most of them, our defaults are unlimited.
remove the old mmap / rlimit.datasize hack.
- - adds the VMCMD_STACK flag to all the stack-creation vmcmd callers.
it is currently unused, but was added a few years ago.
- - add a pair of new process size values to kinfo_proc2{}. one is the
total size of the process memory map, and the other is the total size
adjusted for unused stack space (since most processes have a lot of
this...)
- - patch sh, and csh to notice RLIMIT_AS. (in some cases, the alias
RLIMIT_VMEM was already present and used if availble.)
- - patch ps, top and systat to notice the new k_vm_vsize member of
kinfo_proc2{}.
- - update irix, svr4, svr4_32, linux and osf1 emulations to support
this information. (freebsd could be done, but that it's best left
as part of the full-update of compat/freebsd.)
this addresses PR 7897. it also gives correct memory usage values,
which have never been entirely correct (since mmap), and have been
very incorrect since jemalloc() was enabled.
tested on i386 and sparc64, build tested on several other platforms.
thanks to many folks for feedback and testing but most espcially
chuq and yamt for critical suggestions that lead to this patch not
having a special ugliness i wasn't happy with anyway :-)
 1.3.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.5.22.2 03-Dec-2017  jdolecek update from HEAD
 1.5.22.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.5.12.1 30-Oct-2012  yamt sync with head
 1.6.14.1 06-Apr-2015  skrll Sync with HEAD
 1.9.2.1 02-Aug-2025  perseant Sync with HEAD
 1.35 23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.34 09-Nov-2014  maxv Do not uselessly include <sys/malloc.h>.
 1.33 18-Jun-2008  tsutsui branches: 1.33.40; 1.33.58;
Include <sys/sched.h> before <sys/syscallargs.h> for cpuset_t.
 1.32 28-Apr-2008  martin branches: 1.32.2; 1.32.4;
Remove clause 3 and 4 from TNF licenses
 1.31 20-Dec-2007  dsl branches: 1.31.6; 1.31.8; 1.31.10;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.30 08-Dec-2007  dsl branches: 1.30.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.29 04-Mar-2007  christos branches: 1.29.14; 1.29.16; 1.29.24;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.28 09-Feb-2007  ad branches: 1.28.2;
Merge newlock2 to head.
 1.27 18-Jan-2003  thorpej branches: 1.27.18; 1.27.48;
Merge the nathanw_sa branch.
 1.26 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.25 04-Oct-1998  fvdl branches: 1.25.24; 1.25.26;
Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.24 03-Oct-1998  christos Attempt to fix the mess.
 1.23 01-Oct-1998  erh Split compat/linux/linux_file.c into common and multi-architechture parts.
 1.22 14-Feb-1998  kleink * Use sys___posix_{chown,fchown}() instead of sys_{chown,fchown}().
* Change reference from sys_posix_rename() to sys___posix_rename().
 1.21 20-Oct-1997  thorpej Fix the shared library versioning snafu caused by the recent changes
to the stat(2) family and msync(2). This uses a primitive function
versioning scheme.

This reverts the libc shared library major version from 13 to 12, and
adds a few new interfaces to bring us to libc version 12.20.

From Frank van der Linden <fvdl@NetBSD.ORG>.
 1.20 19-Oct-1997  mycroft Fix bogosity in mknod(2) translation.
 1.19 16-Oct-1997  christos check for st_nlink overflow
 1.18 05-Sep-1997  kleink Add missing preparation of F_GETLK parameters in linux_sys_fcntl(); fixes PR
port-i386/4083 from Matthias Scheler <tron@lyssa.owl.de>, but vastly cleaned
up as previously suggested by myself.
 1.17 27-Jun-1997  kleink branches: 1.17.4;
Use sys_posix_rename() instead of sys_rename() as it's the behaviour of the
native implementation.
 1.16 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.15 20-May-1996  fvdl Update list of Linux syscalls and implement the ones that are likely to be
used and doable.
 1.14 05-Apr-1996  christos Prototyping changes.
 1.13 08-Oct-1995  fvdl Work around calling the NetBSD fcntl(F_{G,S}ETOWN) for now; it is too
restrictive to implement the Linux equivalent (and perhaps too restrictive
overall).
 1.12 07-Oct-1995  mycroft Prefix names of system call implementation functions with `sys_'.
 1.11 19-Sep-1995  thorpej Make system calls conform to a standard prototype and bring those
prototypes into scope.
 1.10 07-Sep-1995  fvdl Fix some bugs & typing problems.
 1.9 27-Aug-1995  fvdl Add a hook for MD ioctl calls, plus a couple of more changes to make
svgalib binaries work on the i386
 1.8 14-Aug-1995  mycroft Rearrange #includes.
 1.7 24-Jul-1995  fvdl mkdir() has 2 arguments.. fixes PR 1248 (from Brad Spencer)
 1.6 03-Jul-1995  fvdl Fix totally bogus implementation of a few fcntl() calls. I think I'll go
live on a deserted island now..
 1.5 24-Jun-1995  christos Use compat_util.[ch].
 1.4 22-Jun-1995  fvdl * Changed to use generic ELF code from kern/exec_elf.c (which was taken
from the svr4 exec code plus the linux compat mods)
* Include file change
* Add multicast sockopts (from John Brezak)
 1.3 04-Apr-1995  mycroft Fix conversion of `type' and `whence' values in struct flock.
 1.2 05-Mar-1995  fvdl Added a few more system calls.
More consistent alternate root file semantics throughout.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.17.4.1 06-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.25.26.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.25.24.3 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.25.24.2 14-Nov-2001  nathanw Catch up to -current.
 1.25.24.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.27.48.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.27.18.3 21-Jan-2008  yamt sync with head
 1.27.18.2 03-Sep-2007  yamt sync with head.
 1.27.18.1 26-Feb-2007  yamt sync with head.
 1.28.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.29.24.1 26-Dec-2007  ad Sync with head.
 1.29.16.1 09-Jan-2008  matt sync with HEAD
 1.29.14.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.30.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.31.10.2 04-May-2009  yamt sync with head.
 1.31.10.1 16-May-2008  yamt sync with head.
 1.31.8.1 18-May-2008  yamt sync with head.
 1.31.6.2 29-Jun-2008  mjf Sync with HEAD.
 1.31.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.32.4.1 18-Jun-2008  simonb Sync with head.
 1.32.2.3 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.32.2.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.32.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.33.58.1 17-Jan-2015  martin Pull up following revision(s) (requested by maxv in ticket #427):
sys/compat/svr4/svr4_schedctl.c: revision 1.8
sys/netinet/tcp_timer.c: revision 1.88
sys/miscfs/genfs/layer_vfsops.c: revision 1.45
sys/compat/svr4/svr4_ioctl.c: revision 1.37
sys/ufs/chfs/chfs_vfsops.c: revision 1.14
sys/miscfs/fdesc/fdesc_vfsops.c: revision 1.91
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.30
sys/compat/common/kern_time_50.c: revision 1.28
sys/netinet6/ip6_forward.c: revision 1.74
sys/miscfs/umapfs/umap_vnops.c: revision 1.57
sys/compat/svr4/svr4_fcntl.c: revision 1.74
distrib/sets/lists/comp/mi: revision 1.1931
sys/netinet6/udp6_output.c: revision 1.46
sys/fs/puffs/puffs_compat.c: revision 1.3
sys/fs/udf/udf_rename.c: revision 1.11
sys/compat/svr4/svr4_filio.c: revision 1.24
sys/fs/udf/udf_rename.c: revision 1.12
sys/netinet/tcp_usrreq.c: revision 1.202
sys/miscfs/umapfs/umap_subr.c: revision 1.29
sys/compat/linux/common/linux_fadvise64.c: revision 1.3
sys/netinet/if_atm.c: revision 1.34
sys/miscfs/procfs/procfs_subr.c: revision 1.106
sys/miscfs/genfs/layer_subr.c: revision 1.37
sys/netinet/tcp_sack.c: revision 1.30
sys/compat/freebsd/freebsd_misc.c: revision 1.33
sys/compat/freebsd/freebsd_file.c: revision 1.33
sys/ufs/chfs/chfs_vnode.c: revision 1.12
sys/compat/svr4/svr4_ttold.c: revision 1.34
sys/compat/linux/common/linux_file.c: revision 1.114
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.43
sys/compat/linux/common/linux_signal.c: revision 1.76
sys/compat/common/compat_util.c: revision 1.46
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.18
sys/compat/svr4/svr4_sockio.c: revision 1.36
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.32
sys/compat/svr4/svr4_signal.c: revision 1.66
sys/kern/kern_exec.c: revision 1.410
sys/fs/puffs/puffs_vfsops.c: revision 1.115
sys/compat/svr4/svr4_exec_elf64.c: revision 1.15
sys/compat/linux/arch/i386/linux_machdep.c: revision 1.159
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.50
sys/compat/linux32/common/linux32_misc.c: revision 1.24
sys/netinet/in_pcb.c: revision 1.153
sys/sys/malloc.h: revision 1.116
sys/compat/common/if_43.c: revision 1.9
share/man/man9/Makefile: revision 1.380
sys/netinet/tcp_vtw.c: revision 1.12
sys/miscfs/umapfs/umap_vfsops.c: revision 1.95
sys/ufs/ext2fs/ext2fs_vfsops.c: revision 1.186
sys/compat/common/uipc_syscalls_43.c: revision 1.46
sys/ufs/ext2fs/ext2fs_vnops.c: revision 1.115
sys/fs/puffs/puffs_msgif.c: revision 1.97
sys/compat/svr4/svr4_ipc.c: revision 1.27
sys/compat/linux/common/linux_exec.c: revision 1.117
sys/ufs/ext2fs/ext2fs_readwrite.c: revision 1.66
sys/netinet/tcp_output.c: revision 1.179
sys/compat/svr4/svr4_termios.c: revision 1.28
sys/fs/udf/udf_strat_bootstrap.c: revision 1.4
sys/fs/puffs/puffs_subr.c: revision 1.67
sys/fs/puffs/puffs_node.c: revision 1.36
sys/miscfs/overlay/overlay_vnops.c: revision 1.21
sys/fs/cd9660/cd9660_node.c: revision 1.34
sys/netinet/raw_ip.c: revision 1.146
sys/sys/mallocvar.h: revision 1.13
sys/miscfs/overlay/overlay_vfsops.c: revision 1.63
share/man/man9/malloc.9: revision 1.50
sys/netinet6/dest6.c: revision 1.18
sys/compat/linux/common/linux_uselib.c: revision 1.33
sys/compat/linux/common/linux_socket.c: revision 1.120
share/man/man9/malloc.9: revision 1.51
sys/netinet/tcp_subr.c: revision 1.257
sys/compat/linux/common/linux_socketcall.c: revision 1.45
sys/compat/linux/common/linux_fadvise64_64.c: revision 1.3
sys/compat/freebsd/freebsd_ipc.c: revision 1.17
sys/compat/linux/common/linux_misc_notalpha.c: revision 1.109
sys/compat/linux/arch/alpha/linux_pipe.c: revision 1.17
sys/netinet6/in6_pcb.c: revision 1.132
sys/netinet6/in6_ifattach.c: revision 1.94
sys/compat/svr4/svr4_exec_elf32.c: revision 1.15
sys/miscfs/nullfs/null_vfsops.c: revision 1.90
sys/fs/cd9660/cd9660_util.c: revision 1.12
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.48
sys/compat/freebsd/freebsd_exec_elf32.c: revision 1.20
sys/miscfs/procfs/procfs_vfsops.c: revision 1.94
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.28
sys/compat/linux/common/linux_sched.c: revision 1.67
sys/compat/linux/common/linux_exec_aout.c: revision 1.67
sys/compat/linux/common/linux_pipe.c: revision 1.67
sys/compat/linux/common/linux_llseek.c: revision 1.34
sys/compat/linux/arch/mips/linux_ptrace.c: revision 1.10
Do not uselessly include <sys/malloc.h>.
Cleanup:
- remove struct kmembuckets (dead)
- correctly deadify MALLOC_XX
- remove MALLOC_DEFINE_LIMIT and MALLOC_JUSTDEFINE_LIMIT (dead)
- remove malloc_roundup(), malloc_type_setlimit(), MALLOC_DEFINE_LIMIT()
and MALLOC_JUSTDEFINE_LIMIT() from man 9 malloc
New sentence, new line. Bump date for previous.
Obsolete malloc_roundup(9), malloc_type_setlimit(9) and MALLOC_DEFINE_LIMIT(9)
man pages.
 1.33.40.1 03-Dec-2017  jdolecek update from HEAD
 1.20 23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.19 07-Jul-2010  chs many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
- support new-style (NPTL) linux pthreads on all platforms.
clone() with CLONE_THREAD uses 1 process with many LWPs
instead of separate processes.
- move the contents of sys__lwp_setprivate() into a new
lwp_setprivate() and use that everywhere.
- update linux_release[] and linux32_release[] to "2.6.18".
- adjust placement of emul fork/exec/exit hooks as needed
and adjust other emul code to match.
- convert all struct emul definitions to use named initializers.
- change the pid allocator to allow multiple pids to refer to the same proc.
- remove a few fields from struct proc that are no longer needed.
- disable the non-functional "vdso" code in linux32/amd64,
glibc works fine without it.
- fix a race in the futex code where we could miss a wakeup after
a requeue operation.
- redo futex locking to be a little more efficient.
 1.18 28-Apr-2008  martin branches: 1.18.20; 1.18.22;
Remove clause 3 and 4 from TNF licenses
 1.17 04-Dec-2007  dsl branches: 1.17.12; 1.17.14; 1.17.16;
Remove all the __P
 1.16 10-May-2007  christos branches: 1.16.6; 1.16.8; 1.16.14; 1.16.16;
- linux uname -m on x86 returns i{3,4,5,6}86 make it so.
- delete the machine sysctl that never worked, and gc linux_machine.
 1.15 23-Aug-2006  manu branches: 1.15.8; 1.15.12; 1.15.14;
1) Complete Linux exit_group() emulation
Members of the thread group must die without reporting to the parent and
without going to zombie stage. We do that by reparenting to init before
catching a SIGKILL. The parent will not see the child death.

The thread group leader must report the exit status, even if it exits
because of another thread calling exit_group(). We do that by storing the
exit status in struct linux_emuldata_shared, and the exit hook has the
duty of setting struct proc's p_xstat for the thread group leader.

2) For exit/fork/exec hooks, move the NPTL specific code to separate functions
that are shared between COMPAT_LINUX and COMPAT_LINUX32

3) Fix LINUX_CLONE_PARENT_SETTID semantics
 1.14 11-Dec-2005  christos branches: 1.14.4; 1.14.8;
merge ktrace-lwp.
 1.13 05-Nov-2005  manu Instead of ifdef'ing __amd64__ all the Linux NPTL stuff, introduce an
ifdef LINUX_NPTL.
Also implement SETTLS flag to Linux clone()
 1.12 03-May-2005  manu branches: 1.12.2;
First work on COMPAT_LINUX/amd64
Process startup and dynamiclinking work, but processes hang due to
Linux arch_prctl(2) not being really supported yet.
 1.11 26-Mar-2004  drochner all ports define __HAVE_SIGINFO now, so remove the CPP conditionals
 1.10 26-Sep-2003  simonb Fix "constify sendsig/trapsignal" fallout for non-siginfo'd archs. Test
compiled on most architectures.
 1.9 25-Sep-2003  christos constify sendsig/trapsignal
 1.8 06-Sep-2003  christos SA_SIGINFO changes
 1.7 04-Jul-2002  thorpej branches: 1.7.6;
Add kernel support for having userland provide the signal trampoline:

* struct sigacts gets a new sigact_sigdesc structure, which has the
sigaction and the trampoline/version. Version 0 means "legacy kernel
provided trampoline". Other versions are coordinated with machine-
dependent code in libc.
* sigaction1() grows two more arguments -- the trampoline pointer and
the trampoline version.
* A new __sigaction_sigtramp() system call is provided to register a
trampoline along with a signal handler.
* The handler is no longer passed to sensig() functions. Instead,
sendsig() looks up the handler by peeking in the sigacts for the
process getting the signal (since it has to look in there for the
trampoline anyway).
* Native sendsig() functions now select the appropriate trampoline and
its arguments based on the trampoline version in the sigacts.

Changes to libc to use the new facility will be checked in later. Kernel
version not bumped; we will ride the 1.6C bump made recently.
 1.6 15-Feb-2002  christos branches: 1.6.8;
- add a real linux_sys___sysctl because the mib numbers are different.
implement only the kernel version getting entries.
- make the signal conversion functions consistent; dest is arg 1.
- make linux_fakedev deal with block and char devices differently.
- add linux_sys_ugetrlimit, and flesh out the regular get/setrlimit so
that they work properly.
- add linux_mmap2 [untested].
- bump kernel to 2.4.18, and make the date be valentine's day :-)
- linux_sys_*stat64 family was totally busted. Fix it.

tested only on i386.

Status:
gdb, telnet, work
jdk-1.4.0 extractor works, jdk still coredumps.

christos
 1.5 14-Jan-2002  bjh21 Crude first cut at ARMLinux binary compatibility. Successfully runs
"/emul/linux/bin/echo hello, world", dynamically linked.
 1.4 22-Sep-2001  manu Enable Mips Linux emulation in header files
 1.3 19-Jan-2001  manu branches: 1.3.2; 1.3.4; 1.3.6;
Added Linux compatibility support for powerpc ports
 1.2 15-Dec-1998  itohy branches: 1.2.8;
Added linux compat support on m68k ports.
 1.1 03-Oct-1998  christos Forgot those two.
 1.2.8.1 11-Feb-2001  bouyer Sync with HEAD.
 1.3.6.1 01-Oct-2001  fvdl Catch up with -current.
 1.3.4.4 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.3.4.3 16-Mar-2002  jdolecek Catch up with -current.
 1.3.4.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.3.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.3.2.3 01-Aug-2002  nathanw Catch up to -current.
 1.3.2.2 28-Feb-2002  nathanw Catch up to -current.
 1.3.2.1 26-Sep-2001  nathanw Catch up to -current.
Again.
 1.6.8.1 15-Jul-2002  gehenna catch up with -current.
 1.7.6.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.7.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.7.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.7.6.1 03-Aug-2004  skrll Sync with HEAD
 1.12.2.4 07-Dec-2007  yamt sync with head
 1.12.2.3 03-Sep-2007  yamt sync with head.
 1.12.2.2 30-Dec-2006  yamt sync with head.
 1.12.2.1 21-Jun-2006  yamt sync with head.
 1.14.8.1 03-Sep-2006  yamt sync with head.
 1.14.4.1 09-Sep-2006  rpaulo sync with head
 1.15.14.1 11-Jul-2007  mjf Sync with head.
 1.15.12.1 27-May-2007  ad Sync with head.
 1.15.8.1 17-May-2007  yamt sync with head.
 1.16.16.1 08-Dec-2007  ad Sync with head.
 1.16.14.1 08-Dec-2007  mjf Sync with HEAD.
 1.16.8.1 09-Jan-2008  matt sync with HEAD
 1.16.6.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.17.16.2 11-Aug-2010  yamt sync with head.
 1.17.16.1 16-May-2008  yamt sync with head.
 1.17.14.1 18-May-2008  yamt sync with head.
 1.17.12.1 02-Jun-2008  mjf Sync with HEAD.
 1.18.22.1 05-Mar-2011  rmind sync with head
 1.18.20.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.267 01-Oct-2024  riastradh sys/compat/linux/common: Nix trailing whitespace, and one blank line.

No functional change intended.
 1.266 29-Sep-2024  christos move clone3 to linux_sched.c and make it compile (need to fix XXX comments)
 1.265 28-Sep-2024  christos Linux GSoC-2024: renameat2, clone3, sync_file_range, syncfs (Shivraj Jamgade)
 1.264 29-Jun-2024  christos branches: 1.264.2;
From gsoc 2024: Implement faccessat2 and getcpu (Shivraz)
 1.263 10-Feb-2024  andvar Fix various typos in comments, log messages and documentation.
 1.262 18-Aug-2023  christos Add linux waitid(2) from GSoC 2023 (Theodore Preduta)
 1.261 30-Jul-2023  christos Add EPOLL_CLOEXEC (Theodore Preduta)
 1.260 29-Jul-2023  christos Add/fix statx, readahead, close_range. From GSoC 2023 by Theodore Preduta
 1.259 29-Jul-2023  rin compat/linux: aarch64 does not have epoll_create(2) nor epoll_wait(2)

Note that for Linux, new architectures like arm64 use MI system call
table in include/uapi/asm-generic/unistd.h, instead of MD syscall.tbl.

XXX
Too many ifdef's like this. We should be smarter...
 1.258 28-Jul-2023  christos Add epoll(2) from Theodore Preduta as part of GSoC 2023
 1.257 10-Jul-2023  christos Add memfd_create(2) from GSoC 2023 by Theodore Preduta
 1.256 02-Dec-2021  ryo add prlimit64(2) syscall to COMPAT_LINUX and COMPAT_LINUX32
 1.255 25-Nov-2021  ryo add support COMPAT_LINUX32 for aarch64
 1.254 23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.253 20-Sep-2021  thorpej Add the eventfd system calls to COMPAT_LINUX and COMPAT_LINUX32.
 1.252 07-Sep-2021  riastradh sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.251 11-Jun-2020  ad branches: 1.251.2;
Counter tweaks:

- Don't need to count anonpages+filepages any more; clean+unknown+dirty for
each kind of page can be summed to get the totals.

- Track the number of free pages with a counter so that it's one less thing
for the allocator to do, which opens up further options there.

- Remove cpu_count_sync_one(). It has no users and doesn't save a whole lot.
For the cheap option, give cpu_count_sync() a boolean parameter indicating
that a cached value is okay, and rate limit the updates for cached values
to hz.
 1.250 11-Jun-2020  ad uvm_availmem(): give it a boolean argument to specify whether a recent
cached value will do, or if the very latest total must be fetched. It can
be called thousands of times a second and fetching the totals impacts not
only the calling LWP but other CPUs doing unrelated activity in the VM
system.
 1.249 03-May-2020  thorpej Always clear FUTEX_PRIVATE_FLAG for Linux processes. NetBSD-native futexes
exist in different namespace depending on FUTEX_PRIVATE_FLAG. This appears
not to be the case in Linux, and some futex users will mix private and non-
private ops on the same futex object. Provide a convenience wrapper that
puts this logic in one place witn a comment explaining why.

While here, move the Linux futex wrapper out of its own file and plop
it in linux_misc.c, which is where it lives in the linux32 module.
 1.248 19-Apr-2020  thorpej - Only increment nprocs when we're creating a new process, not just
when allocating a PID.
- Per above, proc_free_pid() no longer decrements nprocs. It's now done
in proc_free() right after proc_free_pid().
- Ensure nprocs is accessed using atomics everywhere.
 1.247 31-Dec-2019  ad branches: 1.247.6;
Rename uvm_free() -> uvm_availmem().
 1.246 21-Dec-2019  ad uvmexp.free -> uvm_free()
 1.245 20-Sep-2019  kamil Avoid signed integer overflow when convering linux timeval to timespec

Linux accepts garbage as timeout and attempts to set it to something
meaningful. Instead of checking for valid ranges of usec, just convert
the type safely, regardless of what is inside it.
 1.244 24-Aug-2019  maxv I don't see the point in having this useless printf, but add a '\n' to it,
so that it at least displays useless stuff correctly.
 1.243 23-Aug-2019  maxv Fix info leaks in sysinfo().
 1.242 23-Aug-2019  maxv Fix info leaks.
 1.241 23-Aug-2019  maxv Fix info leaks.
 1.240 03-Sep-2018  riastradh branches: 1.240.4;
Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.239 28-Jul-2017  riastradh branches: 1.239.2; 1.239.4;
Fail, don't panic, on bad dirents from file system.

Controllable via puffs from userland.

From Ilja Van Sprundel.
 1.238 06-May-2017  joerg branches: 1.238.2;
Extend the mmap(2) interface to allow requesting protections for later
use with mprotect(2), but without enabling them immediately.

Extend the mremap(2) interface to allow duplicating mappings, i.e.
create a second range of virtual addresses references the same physical
pages. Duplicated mappings can have different effective protections.

Adjust PAX mprotect logic to disallow effective protections of W&X, but
allow one mapping W and another X protections. This obsoletes using
temporary files for purposes like JIT.

Adjust PAX logic for mmap(2) and mprotect(2) to fail if W&X is requested
and not silently drop the X protection.

Improve test cases to ensure correct operation of the changed
interfaces.
 1.237 28-Jan-2017  christos branches: 1.237.4;
copy the terminating NUL (njoly)
 1.236 13-Jan-2017  christos branches: 1.236.2;
no namlen on linux
 1.235 13-Jan-2017  christos convert strcpy to a bounded copy to avoid compiler warnings, although the
reclen test prevents overflow.
 1.234 02-Jan-2017  manu Add pselect6 Linux system call.
This lets Matlab R2016A run on NetBSD/amd64
 1.233 10-Nov-2016  christos GC WOPTSCHECKED
 1.232 31-Aug-2016  njoly Teach wait4 about WCONTINUED.
 1.231 14-Mar-2015  njoly branches: 1.231.2;
Support Linux MAP_LOCKED mmap flag.
 1.230 22-Nov-2014  njoly branches: 1.230.2;
Fix ppoll signature (int ->u_int)
 1.229 29-May-2014  njoly branches: 1.229.2; 1.229.4; 1.229.8;
For utimes(2), use compat_50_sys_utimes() instead of local version.
 1.228 18-Nov-2013  chs branches: 1.228.2;
implement the *at() syscalls.
bring the unimplemented syscall list up to date.
 1.227 10-Nov-2013  slp On linux_sys_getdents, insert d_type at the end of each record.
Fixes PR kern/47806.
 1.226 24-Sep-2013  njoly Add utimensat(2) for compat linux.
 1.225 15-Sep-2013  njoly Make alpha use linux_sys_utimes() just like other archs.
 1.224 11-Aug-2013  pooka Allow to build in envs without USRSTACK (namely, rump kernels on powerpc).
TODO: all of the m*() calls are by definition incompatible with rump
kernels; including them is no great damage, but they're not useful either.
 1.223 15-Apr-2013  christos branches: 1.223.4;
alpha uses standard utimes.
 1.222 09-Apr-2013  pooka Fix COMPAT_LINUX32.
 1.221 08-Apr-2013  pooka support utimes on non-alpha linux platforms
 1.220 19-Sep-2012  pooka emulate ppoll which is essentially our pollts
 1.219 14-Oct-2011  hannken branches: 1.219.2; 1.219.8; 1.219.12; 1.219.14; 1.219.16;
Change the vnode locking protocol of VOP_GETATTR() to request at least
a shared lock. Make all calls outside of file systems respect it.

The calls from file systems need review.

No objections from tech-kern.
 1.218 02-Nov-2010  chs personality() now interprets its parameter as having
the base personality type in the low byte and
various flags in the upper bytes. for now just mask off
the flags to make sure the base type is one we accept.
store the current personality in the emuldata so that
we can return the expected value for PER_QUERY.
 1.217 11-Sep-2010  chs recent versions of linux (which we now claim to be) supply a BSD-style
d_type value in getdents() results, after the d_name field.
make our emulation do the same. fixes part of PR 43695.
 1.216 07-Jul-2010  chs many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
- support new-style (NPTL) linux pthreads on all platforms.
clone() with CLONE_THREAD uses 1 process with many LWPs
instead of separate processes.
- move the contents of sys__lwp_setprivate() into a new
lwp_setprivate() and use that everywhere.
- update linux_release[] and linux32_release[] to "2.6.18".
- adjust placement of emul fork/exec/exit hooks as needed
and adjust other emul code to match.
- convert all struct emul definitions to use named initializers.
- change the pid allocator to allow multiple pids to refer to the same proc.
- remove a few fields from struct proc that are no longer needed.
- disable the non-functional "vdso" code in linux32/amd64,
glibc works fine without it.
- fix a race in the futex code where we could miss a wakeup after
a requeue operation.
- redo futex locking to be a little more efficient.
 1.215 24-Jun-2010  hannken Clean up vnode lock operations pass 2:

VOP_UNLOCK(vp, flags) -> VOP_UNLOCK(vp): Remove the unneeded flags argument.

Welcome to 5.99.32.

Discussed on tech-kern.
 1.214 03-Mar-2010  he branches: 1.214.2;
When implementing "read directory", when there are too many empty entries
in a row, and we need to try to read the next block, and have passed a
non-NULL cookie pointer to VOP_READDIR, ensure that we free the cookie
buffer before re-doing VOP_READDIR, so that we don't leak memory.
This fix is similar to nfs_serv.c revisions 1.115 + 1.124.

This should fix the long-standing problem observed by e.g. using Linux-
emulated programs to take backup of servers, which is one of the problems
which were reported in PR#42661.

Thanks to pooka@ for the hints for traversing the VOP* layer.
 1.213 05-Dec-2009  pooka branches: 1.213.2;
Remove the portalfs kernel file system driver. Replace mount_portal(8)
with a version based on puffs. User functionality remains the same.
 1.212 24-Nov-2009  njoly Update personality(2) to match Linux definition where the argument is an
unsigned long.
 1.211 11-Nov-2009  rmind - selcommon/pollcommon: drop redundant l argument.
- Use cached curlwp->l_fd, instead of p->p_fd.
- Inline selscan/pollscan.
 1.210 04-Nov-2009  rmind do_sys_wait(): fix previous by checking for ru != NULL. Noticed by
Onno van der Linden. Also, remove redundant arguments (seems that
was_zombie was not used since rev 1.177 ?).
 1.209 22-Jul-2009  njoly Make compat linux/linux32 getdents(2) fail with ENOTDIR instead of
EINVAL when file descriptor does not refer to a directory.
 1.208 15-May-2009  pooka pad -> PAD
 1.207 29-Mar-2009  christos Move the internal poll/select related API's to use timespec instead
of timeval (rides the uvm bump).
 1.206 14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.205 19-Jan-2009  njoly branches: 1.205.2;
Small personality(2) update.
- Allow querying current personality.
- Use symbolic names instead of magic values.
 1.204 17-Jan-2009  njoly Convert linux/linux32 wait(4) to use a compat50 rusage structure.
 1.203 11-Jan-2009  christos merge christos-time_t
 1.202 12-Nov-2008  ad Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.
 1.201 24-Jun-2008  ad branches: 1.201.2; 1.201.4; 1.201.6; 1.201.10;
Replace references to getsock/getvnode.
 1.200 24-Jun-2008  gmcgarry ioctl commands are defined unsigned long, so cast cmd to unsigned long before comparison.
 1.199 28-May-2008  njoly branches: 1.199.2;
Add LINUX_TMPFS_SUPER_MAGIC, and map it to our tmpfs.
This makes sem_open/sem_unlink (POSIX named semaphores) work under
NPTL emulation.
 1.198 28-Apr-2008  martin branches: 1.198.2;
Remove clause 3 and 4 from TNF licenses
 1.197 24-Apr-2008  ad branches: 1.197.2;
Merge proc::p_mutex and proc::p_smutex into a single adaptive mutex, since
we no longer need to guard against access from hardware interrupt handlers.

Additionally, if cloning a process with CLONE_SIGHAND, arrange to have the
child process share the parent's lock so that signal state may be kept in
sync. Partially addresses PR kern/37437.
 1.196 23-Apr-2008  ad Fix locking.
 1.195 04-Apr-2008  njoly branches: 1.195.2;
Cleanup. Kill linux_sys_msync and use sys___msync13 instead.
No functional changes expected.
 1.194 21-Mar-2008  ad branches: 1.194.2;
Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
 1.193 15-Jan-2008  njoly branches: 1.193.6;
compat linux (and linux32) uid16 functions cleanup and fixes.

- Move uid16 functions to their own file linux_uid16.c, included by
needed archs (arm, i386 and m68k).
- Add new MI types linux_{u,g}id16_t.
- Add macros to handle linux_uid16_t and uid_t conversions.
- Add linux_sys_getres{uid,gid}16 syscalls, to fix an overflow with
bad sizes given to copyout when linux_sys_getres{uid,gid} are used.
- Update arm syscall table to use more uid16 functions.
 1.192 24-Dec-2007  njoly Kill unneeded linux_sys_getpgid and use native sys_getpgid instead.
 1.191 21-Dec-2007  njoly - Fix setfsuid to return uid on success.
- Replace getfsuid, which never existed on Linux, by correct setfsgid
syscall.

ok by christos and dsl.
 1.190 20-Dec-2007  dsl Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.189 08-Dec-2007  dsl branches: 1.189.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.188 04-Dec-2007  dsl Remove all the __P
 1.187 26-Nov-2007  pooka branches: 1.187.2;
Remove the "struct lwp *" argument from all VFS and VOP interfaces.
The general trend is to remove it from all kernel interfaces and
this is a start. In case the calling lwp is desired, curlwp should
be used.

quick consensus on tech-kern
 1.186 08-Nov-2007  njoly Replace strncpy with strlcpy in compat linux and linux32 uname,
old_uname and oldold_uname syscalls to ensure that all *utsname fields
are always NUL terminated.
 1.185 07-Nov-2007  njoly Remove remaining 64-bit compat linux syscalls linux_sys_xxx() (except
for ones without arguments), and replace them by their 32-bit
equivalent linux32_sys_xxxx().
 1.184 19-Oct-2007  njoly branches: 1.184.2;
Add compat_linux and exec_linux_elf lkm support for amd64:
- Add needed COMPAT_OSSAUDIO to GENERIC.
- Add missing includes needed by linux_syscallargs.h.
- Add lkm building.
 1.183 17-Jul-2007  joerg branches: 1.183.6; 1.183.8; 1.183.12;
Add native mremap system call based on the UVM implementation for
Linux compat. Add code to enforce alignment of the new location.
Special thanks to wizd for helping with the man page.
 1.182 04-Jul-2007  dsl It seems that min(16,16) isn't a compile time constant.
So don't bother limiting the local arrays to NGROUPS, just use 16.
 1.181 30-Jun-2007  dsl Match updates to kauth_cred_set/getgroups.
 1.180 23-Jun-2007  dsl Simplify code to get/set 16bit group lists.
Cloned from ibcs2 copy (maybe I should have worked out somewhere to put this
as common code...)
 1.179 23-Jun-2007  dsl These now need sys/prot.h
 1.178 04-Jun-2007  dsl Fix select() without a timeout parameter.
 1.177 02-Jun-2007  dsl Call selcommon() directly instead of using the stackgap...
 1.176 12-May-2007  dsl There is no need to use the stackgap for get/setrlimit.
 1.175 10-May-2007  christos - linux uname -m on x86 returns i{3,4,5,6}86 make it so.
- delete the machine sysctl that never worked, and gc linux_machine.
 1.174 08-May-2007  dsl Remember to copy the rusage to the users buffer.
 1.173 07-May-2007  dsl Split sys_wait4() so that compat code can fiddle with the returned 'status'
and 'rusage' without having to copy data to/from stackgap buffers.
The old split (find_stopped_child) could be removed.
amd64 seems to run netbsd32, linux and linux32 emulations. sparc64 compiles.
 1.172 30-Apr-2007  dsl Rework compat stat() and statvfs() code so that it no longer uses the stackgap.
 1.171 22-Apr-2007  dsl Change the way that emulations locate files within the emulation root to
avoid having to allocate space in the 'stackgap'
- which is very LWP unfriendly.
The additional code for non-emulation namei() is trivial, the reduction for
the emulations is massive.
The vnode for a processes emulation root is saved in the cwdi structure
during process exec.
If the emulation root the TRYEMULROOT flag are set, namei() will do an initial
search for absolute pathnames in the emulation root, if that fails it will
retry from the normal root.
".." at the emulation root will always go to the real root, even in the middle
of paths and when expanding symlinks.
Absolute symlinks found using absolute paths in the emulation root will be
relative to the emulation root (so /usr/lib/xxx.so -> /lib/xxx.so links
inside the emulation root don't need changing).
If the root of the emulation would be returned (for an emulation lookup), then
the real root is returned instead (matching the behaviour of emul_lookup,
but being a cheap comparison here) so that programs that scan "../.."
looking for the root dircetory don't loop forever.
The target for symbolic links is no longer mangled (it used to get the
CHECK_ALT_xxx() treatment, so could get /emul/xxx prepended).
CHECK_ALT_xxx() are no more. Most of the change is deleting them, and adding
TRYEMULROOT to the flags to NDINIT().
A lot of the emulation system call stubs could now be deleted.
 1.170 11-Apr-2007  njoly - Add compat amd64 linux32 statfs support, adapted from PR/35956.
- Move bsd_to_linux_statfs() function to its own file to be shared
between both linux compats.

ok by manu.
 1.169 23-Mar-2007  mrg implement emul.linux.kern.machine, which can be set to "i686", like
some applications seem to want.
 1.168 14-Mar-2007  njoly branches: 1.168.2;
Fix compat linux statfs/fstatfs syscalls on amd64.
- Do not use statfs64/fstatfs64 as they have an extra size argument.
- Add full 64bit linux struct statfs support.

ok by manu
 1.167 04-Mar-2007  christos branches: 1.167.2; 1.167.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.166 09-Feb-2007  ad branches: 1.166.2;
Merge newlock2 to head.
 1.165 16-Nov-2006  christos branches: 1.165.2;
__unused removal on arguments; approved by core.
 1.164 14-Nov-2006  elad Clean some KAUTH_GENERIC_ISSUSER usage in compat code.
 1.163 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.162 13-Sep-2006  manu branches: 1.162.2;
Jumbo COMPAT_LINUX/COMPAT_LINUX32 bugfix, with the help of Nicolas Joly
- Fix shmat return value on amd64: it uses no black magic with retval[0]
- Fix integer overflows in sysinfo
- Implement sysinfo, mmap2, sched_getparam, sched_getscheduler, mremap,
and madvise in COMPAT_LINUX32
- Fix improper types used in setgroups16/getgroups16
- Implement mmap2 for COMPAT_LINUX32
- Ifdef debug messages by DEBUG_LINUX
 1.161 01-Sep-2006  matt branches: 1.161.2;
When calling PTRACE from an LKM, use sysent[SYS_ptrace].sy_call in case
the sys_ptrace symbol isn't present.
 1.160 30-Aug-2006  he Allow this to build as an LKM by testing for _KERNEL_OPT before
including opt_ptrace.h.
 1.159 30-Aug-2006  matt Update to deal with options PTRACE
 1.158 23-Jul-2006  ad Use the LWP cached credentials where sane.
 1.157 13-Jun-2006  christos change 20 to NZERO; pointed out by mrg.
 1.156 10-Jun-2006  christos PR/33671: Nicolas Joly: Add a getpriority syscall to account for the fact
that the linux getpriority is off by 20.
 1.155 07-Jun-2006  kardel merge FreeBSD timecounters from branch simonb-timecounters
- struct timeval time is gone
time.tv_sec -> time_second
- struct timeval mono_time is gone
mono_time.tv_sec -> time_uptime
- access to time via
{get,}{micro,nano,bin}time()
get* versions are fast but less precise
- support NTP nanokernel implementation (NTP API 4)
- further reading:
Timecounter Paper: http://phk.freebsd.dk/pubs/timecounter.pdf
NTP Nanokernel: http://www.eecis.udel.edu/~mills/ntp/html/kern.html
 1.154 14-May-2006  elad branches: 1.154.2;
integrate kauth.
 1.153 10-May-2006  yamt don't allocate struct statvfs on stack as it's too large.
while i'm here, remove some unnecessary casts.
 1.152 17-Mar-2006  erh Fix Coverity issues 2321 and 2320. Make sure to free allocated memory.
 1.151 01-Mar-2006  yamt branches: 1.151.2; 1.151.4; 1.151.6;
merge yamt-uio_vmspace branch.

- use vmspace rather than proc or lwp where appropriate.
the latter is more natural to specify an address space.
(and less likely to be abused for random purposes.)
- fix a swdmover race.
 1.150 09-Feb-2006  manu Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.149 31-Jan-2006  yamt branches: 1.149.2; 1.149.4;
linux_sys_mremap: validate flags.
 1.148 21-Jan-2006  yamt implement compat_linux mremap.
 1.147 11-Dec-2005  christos branches: 1.147.2;
merge ktrace-lwp.
 1.146 30-Nov-2005  rpaulo Remove the debugging printf left in linux_sys_getrlimit().
 1.145 23-Nov-2005  manu Remove a debug printf
 1.144 23-Nov-2005  manu - Add Linux tkill and tgkill (partial emulation).
- Fix getrlimit on amd64
 1.143 07-Nov-2005  manu branches: 1.143.2;
Include linux_machdep.h so that LINUX_UNAME_ARCH ges defined (fixes
uname emulation)
 1.142 04-Nov-2005  manu Fix machine name returned by uname on Linux
 1.141 30-Oct-2005  chs add support for the linux PROT_GROWS{DOWN,UP} mprotect() flags.
fixes PR 30008.
 1.140 10-Sep-2005  jmmv branches: 1.140.2;
Initial addition of tmpfs, an efficient memory file-system. This project
was developed as part of Google's Summer of Code 2005 program. This
change adds the kernel code, the mount_tmpfs utility, a regression test
suite and does all other related changes to integrate these.

The file-system is still *experimental*. Therefore, it is disabled by
default in all kernels. However, as typically done, a commented-out
entry is added in them to ease its setup.

Note that I haven't commited the required mountd(8) changes to be able
to export tmpfs file-systems because NFS support is still very unstable
and because, before enabling it, I'd like to do some other changes.

OK'ed by my project mentor, William Studenmund (wrstuden@).
 1.139 02-Jun-2005  drochner branches: 1.139.2;
more cast-qual fallout
 1.138 29-May-2005  christos - sprinkle const.
- add XXXUNCONST to the emul_find() pbuf argument free'ing. XXX: this needs
an api change.
- avoid variable shadowing.
 1.137 03-May-2005  manu First work on COMPAT_LINUX/amd64
Process startup and dynamiclinking work, but processes hang due to
Linux arch_prctl(2) not being really supported yet.
 1.136 19-Apr-2005  christos PR/29696: Joel Carnat: NetBSD freezes when accessing smbfs mounted FS with
firefox/linux due to compat getdents() call assumption that all filesystems
support cookies.
 1.135 26-Feb-2005  perry branches: 1.135.2;
nuke trailing whitespace
 1.134 13-Nov-2004  christos branches: 1.134.4; 1.134.6;
Add ptyfs magic number and entry.
 1.133 07-Oct-2004  erh PR kern/27184: Have linux_sys_waitpid() call linux_sys_wait4() so the
supported options can't get out of sync. This add support for the
linux __WCLONE and __WALL options (NetBSD version: WALTSIG and WALLSIG)
Add a diagnostic check to see if the one unhandled option (__WNOTHREAD) is
specified.
This should prevent linux processes from losing their children and creating
tons of zombie processes.
 1.132 20-Sep-2004  jdolecek implement support for Linux statfs64() syscall - 64bit variant of statfs()
 1.131 19-Sep-2004  jdolecek Adjust struct statfs content to flag that the newer Linux kernel do
provide f_frsize. It cannot be actually used to GNU C statvfs() bug
in f_frsize != f_bsize case, so just keep pretending we don't support it.
Update comments and explain the situation in detail there.
 1.130 17-Sep-2004  skrll There's no need to pass a proc value when using UIO_SYSSPACE with
vn_rdwr(9) and uiomove(9).

OK'd by Jason Thorpe
 1.129 13-Sep-2004  jdolecek bsd_to_linux_statfs():
- filesystem size is expressed in number of fragments, not blocks;
this fixes computed filesystem sizes for Linux df(1) and other Linux
binaries using statfs(2) for filesystems, which use different value
for frament and block, such as FFS
- use FS f_namemax instead of always using MAXNAMLEN
 1.128 29-Aug-2004  jdolecek handle mmap() request with MAP_GROWSDOWN flag (request for stack-like
grow-down auto extend segment) by allocating segment sized at
current stack size limit, and offsetting requested/returned address
as required

due to how normal virtual memory management work, allocating the
full sized stack memory segment up-front actually requires exactly same
amount of VA space and physical memory as the Linux 'grow' scheme and the
'grow' scheme is quite a lot more difficult to use in applications correctly,
so it's not very apparent why Linux introduced this feature at all

this fixes Thomas Klausner's Heroes3 crash, and might also
fix PR 26687 by Jan Schaumann
 1.127 08-Aug-2004  jdolecek linux processes sharing VM space (via clone() call) must also
share same 'break' value used for brk()/sbrk(), otherwise application SIGSEGVs
quickly once different threads try to adjust data segment size

this fixes linux Mozilla crashes with SuSE 9.1 libraries, and possibly
other linux applications using real threads
 1.126 01-Aug-2004  jdolecek Linux returns ENOMEM (not EFAULT) if the address specified in mprotect()
is not part of process address space

this fixes Linux libgcc_s's stack executability setup
 1.125 21-Apr-2004  christos fix more statvfs1 fallout
 1.124 21-Apr-2004  christos s/statvfs/statvfs1/
 1.123 21-Apr-2004  christos Replace the statfs() family of system calls with statvfs().
Retain binary compatibility.
 1.122 04-Dec-2003  atatat branches: 1.122.2;
Dynamic sysctl.

Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.

Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.

All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.

PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
 1.121 29-Jun-2003  fvdl branches: 1.121.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.120 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.119 23-Jun-2003  christos PR/21948: Todd Vierling: Implement MAP_TRYFIXED for linux emulation.
 1.118 23-Jun-2003  christos PR/21937: Todd Vierling: Proper support for mmap2
 1.117 05-Mar-2003  dsl Use do_setresuid() to implement linux_sys_setresuid()
 1.116 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.115 16-Dec-2002  christos branches: 1.115.2;
Don't allow non-page-aligned offsets! So dumb. From Jason Ish, thanks.
 1.114 25-Nov-2002  thorpej Add ULL to a 64-bit integer constant.
 1.113 13-Nov-2002  jdolecek we now export information about CLK_TCK via ELF aux args, no need to
hardcode '100' for times(2) anymore; use 'hz' instead
 1.112 13-Nov-2002  jdolecek linux_sys_times(): if tms is NULL, just return the number of ticks since
boot, don't error out; this matches what Linux does

Fixes problem reported in kern/19027
 1.111 23-Sep-2002  simonb Put storage class first in "static const" declaration.
 1.110 20-Jun-2002  enami Don't copy from destination to destination.
 1.109 10-May-2002  tron branches: 1.109.2; 1.109.4;
Fix off by one error in check for size of field "d_off" in Linux
"dirent" structure.
 1.108 10-May-2002  tron Move implementation of linux_sys_getdents64() to source file for
Linux 64bit filesystem calls.
 1.107 10-Apr-2002  christos implement getdents64; my full java tree builds now.
 1.106 03-Apr-2002  fvdl Allocate the right size for the native gid_t array in setgroups16.
 1.105 31-Mar-2002  christos make signal array handling uniform, and put signal arrays in a separate
file. This is simular to errno array handling.
 1.104 22-Mar-2002  christos gc debugging printfs.
 1.103 22-Mar-2002  christos nuke mmap2, cleanup mmap, add mprotect
 1.102 16-Mar-2002  christos make the stackgap_{init,alloc} functions MP friendly (i.e. pass struct proc *
in, instead of using curproc). While there add an optional size argument to
stackgap_init.
 1.101 20-Feb-2002  christos proper statfs emulation...
 1.100 18-Feb-2002  christos Resolve alpha compile issues:
- bug with order in args in mask conversion md code.
- flags can be both int and long on the alpha. kludge around that, by not
passing pointers to the conversion function.
- something is wrong with the toolchain look at the void * cast in copyout().
- sa_restorer is in a different place on the aplha. Deal with that, by not
initializing it as before. XXX: this should be changed in the MD signal
definition.
 1.99 18-Feb-2002  jdolecek Back off previous partially - make linux_release[] back 2.0.38
and linux_version[] "#0 Sun Apr 1 11:11:11 MET 2000";". Add a BIG
WARNING MESSAGE so that people won't break things changing this.
 1.98 17-Feb-2002  rafal There is no linux_sys_ugetrlimit on mips, so don't try building it (XXX: adds
icky ifdefs)
 1.97 15-Feb-2002  christos - add a real linux_sys___sysctl because the mib numbers are different.
implement only the kernel version getting entries.
- make the signal conversion functions consistent; dest is arg 1.
- make linux_fakedev deal with block and char devices differently.
- add linux_sys_ugetrlimit, and flesh out the regular get/setrlimit so
that they work properly.
- add linux_mmap2 [untested].
- bump kernel to 2.4.18, and make the date be valentine's day :-)
- linux_sys_*stat64 family was totally busted. Fix it.

tested only on i386.

Status:
gdb, telnet, work
jdk-1.4.0 extractor works, jdk still coredumps.

christos
 1.96 09-Dec-2001  chs replace "vnode" and "vtext" with "file" and "exec" in uvmexp field names.
 1.95 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.94 08-Sep-2001  manu Removed a hack to make PowerPC mmap work. This could have side effects on
alpha and i386. It has been tested and works on i386.
 1.93 18-Jul-2001  thorpej branches: 1.93.2;
Add support for the __WALL wait4(2) flag.
 1.92 04-Jun-2001  manu branches: 1.92.2;
Fixes by Chuck Silvers to make ptrace PEEKTEXT more 64 bit friendy
 1.91 03-Jun-2001  manu added a double cast to build on alpha
 1.90 02-Jun-2001  jdolecek Slighly improve the PTRACE_CONT comment
 1.89 27-May-2001  manu Fixed the return value of ptrace for PEEKTEXT and PEEKDATA: return value must
be a pointer to data, which holds the result. Linux's glibc undo this odd
operation to bring the standard ptrace behavior to userland.
 1.88 20-May-2001  manu Added powerpc status in a comment
 1.87 30-Mar-2001  jdolecek Implement linux_sys_nosys() and use it instead of sys_nosys() for
unimplemented syscalls. Difference is that linux_sys_nosys() doesn't
post SIGSYS to the process. Linux doesn't do that and thus glibc (and
probably other Linux code) doesn't deal with SIGSYS, even through it
generally contains fallback code for ENOSYS case.

This also addresses port-i386/12503, though the issue was already discussed
earlier.
 1.86 16-Mar-2001  manu Removed an unused oldbrk variable in linux_sys_brk()
 1.85 15-Mar-2001  manu Made linux_sys_brk() cleaner (no functionnality change)
 1.84 15-Mar-2001  manu Fixed brk() emulation. We now keep track of the processes' idea of the
break value. See http://mail-index.netbsd.org/tech-kern/2001/03/15/0000.html
for more details.
 1.83 05-Jan-2001  fvdl branches: 1.83.2;
Set Linux version to 2.0.38 for now, until the clone + "real time signal"
problems are fixed.
 1.82 29-Dec-2000  fvdl Hardcode what the linux uname() calls return (Linux 2.2.5 is the current
value). A few major applications check for this (like VMware), and
there is no other way to trick them. Needs a more generic solution
eventually.
 1.81 27-Dec-2000  fvdl Use CHECK_ALT_* for chown and lchown, missed in my previous commit.
Get *id16 calls right; most can be passed through directly, but
some need the 16->32 check for -1 values.
 1.80 22-Dec-2000  jdolecek split off thread specific stuff from struct sigacts to struct sigctx, leaving
only signal handler array sharable between threads
move other random signal stuff from struct proc to struct sigctx

This addresses kern/10981 by Matthew Orgass.
 1.79 21-Dec-2000  thorpej Only include the 16-bit uid/gid stuff if on i386 or m68k. This is a
little ugly, but hey, so is Linux.
 1.78 18-Dec-2000  fvdl Add seperate entries for 16 bit uid/gid calls, so that border cases
like 0xffff can be handled better (not done yet).
 1.77 13-Dec-2000  augustss Implement sysinfo.
 1.76 02-Dec-2000  jdolecek add emulation of linux swapoff(2)
 1.75 01-Dec-2000  jdolecek implement linux_sys_setdomainname()/linux_sys_swapon(), using code
from compat_09_sys_setdomainname()/compat_12_sys_swapon().
 1.74 01-Dec-2000  jdolecek add e_path (emulation path) to struct emul, which replaces emulation-specific
*_emul_path variables

change macros CHECK_ALT_{CREAT|EXIST} to use that, 'root' doesn't need
to be passed explicitly any more and *_CHECK_ALT_{CREAT|EXIST} are removed
change explicit emul_find() calls in probe functions to get the emulation
path from the checked exec switch entry's emulation

remove no longer needed header files

add e_flags and e_syscall to struct emul; these are unsed and empty for now
 1.73 01-Nov-2000  jdolecek Linux LINUX_PTRACE_SINGLESTEP operation should have same
semantics as NetBSD's PT_STEP, so support it on archs which have it
under Linux, ptrace(PTRACE_CONT, pid, 0, 0) is used to continue the
traced process where it left off; adjust addr to (caddr_t) 1 so that
the NetBSD syscall code DTRT
some sligh const poisoning
 1.72 07-Sep-2000  fvdl In the case of MAP_ANON, Linux mmap ignores the fd argument completely.
So, always pass -1 to the native syscall in that case, to avoid
errors if a Linux app doesn't specify -1 as the fd (which some do).
 1.71 29-Jun-2000  mrg remove include of <vm/vm.h>
 1.70 26-Jun-2000  mrg remove redundant vm includes.
 1.69 30-Mar-2000  augustss branches: 1.69.4;
Kill register declarations.
 1.68 28-Mar-2000  simonb Centralise the declarations of cpu_model, machine, machine_arch,
osrelease, and ostype and remove "extern char foo[];" (for hostname
and domainname too).

Also delete redunctant decl of boottime in kern_info_43.c.
 1.67 18-Mar-2000  erh Add linux_sys_reboot.
 1.66 18-Mar-2000  erh Adjust linux_sys_ptrace_args to reflect inconsistencies across ports. Temporarily ifndef alpha around getfsuid since Linux/alpha doesn't seem to have it.
 1.65 13-Mar-2000  soren Fix doubled 'the's in comments.
 1.64 17-Feb-2000  abs Update patch from Witold Wnuk in PR 9335 to solve potential security
issue noted by tls.
 1.63 03-Feb-2000  abs Add Linux fsuid system calls - from Witold J. Wnuk in PR kern/9335
 1.62 16-Dec-1999  tron Move MI parts of ptrace(2) emulation to "linux_misc.c".
 1.61 05-Oct-1999  tron branches: 1.61.2; 1.61.8;
After linux_sys_clone() has been moved to "linux_sched.c" we don't need
to include "linux_sched.h" any more.
 1.60 04-Oct-1999  tron Add emulation for scheduler related syscalls. Although they are dummies
even under Linux the posix thread library for "glibc2" requires them.
 1.59 15-Jul-1999  thorpej A few things to make the Linux clone(2) emulation work a bit better:
- When the exit signal is specified to be 0, don't just assume they
meant SIGCHLD. In the Linux world, this appears to mean "don't deliver
an exit signal at all".
- Simplify P_EXITSIG(); don't check against initproc here, just change
the exit signal to SIGCHLD if reparenting to initproc.

A very simple clone(2) test program now works, and the MpegTV package
starts, but doesn't run properly yet (I believe there is a separate
bug which keeps it from working properly).
 1.58 17-May-1999  thorpej Oops, completely forgot to translate the exit signal in clone(2).
 1.57 14-May-1999  thorpej Emulate the Linux {get,set}resuid(2) system calls.
 1.56 13-May-1999  thorpej Emulate the Linux clone(2) system call.
 1.55 13-May-1999  thorpej Fully emulate the Linux wait4(2) system call, including the __WCLONE
flag (which is equivalent to our new WALTSIG).
 1.54 05-May-1999  thorpej Add "use counting" to file entries. When closing a file, and it's reference
count is 0, wait for use count to drain before finishing the close.

This is necessary in order for multiple processes to safely share file
descriptor tables.
 1.53 09-Feb-1999  christos branches: 1.53.2; 1.53.4;
const poisoning.
 1.52 16-Dec-1998  christos more defensive signal conversion, and fix a malloc sizeof(int) to sizeof(int *).
 1.51 04-Oct-1998  fvdl Fix pointer fuckup that made getdents() stop working.
 1.50 04-Oct-1998  fvdl Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.49 03-Oct-1998  christos Attempt to fix the mess.
 1.48 01-Oct-1998  perry Add braces to shut up egcs
 1.47 01-Oct-1998  erh Wheeee!: 8-way split of compat/linux/linux_misc.c into common code and multi-architechture functions.
 1.46 11-Sep-1998  mycroft Substantial signal handling changes:
* Increase the size of sigset_t to accomodate 128 signals -- adding new
versions of sys_setprocmask(), sys_sigaction(), sys_sigpending() and
sys_sigsuspend() to handle the changed arguments.
* Abstract the guts of sys_sigaltstack(), sys_setprocmask(), sys_sigaction(),
sys_sigpending() and sys_sigsuspend() into separate functions, and call them
from all the emulations rather than hard-coding everything. (Avoids uses
the stackgap crap for these system calls.)
* Add a new flag (p_checksig) to indicate that a process may have signals
pending and userret() needs to do the full (slow) check.
* Eliminate SAS_ALTSTACK; it's exactly the inverse of SS_DISABLE.
* Correct emulation bugs with restoring SS_ONSTACK.
* Make the signal mask in the sigcontext always use the emulated mask format.
* Store signals internally in sigaction structures, rather than maintaining a
bunch of little sigsets for each SA_* bit.
* Keep track of where we put the signal trampoline, rather than figuring it out
in *_sendsig().
* Issue a warning when a non-emulated sigaction bit is observed.
* Add missing emulated signals, and a native SIGPWR (currently not used).
* Implement the `not reset when caught' semantics for relevant signals.

Note: Only code touched by the i386 port has been modified. Other ports and
emulations need to be updated.
 1.45 08-Sep-1998  rvb ufs_readdir no longer checks if vp->v_type != VDIR so
the individual emulated readdirs must check.
Since netbsd and freebsd return EINVAL for the error
and I don't know what the other platforms do, return
EINVAL for them too.
 1.44 18-Aug-1998  thorpej Add some braces to make egcs happy.
 1.43 07-Jul-1998  thorpej Oops, fix typo, pointed out by Urban Boquist <boquist@cs.chalmers.se>.
 1.42 02-Jul-1998  thorpej Implement the shrinking and no-change bits of the Linux mremap(2) system
call, provided by Urban Boquist <boquist@cs.chalmers.se> in PR #5693.

Add a comment about how one might implement the growing bit of mremap(2).
 1.41 24-Mar-1998  mycroft Fix typo in utime().
 1.40 03-Mar-1998  fvdl Only free cookiebuf when sure that the vop actually allocated it.
 1.39 01-Mar-1998  fvdl Merge with Lite2 + local changes
 1.38 20-Feb-1998  mycroft Linux's getsid(2) does in fact return a pid, not a pointer.
 1.37 14-Feb-1998  thorpej Add a comment clearly describing that Linux's getsid(2) differs from
the XPG4.2 definition in that it returns the kernel virtual address
of the session structure, rather than the process group ID of the
session leader.
 1.36 21-Oct-1997  fvdl branches: 1.36.2;
msync -> __msync13
 1.35 10-Oct-1997  fvdl Fix braino in my interpretation of the eof flag to VOP_READDIR.
 1.34 10-Oct-1997  mycroft Emulate mremap(2) by returning ENOMEM for now. This should be sufficient for
realloc(3) and other uses. From Matthias Scheler in PR 3920.
 1.33 10-Oct-1997  fvdl Signal error when getting a 64 bit offset cookie that can't be stored
in 32 bits. Provide an error message to the user, and return EINVAL.
Also, pay attention to the EOF flag from VOP_READDIR. Correct a
misspell in a panic message.
 1.32 04-Aug-1997  bouyer Fix "missing entries" bug when reading large directories: When reading a
directory and running out of space in the dest buffer, off should point to the
current entry (which was not saved) and not to the next.
I discovered this bug using linux and SunOS emulation over NFS, but seems to
affect other emulations as well.
 1.31 27-Jul-1997  augustss branches: 1.31.2;
Changes to the sudio system:
- It is now possible to handle devices that want "looping" DMA,
e.g. the SoundBlaster correctly. The WSS and SB drivers use this.
To do this several new methods were introduced in audio_hw_if.
- Different silence handling (forced by previous change).
- The audio driver can now be mmap()-ed, but due to problems in
the VM system only for writing for now.
- The OSS (Linux) audio emulation takes advantage of some of the
new features.
 1.30 07-Apr-1997  augustss Add Linux nice() syscall.
 1.29 10-Aug-1996  mycroft sys/dir.h -> sys/dirent.h
 1.28 23-Jun-1996  mycroft Catch up with setre[ug]id() changes.
 1.27 20-May-1996  fvdl branches: 1.27.4;
Update list of Linux syscalls and implement the ones that are likely to be
used and doable.
 1.26 04-Apr-1996  christos - Prototyping changes
- Fix bug that gcc -Wall found in linux_sys_getpgid()
 1.25 03-Apr-1996  mycroft Add explicit return types.
 1.24 18-Dec-1995  fvdl msync, readv and writev were recently added to the Linux kernel; add them
to the emulation as well.
 1.23 09-Dec-1995  mycroft We don't need a private version of fork() here any more.
 1.22 09-Oct-1995  mycroft Use cookies for directory offset, mostly from Greg Hudson.
 1.21 07-Oct-1995  mycroft Prefix names of system call implementation functions with `sys_'.
 1.20 19-Sep-1995  thorpej Make system calls conform to a standard prototype and bring those
prototypes into scope.
 1.19 13-Sep-1995  fvdl Update offset elsewhere in linux_getdents(); still emulate a bug in
Linux, but avoid endless loops.
 1.18 07-Sep-1995  fvdl Fix some bugs & typing problems.
 1.17 23-Aug-1995  fvdl Emulate some syscalls that appear in Linux 1.3: a select() with normal args,
getdents() and flock().
 1.16 21-Aug-1995  fvdl Check for status NULL argument in wait4 and waitpid. From PR #1392
by Thomas EberHardt.
 1.15 21-Aug-1995  mycroft Implement the old and older uname(2) calls.
 1.14 16-Aug-1995  mycroft If updating the timeval would make it negative, zero it instead.
 1.13 16-Aug-1995  mycroft Allow bogus timevals, per Linux.
 1.12 14-Aug-1995  mycroft Export bsd_to_linux_sig[], and use it.
 1.11 14-Aug-1995  mycroft Rearrange #includes.
 1.10 13-Aug-1995  mycroft Linux doesn't allow select(2) to be restarted.
 1.9 24-Jun-1995  christos Use compat_util.[ch].
 1.8 22-Jun-1995  fvdl * Changed to use generic ELF code from kern/exec_elf.c (which was taken
from the svr4 exec code plus the linux compat mods)
* Include file change
* Add multicast sockopts (from John Brezak)
 1.7 11-Jun-1995  fvdl Linux select() returns the amount of time left before a timeout would have
occured in the timeval structure. Emulate this behavior. Reported by
Theo de Raadt.
 1.6 11-Jun-1995  fvdl * Make Linux ELF binaries work. Lots of code duplication, but it will have to do
for now.
* Add a sanity check in linux_uselib
 1.5 10-Jun-1995  mycroft Rename the dirent fields to match Linux. Make sure the requested buffer
is no larger than MAXBSIZE.
 1.4 22-Mar-1995  mycroft Emulate the return value of times() better.
 1.3 21-Mar-1995  mycroft Update to use timer{add,sub}().
 1.2 05-Mar-1995  fvdl Added a few more system calls.
More consistent alternate root file semantics throughout.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.27.4.2 10-Dec-1996  mycroft From trunk:
sys/dir.h -> sys/dirent.h
 1.27.4.1 10-Dec-1996  mycroft From trunk:
Implement setre[ug]id() for real.
 1.31.2.2 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.31.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.36.2.1 08-May-1998  mycroft Pull up 1.41, per request of mycroft.
 1.53.4.2 02-Aug-1999  thorpej Update from trunk.
 1.53.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.53.2.1 15-Aug-2000  he Pull up revision 1.63 (requested by abs):
Enable basic versions of Linux fsuid calls.
 1.61.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.61.2.6 21-Apr-2001  bouyer Sync with HEAD
 1.61.2.5 27-Mar-2001  bouyer Sync with HEAD.
 1.61.2.4 05-Jan-2001  bouyer Sync with HEAD
 1.61.2.3 08-Dec-2000  bouyer Sync with HEAD.
 1.61.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.61.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.69.4.3 01-May-2001  he Pull up revision 1.87 (via patch, requested by jdolecek):
Make it possible to use a different function for unimplemented
syscalls than sys_nosys(), so that the Linux emulation can avoid
posting SIGSYS and instead just return ENOSYS.
 1.69.4.2 30-Mar-2001  he Pull up revisions 1.82-1.83 (requested by fvdl):
Add some required Linux emulation bits to support the Linux
version of VMware.
 1.69.4.1 11-Sep-2000  fvdl Pull up revision 1.72:
In the case of MAP_ANON, Linux mmap ignores the fd argument completely.
So, always pass -1 to the native syscall in that case, to avoid
errors if a Linux app doesn't specify -1 as the fd (which some do).

approved by thorpej
 1.83.2.21 19-Dec-2002  thorpej Sync with HEAD.
 1.83.2.20 11-Dec-2002  thorpej Sync with HEAD.
 1.83.2.19 18-Oct-2002  nathanw Catch up to -current.
 1.83.2.18 01-Aug-2002  nathanw Catch up to -current.
 1.83.2.17 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.83.2.16 08-Jul-2002  nathanw Whitespace.
 1.83.2.15 20-Jun-2002  nathanw Catch up to -current.
 1.83.2.14 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.83.2.13 17-Apr-2002  nathanw LWPify.
 1.83.2.12 17-Apr-2002  nathanw Catch up to -current.
 1.83.2.11 01-Apr-2002  nathanw LWPify linux_sys_mprotect().
 1.83.2.10 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.83.2.9 28-Feb-2002  nathanw LWPify linux_{set/get}rlimit(); move and LWPify linux_sysctl().
 1.83.2.8 28-Feb-2002  nathanw Catch up to -current.
 1.83.2.7 08-Jan-2002  nathanw Catch up to -current.
 1.83.2.6 14-Nov-2001  nathanw Catch up to -current.
 1.83.2.5 21-Sep-2001  nathanw Catch up to -current.
 1.83.2.4 24-Aug-2001  nathanw Catch up with -current.
 1.83.2.3 21-Jun-2001  nathanw Catch up to -current.
 1.83.2.2 09-Apr-2001  nathanw Catch up with -current.
 1.83.2.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.92.2.7 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.92.2.6 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.92.2.5 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.92.2.4 16-Mar-2002  jdolecek Catch up with -current.
 1.92.2.3 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.92.2.2 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.92.2.1 03-Aug-2001  lukem update to -current
 1.93.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.109.4.5 26-Oct-2003  jmc Pullup rev 1.119 (ticket #1428)

Implement MAP_TRYFIXED for linux emulation.
 1.109.4.4 22-Oct-2003  jmc Pullup rev 1.118 (via patch) (requested by tv in ticket #1427)

Proper support for mmap2
 1.109.4.3 22-Oct-2003  jmc Pullup rev 115 (requested by tv in ticket #1426)

Don't allow non-page-aligned offsets.
 1.109.4.2 12-Dec-2002  he Pull up revision 1.112 (requested by jdolecek in ticket #987):
Correct linux_sys_times(): if tms is NULL, just return the
number of ticks since boot instead of returning error; this
matches what Linux does. Fixes PR#19027.
 1.109.4.1 21-Jun-2002  lukem Pull up revision 1.110 (requested by enami in ticket #331):
Don't copy from destination to destination.

[Fixes setrlimit in linux emulation]
 1.109.2.1 15-Jul-2002  gehenna catch up with -current.
 1.115.2.1 18-Dec-2002  gmcgarry Merge pcred and ucred, and poolify. TBD: check backward compatibility
and factor-out some higher-level functionality.
 1.121.2.12 11-Dec-2005  christos Sync with head.
 1.121.2.11 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.121.2.10 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.121.2.9 14-Nov-2004  skrll Sync with HEAD.
 1.121.2.8 19-Oct-2004  skrll Sync with HEAD
 1.121.2.7 24-Sep-2004  skrll Sync with HEAD.
 1.121.2.6 21-Sep-2004  skrll Fix the sync with head I botched.
 1.121.2.5 18-Sep-2004  skrll Sync with HEAD.
 1.121.2.4 03-Sep-2004  skrll Sync with HEAD
 1.121.2.3 12-Aug-2004  skrll Sync with HEAD.
 1.121.2.2 03-Aug-2004  skrll Sync with HEAD
 1.121.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.122.2.4 12-Nov-2004  jmc Pullup rev 1.133 (requested by christos in ticket #950)

Prevent linux processes from losing their children and creating
tons of zombie processes.
 1.122.2.3 05-Sep-2004  tron Pull up revision 1.128 (requested by jdolecek in ticket #810):
handle mmap() request with MAP_GROWSDOWN flag (request for stack-like
grow-down auto extend segment) by allocating segment sized at
current stack size limit, and offsetting requested/returned address
as required
due to how normal virtual memory management work, allocating the
full sized stack memory segment up-front actually requires exactly same
amount of VA space and physical memory as the Linux 'grow' scheme and the
'grow' scheme is quite a lot more difficult to use in applications correctly,
so it's not very apparent why Linux introduced this feature at all
this fixes Thomas Klausner's Heroes3 crash, and might also
fix PR 26687 by Jan Schaumann
 1.122.2.2 15-Aug-2004  tron Pull up revision 1.127 (requested by jdolecek in ticket #762):
linux processes sharing VM space (via clone() call) must also
share same 'break' value used for brk()/sbrk(), otherwise application SIGSEGVs
quickly once different threads try to adjust data segment size
this fixes linux Mozilla crashes with SuSE 9.1 libraries, and possibly
other linux applications using real threads
 1.122.2.1 11-Aug-2004  jmc Pullup rev 1.126 (requested by jdolecek in ticket #740)

Linux returns ENOMEM (not EFAULT) if the address specified in mprotect()
is not part of process address space.
 1.134.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.134.4.1 29-Apr-2005  kent sync with -current
 1.135.2.2 01-Nov-2005  tron Pull up following revision(s) (requested by chs in ticket #924):
sys/compat/linux/common/linux_misc.c: revision 1.141
sys/compat/linux/common/linux_mmap.h: revision 1.17
add support for the linux PROT_GROWS{DOWN,UP} mprotect() flags.
fixes PR 30008.
 1.135.2.1 01-Oct-2005  tron Pull up following revision(s) (requested by christos in ticket #838):
sys/compat/svr4/svr4_misc.c: revision 1.112
sys/compat/ibcs2/ibcs2_misc.c: revision 1.74
sys/compat/linux/common/linux_misc.c: revision 1.136
sys/compat/irix/irix_dirent.c: revision 1.14
sys/compat/sunos/sunos_misc.c: revision 1.132
sys/compat/svr4_32/svr4_32_misc.c: revision 1.31
sys/compat/sunos32/sunos32_misc.c: revision 1.30
sys/compat/linux/common/linux_file64.c: revision 1.26
PR/29696: Joel Carnat: NetBSD freezes when accessing smbfs mounted FS with
firefox/linux due to compat getdents() call assumption that all filesystems
support cookies.
 1.139.2.9 24-Mar-2008  yamt sync with head.
 1.139.2.8 21-Jan-2008  yamt sync with head
 1.139.2.7 07-Dec-2007  yamt sync with head
 1.139.2.6 15-Nov-2007  yamt sync with head.
 1.139.2.5 27-Oct-2007  yamt sync with head.
 1.139.2.4 03-Sep-2007  yamt sync with head.
 1.139.2.3 26-Feb-2007  yamt sync with head.
 1.139.2.2 30-Dec-2006  yamt sync with head.
 1.139.2.1 21-Jun-2006  yamt sync with head.
 1.140.2.1 02-Nov-2005  yamt sync with head.
 1.143.2.1 29-Nov-2005  yamt sync with head.
 1.147.2.3 18-Feb-2006  yamt sync with head.
 1.147.2.2 01-Feb-2006  yamt sync with head.
 1.147.2.1 31-Dec-2005  yamt adapt some random parts of kernel to uio_vmspace.
 1.149.4.3 01-Jun-2006  kardel Sync with head.
 1.149.4.2 22-Apr-2006  simonb Sync with head.
 1.149.4.1 04-Feb-2006  simonb Adapt for timecounters: mostly use get*time() and use "time_second"
instead of "time.tv_sec".
 1.149.2.1 09-Sep-2006  rpaulo sync with head
 1.151.6.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.151.6.1 28-Mar-2006  tron Merge 2006-03-28 NetBSD-current into the "peter-altq" branch.
 1.151.4.6 11-May-2006  elad sync with head
 1.151.4.5 06-May-2006  christos - Move kauth_cred_t declaration to <sys/types.h>
- Cleanup struct ucred; forward declarations that are unused.
- Don't include <sys/kauth.h> in any header, but include it in the c files
that need it.

Approved by core.
 1.151.4.4 19-Apr-2006  elad sync with head.
 1.151.4.3 10-Mar-2006  elad generic_authorize() -> kauth_authorize_generic().
 1.151.4.2 08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.151.4.1 08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.151.2.6 14-Sep-2006  yamt sync with head.
 1.151.2.5 03-Sep-2006  yamt sync with head.
 1.151.2.4 11-Aug-2006  yamt sync with head
 1.151.2.3 26-Jun-2006  yamt sync with head.
 1.151.2.2 24-May-2006  yamt sync with head.
 1.151.2.1 01-Apr-2006  yamt sync with head.
 1.154.2.1 19-Jun-2006  chap Sync with head.
 1.161.2.4 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.161.2.3 29-Dec-2006  ad Checkpoint work in progress.
 1.161.2.2 18-Nov-2006  ad Sync with head.
 1.161.2.1 24-Oct-2006  ad - Redo LWP locking slightly and fix some races.
- Fix some locking botches.
- Make signal mask / stack per-proc for SA processes.
- Add _lwp_kill().
 1.162.2.2 10-Dec-2006  yamt sync with head.
 1.162.2.1 22-Oct-2006  yamt sync with head
 1.165.2.3 12-Jun-2010  riz Pull up following revision(s) (requested by he in ticket #1387):
sys/compat/svr4/svr4_misc.c: revision 1.149
sys/compat/linux/common/linux_misc.c: revision 1.214
sys/compat/common/vfs_syscalls_30.c: revision 1.31
sys/compat/sunos/sunos_misc.c: revision 1.166
sys/compat/linux/common/linux_file64.c: revision 1.50
sys/compat/svr4_32/svr4_32_misc.c: revision 1.68
sys/compat/ibcs2/ibcs2_misc.c: revision 1.110
sys/compat/linux32/common/linux32_dirent.c: revision 1.10
sys/compat/sunos32/sunos32_misc.c: revision 1.69
sys/compat/irix/irix_dirent.c: revision 1.24
sys/compat/osf1/osf1_file.c: revision 1.38
When implementing "read directory", when there are too many empty entries
in a row, and we need to try to read the next block, and have passed a
non-NULL cookie pointer to VOP_READDIR, ensure that we free the cookie
buffer before re-doing VOP_READDIR, so that we don't leak memory.
This fix is similar to nfs_serv.c revisions 1.115 + 1.124.
This should fix the long-standing problem observed by e.g. using Linux-
emulated programs to take backup of servers, which is one of the problems
which were reported in PR#42661.
Thanks to pooka@ for the hints for traversing the VOP* layer.
 1.165.2.2 20-Apr-2007  bouyer Pull up following revision(s) (requested by njoly in ticket #582):
sys/compat/linux32/common/linux32_types.h: revision 1.4 via patch
sys/compat/linux32/arch/amd64/syscalls.master: revision 1.14 via patch
sys/compat/linux/common/linux_statfs.h: revision 1.1 via patch
sys/compat/linux/common/linux_misc.c: revision 1.170 via patch
sys/compat/linux32/common/linux32_misc.c: revision 1.5 via patch
sys/compat/linux32/files.linux32: revision 1.4 via patch
- Add compat amd64 linux32 statfs support, adapted from PR/35956.
- Move bsd_to_linux_statfs() function to its own file to be shared
between both linux compats.
 1.165.2.1 20-Apr-2007  bouyer Pull up following revision(s) (requested by njoly in ticket #581):
sys/compat/linux/common/linux_misc.c: revision 1.168
sys/compat/linux/arch/amd64/syscalls.master: revision 1.18
sys/compat/linux/common/linux_types.h: revision 1.25
sys/compat/linux/arch/amd64/linux_machdep.h: revision 1.6
sys/compat/linux/common/linux_misc_notalpha.c: revision 1.87
Fix compat linux statfs/fstatfs syscalls on amd64.
- Do not use statfs64/fstatfs64 as they have an extra size argument.
- Add full 64bit linux struct statfs support.
 1.166.2.5 17-May-2007  yamt sync with head.
 1.166.2.4 07-May-2007  yamt sync with head.
 1.166.2.3 15-Apr-2007  yamt sync with head.
 1.166.2.2 24-Mar-2007  yamt sync with head.
 1.166.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.167.4.1 11-Jul-2007  mjf Sync with head.
 1.167.2.5 20-Aug-2007  ad Sync with HEAD.
 1.167.2.4 15-Jul-2007  ad Sync with head.
 1.167.2.3 09-Jun-2007  ad Sync with head.
 1.167.2.2 27-May-2007  ad Sync with head.
 1.167.2.1 10-Apr-2007  ad Sync with head.
 1.168.2.1 29-Mar-2007  reinoud Pullup to -current
 1.183.12.2 13-Nov-2007  bouyer Sync with HEAD
 1.183.12.1 25-Oct-2007  bouyer Sync with HEAD.
 1.183.8.4 23-Mar-2008  matt sync with HEAD
 1.183.8.3 09-Jan-2008  matt sync with HEAD
 1.183.8.2 08-Nov-2007  matt sync with -HEAD
 1.183.8.1 06-Nov-2007  matt sync with HEAD
 1.183.6.4 09-Dec-2007  jmcneill Sync with HEAD.
 1.183.6.3 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.183.6.2 11-Nov-2007  joerg Sync with HEAD.
 1.183.6.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.184.2.4 18-Feb-2008  mjf Sync with HEAD.
 1.184.2.3 27-Dec-2007  mjf Sync with HEAD.
 1.184.2.2 08-Dec-2007  mjf Sync with HEAD.
 1.184.2.1 19-Nov-2007  mjf Sync with HEAD.
 1.187.2.2 26-Dec-2007  ad Sync with head.
 1.187.2.1 08-Dec-2007  ad Sync with head.
 1.189.4.2 19-Jan-2008  bouyer Sync with HEAD
 1.189.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.193.6.4 17-Jan-2009  mjf Sync with HEAD.
 1.193.6.3 29-Jun-2008  mjf Sync with HEAD.
 1.193.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.193.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.194.2.3 20-Nov-2008  christos merge with head.
 1.194.2.2 01-Nov-2008  christos Sync with head.
 1.194.2.1 29-Mar-2008  christos Welcome to the time_t=long long dev_t=uint64_t branch.
 1.195.2.2 04-Jun-2008  yamt sync with head
 1.195.2.1 18-May-2008  yamt sync with head.
 1.197.2.7 09-Oct-2010  yamt sync with head
 1.197.2.6 11-Aug-2010  yamt sync with head.
 1.197.2.5 11-Mar-2010  yamt sync with head
 1.197.2.4 19-Aug-2009  yamt sync with head.
 1.197.2.3 16-May-2009  yamt sync with head
 1.197.2.2 04-May-2009  yamt sync with head.
 1.197.2.1 16-May-2008  yamt sync with head.
 1.198.2.4 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.198.2.3 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.198.2.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.198.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.199.2.1 27-Jun-2008  simonb Sync with head.
 1.201.10.1 21-Apr-2010  matt sync to netbsd-5
 1.201.6.1 17-Mar-2010  snj Pull up following revision(s) (requested by he in ticket #1323):
sys/compat/common/vfs_syscalls_30.c: revision 1.31
sys/compat/ibcs2/ibcs2_misc.c: revision 1.110
sys/compat/irix/irix_dirent.c: revision 1.24
sys/compat/linux/common/linux_file64.c: revision 1.50
sys/compat/linux/common/linux_misc.c: revision 1.214
sys/compat/linux32/common/linux32_dirent.c: revision 1.10
sys/compat/sunos/sunos_misc.c: revision 1.166
sys/compat/sunos32/sunos32_misc.c: revision 1.69
sys/compat/svr4/svr4_misc.c: revision 1.149
sys/compat/svr4_32/svr4_32_misc.c: revision 1.68
When implementing "read directory", when there are too many empty entries
in a row, and we need to try to read the next block, and have passed a
non-NULL cookie pointer to VOP_READDIR, ensure that we free the cookie
buffer before re-doing VOP_READDIR, so that we don't leak memory.
This fix is similar to nfs_serv.c revisions 1.115 + 1.124.
This should fix the long-standing problem observed by e.g. using Linux-
emulated programs to take backup of servers, which is one of the problems
which were reported in PR#42661.
Thanks to pooka@ for the hints for traversing the VOP* layer.
 1.201.4.3 28-Apr-2009  skrll Sync with HEAD.
 1.201.4.2 03-Mar-2009  skrll Sync with HEAD.
 1.201.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.201.2.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.205.2.2 23-Jul-2009  jym Sync with HEAD.
 1.205.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.213.2.4 06-Nov-2010  uebayasi Sync with HEAD.
 1.213.2.3 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.213.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.213.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.214.2.2 05-Mar-2011  rmind sync with head
 1.214.2.1 03-Jul-2010  rmind sync with head
 1.219.16.1 19-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1483):
sys/compat/common/vfs_syscalls_12.c: revision 1.34
sys/compat/svr4_32/svr4_32_misc.c: revision 1.78
sys/compat/sunos32/sunos32_misc.c: revision 1.78
sys/compat/linux/common/linux_misc.c: revision 1.239
sys/compat/osf1/osf1_file.c: revision 1.44
sys/compat/common/vfs_syscalls_43.c: revision 1.60
sys/compat/svr4/svr4_misc.c: revision 1.158
sys/compat/ibcs2/ibcs2_misc.c: revision 1.114
sys/compat/linux/common/linux_file64.c: revision 1.59
sys/compat/linux32/common/linux32_dirent.c: revision 1.18
sys/compat/sunos/sunos_misc.c: revision 1.171
Fail, don't panic, on bad dirents from file system.
Controllable via puffs from userland.
From Ilja Van Sprundel.
 1.219.14.1 19-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1483):
sys/compat/common/vfs_syscalls_12.c: revision 1.34
sys/compat/svr4_32/svr4_32_misc.c: revision 1.78
sys/compat/sunos32/sunos32_misc.c: revision 1.78
sys/compat/linux/common/linux_misc.c: revision 1.239
sys/compat/osf1/osf1_file.c: revision 1.44
sys/compat/common/vfs_syscalls_43.c: revision 1.60
sys/compat/svr4/svr4_misc.c: revision 1.158
sys/compat/ibcs2/ibcs2_misc.c: revision 1.114
sys/compat/linux/common/linux_file64.c: revision 1.59
sys/compat/linux32/common/linux32_dirent.c: revision 1.18
sys/compat/sunos/sunos_misc.c: revision 1.171
Fail, don't panic, on bad dirents from file system.
Controllable via puffs from userland.
From Ilja Van Sprundel.
 1.219.12.4 03-Dec-2017  jdolecek update from HEAD
 1.219.12.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.219.12.2 23-Jun-2013  tls resync from head
 1.219.12.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.219.8.2 19-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1483):
sys/compat/common/vfs_syscalls_12.c: revision 1.34
sys/compat/svr4_32/svr4_32_misc.c: revision 1.78
sys/compat/sunos32/sunos32_misc.c: revision 1.78
sys/compat/linux/common/linux_misc.c: revision 1.239
sys/compat/osf1/osf1_file.c: revision 1.44
sys/compat/common/vfs_syscalls_43.c: revision 1.60
sys/compat/svr4/svr4_misc.c: revision 1.158
sys/compat/ibcs2/ibcs2_misc.c: revision 1.114
sys/compat/linux/common/linux_file64.c: revision 1.59
sys/compat/linux32/common/linux32_dirent.c: revision 1.18
sys/compat/sunos/sunos_misc.c: revision 1.171
Fail, don't panic, on bad dirents from file system.
Controllable via puffs from userland.
From Ilja Van Sprundel.
 1.219.8.1 14-Dec-2013  bouyer Pull up following revision(s) (requested by hauke in ticket #993):
sys/compat/linux/common/linux_misc.c: revision 1.227
On linux_sys_getdents, insert d_type at the end of each record.
Fixes PR kern/47806.
 1.219.2.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.219.2.1 30-Oct-2012  yamt sync with head
 1.223.4.2 18-May-2014  rmind sync with head
 1.223.4.1 28-Aug-2013  rmind sync with head
 1.228.2.1 10-Aug-2014  tls Rebase.
 1.229.8.2 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1720:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149 (patch)
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54 (patch)

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.229.8.1 12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1479):
sys/compat/common/vfs_syscalls_12.c: revision 1.34
sys/rump/kern/lib/libsys_sunos/rump_sunos_compat.c: revision 1.2
sys/compat/svr4_32/svr4_32_misc.c: revision 1.78
sys/compat/sunos32/sunos32_misc.c: revision 1.78
sys/compat/linux/common/linux_misc.c: revision 1.239
sys/compat/osf1/osf1_file.c: revision 1.44
sys/compat/common/vfs_syscalls_43.c: revision 1.60
sys/compat/svr4/svr4_misc.c: revision 1.158
sys/compat/ibcs2/ibcs2_misc.c: revision 1.114
sys/compat/linux/common/linux_file64.c: revision 1.59
sys/compat/linux32/common/linux32_dirent.c: revision 1.18
sys/compat/sunos/sunos_misc.c: revision 1.171
Fail, don't panic, on bad dirents from file system.
Controllable via puffs from userland.
From Ilja Van Sprundel.
 1.229.4.1 12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1479):
sys/compat/common/vfs_syscalls_12.c: revision 1.34
sys/rump/kern/lib/libsys_sunos/rump_sunos_compat.c: revision 1.2
sys/compat/svr4_32/svr4_32_misc.c: revision 1.78
sys/compat/sunos32/sunos32_misc.c: revision 1.78
sys/compat/linux/common/linux_misc.c: revision 1.239
sys/compat/osf1/osf1_file.c: revision 1.44
sys/compat/common/vfs_syscalls_43.c: revision 1.60
sys/compat/svr4/svr4_misc.c: revision 1.158
sys/compat/ibcs2/ibcs2_misc.c: revision 1.114
sys/compat/linux/common/linux_file64.c: revision 1.59
sys/compat/linux32/common/linux32_dirent.c: revision 1.18
sys/compat/sunos/sunos_misc.c: revision 1.171
Fail, don't panic, on bad dirents from file system.
Controllable via puffs from userland.
From Ilja Van Sprundel.
 1.229.2.3 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1720:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149 (patch)
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54 (patch)

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.229.2.2 12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1479):
sys/compat/common/vfs_syscalls_12.c: revision 1.34
sys/rump/kern/lib/libsys_sunos/rump_sunos_compat.c: revision 1.2
sys/compat/svr4_32/svr4_32_misc.c: revision 1.78
sys/compat/sunos32/sunos32_misc.c: revision 1.78
sys/compat/linux/common/linux_misc.c: revision 1.239
sys/compat/osf1/osf1_file.c: revision 1.44
sys/compat/common/vfs_syscalls_43.c: revision 1.60
sys/compat/svr4/svr4_misc.c: revision 1.158
sys/compat/ibcs2/ibcs2_misc.c: revision 1.114
sys/compat/linux/common/linux_file64.c: revision 1.59
sys/compat/linux32/common/linux32_dirent.c: revision 1.18
sys/compat/sunos/sunos_misc.c: revision 1.171
Fail, don't panic, on bad dirents from file system.
Controllable via puffs from userland.
From Ilja Van Sprundel.
 1.229.2.1 17-Apr-2017  snj Pull up following revision(s) (requested by manu in ticket #1354):
sys/compat/linux/arch/alpha/syscalls.master: revision 1.92 via patch
sys/compat/linux/arch/amd64/syscalls.master: revision 1.58 via patch
sys/compat/linux/arch/arm/syscalls.master: revision 1.65 via patch
sys/compat/linux/arch/i386/syscalls.master: revision 1.122 via patch
sys/compat/linux/arch/m68k/syscalls.master: revision 1.91 via patch
sys/compat/linux/arch/mips/syscalls.master: revision 1.61 via patch
sys/compat/linux/arch/powerpc/syscalls.master: revision 1.70 via patch
sys/compat/linux/common/linux_misc.c: revision 1.234
sys/compat/linux/common/linux_signal.h: revision 1.31
Add pselect6 Linux system call.
This lets Matlab R2016A run on NetBSD/amd64
 1.230.2.5 28-Aug-2017  skrll Sync with HEAD
 1.230.2.4 05-Feb-2017  skrll Sync with HEAD
 1.230.2.3 05-Dec-2016  skrll Sync with HEAD
 1.230.2.2 05-Oct-2016  skrll Sync with HEAD
 1.230.2.1 06-Apr-2015  skrll Sync with HEAD
 1.231.2.2 20-Mar-2017  pgoyette Sync with HEAD
 1.231.2.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.236.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.237.4.1 11-May-2017  pgoyette Sync with HEAD
 1.238.2.3 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1836):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.238.2.2 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1487:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.238.2.1 09-Aug-2017  snj Pull up following revision(s) (requested by spz in ticket #193):
sys/compat/common/vfs_syscalls_12.c: revision 1.34
sys/rump/kern/lib/libsys_sunos/rump_sunos_compat.c: revision 1.2
sys/compat/svr4_32/svr4_32_misc.c: revision 1.78
sys/compat/sunos32/sunos32_misc.c: revision 1.78
sys/compat/linux/common/linux_misc.c: revision 1.239
sys/compat/osf1/osf1_file.c: revision 1.44
sys/compat/common/vfs_syscalls_43.c: revision 1.60
sys/compat/svr4/svr4_misc.c: revision 1.158
sys/compat/ibcs2/ibcs2_misc.c: revision 1.114
sys/compat/linux/common/linux_file64.c: revision 1.59
sys/compat/linux32/common/linux32_dirent.c: revision 1.18
sys/compat/sunos/sunos_misc.c: revision 1.171
Fail, don't panic, on bad dirents from file system.
Controllable via puffs from userland.
From Ilja Van Sprundel.
 1.239.4.4 21-Apr-2020  martin Sync with HEAD
 1.239.4.3 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.239.4.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.239.4.1 10-Jun-2019  christos Sync with HEAD
 1.239.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.240.4.2 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.240.4.1 13-Sep-2019  martin Pull up following revision(s) (requested by maxv in ticket #194):

sys/compat/linux/common/linux_socket.c: revision 1.146
sys/compat/linux/common/linux_socket.c: revision 1.147
sys/compat/linux/common/linux_socket.c: revision 1.148
sys/compat/linux/common/linux_socket.c: revision 1.149
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.59
sys/compat/linux32/common/linux32_sysinfo.c: revision 1.8
sys/kern/sysv_shm.c: revision 1.138
sys/compat/linux/common/linux_file64.c: revision 1.61
sys/compat/linux/common/linux_file64.c: revision 1.62
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.58
sys/compat/linux32/common/linux32_dirent.c: revision 1.20
sys/compat/linux32/common/linux32_utsname.c: revision 1.10
sys/compat/linux/common/linux_termios.h: revision 1.22
sys/compat/linux32/common/linux32_termios.c: revision 1.15
sys/compat/linux32/common/linux32_misc.c: revision 1.27
sys/compat/linux32/common/linux32_ioctl.c: revision 1.14
sys/compat/linux/common/linux_statfs.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.57
sys/compat/linux/common/linux_fcntl.h: revision 1.18
sys/compat/linux/common/linux_socket.h: revision 1.24
sys/sys/shm.h: revision 1.54
sys/compat/ossaudio/ossaudio.c: revision 1.75
sys/compat/linux32/common/linux32_signal.c: revision 1.20
sys/miscfs/procfs/procfs_linux.c: revision 1.75
sys/compat/linux/common/linux_signal.c: revision 1.81
sys/compat/linux/common/linux_termios.c: revision 1.38
sys/compat/linux/common/linux_misc.c: revision 1.241
sys/compat/linux/common/linux_misc.c: revision 1.242
sys/compat/linux/common/linux_misc.c: revision 1.243
sys/compat/linux/common/linux_misc.c: revision 1.244

Fix info leaks.

Fix stupid bugs in linux_sys_shmctl(): the index could be out of bound
(page fault) and there was no proper locking.
Maybe we should just remove LINUX_SHM_STAT, like compat_linux32.

Remove printf.

When dealing with an unknown value, set -1, to prevent (harmless)
uninitialized accesses later.

Add a default case, don't call sys_ioctl() with an uninitialized 'com'
argument.

Fix error handling, returns an errno, not -1.

Put the printf under DEBUG_LINUX.


Hum, don't forget the 'pid' argument, otherwise we're not gonna go very
far.

Don't read data from userland directly. This simply does not work on any
recent x86 CPU (thanks to SMAP) and all architectures that forbid direct
access to userland from the kernel. But I guess no one noticed because no
one ever uses compat_linux, right?

Hum, don't pass an mbuf to realloc(). Inspired from copyin32_msg_control().

Fix memory leak.

I don't see the point in having this useless printf, but add a '\n' to it,
so that it at least displays useless stuff correctly.

Hum, remove incorrect assignment. Userland could have passed a smaller
namelen, and the uninitialized bytes from sb_data were being used later in
the network stack.
 1.247.6.1 20-Apr-2020  bouyer Sync with HEAD
 1.251.2.1 15-Dec-2020  thorpej Add Linux eventfd, timerfd, and POSIX timer calls.
 1.264.2.1 02-Aug-2025  perseant Sync with HEAD
 1.34 01-Oct-2024  riastradh sys/compat/linux/common: Nix trailing whitespace, and one blank line.

No functional change intended.
 1.33 29-Jun-2024  christos branches: 1.33.2;
From gsoc 2024: Implement faccessat2 and getcpu (Shivraz)
 1.32 12-May-2024  christos Add forward decl for procfs include.
 1.31 12-May-2024  christos fix whitespace
 1.30 12-May-2024  christos PR/58240: Ricardo Branco: Add missing limits
 1.29 18-Aug-2023  christos Add linux waitid(2) from GSoC 2023 (Theodore Preduta)
 1.28 29-Jul-2023  rin Add comment on packed attribution for struct linux_epoll_event on amd64.
NFC.
 1.27 28-Jul-2023  christos Add epoll(2) from Theodore Preduta as part of GSoC 2023
 1.26 03-May-2020  thorpej Always clear FUTEX_PRIVATE_FLAG for Linux processes. NetBSD-native futexes
exist in different namespace depending on FUTEX_PRIVATE_FLAG. This appears
not to be the case in Linux, and some futex users will mix private and non-
private ops on the same futex object. Provide a convenience wrapper that
puts this logic in one place witn a comment explaining why.

While here, move the Linux futex wrapper out of its own file and plop
it in linux_misc.c, which is where it lives in the linux32 module.
 1.25 31-Aug-2016  njoly Teach wait4 about WCONTINUED.
 1.24 18-Nov-2013  chs branches: 1.24.6;
implement the *at() syscalls.
bring the unimplemented syscall list up to date.
 1.23 22-Sep-2012  joerg branches: 1.23.2;
LINUX_RLIM_INFINITY doesn't fit into the value range for linux32, so
introduce a variant with correct value.
 1.22 13-Sep-2012  pooka Rename structure members to make the code compile in environments
where "linux" is #defined.
 1.21 30-May-2011  alnsn branches: 1.21.4; 1.21.14;
Add fadvise64 and fadvise64_64 syscalls to compat_linux and compat_linux32.
 1.20 02-Nov-2010  chs branches: 1.20.2;
personality() now interprets its parameter as having
the base personality type in the low byte and
various flags in the upper bytes. for now just mask off
the flags to make sure the base type is one we accept.
store the current personality in the emuldata so that
we can return the expected value for PER_QUERY.
 1.19 19-Jan-2009  njoly branches: 1.19.4; 1.19.6;
Small personality(2) update.
- Allow querying current personality.
- Use symbolic names instead of magic values.
 1.18 11-Jan-2009  christos merge christos-time_t
 1.17 28-May-2008  njoly branches: 1.17.6;
Add LINUX_TMPFS_SUPER_MAGIC, and map it to our tmpfs.
This makes sem_open/sem_unlink (POSIX named semaphores) work under
NPTL emulation.
 1.16 28-Apr-2008  martin branches: 1.16.2;
Remove clause 3 and 4 from TNF licenses
 1.15 04-Dec-2007  dsl branches: 1.15.12; 1.15.14; 1.15.16; 1.15.18;
Remove all the __P
 1.14 07-May-2007  dsl branches: 1.14.6; 1.14.8; 1.14.14; 1.14.16;
Split sys_wait4() so that compat code can fiddle with the returned 'status'
and 'rusage' without having to copy data to/from stackgap buffers.
The old split (find_stopped_child) could be removed.
amd64 seems to run netbsd32, linux and linux32 emulations. sparc64 compiles.
 1.13 11-Dec-2005  christos branches: 1.13.26; 1.13.30; 1.13.32;
merge ktrace-lwp.
 1.12 03-May-2005  manu branches: 1.12.2;
First work on COMPAT_LINUX/amd64
Process startup and dynamiclinking work, but processes hang due to
Linux arch_prctl(2) not being really supported yet.
 1.11 13-Nov-2004  christos Add ptyfs magic number and entry.
 1.10 07-Oct-2004  erh PR kern/27184: Have linux_sys_waitpid() call linux_sys_wait4() so the
supported options can't get out of sync. This add support for the
linux __WCLONE and __WALL options (NetBSD version: WALTSIG and WALLSIG)
Add a diagnostic check to see if the one unhandled option (__WNOTHREAD) is
specified.
This should prevent linux processes from losing their children and creating
tons of zombie processes.
 1.9 20-Sep-2004  jdolecek implement support for Linux statfs64() syscall - 64bit variant of statfs()
 1.8 18-Jan-2003  thorpej branches: 1.8.2; 1.8.4;
Merge the nathanw_sa branch.
 1.7 20-Feb-2002  christos proper statfs emulation...
 1.6 15-Feb-2002  christos - add a real linux_sys___sysctl because the mib numbers are different.
implement only the kernel version getting entries.
- make the signal conversion functions consistent; dest is arg 1.
- make linux_fakedev deal with block and char devices differently.
- add linux_sys_ugetrlimit, and flesh out the regular get/setrlimit so
that they work properly.
- add linux_mmap2 [untested].
- bump kernel to 2.4.18, and make the date be valentine's day :-)
- linux_sys_*stat64 family was totally busted. Fix it.

tested only on i386.

Status:
gdb, telnet, work
jdk-1.4.0 extractor works, jdk still coredumps.

christos
 1.5 18-Jul-2001  thorpej Add support for the __WALL wait4(2) flag.
 1.4 13-Dec-2000  augustss branches: 1.4.2; 1.4.4;
Implement sysinfo.
 1.3 13-May-1999  thorpej branches: 1.3.2;
Define the flags used by the Linux wait4() system call.
 1.2 03-Oct-1998  christos branches: 1.2.8;
Attempt to fix the mess.
 1.1 01-Oct-1998  erh Add a couple function prototypes from linux_misc.c.
 1.2.8.1 21-Jun-1999  thorpej Sync w/ -current.
 1.3.2.1 05-Jan-2001  bouyer Sync with HEAD
 1.4.4.2 16-Mar-2002  jdolecek Catch up with -current.
 1.4.4.1 03-Aug-2001  lukem update to -current
 1.4.2.3 28-Feb-2002  nathanw Catch up to -current.
 1.4.2.2 24-Aug-2001  nathanw Catch up with -current.
 1.4.2.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.8.4.1 12-Nov-2004  jmc Pullup rev 1.10 (requested by christos in ticket #950)

Prevent linux processes from losing their children and creating
tons of zombie processes.
 1.8.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.8.2.3 14-Nov-2004  skrll Sync with HEAD.
 1.8.2.2 19-Oct-2004  skrll Sync with HEAD
 1.8.2.1 24-Sep-2004  skrll Sync with HEAD.
 1.12.2.2 07-Dec-2007  yamt sync with head
 1.12.2.1 03-Sep-2007  yamt sync with head.
 1.13.32.1 11-Jul-2007  mjf Sync with head.
 1.13.30.1 27-May-2007  ad Sync with head.
 1.13.26.1 17-May-2007  yamt sync with head.
 1.14.16.1 08-Dec-2007  ad Sync with head.
 1.14.14.1 08-Dec-2007  mjf Sync with HEAD.
 1.14.8.1 09-Jan-2008  matt sync with HEAD
 1.14.6.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.15.18.2 04-May-2009  yamt sync with head.
 1.15.18.1 16-May-2008  yamt sync with head.
 1.15.16.2 04-Jun-2008  yamt sync with head
 1.15.16.1 18-May-2008  yamt sync with head.
 1.15.14.2 01-Nov-2008  christos Sync with head.
 1.15.14.1 29-Mar-2008  christos Welcome to the time_t=long long dev_t=uint64_t branch.
 1.15.12.2 17-Jan-2009  mjf Sync with HEAD.
 1.15.12.1 02-Jun-2008  mjf Sync with HEAD.
 1.16.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.17.6.2 03-Mar-2009  skrll Sync with HEAD.
 1.17.6.1 19-Jan-2009  skrll Sync with HEAD.
 1.19.6.2 31-May-2011  rmind sync with head
 1.19.6.1 05-Mar-2011  rmind sync with head
 1.19.4.1 06-Nov-2010  uebayasi Sync with HEAD.
 1.20.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.21.14.3 03-Dec-2017  jdolecek update from HEAD
 1.21.14.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.21.14.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.21.4.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.21.4.1 30-Oct-2012  yamt sync with head
 1.23.2.1 18-May-2014  rmind sync with head
 1.24.6.1 05-Oct-2016  skrll Sync with HEAD
 1.33.2.1 02-Aug-2025  perseant Sync with HEAD
 1.115 22-May-2022  andvar fix various small typos, mainly in comments.
 1.114 25-Nov-2021  ryo add support COMPAT_LINUX32 for aarch64
 1.113 23-Sep-2021  christos remove stray char.
 1.112 23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.111 04-Dec-2020  thorpej Rewrite linux_sys_alarm() to use dogetitimer() / dosetitimer(), rather
than fiddling with process timers directly.
 1.110 29-Nov-2018  maxv branches: 1.110.12;
Improve my kern_time.c::rev1.192, systematically clear the buffers we get
from 'ptimer_pool' to prevent more leaks.
 1.109 09-Nov-2014  maxv branches: 1.109.12; 1.109.18; 1.109.20;
Do not uselessly include <sys/malloc.h>.
 1.108 02-Nov-2010  chs branches: 1.108.18; 1.108.34;
implement the following syscalls for linux32:
truncate64
ftruncate64
profil
ioperm
iopl
setdomainname
modify_ldt
statfs64
fstatfs64

note that iopl(), ioperm() and modify_ldt() just call
the respective 64-bit handlers, which don't do anything yet.
 1.107 07-Jul-2010  chs many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
- support new-style (NPTL) linux pthreads on all platforms.
clone() with CLONE_THREAD uses 1 process with many LWPs
instead of separate processes.
- move the contents of sys__lwp_setprivate() into a new
lwp_setprivate() and use that everywhere.
- update linux_release[] and linux32_release[] to "2.6.18".
- adjust placement of emul fork/exec/exit hooks as needed
and adjust other emul code to match.
- convert all struct emul definitions to use named initializers.
- change the pid allocator to allow multiple pids to refer to the same proc.
- remove a few fields from struct proc that are no longer needed.
- disable the non-functional "vdso" code in linux32/amd64,
glibc works fine without it.
- fix a race in the futex code where we could miss a wakeup after
a requeue operation.
- redo futex locking to be a little more efficient.
 1.106 02-Jun-2009  njoly branches: 1.106.2; 1.106.4;
Make nice(2) return EPERM on error, not EACCES (from sys_setpriority).
 1.105 29-Dec-2008  njoly branches: 1.105.2;
Fix stime(2) inverted copyin arguments.
 1.104 03-Oct-2008  njoly branches: 1.104.2;
Compat linux/linux32 nice(2) fix. The syscall argument is an increment
to be added to the current nice value, not an absolute value to be
set.
 1.103 15-Jul-2008  christos Use more timespecs internally. From Alexander Shishkin and me.
Welcome to 4.99.70, 30 more to go for 100.
 1.102 28-Apr-2008  martin branches: 1.102.2; 1.102.4; 1.102.6;
Remove clause 3 and 4 from TNF licenses
 1.101 21-Apr-2008  ad branches: 1.101.2;
timer fixes for PR 37093:

- Fix serious concurrency problems, making the code MT and MP safe in
the process.
- Don't allocate memory or inspect process state from hardclock().
 1.100 26-Dec-2007  njoly branches: 1.100.6; 1.100.8;
Fix readdir syscall retval to return 1 (instead of getdents number of
byte read) on success.
 1.99 20-Dec-2007  dsl Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.98 08-Dec-2007  dsl branches: 1.98.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.97 25-Nov-2007  elad branches: 1.97.2;
Refactor time modification checks and place them in the secmodel code.

okay christos@
 1.96 07-Nov-2007  njoly Remove remaining 64-bit compat linux syscalls linux_sys_xxx() (except
for ones without arguments), and replace them by their 32-bit
equivalent linux32_sys_xxxx().
 1.95 19-Oct-2007  njoly branches: 1.95.2;
Add compat_linux and exec_linux_elf lkm support for amd64:
- Add needed COMPAT_OSSAUDIO to GENERIC.
- Add missing includes needed by linux_syscallargs.h.
- Add lkm building.
 1.94 09-Jul-2007  ad branches: 1.94.6; 1.94.8; 1.94.12;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.93 23-Jun-2007  dsl These now need sys/prot.h
 1.92 12-May-2007  dsl Change the compat sys_[fl]utime code to not use the stackgap.
 1.91 30-Apr-2007  dsl Include extra header (vfs_syscalls.h).
 1.90 30-Apr-2007  dsl Rework compat stat() and statvfs() code so that it no longer uses the stackgap.
 1.89 23-Apr-2007  christos avoid zerodivide.
 1.88 22-Apr-2007  dsl Change the way that emulations locate files within the emulation root to
avoid having to allocate space in the 'stackgap'
- which is very LWP unfriendly.
The additional code for non-emulation namei() is trivial, the reduction for
the emulations is massive.
The vnode for a processes emulation root is saved in the cwdi structure
during process exec.
If the emulation root the TRYEMULROOT flag are set, namei() will do an initial
search for absolute pathnames in the emulation root, if that fails it will
retry from the normal root.
".." at the emulation root will always go to the real root, even in the middle
of paths and when expanding symlinks.
Absolute symlinks found using absolute paths in the emulation root will be
relative to the emulation root (so /usr/lib/xxx.so -> /lib/xxx.so links
inside the emulation root don't need changing).
If the root of the emulation would be returned (for an emulation lookup), then
the real root is returned instead (matching the behaviour of emul_lookup,
but being a cheap comparison here) so that programs that scan "../.."
looking for the root dircetory don't loop forever.
The target for symbolic links is no longer mangled (it used to get the
CHECK_ALT_xxx() treatment, so could get /emul/xxx prepended).
CHECK_ALT_xxx() are no more. Most of the change is deleting them, and adding
TRYEMULROOT to the flags to NDINIT().
A lot of the emulation system call stubs could now be deleted.
 1.87 14-Mar-2007  njoly Fix compat linux statfs/fstatfs syscalls on amd64.
- Do not use statfs64/fstatfs64 as they have an extra size argument.
- Add full 64bit linux struct statfs support.

ok by manu
 1.86 04-Mar-2007  christos branches: 1.86.2; 1.86.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.85 09-Feb-2007  ad branches: 1.85.2;
Merge newlock2 to head.
 1.84 16-Nov-2006  christos branches: 1.84.2;
__unused removal on arguments; approved by core.
 1.83 14-Nov-2006  elad Clean some KAUTH_GENERIC_ISSUSER usage in compat code.
 1.82 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.81 23-Jul-2006  ad branches: 1.81.4; 1.81.6;
Use the LWP cached credentials where sane.
 1.80 07-Jun-2006  kardel merge FreeBSD timecounters from branch simonb-timecounters
- struct timeval time is gone
time.tv_sec -> time_second
- struct timeval mono_time is gone
mono_time.tv_sec -> time_uptime
- access to time via
{get,}{micro,nano,bin}time()
get* versions are fast but less precise
- support NTP nanokernel implementation (NTP API 4)
- further reading:
Timecounter Paper: http://phk.freebsd.dk/pubs/timecounter.pdf
NTP Nanokernel: http://www.eecis.udel.edu/~mills/ntp/html/kern.html
 1.79 14-May-2006  elad branches: 1.79.2;
integrate kauth.
 1.78 10-May-2006  yamt don't allocate struct statvfs on stack as it's too large.
while i'm here, remove some unnecessary casts.
 1.77 09-Feb-2006  manu branches: 1.77.2; 1.77.4; 1.77.6;
Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.76 11-Dec-2005  christos branches: 1.76.2; 1.76.4; 1.76.6;
merge ktrace-lwp.
 1.75 05-Dec-2005  christos - make settime take timespec.
- avoid wrapping of time in settime.
- pass struct proc down so that we can log a detailed message.
 1.74 03-May-2005  manu branches: 1.74.2;
First work on COMPAT_LINUX/amd64
Process startup and dynamiclinking work, but processes hang due to
Linux arch_prctl(2) not being really supported yet.
 1.73 26-Feb-2005  perry nuke trailing whitespace
 1.72 07-Oct-2004  erh branches: 1.72.4; 1.72.6;
PR kern/27184: Have linux_sys_waitpid() call linux_sys_wait4() so the
supported options can't get out of sync. This add support for the
linux __WCLONE and __WALL options (NetBSD version: WALTSIG and WALLSIG)
Add a diagnostic check to see if the one unhandled option (__WNOTHREAD) is
specified.
This should prevent linux processes from losing their children and creating
tons of zombie processes.
 1.71 24-Sep-2004  he Since the implementation of bsd_to_linux_statfs64() is conditional,
also make the forward declaration conditional. Fixes compile
problem for m68k ports.
 1.70 20-Sep-2004  jdolecek implement support for Linux statfs64() syscall - 64bit variant of statfs()
 1.69 29-Jun-2003  fvdl branches: 1.69.2; 1.69.4;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.68 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.67 05-Mar-2003  dsl Reimplement linux_sys_setresgid() in terms of do_setresgid()
 1.66 23-Feb-2003  enami Remember the allocated ptimer object so that it won't leak.
 1.65 19-Feb-2003  jdolecek update emul alarm syscalls to recent timer changes

problem encountered by Luke Mewburn for linux emul, problem spot
found by Enami Tsugutomo
 1.64 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.63 03-Apr-2002  tron branches: 1.63.6;
Fix a cut and paste error in the emulation of getresgid(2): it returned
the effective user id as effective group id.
 1.62 16-Mar-2002  christos make the stackgap_{init,alloc} functions MP friendly (i.e. pass struct proc *
in, instead of using curproc). While there add an optional size argument to
stackgap_init.
 1.61 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.60 22-Dec-2000  jdolecek branches: 1.60.2; 1.60.4;
split off thread specific stuff from struct sigacts to struct sigctx, leaving
only signal handler array sharable between threads
move other random signal stuff from struct proc to struct sigctx

This addresses kern/10981 by Matthew Orgass.
 1.59 01-Dec-2000  jdolecek add e_path (emulation path) to struct emul, which replaces emulation-specific
*_emul_path variables

change macros CHECK_ALT_{CREAT|EXIST} to use that, 'root' doesn't need
to be passed explicitly any more and *_CHECK_ALT_{CREAT|EXIST} are removed
change explicit emul_find() calls in probe functions to get the emulation
path from the checked exec switch entry's emulation

remove no longer needed header files

add e_flags and e_syscall to struct emul; these are unsed and empty for now
 1.58 29-Aug-2000  sommerfeld Emulation stackgap sanity checks, based partly on fixes from
FreeBSD-SA00:42.

Change stackgap_alloc to bounds-check the allocation vs. the stack
gap, returning NULL if there isn't room for the allocation.

Change emul_find() to check for a NULL return from stackgap_alloc()
and convert that into ENAMETOOLONG.

Reorder various emulation syscalls so that all *_CHECK_ALT_{EXIST,CREAT}
calls (which turn into emul_find() under the covers come *after* small,
fixed-size stackgap_alloc() calls.

Clean up ibcs2 {get,set}groups.
 1.57 07-Aug-2000  itohy Add #include <sys/proc.h>, since this file touches members of struct proc.
 1.56 13-Jul-2000  thorpej Add a comment about the hzto() return value.
 1.55 29-Jun-2000  mrg remove include of <vm/vm.h>
 1.54 26-Jun-2000  mrg remove redundant vm includes
 1.53 23-Mar-2000  thorpej branches: 1.53.4;
New callout mechanism with two major improvements over the old
timeout()/untimeout() API:
- Clients supply callout handle storage, thus eliminating problems of
resource allocation.
- Insertion and removal of callouts is constant time, important as
this facility is used quite a lot in the kernel.

The old timeout()/untimeout() API has been removed from the kernel.
 1.52 16-Aug-1999  tron branches: 1.52.2;
Add emulation for Linux stime(2) required for MuPAD's X11 interface.
 1.51 14-May-1999  thorpej Emulate the Linux {get,set}resgid(2) system calls.
 1.50 09-Feb-1999  christos branches: 1.50.2; 1.50.4;
const poisoning.
 1.49 04-Oct-1998  fvdl Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.48 03-Oct-1998  christos Attempt to fix the mess.
 1.47 01-Oct-1998  erh Wheeee!: 8-way split of compat/linux/linux_misc.c into common code and multi-architechture functions.
 1.46 11-Sep-1998  mycroft Substantial signal handling changes:
* Increase the size of sigset_t to accomodate 128 signals -- adding new
versions of sys_setprocmask(), sys_sigaction(), sys_sigpending() and
sys_sigsuspend() to handle the changed arguments.
* Abstract the guts of sys_sigaltstack(), sys_setprocmask(), sys_sigaction(),
sys_sigpending() and sys_sigsuspend() into separate functions, and call them
from all the emulations rather than hard-coding everything. (Avoids uses
the stackgap crap for these system calls.)
* Add a new flag (p_checksig) to indicate that a process may have signals
pending and userret() needs to do the full (slow) check.
* Eliminate SAS_ALTSTACK; it's exactly the inverse of SS_DISABLE.
* Correct emulation bugs with restoring SS_ONSTACK.
* Make the signal mask in the sigcontext always use the emulated mask format.
* Store signals internally in sigaction structures, rather than maintaining a
bunch of little sigsets for each SA_* bit.
* Keep track of where we put the signal trampoline, rather than figuring it out
in *_sendsig().
* Issue a warning when a non-emulated sigaction bit is observed.
* Add missing emulated signals, and a native SIGPWR (currently not used).
* Implement the `not reset when caught' semantics for relevant signals.

Note: Only code touched by the i386 port has been modified. Other ports and
emulations need to be updated.
 1.45 08-Sep-1998  rvb ufs_readdir no longer checks if vp->v_type != VDIR so
the individual emulated readdirs must check.
Since netbsd and freebsd return EINVAL for the error
and I don't know what the other platforms do, return
EINVAL for them too.
 1.44 18-Aug-1998  thorpej Add some braces to make egcs happy.
 1.43 07-Jul-1998  thorpej Oops, fix typo, pointed out by Urban Boquist <boquist@cs.chalmers.se>.
 1.42 02-Jul-1998  thorpej Implement the shrinking and no-change bits of the Linux mremap(2) system
call, provided by Urban Boquist <boquist@cs.chalmers.se> in PR #5693.

Add a comment about how one might implement the growing bit of mremap(2).
 1.41 24-Mar-1998  mycroft Fix typo in utime().
 1.40 03-Mar-1998  fvdl Only free cookiebuf when sure that the vop actually allocated it.
 1.39 01-Mar-1998  fvdl Merge with Lite2 + local changes
 1.38 20-Feb-1998  mycroft Linux's getsid(2) does in fact return a pid, not a pointer.
 1.37 14-Feb-1998  thorpej Add a comment clearly describing that Linux's getsid(2) differs from
the XPG4.2 definition in that it returns the kernel virtual address
of the session structure, rather than the process group ID of the
session leader.
 1.36 21-Oct-1997  fvdl branches: 1.36.2;
msync -> __msync13
 1.35 10-Oct-1997  fvdl Fix braino in my interpretation of the eof flag to VOP_READDIR.
 1.34 10-Oct-1997  mycroft Emulate mremap(2) by returning ENOMEM for now. This should be sufficient for
realloc(3) and other uses. From Matthias Scheler in PR 3920.
 1.33 10-Oct-1997  fvdl Signal error when getting a 64 bit offset cookie that can't be stored
in 32 bits. Provide an error message to the user, and return EINVAL.
Also, pay attention to the EOF flag from VOP_READDIR. Correct a
misspell in a panic message.
 1.32 04-Aug-1997  bouyer Fix "missing entries" bug when reading large directories: When reading a
directory and running out of space in the dest buffer, off should point to the
current entry (which was not saved) and not to the next.
I discovered this bug using linux and SunOS emulation over NFS, but seems to
affect other emulations as well.
 1.31 27-Jul-1997  augustss branches: 1.31.2;
Changes to the sudio system:
- It is now possible to handle devices that want "looping" DMA,
e.g. the SoundBlaster correctly. The WSS and SB drivers use this.
To do this several new methods were introduced in audio_hw_if.
- Different silence handling (forced by previous change).
- The audio driver can now be mmap()-ed, but due to problems in
the VM system only for writing for now.
- The OSS (Linux) audio emulation takes advantage of some of the
new features.
 1.30 07-Apr-1997  augustss Add Linux nice() syscall.
 1.29 10-Aug-1996  mycroft sys/dir.h -> sys/dirent.h
 1.28 23-Jun-1996  mycroft Catch up with setre[ug]id() changes.
 1.27 20-May-1996  fvdl branches: 1.27.4;
Update list of Linux syscalls and implement the ones that are likely to be
used and doable.
 1.26 04-Apr-1996  christos - Prototyping changes
- Fix bug that gcc -Wall found in linux_sys_getpgid()
 1.25 03-Apr-1996  mycroft Add explicit return types.
 1.24 18-Dec-1995  fvdl msync, readv and writev were recently added to the Linux kernel; add them
to the emulation as well.
 1.23 09-Dec-1995  mycroft We don't need a private version of fork() here any more.
 1.22 09-Oct-1995  mycroft Use cookies for directory offset, mostly from Greg Hudson.
 1.21 07-Oct-1995  mycroft Prefix names of system call implementation functions with `sys_'.
 1.20 19-Sep-1995  thorpej Make system calls conform to a standard prototype and bring those
prototypes into scope.
 1.19 13-Sep-1995  fvdl Update offset elsewhere in linux_getdents(); still emulate a bug in
Linux, but avoid endless loops.
 1.18 07-Sep-1995  fvdl Fix some bugs & typing problems.
 1.17 23-Aug-1995  fvdl Emulate some syscalls that appear in Linux 1.3: a select() with normal args,
getdents() and flock().
 1.16 21-Aug-1995  fvdl Check for status NULL argument in wait4 and waitpid. From PR #1392
by Thomas EberHardt.
 1.15 21-Aug-1995  mycroft Implement the old and older uname(2) calls.
 1.14 16-Aug-1995  mycroft If updating the timeval would make it negative, zero it instead.
 1.13 16-Aug-1995  mycroft Allow bogus timevals, per Linux.
 1.12 14-Aug-1995  mycroft Export bsd_to_linux_sig[], and use it.
 1.11 14-Aug-1995  mycroft Rearrange #includes.
 1.10 13-Aug-1995  mycroft Linux doesn't allow select(2) to be restarted.
 1.9 24-Jun-1995  christos Use compat_util.[ch].
 1.8 22-Jun-1995  fvdl * Changed to use generic ELF code from kern/exec_elf.c (which was taken
from the svr4 exec code plus the linux compat mods)
* Include file change
* Add multicast sockopts (from John Brezak)
 1.7 11-Jun-1995  fvdl Linux select() returns the amount of time left before a timeout would have
occured in the timeval structure. Emulate this behavior. Reported by
Theo de Raadt.
 1.6 11-Jun-1995  fvdl * Make Linux ELF binaries work. Lots of code duplication, but it will have to do
for now.
* Add a sanity check in linux_uselib
 1.5 10-Jun-1995  mycroft Rename the dirent fields to match Linux. Make sure the requested buffer
is no larger than MAXBSIZE.
 1.4 22-Mar-1995  mycroft Emulate the return value of times() better.
 1.3 21-Mar-1995  mycroft Update to use timer{add,sub}().
 1.2 05-Mar-1995  fvdl Added a few more system calls.
More consistent alternate root file semantics throughout.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.27.4.2 10-Dec-1996  mycroft From trunk:
sys/dir.h -> sys/dirent.h
 1.27.4.1 10-Dec-1996  mycroft From trunk:
Implement setre[ug]id() for real.
 1.31.2.2 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.31.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.36.2.1 08-May-1998  mycroft Pull up 1.41, per request of mycroft.
 1.50.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.50.2.1 09-Sep-2000  he Pull up revision 1.58 (requested by simonb):
More carefully check length of user-supplied data, in particular
make sure we don't overrun the available stack gap in stack gap
allocations.
 1.52.2.3 05-Jan-2001  bouyer Sync with HEAD
 1.52.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.52.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.53.4.2 30-Aug-2000  sommerfeld Pull up:
syssrc/sys/compat/common/compat_util.c 1.16
syssrc/sys/compat/hpux/hpux_file.c 1.14
syssrc/sys/compat/ibcs2/ibcs2_misc.c 1.52
syssrc/sys/compat/ibcs2/ibcs2_stat.c 1.16
syssrc/sys/compat/linux/common/linux_file.c 1.29
syssrc/sys/compat/linux/common/linux_misc_notalpha.c 1.58
syssrc/sys/compat/svr4/svr4_stat.c 1.40
syssrc/sys/compat/svr4/svr4_stream.c 1.40,1.41

Approved by thorpej and jhawk.

Emulation stackgap sanity checks, based partly on fixes from
FreeBSD-SA00:42.

Change stackgap_alloc to bounds-check the allocation vs. the stack
gap, returning NULL if there isn't room for the allocation.

Change emul_find() to check for a NULL return from stackgap_alloc()
and convert that into ENAMETOOLONG.

Reorder various emulation syscalls so that all *_CHECK_ALT_{EXIST,CREAT}
calls (which turn into emul_find() under the covers come *after* small,
fixed-size stackgap_alloc() calls.

Clean up ibcs2 {get,set}groups.

Add range checks to svr4_stream.c
 1.53.4.1 13-Jul-2000  thorpej Pull up rev. 1.56:
Add a comment about the hzto() return value.
 1.60.4.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.60.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.60.2.9 05-Oct-2002  gmcgarry Rework for new struct ptimers.
 1.60.2.8 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.60.2.7 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.60.2.6 17-Apr-2002  nathanw Catch up to -current.
 1.60.2.5 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.60.2.4 06-Dec-2001  wdk #include <sys/lwp.h> for Mips architectures.
 1.60.2.3 17-Nov-2001  nathanw Reimplement linux_sys_alarm() in terms of the new timers.
 1.60.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.60.2.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.63.6.1 18-Dec-2002  gmcgarry Merge pcred and ucred, and poolify. TBD: check backward compatibility
and factor-out some higher-level functionality.
 1.69.4.1 12-Nov-2004  jmc Pullup rev 1.72 (requested by christos in ticket #950)

Prevent linux processes from losing their children and creating
tons of zombie processes.
 1.69.2.8 11-Dec-2005  christos Sync with head.
 1.69.2.7 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.69.2.6 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.69.2.5 19-Oct-2004  skrll Sync with HEAD
 1.69.2.4 24-Sep-2004  skrll Sync with HEAD.
 1.69.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.69.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.69.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.72.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.72.4.1 29-Apr-2005  kent sync with -current
 1.74.2.8 21-Jan-2008  yamt sync with head
 1.74.2.7 07-Dec-2007  yamt sync with head
 1.74.2.6 15-Nov-2007  yamt sync with head.
 1.74.2.5 27-Oct-2007  yamt sync with head.
 1.74.2.4 03-Sep-2007  yamt sync with head.
 1.74.2.3 26-Feb-2007  yamt sync with head.
 1.74.2.2 30-Dec-2006  yamt sync with head.
 1.74.2.1 21-Jun-2006  yamt sync with head.
 1.76.6.3 01-Jun-2006  kardel Sync with head.
 1.76.6.2 22-Apr-2006  simonb Sync with head.
 1.76.6.1 04-Feb-2006  simonb Adapt for timecounters: mostly use get*time() and use "time_second"
instead of "time.tv_sec".
 1.76.4.1 09-Sep-2006  rpaulo sync with head
 1.76.2.1 18-Feb-2006  yamt sync with head.
 1.77.6.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.77.4.4 11-May-2006  elad sync with head
 1.77.4.3 06-May-2006  christos - Move kauth_cred_t declaration to <sys/types.h>
- Cleanup struct ucred; forward declarations that are unused.
- Don't include <sys/kauth.h> in any header, but include it in the c files
that need it.

Approved by core.
 1.77.4.2 10-Mar-2006  elad generic_authorize() -> kauth_authorize_generic().
 1.77.4.1 08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.77.2.3 11-Aug-2006  yamt sync with head
 1.77.2.2 26-Jun-2006  yamt sync with head.
 1.77.2.1 24-May-2006  yamt sync with head.
 1.79.2.1 19-Jun-2006  chap Sync with head.
 1.81.6.2 10-Dec-2006  yamt sync with head.
 1.81.6.1 22-Oct-2006  yamt sync with head
 1.81.4.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.81.4.1 18-Nov-2006  ad Sync with head.
 1.84.2.2 07-Oct-2007  pavel Pull up following revision(s) (requested by hauke in ticket #919):
sys/compat/linux/common/linux_misc_notalpha.c: revision 1.89
avoid zerodivide.
 1.84.2.1 20-Apr-2007  bouyer branches: 1.84.2.1.2;
Pull up following revision(s) (requested by njoly in ticket #581):
sys/compat/linux/common/linux_misc.c: revision 1.168
sys/compat/linux/arch/amd64/syscalls.master: revision 1.18
sys/compat/linux/common/linux_types.h: revision 1.25
sys/compat/linux/arch/amd64/linux_machdep.h: revision 1.6
sys/compat/linux/common/linux_misc_notalpha.c: revision 1.87
Fix compat linux statfs/fstatfs syscalls on amd64.
- Do not use statfs64/fstatfs64 as they have an extra size argument.
- Add full 64bit linux struct statfs support.
 1.84.2.1.2.1 29-Oct-2007  wrstuden Catch up with 4.0 RC3
 1.85.2.4 17-May-2007  yamt sync with head.
 1.85.2.3 07-May-2007  yamt sync with head.
 1.85.2.2 24-Mar-2007  yamt sync with head.
 1.85.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.86.4.1 11-Jul-2007  mjf Sync with head.
 1.86.2.4 15-Jul-2007  ad Sync with head.
 1.86.2.3 01-Jul-2007  ad Adapt to callout API change.
 1.86.2.2 27-May-2007  ad Sync with head.
 1.86.2.1 10-Apr-2007  ad Sync with head.
 1.94.12.2 13-Nov-2007  bouyer Sync with HEAD
 1.94.12.1 25-Oct-2007  bouyer Sync with HEAD.
 1.94.8.3 09-Jan-2008  matt sync with HEAD
 1.94.8.2 08-Nov-2007  matt sync with -HEAD
 1.94.8.1 06-Nov-2007  matt sync with HEAD
 1.94.6.4 09-Dec-2007  jmcneill Sync with HEAD.
 1.94.6.3 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.94.6.2 11-Nov-2007  joerg Sync with HEAD.
 1.94.6.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.95.2.4 18-Feb-2008  mjf Sync with HEAD.
 1.95.2.3 27-Dec-2007  mjf Sync with HEAD.
 1.95.2.2 08-Dec-2007  mjf Sync with HEAD.
 1.95.2.1 19-Nov-2007  mjf Sync with HEAD.
 1.97.2.1 26-Dec-2007  ad Sync with head.
 1.98.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.100.8.1 18-May-2008  yamt sync with head.
 1.100.6.4 17-Jan-2009  mjf Sync with HEAD.
 1.100.6.3 05-Oct-2008  mjf Sync with HEAD.
 1.100.6.2 28-Sep-2008  mjf Sync with HEAD.
 1.100.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.101.2.4 11-Aug-2010  yamt sync with head.
 1.101.2.3 20-Jun-2009  yamt sync with head
 1.101.2.2 04-May-2009  yamt sync with head.
 1.101.2.1 16-May-2008  yamt sync with head.
 1.102.6.1 19-Oct-2008  haad Sync with HEAD.
 1.102.4.1 18-Jul-2008  simonb Sync with head.
 1.102.2.4 10-Oct-2008  skrll Sync with HEAD.
 1.102.2.3 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.102.2.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.102.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.104.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.105.2.1 23-Jul-2009  jym Sync with HEAD.
 1.106.4.1 05-Mar-2011  rmind sync with head
 1.106.2.2 06-Nov-2010  uebayasi Sync with HEAD.
 1.106.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.108.34.2 14-Dec-2018  martin Additionally pull up following revision(s) (requested by maxv in ticket #1660):

sys/compat/linux/common/linux_misc_notalpha.c: revision 1.110
sys/kern/kern_time.c: revision 1.193

Improve my kern_time.c::rev1.192, systematically clear the buffers we get
from 'ptimer_pool' to prevent more leaks.
 1.108.34.1 17-Jan-2015  martin branches: 1.108.34.1.2; 1.108.34.1.6;
Pull up following revision(s) (requested by maxv in ticket #427):
sys/compat/svr4/svr4_schedctl.c: revision 1.8
sys/netinet/tcp_timer.c: revision 1.88
sys/miscfs/genfs/layer_vfsops.c: revision 1.45
sys/compat/svr4/svr4_ioctl.c: revision 1.37
sys/ufs/chfs/chfs_vfsops.c: revision 1.14
sys/miscfs/fdesc/fdesc_vfsops.c: revision 1.91
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.30
sys/compat/common/kern_time_50.c: revision 1.28
sys/netinet6/ip6_forward.c: revision 1.74
sys/miscfs/umapfs/umap_vnops.c: revision 1.57
sys/compat/svr4/svr4_fcntl.c: revision 1.74
distrib/sets/lists/comp/mi: revision 1.1931
sys/netinet6/udp6_output.c: revision 1.46
sys/fs/puffs/puffs_compat.c: revision 1.3
sys/fs/udf/udf_rename.c: revision 1.11
sys/compat/svr4/svr4_filio.c: revision 1.24
sys/fs/udf/udf_rename.c: revision 1.12
sys/netinet/tcp_usrreq.c: revision 1.202
sys/miscfs/umapfs/umap_subr.c: revision 1.29
sys/compat/linux/common/linux_fadvise64.c: revision 1.3
sys/netinet/if_atm.c: revision 1.34
sys/miscfs/procfs/procfs_subr.c: revision 1.106
sys/miscfs/genfs/layer_subr.c: revision 1.37
sys/netinet/tcp_sack.c: revision 1.30
sys/compat/freebsd/freebsd_misc.c: revision 1.33
sys/compat/freebsd/freebsd_file.c: revision 1.33
sys/ufs/chfs/chfs_vnode.c: revision 1.12
sys/compat/svr4/svr4_ttold.c: revision 1.34
sys/compat/linux/common/linux_file.c: revision 1.114
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.43
sys/compat/linux/common/linux_signal.c: revision 1.76
sys/compat/common/compat_util.c: revision 1.46
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.18
sys/compat/svr4/svr4_sockio.c: revision 1.36
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.32
sys/compat/svr4/svr4_signal.c: revision 1.66
sys/kern/kern_exec.c: revision 1.410
sys/fs/puffs/puffs_vfsops.c: revision 1.115
sys/compat/svr4/svr4_exec_elf64.c: revision 1.15
sys/compat/linux/arch/i386/linux_machdep.c: revision 1.159
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.50
sys/compat/linux32/common/linux32_misc.c: revision 1.24
sys/netinet/in_pcb.c: revision 1.153
sys/sys/malloc.h: revision 1.116
sys/compat/common/if_43.c: revision 1.9
share/man/man9/Makefile: revision 1.380
sys/netinet/tcp_vtw.c: revision 1.12
sys/miscfs/umapfs/umap_vfsops.c: revision 1.95
sys/ufs/ext2fs/ext2fs_vfsops.c: revision 1.186
sys/compat/common/uipc_syscalls_43.c: revision 1.46
sys/ufs/ext2fs/ext2fs_vnops.c: revision 1.115
sys/fs/puffs/puffs_msgif.c: revision 1.97
sys/compat/svr4/svr4_ipc.c: revision 1.27
sys/compat/linux/common/linux_exec.c: revision 1.117
sys/ufs/ext2fs/ext2fs_readwrite.c: revision 1.66
sys/netinet/tcp_output.c: revision 1.179
sys/compat/svr4/svr4_termios.c: revision 1.28
sys/fs/udf/udf_strat_bootstrap.c: revision 1.4
sys/fs/puffs/puffs_subr.c: revision 1.67
sys/fs/puffs/puffs_node.c: revision 1.36
sys/miscfs/overlay/overlay_vnops.c: revision 1.21
sys/fs/cd9660/cd9660_node.c: revision 1.34
sys/netinet/raw_ip.c: revision 1.146
sys/sys/mallocvar.h: revision 1.13
sys/miscfs/overlay/overlay_vfsops.c: revision 1.63
share/man/man9/malloc.9: revision 1.50
sys/netinet6/dest6.c: revision 1.18
sys/compat/linux/common/linux_uselib.c: revision 1.33
sys/compat/linux/common/linux_socket.c: revision 1.120
share/man/man9/malloc.9: revision 1.51
sys/netinet/tcp_subr.c: revision 1.257
sys/compat/linux/common/linux_socketcall.c: revision 1.45
sys/compat/linux/common/linux_fadvise64_64.c: revision 1.3
sys/compat/freebsd/freebsd_ipc.c: revision 1.17
sys/compat/linux/common/linux_misc_notalpha.c: revision 1.109
sys/compat/linux/arch/alpha/linux_pipe.c: revision 1.17
sys/netinet6/in6_pcb.c: revision 1.132
sys/netinet6/in6_ifattach.c: revision 1.94
sys/compat/svr4/svr4_exec_elf32.c: revision 1.15
sys/miscfs/nullfs/null_vfsops.c: revision 1.90
sys/fs/cd9660/cd9660_util.c: revision 1.12
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.48
sys/compat/freebsd/freebsd_exec_elf32.c: revision 1.20
sys/miscfs/procfs/procfs_vfsops.c: revision 1.94
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.28
sys/compat/linux/common/linux_sched.c: revision 1.67
sys/compat/linux/common/linux_exec_aout.c: revision 1.67
sys/compat/linux/common/linux_pipe.c: revision 1.67
sys/compat/linux/common/linux_llseek.c: revision 1.34
sys/compat/linux/arch/mips/linux_ptrace.c: revision 1.10
Do not uselessly include <sys/malloc.h>.
Cleanup:
- remove struct kmembuckets (dead)
- correctly deadify MALLOC_XX
- remove MALLOC_DEFINE_LIMIT and MALLOC_JUSTDEFINE_LIMIT (dead)
- remove malloc_roundup(), malloc_type_setlimit(), MALLOC_DEFINE_LIMIT()
and MALLOC_JUSTDEFINE_LIMIT() from man 9 malloc
New sentence, new line. Bump date for previous.
Obsolete malloc_roundup(9), malloc_type_setlimit(9) and MALLOC_DEFINE_LIMIT(9)
man pages.
 1.108.34.1.6.1 14-Dec-2018  martin Additionally pull up following revision(s) (requested by maxv in ticket #1660):

sys/compat/linux/common/linux_misc_notalpha.c: revision 1.110
sys/kern/kern_time.c: revision 1.193

Improve my kern_time.c::rev1.192, systematically clear the buffers we get
from 'ptimer_pool' to prevent more leaks.
 1.108.34.1.2.1 14-Dec-2018  martin Additionally pull up following revision(s) (requested by maxv in ticket #1660):

sys/compat/linux/common/linux_misc_notalpha.c: revision 1.110
sys/kern/kern_time.c: revision 1.193

Improve my kern_time.c::rev1.192, systematically clear the buffers we get
from 'ptimer_pool' to prevent more leaks.
 1.108.18.1 03-Dec-2017  jdolecek update from HEAD
 1.109.20.1 10-Jun-2019  christos Sync with HEAD
 1.109.18.1 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.109.12.1 30-Nov-2018  martin Additionally pull up following revision(s) (requested by maxv in ticket #1110):

sys/compat/linux/common/linux_misc_notalpha.c: revision 1.110
sys/kern/kern_time.c: revision 1.193

Improve my kern_time.c::rev1.192, systematically clear the buffers we get
from 'ptimer_pool' to prevent more leaks.
 1.110.12.1 14-Dec-2020  thorpej Sync w/ HEAD.
 1.22 23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.21 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.20 20-Dec-2007  dsl branches: 1.20.6; 1.20.8; 1.20.10;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.19 04-Dec-2007  dsl branches: 1.19.4;
Remove all the __P
 1.18 11-Dec-2005  christos branches: 1.18.44; 1.18.46; 1.18.52; 1.18.56;
merge ktrace-lwp.
 1.17 30-Oct-2005  chs add support for the linux PROT_GROWS{DOWN,UP} mprotect() flags.
fixes PR 30008.
 1.16 03-May-2005  manu branches: 1.16.2; 1.16.4;
First work on COMPAT_LINUX/amd64
Process startup and dynamiclinking work, but processes hang due to
Linux arch_prctl(2) not being really supported yet.
 1.15 23-Jun-2003  christos branches: 1.15.2; 1.15.16;
PR/21937: Todd Vierling: Proper support for mmap2
 1.14 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.13 22-Mar-2002  christos branches: 1.13.4;
nuke mmap2, cleanup mmap, add mprotect
 1.12 15-Feb-2002  christos - add a real linux_sys___sysctl because the mib numbers are different.
implement only the kernel version getting entries.
- make the signal conversion functions consistent; dest is arg 1.
- make linux_fakedev deal with block and char devices differently.
- add linux_sys_ugetrlimit, and flesh out the regular get/setrlimit so
that they work properly.
- add linux_mmap2 [untested].
- bump kernel to 2.4.18, and make the date be valentine's day :-)
- linux_sys_*stat64 family was totally busted. Fix it.

tested only on i386.

Status:
gdb, telnet, work
jdk-1.4.0 extractor works, jdk still coredumps.

christos
 1.11 14-Jan-2002  bjh21 Crude first cut at ARMLinux binary compatibility. Successfully runs
"/emul/linux/bin/echo hello, world", dynamically linked.
 1.10 22-Sep-2001  manu Enable Mips Linux emulation in header files
 1.9 08-Sep-2001  manu Removed a hack to make PowerPC mmap work. This could have side effects on
alpha and i386. It has been tested and works on i386.
 1.8 19-Jan-2001  manu branches: 1.8.2; 1.8.4; 1.8.6;
Cosmetic fix to move powerpc from "guesses" to "know values"
 1.7 10-Apr-2000  chs sparc -> __sparc__
 1.6 15-Dec-1998  itohy branches: 1.6.8;
Added linux compat support on m68k ports.
 1.5 07-Oct-1998  erh Move linux_sys_mmap declarations to linux_mmap.h Make sure oldmmap.c includes oldmmap.h.
 1.4 04-Oct-1998  fvdl Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.3 03-Oct-1998  christos Attempt to fix the mess.
 1.2 01-Oct-1998  erh Split compat/linux/linux_mmap.h into i386 and common parts.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.6.8.2 11-Feb-2001  bouyer Sync with HEAD.
 1.6.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.8.6.1 01-Oct-2001  fvdl Catch up with -current.
 1.8.4.5 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.8.4.4 16-Mar-2002  jdolecek Catch up with -current.
 1.8.4.3 11-Feb-2002  jdolecek Sync w/ -current.
 1.8.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.8.4.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.8.2.5 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.8.2.4 28-Feb-2002  nathanw Catch up to -current.
 1.8.2.3 26-Sep-2001  nathanw Catch up to -current.
Again.
 1.8.2.2 21-Sep-2001  nathanw Catch up to -current.
 1.8.2.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.13.4.1 22-Oct-2003  jmc Pullup rev 1.15 (via patch) (requested by tv in ticket #1427)

Proper support for mmap2
 1.15.16.1 01-Nov-2005  tron Pull up following revision(s) (requested by chs in ticket #924):
sys/compat/linux/common/linux_misc.c: revision 1.141
sys/compat/linux/common/linux_mmap.h: revision 1.17
add support for the linux PROT_GROWS{DOWN,UP} mprotect() flags.
fixes PR 30008.
 1.15.2.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.16.4.1 02-Nov-2005  yamt sync with head.
 1.16.2.3 21-Jan-2008  yamt sync with head
 1.16.2.2 07-Dec-2007  yamt sync with head
 1.16.2.1 21-Jun-2006  yamt sync with head.
 1.18.56.2 26-Dec-2007  ad Sync with head.
 1.18.56.1 08-Dec-2007  ad Sync with head.
 1.18.52.2 27-Dec-2007  mjf Sync with HEAD.
 1.18.52.1 08-Dec-2007  mjf Sync with HEAD.
 1.18.46.1 09-Jan-2008  matt sync with HEAD
 1.18.44.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.19.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.20.10.1 16-May-2008  yamt sync with head.
 1.20.8.1 18-May-2008  yamt sync with head.
 1.20.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.17 01-Oct-2024  riastradh sys/compat/linux/common: Nix trailing whitespace, and one blank line.

No functional change intended.
 1.16 01-Jul-2024  christos Add linux POSIX message queue support (Ricardo Branco)
 1.15 19-Aug-2023  christos branches: 1.15.6;
new inotify support GSoC 2023 (Theodore Preduta)
 1.14 26-Apr-2020  thorpej Add a NetBSD native futex implementation, mostly written by riastradh@.
Map the COMPAT_LINUX futex calls to the native ones.
 1.13 21-Mar-2020  pgoyette Deal with having to teardown sysctl entries in multiple sub-trees.

(This used to work, but I broke it recently.)
 1.12 16-Mar-2020  pgoyette Use the module subsystem's ability to process SYSCTL_SETUP() entries to
automate installation of sysctl nodes.

Note that there are still a number of device and pseudo-device modules
that create entries tied to individual device units, rather than to the
module itself. These are not changed.
 1.11 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.10 10-Dec-2017  kre branches: 1.10.2; 1.10.4;

Finally (hopefully) return completely to the state where compat_linux is
enabled by default.

While here make it possible to enable this if already enabled, or disable
if already disabled, without error. Some minor KNF.
 1.9 08-Dec-2017  kre Finish the previous change - as well as setting the default for these
compat modules back to enabled, stop forcing it to switch back to
disabled any time the module is init'd (which is truly barbaric behaviour.)
 1.8 01-Dec-2017  joerg Unbreak Linux emulation by default. While not loading it automatically
is somewhat sensible, breaking functionality of GENERIC is not and has
been objected to on a regular base.
 1.7 29-Sep-2017  maxv Remove compat_linux from the autoload list, and add a sysctl to enable or
disable it - which defaults to disabled. The following command is now
required to use linux binaries:

sysctl -w emul.linux.enabled=1

After a discussion on tech-kern@. All the other ideas to reduce the attack
surface have drawbacks, and this sysctl seems to be the best option.
 1.6 03-Dec-2015  pgoyette Merge the compat_sysv module into the sysv_ipc module - it should
never have been a separate module in the first place (my bad).

Adjust dependencies as appropriate.
 1.5 10-Oct-2015  pgoyette Add an additional dependency on compat_sysv
 1.4 07-Mar-2014  christos branches: 1.4.4; 1.4.6;
c99 initializers for struct execsw
 1.3 19-Sep-2013  christos exec modules need to be of the exec kind
 1.2 14-Sep-2011  christos branches: 1.2.2; 1.2.12; 1.2.16;
Can't use RUN_ONCE here to initialize the futex_lock, otherwise we cannot
unload the module.
 1.1 19-Nov-2008  ad branches: 1.1.4; 1.1.6; 1.1.8; 1.1.12;
Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.1.12.2 04-May-2009  yamt sync with head.
 1.1.12.1 19-Nov-2008  yamt file linux_mod.c was added on branch yamt-nfs-mp on 2009-05-04 08:12:22 +0000
 1.1.8.2 19-Jan-2009  skrll Sync with HEAD.
 1.1.8.1 19-Nov-2008  skrll file linux_mod.c was added on branch nick-hppapmap on 2009-01-19 13:17:31 +0000
 1.1.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.1.6.1 19-Nov-2008  mjf file linux_mod.c was added on branch mjf-devfs2 on 2009-01-17 13:28:44 +0000
 1.1.4.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.1.4.1 19-Nov-2008  haad file linux_mod.c was added on branch haad-dm on 2008-12-13 01:13:56 +0000
 1.2.16.1 18-May-2014  rmind sync with head
 1.2.12.2 03-Dec-2017  jdolecek update from HEAD
 1.2.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.2.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.4.6.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.4.4.2 17-Nov-2015  riz Revert ticket #1020, per pgoyette in ticket #1041.
 1.4.4.1 08-Nov-2015  riz Pull up following revision(s) (requested by pgoyette in ticket #1020):
sys/compat/netbsd32/netbsd32_mod.c: revision 1.6
sys/compat/netbsd32/netbsd32_mod.c: revision 1.7
sys/compat/netbsd32/netbsd32_mod.c: revision 1.8
sys/compat/netbsd32/netbsd32_mod.c: revision 1.9
sys/compat/linux/common/linux_mod.c: revision 1.5
Add an additional dependency on compat_sysv
Add another dependency for nfsserver
And yet another dependency, this time on mq
Ooops, spell the module name in full. "mqueue" vs "mq"
we need compat_sysv now.
 1.10.4.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.10.4.1 10-Jun-2019  christos Sync with HEAD
 1.10.2.4 24-Jan-2019  pgoyette Reduce the list of required modules to what is really needed
 1.10.2.3 18-Oct-2018  pgoyette Add a few more references to the (currently always but not forever)
built-in compat_util module
 1.10.2.2 19-Sep-2018  pgoyette Remove leading coma from list of required modules. It doesn't seem
to cause any real problems, but it makes modstat output look weird.
 1.10.2.1 12-Sep-2018  pgoyette Adjust module requirements to reflect the new more granular modules
 1.15.6.1 02-Aug-2025  perseant Sync with HEAD
 1.2 17-May-2025  andvar branches: 1.2.4;
Fix RCS ID in few more files.
 1.1 01-Jul-2024  christos Add linux POSIX message queue support (Ricardo Branco)
 1.2.4.2 02-Aug-2025  perseant Sync with HEAD
 1.2.4.1 17-May-2025  perseant file linux_mqueue.c was added on branch perseant-exfatfs on 2025-08-02 05:56:26 +0000
 1.2 17-May-2025  andvar branches: 1.2.4;
Fix RCS ID in few more files.
 1.1 01-Jul-2024  christos Add linux POSIX message queue support (Ricardo Branco)
 1.2.4.2 02-Aug-2025  perseant Sync with HEAD
 1.2.4.1 17-May-2025  perseant file linux_mqueue.h was added on branch perseant-exfatfs on 2025-08-02 05:56:26 +0000
 1.14 01-Oct-2024  riastradh sys/compat/linux/common: Nix trailing whitespace, and one blank line.

No functional change intended.
 1.13 18-Nov-2009  njoly branches: 1.13.100;
Make compat linux/linux32 msgrcv_msgarg type member of type
long/netbsd32_long to match linux definition.
 1.12 09-Dec-2008  njoly Add some padding members to linux_msqid64_ds for 32-bit archs. This
fix msgctl(2) IPC_STAT|IPC_64 calls, at least, on i386.
 1.11 21-May-2008  njoly branches: 1.11.4; 1.11.6;
Add IPC_64 support to msgctl, needed for amd64.
 1.10 28-Apr-2008  martin branches: 1.10.2;
Remove clause 3 and 4 from TNF licenses
 1.9 20-Dec-2007  dsl branches: 1.9.6; 1.9.8; 1.9.10;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.8 04-Dec-2007  dsl branches: 1.8.4;
Remove all the __P
 1.7 09-Feb-2006  manu branches: 1.7.38; 1.7.40; 1.7.46; 1.7.50;
Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.6 18-Jan-2003  thorpej branches: 1.6.18; 1.6.30; 1.6.32; 1.6.34;
Merge the nathanw_sa branch.
 1.5 04-Oct-1998  fvdl branches: 1.5.24;
Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.4 03-Oct-1998  christos Attempt to fix the mess.
 1.3 01-Oct-1998  erh Move IPC headers to common. The msg, sem and shm files, in addition to other common structures and to avoid creating several more machine dependent header files, include the syscall arguments for several system calls which don't exist on all architechtures.
 1.2 15-Aug-1995  fvdl Implement the rest of the sysv ipc calls ({sem,msg}*())
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.5.24.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.6.34.1 22-Apr-2006  simonb Sync with head.
 1.6.32.1 09-Sep-2006  rpaulo sync with head
 1.6.30.1 18-Feb-2006  yamt sync with head.
 1.6.18.3 21-Jan-2008  yamt sync with head
 1.6.18.2 07-Dec-2007  yamt sync with head
 1.6.18.1 21-Jun-2006  yamt sync with head.
 1.7.50.2 26-Dec-2007  ad Sync with head.
 1.7.50.1 08-Dec-2007  ad Sync with head.
 1.7.46.2 27-Dec-2007  mjf Sync with HEAD.
 1.7.46.1 08-Dec-2007  mjf Sync with HEAD.
 1.7.40.1 09-Jan-2008  matt sync with HEAD
 1.7.38.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.8.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.9.10.3 11-Mar-2010  yamt sync with head
 1.9.10.2 04-May-2009  yamt sync with head.
 1.9.10.1 16-May-2008  yamt sync with head.
 1.9.8.2 04-Jun-2008  yamt sync with head
 1.9.8.1 18-May-2008  yamt sync with head.
 1.9.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.9.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.10.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.11.6.1 19-Jan-2009  skrll Sync with HEAD.
 1.11.4.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.13.100.1 02-Aug-2025  perseant Sync with HEAD
 1.9 01-Oct-2024  riastradh sys/compat/linux/common: Nix trailing whitespace, and one blank line.

No functional change intended.
 1.8 07-Sep-2021  riastradh branches: 1.8.10;
sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.7 21-Mar-2008  ad branches: 1.7.6; 1.7.84; 1.7.96;
Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
 1.6 20-Dec-2007  dsl branches: 1.6.6;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.5 19-Oct-2007  njoly branches: 1.5.4; 1.5.8;
Add compat_linux and exec_linux_elf lkm support for amd64:
- Add needed COMPAT_OSSAUDIO to GENERIC.
- Add missing includes needed by linux_syscallargs.h.
- Add lkm building.
 1.4 04-Mar-2007  christos branches: 1.4.14; 1.4.16; 1.4.20;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.3 09-Feb-2007  ad branches: 1.3.2;
Merge newlock2 to head.
 1.2 11-Dec-2005  christos branches: 1.2.20;
merge ktrace-lwp.
 1.1 28-Feb-2005  soren branches: 1.1.2; 1.1.6; 1.1.8; 1.1.10;
Emulate basic mtio ioctls.
 1.1.10.6 24-Mar-2008  yamt sync with head.
 1.1.10.5 21-Jan-2008  yamt sync with head
 1.1.10.4 27-Oct-2007  yamt sync with head.
 1.1.10.3 03-Sep-2007  yamt sync with head.
 1.1.10.2 26-Feb-2007  yamt sync with head.
 1.1.10.1 21-Jun-2006  yamt sync with head.
 1.1.8.2 29-Apr-2005  kent sync with -current
 1.1.8.1 28-Feb-2005  kent file linux_mtio.c was added on branch kent-audio2 on 2005-04-29 11:28:40 +0000
 1.1.6.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.1.6.1 28-Feb-2005  yamt file linux_mtio.c was added on branch yamt-km on 2005-03-19 08:33:37 +0000
 1.1.2.2 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.1.2.1 28-Feb-2005  skrll file linux_mtio.c was added on branch ktrace-lwp on 2005-03-04 16:40:03 +0000
 1.2.20.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.3.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.4.20.1 25-Oct-2007  bouyer Sync with HEAD.
 1.4.16.2 09-Jan-2008  matt sync with HEAD
 1.4.16.1 06-Nov-2007  matt sync with HEAD
 1.4.14.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.5.8.1 02-Jan-2008  bouyer Sync with HEAD
 1.5.4.1 26-Dec-2007  ad Sync with head.
 1.6.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.7.96.1 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.7.84.1 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1836):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.7.6.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.7.6.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.8.10.1 02-Aug-2025  perseant Sync with HEAD
 1.2 11-Dec-2005  christos merge ktrace-lwp.
 1.1 28-Feb-2005  soren branches: 1.1.2; 1.1.6; 1.1.8;
Emulate basic mtio ioctls.
 1.1.8.2 29-Apr-2005  kent sync with -current
 1.1.8.1 28-Feb-2005  kent file linux_mtio.h was added on branch kent-audio2 on 2005-04-29 11:28:40 +0000
 1.1.6.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.1.6.1 28-Feb-2005  yamt file linux_mtio.h was added on branch yamt-km on 2005-03-19 08:33:37 +0000
 1.1.2.2 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.1.2.1 28-Feb-2005  skrll file linux_mtio.h was added on branch ktrace-lwp on 2005-03-04 16:40:03 +0000
 1.74 25-Nov-2021  ryo add support COMPAT_LINUX32 for aarch64
 1.73 23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.72 18-Aug-2009  christos more debugging for mmap
 1.71 03-Dec-2008  ad PR port-amd64/40091 compat_linux32 module loading = panic due to missing syms
 1.70 18-Jun-2008  tsutsui branches: 1.70.2; 1.70.4;
Include <sys/sched.h> before <sys/syscallargs.h> for cpuset_t.
 1.69 28-Apr-2008  martin branches: 1.69.2; 1.69.4;
Remove clause 3 and 4 from TNF licenses
 1.68 20-Dec-2007  dsl branches: 1.68.6; 1.68.8; 1.68.10;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.67 08-Dec-2007  dsl branches: 1.67.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.66 09-Feb-2007  ad branches: 1.66.18; 1.66.20; 1.66.28;
Merge newlock2 to head.
 1.65 09-Feb-2006  manu branches: 1.65.14;
Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.64 11-Dec-2005  christos branches: 1.64.2; 1.64.4; 1.64.6;
merge ktrace-lwp.
 1.63 24-Aug-2004  jdolecek branches: 1.63.12;
fix debug printf - lm_addr is not pointer anumore
 1.62 22-Aug-2004  jdolecek make struct linux_oldmmap members explicitly unsigned (with exception
of lm_fd, which can be -1), rename lm_pos to lm_offset, g/c some unneeded casts

no functional change
 1.61 18-Jan-2003  thorpej branches: 1.61.2;
Merge the nathanw_sa branch.
 1.60 17-Dec-2002  tron Include "uvm/uvm_param.h" to get definition of PAGE_MASK required for
last change.
 1.59 16-Dec-2002  christos Don't allow non-page-aligned offsets! So dumb. From Jason Ish, thanks.
 1.58 29-Mar-2002  christos branches: 1.58.4;
- #undef DPRINTF for files that are included from other files.
- more debugging for socketcalls
- fix sa_len if AF_INET; somehow we get passed 28 instead of 16?
 1.57 22-Mar-2002  christos gc debugging printfs.
 1.56 15-Feb-2002  christos s/printf/uprintf/
 1.55 15-Feb-2002  christos - add a real linux_sys___sysctl because the mib numbers are different.
implement only the kernel version getting entries.
- make the signal conversion functions consistent; dest is arg 1.
- make linux_fakedev deal with block and char devices differently.
- add linux_sys_ugetrlimit, and flesh out the regular get/setrlimit so
that they work properly.
- add linux_mmap2 [untested].
- bump kernel to 2.4.18, and make the date be valentine's day :-)
- linux_sys_*stat64 family was totally busted. Fix it.

tested only on i386.

Status:
gdb, telnet, work
jdk-1.4.0 extractor works, jdk still coredumps.

christos
 1.54 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.53 29-Dec-2000  fvdl branches: 1.53.2; 1.53.4;
Avoid sign extension problem in offset.
 1.52 29-Jun-2000  mrg remove include of <vm/vm.h>
 1.51 26-Jun-2000  mrg remove redundant vm includes.
 1.50 07-Oct-1998  erh branches: 1.50.12; 1.50.22;
Move linux_sys_mmap declarations to linux_mmap.h Make sure oldmmap.c includes oldmmap.h.
 1.49 04-Oct-1998  fvdl Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.48 03-Oct-1998  christos Attempt to fix the mess.
 1.47 01-Oct-1998  erh Wheeee!: 8-way split of compat/linux/linux_misc.c into common code and multi-architechture functions.
 1.46 11-Sep-1998  mycroft Substantial signal handling changes:
* Increase the size of sigset_t to accomodate 128 signals -- adding new
versions of sys_setprocmask(), sys_sigaction(), sys_sigpending() and
sys_sigsuspend() to handle the changed arguments.
* Abstract the guts of sys_sigaltstack(), sys_setprocmask(), sys_sigaction(),
sys_sigpending() and sys_sigsuspend() into separate functions, and call them
from all the emulations rather than hard-coding everything. (Avoids uses
the stackgap crap for these system calls.)
* Add a new flag (p_checksig) to indicate that a process may have signals
pending and userret() needs to do the full (slow) check.
* Eliminate SAS_ALTSTACK; it's exactly the inverse of SS_DISABLE.
* Correct emulation bugs with restoring SS_ONSTACK.
* Make the signal mask in the sigcontext always use the emulated mask format.
* Store signals internally in sigaction structures, rather than maintaining a
bunch of little sigsets for each SA_* bit.
* Keep track of where we put the signal trampoline, rather than figuring it out
in *_sendsig().
* Issue a warning when a non-emulated sigaction bit is observed.
* Add missing emulated signals, and a native SIGPWR (currently not used).
* Implement the `not reset when caught' semantics for relevant signals.

Note: Only code touched by the i386 port has been modified. Other ports and
emulations need to be updated.
 1.45 08-Sep-1998  rvb ufs_readdir no longer checks if vp->v_type != VDIR so
the individual emulated readdirs must check.
Since netbsd and freebsd return EINVAL for the error
and I don't know what the other platforms do, return
EINVAL for them too.
 1.44 18-Aug-1998  thorpej Add some braces to make egcs happy.
 1.43 07-Jul-1998  thorpej Oops, fix typo, pointed out by Urban Boquist <boquist@cs.chalmers.se>.
 1.42 02-Jul-1998  thorpej Implement the shrinking and no-change bits of the Linux mremap(2) system
call, provided by Urban Boquist <boquist@cs.chalmers.se> in PR #5693.

Add a comment about how one might implement the growing bit of mremap(2).
 1.41 24-Mar-1998  mycroft Fix typo in utime().
 1.40 03-Mar-1998  fvdl Only free cookiebuf when sure that the vop actually allocated it.
 1.39 01-Mar-1998  fvdl Merge with Lite2 + local changes
 1.38 20-Feb-1998  mycroft Linux's getsid(2) does in fact return a pid, not a pointer.
 1.37 14-Feb-1998  thorpej Add a comment clearly describing that Linux's getsid(2) differs from
the XPG4.2 definition in that it returns the kernel virtual address
of the session structure, rather than the process group ID of the
session leader.
 1.36 21-Oct-1997  fvdl branches: 1.36.2;
msync -> __msync13
 1.35 10-Oct-1997  fvdl Fix braino in my interpretation of the eof flag to VOP_READDIR.
 1.34 10-Oct-1997  mycroft Emulate mremap(2) by returning ENOMEM for now. This should be sufficient for
realloc(3) and other uses. From Matthias Scheler in PR 3920.
 1.33 10-Oct-1997  fvdl Signal error when getting a 64 bit offset cookie that can't be stored
in 32 bits. Provide an error message to the user, and return EINVAL.
Also, pay attention to the EOF flag from VOP_READDIR. Correct a
misspell in a panic message.
 1.32 04-Aug-1997  bouyer Fix "missing entries" bug when reading large directories: When reading a
directory and running out of space in the dest buffer, off should point to the
current entry (which was not saved) and not to the next.
I discovered this bug using linux and SunOS emulation over NFS, but seems to
affect other emulations as well.
 1.31 27-Jul-1997  augustss branches: 1.31.2;
Changes to the sudio system:
- It is now possible to handle devices that want "looping" DMA,
e.g. the SoundBlaster correctly. The WSS and SB drivers use this.
To do this several new methods were introduced in audio_hw_if.
- Different silence handling (forced by previous change).
- The audio driver can now be mmap()-ed, but due to problems in
the VM system only for writing for now.
- The OSS (Linux) audio emulation takes advantage of some of the
new features.
 1.30 07-Apr-1997  augustss Add Linux nice() syscall.
 1.29 10-Aug-1996  mycroft sys/dir.h -> sys/dirent.h
 1.28 23-Jun-1996  mycroft Catch up with setre[ug]id() changes.
 1.27 20-May-1996  fvdl branches: 1.27.4;
Update list of Linux syscalls and implement the ones that are likely to be
used and doable.
 1.26 04-Apr-1996  christos - Prototyping changes
- Fix bug that gcc -Wall found in linux_sys_getpgid()
 1.25 03-Apr-1996  mycroft Add explicit return types.
 1.24 18-Dec-1995  fvdl msync, readv and writev were recently added to the Linux kernel; add them
to the emulation as well.
 1.23 09-Dec-1995  mycroft We don't need a private version of fork() here any more.
 1.22 09-Oct-1995  mycroft Use cookies for directory offset, mostly from Greg Hudson.
 1.21 07-Oct-1995  mycroft Prefix names of system call implementation functions with `sys_'.
 1.20 19-Sep-1995  thorpej Make system calls conform to a standard prototype and bring those
prototypes into scope.
 1.19 13-Sep-1995  fvdl Update offset elsewhere in linux_getdents(); still emulate a bug in
Linux, but avoid endless loops.
 1.18 07-Sep-1995  fvdl Fix some bugs & typing problems.
 1.17 23-Aug-1995  fvdl Emulate some syscalls that appear in Linux 1.3: a select() with normal args,
getdents() and flock().
 1.16 21-Aug-1995  fvdl Check for status NULL argument in wait4 and waitpid. From PR #1392
by Thomas EberHardt.
 1.15 21-Aug-1995  mycroft Implement the old and older uname(2) calls.
 1.14 16-Aug-1995  mycroft If updating the timeval would make it negative, zero it instead.
 1.13 16-Aug-1995  mycroft Allow bogus timevals, per Linux.
 1.12 14-Aug-1995  mycroft Export bsd_to_linux_sig[], and use it.
 1.11 14-Aug-1995  mycroft Rearrange #includes.
 1.10 13-Aug-1995  mycroft Linux doesn't allow select(2) to be restarted.
 1.9 24-Jun-1995  christos Use compat_util.[ch].
 1.8 22-Jun-1995  fvdl * Changed to use generic ELF code from kern/exec_elf.c (which was taken
from the svr4 exec code plus the linux compat mods)
* Include file change
* Add multicast sockopts (from John Brezak)
 1.7 11-Jun-1995  fvdl Linux select() returns the amount of time left before a timeout would have
occured in the timeval structure. Emulate this behavior. Reported by
Theo de Raadt.
 1.6 11-Jun-1995  fvdl * Make Linux ELF binaries work. Lots of code duplication, but it will have to do
for now.
* Add a sanity check in linux_uselib
 1.5 10-Jun-1995  mycroft Rename the dirent fields to match Linux. Make sure the requested buffer
is no larger than MAXBSIZE.
 1.4 22-Mar-1995  mycroft Emulate the return value of times() better.
 1.3 21-Mar-1995  mycroft Update to use timer{add,sub}().
 1.2 05-Mar-1995  fvdl Added a few more system calls.
More consistent alternate root file semantics throughout.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.27.4.2 10-Dec-1996  mycroft From trunk:
sys/dir.h -> sys/dirent.h
 1.27.4.1 10-Dec-1996  mycroft From trunk:
Implement setre[ug]id() for real.
 1.31.2.2 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.31.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.36.2.1 08-May-1998  mycroft Pull up 1.41, per request of mycroft.
 1.50.22.1 30-Mar-2001  he Pull up revision 1.53 (requested by fvdl):
Add some required Linux emulation bits to support the Linux
version of VMware.
 1.50.12.2 05-Jan-2001  bouyer Sync with HEAD
 1.50.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.53.4.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.53.4.2 16-Mar-2002  jdolecek Catch up with -current.
 1.53.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.53.2.7 19-Dec-2002  thorpej Sync with HEAD.
 1.53.2.6 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.53.2.5 17-Apr-2002  nathanw Catch up to -current.
 1.53.2.4 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.53.2.3 28-Feb-2002  nathanw Catch up to -current.
 1.53.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.53.2.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.58.4.2 22-Oct-2003  jmc Pullup rev 1.60 (requested by tv in ticket #1426)

Don't allow non-page-aligned offsets.
 1.58.4.1 22-Oct-2003  jmc Pullup rev 1.59 (requested by tv in ticket #1426)

Don't allow non-page-aligned offsets.
 1.61.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.61.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.61.2.1 25-Aug-2004  skrll Sync with HEAD.
 1.63.12.3 21-Jan-2008  yamt sync with head
 1.63.12.2 26-Feb-2007  yamt sync with head.
 1.63.12.1 21-Jun-2006  yamt sync with head.
 1.64.6.1 22-Apr-2006  simonb Sync with head.
 1.64.4.1 09-Sep-2006  rpaulo sync with head
 1.64.2.1 18-Feb-2006  yamt sync with head.
 1.65.14.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.66.28.1 26-Dec-2007  ad Sync with head.
 1.66.20.1 09-Jan-2008  matt sync with HEAD
 1.66.18.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.67.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.68.10.3 19-Aug-2009  yamt sync with head.
 1.68.10.2 04-May-2009  yamt sync with head.
 1.68.10.1 16-May-2008  yamt sync with head.
 1.68.8.1 18-May-2008  yamt sync with head.
 1.68.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.68.6.2 29-Jun-2008  mjf Sync with HEAD.
 1.68.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.69.4.1 18-Jun-2008  simonb Sync with head.
 1.69.2.3 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.69.2.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.69.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.70.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.70.2.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.6 23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.5 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.4 11-Dec-2005  christos branches: 1.4.70; 1.4.72; 1.4.74;
merge ktrace-lwp.
 1.3 22-Aug-2004  jdolecek make struct linux_oldmmap members explicitly unsigned (with exception
of lm_fd, which can be -1), rename lm_pos to lm_offset, g/c some unneeded casts

no functional change
 1.2 07-Oct-1998  erh branches: 1.2.46;
Move linux_sys_mmap declarations to linux_mmap.h Make sure oldmmap.c includes oldmmap.h.
 1.1 01-Oct-1998  erh Define structures needed for these functions.
 1.2.46.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.46.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.46.1 25-Aug-2004  skrll Sync with HEAD.
 1.4.74.1 16-May-2008  yamt sync with head.
 1.4.72.1 18-May-2008  yamt sync with head.
 1.4.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.68 23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.67 07-Sep-2021  riastradh sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.66 28-Apr-2008  martin branches: 1.66.2; 1.66.80; 1.66.92;
Remove clause 3 and 4 from TNF licenses
 1.65 20-Dec-2007  dsl branches: 1.65.6; 1.65.8; 1.65.10;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.64 08-Nov-2007  njoly branches: 1.64.2; 1.64.6;
Replace strncpy with strlcpy in compat linux and linux32 uname,
old_uname and oldold_uname syscalls to ensure that all *utsname fields
are always NUL terminated.
 1.63 10-May-2007  christos branches: 1.63.6; 1.63.8; 1.63.12; 1.63.14;
- linux uname -m on x86 returns i{3,4,5,6}86 make it so.
- delete the machine sysctl that never worked, and gc linux_machine.
 1.62 23-Mar-2007  mrg implement emul.linux.kern.machine, which can be set to "i686", like
some applications seem to want.
 1.61 09-Feb-2007  ad branches: 1.61.2; 1.61.6; 1.61.8; 1.61.10;
Merge newlock2 to head.
 1.60 16-Nov-2006  christos __unused removal on arguments; approved by core.
 1.59 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.58 19-Jan-2003  thorpej branches: 1.58.18; 1.58.48; 1.58.50;
Merge the nathanw_sa branch.
 1.57 18-Jan-2003  jdolecek LWPify
 1.56 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.55 29-Dec-2000  fvdl branches: 1.55.2; 1.55.4;
Hardcode what the linux uname() calls return (Linux 2.2.5 is the current
value). A few major applications check for this (like VMware), and
there is no other way to trick them. Needs a more generic solution
eventually.
 1.54 29-Jun-2000  mrg remove include of <vm/vm.h>
 1.53 26-Jun-2000  mrg remove redundant vm includes.
 1.52 28-Mar-2000  simonb branches: 1.52.4;
Centralise the declarations of cpu_model, machine, machine_arch,
osrelease, and ostype and remove "extern char foo[];" (for hostname
and domainname too).

Also delete redunctant decl of boottime in kern_info_43.c.
 1.51 13-Mar-2000  soren Fix doubled 'the's in comments.
 1.50 04-Oct-1998  fvdl branches: 1.50.12;
Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.49 03-Oct-1998  christos Attempt to fix the mess.
 1.48 01-Oct-1998  perry shut up egcs complaints by adding braces
 1.47 01-Oct-1998  erh Wheeee!: 8-way split of compat/linux/linux_misc.c into common code and multi-architechture functions.
 1.46 11-Sep-1998  mycroft Substantial signal handling changes:
* Increase the size of sigset_t to accomodate 128 signals -- adding new
versions of sys_setprocmask(), sys_sigaction(), sys_sigpending() and
sys_sigsuspend() to handle the changed arguments.
* Abstract the guts of sys_sigaltstack(), sys_setprocmask(), sys_sigaction(),
sys_sigpending() and sys_sigsuspend() into separate functions, and call them
from all the emulations rather than hard-coding everything. (Avoids uses
the stackgap crap for these system calls.)
* Add a new flag (p_checksig) to indicate that a process may have signals
pending and userret() needs to do the full (slow) check.
* Eliminate SAS_ALTSTACK; it's exactly the inverse of SS_DISABLE.
* Correct emulation bugs with restoring SS_ONSTACK.
* Make the signal mask in the sigcontext always use the emulated mask format.
* Store signals internally in sigaction structures, rather than maintaining a
bunch of little sigsets for each SA_* bit.
* Keep track of where we put the signal trampoline, rather than figuring it out
in *_sendsig().
* Issue a warning when a non-emulated sigaction bit is observed.
* Add missing emulated signals, and a native SIGPWR (currently not used).
* Implement the `not reset when caught' semantics for relevant signals.

Note: Only code touched by the i386 port has been modified. Other ports and
emulations need to be updated.
 1.45 08-Sep-1998  rvb ufs_readdir no longer checks if vp->v_type != VDIR so
the individual emulated readdirs must check.
Since netbsd and freebsd return EINVAL for the error
and I don't know what the other platforms do, return
EINVAL for them too.
 1.44 18-Aug-1998  thorpej Add some braces to make egcs happy.
 1.43 07-Jul-1998  thorpej Oops, fix typo, pointed out by Urban Boquist <boquist@cs.chalmers.se>.
 1.42 02-Jul-1998  thorpej Implement the shrinking and no-change bits of the Linux mremap(2) system
call, provided by Urban Boquist <boquist@cs.chalmers.se> in PR #5693.

Add a comment about how one might implement the growing bit of mremap(2).
 1.41 24-Mar-1998  mycroft Fix typo in utime().
 1.40 03-Mar-1998  fvdl Only free cookiebuf when sure that the vop actually allocated it.
 1.39 01-Mar-1998  fvdl Merge with Lite2 + local changes
 1.38 20-Feb-1998  mycroft Linux's getsid(2) does in fact return a pid, not a pointer.
 1.37 14-Feb-1998  thorpej Add a comment clearly describing that Linux's getsid(2) differs from
the XPG4.2 definition in that it returns the kernel virtual address
of the session structure, rather than the process group ID of the
session leader.
 1.36 21-Oct-1997  fvdl branches: 1.36.2;
msync -> __msync13
 1.35 10-Oct-1997  fvdl Fix braino in my interpretation of the eof flag to VOP_READDIR.
 1.34 10-Oct-1997  mycroft Emulate mremap(2) by returning ENOMEM for now. This should be sufficient for
realloc(3) and other uses. From Matthias Scheler in PR 3920.
 1.33 10-Oct-1997  fvdl Signal error when getting a 64 bit offset cookie that can't be stored
in 32 bits. Provide an error message to the user, and return EINVAL.
Also, pay attention to the EOF flag from VOP_READDIR. Correct a
misspell in a panic message.
 1.32 04-Aug-1997  bouyer Fix "missing entries" bug when reading large directories: When reading a
directory and running out of space in the dest buffer, off should point to the
current entry (which was not saved) and not to the next.
I discovered this bug using linux and SunOS emulation over NFS, but seems to
affect other emulations as well.
 1.31 27-Jul-1997  augustss branches: 1.31.2;
Changes to the sudio system:
- It is now possible to handle devices that want "looping" DMA,
e.g. the SoundBlaster correctly. The WSS and SB drivers use this.
To do this several new methods were introduced in audio_hw_if.
- Different silence handling (forced by previous change).
- The audio driver can now be mmap()-ed, but due to problems in
the VM system only for writing for now.
- The OSS (Linux) audio emulation takes advantage of some of the
new features.
 1.30 07-Apr-1997  augustss Add Linux nice() syscall.
 1.29 10-Aug-1996  mycroft sys/dir.h -> sys/dirent.h
 1.28 23-Jun-1996  mycroft Catch up with setre[ug]id() changes.
 1.27 20-May-1996  fvdl branches: 1.27.4;
Update list of Linux syscalls and implement the ones that are likely to be
used and doable.
 1.26 04-Apr-1996  christos - Prototyping changes
- Fix bug that gcc -Wall found in linux_sys_getpgid()
 1.25 03-Apr-1996  mycroft Add explicit return types.
 1.24 18-Dec-1995  fvdl msync, readv and writev were recently added to the Linux kernel; add them
to the emulation as well.
 1.23 09-Dec-1995  mycroft We don't need a private version of fork() here any more.
 1.22 09-Oct-1995  mycroft Use cookies for directory offset, mostly from Greg Hudson.
 1.21 07-Oct-1995  mycroft Prefix names of system call implementation functions with `sys_'.
 1.20 19-Sep-1995  thorpej Make system calls conform to a standard prototype and bring those
prototypes into scope.
 1.19 13-Sep-1995  fvdl Update offset elsewhere in linux_getdents(); still emulate a bug in
Linux, but avoid endless loops.
 1.18 07-Sep-1995  fvdl Fix some bugs & typing problems.
 1.17 23-Aug-1995  fvdl Emulate some syscalls that appear in Linux 1.3: a select() with normal args,
getdents() and flock().
 1.16 21-Aug-1995  fvdl Check for status NULL argument in wait4 and waitpid. From PR #1392
by Thomas EberHardt.
 1.15 21-Aug-1995  mycroft Implement the old and older uname(2) calls.
 1.14 16-Aug-1995  mycroft If updating the timeval would make it negative, zero it instead.
 1.13 16-Aug-1995  mycroft Allow bogus timevals, per Linux.
 1.12 14-Aug-1995  mycroft Export bsd_to_linux_sig[], and use it.
 1.11 14-Aug-1995  mycroft Rearrange #includes.
 1.10 13-Aug-1995  mycroft Linux doesn't allow select(2) to be restarted.
 1.9 24-Jun-1995  christos Use compat_util.[ch].
 1.8 22-Jun-1995  fvdl * Changed to use generic ELF code from kern/exec_elf.c (which was taken
from the svr4 exec code plus the linux compat mods)
* Include file change
* Add multicast sockopts (from John Brezak)
 1.7 11-Jun-1995  fvdl Linux select() returns the amount of time left before a timeout would have
occured in the timeval structure. Emulate this behavior. Reported by
Theo de Raadt.
 1.6 11-Jun-1995  fvdl * Make Linux ELF binaries work. Lots of code duplication, but it will have to do
for now.
* Add a sanity check in linux_uselib
 1.5 10-Jun-1995  mycroft Rename the dirent fields to match Linux. Make sure the requested buffer
is no larger than MAXBSIZE.
 1.4 22-Mar-1995  mycroft Emulate the return value of times() better.
 1.3 21-Mar-1995  mycroft Update to use timer{add,sub}().
 1.2 05-Mar-1995  fvdl Added a few more system calls.
More consistent alternate root file semantics throughout.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.27.4.2 10-Dec-1996  mycroft From trunk:
sys/dir.h -> sys/dirent.h
 1.27.4.1 10-Dec-1996  mycroft From trunk:
Implement setre[ug]id() for real.
 1.31.2.2 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.31.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.36.2.1 08-May-1998  mycroft Pull up 1.41, per request of mycroft.
 1.50.12.2 05-Jan-2001  bouyer Sync with HEAD
 1.50.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.52.4.1 30-Mar-2001  he Pull up revision 1.55 (requested by fvdl):
Add some required Linux emulation bits to support the Linux
version of VMware.
 1.55.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.55.2.3 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.55.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.55.2.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.58.50.2 10-Dec-2006  yamt sync with head.
 1.58.50.1 22-Oct-2006  yamt sync with head
 1.58.48.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.58.48.1 18-Nov-2006  ad Sync with head.
 1.58.18.5 21-Jan-2008  yamt sync with head
 1.58.18.4 15-Nov-2007  yamt sync with head.
 1.58.18.3 03-Sep-2007  yamt sync with head.
 1.58.18.2 26-Feb-2007  yamt sync with head.
 1.58.18.1 30-Dec-2006  yamt sync with head.
 1.61.10.1 29-Mar-2007  reinoud Pullup to -current
 1.61.8.1 11-Jul-2007  mjf Sync with head.
 1.61.6.2 27-May-2007  ad Sync with head.
 1.61.6.1 10-Apr-2007  ad Sync with head.
 1.61.2.2 17-May-2007  yamt sync with head.
 1.61.2.1 24-Mar-2007  yamt sync with head.
 1.63.14.2 27-Dec-2007  mjf Sync with HEAD.
 1.63.14.1 19-Nov-2007  mjf Sync with HEAD.
 1.63.12.1 13-Nov-2007  bouyer Sync with HEAD
 1.63.8.1 09-Jan-2008  matt sync with HEAD
 1.63.6.1 11-Nov-2007  joerg Sync with HEAD.
 1.64.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.64.2.1 26-Dec-2007  ad Sync with head.
 1.65.10.1 16-May-2008  yamt sync with head.
 1.65.8.1 18-May-2008  yamt sync with head.
 1.65.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.66.92.1 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.66.80.1 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1836):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.66.2.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.66.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.3 23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.2 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.1 01-Oct-1998  erh branches: 1.1.144; 1.1.146; 1.1.148;
Define structures needed for these functions.
 1.1.148.1 16-May-2008  yamt sync with head.
 1.1.146.1 18-May-2008  yamt sync with head.
 1.1.144.1 02-Jun-2008  mjf Sync with HEAD.
 1.59 23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.58 18-Jun-2008  tsutsui Include <sys/sched.h> before <sys/syscallargs.h> for cpuset_t.
 1.57 28-Apr-2008  martin branches: 1.57.2; 1.57.4;
Remove clause 3 and 4 from TNF licenses
 1.56 20-Dec-2007  dsl branches: 1.56.6; 1.56.8; 1.56.10;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.55 08-Dec-2007  dsl branches: 1.55.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.54 09-Feb-2007  ad branches: 1.54.18; 1.54.20; 1.54.28;
Merge newlock2 to head.
 1.53 18-Jan-2003  thorpej branches: 1.53.18; 1.53.48;
Merge the nathanw_sa branch.
 1.52 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.51 29-Jun-2000  mrg branches: 1.51.2; 1.51.4;
remove include of <vm/vm.h>
 1.50 26-Jun-2000  mrg remove redundant vm includes.
 1.49 04-Oct-1998  fvdl branches: 1.49.12;
Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.48 03-Oct-1998  christos Attempt to fix the mess.
 1.47 01-Oct-1998  erh Wheeee!: 8-way split of compat/linux/linux_misc.c into common code and multi-architechture functions.
 1.46 11-Sep-1998  mycroft Substantial signal handling changes:
* Increase the size of sigset_t to accomodate 128 signals -- adding new
versions of sys_setprocmask(), sys_sigaction(), sys_sigpending() and
sys_sigsuspend() to handle the changed arguments.
* Abstract the guts of sys_sigaltstack(), sys_setprocmask(), sys_sigaction(),
sys_sigpending() and sys_sigsuspend() into separate functions, and call them
from all the emulations rather than hard-coding everything. (Avoids uses
the stackgap crap for these system calls.)
* Add a new flag (p_checksig) to indicate that a process may have signals
pending and userret() needs to do the full (slow) check.
* Eliminate SAS_ALTSTACK; it's exactly the inverse of SS_DISABLE.
* Correct emulation bugs with restoring SS_ONSTACK.
* Make the signal mask in the sigcontext always use the emulated mask format.
* Store signals internally in sigaction structures, rather than maintaining a
bunch of little sigsets for each SA_* bit.
* Keep track of where we put the signal trampoline, rather than figuring it out
in *_sendsig().
* Issue a warning when a non-emulated sigaction bit is observed.
* Add missing emulated signals, and a native SIGPWR (currently not used).
* Implement the `not reset when caught' semantics for relevant signals.

Note: Only code touched by the i386 port has been modified. Other ports and
emulations need to be updated.
 1.45 08-Sep-1998  rvb ufs_readdir no longer checks if vp->v_type != VDIR so
the individual emulated readdirs must check.
Since netbsd and freebsd return EINVAL for the error
and I don't know what the other platforms do, return
EINVAL for them too.
 1.44 18-Aug-1998  thorpej Add some braces to make egcs happy.
 1.43 07-Jul-1998  thorpej Oops, fix typo, pointed out by Urban Boquist <boquist@cs.chalmers.se>.
 1.42 02-Jul-1998  thorpej Implement the shrinking and no-change bits of the Linux mremap(2) system
call, provided by Urban Boquist <boquist@cs.chalmers.se> in PR #5693.

Add a comment about how one might implement the growing bit of mremap(2).
 1.41 24-Mar-1998  mycroft Fix typo in utime().
 1.40 03-Mar-1998  fvdl Only free cookiebuf when sure that the vop actually allocated it.
 1.39 01-Mar-1998  fvdl Merge with Lite2 + local changes
 1.38 20-Feb-1998  mycroft Linux's getsid(2) does in fact return a pid, not a pointer.
 1.37 14-Feb-1998  thorpej Add a comment clearly describing that Linux's getsid(2) differs from
the XPG4.2 definition in that it returns the kernel virtual address
of the session structure, rather than the process group ID of the
session leader.
 1.36 21-Oct-1997  fvdl branches: 1.36.2;
msync -> __msync13
 1.35 10-Oct-1997  fvdl Fix braino in my interpretation of the eof flag to VOP_READDIR.
 1.34 10-Oct-1997  mycroft Emulate mremap(2) by returning ENOMEM for now. This should be sufficient for
realloc(3) and other uses. From Matthias Scheler in PR 3920.
 1.33 10-Oct-1997  fvdl Signal error when getting a 64 bit offset cookie that can't be stored
in 32 bits. Provide an error message to the user, and return EINVAL.
Also, pay attention to the EOF flag from VOP_READDIR. Correct a
misspell in a panic message.
 1.32 04-Aug-1997  bouyer Fix "missing entries" bug when reading large directories: When reading a
directory and running out of space in the dest buffer, off should point to the
current entry (which was not saved) and not to the next.
I discovered this bug using linux and SunOS emulation over NFS, but seems to
affect other emulations as well.
 1.31 27-Jul-1997  augustss branches: 1.31.2;
Changes to the sudio system:
- It is now possible to handle devices that want "looping" DMA,
e.g. the SoundBlaster correctly. The WSS and SB drivers use this.
To do this several new methods were introduced in audio_hw_if.
- Different silence handling (forced by previous change).
- The audio driver can now be mmap()-ed, but due to problems in
the VM system only for writing for now.
- The OSS (Linux) audio emulation takes advantage of some of the
new features.
 1.30 07-Apr-1997  augustss Add Linux nice() syscall.
 1.29 10-Aug-1996  mycroft sys/dir.h -> sys/dirent.h
 1.28 23-Jun-1996  mycroft Catch up with setre[ug]id() changes.
 1.27 20-May-1996  fvdl branches: 1.27.4;
Update list of Linux syscalls and implement the ones that are likely to be
used and doable.
 1.26 04-Apr-1996  christos - Prototyping changes
- Fix bug that gcc -Wall found in linux_sys_getpgid()
 1.25 03-Apr-1996  mycroft Add explicit return types.
 1.24 18-Dec-1995  fvdl msync, readv and writev were recently added to the Linux kernel; add them
to the emulation as well.
 1.23 09-Dec-1995  mycroft We don't need a private version of fork() here any more.
 1.22 09-Oct-1995  mycroft Use cookies for directory offset, mostly from Greg Hudson.
 1.21 07-Oct-1995  mycroft Prefix names of system call implementation functions with `sys_'.
 1.20 19-Sep-1995  thorpej Make system calls conform to a standard prototype and bring those
prototypes into scope.
 1.19 13-Sep-1995  fvdl Update offset elsewhere in linux_getdents(); still emulate a bug in
Linux, but avoid endless loops.
 1.18 07-Sep-1995  fvdl Fix some bugs & typing problems.
 1.17 23-Aug-1995  fvdl Emulate some syscalls that appear in Linux 1.3: a select() with normal args,
getdents() and flock().
 1.16 21-Aug-1995  fvdl Check for status NULL argument in wait4 and waitpid. From PR #1392
by Thomas EberHardt.
 1.15 21-Aug-1995  mycroft Implement the old and older uname(2) calls.
 1.14 16-Aug-1995  mycroft If updating the timeval would make it negative, zero it instead.
 1.13 16-Aug-1995  mycroft Allow bogus timevals, per Linux.
 1.12 14-Aug-1995  mycroft Export bsd_to_linux_sig[], and use it.
 1.11 14-Aug-1995  mycroft Rearrange #includes.
 1.10 13-Aug-1995  mycroft Linux doesn't allow select(2) to be restarted.
 1.9 24-Jun-1995  christos Use compat_util.[ch].
 1.8 22-Jun-1995  fvdl * Changed to use generic ELF code from kern/exec_elf.c (which was taken
from the svr4 exec code plus the linux compat mods)
* Include file change
* Add multicast sockopts (from John Brezak)
 1.7 11-Jun-1995  fvdl Linux select() returns the amount of time left before a timeout would have
occured in the timeval structure. Emulate this behavior. Reported by
Theo de Raadt.
 1.6 11-Jun-1995  fvdl * Make Linux ELF binaries work. Lots of code duplication, but it will have to do
for now.
* Add a sanity check in linux_uselib
 1.5 10-Jun-1995  mycroft Rename the dirent fields to match Linux. Make sure the requested buffer
is no larger than MAXBSIZE.
 1.4 22-Mar-1995  mycroft Emulate the return value of times() better.
 1.3 21-Mar-1995  mycroft Update to use timer{add,sub}().
 1.2 05-Mar-1995  fvdl Added a few more system calls.
More consistent alternate root file semantics throughout.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.27.4.2 10-Dec-1996  mycroft From trunk:
sys/dir.h -> sys/dirent.h
 1.27.4.1 10-Dec-1996  mycroft From trunk:
Implement setre[ug]id() for real.
 1.31.2.2 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.31.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.36.2.1 08-May-1998  mycroft Pull up 1.41, per request of mycroft.
 1.49.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.51.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.51.2.3 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.51.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.51.2.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.53.48.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.53.18.2 21-Jan-2008  yamt sync with head
 1.53.18.1 26-Feb-2007  yamt sync with head.
 1.54.28.1 26-Dec-2007  ad Sync with head.
 1.54.20.1 09-Jan-2008  matt sync with HEAD
 1.54.18.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.55.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.56.10.2 04-May-2009  yamt sync with head.
 1.56.10.1 16-May-2008  yamt sync with head.
 1.56.8.1 18-May-2008  yamt sync with head.
 1.56.6.2 29-Jun-2008  mjf Sync with HEAD.
 1.56.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.57.4.1 18-Jun-2008  simonb Sync with head.
 1.57.2.3 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.57.2.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.57.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.4 23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.3 11-Jan-2009  christos merge christos-time_t
 1.2 28-Apr-2008  martin branches: 1.2.8;
Remove clause 3 and 4 from TNF licenses
 1.1 01-Oct-1998  erh branches: 1.1.144; 1.1.146; 1.1.148; 1.1.150;
Define structures needed for these functions.
 1.1.150.2 04-May-2009  yamt sync with head.
 1.1.150.1 16-May-2008  yamt sync with head.
 1.1.148.1 18-May-2008  yamt sync with head.
 1.1.146.2 01-Nov-2008  christos Sync with head.
 1.1.146.1 29-Mar-2008  christos Welcome to the time_t=long long dev_t=uint64_t branch.
 1.1.144.2 17-Jan-2009  mjf Sync with HEAD.
 1.1.144.1 02-Jun-2008  mjf Sync with HEAD.
 1.2.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.68 23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.67 07-Sep-2021  riastradh sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.66 28-Apr-2008  martin branches: 1.66.2; 1.66.80; 1.66.92;
Remove clause 3 and 4 from TNF licenses
 1.65 20-Dec-2007  dsl branches: 1.65.6; 1.65.8; 1.65.10;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.64 08-Nov-2007  njoly branches: 1.64.2; 1.64.6;
Replace strncpy with strlcpy in compat linux and linux32 uname,
old_uname and oldold_uname syscalls to ensure that all *utsname fields
are always NUL terminated.
 1.63 10-May-2007  christos branches: 1.63.6; 1.63.8; 1.63.12; 1.63.14;
- linux uname -m on x86 returns i{3,4,5,6}86 make it so.
- delete the machine sysctl that never worked, and gc linux_machine.
 1.62 23-Mar-2007  mrg implement emul.linux.kern.machine, which can be set to "i686", like
some applications seem to want.
 1.61 09-Feb-2007  ad branches: 1.61.2; 1.61.6; 1.61.8; 1.61.10;
Merge newlock2 to head.
 1.60 16-Nov-2006  christos __unused removal on arguments; approved by core.
 1.59 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.58 18-Jan-2003  thorpej branches: 1.58.18; 1.58.48; 1.58.50;
Merge the nathanw_sa branch.
 1.57 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.56 29-Dec-2000  fvdl branches: 1.56.2; 1.56.4;
Hardcode what the linux uname() calls return (Linux 2.2.5 is the current
value). A few major applications check for this (like VMware), and
there is no other way to trick them. Needs a more generic solution
eventually.
 1.55 29-Jun-2000  mrg remove include of <vm/vm.h>
 1.54 26-Jun-2000  mrg remove redundant vm includes.
 1.53 28-Mar-2000  simonb branches: 1.53.4;
Centralise the declarations of cpu_model, machine, machine_arch,
osrelease, and ostype and remove "extern char foo[];" (for hostname
and domainname too).

Also delete redunctant decl of boottime in kern_info_43.c.
 1.52 13-Mar-2000  soren Fix doubled 'the's in comments.
 1.51 07-Oct-1998  erh branches: 1.51.12;
This needs its defines.
 1.50 04-Oct-1998  fvdl Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.49 03-Oct-1998  christos Attempt to fix the mess.
 1.48 01-Oct-1998  perry shut up egcs complaints about braces
 1.47 01-Oct-1998  erh Wheeee!: 8-way split of compat/linux/linux_misc.c into common code and multi-architechture functions.
 1.46 11-Sep-1998  mycroft Substantial signal handling changes:
* Increase the size of sigset_t to accomodate 128 signals -- adding new
versions of sys_setprocmask(), sys_sigaction(), sys_sigpending() and
sys_sigsuspend() to handle the changed arguments.
* Abstract the guts of sys_sigaltstack(), sys_setprocmask(), sys_sigaction(),
sys_sigpending() and sys_sigsuspend() into separate functions, and call them
from all the emulations rather than hard-coding everything. (Avoids uses
the stackgap crap for these system calls.)
* Add a new flag (p_checksig) to indicate that a process may have signals
pending and userret() needs to do the full (slow) check.
* Eliminate SAS_ALTSTACK; it's exactly the inverse of SS_DISABLE.
* Correct emulation bugs with restoring SS_ONSTACK.
* Make the signal mask in the sigcontext always use the emulated mask format.
* Store signals internally in sigaction structures, rather than maintaining a
bunch of little sigsets for each SA_* bit.
* Keep track of where we put the signal trampoline, rather than figuring it out
in *_sendsig().
* Issue a warning when a non-emulated sigaction bit is observed.
* Add missing emulated signals, and a native SIGPWR (currently not used).
* Implement the `not reset when caught' semantics for relevant signals.

Note: Only code touched by the i386 port has been modified. Other ports and
emulations need to be updated.
 1.45 08-Sep-1998  rvb ufs_readdir no longer checks if vp->v_type != VDIR so
the individual emulated readdirs must check.
Since netbsd and freebsd return EINVAL for the error
and I don't know what the other platforms do, return
EINVAL for them too.
 1.44 18-Aug-1998  thorpej Add some braces to make egcs happy.
 1.43 07-Jul-1998  thorpej Oops, fix typo, pointed out by Urban Boquist <boquist@cs.chalmers.se>.
 1.42 02-Jul-1998  thorpej Implement the shrinking and no-change bits of the Linux mremap(2) system
call, provided by Urban Boquist <boquist@cs.chalmers.se> in PR #5693.

Add a comment about how one might implement the growing bit of mremap(2).
 1.41 24-Mar-1998  mycroft Fix typo in utime().
 1.40 03-Mar-1998  fvdl Only free cookiebuf when sure that the vop actually allocated it.
 1.39 01-Mar-1998  fvdl Merge with Lite2 + local changes
 1.38 20-Feb-1998  mycroft Linux's getsid(2) does in fact return a pid, not a pointer.
 1.37 14-Feb-1998  thorpej Add a comment clearly describing that Linux's getsid(2) differs from
the XPG4.2 definition in that it returns the kernel virtual address
of the session structure, rather than the process group ID of the
session leader.
 1.36 21-Oct-1997  fvdl branches: 1.36.2;
msync -> __msync13
 1.35 10-Oct-1997  fvdl Fix braino in my interpretation of the eof flag to VOP_READDIR.
 1.34 10-Oct-1997  mycroft Emulate mremap(2) by returning ENOMEM for now. This should be sufficient for
realloc(3) and other uses. From Matthias Scheler in PR 3920.
 1.33 10-Oct-1997  fvdl Signal error when getting a 64 bit offset cookie that can't be stored
in 32 bits. Provide an error message to the user, and return EINVAL.
Also, pay attention to the EOF flag from VOP_READDIR. Correct a
misspell in a panic message.
 1.32 04-Aug-1997  bouyer Fix "missing entries" bug when reading large directories: When reading a
directory and running out of space in the dest buffer, off should point to the
current entry (which was not saved) and not to the next.
I discovered this bug using linux and SunOS emulation over NFS, but seems to
affect other emulations as well.
 1.31 27-Jul-1997  augustss branches: 1.31.2;
Changes to the sudio system:
- It is now possible to handle devices that want "looping" DMA,
e.g. the SoundBlaster correctly. The WSS and SB drivers use this.
To do this several new methods were introduced in audio_hw_if.
- Different silence handling (forced by previous change).
- The audio driver can now be mmap()-ed, but due to problems in
the VM system only for writing for now.
- The OSS (Linux) audio emulation takes advantage of some of the
new features.
 1.30 07-Apr-1997  augustss Add Linux nice() syscall.
 1.29 10-Aug-1996  mycroft sys/dir.h -> sys/dirent.h
 1.28 23-Jun-1996  mycroft Catch up with setre[ug]id() changes.
 1.27 20-May-1996  fvdl branches: 1.27.4;
Update list of Linux syscalls and implement the ones that are likely to be
used and doable.
 1.26 04-Apr-1996  christos - Prototyping changes
- Fix bug that gcc -Wall found in linux_sys_getpgid()
 1.25 03-Apr-1996  mycroft Add explicit return types.
 1.24 18-Dec-1995  fvdl msync, readv and writev were recently added to the Linux kernel; add them
to the emulation as well.
 1.23 09-Dec-1995  mycroft We don't need a private version of fork() here any more.
 1.22 09-Oct-1995  mycroft Use cookies for directory offset, mostly from Greg Hudson.
 1.21 07-Oct-1995  mycroft Prefix names of system call implementation functions with `sys_'.
 1.20 19-Sep-1995  thorpej Make system calls conform to a standard prototype and bring those
prototypes into scope.
 1.19 13-Sep-1995  fvdl Update offset elsewhere in linux_getdents(); still emulate a bug in
Linux, but avoid endless loops.
 1.18 07-Sep-1995  fvdl Fix some bugs & typing problems.
 1.17 23-Aug-1995  fvdl Emulate some syscalls that appear in Linux 1.3: a select() with normal args,
getdents() and flock().
 1.16 21-Aug-1995  fvdl Check for status NULL argument in wait4 and waitpid. From PR #1392
by Thomas EberHardt.
 1.15 21-Aug-1995  mycroft Implement the old and older uname(2) calls.
 1.14 16-Aug-1995  mycroft If updating the timeval would make it negative, zero it instead.
 1.13 16-Aug-1995  mycroft Allow bogus timevals, per Linux.
 1.12 14-Aug-1995  mycroft Export bsd_to_linux_sig[], and use it.
 1.11 14-Aug-1995  mycroft Rearrange #includes.
 1.10 13-Aug-1995  mycroft Linux doesn't allow select(2) to be restarted.
 1.9 24-Jun-1995  christos Use compat_util.[ch].
 1.8 22-Jun-1995  fvdl * Changed to use generic ELF code from kern/exec_elf.c (which was taken
from the svr4 exec code plus the linux compat mods)
* Include file change
* Add multicast sockopts (from John Brezak)
 1.7 11-Jun-1995  fvdl Linux select() returns the amount of time left before a timeout would have
occured in the timeval structure. Emulate this behavior. Reported by
Theo de Raadt.
 1.6 11-Jun-1995  fvdl * Make Linux ELF binaries work. Lots of code duplication, but it will have to do
for now.
* Add a sanity check in linux_uselib
 1.5 10-Jun-1995  mycroft Rename the dirent fields to match Linux. Make sure the requested buffer
is no larger than MAXBSIZE.
 1.4 22-Mar-1995  mycroft Emulate the return value of times() better.
 1.3 21-Mar-1995  mycroft Update to use timer{add,sub}().
 1.2 05-Mar-1995  fvdl Added a few more system calls.
More consistent alternate root file semantics throughout.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.27.4.2 10-Dec-1996  mycroft From trunk:
sys/dir.h -> sys/dirent.h
 1.27.4.1 10-Dec-1996  mycroft From trunk:
Implement setre[ug]id() for real.
 1.31.2.2 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.31.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.36.2.1 08-May-1998  mycroft Pull up 1.41, per request of mycroft.
 1.51.12.2 05-Jan-2001  bouyer Sync with HEAD
 1.51.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.53.4.1 30-Mar-2001  he Pull up revision 1.56 (requested by fvdl):
Add some required Linux emulation bits to support the Linux
version of VMware.
 1.56.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.56.2.3 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.56.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.56.2.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.58.50.2 10-Dec-2006  yamt sync with head.
 1.58.50.1 22-Oct-2006  yamt sync with head
 1.58.48.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.58.48.1 18-Nov-2006  ad Sync with head.
 1.58.18.5 21-Jan-2008  yamt sync with head
 1.58.18.4 15-Nov-2007  yamt sync with head.
 1.58.18.3 03-Sep-2007  yamt sync with head.
 1.58.18.2 26-Feb-2007  yamt sync with head.
 1.58.18.1 30-Dec-2006  yamt sync with head.
 1.61.10.1 29-Mar-2007  reinoud Pullup to -current
 1.61.8.1 11-Jul-2007  mjf Sync with head.
 1.61.6.2 27-May-2007  ad Sync with head.
 1.61.6.1 10-Apr-2007  ad Sync with head.
 1.61.2.2 17-May-2007  yamt sync with head.
 1.61.2.1 24-Mar-2007  yamt sync with head.
 1.63.14.2 27-Dec-2007  mjf Sync with HEAD.
 1.63.14.1 19-Nov-2007  mjf Sync with HEAD.
 1.63.12.1 13-Nov-2007  bouyer Sync with HEAD
 1.63.8.1 09-Jan-2008  matt sync with HEAD
 1.63.6.1 11-Nov-2007  joerg Sync with HEAD.
 1.64.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.64.2.1 26-Dec-2007  ad Sync with head.
 1.65.10.1 16-May-2008  yamt sync with head.
 1.65.8.1 18-May-2008  yamt sync with head.
 1.65.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.66.92.1 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.66.80.1 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1836):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.66.2.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.66.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.9 23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.8 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.7 04-Oct-1998  fvdl branches: 1.7.144; 1.7.146; 1.7.148;
Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.6 01-Oct-1998  erh Split linux_types.h into i386, common and multi-architechture parts.
 1.5 20-May-1996  fvdl Update list of Linux syscalls and implement the ones that are likely to be
used and doable.
 1.4 21-Aug-1995  mycroft Implement the old and older uname(2) calls.
 1.3 14-Aug-1995  mycroft Move signal types into signal.h.
 1.2 05-Mar-1995  fvdl Added a few more system calls.
More consistent alternate root file semantics throughout.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.7.148.1 16-May-2008  yamt sync with head.
 1.7.146.1 18-May-2008  yamt sync with head.
 1.7.144.1 02-Jun-2008  mjf Sync with HEAD.
 1.69 23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.68 26-Dec-2017  kamil Refactor pipe1() and correct a bug in sys_pipe2() (SYS_pipe2)

sys_pipe2() returns two integers (values), the 2nd one is a copy of the 2nd
file descriptor that lands in fildes[2]. This is a side effect of reusing
the code for sys_pipe() (SYS_pipe) and not cleaning it up.

The first returned value is (on success) 0.

Introduced a small refactoring in pipe1() that it does not operate over
retval[], but on an array int[2]. A user sets retval[] for pipe() when
desired and needed.

This refactoring touches compat code: netbsd32, linux, linux32.

Before the changes on NetBSD/amd64:

$ ktruss -i ./a.out
[...]
15131 1 a.out pipe2(0x7f7fff2e62b8, 0) = 0, 4
[...]

After the changes:

$ ktruss -i ./a.out
[...]
782 1 a.out pipe2(0x7f7fff97e850, 0) = 0
[...]

There should not be a visible change for current users.

Sponsored by <The NetBSD Foundation>
 1.67 09-Nov-2014  maxv Do not uselessly include <sys/malloc.h>.
 1.66 01-Jun-2014  njoly branches: 1.66.2;
Cleanup pipe(2) flags, now that native handle them.
 1.65 14-Apr-2011  christos branches: 1.65.14; 1.65.28;
move dup3 to a more appropriate place because pipe is "special". Gotta love
linux.
 1.64 10-Apr-2011  christos - implement dup3 and pipe2
- eliminate amd64 ifdef
 1.63 18-Jun-2008  tsutsui branches: 1.63.18; 1.63.24;
Include <sys/sched.h> before <sys/syscallargs.h> for cpuset_t.
 1.62 28-Apr-2008  martin branches: 1.62.2; 1.62.4;
Remove clause 3 and 4 from TNF licenses
 1.61 20-Dec-2007  dsl branches: 1.61.6; 1.61.8; 1.61.10;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.60 08-Dec-2007  dsl branches: 1.60.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.59 19-Oct-2007  njoly branches: 1.59.4;
Add compat_linux and exec_linux_elf lkm support for amd64:
- Add needed COMPAT_OSSAUDIO to GENERIC.
- Add missing includes needed by linux_syscallargs.h.
- Add lkm building.
 1.58 09-Feb-2007  ad branches: 1.58.18; 1.58.20; 1.58.24;
Merge newlock2 to head.
 1.57 11-Dec-2005  christos branches: 1.57.20;
merge ktrace-lwp.
 1.56 05-Nov-2005  manu Fix a messed up patch
 1.55 04-Nov-2005  manu register_t is not an int on amd64
 1.54 31-Oct-2005  manu Fix pipe linux emulation on amd64
 1.53 18-Jan-2003  thorpej branches: 1.53.2; 1.53.18; 1.53.20;
Merge the nathanw_sa branch.
 1.52 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.51 29-Jun-2000  mrg branches: 1.51.2; 1.51.4;
remove include of <vm/vm.h>
 1.50 26-Jun-2000  mrg remove redundant vm includes.
 1.49 04-Oct-1998  fvdl branches: 1.49.12;
Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.48 03-Oct-1998  christos Attempt to fix the mess.
 1.47 01-Oct-1998  erh Wheeee!: 8-way split of compat/linux/linux_misc.c into common code and multi-architechture functions.
 1.46 11-Sep-1998  mycroft Substantial signal handling changes:
* Increase the size of sigset_t to accomodate 128 signals -- adding new
versions of sys_setprocmask(), sys_sigaction(), sys_sigpending() and
sys_sigsuspend() to handle the changed arguments.
* Abstract the guts of sys_sigaltstack(), sys_setprocmask(), sys_sigaction(),
sys_sigpending() and sys_sigsuspend() into separate functions, and call them
from all the emulations rather than hard-coding everything. (Avoids uses
the stackgap crap for these system calls.)
* Add a new flag (p_checksig) to indicate that a process may have signals
pending and userret() needs to do the full (slow) check.
* Eliminate SAS_ALTSTACK; it's exactly the inverse of SS_DISABLE.
* Correct emulation bugs with restoring SS_ONSTACK.
* Make the signal mask in the sigcontext always use the emulated mask format.
* Store signals internally in sigaction structures, rather than maintaining a
bunch of little sigsets for each SA_* bit.
* Keep track of where we put the signal trampoline, rather than figuring it out
in *_sendsig().
* Issue a warning when a non-emulated sigaction bit is observed.
* Add missing emulated signals, and a native SIGPWR (currently not used).
* Implement the `not reset when caught' semantics for relevant signals.

Note: Only code touched by the i386 port has been modified. Other ports and
emulations need to be updated.
 1.45 08-Sep-1998  rvb ufs_readdir no longer checks if vp->v_type != VDIR so
the individual emulated readdirs must check.
Since netbsd and freebsd return EINVAL for the error
and I don't know what the other platforms do, return
EINVAL for them too.
 1.44 18-Aug-1998  thorpej Add some braces to make egcs happy.
 1.43 07-Jul-1998  thorpej Oops, fix typo, pointed out by Urban Boquist <boquist@cs.chalmers.se>.
 1.42 02-Jul-1998  thorpej Implement the shrinking and no-change bits of the Linux mremap(2) system
call, provided by Urban Boquist <boquist@cs.chalmers.se> in PR #5693.

Add a comment about how one might implement the growing bit of mremap(2).
 1.41 24-Mar-1998  mycroft Fix typo in utime().
 1.40 03-Mar-1998  fvdl Only free cookiebuf when sure that the vop actually allocated it.
 1.39 01-Mar-1998  fvdl Merge with Lite2 + local changes
 1.38 20-Feb-1998  mycroft Linux's getsid(2) does in fact return a pid, not a pointer.
 1.37 14-Feb-1998  thorpej Add a comment clearly describing that Linux's getsid(2) differs from
the XPG4.2 definition in that it returns the kernel virtual address
of the session structure, rather than the process group ID of the
session leader.
 1.36 21-Oct-1997  fvdl branches: 1.36.2;
msync -> __msync13
 1.35 10-Oct-1997  fvdl Fix braino in my interpretation of the eof flag to VOP_READDIR.
 1.34 10-Oct-1997  mycroft Emulate mremap(2) by returning ENOMEM for now. This should be sufficient for
realloc(3) and other uses. From Matthias Scheler in PR 3920.
 1.33 10-Oct-1997  fvdl Signal error when getting a 64 bit offset cookie that can't be stored
in 32 bits. Provide an error message to the user, and return EINVAL.
Also, pay attention to the EOF flag from VOP_READDIR. Correct a
misspell in a panic message.
 1.32 04-Aug-1997  bouyer Fix "missing entries" bug when reading large directories: When reading a
directory and running out of space in the dest buffer, off should point to the
current entry (which was not saved) and not to the next.
I discovered this bug using linux and SunOS emulation over NFS, but seems to
affect other emulations as well.
 1.31 27-Jul-1997  augustss branches: 1.31.2;
Changes to the sudio system:
- It is now possible to handle devices that want "looping" DMA,
e.g. the SoundBlaster correctly. The WSS and SB drivers use this.
To do this several new methods were introduced in audio_hw_if.
- Different silence handling (forced by previous change).
- The audio driver can now be mmap()-ed, but due to problems in
the VM system only for writing for now.
- The OSS (Linux) audio emulation takes advantage of some of the
new features.
 1.30 07-Apr-1997  augustss Add Linux nice() syscall.
 1.29 10-Aug-1996  mycroft sys/dir.h -> sys/dirent.h
 1.28 23-Jun-1996  mycroft Catch up with setre[ug]id() changes.
 1.27 20-May-1996  fvdl branches: 1.27.4;
Update list of Linux syscalls and implement the ones that are likely to be
used and doable.
 1.26 04-Apr-1996  christos - Prototyping changes
- Fix bug that gcc -Wall found in linux_sys_getpgid()
 1.25 03-Apr-1996  mycroft Add explicit return types.
 1.24 18-Dec-1995  fvdl msync, readv and writev were recently added to the Linux kernel; add them
to the emulation as well.
 1.23 09-Dec-1995  mycroft We don't need a private version of fork() here any more.
 1.22 09-Oct-1995  mycroft Use cookies for directory offset, mostly from Greg Hudson.
 1.21 07-Oct-1995  mycroft Prefix names of system call implementation functions with `sys_'.
 1.20 19-Sep-1995  thorpej Make system calls conform to a standard prototype and bring those
prototypes into scope.
 1.19 13-Sep-1995  fvdl Update offset elsewhere in linux_getdents(); still emulate a bug in
Linux, but avoid endless loops.
 1.18 07-Sep-1995  fvdl Fix some bugs & typing problems.
 1.17 23-Aug-1995  fvdl Emulate some syscalls that appear in Linux 1.3: a select() with normal args,
getdents() and flock().
 1.16 21-Aug-1995  fvdl Check for status NULL argument in wait4 and waitpid. From PR #1392
by Thomas EberHardt.
 1.15 21-Aug-1995  mycroft Implement the old and older uname(2) calls.
 1.14 16-Aug-1995  mycroft If updating the timeval would make it negative, zero it instead.
 1.13 16-Aug-1995  mycroft Allow bogus timevals, per Linux.
 1.12 14-Aug-1995  mycroft Export bsd_to_linux_sig[], and use it.
 1.11 14-Aug-1995  mycroft Rearrange #includes.
 1.10 13-Aug-1995  mycroft Linux doesn't allow select(2) to be restarted.
 1.9 24-Jun-1995  christos Use compat_util.[ch].
 1.8 22-Jun-1995  fvdl * Changed to use generic ELF code from kern/exec_elf.c (which was taken
from the svr4 exec code plus the linux compat mods)
* Include file change
* Add multicast sockopts (from John Brezak)
 1.7 11-Jun-1995  fvdl Linux select() returns the amount of time left before a timeout would have
occured in the timeval structure. Emulate this behavior. Reported by
Theo de Raadt.
 1.6 11-Jun-1995  fvdl * Make Linux ELF binaries work. Lots of code duplication, but it will have to do
for now.
* Add a sanity check in linux_uselib
 1.5 10-Jun-1995  mycroft Rename the dirent fields to match Linux. Make sure the requested buffer
is no larger than MAXBSIZE.
 1.4 22-Mar-1995  mycroft Emulate the return value of times() better.
 1.3 21-Mar-1995  mycroft Update to use timer{add,sub}().
 1.2 05-Mar-1995  fvdl Added a few more system calls.
More consistent alternate root file semantics throughout.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.27.4.2 10-Dec-1996  mycroft From trunk:
sys/dir.h -> sys/dirent.h
 1.27.4.1 10-Dec-1996  mycroft From trunk:
Implement setre[ug]id() for real.
 1.31.2.2 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.31.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.36.2.1 08-May-1998  mycroft Pull up 1.41, per request of mycroft.
 1.49.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.51.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.51.2.3 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.51.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.51.2.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.53.20.1 02-Nov-2005  yamt sync with head.
 1.53.18.4 21-Jan-2008  yamt sync with head
 1.53.18.3 27-Oct-2007  yamt sync with head.
 1.53.18.2 26-Feb-2007  yamt sync with head.
 1.53.18.1 21-Jun-2006  yamt sync with head.
 1.53.2.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.57.20.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.58.24.1 25-Oct-2007  bouyer Sync with HEAD.
 1.58.20.2 09-Jan-2008  matt sync with HEAD
 1.58.20.1 06-Nov-2007  matt sync with HEAD
 1.58.18.2 09-Dec-2007  jmcneill Sync with HEAD.
 1.58.18.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.59.4.1 26-Dec-2007  ad Sync with head.
 1.60.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.61.10.2 04-May-2009  yamt sync with head.
 1.61.10.1 16-May-2008  yamt sync with head.
 1.61.8.1 18-May-2008  yamt sync with head.
 1.61.6.2 29-Jun-2008  mjf Sync with HEAD.
 1.61.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.62.4.1 18-Jun-2008  simonb Sync with head.
 1.62.2.3 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.62.2.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.62.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.63.24.1 06-Jun-2011  jruoho Sync with HEAD.
 1.63.18.1 21-Apr-2011  rmind sync with head
 1.65.28.1 10-Aug-2014  tls Rebase.
 1.65.14.2 03-Dec-2017  jdolecek update from HEAD
 1.65.14.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.66.2.1 17-Jan-2015  martin Pull up following revision(s) (requested by maxv in ticket #427):
sys/compat/svr4/svr4_schedctl.c: revision 1.8
sys/netinet/tcp_timer.c: revision 1.88
sys/miscfs/genfs/layer_vfsops.c: revision 1.45
sys/compat/svr4/svr4_ioctl.c: revision 1.37
sys/ufs/chfs/chfs_vfsops.c: revision 1.14
sys/miscfs/fdesc/fdesc_vfsops.c: revision 1.91
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.30
sys/compat/common/kern_time_50.c: revision 1.28
sys/netinet6/ip6_forward.c: revision 1.74
sys/miscfs/umapfs/umap_vnops.c: revision 1.57
sys/compat/svr4/svr4_fcntl.c: revision 1.74
distrib/sets/lists/comp/mi: revision 1.1931
sys/netinet6/udp6_output.c: revision 1.46
sys/fs/puffs/puffs_compat.c: revision 1.3
sys/fs/udf/udf_rename.c: revision 1.11
sys/compat/svr4/svr4_filio.c: revision 1.24
sys/fs/udf/udf_rename.c: revision 1.12
sys/netinet/tcp_usrreq.c: revision 1.202
sys/miscfs/umapfs/umap_subr.c: revision 1.29
sys/compat/linux/common/linux_fadvise64.c: revision 1.3
sys/netinet/if_atm.c: revision 1.34
sys/miscfs/procfs/procfs_subr.c: revision 1.106
sys/miscfs/genfs/layer_subr.c: revision 1.37
sys/netinet/tcp_sack.c: revision 1.30
sys/compat/freebsd/freebsd_misc.c: revision 1.33
sys/compat/freebsd/freebsd_file.c: revision 1.33
sys/ufs/chfs/chfs_vnode.c: revision 1.12
sys/compat/svr4/svr4_ttold.c: revision 1.34
sys/compat/linux/common/linux_file.c: revision 1.114
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.43
sys/compat/linux/common/linux_signal.c: revision 1.76
sys/compat/common/compat_util.c: revision 1.46
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.18
sys/compat/svr4/svr4_sockio.c: revision 1.36
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.32
sys/compat/svr4/svr4_signal.c: revision 1.66
sys/kern/kern_exec.c: revision 1.410
sys/fs/puffs/puffs_vfsops.c: revision 1.115
sys/compat/svr4/svr4_exec_elf64.c: revision 1.15
sys/compat/linux/arch/i386/linux_machdep.c: revision 1.159
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.50
sys/compat/linux32/common/linux32_misc.c: revision 1.24
sys/netinet/in_pcb.c: revision 1.153
sys/sys/malloc.h: revision 1.116
sys/compat/common/if_43.c: revision 1.9
share/man/man9/Makefile: revision 1.380
sys/netinet/tcp_vtw.c: revision 1.12
sys/miscfs/umapfs/umap_vfsops.c: revision 1.95
sys/ufs/ext2fs/ext2fs_vfsops.c: revision 1.186
sys/compat/common/uipc_syscalls_43.c: revision 1.46
sys/ufs/ext2fs/ext2fs_vnops.c: revision 1.115
sys/fs/puffs/puffs_msgif.c: revision 1.97
sys/compat/svr4/svr4_ipc.c: revision 1.27
sys/compat/linux/common/linux_exec.c: revision 1.117
sys/ufs/ext2fs/ext2fs_readwrite.c: revision 1.66
sys/netinet/tcp_output.c: revision 1.179
sys/compat/svr4/svr4_termios.c: revision 1.28
sys/fs/udf/udf_strat_bootstrap.c: revision 1.4
sys/fs/puffs/puffs_subr.c: revision 1.67
sys/fs/puffs/puffs_node.c: revision 1.36
sys/miscfs/overlay/overlay_vnops.c: revision 1.21
sys/fs/cd9660/cd9660_node.c: revision 1.34
sys/netinet/raw_ip.c: revision 1.146
sys/sys/mallocvar.h: revision 1.13
sys/miscfs/overlay/overlay_vfsops.c: revision 1.63
share/man/man9/malloc.9: revision 1.50
sys/netinet6/dest6.c: revision 1.18
sys/compat/linux/common/linux_uselib.c: revision 1.33
sys/compat/linux/common/linux_socket.c: revision 1.120
share/man/man9/malloc.9: revision 1.51
sys/netinet/tcp_subr.c: revision 1.257
sys/compat/linux/common/linux_socketcall.c: revision 1.45
sys/compat/linux/common/linux_fadvise64_64.c: revision 1.3
sys/compat/freebsd/freebsd_ipc.c: revision 1.17
sys/compat/linux/common/linux_misc_notalpha.c: revision 1.109
sys/compat/linux/arch/alpha/linux_pipe.c: revision 1.17
sys/netinet6/in6_pcb.c: revision 1.132
sys/netinet6/in6_ifattach.c: revision 1.94
sys/compat/svr4/svr4_exec_elf32.c: revision 1.15
sys/miscfs/nullfs/null_vfsops.c: revision 1.90
sys/fs/cd9660/cd9660_util.c: revision 1.12
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.48
sys/compat/freebsd/freebsd_exec_elf32.c: revision 1.20
sys/miscfs/procfs/procfs_vfsops.c: revision 1.94
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.28
sys/compat/linux/common/linux_sched.c: revision 1.67
sys/compat/linux/common/linux_exec_aout.c: revision 1.67
sys/compat/linux/common/linux_pipe.c: revision 1.67
sys/compat/linux/common/linux_llseek.c: revision 1.34
sys/compat/linux/arch/mips/linux_ptrace.c: revision 1.10
Do not uselessly include <sys/malloc.h>.
Cleanup:
- remove struct kmembuckets (dead)
- correctly deadify MALLOC_XX
- remove MALLOC_DEFINE_LIMIT and MALLOC_JUSTDEFINE_LIMIT (dead)
- remove malloc_roundup(), malloc_type_setlimit(), MALLOC_DEFINE_LIMIT()
and MALLOC_JUSTDEFINE_LIMIT() from man 9 malloc
New sentence, new line. Bump date for previous.
Obsolete malloc_roundup(9), malloc_type_setlimit(9) and MALLOC_DEFINE_LIMIT(9)
man pages.
 1.5 01-Oct-2024  riastradh sys/compat/linux/common: Nix trailing whitespace, and one blank line.

No functional change intended.
 1.4 09-Feb-2024  andvar branches: 1.4.2;
fix spelling mistakes, mainly in comments and log messages.
 1.3 24-Nov-2006  wiz s/independant/independent/, from Zafer.
 1.2 11-Dec-2005  christos branches: 1.2.20; 1.2.22;
merge ktrace-lwp.
 1.1 03-May-2005  manu branches: 1.1.2; 1.1.8;
First work on COMPAT_LINUX/amd64
Process startup and dynamiclinking work, but processes hang due to
Linux arch_prctl(2) not being really supported yet.
 1.1.8.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.8.1 03-May-2005  skrll file linux_prctl.h was added on branch ktrace-lwp on 2005-11-10 14:01:07 +0000
 1.1.2.1 30-Dec-2006  yamt sync with head.
 1.2.22.1 10-Dec-2006  yamt sync with head.
 1.2.20.1 12-Jan-2007  ad Sync with head.
 1.4.2.1 02-Aug-2025  perseant Sync with HEAD
 1.12 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.11 20-Dec-2007  dsl branches: 1.11.6; 1.11.8; 1.11.10;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.10 04-Dec-2007  dsl branches: 1.10.4;
Remove all the __P
 1.9 11-Dec-2005  christos branches: 1.9.44; 1.9.46; 1.9.52; 1.9.56;
merge ktrace-lwp.
 1.8 26-Feb-2005  perry branches: 1.8.4;
nuke trailing whitespace
 1.7 18-Jan-2003  thorpej branches: 1.7.2; 1.7.10; 1.7.12;
Merge the nathanw_sa branch.
 1.6 27-Jan-2002  bjh21 Add support for PTRACE_GETREGS and PTRACE_SETREGS in ARMLinux emulation.
 1.5 22-Sep-2001  manu Enable Mips Linux emulation in header files
 1.4 22-May-2001  manu branches: 1.4.2; 1.4.4;
Enable PowerPC Linux ptrace() emulation
 1.3 01-Nov-2000  jdolecek branches: 1.3.2; 1.3.4;
move definition of LINUX_PTRACE_{SET|GET}(FP)REGS flags to
sys/compat/linux/common/linux_ptrace.h, they seem to be actually MI
 1.2 16-Dec-1999  tron branches: 1.2.2;
Move MI parts of ptrace(2) emulation to "linux_misc.c".
 1.1 11-Dec-1999  tron Architecture independent definitions for Linux's ptrace(2) system call.
 1.2.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.3.4.4 28-Feb-2002  nathanw Catch up to -current.
 1.3.4.3 26-Sep-2001  nathanw Catch up to -current.
Again.
 1.3.4.2 21-Jun-2001  nathanw Catch up to -current.
 1.3.4.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.3.2.3 22-Nov-2000  bouyer Sync with HEAD.
 1.3.2.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.3.2.1 01-Nov-2000  bouyer file linux_ptrace.h was added on branch thorpej_scsipi on 2000-11-20 18:08:25 +0000
 1.4.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.4.2.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.4.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.7.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.7.10.1 29-Apr-2005  kent sync with -current
 1.7.2.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.8.4.2 21-Jan-2008  yamt sync with head
 1.8.4.1 07-Dec-2007  yamt sync with head
 1.9.56.2 26-Dec-2007  ad Sync with head.
 1.9.56.1 08-Dec-2007  ad Sync with head.
 1.9.52.2 27-Dec-2007  mjf Sync with HEAD.
 1.9.52.1 08-Dec-2007  mjf Sync with HEAD.
 1.9.46.1 09-Jan-2008  matt sync with HEAD
 1.9.44.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.10.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.11.10.1 16-May-2008  yamt sync with head.
 1.11.8.1 18-May-2008  yamt sync with head.
 1.11.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.2 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.1 18-Mar-2000  erh branches: 1.1.6; 1.1.128; 1.1.130; 1.1.132;
Add defines for linux_sys_reboot.
 1.1.132.1 16-May-2008  yamt sync with head.
 1.1.130.1 18-May-2008  yamt sync with head.
 1.1.128.1 02-Jun-2008  mjf Sync with HEAD.
 1.1.6.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.1.6.1 18-Mar-2000  bouyer file linux_reboot.h was added on branch thorpej_scsipi on 2000-11-20 18:08:25 +0000
 1.85 19-Sep-2025  kre cl_args.stack_size is uint64_t (all architectures), on ILP32 (void *)
is 32 bits, as is (intptr_t). 32 bits added to 64 bits --> 64 bits,
which gcc complains about converting to a pointer. Add yet another cast.

Should fix ILP32 builds (eg: i386)
 1.84 19-Sep-2025  christos PR/59608: csaba mate: fix stack address and ignore sysvsem flag. makes the
latest jvm work again.
 1.83 03-Oct-2024  hannken branches: 1.83.2;
Fix fallout from DPRINTF conversion.

Kernels ALL/i386 and ALL/amd64 compile again.
 1.82 01-Oct-2024  riastradh sys/compat/linux/common: Nix trailing whitespace, and one blank line.

No functional change intended.
 1.81 30-Sep-2024  kre Supply a missing cast, which fixes the i386 (other 32 bit too probably)
builds.

Note I used uintptr_t rather than intptr_t which other similar
lines nearby use - the int being converted to a ptr is uint64_t
so using unsigned seemed safer to me. Feel free to change it.

Not sure if the code will work though - linux's clone3() is
being emulated via its clone() sys call - I know nothing about
linux sys calls, but my impression of these two is that in
clone() the "stack" arg points at the logical stack start
(usually the highest addr in the stack segment - though there
are some systems with upward growing stacks) whereas for
clone3() it looks to me as if the stack arg is always intended
to be the lowest addr in the stack segment (with a new size
field added to compute the top). Simply copying that arg to the
clone() arg of the same name might not work. (I am surmising).
I'd expect the code to need to vary based upon in which direction
the architecture's stack grows. Maybe.
 1.80 29-Sep-2024  christos move clone3 to linux_sched.c and make it compile (need to fix XXX comments)
 1.79 07-Sep-2021  riastradh branches: 1.79.10;
sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.78 23-May-2020  ad Move proc_lock into the data segment. It was dynamically allocated because
at the time we had mutex_obj_alloc() but not __cacheline_aligned.
 1.77 14-May-2020  rin Fix previous; specify lwpid for curlpw in the case of pid == 0.

For linux_sys_sched_setaffinity, pid == 0 means the current thread.
On the other hand, for our native sys_sched_setaffinity, lid == 0
means all lwp's that belong to the process.
 1.76 29-Apr-2020  thorpej Fix proc / lwp lookup processing in linux_sys_sched_getaffinity()
and linux_sys_sched_setaffinity(). They were incorrect even before
the LWP ID changes, but those changes exposed the latent bugs.
 1.75 24-Apr-2020  thorpej Overhaul the way LWP IDs are allocated. Instead of each LWP having it's
own LWP ID space, LWP IDs came from the same number space as PIDs. The
lead LWP of a process gets the PID as its LID. If a multi-LWP process's
lead LWP exits, the PID persists for the process.

In addition to providing system-wide unique thread IDs, this also lets us
eliminate the per-process LWP radix tree, and some associated locks.

Remove the separate "global thread ID" map added previously; it is no longer
needed to provide this functionality.

Nudged in this direction by ad@ and chs@.
 1.74 19-Apr-2020  thorpej - Only increment nprocs when we're creating a new process, not just
when allocating a PID.
- Per above, proc_free_pid() no longer decrements nprocs. It's now done
in proc_free() right after proc_free_pid().
- Ensure nprocs is accessed using atomics everywhere.
 1.73 23-Nov-2019  ad branches: 1.73.6;
Minor scheduler cleanup:

- Adapt to cpu_need_resched() changes. Avoid lost & duplicate IPIs and ASTs.
sched_resched_cpu() and sched_resched_lwp() contain the logic for this.
- Changes for LSIDL to make the locking scheme match the intended design.
- Reduce lock contention and false sharing further.
- Numerous small bugfixes, including some corrections for SCHED_FIFO/RT.
- Use setrunnable() in more places, and merge cut & pasted code.
 1.72 03-Oct-2019  kamil Switch kevent udata from intptr_t void*

Synchromize the struct field format with other BSDs and Darwin.

No ABI change between older and newer struct form on the ports.

The change will require no changes to most C users during the transition
period as the header keeps a caller cast.

Discussed with core@ and there were no objections for this move.
 1.71 16-Apr-2018  kamil branches: 1.71.2; 1.71.6;
Remove the rnewprocp argument from fork1(9)

It's now unused and it can cause use-after-free scenarios as noted by
<Mateusz Guzik>.

Reference: http://mail-index.netbsd.org/tech-kern/2017/09/08/msg022267.html

Sponsored by <The NetBSD Foundation>
 1.70 15-Apr-2018  kamil Remove unused variable p from linux_sys_clone()

After refactoring by <chs> in 2010 (r. 1.63) the p variable is no longer
used.

As noted by <Mateusz Guzik> its usage is also unsafe and might cause
use-after-free scenarios.

No functional change intended.

Reference: http://mail-index.netbsd.org/tech-kern/2017/09/08/msg022267.html

Sponsored by <The NetBSD Foundation>
 1.69 21-Apr-2017  christos branches: 1.69.4; 1.69.10;
- Propagate the signal mask from the ucontext_t to the newly created thread
as specified by _lwp_create(2)
- Reset the signal stack for threads created with _lwp_create(2)
 1.68 03-Jul-2015  christos branches: 1.68.2; 1.68.4;
PR/50021: Rin Okuyama: Fix linux affinity syscalls
XXX: pullup-7
 1.67 09-Nov-2014  maxv branches: 1.67.2;
Do not uselessly include <sys/malloc.h>.
 1.66 23-Jan-2014  njoly branches: 1.66.4;
Fix inverted pid/lid arguments in do_sched_{get,set}param calls.
 1.65 18-Aug-2011  christos branches: 1.65.2; 1.65.12; 1.65.16;
Better debugging.
 1.64 05-Jun-2011  dsl Delete some splurious commas and very unexpected trailing space
 1.63 07-Jul-2010  chs branches: 1.63.2; 1.63.6;
many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
- support new-style (NPTL) linux pthreads on all platforms.
clone() with CLONE_THREAD uses 1 process with many LWPs
instead of separate processes.
- move the contents of sys__lwp_setprivate() into a new
lwp_setprivate() and use that everywhere.
- update linux_release[] and linux32_release[] to "2.6.18".
- adjust placement of emul fork/exec/exit hooks as needed
and adjust other emul code to match.
- convert all struct emul definitions to use named initializers.
- change the pid allocator to allow multiple pids to refer to the same proc.
- remove a few fields from struct proc that are no longer needed.
- disable the non-functional "vdso" code in linux32/amd64,
glibc works fine without it.
- fix a race in the futex code where we could miss a wakeup after
a requeue operation.
- redo futex locking to be a little more efficient.
 1.62 01-Jul-2010  rmind Remove pfind() and pgfind(), fix locking in various broken uses of these.
Rename real routines to proc_find() and pgrp_find(), remove PFIND_* flags
and have consistent behaviour. Provide proc_find_raw() for special cases.
Fix memory leak in sysctl_proc_corename().

COMPAT_LINUX: rework ptrace() locking, minimise differences between
different versions per-arch.

Note: while this change adds some formal cosmetics for COMPAT_DARWIN and
COMPAT_IRIX - locking there is utterly broken (for ages).

Fixes PR/43176.
 1.61 03-Sep-2009  njoly branches: 1.61.2; 1.61.4;
Use correct sched_setscheduler syscall 3rd argument type.
 1.60 23-Jun-2009  njoly sched_getaffinity(2) update:
- dynamically calculate the cpu mask size,
- return it upon success,
- fix generated cpu mask.
 1.59 18-Jun-2009  njoly In linux_sys_sched_getaffinity(), do not leak memory on error.
 1.58 25-Oct-2008  christos branches: 1.58.4; 1.58.8; 1.58.10;
Add preliminary tls support for i386. Does not work yet. From FreeBSD.
 1.57 07-May-2008  njoly branches: 1.57.2; 1.57.6;
Restore sched_native2linux() KASSERTs, i accidentally disabled in a
previous commit.
 1.56 05-May-2008  jmcneill Wrap debug printfs in #ifdef DEBUG_LINUX (hi njoly!)
 1.55 01-May-2008  njoly Add SCHED_FIFO/SCHED_RR support to sched_get_priority_{min,max}.
 1.54 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.53 24-Apr-2008  ad branches: 1.53.2;
Network protocol interrupts can now block on locks, so merge the globals
proclist_mutex and proclist_lock into a single adaptive mutex (proc_lock).
Implications:

- Inspecting process state requires thread context, so signals can no longer
be sent from a hardware interrupt handler. Signal activity must be
deferred to a soft interrupt or kthread.

- As the proc state locking is simplified, it's now safe to take exit()
and wait() out from under kernel_lock.

- The system spends less time at IPL_SCHED, and there is less lock activity.
 1.52 23-Apr-2008  ad Tweak previous.
 1.51 23-Apr-2008  ad Fix locking.
 1.50 29-Feb-2008  elad branches: 1.50.2;
In linux_sys_sched_getparam(), get the native policy too, so that we have
a better chance at properly converting the priority.

Noted by & okay yamt@.
 1.49 28-Feb-2008  elad Factor out the guts of get/setparam so it can be used from the compat code.

Make the FreeBSD and Linux compat code convert the parameters to their
native representation and call the native routines.

Remove KAUTH_PROCESS_SCHEDULER_GET/SET.

Update documentation and examples.

XXX: For now, only the Linux compat code does the priority conversion
XXX: right.

Linux priority conversion code from yamt@, thanks!

Okay yamt@.
 1.48 16-Feb-2008  elad branches: 1.48.2; 1.48.6;
Fold KAUTH_REQ_PROCESS_SCHEDULER_* to KAUTH_PROCESS_SCHEDULER_*. In other
words, don't pass an action and a request, and just use a single action to
indicate what is the operation in question.

This is the first step in fixing PR/37986, which calls for policy/priority
checking in the secmodel code. Right now we're lacking room for another
parameter required to make a decision, and this change makes room for such.
 1.47 23-Jan-2008  elad Tons of process scope changes.

- Add a KAUTH_PROCESS_SCHEDULER action, to handle scheduler related
requests, and add specific requests for set/get scheduler policy and
set/get scheduler parameters.

- Add a KAUTH_PROCESS_KEVENT_FILTER action, to handle kevent(2) related
requests.

- Add a KAUTH_DEVICE_TTY_STI action to handle requests to TIOCSTI.

- Add requests for the KAUTH_PROCESS_CANSEE action, indicating what
process information is being looked at (entry itself, args, env,
open files).

- Add requests for the KAUTH_PROCESS_RLIMIT action indicating set/get.

- Add requests for the KAUTH_PROCESS_CORENAME action indicating set/get.

- Make bsd44 secmodel code handle the newly added rqeuests appropriately.

All of the above make it possible to issue finer-grained kauth(9) calls in
many places, removing some KAUTH_GENERIC_ISSUSER requests.

- Remove the "CAN" from KAUTH_PROCESS_CAN{KTRACE,PROCFS,PTRACE,SIGNAL}.

Discussed with christos@ and yamt@.
 1.46 20-Dec-2007  dsl Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.45 08-Dec-2007  dsl branches: 1.45.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.44 19-Oct-2007  njoly branches: 1.44.2; 1.44.4;
Add compat_linux and exec_linux_elf lkm support for amd64:
- Add needed COMPAT_OSSAUDIO to GENERIC.
- Add missing includes needed by linux_syscallargs.h.
- Add lkm building.
 1.43 19-Oct-2007  ad machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.42 15-Feb-2007  ad branches: 1.42.6; 1.42.18; 1.42.20; 1.42.24;
Count the number of CPUs at boot and stash in 'ncpu'. Eventually should
have each CPU register at attach, so we can figure out the topology for
the scheduler.
 1.41 09-Feb-2007  ad Acquire proclist_mutex before sending signals.
 1.40 09-Feb-2007  ad Merge newlock2 to head.
 1.39 05-Feb-2007  njoly Add a new linux_emuldata_shared flag value LINUX_LES_USE_NPTL to allow
both NPTL and old linuxthreads behaviour depending on process needs.

Apply to exit_group(), getpid() and getppid() to share them between
compat linux32 (non NPTL) and compat linux (NPTL) on amd64.

ok by manu and christos
 1.38 05-Jan-2007  elad Consistent usage of KAUTH_GENERIC_ISSUSER.
 1.37 16-Nov-2006  christos branches: 1.37.2;
__unused removal on arguments; approved by core.
 1.36 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.35 23-Aug-2006  dogcow branches: 1.35.2; 1.35.4;
move #ifdef up a few lines to prevent unused variable warning/error
 1.34 23-Aug-2006  manu 1) Complete Linux exit_group() emulation
Members of the thread group must die without reporting to the parent and
without going to zombie stage. We do that by reparenting to init before
catching a SIGKILL. The parent will not see the child death.

The thread group leader must report the exit status, even if it exits
because of another thread calling exit_group(). We do that by storing the
exit status in struct linux_emuldata_shared, and the exit hook has the
duty of setting struct proc's p_xstat for the thread group leader.

2) For exit/fork/exec hooks, move the NPTL specific code to separate functions
that are shared between COMPAT_LINUX and COMPAT_LINUX32

3) Fix LINUX_CLONE_PARENT_SETTID semantics
 1.33 23-Jul-2006  ad Use the LWP cached credentials where sane.
 1.32 26-Jun-2006  manu Do not implement exit_group() the right way on platforms that do not
define LINUX_NPTL yet, that cause firefox-bin to fail.
 1.31 25-Jun-2006  manu - Complete exit_group() implementation. We now maintain a list of Linux
threads in a processes and kill them properly. The code is a bit too
complicated, but I could not find a simplier way of dealing with it

- Change getpid() and getppid() semantics to match what Linux does,
and implement gettid(). In the Linux kernel, threads are implemnted
as plain old processes. A thread group is just a set of processes,
with the parent called leader. Thread ID, which are returned by gettid(),
are just the PID of the plain old processes, and getpid() returns the
PID of the thread group leader.

- Remove struct linux32_emuldata. COMPAT_LINUX32 uses a lot of COMPAT_LINUX
code, where a struct linux_emuldata is assumed. By having distinct emuldata
structure with different sizes and layouts, we caused kernel memory
corruptions.

- Fix setprioriry() and getpriority()

Thanks to Nicolas Joly for tracking down the problem and providing me the
hardware to fix them.
 1.30 14-May-2006  elad branches: 1.30.4;
integrate kauth.
 1.29 29-Nov-2005  jdolecek branches: 1.29.4; 1.29.6; 1.29.8; 1.29.10; 1.29.12;
undo linux_sys_exit_group() change _again_ - please do not commit known
broken code
 1.28 29-Nov-2005  manu Threads should not send a signal on exit.
 1.27 23-Nov-2005  manu - Add Linux tkill and tgkill (partial emulation).
- Fix getrlimit on amd64
 1.26 11-Nov-2005  jdolecek branches: 1.26.2;
undo the linux_sys_exit_group() change for now - complete CLONE_THREAD support
is necessary for this to work properly
 1.25 09-Nov-2005  manu Fix build problem
 1.24 09-Nov-2005  manu Improve Linux exit_group emulation by sending a SIGKILL to all other
processes in the group instead of letting them live. It would be better
to properly terminate them.
 1.23 05-Nov-2005  manu ifdef out sched_{get|set}affinity for ports that don't use it yet. That
should fix build.
 1.22 05-Nov-2005  manu Implement Linux sched_{set|get}affinity
 1.21 05-Nov-2005  manu Instead of ifdef'ing __amd64__ all the Linux NPTL stuff, introduce an
ifdef LINUX_NPTL.
Also implement SETTLS flag to Linux clone()
 1.20 04-Nov-2005  manu Implement Linux futex ang gettid
 1.19 22-Jun-2005  manu branches: 1.19.2;
Implent CLONE_PARENT_SETTID, CLONE_CHILD_CLEARTID, and CLONE_CHILD_SETTID
options to clone(). This makes fork() work on amd64.

clone() prototype has changed and the changes is probably revelant on some
other arches.
 1.18 10-Sep-2004  wiz Fix typo in comment.
 1.17 09-Sep-2004  tron Next attempt to fix the RCS Id. *sigh*
 1.16 09-Sep-2004  tron Fix RCS Id lossage caused by last commit.
 1.15 09-Sep-2004  tron Finish linux_sys_exit_group() with a (never reached) "return" statement so
that GCC will actually compile this.
 1.14 08-Sep-2004  jdolecek implement basic exit_group(2), which just terminates calling thread;
apparently not many apps use thread groups yet, at least not with default
SuSE 9.1 libraries, so this is enough for now
 1.13 08-Sep-2004  jdolecek do more strict flag checking in clone(2) (matches what Linux does)
 1.12 18-Jan-2003  thorpej branches: 1.12.2;
Merge the nathanw_sa branch.
 1.11 22-Dec-2002  gmcgarry Use yield() for voluntary context switches.
 1.10 31-Mar-2002  christos branches: 1.10.6;
make signal array handling uniform, and put signal arrays in a separate
file. This is simular to errno array handling.
 1.9 15-Nov-2001  lukem don't need <sys/types.h> when including <sys/param.h>
 1.8 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.7 25-Aug-2000  thorpej branches: 1.7.2; 1.7.4;
Make need_resched() take a "struct cpu_info *" argument. This
causes gives a primitive form of processor affinity. Its use in
roundrobin() still needs some work.
 1.6 28-May-2000  thorpej Rather than starting init and creating kthreads by forking and then
doing a cpu_set_kpc(), just pass the entry point and argument all
the way down the fork path starting with fork1(). In order to
avoid special-casing the normal fork in every cpu_fork(), MI code
passes down child_return() and the child process pointer explicitly.

This fixes a race condition on multiprocessor systems; a CPU could
grab the newly created processes (which has been placed on a run queue)
before cpu_set_kpc() would be performed.
 1.5 30-Mar-2000  augustss branches: 1.5.2;
Kill register declarations.
 1.4 04-Dec-1999  tron Allow signal numbers upto 63 in clone(2) emulation.
 1.3 21-Oct-1999  itohy Add #include <machine/cpu.h> for need_resched() macro.
 1.2 11-Oct-1999  thorpej branches: 1.2.2; 1.2.4;
Fix typos in the license notice.
 1.1 04-Oct-1999  tron branches: 1.1.2;
Add emulation for scheduler related syscalls. Although they are dummies
even under Linux the posix thread library for "glibc2" requires them.
 1.1.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.2.4.1 15-Nov-1999  fvdl Sync with -current
 1.2.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.5.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.7.4.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.7.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.7.2.7 29-Dec-2002  thorpej Sync with HEAD.
 1.7.2.6 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.7.2.5 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.7.2.4 17-Apr-2002  nathanw Catch up to -current.
 1.7.2.3 08-Jan-2002  nathanw Catch up to -current.
 1.7.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.7.2.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.10.6.1 18-Dec-2002  gmcgarry Merge pcred and ucred, and poolify. TBD: check backward compatibility
and factor-out some higher-level functionality.
 1.12.2.4 11-Dec-2005  christos Sync with head.
 1.12.2.3 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.12.2.2 21-Sep-2004  skrll Fix the sync with head I botched.
 1.12.2.1 18-Sep-2004  skrll Sync with HEAD.
 1.19.2.8 17-Mar-2008  yamt sync with head.
 1.19.2.7 27-Feb-2008  yamt sync with head.
 1.19.2.6 04-Feb-2008  yamt sync with head.
 1.19.2.5 21-Jan-2008  yamt sync with head
 1.19.2.4 27-Oct-2007  yamt sync with head.
 1.19.2.3 26-Feb-2007  yamt sync with head.
 1.19.2.2 30-Dec-2006  yamt sync with head.
 1.19.2.1 21-Jun-2006  yamt sync with head.
 1.26.2.1 29-Nov-2005  yamt sync with head.
 1.29.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.29.10.2 06-May-2006  christos - Move kauth_cred_t declaration to <sys/types.h>
- Cleanup struct ucred; forward declarations that are unused.
- Don't include <sys/kauth.h> in any header, but include it in the c files
that need it.

Approved by core.
 1.29.10.1 08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.29.8.4 03-Sep-2006  yamt sync with head.
 1.29.8.3 11-Aug-2006  yamt sync with head
 1.29.8.2 26-Jun-2006  yamt sync with head.
 1.29.8.1 24-May-2006  yamt sync with head.
 1.29.6.1 01-Jun-2006  kardel Sync with head.
 1.29.4.1 09-Sep-2006  rpaulo sync with head
 1.30.4.1 13-Jul-2006  gdamore Merge from HEAD.
 1.35.4.2 10-Dec-2006  yamt sync with head.
 1.35.4.1 22-Oct-2006  yamt sync with head
 1.35.2.4 09-Feb-2007  ad Sync with HEAD.
 1.35.2.3 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.35.2.2 12-Jan-2007  ad Sync with head.
 1.35.2.1 18-Nov-2006  ad Sync with head.
 1.37.2.2 21-Jun-2009  bouyer Pull up following revision(s) (requested by njoly in ticket #1328):
sys/compat/linux/common/linux_sched.c: revision 1.59
In linux_sys_sched_getaffinity(), do not leak memory on error.
 1.37.2.1 28-Mar-2007  jdc branches: 1.37.2.1.6;
Pull up revision 1.39 (requested by njoly in ticket #523).

Add a new linux_emuldata_shared flag value LINUX_LES_USE_NPTL to allow
both NPTL and old linuxthreads behaviour depending on process needs.

Apply to exit_group(), getpid() and getppid() to share them between
compat linux32 (non NPTL) and compat linux (NPTL) on amd64.

ok by manu and christos
 1.37.2.1.6.1 21-Jun-2009  bouyer Pull up following revision(s) (requested by njoly in ticket #1328):
sys/compat/linux/common/linux_sched.c: revision 1.59
In linux_sys_sched_getaffinity(), do not leak memory on error.
 1.42.24.1 25-Oct-2007  bouyer Sync with HEAD.
 1.42.20.3 23-Mar-2008  matt sync with HEAD
 1.42.20.2 09-Jan-2008  matt sync with HEAD
 1.42.20.1 06-Nov-2007  matt sync with HEAD
 1.42.18.2 09-Dec-2007  jmcneill Sync with HEAD.
 1.42.18.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.42.6.1 23-Oct-2007  ad Sync with head.
 1.44.4.1 26-Dec-2007  ad Sync with head.
 1.44.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.45.4.2 23-Jan-2008  bouyer Sync with HEAD.
 1.45.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.48.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.48.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.48.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.48.2.1 24-Mar-2008  keiichi sync with head.
 1.50.2.1 18-May-2008  yamt sync with head.
 1.53.2.5 11-Aug-2010  yamt sync with head.
 1.53.2.4 16-Sep-2009  yamt sync with head
 1.53.2.3 18-Jul-2009  yamt sync with head.
 1.53.2.2 04-May-2009  yamt sync with head.
 1.53.2.1 16-May-2008  yamt sync with head.
 1.57.6.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.57.2.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.57.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.58.10.1 19-Jun-2009  snj branches: 1.58.10.1.2;
Pull up following revision(s) (requested by njoly in ticket #822):
sys/compat/linux/common/linux_sched.c: revision 1.59
In linux_sys_sched_getaffinity(), do not leak memory on error.
 1.58.10.1.2.1 21-Apr-2010  matt sync to netbsd-5
 1.58.8.1 23-Jul-2009  jym Sync with HEAD.
 1.58.4.1 19-Jun-2009  snj Pull up following revision(s) (requested by njoly in ticket #822):
sys/compat/linux/common/linux_sched.c: revision 1.59
In linux_sys_sched_getaffinity(), do not leak memory on error.
 1.61.4.3 12-Jun-2011  rmind sync with head
 1.61.4.2 05-Mar-2011  rmind sync with head
 1.61.4.1 03-Jul-2010  rmind sync with head
 1.61.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.63.6.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.63.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.65.16.1 18-May-2014  rmind sync with head
 1.65.12.2 03-Dec-2017  jdolecek update from HEAD
 1.65.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.65.2.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.66.4.2 31-Dec-2016  snj Pull up following revision(s) (requested by rin in ticket #1343):
sys/compat/linux/common/linux_sched.c: revision 1.68
PR/50021: Rin Okuyama: Fix linux affinity syscalls
 1.66.4.1 17-Jan-2015  martin branches: 1.66.4.1.4;
Pull up following revision(s) (requested by maxv in ticket #427):
sys/compat/svr4/svr4_schedctl.c: revision 1.8
sys/netinet/tcp_timer.c: revision 1.88
sys/miscfs/genfs/layer_vfsops.c: revision 1.45
sys/compat/svr4/svr4_ioctl.c: revision 1.37
sys/ufs/chfs/chfs_vfsops.c: revision 1.14
sys/miscfs/fdesc/fdesc_vfsops.c: revision 1.91
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.30
sys/compat/common/kern_time_50.c: revision 1.28
sys/netinet6/ip6_forward.c: revision 1.74
sys/miscfs/umapfs/umap_vnops.c: revision 1.57
sys/compat/svr4/svr4_fcntl.c: revision 1.74
distrib/sets/lists/comp/mi: revision 1.1931
sys/netinet6/udp6_output.c: revision 1.46
sys/fs/puffs/puffs_compat.c: revision 1.3
sys/fs/udf/udf_rename.c: revision 1.11
sys/compat/svr4/svr4_filio.c: revision 1.24
sys/fs/udf/udf_rename.c: revision 1.12
sys/netinet/tcp_usrreq.c: revision 1.202
sys/miscfs/umapfs/umap_subr.c: revision 1.29
sys/compat/linux/common/linux_fadvise64.c: revision 1.3
sys/netinet/if_atm.c: revision 1.34
sys/miscfs/procfs/procfs_subr.c: revision 1.106
sys/miscfs/genfs/layer_subr.c: revision 1.37
sys/netinet/tcp_sack.c: revision 1.30
sys/compat/freebsd/freebsd_misc.c: revision 1.33
sys/compat/freebsd/freebsd_file.c: revision 1.33
sys/ufs/chfs/chfs_vnode.c: revision 1.12
sys/compat/svr4/svr4_ttold.c: revision 1.34
sys/compat/linux/common/linux_file.c: revision 1.114
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.43
sys/compat/linux/common/linux_signal.c: revision 1.76
sys/compat/common/compat_util.c: revision 1.46
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.18
sys/compat/svr4/svr4_sockio.c: revision 1.36
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.32
sys/compat/svr4/svr4_signal.c: revision 1.66
sys/kern/kern_exec.c: revision 1.410
sys/fs/puffs/puffs_vfsops.c: revision 1.115
sys/compat/svr4/svr4_exec_elf64.c: revision 1.15
sys/compat/linux/arch/i386/linux_machdep.c: revision 1.159
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.50
sys/compat/linux32/common/linux32_misc.c: revision 1.24
sys/netinet/in_pcb.c: revision 1.153
sys/sys/malloc.h: revision 1.116
sys/compat/common/if_43.c: revision 1.9
share/man/man9/Makefile: revision 1.380
sys/netinet/tcp_vtw.c: revision 1.12
sys/miscfs/umapfs/umap_vfsops.c: revision 1.95
sys/ufs/ext2fs/ext2fs_vfsops.c: revision 1.186
sys/compat/common/uipc_syscalls_43.c: revision 1.46
sys/ufs/ext2fs/ext2fs_vnops.c: revision 1.115
sys/fs/puffs/puffs_msgif.c: revision 1.97
sys/compat/svr4/svr4_ipc.c: revision 1.27
sys/compat/linux/common/linux_exec.c: revision 1.117
sys/ufs/ext2fs/ext2fs_readwrite.c: revision 1.66
sys/netinet/tcp_output.c: revision 1.179
sys/compat/svr4/svr4_termios.c: revision 1.28
sys/fs/udf/udf_strat_bootstrap.c: revision 1.4
sys/fs/puffs/puffs_subr.c: revision 1.67
sys/fs/puffs/puffs_node.c: revision 1.36
sys/miscfs/overlay/overlay_vnops.c: revision 1.21
sys/fs/cd9660/cd9660_node.c: revision 1.34
sys/netinet/raw_ip.c: revision 1.146
sys/sys/mallocvar.h: revision 1.13
sys/miscfs/overlay/overlay_vfsops.c: revision 1.63
share/man/man9/malloc.9: revision 1.50
sys/netinet6/dest6.c: revision 1.18
sys/compat/linux/common/linux_uselib.c: revision 1.33
sys/compat/linux/common/linux_socket.c: revision 1.120
share/man/man9/malloc.9: revision 1.51
sys/netinet/tcp_subr.c: revision 1.257
sys/compat/linux/common/linux_socketcall.c: revision 1.45
sys/compat/linux/common/linux_fadvise64_64.c: revision 1.3
sys/compat/freebsd/freebsd_ipc.c: revision 1.17
sys/compat/linux/common/linux_misc_notalpha.c: revision 1.109
sys/compat/linux/arch/alpha/linux_pipe.c: revision 1.17
sys/netinet6/in6_pcb.c: revision 1.132
sys/netinet6/in6_ifattach.c: revision 1.94
sys/compat/svr4/svr4_exec_elf32.c: revision 1.15
sys/miscfs/nullfs/null_vfsops.c: revision 1.90
sys/fs/cd9660/cd9660_util.c: revision 1.12
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.48
sys/compat/freebsd/freebsd_exec_elf32.c: revision 1.20
sys/miscfs/procfs/procfs_vfsops.c: revision 1.94
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.28
sys/compat/linux/common/linux_sched.c: revision 1.67
sys/compat/linux/common/linux_exec_aout.c: revision 1.67
sys/compat/linux/common/linux_pipe.c: revision 1.67
sys/compat/linux/common/linux_llseek.c: revision 1.34
sys/compat/linux/arch/mips/linux_ptrace.c: revision 1.10
Do not uselessly include <sys/malloc.h>.
Cleanup:
- remove struct kmembuckets (dead)
- correctly deadify MALLOC_XX
- remove MALLOC_DEFINE_LIMIT and MALLOC_JUSTDEFINE_LIMIT (dead)
- remove malloc_roundup(), malloc_type_setlimit(), MALLOC_DEFINE_LIMIT()
and MALLOC_JUSTDEFINE_LIMIT() from man 9 malloc
New sentence, new line. Bump date for previous.
Obsolete malloc_roundup(9), malloc_type_setlimit(9) and MALLOC_DEFINE_LIMIT(9)
man pages.
 1.66.4.1.4.1 18-Jan-2017  skrll Sync with netbsd-5
 1.67.2.2 28-Aug-2017  skrll Sync with HEAD
 1.67.2.1 22-Sep-2015  skrll Sync with HEAD
 1.68.4.1 21-Apr-2017  bouyer Sync with HEAD
 1.68.2.1 26-Apr-2017  pgoyette Sync with HEAD
 1.69.10.2 22-Apr-2018  pgoyette Sync with HEAD
 1.69.10.1 16-Apr-2018  pgoyette Sync with HEAD, resolve some conflicts
 1.69.4.1 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1836):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.71.6.1 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.71.2.2 21-Apr-2020  martin Sync with HEAD
 1.71.2.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.73.6.2 25-Apr-2020  bouyer Sync with bouyer-xenpvh-base2 (HEAD)
 1.73.6.1 20-Apr-2020  bouyer Sync with HEAD
 1.79.10.1 02-Aug-2025  perseant Sync with HEAD
 1.83.2.1 09-Oct-2025  martin Pull up following revision(s) (requested by christos in ticket #49):

sys/compat/linux/common/linux_sched.h: revision 1.12
sys/compat/linux/common/linux_sched.c: revision 1.84
sys/compat/linux/common/linux_sched.c: revision 1.85

PR/59608: csaba mate: fix stack address and ignore sysvsem flag. makes
the
latest jvm work again.

cl_args.stack_size is uint64_t (all architectures), on ILP32 (void *)
is 32 bits, as is (intptr_t). 32 bits added to 64 bits --> 64 bits,
which gcc complains about converting to a pointer. Add yet another
cast.

Should fix ILP32 builds (eg: i386)
 1.12 19-Sep-2025  christos PR/59608: csaba mate: fix stack address and ignore sysvsem flag. makes the
latest jvm work again.
 1.11 28-Sep-2024  christos branches: 1.11.2;
Linux GSoC-2024: renameat2, clone3, sync_file_range, syncfs (Shivraj Jamgade)
 1.10 19-Sep-2021  thorpej branches: 1.10.10;
Add the timerfd syscalls to COMPAT_LINUX and COMPAT_LINUX32.
 1.9 19-Sep-2021  thorpej Add the POSIX timer syscalls (timer_create(), timer_settime(), timer_gettime(),
timer_getoverrun(), and timer_delete()) to COMPAT_LINUX and COMPAT_LINUX32.
 1.8 18-Nov-2011  christos branches: 1.8.64;
- add sigtimedwait support.
- merge the siginfo population code.
 1.7 28-Apr-2008  martin branches: 1.7.34;
Remove clause 3 and 4 from TNF licenses
 1.6 17-Apr-2008  njoly branches: 1.6.2; 1.6.4;
Add compat linux32 sys_clock_{getres,gettime,settime} syscalls.
 1.5 11-Dec-2005  christos branches: 1.5.70;
merge ktrace-lwp.
 1.4 16-May-2005  fvdl Implement clock_* POSIX functions.
 1.3 05-Sep-2004  jdolecek add some newer clone flags
 1.2 04-Oct-1999  tron branches: 1.2.36;
Add emulation for scheduler related syscalls. Although they are dummies
even under Linux the posix thread library for "glibc2" requires them.
 1.1 12-May-1999  thorpej branches: 1.1.2;
Add scheduling-related definitions. Currently we have the flags passed
to the __clone(2) system call.
 1.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.2.36.3 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.2.36.2 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.36.1 18-Sep-2004  skrll Sync with HEAD.
 1.5.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.6.4.1 16-May-2008  yamt sync with head.
 1.6.2.1 18-May-2008  yamt sync with head.
 1.7.34.1 17-Apr-2012  yamt sync with head
 1.8.64.2 17-Dec-2020  thorpej Re-factor the code that maps the clockid_t in timer_create() and
the flags in timerfd_settime() into separate functions.
 1.8.64.1 15-Dec-2020  thorpej Add Linux eventfd, timerfd, and POSIX timer calls.
 1.10.10.1 02-Aug-2025  perseant Sync with HEAD
 1.11.2.1 09-Oct-2025  martin Pull up following revision(s) (requested by christos in ticket #49):

sys/compat/linux/common/linux_sched.h: revision 1.12
sys/compat/linux/common/linux_sched.c: revision 1.84
sys/compat/linux/common/linux_sched.c: revision 1.85

PR/59608: csaba mate: fix stack address and ignore sysvsem flag. makes
the
latest jvm work again.

cl_args.stack_size is uint64_t (all architectures), on ILP32 (void *)
is 32 bits, as is (intptr_t). 32 bits added to 64 bits --> 64 bits,
which gcc complains about converting to a pointer. Add yet another
cast.

Should fix ILP32 builds (eg: i386)
 1.11 23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.10 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.9 24-Apr-2008  njoly branches: 1.9.2;
Add IPC_64 support for semctl IPC_STAT/IPC_SET.
 1.8 20-Dec-2007  dsl branches: 1.8.6; 1.8.8;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.7 04-Dec-2007  dsl branches: 1.7.4;
Remove all the __P
 1.6 09-Feb-2006  manu branches: 1.6.38; 1.6.40; 1.6.46; 1.6.50;
Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.5 18-Jan-2003  thorpej branches: 1.5.18; 1.5.30; 1.5.32; 1.5.34;
Merge the nathanw_sa branch.
 1.4 04-Oct-1998  fvdl branches: 1.4.24;
Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.3 03-Oct-1998  christos Attempt to fix the mess.
 1.2 01-Oct-1998  erh Move IPC headers to common. The msg, sem and shm files, in addition to other common structures and to avoid creating several more machine dependent header files, include the syscall arguments for several system calls which don't exist on all architechtures.
 1.1 15-Aug-1995  fvdl Implement the rest of the sysv ipc calls ({sem,msg}*())
 1.4.24.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.5.34.1 22-Apr-2006  simonb Sync with head.
 1.5.32.1 09-Sep-2006  rpaulo sync with head
 1.5.30.1 18-Feb-2006  yamt sync with head.
 1.5.18.3 21-Jan-2008  yamt sync with head
 1.5.18.2 07-Dec-2007  yamt sync with head
 1.5.18.1 21-Jun-2006  yamt sync with head.
 1.6.50.2 26-Dec-2007  ad Sync with head.
 1.6.50.1 08-Dec-2007  ad Sync with head.
 1.6.46.2 27-Dec-2007  mjf Sync with HEAD.
 1.6.46.1 08-Dec-2007  mjf Sync with HEAD.
 1.6.40.1 09-Jan-2008  matt sync with HEAD
 1.6.38.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.7.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.8.8.1 18-May-2008  yamt sync with head.
 1.8.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.9.2.1 16-May-2008  yamt sync with head.
 1.14 21-Nov-2017  maxv This should be "linux_sg_version", not "version".
 1.13 21-Mar-2008  ad branches: 1.13.6; 1.13.48; 1.13.84;
Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
 1.12 20-Dec-2007  dsl branches: 1.12.6;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.11 19-Oct-2007  njoly branches: 1.11.4; 1.11.8;
Add compat_linux and exec_linux_elf lkm support for amd64:
- Add needed COMPAT_OSSAUDIO to GENERIC.
- Add missing includes needed by linux_syscallargs.h.
- Add lkm building.
 1.10 04-Mar-2007  christos branches: 1.10.14; 1.10.16; 1.10.20;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.9 09-Feb-2007  ad branches: 1.9.2;
Merge newlock2 to head.
 1.8 13-Sep-2006  christos Avoid empty body in if
 1.7 11-Dec-2005  christos branches: 1.7.8; 1.7.20;
merge ktrace-lwp.
 1.6 04-Nov-2005  chs make this compile on m68k by including sys/device.h explicitly.
on other platforms it's apparently included implicitly, probably through cpu.h.
 1.5 26-Feb-2005  perry branches: 1.5.2; 1.5.4; 1.5.6;
nuke trailing whitespace
 1.4 13-Feb-2005  soren SG_GET_VERSION_NUM returns an int. Also make the version number patchable.
 1.3 13-Feb-2005  christos Don't zero out the linux request; we still need values from it.
Limit the sense len to the linux input buffer.
 1.2 13-Feb-2005  christos We were zeroing out the wrong struct.
 1.1 03-Feb-2005  christos branches: 1.1.2; 1.1.4;
Add linux scsi-generic to work for simple cases. Allows gendalia's change
to limp along. From soren with fixes from me.
 1.1.4.3 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.1.4.2 12-Feb-2005  yamt sync with head.
 1.1.4.1 03-Feb-2005  yamt file linux_sg.c was added on branch yamt-km on 2005-02-12 18:17:41 +0000
 1.1.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.1.2.3 15-Feb-2005  skrll Sync with HEAD.
 1.1.2.2 04-Feb-2005  skrll Sync with HEAD.
 1.1.2.1 03-Feb-2005  skrll file linux_sg.c was added on branch ktrace-lwp on 2005-02-04 11:45:08 +0000
 1.5.6.7 24-Mar-2008  yamt sync with head.
 1.5.6.6 21-Jan-2008  yamt sync with head
 1.5.6.5 27-Oct-2007  yamt sync with head.
 1.5.6.4 03-Sep-2007  yamt sync with head.
 1.5.6.3 26-Feb-2007  yamt sync with head.
 1.5.6.2 30-Dec-2006  yamt sync with head.
 1.5.6.1 21-Jun-2006  yamt sync with head.
 1.5.4.2 29-Apr-2005  kent sync with -current
 1.5.4.1 26-Feb-2005  kent file linux_sg.c was added on branch kent-audio2 on 2005-04-29 11:28:40 +0000
 1.5.2.1 11-Oct-2006  ghen Pull up following revision(s) (requested by tsutsui in ticket #1526):
sys/compat/linux/common/linux_sg.c: revision 1.6
make this compile on m68k by including sys/device.h explicitly.
on other platforms it's apparently included implicitly, probably through cpu.h.
 1.7.20.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.7.20.1 18-Nov-2006  ad Sync with head.
 1.7.8.1 14-Sep-2006  yamt sync with head.
 1.9.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.10.20.1 25-Oct-2007  bouyer Sync with HEAD.
 1.10.16.2 09-Jan-2008  matt sync with HEAD
 1.10.16.1 06-Nov-2007  matt sync with HEAD
 1.10.14.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.11.8.1 02-Jan-2008  bouyer Sync with HEAD
 1.11.4.1 26-Dec-2007  ad Sync with head.
 1.12.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.13.84.1 30-Nov-2017  martin Pull up following revision(s) (requested by maxv in ticket #400):
sys/compat/linux/common/linux_sg.c: revision 1.14
This should be "linux_sg_version", not "version".
 1.13.48.1 03-Dec-2017  jdolecek update from HEAD
 1.13.6.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.13.6.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 26-Feb-2005  perry branches: 1.2.4;
nuke trailing whitespace
 1.1 03-Feb-2005  christos branches: 1.1.2; 1.1.4;
Add linux scsi-generic to work for simple cases. Allows gendalia's change
to limp along. From soren with fixes from me.
 1.1.4.3 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.1.4.2 12-Feb-2005  yamt sync with head.
 1.1.4.1 03-Feb-2005  yamt file linux_sg.h was added on branch yamt-km on 2005-02-12 18:17:41 +0000
 1.1.2.3 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.1.2.2 04-Feb-2005  skrll Sync with HEAD.
 1.1.2.1 03-Feb-2005  skrll file linux_sg.h was added on branch ktrace-lwp on 2005-02-04 11:45:08 +0000
 1.2.4.2 29-Apr-2005  kent sync with -current
 1.2.4.1 26-Feb-2005  kent file linux_sg.h was added on branch kent-audio2 on 2005-04-29 11:28:40 +0000
 1.12 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.11 28-Jan-2008  njoly branches: 1.11.6; 1.11.8; 1.11.10;
Update struct linux_shmid64_ds for 64bits archs.
- shm_segsz should be of type size_t, not int.
- Disable padding fields used on 32bits archs.
 1.10 20-Dec-2007  dsl Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.9 04-Dec-2007  dsl branches: 1.9.4;
Remove all the __P
 1.8 09-Feb-2006  manu branches: 1.8.38; 1.8.40; 1.8.46; 1.8.50;
Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.7 10-Nov-2005  christos branches: 1.7.4; 1.7.6; 1.7.8;
More ipc support for linux; makes oracle work. From chuq and
jlrodriguez at terra dot es
 1.6 28-Sep-2004  jdolecek branches: 1.6.12;
add flag for shmget(2) to specify that later shmat(2) for the shared memory
segment should succeed even if the segment would be marked removed; use this
to implement the Linux-compatible semantics of shmat(2)

this fixes the old Linux VMware3 graphics problem with local display,
and possibly other local Linux X clients using MIT-SHM
 1.5 18-Jan-2003  thorpej branches: 1.5.2; 1.5.4;
Merge the nathanw_sa branch.
 1.4 04-Oct-1998  fvdl branches: 1.4.24;
Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.3 03-Oct-1998  christos Attempt to fix the mess.
 1.2 01-Oct-1998  erh Move IPC headers to common. The msg, sem and shm files, in addition to other common structures and to avoid creating several more machine dependent header files, include the syscall arguments for several system calls which don't exist on all architechtures.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.4.24.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.5.4.1 04-Oct-2004  jmc Pullup rev 1.6 (requested by jdolecek in ticket #884)

Fix linux handling of SysV-style shared memory. Fixed Linux VMware display
problems.
 1.5.2.2 11-Dec-2005  christos Sync with head.
 1.5.2.1 19-Oct-2004  skrll Sync with HEAD
 1.6.12.4 04-Feb-2008  yamt sync with head.
 1.6.12.3 21-Jan-2008  yamt sync with head
 1.6.12.2 07-Dec-2007  yamt sync with head
 1.6.12.1 21-Jun-2006  yamt sync with head.
 1.7.8.1 22-Apr-2006  simonb Sync with head.
 1.7.6.1 09-Sep-2006  rpaulo sync with head
 1.7.4.1 18-Feb-2006  yamt sync with head.
 1.8.50.2 26-Dec-2007  ad Sync with head.
 1.8.50.1 08-Dec-2007  ad Sync with head.
 1.8.46.3 18-Feb-2008  mjf Sync with HEAD.
 1.8.46.2 27-Dec-2007  mjf Sync with HEAD.
 1.8.46.1 08-Dec-2007  mjf Sync with HEAD.
 1.8.40.2 23-Mar-2008  matt sync with HEAD
 1.8.40.1 09-Jan-2008  matt sync with HEAD
 1.8.38.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.9.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.11.10.1 16-May-2008  yamt sync with head.
 1.11.8.1 18-May-2008  yamt sync with head.
 1.11.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.41 25-Nov-2021  ryo add support COMPAT_LINUX32 for aarch64
 1.40 23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.39 02-Jun-2009  njoly Add the mask value returned by siggetmask.
 1.38 28-Apr-2008  martin branches: 1.38.2; 1.38.14;
Remove clause 3 and 4 from TNF licenses
 1.37 24-Apr-2008  ad branches: 1.37.2;
Merge proc::p_mutex and proc::p_smutex into a single adaptive mutex, since
we no longer need to guard against access from hardware interrupt handlers.

Additionally, if cloning a process with CLONE_SIGHAND, arrange to have the
child process share the parent's lock so that signal state may be kept in
sync. Partially addresses PR kern/37437.
 1.36 20-Dec-2007  dsl branches: 1.36.6; 1.36.8;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.35 08-Dec-2007  dsl branches: 1.35.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.34 19-Oct-2007  njoly branches: 1.34.4;
Add compat_linux and exec_linux_elf lkm support for amd64:
- Add needed COMPAT_OSSAUDIO to GENERIC.
- Add missing includes needed by linux_syscallargs.h.
- Add lkm building.
 1.33 09-Feb-2007  ad branches: 1.33.18; 1.33.20; 1.33.24;
Merge newlock2 to head.
 1.32 16-Nov-2006  christos __unused removal on arguments; approved by core.
 1.31 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.30 11-Dec-2005  christos branches: 1.30.20; 1.30.22;
merge ktrace-lwp.
 1.29 03-May-2005  manu branches: 1.29.2;
First work on COMPAT_LINUX/amd64
Process startup and dynamiclinking work, but processes hang due to
Linux arch_prctl(2) not being really supported yet.
 1.28 26-Feb-2005  perry nuke trailing whitespace
 1.27 18-Jan-2003  thorpej branches: 1.27.2; 1.27.10; 1.27.12;
Merge the nathanw_sa branch.
 1.26 04-Jul-2002  thorpej Add kernel support for having userland provide the signal trampoline:

* struct sigacts gets a new sigact_sigdesc structure, which has the
sigaction and the trampoline/version. Version 0 means "legacy kernel
provided trampoline". Other versions are coordinated with machine-
dependent code in libc.
* sigaction1() grows two more arguments -- the trampoline pointer and
the trampoline version.
* A new __sigaction_sigtramp() system call is provided to register a
trampoline along with a signal handler.
* The handler is no longer passed to sensig() functions. Instead,
sendsig() looks up the handler by peeking in the sigacts for the
process getting the signal (since it has to look in there for the
trampoline anyway).
* Native sendsig() functions now select the appropriate trampoline and
its arguments based on the trampoline version in the sigacts.

Changes to libc to use the new facility will be checked in later. Kernel
version not bumped; we will ride the 1.6C bump made recently.
 1.25 31-Mar-2002  christos branches: 1.25.2;
make signal array handling uniform, and put signal arrays in a separate
file. This is simular to errno array handling.
 1.24 15-Feb-2002  christos - add a real linux_sys___sysctl because the mib numbers are different.
implement only the kernel version getting entries.
- make the signal conversion functions consistent; dest is arg 1.
- make linux_fakedev deal with block and char devices differently.
- add linux_sys_ugetrlimit, and flesh out the regular get/setrlimit so
that they work properly.
- add linux_mmap2 [untested].
- bump kernel to 2.4.18, and make the date be valentine's day :-)
- linux_sys_*stat64 family was totally busted. Fix it.

tested only on i386.

Status:
gdb, telnet, work
jdk-1.4.0 extractor works, jdk still coredumps.

christos
 1.23 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.22 30-Mar-2000  augustss branches: 1.22.6; 1.22.8;
Kill register declarations.
 1.21 04-Dec-1999  tron Fix typo in last commit.
 1.20 04-Dec-1999  tron Adapt to renamed system call argument.
 1.19 04-Dec-1999  tron Add bound checks in emulation of signal(2) and return SIG_ERR on failure.
This fixes a part of PR kern/8904 by Dave Sainty.
 1.18 07-Oct-1998  erh branches: 1.18.12; 1.18.18;
Fix typos.
 1.17 07-Oct-1998  erh sigprocmask (non-rt version) doesn't exist on alpha. Add it here.
 1.16 04-Oct-1998  fvdl Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.15 03-Oct-1998  christos Attempt to fix the mess.
 1.14 01-Oct-1998  erh Split compat/linux/linux_signal.c into i386, common and multi-architecture parts.
 1.13 29-Sep-1998  tv Bracket stray printf()s by #ifdef DEBUG.
 1.12 11-Sep-1998  mycroft Substantial signal handling changes:
* Increase the size of sigset_t to accomodate 128 signals -- adding new
versions of sys_setprocmask(), sys_sigaction(), sys_sigpending() and
sys_sigsuspend() to handle the changed arguments.
* Abstract the guts of sys_sigaltstack(), sys_setprocmask(), sys_sigaction(),
sys_sigpending() and sys_sigsuspend() into separate functions, and call them
from all the emulations rather than hard-coding everything. (Avoids uses
the stackgap crap for these system calls.)
* Add a new flag (p_checksig) to indicate that a process may have signals
pending and userret() needs to do the full (slow) check.
* Eliminate SAS_ALTSTACK; it's exactly the inverse of SS_DISABLE.
* Correct emulation bugs with restoring SS_ONSTACK.
* Make the signal mask in the sigcontext always use the emulated mask format.
* Store signals internally in sigaction structures, rather than maintaining a
bunch of little sigsets for each SA_* bit.
* Keep track of where we put the signal trampoline, rather than figuring it out
in *_sendsig().
* Issue a warning when a non-emulated sigaction bit is observed.
* Add missing emulated signals, and a native SIGPWR (currently not used).
* Implement the `not reset when caught' semantics for relevant signals.

Note: Only code touched by the i386 port has been modified. Other ports and
emulations need to be updated.
 1.11 09-Aug-1998  perry bzero->memset, bcopy->memcpy, bcmp->memcmp
 1.10 04-Apr-1996  christos - Add missing prototypes
- Fix bugs with reversed arguments that prototyping discovered
 1.9 07-Oct-1995  mycroft Prefix names of system call implementation functions with `sys_'.
 1.8 19-Sep-1995  thorpej Make system calls conform to a standard prototype and bring those
prototypes into scope.
 1.7 14-Aug-1995  mycroft Move signal types into signal.h.
 1.6 13-Aug-1995  mycroft Convert SA_NOMASK and SA_ONESHOT.
Clean up this code a bit.
 1.5 24-Jun-1995  christos Use compat_util.[ch].
 1.4 22-Jun-1995  fvdl * Changed to use generic ELF code from kern/exec_elf.c (which was taken
from the svr4 exec code plus the linux compat mods)
* Include file change
* Add multicast sockopts (from John Brezak)
 1.3 10-Mar-1995  fvdl Add the Linux pause() system call. Fix the arguments to sigsuspend().
 1.2 08-Mar-1995  fvdl Fix typo in comment.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.18.18.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.18.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.22.8.4 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.22.8.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.22.8.2 16-Mar-2002  jdolecek Catch up with -current.
 1.22.8.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.22.6.8 01-Aug-2002  nathanw Catch up to -current.
 1.22.6.7 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.22.6.6 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.22.6.5 17-Apr-2002  nathanw Catch up to -current.
 1.22.6.4 28-Feb-2002  nathanw Catch up to -current.
 1.22.6.3 06-Dec-2001  wdk #include <sys/lwp.h> for Mips architectures.
 1.22.6.2 14-Nov-2001  nathanw Catch up to -current.
 1.22.6.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.25.2.1 15-Jul-2002  gehenna catch up with -current.
 1.27.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.27.10.1 29-Apr-2005  kent sync with -current
 1.27.2.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.27.2.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.29.2.4 21-Jan-2008  yamt sync with head
 1.29.2.3 27-Oct-2007  yamt sync with head.
 1.29.2.2 26-Feb-2007  yamt sync with head.
 1.29.2.1 30-Dec-2006  yamt sync with head.
 1.30.22.2 10-Dec-2006  yamt sync with head.
 1.30.22.1 22-Oct-2006  yamt sync with head
 1.30.20.4 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.30.20.3 19-Jan-2007  ad Fix Linux compatability for i386, others to follow later.
 1.30.20.2 18-Nov-2006  ad Sync with head.
 1.30.20.1 24-Oct-2006  ad - Redo LWP locking slightly and fix some races.
- Fix some locking botches.
- Make signal mask / stack per-proc for SA processes.
- Add _lwp_kill().
 1.33.24.1 25-Oct-2007  bouyer Sync with HEAD.
 1.33.20.2 09-Jan-2008  matt sync with HEAD
 1.33.20.1 06-Nov-2007  matt sync with HEAD
 1.33.18.2 09-Dec-2007  jmcneill Sync with HEAD.
 1.33.18.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.34.4.1 26-Dec-2007  ad Sync with head.
 1.35.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.36.8.1 18-May-2008  yamt sync with head.
 1.36.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.37.2.2 20-Jun-2009  yamt sync with head
 1.37.2.1 16-May-2008  yamt sync with head.
 1.38.14.1 23-Jul-2009  jym Sync with HEAD.
 1.38.2.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.38.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.36 23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.35 07-Jan-2018  christos Ignore signal 64 for now (go uses it)
XXX: pullup-8
 1.34 17-Oct-2008  njoly g/c amd64 ifndef/endif.
 1.33 28-Apr-2008  martin branches: 1.33.2; 1.33.6;
Remove clause 3 and 4 from TNF licenses
 1.32 20-Dec-2007  dsl branches: 1.32.6; 1.32.8; 1.32.10;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.31 19-Oct-2007  njoly branches: 1.31.4; 1.31.8;
Add compat_linux and exec_linux_elf lkm support for amd64:
- Add needed COMPAT_OSSAUDIO to GENERIC.
- Add missing includes needed by linux_syscallargs.h.
- Add lkm building.
 1.30 09-Feb-2007  ad branches: 1.30.18; 1.30.20; 1.30.24;
Merge newlock2 to head.
 1.29 16-Nov-2006  christos __unused removal on arguments; approved by core.
 1.28 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.27 11-Dec-2005  christos branches: 1.27.20; 1.27.22;
merge ktrace-lwp.
 1.26 03-May-2005  manu branches: 1.26.2;
First work on COMPAT_LINUX/amd64
Process startup and dynamiclinking work, but processes hang due to
Linux arch_prctl(2) not being really supported yet.
 1.25 18-Jan-2003  thorpej branches: 1.25.2;
Merge the nathanw_sa branch.
 1.24 04-Jul-2002  thorpej Add kernel support for having userland provide the signal trampoline:

* struct sigacts gets a new sigact_sigdesc structure, which has the
sigaction and the trampoline/version. Version 0 means "legacy kernel
provided trampoline". Other versions are coordinated with machine-
dependent code in libc.
* sigaction1() grows two more arguments -- the trampoline pointer and
the trampoline version.
* A new __sigaction_sigtramp() system call is provided to register a
trampoline along with a signal handler.
* The handler is no longer passed to sensig() functions. Instead,
sendsig() looks up the handler by peeking in the sigacts for the
process getting the signal (since it has to look in there for the
trampoline anyway).
* Native sendsig() functions now select the appropriate trampoline and
its arguments based on the trampoline version in the sigacts.

Changes to libc to use the new facility will be checked in later. Kernel
version not bumped; we will ride the 1.6C bump made recently.
 1.23 31-Mar-2002  christos branches: 1.23.2;
make signal array handling uniform, and put signal arrays in a separate
file. This is simular to errno array handling.
 1.22 15-Feb-2002  christos - add a real linux_sys___sysctl because the mib numbers are different.
implement only the kernel version getting entries.
- make the signal conversion functions consistent; dest is arg 1.
- make linux_fakedev deal with block and char devices differently.
- add linux_sys_ugetrlimit, and flesh out the regular get/setrlimit so
that they work properly.
- add linux_mmap2 [untested].
- bump kernel to 2.4.18, and make the date be valentine's day :-)
- linux_sys_*stat64 family was totally busted. Fix it.

tested only on i386.

Status:
gdb, telnet, work
jdk-1.4.0 extractor works, jdk still coredumps.

christos
 1.21 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.20 09-Aug-2000  tv branches: 1.20.2; 1.20.4;
Pretend to do something useful (just fill in oldsigaction with SIG_IGN and
zeroes) if the mapped signal number comes up zero. Previously, sigaction1()
would return an error, confusing some linux apps trying to set handlers for
"all" signals.
 1.19 30-Mar-2000  augustss Kill register declarations.
 1.18 04-Dec-1999  tron Add bound checks in emulation of sigaction(2). This fixes a part of
PR kern/8904 by Dave Sainty.
 1.17 07-Oct-1998  erh branches: 1.17.12; 1.17.18;
This is used on the alpha. It is called osf_sigaction under linux because of the format of the sigaction structure but it acts the same.
 1.16 04-Oct-1998  fvdl Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.15 03-Oct-1998  christos Attempt to fix the mess.
 1.14 01-Oct-1998  erh Split compat/linux/linux_signal.c into i386, common and multi-architecture parts.
 1.13 29-Sep-1998  tv Bracket stray printf()s by #ifdef DEBUG.
 1.12 11-Sep-1998  mycroft Substantial signal handling changes:
* Increase the size of sigset_t to accomodate 128 signals -- adding new
versions of sys_setprocmask(), sys_sigaction(), sys_sigpending() and
sys_sigsuspend() to handle the changed arguments.
* Abstract the guts of sys_sigaltstack(), sys_setprocmask(), sys_sigaction(),
sys_sigpending() and sys_sigsuspend() into separate functions, and call them
from all the emulations rather than hard-coding everything. (Avoids uses
the stackgap crap for these system calls.)
* Add a new flag (p_checksig) to indicate that a process may have signals
pending and userret() needs to do the full (slow) check.
* Eliminate SAS_ALTSTACK; it's exactly the inverse of SS_DISABLE.
* Correct emulation bugs with restoring SS_ONSTACK.
* Make the signal mask in the sigcontext always use the emulated mask format.
* Store signals internally in sigaction structures, rather than maintaining a
bunch of little sigsets for each SA_* bit.
* Keep track of where we put the signal trampoline, rather than figuring it out
in *_sendsig().
* Issue a warning when a non-emulated sigaction bit is observed.
* Add missing emulated signals, and a native SIGPWR (currently not used).
* Implement the `not reset when caught' semantics for relevant signals.

Note: Only code touched by the i386 port has been modified. Other ports and
emulations need to be updated.
 1.11 09-Aug-1998  perry bzero->memset, bcopy->memcpy, bcmp->memcmp
 1.10 04-Apr-1996  christos - Add missing prototypes
- Fix bugs with reversed arguments that prototyping discovered
 1.9 07-Oct-1995  mycroft Prefix names of system call implementation functions with `sys_'.
 1.8 19-Sep-1995  thorpej Make system calls conform to a standard prototype and bring those
prototypes into scope.
 1.7 14-Aug-1995  mycroft Move signal types into signal.h.
 1.6 13-Aug-1995  mycroft Convert SA_NOMASK and SA_ONESHOT.
Clean up this code a bit.
 1.5 24-Jun-1995  christos Use compat_util.[ch].
 1.4 22-Jun-1995  fvdl * Changed to use generic ELF code from kern/exec_elf.c (which was taken
from the svr4 exec code plus the linux compat mods)
* Include file change
* Add multicast sockopts (from John Brezak)
 1.3 10-Mar-1995  fvdl Add the Linux pause() system call. Fix the arguments to sigsuspend().
 1.2 08-Mar-1995  fvdl Fix typo in comment.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.17.18.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.17.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.20.4.4 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.20.4.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.20.4.2 16-Mar-2002  jdolecek Catch up with -current.
 1.20.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.20.2.8 01-Aug-2002  nathanw Catch up to -current.
 1.20.2.7 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.20.2.6 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.20.2.5 17-Apr-2002  nathanw Catch up to -current.
 1.20.2.4 28-Feb-2002  nathanw Catch up to -current.
 1.20.2.3 14-Nov-2001  nathanw Catch up to -current.
 1.20.2.2 30-Aug-2001  nathanw #include <sys/lwp.h>
 1.20.2.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.23.2.1 15-Jul-2002  gehenna catch up with -current.
 1.25.2.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.26.2.4 21-Jan-2008  yamt sync with head
 1.26.2.3 27-Oct-2007  yamt sync with head.
 1.26.2.2 26-Feb-2007  yamt sync with head.
 1.26.2.1 30-Dec-2006  yamt sync with head.
 1.27.22.2 10-Dec-2006  yamt sync with head.
 1.27.22.1 22-Oct-2006  yamt sync with head
 1.27.20.3 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.27.20.2 18-Nov-2006  ad Sync with head.
 1.27.20.1 24-Oct-2006  ad - Redo LWP locking slightly and fix some races.
- Fix some locking botches.
- Make signal mask / stack per-proc for SA processes.
- Add _lwp_kill().
 1.30.24.1 25-Oct-2007  bouyer Sync with HEAD.
 1.30.20.2 09-Jan-2008  matt sync with HEAD
 1.30.20.1 06-Nov-2007  matt sync with HEAD
 1.30.18.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.31.8.1 02-Jan-2008  bouyer Sync with HEAD
 1.31.4.1 26-Dec-2007  ad Sync with head.
 1.32.10.2 04-May-2009  yamt sync with head.
 1.32.10.1 16-May-2008  yamt sync with head.
 1.32.8.1 18-May-2008  yamt sync with head.
 1.32.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.32.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.33.6.1 19-Oct-2008  haad Sync with HEAD.
 1.33.2.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.33.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.3 19-Sep-2021  thorpej - LINUX_SIGEV_PAD is incorrect for 64-bit systems, because sigval_t
contains a pointer. Correct this.
- Add routines to convert from Linux to native sigevent_t.
 1.2 28-Apr-2008  martin branches: 1.2.100;
Remove clause 3 and 4 from TNF licenses
 1.1 16-May-2005  fvdl branches: 1.1.8; 1.1.80; 1.1.82; 1.1.84;
Add Linux sigevent definitions.
 1.1.84.1 16-May-2008  yamt sync with head.
 1.1.82.1 18-May-2008  yamt sync with head.
 1.1.80.1 02-Jun-2008  mjf Sync with HEAD.
 1.1.8.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.8.1 16-May-2005  skrll file linux_sigevent.h was added on branch ktrace-lwp on 2005-11-10 14:01:07 +0000
 1.2.100.1 15-Dec-2020  thorpej Add Linux eventfd, timerfd, and POSIX timer calls.
 1.17 23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.16 18-Nov-2011  martin Provide linux_siginfo_t for all archs, to unbreak kdump build.
 1.15 18-Nov-2011  christos - add sigtimedwait support.
- merge the siginfo population code.
 1.14 23-Nov-2008  njoly branches: 1.14.16;
Move si_code definitions from MD to MI linux_siginfo.h, all archs
(except mips for 3 values) are identical.
While here, remove unused/unneeded LINUX__SI_CODE macro. Only the
lower 16-bits are used for userland si_code.
 1.13 21-Oct-2008  njoly branches: 1.13.2;
Remove LINUX_SI_xxx from MI siginfo.h, that should not have been
committed. Rather add them to amd64 MD header.
Fix compilation failures on non x86 archs.
 1.12 19-Oct-2008  njoly Add native to linux siginfo si_code translation, mostly for negative
values. Adjust amd64 and i386 accordingly, not sure about aother archs
i can't test.
 1.11 28-Apr-2008  martin branches: 1.11.6;
Remove clause 3 and 4 from TNF licenses
 1.10 11-Dec-2005  christos branches: 1.10.70; 1.10.72; 1.10.74;
merge ktrace-lwp.
 1.9 24-Jun-2005  manu More accurate SIGCHLD code and status for siginfo
 1.8 03-May-2005  manu First work on COMPAT_LINUX/amd64
Process startup and dynamiclinking work, but processes hang due to
Linux arch_prctl(2) not being really supported yet.
 1.7 05-Sep-2002  christos branches: 1.7.6;
remove XXX:
 1.6 03-Apr-2002  christos don't bail out if we don't have an arch/siginfo.h because we are being used
from userland.
 1.5 14-Jan-2002  bjh21 Crude first cut at ARMLinux binary compatibility. Successfully runs
"/emul/linux/bin/echo hello, world", dynamically linked.
 1.4 22-Sep-2001  manu Enable Mips Linux emulation in header files
 1.3 19-Jan-2001  manu branches: 1.3.2; 1.3.4; 1.3.6;
Added Linux compatibility support for powerpc ports
 1.2 15-Dec-1998  itohy branches: 1.2.8;
Added linux compat support on m68k ports.
 1.1 03-Oct-1998  christos Forgot those two.
 1.2.8.1 11-Feb-2001  bouyer Sync with HEAD.
 1.3.6.1 01-Oct-2001  fvdl Catch up with -current.
 1.3.4.4 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.3.4.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.3.4.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.3.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.3.2.4 17-Sep-2002  nathanw Catch up to -current.
 1.3.2.3 17-Apr-2002  nathanw Catch up to -current.
 1.3.2.2 28-Feb-2002  nathanw Catch up to -current.
 1.3.2.1 26-Sep-2001  nathanw Catch up to -current.
Again.
 1.7.6.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.10.74.2 04-May-2009  yamt sync with head.
 1.10.74.1 16-May-2008  yamt sync with head.
 1.10.72.1 18-May-2008  yamt sync with head.
 1.10.70.2 17-Jan-2009  mjf Sync with HEAD.
 1.10.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.11.6.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.11.6.1 19-Oct-2008  haad Sync with HEAD.
 1.13.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.14.16.1 17-Apr-2012  yamt sync with head
 1.90 01-Oct-2024  riastradh sys/compat/linux/common: Nix trailing whitespace, and one blank line.

No functional change intended.
 1.89 18-Aug-2023  christos branches: 1.89.6;
Add linux waitid(2) from GSoC 2023 (Theodore Preduta)
 1.88 01-Nov-2021  thorpej Use "stack_t" instead of "struct sigaltstack", as the former is the
newer standardized name. NFC.
 1.87 27-Oct-2021  thorpej Use __SIGTRAMP_SIGCODE_VERSION rather than hard-coding 0.
 1.86 23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.85 19-Sep-2021  thorpej - LINUX_SIGEV_PAD is incorrect for 64-bit systems, because sigval_t
contains a pointer. Correct this.
- Add routines to convert from Linux to native sigevent_t.
 1.84 07-Sep-2021  riastradh sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.83 23-May-2020  ad branches: 1.83.2;
Move proc_lock into the data segment. It was dynamically allocated because
at the time we had mutex_obj_alloc() but not __cacheline_aligned.
 1.82 29-Apr-2020  thorpej Fix proc lookup by distinguishing between the "tgid" and "tid" cases.
 1.81 23-Aug-2019  maxv Fix info leaks in sigaltstack.
 1.80 07-Jan-2018  christos branches: 1.80.4; 1.80.8;
Ignore signal 64 for now (go uses it)
XXX: pullup-8
 1.79 20-Feb-2017  rin branches: 1.79.6;
KNF; no binary changes
 1.78 20-Feb-2017  rin CID 980928: fix NULL pointer dereferece
 1.77 14-Nov-2015  christos branches: 1.77.2; 1.77.4;
PR/50428: Rin Okuyama: support SA_RESTORER flag for rt_sigaction(2) in the
ports that support it.
 1.76 09-Nov-2014  maxv branches: 1.76.2;
Do not uselessly include <sys/malloc.h>.
 1.75 18-Nov-2011  christos branches: 1.75.10; 1.75.26;
remove one more kassert
 1.74 18-Nov-2011  christos remove incorrect assertions (the len passed is the size of the bsd structure
not the linux one)
 1.73 18-Nov-2011  christos - add sigtimedwait support.
- merge the siginfo population code.
 1.72 30-Jun-2011  wiz branches: 1.72.2;
dependant -> dependent
 1.71 07-Jul-2010  chs many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
- support new-style (NPTL) linux pthreads on all platforms.
clone() with CLONE_THREAD uses 1 process with many LWPs
instead of separate processes.
- move the contents of sys__lwp_setprivate() into a new
lwp_setprivate() and use that everywhere.
- update linux_release[] and linux32_release[] to "2.6.18".
- adjust placement of emul fork/exec/exit hooks as needed
and adjust other emul code to match.
- convert all struct emul definitions to use named initializers.
- change the pid allocator to allow multiple pids to refer to the same proc.
- remove a few fields from struct proc that are no longer needed.
- disable the non-functional "vdso" code in linux32/amd64,
glibc works fine without it.
- fix a race in the futex code where we could miss a wakeup after
a requeue operation.
- redo futex locking to be a little more efficient.
 1.70 01-Jul-2010  rmind Remove pfind() and pgfind(), fix locking in various broken uses of these.
Rename real routines to proc_find() and pgrp_find(), remove PFIND_* flags
and have consistent behaviour. Provide proc_find_raw() for special cases.
Fix memory leak in sysctl_proc_corename().

COMPAT_LINUX: rework ptrace() locking, minimise differences between
different versions per-arch.

Note: while this change adds some formal cosmetics for COMPAT_DARWIN and
COMPAT_IRIX - locking there is utterly broken (for ages).

Fixes PR/43176.
 1.69 08-Jun-2009  njoly branches: 1.69.2; 1.69.4;
Small rt_queueinfo(2) update, to require a linux_siginfo structure.
While here, cleanup ifdef out argument types.
 1.68 29-May-2009  njoly Add native to linux siginfo si_status translation, used on i386 and
amd64.
 1.67 18-Feb-2009  njoly Do not protect native_to_linux_si_code() under LINUX_NPTL anymore, now
that linux si_code definitions are MI.
 1.66 21-Oct-2008  njoly branches: 1.66.2; 1.66.8;
Do not use native_to_linux_si_code() outside LINUX_NPTL; until i
figure a better way to handle it.
 1.65 21-Oct-2008  njoly tkill/tgkill syscalls cleanup.

- Make both syscalls set si_code to SI_LWP (which will be converted to
Linux SI_TKILL value). Fix thread some cancellation under NPTL
emulation.
- Merge code in a new linux_do_tkill() function that will do its own
job, instead of calling linux_sys_kill().
- Do only alter single tasks, by rejecting non positive tid/tgid
values.
 1.64 19-Oct-2008  njoly Add native to linux siginfo si_code translation, mostly for negative
values. Adjust amd64 and i386 accordingly, not sure about aother archs
i can't test.
 1.63 30-Jul-2008  njoly Fix linux_sigismember/linux_sigaddset to work on amd64 (and other
64bits archs), by ensuring that bit shifts are done on correct type.
 1.62 28-Apr-2008  martin branches: 1.62.2; 1.62.4; 1.62.6;
Remove clause 3 and 4 from TNF licenses
 1.61 24-Apr-2008  ad branches: 1.61.2;
Merge proc::p_mutex and proc::p_smutex into a single adaptive mutex, since
we no longer need to guard against access from hardware interrupt handlers.

Additionally, if cloning a process with CLONE_SIGHAND, arrange to have the
child process share the parent's lock so that signal state may be kept in
sync. Partially addresses PR kern/37437.
 1.60 24-Apr-2008  ad Network protocol interrupts can now block on locks, so merge the globals
proclist_mutex and proclist_lock into a single adaptive mutex (proc_lock).
Implications:

- Inspecting process state requires thread context, so signals can no longer
be sent from a hardware interrupt handler. Signal activity must be
deferred to a soft interrupt or kthread.

- As the proc state locking is simplified, it's now safe to take exit()
and wait() out from under kernel_lock.

- The system spends less time at IPL_SCHED, and there is less lock activity.
 1.59 23-Apr-2008  ad Tweak locking.
 1.58 20-Dec-2007  dsl branches: 1.58.6; 1.58.8;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.57 08-Dec-2007  dsl branches: 1.57.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.56 04-Dec-2007  dsl Remove all the __P
 1.55 19-Oct-2007  njoly branches: 1.55.2; 1.55.4;
Add compat_linux and exec_linux_elf lkm support for amd64:
- Add needed COMPAT_OSSAUDIO to GENERIC.
- Add missing includes needed by linux_syscallargs.h.
- Add lkm building.
 1.54 04-Mar-2007  christos branches: 1.54.14; 1.54.16; 1.54.20;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.53 09-Feb-2007  ad branches: 1.53.2;
Merge newlock2 to head.
 1.52 16-Nov-2006  christos __unused removal on arguments; approved by core.
 1.51 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.50 13-Sep-2006  christos branches: 1.50.2;
avoid empty if body.
 1.49 23-Nov-2005  manu branches: 1.49.8; 1.49.20;
- Add Linux tkill and tgkill (partial emulation).
- Fix getrlimit on amd64
 1.48 19-Sep-2005  christos branches: 1.48.6;
MINSIGSTKSZ on linux is different depending on the platform and usually
smaller than ours.
 1.47 20-May-2005  mrg branches: 1.47.2;
tramp and vers are used unconditionally, make them visible everywhere.
 1.46 19-May-2005  manu Add support for Linux SA_RESTORER on amd64.
 1.45 16-May-2005  fvdl Include linux_sigevent.h (to be used later).
 1.44 09-May-2005  jmc #endif for LINUX_SS_ONSTACK needs to go after linux_sys_sigaltstack or builds
break on platforms that don't define it (alpha, sparc)
 1.43 03-May-2005  manu First work on COMPAT_LINUX/amd64
Process startup and dynamiclinking work, but processes hang due to
Linux arch_prctl(2) not being really supported yet.
 1.42 26-Feb-2005  perry nuke trailing whitespace
 1.41 03-Jul-2003  christos branches: 1.41.8; 1.41.10;
make the converter of sigaltstack public.
 1.40 18-Jan-2003  thorpej branches: 1.40.2;
Merge the nathanw_sa branch.
 1.39 26-Nov-2002  christos rename: s/sa_/<compat>sa/g
 1.38 04-Jul-2002  thorpej Add kernel support for having userland provide the signal trampoline:

* struct sigacts gets a new sigact_sigdesc structure, which has the
sigaction and the trampoline/version. Version 0 means "legacy kernel
provided trampoline". Other versions are coordinated with machine-
dependent code in libc.
* sigaction1() grows two more arguments -- the trampoline pointer and
the trampoline version.
* A new __sigaction_sigtramp() system call is provided to register a
trampoline along with a signal handler.
* The handler is no longer passed to sensig() functions. Instead,
sendsig() looks up the handler by peeking in the sigacts for the
process getting the signal (since it has to look in there for the
trampoline anyway).
* Native sendsig() functions now select the appropriate trampoline and
its arguments based on the trampoline version in the sigacts.

Changes to libc to use the new facility will be checked in later. Kernel
version not bumped; we will ride the 1.6C bump made recently.
 1.37 31-Mar-2002  christos branches: 1.37.2;
make signal array handling uniform, and put signal arrays in a separate
file. This is simular to errno array handling.
 1.36 22-Mar-2002  christos gc debugging printfs.
 1.35 19-Mar-2002  christos - Now that RT-signals fit, fix the array to deliver them. [i386 only].
- jdk-1.4 works perfectly now. :-)
 1.34 18-Feb-2002  christos Resolve alpha compile issues:
- bug with order in args in mask conversion md code.
- flags can be both int and long on the alpha. kludge around that, by not
passing pointers to the conversion function.
- something is wrong with the toolchain look at the void * cast in copyout().
- sa_restorer is in a different place on the aplha. Deal with that, by not
initializing it as before. XXX: this should be changed in the MD signal
definition.
 1.33 15-Feb-2002  christos - add a real linux_sys___sysctl because the mib numbers are different.
implement only the kernel version getting entries.
- make the signal conversion functions consistent; dest is arg 1.
- make linux_fakedev deal with block and char devices differently.
- add linux_sys_ugetrlimit, and flesh out the regular get/setrlimit so
that they work properly.
- add linux_mmap2 [untested].
- bump kernel to 2.4.18, and make the date be valentine's day :-)
- linux_sys_*stat64 family was totally busted. Fix it.

tested only on i386.

Status:
gdb, telnet, work
jdk-1.4.0 extractor works, jdk still coredumps.

christos
 1.32 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.31 18-Jan-2001  jdolecek branches: 1.31.2; 1.31.4;
constify
 1.30 23-Aug-2000  christos add support for sigaltstack(2) needed for jvm-1.3 support.
XXX: Only on i386, don't have access to other linuxes...
 1.29 09-Aug-2000  tv Pretend to do something useful (just fill in oldsigaction with SIG_IGN and
zeroes) if the mapped signal number comes up zero. Previously, sigaction1()
would return an error, confusing some linux apps trying to set handlers for
"all" signals.
 1.28 28-Jul-2000  tron Adoid excessive use of "return" in "excessive()".
 1.27 28-Jul-2000  tron Use "NULL" and not "0" for null pointers.
 1.26 30-Mar-2000  augustss branches: 1.26.4;
Kill register declarations.
 1.25 04-Dec-1999  tron Add bound checks in emulation of kill(2). This fixes the last part of
PR kern/8904 by Dave Sainty.
 1.24 04-Oct-1999  fvdl branches: 1.24.2; 1.24.8;
Handle the newer, larger sigset_t Linux now uses.
 1.23 30-Sep-1999  tron NetBSD's signal number 11 is SIGSYS nog SIGSEGV.
 1.22 08-Sep-1999  jdolecek Use DEBUG_LINUX exclusively. Fixes PR#7684.
 1.21 19-Dec-1998  drochner get "opt_compat_xxx.h" includes out of <sys/signal.h>
 1.20 15-Dec-1998  itohy Added linux compat support on m68k ports.
 1.19 07-Oct-1998  erh Fix typos.
 1.18 07-Oct-1998  erh Fix types. Kill old declarations.
 1.17 07-Oct-1998  erh sigprocmask (non-rt) version doesn't exist on alpha. rename it to sigprocmask1 for use in linux_sys_sigprocmask and linux_sys_rt_sigprocmask.
 1.16 04-Oct-1998  fvdl Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.15 03-Oct-1998  christos Attempt to fix the mess.
 1.14 01-Oct-1998  erh Split compat/linux/linux_signal.c into i386, common and multi-architecture parts.
 1.13 29-Sep-1998  tv Bracket stray printf()s by #ifdef DEBUG.
 1.12 11-Sep-1998  mycroft Substantial signal handling changes:
* Increase the size of sigset_t to accomodate 128 signals -- adding new
versions of sys_setprocmask(), sys_sigaction(), sys_sigpending() and
sys_sigsuspend() to handle the changed arguments.
* Abstract the guts of sys_sigaltstack(), sys_setprocmask(), sys_sigaction(),
sys_sigpending() and sys_sigsuspend() into separate functions, and call them
from all the emulations rather than hard-coding everything. (Avoids uses
the stackgap crap for these system calls.)
* Add a new flag (p_checksig) to indicate that a process may have signals
pending and userret() needs to do the full (slow) check.
* Eliminate SAS_ALTSTACK; it's exactly the inverse of SS_DISABLE.
* Correct emulation bugs with restoring SS_ONSTACK.
* Make the signal mask in the sigcontext always use the emulated mask format.
* Store signals internally in sigaction structures, rather than maintaining a
bunch of little sigsets for each SA_* bit.
* Keep track of where we put the signal trampoline, rather than figuring it out
in *_sendsig().
* Issue a warning when a non-emulated sigaction bit is observed.
* Add missing emulated signals, and a native SIGPWR (currently not used).
* Implement the `not reset when caught' semantics for relevant signals.

Note: Only code touched by the i386 port has been modified. Other ports and
emulations need to be updated.
 1.11 09-Aug-1998  perry bzero->memset, bcopy->memcpy, bcmp->memcmp
 1.10 04-Apr-1996  christos - Add missing prototypes
- Fix bugs with reversed arguments that prototyping discovered
 1.9 07-Oct-1995  mycroft Prefix names of system call implementation functions with `sys_'.
 1.8 19-Sep-1995  thorpej Make system calls conform to a standard prototype and bring those
prototypes into scope.
 1.7 14-Aug-1995  mycroft Move signal types into signal.h.
 1.6 13-Aug-1995  mycroft Convert SA_NOMASK and SA_ONESHOT.
Clean up this code a bit.
 1.5 24-Jun-1995  christos Use compat_util.[ch].
 1.4 22-Jun-1995  fvdl * Changed to use generic ELF code from kern/exec_elf.c (which was taken
from the svr4 exec code plus the linux compat mods)
* Include file change
* Add multicast sockopts (from John Brezak)
 1.3 10-Mar-1995  fvdl Add the Linux pause() system call. Fix the arguments to sigsuspend().
 1.2 08-Mar-1995  fvdl Fix typo in comment.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.24.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.24.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.24.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.26.4.1 30-Mar-2001  he Pull up revision 1.29 (via patch, requested by fvdl):
Add some required Linux emulation bits to support the Linux
version of VMware.
 1.31.4.4 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.31.4.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.31.4.2 16-Mar-2002  jdolecek Catch up with -current.
 1.31.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.31.2.9 11-Dec-2002  thorpej Sync with HEAD.
 1.31.2.8 01-Aug-2002  nathanw Catch up to -current.
 1.31.2.7 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.31.2.6 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.31.2.5 17-Apr-2002  nathanw Catch up to -current.
 1.31.2.4 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.31.2.3 28-Feb-2002  nathanw Catch up to -current.
 1.31.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.31.2.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.37.2.1 15-Jul-2002  gehenna catch up with -current.
 1.40.2.6 11-Dec-2005  christos Sync with head.
 1.40.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.40.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.40.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.40.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.40.2.1 03-Aug-2004  skrll Sync with HEAD
 1.41.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.41.8.1 29-Apr-2005  kent sync with -current
 1.47.2.7 21-Jan-2008  yamt sync with head
 1.47.2.6 07-Dec-2007  yamt sync with head
 1.47.2.5 27-Oct-2007  yamt sync with head.
 1.47.2.4 03-Sep-2007  yamt sync with head.
 1.47.2.3 26-Feb-2007  yamt sync with head.
 1.47.2.2 30-Dec-2006  yamt sync with head.
 1.47.2.1 21-Jun-2006  yamt sync with head.
 1.48.6.1 29-Nov-2005  yamt sync with head.
 1.49.20.4 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.49.20.3 19-Jan-2007  ad Fix Linux compatability for i386, others to follow later.
 1.49.20.2 18-Nov-2006  ad Sync with head.
 1.49.20.1 24-Oct-2006  ad - Redo LWP locking slightly and fix some races.
- Fix some locking botches.
- Make signal mask / stack per-proc for SA processes.
- Add _lwp_kill().
 1.49.8.1 14-Sep-2006  yamt sync with head.
 1.50.2.2 10-Dec-2006  yamt sync with head.
 1.50.2.1 22-Oct-2006  yamt sync with head
 1.53.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.54.20.1 25-Oct-2007  bouyer Sync with HEAD.
 1.54.16.2 09-Jan-2008  matt sync with HEAD
 1.54.16.1 06-Nov-2007  matt sync with HEAD
 1.54.14.2 09-Dec-2007  jmcneill Sync with HEAD.
 1.54.14.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.55.4.2 26-Dec-2007  ad Sync with head.
 1.55.4.1 08-Dec-2007  ad Sync with head.
 1.55.2.2 27-Dec-2007  mjf Sync with HEAD.
 1.55.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.57.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.58.8.1 18-May-2008  yamt sync with head.
 1.58.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.58.6.2 28-Sep-2008  mjf Sync with HEAD.
 1.58.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.61.2.4 11-Aug-2010  yamt sync with head.
 1.61.2.3 20-Jun-2009  yamt sync with head
 1.61.2.2 04-May-2009  yamt sync with head.
 1.61.2.1 16-May-2008  yamt sync with head.
 1.62.6.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.62.6.1 19-Oct-2008  haad Sync with HEAD.
 1.62.4.1 31-Jul-2008  simonb Sync with head.
 1.62.2.4 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.62.2.3 14-May-2008  wrstuden Per discussion with ad at n dot o, revert signal mask handling
changes.

The l_sigstk changes are most likely totally un-needed as SA will
never use a signal stack - we send an upcall (or will as other
diffs are brought in).

The l_sigmask changes were too controvertial. In all honesty, I
think it's probably best to revert them. The main reason they were
there is the fact that in an SA process, we don't mask signals per
kernel thread, we mask them per user thread. In the kernel, we want
them all to get turned into upcalls. Thus the normal state of
l_sigmask in an SA process is for it to always be empty.

While we are in the process of delivering a signal, we want to
temporarily mask a signal (so we don't recursively exhaust our
upcall stacks). However signal delivery is rare (important, but
rare), and delivering back-to-back signals is even rarer. So rather
than cause every user of a signal mask to be prepared for this very
rare case, we will just add a second check later in the signal
delivery code. Said change is not in this diff.

This also un-compensates all of our compatability code for dealing
with SA. SA is a NetBSD-specific thing, so there's no need for
Irix, Linux, Solaris, SVR4 and so on to cope with it.

As previously, everything other than kern_sa.c compiles in i386
GENERIC as of this checkin. I will switch to ALL soon for compile
testing.
 1.62.2.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.62.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.66.8.2 23-Jul-2009  jym Sync with HEAD.
 1.66.8.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.66.2.1 03-Mar-2009  skrll Sync with HEAD.
 1.69.4.2 05-Mar-2011  rmind sync with head
 1.69.4.1 03-Jul-2010  rmind sync with head
 1.69.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.72.2.1 17-Apr-2012  yamt sync with head
 1.75.26.2 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1720:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149 (patch)
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54 (patch)

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.75.26.1 17-Jan-2015  martin branches: 1.75.26.1.6;
Pull up following revision(s) (requested by maxv in ticket #427):
sys/compat/svr4/svr4_schedctl.c: revision 1.8
sys/netinet/tcp_timer.c: revision 1.88
sys/miscfs/genfs/layer_vfsops.c: revision 1.45
sys/compat/svr4/svr4_ioctl.c: revision 1.37
sys/ufs/chfs/chfs_vfsops.c: revision 1.14
sys/miscfs/fdesc/fdesc_vfsops.c: revision 1.91
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.30
sys/compat/common/kern_time_50.c: revision 1.28
sys/netinet6/ip6_forward.c: revision 1.74
sys/miscfs/umapfs/umap_vnops.c: revision 1.57
sys/compat/svr4/svr4_fcntl.c: revision 1.74
distrib/sets/lists/comp/mi: revision 1.1931
sys/netinet6/udp6_output.c: revision 1.46
sys/fs/puffs/puffs_compat.c: revision 1.3
sys/fs/udf/udf_rename.c: revision 1.11
sys/compat/svr4/svr4_filio.c: revision 1.24
sys/fs/udf/udf_rename.c: revision 1.12
sys/netinet/tcp_usrreq.c: revision 1.202
sys/miscfs/umapfs/umap_subr.c: revision 1.29
sys/compat/linux/common/linux_fadvise64.c: revision 1.3
sys/netinet/if_atm.c: revision 1.34
sys/miscfs/procfs/procfs_subr.c: revision 1.106
sys/miscfs/genfs/layer_subr.c: revision 1.37
sys/netinet/tcp_sack.c: revision 1.30
sys/compat/freebsd/freebsd_misc.c: revision 1.33
sys/compat/freebsd/freebsd_file.c: revision 1.33
sys/ufs/chfs/chfs_vnode.c: revision 1.12
sys/compat/svr4/svr4_ttold.c: revision 1.34
sys/compat/linux/common/linux_file.c: revision 1.114
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.43
sys/compat/linux/common/linux_signal.c: revision 1.76
sys/compat/common/compat_util.c: revision 1.46
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.18
sys/compat/svr4/svr4_sockio.c: revision 1.36
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.32
sys/compat/svr4/svr4_signal.c: revision 1.66
sys/kern/kern_exec.c: revision 1.410
sys/fs/puffs/puffs_vfsops.c: revision 1.115
sys/compat/svr4/svr4_exec_elf64.c: revision 1.15
sys/compat/linux/arch/i386/linux_machdep.c: revision 1.159
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.50
sys/compat/linux32/common/linux32_misc.c: revision 1.24
sys/netinet/in_pcb.c: revision 1.153
sys/sys/malloc.h: revision 1.116
sys/compat/common/if_43.c: revision 1.9
share/man/man9/Makefile: revision 1.380
sys/netinet/tcp_vtw.c: revision 1.12
sys/miscfs/umapfs/umap_vfsops.c: revision 1.95
sys/ufs/ext2fs/ext2fs_vfsops.c: revision 1.186
sys/compat/common/uipc_syscalls_43.c: revision 1.46
sys/ufs/ext2fs/ext2fs_vnops.c: revision 1.115
sys/fs/puffs/puffs_msgif.c: revision 1.97
sys/compat/svr4/svr4_ipc.c: revision 1.27
sys/compat/linux/common/linux_exec.c: revision 1.117
sys/ufs/ext2fs/ext2fs_readwrite.c: revision 1.66
sys/netinet/tcp_output.c: revision 1.179
sys/compat/svr4/svr4_termios.c: revision 1.28
sys/fs/udf/udf_strat_bootstrap.c: revision 1.4
sys/fs/puffs/puffs_subr.c: revision 1.67
sys/fs/puffs/puffs_node.c: revision 1.36
sys/miscfs/overlay/overlay_vnops.c: revision 1.21
sys/fs/cd9660/cd9660_node.c: revision 1.34
sys/netinet/raw_ip.c: revision 1.146
sys/sys/mallocvar.h: revision 1.13
sys/miscfs/overlay/overlay_vfsops.c: revision 1.63
share/man/man9/malloc.9: revision 1.50
sys/netinet6/dest6.c: revision 1.18
sys/compat/linux/common/linux_uselib.c: revision 1.33
sys/compat/linux/common/linux_socket.c: revision 1.120
share/man/man9/malloc.9: revision 1.51
sys/netinet/tcp_subr.c: revision 1.257
sys/compat/linux/common/linux_socketcall.c: revision 1.45
sys/compat/linux/common/linux_fadvise64_64.c: revision 1.3
sys/compat/freebsd/freebsd_ipc.c: revision 1.17
sys/compat/linux/common/linux_misc_notalpha.c: revision 1.109
sys/compat/linux/arch/alpha/linux_pipe.c: revision 1.17
sys/netinet6/in6_pcb.c: revision 1.132
sys/netinet6/in6_ifattach.c: revision 1.94
sys/compat/svr4/svr4_exec_elf32.c: revision 1.15
sys/miscfs/nullfs/null_vfsops.c: revision 1.90
sys/fs/cd9660/cd9660_util.c: revision 1.12
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.48
sys/compat/freebsd/freebsd_exec_elf32.c: revision 1.20
sys/miscfs/procfs/procfs_vfsops.c: revision 1.94
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.28
sys/compat/linux/common/linux_sched.c: revision 1.67
sys/compat/linux/common/linux_exec_aout.c: revision 1.67
sys/compat/linux/common/linux_pipe.c: revision 1.67
sys/compat/linux/common/linux_llseek.c: revision 1.34
sys/compat/linux/arch/mips/linux_ptrace.c: revision 1.10
Do not uselessly include <sys/malloc.h>.
Cleanup:
- remove struct kmembuckets (dead)
- correctly deadify MALLOC_XX
- remove MALLOC_DEFINE_LIMIT and MALLOC_JUSTDEFINE_LIMIT (dead)
- remove malloc_roundup(), malloc_type_setlimit(), MALLOC_DEFINE_LIMIT()
and MALLOC_JUSTDEFINE_LIMIT() from man 9 malloc
New sentence, new line. Bump date for previous.
Obsolete malloc_roundup(9), malloc_type_setlimit(9) and MALLOC_DEFINE_LIMIT(9)
man pages.
 1.75.26.1.6.1 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1720:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149 (patch)
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54 (patch)

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.75.10.1 03-Dec-2017  jdolecek update from HEAD
 1.76.2.2 28-Aug-2017  skrll Sync with HEAD
 1.76.2.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.77.4.1 21-Apr-2017  bouyer Sync with HEAD
 1.77.2.1 20-Mar-2017  pgoyette Sync with HEAD
 1.79.6.2 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1836):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.79.6.1 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1487:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.80.8.2 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.80.8.1 13-Sep-2019  martin Pull up following revision(s) (requested by maxv in ticket #194):

sys/compat/linux/common/linux_socket.c: revision 1.146
sys/compat/linux/common/linux_socket.c: revision 1.147
sys/compat/linux/common/linux_socket.c: revision 1.148
sys/compat/linux/common/linux_socket.c: revision 1.149
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.59
sys/compat/linux32/common/linux32_sysinfo.c: revision 1.8
sys/kern/sysv_shm.c: revision 1.138
sys/compat/linux/common/linux_file64.c: revision 1.61
sys/compat/linux/common/linux_file64.c: revision 1.62
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.58
sys/compat/linux32/common/linux32_dirent.c: revision 1.20
sys/compat/linux32/common/linux32_utsname.c: revision 1.10
sys/compat/linux/common/linux_termios.h: revision 1.22
sys/compat/linux32/common/linux32_termios.c: revision 1.15
sys/compat/linux32/common/linux32_misc.c: revision 1.27
sys/compat/linux32/common/linux32_ioctl.c: revision 1.14
sys/compat/linux/common/linux_statfs.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.57
sys/compat/linux/common/linux_fcntl.h: revision 1.18
sys/compat/linux/common/linux_socket.h: revision 1.24
sys/sys/shm.h: revision 1.54
sys/compat/ossaudio/ossaudio.c: revision 1.75
sys/compat/linux32/common/linux32_signal.c: revision 1.20
sys/miscfs/procfs/procfs_linux.c: revision 1.75
sys/compat/linux/common/linux_signal.c: revision 1.81
sys/compat/linux/common/linux_termios.c: revision 1.38
sys/compat/linux/common/linux_misc.c: revision 1.241
sys/compat/linux/common/linux_misc.c: revision 1.242
sys/compat/linux/common/linux_misc.c: revision 1.243
sys/compat/linux/common/linux_misc.c: revision 1.244

Fix info leaks.

Fix stupid bugs in linux_sys_shmctl(): the index could be out of bound
(page fault) and there was no proper locking.
Maybe we should just remove LINUX_SHM_STAT, like compat_linux32.

Remove printf.

When dealing with an unknown value, set -1, to prevent (harmless)
uninitialized accesses later.

Add a default case, don't call sys_ioctl() with an uninitialized 'com'
argument.

Fix error handling, returns an errno, not -1.

Put the printf under DEBUG_LINUX.


Hum, don't forget the 'pid' argument, otherwise we're not gonna go very
far.

Don't read data from userland directly. This simply does not work on any
recent x86 CPU (thanks to SMAP) and all architectures that forbid direct
access to userland from the kernel. But I guess no one noticed because no
one ever uses compat_linux, right?

Hum, don't pass an mbuf to realloc(). Inspired from copyin32_msg_control().

Fix memory leak.

I don't see the point in having this useless printf, but add a '\n' to it,
so that it at least displays useless stuff correctly.

Hum, remove incorrect assignment. Userland could have passed a smaller
namelen, and the uninitialized bytes from sb_data were being used later in
the network stack.
 1.80.4.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.83.2.1 15-Dec-2020  thorpej Add Linux eventfd, timerfd, and POSIX timer calls.
 1.89.6.1 02-Aug-2025  perseant Sync with HEAD
 1.34 01-Nov-2021  thorpej Use "stack_t" instead of "struct sigaltstack", as the former is the
newer standardized name. NFC.
 1.33 23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.32 02-Jan-2017  martin Provide a dummy linux_sigset_t for all architectures that do not have
any machdep one. This make kdump compile again.
 1.31 02-Jan-2017  manu Add pselect6 Linux system call.
This lets Matlab R2016A run on NetBSD/amd64
 1.30 29-May-2009  njoly branches: 1.30.22; 1.30.38; 1.30.40; 1.30.44;
Add native to linux siginfo si_status translation, used on i386 and
amd64.
 1.29 19-Oct-2008  njoly branches: 1.29.8;
Add native to linux siginfo si_code translation, mostly for negative
values. Adjust amd64 and i386 accordingly, not sure about aother archs
i can't test.
 1.28 28-Apr-2008  martin branches: 1.28.6;
Remove clause 3 and 4 from TNF licenses
 1.27 04-Dec-2007  dsl branches: 1.27.12; 1.27.14; 1.27.16;
Remove all the __P
 1.26 09-Feb-2007  ad branches: 1.26.18; 1.26.20; 1.26.26; 1.26.28;
Merge newlock2 to head.
 1.25 11-Dec-2005  christos branches: 1.25.20;
merge ktrace-lwp.
 1.24 19-Jun-2005  christos branches: 1.24.2;
remove duplicate declaration.
 1.23 02-Jun-2005  drochner more cast-qual fallout
 1.22 03-May-2005  manu First work on COMPAT_LINUX/amd64
Process startup and dynamiclinking work, but processes hang due to
Linux arch_prctl(2) not being really supported yet.
 1.21 08-Aug-2003  christos Conditionally declare function that is not used all the time.
 1.20 04-Jul-2003  enami Actually move the prototype of native_to_linux_sigaltstack here.
 1.19 02-Apr-2002  christos branches: 1.19.10;
Don't blow up if we don't have a machine dependend linux_signal.h.
kdump includes linux_signo.c
 1.18 31-Mar-2002  christos make signal array handling uniform, and put signal arrays in a separate
file. This is simular to errno array handling.
 1.17 18-Feb-2002  christos Resolve alpha compile issues:
- bug with order in args in mask conversion md code.
- flags can be both int and long on the alpha. kludge around that, by not
passing pointers to the conversion function.
- something is wrong with the toolchain look at the void * cast in copyout().
- sa_restorer is in a different place on the aplha. Deal with that, by not
initializing it as before. XXX: this should be changed in the MD signal
definition.
 1.16 15-Feb-2002  christos - add a real linux_sys___sysctl because the mib numbers are different.
implement only the kernel version getting entries.
- make the signal conversion functions consistent; dest is arg 1.
- make linux_fakedev deal with block and char devices differently.
- add linux_sys_ugetrlimit, and flesh out the regular get/setrlimit so
that they work properly.
- add linux_mmap2 [untested].
- bump kernel to 2.4.18, and make the date be valentine's day :-)
- linux_sys_*stat64 family was totally busted. Fix it.

tested only on i386.

Status:
gdb, telnet, work
jdk-1.4.0 extractor works, jdk still coredumps.

christos
 1.15 14-Jan-2002  bjh21 Crude first cut at ARMLinux binary compatibility. Successfully runs
"/emul/linux/bin/echo hello, world", dynamically linked.
 1.14 22-Sep-2001  manu Enable Mips Linux emulation in header files
 1.13 19-Jan-2001  manu branches: 1.13.2; 1.13.4; 1.13.6;
Added Linux compatibility support for powerpc ports
 1.12 18-Jan-2001  jdolecek constify
 1.11 15-Dec-1998  itohy branches: 1.11.8;
Added linux compat support on m68k ports.
 1.10 07-Oct-1998  erh Fix types. Kill old declarations.
 1.9 07-Oct-1998  erh Add prototype for linux_sigprocmask1().
 1.8 04-Oct-1998  fvdl Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.7 03-Oct-1998  christos Attempt to fix the mess.
 1.6 01-Oct-1998  erh Split compat/linux/linux_signal.h into i386 and common parts.
 1.5 11-Sep-1998  mycroft Substantial signal handling changes:
* Increase the size of sigset_t to accomodate 128 signals -- adding new
versions of sys_setprocmask(), sys_sigaction(), sys_sigpending() and
sys_sigsuspend() to handle the changed arguments.
* Abstract the guts of sys_sigaltstack(), sys_setprocmask(), sys_sigaction(),
sys_sigpending() and sys_sigsuspend() into separate functions, and call them
from all the emulations rather than hard-coding everything. (Avoids uses
the stackgap crap for these system calls.)
* Add a new flag (p_checksig) to indicate that a process may have signals
pending and userret() needs to do the full (slow) check.
* Eliminate SAS_ALTSTACK; it's exactly the inverse of SS_DISABLE.
* Correct emulation bugs with restoring SS_ONSTACK.
* Make the signal mask in the sigcontext always use the emulated mask format.
* Store signals internally in sigaction structures, rather than maintaining a
bunch of little sigsets for each SA_* bit.
* Keep track of where we put the signal trampoline, rather than figuring it out
in *_sendsig().
* Issue a warning when a non-emulated sigaction bit is observed.
* Add missing emulated signals, and a native SIGPWR (currently not used).
* Implement the `not reset when caught' semantics for relevant signals.

Note: Only code touched by the i386 port has been modified. Other ports and
emulations need to be updated.
 1.4 27-Aug-1995  fvdl Add a hook for MD ioctl calls, plus a couple of more changes to make
svgalib binaries work on the i386
 1.3 14-Aug-1995  mycroft Export bsd_to_linux_sig[], and use it.
 1.2 14-Aug-1995  mycroft Move signal types into signal.h.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.11.8.1 11-Feb-2001  bouyer Sync with HEAD.
 1.13.6.1 01-Oct-2001  fvdl Catch up with -current.
 1.13.4.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.13.4.3 16-Mar-2002  jdolecek Catch up with -current.
 1.13.4.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.13.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.13.2.3 17-Apr-2002  nathanw Catch up to -current.
 1.13.2.2 28-Feb-2002  nathanw Catch up to -current.
 1.13.2.1 26-Sep-2001  nathanw Catch up to -current.
Again.
 1.19.10.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.19.10.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.19.10.2 18-Sep-2004  skrll Sync with HEAD.
 1.19.10.1 03-Aug-2004  skrll Sync with HEAD
 1.24.2.2 07-Dec-2007  yamt sync with head
 1.24.2.1 26-Feb-2007  yamt sync with head.
 1.25.20.1 24-Oct-2006  ad - Redo LWP locking slightly and fix some races.
- Fix some locking botches.
- Make signal mask / stack per-proc for SA processes.
- Add _lwp_kill().
 1.26.28.1 08-Dec-2007  ad Sync with head.
 1.26.26.1 08-Dec-2007  mjf Sync with HEAD.
 1.26.20.1 09-Jan-2008  matt sync with HEAD
 1.26.18.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.27.16.3 20-Jun-2009  yamt sync with head
 1.27.16.2 04-May-2009  yamt sync with head.
 1.27.16.1 16-May-2008  yamt sync with head.
 1.27.14.1 18-May-2008  yamt sync with head.
 1.27.12.2 17-Jan-2009  mjf Sync with HEAD.
 1.27.12.1 02-Jun-2008  mjf Sync with HEAD.
 1.28.6.1 19-Oct-2008  haad Sync with HEAD.
 1.29.8.1 23-Jul-2009  jym Sync with HEAD.
 1.30.44.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.30.40.1 05-Feb-2017  skrll Sync with HEAD
 1.30.38.2 19-Apr-2017  snj Fix fallout from ticket #1354 by applying:
sys/compat/linux/common/linux_signal.h: revision 1.32
Provide a dummy linux_sigset_t for all architectures that do not have
any machdep one. This make kdump compile again.
 1.30.38.1 17-Apr-2017  snj Pull up following revision(s) (requested by manu in ticket #1354):
sys/compat/linux/arch/alpha/syscalls.master: revision 1.92 via patch
sys/compat/linux/arch/amd64/syscalls.master: revision 1.58 via patch
sys/compat/linux/arch/arm/syscalls.master: revision 1.65 via patch
sys/compat/linux/arch/i386/syscalls.master: revision 1.122 via patch
sys/compat/linux/arch/m68k/syscalls.master: revision 1.91 via patch
sys/compat/linux/arch/mips/syscalls.master: revision 1.61 via patch
sys/compat/linux/arch/powerpc/syscalls.master: revision 1.70 via patch
sys/compat/linux/common/linux_misc.c: revision 1.234
sys/compat/linux/common/linux_signal.h: revision 1.31
Add pselect6 Linux system call.
This lets Matlab R2016A run on NetBSD/amd64
 1.30.22.1 03-Dec-2017  jdolecek update from HEAD
 1.7 23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.6 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.5 11-Dec-2005  christos branches: 1.5.70; 1.5.72; 1.5.74;
merge ktrace-lwp.
 1.4 19-May-2005  manu Add support for Linux SA_RESTORER on amd64.
 1.3 03-Apr-2002  christos branches: 1.3.2; 1.3.8; 1.3.14;
make this compile on archs that don't define linux signals.
 1.2 31-Mar-2002  christos bring the reverse signal mapping array into linux_signo.c
 1.1 31-Mar-2002  christos make signal array handling uniform, and put signal arrays in a separate
file. This is simular to errno array handling.
 1.3.14.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.3.8.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.3.8.1 03-Apr-2002  jdolecek file linux_signo.c was added on branch kqueue on 2002-06-23 17:44:27 +0000
 1.3.2.2 17-Apr-2002  nathanw Catch up to -current.
 1.3.2.1 03-Apr-2002  nathanw file linux_signo.c was added on branch nathanw_sa on 2002-04-17 00:05:12 +0000
 1.5.74.1 16-May-2008  yamt sync with head.
 1.5.72.1 18-May-2008  yamt sync with head.
 1.5.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.158 28-Jun-2025  christos PR/59486: csaba mate: Ignore IP_MULTICAST_ALL, since we don't have it.
Also, add -3 to return ENOPROTOOPT, more options and consistently whitespace
after define (the majority had define<space> so make them all the samr)
 1.157 27-Jun-2025  christos PR/59486: csaba mate: Ignore IP_MULTICAST_ALL, since we don't have it.
 1.156 01-Oct-2024  riastradh sys/compat/linux/common: Nix trailing whitespace, and one blank line.

No functional change intended.
 1.155 24-Dec-2022  andvar branches: 1.155.6;
s/reqest/request/, s/requst/request/ and s/reuqest/request/ in comments.
 1.154 23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.153 07-Sep-2021  riastradh sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.152 03-Nov-2020  christos PR/55780: Bernd Sieker: setsockopt in Linux emulation misses some options
 1.151 24-Oct-2020  mgorny branches: 1.151.2;
Fix compat with Linux programs that use longer namelen for sockets

Linux is less strict than NetBSD and permits namelen to be larger
than valid struct sockaddr_in*. If this is the case, truncate the value
to the correct size, so that NetBSD networking does not return an error.

Reviewed by kamil
 1.150 16-Jul-2020  msaitoh Don't accept negative value.

Reported-by: syzbot+e71a77402d6668f1868d@syzkaller.appspotmail.com
 1.149 08-Sep-2019  maxv Hum, remove incorrect assignment. Userland could have passed a smaller
namelen, and the uninitialized bytes from sb_data were being used later in
the network stack.
 1.148 24-Aug-2019  maxv Fix memory leak.
 1.147 24-Aug-2019  maxv Hum, don't pass an mbuf to realloc(). Inspired from copyin32_msg_control().
 1.146 24-Aug-2019  maxv Don't read data from userland directly. This simply does not work on any
recent x86 CPU (thanks to SMAP) and all architectures that forbid direct
access to userland from the kernel. But I guess no one noticed because no
one ever uses compat_linux, right?
 1.145 18-Apr-2019  christos branches: 1.145.4;
Zero out the ifreq struct for SIOCGIFCONF to avoid up to 127 bytes of stack
disclosure. From Andy Nguyen, many thanks! This is the compat code part
pointed out by ozaki-r@
 1.144 04-Feb-2019  mrg - avoid uninitialised memory usage
 1.143 14-Nov-2018  hannken Apply the recent fixes to {send,recv}mmsg() to their compat variants.
 1.142 10-May-2018  ozaki-r branches: 1.142.2;
Fix pserialize enter/exit pairs in linux_getifconf and linux32_getifconf

Tested by using a small linux program that uses ioctl(SIOCGIFCONF).
Probably fix PR kern/53259 as well.
 1.141 03-May-2018  christos Fix COMPAT_NETBSD32 cmsg handling:

1. alignment was wrong for > 1 message
2. macros were doing incorrect pointer comparisons, fortunately ending
the iteration early after the fists cmsg instead of crashing.
3. don't output 32 bit ktrace records for cmsg. 32 bit programs running
under emulation on 64 bit systems should produce 64 bit ktrace records
so that the native ktrace can handle the records; remove extra arguments
that are now not needed (the 32 bit msghdr).
4. output the correct type for cmsg trace records.
5. output all the cmsg records in traces instead of just the first one.

Welcome to 8.99.15 because of the argument removal.

XXX: Really all the code should be changed to use the CMSG_{FIRST,NXT}HDR
macros...
 1.140 16-Mar-2018  christos PR/53103: Timo Buhrmester: linux emulation of sendto(2) broken

The sockargs refactoring broke it, because sockargs only works with a user
address. Added an argument to sockargs to indicate where the address is
coming from. Welcome to 8.99.14.
 1.139 22-Nov-2017  ozaki-r branches: 1.139.2;
Fix and make consistent of usages of psz/psref in ifconf variants
 1.138 14-Mar-2017  ozaki-r branches: 1.138.6;
Use if_acquire and if_release instead of using psref API directly

- Provide if_release for consistency to if_acquire
- Use if_acquire and if_release for ifp iterations
- Make ifnet_psref_class static
 1.137 03-Feb-2017  christos add sendmmsg and recvmmsg
 1.136 03-Feb-2017  christos handle accept4 for i386
 1.135 03-Feb-2017  martin Do not compile accept4 on i386, there is no such syscall in Linux.
 1.134 02-Feb-2017  christos implement accept4
 1.133 13-Sep-2016  martin branches: 1.133.2;
Make the ktrace record written by do_sys_sendmsg/do_sys_recvmsg overridable
by the caller. Use this in compat_netbsd32 to log the 32bit version, so
the 32bit userland kdump is happy.
 1.132 01-Aug-2016  ozaki-r Apply pserialize and psref to struct ifaddr and its variants

This change makes struct ifaddr and its variants (in_ifaddr and in6_ifaddr)
MP-safe by using pserialize and psref. At this moment, pserialize_perform
and psref_target_destroy are disabled because (1) we don't need them
because of softnet_lock (2) they cause a deadlock because of softnet_lock.
So we'll enable them when we remove softnet_lock in the future.
 1.131 07-Jul-2016  ozaki-r branches: 1.131.2;
Switch the address list of intefaces to pslist(9)

As usual, we leave the old list to avoid breaking kvm(3) users.
 1.130 05-Jul-2016  ozaki-r Fix psref isn't released in a case of IFADDR_EMPTY
 1.129 16-Jun-2016  ozaki-r Use curlwp_bind and curlwp_bindx instead of open-coding LP_BOUND
 1.128 15-Jun-2016  ozaki-r Protect if_byindex by pserialize
 1.127 12-May-2016  ozaki-r Protect ifnet list with psz and psref

The change ensures that ifnet objects in the ifnet list aren't freed during
list iterations by using pserialize(9) and psref(9).

Note that the change adds a pslist(9) for ifnet but doesn't remove the
original ifnet list (ifnet_list) to avoid breaking kvm(3) users. We
shouldn't use the original list in the kernel anymore.
 1.126 24-Jul-2015  maxv Unused inits (harmless).

Found by Brainy.
 1.125 24-May-2015  rtr convert remaining linux_get_sa() users to use linux_get_sa_sb() and
pass the pointer to the sockaddr in msghdr.msg_name, while removing
the MSG_NAMEMBUF flag.

now that the original linux_get_sa() is unused remove it and to make
function names consistent again rename linux_get_sa_sb() to linux_get_sa().
 1.124 02-May-2015  rtr make connect syscall use sockaddr_big and modify pr_{send,connect}
nam parameter type from buf * to sockaddr *.

final commit for parameter type changes to protocol user requests

* bump kernel version to 7.99.15 for parameter type changes to pr_{send,connect}
 1.123 03-Apr-2015  rtr * change pr_bind to accept struct sockaddr * instead of struct mbuf *
* update protocol bind implementations to use/expect sockaddr *
instead of mbuf *
* introduce sockaddr_big struct for storage of addr data passed via
sys_bind; sockaddr_big is of sufficient size and alignment to
accommodate all addr data sizes received.
* modify sys_bind to allocate sockaddr_big instead of using an mbuf.
* bump kernel version to 7.99.9 for change to pr_bind() parameter type.

Patch posted to tech-net@
http://mail-index.netbsd.org/tech-net/2015/03/15/msg005004.html

The choice to use a new structure sockaddr_big has been retained since
changing sockaddr_storage size would lead to unnecessary ABI change. The
use of the new structure does not preclude future work that increases
the size of sockaddr_storage and at that time sockaddr_big may be
trivially replaced.

Tested by mrg@ and myself, discussed with rmind@, posted to tech-net@
 1.122 26-Nov-2014  ozaki-r branches: 1.122.2;
Tweak ifconf variants

The tweaks make the code intention clear and make further changes easy.

No functional change.
 1.121 21-Nov-2014  ozaki-r Tweak linux_getifhwaddr

No functional change.
 1.120 09-Nov-2014  maxv Do not uselessly include <sys/malloc.h>.
 1.119 23-May-2014  njoly branches: 1.119.2;
Add a funtion that translate socket type value from Linux to NetBSD.
Use it for socket and socketpair syscalls.
 1.118 17-May-2014  rmind Replace open-coded access (and boundary checking) of ifindex2ifnet with
if_byindex() function.
 1.117 27-Jan-2014  njoly branches: 1.117.2;
Add basic IPV6 level socket options support (IPV6_V6ONLY).
 1.116 27-Jan-2014  njoly Add SO_SNDLOWAT, SO_RCVLOWAT and SO_ACCEPTCONN support for socket
options.
 1.115 11-Jan-2013  christos branches: 1.115.2;
Use copyin/copyout and linux-specific ifreq structures (they are the same
as the netbsd ones, but this disconnects them)
 1.114 20-Jun-2012  christos branches: 1.114.2;
print proper ktruser names depending on the emulation.
 1.113 15-Mar-2012  bouyer Do not read past end of array. Found by gcc -03
 1.112 20-Jan-2012  joerg Change CMSG_SPACE and CMSG_LEN to provide Integer Constant Expressions
again. This was changed in sys/socket.h r1.51 to work around fallout
from the IPv6 aux data migration. It broke the historic ABI on some
platforms. This commit restores compatibility for netbsd32 code on such
platforms and provides a template for future changes to the CMSG_*
alignment. Revert PCC/Clang workarounds in postfix and tmux.
 1.111 20-Dec-2011  christos - Eliminate so_nbio and turn it into a bit SS_NBIO in so_state.
- Introduce MSG_NBIO so that we can turn non blocking i/o on a per call basis
- Use MSG_NBIO to fix the XXX: multi-threaded issues on the fifo sockets.
- Don't set SO_CANTRCVMORE, if we were interrupted (perhaps do it for all
errors?).
 1.110 17-Jul-2011  christos branches: 1.110.2; 1.110.6;
fail early on socket domain+type combinations we don't support
 1.109 30-Jun-2011  wiz dependant -> dependent
 1.108 02-Nov-2010  chs update linux_sys_socket() to understand the flags that are now
included in the "type" parameter. in linux_sys_sendmsg(),
if we see an SCM_CREDENTIALS control message, just drop it
instead of giving an error. the linux and native versions of
the cred-passing operation are very different and some apps
(eg. linux pulseaudio library talking to a native server)
will work without the control data.
 1.107 28-Nov-2009  dsl branches: 1.107.2; 1.107.4;
Add LINUX_SIOCGIFMTU and LINUX_IP_HDRINCL support.
Fixes part of PR/31358
The other parts are rather too intrusive to be fixed as in the PR.
 1.106 13-Nov-2009  joerg Return the result of copyout. Reminded by Niolas Joly.
 1.105 13-Nov-2009  joerg Provide SIOCGIFNAME.
 1.104 17-Jun-2009  njoly Add a new linux_msghdr structure, as its size differs on 64bit archs.
Do the needed conversions in sendmsg/recvmsg syscalls, and adjust
their definitions accordingly.
 1.103 16-Jun-2009  njoly Add LINUX_CMSG_{SPACE,LEN} macros. Use then when calculating the
msg_controllen size, when converting the control message buffer from
native (previous version was missing the linux_cmsghdr size).
 1.102 16-Jun-2009  njoly For linux cmsg header copyout, use the linux structure size, not the
native one.
 1.101 16-Jun-2009  njoly Make compat linux sendmsg/recvmsg output msghdr and control messages
buffers with ktrace(1), just like the native functions.
 1.100 11-Jun-2009  njoly In sendmsg(2), do copy the msghdr structure before trying to use it.
 1.99 19-Nov-2008  ad branches: 1.99.4;
Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.98 06-Aug-2008  plunky branches: 1.98.2; 1.98.4; 1.98.6;
Convert socket options code to use a sockopt structure
instead of laying everything into an mbuf.

approved by core
 1.97 03-Jul-2008  njoly branches: 1.97.2;
Fix SIOCGIFCONF ioctl for 64bit platforms. Add a new linux_ifreq
structure and linux_getifconf function (cleaned up version from
compat_ifconf).

While here, update linux_getifhwaddr to use the new structure.

Ok by christos.
 1.96 24-Jun-2008  ad Replace references to getsock/getvnode.
 1.95 11-Jun-2008  njoly In linux_sys_sendto, do not unconditionnally set MSG_NAMEMBUF to
msg_flags; add it only if a target adress was provided and needs to be
converted.
 1.94 09-Jun-2008  njoly branches: 1.94.2;
Do set mbuf in all cases, even for salen value of 0; otherwise this
will make a panic later when trying to free memory from a random
adress.

XXX Need to revisit it later to avoid mbuf allocation in this case.
 1.93 29-Apr-2008  njoly branches: 1.93.2;
In linux_get_sa(), make salen parameter unsigned.
Avoid kernel DIAGNOSTIC 0 bytes uvm mapping assertion, for negative
values.
 1.92 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.91 24-Apr-2008  ad branches: 1.91.2;
Merge the socket locking patch:

- Socket layer becomes MP safe.
- Unix protocols become MP safe.
- Allows protocol processing interrupts to safely block on locks.
- Fixes a number of race conditions.

With much feedback from matt@ and plunky@.
 1.90 23-Apr-2008  ad Fix locking.
 1.89 26-Mar-2008  ad branches: 1.89.2;
- Remove uneeded splsoftnet().
- Use fd_getsock().
 1.88 23-Mar-2008  ad linux_get_sa: fix botched fd handling.
 1.87 21-Mar-2008  ad Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
 1.86 06-Feb-2008  ad branches: 1.86.6;
Don't lock the socket to set/clear FNONBLOCK. Just set it atomically.
 1.85 20-Dec-2007  dsl Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.84 08-Dec-2007  dsl branches: 1.84.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.83 05-Dec-2007  dyoung Use IFADDR_EMPTY().
 1.82 05-Dec-2007  dyoung Don't open-code queue(3) macros (x = ifnet.tqh_first; y =
x.if_list.tqe_next). Instead, use the macros themselves.

Use IFNET_FOREACH() and IFADDR_FOREACH().
 1.81 04-Dec-2007  dsl Remove all the __P
 1.80 19-Oct-2007  njoly branches: 1.80.2; 1.80.4;
Add compat_linux and exec_linux_elf lkm support for amd64:
- Add needed COMPAT_OSSAUDIO to GENERIC.
- Add missing includes needed by linux_syscallargs.h.
- Add lkm building.
 1.79 29-Aug-2007  dyoung branches: 1.79.4;
Constify: LLADDR() -> CLLADDR().
 1.78 26-Aug-2007  dyoung branches: 1.78.2;
Use satosdl().
 1.77 15-Aug-2007  ad Changes to make ktrace LKM friendly and reduce ifdef KTRACE. Proposed
on tech-kern.
 1.76 01-Jul-2007  dsl branches: 1.76.2; 1.76.6;
Fix long-term breakage in the definition of 'control' data for linux.
cmsg->cmsg_len is 'size_t' not 'socklen_t' - so it is 8 bytes on 64bit
platforms instead of 4. There is also never padding after the header.
Redo linux sendmsg() so that it stands a chance of getting it right.
Redo linux recvmsg() so that it process control data directly from the mbuf
list. Allowing it to hack the data without using the stackgap.
 1.75 06-Jun-2007  rjs Wrap ktrace calls with #ifdef KTRACE.
 1.74 02-Jun-2007  yamt wrap #include "opt_ktrace.h" by #ifdef _KERNEL_OPT.
 1.73 01-Jun-2007  dsl Split sys_bind() and sys_connect() so that compat code can use common code
once the 'address' has been copied into an mbuf.
Add extra flags for 'struct msghdr.msg_flags' to indicate that the address
and control are already in mbufs, and that the uio structure is in userspace
for sending data, rename sendit() to do_sys_sendmsg() to ensure no old code
passes in random flags.
Changes to compat code to use new functions - removing some stackgap use.
Fix a 'use after free' in compat_43_sys_recvmsg.
I ***THINK*** the code that converts 'cmsg' formatted data is borked!
svr4_stream.c ought to be generated from svr4_32_stream.c during the build.
 1.72 29-May-2007  christos Add a sockaddr_storage member to "struct ifreq" maintaining backwards
compatibility with the older ioctls. This avoids stack smashing and
abuse of "struct sockaddr" when ioctls placed "struct sockaddr_foo's" that
were longer than "struct sockaddr".
XXX: Some of the emulations might be broken; I tried to add code for
them but I did not test them.
 1.71 04-Mar-2007  christos branches: 1.71.2; 1.71.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.70 11-Feb-2007  mlelstv branches: 1.70.2;
Make setsockopt return compatible error codes for AF_UNIX sockets.
 1.69 09-Feb-2007  ad Merge newlock2 to head.
 1.68 16-Nov-2006  christos branches: 1.68.2;
__unused removal on arguments; approved by core.
 1.67 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.66 02-Sep-2006  christos branches: 1.66.2; 1.66.4;
comment out impossible code
 1.65 23-Jul-2006  ad Use the LWP cached credentials where sane.
 1.64 27-Jun-2006  pavel Use the new socket call for Linux and SVR4, because those systems (at
least Linux 2.4.31, Irix 6.5.20 and Solaris 10) use EAFNOSUPPORT.

Only the Linux emulation has been tested.

XXX somebody should audit the other emulations...
 1.63 26-Jun-2006  mrg version the socket(2) syscall. for compat30 socket, we use
EPROTONOSUPPORT instead of EAFNOSUPPORT.

from pavel@ with a little bit of clean up from myself.

XXX: netbsd32 (and perhaps other emulations) should be able
XXX: to call the standard socket calls for this i think, but
XXX: revisit this at another time.
 1.62 14-May-2006  elad branches: 1.62.4;
integrate kauth.
 1.61 12-May-2006  mrg use socklen_t when talking to the NetBSD side of things
 1.60 27-Mar-2006  dyoung Use __arraycount().
 1.59 09-Feb-2006  manu branches: 1.59.2; 1.59.4; 1.59.6;
Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.58 11-Dec-2005  christos branches: 1.58.2; 1.58.4; 1.58.6;
merge ktrace-lwp.
 1.57 24-Sep-2005  christos factor out some of the osockaddr, omsghdr code.
 1.56 03-May-2005  manu branches: 1.56.2;
First work on COMPAT_LINUX/amd64
Process startup and dynamiclinking work, but processes hang due to
Linux arch_prctl(2) not being really supported yet.
 1.55 26-Feb-2005  perry nuke trailing whitespace
 1.54 24-Feb-2005  martin Fix number of elements calculation when converting socket options.
Fixes bugs 4 and 5 reported by Ted Unangst on tech-kern.
 1.53 12-Sep-2004  jdolecek branches: 1.53.4; 1.53.6;
if passed sockaddr has family AF_UNSPEC, use socket family of the socket
the sockaddr is used for

this fixes bind() problem in Linux version of Theocracy, testing
by Thomas Klausner
 1.52 05-Sep-2004  jdolecek linux_sa_get: g/c curproc use, we get the process as one of arguments
 1.51 29-Aug-2004  jdolecek in debug log, data dump is more useful unsigned
 1.50 25-Oct-2003  christos branches: 1.50.2;
Fix uninitialized variable warnings
 1.49 27-Jul-2003  jdolecek More complete sendmsg(2) and recvmsg(2) emulation:
* translate MSG_* flags
* rewrite CMSG level/type to appropriate NetBSD value on input, and to Linux
value on output
* handle different CMSG_DATA alignment for some archs

This fixes SCM_RIGHTS passing. Other SCM_* types are not supported -
the set is different on NetBSD and Linux. SCM_TIMESTAMP doesn't seem
to be actually implemented in Linux 2.5.15, so it's not supported
for Linux binaries either (for now).

PR: 21577 by Todd Vierling
 1.48 27-Jul-2003  mrg add a cast appease gcc3.3
 1.47 23-Jul-2003  christos make credentials work on the i386 by passing the original msg structure.
(from Todd Vierling)
 1.46 29-Jun-2003  fvdl branches: 1.46.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.45 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.44 21-Mar-2003  dsl Change 'data' argument to fo_ioctl and fo_fcntl from 'caddr_t' to 'void *'.
Avoids a lot of casting and removes the need for some line breaks.
Removed a load of (caddr_t) casts from calls to copyin/copyout as well.
(approved by christos - he has a plan to remove caddr_t...)
 1.43 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.42 29-Nov-2002  fvdl branches: 1.42.2;
Patch that actually works for previous, from Jaromir Dolecek.
 1.41 29-Nov-2002  itojun setsockopt(IPPROTO_IPV6, IPV6_V6ONLY, 0) for AF_INET6 sockets,
to meet with the default behavior of linux.
review: fvdl/christos
XXX interactions with net.inet6.ip6.v6only?
 1.40 28-Nov-2002  itojun minor KNF (indent)
 1.39 12-May-2002  jschauma branches: 1.39.4;
Linux does not implement SO_REUSEPORT, but allows reuse of a
host:port pair through SO_REUSEADDR even if the address is not a
multicast-address. Effectively, this means that we should use
SO_REUSEPORT when SO_REUSEADDR is set (from the linux process)
to allow Linux applications to not exit with EADDRINUSE.

(Previously erraneously applied to 1.5 branch; approved for
proper location by thorpej)
 1.38 08-Apr-2002  christos PR/16236: Joachim Koenig-Baltes: Linux emulation connect requires IPV6.
Apparently the sockaddr len fix was only compiled when IPV6 was enabled.
 1.37 29-Mar-2002  christos - #undef DPRINTF for files that are included from other files.
- more debugging for socketcalls
- fix sa_len if AF_INET; somehow we get passed 28 instead of 16?
 1.36 16-Mar-2002  christos make the stackgap_{init,alloc} functions MP friendly (i.e. pass struct proc *
in, instead of using curproc). While there add an optional size argument to
stackgap_init.
 1.35 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.34 08-Sep-2001  fvdl Allow the old-style sockaddr_in6 for v6 addresses for which the
scope id is irrelevant. Makes netscape6 for Linux work again,
which uses v4-mapped addresses to connect to v4 sites.
 1.33 04-Jul-2001  jdolecek branches: 1.33.2; 1.33.4;
remove no longer used variable
make 'osa' arg of linux_sa_get() const
 1.32 04-Jul-2001  jdolecek Do address family (AF_*) number translation for socket system calls which
pass socket address in our or out. This makes Linux programs using IPv6
working under emulation. This addresses kern/13279 by Jun-ichiro itojun Hagino.

Change sendmsg()/recvmsg() to expect the control information
to be passed the standard way (not 4.3BSD one, imlied by compat_43 code
or MSG_COMPAT). Linux uses different (arguably broken) CMSG_ALIGN() on some
architectures unfortunately, that would need to be handled eventually.

Also provide some other trivial stubs (like linux_sys_send()) to avoid
unneeded dependance on uipc_syscalls_43.c.
 1.31 25-Jun-2001  jdolecek linux_getifhwaddr(): use strncmp() to find out if if_name starts with 'eth',
it's more readable that way
 1.30 14-Jun-2001  thorpej Fix a partial construction problem that can cause race conditions
between creation of a file descriptor and close(2) when using kernel
assisted threads. What we do is stick descriptors in the table, but
mark them as "larval". This causes essentially everything to treat
it as a non-existent descriptor, except for fdalloc(), which sees a
filled slot so that it won't (incorrectly) allocate it again. When
a descriptor is fully constructed, the code that has constructed it
marks it as "mature" (which actually clears the "larval" flag), and
things continue to work as normal.

While here, gather all the code that gets a descriptor from the table
into a fd_getfile() function, and call it, rather than having the
same (sometimes incorrect) code copied all over the place.
 1.29 29-Mar-2001  fvdl Don't do the ioctl call for the get hw addr case, all the work has
been done already.
 1.28 05-Feb-2001  chs branches: 1.28.2;
expose the definitions of MIN() and MAX() in sys/param.h to the kernel
and use those in favor of a dozen copies scattered around the source tree.
 1.27 29-Dec-2000  fvdl Allow the EJUSTRETURN hack for PTIOCLINUX-passed through ioctl calls.
 1.26 22-Dec-2000  fvdl Don't do the syscall with modified ioctl command if we've successfully
done a 'passthrough' ioctl.
 1.25 18-Dec-2000  fvdl Pass SIOC* calls that are done on devices (not sockets) through
without trying to interpret done, as is done on Linux. The device
will get them as PTIOCLINUX, with command and arg in the structure
passed in.
 1.24 03-May-2000  thorpej branches: 1.24.4;
Remove junk after #undef.
 1.23 30-Mar-2000  augustss Kill register declarations.
 1.22 12-Jan-2000  jdolecek Improve emulation of SIOCGIFHWADDR ioctl:
* when finding an interface, try the real name first before faking eth*
* Linux kernel returns ENODEV if the request goes to unknown interface,
so do the same here

This change makes Linux ICA client work.

Patch sent by Zdenek Salvet <salvet@ics.muni.cz> in kern/9169.
 1.21 17-Jul-1999  jtk branches: 1.21.2;
implement emulation of SIOCGIFHWADDR, PR 7997
 1.20 05-May-1999  thorpej Add "use counting" to file entries. When closing a file, and it's reference
count is 0, wait for use count to drain before finishing the close.

This is necessary in order for multiple processes to safely share file
descriptor tables.
 1.19 25-Mar-1999  sommerfe branches: 1.19.2; 1.19.4;
commit fix to PR7072: emulate linux non-blocking connect behavior more correctly
 1.18 04-Oct-1998  fvdl Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.17 03-Oct-1998  christos Attempt to fix the mess.
 1.16 01-Oct-1998  erh Split linux/compat/linux_socket.c into common and multi-architechture parts. linux_socketcall.c contains the socketcall multiplexer.
 1.15 22-Dec-1996  fvdl Make this compile again, including Politically Correct const handling.
 1.14 05-Apr-1996  christos Prototyping changes.
 1.13 08-Mar-1996  mycroft Separate ioctl emulation by group. Add (minimal) audio emulation.
 1.12 07-Oct-1995  mycroft Prefix names of system call implementation functions with `sys_'.
 1.11 19-Sep-1995  thorpej Make system calls conform to a standard prototype and bring those
prototypes into scope.
 1.10 14-Aug-1995  mycroft Rearrange #includes.
 1.9 24-Jun-1995  christos Use compat_util.[ch].
 1.8 22-Jun-1995  fvdl * Changed to use generic ELF code from kern/exec_elf.c (which was taken
from the svr4 exec code plus the linux compat mods)
* Include file change
* Add multicast sockopts (from John Brezak)
 1.7 28-May-1995  mycroft Need netinet/tcp.h.
 1.6 28-May-1995  mycroft Convert TCP socket options.
 1.5 28-May-1995  mycroft Fill in `name' argument to getsockopt() correctly.
 1.4 28-May-1995  mycroft Fix typo.
 1.3 28-May-1995  mycroft Convert IP socket options.
 1.2 28-May-1995  mycroft Get rid of damned `static's.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.19.4.2 02-Aug-1999  thorpej Update from trunk.
 1.19.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.19.2.1 15-Jan-2000  he Pull up revision 1.21 (via patch, requested by joda):
Implement the SIOCGIFHWADDR Linux ioctl, allowing installation
of Matlab (after convincing the install script it is running on
a supported platform).
 1.21.2.4 21-Apr-2001  bouyer Sync with HEAD
 1.21.2.3 11-Feb-2001  bouyer Sync with HEAD.
 1.21.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.21.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.24.4.4 12-May-2002  jschauma Undo my own bad - change did not belong into 1.5 branch. Sorry.
 1.24.4.3 11-May-2002  jschauma Linux does not implement SO_REUSEPORT, but allows reuse of a
host:port pair through SO_REUSEADDR even if the address is not a
multicast-address. Effectively, this means that we should use
SO_REUSEPORT when SO_REUSEADDR is set (from the linux process)
to allow Linux applications to not exit with EADDRINUSE.
 1.24.4.2 30-Mar-2001  he Pull up revision 1.29 (requested by fvdl):
Fix the SIOCGETHWADDR socket ioctl call; earlier it always returned
an error.
 1.24.4.1 30-Mar-2001  he Pull up revisions 1.25-1.26 (requested by fvdl):
Add some required Linux emulation bits to support the Linux
version of VMware.
 1.28.2.14 11-Dec-2002  thorpej Sync with HEAD.
 1.28.2.13 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.28.2.12 24-Jun-2002  nathanw Curproc->curlwp renaming.

Change uses of "curproc->l_proc" back to "curproc", which is more like the
original use. Bare uses of "curproc" are now "curlwp".

"curproc" is now #defined in proc.h as ((curlwp) ? (curlwp)->l_proc) : NULL)
so that it is always safe to reference curproc (*de*referencing curproc
is another story, but that's always been true).
 1.28.2.11 20-Jun-2002  nathanw Catch up to -current.
 1.28.2.10 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.28.2.9 17-Apr-2002  nathanw Catch up to -current.
 1.28.2.8 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.28.2.7 14-Nov-2001  nathanw Catch up to -current.
 1.28.2.6 21-Sep-2001  nathanw Catch up to -current.
 1.28.2.5 24-Aug-2001  nathanw A few files and lwp/proc conversions I missed in the last big update.
GENERIC runs again.
 1.28.2.4 24-Aug-2001  nathanw Catch up with -current.
 1.28.2.3 21-Jun-2001  nathanw Catch up to -current.
 1.28.2.2 09-Apr-2001  nathanw Catch up with -current.
 1.28.2.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.33.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.33.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.33.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.33.2.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.39.4.3 22-Oct-2003  jmc Pullup revs 1.41-1.42 (requested by tv in ticket #1429)

setsockopt(IPPROTO_IPV6, IPV6_V6ONLY, 0) for AF_INET6 sockets,
to meet with the default behavior of linux.
 1.39.4.2 22-Oct-2003  jmc Pullup rev 1.49 (via patch) (requested by tv in ticket #1425)

More complete sendmsg(2) and recvmsg(2) emulation:
* translate MSG_* flags
* rewrite CMSG level/type to appropriate NetBSD value on input,
and to Linux value on output
* handle different CMSG_DATA alignment for some archs

This fixes SCM_RIGHTS passing. Other SCM_* types are not supported -
the set is different on NetBSD and Linux. SCM_TIMESTAMP doesn't seem
to be actually implemented in Linux 2.5.15, so it's not supported
for Linux binaries either (for now).
 1.39.4.1 22-Oct-2003  jmc Pullup rev 1.46 (requested by tv in ticket #1425)

make credentials work on the i386 by passing the original msg structure.
 1.42.2.1 18-Dec-2002  gmcgarry Merge pcred and ucred, and poolify. TBD: check backward compatibility
and factor-out some higher-level functionality.
 1.46.2.8 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.46.2.7 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.46.2.6 21-Sep-2004  skrll Adapt to branch.
 1.46.2.5 21-Sep-2004  skrll Fix the sync with head I botched.
 1.46.2.4 18-Sep-2004  skrll Sync with HEAD.
 1.46.2.3 03-Sep-2004  skrll Sync with HEAD
 1.46.2.2 03-Aug-2004  skrll Sync with HEAD
 1.46.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.50.2.1 20-Sep-2004  tron Pull up revision 1.53 (requested by jdolecek in ticket #844):
if passed sockaddr has family AF_UNSPEC, use socket family of the socket
the sockaddr is used for
this fixes bind() problem in Linux version of Theocracy, testing
by Thomas Klausner
 1.53.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.53.4.1 29-Apr-2005  kent sync with -current
 1.56.2.9 24-Mar-2008  yamt sync with head.
 1.56.2.8 11-Feb-2008  yamt sync with head.
 1.56.2.7 21-Jan-2008  yamt sync with head
 1.56.2.6 07-Dec-2007  yamt sync with head
 1.56.2.5 27-Oct-2007  yamt sync with head.
 1.56.2.4 03-Sep-2007  yamt sync with head.
 1.56.2.3 26-Feb-2007  yamt sync with head.
 1.56.2.2 30-Dec-2006  yamt sync with head.
 1.56.2.1 21-Jun-2006  yamt sync with head.
 1.58.6.2 01-Jun-2006  kardel Sync with head.
 1.58.6.1 22-Apr-2006  simonb Sync with head.
 1.58.4.1 09-Sep-2006  rpaulo sync with head
 1.58.2.1 18-Feb-2006  yamt sync with head.
 1.59.6.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.59.6.1 28-Mar-2006  tron Merge 2006-03-28 NetBSD-current into the "peter-altq" branch.
 1.59.4.3 06-May-2006  christos - Move kauth_cred_t declaration to <sys/types.h>
- Cleanup struct ucred; forward declarations that are unused.
- Don't include <sys/kauth.h> in any header, but include it in the c files
that need it.

Approved by core.
 1.59.4.2 19-Apr-2006  elad sync with head.
 1.59.4.1 08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.59.2.4 03-Sep-2006  yamt sync with head.
 1.59.2.3 11-Aug-2006  yamt sync with head
 1.59.2.2 24-May-2006  yamt sync with head.
 1.59.2.1 01-Apr-2006  yamt sync with head.
 1.62.4.1 13-Jul-2006  gdamore Merge from HEAD.
 1.66.4.2 10-Dec-2006  yamt sync with head.
 1.66.4.1 22-Oct-2006  yamt sync with head
 1.66.2.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.66.2.1 18-Nov-2006  ad Sync with head.
 1.68.2.1 21-Feb-2007  tron Pull up following revision(s) (requested by mlelstv in ticket #447):
sys/compat/linux/common/linux_socket.c: revision 1.70
Make setsockopt return compatible error codes for AF_UNIX sockets.
 1.70.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.71.4.1 11-Jul-2007  mjf Sync with head.
 1.71.2.4 09-Oct-2007  ad Sync with head.
 1.71.2.3 20-Aug-2007  ad Sync with HEAD.
 1.71.2.2 15-Jul-2007  ad Sync with head.
 1.71.2.1 09-Jun-2007  ad Sync with head.
 1.76.6.4 09-Dec-2007  jmcneill Sync with HEAD.
 1.76.6.3 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.76.6.2 03-Sep-2007  jmcneill Sync with HEAD.
 1.76.6.1 16-Aug-2007  jmcneill Sync with HEAD.
 1.76.2.1 03-Sep-2007  skrll Sync with HEAD.
 1.78.2.3 23-Mar-2008  matt sync with HEAD
 1.78.2.2 09-Jan-2008  matt sync with HEAD
 1.78.2.1 06-Nov-2007  matt sync with HEAD
 1.79.4.1 25-Oct-2007  bouyer Sync with HEAD.
 1.80.4.2 26-Dec-2007  ad Sync with head.
 1.80.4.1 08-Dec-2007  ad Sync with head.
 1.80.2.3 18-Feb-2008  mjf Sync with HEAD.
 1.80.2.2 27-Dec-2007  mjf Sync with HEAD.
 1.80.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.84.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.86.6.5 17-Jan-2009  mjf Sync with HEAD.
 1.86.6.4 28-Sep-2008  mjf Sync with HEAD.
 1.86.6.3 29-Jun-2008  mjf Sync with HEAD.
 1.86.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.86.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.89.2.2 17-Jun-2008  yamt sync with head.
 1.89.2.1 18-May-2008  yamt sync with head.
 1.91.2.4 11-Mar-2010  yamt sync with head
 1.91.2.3 20-Jun-2009  yamt sync with head
 1.91.2.2 04-May-2009  yamt sync with head.
 1.91.2.1 16-May-2008  yamt sync with head.
 1.93.2.4 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.93.2.3 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.93.2.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.93.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.94.2.3 03-Jul-2008  simonb Sync with head.
 1.94.2.2 27-Jun-2008  simonb Sync with head.
 1.94.2.1 18-Jun-2008  simonb Sync with head.
 1.97.2.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.97.2.1 19-Oct-2008  haad Sync with HEAD.
 1.98.6.1 17-Jun-2009  bouyer branches: 1.98.6.1.2;
Pull up following revision(s) (requested by njoly in ticket #806):
sys/compat/linux/common/linux_socket.c: revision 1.100
In sendmsg(2), do copy the msghdr structure before trying to use it.
 1.98.6.1.2.1 21-Apr-2010  matt sync to netbsd-5
 1.98.4.2 28-Nov-2009  bouyer Pull up following revision(s) (requested by joerg in ticket #1147):
sys/compat/linux32/common/linux32_socket.c: revision 1.11, 1.12
sys/compat/linux/common/linux_socket.c: revision 1.105, 1.106
sys/compat/linux/common/linux_sockio.h: revision 1.17
sys/compat/linux32/common/linux32_sockio.h: revision 1.3
Provide SIOCGIFNAME.
Return the result of copyout. Reminded by Niolas Joly.
 1.98.4.1 17-Jun-2009  bouyer Pull up following revision(s) (requested by njoly in ticket #806):
sys/compat/linux/common/linux_socket.c: revision 1.100
In sendmsg(2), do copy the msghdr structure before trying to use it.
 1.98.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.99.4.1 23-Jul-2009  jym Sync with HEAD.
 1.107.4.1 05-Mar-2011  rmind sync with head
 1.107.2.1 06-Nov-2010  uebayasi Sync with HEAD.
 1.110.6.2 05-Apr-2012  mrg sync to latest -current.
 1.110.6.1 18-Feb-2012  mrg merge to -current.
 1.110.2.4 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.110.2.3 23-Jan-2013  yamt sync with head
 1.110.2.2 30-Oct-2012  yamt sync with head
 1.110.2.1 17-Apr-2012  yamt sync with head
 1.114.2.3 03-Dec-2017  jdolecek update from HEAD
 1.114.2.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.114.2.1 25-Feb-2013  tls resync with head
 1.115.2.2 18-May-2014  rmind sync with head
 1.115.2.1 17-Jul-2013  rmind Checkpoint work in progress:
- Move PCB structures under __INPCB_PRIVATE, adjust most of the callers
and thus make IPv4 PCB structures mostly opaque. Any volunteers for
merging in6pcb with inpcb (see rpaulo-netinet-merge-pcb branch)?
- Move various global vars to the modules where they belong, make them static.
- Some preliminary work for IPv4 PCB locking scheme.
- Make raw IP code mostly MP-safe. Simplify some of it.
- Rework "fast" IP forwarding (ipflow) code to be mostly MP-safe. It should
run from a software interrupt, rather than hard.
- Rework tun(4) pseudo interface to be MP-safe.
- Work towards making some other interfaces more strict.
 1.117.2.1 10-Aug-2014  tls Rebase.
 1.119.2.3 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1720:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149 (patch)
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54 (patch)

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.119.2.2 19-Apr-2019  martin Pull up following revision(s) via patch (requested by christos in ticket #1689):

sys/compat/linux/common/linux_socket.c: revision 1.145
sys/net/if.c: revision 1.449
sys/compat/linux32/common/linux32_socket.c: revision 1.30
sys/compat/common/uipc_syscalls_40.c: revision 1.19

Zero out the ifreq struct for SIOCGIFCONF to avoid up to 127 bytes of stack
disclosure. From Andy Nguyen, many thanks!

-

Zero out the ifreq struct for SIOCGIFCONF to avoid up to 127 bytes of stack
disclosure. From Andy Nguyen, many thanks! This is the compat code part
pointed out by ozaki-r@
 1.119.2.1 17-Jan-2015  martin branches: 1.119.2.1.2; 1.119.2.1.6;
Pull up following revision(s) (requested by maxv in ticket #427):
sys/compat/svr4/svr4_schedctl.c: revision 1.8
sys/netinet/tcp_timer.c: revision 1.88
sys/miscfs/genfs/layer_vfsops.c: revision 1.45
sys/compat/svr4/svr4_ioctl.c: revision 1.37
sys/ufs/chfs/chfs_vfsops.c: revision 1.14
sys/miscfs/fdesc/fdesc_vfsops.c: revision 1.91
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.30
sys/compat/common/kern_time_50.c: revision 1.28
sys/netinet6/ip6_forward.c: revision 1.74
sys/miscfs/umapfs/umap_vnops.c: revision 1.57
sys/compat/svr4/svr4_fcntl.c: revision 1.74
distrib/sets/lists/comp/mi: revision 1.1931
sys/netinet6/udp6_output.c: revision 1.46
sys/fs/puffs/puffs_compat.c: revision 1.3
sys/fs/udf/udf_rename.c: revision 1.11
sys/compat/svr4/svr4_filio.c: revision 1.24
sys/fs/udf/udf_rename.c: revision 1.12
sys/netinet/tcp_usrreq.c: revision 1.202
sys/miscfs/umapfs/umap_subr.c: revision 1.29
sys/compat/linux/common/linux_fadvise64.c: revision 1.3
sys/netinet/if_atm.c: revision 1.34
sys/miscfs/procfs/procfs_subr.c: revision 1.106
sys/miscfs/genfs/layer_subr.c: revision 1.37
sys/netinet/tcp_sack.c: revision 1.30
sys/compat/freebsd/freebsd_misc.c: revision 1.33
sys/compat/freebsd/freebsd_file.c: revision 1.33
sys/ufs/chfs/chfs_vnode.c: revision 1.12
sys/compat/svr4/svr4_ttold.c: revision 1.34
sys/compat/linux/common/linux_file.c: revision 1.114
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.43
sys/compat/linux/common/linux_signal.c: revision 1.76
sys/compat/common/compat_util.c: revision 1.46
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.18
sys/compat/svr4/svr4_sockio.c: revision 1.36
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.32
sys/compat/svr4/svr4_signal.c: revision 1.66
sys/kern/kern_exec.c: revision 1.410
sys/fs/puffs/puffs_vfsops.c: revision 1.115
sys/compat/svr4/svr4_exec_elf64.c: revision 1.15
sys/compat/linux/arch/i386/linux_machdep.c: revision 1.159
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.50
sys/compat/linux32/common/linux32_misc.c: revision 1.24
sys/netinet/in_pcb.c: revision 1.153
sys/sys/malloc.h: revision 1.116
sys/compat/common/if_43.c: revision 1.9
share/man/man9/Makefile: revision 1.380
sys/netinet/tcp_vtw.c: revision 1.12
sys/miscfs/umapfs/umap_vfsops.c: revision 1.95
sys/ufs/ext2fs/ext2fs_vfsops.c: revision 1.186
sys/compat/common/uipc_syscalls_43.c: revision 1.46
sys/ufs/ext2fs/ext2fs_vnops.c: revision 1.115
sys/fs/puffs/puffs_msgif.c: revision 1.97
sys/compat/svr4/svr4_ipc.c: revision 1.27
sys/compat/linux/common/linux_exec.c: revision 1.117
sys/ufs/ext2fs/ext2fs_readwrite.c: revision 1.66
sys/netinet/tcp_output.c: revision 1.179
sys/compat/svr4/svr4_termios.c: revision 1.28
sys/fs/udf/udf_strat_bootstrap.c: revision 1.4
sys/fs/puffs/puffs_subr.c: revision 1.67
sys/fs/puffs/puffs_node.c: revision 1.36
sys/miscfs/overlay/overlay_vnops.c: revision 1.21
sys/fs/cd9660/cd9660_node.c: revision 1.34
sys/netinet/raw_ip.c: revision 1.146
sys/sys/mallocvar.h: revision 1.13
sys/miscfs/overlay/overlay_vfsops.c: revision 1.63
share/man/man9/malloc.9: revision 1.50
sys/netinet6/dest6.c: revision 1.18
sys/compat/linux/common/linux_uselib.c: revision 1.33
sys/compat/linux/common/linux_socket.c: revision 1.120
share/man/man9/malloc.9: revision 1.51
sys/netinet/tcp_subr.c: revision 1.257
sys/compat/linux/common/linux_socketcall.c: revision 1.45
sys/compat/linux/common/linux_fadvise64_64.c: revision 1.3
sys/compat/freebsd/freebsd_ipc.c: revision 1.17
sys/compat/linux/common/linux_misc_notalpha.c: revision 1.109
sys/compat/linux/arch/alpha/linux_pipe.c: revision 1.17
sys/netinet6/in6_pcb.c: revision 1.132
sys/netinet6/in6_ifattach.c: revision 1.94
sys/compat/svr4/svr4_exec_elf32.c: revision 1.15
sys/miscfs/nullfs/null_vfsops.c: revision 1.90
sys/fs/cd9660/cd9660_util.c: revision 1.12
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.48
sys/compat/freebsd/freebsd_exec_elf32.c: revision 1.20
sys/miscfs/procfs/procfs_vfsops.c: revision 1.94
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.28
sys/compat/linux/common/linux_sched.c: revision 1.67
sys/compat/linux/common/linux_exec_aout.c: revision 1.67
sys/compat/linux/common/linux_pipe.c: revision 1.67
sys/compat/linux/common/linux_llseek.c: revision 1.34
sys/compat/linux/arch/mips/linux_ptrace.c: revision 1.10
Do not uselessly include <sys/malloc.h>.
Cleanup:
- remove struct kmembuckets (dead)
- correctly deadify MALLOC_XX
- remove MALLOC_DEFINE_LIMIT and MALLOC_JUSTDEFINE_LIMIT (dead)
- remove malloc_roundup(), malloc_type_setlimit(), MALLOC_DEFINE_LIMIT()
and MALLOC_JUSTDEFINE_LIMIT() from man 9 malloc
New sentence, new line. Bump date for previous.
Obsolete malloc_roundup(9), malloc_type_setlimit(9) and MALLOC_DEFINE_LIMIT(9)
man pages.
 1.119.2.1.6.2 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1720:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149 (patch)
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54 (patch)

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.119.2.1.6.1 19-Apr-2019  martin Pull up following revision(s) via patch (requested by christos in ticket #1689):

sys/compat/linux/common/linux_socket.c: revision 1.145
sys/net/if.c: revision 1.449
sys/compat/linux32/common/linux32_socket.c: revision 1.30
sys/compat/common/uipc_syscalls_40.c: revision 1.19

Zero out the ifreq struct for SIOCGIFCONF to avoid up to 127 bytes of stack
disclosure. From Andy Nguyen, many thanks!

-

Zero out the ifreq struct for SIOCGIFCONF to avoid up to 127 bytes of stack
disclosure. From Andy Nguyen, many thanks! This is the compat code part
pointed out by ozaki-r@
 1.119.2.1.2.1 19-Apr-2019  martin Pull up following revision(s) via patch (requested by christos in ticket #1689):

sys/compat/linux/common/linux_socket.c: revision 1.145
sys/net/if.c: revision 1.449
sys/compat/linux32/common/linux32_socket.c: revision 1.30
sys/compat/common/uipc_syscalls_40.c: revision 1.19

Zero out the ifreq struct for SIOCGIFCONF to avoid up to 127 bytes of stack
disclosure. From Andy Nguyen, many thanks!

-

Zero out the ifreq struct for SIOCGIFCONF to avoid up to 127 bytes of stack
disclosure. From Andy Nguyen, many thanks! This is the compat code part
pointed out by ozaki-r@
 1.122.2.8 28-Aug-2017  skrll Sync with HEAD
 1.122.2.7 05-Feb-2017  skrll Sync with HEAD
 1.122.2.6 05-Oct-2016  skrll Sync with HEAD
 1.122.2.5 09-Jul-2016  skrll Sync with HEAD
 1.122.2.4 29-May-2016  skrll Sync with HEAD
 1.122.2.3 22-Sep-2015  skrll Sync with HEAD
 1.122.2.2 06-Jun-2015  skrll Sync with HEAD
 1.122.2.1 06-Apr-2015  skrll Sync with HEAD
 1.131.2.2 20-Mar-2017  pgoyette Sync with HEAD
 1.131.2.1 06-Aug-2016  pgoyette Sync with HEAD
 1.133.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.138.6.7 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1836):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.138.6.6 17-Jul-2020  martin Pull up following revision(s) (requested by msaitoh in ticket #1576):

sys/net/if.c: revision 1.479
sys/compat/common/uipc_syscalls_40.c: revision 1.23
sys/compat/linux/common/linux_socket.c: revision 1.150
sys/compat/linux32/common/linux32_socket.c: revision 1.31

Don't accept negative value.
 1.138.6.5 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1487:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.138.6.4 19-Apr-2019  martin Pull up following revision(s) (requested by christos in ticket #1233):

sys/compat/linux/common/linux_socket.c: revision 1.145
sys/net/if.c: revision 1.449
sys/compat/linux32/common/linux32_socket.c: revision 1.30
sys/compat/common/uipc_syscalls_40.c: revision 1.19

Zero out the ifreq struct for SIOCGIFCONF to avoid up to 127 bytes of stack
disclosure. From Andy Nguyen, many thanks!

-

Zero out the ifreq struct for SIOCGIFCONF to avoid up to 127 bytes of stack
disclosure. From Andy Nguyen, many thanks! This is the compat code part
pointed out by ozaki-r@
 1.138.6.3 08-Dec-2018  martin Apply patch, requested by tsutsui in ticket #1132:

Different solution for the fix in

sys/compat/linux/common/linux_socket.c rev 1.140

The solution in -current could not be directly used as it required a kernel
version bump and broke the ABI. Work around it differently here.

Fixes linux emulation of sendto(2), PR 53103.
 1.138.6.2 12-May-2018  martin Pull up following revision(s) (requested by ozaki-r in ticket #818):

sys/compat/linux/common/linux_socket.c: revision 1.142
sys/compat/linux32/common/linux32_socket.c: revision 1.29

Fix pserialize enter/exit pairs in linux_getifconf and linux32_getifconf

Tested by using a small linux program that uses ioctl(SIOCGIFCONF).
Probably fix PR kern/53259 as well.
 1.138.6.1 30-Nov-2017  martin Pull up following revision(s) (requested by ozaki-r in ticket #407):
sys/compat/linux32/common/linux32_socket.c: revision 1.28
sys/net/if.c: revision 1.400
sys/netipsec/key.c: revision 1.243
sys/compat/linux/common/linux_socket.c: revision 1.139
sys/netinet/ip_carp.c: revision 1.93
sys/netinet6/in6.c: revision 1.252
sys/netinet6/in6.c: revision 1.253
sys/netinet6/in6.c: revision 1.254
sys/net/if_spppsubr.c: revision 1.173
sys/net/if_spppsubr.c: revision 1.174
sys/compat/common/uipc_syscalls_40.c: revision 1.14
Protect IFADDR_READER_FOREACH and obtained ifa with psz/psref
Fix usage of FOREACH macro
key_sad.lock is held there so SAVLIST_WRITER_FOREACH is enough.
Protect IFADDR_READER_FOREACH and obtained ifa with psz/psref
Protect IFADDR_READER_FOREACH and obtained ifa with psz/psref (more)
Fix and make consistent of usages of psz/psref in ifconf variants
Remove unnecessary goto because there is no cleanup code to share (NFC)
Tweak a condition; we don't need to care ifacount to be negative
Fix a race condition of in6_ifinit
in6_ifinit checks the number of IPv6 addresses on a given interface and
if it's zero (i.e., an IPv6 address being assigned to the interface
is the first one), call if_addr_init. However, the actual assignment of
the address (ifa_insert) is out of in6_ifinit. The check and the
assignment must be done atomically.
Fix it by holding in6_ifaddr_lock during in6_ifinit and ifa_insert.
And also add missing pserialize to IFADDR_READER_FOREACH.
 1.139.2.3 26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.139.2.2 21-May-2018  pgoyette Sync with HEAD
 1.139.2.1 22-Mar-2018  pgoyette Synch with HEAD, resolve conflicts
 1.142.2.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.142.2.1 10-Jun-2019  christos Sync with HEAD
 1.145.4.4 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.145.4.3 08-Nov-2020  martin Pull up following revision(s) (requested by kamil in ticket #1127):

sys/compat/linux/common/linux_socket.c: revision 1.151

Fix compat with Linux programs that use longer namelen for sockets

Linux is less strict than NetBSD and permits namelen to be larger
than valid struct sockaddr_in*. If this is the case, truncate the value
to the correct size, so that NetBSD networking does not return an error.

Reviewed by kamil
 1.145.4.2 17-Jul-2020  martin Pull up following revision(s) (requested by msaitoh in ticket #1018):

sys/net/if.c: revision 1.479
sys/compat/common/uipc_syscalls_40.c: revision 1.23
sys/compat/linux/common/linux_socket.c: revision 1.150
sys/compat/linux32/common/linux32_socket.c: revision 1.31

Don't accept negative value.
 1.145.4.1 13-Sep-2019  martin Pull up following revision(s) (requested by maxv in ticket #194):

sys/compat/linux/common/linux_socket.c: revision 1.146
sys/compat/linux/common/linux_socket.c: revision 1.147
sys/compat/linux/common/linux_socket.c: revision 1.148
sys/compat/linux/common/linux_socket.c: revision 1.149
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.59
sys/compat/linux32/common/linux32_sysinfo.c: revision 1.8
sys/kern/sysv_shm.c: revision 1.138
sys/compat/linux/common/linux_file64.c: revision 1.61
sys/compat/linux/common/linux_file64.c: revision 1.62
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.58
sys/compat/linux32/common/linux32_dirent.c: revision 1.20
sys/compat/linux32/common/linux32_utsname.c: revision 1.10
sys/compat/linux/common/linux_termios.h: revision 1.22
sys/compat/linux32/common/linux32_termios.c: revision 1.15
sys/compat/linux32/common/linux32_misc.c: revision 1.27
sys/compat/linux32/common/linux32_ioctl.c: revision 1.14
sys/compat/linux/common/linux_statfs.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.57
sys/compat/linux/common/linux_fcntl.h: revision 1.18
sys/compat/linux/common/linux_socket.h: revision 1.24
sys/sys/shm.h: revision 1.54
sys/compat/ossaudio/ossaudio.c: revision 1.75
sys/compat/linux32/common/linux32_signal.c: revision 1.20
sys/miscfs/procfs/procfs_linux.c: revision 1.75
sys/compat/linux/common/linux_signal.c: revision 1.81
sys/compat/linux/common/linux_termios.c: revision 1.38
sys/compat/linux/common/linux_misc.c: revision 1.241
sys/compat/linux/common/linux_misc.c: revision 1.242
sys/compat/linux/common/linux_misc.c: revision 1.243
sys/compat/linux/common/linux_misc.c: revision 1.244

Fix info leaks.

Fix stupid bugs in linux_sys_shmctl(): the index could be out of bound
(page fault) and there was no proper locking.
Maybe we should just remove LINUX_SHM_STAT, like compat_linux32.

Remove printf.

When dealing with an unknown value, set -1, to prevent (harmless)
uninitialized accesses later.

Add a default case, don't call sys_ioctl() with an uninitialized 'com'
argument.

Fix error handling, returns an errno, not -1.

Put the printf under DEBUG_LINUX.


Hum, don't forget the 'pid' argument, otherwise we're not gonna go very
far.

Don't read data from userland directly. This simply does not work on any
recent x86 CPU (thanks to SMAP) and all architectures that forbid direct
access to userland from the kernel. But I guess no one noticed because no
one ever uses compat_linux, right?

Hum, don't pass an mbuf to realloc(). Inspired from copyin32_msg_control().

Fix memory leak.

I don't see the point in having this useless printf, but add a '\n' to it,
so that it at least displays useless stuff correctly.

Hum, remove incorrect assignment. Userland could have passed a smaller
namelen, and the uninitialized bytes from sb_data were being used later in
the network stack.
 1.151.2.1 14-Dec-2020  thorpej Sync w/ HEAD.
 1.155.6.1 02-Aug-2025  perseant Sync with HEAD
 1.27 28-Jun-2025  christos PR/59486: csaba mate: Ignore IP_MULTICAST_ALL, since we don't have it.
Also, add -3 to return ENOPROTOOPT, more options and consistently whitespace
after define (the majority had define<space> so make them all the samr)
 1.26 27-Jun-2025  christos PR/59486: csaba mate: Ignore IP_MULTICAST_ALL, since we don't have it.
 1.25 23-Sep-2021  ryo branches: 1.25.10;
add support COMPAT_LINUX for aarch64
 1.24 24-Aug-2019  maxv Don't read data from userland directly. This simply does not work on any
recent x86 CPU (thanks to SMAP) and all architectures that forbid direct
access to userland from the kernel. But I guess no one noticed because no
one ever uses compat_linux, right?
 1.23 03-Feb-2017  christos branches: 1.23.6; 1.23.14; 1.23.18;
add sendmmsg and recvmmsg
 1.22 27-Jan-2014  njoly branches: 1.22.4; 1.22.6; 1.22.10; 1.22.14; 1.22.16;
Add basic IPV6 level socket options support (IPV6_V6ONLY).
 1.21 30-Jun-2011  wiz branches: 1.21.2; 1.21.12; 1.21.16;
dependant -> dependent
 1.20 02-Nov-2010  chs update linux_sys_socket() to understand the flags that are now
included in the "type" parameter. in linux_sys_sendmsg(),
if we see an SCM_CREDENTIALS control message, just drop it
instead of giving an error. the linux and native versions of
the cred-passing operation are very different and some apps
(eg. linux pulseaudio library talking to a native server)
will work without the control data.
 1.19 28-Nov-2009  dsl branches: 1.19.2; 1.19.4;
Add LINUX_SIOCGIFMTU and LINUX_IP_HDRINCL support.
Fixes part of PR/31358
The other parts are rather too intrusive to be fixed as in the PR.
 1.18 17-Jun-2009  njoly Add a new linux_msghdr structure, as its size differs on 64bit archs.
Do the needed conversions in sendmsg/recvmsg syscalls, and adjust
their definitions accordingly.
 1.17 16-Jun-2009  njoly Add LINUX_CMSG_{SPACE,LEN} macros. Use then when calculating the
msg_controllen size, when converting the control message buffer from
native (previous version was missing the linux_cmsghdr size).
 1.16 28-Apr-2008  martin branches: 1.16.14;
Remove clause 3 and 4 from TNF licenses
 1.15 01-Jul-2007  dsl branches: 1.15.28; 1.15.30; 1.15.32;
Fix long-term breakage in the definition of 'control' data for linux.
cmsg->cmsg_len is 'size_t' not 'socklen_t' - so it is 8 bytes on 64bit
platforms instead of 4. There is also never padding after the header.
Redo linux sendmsg() so that it stands a chance of getting it right.
Redo linux recvmsg() so that it process control data directly from the mbuf
list. Allowing it to hack the data without using the stackgap.
 1.14 04-Mar-2007  christos branches: 1.14.2; 1.14.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.13 11-Dec-2005  christos branches: 1.13.26;
merge ktrace-lwp.
 1.12 03-May-2005  manu branches: 1.12.2;
First work on COMPAT_LINUX/amd64
Process startup and dynamiclinking work, but processes hang due to
Linux arch_prctl(2) not being really supported yet.
 1.11 27-Jul-2003  jdolecek More complete sendmsg(2) and recvmsg(2) emulation:
* translate MSG_* flags
* rewrite CMSG level/type to appropriate NetBSD value on input, and to Linux
value on output
* handle different CMSG_DATA alignment for some archs

This fixes SCM_RIGHTS passing. Other SCM_* types are not supported -
the set is different on NetBSD and Linux. SCM_TIMESTAMP doesn't seem
to be actually implemented in Linux 2.5.15, so it's not supported
for Linux binaries either (for now).

PR: 21577 by Todd Vierling
 1.10 14-Jan-2002  bjh21 branches: 1.10.10; 1.10.16;
Crude first cut at ARMLinux binary compatibility. Successfully runs
"/emul/linux/bin/echo hello, world", dynamically linked.
 1.9 22-Sep-2001  manu Enable Mips Linux emulation in header files
 1.8 19-Jan-2001  manu branches: 1.8.2; 1.8.4; 1.8.6;
Added Linux compatibility support for powerpc ports
 1.7 15-Dec-1998  itohy branches: 1.7.8;
Added linux compat support on m68k ports.
 1.6 04-Oct-1998  fvdl Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.5 03-Oct-1998  christos Attempt to fix the mess.
 1.4 01-Oct-1998  erh Split linux_socket.h into i386 and common parts.
 1.3 28-May-1995  mycroft Convert TCP socket options.
 1.2 28-May-1995  mycroft Convert IP socket options.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.7.8.1 11-Feb-2001  bouyer Sync with HEAD.
 1.8.6.1 01-Oct-2001  fvdl Catch up with -current.
 1.8.4.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.8.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.8.2.2 28-Feb-2002  nathanw Catch up to -current.
 1.8.2.1 26-Sep-2001  nathanw Catch up to -current.
Again.
 1.10.16.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.10.16.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.10.16.2 18-Sep-2004  skrll Sync with HEAD.
 1.10.16.1 03-Aug-2004  skrll Sync with HEAD
 1.10.10.1 22-Oct-2003  jmc Pullup rev 1.11 (requested by tv in ticket #1425)

More complete sendmsg(2) and recvmsg(2) emulation:
* translate MSG_* flags
* rewrite CMSG level/type to appropriate NetBSD value on input,
and to Linux value on output
* handle different CMSG_DATA alignment for some archs

This fixes SCM_RIGHTS passing. Other SCM_* types are not supported -
the set is different on NetBSD and Linux. SCM_TIMESTAMP doesn't seem
to be actually implemented in Linux 2.5.15, so it's not supported
for Linux binaries either (for now).
 1.12.2.1 03-Sep-2007  yamt sync with head.
 1.13.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.14.4.1 11-Jul-2007  mjf Sync with head.
 1.14.2.1 15-Jul-2007  ad Sync with head.
 1.15.32.3 11-Mar-2010  yamt sync with head
 1.15.32.2 20-Jun-2009  yamt sync with head
 1.15.32.1 16-May-2008  yamt sync with head.
 1.15.30.1 18-May-2008  yamt sync with head.
 1.15.28.1 02-Jun-2008  mjf Sync with HEAD.
 1.16.14.1 23-Jul-2009  jym Sync with HEAD.
 1.19.4.1 05-Mar-2011  rmind sync with head
 1.19.2.1 06-Nov-2010  uebayasi Sync with HEAD.
 1.21.16.1 18-May-2014  rmind sync with head
 1.21.12.2 03-Dec-2017  jdolecek update from HEAD
 1.21.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.21.2.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.22.16.1 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1720:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149 (patch)
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54 (patch)

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.22.14.1 21-Apr-2017  bouyer Sync with HEAD
 1.22.10.1 20-Mar-2017  pgoyette Sync with HEAD
 1.22.6.1 05-Feb-2017  skrll Sync with HEAD
 1.22.4.1 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1720:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149 (patch)
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54 (patch)

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.23.18.1 13-Sep-2019  martin Pull up following revision(s) (requested by maxv in ticket #194):

sys/compat/linux/common/linux_socket.c: revision 1.146
sys/compat/linux/common/linux_socket.c: revision 1.147
sys/compat/linux/common/linux_socket.c: revision 1.148
sys/compat/linux/common/linux_socket.c: revision 1.149
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.59
sys/compat/linux32/common/linux32_sysinfo.c: revision 1.8
sys/kern/sysv_shm.c: revision 1.138
sys/compat/linux/common/linux_file64.c: revision 1.61
sys/compat/linux/common/linux_file64.c: revision 1.62
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.58
sys/compat/linux32/common/linux32_dirent.c: revision 1.20
sys/compat/linux32/common/linux32_utsname.c: revision 1.10
sys/compat/linux/common/linux_termios.h: revision 1.22
sys/compat/linux32/common/linux32_termios.c: revision 1.15
sys/compat/linux32/common/linux32_misc.c: revision 1.27
sys/compat/linux32/common/linux32_ioctl.c: revision 1.14
sys/compat/linux/common/linux_statfs.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.57
sys/compat/linux/common/linux_fcntl.h: revision 1.18
sys/compat/linux/common/linux_socket.h: revision 1.24
sys/sys/shm.h: revision 1.54
sys/compat/ossaudio/ossaudio.c: revision 1.75
sys/compat/linux32/common/linux32_signal.c: revision 1.20
sys/miscfs/procfs/procfs_linux.c: revision 1.75
sys/compat/linux/common/linux_signal.c: revision 1.81
sys/compat/linux/common/linux_termios.c: revision 1.38
sys/compat/linux/common/linux_misc.c: revision 1.241
sys/compat/linux/common/linux_misc.c: revision 1.242
sys/compat/linux/common/linux_misc.c: revision 1.243
sys/compat/linux/common/linux_misc.c: revision 1.244

Fix info leaks.

Fix stupid bugs in linux_sys_shmctl(): the index could be out of bound
(page fault) and there was no proper locking.
Maybe we should just remove LINUX_SHM_STAT, like compat_linux32.

Remove printf.

When dealing with an unknown value, set -1, to prevent (harmless)
uninitialized accesses later.

Add a default case, don't call sys_ioctl() with an uninitialized 'com'
argument.

Fix error handling, returns an errno, not -1.

Put the printf under DEBUG_LINUX.


Hum, don't forget the 'pid' argument, otherwise we're not gonna go very
far.

Don't read data from userland directly. This simply does not work on any
recent x86 CPU (thanks to SMAP) and all architectures that forbid direct
access to userland from the kernel. But I guess no one noticed because no
one ever uses compat_linux, right?

Hum, don't pass an mbuf to realloc(). Inspired from copyin32_msg_control().

Fix memory leak.

I don't see the point in having this useless printf, but add a '\n' to it,
so that it at least displays useless stuff correctly.

Hum, remove incorrect assignment. Userland could have passed a smaller
namelen, and the uninitialized bytes from sb_data were being used later in
the network stack.
 1.23.14.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.23.6.1 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1487:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.25.10.1 02-Aug-2025  perseant Sync with HEAD
 1.1 25-Jan-2014  njoly branches: 1.1.4; 1.1.6; 1.1.10;
Update linux socket socket options (SO_*). Add common version to its
own file (linux_socket_generic.h); use it for all but alpha and mips.
 1.1.10.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.10.1 25-Jan-2014  tls file linux_socket_generic.h was added on branch tls-maxphys on 2014-08-20 00:03:32 +0000
 1.1.6.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.1.6.1 25-Jan-2014  yamt file linux_socket_generic.h was added on branch yamt-pagecache on 2014-05-22 11:40:17 +0000
 1.1.4.2 18-May-2014  rmind sync with head
 1.1.4.1 25-Jan-2014  rmind file linux_socket_generic.h was added on branch rmind-smpnet on 2014-05-18 17:45:32 +0000
 1.49 23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.48 09-Feb-2017  christos use proper arg functions, remove bogus ones.
 1.47 03-Feb-2017  christos add sendmmsg and recvmmsg
 1.46 03-Feb-2017  christos handle accept4 for i386
 1.45 09-Nov-2014  maxv branches: 1.45.2; 1.45.4; 1.45.6;
Do not uselessly include <sys/malloc.h>.
 1.44 21-Jun-2014  maxv branches: 1.44.2;
If SCARG(uap, what) = 0, copyin() will copy (size_t)-1 bytes, and it's not
a good idea; but not proven harmful.

With the help of njoly@
 1.43 27-Dec-2013  njoly branches: 1.43.2;
Rename ipcall/socketcall specific defines to avoid conflict with
syscalls definitions. No functional changes.
 1.42 22-Jun-2012  martin branches: 1.42.2; 1.42.4;
From the "parse errors that you just do not see as a human" department:
build fix.
 1.41 21-Jun-2012  christos fix token pasting.
 1.40 20-Jun-2012  christos print proper ktruser names depending on the emulation.
 1.39 03-Jul-2008  njoly branches: 1.39.6; 1.39.20; 1.39.30; 1.39.36; 1.39.40; 1.39.42; 1.39.44;
Fix SIOCGIFCONF ioctl for 64bit platforms. Add a new linux_ifreq
structure and linux_getifconf function (cleaned up version from
compat_ifconf).

While here, update linux_getifhwaddr to use the new structure.

Ok by christos.
 1.38 28-Apr-2008  martin branches: 1.38.2; 1.38.4;
Remove clause 3 and 4 from TNF licenses
 1.37 20-Dec-2007  dsl branches: 1.37.6; 1.37.8; 1.37.10;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.36 08-Dec-2007  dsl branches: 1.36.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.35 15-Aug-2007  ad branches: 1.35.2; 1.35.10;
Changes to make ktrace LKM friendly and reduce ifdef KTRACE. Proposed
on tech-kern.
 1.34 02-Jun-2007  yamt branches: 1.34.2; 1.34.6;
wrap #include "opt_ktrace.h" by #ifdef _KERNEL_OPT.
 1.33 01-Jun-2007  dsl (Ab)use a KTR_USER trace entry for the linux socket command and arguments.
 1.32 04-Mar-2007  christos branches: 1.32.2; 1.32.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.31 09-Feb-2007  ad branches: 1.31.2;
Merge newlock2 to head.
 1.30 11-Dec-2005  christos branches: 1.30.20;
merge ktrace-lwp.
 1.29 29-May-2005  christos branches: 1.29.2;
- sprinkle const.
- add XXXUNCONST to the emul_find() pbuf argument free'ing. XXX: this needs
an api change.
- avoid variable shadowing.
 1.28 03-May-2005  manu First work on COMPAT_LINUX/amd64
Process startup and dynamiclinking work, but processes hang due to
Linux arch_prctl(2) not being really supported yet.
 1.27 05-Sep-2004  jdolecek improve the (#ifdef DEBUG_LINUX) socketcall argument dump code:
- print the socketcall type
- special case socket(2) call, it's also the only one with first argument
not being a socket descriptor
- only dump the relevant part of linux_socketcall_dummy_args, instead
of always the whole structure
 1.26 29-Aug-2004  jdolecek dump socketcall data #ifdef DEBUG_LINUX
 1.25 18-Jan-2003  thorpej branches: 1.25.2;
Merge the nathanw_sa branch.
 1.24 29-Mar-2002  christos - #undef DPRINTF for files that are included from other files.
- more debugging for socketcalls
- fix sa_len if AF_INET; somehow we get passed 28 instead of 16?
 1.23 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.22 22-Jul-2001  jdolecek make linux_socketcall_argsize[] static const
 1.21 04-Jul-2001  jdolecek branches: 1.21.2;
Do address family (AF_*) number translation for socket system calls which
pass socket address in our or out. This makes Linux programs using IPv6
working under emulation. This addresses kern/13279 by Jun-ichiro itojun Hagino.

Change sendmsg()/recvmsg() to expect the control information
to be passed the standard way (not 4.3BSD one, imlied by compat_43 code
or MSG_COMPAT). Linux uses different (arguably broken) CMSG_ALIGN() on some
architectures unfortunately, that would need to be handled eventually.

Also provide some other trivial stubs (like linux_sys_send()) to avoid
unneeded dependance on uipc_syscalls_43.c.
 1.20 22-Jun-2001  jdolecek linux_sys_socketcall(): refuse negative 'what' values
 1.19 25-Mar-1999  sommerfe branches: 1.19.20;
commit fix to PR7072: emulate linux non-blocking connect behavior more correctly
 1.18 04-Oct-1998  fvdl Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.17 03-Oct-1998  christos Attempt to fix the mess.
 1.16 01-Oct-1998  erh Split linux/compat/linux_socket.c into common and multi-architechture parts. linux_socketcall.c contains the socketcall multiplexer.
 1.15 22-Dec-1996  fvdl Make this compile again, including Politically Correct const handling.
 1.14 05-Apr-1996  christos Prototyping changes.
 1.13 08-Mar-1996  mycroft Separate ioctl emulation by group. Add (minimal) audio emulation.
 1.12 07-Oct-1995  mycroft Prefix names of system call implementation functions with `sys_'.
 1.11 19-Sep-1995  thorpej Make system calls conform to a standard prototype and bring those
prototypes into scope.
 1.10 14-Aug-1995  mycroft Rearrange #includes.
 1.9 24-Jun-1995  christos Use compat_util.[ch].
 1.8 22-Jun-1995  fvdl * Changed to use generic ELF code from kern/exec_elf.c (which was taken
from the svr4 exec code plus the linux compat mods)
* Include file change
* Add multicast sockopts (from John Brezak)
 1.7 28-May-1995  mycroft Need netinet/tcp.h.
 1.6 28-May-1995  mycroft Convert TCP socket options.
 1.5 28-May-1995  mycroft Fill in `name' argument to getsockopt() correctly.
 1.4 28-May-1995  mycroft Fix typo.
 1.3 28-May-1995  mycroft Convert IP socket options.
 1.2 28-May-1995  mycroft Get rid of damned `static's.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.19.20.5 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.19.20.4 17-Apr-2002  nathanw Catch up to -current.
 1.19.20.3 14-Nov-2001  nathanw Catch up to -current.
 1.19.20.2 24-Aug-2001  nathanw Catch up with -current.
 1.19.20.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.21.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.21.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.21.2.1 03-Aug-2001  lukem update to -current
 1.25.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.25.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.25.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.25.2.1 03-Sep-2004  skrll Sync with HEAD
 1.29.2.3 21-Jan-2008  yamt sync with head
 1.29.2.2 03-Sep-2007  yamt sync with head.
 1.29.2.1 26-Feb-2007  yamt sync with head.
 1.30.20.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.31.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.32.4.1 11-Jul-2007  mjf Sync with head.
 1.32.2.2 20-Aug-2007  ad Sync with HEAD.
 1.32.2.1 09-Jun-2007  ad Sync with head.
 1.34.6.2 09-Dec-2007  jmcneill Sync with HEAD.
 1.34.6.1 16-Aug-2007  jmcneill Sync with HEAD.
 1.34.2.1 03-Sep-2007  skrll Sync with HEAD.
 1.35.10.1 26-Dec-2007  ad Sync with head.
 1.35.2.1 09-Jan-2008  matt sync with HEAD
 1.36.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.37.10.2 04-May-2009  yamt sync with head.
 1.37.10.1 16-May-2008  yamt sync with head.
 1.37.8.1 18-May-2008  yamt sync with head.
 1.37.6.2 28-Sep-2008  mjf Sync with HEAD.
 1.37.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.38.4.1 03-Jul-2008  simonb Sync with head.
 1.38.2.3 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.38.2.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.38.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.39.44.1 08-Aug-2014  msaitoh Pull up following revision(s) (requested by maxv in ticket #1104):
sys/compat/linux32/common/linux32_socketcall.c: revision 1.9
sys/compat/linux/common/linux_socketcall.c: revision 1.44
If SCARG(uap, what) = 0, copyin() will copy (size_t)-1 bytes, and it's not
a good idea; but not proven harmful.
With the help of njoly@
 1.39.42.1 08-Aug-2014  msaitoh Pull up following revision(s) (requested by maxv in ticket #1916):
sys/compat/linux32/common/linux32_socketcall.c: revision 1.9
sys/compat/linux/common/linux_socketcall.c: revision 1.44
If SCARG(uap, what) = 0, copyin() will copy (size_t)-1 bytes, and it's not
a good idea; but not proven harmful.
With the help of njoly@
 1.39.40.1 08-Aug-2014  msaitoh Pull up following revision(s) (requested by maxv in ticket #1104):
sys/compat/linux32/common/linux32_socketcall.c: revision 1.9
sys/compat/linux/common/linux_socketcall.c: revision 1.44
If SCARG(uap, what) = 0, copyin() will copy (size_t)-1 bytes, and it's not
a good idea; but not proven harmful.
With the help of njoly@
 1.39.36.1 08-Aug-2014  msaitoh Pull up following revision(s) (requested by maxv in ticket #1104):
sys/compat/linux32/common/linux32_socketcall.c: revision 1.9
sys/compat/linux/common/linux_socketcall.c: revision 1.44
If SCARG(uap, what) = 0, copyin() will copy (size_t)-1 bytes, and it's not
a good idea; but not proven harmful.
With the help of njoly@
 1.39.30.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.39.30.1 30-Oct-2012  yamt sync with head
 1.39.20.1 08-Aug-2014  msaitoh Pull up following revision(s) (requested by maxv in ticket #1916):
sys/compat/linux32/common/linux32_socketcall.c: revision 1.9
sys/compat/linux/common/linux_socketcall.c: revision 1.44
If SCARG(uap, what) = 0, copyin() will copy (size_t)-1 bytes, and it's not
a good idea; but not proven harmful.
With the help of njoly@
 1.39.6.1 08-Aug-2014  msaitoh Pull up following revision(s) (requested by maxv in ticket #1916):
sys/compat/linux32/common/linux32_socketcall.c: revision 1.9
sys/compat/linux/common/linux_socketcall.c: revision 1.44
If SCARG(uap, what) = 0, copyin() will copy (size_t)-1 bytes, and it's not
a good idea; but not proven harmful.
With the help of njoly@
 1.42.4.1 18-May-2014  rmind sync with head
 1.42.2.2 03-Dec-2017  jdolecek update from HEAD
 1.42.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.43.2.1 10-Aug-2014  tls Rebase.
 1.44.2.1 17-Jan-2015  martin Pull up following revision(s) (requested by maxv in ticket #427):
sys/compat/svr4/svr4_schedctl.c: revision 1.8
sys/netinet/tcp_timer.c: revision 1.88
sys/miscfs/genfs/layer_vfsops.c: revision 1.45
sys/compat/svr4/svr4_ioctl.c: revision 1.37
sys/ufs/chfs/chfs_vfsops.c: revision 1.14
sys/miscfs/fdesc/fdesc_vfsops.c: revision 1.91
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.30
sys/compat/common/kern_time_50.c: revision 1.28
sys/netinet6/ip6_forward.c: revision 1.74
sys/miscfs/umapfs/umap_vnops.c: revision 1.57
sys/compat/svr4/svr4_fcntl.c: revision 1.74
distrib/sets/lists/comp/mi: revision 1.1931
sys/netinet6/udp6_output.c: revision 1.46
sys/fs/puffs/puffs_compat.c: revision 1.3
sys/fs/udf/udf_rename.c: revision 1.11
sys/compat/svr4/svr4_filio.c: revision 1.24
sys/fs/udf/udf_rename.c: revision 1.12
sys/netinet/tcp_usrreq.c: revision 1.202
sys/miscfs/umapfs/umap_subr.c: revision 1.29
sys/compat/linux/common/linux_fadvise64.c: revision 1.3
sys/netinet/if_atm.c: revision 1.34
sys/miscfs/procfs/procfs_subr.c: revision 1.106
sys/miscfs/genfs/layer_subr.c: revision 1.37
sys/netinet/tcp_sack.c: revision 1.30
sys/compat/freebsd/freebsd_misc.c: revision 1.33
sys/compat/freebsd/freebsd_file.c: revision 1.33
sys/ufs/chfs/chfs_vnode.c: revision 1.12
sys/compat/svr4/svr4_ttold.c: revision 1.34
sys/compat/linux/common/linux_file.c: revision 1.114
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.43
sys/compat/linux/common/linux_signal.c: revision 1.76
sys/compat/common/compat_util.c: revision 1.46
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.18
sys/compat/svr4/svr4_sockio.c: revision 1.36
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.32
sys/compat/svr4/svr4_signal.c: revision 1.66
sys/kern/kern_exec.c: revision 1.410
sys/fs/puffs/puffs_vfsops.c: revision 1.115
sys/compat/svr4/svr4_exec_elf64.c: revision 1.15
sys/compat/linux/arch/i386/linux_machdep.c: revision 1.159
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.50
sys/compat/linux32/common/linux32_misc.c: revision 1.24
sys/netinet/in_pcb.c: revision 1.153
sys/sys/malloc.h: revision 1.116
sys/compat/common/if_43.c: revision 1.9
share/man/man9/Makefile: revision 1.380
sys/netinet/tcp_vtw.c: revision 1.12
sys/miscfs/umapfs/umap_vfsops.c: revision 1.95
sys/ufs/ext2fs/ext2fs_vfsops.c: revision 1.186
sys/compat/common/uipc_syscalls_43.c: revision 1.46
sys/ufs/ext2fs/ext2fs_vnops.c: revision 1.115
sys/fs/puffs/puffs_msgif.c: revision 1.97
sys/compat/svr4/svr4_ipc.c: revision 1.27
sys/compat/linux/common/linux_exec.c: revision 1.117
sys/ufs/ext2fs/ext2fs_readwrite.c: revision 1.66
sys/netinet/tcp_output.c: revision 1.179
sys/compat/svr4/svr4_termios.c: revision 1.28
sys/fs/udf/udf_strat_bootstrap.c: revision 1.4
sys/fs/puffs/puffs_subr.c: revision 1.67
sys/fs/puffs/puffs_node.c: revision 1.36
sys/miscfs/overlay/overlay_vnops.c: revision 1.21
sys/fs/cd9660/cd9660_node.c: revision 1.34
sys/netinet/raw_ip.c: revision 1.146
sys/sys/mallocvar.h: revision 1.13
sys/miscfs/overlay/overlay_vfsops.c: revision 1.63
share/man/man9/malloc.9: revision 1.50
sys/netinet6/dest6.c: revision 1.18
sys/compat/linux/common/linux_uselib.c: revision 1.33
sys/compat/linux/common/linux_socket.c: revision 1.120
share/man/man9/malloc.9: revision 1.51
sys/netinet/tcp_subr.c: revision 1.257
sys/compat/linux/common/linux_socketcall.c: revision 1.45
sys/compat/linux/common/linux_fadvise64_64.c: revision 1.3
sys/compat/freebsd/freebsd_ipc.c: revision 1.17
sys/compat/linux/common/linux_misc_notalpha.c: revision 1.109
sys/compat/linux/arch/alpha/linux_pipe.c: revision 1.17
sys/netinet6/in6_pcb.c: revision 1.132
sys/netinet6/in6_ifattach.c: revision 1.94
sys/compat/svr4/svr4_exec_elf32.c: revision 1.15
sys/miscfs/nullfs/null_vfsops.c: revision 1.90
sys/fs/cd9660/cd9660_util.c: revision 1.12
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.48
sys/compat/freebsd/freebsd_exec_elf32.c: revision 1.20
sys/miscfs/procfs/procfs_vfsops.c: revision 1.94
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.28
sys/compat/linux/common/linux_sched.c: revision 1.67
sys/compat/linux/common/linux_exec_aout.c: revision 1.67
sys/compat/linux/common/linux_pipe.c: revision 1.67
sys/compat/linux/common/linux_llseek.c: revision 1.34
sys/compat/linux/arch/mips/linux_ptrace.c: revision 1.10
Do not uselessly include <sys/malloc.h>.
Cleanup:
- remove struct kmembuckets (dead)
- correctly deadify MALLOC_XX
- remove MALLOC_DEFINE_LIMIT and MALLOC_JUSTDEFINE_LIMIT (dead)
- remove malloc_roundup(), malloc_type_setlimit(), MALLOC_DEFINE_LIMIT()
and MALLOC_JUSTDEFINE_LIMIT() from man 9 malloc
New sentence, new line. Bump date for previous.
Obsolete malloc_roundup(9), malloc_type_setlimit(9) and MALLOC_DEFINE_LIMIT(9)
man pages.
 1.45.6.1 21-Apr-2017  bouyer Sync with HEAD
 1.45.4.1 20-Mar-2017  pgoyette Sync with HEAD
 1.45.2.2 28-Aug-2017  skrll Sync with HEAD
 1.45.2.1 05-Feb-2017  skrll Sync with HEAD
 1.22 23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.21 09-Feb-2017  christos use proper arg functions, remove bogus ones.
 1.20 03-Feb-2017  christos New versions of linux on arm and others have both socketcall and separate
syscalls...
 1.19 03-Feb-2017  christos add sendmmsg and recvmmsg
 1.18 03-Feb-2017  christos handle accept4 for i386
 1.17 27-Dec-2013  njoly branches: 1.17.6; 1.17.10; 1.17.14;
Rename ipcall/socketcall specific defines to avoid conflict with
syscalls definitions. No functional changes.
 1.16 17-Jun-2009  njoly branches: 1.16.12; 1.16.22; 1.16.26;
Add a new linux_msghdr structure, as its size differs on 64bit archs.
Do the needed conversions in sendmsg/recvmsg syscalls, and adjust
their definitions accordingly.
 1.15 28-Apr-2008  martin branches: 1.15.14;
Remove clause 3 and 4 from TNF licenses
 1.14 20-Dec-2007  dsl branches: 1.14.6; 1.14.8; 1.14.10;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.13 04-Dec-2007  dsl branches: 1.13.4;
Remove all the __P
 1.12 04-Mar-2007  christos branches: 1.12.14; 1.12.16; 1.12.22; 1.12.24;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.11 09-Feb-2006  manu branches: 1.11.20;
Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.10 11-Dec-2005  christos branches: 1.10.2; 1.10.4; 1.10.6;
merge ktrace-lwp.
 1.9 03-May-2005  manu branches: 1.9.2;
First work on COMPAT_LINUX/amd64
Process startup and dynamiclinking work, but processes hang due to
Linux arch_prctl(2) not being really supported yet.
 1.8 26-Feb-2005  perry nuke trailing whitespace
 1.7 18-Jan-2003  thorpej branches: 1.7.2; 1.7.10; 1.7.12;
Merge the nathanw_sa branch.
 1.6 04-Jul-2001  jdolecek Do address family (AF_*) number translation for socket system calls which
pass socket address in our or out. This makes Linux programs using IPv6
working under emulation. This addresses kern/13279 by Jun-ichiro itojun Hagino.

Change sendmsg()/recvmsg() to expect the control information
to be passed the standard way (not 4.3BSD one, imlied by compat_43 code
or MSG_COMPAT). Linux uses different (arguably broken) CMSG_ALIGN() on some
architectures unfortunately, that would need to be handled eventually.

Also provide some other trivial stubs (like linux_sys_send()) to avoid
unneeded dependance on uipc_syscalls_43.c.
 1.5 25-Mar-1999  sommerfe branches: 1.5.20;
commit fix to PR7072: emulate linux non-blocking connect behavior more correctly
 1.4 04-Oct-1998  fvdl Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.3 03-Oct-1998  christos Attempt to fix the mess.
 1.2 01-Oct-1998  erh Move compat/linux/linux_socketcall.h to multiarch. Defines for the socketcall multiplexer.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.5.20.2 24-Aug-2001  nathanw Catch up with -current.
 1.5.20.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.7.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.7.10.1 29-Apr-2005  kent sync with -current
 1.7.2.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.7.2.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.9.2.4 21-Jan-2008  yamt sync with head
 1.9.2.3 07-Dec-2007  yamt sync with head
 1.9.2.2 03-Sep-2007  yamt sync with head.
 1.9.2.1 21-Jun-2006  yamt sync with head.
 1.10.6.1 22-Apr-2006  simonb Sync with head.
 1.10.4.1 09-Sep-2006  rpaulo sync with head
 1.10.2.1 18-Feb-2006  yamt sync with head.
 1.11.20.1 12-Mar-2007  rmind Sync with HEAD.
 1.12.24.2 26-Dec-2007  ad Sync with head.
 1.12.24.1 08-Dec-2007  ad Sync with head.
 1.12.22.2 27-Dec-2007  mjf Sync with HEAD.
 1.12.22.1 08-Dec-2007  mjf Sync with HEAD.
 1.12.16.1 09-Jan-2008  matt sync with HEAD
 1.12.14.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.13.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.14.10.2 20-Jun-2009  yamt sync with head
 1.14.10.1 16-May-2008  yamt sync with head.
 1.14.8.1 18-May-2008  yamt sync with head.
 1.14.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.15.14.1 23-Jul-2009  jym Sync with HEAD.
 1.16.26.1 18-May-2014  rmind sync with head
 1.16.22.2 03-Dec-2017  jdolecek update from HEAD
 1.16.22.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.16.12.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.17.14.1 21-Apr-2017  bouyer Sync with HEAD
 1.17.10.1 20-Mar-2017  pgoyette Sync with HEAD
 1.17.6.2 28-Aug-2017  skrll Sync with HEAD
 1.17.6.1 05-Feb-2017  skrll Sync with HEAD
 1.20 01-Oct-2024  riastradh sys/compat/linux/common: Nix trailing whitespace, and one blank line.

No functional change intended.
 1.19 11-Jan-2013  christos branches: 1.19.74;
Use copyin/copyout and linux-specific ifreq structures (they are the same
as the netbsd ones, but this disconnects them)
 1.18 28-Nov-2009  dsl branches: 1.18.12; 1.18.22;
Add LINUX_SIOCGIFMTU and LINUX_IP_HDRINCL support.
Fixes part of PR/31358
The other parts are rather too intrusive to be fixed as in the PR.
 1.17 13-Nov-2009  joerg Provide SIOCGIFNAME.
 1.16 03-Jul-2008  njoly branches: 1.16.6; 1.16.14;
Fix SIOCGIFCONF ioctl for 64bit platforms. Add a new linux_ifreq
structure and linux_getifconf function (cleaned up version from
compat_ifconf).

While here, update linux_getifhwaddr to use the new structure.

Ok by christos.
 1.15 28-Apr-2008  martin branches: 1.15.2; 1.15.4;
Remove clause 3 and 4 from TNF licenses
 1.14 22-Dec-2000  fvdl branches: 1.14.122; 1.14.124; 1.14.126;
Add SIOCGIFBR and SIOCSIFBR (more for reference than anything, currently).
 1.13 21-Dec-2000  fvdl Fix yet another typo.
 1.12 19-Dec-2000  fvdl Fix another pasto.
 1.11 18-Dec-2000  fvdl Fix pasto in previous.
 1.10 18-Dec-2000  fvdl Define LINUX_SIOCDEVPRIVATE (currently not emulated for sockets).
 1.9 17-Jul-1999  jtk branches: 1.9.2; 1.9.12;
add LINUX_SIOCGIFHWADDR
 1.8 04-Oct-1998  fvdl branches: 1.8.6; 1.8.8;
Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.7 03-Oct-1998  christos Attempt to fix the mess.
 1.6 01-Oct-1998  erh Move compat/linux/linux_sockio.h to common.
 1.5 08-Mar-1996  mycroft Separate ioctl emulation by group. Add (minimal) audio emulation.
 1.4 27-Feb-1996  mycroft Map SIOCGIFFLAGS and SIOCGIFADDR (et al).
 1.3 27-Feb-1996  mycroft Map SIOCGIFCONF.
 1.2 22-Jun-1995  fvdl * Changed to use generic ELF code from kern/exec_elf.c (which was taken
from the svr4 exec code plus the linux compat mods)
* Include file change
* Add multicast sockopts (from John Brezak)
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.8.8.1 02-Aug-1999  thorpej Update from trunk.
 1.8.6.1 15-Jan-2000  he Pull up revision 1.9 (requested by joda):
Implement the SIOCGIFHWADDR Linux ioctl, allowing installation
of Matlab (after convincing the install script it is running on
a supported platform).
 1.9.12.1 30-Mar-2001  he Pull up revisions 1.10-1.14 (requested by fvdl):
Add some required Linux emulation bits to support the Linux
version of VMware.
 1.9.2.1 05-Jan-2001  bouyer Sync with HEAD
 1.14.126.3 11-Mar-2010  yamt sync with head
 1.14.126.2 04-May-2009  yamt sync with head.
 1.14.126.1 16-May-2008  yamt sync with head.
 1.14.124.1 18-May-2008  yamt sync with head.
 1.14.122.2 28-Sep-2008  mjf Sync with HEAD.
 1.14.122.1 02-Jun-2008  mjf Sync with HEAD.
 1.15.4.1 03-Jul-2008  simonb Sync with head.
 1.15.2.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.16.14.1 21-Apr-2010  matt sync to netbsd-5
 1.16.6.1 28-Nov-2009  bouyer Pull up following revision(s) (requested by joerg in ticket #1147):
sys/compat/linux32/common/linux32_socket.c: revision 1.11, 1.12
sys/compat/linux/common/linux_socket.c: revision 1.105, 1.106
sys/compat/linux/common/linux_sockio.h: revision 1.17
sys/compat/linux32/common/linux32_sockio.h: revision 1.3
Provide SIOCGIFNAME.
Return the result of copyout. Reminded by Niolas Joly.
 1.18.22.1 25-Feb-2013  tls resync with head
 1.18.12.1 23-Jan-2013  yamt sync with head
 1.19.74.1 02-Aug-2025  perseant Sync with HEAD
 1.7 23-Aug-2019  maxv Fix info leaks.
 1.6 13-Sep-2012  pooka branches: 1.6.12; 1.6.24; 1.6.30; 1.6.38; 1.6.42;
Rename structure members to make the code compile in environments
where "linux" is #defined.
 1.5 02-Nov-2010  chs branches: 1.5.8; 1.5.18;
implement the following syscalls for linux32:
truncate64
ftruncate64
profil
ioperm
iopl
setdomainname
modify_ldt
statfs64
fstatfs64

note that iopl(), ioperm() and modify_ldt() just call
the respective 64-bit handlers, which don't do anything yet.
 1.4 15-Mar-2009  cegger branches: 1.4.2; 1.4.4;
ansify function definitions
 1.3 28-Apr-2008  martin branches: 1.3.8; 1.3.14;
Remove clause 3 and 4 from TNF licenses
 1.2 04-Dec-2007  dsl branches: 1.2.12; 1.2.14; 1.2.16;
Remove all the __P
 1.1 11-Apr-2007  njoly branches: 1.1.4; 1.1.6; 1.1.8; 1.1.10; 1.1.16; 1.1.18; 1.1.20; 1.1.26; 1.1.28;
- Add compat amd64 linux32 statfs support, adapted from PR/35956.
- Move bsd_to_linux_statfs() function to its own file to be shared
between both linux compats.

ok by manu.
 1.1.28.1 08-Dec-2007  ad Sync with head.
 1.1.26.1 08-Dec-2007  mjf Sync with HEAD.
 1.1.20.3 07-Dec-2007  yamt sync with head
 1.1.20.2 03-Sep-2007  yamt sync with head.
 1.1.20.1 11-Apr-2007  yamt file linux_statfs.h was added on branch yamt-lazymbuf on 2007-09-03 14:32:26 +0000
 1.1.18.1 09-Jan-2008  matt sync with HEAD
 1.1.16.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.1.10.2 11-Jul-2007  mjf Sync with head.
 1.1.10.1 11-Apr-2007  mjf file linux_statfs.h was added on branch mjf-ufs-trans on 2007-07-11 20:04:20 +0000
 1.1.8.2 09-Jun-2007  ad Sync with head.
 1.1.8.1 11-Apr-2007  ad file linux_statfs.h was added on branch vmlocking on 2007-06-09 21:37:08 +0000
 1.1.6.2 20-Apr-2007  bouyer Pull up following revision(s) (requested by njoly in ticket #582):
sys/compat/linux32/common/linux32_types.h: revision 1.4 via patch
sys/compat/linux32/arch/amd64/syscalls.master: revision 1.14 via patch
sys/compat/linux/common/linux_statfs.h: revision 1.1 via patch
sys/compat/linux/common/linux_misc.c: revision 1.170 via patch
sys/compat/linux32/common/linux32_misc.c: revision 1.5 via patch
sys/compat/linux32/files.linux32: revision 1.4 via patch
- Add compat amd64 linux32 statfs support, adapted from PR/35956.
- Move bsd_to_linux_statfs() function to its own file to be shared
between both linux compats.
 1.1.6.1 11-Apr-2007  bouyer file linux_statfs.h was added on branch netbsd-4 on 2007-04-20 20:26:04 +0000
 1.1.4.2 15-Apr-2007  yamt sync with head.
 1.1.4.1 11-Apr-2007  yamt file linux_statfs.h was added on branch yamt-idlelwp on 2007-04-15 16:03:14 +0000
 1.2.16.2 04-May-2009  yamt sync with head.
 1.2.16.1 16-May-2008  yamt sync with head.
 1.2.14.1 18-May-2008  yamt sync with head.
 1.2.12.1 02-Jun-2008  mjf Sync with HEAD.
 1.3.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.3.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.4.4.1 05-Mar-2011  rmind sync with head
 1.4.2.1 06-Nov-2010  uebayasi Sync with HEAD.
 1.5.18.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.5.8.1 30-Oct-2012  yamt sync with head
 1.6.42.1 13-Sep-2019  martin Pull up following revision(s) (requested by maxv in ticket #194):

sys/compat/linux/common/linux_socket.c: revision 1.146
sys/compat/linux/common/linux_socket.c: revision 1.147
sys/compat/linux/common/linux_socket.c: revision 1.148
sys/compat/linux/common/linux_socket.c: revision 1.149
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.59
sys/compat/linux32/common/linux32_sysinfo.c: revision 1.8
sys/kern/sysv_shm.c: revision 1.138
sys/compat/linux/common/linux_file64.c: revision 1.61
sys/compat/linux/common/linux_file64.c: revision 1.62
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.58
sys/compat/linux32/common/linux32_dirent.c: revision 1.20
sys/compat/linux32/common/linux32_utsname.c: revision 1.10
sys/compat/linux/common/linux_termios.h: revision 1.22
sys/compat/linux32/common/linux32_termios.c: revision 1.15
sys/compat/linux32/common/linux32_misc.c: revision 1.27
sys/compat/linux32/common/linux32_ioctl.c: revision 1.14
sys/compat/linux/common/linux_statfs.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.57
sys/compat/linux/common/linux_fcntl.h: revision 1.18
sys/compat/linux/common/linux_socket.h: revision 1.24
sys/sys/shm.h: revision 1.54
sys/compat/ossaudio/ossaudio.c: revision 1.75
sys/compat/linux32/common/linux32_signal.c: revision 1.20
sys/miscfs/procfs/procfs_linux.c: revision 1.75
sys/compat/linux/common/linux_signal.c: revision 1.81
sys/compat/linux/common/linux_termios.c: revision 1.38
sys/compat/linux/common/linux_misc.c: revision 1.241
sys/compat/linux/common/linux_misc.c: revision 1.242
sys/compat/linux/common/linux_misc.c: revision 1.243
sys/compat/linux/common/linux_misc.c: revision 1.244

Fix info leaks.

Fix stupid bugs in linux_sys_shmctl(): the index could be out of bound
(page fault) and there was no proper locking.
Maybe we should just remove LINUX_SHM_STAT, like compat_linux32.

Remove printf.

When dealing with an unknown value, set -1, to prevent (harmless)
uninitialized accesses later.

Add a default case, don't call sys_ioctl() with an uninitialized 'com'
argument.

Fix error handling, returns an errno, not -1.

Put the printf under DEBUG_LINUX.


Hum, don't forget the 'pid' argument, otherwise we're not gonna go very
far.

Don't read data from userland directly. This simply does not work on any
recent x86 CPU (thanks to SMAP) and all architectures that forbid direct
access to userland from the kernel. But I guess no one noticed because no
one ever uses compat_linux, right?

Hum, don't pass an mbuf to realloc(). Inspired from copyin32_msg_control().

Fix memory leak.

I don't see the point in having this useless printf, but add a '\n' to it,
so that it at least displays useless stuff correctly.

Hum, remove incorrect assignment. Userland could have passed a smaller
namelen, and the uninitialized bytes from sb_data were being used later in
the network stack.
 1.6.38.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.6.30.1 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1487:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.6.24.1 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1720:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149 (patch)
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54 (patch)

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.6.12.1 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1720:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149 (patch)
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54 (patch)

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.48 10-Jul-2023  christos Add memfd_create(2) from GSoC 2023 by Theodore Preduta
 1.47 23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.46 21-Mar-2020  pgoyette Deal with having to teardown sysctl entries in multiple sub-trees.

(This used to work, but I broke it recently.)
 1.45 16-Mar-2020  pgoyette Use the module subsystem's ability to process SYSCTL_SETUP() entries to
automate installation of sysctl nodes.

Note that there are still a number of device and pseudo-device modules
that create entries tied to individual device units, rather than to the
module itself. These are not changed.
 1.44 29-Sep-2017  maxv branches: 1.44.4;
Remove compat_linux from the autoload list, and add a sysctl to enable or
disable it - which defaults to disabled. The following command is now
required to use linux binaries:

sysctl -w emul.linux.enabled=1

After a discussion on tech-kern@. All the other ideas to reduce the attack
surface have drawbacks, and this sysctl seems to be the best option.
 1.43 16-May-2014  martin Get rid of all sysc_init_field uses - initialize fields directly in C99
notation.
 1.42 25-Feb-2014  pooka branches: 1.42.2;
Ensure that the top level sysctl nodes (kern, vfs, net, ...) exist before
the sysctl link sets are processed, and remove redundancy.

Shaves >13kB off of an amd64 GENERIC, not to mention >1k duplicate
lines of code.
 1.41 18-Nov-2013  chs claim to be linux 3.11.6 (opensuse 13.1).
 1.40 07-Jul-2010  chs branches: 1.40.8; 1.40.18; 1.40.22;
many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
- support new-style (NPTL) linux pthreads on all platforms.
clone() with CLONE_THREAD uses 1 process with many LWPs
instead of separate processes.
- move the contents of sys__lwp_setprivate() into a new
lwp_setprivate() and use that everywhere.
- update linux_release[] and linux32_release[] to "2.6.18".
- adjust placement of emul fork/exec/exit hooks as needed
and adjust other emul code to match.
- convert all struct emul definitions to use named initializers.
- change the pid allocator to allow multiple pids to refer to the same proc.
- remove a few fields from struct proc that are no longer needed.
- disable the non-functional "vdso" code in linux32/amd64,
glibc works fine without it.
- fix a race in the futex code where we could miss a wakeup after
a requeue operation.
- redo futex locking to be a little more efficient.
 1.39 05-Jan-2009  njoly branches: 1.39.4; 1.39.6;
Make sysctl(2) fails with ENOTDIR (instead of EINVAL) for invalid mib
vector length.
 1.38 19-Nov-2008  ad Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.37 12-Nov-2008  ad Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.
 1.36 18-Jun-2008  tsutsui branches: 1.36.2; 1.36.4;
Include <sys/sched.h> before <sys/syscallargs.h> for cpuset_t.
 1.35 28-Apr-2008  martin branches: 1.35.2; 1.35.4;
Remove clause 3 and 4 from TNF licenses
 1.34 07-Jan-2008  ad branches: 1.34.6; 1.34.8; 1.34.10;
Patch up sysctl locking:

- Lock processes, credentials, filehead etc correctly.
- Acquire a read hold on sysctl_treelock if only doing a query.
- Don't wire down the output buffer. It doesn't work correctly and the code
regularly does long term sleeps with it held - it's not worth it.
- Don't hold locks other than sysctl_lock while doing copyout().
- Drop sysctl_lock while doing copyout / allocating memory in a few places.
- Don't take kernel_lock for sysctl.
- Fix a number of bugs spotted along the way
 1.33 20-Dec-2007  dsl Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.32 19-Oct-2007  njoly branches: 1.32.2; 1.32.4; 1.32.8;
Add compat_linux and exec_linux_elf lkm support for amd64:
- Add needed COMPAT_OSSAUDIO to GENERIC.
- Add missing includes needed by linux_syscallargs.h.
- Add lkm building.
 1.31 15-Aug-2007  ad branches: 1.31.2; 1.31.6;
Changes to make ktrace LKM friendly and reduce ifdef KTRACE. Proposed
on tech-kern.
 1.30 10-May-2007  christos branches: 1.30.2; 1.30.6;
- linux uname -m on x86 returns i{3,4,5,6}86 make it so.
- delete the machine sysctl that never worked, and gc linux_machine.
 1.29 10-May-2007  christos move the #if 0 down a few lines so linux_machine gets initialized. Pointed
out by Joachim K�nig
 1.28 06-May-2007  christos Remove change that obviously was not tested (since it uses LINUX_KERN_VERSION
again, producing EEXIST). There is no machine sysctl in linux that corresponds
to this (at least on my i386 suse box)
 1.27 23-Apr-2007  manu Linux's uname should return x86_64 as machine_arch
 1.26 23-Mar-2007  mrg implement emul.linux.kern.machine, which can be set to "i686", like
some applications seem to want.
 1.25 09-Feb-2007  ad branches: 1.25.2; 1.25.6; 1.25.8; 1.25.10;
Merge newlock2 to head.
 1.24 16-Nov-2006  christos branches: 1.24.2;
__unused removal on arguments; approved by core.
 1.23 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.22 24-Sep-2006  dbj use _KERNEL_OPT instead of _LKM to check whether to include "opt_ktrace.h"
 1.21 24-Sep-2006  dogcow opt_ktrace.h doesn't exist when building LKMs.
 1.20 23-Sep-2006  manu Add sysctl tracing to emulations.
While we are there, fix a bug in FreeBSD sysctl emulation: use copyin for
moving data to the kernel
 1.19 08-Mar-2006  jonathan branches: 1.19.10; 1.19.12;
Rework Linux sysctl()-emulation, so that on amd64, we return the same
Linux kernel-version as on i386 and ppc (currently 2.4.18), and a date
in Feb 2002.

On all other NetBSD platforms we return a Linux-kernel version of
2.0.38 and a date sometime in 2000, which (AFAIK) predates the
existence of amd64, and therefore predates Linux support for amd64.

To me, it makes much more sense to return the same Linux-kernel-version
and date for both 32-bit x86 and 64-bit x86.

Empirically (and not least), this change also allows SuSE 10 amd64
binaries to run under our Linux amd64 binary emulation (both static
and dynamic-linked, given suitable setup) , which they didn't when we
reported a Linux/x86_64 kernel version of 2.0.38.
 1.18 11-Dec-2005  christos branches: 1.18.4; 1.18.6; 1.18.8; 1.18.10;
merge ktrace-lwp.
 1.17 20-Jun-2005  atatat branches: 1.17.2;
Change the rest of the sysctl subsystem to use const consistently.
The __UNCONST macro is now used only where necessary and the RW macros
are gone. Most of the changes here are consumers of the
sysctl_createv(9) interface that now takes a pair of const pointers
which used not to be.
 1.16 25-May-2004  atatat Sysctl descriptions under emul subtree.
 1.15 20-May-2004  atatat Tweak sysctl setup functions (the macros, actually) for use in lkms,
and tweak lkminit_*.c (where applicable) to call them, and to call
sysctl_teardown() when being unloaded.

This consists of (1) making setup functions not be static when being
compiled as lkms (change to sys/sysctl.h), (2) making prototypes
visible for the various setup functions in header files (changes to
various header files), and (3) making simple "load" and "unload"
functions in the actual lkminit stuff.

linux_sysctl.c also needs its root exposed (ie, made not static) for
this (when built as an lkm).
 1.14 27-Apr-2004  atatat Be consistent about using sysc_init_field()
 1.13 24-Mar-2004  atatat branches: 1.13.2;
Tango on sysctl_createv() and flags. The flags have all been renamed,
and sysctl_createv() now uses more arguments.
 1.12 09-Mar-2004  atatat Remove useless comment about stuff that never happened.
 1.11 04-Dec-2003  atatat Dynamic sysctl.

Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.

Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.

All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.

PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
 1.10 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.9 29-Jun-2003  fvdl branches: 1.9.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.8 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.7 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.6 25-Nov-2002  schmonz Report ourselves as Linux 2.4.18 on powerpc, too.
 1.5 04-Apr-2002  tron Set default kernel version of Linux emulation to 2.4.18 on the i386 port.
It has been successfully tested using SuSE 7.3 libraries and binaries with
many applications.
 1.4 02-Apr-2002  jdolecek rename sysctl_linux() to linux_sysctl() and hook it into emul_linux
 1.3 20-Mar-2002  christos emulation specific sysctls. Also change the kernel date to nov 11 as requested
by bad.
 1.2 20-Feb-2002  christos branches: 1.2.2; 1.2.8;
allow writing of kernel.version, kernel.osrelease, kernel.ostype... I might
revert that l8r if I come up with something better.
 1.1 15-Feb-2002  christos s/printf/uprintf/
 1.2.8.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.2.8.2 16-Mar-2002  jdolecek Catch up with -current.
 1.2.8.1 20-Feb-2002  jdolecek file linux_sysctl.c was added on branch kqueue on 2002-03-16 16:00:39 +0000
 1.2.2.7 11-Dec-2002  thorpej Sync with HEAD.
 1.2.2.6 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.2.2.5 17-Apr-2002  nathanw Catch up to -current.
 1.2.2.4 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.2.2.3 28-Feb-2002  nathanw LWPify linux_{set/get}rlimit(); move and LWPify linux_sysctl().
 1.2.2.2 28-Feb-2002  nathanw Catch up to -current.
 1.2.2.1 20-Feb-2002  nathanw file linux_sysctl.c was added on branch nathanw_sa on 2002-02-28 04:12:57 +0000
 1.9.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.9.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.9.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.9.2.2 03-Aug-2004  skrll Sync with HEAD
 1.9.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.13.2.3 26-May-2004  he Pull up revision 1.16 (requested by atatat in ticket #387):
Add sysctl descriptions under emul subtree.
 1.13.2.2 23-May-2004  tron Pull up revision 1.15 (requested by atatat in ticket #374):
Tweak sysctl setup functions (the macros, actually) for use in lkms,
and tweak lkminit_*.c (where applicable) to call them, and to call
sysctl_teardown() when being unloaded.
This consists of (1) making setup functions not be static when being
compiled as lkms (change to sys/sysctl.h), (2) making prototypes
visible for the various setup functions in header files (changes to
various header files), and (3) making simple "load" and "unload"
functions in the actual lkminit stuff.
linux_sysctl.c also needs its root exposed (ie, made not static) for
this (when built as an lkm).
 1.13.2.1 29-Apr-2004  jmc Pullup rev 1.14 (requested by atatat in ticket #206)

Be consistent about using sysc_init_field()
 1.17.2.6 21-Jan-2008  yamt sync with head
 1.17.2.5 27-Oct-2007  yamt sync with head.
 1.17.2.4 03-Sep-2007  yamt sync with head.
 1.17.2.3 26-Feb-2007  yamt sync with head.
 1.17.2.2 30-Dec-2006  yamt sync with head.
 1.17.2.1 21-Jun-2006  yamt sync with head.
 1.18.10.1 19-Apr-2006  elad sync with head.
 1.18.8.1 13-Mar-2006  yamt sync with head.
 1.18.6.1 22-Apr-2006  simonb Sync with head.
 1.18.4.1 09-Sep-2006  rpaulo sync with head
 1.19.12.2 10-Dec-2006  yamt sync with head.
 1.19.12.1 22-Oct-2006  yamt sync with head
 1.19.10.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.19.10.1 18-Nov-2006  ad Sync with head.
 1.24.2.1 29-Apr-2007  bouyer Pull up following revision(s) (requested by manu in ticket #596):
sys/compat/linux/arch/amd64/linux_machdep.h: revision 1.8
sys/compat/linux/common/linux_sysctl.c: revision 1.27
Linux's uname should return x86_64 as machine_arch
 1.25.10.1 29-Mar-2007  reinoud Pullup to -current
 1.25.8.1 11-Jul-2007  mjf Sync with head.
 1.25.6.3 20-Aug-2007  ad Sync with HEAD.
 1.25.6.2 27-May-2007  ad Sync with head.
 1.25.6.1 10-Apr-2007  ad Sync with head.
 1.25.2.3 17-May-2007  yamt sync with head.
 1.25.2.2 07-May-2007  yamt sync with head.
 1.25.2.1 24-Mar-2007  yamt sync with head.
 1.30.6.2 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.30.6.1 16-Aug-2007  jmcneill Sync with HEAD.
 1.30.2.1 03-Sep-2007  skrll Sync with HEAD.
 1.31.6.1 25-Oct-2007  bouyer Sync with HEAD.
 1.31.2.2 09-Jan-2008  matt sync with HEAD
 1.31.2.1 06-Nov-2007  matt sync with HEAD
 1.32.8.2 08-Jan-2008  bouyer Sync with HEAD
 1.32.8.1 02-Jan-2008  bouyer Sync with HEAD
 1.32.4.1 26-Dec-2007  ad Sync with head.
 1.32.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.34.10.3 11-Aug-2010  yamt sync with head.
 1.34.10.2 04-May-2009  yamt sync with head.
 1.34.10.1 16-May-2008  yamt sync with head.
 1.34.8.1 18-May-2008  yamt sync with head.
 1.34.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.34.6.2 29-Jun-2008  mjf Sync with HEAD.
 1.34.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.35.4.1 18-Jun-2008  simonb Sync with head.
 1.35.2.3 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.35.2.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.35.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.36.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.36.2.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.39.6.1 05-Mar-2011  rmind sync with head
 1.39.4.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.40.22.1 18-May-2014  rmind sync with head
 1.40.18.2 03-Dec-2017  jdolecek update from HEAD
 1.40.18.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.40.8.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.42.2.1 10-Aug-2014  tls Rebase.
 1.44.4.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.8 21-Mar-2020  pgoyette Deal with having to teardown sysctl entries in multiple sub-trees.

(This used to work, but I broke it recently.)
 1.7 16-Mar-2020  pgoyette Use the module subsystem's ability to process SYSCTL_SETUP() entries to
automate installation of sysctl nodes.

Note that there are still a number of device and pseudo-device modules
that create entries tied to individual device units, rather than to the
module itself. These are not changed.
 1.6 29-Sep-2017  maxv branches: 1.6.4;
Remove compat_linux from the autoload list, and add a sysctl to enable or
disable it - which defaults to disabled. The following command is now
required to use linux binaries:

sysctl -w emul.linux.enabled=1

After a discussion on tech-kern@. All the other ideas to reduce the attack
surface have drawbacks, and this sysctl seems to be the best option.
 1.5 19-Nov-2008  ad branches: 1.5.26;
Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.4 28-Apr-2008  martin branches: 1.4.6; 1.4.8;
Remove clause 3 and 4 from TNF licenses
 1.3 11-Dec-2005  christos branches: 1.3.70; 1.3.72; 1.3.74;
merge ktrace-lwp.
 1.2 20-May-2004  atatat Tweak sysctl setup functions (the macros, actually) for use in lkms,
and tweak lkminit_*.c (where applicable) to call them, and to call
sysctl_teardown() when being unloaded.

This consists of (1) making setup functions not be static when being
compiled as lkms (change to sys/sysctl.h), (2) making prototypes
visible for the various setup functions in header files (changes to
various header files), and (3) making simple "load" and "unload"
functions in the actual lkminit stuff.

linux_sysctl.c also needs its root exposed (ie, made not static) for
this (when built as an lkm).
 1.1 15-Feb-2002  christos branches: 1.1.2; 1.1.8; 1.1.20; 1.1.22;
s/printf/uprintf/
 1.1.22.1 23-May-2004  tron Pull up revision 1.2 (requested by atatat in ticket #374):
Tweak sysctl setup functions (the macros, actually) for use in lkms,
and tweak lkminit_*.c (where applicable) to call them, and to call
sysctl_teardown() when being unloaded.
This consists of (1) making setup functions not be static when being
compiled as lkms (change to sys/sysctl.h), (2) making prototypes
visible for the various setup functions in header files (changes to
various header files), and (3) making simple "load" and "unload"
functions in the actual lkminit stuff.
linux_sysctl.c also needs its root exposed (ie, made not static) for
this (when built as an lkm).
 1.1.20.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.20.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.20.1 03-Aug-2004  skrll Sync with HEAD
 1.1.8.2 16-Mar-2002  jdolecek Catch up with -current.
 1.1.8.1 15-Feb-2002  jdolecek file linux_sysctl.h was added on branch kqueue on 2002-03-16 16:00:39 +0000
 1.1.2.2 28-Feb-2002  nathanw Catch up to -current.
 1.1.2.1 15-Feb-2002  nathanw file linux_sysctl.h was added on branch nathanw_sa on 2002-02-28 04:12:57 +0000
 1.3.74.2 04-May-2009  yamt sync with head.
 1.3.74.1 16-May-2008  yamt sync with head.
 1.3.72.1 18-May-2008  yamt sync with head.
 1.3.70.2 17-Jan-2009  mjf Sync with HEAD.
 1.3.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.4.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.4.6.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.5.26.1 03-Dec-2017  jdolecek update from HEAD
 1.6.4.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.39 23-Nov-2021  pho Make LINUX_FIOCLEX and LINUX_FIONCLEX work

These ioctls were declared in linux_termios.h but were not actually
handled.
 1.38 23-Aug-2019  maxv Add a default case, don't call sys_ioctl() with an uninitialized 'com'
argument.
 1.37 27-Dec-2013  njoly branches: 1.37.4; 1.37.16; 1.37.22; 1.37.30; 1.37.34;
Add easy parts (TCOOFF/TCOON) of the TCXONC linux termios ioctl.
 1.36 04-Jul-2008  matthias branches: 1.36.30; 1.36.40; 1.36.46;
make LINUX_TCSBRK work. The code is mostly copied from
sys/compat/ibcs2/ibcs2_ioctl.c.
 1.35 28-Apr-2008  martin branches: 1.35.2; 1.35.4;
Remove clause 3 and 4 from TNF licenses
 1.34 21-Mar-2008  ad branches: 1.34.2; 1.34.4;
Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
 1.33 20-Dec-2007  dsl branches: 1.33.6;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.32 19-Oct-2007  njoly branches: 1.32.4; 1.32.8;
Add compat_linux and exec_linux_elf lkm support for amd64:
- Add needed COMPAT_OSSAUDIO to GENERIC.
- Add missing includes needed by linux_syscallargs.h.
- Add lkm building.
 1.31 13-May-2007  dsl branches: 1.31.6; 1.31.8; 1.31.12;
This is deja vu - I fixed this earlier....
No need to use stackgap for ioctl to get PTM name, directly call file's
ioctl function with kernel buffer.
 1.30 14-Mar-2007  manu Add ptmx fakedevice hack for amd64
Fix a bug in ioctl handling
 1.29 04-Mar-2007  christos branches: 1.29.2; 1.29.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.28 09-Feb-2007  ad branches: 1.28.2;
Merge newlock2 to head.
 1.27 25-Nov-2006  elad branches: 1.27.2;
Part of PR/33280: Christian Ehrhardt: The call to FILE_USE should be
immediatly before the FREAD | FWRITE test not after it or FILE_UNUSE will
be called after the jump to out without a corresponding FILE_USE.
 1.26 22-Sep-2006  christos Pretend to implement TIOCSPTLCK. Although failing is harmless, there is no
point in doing so.
 1.25 15-Feb-2006  manu branches: 1.25.14; 1.25.16;
- Move the BSD to Linux and Linux to BSD termio/termios conversion functions
to a header where they can be shared between COMPAT_LINUX and COMPAT_LINUX32
- Add termios ioctl emulation to COMPAT_LINUX32
- Add the getcwd system call to COMPAT_LINUX32/amd64

That makes Linux's bash working with COMPAT_LINUX32.
 1.24 11-Dec-2005  christos branches: 1.24.2; 1.24.4; 1.24.6;
merge ktrace-lwp.
 1.23 24-Oct-2005  christos PR/31905: Wolfgang Stukenbrock: Termios ioctls TIOCMBIC and TIOCMBIS missing
in linux emulation code
 1.22 26-Feb-2005  perry branches: 1.22.2; 1.22.4; 1.22.6;
nuke trailing whitespace
 1.21 13-Nov-2004  christos branches: 1.21.4; 1.21.6;
Add LINUX_TIOCGPTN for ptyfs pty emulation.
 1.20 29-Jun-2003  fvdl branches: 1.20.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.19 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.18 21-Mar-2003  dsl Change 'data' argument to fo_ioctl and fo_fcntl from 'caddr_t' to 'void *'.
Avoids a lot of casting and removes the need for some line breaks.
Removed a load of (caddr_t) casts from calls to copyin/copyout as well.
(approved by christos - he has a plan to remove caddr_t...)
 1.17 27-Feb-2003  yamt make compat_linux struct file interlock friendly.
 1.16 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.15 19-Dec-2001  augustss Add some missing ioctl()s. From Tommy Bohlin in PR kern/14414.
 1.14 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.13 14-Jun-2001  thorpej branches: 1.13.2;
Fix a partial construction problem that can cause race conditions
between creation of a file descriptor and close(2) when using kernel
assisted threads. What we do is stick descriptors in the table, but
mark them as "larval". This causes essentially everything to treat
it as a non-existent descriptor, except for fdalloc(), which sees a
filled slot so that it won't (incorrectly) allocate it again. When
a descriptor is fully constructed, the code that has constructed it
marks it as "mature" (which actually clears the "larval" flag), and
things continue to work as normal.

While here, gather all the code that gets a descriptor from the table
into a fd_getfile() function, and call it, rather than having the
same (sometimes incorrect) code copied all over the place.
 1.12 22-May-2001  manu When c_ospeed in termio is null, NetBSD hangup the terminal. Since Linux
does not do this, we fake null c_ospeed values by -1 in the kernel, so
that NetBSD does not hangup.
 1.11 21-Feb-2001  jdolecek branches: 1.11.2;
make some more constant arrays 'const'
 1.10 05-Feb-2001  itojun make it compile on alpha. cast pointer to u_long, not int
 1.9 03-Feb-2001  ross Emulate LINUX_TCFLSH with our TIOCFLUSH. Do some CSE.
 1.8 10-Dec-2000  fvdl Add some ioctls for harddisk, floppy disk and console handling.
Implement a few extra cdrom ioctl calls.
Make sure to correctly use FILE_USE and FILE_UNUSE.
 1.7 30-Mar-2000  augustss branches: 1.7.4;
Kill register declarations.
 1.6 04-Oct-1998  fvdl branches: 1.6.12;
Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.5 03-Oct-1998  christos Attempt to fix the mess.
 1.4 01-Oct-1998  erh Moved from compat/linux/linux_termios.c to common.
 1.3 05-Apr-1996  christos Prototyping changes.
 1.2 03-Apr-1996  mycroft Add explicit return types.
 1.1 08-Mar-1996  mycroft Separate ioctl emulation by group. Add (minimal) audio emulation.
 1.6.12.4 12-Mar-2001  bouyer Sync with HEAD.
 1.6.12.3 11-Feb-2001  bouyer Sync with HEAD.
 1.6.12.2 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.6.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.7.4.1 30-Mar-2001  he Pull up revision 1.8 (requested by fvdl):
Add some required Linux emulation bits to support the Linux
version of VMware.
 1.11.2.6 24-Jun-2002  nathanw Curproc->curlwp renaming.

Change uses of "curproc->l_proc" back to "curproc", which is more like the
original use. Bare uses of "curproc" are now "curlwp".

"curproc" is now #defined in proc.h as ((curlwp) ? (curlwp)->l_proc) : NULL)
so that it is always safe to reference curproc (*de*referencing curproc
is another story, but that's always been true).
 1.11.2.5 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.11.2.4 08-Jan-2002  nathanw Catch up to -current.
 1.11.2.3 14-Nov-2001  nathanw Catch up to -current.
 1.11.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.11.2.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.13.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.20.2.7 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.20.2.6 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.20.2.5 21-Nov-2004  skrll This was somehow missed in the sync to HEAD.
 1.20.2.4 14-Nov-2004  skrll Sync with HEAD.
 1.20.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.20.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.20.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.21.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.21.4.1 29-Apr-2005  kent sync with -current
 1.22.6.1 26-Oct-2005  yamt sync with head
 1.22.4.7 24-Mar-2008  yamt sync with head.
 1.22.4.6 21-Jan-2008  yamt sync with head
 1.22.4.5 27-Oct-2007  yamt sync with head.
 1.22.4.4 03-Sep-2007  yamt sync with head.
 1.22.4.3 26-Feb-2007  yamt sync with head.
 1.22.4.2 30-Dec-2006  yamt sync with head.
 1.22.4.1 21-Jun-2006  yamt sync with head.
 1.22.2.1 11-Jan-2007  bouyer Pull up following revision(s) (requested by tron in ticket #1627):
sys/compat/linux/common/linux_termios.c: revision 1.23
PR/31905: Wolfgang Stukenbrock: Termios ioctls TIOCMBIC and TIOCMBIS missing
in linux emulation code
 1.24.6.1 22-Apr-2006  simonb Sync with head.
 1.24.4.1 09-Sep-2006  rpaulo sync with head
 1.24.2.1 18-Feb-2006  yamt sync with head.
 1.25.16.2 10-Dec-2006  yamt sync with head.
 1.25.16.1 22-Oct-2006  yamt sync with head
 1.25.14.3 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.25.14.2 12-Jan-2007  ad Sync with head.
 1.25.14.1 18-Nov-2006  ad Sync with head.
 1.27.2.1 13-May-2007  pavel Pull up following revision(s) (requested by manu in ticket #637):
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.21
sys/compat/linux/arch/amd64/linux_machdep.h: revision 1.7
sys/compat/linux/common/linux_termios.c: revision 1.30
Add ptmx fakedevice hack for amd64
Fix a bug in ioctl handling
 1.28.2.3 17-May-2007  yamt sync with head.
 1.28.2.2 24-Mar-2007  yamt sync with head.
 1.28.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.29.4.1 11-Jul-2007  mjf Sync with head.
 1.29.2.2 27-May-2007  ad Sync with head.
 1.29.2.1 10-Apr-2007  ad Sync with head.
 1.31.12.1 25-Oct-2007  bouyer Sync with HEAD.
 1.31.8.2 09-Jan-2008  matt sync with HEAD
 1.31.8.1 06-Nov-2007  matt sync with HEAD
 1.31.6.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.32.8.1 02-Jan-2008  bouyer Sync with HEAD
 1.32.4.1 26-Dec-2007  ad Sync with head.
 1.33.6.3 28-Sep-2008  mjf Sync with HEAD.
 1.33.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.33.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.34.4.2 04-May-2009  yamt sync with head.
 1.34.4.1 16-May-2008  yamt sync with head.
 1.34.2.1 18-May-2008  yamt sync with head.
 1.35.4.1 18-Jul-2008  simonb Sync with head.
 1.35.2.3 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.35.2.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.35.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.36.46.1 18-May-2014  rmind sync with head
 1.36.40.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.36.30.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.37.34.1 13-Sep-2019  martin Pull up following revision(s) (requested by maxv in ticket #194):

sys/compat/linux/common/linux_socket.c: revision 1.146
sys/compat/linux/common/linux_socket.c: revision 1.147
sys/compat/linux/common/linux_socket.c: revision 1.148
sys/compat/linux/common/linux_socket.c: revision 1.149
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.59
sys/compat/linux32/common/linux32_sysinfo.c: revision 1.8
sys/kern/sysv_shm.c: revision 1.138
sys/compat/linux/common/linux_file64.c: revision 1.61
sys/compat/linux/common/linux_file64.c: revision 1.62
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.58
sys/compat/linux32/common/linux32_dirent.c: revision 1.20
sys/compat/linux32/common/linux32_utsname.c: revision 1.10
sys/compat/linux/common/linux_termios.h: revision 1.22
sys/compat/linux32/common/linux32_termios.c: revision 1.15
sys/compat/linux32/common/linux32_misc.c: revision 1.27
sys/compat/linux32/common/linux32_ioctl.c: revision 1.14
sys/compat/linux/common/linux_statfs.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.57
sys/compat/linux/common/linux_fcntl.h: revision 1.18
sys/compat/linux/common/linux_socket.h: revision 1.24
sys/sys/shm.h: revision 1.54
sys/compat/ossaudio/ossaudio.c: revision 1.75
sys/compat/linux32/common/linux32_signal.c: revision 1.20
sys/miscfs/procfs/procfs_linux.c: revision 1.75
sys/compat/linux/common/linux_signal.c: revision 1.81
sys/compat/linux/common/linux_termios.c: revision 1.38
sys/compat/linux/common/linux_misc.c: revision 1.241
sys/compat/linux/common/linux_misc.c: revision 1.242
sys/compat/linux/common/linux_misc.c: revision 1.243
sys/compat/linux/common/linux_misc.c: revision 1.244

Fix info leaks.

Fix stupid bugs in linux_sys_shmctl(): the index could be out of bound
(page fault) and there was no proper locking.
Maybe we should just remove LINUX_SHM_STAT, like compat_linux32.

Remove printf.

When dealing with an unknown value, set -1, to prevent (harmless)
uninitialized accesses later.

Add a default case, don't call sys_ioctl() with an uninitialized 'com'
argument.

Fix error handling, returns an errno, not -1.

Put the printf under DEBUG_LINUX.


Hum, don't forget the 'pid' argument, otherwise we're not gonna go very
far.

Don't read data from userland directly. This simply does not work on any
recent x86 CPU (thanks to SMAP) and all architectures that forbid direct
access to userland from the kernel. But I guess no one noticed because no
one ever uses compat_linux, right?

Hum, don't pass an mbuf to realloc(). Inspired from copyin32_msg_control().

Fix memory leak.

I don't see the point in having this useless printf, but add a '\n' to it,
so that it at least displays useless stuff correctly.

Hum, remove incorrect assignment. Userland could have passed a smaller
namelen, and the uninitialized bytes from sb_data were being used later in
the network stack.
 1.37.30.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.37.22.1 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1487:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.37.16.1 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1720:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149 (patch)
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54 (patch)

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.37.4.1 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1720:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149 (patch)
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54 (patch)

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.23 23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.22 23-Aug-2019  maxv Fix info leaks.
 1.21 25-Sep-2011  chs branches: 1.21.28; 1.21.40; 1.21.46; 1.21.54; 1.21.58;
linux_termio c_cc array should be indexed by LINUX_OLD_V* rather than LINUX_V*.
fixes array overrun on alpha noticed by gcc 4.5.
 1.20 04-Jul-2011  mrg avoid array bounds violation on netbsd/mips when dealing with termio
structures. (did linux/mips ever support termio?).

the effect of this is that termio linux apps won't have VEOF support.
i can't tell what it should be since that code isn't in linux going
back quite some years.
 1.19 15-Mar-2009  cegger ansify function definitions
 1.18 28-Jun-2008  chris branches: 1.18.4; 1.18.10;
Fix warnings about type conversions by using linux_speed_t type on
linux_speeds[] rather than speed_t.

On Arm (and others) linux uses unsigned long, however, NetBSD uses
unsigned int.
 1.17 28-Apr-2008  martin branches: 1.17.2; 1.17.4;
Remove clause 3 and 4 from TNF licenses
 1.16 04-Dec-2007  dsl branches: 1.16.12; 1.16.14; 1.16.16;
Remove all the __P
 1.15 15-Feb-2006  manu branches: 1.15.38; 1.15.40; 1.15.46; 1.15.50;
- Move the BSD to Linux and Linux to BSD termio/termios conversion functions
to a header where they can be shared between COMPAT_LINUX and COMPAT_LINUX32
- Add termios ioctl emulation to COMPAT_LINUX32
- Add the getcwd system call to COMPAT_LINUX32/amd64

That makes Linux's bash working with COMPAT_LINUX32.
 1.14 11-Dec-2005  christos branches: 1.14.2; 1.14.4; 1.14.6;
merge ktrace-lwp.
 1.13 03-May-2005  manu branches: 1.13.2;
First work on COMPAT_LINUX/amd64
Process startup and dynamiclinking work, but processes hang due to
Linux arch_prctl(2) not being really supported yet.
 1.12 26-Feb-2005  perry nuke trailing whitespace
 1.11 14-Jan-2002  bjh21 branches: 1.11.16; 1.11.24; 1.11.26;
Crude first cut at ARMLinux binary compatibility. Successfully runs
"/emul/linux/bin/echo hello, world", dynamically linked.
 1.10 22-Sep-2001  manu Enable Mips Linux emulation in header files
 1.9 26-Aug-2001  manu branches: 1.9.2;
Moved LINUX_NCCS from MI file to MD file, because the value is different
on MIPS and sparc machines.
 1.8 20-Jan-2001  manu branches: 1.8.2; 1.8.4;
Moved architecure dependent part of struct linux_termio to architecture
dependent header files.
 1.7 19-Jan-2001  manu Added Linux compatibility support for powerpc ports
 1.6 10-Dec-2000  fvdl Add some ioctls for harddisk, floppy disk and console handling.
Implement a few extra cdrom ioctl calls.
Make sure to correctly use FILE_USE and FILE_UNUSE.
 1.5 15-Dec-1998  itohy branches: 1.5.8; 1.5.18;
Added linux compat support on m68k ports.
 1.4 03-Oct-1998  christos Attempt to fix the mess.
 1.3 01-Oct-1998  erh Split compat/linux/linux_termios.h into i386 and common parts.
 1.2 05-Jan-1998  perry RCSID Police.
 1.1 08-Mar-1996  mycroft Separate ioctl emulation by group. Add (minimal) audio emulation.
 1.5.18.1 30-Mar-2001  he Pull up revision 1.6 (requested by fvdl):
Add some required Linux emulation bits to support the Linux
version of VMware.
 1.5.8.2 11-Feb-2001  bouyer Sync with HEAD.
 1.5.8.1 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.8.4.3 11-Feb-2002  jdolecek Sync w/ -current.
 1.8.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.8.4.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.8.2.3 28-Feb-2002  nathanw Catch up to -current.
 1.8.2.2 26-Sep-2001  nathanw Catch up to -current.
Again.
 1.8.2.1 21-Sep-2001  nathanw Catch up to -current.
 1.9.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.11.26.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.11.24.1 29-Apr-2005  kent sync with -current
 1.11.16.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.11.16.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.13.2.2 07-Dec-2007  yamt sync with head
 1.13.2.1 21-Jun-2006  yamt sync with head.
 1.14.6.1 22-Apr-2006  simonb Sync with head.
 1.14.4.1 09-Sep-2006  rpaulo sync with head
 1.14.2.1 18-Feb-2006  yamt sync with head.
 1.15.50.1 08-Dec-2007  ad Sync with head.
 1.15.46.1 08-Dec-2007  mjf Sync with HEAD.
 1.15.40.1 09-Jan-2008  matt sync with HEAD
 1.15.38.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.16.16.2 04-May-2009  yamt sync with head.
 1.16.16.1 16-May-2008  yamt sync with head.
 1.16.14.1 18-May-2008  yamt sync with head.
 1.16.12.2 29-Jun-2008  mjf Sync with HEAD.
 1.16.12.1 02-Jun-2008  mjf Sync with HEAD.
 1.17.4.1 03-Jul-2008  simonb Sync with head.
 1.17.2.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.18.10.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.18.4.1 28-Apr-2009  skrll Sync with HEAD.
 1.21.58.1 13-Sep-2019  martin Pull up following revision(s) (requested by maxv in ticket #194):

sys/compat/linux/common/linux_socket.c: revision 1.146
sys/compat/linux/common/linux_socket.c: revision 1.147
sys/compat/linux/common/linux_socket.c: revision 1.148
sys/compat/linux/common/linux_socket.c: revision 1.149
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.59
sys/compat/linux32/common/linux32_sysinfo.c: revision 1.8
sys/kern/sysv_shm.c: revision 1.138
sys/compat/linux/common/linux_file64.c: revision 1.61
sys/compat/linux/common/linux_file64.c: revision 1.62
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.58
sys/compat/linux32/common/linux32_dirent.c: revision 1.20
sys/compat/linux32/common/linux32_utsname.c: revision 1.10
sys/compat/linux/common/linux_termios.h: revision 1.22
sys/compat/linux32/common/linux32_termios.c: revision 1.15
sys/compat/linux32/common/linux32_misc.c: revision 1.27
sys/compat/linux32/common/linux32_ioctl.c: revision 1.14
sys/compat/linux/common/linux_statfs.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.57
sys/compat/linux/common/linux_fcntl.h: revision 1.18
sys/compat/linux/common/linux_socket.h: revision 1.24
sys/sys/shm.h: revision 1.54
sys/compat/ossaudio/ossaudio.c: revision 1.75
sys/compat/linux32/common/linux32_signal.c: revision 1.20
sys/miscfs/procfs/procfs_linux.c: revision 1.75
sys/compat/linux/common/linux_signal.c: revision 1.81
sys/compat/linux/common/linux_termios.c: revision 1.38
sys/compat/linux/common/linux_misc.c: revision 1.241
sys/compat/linux/common/linux_misc.c: revision 1.242
sys/compat/linux/common/linux_misc.c: revision 1.243
sys/compat/linux/common/linux_misc.c: revision 1.244

Fix info leaks.

Fix stupid bugs in linux_sys_shmctl(): the index could be out of bound
(page fault) and there was no proper locking.
Maybe we should just remove LINUX_SHM_STAT, like compat_linux32.

Remove printf.

When dealing with an unknown value, set -1, to prevent (harmless)
uninitialized accesses later.

Add a default case, don't call sys_ioctl() with an uninitialized 'com'
argument.

Fix error handling, returns an errno, not -1.

Put the printf under DEBUG_LINUX.


Hum, don't forget the 'pid' argument, otherwise we're not gonna go very
far.

Don't read data from userland directly. This simply does not work on any
recent x86 CPU (thanks to SMAP) and all architectures that forbid direct
access to userland from the kernel. But I guess no one noticed because no
one ever uses compat_linux, right?

Hum, don't pass an mbuf to realloc(). Inspired from copyin32_msg_control().

Fix memory leak.

I don't see the point in having this useless printf, but add a '\n' to it,
so that it at least displays useless stuff correctly.

Hum, remove incorrect assignment. Userland could have passed a smaller
namelen, and the uninitialized bytes from sb_data were being used later in
the network stack.
 1.21.54.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.21.46.1 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1487:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.21.40.1 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1720:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149 (patch)
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54 (patch)

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.21.28.1 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1720:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149 (patch)
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54 (patch)

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.42 19-Sep-2021  thorpej Add the timerfd syscalls to COMPAT_LINUX and COMPAT_LINUX32.
 1.41 19-Sep-2021  thorpej Add the POSIX timer syscalls (timer_create(), timer_settime(), timer_gettime(),
timer_getoverrun(), and timer_delete()) to COMPAT_LINUX and COMPAT_LINUX32.
 1.40 07-Sep-2021  riastradh sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.39 29-Jul-2017  riastradh branches: 1.39.8; 1.39.16;
Put suser check in the right function: settimeofday, not gettimeofday.

While here, remove wrong comment.

Noted by kre@.
 1.38 29-Jul-2017  riastradh Only let the superuser set the compat_linux timezone.

Not really keen to invent a new kauth cookie for this useless purpose.

From Ilja Van Sprundel.
 1.37 13-Jan-2014  njoly branches: 1.37.4; 1.37.6; 1.37.8; 1.37.16; 1.37.22;
Cleanup, and reduce diffs between arches. Make alpha use
linux_sys_{get,set}timeofday like others.
 1.36 02-Oct-2012  christos branches: 1.36.2;
kernel portion of clock_nanosleep()
 1.35 18-Nov-2011  christos branches: 1.35.6; 1.35.10; 1.35.12; 1.35.14;
- add sigtimedwait support.
- merge the siginfo population code.
 1.34 12-Jul-2010  njoly branches: 1.34.8;
Add CLOCK_MONOTONIC support for compat linux/linux32
clock_nanosleep(2).
 1.33 08-Apr-2010  njoly Do not use 0 for pointers, but NULL.
 1.32 08-Apr-2010  njoly Add a new clock_gettime1() function that holds most of the
clock_gettime syscall code (except for the copyout). Adjust all
corresponding syscalls to make use of it.
 1.31 03-Apr-2010  njoly Move most clock_getres syscall code, except for coypout call, to a new
clock_getres1() function which can be used by emulations. Adjust all
clock_getres syscalls to now make of use it.
 1.30 29-Mar-2010  njoly Convert linux/linux32/netbsd32 clock_settime syscalls, to use the
common clock_settime1() function.
 1.29 21-Jul-2009  njoly branches: 1.29.2; 1.29.4;
Do reject unknown/invalid linux clockid.
 1.28 11-Jan-2009  christos branches: 1.28.2;
merge christos-time_t
 1.27 19-Nov-2008  njoly futex(2) timeout argument cleanup/fix.
- Use `struct linux_timespec', converted to native structure.
- Ensure that provided values are correct.
- Replace timeval+tvtohz by tstohz.
 1.26 12-Nov-2008  njoly Fix nanosleep(2) on 64-bit archs. Do not call native nanosleep
syscall, but rather a modified version the will take care of `struct
timespec' conversions.
 1.25 18-Jun-2008  tsutsui branches: 1.25.2; 1.25.4; 1.25.6;
Include <sys/sched.h> before <sys/syscallargs.h> for cpuset_t.
 1.24 28-Apr-2008  martin branches: 1.24.2; 1.24.4;
Remove clause 3 and 4 from TNF licenses
 1.23 17-Apr-2008  njoly branches: 1.23.2; 1.23.4;
Add compat linux32 sys_clock_{getres,gettime,settime} syscalls.
 1.22 20-Dec-2007  dsl branches: 1.22.6; 1.22.8;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.21 08-Dec-2007  dsl branches: 1.21.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.20 25-Nov-2007  elad branches: 1.20.2;
Refactor time modification checks and place them in the secmodel code.

okay christos@
 1.19 19-Oct-2007  njoly branches: 1.19.2;
Add compat_linux and exec_linux_elf lkm support for amd64:
- Add needed COMPAT_OSSAUDIO to GENERIC.
- Add missing includes needed by linux_syscallargs.h.
- Add lkm building.
 1.18 13-May-2007  dsl branches: 1.18.6; 1.18.8; 1.18.12;
Stop using the stackgap for time functions.
 1.17 12-May-2007  dsl Fix comment and indent.
 1.16 04-Mar-2007  christos branches: 1.16.2; 1.16.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.15 09-Feb-2007  ad branches: 1.15.2;
Merge newlock2 to head.
 1.14 14-May-2006  christos branches: 1.14.8;
XXX: GCC uninitialized
 1.13 11-Dec-2005  christos branches: 1.13.4; 1.13.6; 1.13.8; 1.13.12;
merge ktrace-lwp.
 1.12 05-Nov-2005  manu Instead of ifdef'ing __amd64__ all the Linux NPTL stuff, introduce an
ifdef LINUX_NPTL.
Also implement SETTLS flag to Linux clone()
 1.11 16-May-2005  fvdl branches: 1.11.2;
Implement clock_* POSIX functions.
 1.10 03-May-2005  manu First work on COMPAT_LINUX/amd64
Process startup and dynamiclinking work, but processes hang due to
Linux arch_prctl(2) not being really supported yet.
 1.9 26-Feb-2005  perry nuke trailing whitespace
 1.8 18-Jan-2003  thorpej branches: 1.8.2; 1.8.10; 1.8.12;
Merge the nathanw_sa branch.
 1.7 17-Jan-2002  rjs Add arm to #endif comment.
 1.6 14-Jan-2002  bjh21 Crude first cut at ARMLinux binary compatibility. Successfully runs
"/emul/linux/bin/echo hello, world", dynamically linked.
 1.5 15-Nov-2001  lukem don't need <sys/types.h> when including <sys/param.h>
 1.4 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.3 22-Sep-2001  manu Fixes for mips support
 1.2 15-May-2001  manu branches: 1.2.2; 1.2.4; 1.2.6;
This file is not used on alpha, and it causes some warning that break the
build. Added an ifdef to ignore the file content for alpha (not tested)
 1.1 13-May-2001  manu Improved the accuracy of gettimeofday/settimeofday: Linux stores a srtuct
timezone in the kernel. We now keep track of it for emulated processes.
Tested for powerpc and i386. Untested on m68k, but it should be ok
Alpha has a particular implementation (osf1_sys_gettimeofday), and it has
therefore not been touched.
 1.2.6.1 01-Oct-2001  fvdl Catch up with -current.
 1.2.4.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.2.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.2.7 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.2.2.6 28-Feb-2002  nathanw Catch up to -current.
 1.2.2.5 08-Jan-2002  nathanw Catch up to -current.
 1.2.2.4 14-Nov-2001  nathanw Catch up to -current.
 1.2.2.3 26-Sep-2001  nathanw Catch up to -current.
Again.
 1.2.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.2.2.1 15-May-2001  nathanw file linux_time.c was added on branch nathanw_sa on 2001-06-21 19:59:57 +0000
 1.8.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.8.10.1 29-Apr-2005  kent sync with -current
 1.8.2.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.8.2.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.11.2.6 21-Jan-2008  yamt sync with head
 1.11.2.5 07-Dec-2007  yamt sync with head
 1.11.2.4 27-Oct-2007  yamt sync with head.
 1.11.2.3 03-Sep-2007  yamt sync with head.
 1.11.2.2 26-Feb-2007  yamt sync with head.
 1.11.2.1 21-Jun-2006  yamt sync with head.
 1.13.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.13.8.1 24-May-2006  yamt sync with head.
 1.13.6.1 01-Jun-2006  kardel Sync with head.
 1.13.4.1 09-Sep-2006  rpaulo sync with head
 1.14.8.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.15.2.2 17-May-2007  yamt sync with head.
 1.15.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.16.4.1 11-Jul-2007  mjf Sync with head.
 1.16.2.1 27-May-2007  ad Sync with head.
 1.18.12.1 25-Oct-2007  bouyer Sync with HEAD.
 1.18.8.2 09-Jan-2008  matt sync with HEAD
 1.18.8.1 06-Nov-2007  matt sync with HEAD
 1.18.6.3 09-Dec-2007  jmcneill Sync with HEAD.
 1.18.6.2 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.18.6.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.19.2.2 27-Dec-2007  mjf Sync with HEAD.
 1.19.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.20.2.1 26-Dec-2007  ad Sync with head.
 1.21.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.22.8.3 20-Nov-2008  christos merge with head.
 1.22.8.2 01-Nov-2008  christos Sync with head.
 1.22.8.1 29-Mar-2008  christos Welcome to the time_t=long long dev_t=uint64_t branch.
 1.22.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.22.6.2 29-Jun-2008  mjf Sync with HEAD.
 1.22.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.23.4.4 11-Aug-2010  yamt sync with head.
 1.23.4.3 19-Aug-2009  yamt sync with head.
 1.23.4.2 04-May-2009  yamt sync with head.
 1.23.4.1 16-May-2008  yamt sync with head.
 1.23.2.1 18-May-2008  yamt sync with head.
 1.24.4.1 18-Jun-2008  simonb Sync with head.
 1.24.2.3 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.24.2.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.24.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.25.6.1 20-Nov-2008  snj Pull up following revision(s) (requested by njoly in ticket #81):
sys/compat/linux/arch/mips/syscalls.master: revision 1.30
sys/compat/linux/arch/m68k/syscalls.master: revision 1.63
sys/compat/linux32/arch/amd64/syscalls.master: revision 1.39
sys/compat/linux/arch/alpha/syscalls.master: revision 1.63
sys/compat/linux/arch/powerpc/syscalls.master: revision 1.38
sys/compat/linux32/common/linux32_time.c: revision 1.22
sys/compat/linux/arch/amd64/syscalls.master: revision 1.25
sys/compat/linux/arch/i386/syscalls.master: revision 1.94
sys/compat/linux/arch/arm/syscalls.master: revision 1.36
sys/compat/linux/common/linux_time.c: revision 1.26
Fix nanosleep(2) on 64-bit archs. Do not call native nanosleep
syscall, but rather a modified version the will take care of `struct
timespec' conversions.
 1.25.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.25.2.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.28.2.1 23-Jul-2009  jym Sync with HEAD.
 1.29.4.2 05-Mar-2011  rmind sync with head
 1.29.4.1 30-May-2010  rmind sync with head
 1.29.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.29.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.34.8.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.34.8.2 30-Oct-2012  yamt sync with head
 1.34.8.1 17-Apr-2012  yamt sync with head
 1.35.14.1 19-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1489):
sys/compat/linux/common/linux_time.c: 1.38-1.39 via patch
Only let the superuser set the compat_linux timezone.
Not really keen to invent a new kauth cookie for this useless purpose.
From Ilja Van Sprundel.
--
Put suser check in the right function: settimeofday, not gettimeofday.
While here, remove wrong comment.
Noted by kre@.
 1.35.12.1 19-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1489):
sys/compat/linux/common/linux_time.c: 1.38-1.39 via patch
Only let the superuser set the compat_linux timezone.
Not really keen to invent a new kauth cookie for this useless purpose.
From Ilja Van Sprundel.
--
Put suser check in the right function: settimeofday, not gettimeofday.
While here, remove wrong comment.
Noted by kre@.
 1.35.10.3 03-Dec-2017  jdolecek update from HEAD
 1.35.10.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.35.10.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.35.6.1 19-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1489):
sys/compat/linux/common/linux_time.c: 1.38-1.39 via patch
Only let the superuser set the compat_linux timezone.
Not really keen to invent a new kauth cookie for this useless purpose.
From Ilja Van Sprundel.
--
Put suser check in the right function: settimeofday, not gettimeofday.
While here, remove wrong comment.
Noted by kre@.
 1.36.2.1 18-May-2014  rmind sync with head
 1.37.22.2 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1836):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.37.22.1 08-Aug-2017  martin Pull up following revision(s) (requested by spz in ticket #188):
sys/compat/linux/common/linux_time.c: revision 1.38
sys/compat/linux/common/linux_time.c: revision 1.39
Only let the superuser set the compat_linux timezone.
Not really keen to invent a new kauth cookie for this useless purpose.
From Ilja Van Sprundel.
Put suser check in the right function: settimeofday, not gettimeofday.
While here, remove wrong comment.
Noted by kre@.
 1.37.16.1 12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1486):
sys/compat/linux/common/linux_time.c: revision 1.38-1.39 via patch
Only let the superuser set the compat_linux timezone.
Not really keen to invent a new kauth cookie for this useless purpose.
From Ilja Van Sprundel.
--
Put suser check in the right function: settimeofday, not gettimeofday.
While here, remove wrong comment.
Noted by kre@.
 1.37.8.1 12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1486):
sys/compat/linux/common/linux_time.c: revision 1.38-1.39 via patch
Only let the superuser set the compat_linux timezone.
Not really keen to invent a new kauth cookie for this useless purpose.
From Ilja Van Sprundel.
--
Put suser check in the right function: settimeofday, not gettimeofday.
While here, remove wrong comment.
Noted by kre@.
 1.37.6.1 28-Aug-2017  skrll Sync with HEAD
 1.37.4.1 12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1486):
sys/compat/linux/common/linux_time.c: revision 1.38-1.39 via patch
Only let the superuser set the compat_linux timezone.
Not really keen to invent a new kauth cookie for this useless purpose.
From Ilja Van Sprundel.
--
Put suser check in the right function: settimeofday, not gettimeofday.
While here, remove wrong comment.
Noted by kre@.
 1.39.16.2 17-Dec-2020  thorpej Re-factor the code that maps the clockid_t in timer_create() and
the flags in timerfd_settime() into separate functions.
 1.39.16.1 15-Dec-2020  thorpej Add Linux eventfd, timerfd, and POSIX timer calls.
 1.39.8.1 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.34 01-Jul-2024  christos Add linux POSIX message queue support (Ricardo Branco)
 1.33 25-Nov-2021  ryo branches: 1.33.10;
- Add compat_linux statx(2) syscall.
- The AT_EMPTY_PATH processing from the modification of
sys/compat/linux/common/linux_file64.c r1.63 has been separated, and made
common to linux_statat(), so that it can be used not only by
linux32_sys_fstatat64() but also by other *statat() variants.
 1.32 23-Sep-2021  ryo add support COMPAT_LINUX for aarch64
 1.31 18-Nov-2013  chs implement the *at() syscalls.
bring the unimplemented syscall list up to date.
 1.30 11-Jan-2009  christos branches: 1.30.14; 1.30.24; 1.30.28;
merge christos-time_t
 1.29 05-Jan-2009  njoly Restore struct sysctl padding member name, which was damaged during
__unused removal on arguments.
 1.28 28-Apr-2008  martin branches: 1.28.8;
Remove clause 3 and 4 from TNF licenses
 1.27 15-Jan-2008  njoly branches: 1.27.6; 1.27.8; 1.27.10; 1.27.12;
compat linux (and linux32) uid16 functions cleanup and fixes.

- Move uid16 functions to their own file linux_uid16.c, included by
needed archs (arm, i386 and m68k).
- Add new MI types linux_{u,g}id16_t.
- Add macros to handle linux_uid16_t and uid_t conversions.
- Add linux_sys_getres{uid,gid}16 syscalls, to fix an overflow with
bad sizes given to copyout when linux_sys_getres{uid,gid} are used.
- Update arm syscall table to use more uid16 functions.
 1.26 23-Mar-2007  mrg branches: 1.26.10; 1.26.16; 1.26.22;
implement emul.linux.kern.machine, which can be set to "i686", like
some applications seem to want.
 1.25 14-Mar-2007  njoly branches: 1.25.2;
Fix compat linux statfs/fstatfs syscalls on amd64.
- Do not use statfs64/fstatfs64 as they have an extra size argument.
- Add full 64bit linux struct statfs support.

ok by manu
 1.24 16-Nov-2006  christos branches: 1.24.2; 1.24.4; 1.24.8; 1.24.10;
__unused removal on arguments; approved by core.
 1.23 11-Dec-2005  christos branches: 1.23.20; 1.23.22;
merge ktrace-lwp.
 1.22 03-May-2005  manu branches: 1.22.2;
First work on COMPAT_LINUX/amd64
Process startup and dynamiclinking work, but processes hang due to
Linux arch_prctl(2) not being really supported yet.
 1.21 26-Feb-2005  perry nuke trailing whitespace
 1.20 20-Sep-2004  jdolecek branches: 1.20.4; 1.20.6;
move definition of linux_fsid_t to common/linux_types.h - it's identical
across all Linux archs
 1.19 20-Sep-2004  jdolecek implement support for Linux statfs64() syscall - 64bit variant of statfs()
 1.18 20-Sep-2004  christos Add a linux_fsid_t typedef for the ports that don't have architecture dependent
linux_types.h. Fixes sparc build.
 1.17 19-Sep-2004  jdolecek Adjust struct statfs content to flag that the newer Linux kernel do
provide f_frsize. It cannot be actually used to GNU C statvfs() bug
in f_frsize != f_bsize case, so just keep pretending we don't support it.
Update comments and explain the situation in detail there.
 1.16 19-Sep-2004  jdolecek move definition of struct linux_stafs to common/linux_types.h, and use
explicit size types - the structure definition is actually identical
on currently support COMPAT_LINUX archs, so no point to have 6 copies of it
in the tree
 1.15 10-Oct-2002  thorpej branches: 1.15.6;
Avoid collision with __unused in sys/cdefs.h.
 1.14 03-Apr-2002  christos provide missing types for arch's that don't have specific linux_types.h
 1.13 15-Feb-2002  christos - add a real linux_sys___sysctl because the mib numbers are different.
implement only the kernel version getting entries.
- make the signal conversion functions consistent; dest is arg 1.
- make linux_fakedev deal with block and char devices differently.
- add linux_sys_ugetrlimit, and flesh out the regular get/setrlimit so
that they work properly.
- add linux_mmap2 [untested].
- bump kernel to 2.4.18, and make the date be valentine's day :-)
- linux_sys_*stat64 family was totally busted. Fix it.

tested only on i386.

Status:
gdb, telnet, work
jdk-1.4.0 extractor works, jdk still coredumps.

christos
 1.12 14-Jan-2002  bjh21 Crude first cut at ARMLinux binary compatibility. Successfully runs
"/emul/linux/bin/echo hello, world", dynamically linked.
 1.11 19-Jan-2001  manu branches: 1.11.2; 1.11.4;
Added Linux compatibility support for powerpc ports
 1.10 29-Dec-2000  fvdl Hardcode what the linux uname() calls return (Linux 2.2.5 is the current
value). A few major applications check for this (like VMware), and
there is no other way to trick them. Needs a more generic solution
eventually.
 1.9 07-Oct-1998  erh branches: 1.9.12; 1.9.22;
Kill the linux_old*.h includes (which are only used in the corresponding linux_old*.c). Add linux_siginfo.h.
 1.8 04-Oct-1998  fvdl Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.7 03-Oct-1998  christos Attempt to fix the mess.
 1.6 01-Oct-1998  erh Split linux_types.h into i386, common and multi-architechture parts.
 1.5 20-May-1996  fvdl Update list of Linux syscalls and implement the ones that are likely to be
used and doable.
 1.4 21-Aug-1995  mycroft Implement the old and older uname(2) calls.
 1.3 14-Aug-1995  mycroft Move signal types into signal.h.
 1.2 05-Mar-1995  fvdl Added a few more system calls.
More consistent alternate root file semantics throughout.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.9.22.1 30-Mar-2001  he Pull up revision 1.10 (requested by fvdl):
Add some required Linux emulation bits to support the Linux
version of VMware.
 1.9.12.2 11-Feb-2001  bouyer Sync with HEAD.
 1.9.12.1 05-Jan-2001  bouyer Sync with HEAD
 1.11.4.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.11.4.2 16-Mar-2002  jdolecek Catch up with -current.
 1.11.4.1 11-Feb-2002  jdolecek Sync w/ -current.
 1.11.2.3 18-Oct-2002  nathanw Catch up to -current.
 1.11.2.2 17-Apr-2002  nathanw Catch up to -current.
 1.11.2.1 28-Feb-2002  nathanw Catch up to -current.
 1.15.6.3 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.15.6.2 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.15.6.1 24-Sep-2004  skrll Sync with HEAD.
 1.20.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.20.4.1 29-Apr-2005  kent sync with -current
 1.22.2.3 21-Jan-2008  yamt sync with head
 1.22.2.2 03-Sep-2007  yamt sync with head.
 1.22.2.1 30-Dec-2006  yamt sync with head.
 1.23.22.1 10-Dec-2006  yamt sync with head.
 1.23.20.1 18-Nov-2006  ad Sync with head.
 1.24.10.1 11-Jul-2007  mjf Sync with head.
 1.24.8.1 10-Apr-2007  ad Sync with head.
 1.24.4.1 24-Mar-2007  yamt sync with head.
 1.24.2.1 20-Apr-2007  bouyer Pull up following revision(s) (requested by njoly in ticket #581):
sys/compat/linux/common/linux_misc.c: revision 1.168
sys/compat/linux/arch/amd64/syscalls.master: revision 1.18
sys/compat/linux/common/linux_types.h: revision 1.25
sys/compat/linux/arch/amd64/linux_machdep.h: revision 1.6
sys/compat/linux/common/linux_misc_notalpha.c: revision 1.87
Fix compat linux statfs/fstatfs syscalls on amd64.
- Do not use statfs64/fstatfs64 as they have an extra size argument.
- Add full 64bit linux struct statfs support.
 1.25.2.1 29-Mar-2007  reinoud Pullup to -current
 1.26.22.1 19-Jan-2008  bouyer Sync with HEAD
 1.26.16.1 18-Feb-2008  mjf Sync with HEAD.
 1.26.10.1 23-Mar-2008  matt sync with HEAD
 1.27.12.2 04-May-2009  yamt sync with head.
 1.27.12.1 16-May-2008  yamt sync with head.
 1.27.10.1 18-May-2008  yamt sync with head.
 1.27.8.4 10-Jan-2009  christos merge diffs
 1.27.8.3 30-Dec-2008  christos it is suseconds_t we want
 1.27.8.2 01-Nov-2008  christos Sync with head.
 1.27.8.1 29-Mar-2008  christos Welcome to the time_t=long long dev_t=uint64_t branch.
 1.27.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.27.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.28.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.30.28.1 18-May-2014  rmind sync with head
 1.30.24.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.30.14.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.33.10.1 02-Aug-2025  perseant Sync with HEAD
 1.4 20-May-2014  njoly Fix signed vs. unsigned comparison in getgroups16() syscall. Negative
gisetsize values now fail with EINVAL as expected.
 1.3 20-May-2008  njoly branches: 1.3.42; 1.3.58;
Fix linux_sys_getres{uid,gid}16 arguments type in comment.
 1.2 28-Apr-2008  martin branches: 1.2.2;
Remove clause 3 and 4 from TNF licenses
 1.1 15-Jan-2008  njoly branches: 1.1.2; 1.1.4; 1.1.6; 1.1.12; 1.1.14; 1.1.16; 1.1.18;
compat linux (and linux32) uid16 functions cleanup and fixes.

- Move uid16 functions to their own file linux_uid16.c, included by
needed archs (arm, i386 and m68k).
- Add new MI types linux_{u,g}id16_t.
- Add macros to handle linux_uid16_t and uid_t conversions.
- Add linux_sys_getres{uid,gid}16 syscalls, to fix an overflow with
bad sizes given to copyout when linux_sys_getres{uid,gid} are used.
- Update arm syscall table to use more uid16 functions.
 1.1.18.2 04-May-2009  yamt sync with head.
 1.1.18.1 16-May-2008  yamt sync with head.
 1.1.16.2 04-Jun-2008  yamt sync with head
 1.1.16.1 18-May-2008  yamt sync with head.
 1.1.14.2 23-Mar-2008  matt sync with HEAD
 1.1.14.1 15-Jan-2008  matt file linux_uid16.c was added on branch matt-armv6 on 2008-03-23 02:04:33 +0000
 1.1.12.1 02-Jun-2008  mjf Sync with HEAD.
 1.1.6.2 18-Feb-2008  mjf Sync with HEAD.
 1.1.6.1 15-Jan-2008  mjf file linux_uid16.c was added on branch mjf-devfs on 2008-02-18 21:05:27 +0000
 1.1.4.2 21-Jan-2008  yamt sync with head
 1.1.4.1 15-Jan-2008  yamt file linux_uid16.c was added on branch yamt-lazymbuf on 2008-01-21 09:41:31 +0000
 1.1.2.2 19-Jan-2008  bouyer Sync with HEAD
 1.1.2.1 15-Jan-2008  bouyer file linux_uid16.c was added on branch bouyer-xeni386 on 2008-01-19 12:14:58 +0000
 1.2.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.3.58.1 10-Aug-2014  tls Rebase.
 1.3.42.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.33 09-Nov-2014  maxv Do not uselessly include <sys/malloc.h>.
 1.32 30-Oct-2014  maxv Reject non-regular files.

Patch from njoly@.
 1.31 19-Oct-2014  maxv Resource leak.

Found by my code scanner.

Tested by njoly@; ok njoly@ rmind@ on tech-kern@.
 1.30 28-Aug-2009  dholland branches: 1.30.22; 1.30.38;
Another one that needs <sys/exec_aout.h>.
 1.29 15-Aug-2009  matt Include <sys/exec_aout.h> explicitly instead of relying on <sys/exec.h> to
do it for you.
 1.28 29-Jun-2009  dholland Convert 67 namei call sites to use namei_simple, in these functions:

check_console, veriexecclose, veriexec_delete, veriexec_file_add,
emul_find_root, coff_load_shlib (sh3 version), coff_load_shlib,
compat_20_sys_statfs, compat_20_netbsd32_statfs,
ELFNAME2(netbsd32,probe_noteless), darwin_sys_statfs,
ibcs2_sys_statfs, ibcs2_sys_statvfs, linux_sys_uselib,
osf1_sys_statfs, sunos_sys_statfs, sunos32_sys_statfs,
ultrix_sys_statfs, do_sys_mount, fss_create_files (3 of 4),
adosfs_mount, cd9660_mount, coda_ioctl, coda_mount, ext2fs_mount,
ffs_mount, filecore_mount, hfs_mount, lfs_mount, msdosfs_mount,
ntfs_mount, sysvbfs_mount, udf_mount, union_mount, sys_chflags,
sys_lchflags, sys_chmod, sys_lchmod, sys_chown, sys_lchown,
sys___posix_chown, sys___posix_lchown, sys_link, do_sys_pstatvfs,
sys_quotactl, sys_revoke, sys_truncate, do_sys_utimes, sys_extattrctl,
sys_extattr_set_file, sys_extattr_set_link, sys_extattr_get_file,
sys_extattr_get_link, sys_extattr_delete_file,
sys_extattr_delete_link, sys_extattr_list_file, sys_extattr_list_link,
sys_setxattr, sys_lsetxattr, sys_getxattr, sys_lgetxattr,
sys_listxattr, sys_llistxattr, sys_removexattr, sys_lremovexattr

All have been scrutinized (several times, in fact) and compile-tested,
but not all have been explicitly tested in action.

XXX: While I haven't (intentionally) changed the use or nonuse of
XXX: TRYEMULROOT in any of these places, I'm not convinced all the
XXX: uses are correct; an audit might be desirable.
 1.27 28-Apr-2008  martin branches: 1.27.2; 1.27.14;
Remove clause 3 and 4 from TNF licenses
 1.26 20-Dec-2007  dsl branches: 1.26.6; 1.26.8; 1.26.10;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.25 08-Dec-2007  pooka branches: 1.25.4;
Remove cn_lwp from struct componentname. curlwp should be used
from on. The NDINIT() macro no longer takes the lwp parameter and
associates the credentials of the calling thread with the namei
structure.
 1.24 19-Oct-2007  njoly branches: 1.24.4;
Add compat_linux and exec_linux_elf lkm support for amd64:
- Add needed COMPAT_OSSAUDIO to GENERIC.
- Add missing includes needed by linux_syscallargs.h.
- Add lkm building.
 1.23 19-Oct-2007  ad machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.22 30-Apr-2007  dsl branches: 1.22.6; 1.22.8; 1.22.12;
Remove some unused calls to stackgap_init()
 1.21 22-Apr-2007  dsl Change the way that emulations locate files within the emulation root to
avoid having to allocate space in the 'stackgap'
- which is very LWP unfriendly.
The additional code for non-emulation namei() is trivial, the reduction for
the emulations is massive.
The vnode for a processes emulation root is saved in the cwdi structure
during process exec.
If the emulation root the TRYEMULROOT flag are set, namei() will do an initial
search for absolute pathnames in the emulation root, if that fails it will
retry from the normal root.
".." at the emulation root will always go to the real root, even in the middle
of paths and when expanding symlinks.
Absolute symlinks found using absolute paths in the emulation root will be
relative to the emulation root (so /usr/lib/xxx.so -> /lib/xxx.so links
inside the emulation root don't need changing).
If the root of the emulation would be returned (for an emulation lookup), then
the real root is returned instead (matching the behaviour of emul_lookup,
but being a cheap comparison here) so that programs that scan "../.."
looking for the root dircetory don't loop forever.
The target for symbolic links is no longer mangled (it used to get the
CHECK_ALT_xxx() treatment, so could get /emul/xxx prepended).
CHECK_ALT_xxx() are no more. Most of the change is deleting them, and adding
TRYEMULROOT to the flags to NDINIT().
A lot of the emulation system call stubs could now be deleted.
 1.20 04-Mar-2007  christos branches: 1.20.2; 1.20.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.19 09-Feb-2007  ad branches: 1.19.2;
Merge newlock2 to head.
 1.18 16-Nov-2006  christos __unused removal on arguments; approved by core.
 1.17 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.16 23-Jul-2006  ad branches: 1.16.4; 1.16.6;
Use the LWP cached credentials where sane.
 1.15 14-May-2006  elad integrate kauth.
 1.14 11-Dec-2005  christos branches: 1.14.4; 1.14.6; 1.14.8; 1.14.10; 1.14.12;
merge ktrace-lwp.
 1.13 17-Sep-2004  skrll branches: 1.13.12;
There's no need to pass a proc value when using UIO_SYSSPACE with
vn_rdwr(9) and uiomove(9).

OK'd by Jason Thorpe
 1.12 29-Jun-2003  fvdl branches: 1.12.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.11 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.10 01-Apr-2003  thorpej Use PAGE_SIZE rather than NBPG.
 1.9 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.8 06-Jan-2003  wiz writable, not writeable.
 1.7 05-Oct-2002  chs count executable image pages as executable for vm-usage purposes.
also, always do the VTEXT vs. v_writecount mutual exclusion
(which we previously skipped if the text or data segment was empty).
 1.6 16-Mar-2002  christos branches: 1.6.6;
make the stackgap_{init,alloc} functions MP friendly (i.e. pass struct proc *
in, instead of using curproc). While there add an optional size argument to
stackgap_init.
 1.5 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.4 30-Oct-2001  thorpej - Add a new vnode flag VEXECMAP, which indicates that a vnode has
executable mappings. Stop overloading VTEXT for this purpose (VTEXT
also has another meaning).
- Rename vn_marktext() to vn_markexec(), and use it when executable
mappings of a vnode are established.
- In places where we want to set VTEXT, set it in v_flag directly, rather
than making a function call to do this (it no longer makes sense to
use a function call, since we no longer overload VTEXT with VEXECMAP's
meaning).

VEXECMAP suggested by Chuq Silvers.
 1.3 22-Jul-2001  wiz branches: 1.3.4;
seperate -> separate
 1.2 12-Dec-2000  jdolecek branches: 1.2.2; 1.2.4;
define EXEC_AOUT (if not defined) before including linux_syscallargs.h,
to get linux_sys_uselib() prototype
 1.1 01-Dec-2000  jdolecek branches: 1.1.2;
put linux_sys_uselib() to separate file linux_uselib.c
 1.1.2.3 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.1.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.1.2.1 01-Dec-2000  bouyer file linux_uselib.c was added on branch thorpej_scsipi on 2000-12-08 09:08:31 +0000
 1.2.4.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.2.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.4.1 03-Aug-2001  lukem update to -current
 1.2.2.7 07-Jan-2003  thorpej Sync with HEAD.
 1.2.2.6 18-Oct-2002  nathanw Catch up to -current.
 1.2.2.5 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.2.2.4 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.2.2.3 14-Nov-2001  nathanw Catch up to -current.
 1.2.2.2 24-Aug-2001  nathanw Catch up with -current.
 1.2.2.1 05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.3.4.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.6.6.1 02-Oct-2003  tron Pull up revision 1.7 (requested by junyoung in ticket #1488):
count executable image pages as executable for vm-usage purposes.
also, always do the VTEXT vs. v_writecount mutual exclusion
(which we previously skipped if the text or data segment was empty).
 1.12.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.12.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.12.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.13.12.6 21-Jan-2008  yamt sync with head
 1.13.12.5 27-Oct-2007  yamt sync with head.
 1.13.12.4 03-Sep-2007  yamt sync with head.
 1.13.12.3 26-Feb-2007  yamt sync with head.
 1.13.12.2 30-Dec-2006  yamt sync with head.
 1.13.12.1 21-Jun-2006  yamt sync with head.
 1.14.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.14.10.1 08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.14.8.2 11-Aug-2006  yamt sync with head
 1.14.8.1 24-May-2006  yamt sync with head.
 1.14.6.1 01-Jun-2006  kardel Sync with head.
 1.14.4.1 09-Sep-2006  rpaulo sync with head
 1.16.6.2 10-Dec-2006  yamt sync with head.
 1.16.6.1 22-Oct-2006  yamt sync with head
 1.16.4.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.16.4.1 18-Nov-2006  ad Sync with head.
 1.19.2.2 07-May-2007  yamt sync with head.
 1.19.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.20.4.1 11-Jul-2007  mjf Sync with head.
 1.20.2.2 23-Oct-2007  ad Sync with head.
 1.20.2.1 27-May-2007  ad Sync with head.
 1.22.12.1 25-Oct-2007  bouyer Sync with HEAD.
 1.22.8.2 09-Jan-2008  matt sync with HEAD
 1.22.8.1 06-Nov-2007  matt sync with HEAD
 1.22.6.2 09-Dec-2007  jmcneill Sync with HEAD.
 1.22.6.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.24.4.1 26-Dec-2007  ad Sync with head.
 1.25.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.26.10.4 16-Sep-2009  yamt sync with head
 1.26.10.3 19-Aug-2009  yamt sync with head.
 1.26.10.2 18-Jul-2009  yamt sync with head.
 1.26.10.1 16-May-2008  yamt sync with head.
 1.26.8.1 18-May-2008  yamt sync with head.
 1.26.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.27.14.1 23-Jul-2009  jym Sync with HEAD.
 1.27.2.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.27.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.30.38.2 17-Jan-2015  martin Pull up following revision(s) (requested by maxv in ticket #427):
sys/compat/svr4/svr4_schedctl.c: revision 1.8
sys/netinet/tcp_timer.c: revision 1.88
sys/miscfs/genfs/layer_vfsops.c: revision 1.45
sys/compat/svr4/svr4_ioctl.c: revision 1.37
sys/ufs/chfs/chfs_vfsops.c: revision 1.14
sys/miscfs/fdesc/fdesc_vfsops.c: revision 1.91
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.30
sys/compat/common/kern_time_50.c: revision 1.28
sys/netinet6/ip6_forward.c: revision 1.74
sys/miscfs/umapfs/umap_vnops.c: revision 1.57
sys/compat/svr4/svr4_fcntl.c: revision 1.74
distrib/sets/lists/comp/mi: revision 1.1931
sys/netinet6/udp6_output.c: revision 1.46
sys/fs/puffs/puffs_compat.c: revision 1.3
sys/fs/udf/udf_rename.c: revision 1.11
sys/compat/svr4/svr4_filio.c: revision 1.24
sys/fs/udf/udf_rename.c: revision 1.12
sys/netinet/tcp_usrreq.c: revision 1.202
sys/miscfs/umapfs/umap_subr.c: revision 1.29
sys/compat/linux/common/linux_fadvise64.c: revision 1.3
sys/netinet/if_atm.c: revision 1.34
sys/miscfs/procfs/procfs_subr.c: revision 1.106
sys/miscfs/genfs/layer_subr.c: revision 1.37
sys/netinet/tcp_sack.c: revision 1.30
sys/compat/freebsd/freebsd_misc.c: revision 1.33
sys/compat/freebsd/freebsd_file.c: revision 1.33
sys/ufs/chfs/chfs_vnode.c: revision 1.12
sys/compat/svr4/svr4_ttold.c: revision 1.34
sys/compat/linux/common/linux_file.c: revision 1.114
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.43
sys/compat/linux/common/linux_signal.c: revision 1.76
sys/compat/common/compat_util.c: revision 1.46
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.18
sys/compat/svr4/svr4_sockio.c: revision 1.36
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.32
sys/compat/svr4/svr4_signal.c: revision 1.66
sys/kern/kern_exec.c: revision 1.410
sys/fs/puffs/puffs_vfsops.c: revision 1.115
sys/compat/svr4/svr4_exec_elf64.c: revision 1.15
sys/compat/linux/arch/i386/linux_machdep.c: revision 1.159
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.50
sys/compat/linux32/common/linux32_misc.c: revision 1.24
sys/netinet/in_pcb.c: revision 1.153
sys/sys/malloc.h: revision 1.116
sys/compat/common/if_43.c: revision 1.9
share/man/man9/Makefile: revision 1.380
sys/netinet/tcp_vtw.c: revision 1.12
sys/miscfs/umapfs/umap_vfsops.c: revision 1.95
sys/ufs/ext2fs/ext2fs_vfsops.c: revision 1.186
sys/compat/common/uipc_syscalls_43.c: revision 1.46
sys/ufs/ext2fs/ext2fs_vnops.c: revision 1.115
sys/fs/puffs/puffs_msgif.c: revision 1.97
sys/compat/svr4/svr4_ipc.c: revision 1.27
sys/compat/linux/common/linux_exec.c: revision 1.117
sys/ufs/ext2fs/ext2fs_readwrite.c: revision 1.66
sys/netinet/tcp_output.c: revision 1.179
sys/compat/svr4/svr4_termios.c: revision 1.28
sys/fs/udf/udf_strat_bootstrap.c: revision 1.4
sys/fs/puffs/puffs_subr.c: revision 1.67
sys/fs/puffs/puffs_node.c: revision 1.36
sys/miscfs/overlay/overlay_vnops.c: revision 1.21
sys/fs/cd9660/cd9660_node.c: revision 1.34
sys/netinet/raw_ip.c: revision 1.146
sys/sys/mallocvar.h: revision 1.13
sys/miscfs/overlay/overlay_vfsops.c: revision 1.63
share/man/man9/malloc.9: revision 1.50
sys/netinet6/dest6.c: revision 1.18
sys/compat/linux/common/linux_uselib.c: revision 1.33
sys/compat/linux/common/linux_socket.c: revision 1.120
share/man/man9/malloc.9: revision 1.51
sys/netinet/tcp_subr.c: revision 1.257
sys/compat/linux/common/linux_socketcall.c: revision 1.45
sys/compat/linux/common/linux_fadvise64_64.c: revision 1.3
sys/compat/freebsd/freebsd_ipc.c: revision 1.17
sys/compat/linux/common/linux_misc_notalpha.c: revision 1.109
sys/compat/linux/arch/alpha/linux_pipe.c: revision 1.17
sys/netinet6/in6_pcb.c: revision 1.132
sys/netinet6/in6_ifattach.c: revision 1.94
sys/compat/svr4/svr4_exec_elf32.c: revision 1.15
sys/miscfs/nullfs/null_vfsops.c: revision 1.90
sys/fs/cd9660/cd9660_util.c: revision 1.12
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.48
sys/compat/freebsd/freebsd_exec_elf32.c: revision 1.20
sys/miscfs/procfs/procfs_vfsops.c: revision 1.94
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.28
sys/compat/linux/common/linux_sched.c: revision 1.67
sys/compat/linux/common/linux_exec_aout.c: revision 1.67
sys/compat/linux/common/linux_pipe.c: revision 1.67
sys/compat/linux/common/linux_llseek.c: revision 1.34
sys/compat/linux/arch/mips/linux_ptrace.c: revision 1.10
Do not uselessly include <sys/malloc.h>.
Cleanup:
- remove struct kmembuckets (dead)
- correctly deadify MALLOC_XX
- remove MALLOC_DEFINE_LIMIT and MALLOC_JUSTDEFINE_LIMIT (dead)
- remove malloc_roundup(), malloc_type_setlimit(), MALLOC_DEFINE_LIMIT()
and MALLOC_JUSTDEFINE_LIMIT() from man 9 malloc
New sentence, new line. Bump date for previous.
Obsolete malloc_roundup(9), malloc_type_setlimit(9) and MALLOC_DEFINE_LIMIT(9)
man pages.
 1.30.38.1 29-Dec-2014  martin Pull up following revision(s) (requested by maxv in ticket #353):
sys/ufs/chfs/chfs_vfsops.c: revision 1.12
sys/compat/common/vfs_syscalls_30.c: revision 1.35
sys/compat/linux/common/linux_uselib.c: revision 1.31
sys/compat/linux/common/linux_uselib.c: revision 1.32
Resource leak.
Memory leaks.
Reject non-regular files.
 1.30.22.1 03-Dec-2017  jdolecek update from HEAD
 1.11 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.10 01-Dec-2000  jdolecek branches: 1.10.122; 1.10.124; 1.10.126;
add e_path (emulation path) to struct emul, which replaces emulation-specific
*_emul_path variables

change macros CHECK_ALT_{CREAT|EXIST} to use that, 'root' doesn't need
to be passed explicitly any more and *_CHECK_ALT_{CREAT|EXIST} are removed
change explicit emul_find() calls in probe functions to get the emulation
path from the checked exec switch entry's emulation

remove no longer needed header files

add e_flags and e_syscall to struct emul; these are unsed and empty for now
 1.9 04-Oct-1998  fvdl branches: 1.9.12;
Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.8 03-Oct-1998  christos Attempt to fix the mess.
 1.7 01-Oct-1998  erh Move compat/linux/linux_util.h to common.
 1.6 05-Sep-1998  christos Assign copyright to TNF.
 1.5 24-Jun-1995  christos Use compat_util.[ch].
 1.4 22-Jun-1995  fvdl * Changed to use generic ELF code from kern/exec_elf.c (which was taken
from the svr4 exec code plus the linux compat mods)
* Include file change
* Add multicast sockopts (from John Brezak)
 1.3 07-Apr-1995  fvdl Handle Linux signal tramp code differently. Some changes because of the
now seperate Linux signal trampoline code. Add linux_sigreturn to
syscalls.master.
 1.2 05-Mar-1995  fvdl Added a few more system calls.
More consistent alternate root file semantics throughout.
 1.1 28-Feb-1995  fvdl Added Linux compat code.
 1.9.12.1 08-Dec-2000  bouyer Sync with HEAD.
 1.10.126.1 16-May-2008  yamt sync with head.
 1.10.124.1 18-May-2008  yamt sync with head.
 1.10.122.1 02-Jun-2008  mjf Sync with HEAD.
 1.1 16-Jan-2017  christos branches: 1.1.2; 1.1.4; 1.1.8; 1.1.18;
Descend
 1.1.18.2 03-Dec-2017  jdolecek update from HEAD
 1.1.18.1 16-Jan-2017  jdolecek file Makefile was added on branch tls-maxphys on 2017-12-03 11:36:55 +0000
 1.1.8.2 21-Apr-2017  bouyer Sync with HEAD
 1.1.8.1 16-Jan-2017  bouyer file Makefile was added on branch bouyer-socketcan on 2017-04-21 16:53:42 +0000
 1.1.4.2 20-Mar-2017  pgoyette Sync with HEAD
 1.1.4.1 16-Jan-2017  pgoyette file Makefile was added on branch pgoyette-localcount on 2017-03-20 06:57:25 +0000
 1.1.2.2 05-Feb-2017  skrll Sync with HEAD
 1.1.2.1 16-Jan-2017  skrll file Makefile was added on branch nick-nhusb on 2017-02-05 13:40:25 +0000
 1.4 16-Jan-2017  christos Descend
 1.3 14-Jan-2014  christos branches: 1.3.6; 1.3.10; 1.3.14;
use new bsd.syscall.mk
 1.2 23-Mar-2007  njoly branches: 1.2.70; 1.2.80; 1.2.86;
Fix generated file names from makesyscalls.sh (s/linux/linux32/).
From Edgar Fu� in PR/35956.
 1.1 09-Feb-2006  manu branches: 1.1.2; 1.1.10; 1.1.16; 1.1.22; 1.1.26; 1.1.28; 1.1.32; 1.1.34; 1.1.36;
Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.1.36.1 29-Mar-2007  reinoud Pullup to -current
 1.1.34.1 11-Jul-2007  mjf Sync with head.
 1.1.32.1 10-Apr-2007  ad Sync with head.
 1.1.28.1 24-Mar-2007  yamt sync with head.
 1.1.26.1 31-Mar-2007  bouyer Pull up following revision(s) (requested by njoly in ticket #543):
sys/compat/linux32/Makefile.inc: revision 1.2
Fix generated file names from makesyscalls.sh (s/linux/linux32/).
From Edgar Fu� in PR/35956.
 1.1.22.2 09-Sep-2006  rpaulo sync with head
 1.1.22.1 09-Feb-2006  rpaulo file Makefile.inc was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:45:52 +0000
 1.1.16.3 03-Sep-2007  yamt sync with head.
 1.1.16.2 21-Jun-2006  yamt sync with head.
 1.1.16.1 09-Feb-2006  yamt file Makefile.inc was added on branch yamt-lazymbuf on 2006-06-21 14:59:27 +0000
 1.1.10.2 22-Apr-2006  simonb Sync with head.
 1.1.10.1 09-Feb-2006  simonb file Makefile.inc was added on branch simonb-timecounters on 2006-04-22 11:38:14 +0000
 1.1.2.2 18-Feb-2006  yamt sync with head.
 1.1.2.1 09-Feb-2006  yamt file Makefile.inc was added on branch yamt-uio_vmspace on 2006-02-18 15:38:59 +0000
 1.2.86.1 18-May-2014  rmind sync with head
 1.2.80.2 03-Dec-2017  jdolecek update from HEAD
 1.2.80.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.70.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.3.14.1 21-Apr-2017  bouyer Sync with HEAD
 1.3.10.1 20-Mar-2017  pgoyette Sync with HEAD
 1.3.6.1 05-Feb-2017  skrll Sync with HEAD
 1.7 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.6 17-Nov-2014  uebayasi branches: 1.6.18; 1.6.20;
Define compat modules (but without dependencies yet).
 1.5 19-Nov-2008  ad branches: 1.5.26;
Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.4 11-Apr-2007  njoly branches: 1.4.30; 1.4.34; 1.4.40; 1.4.44;
- Add compat amd64 linux32 statfs support, adapted from PR/35956.
- Move bsd_to_linux_statfs() function to its own file to be shared
between both linux compats.

ok by manu.
 1.3 13-Sep-2006  manu branches: 1.3.4; 1.3.6; 1.3.10; 1.3.12;
Jumbo COMPAT_LINUX/COMPAT_LINUX32 bugfix, with the help of Nicolas Joly
- Fix shmat return value on amd64: it uses no black magic with retval[0]
- Fix integer overflows in sysinfo
- Implement sysinfo, mmap2, sched_getparam, sched_getscheduler, mremap,
and madvise in COMPAT_LINUX32
- Fix improper types used in setgroups16/getgroups16
- Implement mmap2 for COMPAT_LINUX32
- Ifdef debug messages by DEBUG_LINUX
 1.2 15-Feb-2006  manu branches: 1.2.2; 1.2.4; 1.2.10; 1.2.16; 1.2.20; 1.2.22;
- Move the BSD to Linux and Linux to BSD termio/termios conversion functions
to a header where they can be shared between COMPAT_LINUX and COMPAT_LINUX32
- Add termios ioctl emulation to COMPAT_LINUX32
- Add the getcwd system call to COMPAT_LINUX32/amd64

That makes Linux's bash working with COMPAT_LINUX32.
 1.1 09-Feb-2006  manu Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.2.22.2 09-Sep-2006  rpaulo sync with head
 1.2.22.1 15-Feb-2006  rpaulo file files.linux32 was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:45:52 +0000
 1.2.20.1 18-Nov-2006  ad Sync with head.
 1.2.16.4 03-Sep-2007  yamt sync with head.
 1.2.16.3 30-Dec-2006  yamt sync with head.
 1.2.16.2 21-Jun-2006  yamt sync with head.
 1.2.16.1 15-Feb-2006  yamt file files.linux32 was added on branch yamt-lazymbuf on 2006-06-21 14:59:27 +0000
 1.2.10.2 22-Apr-2006  simonb Sync with head.
 1.2.10.1 15-Feb-2006  simonb file files.linux32 was added on branch simonb-timecounters on 2006-04-22 11:38:14 +0000
 1.2.4.1 14-Sep-2006  yamt sync with head.
 1.2.2.2 18-Feb-2006  yamt sync with head.
 1.2.2.1 15-Feb-2006  yamt file files.linux32 was added on branch yamt-uio_vmspace on 2006-02-18 15:38:59 +0000
 1.3.12.1 11-Jul-2007  mjf Sync with head.
 1.3.10.1 27-May-2007  ad Sync with head.
 1.3.6.1 15-Apr-2007  yamt sync with head.
 1.3.4.1 20-Apr-2007  bouyer Pull up following revision(s) (requested by njoly in ticket #582):
sys/compat/linux32/common/linux32_types.h: revision 1.4 via patch
sys/compat/linux32/arch/amd64/syscalls.master: revision 1.14 via patch
sys/compat/linux/common/linux_statfs.h: revision 1.1 via patch
sys/compat/linux/common/linux_misc.c: revision 1.170 via patch
sys/compat/linux32/common/linux32_misc.c: revision 1.5 via patch
sys/compat/linux32/files.linux32: revision 1.4 via patch
- Add compat amd64 linux32 statfs support, adapted from PR/35956.
- Move bsd_to_linux_statfs() function to its own file to be shared
between both linux compats.
 1.4.44.1 19-Jan-2009  skrll Sync with HEAD.
 1.4.40.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.4.34.1 04-May-2009  yamt sync with head.
 1.4.30.1 17-Jan-2009  mjf Sync with HEAD.
 1.5.26.1 03-Dec-2017  jdolecek update from HEAD
 1.6.20.1 10-Jun-2019  christos Sync with HEAD
 1.6.18.1 12-Mar-2018  pgoyette Update dependencies for modules when they are built-in. Now we don't
(or at least, shouldn't) need reminders in the GENERIC config files
about which module options require other options.

Update branch status doc accordingly.
 1.2 25-Nov-2021  ryo add support COMPAT_LINUX32 for aarch64
 1.1 09-Feb-2006  manu branches: 1.1.2; 1.1.10; 1.1.16; 1.1.22;
Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.1.22.2 09-Sep-2006  rpaulo sync with head
 1.1.22.1 09-Feb-2006  rpaulo file linux32_syscall.h was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:45:52 +0000
 1.1.16.2 21-Jun-2006  yamt sync with head.
 1.1.16.1 09-Feb-2006  yamt file linux32_syscall.h was added on branch yamt-lazymbuf on 2006-06-21 14:59:27 +0000
 1.1.10.2 22-Apr-2006  simonb Sync with head.
 1.1.10.1 09-Feb-2006  simonb file linux32_syscall.h was added on branch simonb-timecounters on 2006-04-22 11:38:14 +0000
 1.1.2.2 18-Feb-2006  yamt sync with head.
 1.1.2.1 09-Feb-2006  yamt file linux32_syscall.h was added on branch yamt-uio_vmspace on 2006-02-18 15:38:59 +0000
 1.2 25-Nov-2021  ryo add support COMPAT_LINUX32 for aarch64
 1.1 09-Feb-2006  manu branches: 1.1.2; 1.1.10; 1.1.16; 1.1.22;
Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.1.22.2 09-Sep-2006  rpaulo sync with head
 1.1.22.1 09-Feb-2006  rpaulo file linux32_syscallargs.h was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:45:52 +0000
 1.1.16.2 21-Jun-2006  yamt sync with head.
 1.1.16.1 09-Feb-2006  yamt file linux32_syscallargs.h was added on branch yamt-lazymbuf on 2006-06-21 14:59:27 +0000
 1.1.10.2 22-Apr-2006  simonb Sync with head.
 1.1.10.1 09-Feb-2006  simonb file linux32_syscallargs.h was added on branch simonb-timecounters on 2006-04-22 11:38:14 +0000
 1.1.2.2 18-Feb-2006  yamt sync with head.
 1.1.2.1 09-Feb-2006  yamt file linux32_syscallargs.h was added on branch yamt-uio_vmspace on 2006-02-18 15:38:59 +0000
 1.2 25-Nov-2021  ryo add support COMPAT_LINUX32 for aarch64
 1.1 09-Feb-2006  manu branches: 1.1.2; 1.1.10; 1.1.16; 1.1.22;
Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.1.22.2 09-Sep-2006  rpaulo sync with head
 1.1.22.1 09-Feb-2006  rpaulo file linux32_syscalls.c was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:45:52 +0000
 1.1.16.2 21-Jun-2006  yamt sync with head.
 1.1.16.1 09-Feb-2006  yamt file linux32_syscalls.c was added on branch yamt-lazymbuf on 2006-06-21 14:59:27 +0000
 1.1.10.2 22-Apr-2006  simonb Sync with head.
 1.1.10.1 09-Feb-2006  simonb file linux32_syscalls.c was added on branch simonb-timecounters on 2006-04-22 11:38:14 +0000
 1.1.2.2 18-Feb-2006  yamt sync with head.
 1.1.2.1 09-Feb-2006  yamt file linux32_syscalls.c was added on branch yamt-uio_vmspace on 2006-02-18 15:38:59 +0000
 1.2 25-Nov-2021  ryo add support COMPAT_LINUX32 for aarch64
 1.1 07-Mar-2015  christos branches: 1.1.2; 1.1.18;
centralize arguments functions
 1.1.18.2 03-Dec-2017  jdolecek update from HEAD
 1.1.18.1 07-Mar-2015  jdolecek file linux32_systrace_args.c was added on branch tls-maxphys on 2017-12-03 11:36:55 +0000
 1.1.2.2 06-Apr-2015  skrll Sync with HEAD
 1.1.2.1 07-Mar-2015  skrll file linux32_systrace_args.c was added on branch nick-nhusb on 2015-04-06 15:18:06 +0000
 1.2 25-Nov-2021  ryo add support COMPAT_LINUX32 for aarch64
 1.1 16-Jan-2017  christos branches: 1.1.2; 1.1.4; 1.1.8; 1.1.18;
descend and regen
 1.1.18.2 03-Dec-2017  jdolecek update from HEAD
 1.1.18.1 16-Jan-2017  jdolecek file Makefile was added on branch tls-maxphys on 2017-12-03 11:36:55 +0000
 1.1.8.2 21-Apr-2017  bouyer Sync with HEAD
 1.1.8.1 16-Jan-2017  bouyer file Makefile was added on branch bouyer-socketcan on 2017-04-21 16:53:42 +0000
 1.1.4.2 20-Mar-2017  pgoyette Sync with HEAD
 1.1.4.1 16-Jan-2017  pgoyette file Makefile was added on branch pgoyette-localcount on 2017-03-20 06:57:25 +0000
 1.1.2.2 05-Feb-2017  skrll Sync with HEAD
 1.1.2.1 16-Jan-2017  skrll file Makefile was added on branch nick-nhusb on 2017-02-05 13:40:25 +0000
 1.1 25-Nov-2021  ryo add support COMPAT_LINUX32 for aarch64
 1.1 25-Nov-2021  ryo add support COMPAT_LINUX32 for aarch64
 1.1 25-Nov-2021  ryo add support COMPAT_LINUX32 for aarch64
 1.2 26-Nov-2021  ryo - LINUX_GO_RT0_SIGNATURE for compat_linux is no longer enabled by default.
it is now defined in each arch same as the other *_SIGNATURE definitions.
- add new LINUX32_GO_RT0_SIGNATURE for compat_linux32, and is defined in amd64 and aarch64.
 1.1 25-Nov-2021  ryo add support COMPAT_LINUX32 for aarch64
 1.2 09-Apr-2023  riastradh compat_linux32: KASSERT(A && B) -> KASSERT(A); KASSERT(B)
 1.1 25-Nov-2021  ryo add support COMPAT_LINUX32 for aarch64
 1.1 25-Nov-2021  ryo add support COMPAT_LINUX32 for aarch64
 1.1 25-Nov-2021  ryo add support COMPAT_LINUX32 for aarch64
 1.3 07-Feb-2024  msaitoh Remove ryo@'s mail addresses.
 1.2 03-Dec-2021  ryo Fixed a bug in sigreturn that sigmask was not restored.
 1.1 25-Nov-2021  ryo add support COMPAT_LINUX32 for aarch64
 1.1 25-Nov-2021  ryo add support COMPAT_LINUX32 for aarch64
 1.1 25-Nov-2021  ryo add support COMPAT_LINUX32 for aarch64
 1.1 25-Nov-2021  ryo add support COMPAT_LINUX32 for aarch64
 1.2 07-Feb-2024  msaitoh Remove ryo@'s mail addresses.
 1.1 25-Nov-2021  ryo add support COMPAT_LINUX32 for aarch64
 1.1 25-Nov-2021  ryo add support COMPAT_LINUX32 for aarch64
 1.1 25-Nov-2021  ryo add support COMPAT_LINUX32 for aarch64
 1.3 02-Dec-2021  ryo regen
 1.2 27-Nov-2021  ryo regen
 1.1 25-Nov-2021  ryo add support COMPAT_LINUX32 for aarch64
 1.3 02-Dec-2021  ryo regen
 1.2 27-Nov-2021  ryo regen
 1.1 25-Nov-2021  ryo add support COMPAT_LINUX32 for aarch64
 1.3 02-Dec-2021  ryo regen
 1.2 27-Nov-2021  ryo regen
 1.1 25-Nov-2021  ryo add support COMPAT_LINUX32 for aarch64
 1.3 02-Dec-2021  ryo regen
 1.2 27-Nov-2021  ryo regen
 1.1 25-Nov-2021  ryo add support COMPAT_LINUX32 for aarch64
 1.3 02-Dec-2021  ryo regen
 1.2 27-Nov-2021  ryo regen
 1.1 25-Nov-2021  ryo add support COMPAT_LINUX32 for aarch64
 1.1 25-Nov-2021  ryo add support COMPAT_LINUX32 for aarch64
 1.1 25-Nov-2021  ryo add support COMPAT_LINUX32 for aarch64
 1.1 25-Nov-2021  ryo add support COMPAT_LINUX32 for aarch64
 1.3 02-Dec-2021  ryo add prlimit64(2) syscall to COMPAT_LINUX and COMPAT_LINUX32
 1.2 27-Nov-2021  ryo Add pselect6(2) system call to COMPAT_LINUX32
 1.1 25-Nov-2021  ryo add support COMPAT_LINUX32 for aarch64
 1.2 04-May-2014  njoly Remove now unneeded bsd.kinc.mk.
 1.1 09-Feb-2006  manu branches: 1.1.2; 1.1.10; 1.1.16; 1.1.22; 1.1.112; 1.1.122; 1.1.128; 1.1.138;
Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.1.138.1 10-Aug-2014  tls Rebase.
 1.1.128.1 18-May-2014  rmind sync with head
 1.1.122.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.112.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.1.22.2 09-Sep-2006  rpaulo sync with head
 1.1.22.1 09-Feb-2006  rpaulo file Makefile was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:45:52 +0000
 1.1.16.2 21-Jun-2006  yamt sync with head.
 1.1.16.1 09-Feb-2006  yamt file Makefile was added on branch yamt-lazymbuf on 2006-06-21 14:59:27 +0000
 1.1.10.2 22-Apr-2006  simonb Sync with head.
 1.1.10.1 09-Feb-2006  simonb file Makefile was added on branch simonb-timecounters on 2006-04-22 11:38:14 +0000
 1.1.2.2 18-Feb-2006  yamt sync with head.
 1.1.2.1 09-Feb-2006  yamt file Makefile was added on branch yamt-uio_vmspace on 2006-02-18 15:38:59 +0000
 1.3 20-May-2008  njoly Add compat linux32 ipc(2) syscall support, for shared memory and
semaphores.
 1.2 15-Jan-2008  njoly branches: 1.2.6; 1.2.8; 1.2.10; 1.2.12;
compat linux (and linux32) uid16 functions cleanup and fixes.

- Move uid16 functions to their own file linux_uid16.c, included by
needed archs (arm, i386 and m68k).
- Add new MI types linux_{u,g}id16_t.
- Add macros to handle linux_uid16_t and uid_t conversions.
- Add linux_sys_getres{uid,gid}16 syscalls, to fix an overflow with
bad sizes given to copyout when linux_sys_getres{uid,gid} are used.
- Update arm syscall table to use more uid16 functions.
 1.1 09-Feb-2006  manu branches: 1.1.2; 1.1.10; 1.1.16; 1.1.22; 1.1.48; 1.1.54; 1.1.62;
Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.1.62.1 19-Jan-2008  bouyer Sync with HEAD
 1.1.54.1 18-Feb-2008  mjf Sync with HEAD.
 1.1.48.1 23-Mar-2008  matt sync with HEAD
 1.1.22.2 09-Sep-2006  rpaulo sync with head
 1.1.22.1 09-Feb-2006  rpaulo file files.linux32_amd64 was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:45:52 +0000
 1.1.16.3 21-Jan-2008  yamt sync with head
 1.1.16.2 21-Jun-2006  yamt sync with head.
 1.1.16.1 09-Feb-2006  yamt file files.linux32_amd64 was added on branch yamt-lazymbuf on 2006-06-21 14:59:27 +0000
 1.1.10.2 22-Apr-2006  simonb Sync with head.
 1.1.10.1 09-Feb-2006  simonb file files.linux32_amd64 was added on branch simonb-timecounters on 2006-04-22 11:38:14 +0000
 1.1.2.2 18-Feb-2006  yamt sync with head.
 1.1.2.1 09-Feb-2006  yamt file files.linux32_amd64 was added on branch yamt-uio_vmspace on 2006-02-18 15:38:59 +0000
 1.2.12.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.2.10.1 04-May-2009  yamt sync with head.
 1.2.8.1 04-Jun-2008  yamt sync with head
 1.2.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.1 09-Feb-2006  manu branches: 1.1.2; 1.1.10; 1.1.16; 1.1.22;
Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.1.22.2 09-Sep-2006  rpaulo sync with head
 1.1.22.1 09-Feb-2006  rpaulo file linux32_errno.h was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:45:52 +0000
 1.1.16.2 21-Jun-2006  yamt sync with head.
 1.1.16.1 09-Feb-2006  yamt file linux32_errno.h was added on branch yamt-lazymbuf on 2006-06-21 14:59:27 +0000
 1.1.10.2 22-Apr-2006  simonb Sync with head.
 1.1.10.1 09-Feb-2006  simonb file linux32_errno.h was added on branch simonb-timecounters on 2006-04-22 11:38:14 +0000
 1.1.2.2 18-Feb-2006  yamt sync with head.
 1.1.2.1 09-Feb-2006  yamt file linux32_errno.h was added on branch yamt-uio_vmspace on 2006-02-18 15:38:59 +0000
 1.10 26-Nov-2021  ryo - LINUX_GO_RT0_SIGNATURE for compat_linux is no longer enabled by default.
it is now defined in each arch same as the other *_SIGNATURE definitions.
- add new LINUX32_GO_RT0_SIGNATURE for compat_linux32, and is defined in amd64 and aarch64.
 1.9 25-Nov-2021  ryo Extra arguments for AT_HWCAP and AT_PLATFORM are now passed when executing linux32 binaries.

AT_SYSINFO (vsyscall) feature seems to be broken, so leave it commented out.
 1.8 25-Nov-2021  ryo The default name of the `exec_setup_stack' function for linux32 should be `linux32_exec_setup_stack',
and it should be defined in each arch.
declaration of linux32_exec_setup_stack() in linux32/amd64 has been removed because it does not exist.

NFC.
 1.7 26-Apr-2017  christos catch up with unit fixes for es_arglen; consistently use bytes.
 1.6 21-Feb-2014  maxv branches: 1.6.6; 1.6.20;
Increase LINUX32_ELF_AUX_ENTRIES to avoid overrun in linux32/. Also,
add comments and KASSERTs to make sure people don't forget to increase
XX_AUX_ENTRIES's when adding vectors.

Reported by martin@ (CV), with suggestions from chs@.

ok martin@ chs@
 1.5 09-Feb-2014  chs account for the 16 bytes of AT_RANDOM data in the stack setup. fixes PR 48518.
use cprng_strong32() instead of random(). add AT_RANDOM support for linux32.
 1.4 07-Jul-2010  chs branches: 1.4.8; 1.4.18; 1.4.22;
many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
- support new-style (NPTL) linux pthreads on all platforms.
clone() with CLONE_THREAD uses 1 process with many LWPs
instead of separate processes.
- move the contents of sys__lwp_setprivate() into a new
lwp_setprivate() and use that everywhere.
- update linux_release[] and linux32_release[] to "2.6.18".
- adjust placement of emul fork/exec/exit hooks as needed
and adjust other emul code to match.
- convert all struct emul definitions to use named initializers.
- change the pid allocator to allow multiple pids to refer to the same proc.
- remove a few fields from struct proc that are no longer needed.
- disable the non-functional "vdso" code in linux32/amd64,
glibc works fine without it.
- fix a race in the futex code where we could miss a wakeup after
a requeue operation.
- redo futex locking to be a little more efficient.
 1.3 18-Apr-2010  jym This patch fixes the NX regression issue observed on amd64 kernels, where
per-page execution right was disabled (therefore leading to the inability
of the kernel to detect fraudulent use of memory mappings marked as not
being executable).

- replace cpu_feature and ci_feature_flags variables by cpu_feature and
ci_feat_val arrays. This makes it cleaner and brings kernel code closer
to the design of cpuctl(8). A warning will be raised for each CPU that
does not expose the same features as the Boot Processor (BP).

- the blacklist of CPU features is now a macro defined in the
specialreg.h header, instead of hardcoding it inside MD initialization
code; fix comments.

- replace checks against CPUID_TSC with the cpu_hascounter() function.

- clean up the code in init_x86_64(), as cpu_feature variables are set
inside cpu_probe().

- use cpu_init_msrs() for i386. It will be eventually used later for NX
feature under i386 PAE kernels.

- remove code that checks for CPUID_NOX in amd64 mptramp.S, this is already
performed by cpu_hatch() through cpu_init_msrs().

- remove cpu_signature and feature_flags members from struct mpbios_proc
(they were never used).

This patch was tested with i386 MONOLITHIC, XEN3PAE_DOM0 and XEN3_DOM0 under
a native i386 host, and amd64 GENERIC, XEN3_DOM0 via QEMU virtual machines.

XXX Should kernel rev be bumped?

XXX A similar patch should be pulled-up for NetBSD-5, hopefully tomorrow.
 1.2 07-Aug-2006  manu branches: 1.2.6; 1.2.60; 1.2.82; 1.2.84;
Add a new signature test for linux probe function. We look for a .debuglink
section, which is specific to the Linux dynamic interpeter (yes, Linux
can execute it as a stand alone program)
 1.1 09-Feb-2006  manu branches: 1.1.2; 1.1.4; 1.1.10; 1.1.16;
Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.1.16.3 30-Dec-2006  yamt sync with head.
 1.1.16.2 21-Jun-2006  yamt sync with head.
 1.1.16.1 09-Feb-2006  yamt file linux32_exec.h was added on branch yamt-lazymbuf on 2006-06-21 14:59:27 +0000
 1.1.10.2 22-Apr-2006  simonb Sync with head.
 1.1.10.1 09-Feb-2006  simonb file linux32_exec.h was added on branch simonb-timecounters on 2006-04-22 11:38:14 +0000
 1.1.4.1 11-Aug-2006  yamt sync with head
 1.1.2.2 18-Feb-2006  yamt sync with head.
 1.1.2.1 09-Feb-2006  yamt file linux32_exec.h was added on branch yamt-uio_vmspace on 2006-02-18 15:38:59 +0000
 1.2.84.2 05-Mar-2011  rmind sync with head
 1.2.84.1 30-May-2010  rmind sync with head
 1.2.82.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.2.82.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.2.60.1 11-Aug-2010  yamt sync with head.
 1.2.6.2 09-Sep-2006  rpaulo sync with head
 1.2.6.1 07-Aug-2006  rpaulo file linux32_exec.h was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:45:52 +0000
 1.4.22.1 18-May-2014  rmind sync with head
 1.4.18.2 03-Dec-2017  jdolecek update from HEAD
 1.4.18.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.4.8.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.6.20.1 02-May-2017  pgoyette Sync with HEAD - tag prg-localcount2-base1
 1.6.6.1 28-Aug-2017  skrll Sync with HEAD
 1.1 25-Nov-2021  ryo - Use LINUX32_F_xxx instead of LINUX_F_xxx for compat_linux32.
aarch64 and arm have different values.
- Compile linux32_sys_fadvise64() only if the syscall is required.
 1.1 15-Feb-2006  manu branches: 1.1.2; 1.1.10; 1.1.16; 1.1.22;
- Move the BSD to Linux and Linux to BSD termio/termios conversion functions
to a header where they can be shared between COMPAT_LINUX and COMPAT_LINUX32
- Add termios ioctl emulation to COMPAT_LINUX32
- Add the getcwd system call to COMPAT_LINUX32/amd64

That makes Linux's bash working with COMPAT_LINUX32.
 1.1.22.2 09-Sep-2006  rpaulo sync with head
 1.1.22.1 15-Feb-2006  rpaulo file linux32_ioctl.h was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:45:52 +0000
 1.1.16.2 21-Jun-2006  yamt sync with head.
 1.1.16.1 15-Feb-2006  yamt file linux32_ioctl.h was added on branch yamt-lazymbuf on 2006-06-21 14:59:27 +0000
 1.1.10.2 22-Apr-2006  simonb Sync with head.
 1.1.10.1 15-Feb-2006  simonb file linux32_ioctl.h was added on branch simonb-timecounters on 2006-04-22 11:38:14 +0000
 1.1.2.2 18-Feb-2006  yamt sync with head.
 1.1.2.1 15-Feb-2006  yamt file linux32_ioctl.h was added on branch yamt-uio_vmspace on 2006-02-18 15:38:59 +0000
 1.48 20-Jun-2023  riastradh linux32_rt_sendsig: Memset zero before copyout.

Not sure if there's any padding here, but it's a pretty big
structure, fairly likely, so let's be rather safe than sorry.

XXX pullup-8
XXX pullup-9
XXX pullup-10
 1.47 01-Nov-2021  thorpej branches: 1.47.4;
Use "stack_t" instead of "struct sigaltstack", as the former is the
newer standardized name. NFC.
 1.46 07-Sep-2021  riastradh sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.45 19-May-2019  maxv branches: 1.45.2;
Rename

fpu_save_area_clear -> fpu_clear
fpu_save_area_reset -> fpu_sigreset

Clearer, and reduces a future diff. No real functional change.
 1.44 24-Mar-2019  maxv Disable preemption when setting PCB_COMPAT32, to prevent a context switch
before cpu_fsgs_reload() finishes, otherwise we write garbage in the GDT.
On NetBSD-current it is harmless, however in NetBSD-8 it might cause
panics, because NetBSD-8 uses the old SegRegs model and under this model
we reload %fs and %gs during switches.
 1.43 21-Oct-2017  maxv branches: 1.43.4;
Include opt_user_ldt.h when needed.
 1.42 19-Oct-2017  maxv Always mask the 16 bits of the segregs in the trapframe. We don't zero-
extend the uint64_t's when building it, so we're leaking 48 bits of kernel
stack to userland.

Having said that, it appears that I unintentionally fixed most of this
issue in locore.S::rev1.127 - by building the frame with interrupts
disabled, we are implicitly guaranteeing that the structure doesn't get
overwritten by the kernel. Which means, we are leaking to userland data
that comes from userland anyway.

(still other places with this issue, but I'll fix them differently)
 1.41 15-Oct-2017  maxv Use two separate functions: cpu_segregs32_zero and cpu_segregs64_zero. The
way segment registers work on amd64 will diverge between 32bit and 64bit
LWPs.
 1.40 15-Oct-2017  maxv Make sure the 32bit LWPs don't have MDL_IRET set. That's not a problem
right now, but will be in the future.
 1.39 02-Sep-2017  maxv Fix a subtle ring0 escalation vulnerability in amd64, and implement a
mitigation against similar bugs.

The operations on segment registers can generate a page fault if there is
an issue when touching the in-memory gdt. Theoretically, it is never
supposed to happen, since the gdt is mapped correctly. However, in the
kernel we allow the gdt to be resized, and to do that, we allocate the
maximum amount of va needed by it, but only kenter a few pages until we
need more. Moreover, to avoid reloading the gdt each time we grow it, the
'size' field of gdtr is set to the maximum value. All of this means that
if a mov or iretq is done with a segment register whose index hits a page
that has not been kentered, a page fault is sent.

Such a page fault, if received in kernel mode, does not trigger a swapgs
on amd64; in other words, the kernel would be re-entered with the userland
tls.

And there just happens to be a place in compat_linux32 where the index of
%cs is controlled by userland, making it easy to trigger the page fault
and get kernel privileges.

The mitigation simply consists in abandoning the gdt_grow mechanism and
allocating/kentering the maximum size right away, in such a way that no
page fault can be triggered because of segment registers.
 1.38 05-Feb-2017  maxv branches: 1.38.6;
Remove #if 0 on USER_LDT.
 1.37 02-Sep-2016  maxv branches: 1.37.2;
Fix argument (does not compile anyway).
 1.36 19-Feb-2014  dsl branches: 1.36.4; 1.36.6; 1.36.8; 1.36.10; 1.36.14;
Explicitly include x86/fpu.h instead of relying in x86/frame.h including it.
 1.35 15-Feb-2014  dsl Remove all references to MDL_USEDFPU and deferred fpu initialisation.
The cost of zeroing the save area on exec is minimal.
This stops the FP registers of a random process being used the first
time an lwp uses the fpu.
sendsig_siginfo() and get_mcontext() now unconditionally copy the FP
registers.
I'll remove the double-copy for signal handlers soon.
get_mcontext() might have been leaking kernel memory to userspace - and
may still do so if i386_use_fxsave is false (short copies).
 1.34 07-Feb-2014  dsl Convert the amd64 build to use x86/cpu_extended_state.h so that the fpu
definitions match those of i386.
Mostly just structure and field renames, in addition:
1) process_xmm_to_s87() and process_s87_to_xmm() moved into
x86/convert_xmm_s87.c so they can be used by amd64's netbsd32 code.
2) The linux signal code simplified to use a structure copy for ths fxsave
data - it matches the hardware definition and won't change.
 1.33 01-Dec-2013  christos revert fpu/pcu changes until we figure out what's wrong; they cause random
freezes
 1.32 23-Oct-2013  drochner Use the MI "pcu" framework for bookkeeping of npx/fpu states on x86.
This reduces the amount of MD code enormously, and makes it easier
to implement support for newer CPU features which require more fpu
state, or for fpu usage by the kernel.
For access to FPU state across CPUs, an xcall kthread is used now
rather than a dedicated IPI.
No user visible changes intended.
 1.31 15-Jul-2012  dsl branches: 1.31.2; 1.31.4;
Rename MDP_IRET to MDL_IRET since it is an lwp flag, not a proc one.
Add an MDL_COMPAT32 flag to the lwp's md_flags, set it for 32bit lwps
and use it to force 'return to user' with iret (as is done when
MDL_IRET is set).
Split the iret/sysret code paths much later.
Remove all the replicated code for 32bit system calls - which was only
needed so that iret was always used.
frameasm.h for XEN contains '#define swapgs', while XEN probable never
needs swapgs, this is likely to be confusing.
Add a SWAPGS which is a nop on XEN and swapgs otherwise.
(I've not yet checked all the swapgs in files that include frameasm.h)
Simple x86 programs still work.
Hijack 6.99.9 kernel bump (needed for compat32 modules)
 1.30 08-Jul-2012  dsl The MDP_USEDFPU (amd64 and sh3) and MDP_SSTEP (sh3) are lwp flags not
process ones, rename to MDL_xxx.
 1.29 04-Mar-2011  joerg branches: 1.29.4; 1.29.10; 1.29.14; 1.29.16;
Refactor ps_strings access. Based on PK_32, write either the normal
version or the 32bit compat layout in execve1. Introduce a new function
copyin_psstrings for reading it back from userland and converting it to
the native layout. Refactor procfs to share most of the code with the
kern.proc_args sysctl handler.

This material is based upon work partially supported by
The NetBSD Foundation under a contract with Joerg Sonnenberger.
 1.28 07-Feb-2011  chs move macros for validating fs/gs to segments.h and use them
in the linux32 code as well.
 1.27 02-Nov-2010  chs branches: 1.27.2; 1.27.4;
implement the following syscalls for linux32:
truncate64
ftruncate64
profil
ioperm
iopl
setdomainname
modify_ldt
statfs64
fstatfs64

note that iopl(), ioperm() and modify_ldt() just call
the respective 64-bit handlers, which don't do anything yet.
 1.26 12-Jul-2010  christos fix debugging build.
 1.25 07-Jul-2010  jmmv Add missing includes to bring the linux_semun type needed by
linux_syscallargs.h.
 1.24 07-Jul-2010  chs many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
- support new-style (NPTL) linux pthreads on all platforms.
clone() with CLONE_THREAD uses 1 process with many LWPs
instead of separate processes.
- move the contents of sys__lwp_setprivate() into a new
lwp_setprivate() and use that everywhere.
- update linux_release[] and linux32_release[] to "2.6.18".
- adjust placement of emul fork/exec/exit hooks as needed
and adjust other emul code to match.
- convert all struct emul definitions to use named initializers.
- change the pid allocator to allow multiple pids to refer to the same proc.
- remove a few fields from struct proc that are no longer needed.
- disable the non-functional "vdso" code in linux32/amd64,
glibc works fine without it.
- fix a race in the futex code where we could miss a wakeup after
a requeue operation.
- redo futex locking to be a little more efficient.
 1.23 23-Nov-2009  rmind branches: 1.23.2; 1.23.4;
Use lwp_getpcb() in compat code, clean from struct user.
 1.22 29-May-2009  njoly Add native to linux siginfo si_status translation, used on i386 and
amd64.
 1.21 15-Mar-2009  cegger ansify function definitions
 1.20 19-Oct-2008  njoly branches: 1.20.2; 1.20.8;
Add native to linux siginfo si_code translation, mostly for negative
values. Adjust amd64 and i386 accordingly, not sure about aother archs
i can't test.
 1.19 09-Oct-2008  njoly Fix linux32 siginfo si_signo value. Do not convert ksi_signo twice.
 1.18 18-Sep-2008  christos Define a PSL_CLEARSIG macro for the psl flags to be cleared on signal delivery
and use it everywhere.
 1.17 24-Apr-2008  ad branches: 1.17.2; 1.17.4; 1.17.8;
Merge proc::p_mutex and proc::p_smutex into a single adaptive mutex, since
we no longer need to guard against access from hardware interrupt handlers.

Additionally, if cloning a process with CLONE_SIGHAND, arrange to have the
child process share the parent's lock so that signal state may be kept in
sync. Partially addresses PR kern/37437.
 1.16 20-Dec-2007  dsl branches: 1.16.6; 1.16.8;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.15 08-Dec-2007  dsl branches: 1.15.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.14 04-Dec-2007  dsl Remove all the __P
 1.13 24-Nov-2007  christos branches: 1.13.2;
- move the save context before the signal reset (Arto Huusko)
- set the sigcontext cr2
 1.12 19-Oct-2007  ad branches: 1.12.2;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.11 21-May-2007  christos branches: 1.11.6; 1.11.8; 1.11.12;
rename si_sigval -> si_value to match POSIX RTS.
 1.10 18-Mar-2007  dsl Change all the NETBSD32PTR64(SCARG(uap, xxx))) to SCARG_P32(uap, xxx).
 1.9 16-Mar-2007  dsl remove all the double (and triple) casts used to convert 32bit userspace
pointers to and from 64bit kernel pointers. Instead use the defines
NETBSD32PTR64(p32) to read a 32bit pointer and (the new) NETBSD32PTR32(p32,p64)
to write a 32bit pointer throughout.
The 32bit pointer is now a struct to enforce the above.
amd64 (with linux emul) and sparc64 will both compile (when the arch stuff
goes in soon), and amd64 still runs some i386 binaries.
 1.8 05-Mar-2007  christos branches: 1.8.2; 1.8.4; 1.8.6;
fix caddr_t lossage
 1.7 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.6 17-Feb-2007  pavel Change the process/lwp flags seen by userland via sysctl back to the
P_*/L_* naming convention, and rename the in-kernel flags to avoid
conflict. (P_ -> PK_, L_ -> LW_ ). Add back the (now unused) LSDEAD
constant.

Restores source compatibility with pre-newlock2 tools like ps or top.

Reviewed by Andrew Doran.
 1.5 15-Feb-2007  ad branches: 1.5.2;
Fix COMPAT_LINUX32.
 1.4 09-Feb-2007  ad Merge newlock2 to head.
 1.3 22-Nov-2006  christos adjust_limits takes p, not l again
 1.2 21-Nov-2006  christos From Nicolas Joly:

> It seems that 32bits programs, running under compat_netbsd32, using
> setrlimit force all other programs to have their maximum data size
> fixed at 3GB, where native 64bits apps used 8GB previously.

I tracked this one to the `netbsd32_adjust_limits()' function (called
when creating a new process under compat_netbsd32), where data and
stack limits are set without checking for shared `p_limit' structure
(p_limit->p_refcnt > 1). This explain the side effect where processes
have their limits changed when a compat_netbsd32 (or compat_linux32)
program is run.

The fix is to use `dosetrlimit()' to ensure the needed copy-on-write
behaviour for shared structure.
 1.1 09-Feb-2006  manu branches: 1.1.2; 1.1.10; 1.1.16; 1.1.20; 1.1.22; 1.1.24;
Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.1.24.1 10-Dec-2006  yamt sync with head.
 1.1.22.2 09-Sep-2006  rpaulo sync with head
 1.1.22.1 09-Feb-2006  rpaulo file linux32_machdep.c was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:45:52 +0000
 1.1.20.3 06-Feb-2007  ad More compat changes.

XXX compat_irix, compat_mach and compat_darwin need work.
 1.1.20.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.1.20.1 12-Jan-2007  ad Sync with head.
 1.1.16.8 21-Jan-2008  yamt sync with head
 1.1.16.7 07-Dec-2007  yamt sync with head
 1.1.16.6 27-Oct-2007  yamt sync with head.
 1.1.16.5 03-Sep-2007  yamt sync with head.
 1.1.16.4 26-Feb-2007  yamt sync with head.
 1.1.16.3 30-Dec-2006  yamt sync with head.
 1.1.16.2 21-Jun-2006  yamt sync with head.
 1.1.16.1 09-Feb-2006  yamt file linux32_machdep.c was added on branch yamt-lazymbuf on 2006-06-21 14:59:27 +0000
 1.1.10.2 22-Apr-2006  simonb Sync with head.
 1.1.10.1 09-Feb-2006  simonb file linux32_machdep.c was added on branch simonb-timecounters on 2006-04-22 11:38:14 +0000
 1.1.2.2 18-Feb-2006  yamt sync with head.
 1.1.2.1 09-Feb-2006  yamt file linux32_machdep.c was added on branch yamt-uio_vmspace on 2006-02-18 15:38:59 +0000
 1.5.2.3 24-Mar-2007  yamt sync with head.
 1.5.2.2 12-Mar-2007  rmind Sync with HEAD.
 1.5.2.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.8.6.2 29-Mar-2007  reinoud Pullup to -current
 1.8.6.1 18-Mar-2007  reinoud First attempt to bring branch in sync with HEAD
 1.8.4.1 11-Jul-2007  mjf Sync with head.
 1.8.2.3 23-Oct-2007  ad Sync with head.
 1.8.2.2 27-May-2007  ad Sync with head.
 1.8.2.1 10-Apr-2007  ad Sync with head.
 1.11.12.1 25-Oct-2007  bouyer Sync with HEAD.
 1.11.8.2 09-Jan-2008  matt sync with HEAD
 1.11.8.1 06-Nov-2007  matt sync with HEAD
 1.11.6.3 09-Dec-2007  jmcneill Sync with HEAD.
 1.11.6.2 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.11.6.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.12.2.2 27-Dec-2007  mjf Sync with HEAD.
 1.12.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.13.2.2 26-Dec-2007  ad Sync with head.
 1.13.2.1 08-Dec-2007  ad Sync with head.
 1.15.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.16.8.1 18-May-2008  yamt sync with head.
 1.16.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.16.6.2 28-Sep-2008  mjf Sync with HEAD.
 1.16.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.17.8.1 19-Oct-2008  haad Sync with HEAD.
 1.17.4.4 10-Oct-2008  skrll Sync with HEAD.
 1.17.4.3 24-Sep-2008  wrstuden Merge in changes between wrstuden-revivesa-base-2 and
wrstuden-revivesa-base-3.
 1.17.4.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.17.4.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.17.2.4 11-Aug-2010  yamt sync with head.
 1.17.2.3 11-Mar-2010  yamt sync with head
 1.17.2.2 20-Jun-2009  yamt sync with head
 1.17.2.1 04-May-2009  yamt sync with head.
 1.20.8.2 23-Jul-2009  jym Sync with HEAD.
 1.20.8.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.20.2.1 28-Apr-2009  skrll Sync with HEAD.
 1.23.4.1 05-Mar-2011  rmind sync with head
 1.23.2.2 06-Nov-2010  uebayasi Sync with HEAD.
 1.23.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.27.4.2 05-Mar-2011  bouyer Sync with HEAD
 1.27.4.1 08-Feb-2011  bouyer Sync with HEAD
 1.27.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.29.16.1 09-Sep-2017  snj Pull up following revision(s) (requested by maxv in ticket #1502):
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.39
Fix a ring0 escalation vulnerability in compat_linux32 where the
index of %cs is controlled by userland, making it easy to trigger
the page fault and get kernel privileges.
 1.29.14.1 09-Sep-2017  snj Pull up following revision(s) (requested by maxv in ticket #1502):
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.39
Fix a ring0 escalation vulnerability in compat_linux32 where the
index of %cs is controlled by userland, making it easy to trigger
the page fault and get kernel privileges.
 1.29.10.1 09-Sep-2017  snj Pull up following revision(s) (requested by maxv in ticket #1502):
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.39
Fix a ring0 escalation vulnerability in compat_linux32 where the
index of %cs is controlled by userland, making it easy to trigger
the page fault and get kernel privileges.
 1.29.4.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.29.4.1 30-Oct-2012  yamt sync with head
 1.31.4.1 18-May-2014  rmind sync with head
 1.31.2.2 03-Dec-2017  jdolecek update from HEAD
 1.31.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.36.14.1 09-Sep-2017  snj Pull up following revision(s) (requested by maxv in ticket #1507):
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.39
Fix a ring0 escalation vulnerability in compat_linux32 where the
index of %cs is controlled by userland, making it easy to trigger
the page fault and get kernel privileges.
 1.36.10.1 20-Mar-2017  pgoyette Sync with HEAD
 1.36.8.1 09-Sep-2017  snj Pull up following revision(s) (requested by maxv in ticket #1507):
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.39
Fix a ring0 escalation vulnerability in compat_linux32 where the
index of %cs is controlled by userland, making it easy to trigger
the page fault and get kernel privileges.
 1.36.6.2 28-Aug-2017  skrll Sync with HEAD
 1.36.6.1 05-Oct-2016  skrll Sync with HEAD
 1.36.4.1 09-Sep-2017  snj Pull up following revision(s) (requested by maxv in ticket #1507):
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.39
Fix a ring0 escalation vulnerability in compat_linux32 where the
index of %cs is controlled by userland, making it easy to trigger
the page fault and get kernel privileges.
 1.37.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.38.6.4 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1841):

sys/compat/sunos32/sunos32_misc.c: revision 1.86
sys/compat/ossaudio/ossaudio.c: revision 1.85
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.48

compat_sunos32: Memset zero before copyout.

Unclear if this can leak anything but let's be on the safe side.

compat_ossaudio: Zero-initialize idat before copyout.
Unclear if there are any paths to the copyout without initialization,
but let's play it safe to keep the auditing effort low.

linux32_rt_sendsig: Memset zero before copyout.
Not sure if there's any padding here, but it's a pretty big
structure, fairly likely, so let's be rather safe than sorry.
 1.38.6.3 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1836):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.38.6.2 05-Apr-2019  martin Pull up following revision(s) (requested by maxv):

sys/arch/amd64/amd64/netbsd32_machdep.c: revision 1.120
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.57
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.44
sys/arch/amd64/amd64/machdep.c: revision 1.328
sys/arch/amd64/amd64/machdep.c: revision 1.329

Fix a tiny race in setregs and linux_setregs. Between the moment we set
pcb_flags to zero, and the moment cpu_segregs64_zero resets pcb_gs, we may
be preempted.

If this happens, and if the calling LWP was a 32bit thread, when switching
back to that LWP, the context switcher sees that PCB_COMPAT32 is not set in
pcb_flags and tries to perform a 64bit context switch; but pcb_gs contains
a 32bit GDT descriptor, and not a 64bit GS.base value. The wrmsr therefore
faults because the value is non-canonical, and this fault is fatal.

Rearrange the code so that the update of pcb_flags and pcb_gs/pcb_fs is non
interruptible. This fixes the problem, tested with a reproducer (which
therefore doesn't work anymore).

Likely fixes PR/53993.

Disable preemption when setting PCB_COMPAT32, to prevent a context switch
before cpu_fsgs_reload() finishes, otherwise we write garbage in the GDT.

On NetBSD-current it is harmless, however in NetBSD-8 it might cause
panics, because NetBSD-8 uses the old SegRegs model and under this model
we reload %fs and %gs during switches.
 1.38.6.1 09-Sep-2017  snj Pull up following revision(s) (requested by maxv in ticket #270):
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.39
Fix a ring0 escalation vulnerability in compat_linux32 where the
index of %cs is controlled by userland, making it easy to trigger
the page fault and get kernel privileges.
 1.43.4.1 10-Jun-2019  christos Sync with HEAD
 1.45.2.2 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1650):

sys/compat/sunos32/sunos32_misc.c: revision 1.86
sys/compat/ossaudio/ossaudio.c: revision 1.85
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.48

compat_sunos32: Memset zero before copyout.

Unclear if this can leak anything but let's be on the safe side.

compat_ossaudio: Zero-initialize idat before copyout.
Unclear if there are any paths to the copyout without initialization,
but let's play it safe to keep the auditing effort low.

linux32_rt_sendsig: Memset zero before copyout.
Not sure if there's any padding here, but it's a pretty big
structure, fairly likely, so let's be rather safe than sorry.
 1.45.2.1 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.47.4.1 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #204):

sys/compat/sunos32/sunos32_misc.c: revision 1.86
sys/compat/ossaudio/ossaudio.c: revision 1.85
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.48

compat_sunos32: Memset zero before copyout.

Unclear if this can leak anything but let's be on the safe side.

compat_ossaudio: Zero-initialize idat before copyout.
Unclear if there are any paths to the copyout without initialization,
but let's play it safe to keep the auditing effort low.

linux32_rt_sendsig: Memset zero before copyout.
Not sure if there's any padding here, but it's a pretty big
structure, fairly likely, so let's be rather safe than sorry.
 1.2 04-Dec-2007  dsl Remove all the __P
 1.1 09-Feb-2006  manu branches: 1.1.2; 1.1.10; 1.1.16; 1.1.22; 1.1.46; 1.1.48; 1.1.54; 1.1.58;
Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.1.58.1 08-Dec-2007  ad Sync with head.
 1.1.54.1 08-Dec-2007  mjf Sync with HEAD.
 1.1.48.1 09-Jan-2008  matt sync with HEAD
 1.1.46.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.1.22.2 09-Sep-2006  rpaulo sync with head
 1.1.22.1 09-Feb-2006  rpaulo file linux32_machdep.h was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:45:52 +0000
 1.1.16.3 07-Dec-2007  yamt sync with head
 1.1.16.2 21-Jun-2006  yamt sync with head.
 1.1.16.1 09-Feb-2006  yamt file linux32_machdep.h was added on branch yamt-lazymbuf on 2006-06-21 14:59:27 +0000
 1.1.10.2 22-Apr-2006  simonb Sync with head.
 1.1.10.1 09-Feb-2006  simonb file linux32_machdep.h was added on branch simonb-timecounters on 2006-04-22 11:38:14 +0000
 1.1.2.2 18-Feb-2006  yamt sync with head.
 1.1.2.1 09-Feb-2006  yamt file linux32_machdep.h was added on branch yamt-uio_vmspace on 2006-02-18 15:38:59 +0000
 1.7 18-Nov-2013  chs implement the *at() syscalls.
bring the unimplemented syscall list up to date.
 1.6 19-Nov-2008  ad branches: 1.6.16; 1.6.26; 1.6.30;
Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.5 02-Feb-2008  dsl branches: 1.5.6; 1.5.10; 1.5.12; 1.5.16; 1.5.18;
Extract the fcntl64() suppoort from linux_file64.c into linux_fcntl64.c
Unravel some of the knots that caused linux_file64.c to be compiled twice
for an amd64 kernel (once for linux and once for linux32) with different
parts being skipped each time.
 1.4 15-Jan-2008  njoly compat linux (and linux32) uid16 functions cleanup and fixes.

- Move uid16 functions to their own file linux_uid16.c, included by
needed archs (arm, i386 and m68k).
- Add new MI types linux_{u,g}id16_t.
- Add macros to handle linux_uid16_t and uid_t conversions.
- Add linux_sys_getres{uid,gid}16 syscalls, to fix an overflow with
bad sizes given to copyout when linux_sys_getres{uid,gid} are used.
- Update arm syscall table to use more uid16 functions.
 1.3 19-Jul-2007  dsl branches: 1.3.6; 1.3.12; 1.3.18; 1.3.22;
include sys/cdefs.h
 1.2 09-Feb-2007  ad branches: 1.2.6; 1.2.14;
Merge newlock2 to head.
 1.1 09-Feb-2006  manu branches: 1.1.2; 1.1.10; 1.1.16; 1.1.20; 1.1.22;
Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.1.22.2 09-Sep-2006  rpaulo sync with head
 1.1.22.1 09-Feb-2006  rpaulo file linux32_missing.c was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:45:52 +0000
 1.1.20.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.1.16.6 04-Feb-2008  yamt sync with head.
 1.1.16.5 21-Jan-2008  yamt sync with head
 1.1.16.4 03-Sep-2007  yamt sync with head.
 1.1.16.3 26-Feb-2007  yamt sync with head.
 1.1.16.2 21-Jun-2006  yamt sync with head.
 1.1.16.1 09-Feb-2006  yamt file linux32_missing.c was added on branch yamt-lazymbuf on 2006-06-21 14:59:27 +0000
 1.1.10.2 22-Apr-2006  simonb Sync with head.
 1.1.10.1 09-Feb-2006  simonb file linux32_missing.c was added on branch simonb-timecounters on 2006-04-22 11:38:14 +0000
 1.1.2.2 18-Feb-2006  yamt sync with head.
 1.1.2.1 09-Feb-2006  yamt file linux32_missing.c was added on branch yamt-uio_vmspace on 2006-02-18 15:38:59 +0000
 1.2.14.1 15-Aug-2007  skrll Sync with HEAD.
 1.2.6.1 20-Aug-2007  ad Sync with HEAD.
 1.3.22.2 19-Jul-2007  dsl include sys/cdefs.h
 1.3.22.1 19-Jul-2007  dsl file linux32_missing.c was added on branch matt-mips64 on 2007-07-19 22:17:24 +0000
 1.3.18.1 19-Jan-2008  bouyer Sync with HEAD
 1.3.12.1 18-Feb-2008  mjf Sync with HEAD.
 1.3.6.1 23-Mar-2008  matt sync with HEAD
 1.5.18.1 19-Jan-2009  skrll Sync with HEAD.
 1.5.16.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.5.12.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.5.12.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.5.10.1 04-May-2009  yamt sync with head.
 1.5.6.1 17-Jan-2009  mjf Sync with HEAD.
 1.6.30.1 18-May-2014  rmind sync with head
 1.6.26.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.6.16.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.9 08-Jun-2009  njoly Fix defines against multiple inclusion protection (s/I386/AMD64).
 1.8 16-Apr-2008  njoly branches: 1.8.4; 1.8.18;
Kill a few other unused linux syscall arguments/prototypes
definitions.
 1.7 15-Apr-2008  njoly Remove syscall prototypes forgotten in previous commit.
 1.6 15-Apr-2008  njoly Remove unused linux_sys_setresgid16_args/linux_sys_setresuid16_args
definitions.
 1.5 15-Jan-2008  njoly branches: 1.5.6;
compat linux (and linux32) uid16 functions cleanup and fixes.

- Move uid16 functions to their own file linux_uid16.c, included by
needed archs (arm, i386 and m68k).
- Add new MI types linux_{u,g}id16_t.
- Add macros to handle linux_uid16_t and uid_t conversions.
- Add linux_sys_getres{uid,gid}16 syscalls, to fix an overflow with
bad sizes given to copyout when linux_sys_getres{uid,gid} are used.
- Update arm syscall table to use more uid16 functions.
 1.4 20-Dec-2007  dsl Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.3 04-Mar-2007  christos branches: 1.3.16; 1.3.22; 1.3.24; 1.3.28;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.2 13-Sep-2006  manu branches: 1.2.6;
Jumbo COMPAT_LINUX/COMPAT_LINUX32 bugfix, with the help of Nicolas Joly
- Fix shmat return value on amd64: it uses no black magic with retval[0]
- Fix integer overflows in sysinfo
- Implement sysinfo, mmap2, sched_getparam, sched_getscheduler, mremap,
and madvise in COMPAT_LINUX32
- Fix improper types used in setgroups16/getgroups16
- Implement mmap2 for COMPAT_LINUX32
- Ifdef debug messages by DEBUG_LINUX
 1.1 09-Feb-2006  manu branches: 1.1.2; 1.1.4; 1.1.10; 1.1.16; 1.1.20; 1.1.22;
Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.1.22.2 09-Sep-2006  rpaulo sync with head
 1.1.22.1 09-Feb-2006  rpaulo file linux32_missing.h was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:45:52 +0000
 1.1.20.1 18-Nov-2006  ad Sync with head.
 1.1.16.5 21-Jan-2008  yamt sync with head
 1.1.16.4 03-Sep-2007  yamt sync with head.
 1.1.16.3 30-Dec-2006  yamt sync with head.
 1.1.16.2 21-Jun-2006  yamt sync with head.
 1.1.16.1 09-Feb-2006  yamt file linux32_missing.h was added on branch yamt-lazymbuf on 2006-06-21 14:59:27 +0000
 1.1.10.2 22-Apr-2006  simonb Sync with head.
 1.1.10.1 09-Feb-2006  simonb file linux32_missing.h was added on branch simonb-timecounters on 2006-04-22 11:38:14 +0000
 1.1.4.1 14-Sep-2006  yamt sync with head.
 1.1.2.2 18-Feb-2006  yamt sync with head.
 1.1.2.1 09-Feb-2006  yamt file linux32_missing.h was added on branch yamt-uio_vmspace on 2006-02-18 15:38:59 +0000
 1.2.6.1 12-Mar-2007  rmind Sync with HEAD.
 1.3.28.2 19-Jan-2008  bouyer Sync with HEAD
 1.3.28.1 02-Jan-2008  bouyer Sync with HEAD
 1.3.24.1 26-Dec-2007  ad Sync with head.
 1.3.22.1 18-Feb-2008  mjf Sync with HEAD.
 1.3.16.2 23-Mar-2008  matt sync with HEAD
 1.3.16.1 09-Jan-2008  matt sync with HEAD
 1.5.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.8.18.1 23-Jul-2009  jym Sync with HEAD.
 1.8.4.1 20-Jun-2009  yamt sync with head
 1.2 19-Sep-2021  thorpej Add routines to convert from linux32 to native sigevent_t.
 1.1 18-Nov-2011  christos branches: 1.1.8; 1.1.66;
add sigtimedwait support
 1.1.66.1 17-Dec-2020  thorpej Add sigevent mapping for Linux-32 compat.
 1.1.8.2 17-Apr-2012  yamt sync with head
 1.1.8.1 18-Nov-2011  yamt file linux32_siginfo.h was added on branch yamt-pagecache on 2012-04-17 00:07:18 +0000
 1.4 08-Mar-2015  christos fix inconsistent names
 1.3 18-Nov-2011  christos branches: 1.3.10; 1.3.28;
add sigtimedwait support
 1.2 08-Jun-2009  njoly branches: 1.2.12;
Fix defines against multiple inclusion protection (s/I386/AMD64).
 1.1 09-Feb-2006  manu branches: 1.1.2; 1.1.10; 1.1.16; 1.1.22; 1.1.76; 1.1.92;
Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.1.92.1 23-Jul-2009  jym Sync with HEAD.
 1.1.76.1 20-Jun-2009  yamt sync with head
 1.1.22.2 09-Sep-2006  rpaulo sync with head
 1.1.22.1 09-Feb-2006  rpaulo file linux32_signal.h was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:45:52 +0000
 1.1.16.2 21-Jun-2006  yamt sync with head.
 1.1.16.1 09-Feb-2006  yamt file linux32_signal.h was added on branch yamt-lazymbuf on 2006-06-21 14:59:27 +0000
 1.1.10.2 22-Apr-2006  simonb Sync with head.
 1.1.10.1 09-Feb-2006  simonb file linux32_signal.h was added on branch simonb-timecounters on 2006-04-22 11:38:14 +0000
 1.1.2.2 18-Feb-2006  yamt sync with head.
 1.1.2.1 09-Feb-2006  yamt file linux32_signal.h was added on branch yamt-uio_vmspace on 2006-02-18 15:38:59 +0000
 1.2.12.1 17-Apr-2012  yamt sync with head
 1.3.28.1 06-Apr-2015  skrll Sync with HEAD
 1.3.10.1 03-Dec-2017  jdolecek update from HEAD
 1.87 02-Dec-2021  ryo regen
 1.86 27-Nov-2021  ryo regen
 1.85 20-Sep-2021  thorpej Regen for preadv(2) / pwritev(2).
 1.84 20-Sep-2021  thorpej Regen for eventfd.
 1.83 19-Sep-2021  thorpej Regen for timerfd.
 1.82 19-Sep-2021  thorpej Regen for POSIX timer syscalls.
 1.81 26-Apr-2020  thorpej branches: 1.81.2;
Regen for native futex calls.
 1.80 09-Nov-2019  jdolecek regen
 1.79 10-Aug-2018  pgoyette Regen
 1.78 10-May-2017  riastradh branches: 1.78.8; 1.78.10;
regen
 1.77 16-Jan-2017  christos branches: 1.77.4;
descend and regen
 1.76 13-Jan-2017  christos branches: 1.76.2;
regen
 1.75 08-Mar-2015  christos branches: 1.75.2;
regen
 1.74 07-Mar-2015  christos regen
 1.73 22-Nov-2014  njoly branches: 1.73.2;
Regen for ppoll(2)
 1.72 29-May-2014  njoly Regen for utimes(2).
 1.71 04-May-2014  njoly Regen for pread/pwrite 64bit offset argument.
 1.70 18-Nov-2013  christos branches: 1.70.2;
Regen
 1.69 18-Nov-2013  chs regen
 1.68 07-Nov-2013  njoly Regen for dup/dup2/dup3 argument types fix.
 1.67 13-Jul-2012  christos branches: 1.67.2; 1.67.4;
regen
 1.66 10-May-2012  christos regen
 1.65 18-Nov-2011  christos branches: 1.65.4; 1.65.6;
regen
 1.64 18-Nov-2011  christos add sigtimedwait support
 1.63 30-May-2011  alnsn branches: 1.63.4;
Regenerate files to pick up correct RCS Ids. Suggested by Chris Badura.
 1.62 30-May-2011  alnsn Add fadvise64 and fadvise64_64 syscalls to compat_linux and compat_linux32.
 1.61 10-Apr-2011  christos Regen: XXX: produces errors because of rump changes!
 1.60 02-Nov-2010  chs branches: 1.60.2;
regen
 1.59 07-Jul-2010  chs regen
 1.58 24-Nov-2009  njoly branches: 1.58.2; 1.58.4;
Regen for personality(2) update.
 1.57 08-Jun-2009  njoly Regen for rt_queueinfo addition.
 1.56 05-Jun-2009  njoly Regen for fstatfs.
 1.55 04-Jun-2009  njoly Regen for stat/lstat/fstat syscalls.
 1.54 02-Jun-2009  njoly Regen for siggetmask/sigsetmask.
 1.53 30-Jan-2009  njoly branches: 1.53.2;
Regen for mincore(2).
 1.52 20-Jan-2009  njoly Regen for personality(2) addition.
 1.51 17-Jan-2009  njoly Regen for wait4 update.
 1.50 16-Jan-2009  njoly Regen for compat 50 update.
 1.49 13-Jan-2009  pooka Regen to prove I didn't screw up the conversion: purely RCSID changes.
 1.48 11-Jan-2009  christos merge christos-time_t
 1.47 12-Dec-2008  njoly branches: 1.47.2;
Regen for clock_nanosleep.
 1.46 06-Dec-2008  njoly Regen for netbsd32_caddr_t removal.
 1.45 05-Dec-2008  njoly Regen for getres{uid,gid} syscalls.
 1.44 01-Dec-2008  njoly Regen for sched_get_priority_{min,max}.
 1.43 19-Nov-2008  ad Regen.
 1.42 12-Nov-2008  njoly Regen for nanosleep(2) fix.
 1.41 06-Oct-2008  njoly branches: 1.41.2; 1.41.4;
Regen.
 1.40 22-Sep-2008  njoly Regen after cleanup.
 1.39 24-Jul-2008  njoly Regen for rt_sigpending.
 1.38 16-Jun-2008  christos branches: 1.38.2;
regen
 1.37 20-May-2008  njoly branches: 1.37.2;
Regen for ipc(2) syscall support.
 1.36 17-Apr-2008  njoly branches: 1.36.2; 1.36.4; 1.36.6;
Regen for sys_clock_{getres,gettime,settime} syscalls.
 1.35 04-Apr-2008  njoly Regen for msync(2) support.
 1.34 20-Feb-2008  njoly branches: 1.34.6;
Regen for mlock/munlock syscalls
 1.33 17-Feb-2008  njoly Regen for pread/pwrite fixes.
 1.32 04-Feb-2008  dsl Regen for merging fcntl() and fcntl64().
 1.31 02-Feb-2008  dsl Regen for pread and pwrite
 1.30 15-Jan-2008  njoly Regen.
 1.29 07-Jan-2008  njoly Regen.
 1.28 26-Dec-2007  njoly Regen for readdir syscall.
 1.27 24-Dec-2007  njoly Regen for old_uname syscall.
 1.26 24-Dec-2007  njoly Regen for getpgid.
 1.25 21-Dec-2007  njoly Regen for getfsuid/setfsgid syscall exchange.
 1.24 20-Dec-2007  dsl regen
 1.23 16-Nov-2007  njoly branches: 1.23.2; 1.23.6;
Regen.
 1.22 11-Nov-2007  christos regen
 1.21 07-Nov-2007  njoly Regen for 64-bit linux syscalls removal.
 1.20 31-Oct-2007  dsl branches: 1.20.2;
regen
 1.19 31-Oct-2007  njoly Regen for syscalls cleanup.
 1.18 27-Oct-2007  njoly Regen for chown additions.
 1.17 20-Apr-2007  njoly branches: 1.17.6; 1.17.8; 1.17.12;
Regen (ftruncate fix).
 1.16 11-Apr-2007  njoly Regen (statfs support).
 1.15 05-Mar-2007  christos branches: 1.15.2; 1.15.4;
fix caddr_t lossage.
 1.14 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.13 16-Feb-2007  njoly branches: 1.13.2;
Regen.
 1.12 08-Feb-2007  njoly Regen (aliases cleanup).
 1.11 07-Feb-2007  njoly Regen (poll argument fix).
 1.10 13-Sep-2006  manu branches: 1.10.4;
Jumbo COMPAT_LINUX/COMPAT_LINUX32 bugfix, with the help of Nicolas Joly
- Fix shmat return value on amd64: it uses no black magic with retval[0]
- Fix integer overflows in sysinfo
- Implement sysinfo, mmap2, sched_getparam, sched_getscheduler, mremap,
and madvise in COMPAT_LINUX32
- Fix improper types used in setgroups16/getgroups16
- Implement mmap2 for COMPAT_LINUX32
- Ifdef debug messages by DEBUG_LINUX
 1.9 06-Sep-2006  manu branches: 1.9.2; 1.9.4;
Implement Linux's fdatasync, patch from Nicolas Joly
 1.8 06-Sep-2006  manu Fix linux32_sys_setres{uid|gid}: -1 does not means the same thing on i386
and amd64...
 1.7 05-Sep-2006  manu typo
 1.6 01-Sep-2006  matt Regen.
 1.5 25-Jun-2006  manu Regen
 1.4 25-Jun-2006  manu - Complete exit_group() implementation. We now maintain a list of Linux
threads in a processes and kill them properly. The code is a bit too
complicated, but I could not find a simplier way of dealing with it

- Change getpid() and getppid() semantics to match what Linux does,
and implement gettid(). In the Linux kernel, threads are implemnted
as plain old processes. A thread group is just a set of processes,
with the parent called leader. Thread ID, which are returned by gettid(),
are just the PID of the plain old processes, and getpid() returns the
PID of the thread group leader.

- Remove struct linux32_emuldata. COMPAT_LINUX32 uses a lot of COMPAT_LINUX
code, where a struct linux_emuldata is assumed. By having distinct emuldata
structure with different sizes and layouts, we caused kernel memory
corruptions.

- Fix setprioriry() and getpriority()

Thanks to Nicolas Joly for tracking down the problem and providing me the
hardware to fix them.
 1.3 15-Feb-2006  manu branches: 1.3.2; 1.3.4; 1.3.10; 1.3.14; 1.3.16;
Add getcwd (for real this time), fix dup and dup2
 1.2 15-Feb-2006  manu - Move the BSD to Linux and Linux to BSD termio/termios conversion functions
to a header where they can be shared between COMPAT_LINUX and COMPAT_LINUX32
- Add termios ioctl emulation to COMPAT_LINUX32
- Add the getcwd system call to COMPAT_LINUX32/amd64

That makes Linux's bash working with COMPAT_LINUX32.
 1.1 09-Feb-2006  manu Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.3.16.12 27-Feb-2008  yamt sync with head.
 1.3.16.11 11-Feb-2008  yamt sync with head.
 1.3.16.10 04-Feb-2008  yamt sync with head.
 1.3.16.9 21-Jan-2008  yamt sync with head
 1.3.16.8 07-Dec-2007  yamt sync with head
 1.3.16.7 15-Nov-2007  yamt sync with head.
 1.3.16.6 27-Oct-2007  yamt sync with head.
 1.3.16.5 03-Sep-2007  yamt sync with head.
 1.3.16.4 26-Feb-2007  yamt sync with head.
 1.3.16.3 30-Dec-2006  yamt sync with head.
 1.3.16.2 21-Jun-2006  yamt sync with head.
 1.3.16.1 15-Feb-2006  yamt file linux32_syscall.h was added on branch yamt-lazymbuf on 2006-06-21 14:59:27 +0000
 1.3.14.1 13-Jul-2006  gdamore Merge from HEAD.
 1.3.10.2 22-Apr-2006  simonb Sync with head.
 1.3.10.1 15-Feb-2006  simonb file linux32_syscall.h was added on branch simonb-timecounters on 2006-04-22 11:38:14 +0000
 1.3.4.2 14-Sep-2006  yamt sync with head.
 1.3.4.1 26-Jun-2006  yamt sync with head.
 1.3.2.2 18-Feb-2006  yamt sync with head.
 1.3.2.1 15-Feb-2006  yamt file linux32_syscall.h was added on branch yamt-uio_vmspace on 2006-02-18 15:38:59 +0000
 1.9.4.2 09-Sep-2006  rpaulo sync with head
 1.9.4.1 06-Sep-2006  rpaulo file linux32_syscall.h was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:45:52 +0000
 1.9.2.2 09-Feb-2007  ad Sync with HEAD.
 1.9.2.1 18-Nov-2006  ad Sync with head.
 1.10.4.2 20-Apr-2007  bouyer regen for ticket #582
 1.10.4.1 02-Apr-2007  bouyer Regen for ticket #544
 1.13.2.3 07-May-2007  yamt sync with head.
 1.13.2.2 15-Apr-2007  yamt sync with head.
 1.13.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.15.4.1 11-Jul-2007  mjf Sync with head.
 1.15.2.1 27-May-2007  ad Sync with head.
 1.17.12.2 18-Nov-2007  bouyer Sync with HEAD
 1.17.12.1 13-Nov-2007  bouyer Sync with HEAD
 1.17.8.4 23-Mar-2008  matt sync with HEAD
 1.17.8.3 09-Jan-2008  matt sync with HEAD
 1.17.8.2 08-Nov-2007  matt sync with -HEAD
 1.17.8.1 06-Nov-2007  matt sync with HEAD
 1.17.6.6 21-Nov-2007  joerg Sync with HEAD.
 1.17.6.5 14-Nov-2007  joerg Sync with HEAD.
 1.17.6.4 11-Nov-2007  joerg Sync with HEAD.
 1.17.6.3 04-Nov-2007  jmcneill Sync with HEAD.
 1.17.6.2 31-Oct-2007  joerg Sync with HEAD.
 1.17.6.1 28-Oct-2007  joerg Sync with HEAD.
 1.20.2.3 18-Feb-2008  mjf Sync with HEAD.
 1.20.2.2 27-Dec-2007  mjf Sync with HEAD.
 1.20.2.1 19-Nov-2007  mjf Sync with HEAD.
 1.23.6.3 19-Jan-2008  bouyer Sync with HEAD
 1.23.6.2 08-Jan-2008  bouyer Sync with HEAD
 1.23.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.23.2.1 26-Dec-2007  ad Sync with head.
 1.34.6.4 17-Jan-2009  mjf Sync with HEAD.
 1.34.6.3 28-Sep-2008  mjf Sync with HEAD.
 1.34.6.2 29-Jun-2008  mjf Sync with HEAD.
 1.34.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.36.6.3 10-Oct-2008  skrll Sync with HEAD.
 1.36.6.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.36.6.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.36.4.4 11-Aug-2010  yamt sync with head.
 1.36.4.3 11-Mar-2010  yamt sync with head
 1.36.4.2 20-Jun-2009  yamt sync with head
 1.36.4.1 04-May-2009  yamt sync with head.
 1.36.2.2 17-Jun-2008  yamt sync with head.
 1.36.2.1 04-Jun-2008  yamt sync with head
 1.37.2.2 28-Jul-2008  simonb Sync with head.
 1.37.2.1 18-Jun-2008  simonb Sync with head.
 1.38.2.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.38.2.1 19-Oct-2008  haad Sync with HEAD.
 1.41.4.2 18-Mar-2015  snj regen for ticket 1149
 1.41.4.1 20-Nov-2008  snj Regen for ticket 81.
 1.41.2.2 03-Mar-2009  skrll Sync with HEAD.
 1.41.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.47.2.2 04-Jan-2009  christos use compat_50 syscalls where appropriate.
 1.47.2.1 12-Dec-2008  christos file linux32_syscall.h was added on branch christos-time_t on 2009-01-04 01:58:39 +0000
 1.53.2.1 23-Jul-2009  jym Sync with HEAD.
 1.58.4.3 31-May-2011  rmind sync with head
 1.58.4.2 21-Apr-2011  rmind sync with head
 1.58.4.1 05-Mar-2011  rmind sync with head
 1.58.2.2 06-Nov-2010  uebayasi Sync with HEAD.
 1.58.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.60.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.63.4.4 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.63.4.3 30-Oct-2012  yamt sync with head
 1.63.4.2 23-May-2012  yamt sync with head.
 1.63.4.1 17-Apr-2012  yamt sync with head
 1.65.6.2 20-Jul-2012  riz Pull up following revision(s) (requested by christos in ticket #424):
sys/compat/linux32/arch/amd64/linux32_syscallargs.h: revision 1.67
sys/compat/linux32/arch/amd64/syscalls.master: revision 1.62
sys/compat/linux32/arch/amd64/linux32_syscall.h: revision 1.67
sys/compat/linux32/arch/amd64/linux32_sysent.c: revision 1.67
sys/compat/linux32/arch/amd64/linux32_syscalls.c: revision 1.67
add xattr stubs
regen
 1.65.6.1 19-May-2012  riz Pull up following revision(s) (requested by christos in ticket #263):
sys/compat/linux32/arch/amd64/linux32_syscallargs.h: revision 1.66
sys/compat/linux32/arch/amd64/syscalls.master: revision 1.61
sys/compat/linux32/common/linux32_signal.c: revision 1.16
sys/compat/linux32/arch/amd64/linux32_syscall.h: revision 1.66
sys/compat/linux32/arch/amd64/linux32_sysent.c: revision 1.66
sys/compat/linux32/arch/amd64/linux32_syscalls.c: revision 1.66
regen
Fix rt_sigtimedwait():
It is wishful thinking that:
1. declaring a 32 bit syscall with 64 bit pointers
2. passing a struct with 32 bit pointers to a 64 bit function
is going to work.
 1.65.4.1 02-Jun-2012  mrg sync to latest -current.
 1.67.4.1 18-May-2014  rmind sync with head
 1.67.2.2 03-Dec-2017  jdolecek update from HEAD
 1.67.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.70.2.1 10-Aug-2014  tls Rebase.
 1.73.2.1 06-Apr-2015  skrll Sync with HEAD
 1.75.2.1 20-Mar-2017  pgoyette Sync with HEAD
 1.76.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.77.4.1 11-May-2017  pgoyette Sync with HEAD
 1.78.10.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.78.10.1 10-Jun-2019  christos Sync with HEAD
 1.78.8.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.81.2.3 03-Jan-2021  thorpej Regen for preadv(2) and pwritev(2).
 1.81.2.2 17-Dec-2020  thorpej Regen for POSIX timers and timerfd.
 1.81.2.1 16-Dec-2020  thorpej Regen for eventfd.
 1.87 02-Dec-2021  ryo regen
 1.86 27-Nov-2021  ryo regen
 1.85 20-Sep-2021  thorpej Regen for preadv(2) / pwritev(2).
 1.84 20-Sep-2021  thorpej Regen for eventfd.
 1.83 19-Sep-2021  thorpej Regen for timerfd.
 1.82 19-Sep-2021  thorpej Regen for POSIX timer syscalls.
 1.81 26-Apr-2020  thorpej branches: 1.81.2;
Regen for native futex calls.
 1.80 09-Nov-2019  jdolecek regen
 1.79 10-Aug-2018  pgoyette Regen
 1.78 10-May-2017  riastradh branches: 1.78.8; 1.78.10;
regen
 1.77 16-Jan-2017  christos branches: 1.77.4;
descend and regen
 1.76 13-Jan-2017  christos branches: 1.76.2;
regen
 1.75 08-Mar-2015  christos branches: 1.75.2;
regen
 1.74 07-Mar-2015  christos regen
 1.73 22-Nov-2014  njoly branches: 1.73.2;
Regen for ppoll(2)
 1.72 29-May-2014  njoly Regen for utimes(2).
 1.71 04-May-2014  njoly Regen for pread/pwrite 64bit offset argument.
 1.70 18-Nov-2013  christos branches: 1.70.2;
Regen
 1.69 18-Nov-2013  chs regen
 1.68 07-Nov-2013  njoly Regen for dup/dup2/dup3 argument types fix.
 1.67 13-Jul-2012  christos branches: 1.67.2; 1.67.4;
regen
 1.66 10-May-2012  christos regen
 1.65 18-Nov-2011  christos branches: 1.65.4; 1.65.6;
regen
 1.64 18-Nov-2011  christos add sigtimedwait support
 1.63 30-May-2011  alnsn branches: 1.63.4;
Regenerate files to pick up correct RCS Ids. Suggested by Chris Badura.
 1.62 30-May-2011  alnsn Add fadvise64 and fadvise64_64 syscalls to compat_linux and compat_linux32.
 1.61 10-Apr-2011  christos Regen: XXX: produces errors because of rump changes!
 1.60 02-Nov-2010  chs branches: 1.60.2;
regen
 1.59 07-Jul-2010  chs regen
 1.58 24-Nov-2009  njoly branches: 1.58.2; 1.58.4;
Regen for personality(2) update.
 1.57 08-Jun-2009  njoly Regen for rt_queueinfo addition.
 1.56 05-Jun-2009  njoly Regen for fstatfs.
 1.55 04-Jun-2009  njoly Regen for stat/lstat/fstat syscalls.
 1.54 02-Jun-2009  njoly Regen for siggetmask/sigsetmask.
 1.53 30-Jan-2009  njoly branches: 1.53.2;
Regen for mincore(2).
 1.52 20-Jan-2009  njoly Regen for personality(2) addition.
 1.51 17-Jan-2009  njoly Regen for wait4 update.
 1.50 16-Jan-2009  njoly Regen for compat 50 update.
 1.49 13-Jan-2009  pooka Regen to prove I didn't screw up the conversion: purely RCSID changes.
 1.48 11-Jan-2009  christos merge christos-time_t
 1.47 12-Dec-2008  njoly branches: 1.47.2;
Regen for clock_nanosleep.
 1.46 06-Dec-2008  njoly Regen for netbsd32_caddr_t removal.
 1.45 05-Dec-2008  njoly Regen for getres{uid,gid} syscalls.
 1.44 01-Dec-2008  njoly Regen for sched_get_priority_{min,max}.
 1.43 19-Nov-2008  ad Regen.
 1.42 12-Nov-2008  njoly Regen for nanosleep(2) fix.
 1.41 06-Oct-2008  njoly branches: 1.41.2; 1.41.4;
Regen.
 1.40 22-Sep-2008  njoly Regen after cleanup.
 1.39 24-Jul-2008  njoly Regen for rt_sigpending.
 1.38 16-Jun-2008  christos branches: 1.38.2;
regen
 1.37 20-May-2008  njoly branches: 1.37.2;
Regen for ipc(2) syscall support.
 1.36 17-Apr-2008  njoly branches: 1.36.2; 1.36.4; 1.36.6;
Regen for sys_clock_{getres,gettime,settime} syscalls.
 1.35 04-Apr-2008  njoly Regen for msync(2) support.
 1.34 20-Feb-2008  njoly branches: 1.34.6;
Regen for mlock/munlock syscalls
 1.33 17-Feb-2008  njoly Regen for pread/pwrite fixes.
 1.32 04-Feb-2008  dsl Regen for merging fcntl() and fcntl64().
 1.31 02-Feb-2008  dsl Regen for pread and pwrite
 1.30 15-Jan-2008  njoly Regen.
 1.29 07-Jan-2008  njoly Regen.
 1.28 26-Dec-2007  njoly Regen for readdir syscall.
 1.27 24-Dec-2007  njoly Regen for old_uname syscall.
 1.26 24-Dec-2007  njoly Regen for getpgid.
 1.25 21-Dec-2007  njoly Regen for getfsuid/setfsgid syscall exchange.
 1.24 20-Dec-2007  dsl regen
 1.23 16-Nov-2007  njoly branches: 1.23.2; 1.23.6;
Regen.
 1.22 11-Nov-2007  christos regen
 1.21 07-Nov-2007  njoly Regen for 64-bit linux syscalls removal.
 1.20 31-Oct-2007  dsl branches: 1.20.2;
regen
 1.19 31-Oct-2007  njoly Regen for syscalls cleanup.
 1.18 27-Oct-2007  njoly Regen for chown additions.
 1.17 20-Apr-2007  njoly branches: 1.17.6; 1.17.8; 1.17.12;
Regen (ftruncate fix).
 1.16 11-Apr-2007  njoly Regen (statfs support).
 1.15 05-Mar-2007  christos branches: 1.15.2; 1.15.4;
fix caddr_t lossage.
 1.14 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.13 16-Feb-2007  njoly branches: 1.13.2;
Regen.
 1.12 08-Feb-2007  njoly Regen (aliases cleanup).
 1.11 07-Feb-2007  njoly Regen (poll argument fix).
 1.10 13-Sep-2006  manu branches: 1.10.4;
Jumbo COMPAT_LINUX/COMPAT_LINUX32 bugfix, with the help of Nicolas Joly
- Fix shmat return value on amd64: it uses no black magic with retval[0]
- Fix integer overflows in sysinfo
- Implement sysinfo, mmap2, sched_getparam, sched_getscheduler, mremap,
and madvise in COMPAT_LINUX32
- Fix improper types used in setgroups16/getgroups16
- Implement mmap2 for COMPAT_LINUX32
- Ifdef debug messages by DEBUG_LINUX
 1.9 06-Sep-2006  manu branches: 1.9.2; 1.9.4;
Implement Linux's fdatasync, patch from Nicolas Joly
 1.8 06-Sep-2006  manu Fix linux32_sys_setres{uid|gid}: -1 does not means the same thing on i386
and amd64...
 1.7 05-Sep-2006  manu typo
 1.6 01-Sep-2006  matt Regen.
 1.5 25-Jun-2006  manu Regen
 1.4 25-Jun-2006  manu - Complete exit_group() implementation. We now maintain a list of Linux
threads in a processes and kill them properly. The code is a bit too
complicated, but I could not find a simplier way of dealing with it

- Change getpid() and getppid() semantics to match what Linux does,
and implement gettid(). In the Linux kernel, threads are implemnted
as plain old processes. A thread group is just a set of processes,
with the parent called leader. Thread ID, which are returned by gettid(),
are just the PID of the plain old processes, and getpid() returns the
PID of the thread group leader.

- Remove struct linux32_emuldata. COMPAT_LINUX32 uses a lot of COMPAT_LINUX
code, where a struct linux_emuldata is assumed. By having distinct emuldata
structure with different sizes and layouts, we caused kernel memory
corruptions.

- Fix setprioriry() and getpriority()

Thanks to Nicolas Joly for tracking down the problem and providing me the
hardware to fix them.
 1.3 15-Feb-2006  manu branches: 1.3.2; 1.3.4; 1.3.10; 1.3.14; 1.3.16;
Add getcwd (for real this time), fix dup and dup2
 1.2 15-Feb-2006  manu - Move the BSD to Linux and Linux to BSD termio/termios conversion functions
to a header where they can be shared between COMPAT_LINUX and COMPAT_LINUX32
- Add termios ioctl emulation to COMPAT_LINUX32
- Add the getcwd system call to COMPAT_LINUX32/amd64

That makes Linux's bash working with COMPAT_LINUX32.
 1.1 09-Feb-2006  manu Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.3.16.12 27-Feb-2008  yamt sync with head.
 1.3.16.11 11-Feb-2008  yamt sync with head.
 1.3.16.10 04-Feb-2008  yamt sync with head.
 1.3.16.9 21-Jan-2008  yamt sync with head
 1.3.16.8 07-Dec-2007  yamt sync with head
 1.3.16.7 15-Nov-2007  yamt sync with head.
 1.3.16.6 27-Oct-2007  yamt sync with head.
 1.3.16.5 03-Sep-2007  yamt sync with head.
 1.3.16.4 26-Feb-2007  yamt sync with head.
 1.3.16.3 30-Dec-2006  yamt sync with head.
 1.3.16.2 21-Jun-2006  yamt sync with head.
 1.3.16.1 15-Feb-2006  yamt file linux32_syscallargs.h was added on branch yamt-lazymbuf on 2006-06-21 14:59:27 +0000
 1.3.14.1 13-Jul-2006  gdamore Merge from HEAD.
 1.3.10.2 22-Apr-2006  simonb Sync with head.
 1.3.10.1 15-Feb-2006  simonb file linux32_syscallargs.h was added on branch simonb-timecounters on 2006-04-22 11:38:14 +0000
 1.3.4.2 14-Sep-2006  yamt sync with head.
 1.3.4.1 26-Jun-2006  yamt sync with head.
 1.3.2.2 18-Feb-2006  yamt sync with head.
 1.3.2.1 15-Feb-2006  yamt file linux32_syscallargs.h was added on branch yamt-uio_vmspace on 2006-02-18 15:38:59 +0000
 1.9.4.2 09-Sep-2006  rpaulo sync with head
 1.9.4.1 06-Sep-2006  rpaulo file linux32_syscallargs.h was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:45:52 +0000
 1.9.2.2 09-Feb-2007  ad Sync with HEAD.
 1.9.2.1 18-Nov-2006  ad Sync with head.
 1.10.4.2 20-Apr-2007  bouyer regen for ticket #582
 1.10.4.1 02-Apr-2007  bouyer Regen for ticket #544
 1.13.2.3 07-May-2007  yamt sync with head.
 1.13.2.2 15-Apr-2007  yamt sync with head.
 1.13.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.15.4.1 11-Jul-2007  mjf Sync with head.
 1.15.2.1 27-May-2007  ad Sync with head.
 1.17.12.2 18-Nov-2007  bouyer Sync with HEAD
 1.17.12.1 13-Nov-2007  bouyer Sync with HEAD
 1.17.8.4 23-Mar-2008  matt sync with HEAD
 1.17.8.3 09-Jan-2008  matt sync with HEAD
 1.17.8.2 08-Nov-2007  matt sync with -HEAD
 1.17.8.1 06-Nov-2007  matt sync with HEAD
 1.17.6.6 21-Nov-2007  joerg Sync with HEAD.
 1.17.6.5 14-Nov-2007  joerg Sync with HEAD.
 1.17.6.4 11-Nov-2007  joerg Sync with HEAD.
 1.17.6.3 04-Nov-2007  jmcneill Sync with HEAD.
 1.17.6.2 31-Oct-2007  joerg Sync with HEAD.
 1.17.6.1 28-Oct-2007  joerg Sync with HEAD.
 1.20.2.3 18-Feb-2008  mjf Sync with HEAD.
 1.20.2.2 27-Dec-2007  mjf Sync with HEAD.
 1.20.2.1 19-Nov-2007  mjf Sync with HEAD.
 1.23.6.3 19-Jan-2008  bouyer Sync with HEAD
 1.23.6.2 08-Jan-2008  bouyer Sync with HEAD
 1.23.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.23.2.1 26-Dec-2007  ad Sync with head.
 1.34.6.4 17-Jan-2009  mjf Sync with HEAD.
 1.34.6.3 28-Sep-2008  mjf Sync with HEAD.
 1.34.6.2 29-Jun-2008  mjf Sync with HEAD.
 1.34.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.36.6.3 10-Oct-2008  skrll Sync with HEAD.
 1.36.6.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.36.6.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.36.4.4 11-Aug-2010  yamt sync with head.
 1.36.4.3 11-Mar-2010  yamt sync with head
 1.36.4.2 20-Jun-2009  yamt sync with head
 1.36.4.1 04-May-2009  yamt sync with head.
 1.36.2.2 17-Jun-2008  yamt sync with head.
 1.36.2.1 04-Jun-2008  yamt sync with head
 1.37.2.2 28-Jul-2008  simonb Sync with head.
 1.37.2.1 18-Jun-2008  simonb Sync with head.
 1.38.2.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.38.2.1 19-Oct-2008  haad Sync with HEAD.
 1.41.4.2 18-Mar-2015  snj regen for ticket 1149
 1.41.4.1 20-Nov-2008  snj Regen for ticket 81.
 1.41.2.2 03-Mar-2009  skrll Sync with HEAD.
 1.41.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.47.2.2 04-Jan-2009  christos use compat_50 syscalls where appropriate.
 1.47.2.1 12-Dec-2008  christos file linux32_syscallargs.h was added on branch christos-time_t on 2009-01-04 01:58:39 +0000
 1.53.2.1 23-Jul-2009  jym Sync with HEAD.
 1.58.4.3 31-May-2011  rmind sync with head
 1.58.4.2 21-Apr-2011  rmind sync with head
 1.58.4.1 05-Mar-2011  rmind sync with head
 1.58.2.2 06-Nov-2010  uebayasi Sync with HEAD.
 1.58.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.60.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.63.4.4 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.63.4.3 30-Oct-2012  yamt sync with head
 1.63.4.2 23-May-2012  yamt sync with head.
 1.63.4.1 17-Apr-2012  yamt sync with head
 1.65.6.2 20-Jul-2012  riz Pull up following revision(s) (requested by christos in ticket #424):
sys/compat/linux32/arch/amd64/linux32_syscallargs.h: revision 1.67
sys/compat/linux32/arch/amd64/syscalls.master: revision 1.62
sys/compat/linux32/arch/amd64/linux32_syscall.h: revision 1.67
sys/compat/linux32/arch/amd64/linux32_sysent.c: revision 1.67
sys/compat/linux32/arch/amd64/linux32_syscalls.c: revision 1.67
add xattr stubs
regen
 1.65.6.1 19-May-2012  riz Pull up following revision(s) (requested by christos in ticket #263):
sys/compat/linux32/arch/amd64/linux32_syscallargs.h: revision 1.66
sys/compat/linux32/arch/amd64/syscalls.master: revision 1.61
sys/compat/linux32/common/linux32_signal.c: revision 1.16
sys/compat/linux32/arch/amd64/linux32_syscall.h: revision 1.66
sys/compat/linux32/arch/amd64/linux32_sysent.c: revision 1.66
sys/compat/linux32/arch/amd64/linux32_syscalls.c: revision 1.66
regen
Fix rt_sigtimedwait():
It is wishful thinking that:
1. declaring a 32 bit syscall with 64 bit pointers
2. passing a struct with 32 bit pointers to a 64 bit function
is going to work.
 1.65.4.1 02-Jun-2012  mrg sync to latest -current.
 1.67.4.1 18-May-2014  rmind sync with head
 1.67.2.2 03-Dec-2017  jdolecek update from HEAD
 1.67.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.70.2.1 10-Aug-2014  tls Rebase.
 1.73.2.2 28-Aug-2017  skrll Sync with HEAD
 1.73.2.1 06-Apr-2015  skrll Sync with HEAD
 1.75.2.1 20-Mar-2017  pgoyette Sync with HEAD
 1.76.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.77.4.1 11-May-2017  pgoyette Sync with HEAD
 1.78.10.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.78.10.1 10-Jun-2019  christos Sync with HEAD
 1.78.8.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.81.2.3 03-Jan-2021  thorpej Regen for preadv(2) and pwritev(2).
 1.81.2.2 17-Dec-2020  thorpej Regen for POSIX timers and timerfd.
 1.81.2.1 16-Dec-2020  thorpej Regen for eventfd.
 1.87 02-Dec-2021  ryo regen
 1.86 27-Nov-2021  ryo regen
 1.85 20-Sep-2021  thorpej Regen for preadv(2) / pwritev(2).
 1.84 20-Sep-2021  thorpej Regen for eventfd.
 1.83 19-Sep-2021  thorpej Regen for timerfd.
 1.82 19-Sep-2021  thorpej Regen for POSIX timer syscalls.
 1.81 26-Apr-2020  thorpej branches: 1.81.2;
Regen for native futex calls.
 1.80 09-Nov-2019  jdolecek regen
 1.79 10-Aug-2018  pgoyette Regen
 1.78 10-May-2017  riastradh branches: 1.78.8; 1.78.10;
regen
 1.77 16-Jan-2017  christos branches: 1.77.4;
descend and regen
 1.76 13-Jan-2017  christos branches: 1.76.2;
regen
 1.75 08-Mar-2015  christos branches: 1.75.2;
regen
 1.74 07-Mar-2015  christos regen
 1.73 22-Nov-2014  njoly branches: 1.73.2;
Regen for ppoll(2)
 1.72 29-May-2014  njoly Regen for utimes(2).
 1.71 04-May-2014  njoly Regen for pread/pwrite 64bit offset argument.
 1.70 18-Nov-2013  christos branches: 1.70.2;
Regen
 1.69 18-Nov-2013  chs regen
 1.68 07-Nov-2013  njoly Regen for dup/dup2/dup3 argument types fix.
 1.67 13-Jul-2012  christos branches: 1.67.2; 1.67.4;
regen
 1.66 10-May-2012  christos regen
 1.65 18-Nov-2011  christos branches: 1.65.4; 1.65.6;
regen
 1.64 18-Nov-2011  christos add sigtimedwait support
 1.63 30-May-2011  alnsn branches: 1.63.4;
Regenerate files to pick up correct RCS Ids. Suggested by Chris Badura.
 1.62 30-May-2011  alnsn Add fadvise64 and fadvise64_64 syscalls to compat_linux and compat_linux32.
 1.61 10-Apr-2011  christos Regen: XXX: produces errors because of rump changes!
 1.60 02-Nov-2010  chs branches: 1.60.2;
regen
 1.59 07-Jul-2010  chs regen
 1.58 24-Nov-2009  njoly branches: 1.58.2; 1.58.4;
Regen for personality(2) update.
 1.57 08-Jun-2009  njoly Regen for rt_queueinfo addition.
 1.56 05-Jun-2009  njoly Regen for fstatfs.
 1.55 04-Jun-2009  njoly Regen for stat/lstat/fstat syscalls.
 1.54 02-Jun-2009  njoly Regen for siggetmask/sigsetmask.
 1.53 30-Jan-2009  njoly branches: 1.53.2;
Regen for mincore(2).
 1.52 20-Jan-2009  njoly Regen for personality(2) addition.
 1.51 17-Jan-2009  njoly Regen for wait4 update.
 1.50 16-Jan-2009  njoly Regen for compat 50 update.
 1.49 13-Jan-2009  pooka Regen to prove I didn't screw up the conversion: purely RCSID changes.
 1.48 11-Jan-2009  christos merge christos-time_t
 1.47 12-Dec-2008  njoly branches: 1.47.2;
Regen for clock_nanosleep.
 1.46 06-Dec-2008  njoly Regen for netbsd32_caddr_t removal.
 1.45 05-Dec-2008  njoly Regen for getres{uid,gid} syscalls.
 1.44 01-Dec-2008  njoly Regen for sched_get_priority_{min,max}.
 1.43 19-Nov-2008  ad Regen.
 1.42 12-Nov-2008  njoly Regen for nanosleep(2) fix.
 1.41 06-Oct-2008  njoly branches: 1.41.2; 1.41.4;
Regen.
 1.40 22-Sep-2008  njoly Regen after cleanup.
 1.39 24-Jul-2008  njoly Regen for rt_sigpending.
 1.38 16-Jun-2008  christos branches: 1.38.2;
regen
 1.37 20-May-2008  njoly branches: 1.37.2;
Regen for ipc(2) syscall support.
 1.36 17-Apr-2008  njoly branches: 1.36.2; 1.36.4; 1.36.6;
Regen for sys_clock_{getres,gettime,settime} syscalls.
 1.35 04-Apr-2008  njoly Regen for msync(2) support.
 1.34 20-Feb-2008  njoly branches: 1.34.6;
Regen for mlock/munlock syscalls
 1.33 17-Feb-2008  njoly Regen for pread/pwrite fixes.
 1.32 04-Feb-2008  dsl Regen for merging fcntl() and fcntl64().
 1.31 02-Feb-2008  dsl Regen for pread and pwrite
 1.30 15-Jan-2008  njoly Regen.
 1.29 07-Jan-2008  njoly Regen.
 1.28 26-Dec-2007  njoly Regen for readdir syscall.
 1.27 24-Dec-2007  njoly Regen for old_uname syscall.
 1.26 24-Dec-2007  njoly Regen for getpgid.
 1.25 21-Dec-2007  njoly Regen for getfsuid/setfsgid syscall exchange.
 1.24 20-Dec-2007  dsl regen
 1.23 16-Nov-2007  njoly branches: 1.23.2; 1.23.6;
Regen.
 1.22 11-Nov-2007  christos regen
 1.21 07-Nov-2007  njoly Regen for 64-bit linux syscalls removal.
 1.20 31-Oct-2007  dsl branches: 1.20.2;
regen
 1.19 31-Oct-2007  njoly Regen for syscalls cleanup.
 1.18 27-Oct-2007  njoly Regen for chown additions.
 1.17 20-Apr-2007  njoly branches: 1.17.6; 1.17.8; 1.17.12;
Regen (ftruncate fix).
 1.16 11-Apr-2007  njoly Regen (statfs support).
 1.15 05-Mar-2007  christos branches: 1.15.2; 1.15.4;
fix caddr_t lossage.
 1.14 16-Feb-2007  njoly branches: 1.14.2;
Regen.
 1.13 09-Feb-2007  ad Merge newlock2 to head.
 1.12 08-Feb-2007  njoly Regen (aliases cleanup).
 1.11 07-Feb-2007  njoly Regen (poll argument fix).
 1.10 13-Sep-2006  manu branches: 1.10.4;
Jumbo COMPAT_LINUX/COMPAT_LINUX32 bugfix, with the help of Nicolas Joly
- Fix shmat return value on amd64: it uses no black magic with retval[0]
- Fix integer overflows in sysinfo
- Implement sysinfo, mmap2, sched_getparam, sched_getscheduler, mremap,
and madvise in COMPAT_LINUX32
- Fix improper types used in setgroups16/getgroups16
- Implement mmap2 for COMPAT_LINUX32
- Ifdef debug messages by DEBUG_LINUX
 1.9 06-Sep-2006  manu branches: 1.9.2; 1.9.4;
Implement Linux's fdatasync, patch from Nicolas Joly
 1.8 06-Sep-2006  manu Fix linux32_sys_setres{uid|gid}: -1 does not means the same thing on i386
and amd64...
 1.7 05-Sep-2006  manu typo
 1.6 01-Sep-2006  matt Regen.
 1.5 25-Jun-2006  manu Regen
 1.4 25-Jun-2006  manu - Complete exit_group() implementation. We now maintain a list of Linux
threads in a processes and kill them properly. The code is a bit too
complicated, but I could not find a simplier way of dealing with it

- Change getpid() and getppid() semantics to match what Linux does,
and implement gettid(). In the Linux kernel, threads are implemnted
as plain old processes. A thread group is just a set of processes,
with the parent called leader. Thread ID, which are returned by gettid(),
are just the PID of the plain old processes, and getpid() returns the
PID of the thread group leader.

- Remove struct linux32_emuldata. COMPAT_LINUX32 uses a lot of COMPAT_LINUX
code, where a struct linux_emuldata is assumed. By having distinct emuldata
structure with different sizes and layouts, we caused kernel memory
corruptions.

- Fix setprioriry() and getpriority()

Thanks to Nicolas Joly for tracking down the problem and providing me the
hardware to fix them.
 1.3 15-Feb-2006  manu branches: 1.3.2; 1.3.4; 1.3.10; 1.3.14; 1.3.16;
Add getcwd (for real this time), fix dup and dup2
 1.2 15-Feb-2006  manu - Move the BSD to Linux and Linux to BSD termio/termios conversion functions
to a header where they can be shared between COMPAT_LINUX and COMPAT_LINUX32
- Add termios ioctl emulation to COMPAT_LINUX32
- Add the getcwd system call to COMPAT_LINUX32/amd64

That makes Linux's bash working with COMPAT_LINUX32.
 1.1 09-Feb-2006  manu Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.3.16.12 27-Feb-2008  yamt sync with head.
 1.3.16.11 11-Feb-2008  yamt sync with head.
 1.3.16.10 04-Feb-2008  yamt sync with head.
 1.3.16.9 21-Jan-2008  yamt sync with head
 1.3.16.8 07-Dec-2007  yamt sync with head
 1.3.16.7 15-Nov-2007  yamt sync with head.
 1.3.16.6 27-Oct-2007  yamt sync with head.
 1.3.16.5 03-Sep-2007  yamt sync with head.
 1.3.16.4 26-Feb-2007  yamt sync with head.
 1.3.16.3 30-Dec-2006  yamt sync with head.
 1.3.16.2 21-Jun-2006  yamt sync with head.
 1.3.16.1 15-Feb-2006  yamt file linux32_syscalls.c was added on branch yamt-lazymbuf on 2006-06-21 14:59:27 +0000
 1.3.14.1 13-Jul-2006  gdamore Merge from HEAD.
 1.3.10.2 22-Apr-2006  simonb Sync with head.
 1.3.10.1 15-Feb-2006  simonb file linux32_syscalls.c was added on branch simonb-timecounters on 2006-04-22 11:38:14 +0000
 1.3.4.2 14-Sep-2006  yamt sync with head.
 1.3.4.1 26-Jun-2006  yamt sync with head.
 1.3.2.2 18-Feb-2006  yamt sync with head.
 1.3.2.1 15-Feb-2006  yamt file linux32_syscalls.c was added on branch yamt-uio_vmspace on 2006-02-18 15:38:59 +0000
 1.9.4.2 09-Sep-2006  rpaulo sync with head
 1.9.4.1 06-Sep-2006  rpaulo file linux32_syscalls.c was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:45:52 +0000
 1.9.2.3 09-Feb-2007  ad Sync with HEAD.
 1.9.2.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.9.2.1 18-Nov-2006  ad Sync with head.
 1.10.4.2 20-Apr-2007  bouyer regen for ticket #582
 1.10.4.1 02-Apr-2007  bouyer Regen for ticket #544
 1.14.2.3 07-May-2007  yamt sync with head.
 1.14.2.2 15-Apr-2007  yamt sync with head.
 1.14.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.15.4.1 11-Jul-2007  mjf Sync with head.
 1.15.2.1 27-May-2007  ad Sync with head.
 1.17.12.2 18-Nov-2007  bouyer Sync with HEAD
 1.17.12.1 13-Nov-2007  bouyer Sync with HEAD
 1.17.8.4 23-Mar-2008  matt sync with HEAD
 1.17.8.3 09-Jan-2008  matt sync with HEAD
 1.17.8.2 08-Nov-2007  matt sync with -HEAD
 1.17.8.1 06-Nov-2007  matt sync with HEAD
 1.17.6.6 21-Nov-2007  joerg Sync with HEAD.
 1.17.6.5 14-Nov-2007  joerg Sync with HEAD.
 1.17.6.4 11-Nov-2007  joerg Sync with HEAD.
 1.17.6.3 04-Nov-2007  jmcneill Sync with HEAD.
 1.17.6.2 31-Oct-2007  joerg Sync with HEAD.
 1.17.6.1 28-Oct-2007  joerg Sync with HEAD.
 1.20.2.3 18-Feb-2008  mjf Sync with HEAD.
 1.20.2.2 27-Dec-2007  mjf Sync with HEAD.
 1.20.2.1 19-Nov-2007  mjf Sync with HEAD.
 1.23.6.3 19-Jan-2008  bouyer Sync with HEAD
 1.23.6.2 08-Jan-2008  bouyer Sync with HEAD
 1.23.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.23.2.1 26-Dec-2007  ad Sync with head.
 1.34.6.4 17-Jan-2009  mjf Sync with HEAD.
 1.34.6.3 28-Sep-2008  mjf Sync with HEAD.
 1.34.6.2 29-Jun-2008  mjf Sync with HEAD.
 1.34.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.36.6.3 10-Oct-2008  skrll Sync with HEAD.
 1.36.6.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.36.6.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.36.4.4 11-Aug-2010  yamt sync with head.
 1.36.4.3 11-Mar-2010  yamt sync with head
 1.36.4.2 20-Jun-2009  yamt sync with head
 1.36.4.1 04-May-2009  yamt sync with head.
 1.36.2.2 17-Jun-2008  yamt sync with head.
 1.36.2.1 04-Jun-2008  yamt sync with head
 1.37.2.2 28-Jul-2008  simonb Sync with head.
 1.37.2.1 18-Jun-2008  simonb Sync with head.
 1.38.2.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.38.2.1 19-Oct-2008  haad Sync with HEAD.
 1.41.4.2 18-Mar-2015  snj regen for ticket 1149
 1.41.4.1 20-Nov-2008  snj Regen for ticket 81.
 1.41.2.2 03-Mar-2009  skrll Sync with HEAD.
 1.41.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.47.2.2 04-Jan-2009  christos use compat_50 syscalls where appropriate.
 1.47.2.1 12-Dec-2008  christos file linux32_syscalls.c was added on branch christos-time_t on 2009-01-04 01:58:39 +0000
 1.53.2.1 23-Jul-2009  jym Sync with HEAD.
 1.58.4.3 31-May-2011  rmind sync with head
 1.58.4.2 21-Apr-2011  rmind sync with head
 1.58.4.1 05-Mar-2011  rmind sync with head
 1.58.2.2 06-Nov-2010  uebayasi Sync with HEAD.
 1.58.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.60.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.63.4.4 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.63.4.3 30-Oct-2012  yamt sync with head
 1.63.4.2 23-May-2012  yamt sync with head.
 1.63.4.1 17-Apr-2012  yamt sync with head
 1.65.6.2 20-Jul-2012  riz Pull up following revision(s) (requested by christos in ticket #424):
sys/compat/linux32/arch/amd64/linux32_syscallargs.h: revision 1.67
sys/compat/linux32/arch/amd64/syscalls.master: revision 1.62
sys/compat/linux32/arch/amd64/linux32_syscall.h: revision 1.67
sys/compat/linux32/arch/amd64/linux32_sysent.c: revision 1.67
sys/compat/linux32/arch/amd64/linux32_syscalls.c: revision 1.67
add xattr stubs
regen
 1.65.6.1 19-May-2012  riz Pull up following revision(s) (requested by christos in ticket #263):
sys/compat/linux32/arch/amd64/linux32_syscallargs.h: revision 1.66
sys/compat/linux32/arch/amd64/syscalls.master: revision 1.61
sys/compat/linux32/common/linux32_signal.c: revision 1.16
sys/compat/linux32/arch/amd64/linux32_syscall.h: revision 1.66
sys/compat/linux32/arch/amd64/linux32_sysent.c: revision 1.66
sys/compat/linux32/arch/amd64/linux32_syscalls.c: revision 1.66
regen
Fix rt_sigtimedwait():
It is wishful thinking that:
1. declaring a 32 bit syscall with 64 bit pointers
2. passing a struct with 32 bit pointers to a 64 bit function
is going to work.
 1.65.4.1 02-Jun-2012  mrg sync to latest -current.
 1.67.4.1 18-May-2014  rmind sync with head
 1.67.2.2 03-Dec-2017  jdolecek update from HEAD
 1.67.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.70.2.1 10-Aug-2014  tls Rebase.
 1.73.2.2 05-Feb-2017  skrll Sync with HEAD
 1.73.2.1 06-Apr-2015  skrll Sync with HEAD
 1.75.2.1 20-Mar-2017  pgoyette Sync with HEAD
 1.76.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.77.4.1 11-May-2017  pgoyette Sync with HEAD
 1.78.10.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.78.10.1 10-Jun-2019  christos Sync with HEAD
 1.78.8.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.81.2.3 03-Jan-2021  thorpej Regen for preadv(2) and pwritev(2).
 1.81.2.2 17-Dec-2020  thorpej Regen for POSIX timers and timerfd.
 1.81.2.1 16-Dec-2020  thorpej Regen for eventfd.
 1.87 02-Dec-2021  ryo regen
 1.86 27-Nov-2021  ryo regen
 1.85 20-Sep-2021  thorpej Regen for preadv(2) / pwritev(2).
 1.84 20-Sep-2021  thorpej Regen for eventfd.
 1.83 19-Sep-2021  thorpej Regen for timerfd.
 1.82 19-Sep-2021  thorpej Regen for POSIX timer syscalls.
 1.81 26-Apr-2020  thorpej branches: 1.81.2;
Regen for native futex calls.
 1.80 09-Nov-2019  jdolecek regen
 1.79 10-Aug-2018  pgoyette Regen
 1.78 10-May-2017  riastradh branches: 1.78.8; 1.78.10;
regen
 1.77 16-Jan-2017  christos branches: 1.77.4;
descend and regen
 1.76 13-Jan-2017  christos branches: 1.76.2;
regen
 1.75 08-Mar-2015  christos branches: 1.75.2;
regen
 1.74 07-Mar-2015  christos regen
 1.73 22-Nov-2014  njoly branches: 1.73.2;
Regen for ppoll(2)
 1.72 29-May-2014  njoly Regen for utimes(2).
 1.71 04-May-2014  njoly Regen for pread/pwrite 64bit offset argument.
 1.70 18-Nov-2013  christos branches: 1.70.2;
Regen
 1.69 18-Nov-2013  chs regen
 1.68 07-Nov-2013  njoly Regen for dup/dup2/dup3 argument types fix.
 1.67 13-Jul-2012  christos branches: 1.67.2; 1.67.4;
regen
 1.66 10-May-2012  christos regen
 1.65 18-Nov-2011  christos branches: 1.65.4; 1.65.6;
regen
 1.64 18-Nov-2011  christos add sigtimedwait support
 1.63 30-May-2011  alnsn branches: 1.63.4;
Regenerate files to pick up correct RCS Ids. Suggested by Chris Badura.
 1.62 30-May-2011  alnsn Add fadvise64 and fadvise64_64 syscalls to compat_linux and compat_linux32.
 1.61 10-Apr-2011  christos Regen: XXX: produces errors because of rump changes!
 1.60 02-Nov-2010  chs branches: 1.60.2;
regen
 1.59 07-Jul-2010  chs regen
 1.58 24-Nov-2009  njoly branches: 1.58.2; 1.58.4;
Regen for personality(2) update.
 1.57 08-Jun-2009  njoly Regen for rt_queueinfo addition.
 1.56 05-Jun-2009  njoly Regen for fstatfs.
 1.55 04-Jun-2009  njoly Regen for stat/lstat/fstat syscalls.
 1.54 02-Jun-2009  njoly Regen for siggetmask/sigsetmask.
 1.53 30-Jan-2009  njoly branches: 1.53.2;
Regen for mincore(2).
 1.52 20-Jan-2009  njoly Regen for personality(2) addition.
 1.51 17-Jan-2009  njoly Regen for wait4 update.
 1.50 16-Jan-2009  njoly Regen for compat 50 update.
 1.49 13-Jan-2009  pooka Regen to prove I didn't screw up the conversion: purely RCSID changes.
 1.48 11-Jan-2009  christos merge christos-time_t
 1.47 12-Dec-2008  njoly branches: 1.47.2;
Regen for clock_nanosleep.
 1.46 06-Dec-2008  njoly Regen for netbsd32_caddr_t removal.
 1.45 05-Dec-2008  njoly Regen for getres{uid,gid} syscalls.
 1.44 01-Dec-2008  njoly Regen for sched_get_priority_{min,max}.
 1.43 19-Nov-2008  ad Regen.
 1.42 12-Nov-2008  njoly Regen for nanosleep(2) fix.
 1.41 06-Oct-2008  njoly branches: 1.41.2; 1.41.4;
Regen.
 1.40 22-Sep-2008  njoly Regen after cleanup.
 1.39 24-Jul-2008  njoly Regen for rt_sigpending.
 1.38 16-Jun-2008  christos branches: 1.38.2;
regen
 1.37 20-May-2008  njoly branches: 1.37.2;
Regen for ipc(2) syscall support.
 1.36 17-Apr-2008  njoly branches: 1.36.2; 1.36.4; 1.36.6;
Regen for sys_clock_{getres,gettime,settime} syscalls.
 1.35 04-Apr-2008  njoly Regen for msync(2) support.
 1.34 20-Feb-2008  njoly branches: 1.34.6;
Regen for mlock/munlock syscalls
 1.33 17-Feb-2008  njoly Regen for pread/pwrite fixes.
 1.32 04-Feb-2008  dsl Regen for merging fcntl() and fcntl64().
 1.31 02-Feb-2008  dsl Regen for pread and pwrite
 1.30 15-Jan-2008  njoly Regen.
 1.29 07-Jan-2008  njoly Regen.
 1.28 26-Dec-2007  njoly Regen for readdir syscall.
 1.27 24-Dec-2007  njoly Regen for old_uname syscall.
 1.26 24-Dec-2007  njoly Regen for getpgid.
 1.25 21-Dec-2007  njoly Regen for getfsuid/setfsgid syscall exchange.
 1.24 20-Dec-2007  dsl regen
 1.23 16-Nov-2007  njoly branches: 1.23.2; 1.23.6;
Regen.
 1.22 11-Nov-2007  christos regen
 1.21 07-Nov-2007  njoly Regen for 64-bit linux syscalls removal.
 1.20 31-Oct-2007  dsl branches: 1.20.2;
regen
 1.19 31-Oct-2007  njoly Regen for syscalls cleanup.
 1.18 27-Oct-2007  njoly Regen for chown additions.
 1.17 20-Apr-2007  njoly branches: 1.17.6; 1.17.8; 1.17.12;
Regen (ftruncate fix).
 1.16 11-Apr-2007  njoly Regen (statfs support).
 1.15 05-Mar-2007  christos branches: 1.15.2; 1.15.4;
fix caddr_t lossage.
 1.14 16-Feb-2007  njoly branches: 1.14.2;
Regen.
 1.13 09-Feb-2007  ad Merge newlock2 to head.
 1.12 08-Feb-2007  njoly Regen (aliases cleanup).
 1.11 07-Feb-2007  njoly Regen (poll argument fix).
 1.10 13-Sep-2006  manu branches: 1.10.4;
Jumbo COMPAT_LINUX/COMPAT_LINUX32 bugfix, with the help of Nicolas Joly
- Fix shmat return value on amd64: it uses no black magic with retval[0]
- Fix integer overflows in sysinfo
- Implement sysinfo, mmap2, sched_getparam, sched_getscheduler, mremap,
and madvise in COMPAT_LINUX32
- Fix improper types used in setgroups16/getgroups16
- Implement mmap2 for COMPAT_LINUX32
- Ifdef debug messages by DEBUG_LINUX
 1.9 06-Sep-2006  manu branches: 1.9.2; 1.9.4;
Implement Linux's fdatasync, patch from Nicolas Joly
 1.8 06-Sep-2006  manu Fix linux32_sys_setres{uid|gid}: -1 does not means the same thing on i386
and amd64...
 1.7 05-Sep-2006  manu typo
 1.6 01-Sep-2006  matt Regen.
 1.5 25-Jun-2006  manu Regen
 1.4 25-Jun-2006  manu - Complete exit_group() implementation. We now maintain a list of Linux
threads in a processes and kill them properly. The code is a bit too
complicated, but I could not find a simplier way of dealing with it

- Change getpid() and getppid() semantics to match what Linux does,
and implement gettid(). In the Linux kernel, threads are implemnted
as plain old processes. A thread group is just a set of processes,
with the parent called leader. Thread ID, which are returned by gettid(),
are just the PID of the plain old processes, and getpid() returns the
PID of the thread group leader.

- Remove struct linux32_emuldata. COMPAT_LINUX32 uses a lot of COMPAT_LINUX
code, where a struct linux_emuldata is assumed. By having distinct emuldata
structure with different sizes and layouts, we caused kernel memory
corruptions.

- Fix setprioriry() and getpriority()

Thanks to Nicolas Joly for tracking down the problem and providing me the
hardware to fix them.
 1.3 15-Feb-2006  manu branches: 1.3.2; 1.3.4; 1.3.10; 1.3.14; 1.3.16;
Add getcwd (for real this time), fix dup and dup2
 1.2 15-Feb-2006  manu - Move the BSD to Linux and Linux to BSD termio/termios conversion functions
to a header where they can be shared between COMPAT_LINUX and COMPAT_LINUX32
- Add termios ioctl emulation to COMPAT_LINUX32
- Add the getcwd system call to COMPAT_LINUX32/amd64

That makes Linux's bash working with COMPAT_LINUX32.
 1.1 09-Feb-2006  manu Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.3.16.12 27-Feb-2008  yamt sync with head.
 1.3.16.11 11-Feb-2008  yamt sync with head.
 1.3.16.10 04-Feb-2008  yamt sync with head.
 1.3.16.9 21-Jan-2008  yamt sync with head
 1.3.16.8 07-Dec-2007  yamt sync with head
 1.3.16.7 15-Nov-2007  yamt sync with head.
 1.3.16.6 27-Oct-2007  yamt sync with head.
 1.3.16.5 03-Sep-2007  yamt sync with head.
 1.3.16.4 26-Feb-2007  yamt sync with head.
 1.3.16.3 30-Dec-2006  yamt sync with head.
 1.3.16.2 21-Jun-2006  yamt sync with head.
 1.3.16.1 15-Feb-2006  yamt file linux32_sysent.c was added on branch yamt-lazymbuf on 2006-06-21 14:59:27 +0000
 1.3.14.1 13-Jul-2006  gdamore Merge from HEAD.
 1.3.10.2 22-Apr-2006  simonb Sync with head.
 1.3.10.1 15-Feb-2006  simonb file linux32_sysent.c was added on branch simonb-timecounters on 2006-04-22 11:38:14 +0000
 1.3.4.2 14-Sep-2006  yamt sync with head.
 1.3.4.1 26-Jun-2006  yamt sync with head.
 1.3.2.2 18-Feb-2006  yamt sync with head.
 1.3.2.1 15-Feb-2006  yamt file linux32_sysent.c was added on branch yamt-uio_vmspace on 2006-02-18 15:38:59 +0000
 1.9.4.2 09-Sep-2006  rpaulo sync with head
 1.9.4.1 06-Sep-2006  rpaulo file linux32_sysent.c was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:45:52 +0000
 1.9.2.3 09-Feb-2007  ad Sync with HEAD.
 1.9.2.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.9.2.1 18-Nov-2006  ad Sync with head.
 1.10.4.2 20-Apr-2007  bouyer regen for ticket #582
 1.10.4.1 02-Apr-2007  bouyer Regen for ticket #544
 1.14.2.3 07-May-2007  yamt sync with head.
 1.14.2.2 15-Apr-2007  yamt sync with head.
 1.14.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.15.4.1 11-Jul-2007  mjf Sync with head.
 1.15.2.1 27-May-2007  ad Sync with head.
 1.17.12.2 18-Nov-2007  bouyer Sync with HEAD
 1.17.12.1 13-Nov-2007  bouyer Sync with HEAD
 1.17.8.4 23-Mar-2008  matt sync with HEAD
 1.17.8.3 09-Jan-2008  matt sync with HEAD
 1.17.8.2 08-Nov-2007  matt sync with -HEAD
 1.17.8.1 06-Nov-2007  matt sync with HEAD
 1.17.6.6 21-Nov-2007  joerg Sync with HEAD.
 1.17.6.5 14-Nov-2007  joerg Sync with HEAD.
 1.17.6.4 11-Nov-2007  joerg Sync with HEAD.
 1.17.6.3 04-Nov-2007  jmcneill Sync with HEAD.
 1.17.6.2 31-Oct-2007  joerg Sync with HEAD.
 1.17.6.1 28-Oct-2007  joerg Sync with HEAD.
 1.20.2.3 18-Feb-2008  mjf Sync with HEAD.
 1.20.2.2 27-Dec-2007  mjf Sync with HEAD.
 1.20.2.1 19-Nov-2007  mjf Sync with HEAD.
 1.23.6.3 19-Jan-2008  bouyer Sync with HEAD
 1.23.6.2 08-Jan-2008  bouyer Sync with HEAD
 1.23.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.23.2.1 26-Dec-2007  ad Sync with head.
 1.34.6.4 17-Jan-2009  mjf Sync with HEAD.
 1.34.6.3 28-Sep-2008  mjf Sync with HEAD.
 1.34.6.2 29-Jun-2008  mjf Sync with HEAD.
 1.34.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.36.6.3 10-Oct-2008  skrll Sync with HEAD.
 1.36.6.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.36.6.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.36.4.4 11-Aug-2010  yamt sync with head.
 1.36.4.3 11-Mar-2010  yamt sync with head
 1.36.4.2 20-Jun-2009  yamt sync with head
 1.36.4.1 04-May-2009  yamt sync with head.
 1.36.2.2 17-Jun-2008  yamt sync with head.
 1.36.2.1 04-Jun-2008  yamt sync with head
 1.37.2.2 28-Jul-2008  simonb Sync with head.
 1.37.2.1 18-Jun-2008  simonb Sync with head.
 1.38.2.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.38.2.1 19-Oct-2008  haad Sync with HEAD.
 1.41.4.2 18-Mar-2015  snj regen for ticket 1149
 1.41.4.1 20-Nov-2008  snj Regen for ticket 81.
 1.41.2.2 03-Mar-2009  skrll Sync with HEAD.
 1.41.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.47.2.2 04-Jan-2009  christos use compat_50 syscalls where appropriate.
 1.47.2.1 12-Dec-2008  christos file linux32_sysent.c was added on branch christos-time_t on 2009-01-04 01:58:39 +0000
 1.53.2.1 23-Jul-2009  jym Sync with HEAD.
 1.58.4.3 31-May-2011  rmind sync with head
 1.58.4.2 21-Apr-2011  rmind sync with head
 1.58.4.1 05-Mar-2011  rmind sync with head
 1.58.2.2 06-Nov-2010  uebayasi Sync with HEAD.
 1.58.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.60.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.63.4.4 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.63.4.3 30-Oct-2012  yamt sync with head
 1.63.4.2 23-May-2012  yamt sync with head.
 1.63.4.1 17-Apr-2012  yamt sync with head
 1.65.6.2 20-Jul-2012  riz Pull up following revision(s) (requested by christos in ticket #424):
sys/compat/linux32/arch/amd64/linux32_syscallargs.h: revision 1.67
sys/compat/linux32/arch/amd64/syscalls.master: revision 1.62
sys/compat/linux32/arch/amd64/linux32_syscall.h: revision 1.67
sys/compat/linux32/arch/amd64/linux32_sysent.c: revision 1.67
sys/compat/linux32/arch/amd64/linux32_syscalls.c: revision 1.67
add xattr stubs
regen
 1.65.6.1 19-May-2012  riz Pull up following revision(s) (requested by christos in ticket #263):
sys/compat/linux32/arch/amd64/linux32_syscallargs.h: revision 1.66
sys/compat/linux32/arch/amd64/syscalls.master: revision 1.61
sys/compat/linux32/common/linux32_signal.c: revision 1.16
sys/compat/linux32/arch/amd64/linux32_syscall.h: revision 1.66
sys/compat/linux32/arch/amd64/linux32_sysent.c: revision 1.66
sys/compat/linux32/arch/amd64/linux32_syscalls.c: revision 1.66
regen
Fix rt_sigtimedwait():
It is wishful thinking that:
1. declaring a 32 bit syscall with 64 bit pointers
2. passing a struct with 32 bit pointers to a 64 bit function
is going to work.
 1.65.4.1 02-Jun-2012  mrg sync to latest -current.
 1.67.4.1 18-May-2014  rmind sync with head
 1.67.2.2 03-Dec-2017  jdolecek update from HEAD
 1.67.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.70.2.1 10-Aug-2014  tls Rebase.
 1.73.2.2 05-Feb-2017  skrll Sync with HEAD
 1.73.2.1 06-Apr-2015  skrll Sync with HEAD
 1.75.2.1 20-Mar-2017  pgoyette Sync with HEAD
 1.76.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.77.4.1 11-May-2017  pgoyette Sync with HEAD
 1.78.10.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.78.10.1 10-Jun-2019  christos Sync with HEAD
 1.78.8.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.81.2.3 03-Jan-2021  thorpej Regen for preadv(2) and pwritev(2).
 1.81.2.2 17-Dec-2020  thorpej Regen for POSIX timers and timerfd.
 1.81.2.1 16-Dec-2020  thorpej Regen for eventfd.
 1.14 02-Dec-2021  ryo regen
 1.13 27-Nov-2021  ryo regen
 1.12 20-Sep-2021  thorpej Regen for preadv(2) / pwritev(2).
 1.11 20-Sep-2021  thorpej Regen for eventfd.
 1.10 19-Sep-2021  thorpej Regen for timerfd.
 1.9 19-Sep-2021  thorpej Regen for POSIX timer syscalls.
 1.8 26-Apr-2020  thorpej branches: 1.8.2;
Regen for native futex calls.
 1.7 09-Nov-2019  jdolecek regen
 1.6 10-Aug-2018  pgoyette Regen
 1.5 10-May-2017  riastradh branches: 1.5.8; 1.5.10; 1.5.12;
regen
 1.4 16-Jan-2017  christos branches: 1.4.4;
descend and regen
 1.3 13-Jan-2017  christos branches: 1.3.2;
regen
 1.2 08-Mar-2015  christos branches: 1.2.2; 1.2.4;
regen
 1.1 07-Mar-2015  christos regen
 1.2.4.1 20-Mar-2017  pgoyette Sync with HEAD
 1.2.2.3 05-Feb-2017  skrll Sync with HEAD
 1.2.2.2 06-Apr-2015  skrll Sync with HEAD
 1.2.2.1 08-Mar-2015  skrll file linux32_systrace_args.c was added on branch nick-nhusb on 2015-04-06 15:18:06 +0000
 1.3.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.4.4.1 11-May-2017  pgoyette Sync with HEAD
 1.5.12.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.5.12.1 10-Jun-2019  christos Sync with HEAD
 1.5.10.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.5.8.2 03-Dec-2017  jdolecek update from HEAD
 1.5.8.1 10-May-2017  jdolecek file linux32_systrace_args.c was added on branch tls-maxphys on 2017-12-03 11:36:55 +0000
 1.8.2.3 03-Jan-2021  thorpej Regen for preadv(2) and pwritev(2).
 1.8.2.2 17-Dec-2020  thorpej Regen for POSIX timers and timerfd.
 1.8.2.1 16-Dec-2020  thorpej Regen for eventfd.
 1.2 26-Mar-2007  njoly Sync with recent compat linux termios changes.
 1.1 15-Feb-2006  manu branches: 1.1.2; 1.1.10; 1.1.16; 1.1.22; 1.1.28; 1.1.32; 1.1.34; 1.1.36;
- Move the BSD to Linux and Linux to BSD termio/termios conversion functions
to a header where they can be shared between COMPAT_LINUX and COMPAT_LINUX32
- Add termios ioctl emulation to COMPAT_LINUX32
- Add the getcwd system call to COMPAT_LINUX32/amd64

That makes Linux's bash working with COMPAT_LINUX32.
 1.1.36.1 29-Mar-2007  reinoud Pullup to -current
 1.1.34.1 11-Jul-2007  mjf Sync with head.
 1.1.32.1 10-Apr-2007  ad Sync with head.
 1.1.28.1 15-Apr-2007  yamt sync with head.
 1.1.22.2 09-Sep-2006  rpaulo sync with head
 1.1.22.1 15-Feb-2006  rpaulo file linux32_termios.h was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:45:52 +0000
 1.1.16.3 03-Sep-2007  yamt sync with head.
 1.1.16.2 21-Jun-2006  yamt sync with head.
 1.1.16.1 15-Feb-2006  yamt file linux32_termios.h was added on branch yamt-lazymbuf on 2006-06-21 14:59:27 +0000
 1.1.10.2 22-Apr-2006  simonb Sync with head.
 1.1.10.1 15-Feb-2006  simonb file linux32_termios.h was added on branch simonb-timecounters on 2006-04-22 11:38:14 +0000
 1.1.2.2 18-Feb-2006  yamt sync with head.
 1.1.2.1 15-Feb-2006  yamt file linux32_termios.h was added on branch yamt-uio_vmspace on 2006-02-18 15:38:59 +0000
 1.7 07-Jul-2010  chs many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
- support new-style (NPTL) linux pthreads on all platforms.
clone() with CLONE_THREAD uses 1 process with many LWPs
instead of separate processes.
- move the contents of sys__lwp_setprivate() into a new
lwp_setprivate() and use that everywhere.
- update linux_release[] and linux32_release[] to "2.6.18".
- adjust placement of emul fork/exec/exit hooks as needed
and adjust other emul code to match.
- convert all struct emul definitions to use named initializers.
- change the pid allocator to allow multiple pids to refer to the same proc.
- remove a few fields from struct proc that are no longer needed.
- disable the non-functional "vdso" code in linux32/amd64,
glibc works fine without it.
- fix a race in the futex code where we could miss a wakeup after
a requeue operation.
- redo futex locking to be a little more efficient.
 1.6 08-Jun-2009  njoly branches: 1.6.2; 1.6.4;
Fix defines against multiple inclusion protection (s/I386/AMD64).
 1.5 04-Sep-2008  njoly branches: 1.5.8;
Make linux32 getdents(2) do its own job instead of calling the
corresponding compat linux function, where struct dirent members types
differs.
 1.4 25-Dec-2007  perry branches: 1.4.6; 1.4.10; 1.4.12; 1.4.16;
Convert many of the uses of __attribute__ to equivalent
__packed, __unused and __dead macros from cdefs.h
 1.3 05-Apr-2007  njoly branches: 1.3.10; 1.3.16; 1.3.18; 1.3.22;
Enable stat/stat64 nsec time support, for amd64 compat linux/linux32.
 1.2 13-Sep-2006  manu branches: 1.2.6; 1.2.10; 1.2.12;
Jumbo COMPAT_LINUX/COMPAT_LINUX32 bugfix, with the help of Nicolas Joly
- Fix shmat return value on amd64: it uses no black magic with retval[0]
- Fix integer overflows in sysinfo
- Implement sysinfo, mmap2, sched_getparam, sched_getscheduler, mremap,
and madvise in COMPAT_LINUX32
- Fix improper types used in setgroups16/getgroups16
- Implement mmap2 for COMPAT_LINUX32
- Ifdef debug messages by DEBUG_LINUX
 1.1 09-Feb-2006  manu branches: 1.1.2; 1.1.4; 1.1.10; 1.1.16; 1.1.20; 1.1.22;
Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.1.22.2 09-Sep-2006  rpaulo sync with head
 1.1.22.1 09-Feb-2006  rpaulo file linux32_types.h was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:45:52 +0000
 1.1.20.1 18-Nov-2006  ad Sync with head.
 1.1.16.5 21-Jan-2008  yamt sync with head
 1.1.16.4 03-Sep-2007  yamt sync with head.
 1.1.16.3 30-Dec-2006  yamt sync with head.
 1.1.16.2 21-Jun-2006  yamt sync with head.
 1.1.16.1 09-Feb-2006  yamt file linux32_types.h was added on branch yamt-lazymbuf on 2006-06-21 14:59:27 +0000
 1.1.10.2 22-Apr-2006  simonb Sync with head.
 1.1.10.1 09-Feb-2006  simonb file linux32_types.h was added on branch simonb-timecounters on 2006-04-22 11:38:14 +0000
 1.1.4.1 14-Sep-2006  yamt sync with head.
 1.1.2.2 18-Feb-2006  yamt sync with head.
 1.1.2.1 09-Feb-2006  yamt file linux32_types.h was added on branch yamt-uio_vmspace on 2006-02-18 15:38:59 +0000
 1.2.12.1 11-Jul-2007  mjf Sync with head.
 1.2.10.1 10-Apr-2007  ad Sync with head.
 1.2.6.1 15-Apr-2007  yamt sync with head.
 1.3.22.1 02-Jan-2008  bouyer Sync with HEAD
 1.3.18.1 26-Dec-2007  ad Sync with head.
 1.3.16.1 18-Feb-2008  mjf Sync with HEAD.
 1.3.10.1 09-Jan-2008  matt sync with HEAD
 1.4.16.1 19-Oct-2008  haad Sync with HEAD.
 1.4.12.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.4.10.3 11-Aug-2010  yamt sync with head.
 1.4.10.2 20-Jun-2009  yamt sync with head
 1.4.10.1 04-May-2009  yamt sync with head.
 1.4.6.1 28-Sep-2008  mjf Sync with HEAD.
 1.5.8.1 23-Jul-2009  jym Sync with HEAD.
 1.6.4.1 05-Mar-2011  rmind sync with head
 1.6.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.2 07-Mar-2015  christos Add systrace output file
 1.1 09-Feb-2006  manu branches: 1.1.2; 1.1.10; 1.1.16; 1.1.22; 1.1.122; 1.1.142;
Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.1.142.1 06-Apr-2015  skrll Sync with HEAD
 1.1.122.1 03-Dec-2017  jdolecek update from HEAD
 1.1.22.2 09-Sep-2006  rpaulo sync with head
 1.1.22.1 09-Feb-2006  rpaulo file syscalls.conf was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:45:52 +0000
 1.1.16.2 21-Jun-2006  yamt sync with head.
 1.1.16.1 09-Feb-2006  yamt file syscalls.conf was added on branch yamt-lazymbuf on 2006-06-21 14:59:27 +0000
 1.1.10.2 22-Apr-2006  simonb Sync with head.
 1.1.10.1 09-Feb-2006  simonb file syscalls.conf was added on branch simonb-timecounters on 2006-04-22 11:38:14 +0000
 1.1.2.2 18-Feb-2006  yamt sync with head.
 1.1.2.1 09-Feb-2006  yamt file syscalls.conf was added on branch yamt-uio_vmspace on 2006-02-18 15:38:59 +0000
 1.77 02-Dec-2021  ryo add prlimit64(2) syscall to COMPAT_LINUX and COMPAT_LINUX32
 1.76 27-Nov-2021  ryo Add pselect6(2) system call to COMPAT_LINUX32
 1.75 20-Sep-2021  thorpej Add preadv(2) and pwritev(2) system calls to COMPAT_LINUX and COMPAT_LINUX32.
 1.74 20-Sep-2021  thorpej Add the eventfd system calls to COMPAT_LINUX and COMPAT_LINUX32.
 1.73 19-Sep-2021  thorpej Add the timerfd syscalls to COMPAT_LINUX and COMPAT_LINUX32.
 1.72 19-Sep-2021  thorpej Add the POSIX timer syscalls (timer_create(), timer_settime(), timer_gettime(),
timer_getoverrun(), and timer_delete()) to COMPAT_LINUX and COMPAT_LINUX32.
 1.71 26-Apr-2020  thorpej branches: 1.71.2;
Add a NetBSD native futex implementation, mostly written by riastradh@.
Map the COMPAT_LINUX futex calls to the native ones.
 1.70 09-Nov-2019  jdolecek add dummy implementation of linux fallocate() which just returns EOPNOTSUPP;
this is needed so that glibc falls back to emulation and apps behaving
properly, since EOPNOTSUPP is a documented and expected return code, but
ENOSYS is not

right now there are no filesystems in NetBSD tree supporting the fallocate
VOP, so no point trying to map this to a native call

supposed to help with problem reported in
https://mail-index.netbsd.org/tech-kern/2019/11/03/msg025641.html
 1.69 08-Mar-2015  christos branches: 1.69.18;
fix inconsistent names
 1.68 22-Nov-2014  njoly branches: 1.68.2;
Add ppoll(2) for compat linux32.
 1.67 29-May-2014  njoly Add utimes(2) support.
 1.66 04-May-2014  njoly Fix pread/pwrite syscalls which need a 64bit offset argument.
 1.65 18-Nov-2013  christos branches: 1.65.2;
Fix extended attribute syscalls to use the proper types and call their netbsd32
counterparts for now.
 1.64 18-Nov-2013  chs implement the *at() syscalls.
bring the unimplemented syscall list up to date.
 1.63 07-Nov-2013  njoly Fix dup/dup2/dup3 argument types (u_int -> int).
 1.62 13-Jul-2012  christos branches: 1.62.2; 1.62.4;
add xattr stubs
 1.61 10-May-2012  christos Fix rt_sigtimedwait():
It is wishful thinking that:
1. declaring a 32 bit syscall with 64 bit pointers
2. passing a struct with 32 bit pointers to a 64 bit function
is going to work.
 1.60 18-Nov-2011  christos branches: 1.60.4; 1.60.6;
add sigtimedwait support
 1.59 30-May-2011  alnsn branches: 1.59.4;
Add fadvise64 and fadvise64_64 syscalls to compat_linux and compat_linux32.
 1.58 10-Apr-2011  christos add pipe2 and dup3
 1.57 02-Nov-2010  chs branches: 1.57.2;
implement the following syscalls for linux32:
truncate64
ftruncate64
profil
ioperm
iopl
setdomainname
modify_ldt
statfs64
fstatfs64

note that iopl(), ioperm() and modify_ldt() just call
the respective 64-bit handlers, which don't do anything yet.
 1.56 07-Jul-2010  chs many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
- support new-style (NPTL) linux pthreads on all platforms.
clone() with CLONE_THREAD uses 1 process with many LWPs
instead of separate processes.
- move the contents of sys__lwp_setprivate() into a new
lwp_setprivate() and use that everywhere.
- update linux_release[] and linux32_release[] to "2.6.18".
- adjust placement of emul fork/exec/exit hooks as needed
and adjust other emul code to match.
- convert all struct emul definitions to use named initializers.
- change the pid allocator to allow multiple pids to refer to the same proc.
- remove a few fields from struct proc that are no longer needed.
- disable the non-functional "vdso" code in linux32/amd64,
glibc works fine without it.
- fix a race in the futex code where we could miss a wakeup after
a requeue operation.
- redo futex locking to be a little more efficient.
 1.55 24-Nov-2009  njoly branches: 1.55.2; 1.55.4;
Update personality(2) to match Linux definition where the argument is an
unsigned long.
 1.54 08-Jun-2009  njoly Add rt_queueinfo(2) support.
 1.53 05-Jun-2009  njoly Add fstatfs syscall.
 1.52 04-Jun-2009  njoly Add stat/lstat/fstat syscalls.
 1.51 02-Jun-2009  njoly Add siggetmask/sigsetmask syscalls.
 1.50 30-Jan-2009  njoly branches: 1.50.2;
Add mincore syscall.
 1.49 20-Jan-2009  njoly Add basic support for linux32 personality(2) syscall.
 1.48 17-Jan-2009  njoly Convert linux/linux32 wait(4) to use a compat50 rusage structure.
 1.47 16-Jan-2009  njoly Update some syscalls that now needs compat50 timeval structure.
 1.46 13-Jan-2009  pooka Convert the syscalls.master to a format from which it is easier
to parse and generate the compat name and basename (e.g. __stat50
and stat). Use this to autogenerate __RENAME()'s to the rump_syscalls
header so that they can be called e.g. rump_sys_socket() instead
of rump_sys___socket30().
 1.45 11-Jan-2009  christos merge christos-time_t
 1.44 12-Dec-2008  njoly branches: 1.44.2;
Add clock_nanosleep syscall.
 1.43 06-Dec-2008  njoly Cleanup; kill netbsd32_caddr_t use.
 1.42 05-Dec-2008  njoly Add getres{uid,gid} syscalls.
 1.41 01-Dec-2008  njoly Add sched_get_priority_{min,max} syscalls.
 1.40 19-Nov-2008  ad Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.39 12-Nov-2008  njoly Fix nanosleep(2) on 64-bit archs. Do not call native nanosleep
syscall, but rather a modified version the will take care of `struct
timespec' conversions.
 1.38 06-Oct-2008  njoly branches: 1.38.2; 1.38.4;
Cleanup. Reduce diffs against netbsd32 syscalls.master.
- Remove const keyword for pointer types.
- Update some argument types.
 1.37 22-Sep-2008  njoly Kill a few linux32 syscalls identical to netbsd32 ones.
No functional changes expected.
 1.36 24-Jul-2008  njoly Add rt_sigpending syscall.
 1.35 16-Jun-2008  christos branches: 1.35.2;
an attempt at ptrace32
 1.34 20-May-2008  njoly branches: 1.34.2;
Add compat linux32 ipc(2) syscall support, for shared memory and
semaphores.
 1.33 17-Apr-2008  njoly branches: 1.33.2; 1.33.4; 1.33.6;
Add compat linux32 sys_clock_{getres,gettime,settime} syscalls.
 1.32 04-Apr-2008  njoly Add msync(2) syscall.
 1.31 20-Feb-2008  njoly branches: 1.31.6;
Add mlock/munlock syscalls
 1.30 17-Feb-2008  njoly pread/pwrite fixes: use SCARG_P32 to access pointers, and update
syscalls definitions.
 1.29 04-Feb-2008  dsl Use the same function to implement linux32_sys_fcntl() and linux_sys_fcntl64().
A rather excessive amount of 'appending 64' to names seems to have happened
when linux won support for files > 4G.
technically the linux32_sys_fcntl() function should error the 64bit file
locking requests - but life is too short.
 1.28 02-Feb-2008  dsl Impletemt pread() and pwrite().
 1.27 15-Jan-2008  njoly compat linux (and linux32) uid16 functions cleanup and fixes.

- Move uid16 functions to their own file linux_uid16.c, included by
needed archs (arm, i386 and m68k).
- Add new MI types linux_{u,g}id16_t.
- Add macros to handle linux_uid16_t and uid_t conversions.
- Add linux_sys_getres{uid,gid}16 syscalls, to fix an overflow with
bad sizes given to copyout when linux_sys_getres{uid,gid} are used.
- Update arm syscall table to use more uid16 functions.
 1.26 07-Jan-2008  njoly Remove wrong linux32_sys_mmap2_args define.
 1.25 26-Dec-2007  njoly Add readdir syscall.
 1.24 24-Dec-2007  njoly Add old_uname syscall.
 1.23 24-Dec-2007  njoly Add getpgid syscall.
 1.22 21-Dec-2007  njoly - Fix setfsuid to return uid on success.
- Replace getfsuid, which never existed on Linux, by correct setfsgid
syscall.

ok by christos and dsl.
 1.21 20-Dec-2007  dsl Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.20 16-Nov-2007  njoly branches: 1.20.2; 1.20.6;
Update, for linux_sys_readlink() removal.
 1.19 07-Nov-2007  njoly Remove remaining 64-bit compat linux syscalls linux_sys_xxx() (except
for ones without arguments), and replace them by their 32-bit
equivalent linux32_sys_xxxx().
 1.18 31-Oct-2007  dsl branches: 1.18.2;
This file must use the netbsd32_xxx() system calls, not the sys_xxx() ones.
The latter actually function (due to luck) for calls with one argument,
but will fail badly if more than one is required.
Noticed as an error in the ktrace outut by Nicolas Joly, reported on
tech-kern.
 1.17 31-Oct-2007  njoly compat linux32 syscalls cleanup.

With stackgap and CHECK_ALT_xxx removal, some linux32 and netbsd32
syscalls are now identical.
To avoid code duplication, remove the linux32 definition and use the
netbsd32 one (no functional change).
 1.16 27-Oct-2007  njoly Add missing chown's syscalls family members.
This makes chown(1)/chgrp(1) works under compat linux32.

Problem reported and fix tested by Arto Huusko. Thanks.
 1.15 20-Apr-2007  njoly branches: 1.15.6; 1.15.8; 1.15.12;
Fix ftruncate syscall. Do not use compat_43_sys_ftruncate, but
compat_43_netbsd32_oftruncate instead.
 1.14 11-Apr-2007  njoly - Add compat amd64 linux32 statfs support, adapted from PR/35956.
- Move bsd_to_linux_statfs() function to its own file to be shared
between both linux compats.

ok by manu.
 1.13 05-Mar-2007  christos branches: 1.13.2; 1.13.4;
fix caddr_t lossage.
 1.12 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.11 16-Feb-2007  njoly branches: 1.11.2;
Add support for a few syscalls:
setfsuid16/getfsuid16
setfsuid/getfsuid
sched_yield

ok by manu
 1.10 09-Feb-2007  ad Merge newlock2 to head.
 1.9 08-Feb-2007  njoly Remove some aliases, for syscalls that use their netbsd32 equivalent.
This makes the ktrace output more consistent.

ok by manu.
 1.8 07-Feb-2007  njoly Use netbsd32_pollfdp_t instead of wrong `struct pollfd *'.

ok by manu.
 1.7 13-Sep-2006  manu branches: 1.7.4;
Jumbo COMPAT_LINUX/COMPAT_LINUX32 bugfix, with the help of Nicolas Joly
- Fix shmat return value on amd64: it uses no black magic with retval[0]
- Fix integer overflows in sysinfo
- Implement sysinfo, mmap2, sched_getparam, sched_getscheduler, mremap,
and madvise in COMPAT_LINUX32
- Fix improper types used in setgroups16/getgroups16
- Implement mmap2 for COMPAT_LINUX32
- Ifdef debug messages by DEBUG_LINUX
 1.6 06-Sep-2006  manu branches: 1.6.2; 1.6.4;
Implement Linux's fdatasync, patch from Nicolas Joly
 1.5 06-Sep-2006  manu Fix linux32_sys_setres{uid|gid}: -1 does not means the same thing on i386
and amd64...
 1.4 05-Sep-2006  manu typo
 1.3 25-Jun-2006  manu - Complete exit_group() implementation. We now maintain a list of Linux
threads in a processes and kill them properly. The code is a bit too
complicated, but I could not find a simplier way of dealing with it

- Change getpid() and getppid() semantics to match what Linux does,
and implement gettid(). In the Linux kernel, threads are implemnted
as plain old processes. A thread group is just a set of processes,
with the parent called leader. Thread ID, which are returned by gettid(),
are just the PID of the plain old processes, and getpid() returns the
PID of the thread group leader.

- Remove struct linux32_emuldata. COMPAT_LINUX32 uses a lot of COMPAT_LINUX
code, where a struct linux_emuldata is assumed. By having distinct emuldata
structure with different sizes and layouts, we caused kernel memory
corruptions.

- Fix setprioriry() and getpriority()

Thanks to Nicolas Joly for tracking down the problem and providing me the
hardware to fix them.
 1.2 15-Feb-2006  manu branches: 1.2.2; 1.2.4; 1.2.10; 1.2.14; 1.2.16;
Add getcwd (for real this time), fix dup and dup2
 1.1 09-Feb-2006  manu Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.2.16.12 27-Feb-2008  yamt sync with head.
 1.2.16.11 11-Feb-2008  yamt sync with head.
 1.2.16.10 04-Feb-2008  yamt sync with head.
 1.2.16.9 21-Jan-2008  yamt sync with head
 1.2.16.8 07-Dec-2007  yamt sync with head
 1.2.16.7 15-Nov-2007  yamt sync with head.
 1.2.16.6 27-Oct-2007  yamt sync with head.
 1.2.16.5 03-Sep-2007  yamt sync with head.
 1.2.16.4 26-Feb-2007  yamt sync with head.
 1.2.16.3 30-Dec-2006  yamt sync with head.
 1.2.16.2 21-Jun-2006  yamt sync with head.
 1.2.16.1 15-Feb-2006  yamt file syscalls.master was added on branch yamt-lazymbuf on 2006-06-21 14:59:27 +0000
 1.2.14.1 13-Jul-2006  gdamore Merge from HEAD.
 1.2.10.2 22-Apr-2006  simonb Sync with head.
 1.2.10.1 15-Feb-2006  simonb file syscalls.master was added on branch simonb-timecounters on 2006-04-22 11:38:14 +0000
 1.2.4.2 14-Sep-2006  yamt sync with head.
 1.2.4.1 26-Jun-2006  yamt sync with head.
 1.2.2.2 18-Feb-2006  yamt sync with head.
 1.2.2.1 15-Feb-2006  yamt file syscalls.master was added on branch yamt-uio_vmspace on 2006-02-18 15:38:59 +0000
 1.6.4.2 09-Sep-2006  rpaulo sync with head
 1.6.4.1 06-Sep-2006  rpaulo file syscalls.master was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:45:52 +0000
 1.6.2.3 09-Feb-2007  ad Sync with HEAD.
 1.6.2.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.6.2.1 18-Nov-2006  ad Sync with head.
 1.7.4.2 20-Apr-2007  bouyer Pull up following revision(s) (requested by njoly in ticket #582):
sys/compat/linux32/common/linux32_types.h: revision 1.4 via patch
sys/compat/linux32/arch/amd64/syscalls.master: revision 1.14 via patch
sys/compat/linux/common/linux_statfs.h: revision 1.1 via patch
sys/compat/linux/common/linux_misc.c: revision 1.170 via patch
sys/compat/linux32/common/linux32_misc.c: revision 1.5 via patch
sys/compat/linux32/files.linux32: revision 1.4 via patch
- Add compat amd64 linux32 statfs support, adapted from PR/35956.
- Move bsd_to_linux_statfs() function to its own file to be shared
between both linux compats.
 1.7.4.1 31-Mar-2007  bouyer Pull up following revision(s) (requested by njoly in ticket #544):
sys/compat/linux32/arch/amd64/syscalls.master: revision 1.11
Add support for a few syscalls:
setfsuid16/getfsuid16
setfsuid/getfsuid
sched_yield
ok by manu
 1.11.2.2 07-May-2007  yamt sync with head.
 1.11.2.1 15-Apr-2007  yamt sync with head.
 1.13.4.1 11-Jul-2007  mjf Sync with head.
 1.13.2.1 27-May-2007  ad Sync with head.
 1.15.12.2 18-Nov-2007  bouyer Sync with HEAD
 1.15.12.1 13-Nov-2007  bouyer Sync with HEAD
 1.15.8.4 23-Mar-2008  matt sync with HEAD
 1.15.8.3 09-Jan-2008  matt sync with HEAD
 1.15.8.2 08-Nov-2007  matt sync with -HEAD
 1.15.8.1 06-Nov-2007  matt sync with HEAD
 1.15.6.5 21-Nov-2007  joerg Sync with HEAD.
 1.15.6.4 11-Nov-2007  joerg Sync with HEAD.
 1.15.6.3 04-Nov-2007  jmcneill Sync with HEAD.
 1.15.6.2 31-Oct-2007  joerg Sync with HEAD.
 1.15.6.1 28-Oct-2007  joerg Sync with HEAD.
 1.18.2.3 18-Feb-2008  mjf Sync with HEAD.
 1.18.2.2 27-Dec-2007  mjf Sync with HEAD.
 1.18.2.1 19-Nov-2007  mjf Sync with HEAD.
 1.20.6.3 19-Jan-2008  bouyer Sync with HEAD
 1.20.6.2 08-Jan-2008  bouyer Sync with HEAD
 1.20.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.20.2.1 26-Dec-2007  ad Sync with head.
 1.31.6.4 17-Jan-2009  mjf Sync with HEAD.
 1.31.6.3 28-Sep-2008  mjf Sync with HEAD.
 1.31.6.2 29-Jun-2008  mjf Sync with HEAD.
 1.31.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.33.6.5 10-Oct-2008  skrll Sync with HEAD.
 1.33.6.4 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.33.6.3 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.33.6.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.33.6.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.33.4.4 11-Aug-2010  yamt sync with head.
 1.33.4.3 11-Mar-2010  yamt sync with head
 1.33.4.2 20-Jun-2009  yamt sync with head
 1.33.4.1 04-May-2009  yamt sync with head.
 1.33.2.2 17-Jun-2008  yamt sync with head.
 1.33.2.1 04-Jun-2008  yamt sync with head
 1.34.2.2 28-Jul-2008  simonb Sync with head.
 1.34.2.1 18-Jun-2008  simonb Sync with head.
 1.35.2.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.35.2.1 19-Oct-2008  haad Sync with HEAD.
 1.38.4.2 18-Mar-2015  snj Pull up following revision(s) (requested by joerg in ticket #1149):
sys/compat/linux32/arch/amd64/syscalls.master: revisions 1.52, 1.53 via patch
sys/compat/linux32/common/linux32_misc.c: revision 1.17 via patch
sys/compat/linux32/common/linux32_stat.c: revision 1.14-1.16 via patch
Fix inverted lst_ino/__lst_ino assignment in linux32_from_stat().
--
Cleanup (no functional changes).
Kill some unneeded variables and return stattement.
Rename linux32_from_stat() to better bsd_to_linux32_stat64().
Fix some types.
Add stat/lstat/fstat syscalls.
--
Add fstatfs syscall.
 1.38.4.1 20-Nov-2008  snj Pull up following revision(s) (requested by njoly in ticket #81):
sys/compat/linux/arch/mips/syscalls.master: revision 1.30
sys/compat/linux/arch/m68k/syscalls.master: revision 1.63
sys/compat/linux32/arch/amd64/syscalls.master: revision 1.39
sys/compat/linux/arch/alpha/syscalls.master: revision 1.63
sys/compat/linux/arch/powerpc/syscalls.master: revision 1.38
sys/compat/linux32/common/linux32_time.c: revision 1.22
sys/compat/linux/arch/amd64/syscalls.master: revision 1.25
sys/compat/linux/arch/i386/syscalls.master: revision 1.94
sys/compat/linux/arch/arm/syscalls.master: revision 1.36
sys/compat/linux/common/linux_time.c: revision 1.26
Fix nanosleep(2) on 64-bit archs. Do not call native nanosleep
syscall, but rather a modified version the will take care of `struct
timespec' conversions.
 1.38.2.2 03-Mar-2009  skrll Sync with HEAD.
 1.38.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.44.2.2 04-Jan-2009  christos use compat_50 syscalls where appropriate.
 1.44.2.1 12-Dec-2008  christos file syscalls.master was added on branch christos-time_t on 2009-01-04 01:58:39 +0000
 1.50.2.1 23-Jul-2009  jym Sync with HEAD.
 1.55.4.3 31-May-2011  rmind sync with head
 1.55.4.2 21-Apr-2011  rmind sync with head
 1.55.4.1 05-Mar-2011  rmind sync with head
 1.55.2.2 06-Nov-2010  uebayasi Sync with HEAD.
 1.55.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.57.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.59.4.4 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.59.4.3 30-Oct-2012  yamt sync with head
 1.59.4.2 23-May-2012  yamt sync with head.
 1.59.4.1 17-Apr-2012  yamt sync with head
 1.60.6.2 20-Jul-2012  riz Pull up following revision(s) (requested by christos in ticket #424):
sys/compat/linux32/arch/amd64/linux32_syscallargs.h: revision 1.67
sys/compat/linux32/arch/amd64/syscalls.master: revision 1.62
sys/compat/linux32/arch/amd64/linux32_syscall.h: revision 1.67
sys/compat/linux32/arch/amd64/linux32_sysent.c: revision 1.67
sys/compat/linux32/arch/amd64/linux32_syscalls.c: revision 1.67
add xattr stubs
regen
 1.60.6.1 19-May-2012  riz Pull up following revision(s) (requested by christos in ticket #263):
sys/compat/linux32/arch/amd64/linux32_syscallargs.h: revision 1.66
sys/compat/linux32/arch/amd64/syscalls.master: revision 1.61
sys/compat/linux32/common/linux32_signal.c: revision 1.16
sys/compat/linux32/arch/amd64/linux32_syscall.h: revision 1.66
sys/compat/linux32/arch/amd64/linux32_sysent.c: revision 1.66
sys/compat/linux32/arch/amd64/linux32_syscalls.c: revision 1.66
regen
Fix rt_sigtimedwait():
It is wishful thinking that:
1. declaring a 32 bit syscall with 64 bit pointers
2. passing a struct with 32 bit pointers to a 64 bit function
is going to work.
 1.60.4.1 02-Jun-2012  mrg sync to latest -current.
 1.62.4.1 18-May-2014  rmind sync with head
 1.62.2.2 03-Dec-2017  jdolecek update from HEAD
 1.62.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.65.2.1 10-Aug-2014  tls Rebase.
 1.68.2.1 06-Apr-2015  skrll Sync with HEAD
 1.69.18.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.71.2.3 03-Jan-2021  thorpej Add preadv(2) and pwritev(2).
 1.71.2.2 17-Dec-2020  thorpej Add POSIX timer and timerfd support to COMPAT_LINUX32.
 1.71.2.1 16-Dec-2020  thorpej Add eventfd glue to COMPAT_LINUX32.
 1.20 23-Aug-2019  maxv Fix info leaks.
 1.19 03-Sep-2018  riastradh branches: 1.19.4;
Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.18 28-Jul-2017  riastradh branches: 1.18.2; 1.18.4;
Fail, don't panic, on bad dirents from file system.

Controllable via puffs from userland.

From Ilja Van Sprundel.
 1.17 28-Jan-2017  christos branches: 1.17.6;
avoid the shadow
 1.16 28-Jan-2017  christos we have space for one more.
 1.15 28-Jan-2017  christos fix size computation
 1.14 13-Jan-2017  christos branches: 1.14.2;
convert strcpy to a bounded copy to avoid compiler warnings, although the
reclen test prevents overflow.
 1.13 14-Oct-2011  hannken branches: 1.13.8; 1.13.12; 1.13.14; 1.13.22; 1.13.28; 1.13.30; 1.13.32; 1.13.34; 1.13.38;
Change the vnode locking protocol of VOP_GETATTR() to request at least
a shared lock. Make all calls outside of file systems respect it.

The calls from file systems need review.

No objections from tech-kern.
 1.12 11-Sep-2010  chs recent versions of linux (which we now claim to be) supply a BSD-style
d_type value in getdents() results, after the d_name field.
make our emulation do the same. fixes part of PR 43695.
 1.11 24-Jun-2010  hannken Clean up vnode lock operations pass 2:

VOP_UNLOCK(vp, flags) -> VOP_UNLOCK(vp): Remove the unneeded flags argument.

Welcome to 5.99.32.

Discussed on tech-kern.
 1.10 03-Mar-2010  he branches: 1.10.2;
When implementing "read directory", when there are too many empty entries
in a row, and we need to try to read the next block, and have passed a
non-NULL cookie pointer to VOP_READDIR, ensure that we free the cookie
buffer before re-doing VOP_READDIR, so that we don't leak memory.
This fix is similar to nfs_serv.c revisions 1.115 + 1.124.

This should fix the long-standing problem observed by e.g. using Linux-
emulated programs to take backup of servers, which is one of the problems
which were reported in PR#42661.

Thanks to pooka@ for the hints for traversing the VOP* layer.
 1.9 22-Jul-2009  njoly branches: 1.9.2;
Make compat linux/linux32 getdents(2) fail with ENOTDIR instead of
EINVAL when file descriptor does not refer to a directory.
 1.8 29-Dec-2008  njoly branches: 1.8.2;
s/syscallcarg/syscallarg/ in comments.
 1.7 19-Nov-2008  ad Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.6 04-Sep-2008  njoly branches: 1.6.2; 1.6.4; 1.6.8;
Make linux32 getdents(2) do its own job instead of calling the
corresponding compat linux function, where struct dirent members types
differs.
 1.5 26-Dec-2007  njoly branches: 1.5.6; 1.5.10; 1.5.12; 1.5.16;
Add readdir syscall.
 1.4 20-Dec-2007  dsl Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.3 08-Dec-2007  dsl branches: 1.3.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.2 09-Feb-2007  ad branches: 1.2.18; 1.2.20; 1.2.26; 1.2.28;
Merge newlock2 to head.
 1.1 09-Feb-2006  manu branches: 1.1.2; 1.1.10; 1.1.16; 1.1.20; 1.1.22;
Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.1.22.2 09-Sep-2006  rpaulo sync with head
 1.1.22.1 09-Feb-2006  rpaulo file linux32_dirent.c was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:46:03 +0000
 1.1.20.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.1.16.4 21-Jan-2008  yamt sync with head
 1.1.16.3 26-Feb-2007  yamt sync with head.
 1.1.16.2 21-Jun-2006  yamt sync with head.
 1.1.16.1 09-Feb-2006  yamt file linux32_dirent.c was added on branch yamt-lazymbuf on 2006-06-21 14:59:27 +0000
 1.1.10.2 22-Apr-2006  simonb Sync with head.
 1.1.10.1 09-Feb-2006  simonb file linux32_dirent.c was added on branch simonb-timecounters on 2006-04-22 11:38:14 +0000
 1.1.2.2 18-Feb-2006  yamt sync with head.
 1.1.2.1 09-Feb-2006  yamt file linux32_dirent.c was added on branch yamt-uio_vmspace on 2006-02-18 15:39:02 +0000
 1.2.28.1 26-Dec-2007  ad Sync with head.
 1.2.26.1 18-Feb-2008  mjf Sync with HEAD.
 1.2.20.1 09-Jan-2008  matt sync with HEAD
 1.2.18.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.3.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.5.16.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.5.16.1 19-Oct-2008  haad Sync with HEAD.
 1.5.12.3 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.5.12.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.5.12.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.5.10.5 09-Oct-2010  yamt sync with head
 1.5.10.4 11-Aug-2010  yamt sync with head.
 1.5.10.3 11-Mar-2010  yamt sync with head
 1.5.10.2 19-Aug-2009  yamt sync with head.
 1.5.10.1 04-May-2009  yamt sync with head.
 1.5.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.5.6.1 28-Sep-2008  mjf Sync with HEAD.
 1.6.8.1 21-Apr-2010  matt sync to netbsd-5
 1.6.4.1 17-Mar-2010  snj Pull up following revision(s) (requested by he in ticket #1323):
sys/compat/common/vfs_syscalls_30.c: revision 1.31
sys/compat/ibcs2/ibcs2_misc.c: revision 1.110
sys/compat/irix/irix_dirent.c: revision 1.24
sys/compat/linux/common/linux_file64.c: revision 1.50
sys/compat/linux/common/linux_misc.c: revision 1.214
sys/compat/linux32/common/linux32_dirent.c: revision 1.10
sys/compat/sunos/sunos_misc.c: revision 1.166
sys/compat/sunos32/sunos32_misc.c: revision 1.69
sys/compat/svr4/svr4_misc.c: revision 1.149
sys/compat/svr4_32/svr4_32_misc.c: revision 1.68
When implementing "read directory", when there are too many empty entries
in a row, and we need to try to read the next block, and have passed a
non-NULL cookie pointer to VOP_READDIR, ensure that we free the cookie
buffer before re-doing VOP_READDIR, so that we don't leak memory.
This fix is similar to nfs_serv.c revisions 1.115 + 1.124.
This should fix the long-standing problem observed by e.g. using Linux-
emulated programs to take backup of servers, which is one of the problems
which were reported in PR#42661.
Thanks to pooka@ for the hints for traversing the VOP* layer.
 1.6.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.8.2.1 23-Jul-2009  jym Sync with HEAD.
 1.9.2.3 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.9.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.9.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.10.2.2 05-Mar-2011  rmind sync with head
 1.10.2.1 03-Jul-2010  rmind sync with head
 1.13.38.2 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1720:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149 (patch)
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54 (patch)

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.13.38.1 12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1479):
sys/compat/common/vfs_syscalls_12.c: revision 1.34
sys/rump/kern/lib/libsys_sunos/rump_sunos_compat.c: revision 1.2
sys/compat/svr4_32/svr4_32_misc.c: revision 1.78
sys/compat/sunos32/sunos32_misc.c: revision 1.78
sys/compat/linux/common/linux_misc.c: revision 1.239
sys/compat/osf1/osf1_file.c: revision 1.44
sys/compat/common/vfs_syscalls_43.c: revision 1.60
sys/compat/svr4/svr4_misc.c: revision 1.158
sys/compat/ibcs2/ibcs2_misc.c: revision 1.114
sys/compat/linux/common/linux_file64.c: revision 1.59
sys/compat/linux32/common/linux32_dirent.c: revision 1.18
sys/compat/sunos/sunos_misc.c: revision 1.171
Fail, don't panic, on bad dirents from file system.
Controllable via puffs from userland.
From Ilja Van Sprundel.
 1.13.34.1 20-Mar-2017  pgoyette Sync with HEAD
 1.13.32.1 12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1479):
sys/compat/common/vfs_syscalls_12.c: revision 1.34
sys/rump/kern/lib/libsys_sunos/rump_sunos_compat.c: revision 1.2
sys/compat/svr4_32/svr4_32_misc.c: revision 1.78
sys/compat/sunos32/sunos32_misc.c: revision 1.78
sys/compat/linux/common/linux_misc.c: revision 1.239
sys/compat/osf1/osf1_file.c: revision 1.44
sys/compat/common/vfs_syscalls_43.c: revision 1.60
sys/compat/svr4/svr4_misc.c: revision 1.158
sys/compat/ibcs2/ibcs2_misc.c: revision 1.114
sys/compat/linux/common/linux_file64.c: revision 1.59
sys/compat/linux32/common/linux32_dirent.c: revision 1.18
sys/compat/sunos/sunos_misc.c: revision 1.171
Fail, don't panic, on bad dirents from file system.
Controllable via puffs from userland.
From Ilja Van Sprundel.
 1.13.30.2 28-Aug-2017  skrll Sync with HEAD
 1.13.30.1 05-Feb-2017  skrll Sync with HEAD
 1.13.28.2 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1720:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149 (patch)
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54 (patch)

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.13.28.1 12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1479):
sys/compat/common/vfs_syscalls_12.c: revision 1.34
sys/rump/kern/lib/libsys_sunos/rump_sunos_compat.c: revision 1.2
sys/compat/svr4_32/svr4_32_misc.c: revision 1.78
sys/compat/sunos32/sunos32_misc.c: revision 1.78
sys/compat/linux/common/linux_misc.c: revision 1.239
sys/compat/osf1/osf1_file.c: revision 1.44
sys/compat/common/vfs_syscalls_43.c: revision 1.60
sys/compat/svr4/svr4_misc.c: revision 1.158
sys/compat/ibcs2/ibcs2_misc.c: revision 1.114
sys/compat/linux/common/linux_file64.c: revision 1.59
sys/compat/linux32/common/linux32_dirent.c: revision 1.18
sys/compat/sunos/sunos_misc.c: revision 1.171
Fail, don't panic, on bad dirents from file system.
Controllable via puffs from userland.
From Ilja Van Sprundel.
 1.13.22.1 19-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1483):
sys/compat/common/vfs_syscalls_12.c: revision 1.34
sys/compat/svr4_32/svr4_32_misc.c: revision 1.78
sys/compat/sunos32/sunos32_misc.c: revision 1.78
sys/compat/linux/common/linux_misc.c: revision 1.239
sys/compat/osf1/osf1_file.c: revision 1.44
sys/compat/common/vfs_syscalls_43.c: revision 1.60
sys/compat/svr4/svr4_misc.c: revision 1.158
sys/compat/ibcs2/ibcs2_misc.c: revision 1.114
sys/compat/linux/common/linux_file64.c: revision 1.59
sys/compat/linux32/common/linux32_dirent.c: revision 1.18
sys/compat/sunos/sunos_misc.c: revision 1.171
Fail, don't panic, on bad dirents from file system.
Controllable via puffs from userland.
From Ilja Van Sprundel.
 1.13.14.1 19-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1483):
sys/compat/common/vfs_syscalls_12.c: revision 1.34
sys/compat/svr4_32/svr4_32_misc.c: revision 1.78
sys/compat/sunos32/sunos32_misc.c: revision 1.78
sys/compat/linux/common/linux_misc.c: revision 1.239
sys/compat/osf1/osf1_file.c: revision 1.44
sys/compat/common/vfs_syscalls_43.c: revision 1.60
sys/compat/svr4/svr4_misc.c: revision 1.158
sys/compat/ibcs2/ibcs2_misc.c: revision 1.114
sys/compat/linux/common/linux_file64.c: revision 1.59
sys/compat/linux32/common/linux32_dirent.c: revision 1.18
sys/compat/sunos/sunos_misc.c: revision 1.171
Fail, don't panic, on bad dirents from file system.
Controllable via puffs from userland.
From Ilja Van Sprundel.
 1.13.12.1 03-Dec-2017  jdolecek update from HEAD
 1.13.8.1 19-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1483):
sys/compat/common/vfs_syscalls_12.c: revision 1.34
sys/compat/svr4_32/svr4_32_misc.c: revision 1.78
sys/compat/sunos32/sunos32_misc.c: revision 1.78
sys/compat/linux/common/linux_misc.c: revision 1.239
sys/compat/osf1/osf1_file.c: revision 1.44
sys/compat/common/vfs_syscalls_43.c: revision 1.60
sys/compat/svr4/svr4_misc.c: revision 1.158
sys/compat/ibcs2/ibcs2_misc.c: revision 1.114
sys/compat/linux/common/linux_file64.c: revision 1.59
sys/compat/linux32/common/linux32_dirent.c: revision 1.18
sys/compat/sunos/sunos_misc.c: revision 1.171
Fail, don't panic, on bad dirents from file system.
Controllable via puffs from userland.
From Ilja Van Sprundel.
 1.14.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.17.6.2 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1487:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.17.6.1 09-Aug-2017  snj Pull up following revision(s) (requested by spz in ticket #193):
sys/compat/common/vfs_syscalls_12.c: revision 1.34
sys/rump/kern/lib/libsys_sunos/rump_sunos_compat.c: revision 1.2
sys/compat/svr4_32/svr4_32_misc.c: revision 1.78
sys/compat/sunos32/sunos32_misc.c: revision 1.78
sys/compat/linux/common/linux_misc.c: revision 1.239
sys/compat/osf1/osf1_file.c: revision 1.44
sys/compat/common/vfs_syscalls_43.c: revision 1.60
sys/compat/svr4/svr4_misc.c: revision 1.158
sys/compat/ibcs2/ibcs2_misc.c: revision 1.114
sys/compat/linux/common/linux_file64.c: revision 1.59
sys/compat/linux32/common/linux32_dirent.c: revision 1.18
sys/compat/sunos/sunos_misc.c: revision 1.171
Fail, don't panic, on bad dirents from file system.
Controllable via puffs from userland.
From Ilja Van Sprundel.
 1.18.4.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.18.4.1 10-Jun-2019  christos Sync with HEAD
 1.18.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.19.4.1 13-Sep-2019  martin Pull up following revision(s) (requested by maxv in ticket #194):

sys/compat/linux/common/linux_socket.c: revision 1.146
sys/compat/linux/common/linux_socket.c: revision 1.147
sys/compat/linux/common/linux_socket.c: revision 1.148
sys/compat/linux/common/linux_socket.c: revision 1.149
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.59
sys/compat/linux32/common/linux32_sysinfo.c: revision 1.8
sys/kern/sysv_shm.c: revision 1.138
sys/compat/linux/common/linux_file64.c: revision 1.61
sys/compat/linux/common/linux_file64.c: revision 1.62
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.58
sys/compat/linux32/common/linux32_dirent.c: revision 1.20
sys/compat/linux32/common/linux32_utsname.c: revision 1.10
sys/compat/linux/common/linux_termios.h: revision 1.22
sys/compat/linux32/common/linux32_termios.c: revision 1.15
sys/compat/linux32/common/linux32_misc.c: revision 1.27
sys/compat/linux32/common/linux32_ioctl.c: revision 1.14
sys/compat/linux/common/linux_statfs.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.57
sys/compat/linux/common/linux_fcntl.h: revision 1.18
sys/compat/linux/common/linux_socket.h: revision 1.24
sys/sys/shm.h: revision 1.54
sys/compat/ossaudio/ossaudio.c: revision 1.75
sys/compat/linux32/common/linux32_signal.c: revision 1.20
sys/miscfs/procfs/procfs_linux.c: revision 1.75
sys/compat/linux/common/linux_signal.c: revision 1.81
sys/compat/linux/common/linux_termios.c: revision 1.38
sys/compat/linux/common/linux_misc.c: revision 1.241
sys/compat/linux/common/linux_misc.c: revision 1.242
sys/compat/linux/common/linux_misc.c: revision 1.243
sys/compat/linux/common/linux_misc.c: revision 1.244

Fix info leaks.

Fix stupid bugs in linux_sys_shmctl(): the index could be out of bound
(page fault) and there was no proper locking.
Maybe we should just remove LINUX_SHM_STAT, like compat_linux32.

Remove printf.

When dealing with an unknown value, set -1, to prevent (harmless)
uninitialized accesses later.

Add a default case, don't call sys_ioctl() with an uninitialized 'com'
argument.

Fix error handling, returns an errno, not -1.

Put the printf under DEBUG_LINUX.


Hum, don't forget the 'pid' argument, otherwise we're not gonna go very
far.

Don't read data from userland directly. This simply does not work on any
recent x86 CPU (thanks to SMAP) and all architectures that forbid direct
access to userland from the kernel. But I guess no one noticed because no
one ever uses compat_linux, right?

Hum, don't pass an mbuf to realloc(). Inspired from copyin32_msg_control().

Fix memory leak.

I don't see the point in having this useless printf, but add a '\n' to it,
so that it at least displays useless stuff correctly.

Hum, remove incorrect assignment. Userland could have passed a smaller
namelen, and the uninitialized bytes from sb_data were being used later in
the network stack.
 1.2 25-Jun-2006  manu - Complete exit_group() implementation. We now maintain a list of Linux
threads in a processes and kill them properly. The code is a bit too
complicated, but I could not find a simplier way of dealing with it

- Change getpid() and getppid() semantics to match what Linux does,
and implement gettid(). In the Linux kernel, threads are implemnted
as plain old processes. A thread group is just a set of processes,
with the parent called leader. Thread ID, which are returned by gettid(),
are just the PID of the plain old processes, and getpid() returns the
PID of the thread group leader.

- Remove struct linux32_emuldata. COMPAT_LINUX32 uses a lot of COMPAT_LINUX
code, where a struct linux_emuldata is assumed. By having distinct emuldata
structure with different sizes and layouts, we caused kernel memory
corruptions.

- Fix setprioriry() and getpriority()

Thanks to Nicolas Joly for tracking down the problem and providing me the
hardware to fix them.
 1.1 09-Feb-2006  manu branches: 1.1.2; 1.1.4; 1.1.10; 1.1.14; 1.1.16;
Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.1.16.3 30-Dec-2006  yamt sync with head.
 1.1.16.2 21-Jun-2006  yamt sync with head.
 1.1.16.1 09-Feb-2006  yamt file linux32_emuldata.h was added on branch yamt-lazymbuf on 2006-06-21 14:59:27 +0000
 1.1.14.1 13-Jul-2006  gdamore Merge from HEAD.
 1.1.10.2 22-Apr-2006  simonb Sync with head.
 1.1.10.1 09-Feb-2006  simonb file linux32_emuldata.h was added on branch simonb-timecounters on 2006-04-22 11:38:14 +0000
 1.1.4.1 26-Jun-2006  yamt sync with head.
 1.1.2.2 18-Feb-2006  yamt sync with head.
 1.1.2.1 09-Feb-2006  yamt file linux32_emuldata.h was added on branch yamt-uio_vmspace on 2006-02-18 15:39:02 +0000
 1.2 25-Nov-2021  ryo add support COMPAT_LINUX32 for aarch64
 1.1 09-Feb-2006  manu branches: 1.1.2; 1.1.10; 1.1.16; 1.1.22;
Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.1.22.2 09-Sep-2006  rpaulo sync with head
 1.1.22.1 09-Feb-2006  rpaulo file linux32_errno.h was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:46:03 +0000
 1.1.16.2 21-Jun-2006  yamt sync with head.
 1.1.16.1 09-Feb-2006  yamt file linux32_errno.h was added on branch yamt-lazymbuf on 2006-06-21 14:59:27 +0000
 1.1.10.2 22-Apr-2006  simonb Sync with head.
 1.1.10.1 09-Feb-2006  simonb file linux32_errno.h was added on branch simonb-timecounters on 2006-04-22 11:38:14 +0000
 1.1.2.2 18-Feb-2006  yamt sync with head.
 1.1.2.1 09-Feb-2006  yamt file linux32_errno.h was added on branch yamt-uio_vmspace on 2006-02-18 15:39:02 +0000
 1.24 10-Aug-2018  pgoyette Allow syscall_establish() to install new syscalls when the existing
entry-point is either sys_nomodule or sys_nosys. Update the
makesyscalls.sh script to create a const array of bits to allow
syscall_disestablish() to properly restore the original entry-point.
Update all the initializers of struct emul to initialize the pointer
to the bit array struct emul.

XXX Regen of all files created by makesyscalls.sh will come soon,
XXX followed by a kernel version bump (since struct emul is being
XXX modified).

This commit should address PR kern/45781 and also removes the need
for the work-around for that PR in file

sys/arch/usermode/modules/syscallemu/syscallemu.c
 1.23 06-May-2018  kamil branches: 1.23.2;
Remove an element from struct emul: e_tracesig

e_tracesig used to be implemented for Darwin compat. Nowadays the Darwin
compatiblity layer is gone and there are no other users.

This functionality isn't used where it shall be used in the existing
codebase.

If we want to emulate debugging interfaces in compat layers we would need
to implement that from scratch anyway. We would need to be bug compatible
with other OSes too.

Proposed on tech-kern@.

Welcome to NetBSD 8.99.16!

Sponsored by <The NetBSD Foundation>
 1.22 09-Jan-2018  maya branches: 1.22.2;
remove struct emul's e_fault.

It used to be used by COMPAT_IRIX for the purpose of overriding
uvm_fault (only implemented in MIPS), now removed.

Ride 8.99.12 version bump.
 1.21 19-Feb-2012  rmind Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.
 1.20 07-Jul-2010  chs branches: 1.20.8; 1.20.12;
many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
- support new-style (NPTL) linux pthreads on all platforms.
clone() with CLONE_THREAD uses 1 process with many LWPs
instead of separate processes.
- move the contents of sys__lwp_setprivate() into a new
lwp_setprivate() and use that everywhere.
- update linux_release[] and linux32_release[] to "2.6.18".
- adjust placement of emul fork/exec/exit hooks as needed
and adjust other emul code to match.
- convert all struct emul definitions to use named initializers.
- change the pid allocator to allow multiple pids to refer to the same proc.
- remove a few fields from struct proc that are no longer needed.
- disable the non-functional "vdso" code in linux32/amd64,
glibc works fine without it.
- fix a race in the futex code where we could miss a wakeup after
a requeue operation.
- redo futex locking to be a little more efficient.
 1.19 25-Oct-2009  rmind branches: 1.19.2; 1.19.4;
Initialise struct emul members by name (it is readable now and one can search
them in the tree).
 1.18 14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.17 17-Dec-2008  cegger branches: 1.17.2;
kill MALLOC and FREE macros.
 1.16 19-Nov-2008  ad Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.15 15-Oct-2008  wrstuden branches: 1.15.2;
Merge wrstuden-revivesa into HEAD.
 1.14 05-Sep-2008  tron Compile NetBSD/amd64 kernels with "-Wextra". Patches contributed by
Juan RP in PR port-amd64/39266.
 1.13 28-Apr-2008  martin branches: 1.13.2; 1.13.6;
Remove clause 3 and 4 from TNF licenses
 1.12 26-Apr-2008  njoly branches: 1.12.2;
Remove a duplicate mutex_enter call in linux32_e_proc_init().
Fix a kernel panic for processes created with FORK_SHAREVM.
 1.11 24-Apr-2008  ad Network protocol interrupts can now block on locks, so merge the globals
proclist_mutex and proclist_lock into a single adaptive mutex (proc_lock).
Implications:

- Inspecting process state requires thread context, so signals can no longer
be sent from a hardware interrupt handler. Signal activity must be
deferred to a soft interrupt or kthread.

- As the proc state locking is simplified, it's now safe to take exit()
and wait() out from under kernel_lock.

- The system spends less time at IPL_SCHED, and there is less lock activity.
 1.10 23-Apr-2008  ad Catch up with linux.
 1.9 08-Dec-2007  dsl branches: 1.9.12; 1.9.14;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.8 04-Dec-2007  dsl Remove all the __P
 1.7 19-Oct-2007  ad branches: 1.7.2; 1.7.4;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.6 05-Mar-2007  christos branches: 1.6.2; 1.6.14; 1.6.16; 1.6.20;
more caddr_t lossage.
 1.5 15-Feb-2007  ad branches: 1.5.2;
Fix COMPAT_LINUX32.
 1.4 09-Feb-2007  ad Merge newlock2 to head.
 1.3 23-Aug-2006  manu branches: 1.3.2; 1.3.4;
1) Complete Linux exit_group() emulation
Members of the thread group must die without reporting to the parent and
without going to zombie stage. We do that by reparenting to init before
catching a SIGKILL. The parent will not see the child death.

The thread group leader must report the exit status, even if it exits
because of another thread calling exit_group(). We do that by storing the
exit status in struct linux_emuldata_shared, and the exit hook has the
duty of setting struct proc's p_xstat for the thread group leader.

2) For exit/fork/exec hooks, move the NPTL specific code to separate functions
that are shared between COMPAT_LINUX and COMPAT_LINUX32

3) Fix LINUX_CLONE_PARENT_SETTID semantics
 1.2 25-Jun-2006  manu - Complete exit_group() implementation. We now maintain a list of Linux
threads in a processes and kill them properly. The code is a bit too
complicated, but I could not find a simplier way of dealing with it

- Change getpid() and getppid() semantics to match what Linux does,
and implement gettid(). In the Linux kernel, threads are implemnted
as plain old processes. A thread group is just a set of processes,
with the parent called leader. Thread ID, which are returned by gettid(),
are just the PID of the plain old processes, and getpid() returns the
PID of the thread group leader.

- Remove struct linux32_emuldata. COMPAT_LINUX32 uses a lot of COMPAT_LINUX
code, where a struct linux_emuldata is assumed. By having distinct emuldata
structure with different sizes and layouts, we caused kernel memory
corruptions.

- Fix setprioriry() and getpriority()

Thanks to Nicolas Joly for tracking down the problem and providing me the
hardware to fix them.
 1.1 09-Feb-2006  manu branches: 1.1.2; 1.1.4; 1.1.10; 1.1.14; 1.1.16;
Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.1.16.8 21-Jan-2008  yamt sync with head
 1.1.16.7 07-Dec-2007  yamt sync with head
 1.1.16.6 27-Oct-2007  yamt sync with head.
 1.1.16.5 03-Sep-2007  yamt sync with head.
 1.1.16.4 26-Feb-2007  yamt sync with head.
 1.1.16.3 30-Dec-2006  yamt sync with head.
 1.1.16.2 21-Jun-2006  yamt sync with head.
 1.1.16.1 09-Feb-2006  yamt file linux32_exec.c was added on branch yamt-lazymbuf on 2006-06-21 14:59:27 +0000
 1.1.14.1 13-Jul-2006  gdamore Merge from HEAD.
 1.1.10.2 22-Apr-2006  simonb Sync with head.
 1.1.10.1 09-Feb-2006  simonb file linux32_exec.c was added on branch simonb-timecounters on 2006-04-22 11:38:14 +0000
 1.1.4.2 03-Sep-2006  yamt sync with head.
 1.1.4.1 26-Jun-2006  yamt sync with head.
 1.1.2.2 18-Feb-2006  yamt sync with head.
 1.1.2.1 09-Feb-2006  yamt file linux32_exec.c was added on branch yamt-uio_vmspace on 2006-02-18 15:39:02 +0000
 1.3.4.2 09-Sep-2006  rpaulo sync with head
 1.3.4.1 23-Aug-2006  rpaulo file linux32_exec.c was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:46:03 +0000
 1.3.2.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.5.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.6.20.1 25-Oct-2007  bouyer Sync with HEAD.
 1.6.16.2 09-Jan-2008  matt sync with HEAD
 1.6.16.1 06-Nov-2007  matt sync with HEAD
 1.6.14.2 09-Dec-2007  jmcneill Sync with HEAD.
 1.6.14.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.6.2.1 23-Oct-2007  ad Sync with head.
 1.7.4.2 26-Dec-2007  ad Sync with head.
 1.7.4.1 08-Dec-2007  ad Sync with head.
 1.7.2.2 27-Dec-2007  mjf Sync with HEAD.
 1.7.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.9.14.1 18-May-2008  yamt sync with head.
 1.9.12.3 17-Jan-2009  mjf Sync with HEAD.
 1.9.12.2 28-Sep-2008  mjf Sync with HEAD.
 1.9.12.1 02-Jun-2008  mjf Sync with HEAD.
 1.12.2.4 11-Aug-2010  yamt sync with head.
 1.12.2.3 11-Mar-2010  yamt sync with head
 1.12.2.2 04-May-2009  yamt sync with head.
 1.12.2.1 16-May-2008  yamt sync with head.
 1.13.6.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.13.6.1 19-Oct-2008  haad Sync with HEAD.
 1.13.2.4 24-Sep-2008  skrll Some build fixes.
 1.13.2.3 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.13.2.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.13.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.15.2.2 28-Apr-2009  skrll Sync with HEAD.
 1.15.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.17.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.19.4.1 05-Mar-2011  rmind sync with head
 1.19.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.20.12.1 24-Feb-2012  mrg sync to -current.
 1.20.8.1 17-Apr-2012  yamt sync with head
 1.22.2.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.22.2.1 21-May-2018  pgoyette Sync with HEAD
 1.23.2.1 10-Jun-2019  christos Sync with HEAD
 1.9 26-Nov-2021  ryo - LINUX_GO_RT0_SIGNATURE for compat_linux is no longer enabled by default.
it is now defined in each arch same as the other *_SIGNATURE definitions.
- add new LINUX32_GO_RT0_SIGNATURE for compat_linux32, and is defined in amd64 and aarch64.
 1.8 25-Nov-2021  ryo add support COMPAT_LINUX32 for aarch64
 1.7 07-Jul-2010  chs many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
- support new-style (NPTL) linux pthreads on all platforms.
clone() with CLONE_THREAD uses 1 process with many LWPs
instead of separate processes.
- move the contents of sys__lwp_setprivate() into a new
lwp_setprivate() and use that everywhere.
- update linux_release[] and linux32_release[] to "2.6.18".
- adjust placement of emul fork/exec/exit hooks as needed
and adjust other emul code to match.
- convert all struct emul definitions to use named initializers.
- change the pid allocator to allow multiple pids to refer to the same proc.
- remove a few fields from struct proc that are no longer needed.
- disable the non-functional "vdso" code in linux32/amd64,
glibc works fine without it.
- fix a race in the futex code where we could miss a wakeup after
a requeue operation.
- redo futex locking to be a little more efficient.
 1.6 10-Dec-2009  matt branches: 1.6.2; 1.6.4;
Change u_long to vaddr_t/vsize_t in exec code where appropriate (mostly
involves setregs and vmcmds). Should result in no code differences.
 1.5 19-Nov-2008  ad Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.4 04-Dec-2007  dsl branches: 1.4.12; 1.4.16; 1.4.22; 1.4.24;
Remove all the __P
 1.3 23-Aug-2006  manu branches: 1.3.4; 1.3.28; 1.3.30; 1.3.36; 1.3.40;
1) Complete Linux exit_group() emulation
Members of the thread group must die without reporting to the parent and
without going to zombie stage. We do that by reparenting to init before
catching a SIGKILL. The parent will not see the child death.

The thread group leader must report the exit status, even if it exits
because of another thread calling exit_group(). We do that by storing the
exit status in struct linux_emuldata_shared, and the exit hook has the
duty of setting struct proc's p_xstat for the thread group leader.

2) For exit/fork/exec hooks, move the NPTL specific code to separate functions
that are shared between COMPAT_LINUX and COMPAT_LINUX32

3) Fix LINUX_CLONE_PARENT_SETTID semantics
 1.2 07-Aug-2006  manu Add a new signature test for linux probe function. We look for a .debuglink
section, which is specific to the Linux dynamic interpeter (yes, Linux
can execute it as a stand alone program)
 1.1 09-Feb-2006  manu branches: 1.1.2; 1.1.4; 1.1.10; 1.1.16;
Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.1.16.4 07-Dec-2007  yamt sync with head
 1.1.16.3 30-Dec-2006  yamt sync with head.
 1.1.16.2 21-Jun-2006  yamt sync with head.
 1.1.16.1 09-Feb-2006  yamt file linux32_exec.h was added on branch yamt-lazymbuf on 2006-06-21 14:59:27 +0000
 1.1.10.2 22-Apr-2006  simonb Sync with head.
 1.1.10.1 09-Feb-2006  simonb file linux32_exec.h was added on branch simonb-timecounters on 2006-04-22 11:38:14 +0000
 1.1.4.2 03-Sep-2006  yamt sync with head.
 1.1.4.1 11-Aug-2006  yamt sync with head
 1.1.2.2 18-Feb-2006  yamt sync with head.
 1.1.2.1 09-Feb-2006  yamt file linux32_exec.h was added on branch yamt-uio_vmspace on 2006-02-18 15:39:02 +0000
 1.3.40.1 08-Dec-2007  ad Sync with head.
 1.3.36.1 08-Dec-2007  mjf Sync with HEAD.
 1.3.30.1 09-Jan-2008  matt sync with HEAD
 1.3.28.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.3.4.2 09-Sep-2006  rpaulo sync with head
 1.3.4.1 23-Aug-2006  rpaulo file linux32_exec.h was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:46:03 +0000
 1.4.24.1 19-Jan-2009  skrll Sync with HEAD.
 1.4.22.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.4.16.3 11-Aug-2010  yamt sync with head.
 1.4.16.2 11-Mar-2010  yamt sync with head
 1.4.16.1 04-May-2009  yamt sync with head.
 1.4.12.1 17-Jan-2009  mjf Sync with HEAD.
 1.6.4.1 05-Mar-2011  rmind sync with head
 1.6.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.23 26-Nov-2021  ryo - LINUX_GO_RT0_SIGNATURE for compat_linux is no longer enabled by default.
it is now defined in each arch same as the other *_SIGNATURE definitions.
- add new LINUX32_GO_RT0_SIGNATURE for compat_linux32, and is defined in amd64 and aarch64.
 1.22 25-Nov-2021  ryo add support COMPAT_LINUX32 for aarch64
 1.21 25-Nov-2021  ryo Extra arguments for AT_HWCAP and AT_PLATFORM are now passed when executing linux32 binaries.

AT_SYSINFO (vsyscall) feature seems to be broken, so leave it commented out.
 1.20 07-Sep-2021  riastradh sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.19 06-Aug-2016  maxv branches: 1.19.8; 1.19.20;
The way the kernel tries to prevent a userland process from allocating page
zero is hugely flawed. It is easy to demonstrate that one can trick UVM
into chosing a NULL hint after the user_va0_disable check from uvm_map.
Such a bypass allows kernel NULL pointer dereferences to be exploitable on
architectures with a shared userland<->kernel VA, like amd64.

Fix this by increasing the limit of the vm space made available for
userland processes. This way, UVM will never chose a NULL hint, since it
would be outside of the vm space.

The user_va0_disable sysctl still controls this feature.
 1.18 20-Mar-2015  maxv Zero-fill the ELF auxiliary vectors. Otherwise, on 64bit systems, the
padding between a_v and a_type contains kernel garbage, therefore
exposed to userland.

Original report by uebayasi@
 1.17 23-Feb-2014  njoly branches: 1.17.4; 1.17.6;
Use Aux32Info not AuxInfo. Noticed by Maxime Villard.
 1.16 23-Feb-2014  njoly Fix wrong KASSERTs. Do not compare size vs. entries count.
 1.15 21-Feb-2014  maxv Increase LINUX32_ELF_AUX_ENTRIES to avoid overrun in linux32/. Also,
add comments and KASSERTs to make sure people don't forget to increase
XX_AUX_ENTRIES's when adding vectors.

Reported by martin@ (CV), with suggestions from chs@.

ok martin@ chs@
 1.14 09-Feb-2014  chs account for the 16 bytes of AT_RANDOM data in the stack setup. fixes PR 48518.
use cprng_strong32() instead of random(). add AT_RANDOM support for linux32.
 1.13 03-Feb-2012  matt branches: 1.13.6; 1.13.10;
Add a hook for freeing an ep_emul_arg. Add a wrapper routine
(exec_free_emul_arg) to call the hook and then clear the ep_emul_arg
and ep_emul_arg_free members in the exec_package.
Change users/accessors to use these routines.
Approved by releng.
 1.12 11-Sep-2010  chs branches: 1.12.8; 1.12.12;
always supply an auxiliary vector for linux ELF processes.
static executables (such as newer versions of /sbin/ldconfig)
require this to work properly. since static executables
also don't have a PT_PHDR entry, use the same heuristic as
linux does to provide a value for AT_PHDR in this case.
 1.11 07-Jul-2010  chs many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
- support new-style (NPTL) linux pthreads on all platforms.
clone() with CLONE_THREAD uses 1 process with many LWPs
instead of separate processes.
- move the contents of sys__lwp_setprivate() into a new
lwp_setprivate() and use that everywhere.
- update linux_release[] and linux32_release[] to "2.6.18".
- adjust placement of emul fork/exec/exit hooks as needed
and adjust other emul code to match.
- convert all struct emul definitions to use named initializers.
- change the pid allocator to allow multiple pids to refer to the same proc.
- remove a few fields from struct proc that are no longer needed.
- disable the non-functional "vdso" code in linux32/amd64,
glibc works fine without it.
- fix a race in the futex code where we could miss a wakeup after
a requeue operation.
- redo futex locking to be a little more efficient.
 1.10 18-Apr-2010  jym This patch fixes the NX regression issue observed on amd64 kernels, where
per-page execution right was disabled (therefore leading to the inability
of the kernel to detect fraudulent use of memory mappings marked as not
being executable).

- replace cpu_feature and ci_feature_flags variables by cpu_feature and
ci_feat_val arrays. This makes it cleaner and brings kernel code closer
to the design of cpuctl(8). A warning will be raised for each CPU that
does not expose the same features as the Boot Processor (BP).

- the blacklist of CPU features is now a macro defined in the
specialreg.h header, instead of hardcoding it inside MD initialization
code; fix comments.

- replace checks against CPUID_TSC with the cpu_hascounter() function.

- clean up the code in init_x86_64(), as cpu_feature variables are set
inside cpu_probe().

- use cpu_init_msrs() for i386. It will be eventually used later for NX
feature under i386 PAE kernels.

- remove code that checks for CPUID_NOX in amd64 mptramp.S, this is already
performed by cpu_hatch() through cpu_init_msrs().

- remove cpu_signature and feature_flags members from struct mpbios_proc
(they were never used).

This patch was tested with i386 MONOLITHIC, XEN3PAE_DOM0 and XEN3_DOM0 under
a native i386 host, and amd64 GENERIC, XEN3_DOM0 via QEMU virtual machines.

XXX Should kernel rev be bumped?

XXX A similar patch should be pulled-up for NetBSD-5, hopefully tomorrow.
 1.9 15-Mar-2009  cegger branches: 1.9.2; 1.9.4;
ansify function definitions
 1.8 28-Apr-2008  martin branches: 1.8.8; 1.8.14;
Remove clause 3 and 4 from TNF licenses
 1.7 22-Apr-2007  dsl branches: 1.7.28; 1.7.30; 1.7.32;
Change the way that emulations locate files within the emulation root to
avoid having to allocate space in the 'stackgap'
- which is very LWP unfriendly.
The additional code for non-emulation namei() is trivial, the reduction for
the emulations is massive.
The vnode for a processes emulation root is saved in the cwdi structure
during process exec.
If the emulation root the TRYEMULROOT flag are set, namei() will do an initial
search for absolute pathnames in the emulation root, if that fails it will
retry from the normal root.
".." at the emulation root will always go to the real root, even in the middle
of paths and when expanding symlinks.
Absolute symlinks found using absolute paths in the emulation root will be
relative to the emulation root (so /usr/lib/xxx.so -> /lib/xxx.so links
inside the emulation root don't need changing).
If the root of the emulation would be returned (for an emulation lookup), then
the real root is returned instead (matching the behaviour of emul_lookup,
but being a cheap comparison here) so that programs that scan "../.."
looking for the root dircetory don't loop forever.
The target for symbolic links is no longer mangled (it used to get the
CHECK_ALT_xxx() treatment, so could get /emul/xxx prepended).
CHECK_ALT_xxx() are no more. Most of the change is deleting them, and adding
TRYEMULROOT to the flags to NDINIT().
A lot of the emulation system call stubs could now be deleted.
 1.6 16-Mar-2007  dsl remove all the double (and triple) casts used to convert 32bit userspace
pointers to and from 64bit kernel pointers. Instead use the defines
NETBSD32PTR64(p32) to read a 32bit pointer and (the new) NETBSD32PTR32(p32,p64)
to write a 32bit pointer throughout.
The 32bit pointer is now a struct to enforce the above.
amd64 (with linux emul) and sparc64 will both compile (when the arch stuff
goes in soon), and amd64 still runs some i386 binaries.
 1.5 07-Aug-2006  manu branches: 1.5.6; 1.5.12; 1.5.16; 1.5.18; 1.5.20;
Add a new signature test for linux probe function. We look for a .debuglink
section, which is specific to the Linux dynamic interpeter (yes, Linux
can execute it as a stand alone program)
 1.4 23-Jul-2006  ad Use the LWP cached credentials where sane.
 1.3 13-Jun-2006  skd branches: 1.3.4;
include kauth.h
workaround a gcc4 warning.
 1.2 14-May-2006  elad branches: 1.2.2;
integrate kauth.
 1.1 09-Feb-2006  manu branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.10;
Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.1.10.3 01-Jun-2006  kardel Sync with head.
 1.1.10.2 22-Apr-2006  simonb Sync with head.
 1.1.10.1 09-Feb-2006  simonb file linux32_exec_elf32.c was added on branch simonb-timecounters on 2006-04-22 11:38:14 +0000
 1.1.8.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.1.6.1 08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.1.4.3 11-Aug-2006  yamt sync with head
 1.1.4.2 26-Jun-2006  yamt sync with head.
 1.1.4.1 24-May-2006  yamt sync with head.
 1.1.2.2 18-Feb-2006  yamt sync with head.
 1.1.2.1 09-Feb-2006  yamt file linux32_exec_elf32.c was added on branch yamt-uio_vmspace on 2006-02-18 15:39:02 +0000
 1.2.2.1 19-Jun-2006  chap Sync with head.
 1.3.4.4 03-Sep-2007  yamt sync with head.
 1.3.4.3 30-Dec-2006  yamt sync with head.
 1.3.4.2 21-Jun-2006  yamt sync with head.
 1.3.4.1 13-Jun-2006  yamt file linux32_exec_elf32.c was added on branch yamt-lazymbuf on 2006-06-21 14:59:27 +0000
 1.5.20.1 18-Mar-2007  reinoud First attempt to bring branch in sync with HEAD
 1.5.18.1 11-Jul-2007  mjf Sync with head.
 1.5.16.2 27-May-2007  ad Sync with head.
 1.5.16.1 10-Apr-2007  ad Sync with head.
 1.5.12.2 07-May-2007  yamt sync with head.
 1.5.12.1 24-Mar-2007  yamt sync with head.
 1.5.6.2 09-Sep-2006  rpaulo sync with head
 1.5.6.1 07-Aug-2006  rpaulo file linux32_exec_elf32.c was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:46:03 +0000
 1.7.32.4 09-Oct-2010  yamt sync with head
 1.7.32.3 11-Aug-2010  yamt sync with head.
 1.7.32.2 04-May-2009  yamt sync with head.
 1.7.32.1 16-May-2008  yamt sync with head.
 1.7.30.1 18-May-2008  yamt sync with head.
 1.7.28.1 02-Jun-2008  mjf Sync with HEAD.
 1.8.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.8.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.9.4.2 05-Mar-2011  rmind sync with head
 1.9.4.1 30-May-2010  rmind sync with head
 1.9.2.3 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.9.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.9.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.12.12.1 18-Feb-2012  mrg merge to -current.
 1.12.8.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.12.8.1 17-Apr-2012  yamt sync with head
 1.13.10.1 18-May-2014  rmind sync with head
 1.13.6.2 03-Dec-2017  jdolecek update from HEAD
 1.13.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.17.6.2 05-Oct-2016  skrll Sync with HEAD
 1.17.6.1 06-Apr-2015  skrll Sync with HEAD
 1.17.4.1 29-Mar-2015  martin Pull up following revision(s) (requested by maxv in ticket #650):
sys/compat/netbsd32/netbsd32_exec_elf32.c: revision 1.39
sys/kern/exec_elf.c: revision 1.71
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.18
sys/compat/linux/common/linux_exec_elf32.c: revision 1.92
sys/compat/svr4_32/svr4_32_exec_elf32.c: revision 1.24
Zero-fill the ELF auxiliary vectors. Otherwise, on 64bit systems, the
padding between a_v and a_type contains kernel garbage, therefore
exposed to userland.
Original report by uebayasi@
 1.19.20.1 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.19.8.1 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1836):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.11 25-Nov-2021  ryo - Use LINUX32_F_xxx instead of LINUX_F_xxx for compat_linux32.
aarch64 and arm have different values.
- Compile linux32_sys_fadvise64() only if the syscall is required.
 1.10 17-May-2014  njoly Fix fadvise64 syscalls. Unlike our, linux fadvise syscall do not
return error code; call do_posix_fadvise().
 1.9 30-May-2011  alnsn branches: 1.9.14; 1.9.18; 1.9.28;
Add fadvise64 and fadvise64_64 syscalls to compat_linux and compat_linux32.
 1.8 29-Dec-2008  njoly branches: 1.8.6; 1.8.8;
s/syscallcarg/syscallarg/ in comments.
 1.7 19-Nov-2008  ad Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.6 04-Feb-2008  dsl branches: 1.6.6; 1.6.10; 1.6.12; 1.6.16; 1.6.18;
Use the same function to implement linux32_sys_fcntl() and linux_sys_fcntl64().
A rather excessive amount of 'appending 64' to names seems to have happened
when linux won support for files > 4G.
technically the linux32_sys_fcntl() function should error the 64bit file
locking requests - but life is too short.
 1.5 02-Feb-2008  dsl Fix the linux32 emulations of fcntl() locking.
The 64bit linux emulation versions can't be used because the lock structure
alignment and field sizes all differ.
Since there need to be 4 different versions of the linux struct flock, and
amd64 kernel needs 3 of them compiled in, rather than replicating the same
code block twice more, move the body of the code into a few #defines
that can be expanded with the correct types in the linux[32]_sys_fcntl[64]()
functions.
Should fix problems running progams like skype running under linux32
emulation on amd64.
 1.4 20-Dec-2007  dsl Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.3 08-Dec-2007  dsl branches: 1.3.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.2 09-Feb-2007  ad branches: 1.2.18; 1.2.20; 1.2.26; 1.2.28;
Merge newlock2 to head.
 1.1 09-Feb-2006  manu branches: 1.1.2; 1.1.10; 1.1.16; 1.1.20; 1.1.22;
Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.1.22.2 09-Sep-2006  rpaulo sync with head
 1.1.22.1 09-Feb-2006  rpaulo file linux32_fcntl.c was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:46:03 +0000
 1.1.20.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.1.16.6 11-Feb-2008  yamt sync with head.
 1.1.16.5 04-Feb-2008  yamt sync with head.
 1.1.16.4 21-Jan-2008  yamt sync with head
 1.1.16.3 26-Feb-2007  yamt sync with head.
 1.1.16.2 21-Jun-2006  yamt sync with head.
 1.1.16.1 09-Feb-2006  yamt file linux32_fcntl.c was added on branch yamt-lazymbuf on 2006-06-21 14:59:27 +0000
 1.1.10.2 22-Apr-2006  simonb Sync with head.
 1.1.10.1 09-Feb-2006  simonb file linux32_fcntl.c was added on branch simonb-timecounters on 2006-04-22 11:38:14 +0000
 1.1.2.2 18-Feb-2006  yamt sync with head.
 1.1.2.1 09-Feb-2006  yamt file linux32_fcntl.c was added on branch yamt-uio_vmspace on 2006-02-18 15:39:02 +0000
 1.2.28.1 26-Dec-2007  ad Sync with head.
 1.2.26.1 18-Feb-2008  mjf Sync with HEAD.
 1.2.20.2 23-Mar-2008  matt sync with HEAD
 1.2.20.1 09-Jan-2008  matt sync with HEAD
 1.2.18.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.3.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.6.18.1 19-Jan-2009  skrll Sync with HEAD.
 1.6.16.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.6.12.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.6.12.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.6.10.1 04-May-2009  yamt sync with head.
 1.6.6.1 17-Jan-2009  mjf Sync with HEAD.
 1.8.8.1 06-Jun-2011  jruoho Sync with HEAD.
 1.8.6.1 31-May-2011  rmind sync with head
 1.9.28.1 10-Aug-2014  tls Rebase.
 1.9.18.1 18-May-2014  rmind sync with head
 1.9.14.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1 25-Nov-2021  ryo - Use LINUX32_F_xxx instead of LINUX_F_xxx for compat_linux32.
aarch64 and arm have different values.
- Compile linux32_sys_fadvise64() only if the syscall is required.
 1.15 19-Sep-2021  thorpej Add the timerfd syscalls to COMPAT_LINUX and COMPAT_LINUX32.
 1.14 23-Aug-2019  maxv branches: 1.14.8;
Put the printf under DEBUG_LINUX.
 1.13 18-Aug-2009  christos branches: 1.13.38; 1.13.50; 1.13.56; 1.13.64; 1.13.68;
add the video ioctls so that the 32 bit skype works with video
more commits to come
 1.12 19-Nov-2008  ad Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.11 19-Jun-2008  christos branches: 1.11.2; 1.11.4;
an attempt at linux32_ioctl_socket().
 1.10 22-Jan-2008  jmcneill branches: 1.10.6; 1.10.10; 1.10.12; 1.10.14;
Add ossaudio support for COMPAT_LINUX32, with help from mrg. With this
change, audio now works on amd64 with native firefox, nspluginwrapper, and
the 32-bit linux flash binaries.
 1.9 20-Dec-2007  dsl Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.8 08-Dec-2007  dsl branches: 1.8.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.7 18-Mar-2007  dsl branches: 1.7.8; 1.7.10; 1.7.16; 1.7.18;
Change all the NETBSD32PTR64(SCARG(uap, xxx))) to SCARG_P32(uap, xxx).
 1.6 16-Mar-2007  dsl remove all the double (and triple) casts used to convert 32bit userspace
pointers to and from 64bit kernel pointers. Instead use the defines
NETBSD32PTR64(p32) to read a 32bit pointer and (the new) NETBSD32PTR32(p32,p64)
to write a 32bit pointer throughout.
The 32bit pointer is now a struct to enforce the above.
amd64 (with linux emul) and sparc64 will both compile (when the arch stuff
goes in soon), and amd64 still runs some i386 binaries.
 1.5 04-Mar-2007  christos branches: 1.5.2; 1.5.4; 1.5.6;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.4 13-Sep-2006  manu branches: 1.4.4; 1.4.6; 1.4.10;
Jumbo COMPAT_LINUX/COMPAT_LINUX32 bugfix, with the help of Nicolas Joly
- Fix shmat return value on amd64: it uses no black magic with retval[0]
- Fix integer overflows in sysinfo
- Implement sysinfo, mmap2, sched_getparam, sched_getscheduler, mremap,
and madvise in COMPAT_LINUX32
- Fix improper types used in setgroups16/getgroups16
- Implement mmap2 for COMPAT_LINUX32
- Ifdef debug messages by DEBUG_LINUX
 1.3 25-Aug-2006  manu branches: 1.3.2; 1.3.4;
Add support for socket ioctl.
 1.2 15-Feb-2006  manu branches: 1.2.2; 1.2.4; 1.2.10; 1.2.16;
- Move the BSD to Linux and Linux to BSD termio/termios conversion functions
to a header where they can be shared between COMPAT_LINUX and COMPAT_LINUX32
- Add termios ioctl emulation to COMPAT_LINUX32
- Add the getcwd system call to COMPAT_LINUX32/amd64

That makes Linux's bash working with COMPAT_LINUX32.
 1.1 09-Feb-2006  manu Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.2.16.6 04-Feb-2008  yamt sync with head.
 1.2.16.5 21-Jan-2008  yamt sync with head
 1.2.16.4 03-Sep-2007  yamt sync with head.
 1.2.16.3 30-Dec-2006  yamt sync with head.
 1.2.16.2 21-Jun-2006  yamt sync with head.
 1.2.16.1 15-Feb-2006  yamt file linux32_ioctl.c was added on branch yamt-lazymbuf on 2006-06-21 14:59:27 +0000
 1.2.10.2 22-Apr-2006  simonb Sync with head.
 1.2.10.1 15-Feb-2006  simonb file linux32_ioctl.c was added on branch simonb-timecounters on 2006-04-22 11:38:14 +0000
 1.2.4.2 14-Sep-2006  yamt sync with head.
 1.2.4.1 03-Sep-2006  yamt sync with head.
 1.2.2.2 18-Feb-2006  yamt sync with head.
 1.2.2.1 15-Feb-2006  yamt file linux32_ioctl.c was added on branch yamt-uio_vmspace on 2006-02-18 15:39:02 +0000
 1.3.4.2 09-Sep-2006  rpaulo sync with head
 1.3.4.1 25-Aug-2006  rpaulo file linux32_ioctl.c was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:46:03 +0000
 1.3.2.1 18-Nov-2006  ad Sync with head.
 1.4.10.1 04-Sep-2008  skrll Sync with netbsd-4.
 1.4.6.2 24-Mar-2007  yamt sync with head.
 1.4.6.1 12-Mar-2007  rmind Sync with HEAD.
 1.4.4.1 20-Aug-2008  bouyer Pull up following revision(s) (requested by jmcneill in ticket #1051):
sys/compat/linux32/common/linux32_ioctl.c: revision 1.10 via patch
sys/compat/ossaudio/ossaudiovar.h: revision 1.14
Add ossaudio support for COMPAT_LINUX32, with help from mrg. With this
change, audio now works on amd64 with native firefox, nspluginwrapper, and
the 32-bit linux flash binaries.
 1.5.6.2 29-Mar-2007  reinoud Pullup to -current
 1.5.6.1 18-Mar-2007  reinoud First attempt to bring branch in sync with HEAD
 1.5.4.1 11-Jul-2007  mjf Sync with head.
 1.5.2.1 10-Apr-2007  ad Sync with head.
 1.7.18.1 26-Dec-2007  ad Sync with head.
 1.7.16.1 18-Feb-2008  mjf Sync with HEAD.
 1.7.10.2 23-Mar-2008  matt sync with HEAD
 1.7.10.1 09-Jan-2008  matt sync with HEAD
 1.7.8.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.8.4.2 23-Jan-2008  bouyer Sync with HEAD.
 1.8.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.10.14.1 27-Jun-2008  simonb Sync with head.
 1.10.12.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.10.10.2 19-Aug-2009  yamt sync with head.
 1.10.10.1 04-May-2009  yamt sync with head.
 1.10.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.10.6.1 29-Jun-2008  mjf Sync with HEAD.
 1.11.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.11.2.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.13.68.1 13-Sep-2019  martin Pull up following revision(s) (requested by maxv in ticket #194):

sys/compat/linux/common/linux_socket.c: revision 1.146
sys/compat/linux/common/linux_socket.c: revision 1.147
sys/compat/linux/common/linux_socket.c: revision 1.148
sys/compat/linux/common/linux_socket.c: revision 1.149
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.59
sys/compat/linux32/common/linux32_sysinfo.c: revision 1.8
sys/kern/sysv_shm.c: revision 1.138
sys/compat/linux/common/linux_file64.c: revision 1.61
sys/compat/linux/common/linux_file64.c: revision 1.62
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.58
sys/compat/linux32/common/linux32_dirent.c: revision 1.20
sys/compat/linux32/common/linux32_utsname.c: revision 1.10
sys/compat/linux/common/linux_termios.h: revision 1.22
sys/compat/linux32/common/linux32_termios.c: revision 1.15
sys/compat/linux32/common/linux32_misc.c: revision 1.27
sys/compat/linux32/common/linux32_ioctl.c: revision 1.14
sys/compat/linux/common/linux_statfs.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.57
sys/compat/linux/common/linux_fcntl.h: revision 1.18
sys/compat/linux/common/linux_socket.h: revision 1.24
sys/sys/shm.h: revision 1.54
sys/compat/ossaudio/ossaudio.c: revision 1.75
sys/compat/linux32/common/linux32_signal.c: revision 1.20
sys/miscfs/procfs/procfs_linux.c: revision 1.75
sys/compat/linux/common/linux_signal.c: revision 1.81
sys/compat/linux/common/linux_termios.c: revision 1.38
sys/compat/linux/common/linux_misc.c: revision 1.241
sys/compat/linux/common/linux_misc.c: revision 1.242
sys/compat/linux/common/linux_misc.c: revision 1.243
sys/compat/linux/common/linux_misc.c: revision 1.244

Fix info leaks.

Fix stupid bugs in linux_sys_shmctl(): the index could be out of bound
(page fault) and there was no proper locking.
Maybe we should just remove LINUX_SHM_STAT, like compat_linux32.

Remove printf.

When dealing with an unknown value, set -1, to prevent (harmless)
uninitialized accesses later.

Add a default case, don't call sys_ioctl() with an uninitialized 'com'
argument.

Fix error handling, returns an errno, not -1.

Put the printf under DEBUG_LINUX.


Hum, don't forget the 'pid' argument, otherwise we're not gonna go very
far.

Don't read data from userland directly. This simply does not work on any
recent x86 CPU (thanks to SMAP) and all architectures that forbid direct
access to userland from the kernel. But I guess no one noticed because no
one ever uses compat_linux, right?

Hum, don't pass an mbuf to realloc(). Inspired from copyin32_msg_control().

Fix memory leak.

I don't see the point in having this useless printf, but add a '\n' to it,
so that it at least displays useless stuff correctly.

Hum, remove incorrect assignment. Userland could have passed a smaller
namelen, and the uninitialized bytes from sb_data were being used later in
the network stack.
 1.13.64.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.13.56.1 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1487:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.13.50.1 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1720:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149 (patch)
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54 (patch)

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.13.38.1 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1720:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149 (patch)
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54 (patch)

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.14.8.1 03-Jan-2021  thorpej Handle timerfd ioctls.
 1.6 25-Nov-2021  ryo add support COMPAT_LINUX32 for aarch64
 1.5 19-Jun-2008  christos an attempt at linux32_ioctl_socket().
 1.4 28-Apr-2008  martin branches: 1.4.2; 1.4.4;
Remove clause 3 and 4 from TNF licenses
 1.3 20-Dec-2007  dsl branches: 1.3.6; 1.3.8; 1.3.10;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.2 04-Dec-2007  dsl branches: 1.2.4;
Remove all the __P
 1.1 15-Feb-2006  manu branches: 1.1.2; 1.1.10; 1.1.16; 1.1.22; 1.1.46; 1.1.48; 1.1.54; 1.1.58;
- Move the BSD to Linux and Linux to BSD termio/termios conversion functions
to a header where they can be shared between COMPAT_LINUX and COMPAT_LINUX32
- Add termios ioctl emulation to COMPAT_LINUX32
- Add the getcwd system call to COMPAT_LINUX32/amd64

That makes Linux's bash working with COMPAT_LINUX32.
 1.1.58.2 26-Dec-2007  ad Sync with head.
 1.1.58.1 08-Dec-2007  ad Sync with head.
 1.1.54.2 27-Dec-2007  mjf Sync with HEAD.
 1.1.54.1 08-Dec-2007  mjf Sync with HEAD.
 1.1.48.1 09-Jan-2008  matt sync with HEAD
 1.1.46.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.1.22.2 09-Sep-2006  rpaulo sync with head
 1.1.22.1 15-Feb-2006  rpaulo file linux32_ioctl.h was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:46:03 +0000
 1.1.16.4 21-Jan-2008  yamt sync with head
 1.1.16.3 07-Dec-2007  yamt sync with head
 1.1.16.2 21-Jun-2006  yamt sync with head.
 1.1.16.1 15-Feb-2006  yamt file linux32_ioctl.h was added on branch yamt-lazymbuf on 2006-06-21 14:59:27 +0000
 1.1.10.2 22-Apr-2006  simonb Sync with head.
 1.1.10.1 15-Feb-2006  simonb file linux32_ioctl.h was added on branch simonb-timecounters on 2006-04-22 11:38:14 +0000
 1.1.2.2 18-Feb-2006  yamt sync with head.
 1.1.2.1 15-Feb-2006  yamt file linux32_ioctl.h was added on branch yamt-uio_vmspace on 2006-02-18 15:39:02 +0000
 1.2.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.3.10.2 04-May-2009  yamt sync with head.
 1.3.10.1 16-May-2008  yamt sync with head.
 1.3.8.1 18-May-2008  yamt sync with head.
 1.3.6.2 29-Jun-2008  mjf Sync with HEAD.
 1.3.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.4.4.1 27-Jun-2008  simonb Sync with head.
 1.4.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.4 20-Nov-2009  njoly Make linux32_msqid_ds l_msg_[src]time members use the right type,
linux32_time_t.
 1.3 16-Nov-2009  joerg Follow up commit to fix breakage that somehow passed by the compiler.
 1.2 16-Nov-2009  joerg Add SYSVMSG support for linux32.
 1.1 20-May-2008  njoly branches: 1.1.2; 1.1.4; 1.1.8; 1.1.22;
Add compat linux32 ipc(2) syscall support, for shared memory and
semaphores.
 1.1.22.3 11-Mar-2010  yamt sync with head
 1.1.22.2 04-May-2009  yamt sync with head.
 1.1.22.1 20-May-2008  yamt file linux32_ipc.h was added on branch yamt-nfs-mp on 2009-05-04 08:12:23 +0000
 1.1.8.2 23-Jun-2008  wrstuden Add files to branch that were added on -current.

After this, all that's left of update is to merge some changes
that had conflicts.
 1.1.8.1 20-May-2008  wrstuden file linux32_ipc.h was added on branch wrstuden-revivesa on 2008-06-23 05:02:13 +0000
 1.1.4.2 04-Jun-2008  yamt sync with head
 1.1.4.1 20-May-2008  yamt file linux32_ipc.h was added on branch yamt-pf42 on 2008-06-04 02:05:04 +0000
 1.1.2.2 02-Jun-2008  mjf Sync with HEAD.
 1.1.2.1 20-May-2008  mjf file linux32_ipc.h was added on branch mjf-devfs2 on 2008-06-02 13:23:04 +0000
 1.12 21-Feb-2019  mrg for sysv ipc stat operations, explicitly copy the exported parts
instead of the whole ds structure.

besides triggering a recently added assert in netbsd32, this stops
exposing kernel addresses.

copy the mode clamping to 0777 from sem to shm and msg.


while here, make sure that the compat callers to sysv_ipc clear
the contents of the compat structure before setting the result
members to ensure padding bytes are cleared.

don't set/copy _sem_base, _msg_first, _msg_last or _shm_internal.
even if used, which seems very dodgy, they leak KVAs as well.
possibly this may affect linux binaries, in particular, the
comments around _shm_internal ("XXX Oh well.") may mean apps
rely upon these but hopefully not -- the comments date back to
rev 1.1 in 1995.

the _key, _seq and _msg_cbytes members are exported as before as
i found multiple consumers of these (no less than ipcs(1), and
they appear to be useful for debugging and more.


XXX: the naming of compat functions have too many styles. there
are at least 3 different ones changed here.
 1.11 29-May-2010  dholland branches: 1.11.34; 1.11.38; 1.11.46; 1.11.52; 1.11.60;
Fix build without sysvipc configured, from Wolfgang Stukenbrock in PR 43376,
adjusted for current.
 1.10 05-Jan-2010  mbalmer branches: 1.10.2; 1.10.4;
Remove extra semicolon.
 1.9 18-Nov-2009  njoly Make compat linux/linux32 msgrcv_msgarg type member of type
long/netbsd32_long to match linux definition.
 1.8 18-Nov-2009  njoly Make linux32 msgsnd/msgrcv use the netbsd32 syscalls instead of native
ones, to ensure that msgbuf mtype member will be of the right type.
 1.7 18-Nov-2009  njoly Kill noisy debug printf.
 1.6 16-Nov-2009  joerg Follow up commit to fix breakage that somehow passed by the compiler.
 1.5 16-Nov-2009  joerg Add SYSVMSG support for linux32.
 1.4 27-Apr-2009  njoly branches: 1.4.2;
Add IPC_64 support to all semctl(2) commands, following corresponding
compat linux change.
 1.3 18-Feb-2009  njoly Add IPC_64 support for all shmctl(2) commands, and reduce diffs with
compat linux version.
 1.2 17-Sep-2008  scw branches: 1.2.2; 1.2.8;
In linux32_shmat() don't try to copyout a 64-bit pointer where userspace
is expecting a 32-bit result.

Fixes nspluginwrapper on amd64.
 1.1 20-May-2008  njoly branches: 1.1.2; 1.1.4; 1.1.8; 1.1.10;
Add compat linux32 ipc(2) syscall support, for shared memory and
semaphores.
 1.1.10.1 19-Oct-2008  haad Sync with HEAD.
 1.1.8.3 24-Sep-2008  wrstuden Merge in changes between wrstuden-revivesa-base-2 and
wrstuden-revivesa-base-3.
 1.1.8.2 23-Jun-2008  wrstuden Add files to branch that were added on -current.

After this, all that's left of update is to merge some changes
that had conflicts.
 1.1.8.1 20-May-2008  wrstuden file linux32_ipccall.c was added on branch wrstuden-revivesa on 2008-06-23 05:02:13 +0000
 1.1.4.2 04-Jun-2008  yamt sync with head
 1.1.4.1 20-May-2008  yamt file linux32_ipccall.c was added on branch yamt-pf42 on 2008-06-04 02:05:04 +0000
 1.1.2.3 28-Sep-2008  mjf Sync with HEAD.
 1.1.2.2 02-Jun-2008  mjf Sync with HEAD.
 1.1.2.1 20-May-2008  mjf file linux32_ipccall.c was added on branch mjf-devfs2 on 2008-06-02 13:23:04 +0000
 1.2.8.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.2.2.1 03-Mar-2009  skrll Sync with HEAD.
 1.4.2.4 11-Aug-2010  yamt sync with head.
 1.4.2.3 11-Mar-2010  yamt sync with head
 1.4.2.2 04-May-2009  yamt sync with head.
 1.4.2.1 27-Apr-2009  yamt file linux32_ipccall.c was added on branch yamt-nfs-mp on 2009-05-04 08:12:23 +0000
 1.10.4.1 30-May-2010  rmind sync with head
 1.10.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.11.60.1 10-Jun-2019  christos Sync with HEAD
 1.11.52.1 23-Feb-2019  martin Pull up following revision(s) (requested by mrg in ticket #1195):
sys/compat/sys/ipc.h: revision 1.6
sys/compat/sys/ipc.h: revision 1.7
sys/compat/sys/shm.h: revision 1.8
sys/kern/sysv_shm.c: revision 1.133
sys/compat/sys/sem.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.56
sys/compat/netbsd32/netbsd32_conv.h: revision 1.38
sys/kern/sysv_sem.c: revision 1.96
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.28
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.29
sys/compat/linux32/common/linux32_ipccall.c: revision 1.12
sys/kern/sysv_msg.c: revision 1.73
sys/compat/sys/msg.h: revision 1.6

for sysv ipc stat operations, explicitly copy the exported parts
instead of the whole ds structure.
besides triggering a recently added assert in netbsd32, this stops
exposing kernel addresses.

copy the mode clamping to 0777 from sem to shm and msg.

while here, make sure that the compat callers to sysv_ipc clear
the contents of the compat structure before setting the result
members to ensure padding bytes are cleared.

don't set/copy _sem_base, _msg_first, _msg_last or _shm_internal.
even if used, which seems very dodgy, they leak KVAs as well.
possibly this may affect linux binaries, in particular, the
comments around _shm_internal ("XXX Oh well.") may mean apps
rely upon these but hopefully not -- the comments date back to
rev 1.1 in 1995.

the _key, _seq and _msg_cbytes members are exported as before as
i found multiple consumers of these (no less than ipcs(1), and
they appear to be useful for debugging and more.

XXX: the naming of compat functions have too many styles. there
are at least 3 different ones changed here.

fix naming errors in previous. (this file is no longer compiled, but
this fix makes the pull up more obvious, before deleting this file.)

include libkern.h or strings.h. should fix i386 build issues.
 1.11.46.1 23-Feb-2019  martin Pull up following revision(s) (requested by mrg in ticket #1679):
sys/compat/sys/ipc.h: revision 1.6
sys/compat/sys/ipc.h: revision 1.7
sys/compat/sys/shm.h: revision 1.8
sys/kern/sysv_shm.c: revision 1.133
sys/compat/sys/sem.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.56
sys/compat/netbsd32/netbsd32_conv.h: revision 1.38
sys/kern/sysv_sem.c: revision 1.96
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.28
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.29
sys/compat/linux32/common/linux32_ipccall.c: revision 1.12
sys/kern/sysv_msg.c: revision 1.73
sys/compat/sys/msg.h: revision 1.6

for sysv ipc stat operations, explicitly copy the exported parts
instead of the whole ds structure.
besides triggering a recently added assert in netbsd32, this stops
exposing kernel addresses.

copy the mode clamping to 0777 from sem to shm and msg.

while here, make sure that the compat callers to sysv_ipc clear
the contents of the compat structure before setting the result
members to ensure padding bytes are cleared.

don't set/copy _sem_base, _msg_first, _msg_last or _shm_internal.
even if used, which seems very dodgy, they leak KVAs as well.
possibly this may affect linux binaries, in particular, the
comments around _shm_internal ("XXX Oh well.") may mean apps
rely upon these but hopefully not -- the comments date back to
rev 1.1 in 1995.

the _key, _seq and _msg_cbytes members are exported as before as
i found multiple consumers of these (no less than ipcs(1), and
they appear to be useful for debugging and more.

XXX: the naming of compat functions have too many styles. there
are at least 3 different ones changed here.

fix naming errors in previous. (this file is no longer compiled, but
this fix makes the pull up more obvious, before deleting this file.)

include libkern.h or strings.h. should fix i386 build issues.
 1.11.38.1 23-Feb-2019  martin Pull up following revision(s) (requested by mrg in ticket #1679):
sys/compat/sys/ipc.h: revision 1.6
sys/compat/sys/ipc.h: revision 1.7
sys/compat/sys/shm.h: revision 1.8
sys/kern/sysv_shm.c: revision 1.133
sys/compat/sys/sem.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.56
sys/compat/netbsd32/netbsd32_conv.h: revision 1.38
sys/kern/sysv_sem.c: revision 1.96
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.28
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.29
sys/compat/linux32/common/linux32_ipccall.c: revision 1.12
sys/kern/sysv_msg.c: revision 1.73
sys/compat/sys/msg.h: revision 1.6

for sysv ipc stat operations, explicitly copy the exported parts
instead of the whole ds structure.
besides triggering a recently added assert in netbsd32, this stops
exposing kernel addresses.

copy the mode clamping to 0777 from sem to shm and msg.

while here, make sure that the compat callers to sysv_ipc clear
the contents of the compat structure before setting the result
members to ensure padding bytes are cleared.

don't set/copy _sem_base, _msg_first, _msg_last or _shm_internal.
even if used, which seems very dodgy, they leak KVAs as well.
possibly this may affect linux binaries, in particular, the
comments around _shm_internal ("XXX Oh well.") may mean apps
rely upon these but hopefully not -- the comments date back to
rev 1.1 in 1995.

the _key, _seq and _msg_cbytes members are exported as before as
i found multiple consumers of these (no less than ipcs(1), and
they appear to be useful for debugging and more.

XXX: the naming of compat functions have too many styles. there
are at least 3 different ones changed here.

fix naming errors in previous. (this file is no longer compiled, but
this fix makes the pull up more obvious, before deleting this file.)

include libkern.h or strings.h. should fix i386 build issues.
 1.11.34.1 23-Feb-2019  martin Pull up following revision(s) (requested by mrg in ticket #1679):
sys/compat/sys/ipc.h: revision 1.6
sys/compat/sys/ipc.h: revision 1.7
sys/compat/sys/shm.h: revision 1.8
sys/kern/sysv_shm.c: revision 1.133
sys/compat/sys/sem.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.56
sys/compat/netbsd32/netbsd32_conv.h: revision 1.38
sys/kern/sysv_sem.c: revision 1.96
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.28
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.29
sys/compat/linux32/common/linux32_ipccall.c: revision 1.12
sys/kern/sysv_msg.c: revision 1.73
sys/compat/sys/msg.h: revision 1.6

for sysv ipc stat operations, explicitly copy the exported parts
instead of the whole ds structure.
besides triggering a recently added assert in netbsd32, this stops
exposing kernel addresses.

copy the mode clamping to 0777 from sem to shm and msg.

while here, make sure that the compat callers to sysv_ipc clear
the contents of the compat structure before setting the result
members to ensure padding bytes are cleared.

don't set/copy _sem_base, _msg_first, _msg_last or _shm_internal.
even if used, which seems very dodgy, they leak KVAs as well.
possibly this may affect linux binaries, in particular, the
comments around _shm_internal ("XXX Oh well.") may mean apps
rely upon these but hopefully not -- the comments date back to
rev 1.1 in 1995.

the _key, _seq and _msg_cbytes members are exported as before as
i found multiple consumers of these (no less than ipcs(1), and
they appear to be useful for debugging and more.

XXX: the naming of compat functions have too many styles. there
are at least 3 different ones changed here.

fix naming errors in previous. (this file is no longer compiled, but
this fix makes the pull up more obvious, before deleting this file.)

include libkern.h or strings.h. should fix i386 build issues.
 1.4 25-Nov-2021  ryo add support COMPAT_LINUX32 for aarch64
 1.3 07-Jul-2010  chs many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
- support new-style (NPTL) linux pthreads on all platforms.
clone() with CLONE_THREAD uses 1 process with many LWPs
instead of separate processes.
- move the contents of sys__lwp_setprivate() into a new
lwp_setprivate() and use that everywhere.
- update linux_release[] and linux32_release[] to "2.6.18".
- adjust placement of emul fork/exec/exit hooks as needed
and adjust other emul code to match.
- convert all struct emul definitions to use named initializers.
- change the pid allocator to allow multiple pids to refer to the same proc.
- remove a few fields from struct proc that are no longer needed.
- disable the non-functional "vdso" code in linux32/amd64,
glibc works fine without it.
- fix a race in the futex code where we could miss a wakeup after
a requeue operation.
- redo futex locking to be a little more efficient.
 1.2 04-Dec-2007  dsl branches: 1.2.16; 1.2.36; 1.2.38;
Remove all the __P
 1.1 09-Feb-2006  manu branches: 1.1.2; 1.1.10; 1.1.16; 1.1.22; 1.1.46; 1.1.48; 1.1.54; 1.1.58;
Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.1.58.1 08-Dec-2007  ad Sync with head.
 1.1.54.1 08-Dec-2007  mjf Sync with HEAD.
 1.1.48.1 09-Jan-2008  matt sync with HEAD
 1.1.46.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.1.22.2 09-Sep-2006  rpaulo sync with head
 1.1.22.1 09-Feb-2006  rpaulo file linux32_machdep.h was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:46:03 +0000
 1.1.16.3 07-Dec-2007  yamt sync with head
 1.1.16.2 21-Jun-2006  yamt sync with head.
 1.1.16.1 09-Feb-2006  yamt file linux32_machdep.h was added on branch yamt-lazymbuf on 2006-06-21 14:59:27 +0000
 1.1.10.2 22-Apr-2006  simonb Sync with head.
 1.1.10.1 09-Feb-2006  simonb file linux32_machdep.h was added on branch simonb-timecounters on 2006-04-22 11:38:14 +0000
 1.1.2.2 18-Feb-2006  yamt sync with head.
 1.1.2.1 09-Feb-2006  yamt file linux32_machdep.h was added on branch yamt-uio_vmspace on 2006-02-18 15:39:02 +0000
 1.2.38.1 05-Mar-2011  rmind sync with head
 1.2.36.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.2.16.1 11-Aug-2010  yamt sync with head.
 1.34 25-Nov-2021  ryo add support COMPAT_LINUX32 for aarch64
 1.33 20-Sep-2021  thorpej Add preadv(2) and pwritev(2) system calls to COMPAT_LINUX and COMPAT_LINUX32.
 1.32 20-Sep-2021  thorpej Add the eventfd system calls to COMPAT_LINUX and COMPAT_LINUX32.
 1.31 19-Sep-2021  thorpej Remove redundant linux32_to_native_timespec() prototype.
 1.30 03-May-2020  thorpej branches: 1.30.2;
Always clear FUTEX_PRIVATE_FLAG for Linux processes. NetBSD-native futexes
exist in different namespace depending on FUTEX_PRIVATE_FLAG. This appears
not to be the case in Linux, and some futex users will mix private and non-
private ops on the same futex object. Provide a convenience wrapper that
puts this logic in one place witn a comment explaining why.

While here, move the Linux futex wrapper out of its own file and plop
it in linux_misc.c, which is where it lives in the linux32 module.
 1.29 29-Apr-2020  thorpej Oops, fix a silly mistake in the Linux futex syscall stubs -- we also
copy in the timeout for FUTEX_WAIT_BITSET.
 1.28 26-Apr-2020  thorpej Add a NetBSD native futex implementation, mostly written by riastradh@.
Map the COMPAT_LINUX futex calls to the native ones.
 1.27 23-Aug-2019  maxv Hum, don't forget the 'pid' argument, otherwise we're not gonna go very
far.
 1.26 10-Apr-2017  dholland branches: 1.26.6; 1.26.14; 1.26.18;
Return value pointers should be the last argument.
 1.25 22-Nov-2014  njoly branches: 1.25.2; 1.25.4; 1.25.6;
Add ppoll(2) for compat linux32.
 1.24 09-Nov-2014  maxv Do not uselessly include <sys/malloc.h>.
 1.23 18-Nov-2013  chs branches: 1.23.4;
implement the *at() syscalls.
bring the unimplemented syscall list up to date.
 1.22 18-Nov-2011  christos branches: 1.22.10; 1.22.14;
add sigtimedwait support
 1.21 02-Nov-2010  chs branches: 1.21.8;
personality() now interprets its parameter as having
the base personality type in the low byte and
various flags in the upper bytes. for now just mask off
the flags to make sure the base type is one we accept.
store the current personality in the emuldata so that
we can return the expected value for PER_QUERY.
 1.20 02-Nov-2010  chs implement the following syscalls for linux32:
truncate64
ftruncate64
profil
ioperm
iopl
setdomainname
modify_ldt
statfs64
fstatfs64

note that iopl(), ioperm() and modify_ldt() just call
the respective 64-bit handlers, which don't do anything yet.
 1.19 07-Jul-2010  chs many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
- support new-style (NPTL) linux pthreads on all platforms.
clone() with CLONE_THREAD uses 1 process with many LWPs
instead of separate processes.
- move the contents of sys__lwp_setprivate() into a new
lwp_setprivate() and use that everywhere.
- update linux_release[] and linux32_release[] to "2.6.18".
- adjust placement of emul fork/exec/exit hooks as needed
and adjust other emul code to match.
- convert all struct emul definitions to use named initializers.
- change the pid allocator to allow multiple pids to refer to the same proc.
- remove a few fields from struct proc that are no longer needed.
- disable the non-functional "vdso" code in linux32/amd64,
glibc works fine without it.
- fix a race in the futex code where we could miss a wakeup after
a requeue operation.
- redo futex locking to be a little more efficient.
 1.18 24-Nov-2009  njoly branches: 1.18.2; 1.18.4;
Update personality(2) to match Linux definition where the argument is an
unsigned long.
 1.17 05-Jun-2009  njoly Add fstatfs syscall.
 1.16 20-Jan-2009  njoly branches: 1.16.2;
Add basic support for linux32 personality(2) syscall.
 1.15 19-Nov-2008  ad Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.14 12-Nov-2008  njoly Add missing sys/syscall.h include for SYS_ptrace definition.
 1.13 12-Nov-2008  ad Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.
 1.12 18-Jun-2008  njoly branches: 1.12.2; 1.12.4; 1.12.6;
linux32_sys_ptrace() fixes.
- Add opt_ptrace.h include to activate syscall.
- Convert to use sys_ptrace() instead of netbsd32_ptrace().
- Do not use arch specific call for now.
 1.11 16-Jun-2008  christos an attempt at ptrace32
 1.10 28-Apr-2008  martin branches: 1.10.2; 1.10.4;
Remove clause 3 and 4 from TNF licenses
 1.9 20-Dec-2007  dsl branches: 1.9.6; 1.9.8; 1.9.10;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.8 08-Dec-2007  dsl branches: 1.8.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.7 30-Apr-2007  dsl branches: 1.7.2; 1.7.8; 1.7.10; 1.7.18;
Rework compat stat() and statvfs() code so that it no longer uses the stackgap.
 1.6 22-Apr-2007  dsl Change the way that emulations locate files within the emulation root to
avoid having to allocate space in the 'stackgap'
- which is very LWP unfriendly.
The additional code for non-emulation namei() is trivial, the reduction for
the emulations is massive.
The vnode for a processes emulation root is saved in the cwdi structure
during process exec.
If the emulation root the TRYEMULROOT flag are set, namei() will do an initial
search for absolute pathnames in the emulation root, if that fails it will
retry from the normal root.
".." at the emulation root will always go to the real root, even in the middle
of paths and when expanding symlinks.
Absolute symlinks found using absolute paths in the emulation root will be
relative to the emulation root (so /usr/lib/xxx.so -> /lib/xxx.so links
inside the emulation root don't need changing).
If the root of the emulation would be returned (for an emulation lookup), then
the real root is returned instead (matching the behaviour of emul_lookup,
but being a cheap comparison here) so that programs that scan "../.."
looking for the root dircetory don't loop forever.
The target for symbolic links is no longer mangled (it used to get the
CHECK_ALT_xxx() treatment, so could get /emul/xxx prepended).
CHECK_ALT_xxx() are no more. Most of the change is deleting them, and adding
TRYEMULROOT to the flags to NDINIT().
A lot of the emulation system call stubs could now be deleted.
 1.5 11-Apr-2007  njoly branches: 1.5.4;
- Add compat amd64 linux32 statfs support, adapted from PR/35956.
- Move bsd_to_linux_statfs() function to its own file to be shared
between both linux compats.

ok by manu.
 1.4 13-Sep-2006  manu branches: 1.4.4; 1.4.8;
This file was not used anymore
 1.3 23-Jul-2006  ad branches: 1.3.4; 1.3.6;
Use the LWP cached credentials where sane.
 1.2 14-May-2006  elad branches: 1.2.6;
integrate kauth.
 1.1 09-Feb-2006  manu branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.10;
Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.1.10.3 01-Jun-2006  kardel Sync with head.
 1.1.10.2 22-Apr-2006  simonb Sync with head.
 1.1.10.1 09-Feb-2006  simonb file linux32_misc.c was added on branch simonb-timecounters on 2006-04-22 11:38:14 +0000
 1.1.8.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.1.6.2 10-Mar-2006  elad generic_authorize() -> kauth_authorize_generic().
 1.1.6.1 08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.1.4.3 14-Sep-2006  yamt sync with head.
 1.1.4.2 11-Aug-2006  yamt sync with head
 1.1.4.1 24-May-2006  yamt sync with head.
 1.1.2.2 18-Feb-2006  yamt sync with head.
 1.1.2.1 09-Feb-2006  yamt file linux32_misc.c was added on branch yamt-uio_vmspace on 2006-02-18 15:39:02 +0000
 1.2.6.5 21-Jan-2008  yamt sync with head
 1.2.6.4 03-Sep-2007  yamt sync with head.
 1.2.6.3 30-Dec-2006  yamt sync with head.
 1.2.6.2 21-Jun-2006  yamt sync with head.
 1.2.6.1 14-May-2006  yamt file linux32_misc.c was added on branch yamt-lazymbuf on 2006-06-21 14:59:27 +0000
 1.3.6.2 09-Sep-2006  rpaulo sync with head
 1.3.6.1 23-Jul-2006  rpaulo file linux32_misc.c was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:46:03 +0000
 1.3.4.1 18-Nov-2006  ad Sync with head.
 1.4.8.1 09-Jun-2007  ad Sync with head.
 1.4.4.2 07-May-2007  yamt sync with head.
 1.4.4.1 15-Apr-2007  yamt sync with head.
 1.5.4.2 20-Apr-2007  bouyer Pull up following revision(s) (requested by njoly in ticket #582):
sys/compat/linux32/common/linux32_types.h: revision 1.4 via patch
sys/compat/linux32/arch/amd64/syscalls.master: revision 1.14 via patch
sys/compat/linux/common/linux_statfs.h: revision 1.1 via patch
sys/compat/linux/common/linux_misc.c: revision 1.170 via patch
sys/compat/linux32/common/linux32_misc.c: revision 1.5 via patch
sys/compat/linux32/files.linux32: revision 1.4 via patch
- Add compat amd64 linux32 statfs support, adapted from PR/35956.
- Move bsd_to_linux_statfs() function to its own file to be shared
between both linux compats.
 1.5.4.1 11-Apr-2007  bouyer file linux32_misc.c was added on branch netbsd-4 on 2007-04-20 20:26:03 +0000
 1.7.18.1 26-Dec-2007  ad Sync with head.
 1.7.10.1 09-Jan-2008  matt sync with HEAD
 1.7.8.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.7.2.2 11-Jul-2007  mjf Sync with head.
 1.7.2.1 30-Apr-2007  mjf file linux32_misc.c was added on branch mjf-ufs-trans on 2007-07-11 20:04:23 +0000
 1.8.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.9.10.5 11-Aug-2010  yamt sync with head.
 1.9.10.4 11-Mar-2010  yamt sync with head
 1.9.10.3 20-Jun-2009  yamt sync with head
 1.9.10.2 04-May-2009  yamt sync with head.
 1.9.10.1 16-May-2008  yamt sync with head.
 1.9.8.2 17-Jun-2008  yamt sync with head.
 1.9.8.1 18-May-2008  yamt sync with head.
 1.9.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.9.6.2 29-Jun-2008  mjf Sync with HEAD.
 1.9.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.10.4.2 27-Jun-2008  simonb Sync with head.
 1.10.4.1 18-Jun-2008  simonb Sync with head.
 1.10.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.12.6.1 18-Mar-2015  snj Pull up following revision(s) (requested by joerg in ticket #1149):
sys/compat/linux32/arch/amd64/syscalls.master: revisions 1.52, 1.53 via patch
sys/compat/linux32/common/linux32_misc.c: revision 1.17 via patch
sys/compat/linux32/common/linux32_stat.c: revision 1.14-1.16 via patch
Fix inverted lst_ino/__lst_ino assignment in linux32_from_stat().
--
Cleanup (no functional changes).
Kill some unneeded variables and return stattement.
Rename linux32_from_stat() to better bsd_to_linux32_stat64().
Fix some types.
Add stat/lstat/fstat syscalls.
--
Add fstatfs syscall.
 1.12.4.2 03-Mar-2009  skrll Sync with HEAD.
 1.12.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.12.2.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.16.2.1 23-Jul-2009  jym Sync with HEAD.
 1.18.4.1 05-Mar-2011  rmind sync with head
 1.18.2.2 06-Nov-2010  uebayasi Sync with HEAD.
 1.18.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.21.8.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.21.8.1 17-Apr-2012  yamt sync with head
 1.22.14.1 18-May-2014  rmind sync with head
 1.22.10.2 03-Dec-2017  jdolecek update from HEAD
 1.22.10.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.23.4.2 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1720:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149 (patch)
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54 (patch)

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.23.4.1 17-Jan-2015  martin branches: 1.23.4.1.6;
Pull up following revision(s) (requested by maxv in ticket #427):
sys/compat/svr4/svr4_schedctl.c: revision 1.8
sys/netinet/tcp_timer.c: revision 1.88
sys/miscfs/genfs/layer_vfsops.c: revision 1.45
sys/compat/svr4/svr4_ioctl.c: revision 1.37
sys/ufs/chfs/chfs_vfsops.c: revision 1.14
sys/miscfs/fdesc/fdesc_vfsops.c: revision 1.91
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.30
sys/compat/common/kern_time_50.c: revision 1.28
sys/netinet6/ip6_forward.c: revision 1.74
sys/miscfs/umapfs/umap_vnops.c: revision 1.57
sys/compat/svr4/svr4_fcntl.c: revision 1.74
distrib/sets/lists/comp/mi: revision 1.1931
sys/netinet6/udp6_output.c: revision 1.46
sys/fs/puffs/puffs_compat.c: revision 1.3
sys/fs/udf/udf_rename.c: revision 1.11
sys/compat/svr4/svr4_filio.c: revision 1.24
sys/fs/udf/udf_rename.c: revision 1.12
sys/netinet/tcp_usrreq.c: revision 1.202
sys/miscfs/umapfs/umap_subr.c: revision 1.29
sys/compat/linux/common/linux_fadvise64.c: revision 1.3
sys/netinet/if_atm.c: revision 1.34
sys/miscfs/procfs/procfs_subr.c: revision 1.106
sys/miscfs/genfs/layer_subr.c: revision 1.37
sys/netinet/tcp_sack.c: revision 1.30
sys/compat/freebsd/freebsd_misc.c: revision 1.33
sys/compat/freebsd/freebsd_file.c: revision 1.33
sys/ufs/chfs/chfs_vnode.c: revision 1.12
sys/compat/svr4/svr4_ttold.c: revision 1.34
sys/compat/linux/common/linux_file.c: revision 1.114
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.43
sys/compat/linux/common/linux_signal.c: revision 1.76
sys/compat/common/compat_util.c: revision 1.46
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.18
sys/compat/svr4/svr4_sockio.c: revision 1.36
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.32
sys/compat/svr4/svr4_signal.c: revision 1.66
sys/kern/kern_exec.c: revision 1.410
sys/fs/puffs/puffs_vfsops.c: revision 1.115
sys/compat/svr4/svr4_exec_elf64.c: revision 1.15
sys/compat/linux/arch/i386/linux_machdep.c: revision 1.159
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.50
sys/compat/linux32/common/linux32_misc.c: revision 1.24
sys/netinet/in_pcb.c: revision 1.153
sys/sys/malloc.h: revision 1.116
sys/compat/common/if_43.c: revision 1.9
share/man/man9/Makefile: revision 1.380
sys/netinet/tcp_vtw.c: revision 1.12
sys/miscfs/umapfs/umap_vfsops.c: revision 1.95
sys/ufs/ext2fs/ext2fs_vfsops.c: revision 1.186
sys/compat/common/uipc_syscalls_43.c: revision 1.46
sys/ufs/ext2fs/ext2fs_vnops.c: revision 1.115
sys/fs/puffs/puffs_msgif.c: revision 1.97
sys/compat/svr4/svr4_ipc.c: revision 1.27
sys/compat/linux/common/linux_exec.c: revision 1.117
sys/ufs/ext2fs/ext2fs_readwrite.c: revision 1.66
sys/netinet/tcp_output.c: revision 1.179
sys/compat/svr4/svr4_termios.c: revision 1.28
sys/fs/udf/udf_strat_bootstrap.c: revision 1.4
sys/fs/puffs/puffs_subr.c: revision 1.67
sys/fs/puffs/puffs_node.c: revision 1.36
sys/miscfs/overlay/overlay_vnops.c: revision 1.21
sys/fs/cd9660/cd9660_node.c: revision 1.34
sys/netinet/raw_ip.c: revision 1.146
sys/sys/mallocvar.h: revision 1.13
sys/miscfs/overlay/overlay_vfsops.c: revision 1.63
share/man/man9/malloc.9: revision 1.50
sys/netinet6/dest6.c: revision 1.18
sys/compat/linux/common/linux_uselib.c: revision 1.33
sys/compat/linux/common/linux_socket.c: revision 1.120
share/man/man9/malloc.9: revision 1.51
sys/netinet/tcp_subr.c: revision 1.257
sys/compat/linux/common/linux_socketcall.c: revision 1.45
sys/compat/linux/common/linux_fadvise64_64.c: revision 1.3
sys/compat/freebsd/freebsd_ipc.c: revision 1.17
sys/compat/linux/common/linux_misc_notalpha.c: revision 1.109
sys/compat/linux/arch/alpha/linux_pipe.c: revision 1.17
sys/netinet6/in6_pcb.c: revision 1.132
sys/netinet6/in6_ifattach.c: revision 1.94
sys/compat/svr4/svr4_exec_elf32.c: revision 1.15
sys/miscfs/nullfs/null_vfsops.c: revision 1.90
sys/fs/cd9660/cd9660_util.c: revision 1.12
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.48
sys/compat/freebsd/freebsd_exec_elf32.c: revision 1.20
sys/miscfs/procfs/procfs_vfsops.c: revision 1.94
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.28
sys/compat/linux/common/linux_sched.c: revision 1.67
sys/compat/linux/common/linux_exec_aout.c: revision 1.67
sys/compat/linux/common/linux_pipe.c: revision 1.67
sys/compat/linux/common/linux_llseek.c: revision 1.34
sys/compat/linux/arch/mips/linux_ptrace.c: revision 1.10
Do not uselessly include <sys/malloc.h>.
Cleanup:
- remove struct kmembuckets (dead)
- correctly deadify MALLOC_XX
- remove MALLOC_DEFINE_LIMIT and MALLOC_JUSTDEFINE_LIMIT (dead)
- remove malloc_roundup(), malloc_type_setlimit(), MALLOC_DEFINE_LIMIT()
and MALLOC_JUSTDEFINE_LIMIT() from man 9 malloc
New sentence, new line. Bump date for previous.
Obsolete malloc_roundup(9), malloc_type_setlimit(9) and MALLOC_DEFINE_LIMIT(9)
man pages.
 1.23.4.1.6.1 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1720:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149 (patch)
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54 (patch)

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.25.6.1 21-Apr-2017  bouyer Sync with HEAD
 1.25.4.1 26-Apr-2017  pgoyette Sync with HEAD
 1.25.2.1 28-Aug-2017  skrll Sync with HEAD
 1.26.18.1 13-Sep-2019  martin Pull up following revision(s) (requested by maxv in ticket #194):

sys/compat/linux/common/linux_socket.c: revision 1.146
sys/compat/linux/common/linux_socket.c: revision 1.147
sys/compat/linux/common/linux_socket.c: revision 1.148
sys/compat/linux/common/linux_socket.c: revision 1.149
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.59
sys/compat/linux32/common/linux32_sysinfo.c: revision 1.8
sys/kern/sysv_shm.c: revision 1.138
sys/compat/linux/common/linux_file64.c: revision 1.61
sys/compat/linux/common/linux_file64.c: revision 1.62
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.58
sys/compat/linux32/common/linux32_dirent.c: revision 1.20
sys/compat/linux32/common/linux32_utsname.c: revision 1.10
sys/compat/linux/common/linux_termios.h: revision 1.22
sys/compat/linux32/common/linux32_termios.c: revision 1.15
sys/compat/linux32/common/linux32_misc.c: revision 1.27
sys/compat/linux32/common/linux32_ioctl.c: revision 1.14
sys/compat/linux/common/linux_statfs.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.57
sys/compat/linux/common/linux_fcntl.h: revision 1.18
sys/compat/linux/common/linux_socket.h: revision 1.24
sys/sys/shm.h: revision 1.54
sys/compat/ossaudio/ossaudio.c: revision 1.75
sys/compat/linux32/common/linux32_signal.c: revision 1.20
sys/miscfs/procfs/procfs_linux.c: revision 1.75
sys/compat/linux/common/linux_signal.c: revision 1.81
sys/compat/linux/common/linux_termios.c: revision 1.38
sys/compat/linux/common/linux_misc.c: revision 1.241
sys/compat/linux/common/linux_misc.c: revision 1.242
sys/compat/linux/common/linux_misc.c: revision 1.243
sys/compat/linux/common/linux_misc.c: revision 1.244

Fix info leaks.

Fix stupid bugs in linux_sys_shmctl(): the index could be out of bound
(page fault) and there was no proper locking.
Maybe we should just remove LINUX_SHM_STAT, like compat_linux32.

Remove printf.

When dealing with an unknown value, set -1, to prevent (harmless)
uninitialized accesses later.

Add a default case, don't call sys_ioctl() with an uninitialized 'com'
argument.

Fix error handling, returns an errno, not -1.

Put the printf under DEBUG_LINUX.


Hum, don't forget the 'pid' argument, otherwise we're not gonna go very
far.

Don't read data from userland directly. This simply does not work on any
recent x86 CPU (thanks to SMAP) and all architectures that forbid direct
access to userland from the kernel. But I guess no one noticed because no
one ever uses compat_linux, right?

Hum, don't pass an mbuf to realloc(). Inspired from copyin32_msg_control().

Fix memory leak.

I don't see the point in having this useless printf, but add a '\n' to it,
so that it at least displays useless stuff correctly.

Hum, remove incorrect assignment. Userland could have passed a smaller
namelen, and the uninitialized bytes from sb_data were being used later in
the network stack.
 1.26.14.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.26.6.1 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1487:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.30.2.3 03-Jan-2021  thorpej Add preadv(2) and pwritev(2).
 1.30.2.2 17-Dec-2020  thorpej Remove a redundant prototype.
 1.30.2.1 16-Dec-2020  thorpej Add eventfd glue to COMPAT_LINUX32.
 1.8 19-Nov-2008  ad Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.7 27-Mar-2008  njoly branches: 1.7.4; 1.7.6; 1.7.10; 1.7.12;
Be sure to not include linux_mmap.h before linux_syscallargs.h.
Otherwise wrong syscallarg macro may used for linux_sys_mmap_args
definition.
This makes mmap2 works again (at least to launch oo2 binary).
 1.6 20-Dec-2007  dsl branches: 1.6.6;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.5 08-Dec-2007  dsl branches: 1.5.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.4 31-Oct-2007  njoly branches: 1.4.4;
Remove extra return
 1.3 09-Feb-2007  ad branches: 1.3.18; 1.3.20; 1.3.24;
Merge newlock2 to head.
 1.2 13-Sep-2006  manu Jumbo COMPAT_LINUX/COMPAT_LINUX32 bugfix, with the help of Nicolas Joly
- Fix shmat return value on amd64: it uses no black magic with retval[0]
- Fix integer overflows in sysinfo
- Implement sysinfo, mmap2, sched_getparam, sched_getscheduler, mremap,
and madvise in COMPAT_LINUX32
- Fix improper types used in setgroups16/getgroups16
- Implement mmap2 for COMPAT_LINUX32
- Ifdef debug messages by DEBUG_LINUX
 1.1 09-Feb-2006  manu branches: 1.1.2; 1.1.4; 1.1.10; 1.1.16; 1.1.20; 1.1.22;
Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.1.22.2 09-Sep-2006  rpaulo sync with head
 1.1.22.1 09-Feb-2006  rpaulo file linux32_mman.c was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:46:03 +0000
 1.1.20.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.1.20.1 18-Nov-2006  ad Sync with head.
 1.1.16.6 21-Jan-2008  yamt sync with head
 1.1.16.5 15-Nov-2007  yamt sync with head.
 1.1.16.4 26-Feb-2007  yamt sync with head.
 1.1.16.3 30-Dec-2006  yamt sync with head.
 1.1.16.2 21-Jun-2006  yamt sync with head.
 1.1.16.1 09-Feb-2006  yamt file linux32_mman.c was added on branch yamt-lazymbuf on 2006-06-21 14:59:27 +0000
 1.1.10.2 22-Apr-2006  simonb Sync with head.
 1.1.10.1 09-Feb-2006  simonb file linux32_mman.c was added on branch simonb-timecounters on 2006-04-22 11:38:14 +0000
 1.1.4.1 14-Sep-2006  yamt sync with head.
 1.1.2.2 18-Feb-2006  yamt sync with head.
 1.1.2.1 09-Feb-2006  yamt file linux32_mman.c was added on branch yamt-uio_vmspace on 2006-02-18 15:39:02 +0000
 1.3.24.1 13-Nov-2007  bouyer Sync with HEAD
 1.3.20.2 09-Jan-2008  matt sync with HEAD
 1.3.20.1 06-Nov-2007  matt sync with HEAD
 1.3.18.2 09-Dec-2007  jmcneill Sync with HEAD.
 1.3.18.1 31-Oct-2007  joerg Sync with HEAD.
 1.4.4.1 26-Dec-2007  ad Sync with head.
 1.5.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.6.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.6.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.7.12.1 19-Jan-2009  skrll Sync with HEAD.
 1.7.10.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.7.6.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.7.6.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.7.4.1 04-May-2009  yamt sync with head.
 1.15 25-Nov-2021  ryo The default name of the `exec_setup_stack' function for linux32 should be `linux32_exec_setup_stack',
and it should be defined in each arch.
declaration of linux32_exec_setup_stack() in linux32/amd64 has been removed because it does not exist.

NFC.
 1.14 21-Mar-2020  pgoyette Deal with having to teardown sysctl entries in multiple sub-trees.

(This used to work, but I broke it recently.)
 1.13 16-Mar-2020  pgoyette Use the module subsystem's ability to process SYSCTL_SETUP() entries to
automate installation of sysctl nodes.

Note that there are still a number of device and pseudo-device modules
that create entries tied to individual device units, rather than to the
module itself. These are not changed.
 1.12 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.11 10-Dec-2017  kre branches: 1.11.2; 1.11.4;

Finally (hopefully) return completely to the state where compat_linux is
enabled by default.

While here make it possible to enable this if already enabled, or disable
if already disabled, without error. Some minor KNF.
 1.10 08-Dec-2017  kre Finish the previous change - as well as setting the default for these
compat modules back to enabled, stop forcing it to switch back to
disabled any time the module is init'd (which is truly barbaric behaviour.)
 1.9 01-Dec-2017  joerg Unbreak Linux emulation by default. While not loading it automatically
is somewhat sensible, breaking functionality of GENERIC is not and has
been objected to on a regular base.
 1.8 29-Sep-2017  maxv Remove compat_linux32 from the autoload list and add a enable/disable
sysctl, like compat_linux.
 1.7 03-Dec-2015  pgoyette Update dependencies - compat_linux32 requires compat_netbsd32_sysvipc
 1.6 22-Jul-2014  maxv branches: 1.6.4;
1) On 64bit systems, don't add the 32bit execsw[] to the global exec array.
exec_elf32 works on 32bit systems only, and will crash 32bit binaries on
64bit systems.
2) Now that exec_elf32 is dormant, we can give the native ELF loaders the
highest priority.

Binaries will load faster now (system boot, compilation, etc.).

With the help of njloy@. Discussed a bit on tech-kern@, no disagreement.
 1.5 07-Mar-2014  christos branches: 1.5.2;
c99 initializers for struct execsw
 1.4 19-Sep-2013  christos exec modules need to be of the exec kind
 1.3 07-Jul-2010  chs branches: 1.3.8; 1.3.18; 1.3.22;
many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
- support new-style (NPTL) linux pthreads on all platforms.
clone() with CLONE_THREAD uses 1 process with many LWPs
instead of separate processes.
- move the contents of sys__lwp_setprivate() into a new
lwp_setprivate() and use that everywhere.
- update linux_release[] and linux32_release[] to "2.6.18".
- adjust placement of emul fork/exec/exit hooks as needed
and adjust other emul code to match.
- convert all struct emul definitions to use named initializers.
- change the pid allocator to allow multiple pids to refer to the same proc.
- remove a few fields from struct proc that are no longer needed.
- disable the non-functional "vdso" code in linux32/amd64,
glibc works fine without it.
- fix a race in the futex code where we could miss a wakeup after
a requeue operation.
- redo futex locking to be a little more efficient.
 1.2 03-Dec-2008  ad branches: 1.2.4; 1.2.6; 1.2.8; 1.2.12; 1.2.14; 1.2.16;
PR port-amd64/40091 compat_linux32 module loading = panic due to missing syms
 1.1 19-Nov-2008  ad Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.2.16.1 05-Mar-2011  rmind sync with head
 1.2.14.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.2.12.3 11-Aug-2010  yamt sync with head.
 1.2.12.2 04-May-2009  yamt sync with head.
 1.2.12.1 03-Dec-2008  yamt file linux32_mod.c was added on branch yamt-nfs-mp on 2009-05-04 08:12:23 +0000
 1.2.8.2 19-Jan-2009  skrll Sync with HEAD.
 1.2.8.1 03-Dec-2008  skrll file linux32_mod.c was added on branch nick-hppapmap on 2009-01-19 13:17:32 +0000
 1.2.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.2.6.1 03-Dec-2008  mjf file linux32_mod.c was added on branch mjf-devfs2 on 2009-01-17 13:28:45 +0000
 1.2.4.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.2.4.1 03-Dec-2008  haad file linux32_mod.c was added on branch haad-dm on 2008-12-13 01:13:57 +0000
 1.3.22.1 18-May-2014  rmind sync with head
 1.3.18.2 03-Dec-2017  jdolecek update from HEAD
 1.3.18.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.3.8.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.5.2.1 10-Aug-2014  tls Rebase.
 1.6.4.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.11.4.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.11.4.1 10-Jun-2019  christos Sync with HEAD
 1.11.2.5 24-Jan-2019  pgoyette Restore the MD-vs-REQ requirements structure, just in case
 1.11.2.4 24-Jan-2019  pgoyette Clean up and reorganize the requirements for compat_linux32 module
 1.11.2.3 12-Sep-2018  pgoyette Typo - missing trailing quote
 1.11.2.2 12-Sep-2018  pgoyette Adjust module requirements to reflect the new more granular modules
 1.11.2.1 11-Mar-2018  pgoyette Update module dependencies
 1.13 02-Dec-2021  ryo add prlimit64(2) syscall to COMPAT_LINUX and COMPAT_LINUX32
 1.12 07-Sep-2021  riastradh sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.11 22-Sep-2012  joerg branches: 1.11.30; 1.11.42;
LINUX_RLIM_INFINITY doesn't fit into the value range for linux32, so
introduce a variant with correct value.
 1.10 19-Nov-2008  ad branches: 1.10.16; 1.10.26;
Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.9 22-Sep-2008  njoly branches: 1.9.2;
Kill a few linux32 syscalls identical to netbsd32 ones.
No functional changes expected.
 1.8 20-Dec-2007  dsl branches: 1.8.6; 1.8.10; 1.8.12; 1.8.16;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.7 08-Dec-2007  dsl branches: 1.7.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.6 12-May-2007  dsl branches: 1.6.6; 1.6.8; 1.6.16;
There is no need to use the stackgap for get/setrlimit.
 1.5 18-Mar-2007  dsl Change all the NETBSD32PTR64(SCARG(uap, xxx))) to SCARG_P32(uap, xxx).
 1.4 04-Mar-2007  christos branches: 1.4.2; 1.4.4; 1.4.6;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.3 09-Feb-2007  ad branches: 1.3.2;
Merge newlock2 to head.
 1.2 25-Jun-2006  manu branches: 1.2.4; 1.2.6;
- Complete exit_group() implementation. We now maintain a list of Linux
threads in a processes and kill them properly. The code is a bit too
complicated, but I could not find a simplier way of dealing with it

- Change getpid() and getppid() semantics to match what Linux does,
and implement gettid(). In the Linux kernel, threads are implemnted
as plain old processes. A thread group is just a set of processes,
with the parent called leader. Thread ID, which are returned by gettid(),
are just the PID of the plain old processes, and getpid() returns the
PID of the thread group leader.

- Remove struct linux32_emuldata. COMPAT_LINUX32 uses a lot of COMPAT_LINUX
code, where a struct linux_emuldata is assumed. By having distinct emuldata
structure with different sizes and layouts, we caused kernel memory
corruptions.

- Fix setprioriry() and getpriority()

Thanks to Nicolas Joly for tracking down the problem and providing me the
hardware to fix them.
 1.1 09-Feb-2006  manu branches: 1.1.2; 1.1.4; 1.1.10; 1.1.14; 1.1.16;
Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.1.16.6 21-Jan-2008  yamt sync with head
 1.1.16.5 03-Sep-2007  yamt sync with head.
 1.1.16.4 26-Feb-2007  yamt sync with head.
 1.1.16.3 30-Dec-2006  yamt sync with head.
 1.1.16.2 21-Jun-2006  yamt sync with head.
 1.1.16.1 09-Feb-2006  yamt file linux32_resource.c was added on branch yamt-lazymbuf on 2006-06-21 14:59:27 +0000
 1.1.14.1 13-Jul-2006  gdamore Merge from HEAD.
 1.1.10.2 22-Apr-2006  simonb Sync with head.
 1.1.10.1 09-Feb-2006  simonb file linux32_resource.c was added on branch simonb-timecounters on 2006-04-22 11:38:14 +0000
 1.1.4.1 26-Jun-2006  yamt sync with head.
 1.1.2.2 18-Feb-2006  yamt sync with head.
 1.1.2.1 09-Feb-2006  yamt file linux32_resource.c was added on branch yamt-uio_vmspace on 2006-02-18 15:39:02 +0000
 1.2.6.2 09-Sep-2006  rpaulo sync with head
 1.2.6.1 25-Jun-2006  rpaulo file linux32_resource.c was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:46:03 +0000
 1.2.4.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.3.2.3 17-May-2007  yamt sync with head.
 1.3.2.2 24-Mar-2007  yamt sync with head.
 1.3.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.4.6.1 29-Mar-2007  reinoud Pullup to -current
 1.4.4.1 11-Jul-2007  mjf Sync with head.
 1.4.2.2 27-May-2007  ad Sync with head.
 1.4.2.1 10-Apr-2007  ad Sync with head.
 1.6.16.1 26-Dec-2007  ad Sync with head.
 1.6.8.1 09-Jan-2008  matt sync with HEAD
 1.6.6.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.7.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.8.16.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.8.16.1 19-Oct-2008  haad Sync with HEAD.
 1.8.12.3 10-Oct-2008  skrll Sync with HEAD.
 1.8.12.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.8.12.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.8.10.1 04-May-2009  yamt sync with head.
 1.8.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.8.6.1 28-Sep-2008  mjf Sync with HEAD.
 1.9.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.10.26.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.10.16.1 30-Oct-2012  yamt sync with head
 1.11.42.1 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.11.30.1 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1836):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.9 07-Jul-2010  chs many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
- support new-style (NPTL) linux pthreads on all platforms.
clone() with CLONE_THREAD uses 1 process with many LWPs
instead of separate processes.
- move the contents of sys__lwp_setprivate() into a new
lwp_setprivate() and use that everywhere.
- update linux_release[] and linux32_release[] to "2.6.18".
- adjust placement of emul fork/exec/exit hooks as needed
and adjust other emul code to match.
- convert all struct emul definitions to use named initializers.
- change the pid allocator to allow multiple pids to refer to the same proc.
- remove a few fields from struct proc that are no longer needed.
- disable the non-functional "vdso" code in linux32/amd64,
glibc works fine without it.
- fix a race in the futex code where we could miss a wakeup after
a requeue operation.
- redo futex locking to be a little more efficient.
 1.8 01-Dec-2008  njoly branches: 1.8.6; 1.8.8;
Add sched_get_priority_{min,max} syscalls.
 1.7 19-Nov-2008  ad Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.6 20-Dec-2007  dsl branches: 1.6.6; 1.6.10; 1.6.12; 1.6.16; 1.6.18;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.5 08-Dec-2007  dsl branches: 1.5.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.4 07-Nov-2007  njoly branches: 1.4.2;
Remove remaining 64-bit compat linux syscalls linux_sys_xxx() (except
for ones without arguments), and replace them by their 32-bit
equivalent linux32_sys_xxxx().
 1.3 09-Feb-2007  ad branches: 1.3.18; 1.3.20; 1.3.24; 1.3.26;
Merge newlock2 to head.
 1.2 13-Sep-2006  manu Jumbo COMPAT_LINUX/COMPAT_LINUX32 bugfix, with the help of Nicolas Joly
- Fix shmat return value on amd64: it uses no black magic with retval[0]
- Fix integer overflows in sysinfo
- Implement sysinfo, mmap2, sched_getparam, sched_getscheduler, mremap,
and madvise in COMPAT_LINUX32
- Fix improper types used in setgroups16/getgroups16
- Implement mmap2 for COMPAT_LINUX32
- Ifdef debug messages by DEBUG_LINUX
 1.1 09-Feb-2006  manu branches: 1.1.2; 1.1.4; 1.1.10; 1.1.16; 1.1.20; 1.1.22;
Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.1.22.2 09-Sep-2006  rpaulo sync with head
 1.1.22.1 09-Feb-2006  rpaulo file linux32_sched.c was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:46:03 +0000
 1.1.20.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.1.20.1 18-Nov-2006  ad Sync with head.
 1.1.16.6 21-Jan-2008  yamt sync with head
 1.1.16.5 15-Nov-2007  yamt sync with head.
 1.1.16.4 26-Feb-2007  yamt sync with head.
 1.1.16.3 30-Dec-2006  yamt sync with head.
 1.1.16.2 21-Jun-2006  yamt sync with head.
 1.1.16.1 09-Feb-2006  yamt file linux32_sched.c was added on branch yamt-lazymbuf on 2006-06-21 14:59:27 +0000
 1.1.10.2 22-Apr-2006  simonb Sync with head.
 1.1.10.1 09-Feb-2006  simonb file linux32_sched.c was added on branch simonb-timecounters on 2006-04-22 11:38:14 +0000
 1.1.4.1 14-Sep-2006  yamt sync with head.
 1.1.2.2 18-Feb-2006  yamt sync with head.
 1.1.2.1 09-Feb-2006  yamt file linux32_sched.c was added on branch yamt-uio_vmspace on 2006-02-18 15:39:02 +0000
 1.3.26.2 27-Dec-2007  mjf Sync with HEAD.
 1.3.26.1 19-Nov-2007  mjf Sync with HEAD.
 1.3.24.1 13-Nov-2007  bouyer Sync with HEAD
 1.3.20.2 09-Jan-2008  matt sync with HEAD
 1.3.20.1 08-Nov-2007  matt sync with -HEAD
 1.3.18.2 09-Dec-2007  jmcneill Sync with HEAD.
 1.3.18.1 11-Nov-2007  joerg Sync with HEAD.
 1.4.2.1 26-Dec-2007  ad Sync with head.
 1.5.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.6.18.1 19-Jan-2009  skrll Sync with HEAD.
 1.6.16.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.6.12.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.6.12.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.6.10.2 11-Aug-2010  yamt sync with head.
 1.6.10.1 04-May-2009  yamt sync with head.
 1.6.6.1 17-Jan-2009  mjf Sync with HEAD.
 1.8.8.1 05-Mar-2011  rmind sync with head
 1.8.6.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.3 19-Sep-2021  thorpej Add the POSIX timer syscalls (timer_create(), timer_settime(), timer_gettime(),
timer_getoverrun(), and timer_delete()) to COMPAT_LINUX and COMPAT_LINUX32.
 1.2 19-Sep-2021  thorpej G/C some unused (and unnecessary) definitions.
 1.1 18-Nov-2011  christos branches: 1.1.8; 1.1.66;
add sigtimedwait support
 1.1.66.1 17-Dec-2020  thorpej Add POSIX timer and timerfd support to COMPAT_LINUX32.
 1.1.8.2 17-Apr-2012  yamt sync with head
 1.1.8.1 18-Nov-2011  yamt file linux32_sched.h was added on branch yamt-pagecache on 2012-04-17 00:07:19 +0000
 1.1 20-May-2008  njoly branches: 1.1.2; 1.1.4; 1.1.8; 1.1.22;
Add compat linux32 ipc(2) syscall support, for shared memory and
semaphores.
 1.1.22.2 04-May-2009  yamt sync with head.
 1.1.22.1 20-May-2008  yamt file linux32_sem.h was added on branch yamt-nfs-mp on 2009-05-04 08:12:23 +0000
 1.1.8.2 23-Jun-2008  wrstuden Add files to branch that were added on -current.

After this, all that's left of update is to merge some changes
that had conflicts.
 1.1.8.1 20-May-2008  wrstuden file linux32_sem.h was added on branch wrstuden-revivesa on 2008-06-23 05:02:13 +0000
 1.1.4.2 04-Jun-2008  yamt sync with head
 1.1.4.1 20-May-2008  yamt file linux32_sem.h was added on branch yamt-pf42 on 2008-06-04 02:05:05 +0000
 1.1.2.2 02-Jun-2008  mjf Sync with HEAD.
 1.1.2.1 20-May-2008  mjf file linux32_sem.h was added on branch mjf-devfs2 on 2008-06-02 13:23:04 +0000
 1.1 20-May-2008  njoly branches: 1.1.2; 1.1.4; 1.1.8; 1.1.22;
Add compat linux32 ipc(2) syscall support, for shared memory and
semaphores.
 1.1.22.2 04-May-2009  yamt sync with head.
 1.1.22.1 20-May-2008  yamt file linux32_shm.h was added on branch yamt-nfs-mp on 2009-05-04 08:12:23 +0000
 1.1.8.2 23-Jun-2008  wrstuden Add files to branch that were added on -current.

After this, all that's left of update is to merge some changes
that had conflicts.
 1.1.8.1 20-May-2008  wrstuden file linux32_shm.h was added on branch wrstuden-revivesa on 2008-06-23 05:02:13 +0000
 1.1.4.2 04-Jun-2008  yamt sync with head
 1.1.4.1 20-May-2008  yamt file linux32_shm.h was added on branch yamt-pf42 on 2008-06-04 02:05:05 +0000
 1.1.2.2 02-Jun-2008  mjf Sync with HEAD.
 1.1.2.1 20-May-2008  mjf file linux32_shm.h was added on branch mjf-devfs2 on 2008-06-02 13:23:04 +0000
 1.2 19-Sep-2021  thorpej Add routines to convert from linux32 to native sigevent_t.
 1.1 17-Dec-2020  thorpej branches: 1.1.2;
file linux32_sigevent.h was initially added on branch thorpej-futex.
 1.1.2.1 17-Dec-2020  thorpej Add sigevent mapping for Linux-32 compat.
 1.2 25-Nov-2021  ryo add support COMPAT_LINUX32 for aarch64
 1.1 18-Nov-2011  christos branches: 1.1.8; 1.1.66;
add sigtimedwait support
 1.1.66.1 17-Dec-2020  thorpej Add sigevent mapping for Linux-32 compat.
 1.1.8.2 17-Apr-2012  yamt sync with head
 1.1.8.1 18-Nov-2011  yamt file linux32_siginfo.h was added on branch yamt-pagecache on 2012-04-17 00:07:19 +0000
 1.24 26-Nov-2021  christos Remove #error, fixes the build. I don't understand why this would not work
on big endian. We use this construct to convert pointers everywhere else.
 1.23 01-Nov-2021  thorpej Use "stack_t" instead of "struct sigaltstack", as the former is the
newer standardized name. NFC.
 1.22 19-Sep-2021  thorpej Add routines to convert from linux32 to native sigevent_t.
 1.21 07-Sep-2021  riastradh sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.20 23-Aug-2019  maxv branches: 1.20.8;
Fix info leaks in sigaltstack.
 1.19 07-Jan-2018  christos branches: 1.19.4; 1.19.8;
ignore signal 64 for now (go uses it)
XXX: pullup-8
 1.18 08-Mar-2015  christos branches: 1.18.10;
fix inconsistent names
 1.17 18-Nov-2013  chs branches: 1.17.4; 1.17.6; 1.17.12;
implement the *at() syscalls.
bring the unimplemented syscall list up to date.
 1.16 10-May-2012  christos branches: 1.16.2; 1.16.4;
Fix rt_sigtimedwait():
It is wishful thinking that:
1. declaring a 32 bit syscall with 64 bit pointers
2. passing a struct with 32 bit pointers to a 64 bit function
is going to work.
 1.15 18-Nov-2011  christos branches: 1.15.4; 1.15.6;
remove incorrect assertions (the len passed is the size of the bsd structure
not the linux one)
 1.14 18-Nov-2011  christos add sigtimedwait support
 1.13 08-Jun-2009  njoly branches: 1.13.12;
Add rt_queueinfo(2) support.
 1.12 02-Jun-2009  njoly Add siggetmask/sigsetmask syscalls.
 1.11 18-Mar-2009  cegger bzero -> memset
 1.10 20-Jan-2009  christos branches: 1.10.2;
add some debugging.
 1.9 24-Jul-2008  njoly branches: 1.9.2;
Add rt_sigpending syscall.
 1.8 24-Apr-2008  ad branches: 1.8.2; 1.8.4; 1.8.6; 1.8.8;
Merge proc::p_mutex and proc::p_smutex into a single adaptive mutex, since
we no longer need to guard against access from hardware interrupt handlers.

Additionally, if cloning a process with CLONE_SIGHAND, arrange to have the
child process share the parent's lock so that signal state may be kept in
sync. Partially addresses PR kern/37437.
 1.7 20-Dec-2007  dsl branches: 1.7.6; 1.7.8;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.6 11-Dec-2007  lukem use __KERNEL_RCSID()
 1.5 08-Dec-2007  dsl branches: 1.5.2; 1.5.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.4 18-Mar-2007  dsl branches: 1.4.8; 1.4.10; 1.4.18;
Change all the NETBSD32PTR64(SCARG(uap, xxx))) to SCARG_P32(uap, xxx).
 1.3 16-Mar-2007  dsl remove all the double (and triple) casts used to convert 32bit userspace
pointers to and from 64bit kernel pointers. Instead use the defines
NETBSD32PTR64(p32) to read a 32bit pointer and (the new) NETBSD32PTR32(p32,p64)
to write a 32bit pointer throughout.
The 32bit pointer is now a struct to enforce the above.
amd64 (with linux emul) and sparc64 will both compile (when the arch stuff
goes in soon), and amd64 still runs some i386 binaries.
 1.2 15-Feb-2007  ad branches: 1.2.2; 1.2.6; 1.2.8; 1.2.10;
Fix COMPAT_LINUX32.
 1.1 09-Feb-2006  manu branches: 1.1.2; 1.1.10; 1.1.16; 1.1.22;
Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.1.22.2 09-Sep-2006  rpaulo sync with head
 1.1.22.1 09-Feb-2006  rpaulo file linux32_signal.c was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:46:03 +0000
 1.1.16.5 21-Jan-2008  yamt sync with head
 1.1.16.4 03-Sep-2007  yamt sync with head.
 1.1.16.3 26-Feb-2007  yamt sync with head.
 1.1.16.2 21-Jun-2006  yamt sync with head.
 1.1.16.1 09-Feb-2006  yamt file linux32_signal.c was added on branch yamt-lazymbuf on 2006-06-21 14:59:27 +0000
 1.1.10.2 22-Apr-2006  simonb Sync with head.
 1.1.10.1 09-Feb-2006  simonb file linux32_signal.c was added on branch simonb-timecounters on 2006-04-22 11:38:14 +0000
 1.1.2.2 18-Feb-2006  yamt sync with head.
 1.1.2.1 09-Feb-2006  yamt file linux32_signal.c was added on branch yamt-uio_vmspace on 2006-02-18 15:39:02 +0000
 1.2.10.2 29-Mar-2007  reinoud Pullup to -current
 1.2.10.1 18-Mar-2007  reinoud First attempt to bring branch in sync with HEAD
 1.2.8.1 11-Jul-2007  mjf Sync with head.
 1.2.6.1 10-Apr-2007  ad Sync with head.
 1.2.2.1 24-Mar-2007  yamt sync with head.
 1.4.18.1 26-Dec-2007  ad Sync with head.
 1.4.10.1 09-Jan-2008  matt sync with HEAD
 1.4.8.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.5.4.2 02-Jan-2008  bouyer Sync with HEAD
 1.5.4.1 13-Dec-2007  bouyer Sync with HEAD
 1.5.2.1 13-Dec-2007  yamt sync with head.
 1.7.8.1 18-May-2008  yamt sync with head.
 1.7.6.2 28-Sep-2008  mjf Sync with HEAD.
 1.7.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.8.8.1 19-Oct-2008  haad Sync with HEAD.
 1.8.6.1 28-Jul-2008  simonb Sync with head.
 1.8.4.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.8.2.2 20-Jun-2009  yamt sync with head
 1.8.2.1 04-May-2009  yamt sync with head.
 1.9.2.2 28-Apr-2009  skrll Sync with HEAD.
 1.9.2.1 03-Mar-2009  skrll Sync with HEAD.
 1.10.2.2 23-Jul-2009  jym Sync with HEAD.
 1.10.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.13.12.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.13.12.2 23-May-2012  yamt sync with head.
 1.13.12.1 17-Apr-2012  yamt sync with head
 1.15.6.1 19-May-2012  riz Pull up following revision(s) (requested by christos in ticket #263):
sys/compat/linux32/arch/amd64/linux32_syscallargs.h: revision 1.66
sys/compat/linux32/arch/amd64/syscalls.master: revision 1.61
sys/compat/linux32/common/linux32_signal.c: revision 1.16
sys/compat/linux32/arch/amd64/linux32_syscall.h: revision 1.66
sys/compat/linux32/arch/amd64/linux32_sysent.c: revision 1.66
sys/compat/linux32/arch/amd64/linux32_syscalls.c: revision 1.66
regen
Fix rt_sigtimedwait():
It is wishful thinking that:
1. declaring a 32 bit syscall with 64 bit pointers
2. passing a struct with 32 bit pointers to a 64 bit function
is going to work.
 1.15.4.1 02-Jun-2012  mrg sync to latest -current.
 1.16.4.1 18-May-2014  rmind sync with head
 1.16.2.2 03-Dec-2017  jdolecek update from HEAD
 1.16.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.17.12.1 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1720:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149 (patch)
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54 (patch)

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.17.6.1 06-Apr-2015  skrll Sync with HEAD
 1.17.4.1 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1720:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149 (patch)
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54 (patch)

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.18.10.2 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1836):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.18.10.1 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1487:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.19.8.2 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.19.8.1 13-Sep-2019  martin Pull up following revision(s) (requested by maxv in ticket #194):

sys/compat/linux/common/linux_socket.c: revision 1.146
sys/compat/linux/common/linux_socket.c: revision 1.147
sys/compat/linux/common/linux_socket.c: revision 1.148
sys/compat/linux/common/linux_socket.c: revision 1.149
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.59
sys/compat/linux32/common/linux32_sysinfo.c: revision 1.8
sys/kern/sysv_shm.c: revision 1.138
sys/compat/linux/common/linux_file64.c: revision 1.61
sys/compat/linux/common/linux_file64.c: revision 1.62
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.58
sys/compat/linux32/common/linux32_dirent.c: revision 1.20
sys/compat/linux32/common/linux32_utsname.c: revision 1.10
sys/compat/linux/common/linux_termios.h: revision 1.22
sys/compat/linux32/common/linux32_termios.c: revision 1.15
sys/compat/linux32/common/linux32_misc.c: revision 1.27
sys/compat/linux32/common/linux32_ioctl.c: revision 1.14
sys/compat/linux/common/linux_statfs.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.57
sys/compat/linux/common/linux_fcntl.h: revision 1.18
sys/compat/linux/common/linux_socket.h: revision 1.24
sys/sys/shm.h: revision 1.54
sys/compat/ossaudio/ossaudio.c: revision 1.75
sys/compat/linux32/common/linux32_signal.c: revision 1.20
sys/miscfs/procfs/procfs_linux.c: revision 1.75
sys/compat/linux/common/linux_signal.c: revision 1.81
sys/compat/linux/common/linux_termios.c: revision 1.38
sys/compat/linux/common/linux_misc.c: revision 1.241
sys/compat/linux/common/linux_misc.c: revision 1.242
sys/compat/linux/common/linux_misc.c: revision 1.243
sys/compat/linux/common/linux_misc.c: revision 1.244

Fix info leaks.

Fix stupid bugs in linux_sys_shmctl(): the index could be out of bound
(page fault) and there was no proper locking.
Maybe we should just remove LINUX_SHM_STAT, like compat_linux32.

Remove printf.

When dealing with an unknown value, set -1, to prevent (harmless)
uninitialized accesses later.

Add a default case, don't call sys_ioctl() with an uninitialized 'com'
argument.

Fix error handling, returns an errno, not -1.

Put the printf under DEBUG_LINUX.


Hum, don't forget the 'pid' argument, otherwise we're not gonna go very
far.

Don't read data from userland directly. This simply does not work on any
recent x86 CPU (thanks to SMAP) and all architectures that forbid direct
access to userland from the kernel. But I guess no one noticed because no
one ever uses compat_linux, right?

Hum, don't pass an mbuf to realloc(). Inspired from copyin32_msg_control().

Fix memory leak.

I don't see the point in having this useless printf, but add a '\n' to it,
so that it at least displays useless stuff correctly.

Hum, remove incorrect assignment. Userland could have passed a smaller
namelen, and the uninitialized bytes from sb_data were being used later in
the network stack.
 1.19.4.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.20.8.1 17-Dec-2020  thorpej Add sigevent mapping for Linux-32 compat.
 1.6 27-Nov-2021  ryo Add pselect6(2) system call to COMPAT_LINUX32
 1.5 25-Nov-2021  ryo add support COMPAT_LINUX32 for aarch64
 1.4 01-Nov-2021  thorpej Use "stack_t" instead of "struct sigaltstack", as the former is the
newer standardized name. NFC.
 1.3 18-Nov-2011  christos add sigtimedwait support
 1.2 04-Dec-2007  dsl branches: 1.2.50;
Remove all the __P
 1.1 09-Feb-2006  manu branches: 1.1.2; 1.1.10; 1.1.16; 1.1.22; 1.1.46; 1.1.48; 1.1.54; 1.1.58;
Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.1.58.1 08-Dec-2007  ad Sync with head.
 1.1.54.1 08-Dec-2007  mjf Sync with HEAD.
 1.1.48.1 09-Jan-2008  matt sync with HEAD
 1.1.46.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.1.22.2 09-Sep-2006  rpaulo sync with head
 1.1.22.1 09-Feb-2006  rpaulo file linux32_signal.h was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:46:03 +0000
 1.1.16.3 07-Dec-2007  yamt sync with head
 1.1.16.2 21-Jun-2006  yamt sync with head.
 1.1.16.1 09-Feb-2006  yamt file linux32_signal.h was added on branch yamt-lazymbuf on 2006-06-21 14:59:27 +0000
 1.1.10.2 22-Apr-2006  simonb Sync with head.
 1.1.10.1 09-Feb-2006  simonb file linux32_signal.h was added on branch simonb-timecounters on 2006-04-22 11:38:14 +0000
 1.1.2.2 18-Feb-2006  yamt sync with head.
 1.1.2.1 09-Feb-2006  yamt file linux32_signal.h was added on branch yamt-uio_vmspace on 2006-02-18 15:39:02 +0000
 1.2.50.1 17-Apr-2012  yamt sync with head
 1.32 24-Dec-2022  andvar s/reqest/request/, s/requst/request/ and s/reuqest/request/ in comments.
 1.31 16-Jul-2020  msaitoh Don't accept negative value.

Reported-by: syzbot+e71a77402d6668f1868d@syzkaller.appspotmail.com
 1.30 18-Apr-2019  christos branches: 1.30.4;
Zero out the ifreq struct for SIOCGIFCONF to avoid up to 127 bytes of stack
disclosure. From Andy Nguyen, many thanks! This is the compat code part
pointed out by ozaki-r@
 1.29 10-May-2018  ozaki-r branches: 1.29.2;
Fix pserialize enter/exit pairs in linux_getifconf and linux32_getifconf

Tested by using a small linux program that uses ioctl(SIOCGIFCONF).
Probably fix PR kern/53259 as well.
 1.28 22-Nov-2017  ozaki-r branches: 1.28.2;
Fix and make consistent of usages of psz/psref in ifconf variants
 1.27 14-Mar-2017  ozaki-r branches: 1.27.6;
Use if_acquire and if_release instead of using psref API directly

- Provide if_release for consistency to if_acquire
- Use if_acquire and if_release for ifp iterations
- Make ifnet_psref_class static
 1.26 01-Aug-2016  ozaki-r branches: 1.26.2;
Apply pserialize and psref to struct ifaddr and its variants

This change makes struct ifaddr and its variants (in_ifaddr and in6_ifaddr)
MP-safe by using pserialize and psref. At this moment, pserialize_perform
and psref_target_destroy are disabled because (1) we don't need them
because of softnet_lock (2) they cause a deadlock because of softnet_lock.
So we'll enable them when we remove softnet_lock in the future.
 1.25 07-Jul-2016  ozaki-r branches: 1.25.2;
Switch the address list of intefaces to pslist(9)

As usual, we leave the old list to avoid breaking kvm(3) users.
 1.24 05-Jul-2016  ozaki-r Fix psref isn't released in a case of IFADDR_EMPTY
 1.23 16-Jun-2016  ozaki-r Use curlwp_bind and curlwp_bindx instead of open-coding LP_BOUND
 1.22 15-Jun-2016  ozaki-r Protect if_byindex by pserialize
 1.21 12-May-2016  ozaki-r Protect ifnet list with psz and psref

The change ensures that ifnet objects in the ifnet list aren't freed during
list iterations by using pserialize(9) and psref(9).

Note that the change adds a pslist(9) for ifnet but doesn't remove the
original ifnet list (ifnet_list) to avoid breaking kvm(3) users. We
shouldn't use the original list in the kernel anymore.
 1.20 24-Jul-2015  maxv Unused inits (harmless).

Found by Brainy.
 1.19 26-Nov-2014  ozaki-r branches: 1.19.2;
Tweak ifconf variants

The tweaks make the code intention clear and make further changes easy.

No functional change.
 1.18 17-May-2014  rmind branches: 1.18.2; 1.18.4; 1.18.8;
Replace open-coded access (and boundary checking) of ifindex2ifnet with
if_byindex() function.
 1.17 11-Jan-2013  christos branches: 1.17.2; 1.17.10;
Use copyin/copyout and linux-specific ifreq structures (they are the same
as the netbsd ones, but this disconnects them)
 1.16 15-Mar-2012  bouyer branches: 1.16.2;
Do not read past end of array. Found by gcc -03
 1.15 12-Dec-2009  njoly branches: 1.15.12; 1.15.16;
Add missing semicolons after NETBSD32TOx_UAP macro calls.
 1.14 10-Dec-2009  njoly Add SIOCGIFMTU support.
 1.13 10-Dec-2009  njoly Do not give native requests to netbsd32_ioctl(), use the compat
netbsd32 equivalent instead.
 1.12 13-Nov-2009  joerg Return the result of copyout. Reminded by Niolas Joly.
 1.11 13-Nov-2009  joerg Provide SIOCGIFNAME.
 1.10 19-Nov-2008  ad Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.9 23-Jul-2008  njoly branches: 1.9.2; 1.9.4; 1.9.8;
Add linux32_getifconf, following recent linux_getifconf addition.
 1.8 27-Jun-2008  njoly branches: 1.8.2;
Add SIOCGIFHWADDR support.
Tested by Cem Kayali.
 1.7 24-Jun-2008  njoly Fix SIOCGIFCONF ioctl under compat linux32.
 1.6 19-Jun-2008  christos an attempt at linux32_ioctl_socket().
 1.5 20-Dec-2007  dsl branches: 1.5.6; 1.5.10; 1.5.12; 1.5.14;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.4 08-Dec-2007  dsl branches: 1.4.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.3 09-Feb-2007  ad branches: 1.3.18; 1.3.20; 1.3.28;
Merge newlock2 to head.
 1.2 13-Sep-2006  manu Jumbo COMPAT_LINUX/COMPAT_LINUX32 bugfix, with the help of Nicolas Joly
- Fix shmat return value on amd64: it uses no black magic with retval[0]
- Fix integer overflows in sysinfo
- Implement sysinfo, mmap2, sched_getparam, sched_getscheduler, mremap,
and madvise in COMPAT_LINUX32
- Fix improper types used in setgroups16/getgroups16
- Implement mmap2 for COMPAT_LINUX32
- Ifdef debug messages by DEBUG_LINUX
 1.1 09-Feb-2006  manu branches: 1.1.2; 1.1.4; 1.1.10; 1.1.16; 1.1.20; 1.1.22;
Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.1.22.2 09-Sep-2006  rpaulo sync with head
 1.1.22.1 09-Feb-2006  rpaulo file linux32_socket.c was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:46:03 +0000
 1.1.20.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.1.20.1 18-Nov-2006  ad Sync with head.
 1.1.16.5 21-Jan-2008  yamt sync with head
 1.1.16.4 26-Feb-2007  yamt sync with head.
 1.1.16.3 30-Dec-2006  yamt sync with head.
 1.1.16.2 21-Jun-2006  yamt sync with head.
 1.1.16.1 09-Feb-2006  yamt file linux32_socket.c was added on branch yamt-lazymbuf on 2006-06-21 14:59:27 +0000
 1.1.10.2 22-Apr-2006  simonb Sync with head.
 1.1.10.1 09-Feb-2006  simonb file linux32_socket.c was added on branch simonb-timecounters on 2006-04-22 11:38:14 +0000
 1.1.4.1 14-Sep-2006  yamt sync with head.
 1.1.2.2 18-Feb-2006  yamt sync with head.
 1.1.2.1 09-Feb-2006  yamt file linux32_socket.c was added on branch yamt-uio_vmspace on 2006-02-18 15:39:02 +0000
 1.3.28.1 26-Dec-2007  ad Sync with head.
 1.3.20.1 09-Jan-2008  matt sync with HEAD
 1.3.18.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.4.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.5.14.2 28-Jul-2008  simonb Sync with head.
 1.5.14.1 27-Jun-2008  simonb Sync with head.
 1.5.12.4 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.5.12.3 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.5.12.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.5.12.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.5.10.2 11-Mar-2010  yamt sync with head
 1.5.10.1 04-May-2009  yamt sync with head.
 1.5.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.5.6.2 28-Sep-2008  mjf Sync with HEAD.
 1.5.6.1 29-Jun-2008  mjf Sync with HEAD.
 1.8.2.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.8.2.1 19-Oct-2008  haad Sync with HEAD.
 1.9.8.1 21-Apr-2010  matt sync to netbsd-5
 1.9.4.1 28-Nov-2009  bouyer Pull up following revision(s) (requested by joerg in ticket #1147):
sys/compat/linux32/common/linux32_socket.c: revision 1.11, 1.12
sys/compat/linux/common/linux_socket.c: revision 1.105, 1.106
sys/compat/linux/common/linux_sockio.h: revision 1.17
sys/compat/linux32/common/linux32_sockio.h: revision 1.3
Provide SIOCGIFNAME.
Return the result of copyout. Reminded by Niolas Joly.
 1.9.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.15.16.1 05-Apr-2012  mrg sync to latest -current.
 1.15.12.2 23-Jan-2013  yamt sync with head
 1.15.12.1 17-Apr-2012  yamt sync with head
 1.16.2.3 03-Dec-2017  jdolecek update from HEAD
 1.16.2.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.16.2.1 25-Feb-2013  tls resync with head
 1.17.10.1 10-Aug-2014  tls Rebase.
 1.17.2.1 17-Jul-2013  rmind Checkpoint work in progress:
- Move PCB structures under __INPCB_PRIVATE, adjust most of the callers
and thus make IPv4 PCB structures mostly opaque. Any volunteers for
merging in6pcb with inpcb (see rpaulo-netinet-merge-pcb branch)?
- Move various global vars to the modules where they belong, make them static.
- Some preliminary work for IPv4 PCB locking scheme.
- Make raw IP code mostly MP-safe. Simplify some of it.
- Rework "fast" IP forwarding (ipflow) code to be mostly MP-safe. It should
run from a software interrupt, rather than hard.
- Rework tun(4) pseudo interface to be MP-safe.
- Work towards making some other interfaces more strict.
 1.18.8.1 19-Apr-2019  martin Pull up following revision(s) via patch (requested by christos in ticket #1689):

sys/compat/linux/common/linux_socket.c: revision 1.145
sys/net/if.c: revision 1.449
sys/compat/linux32/common/linux32_socket.c: revision 1.30
sys/compat/common/uipc_syscalls_40.c: revision 1.19

Zero out the ifreq struct for SIOCGIFCONF to avoid up to 127 bytes of stack
disclosure. From Andy Nguyen, many thanks!

-

Zero out the ifreq struct for SIOCGIFCONF to avoid up to 127 bytes of stack
disclosure. From Andy Nguyen, many thanks! This is the compat code part
pointed out by ozaki-r@
 1.18.4.1 19-Apr-2019  martin Pull up following revision(s) via patch (requested by christos in ticket #1689):

sys/compat/linux/common/linux_socket.c: revision 1.145
sys/net/if.c: revision 1.449
sys/compat/linux32/common/linux32_socket.c: revision 1.30
sys/compat/common/uipc_syscalls_40.c: revision 1.19

Zero out the ifreq struct for SIOCGIFCONF to avoid up to 127 bytes of stack
disclosure. From Andy Nguyen, many thanks!

-

Zero out the ifreq struct for SIOCGIFCONF to avoid up to 127 bytes of stack
disclosure. From Andy Nguyen, many thanks! This is the compat code part
pointed out by ozaki-r@
 1.18.2.1 19-Apr-2019  martin Pull up following revision(s) via patch (requested by christos in ticket #1689):

sys/compat/linux/common/linux_socket.c: revision 1.145
sys/net/if.c: revision 1.449
sys/compat/linux32/common/linux32_socket.c: revision 1.30
sys/compat/common/uipc_syscalls_40.c: revision 1.19

Zero out the ifreq struct for SIOCGIFCONF to avoid up to 127 bytes of stack
disclosure. From Andy Nguyen, many thanks!

-

Zero out the ifreq struct for SIOCGIFCONF to avoid up to 127 bytes of stack
disclosure. From Andy Nguyen, many thanks! This is the compat code part
pointed out by ozaki-r@
 1.19.2.5 28-Aug-2017  skrll Sync with HEAD
 1.19.2.4 05-Oct-2016  skrll Sync with HEAD
 1.19.2.3 09-Jul-2016  skrll Sync with HEAD
 1.19.2.2 29-May-2016  skrll Sync with HEAD
 1.19.2.1 22-Sep-2015  skrll Sync with HEAD
 1.25.2.2 20-Mar-2017  pgoyette Sync with HEAD
 1.25.2.1 06-Aug-2016  pgoyette Sync with HEAD
 1.26.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.27.6.4 17-Jul-2020  martin Pull up following revision(s) (requested by msaitoh in ticket #1576):

sys/net/if.c: revision 1.479
sys/compat/common/uipc_syscalls_40.c: revision 1.23
sys/compat/linux/common/linux_socket.c: revision 1.150
sys/compat/linux32/common/linux32_socket.c: revision 1.31

Don't accept negative value.
 1.27.6.3 19-Apr-2019  martin Pull up following revision(s) (requested by christos in ticket #1233):

sys/compat/linux/common/linux_socket.c: revision 1.145
sys/net/if.c: revision 1.449
sys/compat/linux32/common/linux32_socket.c: revision 1.30
sys/compat/common/uipc_syscalls_40.c: revision 1.19

Zero out the ifreq struct for SIOCGIFCONF to avoid up to 127 bytes of stack
disclosure. From Andy Nguyen, many thanks!

-

Zero out the ifreq struct for SIOCGIFCONF to avoid up to 127 bytes of stack
disclosure. From Andy Nguyen, many thanks! This is the compat code part
pointed out by ozaki-r@
 1.27.6.2 12-May-2018  martin Pull up following revision(s) (requested by ozaki-r in ticket #818):

sys/compat/linux/common/linux_socket.c: revision 1.142
sys/compat/linux32/common/linux32_socket.c: revision 1.29

Fix pserialize enter/exit pairs in linux_getifconf and linux32_getifconf

Tested by using a small linux program that uses ioctl(SIOCGIFCONF).
Probably fix PR kern/53259 as well.
 1.27.6.1 30-Nov-2017  martin Pull up following revision(s) (requested by ozaki-r in ticket #407):
sys/compat/linux32/common/linux32_socket.c: revision 1.28
sys/net/if.c: revision 1.400
sys/netipsec/key.c: revision 1.243
sys/compat/linux/common/linux_socket.c: revision 1.139
sys/netinet/ip_carp.c: revision 1.93
sys/netinet6/in6.c: revision 1.252
sys/netinet6/in6.c: revision 1.253
sys/netinet6/in6.c: revision 1.254
sys/net/if_spppsubr.c: revision 1.173
sys/net/if_spppsubr.c: revision 1.174
sys/compat/common/uipc_syscalls_40.c: revision 1.14
Protect IFADDR_READER_FOREACH and obtained ifa with psz/psref
Fix usage of FOREACH macro
key_sad.lock is held there so SAVLIST_WRITER_FOREACH is enough.
Protect IFADDR_READER_FOREACH and obtained ifa with psz/psref
Protect IFADDR_READER_FOREACH and obtained ifa with psz/psref (more)
Fix and make consistent of usages of psz/psref in ifconf variants
Remove unnecessary goto because there is no cleanup code to share (NFC)
Tweak a condition; we don't need to care ifacount to be negative
Fix a race condition of in6_ifinit
in6_ifinit checks the number of IPv6 addresses on a given interface and
if it's zero (i.e., an IPv6 address being assigned to the interface
is the first one), call if_addr_init. However, the actual assignment of
the address (ifa_insert) is out of in6_ifinit. The check and the
assignment must be done atomically.
Fix it by holding in6_ifaddr_lock during in6_ifinit and ifa_insert.
And also add missing pserialize to IFADDR_READER_FOREACH.
 1.28.2.1 21-May-2018  pgoyette Sync with HEAD
 1.29.2.1 10-Jun-2019  christos Sync with HEAD
 1.30.4.1 17-Jul-2020  martin Pull up following revision(s) (requested by msaitoh in ticket #1018):

sys/net/if.c: revision 1.479
sys/compat/common/uipc_syscalls_40.c: revision 1.23
sys/compat/linux/common/linux_socket.c: revision 1.150
sys/compat/linux32/common/linux32_socket.c: revision 1.31

Don't accept negative value.
 1.9 21-Jun-2014  maxv If SCARG(uap, what) = 0, copyin() will copy (size_t)-1 bytes, and it's not
a good idea; but not proven harmful.

With the help of njoly@
 1.8 10-May-2012  christos branches: 1.8.2; 1.8.12;
prefix message with linux32
 1.7 19-Nov-2008  ad branches: 1.7.16; 1.7.20; 1.7.22; 1.7.26; 1.7.28;
Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.6 20-Dec-2007  dsl branches: 1.6.6; 1.6.10; 1.6.16; 1.6.18; 1.6.20; 1.6.26; 1.6.30;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.5 08-Dec-2007  dsl branches: 1.5.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.4 15-Aug-2007  ad branches: 1.4.2; 1.4.10;
Changes to make ktrace LKM friendly and reduce ifdef KTRACE. Proposed
on tech-kern.
 1.3 01-Jun-2007  dsl branches: 1.3.2; 1.3.6;
(Ab)use a KTR_USER trace entry for the linux socket command and arguments.
 1.2 18-Mar-2007  dsl Change all the NETBSD32PTR64(SCARG(uap, xxx))) to SCARG_P32(uap, xxx).
 1.1 09-Feb-2006  manu branches: 1.1.2; 1.1.10; 1.1.16; 1.1.22; 1.1.28; 1.1.32; 1.1.34; 1.1.36;
Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.1.36.1 29-Mar-2007  reinoud Pullup to -current
 1.1.34.1 11-Jul-2007  mjf Sync with head.
 1.1.32.3 20-Aug-2007  ad Sync with HEAD.
 1.1.32.2 09-Jun-2007  ad Sync with head.
 1.1.32.1 10-Apr-2007  ad Sync with head.
 1.1.28.1 24-Mar-2007  yamt sync with head.
 1.1.22.2 09-Sep-2006  rpaulo sync with head
 1.1.22.1 09-Feb-2006  rpaulo file linux32_socketcall.c was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:46:03 +0000
 1.1.16.4 21-Jan-2008  yamt sync with head
 1.1.16.3 03-Sep-2007  yamt sync with head.
 1.1.16.2 21-Jun-2006  yamt sync with head.
 1.1.16.1 09-Feb-2006  yamt file linux32_socketcall.c was added on branch yamt-lazymbuf on 2006-06-21 14:59:27 +0000
 1.1.10.2 22-Apr-2006  simonb Sync with head.
 1.1.10.1 09-Feb-2006  simonb file linux32_socketcall.c was added on branch simonb-timecounters on 2006-04-22 11:38:14 +0000
 1.1.2.2 18-Feb-2006  yamt sync with head.
 1.1.2.1 09-Feb-2006  yamt file linux32_socketcall.c was added on branch yamt-uio_vmspace on 2006-02-18 15:39:02 +0000
 1.3.6.2 09-Dec-2007  jmcneill Sync with HEAD.
 1.3.6.1 16-Aug-2007  jmcneill Sync with HEAD.
 1.3.2.1 03-Sep-2007  skrll Sync with HEAD.
 1.4.10.1 26-Dec-2007  ad Sync with head.
 1.4.2.1 09-Jan-2008  matt sync with HEAD
 1.5.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.6.30.1 08-Aug-2014  msaitoh Pull up following revision(s) (requested by maxv in ticket #1916):
sys/compat/linux32/common/linux32_socketcall.c: revision 1.9
sys/compat/linux/common/linux_socketcall.c: revision 1.44
If SCARG(uap, what) = 0, copyin() will copy (size_t)-1 bytes, and it's not
a good idea; but not proven harmful.
With the help of njoly@
 1.6.26.1 08-Aug-2014  msaitoh Pull up following revision(s) (requested by maxv in ticket #1916):
sys/compat/linux32/common/linux32_socketcall.c: revision 1.9
sys/compat/linux/common/linux_socketcall.c: revision 1.44
If SCARG(uap, what) = 0, copyin() will copy (size_t)-1 bytes, and it's not
a good idea; but not proven harmful.
With the help of njoly@
 1.6.20.1 08-Aug-2014  msaitoh Pull up following revision(s) (requested by maxv in ticket #1916):
sys/compat/linux32/common/linux32_socketcall.c: revision 1.9
sys/compat/linux/common/linux_socketcall.c: revision 1.44
If SCARG(uap, what) = 0, copyin() will copy (size_t)-1 bytes, and it's not
a good idea; but not proven harmful.
With the help of njoly@
 1.6.18.1 19-Jan-2009  skrll Sync with HEAD.
 1.6.16.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.6.10.1 04-May-2009  yamt sync with head.
 1.6.6.1 17-Jan-2009  mjf Sync with HEAD.
 1.7.28.1 08-Aug-2014  msaitoh Pull up following revision(s) (requested by maxv in ticket #1104):
sys/compat/linux32/common/linux32_socketcall.c: revision 1.9
sys/compat/linux/common/linux_socketcall.c: revision 1.44
If SCARG(uap, what) = 0, copyin() will copy (size_t)-1 bytes, and it's not
a good idea; but not proven harmful.
With the help of njoly@
 1.7.26.1 08-Aug-2014  msaitoh Pull up following revision(s) (requested by maxv in ticket #1104):
sys/compat/linux32/common/linux32_socketcall.c: revision 1.9
sys/compat/linux/common/linux_socketcall.c: revision 1.44
If SCARG(uap, what) = 0, copyin() will copy (size_t)-1 bytes, and it's not
a good idea; but not proven harmful.
With the help of njoly@
 1.7.22.1 08-Aug-2014  msaitoh Pull up following revision(s) (requested by maxv in ticket #1104):
sys/compat/linux32/common/linux32_socketcall.c: revision 1.9
sys/compat/linux/common/linux_socketcall.c: revision 1.44
If SCARG(uap, what) = 0, copyin() will copy (size_t)-1 bytes, and it's not
a good idea; but not proven harmful.
With the help of njoly@
 1.7.20.1 02-Jun-2012  mrg sync to latest -current.
 1.7.16.1 23-May-2012  yamt sync with head.
 1.8.12.1 10-Aug-2014  tls Rebase.
 1.8.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.3 20-Dec-2007  dsl Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.2 04-Dec-2007  dsl branches: 1.2.4;
Remove all the __P
 1.1 09-Feb-2006  manu branches: 1.1.2; 1.1.10; 1.1.16; 1.1.22; 1.1.46; 1.1.48; 1.1.54; 1.1.58;
Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.1.58.2 26-Dec-2007  ad Sync with head.
 1.1.58.1 08-Dec-2007  ad Sync with head.
 1.1.54.2 27-Dec-2007  mjf Sync with HEAD.
 1.1.54.1 08-Dec-2007  mjf Sync with HEAD.
 1.1.48.1 09-Jan-2008  matt sync with HEAD
 1.1.46.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.1.22.2 09-Sep-2006  rpaulo sync with head
 1.1.22.1 09-Feb-2006  rpaulo file linux32_socketcall.h was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:46:03 +0000
 1.1.16.4 21-Jan-2008  yamt sync with head
 1.1.16.3 07-Dec-2007  yamt sync with head
 1.1.16.2 21-Jun-2006  yamt sync with head.
 1.1.16.1 09-Feb-2006  yamt file linux32_socketcall.h was added on branch yamt-lazymbuf on 2006-06-21 14:59:27 +0000
 1.1.10.2 22-Apr-2006  simonb Sync with head.
 1.1.10.1 09-Feb-2006  simonb file linux32_socketcall.h was added on branch simonb-timecounters on 2006-04-22 11:38:14 +0000
 1.1.2.2 18-Feb-2006  yamt sync with head.
 1.1.2.1 09-Feb-2006  yamt file linux32_socketcall.h was added on branch yamt-uio_vmspace on 2006-02-18 15:39:02 +0000
 1.2.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.4 11-Jan-2013  christos Use copyin/copyout and linux-specific ifreq structures (they are the same
as the netbsd ones, but this disconnects them)
 1.3 13-Nov-2009  joerg branches: 1.3.12; 1.3.22;
Provide SIOCGIFNAME.
 1.2 23-Jul-2008  njoly branches: 1.2.2; 1.2.6; 1.2.14; 1.2.16;
Add linux32_getifconf, following recent linux_getifconf addition.
 1.1 27-Jun-2008  njoly branches: 1.1.2; 1.1.4; 1.1.6;
Add SIOCGIFHWADDR support.
Tested by Cem Kayali.
 1.1.6.1 19-Oct-2008  haad Sync with HEAD.
 1.1.4.3 28-Sep-2008  mjf Sync with HEAD.
 1.1.4.2 29-Jun-2008  mjf Sync with HEAD.
 1.1.4.1 27-Jun-2008  mjf file linux32_sockio.h was added on branch mjf-devfs2 on 2008-06-29 09:33:03 +0000
 1.1.2.3 28-Jul-2008  simonb Sync with head.
 1.1.2.2 27-Jun-2008  simonb Sync with head.
 1.1.2.1 27-Jun-2008  simonb file linux32_sockio.h was added on branch simonb-wapbl on 2008-06-27 15:11:19 +0000
 1.2.16.1 21-Apr-2010  matt sync to netbsd-5
 1.2.14.3 11-Mar-2010  yamt sync with head
 1.2.14.2 04-May-2009  yamt sync with head.
 1.2.14.1 23-Jul-2008  yamt file linux32_sockio.h was added on branch yamt-nfs-mp on 2009-05-04 08:12:23 +0000
 1.2.6.1 28-Nov-2009  bouyer Pull up following revision(s) (requested by joerg in ticket #1147):
sys/compat/linux32/common/linux32_socket.c: revision 1.11, 1.12
sys/compat/linux/common/linux_socket.c: revision 1.105, 1.106
sys/compat/linux/common/linux_sockio.h: revision 1.17
sys/compat/linux32/common/linux32_sockio.h: revision 1.3
Provide SIOCGIFNAME.
Return the result of copyout. Reminded by Niolas Joly.
 1.2.2.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.2.2.1 23-Jul-2008  wrstuden file linux32_sockio.h was added on branch wrstuden-revivesa on 2008-09-18 04:36:45 +0000
 1.3.22.1 25-Feb-2013  tls resync with head
 1.3.12.1 23-Jan-2013  yamt sync with head
 1.18 25-Nov-2021  ryo - Add compat_linux statx(2) syscall.
- The AT_EMPTY_PATH processing from the modification of
sys/compat/linux/common/linux_file64.c r1.63 has been separated, and made
common to linux_statat(), so that it can be used not only by
linux32_sys_fstatat64() but also by other *statat() variants.
 1.17 18-Nov-2013  chs implement the *at() syscalls.
bring the unimplemented syscall list up to date.
 1.16 04-Jun-2009  njoly branches: 1.16.12; 1.16.22; 1.16.26;
Add stat/lstat/fstat syscalls.
 1.15 03-Jun-2009  njoly Cleanup (no functional changes).
Kill some unneeded variables and return stattement.
Rename linux32_from_stat() to better bsd_to_linux32_stat64().
Fix some types.
 1.14 03-Jun-2009  njoly Fix inverted lst_ino/__lst_ino assignment in linux32_from_stat().
 1.13 18-Mar-2009  cegger bzero -> memset
 1.12 19-Nov-2008  ad branches: 1.12.4;
Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.11 21-Mar-2008  ad branches: 1.11.4; 1.11.6; 1.11.10; 1.11.12; 1.11.14;
Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
 1.10 20-Dec-2007  dsl branches: 1.10.6;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.9 08-Dec-2007  dsl branches: 1.9.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.8 22-Apr-2007  dsl branches: 1.8.6; 1.8.8; 1.8.16;
Change the way that emulations locate files within the emulation root to
avoid having to allocate space in the 'stackgap'
- which is very LWP unfriendly.
The additional code for non-emulation namei() is trivial, the reduction for
the emulations is massive.
The vnode for a processes emulation root is saved in the cwdi structure
during process exec.
If the emulation root the TRYEMULROOT flag are set, namei() will do an initial
search for absolute pathnames in the emulation root, if that fails it will
retry from the normal root.
".." at the emulation root will always go to the real root, even in the middle
of paths and when expanding symlinks.
Absolute symlinks found using absolute paths in the emulation root will be
relative to the emulation root (so /usr/lib/xxx.so -> /lib/xxx.so links
inside the emulation root don't need changing).
If the root of the emulation would be returned (for an emulation lookup), then
the real root is returned instead (matching the behaviour of emul_lookup,
but being a cheap comparison here) so that programs that scan "../.."
looking for the root dircetory don't loop forever.
The target for symbolic links is no longer mangled (it used to get the
CHECK_ALT_xxx() treatment, so could get /emul/xxx prepended).
CHECK_ALT_xxx() are no more. Most of the change is deleting them, and adding
TRYEMULROOT to the flags to NDINIT().
A lot of the emulation system call stubs could now be deleted.
 1.7 18-Mar-2007  dsl Change all the NETBSD32PTR64(SCARG(uap, xxx))) to SCARG_P32(uap, xxx).
 1.6 16-Mar-2007  dsl remove all the double (and triple) casts used to convert 32bit userspace
pointers to and from 64bit kernel pointers. Instead use the defines
NETBSD32PTR64(p32) to read a 32bit pointer and (the new) NETBSD32PTR32(p32,p64)
to write a 32bit pointer throughout.
The 32bit pointer is now a struct to enforce the above.
amd64 (with linux emul) and sparc64 will both compile (when the arch stuff
goes in soon), and amd64 still runs some i386 binaries.
 1.5 11-Mar-2007  dsl branches: 1.5.2; 1.5.4;
Fix amd64 build for compat sys_stat() changes.
This file isn't included in amd64:GENERIC
 1.4 10-Mar-2007  dsl Update all the compat stuff to not use the 'stackgap' for processing
sys_stat() and friends, instead use do_sys_stat() and do_sys_fstat()
that write the answer into a kernel buffer (on stack) that can be
converted to the correct form and written the userspace.
I've test compiled a few kernels, and tested i386 netbsd1.6 ls.
Given I think I've fixed some bugs, it might be 50-50 with new ones.
 1.3 04-Mar-2007  christos branches: 1.3.2;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.2 09-Feb-2007  ad branches: 1.2.2;
Merge newlock2 to head.
 1.1 09-Feb-2006  manu branches: 1.1.2; 1.1.10; 1.1.16; 1.1.20; 1.1.22;
Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.1.22.2 09-Sep-2006  rpaulo sync with head
 1.1.22.1 09-Feb-2006  rpaulo file linux32_stat.c was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:46:03 +0000
 1.1.20.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.1.16.6 24-Mar-2008  yamt sync with head.
 1.1.16.5 21-Jan-2008  yamt sync with head
 1.1.16.4 03-Sep-2007  yamt sync with head.
 1.1.16.3 26-Feb-2007  yamt sync with head.
 1.1.16.2 21-Jun-2006  yamt sync with head.
 1.1.16.1 09-Feb-2006  yamt file linux32_stat.c was added on branch yamt-lazymbuf on 2006-06-21 14:59:27 +0000
 1.1.10.2 22-Apr-2006  simonb Sync with head.
 1.1.10.1 09-Feb-2006  simonb file linux32_stat.c was added on branch simonb-timecounters on 2006-04-22 11:38:14 +0000
 1.1.2.2 18-Feb-2006  yamt sync with head.
 1.1.2.1 09-Feb-2006  yamt file linux32_stat.c was added on branch yamt-uio_vmspace on 2006-02-18 15:39:02 +0000
 1.2.2.3 07-May-2007  yamt sync with head.
 1.2.2.2 24-Mar-2007  yamt sync with head.
 1.2.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.3.2.3 27-May-2007  ad Sync with head.
 1.3.2.2 10-Apr-2007  ad Sync with head.
 1.3.2.1 13-Mar-2007  ad Sync with head.
 1.5.4.2 29-Mar-2007  reinoud Pullup to -current
 1.5.4.1 18-Mar-2007  reinoud First attempt to bring branch in sync with HEAD
 1.5.2.1 11-Jul-2007  mjf Sync with head.
 1.8.16.1 26-Dec-2007  ad Sync with head.
 1.8.8.1 09-Jan-2008  matt sync with HEAD
 1.8.6.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.9.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.10.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.10.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.11.14.1 18-Mar-2015  snj Pull up following revision(s) (requested by joerg in ticket #1149):
sys/compat/linux32/arch/amd64/syscalls.master: revisions 1.52, 1.53 via patch
sys/compat/linux32/common/linux32_misc.c: revision 1.17 via patch
sys/compat/linux32/common/linux32_stat.c: revision 1.14-1.16 via patch
Fix inverted lst_ino/__lst_ino assignment in linux32_from_stat().
--
Cleanup (no functional changes).
Kill some unneeded variables and return stattement.
Rename linux32_from_stat() to better bsd_to_linux32_stat64().
Fix some types.
Add stat/lstat/fstat syscalls.
--
Add fstatfs syscall.
 1.11.12.2 28-Apr-2009  skrll Sync with HEAD.
 1.11.12.1 19-Jan-2009  skrll Sync with HEAD.
 1.11.10.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.11.6.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.11.6.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.11.4.2 20-Jun-2009  yamt sync with head
 1.11.4.1 04-May-2009  yamt sync with head.
 1.12.4.2 23-Jul-2009  jym Sync with HEAD.
 1.12.4.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.16.26.1 18-May-2014  rmind sync with head
 1.16.22.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.16.12.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.19 21-Mar-2020  pgoyette Deal with having to teardown sysctl entries in multiple sub-trees.

(This used to work, but I broke it recently.)
 1.18 16-Mar-2020  pgoyette Use the module subsystem's ability to process SYSCTL_SETUP() entries to
automate installation of sysctl nodes.

Note that there are still a number of device and pseudo-device modules
that create entries tied to individual device units, rather than to the
module itself. These are not changed.
 1.17 29-Sep-2017  maxv branches: 1.17.4;
Remove compat_linux32 from the autoload list and add a enable/disable
sysctl, like compat_linux.
 1.16 16-May-2014  martin Get rid of all sysc_init_field uses - initialize fields directly in C99
notation.
 1.15 25-Feb-2014  pooka branches: 1.15.2;
Ensure that the top level sysctl nodes (kern, vfs, net, ...) exist before
the sysctl link sets are processed, and remove redundancy.

Shaves >13kB off of an amd64 GENERIC, not to mention >1k duplicate
lines of code.
 1.14 18-Nov-2013  chs claim to be linux 3.11.6 (opensuse 13.1).
 1.13 07-Jul-2010  chs branches: 1.13.8; 1.13.18; 1.13.22;
many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
- support new-style (NPTL) linux pthreads on all platforms.
clone() with CLONE_THREAD uses 1 process with many LWPs
instead of separate processes.
- move the contents of sys__lwp_setprivate() into a new
lwp_setprivate() and use that everywhere.
- update linux_release[] and linux32_release[] to "2.6.18".
- adjust placement of emul fork/exec/exit hooks as needed
and adjust other emul code to match.
- convert all struct emul definitions to use named initializers.
- change the pid allocator to allow multiple pids to refer to the same proc.
- remove a few fields from struct proc that are no longer needed.
- disable the non-functional "vdso" code in linux32/amd64,
glibc works fine without it.
- fix a race in the futex code where we could miss a wakeup after
a requeue operation.
- redo futex locking to be a little more efficient.
 1.12 05-Jan-2009  njoly branches: 1.12.4; 1.12.6;
Make sysctl(2) fails with ENOTDIR (instead of EINVAL) for invalid mib
vector length.
 1.11 19-Nov-2008  ad Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.10 12-Nov-2008  ad Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.
 1.9 07-Jan-2008  ad branches: 1.9.6; 1.9.10; 1.9.12; 1.9.16; 1.9.18;
Patch up sysctl locking:

- Lock processes, credentials, filehead etc correctly.
- Acquire a read hold on sysctl_treelock if only doing a query.
- Don't wire down the output buffer. It doesn't work correctly and the code
regularly does long term sleeps with it held - it's not worth it.
- Don't hold locks other than sysctl_lock while doing copyout().
- Drop sysctl_lock while doing copyout / allocating memory in a few places.
- Don't take kernel_lock for sysctl.
- Fix a number of bugs spotted along the way
 1.8 20-Dec-2007  dsl Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.7 08-Dec-2007  dsl branches: 1.7.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.6 15-Aug-2007  ad branches: 1.6.2; 1.6.8; 1.6.10;
Changes to make ktrace LKM friendly and reduce ifdef KTRACE. Proposed
on tech-kern.
 1.5 18-Mar-2007  dsl branches: 1.5.4; 1.5.8;
Change all the NETBSD32PTR64(SCARG(uap, xxx))) to SCARG_P32(uap, xxx).
 1.4 09-Feb-2007  ad branches: 1.4.2; 1.4.6; 1.4.8; 1.4.10;
Merge newlock2 to head.
 1.3 23-Sep-2006  manu Add sysctl tracing to emulations.
While we are there, fix a bug in FreeBSD sysctl emulation: use copyin for
moving data to the kernel
 1.2 05-Sep-2006  manu branches: 1.2.2; 1.2.4; 1.2.6;
Fix linux32_sys_sysctl, it was horribly broken.
 1.1 09-Feb-2006  manu branches: 1.1.2; 1.1.4; 1.1.10; 1.1.16;
Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.1.16.6 21-Jan-2008  yamt sync with head
 1.1.16.5 03-Sep-2007  yamt sync with head.
 1.1.16.4 26-Feb-2007  yamt sync with head.
 1.1.16.3 30-Dec-2006  yamt sync with head.
 1.1.16.2 21-Jun-2006  yamt sync with head.
 1.1.16.1 09-Feb-2006  yamt file linux32_sysctl.c was added on branch yamt-lazymbuf on 2006-06-21 14:59:27 +0000
 1.1.10.2 22-Apr-2006  simonb Sync with head.
 1.1.10.1 09-Feb-2006  simonb file linux32_sysctl.c was added on branch simonb-timecounters on 2006-04-22 11:38:14 +0000
 1.1.4.1 14-Sep-2006  yamt sync with head.
 1.1.2.2 18-Feb-2006  yamt sync with head.
 1.1.2.1 09-Feb-2006  yamt file linux32_sysctl.c was added on branch yamt-uio_vmspace on 2006-02-18 15:39:02 +0000
 1.2.6.1 22-Oct-2006  yamt sync with head
 1.2.4.2 09-Sep-2006  rpaulo sync with head
 1.2.4.1 05-Sep-2006  rpaulo file linux32_sysctl.c was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:46:03 +0000
 1.2.2.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.2.2.1 18-Nov-2006  ad Sync with head.
 1.4.10.1 29-Mar-2007  reinoud Pullup to -current
 1.4.8.1 11-Jul-2007  mjf Sync with head.
 1.4.6.2 20-Aug-2007  ad Sync with HEAD.
 1.4.6.1 10-Apr-2007  ad Sync with head.
 1.4.2.1 24-Mar-2007  yamt sync with head.
 1.5.8.2 09-Dec-2007  jmcneill Sync with HEAD.
 1.5.8.1 16-Aug-2007  jmcneill Sync with HEAD.
 1.5.4.1 03-Sep-2007  skrll Sync with HEAD.
 1.6.10.1 26-Dec-2007  ad Sync with head.
 1.6.8.1 18-Feb-2008  mjf Sync with HEAD.
 1.6.2.1 09-Jan-2008  matt sync with HEAD
 1.7.4.2 08-Jan-2008  bouyer Sync with HEAD
 1.7.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.9.18.1 19-Jan-2009  skrll Sync with HEAD.
 1.9.16.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.9.12.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.9.12.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.9.10.2 11-Aug-2010  yamt sync with head.
 1.9.10.1 04-May-2009  yamt sync with head.
 1.9.6.1 17-Jan-2009  mjf Sync with HEAD.
 1.12.6.1 05-Mar-2011  rmind sync with head
 1.12.4.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.13.22.1 18-May-2014  rmind sync with head
 1.13.18.2 03-Dec-2017  jdolecek update from HEAD
 1.13.18.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.13.8.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.15.2.1 10-Aug-2014  tls Rebase.
 1.17.4.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.6 21-Mar-2020  pgoyette Deal with having to teardown sysctl entries in multiple sub-trees.

(This used to work, but I broke it recently.)
 1.5 16-Mar-2020  pgoyette Use the module subsystem's ability to process SYSCTL_SETUP() entries to
automate installation of sysctl nodes.

Note that there are still a number of device and pseudo-device modules
that create entries tied to individual device units, rather than to the
module itself. These are not changed.
 1.4 22-Aug-2018  msaitoh - Cleanup for dynamic sysctl:
- Remove unused *_NAMES macros for sysctl.
- Remove unused *_MAXID for sysctls.
- Move CTL_MACHDEP sysctl definitions for m68k into m68k/include/cpu.h and
use them on all m68k machines.
 1.3 29-Sep-2017  maxv branches: 1.3.2; 1.3.4;
Remove compat_linux32 from the autoload list and add a enable/disable
sysctl, like compat_linux.
 1.2 19-Nov-2008  ad branches: 1.2.26;
Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.1 09-Feb-2006  manu branches: 1.1.2; 1.1.10; 1.1.16; 1.1.22; 1.1.72; 1.1.76; 1.1.82; 1.1.86;
Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.1.86.1 19-Jan-2009  skrll Sync with HEAD.
 1.1.82.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.1.76.1 04-May-2009  yamt sync with head.
 1.1.72.1 17-Jan-2009  mjf Sync with HEAD.
 1.1.22.2 09-Sep-2006  rpaulo sync with head
 1.1.22.1 09-Feb-2006  rpaulo file linux32_sysctl.h was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:46:04 +0000
 1.1.16.2 21-Jun-2006  yamt sync with head.
 1.1.16.1 09-Feb-2006  yamt file linux32_sysctl.h was added on branch yamt-lazymbuf on 2006-06-21 14:59:27 +0000
 1.1.10.2 22-Apr-2006  simonb Sync with head.
 1.1.10.1 09-Feb-2006  simonb file linux32_sysctl.h was added on branch simonb-timecounters on 2006-04-22 11:38:14 +0000
 1.1.2.2 18-Feb-2006  yamt sync with head.
 1.1.2.1 09-Feb-2006  yamt file linux32_sysctl.h was added on branch yamt-uio_vmspace on 2006-02-18 15:39:02 +0000
 1.2.26.1 03-Dec-2017  jdolecek update from HEAD
 1.3.4.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.3.4.1 10-Jun-2019  christos Sync with HEAD
 1.3.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.14 25-Nov-2021  ryo add support COMPAT_LINUX32 for aarch64
 1.13 11-Jun-2020  ad Counter tweaks:

- Don't need to count anonpages+filepages any more; clean+unknown+dirty for
each kind of page can be summed to get the totals.

- Track the number of free pages with a counter so that it's one less thing
for the allocator to do, which opens up further options there.

- Remove cpu_count_sync_one(). It has no users and doesn't save a whole lot.
For the cheap option, give cpu_count_sync() a boolean parameter indicating
that a cached value is okay, and rate limit the updates for cached values
to hz.
 1.12 11-Jun-2020  ad uvm_availmem(): give it a boolean argument to specify whether a recent
cached value will do, or if the very latest total must be fetched. It can
be called thousands of times a second and fetching the totals impacts not
only the calling LWP but other CPUs doing unrelated activity in the VM
system.
 1.11 19-Apr-2020  thorpej - Only increment nprocs when we're creating a new process, not just
when allocating a PID.
- Per above, proc_free_pid() no longer decrements nprocs. It's now done
in proc_free() right after proc_free_pid().
- Ensure nprocs is accessed using atomics everywhere.
 1.10 31-Dec-2019  ad branches: 1.10.6;
Rename uvm_free() -> uvm_availmem().
 1.9 21-Dec-2019  ad uvmexp.free -> uvm_free()
 1.8 23-Aug-2019  maxv Fix info leaks in sysinfo().
 1.7 19-Nov-2008  ad branches: 1.7.42; 1.7.54; 1.7.60; 1.7.68; 1.7.72;
Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.6 20-Dec-2007  dsl branches: 1.6.6; 1.6.10; 1.6.12; 1.6.16; 1.6.18;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.5 08-Dec-2007  dsl branches: 1.5.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.4 21-Jul-2007  xtraeme branches: 1.4.4; 1.4.6; 1.4.14; 1.4.16;
<sys/proc.h> is needed to get nprocs... fixes the build on amd64.
 1.3 18-Mar-2007  dsl branches: 1.3.4;
Change all the NETBSD32PTR64(SCARG(uap, xxx))) to SCARG_P32(uap, xxx).
 1.2 09-Feb-2007  ad branches: 1.2.2; 1.2.6; 1.2.8; 1.2.10;
Merge newlock2 to head.
 1.1 13-Sep-2006  manu branches: 1.1.2; 1.1.6; 1.1.10;
Jumbo COMPAT_LINUX/COMPAT_LINUX32 bugfix, with the help of Nicolas Joly
- Fix shmat return value on amd64: it uses no black magic with retval[0]
- Fix integer overflows in sysinfo
- Implement sysinfo, mmap2, sched_getparam, sched_getscheduler, mremap,
and madvise in COMPAT_LINUX32
- Fix improper types used in setgroups16/getgroups16
- Implement mmap2 for COMPAT_LINUX32
- Ifdef debug messages by DEBUG_LINUX
 1.1.10.5 21-Jan-2008  yamt sync with head
 1.1.10.4 03-Sep-2007  yamt sync with head.
 1.1.10.3 26-Feb-2007  yamt sync with head.
 1.1.10.2 30-Dec-2006  yamt sync with head.
 1.1.10.1 13-Sep-2006  yamt file linux32_sysinfo.c was added on branch yamt-lazymbuf on 2006-12-30 20:47:42 +0000
 1.1.6.3 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.1.6.2 18-Nov-2006  ad Sync with head.
 1.1.6.1 13-Sep-2006  ad file linux32_sysinfo.c was added on branch newlock2 on 2006-11-18 21:39:11 +0000
 1.1.2.2 14-Sep-2006  yamt sync with head.
 1.1.2.1 13-Sep-2006  yamt file linux32_sysinfo.c was added on branch yamt-pdpolicy on 2006-09-14 12:31:23 +0000
 1.2.10.1 29-Mar-2007  reinoud Pullup to -current
 1.2.8.1 11-Jul-2007  mjf Sync with head.
 1.2.6.2 15-Jul-2007  xtraeme sys/proc.h is required for nprocs, ok ad@.
 1.2.6.1 10-Apr-2007  ad Sync with head.
 1.2.2.1 24-Mar-2007  yamt sync with head.
 1.3.4.1 15-Aug-2007  skrll Sync with HEAD.
 1.4.16.2 21-Jul-2007  xtraeme <sys/proc.h> is needed to get nprocs... fixes the build on amd64.
 1.4.16.1 21-Jul-2007  xtraeme file linux32_sysinfo.c was added on branch matt-mips64 on 2007-07-21 23:39:47 +0000
 1.4.14.1 26-Dec-2007  ad Sync with head.
 1.4.6.1 09-Jan-2008  matt sync with HEAD
 1.4.4.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.5.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.6.18.1 19-Jan-2009  skrll Sync with HEAD.
 1.6.16.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.6.12.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.6.12.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.6.10.1 04-May-2009  yamt sync with head.
 1.6.6.1 17-Jan-2009  mjf Sync with HEAD.
 1.7.72.1 13-Sep-2019  martin Pull up following revision(s) (requested by maxv in ticket #194):

sys/compat/linux/common/linux_socket.c: revision 1.146
sys/compat/linux/common/linux_socket.c: revision 1.147
sys/compat/linux/common/linux_socket.c: revision 1.148
sys/compat/linux/common/linux_socket.c: revision 1.149
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.59
sys/compat/linux32/common/linux32_sysinfo.c: revision 1.8
sys/kern/sysv_shm.c: revision 1.138
sys/compat/linux/common/linux_file64.c: revision 1.61
sys/compat/linux/common/linux_file64.c: revision 1.62
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.58
sys/compat/linux32/common/linux32_dirent.c: revision 1.20
sys/compat/linux32/common/linux32_utsname.c: revision 1.10
sys/compat/linux/common/linux_termios.h: revision 1.22
sys/compat/linux32/common/linux32_termios.c: revision 1.15
sys/compat/linux32/common/linux32_misc.c: revision 1.27
sys/compat/linux32/common/linux32_ioctl.c: revision 1.14
sys/compat/linux/common/linux_statfs.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.57
sys/compat/linux/common/linux_fcntl.h: revision 1.18
sys/compat/linux/common/linux_socket.h: revision 1.24
sys/sys/shm.h: revision 1.54
sys/compat/ossaudio/ossaudio.c: revision 1.75
sys/compat/linux32/common/linux32_signal.c: revision 1.20
sys/miscfs/procfs/procfs_linux.c: revision 1.75
sys/compat/linux/common/linux_signal.c: revision 1.81
sys/compat/linux/common/linux_termios.c: revision 1.38
sys/compat/linux/common/linux_misc.c: revision 1.241
sys/compat/linux/common/linux_misc.c: revision 1.242
sys/compat/linux/common/linux_misc.c: revision 1.243
sys/compat/linux/common/linux_misc.c: revision 1.244

Fix info leaks.

Fix stupid bugs in linux_sys_shmctl(): the index could be out of bound
(page fault) and there was no proper locking.
Maybe we should just remove LINUX_SHM_STAT, like compat_linux32.

Remove printf.

When dealing with an unknown value, set -1, to prevent (harmless)
uninitialized accesses later.

Add a default case, don't call sys_ioctl() with an uninitialized 'com'
argument.

Fix error handling, returns an errno, not -1.

Put the printf under DEBUG_LINUX.


Hum, don't forget the 'pid' argument, otherwise we're not gonna go very
far.

Don't read data from userland directly. This simply does not work on any
recent x86 CPU (thanks to SMAP) and all architectures that forbid direct
access to userland from the kernel. But I guess no one noticed because no
one ever uses compat_linux, right?

Hum, don't pass an mbuf to realloc(). Inspired from copyin32_msg_control().

Fix memory leak.

I don't see the point in having this useless printf, but add a '\n' to it,
so that it at least displays useless stuff correctly.

Hum, remove incorrect assignment. Userland could have passed a smaller
namelen, and the uninitialized bytes from sb_data were being used later in
the network stack.
 1.7.68.3 21-Apr-2020  martin Sync with HEAD
 1.7.68.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.7.68.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.7.60.1 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1487:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.7.54.1 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1720:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149 (patch)
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54 (patch)

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.7.42.1 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1720:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149 (patch)
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54 (patch)

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.10.6.1 20-Apr-2020  bouyer Sync with HEAD
 1.16 26-Nov-2021  ryo The changes on compat/linux/common/linux_termios.c should also
be applied to compat/linux32/common/linux_termios.c, and reduce diff.

- remove duplicate fd_putfile(). This will be done after "goto out;".
- catch up from compat/linux/common/linux_termios.c r1.26 TIOCSPTLCK
- catch up from compat/linux/common/linux_termios.c r1.37 (TCOOFF/TCOON) of the TCXONC
- catch up from compat/linux/common/linux_termios.c r1.39 FIOCLEX and FIONCLEX
 1.15 23-Aug-2019  maxv Add a default case, don't call sys_ioctl() with an uninitialized 'com'
argument.
 1.14 19-Nov-2008  ad branches: 1.14.42; 1.14.54; 1.14.60; 1.14.68; 1.14.72;
Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.13 04-Jul-2008  matthias branches: 1.13.2; 1.13.4;
make LINUX_TCSBRK work. The code is mostly copied from
sys/compat/ibcs2/ibcs2_ioctl.c.
 1.12 28-Apr-2008  martin branches: 1.12.2; 1.12.4;
Remove clause 3 and 4 from TNF licenses
 1.11 22-Mar-2008  bjs branches: 1.11.2; 1.11.4;
fdputfile -> fd_putfile
 1.10 21-Mar-2008  ad Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
 1.9 20-Dec-2007  dsl branches: 1.9.6;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.8 13-May-2007  dsl branches: 1.8.8; 1.8.16; 1.8.20;
This code is already set for directly calling a files ioctl fn with a
kernel buffer - so why not use it when getting the slave pty number.
 1.7 26-Mar-2007  njoly Sync with recent compat linux termios changes.
 1.6 19-Mar-2007  njoly Fix TIOCGPTN ioctl.
Do not use sysioctl() directly, but netbsd32_ioctl() instead.
 1.5 18-Mar-2007  dsl Change all the NETBSD32PTR64(SCARG(uap, xxx))) to SCARG_P32(uap, xxx).
 1.4 16-Mar-2007  dsl remove all the double (and triple) casts used to convert 32bit userspace
pointers to and from 64bit kernel pointers. Instead use the defines
NETBSD32PTR64(p32) to read a 32bit pointer and (the new) NETBSD32PTR32(p32,p64)
to write a 32bit pointer throughout.
The 32bit pointer is now a struct to enforce the above.
amd64 (with linux emul) and sparc64 will both compile (when the arch stuff
goes in soon), and amd64 still runs some i386 binaries.
 1.3 04-Mar-2007  christos branches: 1.3.2; 1.3.4; 1.3.6;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.2 25-Aug-2006  manu branches: 1.2.4; 1.2.10;
netbsd32_sys_ioctl was called with improper syscall argument structure, this
caused any X11 program to fail because FIONREAD ioctl always returned an
error.
 1.1 15-Feb-2006  manu branches: 1.1.2; 1.1.4; 1.1.10; 1.1.16;
- Move the BSD to Linux and Linux to BSD termio/termios conversion functions
to a header where they can be shared between COMPAT_LINUX and COMPAT_LINUX32
- Add termios ioctl emulation to COMPAT_LINUX32
- Add the getcwd system call to COMPAT_LINUX32/amd64

That makes Linux's bash working with COMPAT_LINUX32.
 1.1.16.6 24-Mar-2008  yamt sync with head.
 1.1.16.5 21-Jan-2008  yamt sync with head
 1.1.16.4 03-Sep-2007  yamt sync with head.
 1.1.16.3 30-Dec-2006  yamt sync with head.
 1.1.16.2 21-Jun-2006  yamt sync with head.
 1.1.16.1 15-Feb-2006  yamt file linux32_termios.c was added on branch yamt-lazymbuf on 2006-06-21 14:59:27 +0000
 1.1.10.2 22-Apr-2006  simonb Sync with head.
 1.1.10.1 15-Feb-2006  simonb file linux32_termios.c was added on branch simonb-timecounters on 2006-04-22 11:38:14 +0000
 1.1.4.1 03-Sep-2006  yamt sync with head.
 1.1.2.2 18-Feb-2006  yamt sync with head.
 1.1.2.1 15-Feb-2006  yamt file linux32_termios.c was added on branch yamt-uio_vmspace on 2006-02-18 15:39:02 +0000
 1.2.10.4 17-May-2007  yamt sync with head.
 1.2.10.3 15-Apr-2007  yamt sync with head.
 1.2.10.2 24-Mar-2007  yamt sync with head.
 1.2.10.1 12-Mar-2007  rmind Sync with HEAD.
 1.2.4.2 09-Sep-2006  rpaulo sync with head
 1.2.4.1 25-Aug-2006  rpaulo file linux32_termios.c was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:46:04 +0000
 1.3.6.2 29-Mar-2007  reinoud Pullup to -current
 1.3.6.1 18-Mar-2007  reinoud First attempt to bring branch in sync with HEAD
 1.3.4.1 11-Jul-2007  mjf Sync with head.
 1.3.2.2 27-May-2007  ad Sync with head.
 1.3.2.1 10-Apr-2007  ad Sync with head.
 1.8.20.1 02-Jan-2008  bouyer Sync with HEAD
 1.8.16.1 26-Dec-2007  ad Sync with head.
 1.8.8.1 09-Jan-2008  matt sync with HEAD
 1.9.6.4 17-Jan-2009  mjf Sync with HEAD.
 1.9.6.3 28-Sep-2008  mjf Sync with HEAD.
 1.9.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.9.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.11.4.2 04-May-2009  yamt sync with head.
 1.11.4.1 16-May-2008  yamt sync with head.
 1.11.2.1 18-May-2008  yamt sync with head.
 1.12.4.1 18-Jul-2008  simonb Sync with head.
 1.12.2.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.13.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.13.2.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.14.72.1 13-Sep-2019  martin Pull up following revision(s) (requested by maxv in ticket #194):

sys/compat/linux/common/linux_socket.c: revision 1.146
sys/compat/linux/common/linux_socket.c: revision 1.147
sys/compat/linux/common/linux_socket.c: revision 1.148
sys/compat/linux/common/linux_socket.c: revision 1.149
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.59
sys/compat/linux32/common/linux32_sysinfo.c: revision 1.8
sys/kern/sysv_shm.c: revision 1.138
sys/compat/linux/common/linux_file64.c: revision 1.61
sys/compat/linux/common/linux_file64.c: revision 1.62
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.58
sys/compat/linux32/common/linux32_dirent.c: revision 1.20
sys/compat/linux32/common/linux32_utsname.c: revision 1.10
sys/compat/linux/common/linux_termios.h: revision 1.22
sys/compat/linux32/common/linux32_termios.c: revision 1.15
sys/compat/linux32/common/linux32_misc.c: revision 1.27
sys/compat/linux32/common/linux32_ioctl.c: revision 1.14
sys/compat/linux/common/linux_statfs.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.57
sys/compat/linux/common/linux_fcntl.h: revision 1.18
sys/compat/linux/common/linux_socket.h: revision 1.24
sys/sys/shm.h: revision 1.54
sys/compat/ossaudio/ossaudio.c: revision 1.75
sys/compat/linux32/common/linux32_signal.c: revision 1.20
sys/miscfs/procfs/procfs_linux.c: revision 1.75
sys/compat/linux/common/linux_signal.c: revision 1.81
sys/compat/linux/common/linux_termios.c: revision 1.38
sys/compat/linux/common/linux_misc.c: revision 1.241
sys/compat/linux/common/linux_misc.c: revision 1.242
sys/compat/linux/common/linux_misc.c: revision 1.243
sys/compat/linux/common/linux_misc.c: revision 1.244

Fix info leaks.

Fix stupid bugs in linux_sys_shmctl(): the index could be out of bound
(page fault) and there was no proper locking.
Maybe we should just remove LINUX_SHM_STAT, like compat_linux32.

Remove printf.

When dealing with an unknown value, set -1, to prevent (harmless)
uninitialized accesses later.

Add a default case, don't call sys_ioctl() with an uninitialized 'com'
argument.

Fix error handling, returns an errno, not -1.

Put the printf under DEBUG_LINUX.


Hum, don't forget the 'pid' argument, otherwise we're not gonna go very
far.

Don't read data from userland directly. This simply does not work on any
recent x86 CPU (thanks to SMAP) and all architectures that forbid direct
access to userland from the kernel. But I guess no one noticed because no
one ever uses compat_linux, right?

Hum, don't pass an mbuf to realloc(). Inspired from copyin32_msg_control().

Fix memory leak.

I don't see the point in having this useless printf, but add a '\n' to it,
so that it at least displays useless stuff correctly.

Hum, remove incorrect assignment. Userland could have passed a smaller
namelen, and the uninitialized bytes from sb_data were being used later in
the network stack.
 1.14.68.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.14.60.1 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1487:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.14.54.1 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1720:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149 (patch)
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54 (patch)

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.14.42.1 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1720:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149 (patch)
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54 (patch)

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.2 25-Nov-2021  ryo add support COMPAT_LINUX32 for aarch64
 1.1 15-Feb-2006  manu branches: 1.1.2; 1.1.10; 1.1.16; 1.1.22;
- Move the BSD to Linux and Linux to BSD termio/termios conversion functions
to a header where they can be shared between COMPAT_LINUX and COMPAT_LINUX32
- Add termios ioctl emulation to COMPAT_LINUX32
- Add the getcwd system call to COMPAT_LINUX32/amd64

That makes Linux's bash working with COMPAT_LINUX32.
 1.1.22.2 09-Sep-2006  rpaulo sync with head
 1.1.22.1 15-Feb-2006  rpaulo file linux32_termios.h was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:46:04 +0000
 1.1.16.2 21-Jun-2006  yamt sync with head.
 1.1.16.1 15-Feb-2006  yamt file linux32_termios.h was added on branch yamt-lazymbuf on 2006-06-21 14:59:27 +0000
 1.1.10.2 22-Apr-2006  simonb Sync with head.
 1.1.10.1 15-Feb-2006  simonb file linux32_termios.h was added on branch simonb-timecounters on 2006-04-22 11:38:14 +0000
 1.1.2.2 18-Feb-2006  yamt sync with head.
 1.1.2.1 15-Feb-2006  yamt file linux32_termios.h was added on branch yamt-uio_vmspace on 2006-02-18 15:39:02 +0000
 1.40 19-Sep-2021  thorpej Add the timerfd syscalls to COMPAT_LINUX and COMPAT_LINUX32.
 1.39 19-Sep-2021  thorpej Add the POSIX timer syscalls (timer_create(), timer_settime(), timer_gettime(),
timer_getoverrun(), and timer_delete()) to COMPAT_LINUX and COMPAT_LINUX32.
 1.38 07-Sep-2021  riastradh sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.37 02-Oct-2012  christos branches: 1.37.30; 1.37.42; 1.37.50;
kernel portion of clock_nanosleep()
 1.36 18-Nov-2011  christos branches: 1.36.10;
add sigtimedwait support
 1.35 12-Jul-2010  njoly branches: 1.35.8;
Add CLOCK_MONOTONIC support for compat linux/linux32
clock_nanosleep(2).
 1.34 07-Jul-2010  chs many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
- support new-style (NPTL) linux pthreads on all platforms.
clone() with CLONE_THREAD uses 1 process with many LWPs
instead of separate processes.
- move the contents of sys__lwp_setprivate() into a new
lwp_setprivate() and use that everywhere.
- update linux_release[] and linux32_release[] to "2.6.18".
- adjust placement of emul fork/exec/exit hooks as needed
and adjust other emul code to match.
- convert all struct emul definitions to use named initializers.
- change the pid allocator to allow multiple pids to refer to the same proc.
- remove a few fields from struct proc that are no longer needed.
- disable the non-functional "vdso" code in linux32/amd64,
glibc works fine without it.
- fix a race in the futex code where we could miss a wakeup after
a requeue operation.
- redo futex locking to be a little more efficient.
 1.33 08-Apr-2010  njoly Do not use 0 for pointers, but NULL.
 1.32 08-Apr-2010  njoly Add a new clock_gettime1() function that holds most of the
clock_gettime syscall code (except for the copyout). Adjust all
corresponding syscalls to make use of it.
 1.31 03-Apr-2010  njoly Move most clock_getres syscall code, except for coypout call, to a new
clock_getres1() function which can be used by emulations. Adjust all
clock_getres syscalls to now make of use it.
 1.30 29-Mar-2010  njoly Convert linux/linux32/netbsd32 clock_settime syscalls, to use the
common clock_settime1() function.
 1.29 21-Jul-2009  njoly branches: 1.29.2; 1.29.4;
Kill unreachable return statement.
 1.28 16-Jan-2009  njoly branches: 1.28.2;
Update some syscalls that now needs compat50 timeval structure.
 1.27 29-Dec-2008  njoly Fix stime(2) inverted copyin arguments.
 1.26 29-Dec-2008  njoly s/syscallcarg/syscallarg/ in comments.
 1.25 12-Dec-2008  njoly Add clock_nanosleep syscall.
 1.24 08-Dec-2008  njoly Remove unused timeval_to_clock_t function, superseeded by CONVTCK
macro.
 1.23 19-Nov-2008  ad Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.22 12-Nov-2008  njoly Fix nanosleep(2) on 64-bit archs. Do not call native nanosleep
syscall, but rather a modified version the will take care of `struct
timespec' conversions.
 1.21 08-Sep-2008  christos branches: 1.21.2; 1.21.4;
make this compile again.
 1.20 08-Sep-2008  christos fix broken linux32_sys_times, copied from linux_sys_times.
 1.19 24-Apr-2008  ad branches: 1.19.2; 1.19.4; 1.19.8;
Merge proc::p_mutex and proc::p_smutex into a single adaptive mutex, since
we no longer need to guard against access from hardware interrupt handlers.

Additionally, if cloning a process with CLONE_SIGHAND, arrange to have the
child process share the parent's lock so that signal state may be kept in
sync. Partially addresses PR kern/37437.
 1.18 17-Apr-2008  njoly branches: 1.18.2;
Add compat linux32 sys_clock_{getres,gettime,settime} syscalls.
 1.17 27-Mar-2008  ad Make rusage collection per-LWP and collate in the appropriate places.
cloned threads need a little bit more work but the locking needs to
be fixed first.
 1.16 20-Dec-2007  dsl branches: 1.16.6;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.15 08-Dec-2007  dsl branches: 1.15.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.14 25-Nov-2007  elad branches: 1.14.2;
Refactor time modification checks and place them in the secmodel code.

okay christos@
 1.13 12-May-2007  dsl branches: 1.13.6; 1.13.8; 1.13.14;
Get rusage directly, not via 64bit linux call and stackgap.
 1.12 12-May-2007  dsl Change the compat sys_[fl]utime code to not use the stackgap.
 1.11 22-Apr-2007  dsl Change the way that emulations locate files within the emulation root to
avoid having to allocate space in the 'stackgap'
- which is very LWP unfriendly.
The additional code for non-emulation namei() is trivial, the reduction for
the emulations is massive.
The vnode for a processes emulation root is saved in the cwdi structure
during process exec.
If the emulation root the TRYEMULROOT flag are set, namei() will do an initial
search for absolute pathnames in the emulation root, if that fails it will
retry from the normal root.
".." at the emulation root will always go to the real root, even in the middle
of paths and when expanding symlinks.
Absolute symlinks found using absolute paths in the emulation root will be
relative to the emulation root (so /usr/lib/xxx.so -> /lib/xxx.so links
inside the emulation root don't need changing).
If the root of the emulation would be returned (for an emulation lookup), then
the real root is returned instead (matching the behaviour of emul_lookup,
but being a cheap comparison here) so that programs that scan "../.."
looking for the root dircetory don't loop forever.
The target for symbolic links is no longer mangled (it used to get the
CHECK_ALT_xxx() treatment, so could get /emul/xxx prepended).
CHECK_ALT_xxx() are no more. Most of the change is deleting them, and adding
TRYEMULROOT to the flags to NDINIT().
A lot of the emulation system call stubs could now be deleted.
 1.10 18-Mar-2007  dsl Change all the NETBSD32PTR64(SCARG(uap, xxx))) to SCARG_P32(uap, xxx).
 1.9 16-Mar-2007  dsl remove all the double (and triple) casts used to convert 32bit userspace
pointers to and from 64bit kernel pointers. Instead use the defines
NETBSD32PTR64(p32) to read a 32bit pointer and (the new) NETBSD32PTR32(p32,p64)
to write a 32bit pointer throughout.
The 32bit pointer is now a struct to enforce the above.
amd64 (with linux emul) and sparc64 will both compile (when the arch stuff
goes in soon), and amd64 still runs some i386 binaries.
 1.8 04-Mar-2007  christos branches: 1.8.2; 1.8.4; 1.8.6;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.7 09-Feb-2007  ad branches: 1.7.2;
Merge newlock2 to head.
 1.6 14-Nov-2006  elad Clean some KAUTH_GENERIC_ISSUSER usage in compat code.
 1.5 23-Jul-2006  ad branches: 1.5.4; 1.5.6; 1.5.8;
Use the LWP cached credentials where sane.
 1.4 13-Jun-2006  skd branches: 1.4.4;
include kauth.h
workaround a gcc4 warning.
 1.3 14-May-2006  elad branches: 1.3.2;
integrate kauth.
 1.2 24-Feb-2006  manu branches: 1.2.2; 1.2.4; 1.2.6; 1.2.8;
Fix compat_linux32 time(2) emulation
 1.1 09-Feb-2006  manu branches: 1.1.2;
Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.1.2.3 01-Mar-2006  yamt sync with head.
 1.1.2.2 18-Feb-2006  yamt sync with head.
 1.1.2.1 09-Feb-2006  yamt file linux32_time.c was added on branch yamt-uio_vmspace on 2006-02-18 15:39:02 +0000
 1.2.8.3 01-Jun-2006  kardel Sync with head.
 1.2.8.2 22-Apr-2006  simonb Sync with head.
 1.2.8.1 24-Feb-2006  simonb file linux32_time.c was added on branch simonb-timecounters on 2006-04-22 11:38:14 +0000
 1.2.6.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.2.4.2 10-Mar-2006  elad generic_authorize() -> kauth_authorize_generic().
 1.2.4.1 08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.2.2.3 11-Aug-2006  yamt sync with head
 1.2.2.2 26-Jun-2006  yamt sync with head.
 1.2.2.1 24-May-2006  yamt sync with head.
 1.3.2.1 19-Jun-2006  chap Sync with head.
 1.4.4.7 21-Jan-2008  yamt sync with head
 1.4.4.6 07-Dec-2007  yamt sync with head
 1.4.4.5 03-Sep-2007  yamt sync with head.
 1.4.4.4 26-Feb-2007  yamt sync with head.
 1.4.4.3 30-Dec-2006  yamt sync with head.
 1.4.4.2 21-Jun-2006  yamt sync with head.
 1.4.4.1 13-Jun-2006  yamt file linux32_time.c was added on branch yamt-lazymbuf on 2006-06-21 14:59:27 +0000
 1.5.8.1 10-Dec-2006  yamt sync with head.
 1.5.6.2 09-Sep-2006  rpaulo sync with head
 1.5.6.1 23-Jul-2006  rpaulo file linux32_time.c was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:46:04 +0000
 1.5.4.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.5.4.1 18-Nov-2006  ad Sync with head.
 1.7.2.4 17-May-2007  yamt sync with head.
 1.7.2.3 07-May-2007  yamt sync with head.
 1.7.2.2 24-Mar-2007  yamt sync with head.
 1.7.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.8.6.2 29-Mar-2007  reinoud Pullup to -current
 1.8.6.1 18-Mar-2007  reinoud First attempt to bring branch in sync with HEAD
 1.8.4.1 11-Jul-2007  mjf Sync with head.
 1.8.2.2 27-May-2007  ad Sync with head.
 1.8.2.1 10-Apr-2007  ad Sync with head.
 1.13.14.2 27-Dec-2007  mjf Sync with HEAD.
 1.13.14.1 08-Dec-2007  mjf Sync with HEAD.
 1.13.8.1 09-Jan-2008  matt sync with HEAD
 1.13.6.2 09-Dec-2007  jmcneill Sync with HEAD.
 1.13.6.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.14.2.1 26-Dec-2007  ad Sync with head.
 1.15.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.16.6.4 17-Jan-2009  mjf Sync with HEAD.
 1.16.6.3 28-Sep-2008  mjf Sync with HEAD.
 1.16.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.16.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.18.2.1 18-May-2008  yamt sync with head.
 1.19.8.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.19.8.1 19-Oct-2008  haad Sync with HEAD.
 1.19.4.3 24-Sep-2008  wrstuden Merge in changes between wrstuden-revivesa-base-2 and
wrstuden-revivesa-base-3.
 1.19.4.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.19.4.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.19.2.3 11-Aug-2010  yamt sync with head.
 1.19.2.2 19-Aug-2009  yamt sync with head.
 1.19.2.1 04-May-2009  yamt sync with head.
 1.21.4.1 20-Nov-2008  snj Pull up following revision(s) (requested by njoly in ticket #81):
sys/compat/linux/arch/mips/syscalls.master: revision 1.30
sys/compat/linux/arch/m68k/syscalls.master: revision 1.63
sys/compat/linux32/arch/amd64/syscalls.master: revision 1.39
sys/compat/linux/arch/alpha/syscalls.master: revision 1.63
sys/compat/linux/arch/powerpc/syscalls.master: revision 1.38
sys/compat/linux32/common/linux32_time.c: revision 1.22
sys/compat/linux/arch/amd64/syscalls.master: revision 1.25
sys/compat/linux/arch/i386/syscalls.master: revision 1.94
sys/compat/linux/arch/arm/syscalls.master: revision 1.36
sys/compat/linux/common/linux_time.c: revision 1.26
Fix nanosleep(2) on 64-bit archs. Do not call native nanosleep
syscall, but rather a modified version the will take care of `struct
timespec' conversions.
 1.21.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.28.2.1 23-Jul-2009  jym Sync with HEAD.
 1.29.4.2 05-Mar-2011  rmind sync with head
 1.29.4.1 30-May-2010  rmind sync with head
 1.29.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.29.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.35.8.2 30-Oct-2012  yamt sync with head
 1.35.8.1 17-Apr-2012  yamt sync with head
 1.36.10.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.37.50.1 17-Dec-2020  thorpej Add POSIX timer and timerfd support to COMPAT_LINUX32.
 1.37.42.1 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.37.30.1 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1836):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.18 27-Nov-2021  ryo Add pselect6(2) system call to COMPAT_LINUX32
 1.17 25-Nov-2021  ryo add support COMPAT_LINUX32 for aarch64
 1.16 25-Nov-2021  ryo - Add compat_linux statx(2) syscall.
- The AT_EMPTY_PATH processing from the modification of
sys/compat/linux/common/linux_file64.c r1.63 has been separated, and made
common to linux_statat(), so that it can be used not only by
linux32_sys_fstatat64() but also by other *statat() variants.
 1.15 18-Nov-2011  christos add sigtimedwait support
 1.14 02-Nov-2010  chs branches: 1.14.8;
implement the following syscalls for linux32:
truncate64
ftruncate64
profil
ioperm
iopl
setdomainname
modify_ldt
statfs64
fstatfs64

note that iopl(), ioperm() and modify_ldt() just call
the respective 64-bit handlers, which don't do anything yet.
 1.13 11-Sep-2010  chs recent versions of linux (which we now claim to be) supply a BSD-style
d_type value in getdents() results, after the d_name field.
make our emulation do the same. fixes part of PR 43695.
 1.12 07-Jul-2010  chs many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
- support new-style (NPTL) linux pthreads on all platforms.
clone() with CLONE_THREAD uses 1 process with many LWPs
instead of separate processes.
- move the contents of sys__lwp_setprivate() into a new
lwp_setprivate() and use that everywhere.
- update linux_release[] and linux32_release[] to "2.6.18".
- adjust placement of emul fork/exec/exit hooks as needed
and adjust other emul code to match.
- convert all struct emul definitions to use named initializers.
- change the pid allocator to allow multiple pids to refer to the same proc.
- remove a few fields from struct proc that are no longer needed.
- disable the non-functional "vdso" code in linux32/amd64,
glibc works fine without it.
- fix a race in the futex code where we could miss a wakeup after
a requeue operation.
- redo futex locking to be a little more efficient.
 1.11 16-Jan-2009  njoly branches: 1.11.4; 1.11.6;
Update some syscalls that now needs compat50 timeval structure.
 1.10 05-Jan-2009  njoly Restore struct sysctl padding member name, which was damaged during
__unused removal on arguments.
 1.9 05-Dec-2008  njoly Add getres{uid,gid} syscalls.
 1.8 04-Sep-2008  njoly branches: 1.8.2;
Make linux32 getdents(2) do its own job instead of calling the
corresponding compat linux function, where struct dirent members types
differs.
 1.7 17-Apr-2008  njoly branches: 1.7.4; 1.7.6; 1.7.10;
Add compat linux32 sys_clock_{getres,gettime,settime} syscalls.
 1.6 15-Jan-2008  njoly branches: 1.6.6;
compat linux (and linux32) uid16 functions cleanup and fixes.

- Move uid16 functions to their own file linux_uid16.c, included by
needed archs (arm, i386 and m68k).
- Add new MI types linux_{u,g}id16_t.
- Add macros to handle linux_uid16_t and uid_t conversions.
- Add linux_sys_getres{uid,gid}16 syscalls, to fix an overflow with
bad sizes given to copyout when linux_sys_getres{uid,gid} are used.
- Update arm syscall table to use more uid16 functions.
 1.5 24-Dec-2007  njoly Add old_uname syscall.
 1.4 11-Apr-2007  njoly branches: 1.4.10; 1.4.16; 1.4.18; 1.4.22;
- Add compat amd64 linux32 statfs support, adapted from PR/35956.
- Move bsd_to_linux_statfs() function to its own file to be shared
between both linux compats.

ok by manu.
 1.3 16-Nov-2006  christos branches: 1.3.2; 1.3.4; 1.3.8; 1.3.10;
__unused removal on arguments; approved by core.
 1.2 13-Sep-2006  manu branches: 1.2.2;
Jumbo COMPAT_LINUX/COMPAT_LINUX32 bugfix, with the help of Nicolas Joly
- Fix shmat return value on amd64: it uses no black magic with retval[0]
- Fix integer overflows in sysinfo
- Implement sysinfo, mmap2, sched_getparam, sched_getscheduler, mremap,
and madvise in COMPAT_LINUX32
- Fix improper types used in setgroups16/getgroups16
- Implement mmap2 for COMPAT_LINUX32
- Ifdef debug messages by DEBUG_LINUX
 1.1 09-Feb-2006  manu branches: 1.1.2; 1.1.4; 1.1.10; 1.1.16; 1.1.20; 1.1.22;
Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.1.22.2 09-Sep-2006  rpaulo sync with head
 1.1.22.1 09-Feb-2006  rpaulo file linux32_types.h was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:46:04 +0000
 1.1.20.1 18-Nov-2006  ad Sync with head.
 1.1.16.5 21-Jan-2008  yamt sync with head
 1.1.16.4 03-Sep-2007  yamt sync with head.
 1.1.16.3 30-Dec-2006  yamt sync with head.
 1.1.16.2 21-Jun-2006  yamt sync with head.
 1.1.16.1 09-Feb-2006  yamt file linux32_types.h was added on branch yamt-lazymbuf on 2006-06-21 14:59:27 +0000
 1.1.10.2 22-Apr-2006  simonb Sync with head.
 1.1.10.1 09-Feb-2006  simonb file linux32_types.h was added on branch simonb-timecounters on 2006-04-22 11:38:14 +0000
 1.1.4.1 14-Sep-2006  yamt sync with head.
 1.1.2.2 18-Feb-2006  yamt sync with head.
 1.1.2.1 09-Feb-2006  yamt file linux32_types.h was added on branch yamt-uio_vmspace on 2006-02-18 15:39:02 +0000
 1.2.2.1 10-Dec-2006  yamt sync with head.
 1.3.10.1 11-Jul-2007  mjf Sync with head.
 1.3.8.1 27-May-2007  ad Sync with head.
 1.3.4.1 15-Apr-2007  yamt sync with head.
 1.3.2.1 20-Apr-2007  bouyer Pull up following revision(s) (requested by njoly in ticket #582):
sys/compat/linux32/common/linux32_types.h: revision 1.4 via patch
sys/compat/linux32/arch/amd64/syscalls.master: revision 1.14 via patch
sys/compat/linux/common/linux_statfs.h: revision 1.1 via patch
sys/compat/linux/common/linux_misc.c: revision 1.170 via patch
sys/compat/linux32/common/linux32_misc.c: revision 1.5 via patch
sys/compat/linux32/files.linux32: revision 1.4 via patch
- Add compat amd64 linux32 statfs support, adapted from PR/35956.
- Move bsd_to_linux_statfs() function to its own file to be shared
between both linux compats.
 1.4.22.2 19-Jan-2008  bouyer Sync with HEAD
 1.4.22.1 02-Jan-2008  bouyer Sync with HEAD
 1.4.18.1 26-Dec-2007  ad Sync with head.
 1.4.16.1 18-Feb-2008  mjf Sync with HEAD.
 1.4.10.2 23-Mar-2008  matt sync with HEAD
 1.4.10.1 09-Jan-2008  matt sync with HEAD
 1.6.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.6.6.2 28-Sep-2008  mjf Sync with HEAD.
 1.6.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.7.10.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.7.10.1 19-Oct-2008  haad Sync with HEAD.
 1.7.6.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.7.4.3 09-Oct-2010  yamt sync with head
 1.7.4.2 11-Aug-2010  yamt sync with head.
 1.7.4.1 04-May-2009  yamt sync with head.
 1.8.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.11.6.1 05-Mar-2011  rmind sync with head
 1.11.4.3 06-Nov-2010  uebayasi Sync with HEAD.
 1.11.4.2 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.11.4.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.14.8.1 17-Apr-2012  yamt sync with head
 1.2 19-Nov-2008  ad Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.1 15-Jan-2008  njoly branches: 1.1.2; 1.1.4; 1.1.6; 1.1.12; 1.1.14; 1.1.18; 1.1.24; 1.1.26;
compat linux (and linux32) uid16 functions cleanup and fixes.

- Move uid16 functions to their own file linux_uid16.c, included by
needed archs (arm, i386 and m68k).
- Add new MI types linux_{u,g}id16_t.
- Add macros to handle linux_uid16_t and uid_t conversions.
- Add linux_sys_getres{uid,gid}16 syscalls, to fix an overflow with
bad sizes given to copyout when linux_sys_getres{uid,gid} are used.
- Update arm syscall table to use more uid16 functions.
 1.1.26.1 19-Jan-2009  skrll Sync with HEAD.
 1.1.24.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.1.18.1 04-May-2009  yamt sync with head.
 1.1.14.2 23-Mar-2008  matt sync with HEAD
 1.1.14.1 15-Jan-2008  matt file linux32_uid16.c was added on branch matt-armv6 on 2008-03-23 02:04:33 +0000
 1.1.12.1 17-Jan-2009  mjf Sync with HEAD.
 1.1.6.2 18-Feb-2008  mjf Sync with HEAD.
 1.1.6.1 15-Jan-2008  mjf file linux32_uid16.c was added on branch mjf-devfs on 2008-02-18 21:05:27 +0000
 1.1.4.2 21-Jan-2008  yamt sync with head
 1.1.4.1 15-Jan-2008  yamt file linux32_uid16.c was added on branch yamt-lazymbuf on 2008-01-21 09:41:37 +0000
 1.1.2.2 19-Jan-2008  bouyer Sync with HEAD
 1.1.2.1 15-Jan-2008  bouyer file linux32_uid16.c was added on branch bouyer-xeni386 on 2008-01-19 12:15:00 +0000
 1.44 27-Nov-2021  ryo Add pselect6(2) system call to COMPAT_LINUX32
 1.43 25-Nov-2021  ryo add support COMPAT_LINUX32 for aarch64
 1.42 09-Nov-2019  jdolecek add dummy implementation of linux fallocate() which just returns EOPNOTSUPP;
this is needed so that glibc falls back to emulation and apps behaving
properly, since EOPNOTSUPP is a documented and expected return code, but
ENOSYS is not

right now there are no filesystems in NetBSD tree supporting the fallocate
VOP, so no point trying to map this to a native call

supposed to help with problem reported in
https://mail-index.netbsd.org/tech-kern/2019/11/03/msg025641.html
 1.41 20-Sep-2019  kamil Avoid signed integer overflow when convering linux timeval to timespec

Linux accepts garbage as timeout and attempts to set it to something
meaningful. Instead of checking for valid ranges of usec, just convert
the type safely, regardless of what is inside it.
 1.40 26-Dec-2017  kamil branches: 1.40.4;
Refactor pipe1() and correct a bug in sys_pipe2() (SYS_pipe2)

sys_pipe2() returns two integers (values), the 2nd one is a copy of the 2nd
file descriptor that lands in fildes[2]. This is a side effect of reusing
the code for sys_pipe() (SYS_pipe) and not cleaning it up.

The first returned value is (on success) 0.

Introduced a small refactoring in pipe1() that it does not operate over
retval[], but on an array int[2]. A user sets retval[] for pipe() when
desired and needed.

This refactoring touches compat code: netbsd32, linux, linux32.

Before the changes on NetBSD/amd64:

$ ktruss -i ./a.out
[...]
15131 1 a.out pipe2(0x7f7fff2e62b8, 0) = 0, 4
[...]

After the changes:

$ ktruss -i ./a.out
[...]
782 1 a.out pipe2(0x7f7fff97e850, 0) = 0
[...]

There should not be a visible change for current users.

Sponsored by <The NetBSD Foundation>
 1.39 01-Jun-2014  njoly Cleanup pipe(2) flags, now that native handle them.
 1.38 18-May-2014  njoly Simplify dup3 emulation to call dodup() directly instead of
sys_dup2()+fd_set_exclose(). While here, add some error conditions.
 1.37 04-May-2014  njoly Fix pread/pwrite syscalls which need a 64bit offset argument.
 1.36 18-Nov-2013  chs branches: 1.36.2;
implement the *at() syscalls.
bring the unimplemented syscall list up to date.
 1.35 10-Apr-2011  christos branches: 1.35.4; 1.35.14; 1.35.18;
implement pipe2 and dup3
 1.34 11-Nov-2009  rmind branches: 1.34.4; 1.34.6;
- selcommon/pollcommon: drop redundant l argument.
- Use cached curlwp->l_fd, instead of p->p_fd.
- Inline selscan/pollscan.
 1.33 02-Jun-2009  njoly Make nice(2) return EPERM on error, not EACCES (from sys_setpriority).
 1.32 29-Mar-2009  christos Move the internal poll/select related API's to use timespec instead
of timeval (rides the uvm bump).
 1.31 15-Mar-2009  cegger ansify function definitions
 1.30 16-Jan-2009  njoly branches: 1.30.2;
Update some syscalls that now needs compat50 timeval structure.
 1.29 29-Dec-2008  njoly s/syscallcarg/syscallarg/ in comments.
 1.28 06-Dec-2008  njoly Cleanup; kill netbsd32_caddr_t use.
 1.27 06-Dec-2008  njoly Small setres{uid,gid} cleanup; there is no need to use a specific
handling for -1 uid values.
 1.26 05-Dec-2008  njoly Add getres{uid,gid} syscalls.
 1.25 19-Nov-2008  ad Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.24 03-Oct-2008  njoly branches: 1.24.2;
Compat linux/linux32 nice(2) fix. The syscall argument is an increment
to be added to the current nice value, not an absolute value to be
set.
 1.23 22-Sep-2008  njoly Kill a few linux32 syscalls identical to netbsd32 ones.
No functional changes expected.
 1.22 15-Apr-2008  njoly branches: 1.22.4; 1.22.6; 1.22.10;
Make linux32_sys_nice call sys_setpriority directly instead of
netbsd32_setpriority.
 1.21 17-Feb-2008  njoly branches: 1.21.6;
pread/pwrite fixes: use SCARG_P32 to access pointers, and update
syscalls definitions.
 1.20 02-Feb-2008  dsl Impletemt pread() and pwrite().
 1.19 15-Jan-2008  njoly compat linux (and linux32) uid16 functions cleanup and fixes.

- Move uid16 functions to their own file linux_uid16.c, included by
needed archs (arm, i386 and m68k).
- Add new MI types linux_{u,g}id16_t.
- Add macros to handle linux_uid16_t and uid_t conversions.
- Add linux_sys_getres{uid,gid}16 syscalls, to fix an overflow with
bad sizes given to copyout when linux_sys_getres{uid,gid} are used.
- Update arm syscall table to use more uid16 functions.
 1.18 21-Dec-2007  njoly - Fix setfsuid to return uid on success.
- Replace getfsuid, which never existed on Linux, by correct setfsgid
syscall.

ok by christos and dsl.
 1.17 20-Dec-2007  dsl Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.16 15-Dec-2007  njoly s/netbsd32_void */netbsd32_caddr_t/
 1.15 08-Dec-2007  dsl branches: 1.15.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.14 16-Nov-2007  njoly branches: 1.14.2;
Update, for linux_sys_readlink() removal.
 1.13 07-Nov-2007  njoly Remove remaining 64-bit compat linux syscalls linux_sys_xxx() (except
for ones without arguments), and replace them by their 32-bit
equivalent linux32_sys_xxxx().
 1.12 31-Oct-2007  njoly branches: 1.12.2;
compat linux32 syscalls cleanup.

With stackgap and CHECK_ALT_xxx removal, some linux32 and netbsd32
syscalls are now identical.
To avoid code duplication, remove the linux32 definition and use the
netbsd32 one (no functional change).
 1.11 27-Oct-2007  njoly Add missing chown's syscalls family members.
This makes chown(1)/chgrp(1) works under compat linux32.

Problem reported and fix tested by Arto Huusko. Thanks.
 1.10 16-Jun-2007  dsl branches: 1.10.6; 1.10.8; 1.10.12;
Remove a spare 'timeval' structure - makes this version of this function
match some of the other copies lurking in the world of compat.
 1.9 22-Apr-2007  dsl Change the way that emulations locate files within the emulation root to
avoid having to allocate space in the 'stackgap'
- which is very LWP unfriendly.
The additional code for non-emulation namei() is trivial, the reduction for
the emulations is massive.
The vnode for a processes emulation root is saved in the cwdi structure
during process exec.
If the emulation root the TRYEMULROOT flag are set, namei() will do an initial
search for absolute pathnames in the emulation root, if that fails it will
retry from the normal root.
".." at the emulation root will always go to the real root, even in the middle
of paths and when expanding symlinks.
Absolute symlinks found using absolute paths in the emulation root will be
relative to the emulation root (so /usr/lib/xxx.so -> /lib/xxx.so links
inside the emulation root don't need changing).
If the root of the emulation would be returned (for an emulation lookup), then
the real root is returned instead (matching the behaviour of emul_lookup,
but being a cheap comparison here) so that programs that scan "../.."
looking for the root dircetory don't loop forever.
The target for symbolic links is no longer mangled (it used to get the
CHECK_ALT_xxx() treatment, so could get /emul/xxx prepended).
CHECK_ALT_xxx() are no more. Most of the change is deleting them, and adding
TRYEMULROOT to the flags to NDINIT().
A lot of the emulation system call stubs could now be deleted.
 1.8 02-Apr-2007  njoly Fix select() behaviour with NULL timeout, to blocks indefinitely
instead of returning immediately.
Reported by Edgar Fu� on port-amd64@.
 1.7 18-Mar-2007  dsl Change all the NETBSD32PTR64(SCARG(uap, xxx))) to SCARG_P32(uap, xxx).
 1.6 04-Mar-2007  christos branches: 1.6.2; 1.6.4; 1.6.6;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.5 09-Feb-2007  ad branches: 1.5.2;
Merge newlock2 to head.
 1.4 13-Sep-2006  manu branches: 1.4.4;
Jumbo COMPAT_LINUX/COMPAT_LINUX32 bugfix, with the help of Nicolas Joly
- Fix shmat return value on amd64: it uses no black magic with retval[0]
- Fix integer overflows in sysinfo
- Implement sysinfo, mmap2, sched_getparam, sched_getscheduler, mremap,
and madvise in COMPAT_LINUX32
- Fix improper types used in setgroups16/getgroups16
- Implement mmap2 for COMPAT_LINUX32
- Ifdef debug messages by DEBUG_LINUX
 1.3 06-Sep-2006  manu branches: 1.3.2; 1.3.4;
Fix linux32_sys_setres{uid|gid}: -1 does not means the same thing on i386
and amd64...
 1.2 13-Jun-2006  skd branches: 1.2.4;
include kauth.h
workaround a gcc4 warning.
 1.1 09-Feb-2006  manu branches: 1.1.2; 1.1.4; 1.1.10; 1.1.12;
Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.1.12.1 19-Jun-2006  chap Sync with head.
 1.1.10.2 22-Apr-2006  simonb Sync with head.
 1.1.10.1 09-Feb-2006  simonb file linux32_unistd.c was added on branch simonb-timecounters on 2006-04-22 11:38:14 +0000
 1.1.4.2 14-Sep-2006  yamt sync with head.
 1.1.4.1 26-Jun-2006  yamt sync with head.
 1.1.2.2 18-Feb-2006  yamt sync with head.
 1.1.2.1 09-Feb-2006  yamt file linux32_unistd.c was added on branch yamt-uio_vmspace on 2006-02-18 15:39:02 +0000
 1.2.4.11 27-Feb-2008  yamt sync with head.
 1.2.4.10 04-Feb-2008  yamt sync with head.
 1.2.4.9 21-Jan-2008  yamt sync with head
 1.2.4.8 07-Dec-2007  yamt sync with head
 1.2.4.7 15-Nov-2007  yamt sync with head.
 1.2.4.6 27-Oct-2007  yamt sync with head.
 1.2.4.5 03-Sep-2007  yamt sync with head.
 1.2.4.4 26-Feb-2007  yamt sync with head.
 1.2.4.3 30-Dec-2006  yamt sync with head.
 1.2.4.2 21-Jun-2006  yamt sync with head.
 1.2.4.1 13-Jun-2006  yamt file linux32_unistd.c was added on branch yamt-lazymbuf on 2006-06-21 14:59:27 +0000
 1.3.4.2 09-Sep-2006  rpaulo sync with head
 1.3.4.1 06-Sep-2006  rpaulo file linux32_unistd.c was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:46:04 +0000
 1.3.2.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.3.2.1 18-Nov-2006  ad Sync with head.
 1.4.4.1 12-Apr-2007  bouyer Pull up following revision(s) (requested by njoly in ticket #564):
sys/compat/linux32/common/linux32_unistd.c: revision 1.8
Fix select() behaviour with NULL timeout, to blocks indefinitely
instead of returning immediately.
Reported by Edgar Fu� on port-amd64@.
 1.5.2.4 07-May-2007  yamt sync with head.
 1.5.2.3 15-Apr-2007  yamt sync with head.
 1.5.2.2 24-Mar-2007  yamt sync with head.
 1.5.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.6.6.1 29-Mar-2007  reinoud Pullup to -current
 1.6.4.1 11-Jul-2007  mjf Sync with head.
 1.6.2.3 15-Jul-2007  ad Sync with head.
 1.6.2.2 27-May-2007  ad Sync with head.
 1.6.2.1 10-Apr-2007  ad Sync with head.
 1.10.12.2 18-Nov-2007  bouyer Sync with HEAD
 1.10.12.1 13-Nov-2007  bouyer Sync with HEAD
 1.10.8.4 23-Mar-2008  matt sync with HEAD
 1.10.8.3 09-Jan-2008  matt sync with HEAD
 1.10.8.2 08-Nov-2007  matt sync with -HEAD
 1.10.8.1 06-Nov-2007  matt sync with HEAD
 1.10.6.5 09-Dec-2007  jmcneill Sync with HEAD.
 1.10.6.4 21-Nov-2007  joerg Sync with HEAD.
 1.10.6.3 11-Nov-2007  joerg Sync with HEAD.
 1.10.6.2 31-Oct-2007  joerg Sync with HEAD.
 1.10.6.1 28-Oct-2007  joerg Sync with HEAD.
 1.12.2.3 18-Feb-2008  mjf Sync with HEAD.
 1.12.2.2 27-Dec-2007  mjf Sync with HEAD.
 1.12.2.1 19-Nov-2007  mjf Sync with HEAD.
 1.14.2.1 26-Dec-2007  ad Sync with head.
 1.15.4.2 19-Jan-2008  bouyer Sync with HEAD
 1.15.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.21.6.4 17-Jan-2009  mjf Sync with HEAD.
 1.21.6.3 05-Oct-2008  mjf Sync with HEAD.
 1.21.6.2 28-Sep-2008  mjf Sync with HEAD.
 1.21.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.22.10.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.22.10.1 19-Oct-2008  haad Sync with HEAD.
 1.22.6.3 10-Oct-2008  skrll Sync with HEAD.
 1.22.6.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.22.6.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.22.4.3 11-Mar-2010  yamt sync with head
 1.22.4.2 20-Jun-2009  yamt sync with head
 1.22.4.1 04-May-2009  yamt sync with head.
 1.24.2.2 28-Apr-2009  skrll Sync with HEAD.
 1.24.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.30.2.2 23-Jul-2009  jym Sync with HEAD.
 1.30.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.34.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.34.4.1 21-Apr-2011  rmind sync with head
 1.35.18.1 18-May-2014  rmind sync with head
 1.35.14.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.35.4.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.36.2.1 10-Aug-2014  tls Rebase.
 1.40.4.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.10 23-Aug-2019  maxv Fix info leaks.
 1.9 19-Nov-2008  ad branches: 1.9.42; 1.9.54; 1.9.60; 1.9.68; 1.9.72;
Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.8 24-Dec-2007  njoly branches: 1.8.6; 1.8.10; 1.8.12; 1.8.16; 1.8.18;
Add old_uname syscall.
 1.7 20-Dec-2007  dsl Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.6 08-Dec-2007  dsl branches: 1.6.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.5 09-Nov-2007  njoly branches: 1.5.2;
Make linux32_sys_oldolduname use LINUX_UNAME_ARCH instead of machine,
like other uname syscalls. While here, remove unneeded
LINUX_UNAME_ARCH #ifdef/#endif checks.
 1.4 08-Nov-2007  njoly Replace strncpy with strlcpy in compat linux and linux32 uname,
old_uname and oldold_uname syscalls to ensure that all *utsname fields
are always NUL terminated.
 1.3 18-Mar-2007  dsl branches: 1.3.8; 1.3.10; 1.3.14; 1.3.16;
Change all the NETBSD32PTR64(SCARG(uap, xxx))) to SCARG_P32(uap, xxx).
 1.2 09-Feb-2007  ad branches: 1.2.2; 1.2.6; 1.2.8; 1.2.10;
Merge newlock2 to head.
 1.1 09-Feb-2006  manu branches: 1.1.2; 1.1.10; 1.1.16; 1.1.20; 1.1.22;
Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.1.22.2 09-Sep-2006  rpaulo sync with head
 1.1.22.1 09-Feb-2006  rpaulo file linux32_utsname.c was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:46:04 +0000
 1.1.20.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.1.16.6 21-Jan-2008  yamt sync with head
 1.1.16.5 15-Nov-2007  yamt sync with head.
 1.1.16.4 03-Sep-2007  yamt sync with head.
 1.1.16.3 26-Feb-2007  yamt sync with head.
 1.1.16.2 21-Jun-2006  yamt sync with head.
 1.1.16.1 09-Feb-2006  yamt file linux32_utsname.c was added on branch yamt-lazymbuf on 2006-06-21 14:59:27 +0000
 1.1.10.2 22-Apr-2006  simonb Sync with head.
 1.1.10.1 09-Feb-2006  simonb file linux32_utsname.c was added on branch simonb-timecounters on 2006-04-22 11:38:14 +0000
 1.1.2.2 18-Feb-2006  yamt sync with head.
 1.1.2.1 09-Feb-2006  yamt file linux32_utsname.c was added on branch yamt-uio_vmspace on 2006-02-18 15:39:02 +0000
 1.2.10.1 29-Mar-2007  reinoud Pullup to -current
 1.2.8.1 11-Jul-2007  mjf Sync with head.
 1.2.6.1 10-Apr-2007  ad Sync with head.
 1.2.2.1 24-Mar-2007  yamt sync with head.
 1.3.16.2 27-Dec-2007  mjf Sync with HEAD.
 1.3.16.1 19-Nov-2007  mjf Sync with HEAD.
 1.3.14.1 13-Nov-2007  bouyer Sync with HEAD
 1.3.10.1 09-Jan-2008  matt sync with HEAD
 1.3.8.2 09-Dec-2007  jmcneill Sync with HEAD.
 1.3.8.1 11-Nov-2007  joerg Sync with HEAD.
 1.5.2.1 26-Dec-2007  ad Sync with head.
 1.6.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.8.18.1 19-Jan-2009  skrll Sync with HEAD.
 1.8.16.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.8.12.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.8.12.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.8.10.1 04-May-2009  yamt sync with head.
 1.8.6.1 17-Jan-2009  mjf Sync with HEAD.
 1.9.72.1 13-Sep-2019  martin Pull up following revision(s) (requested by maxv in ticket #194):

sys/compat/linux/common/linux_socket.c: revision 1.146
sys/compat/linux/common/linux_socket.c: revision 1.147
sys/compat/linux/common/linux_socket.c: revision 1.148
sys/compat/linux/common/linux_socket.c: revision 1.149
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.59
sys/compat/linux32/common/linux32_sysinfo.c: revision 1.8
sys/kern/sysv_shm.c: revision 1.138
sys/compat/linux/common/linux_file64.c: revision 1.61
sys/compat/linux/common/linux_file64.c: revision 1.62
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.58
sys/compat/linux32/common/linux32_dirent.c: revision 1.20
sys/compat/linux32/common/linux32_utsname.c: revision 1.10
sys/compat/linux/common/linux_termios.h: revision 1.22
sys/compat/linux32/common/linux32_termios.c: revision 1.15
sys/compat/linux32/common/linux32_misc.c: revision 1.27
sys/compat/linux32/common/linux32_ioctl.c: revision 1.14
sys/compat/linux/common/linux_statfs.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.57
sys/compat/linux/common/linux_fcntl.h: revision 1.18
sys/compat/linux/common/linux_socket.h: revision 1.24
sys/sys/shm.h: revision 1.54
sys/compat/ossaudio/ossaudio.c: revision 1.75
sys/compat/linux32/common/linux32_signal.c: revision 1.20
sys/miscfs/procfs/procfs_linux.c: revision 1.75
sys/compat/linux/common/linux_signal.c: revision 1.81
sys/compat/linux/common/linux_termios.c: revision 1.38
sys/compat/linux/common/linux_misc.c: revision 1.241
sys/compat/linux/common/linux_misc.c: revision 1.242
sys/compat/linux/common/linux_misc.c: revision 1.243
sys/compat/linux/common/linux_misc.c: revision 1.244

Fix info leaks.

Fix stupid bugs in linux_sys_shmctl(): the index could be out of bound
(page fault) and there was no proper locking.
Maybe we should just remove LINUX_SHM_STAT, like compat_linux32.

Remove printf.

When dealing with an unknown value, set -1, to prevent (harmless)
uninitialized accesses later.

Add a default case, don't call sys_ioctl() with an uninitialized 'com'
argument.

Fix error handling, returns an errno, not -1.

Put the printf under DEBUG_LINUX.


Hum, don't forget the 'pid' argument, otherwise we're not gonna go very
far.

Don't read data from userland directly. This simply does not work on any
recent x86 CPU (thanks to SMAP) and all architectures that forbid direct
access to userland from the kernel. But I guess no one noticed because no
one ever uses compat_linux, right?

Hum, don't pass an mbuf to realloc(). Inspired from copyin32_msg_control().

Fix memory leak.

I don't see the point in having this useless printf, but add a '\n' to it,
so that it at least displays useless stuff correctly.

Hum, remove incorrect assignment. Userland could have passed a smaller
namelen, and the uninitialized bytes from sb_data were being used later in
the network stack.
 1.9.68.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.9.60.1 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1487:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.9.54.1 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1720:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149 (patch)
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54 (patch)

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.9.42.1 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1720:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149 (patch)
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54 (patch)

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.13 18-Aug-2023  christos Add linux waitid(2) from GSoC 2023 (Theodore Preduta)
 1.12 10-Nov-2016  christos GC WOPTSCHECKED
 1.11 04-Nov-2009  rmind branches: 1.11.22; 1.11.40; 1.11.44;
do_sys_wait(): fix previous by checking for ru != NULL. Noticed by
Onno van der Linden. Also, remove redundant arguments (seems that
was_zombie was not used since rev 1.177 ?).
 1.10 17-Jan-2009  njoly Convert linux/linux32 wait(4) to use a compat50 rusage structure.
 1.9 19-Nov-2008  ad Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.8 24-Apr-2008  ad branches: 1.8.2; 1.8.4; 1.8.8; 1.8.10;
Merge proc::p_mutex and proc::p_smutex into a single adaptive mutex, since
we no longer need to guard against access from hardware interrupt handlers.

Additionally, if cloning a process with CLONE_SIGHAND, arrange to have the
child process share the parent's lock so that signal state may be kept in
sync. Partially addresses PR kern/37437.
 1.7 23-Apr-2008  ad Catch up with linux.
 1.6 20-Dec-2007  dsl branches: 1.6.6; 1.6.8;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.5 17-Dec-2007  njoly Fix linux32_sys_wait4 by doing its own jobw instead off calling
linux_sys_wait4. It worked except when child resources were requested,
because 32/64 bits struct rusage differs in size ...

While here, update linux32_sys_waitpid to use linux32_sys_wait4 with a
NULL rusage.
 1.4 08-Dec-2007  dsl branches: 1.4.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.3 18-Mar-2007  dsl branches: 1.3.8; 1.3.10; 1.3.18;
Change all the NETBSD32PTR64(SCARG(uap, xxx))) to SCARG_P32(uap, xxx).
 1.2 09-Feb-2007  ad branches: 1.2.2; 1.2.6; 1.2.8; 1.2.10;
Merge newlock2 to head.
 1.1 09-Feb-2006  manu branches: 1.1.2; 1.1.10; 1.1.16; 1.1.20; 1.1.22;
Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.1.22.2 09-Sep-2006  rpaulo sync with head
 1.1.22.1 09-Feb-2006  rpaulo file linux32_wait.c was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:46:04 +0000
 1.1.20.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.1.16.5 21-Jan-2008  yamt sync with head
 1.1.16.4 03-Sep-2007  yamt sync with head.
 1.1.16.3 26-Feb-2007  yamt sync with head.
 1.1.16.2 21-Jun-2006  yamt sync with head.
 1.1.16.1 09-Feb-2006  yamt file linux32_wait.c was added on branch yamt-lazymbuf on 2006-06-21 14:59:27 +0000
 1.1.10.2 22-Apr-2006  simonb Sync with head.
 1.1.10.1 09-Feb-2006  simonb file linux32_wait.c was added on branch simonb-timecounters on 2006-04-22 11:38:14 +0000
 1.1.2.2 18-Feb-2006  yamt sync with head.
 1.1.2.1 09-Feb-2006  yamt file linux32_wait.c was added on branch yamt-uio_vmspace on 2006-02-18 15:39:02 +0000
 1.2.10.1 29-Mar-2007  reinoud Pullup to -current
 1.2.8.1 11-Jul-2007  mjf Sync with head.
 1.2.6.1 10-Apr-2007  ad Sync with head.
 1.2.2.1 24-Mar-2007  yamt sync with head.
 1.3.18.1 26-Dec-2007  ad Sync with head.
 1.3.10.1 09-Jan-2008  matt sync with HEAD
 1.3.8.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.4.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.6.8.1 18-May-2008  yamt sync with head.
 1.6.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.6.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.8.10.1 19-Jan-2009  skrll Sync with HEAD.
 1.8.8.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.8.4.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.8.4.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.8.2.2 11-Mar-2010  yamt sync with head
 1.8.2.1 04-May-2009  yamt sync with head.
 1.11.44.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.11.40.1 05-Dec-2016  skrll Sync with HEAD
 1.11.22.1 03-Dec-2017  jdolecek update from HEAD
 1.3 17-Nov-2014  uebayasi Define compat modules (but without dependencies yet).
 1.2 20-Jul-1997  pk branches: 1.2.202;
config.new => config
 1.1 10-Sep-1996  thorpej Add exec glue for `COMPAT_M68K4K'; just map the executable the way
a MID_M68K4K expects to be mapped. Allows any m68k port with
NBPG == 4096 to run NetBSD/hp300 executables, and will allow hp300s
to run legacy executables when that port's default format is eventually
changed to match the other m68k ports.
 1.2.202.1 03-Dec-2017  jdolecek update from HEAD
 1.25 20-Nov-2019  pgoyette Move all non-emulation-specific coredump code into the coredump module,
and remove all #ifdef COREDUMP conditional compilation. Now, the
coredump module is completely separated from the emulation modules, and
they can all be independently loaded and unloaded.

Welcome to 9.99.18 !
 1.24 07-Mar-2014  christos branches: 1.24.30;
c99 initializers for struct execsw
 1.23 19-Sep-2013  christos exec modules need to be of the exec kind
 1.22 17-Aug-2009  cegger branches: 1.22.12; 1.22.22; 1.22.26;
buildfix: #include <sys/exec_aout.h>
 1.21 21-Nov-2008  he Need to include <sys/module.h> when using the MODULE() macro.
 1.20 19-Nov-2008  ad Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.19 08-Dec-2007  dsl branches: 1.19.12; 1.19.16; 1.19.22; 1.19.24;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.18 04-Dec-2007  dsl Remove all the __P
 1.17 11-Dec-2005  christos branches: 1.17.44; 1.17.46; 1.17.52; 1.17.56;
merge ktrace-lwp.
 1.16 26-Feb-2005  perry branches: 1.16.4;
nuke trailing whitespace
 1.15 30-Jan-2005  christos Don't try to map a 0 size bss.
 1.14 08-Aug-2003  christos branches: 1.14.8; 1.14.10;
- GC all the setup_stack functions
- add one for linux/i386
 1.13 29-Jun-2003  fvdl branches: 1.13.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.12 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.11 01-Apr-2003  thorpej Use PAGE_SIZE rather than NBPG.
 1.10 05-Oct-2002  chs count executable image pages as executable for vm-usage purposes.
also, always do the VTEXT vs. v_writecount mutual exclusion
(which we previously skipped if the text or data segment was empty).
 1.9 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.8 13-Nov-2001  lukem branches: 1.8.10;
add RCSIDs (including regeneration of files as appropriate)
 1.7 30-Oct-2001  thorpej - Add a new vnode flag VEXECMAP, which indicates that a vnode has
executable mappings. Stop overloading VTEXT for this purpose (VTEXT
also has another meaning).
- Rename vn_marktext() to vn_markexec(), and use it when executable
mappings of a vnode are established.
- In places where we want to set VTEXT, set it in v_flag directly, rather
than making a function call to do this (it no longer makes sense to
use a function call, since we no longer overload VTEXT with VEXECMAP's
meaning).

VEXECMAP suggested by Chuq Silvers.
 1.6 21-Nov-2000  jdolecek branches: 1.6.2; 1.6.4; 1.6.8;
restructure struct emul and execsw, in preparation to make emulations LKMable:
* move all exec-type specific information from struct emul to execsw[] and
provide single struct emul per emulation
* elf:
- kern/exec_elf32.c:probe_funcs[] is gone, execsw[] how has one entry
per emulation and contains pointer to respective probe function
- interp is allocated via MALLOC() rather than on stack
- elf_args structure is allocated via MALLOC() rather than malloc()
* ecoff: the per-emulation hooks moved from alpha and mips specific code
to OSF1 and Ultrix compat code as appropriate, execsw[] has one entry per
emulation supporting ecoff with appropriate probe function
* the makecmds/probe functions don't set emulation, pointer to emulation is
part of appropriate execsw[] entry
* constify couple of structures
 1.5 28-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.4 11-Apr-2000  chs add a new function vn_marktext() for exec code to let others know
that the vnode is now being used as process text.
 1.3 20-Feb-1999  thorpej branches: 1.3.4; 1.3.8;
If we match, and we're COMPAT_AOUT, use the a.out compat syscall switch,
not the "stock" one.
 1.2 04-Apr-1997  thorpej kill an unused variable
 1.1 10-Sep-1996  thorpej Add exec glue for `COMPAT_M68K4K'; just map the executable the way
a MID_M68K4K expects to be mapped. Allows any m68k port with
NBPG == 4096 to run NetBSD/hp300 executables, and will allow hp300s
to run legacy executables when that port's default format is eventually
changed to match the other m68k ports.
 1.3.8.2 22-Nov-2000  bouyer Sync with HEAD.
 1.3.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.3.4.1 04-Jul-1999  chs after setting VTEXT on a vnode, flush any UBC mappings
to try to prevent unnecessary VAC aliases.
 1.6.8.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.6.4.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.6.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.6.2.2 18-Oct-2002  nathanw Catch up to -current.
 1.6.2.1 14-Nov-2001  nathanw Catch up to -current.
 1.8.10.2 02-Oct-2003  tron Pull up revision 1.10 (requested by junyoung in ticket #1488):
count executable image pages as executable for vm-usage purposes.
also, always do the VTEXT vs. v_writecount mutual exclusion
(which we previously skipped if the text or data segment was empty).
 1.8.10.1 27-Sep-2003  tron Pull up revision 1.9 (requested by junyoung in ticket #1466):
remove trailing \n in panic(). approved perry.
 1.13.2.7 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.13.2.6 09-Feb-2005  skrll Adapt to branch.
 1.13.2.5 04-Feb-2005  skrll Sync with HEAD.
 1.13.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.13.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.13.2.2 03-Aug-2004  skrll Sync with HEAD
 1.13.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.14.10.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.14.10.1 12-Feb-2005  yamt sync with head.
 1.14.8.1 29-Apr-2005  kent sync with -current
 1.16.4.3 21-Jan-2008  yamt sync with head
 1.16.4.2 07-Dec-2007  yamt sync with head
 1.16.4.1 21-Jun-2006  yamt sync with head.
 1.17.56.2 26-Dec-2007  ad Sync with head.
 1.17.56.1 08-Dec-2007  ad Sync with head.
 1.17.52.2 27-Dec-2007  mjf Sync with HEAD.
 1.17.52.1 08-Dec-2007  mjf Sync with HEAD.
 1.17.46.1 09-Jan-2008  matt sync with HEAD
 1.17.44.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.19.24.1 19-Jan-2009  skrll Sync with HEAD.
 1.19.22.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.19.16.2 19-Aug-2009  yamt sync with head.
 1.19.16.1 04-May-2009  yamt sync with head.
 1.19.12.1 17-Jan-2009  mjf Sync with HEAD.
 1.22.26.1 18-May-2014  rmind sync with head
 1.22.22.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.22.12.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.24.30.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.7 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.6 04-Dec-2007  dsl branches: 1.6.12; 1.6.14; 1.6.16;
Remove all the __P
 1.5 11-Dec-2005  christos branches: 1.5.44; 1.5.46; 1.5.52; 1.5.56;
merge ktrace-lwp.
 1.4 29-Jun-2003  fvdl branches: 1.4.2; 1.4.18;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.3 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.2 09-Oct-1997  jtc Fix tipo inherited from old version of TNF copyright template.
 1.1 10-Sep-1996  thorpej branches: 1.1.10;
Add exec glue for `COMPAT_M68K4K'; just map the executable the way
a MID_M68K4K expects to be mapped. Allows any m68k port with
NBPG == 4096 to run NetBSD/hp300 executables, and will allow hp300s
to run legacy executables when that port's default format is eventually
changed to match the other m68k ports.
 1.1.10.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.4.18.2 07-Dec-2007  yamt sync with head
 1.4.18.1 21-Jun-2006  yamt sync with head.
 1.4.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.5.56.1 08-Dec-2007  ad Sync with head.
 1.5.52.1 08-Dec-2007  mjf Sync with HEAD.
 1.5.46.1 09-Jan-2008  matt sync with HEAD
 1.5.44.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.6.16.1 16-May-2008  yamt sync with head.
 1.6.14.1 18-May-2008  yamt sync with head.
 1.6.12.1 02-Jun-2008  mjf Sync with HEAD.
 1.7 28-Sep-2022  msaitoh Simplify sys/compat/sys/sockio.h. No functional change intended.

- Move some definitions from sys/compat/sockio.h to compat/net/if.h.
struct oif_data in sockio.h and if_data50 are the same, so remove oif_data.
Do the same thing to oifdatareq, too.
- u_quad_t -> uint64_t. No functional change.
 1.6 28-Sep-2022  msaitoh s/u_quad_t/uint64_t/. No functional change.
 1.5 15-Dec-2019  tsutsui Remove clause 3 and 4 leftovers from TNF licenses in more sources.

Confirmed by martin@ in PR/54760.
 1.4 21-Sep-2016  roy branches: 1.4.14; 1.4.16; 1.4.20;
Add ifam_pid and ifam_addrflags to ifa_msghdr.
Re-version RTM_NEWADDR, RTM_DELADDR, RTM_CHGADDR and NET_RT_IFLIST.
Add compat code for old version.
 1.3 01-Feb-2011  matt branches: 1.3.14; 1.3.32; 1.3.36;
Add a new AF/PF_ROUTE which is 64-bit clean which makes the routing socket
interface (and its associated sysctls) act identically for both 32 and 64 bit
programs. The old unclean one remains for backward compatibility.
 1.2 11-Jan-2009  christos branches: 1.2.2; 1.2.4; 1.2.10; 1.2.12; 1.2.14;
merge christos-time_t
 1.1 29-Mar-2008  christos branches: 1.1.2; 1.1.6;
file if.h was initially added on branch christos-time_t.
 1.1.6.1 04-May-2009  yamt sync with head.
 1.1.2.2 28-Dec-2008  christos minor adjustments for module builds.
 1.1.2.1 29-Mar-2008  christos new files
 1.2.14.1 08-Feb-2011  bouyer Sync with HEAD
 1.2.12.1 06-Jun-2011  jruoho Sync with HEAD.
 1.2.10.1 05-Mar-2011  rmind sync with head
 1.2.4.2 19-Jan-2009  skrll Sync with HEAD.
 1.2.4.1 11-Jan-2009  skrll file if.h was added on branch nick-hppapmap on 2009-01-19 13:17:36 +0000
 1.2.2.2 17-Jan-2009  mjf Sync with HEAD.
 1.2.2.1 11-Jan-2009  mjf file if.h was added on branch mjf-devfs2 on 2009-01-17 13:28:46 +0000
 1.3.36.1 04-Nov-2016  pgoyette Sync with HEAD
 1.3.32.1 05-Oct-2016  skrll Sync with HEAD
 1.3.14.1 03-Dec-2017  jdolecek update from HEAD
 1.4.20.1 18-Dec-2019  martin Pull up following revision(s) (requested by tsutsui in ticket #570):

sys/compat/netbsd32/netbsd32_compat_50_sysv.c: revision 1.3
sys/dev/raidframe/rf_compat50.h: revision 1.6
sys/arch/emips/emips/bus_space.c: revision 1.3
sys/compat/net/if.h: revision 1.5
sys/arch/emips/stand/common/bootinfo.c: revision 1.2
sys/compat/common/sysv_msg_50.c: revision 1.5
sys/compat/common/kern_time_30.c: revision 1.8
sys/arch/emips/stand/common/bootinfo.h: revision 1.2
sys/arch/ia64/include/bus.h: revision 1.4
sys/arch/ia64/ia64/bus_space.c: revision 1.2
sys/compat/common/sysv_shm_50.c: revision 1.5
sys/dev/ic/adw.h: revision 1.15
sys/compat/common/uipc_syscalls_50.c: revision 1.10
sys/arch/emips/ebus/flash_ebus.c: revision 1.22
sys/dev/ic/adv.h: revision 1.15
sys/dev/ic/adwmcode.c: revision 1.18
sys/dev/ic/advlib.c: revision 1.29
sys/arch/hpcarm/include/kloader.h: revision 1.3
sys/dev/usb/uberry.c: revision 1.16
sys/compat/common/sysv_sem_50.c: revision 1.5
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.43
sys/dev/ic/advlib.h: revision 1.21
sys/dev/ic/adv.c: revision 1.50
sys/compat/netinet6/in6_var.h: revision 1.5
sys/arch/hpc/stand/hpcboot/arm/arm_sa1100_asm.asm: revision 1.2
sys/arch/emips/include/loadfile_machdep.h: revision 1.3
sys/arch/emips/stand/common/prom_iface.c: revision 1.7
sys/dev/ic/adw.c: revision 1.56
sys/dev/ic/adwmcode.h: revision 1.12
sys/dev/ic/advmcode.c: revision 1.10
sys/arch/emips/ebus/ace_ebus.c: revision 1.22
sys/compat/netbsd32/netbsd32_compat_60.c: revision 1.5
sys/dev/raidframe/rf_compat50.c: revision 1.13
sys/arch/x68k/dev/intiovar.h: revision 1.15
sys/dev/usb/uipad.c: revision 1.8
sys/arch/zaurus/include/kloader.h: revision 1.3
sys/arch/emips/stand/common/bootxx.c: revision 1.2
sys/dev/ic/adwlib.h: revision 1.23
sys/dev/ic/adwlib.c: revision 1.44
sys/compat/netbsd32/netbsd32_compat_16.c: revision 1.3
sys/arch/amigappc/include/intr.h: revision 1.27
sys/arch/x68k/dev/mfp.c: revision 1.27
sys/arch/arm/at91/at91dbgu.c: revision 1.17
sys/dev/ic/advmcode.h: revision 1.7
sys/compat/ultrix/ultrix_exec.h: revision 1.7
sys/compat/common/vfs_syscalls_50.c: revision 1.24
sys/arch/mips/cavium/octeon_dma.c: revision 1.3
sys/arch/hpc/stand/hpcboot/arm/arm_pxa2x0_asm.asm: revision 1.2

Remove clause 3 and 4 from TNF licenses.
Ok'ed by martin@ in PR/54760.

Remove clause 3 and 4 leftovers from TNF licenses in more sources.
Confirmed by martin@ in PR/54760.
 1.4.16.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.4.14.3 14-Jan-2019  pgoyette Create a variant of the HOOK macros that handles hook routines of
type void, and use them where appropriate.
 1.4.14.2 13-Jan-2019  pgoyette Add the required hooks for rtsock_50 and modify the COMPATCALL() macro
to use the hooks. While the rtsock_50 situation is still sub-optimal
(it includes the main rtsock.c with a whole bunch of function and
variable redefinitions via macros), this at least makes it possible to
load the rtsock_50 code separately from more recent code, rather than
the previous requirement that rtsock_50 be built-in.
 1.4.14.1 17-Sep-2018  pgoyette Adapt (most of) the indirect function pointers to the new MP-safe
mechanism. Still remaining are the compat_netbsd32 stuff, and
some usb subroutines.
 1.4 29-Apr-2019  roy Introduce rt_addrmsg_src which adds RTA_AUTHOR to the message.
Use this when we notify userland of a duplicate address
and set RTA_AUTHOR to the hardware address of the sender.

While here, match the logging diagnostic of INET6 to the simpler one
of INET so it's consistent.
 1.3 29-Apr-2019  roy rtsock: Route address message simplification

Rename rt_newaddrmsg to rt_addrmsg_rt.
Add rt_addrmsg which drops the error and route arguments which are only
needed by one caller.
 1.2 21-Sep-2016  roy branches: 1.2.14; 1.2.16;
Add ifam_pid and ifam_addrflags to ifa_msghdr.
Re-version RTM_NEWADDR, RTM_DELADDR, RTM_CHGADDR and NET_RT_IFLIST.
Add compat code for old version.
 1.1 01-Feb-2011  matt branches: 1.1.2; 1.1.4; 1.1.8; 1.1.20; 1.1.38; 1.1.42;
Add a new AF/PF_ROUTE which is 64-bit clean which makes the routing socket
interface (and its associated sysctls) act identically for both 32 and 64 bit
programs. The old unclean one remains for backward compatibility.
 1.1.42.1 04-Nov-2016  pgoyette Sync with HEAD
 1.1.38.1 05-Oct-2016  skrll Sync with HEAD
 1.1.20.1 03-Dec-2017  jdolecek update from HEAD
 1.1.8.2 06-Jun-2011  jruoho Sync with HEAD.
 1.1.8.1 01-Feb-2011  jruoho file route.h was added on branch jruoho-x86intr on 2011-06-06 09:07:32 +0000
 1.1.4.2 05-Mar-2011  rmind sync with head
 1.1.4.1 01-Feb-2011  rmind file route.h was added on branch rmind-uvmplock on 2011-03-05 20:52:54 +0000
 1.1.2.2 08-Feb-2011  bouyer Sync with HEAD
 1.1.2.1 01-Feb-2011  bouyer file route.h was added on branch bouyer-quota2 on 2011-02-08 16:19:47 +0000
 1.2.16.1 10-Jun-2019  christos Sync with HEAD
 1.2.14.3 14-Jan-2019  pgoyette Create a variant of the HOOK macros that handles hook routines of
type void, and use them where appropriate.
 1.2.14.2 13-Jan-2019  pgoyette Add the required hooks for rtsock_50 and modify the COMPATCALL() macro
to use the hooks. While the rtsock_50 situation is still sub-optimal
(it includes the main rtsock.c with a whole bunch of function and
variable redefinitions via macros), this at least makes it possible to
load the rtsock_50 code separately from more recent code, rather than
the previous requirement that rtsock_50 be built-in.
 1.2.14.1 15-Oct-2018  pgoyette Convert a couple more hooks to the MP-safe mechanism.

While here, clean up some headers and remove any that are now empty.
 1.3 04-Oct-2022  msaitoh Fix comment. No fucntional change.
 1.2 27-Jan-2019  pgoyette branches: 1.2.4;
Merge the [pgoyette-compat] branch
 1.1 11-Jan-2019  pgoyette branches: 1.1.2;
file route_50.h was initially added on branch pgoyette-compat.
 1.1.2.1 11-Jan-2019  pgoyette Rework the various sysctl-related routines to call the correct code
for each version. While here, extract the 5.0 specific code instead
of including in the main rtsock.c code.

Also, clean up all the sysctl-related routines to prevent building
more than one copy, no matter how many places rtsock.c gets #include'd
into!
 1.2.4.2 10-Jun-2019  christos Sync with HEAD
 1.2.4.1 27-Jan-2019  christos file route_50.h was added on branch phil-wifi on 2019-06-10 22:07:01 +0000
 1.2 27-Jan-2019  pgoyette branches: 1.2.4;
Merge the [pgoyette-compat] branch
 1.1 15-Mar-2018  pgoyette branches: 1.1.2;
file route_70.h was initially added on branch pgoyette-compat.
 1.1.2.4 15-Oct-2018  pgoyette Convert another hook to the MP-sfe mechanism.

XXX still have three more to convert: openat_10, sysvipc50_sysctl and
XXX compat70_unp_addsockcred
 1.1.2.3 15-Oct-2018  pgoyette Convert a couple more hooks to the MP-safe mechanism.

While here, clean up some headers and remove any that are now empty.
 1.1.2.2 16-Mar-2018  pgoyette Move closer to getting a compat_60 module - still needs more work
 1.1.2.1 15-Mar-2018  pgoyette Create a separate module for COMPAT_70 code only, and untangle the
70 compat code from the current.
 1.2.4.2 10-Jun-2019  christos Sync with HEAD
 1.2.4.1 27-Jan-2019  christos file route_70.h was added on branch phil-wifi on 2019-06-10 22:07:01 +0000
 1.8 14-Jan-2014  christos use new bsd.syscall.mk
 1.7 20-Mar-2012  martin branches: 1.7.2; 1.7.4;
Remove spurious bsd.kinc.mk include, which seems to not be needed here
and does not work at all (missing bsd.own.mk for ACTIVE_CC) anyway.
 1.6 11-Dec-2005  christos branches: 1.6.112; 1.6.116;
merge ktrace-lwp.
 1.5 26-Feb-2005  perry make this rebuild generated files by default
 1.4 15-Nov-2003  thorpej branches: 1.4.8; 1.4.10;
We have CVS; there is no reason to make .bak files when generating the
syscall tables.
 1.3 26-Oct-2003  lukem Use ${HOST_SH} instead of `sh'.

If necessary, pull in <bsd.sys.mk> to get the definition of HOST_SH;
Makefiles that pull in one of (most of) <bsd.*.mk> will get this anyway.
 1.2 25-Mar-1999  mrg branches: 1.2.42;
move sparc32 to netbsd32; split out MD part (signal handling) (mostly via repository copy, rename and perl -pi :-)
 1.1 26-Aug-1998  mrg add a 32-bit compatibility module for the sparc64 port, so it can run NetBSD/sparc binaries with a LP64 kernel.
 1.2.42.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.2.42.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.42.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.42.1 03-Aug-2004  skrll Sync with HEAD
 1.4.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.4.8.1 29-Apr-2005  kent sync with -current
 1.6.116.1 05-Apr-2012  mrg sync to latest -current.
 1.6.112.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.6.112.1 17-Apr-2012  yamt sync with head
 1.7.4.1 18-May-2014  rmind sync with head
 1.7.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.56 19-May-2024  christos version dup3
 1.55 30-Jul-2023  rin COMPAT_NETBSD32: Add support for epoll(2).
 1.54 19-Dec-2022  pgoyette Create compat_100 module infrastructure now that we have branched
for NetBSD-10
 1.53 17-Apr-2021  simonb Compile in compat32 syscall names all the time, as we do for native
syscall names. Needed for dtrace.
 1.52 16-May-2020  christos branches: 1.52.4;
Add ACL support for FFS. From FreeBSD.
 1.51 26-Apr-2020  thorpej Add a NetBSD native futex implementation, mostly written by riastradh@.
Map the COMPAT_LINUX futex calls to the native ones.
 1.50 12-Mar-2020  pgoyette Split out the quota code from the rest of compat_netbsd32 module. This
allows loading of compat_netbsd32 on kernels that don't have ``options
QUOTA'' enabled.
 1.49 22-Sep-2019  christos Add a new member to struct vfsstat and grow the unused members
The new member is caled f_mntfromlabel and it is the dkw_wname
of the corresponding wedge. This is now used by df -W to display
the mountpoint name as NAME=
 1.48 20-Aug-2019  christos make things compile again.
 1.47 20-Aug-2019  maxv Disable netbsd32_drm.c until it receives proper review.
 1.46 20-Aug-2019  christos compat32 drm ioctl support from Surya Shankar at GSoC 2019
 1.45 18-Jun-2019  christos use option quota
 1.44 27-Jan-2019  christos remove dup
 1.43 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.42 24-Dec-2018  mrg quotactl is always included, regardless of options QUOTA.
 1.41 24-Dec-2018  mrg move mmap(), compat 40 mount(), pipe() and getfh() into their own files
as the implementation is non trivial or is compat. mark old mount()
properly instead of manually #if'ing ito to ENOSYS.
 1.40 24-Dec-2018  mrg move rlimit and quota code into their own modules.

(netbsd32_netbsd.c should have only simple shims. anything more
than copying arguments from one args struct to the other should
not be placed in this file. still a couple more to move out.)
 1.39 19-Oct-2016  skrll branches: 1.39.14; 1.39.16;
PR kern/51514: ptrace(2) fails for 32-bit process on 64-bit kernel

Updated from the original patch in the PR by me.
 1.38 03-Dec-2015  pgoyette branches: 1.38.2;
Missed these.

Only include the compat_14 sys calls if this being compiled as part of
the compat_netbsd32_sysvipc module.
 1.37 01-Dec-2015  pgoyette Properly mark netbsd32_mqueue.c to depend on 'options MQUEUE'

Yes, MQUEUE is included in all kernels by default, but it can be removed.
If it is removed, the compat_netbsd32 module should not include it, either.
 1.36 22-Jun-2015  mrg add netbsd32 support for nfssvc(2). we do this by defining 5 copyin/out
functions that do all the ugly work, are just plain copyin/out for the
native system calls, and do the necessary translations for netbsd32.

with this i'm able to run 32 bit nfsd and mountd on 64 bit kernel and
mount the file systems remotely.
 1.35 20-Jun-2015  martin Implement modctl, sigqueinfo and mq_*
 1.34 17-Nov-2014  uebayasi branches: 1.34.2;
Define compat modules (but without dependencies yet).
 1.33 29-Mar-2013  christos branches: 1.33.10;
compat glue for new lwp_park
 1.32 10-Mar-2012  joerg branches: 1.32.2;
P1003_1B_SEMAPHORE is no longer optional.
 1.31 19-Feb-2012  rmind Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.
 1.30 04-Jan-2011  matt branches: 1.30.8; 1.30.12;
Make the SA support as optional as is possible.
 1.29 10-Dec-2009  matt branches: 1.29.4;
Move saemul_netbsd32 to netbsd32_sa.c and allow the KERN_SA bits to be omitted.
 1.28 11-Jan-2009  christos merge christos-time_t
 1.27 19-Nov-2008  ad branches: 1.27.4;
Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.26 15-Oct-2008  wrstuden branches: 1.26.2;
Merge wrstuden-revivesa into HEAD.
 1.25 18-Feb-2007  cube branches: 1.25.38; 1.25.42; 1.25.44; 1.25.48;
Add missing lwp syscalls. Put them all together into a new file,
netbsd32_lwp.c, and remove remaining traces of SA.

This still needs some MD (and possibly MI, depending on the chosen
solution) changes to actually work.
 1.24 09-Nov-2006  cube branches: 1.24.4;
- Make better use of COMPAT_XX type in syscalls.master
- Remove useless (thanks to COMPAT_XX behaviour) #ifdefs in
syscalls.master
- Make netbsd32_compat_43.c compiled per COMPAT_LINUX32 because the latter
needs stuff from it.

Fixes Perry's PR#34951.
 1.23 30-Aug-2006  cube branches: 1.23.2; 1.23.4;
netbsd32_core.c is need only under options COREDUMP.
 1.22 29-Mar-2006  cube Implement the _lwp* and sa_* families of syscalls, using the newly
introduced hooks in the native code.
 1.21 05-Mar-2006  cube branches: 1.21.2; 1.21.4; 1.21.6;
Implement the ksem_* family of syscalls.
 1.20 11-Dec-2005  christos branches: 1.20.4; 1.20.6;
merge ktrace-lwp.
 1.19 23-Oct-2005  cube - Split sys_kevent into kevent1 so that it can be used by COMPAT_NETBSD32
code.

- To achieve COMPAT_NETBSD32 compatibility, introduce a parameter to
kevent1 that points to functions that do the actual copyin/copyout
operations. This is similar to what was done in FreeBSD by Paul Saab.

- Add the COMPAT_NETBSD32 definitions and hooks.
 1.18 19-Aug-2005  christos branches: 1.18.2;
64 bit inode changes.
 1.17 17-Jun-2004  cube branches: 1.17.12;
o Add support for the statvfs family of syscalls (statvfs1, fstatvfs1,
fhstatvfs1 and getvfsstat)
o Move the statfs family out of netbsd32_fs.c and netbsd32_netbsd.c to
netbsd_compat_20.c, compiled with COMPAT_20

Reviewed by christos@.
 1.16 16-Jan-2004  mrg clean up a little:
- delete ktrsyscall32()
- add a check #ifdef _LP64 to do the conversion if P_32 is set to the
standard ktrsyscall()
- add a couple of similar _LP64/P_32 checks to the systrace code.

this should get systrace working for 32 bit apps as well as complete
ktrace support for "trace_enter/trace_exit" using platforms such as amd64.

XXX: systrace isn't supported on sparc64 currently... (it doesn't use
trace_enter/trace_exit, or have it's own calls to systrace_xxx()...)
 1.15 15-Jan-2004  mrg add a copy of the ktrsyscall() entry point for 32 bit emulated calls.
the main purpose of this function is to adjust the "argsize" value of
the ktrace syscall record, otherwise userland will see N/2 (rounded
down) arguments instead of N.
 1.14 25-Oct-2003  chs allow COMPAT_SUNOS without COMPAT_43.
 1.13 15-Oct-2003  fvdl Don't put the netbsd32_compat*.c files in the 'compat library'. Unconditionally
compiling these causes a ripple effect making it hard to conditionalize
anything on COMPAT_* in the kernel.
 1.12 29-Apr-2002  mrg branches: 1.12.10;
build the netbsd32_compat* objects into libcompat.a, so they are available
to emulations not just netbsd itself. rename the compat_10 functions to
match everything else. fixes a problem reported by julian coleman.
 1.11 08-Dec-2001  thorpej Make the coredump routine exec-format/emulation specific. Split
out traditional NetBSD coredump routines into core_netbsd.c and
netbsd32_core.c (for COMPAT_NETBSD32).
 1.10 06-Jun-2001  mrg branches: 1.10.2;
add netbsd32_uvm_unix.c and netbsd32_kern_sig.c
 1.9 08-Feb-2001  mrg branches: 1.9.2;
split up netbsd32_netbsd.c into 9 new files, leaving only those syscalls that
have no special interpretations besides simple syscall args conversion.
 1.8 07-Feb-2001  mrg compat_sunos needs netbsd32_compat_09.c
 1.7 01-Dec-2000  jdolecek put a.out/elf32 specific things in netbsd32_exec_{aout|elf32}.c
emul_netbsd32 was moved to netbsd32_netbsd.c
g/c netbsd32_exec.c now
 1.6 11-Oct-1999  eeh branches: 1.6.2;
Add netbsd32_compat_14.c

Rename everything from compat_netbsd32 -> netbsd32 so we don't have silly
names like compat_14_compat_netbsd32_sys_shmctl().
 1.5 24-Apr-1999  eeh branches: 1.5.2;
Don't defopt COMPAT_NETBSD32 here; it's done in sys/conf/files.
 1.4 25-Mar-1999  mrg branches: 1.4.4;
clean and up make compile
 1.3 25-Mar-1999  mrg move sparc32 to netbsd32; split out MD part (signal handling) (mostly via repository copy, rename and perl -pi :-)
 1.2 01-Oct-1998  eeh Overhaul. Now will run simple things like /bin/sh and /bin/echo.
 1.1 26-Aug-1998  mrg add a 32-bit compatibility module for the sparc64 port, so it can run NetBSD/sparc binaries with a LP64 kernel.
 1.4.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.5.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.6.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.6.2.1 08-Dec-2000  bouyer Sync with HEAD.
 1.9.2.3 20-Jun-2002  nathanw Catch up to -current.
 1.9.2.2 08-Jan-2002  nathanw Catch up to -current.
 1.9.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.10.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.10.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.12.10.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.12.10.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.12.10.2 18-Sep-2004  skrll Sync with HEAD.
 1.12.10.1 03-Aug-2004  skrll Sync with HEAD
 1.17.12.3 26-Feb-2007  yamt sync with head.
 1.17.12.2 30-Dec-2006  yamt sync with head.
 1.17.12.1 21-Jun-2006  yamt sync with head.
 1.18.2.1 26-Oct-2005  yamt sync with head
 1.20.6.1 22-Apr-2006  simonb Sync with head.
 1.20.4.1 09-Sep-2006  rpaulo sync with head
 1.21.6.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.21.4.1 19-Apr-2006  elad sync with head.
 1.21.2.3 03-Sep-2006  yamt sync with head.
 1.21.2.2 01-Apr-2006  yamt sync with head.
 1.21.2.1 05-Mar-2006  yamt file files.netbsd32 was added on branch yamt-pdpolicy on 2006-04-01 12:06:41 +0000
 1.23.4.1 10-Dec-2006  yamt sync with head.
 1.23.2.1 18-Nov-2006  ad Sync with head.
 1.24.4.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.25.48.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.25.48.1 19-Oct-2008  haad Sync with HEAD.
 1.25.44.1 28-Sep-2008  skrll Adapt the SA COMPAT_NETBSD32 stuff to this branch.
 1.25.42.2 11-Mar-2010  yamt sync with head
 1.25.42.1 04-May-2009  yamt sync with head.
 1.25.38.1 17-Jan-2009  mjf Sync with HEAD.
 1.26.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.27.4.2 04-Jan-2009  christos add new syscalls.
 1.27.4.1 19-Nov-2008  christos file files.netbsd32 was added on branch christos-time_t on 2009-01-04 01:56:02 +0000
 1.29.4.1 05-Mar-2011  rmind sync with head
 1.30.12.2 11-Mar-2012  mrg sync to latest -current
 1.30.12.1 24-Feb-2012  mrg sync to -current.
 1.30.8.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.30.8.1 17-Apr-2012  yamt sync with head
 1.32.2.2 03-Dec-2017  jdolecek update from HEAD
 1.32.2.1 23-Jun-2013  tls resync from head
 1.33.10.1 04-Nov-2015  riz Pull up following revision(s) (requested by mrg in ticket #956):
sys/compat/netbsd32/files.netbsd32: revision 1.36
sys/compat/netbsd32/netbsd32_sysent.c: revision 1.115
sys/compat/netbsd32/netbsd32_syscallargs.h: revision 1.116
sys/nfs/nfs_var.h: revision 1.93
sys/compat/netbsd32/netbsd32_conv.h: revision 1.30
sys/compat/netbsd32/netbsd32_syscall.h: revision 1.116
sys/compat/netbsd32/netbsd32_syscalls.c: revision 1.115
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.1
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.3
sys/nfs/nfs_syscalls.c: revision 1.156
sys/compat/netbsd32/syscalls.master: revision 1.108
sys/compat/netbsd32/netbsd32.h: revision 1.107
add netbsd32 support for nfssvc(2). we do this by defining 5 copyin/out
functions that do all the ugly work, are just plain copyin/out for the
native system calls, and do the necessary translations for netbsd32.
with this i'm able to run 32 bit nfsd and mountd on 64 bit kernel and
mount the file systems remotely.
don't copy the first netbsd32_export_args nexports times, but actually
advance the userland pointer each entry through the loop. oops.
 1.34.2.3 05-Dec-2016  skrll Sync with HEAD
 1.34.2.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.34.2.1 22-Sep-2015  skrll Sync with HEAD
 1.38.2.1 04-Nov-2016  pgoyette Sync with HEAD
 1.39.16.3 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.39.16.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.39.16.1 10-Jun-2019  christos Sync with HEAD
 1.39.14.6 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.39.14.5 23-Sep-2018  pgoyette More work on kern_proc_32
 1.39.14.4 12-Sep-2018  pgoyette Split compat_netbsd32_sysvipc into version-specific modules
 1.39.14.3 12-Sep-2018  pgoyette Add a compat_netbsd32_16 to handle the sigcode stuff.
 1.39.14.2 11-Sep-2018  pgoyette Also need to declare the emul_netbsd32 !
 1.39.14.1 21-Mar-2018  pgoyette Split compat/rndpseudo_50.c into two pieces, one for native compat and
a second piece for compat32. Update both modules accordingly.
 1.52.4.1 17-Apr-2021  thorpej Sync with HEAD.
 1.143 30-Jul-2023  rin COMPAT_NETBSD32: Add support for epoll(2).
 1.142 29-Jul-2023  rin COMPAT_NETBSD32: Catch up with sys___kevent100() addition.

XXX
Add epoll_* and memfd_create.
 1.141 12-Feb-2023  andvar s/strucure/structure/ and s/structues/structures/ in comments.
 1.140 23-Apr-2022  reinoud Implement support for mounting UDF in compat32
Fixes PR#56801
 1.139 11-Nov-2021  martin Adapt to recent posix_spawn extensions.
 1.138 06-Nov-2021  thorpej COMPAT_NETBSD32 is all about running the 32-bit flavor of native
binaries on a 64-bit platform[*], as such:
- Make the logic about which "sendsig" flavor to call MI (as it is in the
native 64-bit environment) and follow the same rules as the native 32-bit
environment.
- Make COMPAT_NETBSD32 x COMPAT_16 work the same as it would in the
native 32-bit environment by providing a netbsd32_sendsig_sigcontext_16_hook,
rather than overriding the entire sendsig logic with a netbsd32_sendsig_hook.
- In netbsd32___sigaction_sigtramp(), make sure the compat_netbsd32_16
module is loaded if the trampoline version specifies a sigcontext style
handler, otherwise return EINVAL so that libc can try again with siginfo
style.

[*] ...except for arm32, which uses it to mean "run 32-bit OABI binaries
from the 32-bit EABI environment". Doing it this way was arguably a mistake,
but we are stuck with it for now, so support it by providing a machine-
dependent override for netbsd32_sendsig() that also disables the corresponding
logic in netbsd32___sigaction_sigtramp().

Fixes PR kern/56487.
 1.137 19-Jan-2021  simonb The read/write/send/recv system calls return ssize_t because -1 is
returned on error. Therefore we must restrict the lengths of any
buffers to NETBSD32_SSIZE_MAX with compat32 to avoid garbage return
values.

Fixes ATF lib/libc/sys/t_write:write_err.
 1.136 18-Jan-2021  simonb s/u_intN_t/uintN_t/
 1.135 14-Jan-2021  simonb Handle FSSIOCSET and FSSIOCGET; vndconfig(8) works with compat32 now.
XXX: FSSIOCSET50 and FSSIOCGET50 are not (yet) handled.
 1.134 01-Nov-2020  pgoyette Separate the compat_netbsd32_coredump from the compat_netbsd32 and
coredump modules, into its own module.

Welcome to 7.99.75 !!!
 1.133 16-May-2020  christos branches: 1.133.2;
Add ACL support for FFS. From FreeBSD.
 1.132 24-Dec-2019  kamil Introduce PT_LWPSTATUS + PT_LWPNEXT, obsolete PT_LWPINFO

PT_LWPINFO is a legacy ptrace(2) operation that was originally intended
to retrieve the thread (LWP) information inside a traced process.

It has a number of flaws and is confused with PT_LWPINFO from FreeBSD.

PT_LWPSTATUS and PT_LWPNEXT address the problems (shortly by: rename,
removal of pl_event) and introduces new features: signal context
(pl_sigpend, pl_sigmask), LWP name (pl_name), LWP TLS base address
(pl_private). The private pointer was so far missing information for
a debugger.

PT_LWPSTATUS@nnn is now shipped with core(5) files and contain LWP specific
information, so far missed in the core(5) files.

PT_LWPSTATUS retrieves LWP information for the prompted thread.
PT_LWPNEXT retrieves LWP information for the next thread, borrowing the
semantics from NetBSD specific PT_LWPINFO.

PT_LWPINFO is namespaced with __LEGACY_PT_LWPINFO and still available for
the foreseeable future, without plans of removing it.

Add ATF tests for PT_LWPSTATUS + PT_LWPNEXT.

Keep ATF tests for PT_LWPINFO.

Switch GDB to new API.

Proposed on tech-kern@.
 1.131 18-Nov-2019  rin 8-byte objects on i386 or arm-oabi are aligned in 4-byte boundary.
Therefore, we must use __attribute__((__aligned__(4))) for them.
netbsd32_{,u}int64 are provided for this purpose. However, we
cannot use it in <compat/sys/siginfo.h> due to circular dependency
b/w <machine/netbsd32_machdep.h>.

In order to distangle it, we choose here to have a duplicate type,
netbsd32_siginfo_uint64, in <compat/sys/siginfo.h>. The equivalence
with netbsd32_uint64 is asserted in <compat/netbsd32/netbsd32.h>.

Now, gdb for i386 works again on amd64 kernel.

Based on patch provided by kamil. Thanks!

XXX
pullup to netbsd-9
 1.130 18-Nov-2019  rin Sorry, revert unintentional parts of the previous commit:
http://mail-index.netbsd.org/source-changes/2019/11/18/msg110946.html

I was going to commit only netbsd32_signal.c.
 1.129 18-Nov-2019  rin Belatedly catch up with kern_sig.c rev 1.358:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/kern/kern_sig.c#rev1.358

Provide syscall information with SIGTRAP TRAP_SCE/TRAP_SCX so that
picotrace/truss, for example, works fine on COMPAT_NETBSD32.

With some minor changes:

- Centralize netbsd32_si{,32}_si{32,}() into netbsd32_ksi{,32}_ksi{32,}().
- Provide si_status with SIGCHLD.
- Remove the remaining of SA.

XXX
pullup to netbsd-9
 1.128 07-Nov-2019  rin For netbsd32_statvfs, f_spare should be netbsd32_uint64, not uint64_t.

Fix syscalls using struct statvfs on COMPAT_NETBSD32 on amd64, where
NETBSD32_INT64_ALIGN is __attribute__((__aligned__(4))).
 1.127 03-Oct-2019  kamil Switch kevent udata from intptr_t void*

Synchromize the struct field format with other BSDs and Darwin.

No ABI change between older and newer struct form on the ports.

The change will require no changes to most C users during the transition
period as the header keeps a caller cast.

Discussed with core@ and there were no objections for this move.
 1.126 26-Sep-2019  christos accrightslen should be u_int for compat too
 1.125 25-Sep-2019  christos avoid signed-compare warning; use uintmax_t to print.
 1.124 22-Sep-2019  christos Add a new member to struct vfsstat and grow the unused members
The new member is caled f_mntfromlabel and it is the dkw_wname
of the corresponding wedge. This is now used by df -W to display
the mountpoint name as NAME=
 1.123 20-Feb-2019  mrg branches: 1.123.4;
use KASSERTMSG() in netbsd32_ptr32i().
 1.122 09-Feb-2019  mrg - expand the comment about what netbsd32_machdep.h should provide.
- add missing NETBSD32_POINTER_TYPE
- add static inline functions to convert pointers to/from 32 bit,
inclusing an overflow check for NETBSD32PTR32PLUS().
 1.121 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.120 25-Nov-2018  mlelstv Restore netbsd32 compat code for new NPF ABI.
 1.119 11-Aug-2018  mrg support nullfs in netbsd32.
 1.118 10-May-2018  christos branches: 1.118.2;
add {send,recv}mmsg
 1.117 14-Apr-2018  mrg redo the previous -- compat/sys/siginfo.h is already included
later, as is another header. move them up near the top.
 1.116 18-Dec-2017  mrg branches: 1.116.2;
include <compat/sys/siginfo.h> for siginfo32_t.
 1.115 17-Dec-2017  christos handle siginfo requests for ptrace32
 1.114 13-Nov-2016  rin branches: 1.114.8;
tv_usec in netbsd32_timeval is suseconds_t (aka int32_t) rather than
netbsd32_long (considered harmless)

approved by martin
 1.113 19-Oct-2016  skrll PR kern/51514: ptrace(2) fails for 32-bit process on 64-bit kernel

Updated from the original patch in the PR by me.
 1.112 23-Sep-2016  skrll Trailing whitespace
 1.111 23-Sep-2016  skrll Types for wait6 and clock_getcpuclockid2
 1.110 17-Sep-2016  christos deal with not having KTRACE
 1.109 26-Nov-2015  martin branches: 1.109.2;
We never exec(2) with a kernel vmspace, so do not test for that, but instead
KASSERT() that we don't.
When calculating the load address for the interpreter (e.g. ld.elf_so),
we need to take into account wether the exec'd process will run with
topdown memory or bottom up. We can not use the current vmspace's flags
to test for that, as this happens too early. Luckily the execpack already
knows what the new state will be later, so instead of testing the current
vmspace, pass the info as additional argument to struct emul
e_vm_default_addr.
Fix all such functions and adopt all callers.
 1.108 10-Aug-2015  mrg move some header-specific pointer-typedefs into a header-specific area.
 1.107 22-Jun-2015  mrg add netbsd32 support for nfssvc(2). we do this by defining 5 copyin/out
functions that do all the ugly work, are just plain copyin/out for the
native system calls, and do the necessary translations for netbsd32.

with this i'm able to run 32 bit nfsd and mountd on 64 bit kernel and
mount the file systems remotely.
 1.106 21-Jun-2015  mrg s/sparc64/native 64 bit/ in a comment...
 1.105 21-Jun-2015  martin Implement trivial conversion for pset_*
 1.104 20-Jun-2015  martin Implement modctl, sigqueinfo and mq_*
 1.103 05-Oct-2014  christos branches: 1.103.2;
add tmpfs.
 1.102 28-Jun-2014  dholland branches: 1.102.2;
Revert the following changes:

src/sys/sys/quotactl.h 1.37
src/sys/compat/netbsd32/netbsd32.h 1.101
src/sys/compat/netbsd32/netbsd32_netbsd.c 1.188, 1.189
src/sys/kern/vfs_quotactl.c 1.39
src/sys/kern/vfs_syscalls.c 1.483
src/sys/ufs/lfs/ulfs_quota.c 1.11
src/sys/ufs/ufs/ufs_quota.c 1.116
src/lib/libquota/quota_kernel.c 1.5

and do them correctly.

If you're going to change the name of something, you need to change
the name of *all* the things with the same name, not just a handful,
and you should change it to something similar so it still matches the
rest of the system rather than just picking an arbitrarily different
name.

Hi, Joerg.

To wit, rename the quotactl "delete" operation to "del", because
"delete" is a reserved word in C++ and for some reason Joerg wants to
run internal interfaces used only by C code through his C++ compiler.
Do not rename it to "remove" instead, because this doesn't match
libquota or the rest of the usage throughout the system; and rename
all the related identifiers, not just the ones that blew the mind of
Joerg's C++ compiler.

Because this is not a user-facing API (the only userland consumer
sys/quotactl.h is libquota) it is sort of ok to make arbitrary
source-incompatible changes; however, by the same token it's completely
unnecessary. If it *were* a user-facing API that someone might have a
semi-rational reason to want to run a C++ compiler on, it would be
incorrect to change it at this point.
 1.101 13-Jun-2014  joerg delete -> remove
 1.100 30-Apr-2014  njoly Do not use native off_t type under compat netbsd32, but a new
netbsd32_off_t that provide the expected alignment for 64bit types.
 1.99 03-Feb-2014  manu branches: 1.99.2;
Properly translate struct swapent for COMPAT_NETBSD32 (missing commit)
 1.98 24-Jan-2014  christos sigaction until 1.4 had an int sigmask, don't trash the stack.
 1.97 01-Jan-2014  dsl Change the type of the 'cookie' that holds the state of the core dump file
from 'void *' to the actual type 'struct coredump_iostate *'.
In most of the code the contents of the structure are still unknown.
This just stops the wrong type of pointer being passed to the 'void *'
parameter.
I hope I've found everything, amd64 GENERIC and i386 GENERIC & ALL compile.
 1.96 12-Oct-2012  christos branches: 1.96.2;
fix pre-5 stat system call structure which should have used the pre-64-time_t
timestamps!
 1.95 08-Apr-2012  martin branches: 1.95.2;
Rework posix_spawn locking and memory management:
- always provide a vmspace for the new proc, initially borrowing from proc0
(this part fixes PR 46286)
- increase parallelism between parent and child if arguments allow this,
avoiding a potential deadlock on exec_lock
- add a new flag for userland to request old (lockstepped) behaviour for
better error reporting
- adapt test cases to the previous two and add a new variant to test the
diagnostics flag
- fix a few memory (and lock) leaks
- provide netbsd32 compat
 1.94 06-Mar-2012  macallan allow mounting ext2fs and msdosfs
while there also enable lfs but that's untested
 1.93 19-Feb-2012  rmind Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.
 1.92 01-Feb-2012  dholland branches: 1.92.2;
Be consistent about whether idtype and objtype codes are signed or
unsigned. They are signed. (While unsigned might have been a better
choice, it doesn't really matter and the majority of preexisting uses
were signed. And consistency is good.)
 1.91 01-Feb-2012  dholland Improve the names of some members of struct quotactl_args. These are
effectively function parameter names, but since they need to be
described with the same names in the man page the choices do matter.
Some.
 1.90 01-Feb-2012  dholland Update compat_netbsd32 for new quotactl.
 1.89 31-Jan-2012  matt Add netbsd32_socklenp_t
 1.88 12-Oct-2011  dholland branches: 1.88.2; 1.88.6;
As a precaution, add sys/param.h explicitly to some headers that will
no longer get it via sys/ucred.h and don't already include it
explicitly. These should in turn be removed when it can be confirmed
that it's safe to do so. (Because sys/param.h is full of things that
are often tested with #if, it's not in general safe to remove it
without checking, as such tests fail silently if the symbol goes
missing.)
 1.87 30-Jun-2011  wiz dependant -> dependent
 1.86 06-Mar-2011  bouyer merge the bouyer-quota2 branch. This adds a new on-disk format
to store disk quota usage and limits, integrated with ffs
metadata. Usage is checked by fsck_ffs (no more quotacheck)
and is covered by the WAPBL journal. Enabled with kernel
option QUOTA2 (added where QUOTA was enabled in kernel config files),
turned on with tunefs(8) on a per-filesystem
basis. mount_mfs(8) can also turn quotas on.

See http://mail-index.netbsd.org/tech-kern/2011/02/19/msg010025.html
for details.
 1.85 22-Jan-2011  matt Add the ability to mount NFS filesystems in COMPAT_NETBSD32
If in the kernel and NFS_ARGS_ONLY, just export struct nfs_args and its flags.
 1.84 14-Dec-2009  matt branches: 1.84.4; 1.84.6; 1.84.8;
Merge from matt-nb5-mips64
 1.83 12-Dec-2009  njoly Remove semicolon from NETBSD32TOx_UAP macro definitions.
 1.82 16-Mar-2009  njoly Fix dev_t alignment, by not using the new 64bit value directly but
rather a 32bit aligned version (netbsd32_dev_t = netbsd32_uint64).

ok by cube@.
 1.81 28-Jan-2009  njoly branches: 1.81.2;
Revert the previous packed attribute fix. Instead make netbsd32_time_t
of type netbsd32_int64 which provides a 64-bit value with a 32-bit
alignment.

Suggested by dsl.
 1.80 28-Jan-2009  njoly Make netbsd32_timespec/netbsd32_timeval structures packed. This fix an
alignment problem between 64-bit kernel and 32-bit userland versions,
which ended in different structure sizes.
 1.79 11-Jan-2009  christos merge christos-time_t
 1.78 22-Nov-2008  mrg branches: 1.78.4;
implement netbsd32__sched_setparam(), netbsd32__sched_getparam(),
netbsd32__sched_setaffinity() and netbsd32__sched_getaffinity().
 1.77 15-Oct-2008  wrstuden branches: 1.77.2; 1.77.4;
Merge wrstuden-revivesa into HEAD.
 1.76 29-May-2008  mrg branches: 1.76.4;
remove clause #3 from my license where there are no other
copyright holders involved.
 1.75 24-May-2008  njoly Fix netbsd32_ipc_perm and netbsd32_shmid_ds structures to use correct
types.
 1.74 02-Feb-2008  dsl branches: 1.74.6; 1.74.8; 1.74.10; 1.74.12;
Fix build
 1.73 02-Feb-2008  dsl Use the netbsd32_[u]int64 type for all 64bit items to ensure we have the
correct alignment/padding rules.
Removed the now-unnecessary #pragma packed for amd64.
Should fix the alignment of 'struct netbsd32_kevent' on non-amd64.
 1.72 02-Feb-2008  dsl Change u_intxx_t to uintxx_t and uint to unsigined int etc.
Fix indentation.
 1.71 25-Dec-2007  perry Convert many of the uses of __attribute__ to equivalent
__packed, __unused and __dead macros from cdefs.h
 1.70 20-Dec-2007  dsl Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.69 07-Dec-2007  ad branches: 1.69.4;
Add: _lwp_setname, _lwp_getname, _lwp_ctl.
 1.68 29-Sep-2007  dsl branches: 1.68.4; 1.68.6;
Use netbsd32_uint64 instead of fsblkcnt_t and fsfilcnt_t in order to get
the correct alignment (4 bytes for i386) for the whole structure.
 1.67 16-Sep-2007  dsl branches: 1.67.2;
Define netbsd32_uint64 for 64bit integers with the alignment requirement
of the corresponding 32bit architecture.
Use it for the 64bit items in netbsd32_statvfs so that the structure
doesn't collect 8byte alignment (and 4 bytes of trailing padding).
This replaces the 'packed' attribute which wasn't architecture specific
and would cause massive overheads accessing every member of sparc64.
Should allow the MIPS64 port do DTRT.
 1.66 17-Jul-2007  christos branches: 1.66.6; 1.66.8;
include <compat/sys/mount.h> MFSNAMELEN
 1.65 30-Jun-2007  dsl Changes to sompat socket function to avoid the dreaded stackgap.
 1.64 03-Jun-2007  dsl Split netbsd32___semctl14() so that it is callable from
compat_10_netbsd32_sys_semsys() (where the one parameter is already in
kernel space).
Note that the code in compat_10_netbsd32_sys_semsys() has always been wrong,
since it called compat_14_sys___semctl() - which would read 64bit values!
 1.63 30-Apr-2007  dsl Rework compat stat() and statvfs() code so that it no longer uses the stackgap.
 1.62 18-Mar-2007  dsl Change all the NETBSD32PTR64(SCARG(uap, xxx))) to SCARG_P32(uap, xxx).
 1.61 16-Mar-2007  dsl remove all the double (and triple) casts used to convert 32bit userspace
pointers to and from 64bit kernel pointers. Instead use the defines
NETBSD32PTR64(p32) to read a 32bit pointer and (the new) NETBSD32PTR32(p32,p64)
to write a 32bit pointer throughout.
The 32bit pointer is now a struct to enforce the above.
amd64 (with linux emul) and sparc64 will both compile (when the arch stuff
goes in soon), and amd64 still runs some i386 binaries.
 1.60 04-Mar-2007  christos branches: 1.60.2; 1.60.4; 1.60.6;
fix fallout from caddr_t changes.
 1.59 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.58 19-Feb-2007  cube Introduce a new member to struct emul, e_startlwp, to be used by
sys__lwp_create. It allows using the said syscall under COMPAT_NETBSD32.

The libpthread regression tests now pass on amd64 and sparc64.
 1.57 09-Feb-2007  ad branches: 1.57.2;
Merge newlock2 to head.
 1.56 21-Nov-2006  christos adjust limits takes struct proc again.
 1.55 21-Nov-2006  christos From Nicolas Joly:

> It seems that 32bits programs, running under compat_netbsd32, using
> setrlimit force all other programs to have their maximum data size
> fixed at 3GB, where native 64bits apps used 8GB previously.

I tracked this one to the `netbsd32_adjust_limits()' function (called
when creating a new process under compat_netbsd32), where data and
stack limits are set without checking for shared `p_limit' structure
(p_limit->p_refcnt > 1). This explain the side effect where processes
have their limits changed when a compat_netbsd32 (or compat_linux32)
program is run.

The fix is to use `dosetrlimit()' to ensure the needed copy-on-write
behaviour for shared structure.
 1.54 13-Jul-2006  martin branches: 1.54.4;
Fix alignement problems for fhandle_t, exposed by gcc4.1.

While touching all vptofh/fhtovp functions, get rid of VFS_MAXFIDSIZ,
version the getfh(2) syscall and explicitly pass the size available in
the filehandle from userland.

Discussed on tech-kern, with lots of help from yamt (thanks!).
 1.53 31-May-2006  drochner branches: 1.53.2;
support ntp_gettime again
compile tested by Havard Eidnes
 1.52 11-May-2006  mrg branches: 1.52.2;
add an extra (uintptr_t) cast to NETBSD32TOP.
 1.51 29-Mar-2006  cube Implement the _lwp* and sa_* families of syscalls, using the newly
introduced hooks in the native code.
 1.50 06-Mar-2006  cube branches: 1.50.2; 1.50.4;
Implement the SysV IPC family of syscalls.
 1.49 05-Mar-2006  cube branches: 1.49.2;
Implement the ksem_* family of syscalls.
 1.48 11-Dec-2005  christos branches: 1.48.4; 1.48.6;
merge ktrace-lwp.
 1.47 24-Oct-2005  cube Move prototypes for siginfo32 to/from siginfo converters at the right
place.
 1.46 23-Oct-2005  cube - Split sys_kevent into kevent1 so that it can be used by COMPAT_NETBSD32
code.

- To achieve COMPAT_NETBSD32 compatibility, introduce a parameter to
kevent1 that points to functions that do the actual copyin/copyout
operations. This is similar to what was done in FreeBSD by Paul Saab.

- Add the COMPAT_NETBSD32 definitions and hooks.
 1.45 07-Oct-2005  chs branches: 1.45.2;
make the previous apply only to x86_64.
 1.44 07-Oct-2005  chs add __attribute__((packed)) to struct netbsd32_stat13. the alignment of
64-bit values is annoying in the x86 world: they require 64-bit alignment
in 64-bit mode but only 32-bit alignment in 32-bit mode.
 1.43 27-Sep-2005  chs this needs stuff from compat/sys/siginfo.h now, just include it here.
 1.42 27-Sep-2005  chs make this compile again.
 1.41 24-Sep-2005  christos make the siginfo converters static and comment out the one that is not used.
 1.40 20-Aug-2005  kent fix a compilation problem on NetBSD/amd64
 1.39 19-Aug-2005  christos Fix lossage I created with the 64 bit ino_t change.
 1.38 19-Aug-2005  christos 64 bit inode changes.
 1.37 23-Jul-2005  cube Regen (__sigtimedwait(2)).
 1.36 23-Jul-2005  cube Implement the timer_create(2) family of syscalls.
 1.35 13-Jul-2005  cube netbsd32_execve2() doesn't exist anymore.
 1.34 04-Jul-2005  cube branches: 1.34.2;
Implement uuidgen(2).
 1.33 10-Jun-2005  matt Rework the coredump code to have no explicit knownledge of how coredump
i/o is done. Instead, pass an opaque cookie which is then passed to a
new routine, coredump_write, which does the actual i/o. This allows the
method of doing i/o to change without affecting any future MD code.
Also, make netbsd32_core.c [re]use core_netbsd.c (in a similar manner that
core_elf64.c uses core_elf32.c) and eliminate that code duplication.
cpu_coredump{,32} is now called twice, first with a NULL iocookie to fill
the core structure and a second to actually write md parts of the coredump.
All i/o is nolonger random access and is suitable for shipping over a stream.
 1.32 02-Jun-2005  drochner in siginfo conversion functions, declare the source operand as "const"
 1.31 26-Mar-2005  fvdl Fix some things regarding COMPAT_NETBSD32 and limits/VM addresses.

* For sparc64 and amd64, define *SIZ32 VM constants.
* Add a new function pointer to struct emul, pointing at a function
that will return the default VM map address. The default function
is uvm_map_defaultaddr, which just uses the VM_DEFAULT_ADDRESS
macro. This gives emulations control over the default map address,
and allows things to be mapped at the right address (in 32bit range)
for COMPAT_NETBSD32.
* Add code to adjust the data and stack limits when a COMPAT_NETBSD32
or COMPAT_SVR4_32 binary is executed.
* Don't use USRSTACK in kern_resource.c, use p_vmspace->vm_minsaddr
instead (emulations might have set it differently)
* Since this changes struct emul, bump kernel version to 3.99.2

Tested on amd64, compile-tested on sparc64.
 1.30 26-Feb-2005  perry branches: 1.30.2;
nuke trailing whitespace
 1.29 17-Jun-2004  cube branches: 1.29.4; 1.29.6;
o Add support for the statvfs family of syscalls (statvfs1, fstatvfs1,
fhstatvfs1 and getvfsstat)
o Move the statfs family out of netbsd32_fs.c and netbsd32_netbsd.c to
netbsd_compat_20.c, compiled with COMPAT_20

Reviewed by christos@.
 1.28 20-May-2004  atatat Tweak sysctl setup functions (the macros, actually) for use in lkms,
and tweak lkminit_*.c (where applicable) to call them, and to call
sysctl_teardown() when being unloaded.

This consists of (1) making setup functions not be static when being
compiled as lkms (change to sys/sysctl.h), (2) making prototypes
visible for the various setup functions in header files (changes to
various header files), and (3) making simple "load" and "unload"
functions in the actual lkminit stuff.

linux_sysctl.c also needs its root exposed (ie, made not static) for
this (when built as an lkm).
 1.27 21-Jan-2004  mrg branches: 1.27.2;
delete ktrsyscall32() prototype
 1.26 15-Jan-2004  mrg add a copy of the ktrsyscall() entry point for 32 bit emulated calls.
the main purpose of this function is to adjust the "argsize" value of
the ktrace syscall record, otherwise userland will see N/2 (rounded
down) arguments instead of N.
 1.25 13-Oct-2003  fvdl Implement 32bit get/setcontext entry points.
 1.24 18-Jan-2003  thorpej branches: 1.24.2;
Merge the nathanw_sa branch.
 1.23 27-Nov-2002  atatat Complete the rename: s/sa_/<compat>_sa_/g

Also tweak the darwin siginfo stuff to avoid the same type of collision.
 1.22 23-Oct-2002  scw In preparation for COMPAT_NETBSD32 on SH-5:

- The MD netbsd32_machdep.h header now defines the 32-bit pointer type
instead of using u_int32_t everywhere,
- The MD netbsd32_machdep.h header now defines a macro (at least on
current implementations) which converts a 32-bit pointer to its 64-bit
equivalent,
- Change the MI code to utilise the above two items in all the right places,
- Implement netbsd32___sigaction_sigtramp().

Tested on Sparc64 by Matt Green.
 1.21 08-Dec-2001  thorpej Make the coredump routine exec-format/emulation specific. Split
out traditional NetBSD coredump routines into core_netbsd.c and
netbsd32_core.c (for COMPAT_NETBSD32).
 1.20 25-Aug-2001  mrg update copyright notices.
 1.19 19-Jun-2001  fvdl branches: 1.19.2;
Some of this was sparc-specific, so ifdef __sparc__ it (XXX). Also,
change the alignment of one structure with an MD ifdef. Should
be moved into the netbsd32_machdep parts.
 1.18 06-Jun-2001  mrg proto for coredump32
 1.17 04-Feb-2001  mrg branches: 1.17.2;
make sysctl vm.loadavg work.
 1.16 02-Feb-2001  mrg de-static netbsd32_exec_aout_prep_[zno]magic().
de-static netbsd32_from_stat43().
move the guts of netbsd32_execve() into netbsd32_execve2().

all of are for the forthcoming sunos32 compat mode (for sparc64).
 1.15 03-Dec-2000  fvdl Add systm.h to pull in copyout* prototypes.
 1.14 01-Dec-2000  jdolecek add e_path (emulation path) to struct emul, which replaces emulation-specific
*_emul_path variables

change macros CHECK_ALT_{CREAT|EXIST} to use that, 'root' doesn't need
to be passed explicitly any more and *_CHECK_ALT_{CREAT|EXIST} are removed
change explicit emul_find() calls in probe functions to get the emulation
path from the checked exec switch entry's emulation

remove no longer needed header files

add e_flags and e_syscall to struct emul; these are unsed and empty for now
 1.13 18-Nov-2000  mrg kill gcc warnings.
 1.12 22-Aug-2000  mrg declare struct firm_event32
 1.11 09-Jul-2000  mrg - massive warning fix fest.
- fix pread/pwrite return values (plus some other syscalls that looked
similarly broken).
- prototypes and clean up for netbsd32_ioctl.c

now getpw*() works under compat32!
 1.10 30-Dec-1999  eeh branches: 1.10.4;
Update to 32-bit compatibility routines.
 1.9 11-Oct-1999  eeh branches: 1.9.2;
Add netbsd32_compat_14.c

Rename everything from compat_netbsd32 -> netbsd32 so we don't have silly
names like compat_14_compat_netbsd32_sys_shmctl().
 1.8 12-Jul-1999  kleink branches: 1.8.2;
XSH5: change function signature to `void *sbrk(intptr_t)'.
 1.7 25-Mar-1999  mrg branches: 1.7.4;
clean and up make compile
 1.6 25-Mar-1999  mrg SPARC32->NETBSD32
 1.5 25-Mar-1999  mrg include the MD header.
 1.4 25-Mar-1999  mrg move sparc32 to netbsd32; split out MD part (signal handling) (mostly via repository copy, rename and perl -pi :-)
 1.3 01-Oct-1998  eeh Overhaul. Now will run simple things like /bin/sh and /bin/echo.
 1.2 07-Sep-1998  eeh Need to make sure high bits of addresses are zeroed out.
 1.1 26-Aug-1998  mrg add a 32-bit compatibility module for the sparc64 port, so it can run NetBSD/sparc binaries with a LP64 kernel.
 1.7.4.1 02-Aug-1999  thorpej Regen.
 1.8.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.9.2.4 11-Feb-2001  bouyer Sync with HEAD.
 1.9.2.3 08-Dec-2000  bouyer Sync with HEAD.
 1.9.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.9.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.10.4.1 26-Aug-2000  mrg pull up 1.12. approved by thorpej:
>Fix netbsd32_ioctls.
 1.17.2.7 11-Dec-2002  thorpej Sync with HEAD.
 1.17.2.6 11-Nov-2002  nathanw Catch up to -current
 1.17.2.5 23-Aug-2002  petrov lwpification.
 1.17.2.4 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.17.2.3 08-Jan-2002  nathanw Catch up to -current.
 1.17.2.2 21-Sep-2001  nathanw Catch up to -current.
 1.17.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.19.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.19.2.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.24.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.24.2.5 01-Apr-2005  skrll Sync with HEAD.
 1.24.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.24.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.24.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.24.2.1 03-Aug-2004  skrll Sync with HEAD
 1.27.2.1 23-May-2004  tron Pull up revision 1.28 (requested by atatat in ticket #374):
Tweak sysctl setup functions (the macros, actually) for use in lkms,
and tweak lkminit_*.c (where applicable) to call them, and to call
sysctl_teardown() when being unloaded.
This consists of (1) making setup functions not be static when being
compiled as lkms (change to sys/sysctl.h), (2) making prototypes
visible for the various setup functions in header files (changes to
various header files), and (3) making simple "load" and "unload"
functions in the actual lkminit stuff.
linux_sysctl.c also needs its root exposed (ie, made not static) for
this (when built as an lkm).
 1.29.6.2 26-Mar-2005  yamt sync with head.
 1.29.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.29.4.1 29-Apr-2005  kent sync with -current
 1.30.2.1 18-Sep-2005  tron Pull up following revision(s) (requested by fvdl in ticket #798):
sys/compat/sunos/sunos_exec.c: revision 1.47
sys/compat/pecoff/pecoff_emul.c: revision 1.11
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.45
sys/arch/amd64/amd64/netbsd32_machdep.c: revision 1.12
sys/sys/proc.h: revision 1.198
sys/compat/mach/mach_exec.c: revision 1.56
sys/compat/freebsd/freebsd_exec.c: revision 1.27
sys/arch/sparc64/include/vmparam.h: revision 1.27
sys/kern/kern_resource.c: revision 1.91
sys/compat/netbsd32/netbsd32_netbsd.c: revision 1.88
sys/compat/osf1/osf1_exec.c: revision 1.39
sys/compat/svr4_32/svr4_32_resource.c: revision 1.5
sys/compat/ultrix/ultrix_misc.c: revision 1.99
sys/compat/svr4_32/svr4_32_exec.h: revision 1.9
sys/kern/exec_elf32.c: revision 1.103
sys/compat/aoutm68k/aoutm68k_exec.c: revision 1.19
sys/compat/sunos32/sunos32_exec.c: revision 1.20
sys/compat/hpux/hpux_exec.c: revision 1.46
sys/compat/darwin/darwin_exec.c: revision 1.40
sys/kern/sysv_shm.c: revision 1.83
sys/uvm/uvm_extern.h: revision 1.99
sys/uvm/uvm_mmap.c: revision 1.89
sys/kern/kern_exec.c: revision 1.195
sys/compat/netbsd32/netbsd32.h: revision 1.31
sys/arch/sparc64/sparc64/svr4_32_machdep.c: revision 1.20
sys/compat/svr4/svr4_exec.c: revision 1.56
sys/compat/irix/irix_exec.c: revision 1.41
sys/compat/ibcs2/ibcs2_exec.c: revision 1.63
sys/compat/svr4_32/svr4_32_exec.c: revision 1.16
sys/arch/amd64/include/vmparam.h: revision 1.8
sys/compat/linux/common/linux_exec.c: revision 1.73
Fix some things regarding COMPAT_NETBSD32 and limits/VM addresses.
* For sparc64 and amd64, define *SIZ32 VM constants.
* Add a new function pointer to struct emul, pointing at a function
that will return the default VM map address. The default function
is uvm_map_defaultaddr, which just uses the VM_DEFAULT_ADDRESS
macro. This gives emulations control over the default map address,
and allows things to be mapped at the right address (in 32bit range)
for COMPAT_NETBSD32.
* Add code to adjust the data and stack limits when a COMPAT_NETBSD32
or COMPAT_SVR4_32 binary is executed.
* Don't use USRSTACK in kern_resource.c, use p_vmspace->vm_minsaddr
instead (emulations might have set it differently)
* Since this changes struct emul, bump kernel version to 3.99.2
Tested on amd64, compile-tested on sparc64.
 1.34.2.7 04-Feb-2008  yamt sync with head.
 1.34.2.6 21-Jan-2008  yamt sync with head
 1.34.2.5 27-Oct-2007  yamt sync with head.
 1.34.2.4 03-Sep-2007  yamt sync with head.
 1.34.2.3 26-Feb-2007  yamt sync with head.
 1.34.2.2 30-Dec-2006  yamt sync with head.
 1.34.2.1 21-Jun-2006  yamt sync with head.
 1.45.2.1 26-Oct-2005  yamt sync with head
 1.48.6.2 01-Jun-2006  kardel Sync with head.
 1.48.6.1 22-Apr-2006  simonb Sync with head.
 1.48.4.1 09-Sep-2006  rpaulo sync with head
 1.49.2.6 11-Aug-2006  yamt sync with head
 1.49.2.5 26-Jun-2006  yamt sync with head.
 1.49.2.4 24-May-2006  yamt sync with head.
 1.49.2.3 01-Apr-2006  yamt sync with head.
 1.49.2.2 13-Mar-2006  yamt sync with head.
 1.49.2.1 05-Mar-2006  yamt file netbsd32.h was added on branch yamt-pdpolicy on 2006-03-13 09:07:07 +0000
 1.50.4.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.50.4.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.50.2.2 11-May-2006  elad sync with head
 1.50.2.1 19-Apr-2006  elad sync with head.
 1.52.2.1 19-Jun-2006  chap Sync with head.
 1.53.2.1 13-Jul-2006  gdamore Merge from HEAD.
 1.54.4.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.54.4.1 12-Jan-2007  ad Sync with head.
 1.57.2.3 07-May-2007  yamt sync with head.
 1.57.2.2 24-Mar-2007  yamt sync with head.
 1.57.2.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.60.6.3 09-Dec-2007  reinoud Pullup to HEAD
 1.60.6.2 29-Mar-2007  reinoud Pullup to -current
 1.60.6.1 18-Mar-2007  reinoud First attempt to bring branch in sync with HEAD
 1.60.4.1 11-Jul-2007  mjf Sync with head.
 1.60.2.6 09-Oct-2007  ad Sync with head.
 1.60.2.5 20-Aug-2007  ad Sync with HEAD.
 1.60.2.4 15-Jul-2007  ad Sync with head.
 1.60.2.3 09-Jun-2007  ad Sync with head.
 1.60.2.2 27-May-2007  ad Sync with head.
 1.60.2.1 10-Apr-2007  ad Sync with head.
 1.66.8.3 23-Mar-2008  matt sync with HEAD
 1.66.8.2 09-Jan-2008  matt sync with HEAD
 1.66.8.1 06-Nov-2007  matt sync with HEAD
 1.66.6.2 09-Dec-2007  jmcneill Sync with HEAD.
 1.66.6.1 02-Oct-2007  joerg Sync with HEAD.
 1.67.2.1 06-Oct-2007  yamt sync with head.
 1.68.6.2 26-Dec-2007  ad Sync with head.
 1.68.6.1 08-Dec-2007  ad Sync with head.
 1.68.4.3 18-Feb-2008  mjf Sync with HEAD.
 1.68.4.2 27-Dec-2007  mjf Sync with HEAD.
 1.68.4.1 08-Dec-2007  mjf Sync with HEAD.
 1.69.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.74.12.4 24-Sep-2008  skrll Some build fixes.
 1.74.12.3 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.74.12.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.74.12.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.74.10.2 11-Mar-2010  yamt sync with head
 1.74.10.1 04-May-2009  yamt sync with head.
 1.74.8.1 04-Jun-2008  yamt sync with head
 1.74.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.74.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.76.4.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.76.4.1 19-Oct-2008  haad Sync with HEAD.
 1.77.4.1 25-Nov-2008  snj branches: 1.77.4.1.4;
Pull up following revision(s) (requested by mrg in ticket #121):
sys/compat/netbsd32/syscalls.master: revision 1.74
sys/compat/netbsd32/netbsd32.h: revision 1.78
sys/compat/netbsd32/netbsd32_netbsd.c: revision 1.149
implement netbsd32__sched_setparam(), netbsd32__sched_getparam(),
netbsd32__sched_setaffinity() and netbsd32__sched_getaffinity().
 1.77.4.1.4.1 12-Sep-2009  matt Add support for netbsd32___mount50. There's got to be a better of doing this.
Maybe pushing it down to vfs. This only supports mfs/ufs/cd9660 and probably
tmpfs.
 1.77.2.3 28-Apr-2009  skrll Sync with HEAD.
 1.77.2.2 03-Mar-2009  skrll Sync with HEAD.
 1.77.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.78.4.2 04-Jan-2009  christos add new syscalls.
 1.78.4.1 22-Nov-2008  christos file netbsd32.h was added on branch christos-time_t on 2009-01-04 01:56:02 +0000
 1.81.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.84.8.2 15-Feb-2011  bouyer implement COMPAT_NETBSD32 quotactl syscalls (both new and COMPAT_50)
 1.84.8.1 08-Feb-2011  bouyer Sync with HEAD
 1.84.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.84.4.2 21-Apr-2011  rmind sync with head
 1.84.4.1 05-Mar-2011  rmind sync with head
 1.88.6.4 29-Apr-2012  mrg sync to latest -current.
 1.88.6.3 06-Mar-2012  mrg sync to -current
 1.88.6.2 24-Feb-2012  mrg sync to -current.
 1.88.6.1 18-Feb-2012  mrg merge to -current.
 1.88.2.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.88.2.2 30-Oct-2012  yamt sync with head
 1.88.2.1 17-Apr-2012  yamt sync with head
 1.92.2.3 18-Mar-2014  msaitoh Pull up following revision(s) (requested by manu in ticket #1025):
sys/compat/netbsd32/netbsd32_netbsd.c: revision 1.184
sys/uvm/uvm_swap.c: revision 1.166
sys/uvm/uvm_swap.h: revision 1.20
sys/compat/netbsd32/netbsd32.h: revision 1.99
Properly translate struct swapent for COMPAT_NETBSD32
Properly translate struct swapent for COMPAT_NETBSD32 (missing commit)
 1.92.2.2 13-Dec-2012  riz Pull up following revision(s) (requested by bouyer in ticket #742):
sys/compat/netbsd32/netbsd32.h: revision 1.94
sys/compat/netbsd32/netbsd32_fs.c: revision 1.63
allow mounting ext2fs and msdosfs
while there also enable lfs but that's untested
 1.92.2.1 12-Apr-2012  riz Pull up following revision(s) (requested by martin in ticket #175):
sys/kern/kern_exit.c: revision 1.238
tests/lib/libc/gen/posix_spawn/t_fileactions.c: revision 1.4
tests/lib/libc/gen/posix_spawn/t_fileactions.c: revision 1.5
sys/uvm/uvm_extern.h: revision 1.183
lib/libc/gen/posix_spawn_fileactions.c: revision 1.2
sys/kern/kern_exec.c: revision 1.348
sys/kern/kern_exec.c: revision 1.349
sys/compat/netbsd32/syscalls.master: revision 1.95
sys/uvm/uvm_glue.c: revision 1.159
sys/uvm/uvm_map.c: revision 1.317
sys/compat/netbsd32/netbsd32.h: revision 1.95
sys/kern/exec_elf.c: revision 1.38
sys/sys/spawn.h: revision 1.2
sys/sys/exec.h: revision 1.135
sys/compat/netbsd32/netbsd32_execve.c: revision 1.34
Rework posix_spawn locking and memory management:
- always provide a vmspace for the new proc, initially borrowing from proc0
(this part fixes PR 46286)
- increase parallelism between parent and child if arguments allow this,
avoiding a potential deadlock on exec_lock
- add a new flag for userland to request old (lockstepped) behaviour for
better error reporting
- adapt test cases to the previous two and add a new variant to test the
diagnostics flag
- fix a few memory (and lock) leaks
- provide netbsd32 compat
Fix asynchronous posix_spawn child exit status (and test for it).
 1.95.2.3 03-Dec-2017  jdolecek update from HEAD
 1.95.2.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.95.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.96.2.1 18-May-2014  rmind sync with head
 1.99.2.1 10-Aug-2014  tls Rebase.
 1.102.2.1 04-Nov-2015  riz Pull up following revision(s) (requested by mrg in ticket #956):
sys/compat/netbsd32/files.netbsd32: revision 1.36
sys/compat/netbsd32/netbsd32_sysent.c: revision 1.115
sys/compat/netbsd32/netbsd32_syscallargs.h: revision 1.116
sys/nfs/nfs_var.h: revision 1.93
sys/compat/netbsd32/netbsd32_conv.h: revision 1.30
sys/compat/netbsd32/netbsd32_syscall.h: revision 1.116
sys/compat/netbsd32/netbsd32_syscalls.c: revision 1.115
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.1
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.3
sys/nfs/nfs_syscalls.c: revision 1.156
sys/compat/netbsd32/syscalls.master: revision 1.108
sys/compat/netbsd32/netbsd32.h: revision 1.107
add netbsd32 support for nfssvc(2). we do this by defining 5 copyin/out
functions that do all the ugly work, are just plain copyin/out for the
native system calls, and do the necessary translations for netbsd32.
with this i'm able to run 32 bit nfsd and mountd on 64 bit kernel and
mount the file systems remotely.
don't copy the first netbsd32_export_args nexports times, but actually
advance the userland pointer each entry through the loop. oops.
 1.103.2.4 05-Dec-2016  skrll Sync with HEAD
 1.103.2.3 05-Oct-2016  skrll Sync with HEAD
 1.103.2.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.103.2.1 22-Sep-2015  skrll Sync with HEAD
 1.109.2.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.109.2.1 04-Nov-2016  pgoyette Sync with HEAD
 1.114.8.4 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1833):

sys/compat/netbsd32/netbsd32_netbsd.c: revision 1.232
sys/compat/netbsd32/netbsd32_socket.c: revision 1.56
sys/compat/netbsd32/netbsd32_conv.h: revision 1.45
sys/compat/netbsd32/netbsd32_fs.c: revision 1.92
sys/compat/netbsd32/netbsd32.h: revision 1.137

The read/write/send/recv system calls return ssize_t because -1 is
returned on error. Therefore we must restrict the lengths of any
buffers to NETBSD32_SSIZE_MAX with compat32 to avoid garbage return
values.

Fixes ATF lib/libc/sys/t_write:write_err.
 1.114.8.3 25-Aug-2018  martin Pull up following revision(s) (requested by mrg in ticket #977):

sys/compat/netbsd32/netbsd32_fs.c: revision 1.81
sys/compat/netbsd32/netbsd32.h: revision 1.119

support nullfs in netbsd32.
 1.114.8.2 14-Apr-2018  snj Pull up revision 1.116 of sys/compat/netbsd32/netbsd32.h to fix fallout
from ticket #713:
include <compat/sys/siginfo.h> for siginfo32_t.
 1.114.8.1 12-Apr-2018  martin Pull up following revision(s) (requested by kamil in ticket #713):

sys/modules/procfs/Makefile: revision 1.4
sys/miscfs/procfs/procfs_vfsops.c: revision 1.98
bin/ps/ps.1: revision 1.108
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.32
sys/miscfs/procfs/procfs_vnops.c: revision 1.198
sys/kern/sys_ptrace_common.c: revision 1.23
sys/kern/sys_ptrace_common.c: revision 1.24
sbin/mount_procfs/mount_procfs.8: revision 1.36
sys/kern/sys_ptrace_common.c: revision 1.25
sys/kern/sys_ptrace.c: revision 1.5
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.30
sys/sys/proc.h: revision 1.342
sys/kern/sys_ptrace_common.c: revision 1.26
sys/miscfs/procfs/procfs_ctl.c: file removal
sys/kern/sys_ptrace_common.c: revision 1.27
sys/miscfs/procfs/procfs_subr.c: revision 1.109
sys/kern/sys_ptrace_common.c: revision 1.28
sys/secmodel/extensions/secmodel_extensions.c: revision 1.8
sys/kern/sys_ptrace_common.c: revision 1.29
sys/sys/ptrace.h: revision 1.62
sys/compat/netbsd32/netbsd32_signal.c: revision 1.45
share/man/man9/kauth.9: revision 1.109
sys/miscfs/procfs/files.procfs: revision 1.12
sys/compat/netbsd32/netbsd32.h: revision 1.115
sys/miscfs/procfs/procfs.h: revision 1.72
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.5
sys/kern/kern_sig.c: revision 1.337
sys/sys/kauth.h: revision 1.75
sys/sys/sysctl.h: revision 1.224
sys/kern/sys_ptrace_common.c: revision 1.30
sys/kern/sys_ptrace_common.c: revision 1.31
sys/kern/sys_ptrace_common.c: revision 1.32
sys/kern/sys_ptrace_common.c: revision 1.33
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.20
sys/kern/sys_ptrace_common.c: revision 1.34
sys/kern/sys_ptrace_common.c: revision 1.36
sys/kern/kern_proc.c: revision 1.207
sys/kern/kern_exit.c: revision 1.269
doc/TODO.ptrace: revision 1.29

Make {s,g}et{db,fp,}regs work again for PK_32 processes
XXX: pullup-8

add disgusting magic to handle compat_netbsd32 as a module.

use process_*reg32 instead of struct *reg32.

Remove the filesystem tracing feature

This is a legacy interface from 4.4BSD, and it was
introduced to overcome shortcomings of ptrace(2) at that time, which are
no longer relevant (performance). Today /proc/#/ctl offers a narrow
subset of ptrace(2) commands and is not applicable for modern
applications use beyond simplistic tracing scenarios.

This removal will simplify kernel internals. Users will still be able to
use all the other /proc files.

This change won't affect other procfs files neither Linux compat
features within mount_procfs(8). /proc/#/ctl isn't available on Linux.

Remove:
- /proc/#/ctl from mount_procfs(8)
- P_FSTRACE note from the documentation of ps(1)
- /proc/#/ctl and filesystem tracing documentation from mount_procfs(8)
- KAUTH_REQ_PROCESS_PROCFS_CTL documentation from kauth(9)
- source code file miscfs/procfs/procfs_ctl.c
- PFSctl and procfs_doctl() from sys/miscfs/procfs/procfs.h
- KAUTH_REQ_PROCESS_PROCFS_CTL from sys/sys/kauth.h
- PSL_FSTRACE (0x00010000) from sys/sys/proc.h
- P_FSTRACE (0x00010000) from sys/sys/sysctl.h

Reduce code complexity after removal of this functionality.

Update TODO.ptrace accordingly: remove two entries about /proc tracing.

Do not keep legacy notes as comments in the headers about removed

PSL_FSTRACE / P_FSTRACE, as this interface had little number of users
(close or equal to zero).
Proposed on tech-kern@.

All filesystem tracing utility users are encouraged to switch to ptrace(2).

Sponsored by <The NetBSD Foundation>

untangle the mess:
- factor out common code
- break each ptrace subcall to its own sub-function
.. more to come ...
- reduce ifdef ugliness by moving it up top.
- factor out PT_IO and make PT_{READ,WRITE}_{I,D} use it
- factor out PT_DUMPCORE
- factor out sendsig code
.. more to come ...

handle siginfo requests for ptrace32

ptrace: Partially undo PT_{READ,WRITE}_{I,D} and unbreak these commands

The refactored code did not work and was generating EFAULT.

Sponsored by <The NetBSD Foundation>

Merge the code back; the problem was that since we are reading/writing
to a kernel address for PT_{READ,WRITE}_{I,D} we need the kernel vmspace.
provide separate read and write functions to accomodate register functions
that need a size argument.

don't ignore error from copyout_piod

Use the proper process (the tracee) to get information about lwps and
registers and the tracer for vmspace.

Add new sysctl(3) entry: security.models.extensions.user_set_dbregs

Model this new sysctl(3) entry after "user_set_cpu_affinity" in the same
level of sysctl(3) switches.

Allow to read unconditionally Debug Registers (no change here). This is
convenient as even if a user of a debugger does not use hardware assisted
watchpoints/breakpoints, a debugger can still prompt these values to store
in an internal cache with context of registers. Reading them should have
no security concerns.

Add a paranoid MI switch that prohibits by default setting these registers
by a regular user (non-superuser). Make this switch disabled by default.
There are enough reserved bits out there to allow using them
unconditionally on hardened hosts.

Features shipped with Debug Registers are optional features in debuggers.
There is no reduction in elementary functionality.

Reviewed by <christos>

Sponsored by <The NetBSD Foundation>
 1.116.2.19 25-Jan-2019  pgoyette Move the netbsd32_machine32_hook into the main kernel with most of
the other hooks.

Although this hook might better belong in compat/netbsd32/ code,
there are some machines without a netbsd32 module (for example, i386
and sgimips) which still have consumers/users of this hook. :(
 1.116.2.18 24-Jan-2019  pgoyette Rework placement of the new netbsd32_machine32_hook
 1.116.2.17 14-Jan-2019  pgoyette Create a variant of the HOOK macros that handles hook routines of
type void, and use them where appropriate.
 1.116.2.16 26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.116.2.15 27-Sep-2018  pgoyette Hook up the arm compat_netbsd32_13 & _16 code
 1.116.2.14 24-Sep-2018  pgoyette syntax: add missing )
 1.116.2.13 24-Sep-2018  pgoyette Convert yet another function pointer to the MP-safe mechanism
 1.116.2.12 23-Sep-2018  pgoyette The kern_proc_32 hook is defined in non-compat code. Don't redefine.
 1.116.2.11 23-Sep-2018  pgoyette More work on kern_proc_32
 1.116.2.10 23-Sep-2018  pgoyette White space for readability
 1.116.2.9 18-Sep-2018  pgoyette The COMPAT_HOOK macros were renamed to MODULE_HOOK, adjust all callers
 1.116.2.8 18-Sep-2018  pgoyette Use the MP-safe compat hooks for netbsd32_compat_80.c's modctl
 1.116.2.7 14-Sep-2018  pgoyette Forward declaration of struct netbsd32_modctl_args
 1.116.2.6 14-Sep-2018  pgoyette Move some extern definitions into netbsd32_netbsd.h rather than having
them in the .c files.
 1.116.2.5 14-Sep-2018  pgoyette OMG it builds!

Finish rearranging the amd64 MD compat_netbsd32 code.

XXX Other architectures will be dealt with later.
 1.116.2.4 11-Sep-2018  pgoyette Put the ``extern struct emul'' into the netbsd32_netbsd.h header
so it doesn't have to be separately declared in each source file.

Thanks mrg@
 1.116.2.3 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.116.2.2 21-May-2018  pgoyette Sync with HEAD
 1.116.2.1 16-Apr-2018  pgoyette Sync with HEAD, resolve some conflicts
 1.118.2.3 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.118.2.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.118.2.1 10-Jun-2019  christos Sync with HEAD
 1.123.4.3 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1489):

sys/compat/netbsd32/netbsd32_netbsd.c: revision 1.232
sys/compat/netbsd32/netbsd32_socket.c: revision 1.56
sys/compat/netbsd32/netbsd32_conv.h: revision 1.45
sys/compat/netbsd32/netbsd32_fs.c: revision 1.92
sys/compat/netbsd32/netbsd32.h: revision 1.137

The read/write/send/recv system calls return ssize_t because -1 is
returned on error. Therefore we must restrict the lengths of any
buffers to NETBSD32_SSIZE_MAX with compat32 to avoid garbage return
values.

Fixes ATF lib/libc/sys/t_write:write_err.
 1.123.4.2 24-Apr-2022  martin Pull up following revision(s) (requested by reinoud in ticket #1438):

sys/compat/netbsd32/netbsd32.h: revision 1.140
sys/compat/netbsd32/netbsd32_fs.c: revision 1.95
sys/fs/udf/udf_subr.c: revision 1.169

Fix endian issue with UDF extended attribute handling

Implement support for mounting UDF in compat32
Fixes PR#56801
 1.123.4.1 19-Nov-2019  martin Pull up following revision(s) (requested by rin in ticket #457):

sys/compat/sys/siginfo.h: revision 1.9
sys/compat/netbsd32/netbsd32.h: revision 1.131

8-byte objects on i386 or arm-oabi are aligned in 4-byte boundary.

Therefore, we must use __attribute__((__aligned__(4))) for them.
netbsd32_{,u}int64 are provided for this purpose. However, we
cannot use it in <compat/sys/siginfo.h> due to circular dependency
b/w <machine/netbsd32_machdep.h>.

In order to distangle it, we choose here to have a duplicate type,
netbsd32_siginfo_uint64, in <compat/sys/siginfo.h>. The equivalence
with netbsd32_uint64 is asserted in <compat/netbsd32/netbsd32.h>.

Now, gdb for i386 works again on amd64 kernel.

Based on patch provided by kamil. Thanks!

XXX
pullup to netbsd-9
 1.133.2.2 03-Apr-2021  thorpej Sync with HEAD.
 1.133.2.1 14-Dec-2020  thorpej Sync w/ HEAD.
 1.3 25-Apr-2021  christos All mips64 has compat_netbsd32
 1.2 06-Mar-2020  pgoyette branches: 1.2.8;
According to mrg@ we need to include aarch64 in the list of those
that need to support COMPAT_NETBSD32
 1.1 04-Feb-2019  mrg branches: 1.1.4;
don't assume _LP64 == supports COMPAT_NETBSD32.

this is not true for alpha, ia64 and arm32 ports, and the first two
were not building because of it, and the latter would be missing
the oabi support (likely not a big deal, but still wrong.)

add a makefile fragment that tells you if it is supported and include
it where needed to define COMPAT_NETBSD32 when building the normal
kernel (ie, modules & rump.)


fixes alpha build, probably fixes ia64 build.


XXX: still leaves some netbsd32 code in rf_netbsdkintf.c, that should
be moved into some hooks, but first the configuration setup
needs to be moved into a common function the netbsd32 code can
call into, vs living in the switch case itself.
 1.1.4.3 08-Apr-2020  martin Merge changes from current as of 20200406
 1.1.4.2 10-Jun-2019  christos Sync with HEAD
 1.1.4.1 04-Feb-2019  christos file netbsd32.mk was added on branch phil-wifi on 2019-06-10 22:07:01 +0000
 1.2.8.1 13-May-2021  thorpej Sync with HEAD.
 1.1 16-May-2020  christos Add ACL support for FFS. From FreeBSD.
 1.20 19-Jan-2021  simonb KNF consistency: No parentheses are needed around the return value.
 1.19 27-Jan-2019  pgoyette branches: 1.19.12;
Merge the [pgoyette-compat] branch
 1.18 29-May-2008  mrg branches: 1.18.12; 1.18.86; 1.18.88;
remove clause #3 from my license where there are no other
copyright holders involved.
 1.17 20-Dec-2007  dsl branches: 1.17.6; 1.17.8; 1.17.10; 1.17.12;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.16 08-Dec-2007  dsl branches: 1.16.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.15 18-Mar-2007  dsl branches: 1.15.8; 1.15.10; 1.15.18;
Change all the NETBSD32PTR64(SCARG(uap, xxx))) to SCARG_P32(uap, xxx).
 1.14 09-Feb-2007  ad branches: 1.14.2; 1.14.6; 1.14.8; 1.14.10;
Merge newlock2 to head.
 1.13 11-Dec-2005  christos branches: 1.13.20;
merge ktrace-lwp.
 1.12 04-Dec-2003  atatat branches: 1.12.16;
Dynamic sysctl.

Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.

Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.

All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.

PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
 1.11 29-Jun-2003  fvdl branches: 1.11.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.10 29-Jun-2003  martin struct proc * -> struct lwp *
 1.9 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.8 23-Oct-2002  scw In preparation for COMPAT_NETBSD32 on SH-5:

- The MD netbsd32_machdep.h header now defines the 32-bit pointer type
instead of using u_int32_t everywhere,
- The MD netbsd32_machdep.h header now defines a macro (at least on
current implementations) which converts a 32-bit pointer to its 64-bit
equivalent,
- Change the MI code to utilise the above two items in all the right places,
- Implement netbsd32___sigaction_sigtramp().

Tested on Sparc64 by Matt Green.
 1.7 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.6 30-Nov-2000  jdolecek branches: 1.6.2; 1.6.4;
fix typo - it should be compat_09_netbsd32_uname, not compat_09_netbsd32_ouname
 1.5 28-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.4 11-Oct-1999  eeh branches: 1.4.2;
Add netbsd32_compat_14.c

Rename everything from compat_netbsd32 -> netbsd32 so we don't have silly
names like compat_14_compat_netbsd32_sys_shmctl().
 1.3 25-Mar-1999  mrg branches: 1.3.8;
SPARC32->NETBSD32
 1.2 25-Mar-1999  mrg move sparc32 to netbsd32; split out MD part (signal handling) (mostly via repository copy, rename and perl -pi :-)
 1.1 26-Aug-1998  mrg add a 32-bit compatibility module for the sparc64 port, so it can run NetBSD/sparc binaries with a LP64 kernel.
 1.3.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.4.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.4.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.6.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.6.2.4 11-Nov-2002  nathanw Catch up to -current
 1.6.2.3 23-Aug-2002  petrov lwpification.
 1.6.2.2 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.6.2.1 14-Nov-2001  nathanw Catch up to -current.
 1.11.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.11.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.11.2.1 03-Aug-2004  skrll Sync with HEAD
 1.12.16.3 21-Jan-2008  yamt sync with head
 1.12.16.2 03-Sep-2007  yamt sync with head.
 1.12.16.1 26-Feb-2007  yamt sync with head.
 1.13.20.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.14.10.1 29-Mar-2007  reinoud Pullup to -current
 1.14.8.1 11-Jul-2007  mjf Sync with head.
 1.14.6.1 10-Apr-2007  ad Sync with head.
 1.14.2.1 24-Mar-2007  yamt sync with head.
 1.15.18.1 26-Dec-2007  ad Sync with head.
 1.15.10.1 09-Jan-2008  matt sync with HEAD
 1.15.8.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.16.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.17.12.3 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.17.12.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.17.12.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.17.10.1 04-May-2009  yamt sync with head.
 1.17.8.1 04-Jun-2008  yamt sync with head
 1.17.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.18.88.1 10-Jun-2019  christos Sync with HEAD
 1.18.86.6 03-Oct-2018  pgoyette Normalize the required lists. Each compat_netbsd32_xx needs the
non-32bit module of the same version _and_ the 32-bit module for
the next higher version.
 1.18.86.5 11-Sep-2018  pgoyette Put the ``extern struct emul'' into the netbsd32_netbsd.h header
so it doesn't have to be separately declared in each source file.

Thanks mrg@
 1.18.86.4 11-Sep-2018  pgoyette Also need to declare the emul_netbsd32 !
 1.18.86.3 11-Sep-2018  pgoyette Install the syscalls into the netbsd32 table, not the default/native table.
 1.18.86.2 11-Sep-2018  pgoyette Use netbsd32 syscall names in the establish/disestablish tables
 1.18.86.1 10-Sep-2018  pgoyette Initial cut at a compat_netbsd32_09 and compat_netbsd32_12 modules.
 1.18.12.2 29-May-2008  mrg remove clause #3 from my license where there are no other
copyright holders involved.
 1.18.12.1 29-May-2008  mrg file netbsd32_compat_09.c was added on branch christos-time_t on 2008-05-29 14:51:27 +0000
 1.19.12.1 03-Apr-2021  thorpej Sync with HEAD.
 1.26 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.25 03-Dec-2015  pgoyette branches: 1.25.16; 1.25.18;
Split out the SYSV IPC stuff into its own compat_netbsd32_sysvipc
module. Adjust dependencies as needed.
 1.24 23-Apr-2010  rmind branches: 1.24.18; 1.24.36;
Replace M_IOV and some malloc(9)s with kmem(9), and while there:
- Fix invalid free (M_TEMP vs M_IOV) in do_sys_recvmsg(), spotted by jakllsch@.
Also, same fix in osf1_sys_sendmsg_xopen().
- Fix attempt to free non-allocated memory in error path in netbsd32___getfh30().
- Plug a memory leak in compat_43_netbsd32_orecvmsg().
 1.23 11-Jan-2009  christos branches: 1.23.4; 1.23.6;
merge christos-time_t
 1.22 20-Dec-2007  dsl branches: 1.22.6; 1.22.10; 1.22.12; 1.22.18; 1.22.24;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.21 08-Dec-2007  dsl branches: 1.21.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.20 03-Jun-2007  dsl branches: 1.20.6; 1.20.8; 1.20.16;
Split netbsd32___semctl14() so that it is callable from
compat_10_netbsd32_sys_semsys() (where the one parameter is already in
kernel space).
Note that the code in compat_10_netbsd32_sys_semsys() has always been wrong,
since it called compat_14_sys___semctl() - which would read 64bit values!
 1.19 16-Mar-2007  dsl remove all the double (and triple) casts used to convert 32bit userspace
pointers to and from 64bit kernel pointers. Instead use the defines
NETBSD32PTR64(p32) to read a 32bit pointer and (the new) NETBSD32PTR32(p32,p64)
to write a 32bit pointer throughout.
The 32bit pointer is now a struct to enforce the above.
amd64 (with linux emul) and sparc64 will both compile (when the arch stuff
goes in soon), and amd64 still runs some i386 binaries.
 1.18 04-Mar-2007  christos branches: 1.18.2; 1.18.4; 1.18.6;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.17 09-Feb-2007  ad branches: 1.17.2;
Merge newlock2 to head.
 1.16 10-Nov-2005  christos branches: 1.16.22;
need compat/sys/shm.h
 1.15 18-Jan-2003  thorpej branches: 1.15.2; 1.15.18;
Merge the nathanw_sa branch.
 1.14 23-Oct-2002  scw In preparation for COMPAT_NETBSD32 on SH-5:

- The MD netbsd32_machdep.h header now defines the 32-bit pointer type
instead of using u_int32_t everywhere,
- The MD netbsd32_machdep.h header now defines a macro (at least on
current implementations) which converts a 32-bit pointer to its 64-bit
equivalent,
- Change the MI code to utilise the above two items in all the right places,
- Implement netbsd32___sigaction_sigtramp().

Tested on Sparc64 by Matt Green.
 1.13 29-Apr-2002  mrg build the netbsd32_compat* objects into libcompat.a, so they are available
to emulations not just netbsd itself. rename the compat_10 functions to
match everything else. fixes a problem reported by julian coleman.
 1.12 16-Mar-2002  christos make the stackgap_{init,alloc} functions MP friendly (i.e. pass struct proc *
in, instead of using curproc). While there add an optional size argument to
stackgap_init.
 1.11 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.10 30-May-2001  mrg branches: 1.10.2;
use _KERNEL_OPT.
 1.9 29-Nov-2000  jdolecek branches: 1.9.2;
LKMify
 1.8 18-Nov-2000  mrg get rid of remaining warnings.
 1.7 18-Nov-2000  mrg kill gcc warnings.
 1.6 28-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.5 26-Jun-2000  mrg remove/move more mach vm header files:

<vm/pglist.h> -> <uvm/uvm_pglist.h>
<vm/vm_inherit.h> -> <uvm/uvm_inherit.h>
<vm/vm_kern.h> -> into <uvm/uvm_extern.h>
<vm/vm_object.h> -> nothing
<vm/vm_pager.h> -> into <uvm/uvm_pager.h>

also includes a bunch of <vm/vm_page.h> include removals (due to redudancy
with <vm/vm.h>), and a scattering of other similar headers.
 1.4 11-Oct-1999  eeh branches: 1.4.2;
Add netbsd32_compat_14.c

Rename everything from compat_netbsd32 -> netbsd32 so we don't have silly
names like compat_14_compat_netbsd32_sys_shmctl().
 1.3 25-Mar-1999  mrg branches: 1.3.8;
move sparc32 to netbsd32; split out MD part (signal handling) (mostly via repository copy, rename and perl -pi :-)
 1.2 19-Oct-1998  tron Defopt SYSVMSG, SYSVSEM and SYSVSHM.
 1.1 01-Oct-1998  eeh Overhaul. Now will run simple things like /bin/sh and /bin/echo.
 1.3.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.4.2.3 08-Dec-2000  bouyer Sync with HEAD.
 1.4.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.4.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.9.2.7 11-Nov-2002  nathanw Catch up to -current
 1.9.2.6 23-Aug-2002  petrov lwpification.
 1.9.2.5 20-Jun-2002  nathanw Catch up to -current.
 1.9.2.4 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.9.2.3 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.9.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.9.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.10.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.10.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.15.18.4 21-Jan-2008  yamt sync with head
 1.15.18.3 03-Sep-2007  yamt sync with head.
 1.15.18.2 26-Feb-2007  yamt sync with head.
 1.15.18.1 21-Jun-2006  yamt sync with head.
 1.15.2.1 11-Dec-2005  christos Sync with head.
 1.16.22.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.17.2.2 24-Mar-2007  yamt sync with head.
 1.17.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.18.6.1 18-Mar-2007  reinoud First attempt to bring branch in sync with HEAD
 1.18.4.1 11-Jul-2007  mjf Sync with head.
 1.18.2.2 09-Jun-2007  ad Sync with head.
 1.18.2.1 10-Apr-2007  ad Sync with head.
 1.20.16.1 26-Dec-2007  ad Sync with head.
 1.20.8.1 09-Jan-2008  matt sync with HEAD
 1.20.6.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.21.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.22.24.1 04-Jan-2009  christos fix module build.
 1.22.18.1 19-Jan-2009  skrll Sync with HEAD.
 1.22.12.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.22.12.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.22.10.2 11-Aug-2010  yamt sync with head.
 1.22.10.1 04-May-2009  yamt sync with head.
 1.22.6.1 17-Jan-2009  mjf Sync with HEAD.
 1.23.6.1 30-May-2010  rmind sync with head
 1.23.4.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.24.36.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.24.18.1 03-Dec-2017  jdolecek update from HEAD
 1.25.18.1 10-Jun-2019  christos Sync with HEAD
 1.25.16.3 12-Sep-2018  pgoyette Split compat_netbsd32_sysvipc into version-specific modules
 1.25.16.2 11-Sep-2018  pgoyette Regen syscall files and fix includes for syscallvar.h
 1.25.16.1 10-Sep-2018  pgoyette Initial cut at a compat_netbsd32_09 and compat_netbsd32_12 modules.
 1.4 20-May-2024  christos Rename dup3110 to dup3100 to match historical practice for NetBSD-11,
because we already have kevent100. Fix compat_dup3 to belong in compat_100
not compat_110.
 1.3 29-Jul-2023  rin COMPAT_NETBSD32: No need to have compat_100_netbsd32_kevent_fetch_timeout.
NFCI.
 1.2 29-Jul-2023  rin COMPAT_NETBSD32: Catch up with sys___kevent100() addition.

XXX
Add epoll_* and memfd_create.
 1.1 19-Dec-2022  pgoyette Create compat_100 module infrastructure now that we have branched
for NetBSD-10
 1.3 19-Jan-2021  simonb KNF consistency: No parentheses are needed around the return value.
 1.2 27-Jan-2019  pgoyette branches: 1.2.4; 1.2.14;
Merge the [pgoyette-compat] branch
 1.1 12-Sep-2018  pgoyette branches: 1.1.2;
file netbsd32_compat_10_sysv.c was initially added on branch pgoyette-compat.
 1.1.2.1 12-Sep-2018  pgoyette Split compat_netbsd32_sysvipc into version-specific modules
 1.2.14.1 03-Apr-2021  thorpej Sync with HEAD.
 1.2.4.2 10-Jun-2019  christos Sync with HEAD
 1.2.4.1 27-Jan-2019  christos file netbsd32_compat_10_sysv.c was added on branch phil-wifi on 2019-06-10 22:07:01 +0000
 1.2 20-May-2024  christos Rename dup3110 to dup3100 to match historical practice for NetBSD-11,
because we already have kevent100. Fix compat_dup3 to belong in compat_100
not compat_110.
 1.1 19-May-2024  christos version dup3
 1.36 07-Sep-2021  riastradh sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.35 19-Jan-2021  simonb KNF consistency: No parentheses are needed around the return value.
 1.34 27-Jan-2019  pgoyette branches: 1.34.4; 1.34.12;
Merge the [pgoyette-compat] branch
 1.33 10-Dec-2012  chs branches: 1.33.30; 1.33.36; 1.33.38;
fix these *stat routines: don't pass a kernel stack buffer
to a function that will try to copyout() to it.
just do both layers of compat translation here.
 1.32 30-Jan-2009  njoly branches: 1.32.14; 1.32.24;
Cleanup. Kill a few netbsd32_caddr_t in syscalls argument types.
 1.31 29-May-2008  mrg branches: 1.31.6; 1.31.12;
remove clause #3 from my license where there are no other
copyright holders involved.
 1.30 20-Dec-2007  dsl branches: 1.30.6; 1.30.8; 1.30.10; 1.30.12;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.29 08-Dec-2007  dsl branches: 1.29.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.28 04-Dec-2007  dsl Remove all the __P
 1.27 30-Apr-2007  dsl branches: 1.27.6; 1.27.8; 1.27.14; 1.27.16;
Remove some unused calls to stackgap_init()
 1.26 22-Apr-2007  dsl Change the way that emulations locate files within the emulation root to
avoid having to allocate space in the 'stackgap'
- which is very LWP unfriendly.
The additional code for non-emulation namei() is trivial, the reduction for
the emulations is massive.
The vnode for a processes emulation root is saved in the cwdi structure
during process exec.
If the emulation root the TRYEMULROOT flag are set, namei() will do an initial
search for absolute pathnames in the emulation root, if that fails it will
retry from the normal root.
".." at the emulation root will always go to the real root, even in the middle
of paths and when expanding symlinks.
Absolute symlinks found using absolute paths in the emulation root will be
relative to the emulation root (so /usr/lib/xxx.so -> /lib/xxx.so links
inside the emulation root don't need changing).
If the root of the emulation would be returned (for an emulation lookup), then
the real root is returned instead (matching the behaviour of emul_lookup,
but being a cheap comparison here) so that programs that scan "../.."
looking for the root dircetory don't loop forever.
The target for symbolic links is no longer mangled (it used to get the
CHECK_ALT_xxx() treatment, so could get /emul/xxx prepended).
CHECK_ALT_xxx() are no more. Most of the change is deleting them, and adding
TRYEMULROOT to the flags to NDINIT().
A lot of the emulation system call stubs could now be deleted.
 1.25 18-Mar-2007  dsl Change all the NETBSD32PTR64(SCARG(uap, xxx))) to SCARG_P32(uap, xxx).
 1.24 16-Mar-2007  dsl remove all the double (and triple) casts used to convert 32bit userspace
pointers to and from 64bit kernel pointers. Instead use the defines
NETBSD32PTR64(p32) to read a 32bit pointer and (the new) NETBSD32PTR32(p32,p64)
to write a 32bit pointer throughout.
The 32bit pointer is now a struct to enforce the above.
amd64 (with linux emul) and sparc64 will both compile (when the arch stuff
goes in soon), and amd64 still runs some i386 binaries.
 1.23 04-Mar-2007  christos branches: 1.23.2; 1.23.4; 1.23.6;
fix fallout from caddr_t changes.
 1.22 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.21 09-Feb-2007  ad branches: 1.21.2;
Merge newlock2 to head.
 1.20 11-Dec-2005  christos branches: 1.20.20;
merge ktrace-lwp.
 1.19 13-Sep-2005  christos make this compile again.
 1.18 29-Jun-2003  fvdl branches: 1.18.2; 1.18.18;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.17 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.16 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.15 23-Oct-2002  scw In preparation for COMPAT_NETBSD32 on SH-5:

- The MD netbsd32_machdep.h header now defines the 32-bit pointer type
instead of using u_int32_t everywhere,
- The MD netbsd32_machdep.h header now defines a macro (at least on
current implementations) which converts a 32-bit pointer to its 64-bit
equivalent,
- Change the MI code to utilise the above two items in all the right places,
- Implement netbsd32___sigaction_sigtramp().

Tested on Sparc64 by Matt Green.
 1.14 16-Mar-2002  christos make the stackgap_{init,alloc} functions MP friendly (i.e. pass struct proc *
in, instead of using curproc). While there add an optional size argument to
stackgap_init.
 1.13 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.12 25-Aug-2001  mrg update copyright notices.
 1.11 30-May-2001  mrg branches: 1.11.2;
use _KERNEL_OPT.
 1.10 07-Feb-2001  mrg branches: 1.10.2;
compat_12_netbsd32_{,fl}stat12() were not copyout()ing the converted result.
 1.9 03-Dec-2000  fvdl Include opt_* files to make sure prototypes are included.
 1.8 01-Dec-2000  jdolecek prototype netbsd32_stat12_to_netbsd32()
 1.7 01-Dec-2000  jdolecek add e_path (emulation path) to struct emul, which replaces emulation-specific
*_emul_path variables

change macros CHECK_ALT_{CREAT|EXIST} to use that, 'root' doesn't need
to be passed explicitly any more and *_CHECK_ALT_{CREAT|EXIST} are removed
change explicit emul_find() calls in probe functions to get the emulation
path from the checked exec switch entry's emulation

remove no longer needed header files

add e_flags and e_syscall to struct emul; these are unsed and empty for now
 1.6 11-Oct-1999  eeh branches: 1.6.2;
Add netbsd32_compat_14.c

Rename everything from compat_netbsd32 -> netbsd32 so we don't have silly
names like compat_14_compat_netbsd32_sys_shmctl().
 1.5 25-Mar-1999  mrg branches: 1.5.8;
SPARC32->NETBSD32
 1.4 25-Mar-1999  mrg move sparc32 to netbsd32; split out MD part (signal handling) (mostly via repository copy, rename and perl -pi :-)
 1.3 01-Oct-1998  eeh Overhaul. Now will run simple things like /bin/sh and /bin/echo.
 1.2 29-Aug-1998  mrg move <vm/vm_swap.h> to <sys/swap.h>. <vm/vm_swap.h> still works for now (goes away later)
 1.1 26-Aug-1998  mrg add a 32-bit compatibility module for the sparc64 port, so it can run NetBSD/sparc binaries with a LP64 kernel.
 1.5.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.6.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.6.2.1 08-Dec-2000  bouyer Sync with HEAD.
 1.10.2.7 11-Nov-2002  nathanw Catch up to -current
 1.10.2.6 23-Aug-2002  petrov lwpification.
 1.10.2.5 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.10.2.4 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.10.2.3 14-Nov-2001  nathanw Catch up to -current.
 1.10.2.2 21-Sep-2001  nathanw Catch up to -current.
 1.10.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.11.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.11.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.11.2.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.18.18.5 21-Jan-2008  yamt sync with head
 1.18.18.4 07-Dec-2007  yamt sync with head
 1.18.18.3 03-Sep-2007  yamt sync with head.
 1.18.18.2 26-Feb-2007  yamt sync with head.
 1.18.18.1 21-Jun-2006  yamt sync with head.
 1.18.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.18.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.18.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.18.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.20.20.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.21.2.3 07-May-2007  yamt sync with head.
 1.21.2.2 24-Mar-2007  yamt sync with head.
 1.21.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.23.6.2 29-Mar-2007  reinoud Pullup to -current
 1.23.6.1 18-Mar-2007  reinoud First attempt to bring branch in sync with HEAD
 1.23.4.1 11-Jul-2007  mjf Sync with head.
 1.23.2.2 27-May-2007  ad Sync with head.
 1.23.2.1 10-Apr-2007  ad Sync with head.
 1.27.16.2 26-Dec-2007  ad Sync with head.
 1.27.16.1 08-Dec-2007  ad Sync with head.
 1.27.14.2 27-Dec-2007  mjf Sync with HEAD.
 1.27.14.1 08-Dec-2007  mjf Sync with HEAD.
 1.27.8.1 09-Jan-2008  matt sync with HEAD
 1.27.6.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.29.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.30.12.3 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.30.12.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.30.12.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.30.10.1 04-May-2009  yamt sync with head.
 1.30.8.1 04-Jun-2008  yamt sync with head
 1.30.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.31.12.2 29-May-2008  mrg remove clause #3 from my license where there are no other
copyright holders involved.
 1.31.12.1 29-May-2008  mrg file netbsd32_compat_12.c was added on branch christos-time_t on 2008-05-29 14:51:27 +0000
 1.31.6.1 03-Mar-2009  skrll Sync with HEAD.
 1.32.24.1 25-Feb-2013  tls resync with head
 1.32.14.1 16-Jan-2013  yamt sync with (a bit old) head
 1.33.38.1 10-Jun-2019  christos Sync with HEAD
 1.33.36.9 03-Oct-2018  pgoyette Normalize the required lists. Each compat_netbsd32_xx needs the
non-32bit module of the same version _and_ the 32-bit module for
the next higher version.
 1.33.36.8 03-Oct-2018  pgoyette Make sure that each version-specific compat_netbsd32_xx module depends
on all higher-version-specific modules, similar to the non-32bit
compat_xx modules.
 1.33.36.7 11-Sep-2018  pgoyette Put the ``extern struct emul'' into the netbsd32_netbsd.h header
so it doesn't have to be separately declared in each source file.

Thanks mrg@
 1.33.36.6 11-Sep-2018  pgoyette Also need to declare the emul_netbsd32 !
 1.33.36.5 11-Sep-2018  pgoyette Install the syscalls into the netbsd32 table, not the default/native table.
 1.33.36.4 11-Sep-2018  pgoyette Use netbsd32 syscall names in the establish/disestablish tables
 1.33.36.3 11-Sep-2018  pgoyette Regen syscall files and fix includes for syscallvar.h
 1.33.36.2 10-Sep-2018  pgoyette More compat_netbsd32_xx modules
 1.33.36.1 10-Sep-2018  pgoyette Initial cut at a compat_netbsd32_09 and compat_netbsd32_12 modules.
 1.33.30.1 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1836):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.34.12.1 03-Apr-2021  thorpej Sync with HEAD.
 1.34.4.1 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.28 19-Jan-2021  simonb KNF consistency: No parentheses are needed around the return value.
 1.27 27-Jan-2019  pgoyette branches: 1.27.12;
Merge the [pgoyette-compat] branch
 1.26 24-Jan-2014  christos branches: 1.26.28; 1.26.30;
need to lock the process.
 1.25 29-May-2008  mrg branches: 1.25.12; 1.25.34; 1.25.44; 1.25.50;
remove clause #3 from my license where there are no other
copyright holders involved.
 1.24 20-Dec-2007  dsl branches: 1.24.6; 1.24.8; 1.24.10; 1.24.12;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.23 08-Dec-2007  dsl branches: 1.23.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.22 16-Jun-2007  dsl branches: 1.22.6; 1.22.8; 1.22.16;
Modify the (recently added) compat_sigaltstack() #define to take the
values of the SS_ONSTACK and SS_DISABLE constants.
Use it to shorten the source files when this action is replicated.
Actually, given the monstrous complexity of sigaltstack1() there is
probably a much better way to do this...
 1.21 03-Jun-2007  dsl Add a #define that expands to the compat wrapper for sigaltstack1().
Use it for the netbsd32_compat_13.c version of the code.
 1.20 03-Jun-2007  dsl Calling sigaltstack1() directly is so much easier than going via
compat_13_sys_sigaltstack().
 1.19 18-Mar-2007  dsl Change all the NETBSD32PTR64(SCARG(uap, xxx))) to SCARG_P32(uap, xxx).
 1.18 16-Mar-2007  dsl remove all the double (and triple) casts used to convert 32bit userspace
pointers to and from 64bit kernel pointers. Instead use the defines
NETBSD32PTR64(p32) to read a 32bit pointer and (the new) NETBSD32PTR32(p32,p64)
to write a 32bit pointer throughout.
The 32bit pointer is now a struct to enforce the above.
amd64 (with linux emul) and sparc64 will both compile (when the arch stuff
goes in soon), and amd64 still runs some i386 binaries.
 1.17 04-Mar-2007  christos branches: 1.17.2; 1.17.4; 1.17.6;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.16 09-Feb-2007  ad branches: 1.16.2;
Merge newlock2 to head.
 1.15 11-Dec-2005  christos branches: 1.15.20;
merge ktrace-lwp.
 1.14 13-Sep-2005  christos make this compile again.
 1.13 18-Jan-2003  thorpej branches: 1.13.2; 1.13.18;
Merge the nathanw_sa branch.
 1.12 23-Oct-2002  scw In preparation for COMPAT_NETBSD32 on SH-5:

- The MD netbsd32_machdep.h header now defines the 32-bit pointer type
instead of using u_int32_t everywhere,
- The MD netbsd32_machdep.h header now defines a macro (at least on
current implementations) which converts a 32-bit pointer to its 64-bit
equivalent,
- Change the MI code to utilise the above two items in all the right places,
- Implement netbsd32___sigaction_sigtramp().

Tested on Sparc64 by Matt Green.
 1.11 16-Mar-2002  christos make the stackgap_{init,alloc} functions MP friendly (i.e. pass struct proc *
in, instead of using curproc). While there add an optional size argument to
stackgap_init.
 1.10 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.9 25-Aug-2001  mrg update copyright notices.
 1.8 07-Feb-2001  mrg branches: 1.8.2; 1.8.4;
fix the glaring errors in compat_13_netbsd32_sigaltstack13
 1.7 09-Jul-2000  mrg - massive warning fix fest.
- fix pread/pwrite return values (plus some other syscalls that looked
similarly broken).
- prototypes and clean up for netbsd32_ioctl.c

now getpw*() works under compat32!
 1.6 30-Mar-2000  augustss Kill register declarations.
 1.5 30-Dec-1999  eeh Update to 32-bit compatibility routines.
 1.4 11-Oct-1999  eeh branches: 1.4.2;
Add netbsd32_compat_14.c

Rename everything from compat_netbsd32 -> netbsd32 so we don't have silly
names like compat_14_compat_netbsd32_sys_shmctl().
 1.3 25-Mar-1999  mrg branches: 1.3.8;
move sparc32 to netbsd32; split out MD part (signal handling) (mostly via repository copy, rename and perl -pi :-)
 1.2 26-Aug-1998  mrg use right syscalls
 1.1 26-Aug-1998  mrg add a 32-bit compatibility module for the sparc64 port, so it can run NetBSD/sparc binaries with a LP64 kernel.
 1.3.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.4.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.4.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.8.4.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.8.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.8.4.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.8.2.6 11-Nov-2002  nathanw Catch up to -current
 1.8.2.5 23-Aug-2002  petrov lwpification.
 1.8.2.4 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.8.2.3 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.8.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.8.2.1 21-Sep-2001  nathanw Catch up to -current.
 1.13.18.4 21-Jan-2008  yamt sync with head
 1.13.18.3 03-Sep-2007  yamt sync with head.
 1.13.18.2 26-Feb-2007  yamt sync with head.
 1.13.18.1 21-Jun-2006  yamt sync with head.
 1.13.2.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.15.20.3 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.15.20.2 11-Jan-2007  ad Checkpoint work in progress.
 1.15.20.1 21-Oct-2006  ad Checkpoint work in progress on locking and per-LWP signals. Very much a
a work in progress and there is still a lot to do.
 1.16.2.2 24-Mar-2007  yamt sync with head.
 1.16.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.17.6.2 29-Mar-2007  reinoud Pullup to -current
 1.17.6.1 18-Mar-2007  reinoud First attempt to bring branch in sync with HEAD
 1.17.4.1 11-Jul-2007  mjf Sync with head.
 1.17.2.3 15-Jul-2007  ad Sync with head.
 1.17.2.2 09-Jun-2007  ad Sync with head.
 1.17.2.1 10-Apr-2007  ad Sync with head.
 1.22.16.1 26-Dec-2007  ad Sync with head.
 1.22.8.1 09-Jan-2008  matt sync with HEAD
 1.22.6.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.23.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.24.12.3 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.24.12.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.24.12.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.24.10.1 04-May-2009  yamt sync with head.
 1.24.8.1 04-Jun-2008  yamt sync with head
 1.24.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.25.50.1 18-May-2014  rmind sync with head
 1.25.44.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.25.34.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.25.12.2 29-May-2008  mrg remove clause #3 from my license where there are no other
copyright holders involved.
 1.25.12.1 29-May-2008  mrg file netbsd32_compat_13.c was added on branch christos-time_t on 2008-05-29 14:51:27 +0000
 1.26.30.1 10-Jun-2019  christos Sync with HEAD
 1.26.28.9 03-Oct-2018  pgoyette Normalize the required lists. Each compat_netbsd32_xx needs the
non-32bit module of the same version _and_ the 32-bit module for
the next higher version.
 1.26.28.8 29-Sep-2018  pgoyette Make sure that the netbsd32_compat_16 code is available to compat_netbsd_13
 1.26.28.7 27-Sep-2018  pgoyette Hook up the arm compat_netbsd32_13 & _16 code
 1.26.28.6 11-Sep-2018  pgoyette Put the ``extern struct emul'' into the netbsd32_netbsd.h header
so it doesn't have to be separately declared in each source file.

Thanks mrg@
 1.26.28.5 11-Sep-2018  pgoyette Also need to declare the emul_netbsd32 !
 1.26.28.4 11-Sep-2018  pgoyette Install the syscalls into the netbsd32 table, not the default/native table.
 1.26.28.3 11-Sep-2018  pgoyette Use netbsd32 syscall names in the establish/disestablish tables
 1.26.28.2 11-Sep-2018  pgoyette Regen syscall files and fix includes for syscallvar.h
 1.26.28.1 10-Sep-2018  pgoyette More compat_netbsd32_xx modules
 1.27.12.1 03-Apr-2021  thorpej Sync with HEAD.
 1.30 27-Feb-2019  mrg this file was moved to netbsd32_compat_14_sysv.c.
 1.29 21-Feb-2019  mrg fix naming errors in previous. (this file is no longer compiled, but
this fix makes the pull up more obvious, before deleting this file.)
 1.28 21-Feb-2019  mrg for sysv ipc stat operations, explicitly copy the exported parts
instead of the whole ds structure.

besides triggering a recently added assert in netbsd32, this stops
exposing kernel addresses.

copy the mode clamping to 0777 from sem to shm and msg.


while here, make sure that the compat callers to sysv_ipc clear
the contents of the compat structure before setting the result
members to ensure padding bytes are cleared.

don't set/copy _sem_base, _msg_first, _msg_last or _shm_internal.
even if used, which seems very dodgy, they leak KVAs as well.
possibly this may affect linux binaries, in particular, the
comments around _shm_internal ("XXX Oh well.") may mean apps
rely upon these but hopefully not -- the comments date back to
rev 1.1 in 1995.

the _key, _seq and _msg_cbytes members are exported as before as
i found multiple consumers of these (no less than ipcs(1), and
they appear to be useful for debugging and more.


XXX: the naming of compat functions have too many styles. there
are at least 3 different ones changed here.
 1.27 27-Dec-2018  maxv Fix kernel info leaks.

+ Possible info leak: [len=80, leaked=10]
| #0 0xffffffff80bad7a7 in kleak_copyout
| #1 0xffffffff8048e71b in netbsd32___msgctl50
| #2 0xffffffff8022fb5b in netbsd32_syscall
| #3 0xffffffff802096dd in handle_syscall
 1.26 07-Jan-2016  joerg branches: 1.26.10; 1.26.16; 1.26.18;
Avoid defining inline functions that are never used when certain options
are missing.
 1.25 03-Dec-2015  pgoyette Strange patch(1) behavior got me three copies of the code. One is
sufficient so remove the excess.
 1.24 03-Dec-2015  pgoyette If compiling as part of a built-in kernel module, make sure we include
the relevant opt_sysv.h file
 1.23 03-Dec-2015  pgoyette Missed these.

Only include the compat_14 sys calls if this being compiled as part of
the compat_netbsd32_sysvipc module.
 1.22 03-Dec-2015  pgoyette Split out the SYSV IPC stuff into its own compat_netbsd32_sysvipc
module. Adjust dependencies as needed.
 1.21 20-Dec-2007  dsl branches: 1.21.12; 1.21.56; 1.21.74; 1.21.76; 1.21.78; 1.21.82;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.20 08-Dec-2007  dsl branches: 1.20.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.19 20-Mar-2007  cube branches: 1.19.8; 1.19.10; 1.19.18;
More SCARG_P32 fallout.
 1.18 20-Mar-2007  cube Fix typo. Reported by martin.
 1.17 18-Mar-2007  dsl Change all the NETBSD32PTR64(SCARG(uap, xxx))) to SCARG_P32(uap, xxx).
 1.16 16-Mar-2007  dsl remove all the double (and triple) casts used to convert 32bit userspace
pointers to and from 64bit kernel pointers. Instead use the defines
NETBSD32PTR64(p32) to read a 32bit pointer and (the new) NETBSD32PTR32(p32,p64)
to write a 32bit pointer throughout.
The 32bit pointer is now a struct to enforce the above.
amd64 (with linux emul) and sparc64 will both compile (when the arch stuff
goes in soon), and amd64 still runs some i386 binaries.
 1.15 04-Mar-2007  christos branches: 1.15.2; 1.15.4; 1.15.6;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.14 09-Feb-2007  ad branches: 1.14.2;
Merge newlock2 to head.
 1.13 23-Jul-2006  ad branches: 1.13.4;
Use the LWP cached credentials where sane.
 1.12 24-Dec-2005  perry branches: 1.12.4; 1.12.8;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.11 10-Nov-2005  christos need compat/sys/shm.h
 1.10 26-Feb-2005  perry branches: 1.10.4;
nuke trailing whitespace
 1.9 18-Jan-2003  thorpej branches: 1.9.2; 1.9.10; 1.9.12;
Merge the nathanw_sa branch.
 1.8 23-Oct-2002  scw In preparation for COMPAT_NETBSD32 on SH-5:

- The MD netbsd32_machdep.h header now defines the 32-bit pointer type
instead of using u_int32_t everywhere,
- The MD netbsd32_machdep.h header now defines a macro (at least on
current implementations) which converts a 32-bit pointer to its 64-bit
equivalent,
- Change the MI code to utilise the above two items in all the right places,
- Implement netbsd32___sigaction_sigtramp().

Tested on Sparc64 by Matt Green.
 1.7 15-Nov-2001  lukem don't need <sys/types.h> when including <sys/param.h>
 1.6 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.5 30-Nov-2000  jdolecek branches: 1.5.2; 1.5.4;
only define SYSVMSG, SYSVSEM, SYSVSHM if it's not defined already
 1.4 18-Nov-2000  mrg kill gcc warnings.
 1.3 09-Jul-2000  mrg - massive warning fix fest.
- fix pread/pwrite return values (plus some other syscalls that looked
similarly broken).
- prototypes and clean up for netbsd32_ioctl.c

now getpw*() works under compat32!
 1.2 30-Dec-1999  eeh Update to 32-bit compatibility routines.
 1.1 11-Oct-1999  eeh branches: 1.1.2; 1.1.8;
Add netbsd32_compat_14.c

Rename everything from compat_netbsd32 -> netbsd32 so we don't have silly
names like compat_14_compat_netbsd32_sys_shmctl().
 1.1.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.1.2.3 08-Dec-2000  bouyer Sync with HEAD.
 1.1.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.1.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.5.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.5.2.5 11-Nov-2002  nathanw Catch up to -current
 1.5.2.4 23-Aug-2002  petrov lwpification.
 1.5.2.3 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.5.2.2 08-Jan-2002  nathanw Catch up to -current.
 1.5.2.1 14-Nov-2001  nathanw Catch up to -current.
 1.9.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.9.10.1 29-Apr-2005  kent sync with -current
 1.9.2.2 11-Dec-2005  christos Sync with head.
 1.9.2.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.10.4.5 21-Jan-2008  yamt sync with head
 1.10.4.4 03-Sep-2007  yamt sync with head.
 1.10.4.3 26-Feb-2007  yamt sync with head.
 1.10.4.2 30-Dec-2006  yamt sync with head.
 1.10.4.1 21-Jun-2006  yamt sync with head.
 1.12.8.1 11-Aug-2006  yamt sync with head
 1.12.4.1 09-Sep-2006  rpaulo sync with head
 1.13.4.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.14.2.2 24-Mar-2007  yamt sync with head.
 1.14.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.15.6.2 29-Mar-2007  reinoud Pullup to -current
 1.15.6.1 18-Mar-2007  reinoud First attempt to bring branch in sync with HEAD
 1.15.4.1 11-Jul-2007  mjf Sync with head.
 1.15.2.1 10-Apr-2007  ad Sync with head.
 1.19.18.1 26-Dec-2007  ad Sync with head.
 1.19.10.1 09-Jan-2008  matt sync with HEAD
 1.19.8.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.20.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.21.82.2 23-Feb-2019  martin Pull up following revision(s) (requested by mrg in ticket #1679):
sys/compat/sys/ipc.h: revision 1.6
sys/compat/sys/ipc.h: revision 1.7
sys/compat/sys/shm.h: revision 1.8
sys/kern/sysv_shm.c: revision 1.133
sys/compat/sys/sem.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.56
sys/compat/netbsd32/netbsd32_conv.h: revision 1.38
sys/kern/sysv_sem.c: revision 1.96
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.28
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.29
sys/compat/linux32/common/linux32_ipccall.c: revision 1.12
sys/kern/sysv_msg.c: revision 1.73
sys/compat/sys/msg.h: revision 1.6

for sysv ipc stat operations, explicitly copy the exported parts
instead of the whole ds structure.
besides triggering a recently added assert in netbsd32, this stops
exposing kernel addresses.

copy the mode clamping to 0777 from sem to shm and msg.

while here, make sure that the compat callers to sysv_ipc clear
the contents of the compat structure before setting the result
members to ensure padding bytes are cleared.

don't set/copy _sem_base, _msg_first, _msg_last or _shm_internal.
even if used, which seems very dodgy, they leak KVAs as well.
possibly this may affect linux binaries, in particular, the
comments around _shm_internal ("XXX Oh well.") may mean apps
rely upon these but hopefully not -- the comments date back to
rev 1.1 in 1995.

the _key, _seq and _msg_cbytes members are exported as before as
i found multiple consumers of these (no less than ipcs(1), and
they appear to be useful for debugging and more.

XXX: the naming of compat functions have too many styles. there
are at least 3 different ones changed here.

fix naming errors in previous. (this file is no longer compiled, but
this fix makes the pull up more obvious, before deleting this file.)

include libkern.h or strings.h. should fix i386 build issues.
 1.21.82.1 02-Jan-2019  martin Pull up following revision(s) (requested by maxv in ticket #1668):

sys/compat/netbsd32/netbsd32_conv.h: revision 1.37
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.27
sys/compat/sys/msg.h: revision 1.5

Fix kernel info leaks.

+ Possible info leak: [len=80, leaked=10]
| #0 0xffffffff80bad7a7 in kleak_copyout
| #1 0xffffffff8048e71b in netbsd32___msgctl50
| #2 0xffffffff8022fb5b in netbsd32_syscall
| #3 0xffffffff802096dd in handle_syscall
 1.21.78.2 23-Feb-2019  martin Pull up following revision(s) (requested by mrg in ticket #1679):
sys/compat/sys/ipc.h: revision 1.6
sys/compat/sys/ipc.h: revision 1.7
sys/compat/sys/shm.h: revision 1.8
sys/kern/sysv_shm.c: revision 1.133
sys/compat/sys/sem.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.56
sys/compat/netbsd32/netbsd32_conv.h: revision 1.38
sys/kern/sysv_sem.c: revision 1.96
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.28
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.29
sys/compat/linux32/common/linux32_ipccall.c: revision 1.12
sys/kern/sysv_msg.c: revision 1.73
sys/compat/sys/msg.h: revision 1.6

for sysv ipc stat operations, explicitly copy the exported parts
instead of the whole ds structure.
besides triggering a recently added assert in netbsd32, this stops
exposing kernel addresses.

copy the mode clamping to 0777 from sem to shm and msg.

while here, make sure that the compat callers to sysv_ipc clear
the contents of the compat structure before setting the result
members to ensure padding bytes are cleared.

don't set/copy _sem_base, _msg_first, _msg_last or _shm_internal.
even if used, which seems very dodgy, they leak KVAs as well.
possibly this may affect linux binaries, in particular, the
comments around _shm_internal ("XXX Oh well.") may mean apps
rely upon these but hopefully not -- the comments date back to
rev 1.1 in 1995.

the _key, _seq and _msg_cbytes members are exported as before as
i found multiple consumers of these (no less than ipcs(1), and
they appear to be useful for debugging and more.

XXX: the naming of compat functions have too many styles. there
are at least 3 different ones changed here.

fix naming errors in previous. (this file is no longer compiled, but
this fix makes the pull up more obvious, before deleting this file.)

include libkern.h or strings.h. should fix i386 build issues.
 1.21.78.1 02-Jan-2019  martin Pull up following revision(s) (requested by maxv in ticket #1668):

sys/compat/netbsd32/netbsd32_conv.h: revision 1.37
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.27
sys/compat/sys/msg.h: revision 1.5

Fix kernel info leaks.

+ Possible info leak: [len=80, leaked=10]
| #0 0xffffffff80bad7a7 in kleak_copyout
| #1 0xffffffff8048e71b in netbsd32___msgctl50
| #2 0xffffffff8022fb5b in netbsd32_syscall
| #3 0xffffffff802096dd in handle_syscall
 1.21.76.2 19-Mar-2016  skrll Sync with HEAD
 1.21.76.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.21.74.2 23-Feb-2019  martin Pull up following revision(s) (requested by mrg in ticket #1679):
sys/compat/sys/ipc.h: revision 1.6
sys/compat/sys/ipc.h: revision 1.7
sys/compat/sys/shm.h: revision 1.8
sys/kern/sysv_shm.c: revision 1.133
sys/compat/sys/sem.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.56
sys/compat/netbsd32/netbsd32_conv.h: revision 1.38
sys/kern/sysv_sem.c: revision 1.96
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.28
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.29
sys/compat/linux32/common/linux32_ipccall.c: revision 1.12
sys/kern/sysv_msg.c: revision 1.73
sys/compat/sys/msg.h: revision 1.6

for sysv ipc stat operations, explicitly copy the exported parts
instead of the whole ds structure.
besides triggering a recently added assert in netbsd32, this stops
exposing kernel addresses.

copy the mode clamping to 0777 from sem to shm and msg.

while here, make sure that the compat callers to sysv_ipc clear
the contents of the compat structure before setting the result
members to ensure padding bytes are cleared.

don't set/copy _sem_base, _msg_first, _msg_last or _shm_internal.
even if used, which seems very dodgy, they leak KVAs as well.
possibly this may affect linux binaries, in particular, the
comments around _shm_internal ("XXX Oh well.") may mean apps
rely upon these but hopefully not -- the comments date back to
rev 1.1 in 1995.

the _key, _seq and _msg_cbytes members are exported as before as
i found multiple consumers of these (no less than ipcs(1), and
they appear to be useful for debugging and more.

XXX: the naming of compat functions have too many styles. there
are at least 3 different ones changed here.

fix naming errors in previous. (this file is no longer compiled, but
this fix makes the pull up more obvious, before deleting this file.)

include libkern.h or strings.h. should fix i386 build issues.
 1.21.74.1 02-Jan-2019  martin Pull up following revision(s) (requested by maxv in ticket #1668):

sys/compat/netbsd32/netbsd32_conv.h: revision 1.37
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.27
sys/compat/sys/msg.h: revision 1.5

Fix kernel info leaks.

+ Possible info leak: [len=80, leaked=10]
| #0 0xffffffff80bad7a7 in kleak_copyout
| #1 0xffffffff8048e71b in netbsd32___msgctl50
| #2 0xffffffff8022fb5b in netbsd32_syscall
| #3 0xffffffff802096dd in handle_syscall
 1.21.56.1 03-Dec-2017  jdolecek update from HEAD
 1.21.12.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.21.12.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.26.18.1 10-Jun-2019  christos Sync with HEAD
 1.26.16.1 12-Sep-2018  pgoyette Split compat_netbsd32_sysvipc into version-specific modules
 1.26.10.2 23-Feb-2019  martin Pull up following revision(s) (requested by mrg in ticket #1195):
sys/compat/sys/ipc.h: revision 1.6
sys/compat/sys/ipc.h: revision 1.7
sys/compat/sys/shm.h: revision 1.8
sys/kern/sysv_shm.c: revision 1.133
sys/compat/sys/sem.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.56
sys/compat/netbsd32/netbsd32_conv.h: revision 1.38
sys/kern/sysv_sem.c: revision 1.96
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.28
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.29
sys/compat/linux32/common/linux32_ipccall.c: revision 1.12
sys/kern/sysv_msg.c: revision 1.73
sys/compat/sys/msg.h: revision 1.6

for sysv ipc stat operations, explicitly copy the exported parts
instead of the whole ds structure.
besides triggering a recently added assert in netbsd32, this stops
exposing kernel addresses.

copy the mode clamping to 0777 from sem to shm and msg.

while here, make sure that the compat callers to sysv_ipc clear
the contents of the compat structure before setting the result
members to ensure padding bytes are cleared.

don't set/copy _sem_base, _msg_first, _msg_last or _shm_internal.
even if used, which seems very dodgy, they leak KVAs as well.
possibly this may affect linux binaries, in particular, the
comments around _shm_internal ("XXX Oh well.") may mean apps
rely upon these but hopefully not -- the comments date back to
rev 1.1 in 1995.

the _key, _seq and _msg_cbytes members are exported as before as
i found multiple consumers of these (no less than ipcs(1), and
they appear to be useful for debugging and more.

XXX: the naming of compat functions have too many styles. there
are at least 3 different ones changed here.

fix naming errors in previous. (this file is no longer compiled, but
this fix makes the pull up more obvious, before deleting this file.)

include libkern.h or strings.h. should fix i386 build issues.
 1.26.10.1 02-Jan-2019  martin Pull up following revision(s) (requested by maxv in ticket #1151):

sys/compat/netbsd32/netbsd32_conv.h: revision 1.37
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.27
sys/compat/sys/msg.h: revision 1.5

Fix kernel info leaks.

+ Possible info leak: [len=80, leaked=10]
| #0 0xffffffff80bad7a7 in kleak_copyout
| #1 0xffffffff8048e71b in netbsd32___msgctl50
| #2 0xffffffff8022fb5b in netbsd32_syscall
| #3 0xffffffff802096dd in handle_syscall
 1.4 19-Jan-2021  simonb KNF consistency: No parentheses are needed around the return value.
 1.3 21-Feb-2019  mrg branches: 1.3.4; 1.3.14;
for sysv ipc stat operations, explicitly copy the exported parts
instead of the whole ds structure.

besides triggering a recently added assert in netbsd32, this stops
exposing kernel addresses.

copy the mode clamping to 0777 from sem to shm and msg.


while here, make sure that the compat callers to sysv_ipc clear
the contents of the compat structure before setting the result
members to ensure padding bytes are cleared.

don't set/copy _sem_base, _msg_first, _msg_last or _shm_internal.
even if used, which seems very dodgy, they leak KVAs as well.
possibly this may affect linux binaries, in particular, the
comments around _shm_internal ("XXX Oh well.") may mean apps
rely upon these but hopefully not -- the comments date back to
rev 1.1 in 1995.

the _key, _seq and _msg_cbytes members are exported as before as
i found multiple consumers of these (no less than ipcs(1), and
they appear to be useful for debugging and more.


XXX: the naming of compat functions have too many styles. there
are at least 3 different ones changed here.
 1.2 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.1 12-Sep-2018  pgoyette branches: 1.1.2;
file netbsd32_compat_14_sysv.c was initially added on branch pgoyette-compat.
 1.1.2.2 03-Jan-2019  pgoyette Bring in some more changes from HEAD.
 1.1.2.1 12-Sep-2018  pgoyette Split compat_netbsd32_sysvipc into version-specific modules
 1.3.14.1 03-Apr-2021  thorpej Sync with HEAD.
 1.3.4.2 10-Jun-2019  christos Sync with HEAD
 1.3.4.1 21-Feb-2019  christos file netbsd32_compat_14_sysv.c was added on branch phil-wifi on 2019-06-10 22:07:01 +0000
 1.10 28-Feb-2025  wiz whitespace
 1.9 28-Feb-2025  christos fix previous (wrong ifdef), thanks wiz@
 1.8 28-Feb-2025  christos PR/59100: Onno van der Linden: i386 compat32 broken on amd64
 1.7 22-Nov-2024  mlelstv Crude patch to allow building and loading of compat_16 and compat_netbsd32_16 code
on aarch64.
 1.6 18-Aug-2024  riastradh netbsd32_compat_16.c: Fix whitespace.

No functional change intended.
 1.5 01-May-2024  mlelstv branches: 1.5.2;
Enable compat sigreturn system call.
 1.4 26-Nov-2021  ryo branches: 1.4.4;
Fix anonymous memory object leak for sigcode.

- Repeating "modload compat_linux && /emul/linux/bin/ls && modunload compat_linux"
will reproduce this problem.
- It cause in exec_sigcode_map(), anon-object for sigcode was created at
first exec, but it remained even after exec_remove.
- Fixed that the anon-object for sigcode is created at exec_add(), and the
anon-object reference is removed at exec_remove().
- sigobject_lock is no longer needed since it is locked by exec_lock.
- The compat_16 module rewrites the e_sigcode entry in emul_netbsd directly and
does not use exec_add()/exec_remove(), so it needs to call
sigcode_alloc()/sigcode_free() on its own.
 1.3 15-Dec-2019  tsutsui Remove clause 3 and 4 leftovers from TNF licenses in more sources.

Confirmed by martin@ in PR/54760.
 1.2 27-Jan-2019  pgoyette branches: 1.2.4; 1.2.6;
Merge the [pgoyette-compat] branch
 1.1 12-Sep-2018  pgoyette branches: 1.1.2;
file netbsd32_compat_16.c was initially added on branch pgoyette-compat.
 1.1.2.5 03-Oct-2018  pgoyette Normalize the required lists. Each compat_netbsd32_xx needs the
non-32bit module of the same version _and_ the 32-bit module for
the next higher version.
 1.1.2.4 03-Oct-2018  pgoyette Make sure that each version-specific compat_netbsd32_xx module depends
on all higher-version-specific modules, similar to the non-32bit
compat_xx modules.
 1.1.2.3 14-Sep-2018  pgoyette OMG it builds!

Finish rearranging the amd64 MD compat_netbsd32 code.

XXX Other architectures will be dealt with later.
 1.1.2.2 14-Sep-2018  pgoyette Work in progress - get the arch-specific netbsd32_machdep.c code to
build as a module.

XXX Doesn't work when the code is built-in to the kernel.
 1.1.2.1 12-Sep-2018  pgoyette Add some more module glue
 1.2.6.1 18-Dec-2019  martin Pull up following revision(s) (requested by tsutsui in ticket #570):

sys/compat/netbsd32/netbsd32_compat_50_sysv.c: revision 1.3
sys/dev/raidframe/rf_compat50.h: revision 1.6
sys/arch/emips/emips/bus_space.c: revision 1.3
sys/compat/net/if.h: revision 1.5
sys/arch/emips/stand/common/bootinfo.c: revision 1.2
sys/compat/common/sysv_msg_50.c: revision 1.5
sys/compat/common/kern_time_30.c: revision 1.8
sys/arch/emips/stand/common/bootinfo.h: revision 1.2
sys/arch/ia64/include/bus.h: revision 1.4
sys/arch/ia64/ia64/bus_space.c: revision 1.2
sys/compat/common/sysv_shm_50.c: revision 1.5
sys/dev/ic/adw.h: revision 1.15
sys/compat/common/uipc_syscalls_50.c: revision 1.10
sys/arch/emips/ebus/flash_ebus.c: revision 1.22
sys/dev/ic/adv.h: revision 1.15
sys/dev/ic/adwmcode.c: revision 1.18
sys/dev/ic/advlib.c: revision 1.29
sys/arch/hpcarm/include/kloader.h: revision 1.3
sys/dev/usb/uberry.c: revision 1.16
sys/compat/common/sysv_sem_50.c: revision 1.5
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.43
sys/dev/ic/advlib.h: revision 1.21
sys/dev/ic/adv.c: revision 1.50
sys/compat/netinet6/in6_var.h: revision 1.5
sys/arch/hpc/stand/hpcboot/arm/arm_sa1100_asm.asm: revision 1.2
sys/arch/emips/include/loadfile_machdep.h: revision 1.3
sys/arch/emips/stand/common/prom_iface.c: revision 1.7
sys/dev/ic/adw.c: revision 1.56
sys/dev/ic/adwmcode.h: revision 1.12
sys/dev/ic/advmcode.c: revision 1.10
sys/arch/emips/ebus/ace_ebus.c: revision 1.22
sys/compat/netbsd32/netbsd32_compat_60.c: revision 1.5
sys/dev/raidframe/rf_compat50.c: revision 1.13
sys/arch/x68k/dev/intiovar.h: revision 1.15
sys/dev/usb/uipad.c: revision 1.8
sys/arch/zaurus/include/kloader.h: revision 1.3
sys/arch/emips/stand/common/bootxx.c: revision 1.2
sys/dev/ic/adwlib.h: revision 1.23
sys/dev/ic/adwlib.c: revision 1.44
sys/compat/netbsd32/netbsd32_compat_16.c: revision 1.3
sys/arch/amigappc/include/intr.h: revision 1.27
sys/arch/x68k/dev/mfp.c: revision 1.27
sys/arch/arm/at91/at91dbgu.c: revision 1.17
sys/dev/ic/advmcode.h: revision 1.7
sys/compat/ultrix/ultrix_exec.h: revision 1.7
sys/compat/common/vfs_syscalls_50.c: revision 1.24
sys/arch/mips/cavium/octeon_dma.c: revision 1.3
sys/arch/hpc/stand/hpcboot/arm/arm_pxa2x0_asm.asm: revision 1.2

Remove clause 3 and 4 from TNF licenses.
Ok'ed by martin@ in PR/54760.

Remove clause 3 and 4 leftovers from TNF licenses in more sources.
Confirmed by martin@ in PR/54760.
 1.2.4.3 08-Apr-2020  martin Merge changes from current as of 20200406
 1.2.4.2 10-Jun-2019  christos Sync with HEAD
 1.2.4.1 27-Jan-2019  christos file netbsd32_compat_16.c was added on branch phil-wifi on 2019-06-10 22:07:01 +0000
 1.4.4.1 26-Oct-2024  martin Pull up following revision(s) (requested by rin in ticket #989):

sys/compat/netbsd32/netbsd32_compat_16.c: revision 1.5
sys/compat/netbsd32/netbsd32_compat_16.c: revision 1.6
sys/compat/netbsd32/netbsd32_signal.c: revision 1.54

In netbsd32___sigaction_sigtramp continue to use the compat module when
already locked for this process.

Enable compat sigreturn system call.

netbsd32_compat_16.c: Fix whitespace.
No functional change intended.
 1.5.2.1 02-Aug-2025  perseant Sync with HEAD
 1.42 07-Sep-2021  riastradh sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.41 19-Jan-2021  wiz Fix syntax error
 1.40 19-Jan-2021  simonb KNF consistency: No parentheses are needed around the return value.
 1.39 01-Jan-2020  maxv branches: 1.39.8;
Fix three stack info leaks, found by kMSan when just invoking all syscalls
with a zero page as argument.

MSan: Uninitialized Stack Memory In copyout() At Offset 0, Variable 'sb32' From compat_20_netbsd32_getfsstat()
MSan: Uninitialized Stack Memory In copyout() At Offset 12, Variable 'oss' From compat_43_sys_sigstack()
MSan: Uninitialized Stack Memory In copyout() At Offset 0, Variable 'sb' From compat_50_netbsd32___fhstat40()
 1.38 27-Jan-2019  pgoyette branches: 1.38.4;
Merge the [pgoyette-compat] branch
 1.37 10-May-2018  christos branches: 1.37.2;
add {send,recv}mmsg
 1.36 13-Apr-2017  hannken branches: 1.36.4; 1.36.10;
Switch compat_20_netbsd32_getfsstat() to mountlist iterator.
 1.35 28-Mar-2017  chs never pass mp->mnt_stat to dostatvfs(), always use a separate buffer.
dostatvfs() clears its buffer, but mp->mnt_stat should never be cleared.
 1.34 05-Sep-2014  matt branches: 1.34.2; 1.34.4; 1.34.6;
Try not to use f_data, use f_{vnode,socket,pipe,mqueue,kqueue,ksem} to get
a correctly typed pointer.
 1.33 24-Jan-2014  christos branches: 1.33.4; 1.33.10;
remove useless flag mangling. It is done already.
 1.32 24-Jan-2014  christos Fix locking botch, and ...
Yes, we want to be careful because the sizes are different.
 1.31 27-Nov-2013  christos Change the queue.3 *_END(&head) macros to NULL. Since we don't have CIRCLEQ
anymore, all the macros expand to NULL anyway, so this improves readability.
Requested by rmind@
 1.30 23-Nov-2013  christos fix open-coded mountlist scan
 1.29 23-Nov-2013  riz Since mountlist is now a TAILQ, convert some missed usages
so things build again.
 1.28 23-Apr-2010  rmind branches: 1.28.8; 1.28.18; 1.28.22;
Replace M_IOV and some malloc(9)s with kmem(9), and while there:
- Fix invalid free (M_TEMP vs M_IOV) in do_sys_recvmsg(), spotted by jakllsch@.
Also, same fix in osf1_sys_sendmsg_xopen().
- Fix attempt to free non-allocated memory in error path in netbsd32___getfh30().
- Plug a memory leak in compat_43_netbsd32_orecvmsg().
 1.27 29-Jun-2009  dholland branches: 1.27.2; 1.27.4;
Convert 67 namei call sites to use namei_simple, in these functions:

check_console, veriexecclose, veriexec_delete, veriexec_file_add,
emul_find_root, coff_load_shlib (sh3 version), coff_load_shlib,
compat_20_sys_statfs, compat_20_netbsd32_statfs,
ELFNAME2(netbsd32,probe_noteless), darwin_sys_statfs,
ibcs2_sys_statfs, ibcs2_sys_statvfs, linux_sys_uselib,
osf1_sys_statfs, sunos_sys_statfs, sunos32_sys_statfs,
ultrix_sys_statfs, do_sys_mount, fss_create_files (3 of 4),
adosfs_mount, cd9660_mount, coda_ioctl, coda_mount, ext2fs_mount,
ffs_mount, filecore_mount, hfs_mount, lfs_mount, msdosfs_mount,
ntfs_mount, sysvbfs_mount, udf_mount, union_mount, sys_chflags,
sys_lchflags, sys_chmod, sys_lchmod, sys_chown, sys_lchown,
sys___posix_chown, sys___posix_lchown, sys_link, do_sys_pstatvfs,
sys_quotactl, sys_revoke, sys_truncate, do_sys_utimes, sys_extattrctl,
sys_extattr_set_file, sys_extattr_set_link, sys_extattr_get_file,
sys_extattr_get_link, sys_extattr_delete_file,
sys_extattr_delete_link, sys_extattr_list_file, sys_extattr_list_link,
sys_setxattr, sys_lsetxattr, sys_getxattr, sys_lgetxattr,
sys_listxattr, sys_llistxattr, sys_removexattr, sys_lremovexattr

All have been scrutinized (several times, in fact) and compile-tested,
but not all have been explicitly tested in action.

XXX: While I haven't (intentionally) changed the use or nonuse of
XXX: TRYEMULROOT in any of these places, I'm not convinced all the
XXX: uses are correct; an audit might be desirable.
 1.26 24-Jun-2008  ad branches: 1.26.10; 1.26.12;
Replace references to getsock/getvnode.
 1.25 29-May-2008  mrg branches: 1.25.2;
remove clause #3 from my license where there are no other
copyright holders involved.
 1.24 06-May-2008  ad branches: 1.24.2;
PR kern/38141 lookup/vfs_busy acquire rwlock recursively

Simplify the mount locking. Remove all the crud to deal with recursion on
the mount lock, and crud to deal with unmount as another weirdo lock.

Hopefully this will once and for all fix the deadlocks with this. With this
commit there are two locks on each mount:

- krwlock_t mnt_unmounting. This is used to prevent unmount across critical
sections like getnewvnode(). It's only ever read locked with rw_tryenter(),
and is only ever write locked in dounmount(). A write hold can't be taken
on this lock if the current LWP could hold a vnode lock.

- kmutex_t mnt_updating. This is taken by threads updating the mount, for
example when going r/o -> r/w, and is only present to serialize updates.
In order to take this lock, a read hold must first be taken on
mnt_unmounting, and the two need to be held across the operation.

One effect of this change: previously if an unmount failed, we would make a
half hearted attempt to back out of it gracefully, but that was unlikely to
work in a lot of cases. Now while an unmount that will be aborted is in
progress, new file operations within the mount will fail instead of being
delayed. That is unlikely to be a problem though, because if the admin
requests unmount of a file system then s(he) has made a decision to deny
access to the resource.
 1.23 30-Apr-2008  ad PR kern/38135 vfs_busy/vfs_trybusy confusion

The previous fix worked, but it opened a window where mounts could have
disappeared from mountlist while the caller was traversing it using
vfs_trybusy(). Fix that.
 1.22 30-Apr-2008  jmmv Fix build of these files after the vfs_trybusy change. Apply the same
modification done in compat/common/vfs_syscalls_20.c:1.27.
 1.21 21-Mar-2008  ad branches: 1.21.2; 1.21.4;
Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
 1.20 30-Jan-2008  ad branches: 1.20.6;
PR kern/37706 (forced unmount of file systems is unsafe):

- Do reference counting for 'struct mount'. Each vnode associated with a
mount takes a reference, and in turn the mount takes a reference to the
vfsops.
- Now that mounts are reference counted, replace the overcomplicated mount
locking inherited from 4.4BSD with a recursable rwlock.
 1.19 20-Dec-2007  dsl Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.18 08-Dec-2007  pooka branches: 1.18.4;
Remove cn_lwp from struct componentname. curlwp should be used
from on. The NDINIT() macro no longer takes the lwp parameter and
associates the credentials of the calling thread with the namei
structure.
 1.17 08-Dec-2007  dsl ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.16 27-Nov-2007  dogcow branches: 1.16.2;
more VFS_STATVFS(x,y,z) fallout; change them to VFS_STATVFS(x,y). (hi, pooka!)
 1.15 10-Oct-2007  ad branches: 1.15.4;
mountlist_slock is now a mutex.
 1.14 18-Jul-2007  briggs branches: 1.14.4; 1.14.6; 1.14.8; 1.14.10;
Fix typo: mnfromname -> mntfromname.
 1.13 17-Jul-2007  christos branches: 1.13.2;
kill silly constants.
 1.12 22-Apr-2007  dsl Change the way that emulations locate files within the emulation root to
avoid having to allocate space in the 'stackgap'
- which is very LWP unfriendly.
The additional code for non-emulation namei() is trivial, the reduction for
the emulations is massive.
The vnode for a processes emulation root is saved in the cwdi structure
during process exec.
If the emulation root the TRYEMULROOT flag are set, namei() will do an initial
search for absolute pathnames in the emulation root, if that fails it will
retry from the normal root.
".." at the emulation root will always go to the real root, even in the middle
of paths and when expanding symlinks.
Absolute symlinks found using absolute paths in the emulation root will be
relative to the emulation root (so /usr/lib/xxx.so -> /lib/xxx.so links
inside the emulation root don't need changing).
If the root of the emulation would be returned (for an emulation lookup), then
the real root is returned instead (matching the behaviour of emul_lookup,
but being a cheap comparison here) so that programs that scan "../.."
looking for the root dircetory don't loop forever.
The target for symbolic links is no longer mangled (it used to get the
CHECK_ALT_xxx() treatment, so could get /emul/xxx prepended).
CHECK_ALT_xxx() are no more. Most of the change is deleting them, and adding
TRYEMULROOT to the flags to NDINIT().
A lot of the emulation system call stubs could now be deleted.
 1.11 16-Apr-2007  pooka I'm not sure if I want to know what MNT_LAXY means, so I'll just
assume the comment has a tyop of MNT_LAZY.
 1.10 18-Mar-2007  dsl Change all the NETBSD32PTR64(SCARG(uap, xxx))) to SCARG_P32(uap, xxx).
 1.9 04-Mar-2007  christos branches: 1.9.2; 1.9.4; 1.9.6;
fix fallout from caddr_t changes.
 1.8 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.7 09-Feb-2007  ad branches: 1.7.2;
Merge newlock2 to head.
 1.6 31-Jul-2006  martin branches: 1.6.4;
Make filehandles opaque to userland
 1.5 07-Mar-2006  thorpej branches: 1.5.2;
Clean up fallout proc_is_traced_p() change:
- proc_is_traced_p() -> trace_is_enabled(), to match trace_enter() and
trace_exit().
- trace_is_enabled() becomes a real function.
- Remove unnecessary include files from various files that used to care
about KTRACE and SYSTRACE, but do no more.
 1.4 24-Dec-2005  perry branches: 1.4.4; 1.4.6; 1.4.8;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 19-Aug-2005  christos Fix lossage I created with the 64 bit ino_t change.
 1.1 17-Jun-2004  cube branches: 1.1.2; 1.1.14;
o Add support for the statvfs family of syscalls (statvfs1, fstatvfs1,
fhstatvfs1 and getvfsstat)
o Move the statfs family out of netbsd32_fs.c and netbsd32_netbsd.c to
netbsd_compat_20.c, compiled with COMPAT_20

Reviewed by christos@.
 1.1.14.9 24-Mar-2008  yamt sync with head.
 1.1.14.8 04-Feb-2008  yamt sync with head.
 1.1.14.7 21-Jan-2008  yamt sync with head
 1.1.14.6 07-Dec-2007  yamt sync with head
 1.1.14.5 27-Oct-2007  yamt sync with head.
 1.1.14.4 03-Sep-2007  yamt sync with head.
 1.1.14.3 26-Feb-2007  yamt sync with head.
 1.1.14.2 30-Dec-2006  yamt sync with head.
 1.1.14.1 21-Jun-2006  yamt sync with head.
 1.1.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.2.5 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.2.4 18-Sep-2004  skrll Sync with HEAD.
 1.1.2.3 26-Aug-2004  skrll Adapt to branch.

sparc64 GENERIC compiles.
 1.1.2.2 03-Aug-2004  skrll Sync with HEAD
 1.1.2.1 17-Jun-2004  skrll file netbsd32_compat_20.c was added on branch ktrace-lwp on 2004-08-03 10:44:21 +0000
 1.4.8.2 11-Aug-2006  yamt sync with head
 1.4.8.1 13-Mar-2006  yamt sync with head.
 1.4.6.1 22-Apr-2006  simonb Sync with head.
 1.4.4.1 09-Sep-2006  rpaulo sync with head
 1.5.2.2 07-Mar-2006  thorpej Clean up fallout proc_is_traced_p() change:
- proc_is_traced_p() -> trace_is_enabled(), to match trace_enter() and
trace_exit().
- trace_is_enabled() becomes a real function.
- Remove unnecessary include files from various files that used to care
about KTRACE and SYSTRACE, but do no more.
 1.5.2.1 07-Mar-2006  thorpej file netbsd32_compat_20.c was added on branch elad-kernelauth on 2006-03-07 03:32:07 +0000
 1.6.4.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.7.2.3 07-May-2007  yamt sync with head.
 1.7.2.2 24-Mar-2007  yamt sync with head.
 1.7.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.9.6.1 29-Mar-2007  reinoud Pullup to -current
 1.9.4.1 11-Jul-2007  mjf Sync with head.
 1.9.2.5 09-Oct-2007  ad Fix merge error.
 1.9.2.4 20-Aug-2007  ad Sync with HEAD.
 1.9.2.3 27-May-2007  ad Sync with head.
 1.9.2.2 10-Apr-2007  ad Sync with head.
 1.9.2.1 13-Mar-2007  ad Pull in the initial set of changes for the vmlocking branch.
 1.13.2.1 15-Aug-2007  skrll Sync with HEAD.
 1.14.10.2 18-Jul-2007  briggs Fix typo: mnfromname -> mntfromname.
 1.14.10.1 18-Jul-2007  briggs file netbsd32_compat_20.c was added on branch matt-mips64 on 2007-07-18 13:53:35 +0000
 1.14.8.1 14-Oct-2007  yamt sync with head.
 1.14.6.3 23-Mar-2008  matt sync with HEAD
 1.14.6.2 09-Jan-2008  matt sync with HEAD
 1.14.6.1 06-Nov-2007  matt sync with HEAD
 1.14.4.3 09-Dec-2007  jmcneill Sync with HEAD.
 1.14.4.2 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.14.4.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.15.4.3 18-Feb-2008  mjf Sync with HEAD.
 1.15.4.2 27-Dec-2007  mjf Sync with HEAD.
 1.15.4.1 08-Dec-2007  mjf Sync with HEAD.
 1.16.2.1 26-Dec-2007  ad Sync with head.
 1.18.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.20.6.3 29-Jun-2008  mjf Sync with HEAD.
 1.20.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.20.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.21.4.4 11-Aug-2010  yamt sync with head.
 1.21.4.3 18-Jul-2009  yamt sync with head.
 1.21.4.2 04-May-2009  yamt sync with head.
 1.21.4.1 16-May-2008  yamt sync with head.
 1.21.2.2 04-Jun-2008  yamt sync with head
 1.21.2.1 18-May-2008  yamt sync with head.
 1.24.2.4 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.24.2.3 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.24.2.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.24.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.25.2.1 27-Jun-2008  simonb Sync with head.
 1.26.12.1 23-Jul-2009  jym Sync with HEAD.
 1.26.10.2 24-Jun-2008  ad Replace references to getsock/getvnode.
 1.26.10.1 24-Jun-2008  ad file netbsd32_compat_20.c was added on branch christos-time_t on 2008-06-24 11:18:16 +0000
 1.27.4.1 30-May-2010  rmind sync with head
 1.27.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.28.22.1 18-May-2014  rmind sync with head
 1.28.18.2 03-Dec-2017  jdolecek update from HEAD
 1.28.18.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.28.8.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.33.10.1 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1720:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149 (patch)
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54 (patch)

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.33.4.1 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1720:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149 (patch)
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54 (patch)

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.34.6.1 21-Apr-2017  bouyer Sync with HEAD
 1.34.4.1 26-Apr-2017  pgoyette Sync with HEAD
 1.34.2.1 28-Aug-2017  skrll Sync with HEAD
 1.36.10.10 03-Oct-2018  pgoyette Normalize the required lists. Each compat_netbsd32_xx needs the
non-32bit module of the same version _and_ the 32-bit module for
the next higher version.
 1.36.10.9 03-Oct-2018  pgoyette Make sure that each version-specific compat_netbsd32_xx module depends
on all higher-version-specific modules, similar to the non-32bit
compat_xx modules.
 1.36.10.8 11-Sep-2018  pgoyette Put the ``extern struct emul'' into the netbsd32_netbsd.h header
so it doesn't have to be separately declared in each source file.

Thanks mrg@
 1.36.10.7 11-Sep-2018  pgoyette Also need to declare the emul_netbsd32 !
 1.36.10.6 11-Sep-2018  pgoyette Install the syscalls into the netbsd32 table, not the default/native table.
 1.36.10.5 11-Sep-2018  pgoyette Use netbsd32 syscall names in the establish/disestablish tables
 1.36.10.4 11-Sep-2018  pgoyette Regen syscall files and fix includes for syscallvar.h
 1.36.10.3 10-Sep-2018  pgoyette More work on splitting the compat_netbsd32 module
 1.36.10.2 10-Sep-2018  pgoyette More compat_netbsd32_xx modules
 1.36.10.1 21-May-2018  pgoyette Sync with HEAD
 1.36.4.2 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1836):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.36.4.1 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1487:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.37.2.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.37.2.1 10-Jun-2019  christos Sync with HEAD
 1.38.4.2 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.38.4.1 02-Jan-2020  martin Pull up following revision(s) (requested by maxv in ticket #597):

sys/compat/common/kern_sig_43.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.39
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.59
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.44

Fix sizeof mismatch in copyin. This leads to a user-triggerable stack
overflow. On my test build at least, by luck, the compiler orders the
variables in a way that the overflow hits only local structures which
haven't yet been initialized and used, so the overflow is harmless.

Very easily seeable with kASan - just invoke the syscall from a 32bit
binary.

Fix three stack info leaks, found by kMSan when just invoking all syscalls
with a zero page as argument.

MSan: Uninitialized Stack Memory In copyout() At Offset 0, Variable 'sb32' From compat_20_netbsd32_getfsstat()
MSan: Uninitialized Stack Memory In copyout() At Offset 12, Variable 'oss' From compat_43_sys_sigstack()
MSan: Uninitialized Stack Memory In copyout() At Offset 0, Variable 'sb' From compat_50_netbsd32___fhstat40()
 1.39.8.1 03-Apr-2021  thorpej Sync with HEAD.
 1.36 19-Jan-2021  simonb KNF consistency: No parentheses are needed around the return value.
 1.35 31-Jan-2020  maxv branches: 1.35.6;
Fix copyout overflows in fhstat, found by the LGTM bot. Not a big problem
since this syscall is privileged.
 1.34 17-Jan-2020  ad VFS_VGET(), VFS_ROOT(), VFS_FHTOVP(): give them a "int lktype" argument, to
allow us to get shared locks (or no lock) on the returned vnode. Matches
FreeBSD.
 1.33 27-Jan-2019  pgoyette branches: 1.33.6;
Merge the [pgoyette-compat] branch
 1.32 03-Sep-2018  riastradh Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.31 05-Dec-2014  maxv branches: 1.31.16; 1.31.18;
User-triggerable kmem_alloc(0).

Ok martin@ christos@

User
 1.30 23-Apr-2010  rmind branches: 1.30.14; 1.30.18; 1.30.20; 1.30.28; 1.30.34; 1.30.36;
Replace M_IOV and some malloc(9)s with kmem(9), and while there:
- Fix invalid free (M_TEMP vs M_IOV) in do_sys_recvmsg(), spotted by jakllsch@.
Also, same fix in osf1_sys_sendmsg_xopen().
- Fix attempt to free non-allocated memory in error path in netbsd32___getfh30().
- Plug a memory leak in compat_43_netbsd32_orecvmsg().
 1.29 26-Jan-2009  njoly branches: 1.29.4; 1.29.6;
Make all fstat(2) compat syscalls consistently use do_sys_fstat(),
instead of fd_getfile()/fd_putfile() dance.

ok by christos.
 1.28 11-Jan-2009  christos merge christos-time_t
 1.27 19-Nov-2008  ad branches: 1.27.4;
Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.26 24-Jun-2008  ad branches: 1.26.2; 1.26.4;
Replace references to getsock/getvnode.
 1.25 29-May-2008  mrg branches: 1.25.2;
remove clause #3 from my license where there are no other
copyright holders involved.
 1.24 21-Mar-2008  ad branches: 1.24.2; 1.24.4; 1.24.6;
Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
 1.23 20-Dec-2007  dsl branches: 1.23.6;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.22 08-Dec-2007  dsl branches: 1.22.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.21 30-Apr-2007  dsl branches: 1.21.6; 1.21.8; 1.21.16;
Split the statvfs functions so that the 'work' is done to a kernel buffer
which can either be copied directly to userspace, or converted then copied.
Saves replicating a lot of code in the compat functions (esp. for
getvfsstat) at a cast of an extra function call in the non-emulated case -
which is unlikely to be measurable given the other costs of the actions
involved (even on vax).
Remove dofhstat() and dofhstatvfs() (and the last caller).
Remove some redundant stackgap_init() calls.
 1.20 22-Apr-2007  dsl Change the way that emulations locate files within the emulation root to
avoid having to allocate space in the 'stackgap'
- which is very LWP unfriendly.
The additional code for non-emulation namei() is trivial, the reduction for
the emulations is massive.
The vnode for a processes emulation root is saved in the cwdi structure
during process exec.
If the emulation root the TRYEMULROOT flag are set, namei() will do an initial
search for absolute pathnames in the emulation root, if that fails it will
retry from the normal root.
".." at the emulation root will always go to the real root, even in the middle
of paths and when expanding symlinks.
Absolute symlinks found using absolute paths in the emulation root will be
relative to the emulation root (so /usr/lib/xxx.so -> /lib/xxx.so links
inside the emulation root don't need changing).
If the root of the emulation would be returned (for an emulation lookup), then
the real root is returned instead (matching the behaviour of emul_lookup,
but being a cheap comparison here) so that programs that scan "../.."
looking for the root dircetory don't loop forever.
The target for symbolic links is no longer mangled (it used to get the
CHECK_ALT_xxx() treatment, so could get /emul/xxx prepended).
CHECK_ALT_xxx() are no more. Most of the change is deleting them, and adding
TRYEMULROOT to the flags to NDINIT().
A lot of the emulation system call stubs could now be deleted.
 1.19 18-Mar-2007  dsl Change all the NETBSD32PTR64(SCARG(uap, xxx))) to SCARG_P32(uap, xxx).
 1.18 10-Mar-2007  dsl branches: 1.18.2; 1.18.4;
Update all the compat stuff to not use the 'stackgap' for processing
sys_stat() and friends, instead use do_sys_stat() and do_sys_fstat()
that write the answer into a kernel buffer (on stack) that can be
converted to the correct form and written the userspace.
I've test compiled a few kernels, and tested i386 netbsd1.6 ls.
Given I think I've fixed some bugs, it might be 50-50 with new ones.
 1.17 04-Mar-2007  christos branches: 1.17.2;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.16 09-Feb-2007  ad branches: 1.16.2;
Merge newlock2 to head.
 1.15 14-Nov-2006  elad Clean some KAUTH_GENERIC_ISSUSER usage in compat code.
 1.14 09-Nov-2006  cube - Make better use of COMPAT_XX type in syscalls.master
- Remove useless (thanks to COMPAT_XX behaviour) #ifdefs in
syscalls.master
- Make netbsd32_compat_43.c compiled per COMPAT_LINUX32 because the latter
needs stuff from it.

Fixes Perry's PR#34951.
 1.13 04-Aug-2006  yamt branches: 1.13.4; 1.13.6;
some filehandle syscall related changes.

- remove the support of variable-sized filehandle from compat version of
syscalls. (strictly speaking, it breaks abi. i don't think it's a problem
because this feature is short-lived and there are no affected in-tree
filesystems.)
- unify vfs_copyinfh_alloc and vfs_copyinfh_alloc_size.
- vfs_copyinfh_alloc_size: check fhsize strictly.
- reduce code duplication between compat and current syscalls.
 1.12 31-Jul-2006  martin Make filehandles opaque to userland
 1.11 23-Jul-2006  ad Use the LWP cached credentials where sane.
 1.10 13-Jul-2006  pavel do not protect the getfh syscall by
#if defined(NFS) || defined(NFSSERVER).
The native syscall also isn't.
 1.9 13-Jul-2006  martin Fix alignement problems for fhandle_t, exposed by gcc4.1.

While touching all vptofh/fhtovp functions, get rid of VFS_MAXFIDSIZ,
version the getfh(2) syscall and explicitly pass the size available in
the filehandle from userland.

Discussed on tech-kern, with lots of help from yamt (thanks!).
 1.8 27-May-2006  simonb branches: 1.8.2; 1.8.4;
Limit the size of any kernel buffers allocated by the VOP_READDIR
routines to MAXBSIZE.
 1.7 14-May-2006  elad branches: 1.7.2;
integrate kauth.
 1.6 05-May-2006  cube Move fhstat as sys___fhstat30 in netbsd32_fs.c because it doesn't belong
to netbsd32_netbsd.c (which incidentally means it had been broken for a
while I guess). Add compat_30 version.
 1.5 07-Mar-2006  thorpej branches: 1.5.2; 1.5.4;
Clean up fallout proc_is_traced_p() change:
- proc_is_traced_p() -> trace_is_enabled(), to match trace_enter() and
trace_exit().
- trace_is_enabled() becomes a real function.
- Remove unnecessary include files from various files that used to care
about KTRACE and SYSTRACE, but do no more.
 1.4 12-Dec-2005  christos branches: 1.4.4; 1.4.6; 1.4.8;
more proc to lwp problems.
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 19-Aug-2005  christos branches: 1.2.6;
Fix lossage I created with the 64 bit ino_t change.
 1.1 19-Aug-2005  christos 64 bit inode changes.
 1.2.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.2.6.1 19-Aug-2005  skrll file netbsd32_compat_30.c was added on branch ktrace-lwp on 2005-11-10 14:01:20 +0000
 1.4.8.4 11-Aug-2006  yamt sync with head
 1.4.8.3 26-Jun-2006  yamt sync with head.
 1.4.8.2 24-May-2006  yamt sync with head.
 1.4.8.1 13-Mar-2006  yamt sync with head.
 1.4.6.2 01-Jun-2006  kardel Sync with head.
 1.4.6.1 22-Apr-2006  simonb Sync with head.
 1.4.4.1 09-Sep-2006  rpaulo sync with head
 1.5.4.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.5.2.3 12-May-2006  elad adapt to kauth kpi, include sys/kauth.h where needed..
 1.5.2.2 11-May-2006  elad sync with head
 1.5.2.1 07-Mar-2006  elad file netbsd32_compat_30.c was added on branch elad-kernelauth on 2006-05-11 23:27:31 +0000
 1.7.2.1 19-Jun-2006  chap Sync with head.
 1.8.4.7 24-Mar-2008  yamt sync with head.
 1.8.4.6 21-Jan-2008  yamt sync with head
 1.8.4.5 03-Sep-2007  yamt sync with head.
 1.8.4.4 26-Feb-2007  yamt sync with head.
 1.8.4.3 30-Dec-2006  yamt sync with head.
 1.8.4.2 21-Jun-2006  yamt sync with head.
 1.8.4.1 27-May-2006  yamt file netbsd32_compat_30.c was added on branch yamt-lazymbuf on 2006-06-21 14:59:35 +0000
 1.8.2.1 13-Jul-2006  gdamore Merge from HEAD.
 1.13.6.1 10-Dec-2006  yamt sync with head.
 1.13.4.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.13.4.1 18-Nov-2006  ad Sync with head.
 1.16.2.3 07-May-2007  yamt sync with head.
 1.16.2.2 24-Mar-2007  yamt sync with head.
 1.16.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.17.2.3 27-May-2007  ad Sync with head.
 1.17.2.2 10-Apr-2007  ad Sync with head.
 1.17.2.1 13-Mar-2007  ad Sync with head.
 1.18.4.1 29-Mar-2007  reinoud Pullup to -current
 1.18.2.1 11-Jul-2007  mjf Sync with head.
 1.21.16.1 26-Dec-2007  ad Sync with head.
 1.21.8.1 09-Jan-2008  matt sync with HEAD
 1.21.6.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.22.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.23.6.4 17-Jan-2009  mjf Sync with HEAD.
 1.23.6.3 29-Jun-2008  mjf Sync with HEAD.
 1.23.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.23.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.24.6.4 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.24.6.3 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.24.6.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.24.6.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.24.4.2 11-Aug-2010  yamt sync with head.
 1.24.4.1 04-May-2009  yamt sync with head.
 1.24.2.1 04-Jun-2008  yamt sync with head
 1.25.2.1 27-Jun-2008  simonb Sync with head.
 1.26.4.2 03-Mar-2009  skrll Sync with HEAD.
 1.26.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.26.2.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.27.4.2 04-Jan-2009  christos add new syscalls.
 1.27.4.1 19-Nov-2008  christos file netbsd32_compat_30.c was added on branch christos-time_t on 2009-01-04 01:56:02 +0000
 1.29.6.1 30-May-2010  rmind sync with head
 1.29.4.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.30.36.1 06-Apr-2015  skrll Sync with HEAD
 1.30.34.1 12-Dec-2014  martin Pull up following revision(s) (requested by maxv in ticket #314):
sys/compat/netbsd32/netbsd32_compat_30.c: revision 1.31
User-triggerable kmem_alloc(0).
Ok martin@ christos@
User
 1.30.28.1 14-Dec-2014  martin Pull up revision 1.31, requested by maxv in #1209:

Prevent a user-triggerable kmem_alloc(0).
 1.30.20.1 14-Dec-2014  martin Pull up revision 1.31, requested by maxv in #1209:

Prevent a user-triggerable kmem_alloc(0).
 1.30.18.1 03-Dec-2017  jdolecek update from HEAD
 1.30.14.1 14-Dec-2014  martin Pull up revision 1.31, requested by maxv in #1209:

Prevent a user-triggerable kmem_alloc(0).
 1.31.18.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.31.18.1 10-Jun-2019  christos Sync with HEAD
 1.31.16.14 26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.31.16.13 03-Oct-2018  pgoyette Normalize the required lists. Each compat_netbsd32_xx needs the
non-32bit module of the same version _and_ the 32-bit module for
the next higher version.
 1.31.16.12 03-Oct-2018  pgoyette Make sure that each version-specific compat_netbsd32_xx module depends
on all higher-version-specific modules, similar to the non-32bit
compat_xx modules.
 1.31.16.11 25-Sep-2018  pgoyette Additional use of NTP function pointers, since the NTP code might not
exist in the kernel. (NTP is not (yet) a module, so we don't need to
use the MP-safe mechanism.)
 1.31.16.10 23-Sep-2018  pgoyette Revert previous. Instead, don't put an entry for ntp_gettime in the
syscall package if we don't have NTP.
 1.31.16.9 23-Sep-2018  pgoyette Provide a dummy version of netbsd32_ntp_gettime for systems where NTP
isn't defined.
 1.31.16.8 11-Sep-2018  pgoyette Move the NTP compat_30 and compat_50 routines into the version-specific
modules.
 1.31.16.7 11-Sep-2018  pgoyette Put the ``extern struct emul'' into the netbsd32_netbsd.h header
so it doesn't have to be separately declared in each source file.

Thanks mrg@
 1.31.16.6 11-Sep-2018  pgoyette Also need to declare the emul_netbsd32 !
 1.31.16.5 11-Sep-2018  pgoyette Install the syscalls into the netbsd32 table, not the default/native table.
 1.31.16.4 11-Sep-2018  pgoyette Use netbsd32 syscall names in the establish/disestablish tables
 1.31.16.3 11-Sep-2018  pgoyette Regen syscall files and fix includes for syscallvar.h
 1.31.16.2 10-Sep-2018  pgoyette More compat_netbsd32_xx modules
 1.31.16.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.33.6.2 29-Feb-2020  ad Sync with head.
 1.33.6.1 17-Jan-2020  ad Sync with head.
 1.35.6.1 03-Apr-2021  thorpej Sync with HEAD.
 1.4 28-Jan-2019  mlelstv branches: 1.4.4;
add missing includes
 1.3 28-Jan-2019  pgoyette Add the appropriate module glue. Seems to have gotten lost during
the merge.
 1.2 24-Dec-2018  mrg move mmap(), compat 40 mount(), pipe() and getfh() into their own files
as the implementation is non trivial or is compat. mark old mount()
properly instead of manually #if'ing ito to ENOSYS.
 1.1 12-Sep-2018  pgoyette branches: 1.1.2;
file netbsd32_compat_40.c was initially added on branch pgoyette-compat.
 1.1.2.4 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.1.2.3 03-Oct-2018  pgoyette Normalize the required lists. Each compat_netbsd32_xx needs the
non-32bit module of the same version _and_ the 32-bit module for
the next higher version.
 1.1.2.2 03-Oct-2018  pgoyette Make sure that each version-specific compat_netbsd32_xx module depends
on all higher-version-specific modules, similar to the non-32bit
compat_xx modules.
 1.1.2.1 12-Sep-2018  pgoyette Add some more module glue
 1.4.4.2 10-Jun-2019  christos Sync with HEAD
 1.4.4.1 28-Jan-2019  christos file netbsd32_compat_40.c was added on branch phil-wifi on 2019-06-10 22:07:01 +0000
 1.65 20-Dec-2024  mlelstv revert previous, msg_flags is already initialized as MSG_NAMEMBUF
to free the sockname mbuf.
 1.64 20-Dec-2024  mlelstv Don't use flags uninitialized.
 1.63 01-Nov-2021  thorpej branches: 1.63.10;
Use "stack_t" instead of "struct sigaltstack", as the former is the
newer standardized name. NFC.
 1.62 07-Sep-2021  riastradh sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.61 19-Jan-2021  simonb KNF consistency: No parentheses are needed around the return value.
 1.60 07-Mar-2020  pgoyette branches: 1.60.4;
Properly mark netbsd32_compat_43 syscalls that are directly implemented
by calling their compat_43 equivalents. With these changes, and with
built-in versions of COMPAT_NETBSD32, COMPAT_NOMID, and COMPAT_09, I can
now run a netbsd-0.9 statically linked i386 (32-bit) version of /bin/ls
on a 9.99.x amd64 host!

Addresses PR kern/55047 but more changes coming to handle non-built-in
modules.

XXX pullup-9
 1.59 01-Jan-2020  maxv Fix sizeof mismatch in copyin. This leads to a user-triggerable stack
overflow. On my test build at least, by luck, the compiler orders the
variables in a way that the overflow hits only local structures which
haven't yet been initialized and used, so the overflow is harmless.

Very easily seeable with kASan - just invoke the syscall from a 32bit
binary.
 1.58 23-Aug-2019  maxv Fix info leak.
 1.57 27-Jan-2019  pgoyette branches: 1.57.4;
Merge the [pgoyette-compat] branch
 1.56 03-May-2018  christos branches: 1.56.2;
Fix COMPAT_NETBSD32 cmsg handling:

1. alignment was wrong for > 1 message
2. macros were doing incorrect pointer comparisons, fortunately ending
the iteration early after the fists cmsg instead of crashing.
3. don't output 32 bit ktrace records for cmsg. 32 bit programs running
under emulation on 64 bit systems should produce 64 bit ktrace records
so that the native ktrace can handle the records; remove extra arguments
that are now not needed (the 32 bit msghdr).
4. output the correct type for cmsg trace records.
5. output all the cmsg records in traces instead of just the first one.

Welcome to 8.99.15 because of the argument removal.

XXX: Really all the code should be changed to use the CMSG_{FIRST,NXT}HDR
macros...
 1.55 16-Mar-2018  christos PR/53103: Timo Buhrmester: linux emulation of sendto(2) broken

The sockargs refactoring broke it, because sockargs only works with a user
address. Added an argument to sockargs to indicate where the address is
coming from. Welcome to 8.99.14.
 1.54 13-Sep-2016  martin branches: 1.54.8; 1.54.14;
Make the ktrace record written by do_sys_sendmsg/do_sys_recvmsg overridable
by the caller. Use this in compat_netbsd32 to log the 32bit version, so
the 32bit userland kdump is happy.
 1.53 23-Apr-2010  joerg branches: 1.53.18; 1.53.34; 1.53.36; 1.53.44;
Fix compilation.
 1.52 23-Apr-2010  rmind Replace M_IOV and some malloc(9)s with kmem(9), and while there:
- Fix invalid free (M_TEMP vs M_IOV) in do_sys_recvmsg(), spotted by jakllsch@.
Also, same fix in osf1_sys_sendmsg_xopen().
- Fix attempt to free non-allocated memory in error path in netbsd32___getfh30().
- Plug a memory leak in compat_43_netbsd32_orecvmsg().
 1.51 30-Jan-2009  njoly branches: 1.51.4; 1.51.6;
Cleanup. Kill a few netbsd32_caddr_t in syscalls argument types.
 1.50 29-May-2008  mrg branches: 1.50.6; 1.50.12;
remove clause #3 from my license where there are no other
copyright holders involved.
 1.49 21-Mar-2008  ad branches: 1.49.2; 1.49.4; 1.49.6;
Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
 1.48 26-Jan-2008  dsl branches: 1.48.6;
Remove some dubious casting of the address of integer variables that
can only be 'not invalid' if the sizes match - when it is unnecessary.
 1.47 20-Dec-2007  dsl Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.46 08-Dec-2007  dsl branches: 1.46.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.45 04-Dec-2007  dsl Remove all the __P
 1.44 30-Jun-2007  dsl branches: 1.44.6; 1.44.8; 1.44.14; 1.44.16;
Changes to sompat socket function to avoid the dreaded stackgap.
 1.43 16-Jun-2007  dsl The code to directly call sigaction1() and sigaltstack1() is much shorter
than the mess required to call the compat_43_xxx functions.
 1.42 03-Jun-2007  dsl sendmsg() shouldn't modify the 'msg' parameter, and recvmsg() doesn't have
to modify the 'iov' array - it isn't updated.
 1.41 30-Apr-2007  dsl Rework compat stat() and statvfs() code so that it no longer uses the stackgap.
 1.40 22-Apr-2007  dsl Change the way that emulations locate files within the emulation root to
avoid having to allocate space in the 'stackgap'
- which is very LWP unfriendly.
The additional code for non-emulation namei() is trivial, the reduction for
the emulations is massive.
The vnode for a processes emulation root is saved in the cwdi structure
during process exec.
If the emulation root the TRYEMULROOT flag are set, namei() will do an initial
search for absolute pathnames in the emulation root, if that fails it will
retry from the normal root.
".." at the emulation root will always go to the real root, even in the middle
of paths and when expanding symlinks.
Absolute symlinks found using absolute paths in the emulation root will be
relative to the emulation root (so /usr/lib/xxx.so -> /lib/xxx.so links
inside the emulation root don't need changing).
If the root of the emulation would be returned (for an emulation lookup), then
the real root is returned instead (matching the behaviour of emul_lookup,
but being a cheap comparison here) so that programs that scan "../.."
looking for the root dircetory don't loop forever.
The target for symbolic links is no longer mangled (it used to get the
CHECK_ALT_xxx() treatment, so could get /emul/xxx prepended).
CHECK_ALT_xxx() are no more. Most of the change is deleting them, and adding
TRYEMULROOT to the flags to NDINIT().
A lot of the emulation system call stubs could now be deleted.
 1.39 18-Mar-2007  dsl Change all the NETBSD32PTR64(SCARG(uap, xxx))) to SCARG_P32(uap, xxx).
 1.38 16-Mar-2007  dsl remove all the double (and triple) casts used to convert 32bit userspace
pointers to and from 64bit kernel pointers. Instead use the defines
NETBSD32PTR64(p32) to read a 32bit pointer and (the new) NETBSD32PTR32(p32,p64)
to write a 32bit pointer throughout.
The 32bit pointer is now a struct to enforce the above.
amd64 (with linux emul) and sparc64 will both compile (when the arch stuff
goes in soon), and amd64 still runs some i386 binaries.
 1.37 04-Mar-2007  christos branches: 1.37.2; 1.37.4; 1.37.6;
fix fallout from caddr_t changes.
 1.36 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.35 09-Feb-2007  ad branches: 1.35.2;
Merge newlock2 to head.
 1.34 11-Dec-2005  christos branches: 1.34.20;
merge ktrace-lwp.
 1.33 24-Sep-2005  christos need compat/sys/socket.h
 1.32 24-Sep-2005  chs need to include sys/socket.h here now, sys/mount.h no longer does it for us.
 1.31 13-Sep-2005  christos make this compile again.
 1.30 26-Feb-2005  perry branches: 1.30.4;
nuke trailing whitespace
 1.29 04-Dec-2003  atatat branches: 1.29.8; 1.29.10;
Dynamic sysctl.

Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.

Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.

All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.

PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
 1.28 26-Oct-2003  christos don't use extra variables where there is no need to.
 1.27 29-Jun-2003  fvdl branches: 1.27.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.26 29-Jun-2003  martin struct proc * -> struct lwp *
 1.25 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.24 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.23 23-Oct-2002  scw In preparation for COMPAT_NETBSD32 on SH-5:

- The MD netbsd32_machdep.h header now defines the 32-bit pointer type
instead of using u_int32_t everywhere,
- The MD netbsd32_machdep.h header now defines a macro (at least on
current implementations) which converts a 32-bit pointer to its 64-bit
equivalent,
- Change the MI code to utilise the above two items in all the right places,
- Implement netbsd32___sigaction_sigtramp().

Tested on Sparc64 by Matt Green.
 1.22 04-May-2002  martin Add missing prototype for compat_43_netbsd32_sigsetmask.
 1.21 16-Mar-2002  christos make the stackgap_{init,alloc} functions MP friendly (i.e. pass struct proc *
in, instead of using curproc). While there add an optional size argument to
stackgap_init.
 1.20 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.19 25-Aug-2001  mrg update copyright notices.
 1.18 15-Aug-2001  eeh Fix bug in netbsd32_compat_43_olseek return value.
 1.17 30-May-2001  mrg branches: 1.17.2;
use _KERNEL_OPT.
 1.16 05-Feb-2001  mrg branches: 1.16.2;
fix the glaring errors in emulations for osendmsg, orecvmsg, osigvec and osigstack.
 1.15 02-Feb-2001  mrg properly implement compat_43_netbsd32_stat43, compat_43_netbsd32_lstat43
and compat_43_netbsd32_fstat43. now 32-bit ls(1) works. so does static
sunos `/sbin/sh' on sparc64.
 1.14 02-Feb-2001  mrg de-static netbsd32_exec_aout_prep_[zno]magic().
de-static netbsd32_from_stat43().
move the guts of netbsd32_execve() into netbsd32_execve2().

all of are for the forthcoming sunos32 compat mode (for sparc64).
 1.13 03-Dec-2000  fvdl Include opt_* files to make sure prototypes are included.
 1.12 01-Dec-2000  jdolecek add e_path (emulation path) to struct emul, which replaces emulation-specific
*_emul_path variables

change macros CHECK_ALT_{CREAT|EXIST} to use that, 'root' doesn't need
to be passed explicitly any more and *_CHECK_ALT_{CREAT|EXIST} are removed
change explicit emul_find() calls in probe functions to get the emulation
path from the checked exec switch entry's emulation

remove no longer needed header files

add e_flags and e_syscall to struct emul; these are unsed and empty for now
 1.11 24-Sep-2000  martin The ovadvise syscall is (correctly) listed as STD, so move it's implementation
to another place. This makes kernels without options COMPAT_43 link.
 1.10 28-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.9 30-Dec-1999  eeh Update to 32-bit compatibility routines.
 1.8 11-Oct-1999  eeh branches: 1.8.2;
Add netbsd32_compat_14.c

Rename everything from compat_netbsd32 -> netbsd32 so we don't have silly
names like compat_14_compat_netbsd32_sys_shmctl().
 1.7 14-Apr-1999  mrg branches: 1.7.2;
fix errors in the copyright on this.
 1.6 25-Mar-1999  mrg branches: 1.6.2;
SPARC32->NETBSD32
 1.5 25-Mar-1999  mrg move sparc32 to netbsd32; split out MD part (signal handling) (mostly via repository copy, rename and perl -pi :-)
 1.4 01-Oct-1998  eeh Overhaul. Now will run simple things like /bin/sh and /bin/echo.
 1.3 29-Aug-1998  mrg move <vm/vm_swap.h> to <sys/swap.h>. <vm/vm_swap.h> still works for now (goes away later)
 1.2 26-Aug-1998  mrg use right syscalls
 1.1 26-Aug-1998  mrg add a 32-bit compatibility module for the sparc64 port, so it can run NetBSD/sparc binaries with a LP64 kernel.
 1.6.2.1 15-Apr-1999  mrg branches: 1.6.2.1.2;
pull up 1.7
 1.6.2.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.7.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.8.2.3 11-Feb-2001  bouyer Sync with HEAD.
 1.8.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.8.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.16.2.9 11-Nov-2002  nathanw Catch up to -current
 1.16.2.8 23-Aug-2002  petrov lwpification.
 1.16.2.7 20-Jun-2002  nathanw Catch up to -current.
 1.16.2.6 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.16.2.5 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.16.2.4 14-Nov-2001  nathanw Catch up to -current.
 1.16.2.3 21-Sep-2001  nathanw Catch up to -current.
 1.16.2.2 24-Aug-2001  nathanw Catch up with -current.
 1.16.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.17.2.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.17.2.3 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.17.2.2 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.17.2.1 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.27.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.27.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.27.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.27.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.27.2.2 03-Aug-2004  skrll Sync with HEAD
 1.27.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.29.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.29.8.1 29-Apr-2005  kent sync with -current
 1.30.4.7 24-Mar-2008  yamt sync with head.
 1.30.4.6 04-Feb-2008  yamt sync with head.
 1.30.4.5 21-Jan-2008  yamt sync with head
 1.30.4.4 07-Dec-2007  yamt sync with head
 1.30.4.3 03-Sep-2007  yamt sync with head.
 1.30.4.2 26-Feb-2007  yamt sync with head.
 1.30.4.1 21-Jun-2006  yamt sync with head.
 1.34.20.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.35.2.3 07-May-2007  yamt sync with head.
 1.35.2.2 24-Mar-2007  yamt sync with head.
 1.35.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.37.6.2 29-Mar-2007  reinoud Pullup to -current
 1.37.6.1 18-Mar-2007  reinoud First attempt to bring branch in sync with HEAD
 1.37.4.1 11-Jul-2007  mjf Sync with head.
 1.37.2.4 15-Jul-2007  ad Sync with head.
 1.37.2.3 09-Jun-2007  ad Sync with head.
 1.37.2.2 27-May-2007  ad Sync with head.
 1.37.2.1 10-Apr-2007  ad Sync with head.
 1.44.16.2 26-Dec-2007  ad Sync with head.
 1.44.16.1 08-Dec-2007  ad Sync with head.
 1.44.14.3 18-Feb-2008  mjf Sync with HEAD.
 1.44.14.2 27-Dec-2007  mjf Sync with HEAD.
 1.44.14.1 08-Dec-2007  mjf Sync with HEAD.
 1.44.8.2 23-Mar-2008  matt sync with HEAD
 1.44.8.1 09-Jan-2008  matt sync with HEAD
 1.44.6.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.46.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.48.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.48.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.49.6.3 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.49.6.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.49.6.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.49.4.2 11-Aug-2010  yamt sync with head.
 1.49.4.1 04-May-2009  yamt sync with head.
 1.49.2.1 04-Jun-2008  yamt sync with head
 1.50.12.2 29-May-2008  mrg remove clause #3 from my license where there are no other
copyright holders involved.
 1.50.12.1 29-May-2008  mrg file netbsd32_compat_43.c was added on branch christos-time_t on 2008-05-29 14:51:27 +0000
 1.50.6.1 03-Mar-2009  skrll Sync with HEAD.
 1.51.6.1 30-May-2010  rmind sync with head
 1.51.4.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.53.44.1 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1720:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149 (patch)
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54 (patch)

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.53.36.1 05-Oct-2016  skrll Sync with HEAD
 1.53.34.1 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1720:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149 (patch)
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54 (patch)

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.53.18.1 03-Dec-2017  jdolecek update from HEAD
 1.54.14.5 11-Sep-2018  pgoyette Put the ``extern struct emul'' into the netbsd32_netbsd.h header
so it doesn't have to be separately declared in each source file.

Thanks mrg@
 1.54.14.4 11-Sep-2018  pgoyette Typo
 1.54.14.3 11-Sep-2018  pgoyette Make compat_netbsd32_43 into a stand-alone module.
 1.54.14.2 21-May-2018  pgoyette Sync with HEAD
 1.54.14.1 22-Mar-2018  pgoyette Synch with HEAD, resolve conflicts
 1.54.8.2 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1836):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.54.8.1 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1487:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.56.2.3 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.56.2.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.56.2.1 10-Jun-2019  christos Sync with HEAD
 1.57.4.4 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.57.4.3 08-Mar-2020  martin Pull up following revision(s) (requested by pgoyette in ticket #761):

sys/compat/netbsd32/syscalls.master: revision 1.132
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.60

Properly mark netbsd32_compat_43 syscalls that are directly implemented
by calling their compat_43 equivalents. With these changes, and with
built-in versions of COMPAT_NETBSD32, COMPAT_NOMID, and COMPAT_09, I can
now run a netbsd-0.9 statically linked i386 (32-bit) version of /bin/ls
on a 9.99.x amd64 host!

Addresses PR kern/55047 but more changes coming to handle non-built-in
modules.

XXX pullup-9
 1.57.4.2 02-Jan-2020  martin Pull up following revision(s) (requested by maxv in ticket #597):

sys/compat/common/kern_sig_43.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.39
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.59
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.44

Fix sizeof mismatch in copyin. This leads to a user-triggerable stack
overflow. On my test build at least, by luck, the compiler orders the
variables in a way that the overflow hits only local structures which
haven't yet been initialized and used, so the overflow is harmless.

Very easily seeable with kASan - just invoke the syscall from a 32bit
binary.

Fix three stack info leaks, found by kMSan when just invoking all syscalls
with a zero page as argument.

MSan: Uninitialized Stack Memory In copyout() At Offset 0, Variable 'sb32' From compat_20_netbsd32_getfsstat()
MSan: Uninitialized Stack Memory In copyout() At Offset 12, Variable 'oss' From compat_43_sys_sigstack()
MSan: Uninitialized Stack Memory In copyout() At Offset 0, Variable 'sb' From compat_50_netbsd32___fhstat40()
 1.57.4.1 13-Sep-2019  martin Pull up following revision(s) (requested by maxv in ticket #194):

sys/compat/linux/common/linux_socket.c: revision 1.146
sys/compat/linux/common/linux_socket.c: revision 1.147
sys/compat/linux/common/linux_socket.c: revision 1.148
sys/compat/linux/common/linux_socket.c: revision 1.149
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.59
sys/compat/linux32/common/linux32_sysinfo.c: revision 1.8
sys/kern/sysv_shm.c: revision 1.138
sys/compat/linux/common/linux_file64.c: revision 1.61
sys/compat/linux/common/linux_file64.c: revision 1.62
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.58
sys/compat/linux32/common/linux32_dirent.c: revision 1.20
sys/compat/linux32/common/linux32_utsname.c: revision 1.10
sys/compat/linux/common/linux_termios.h: revision 1.22
sys/compat/linux32/common/linux32_termios.c: revision 1.15
sys/compat/linux32/common/linux32_misc.c: revision 1.27
sys/compat/linux32/common/linux32_ioctl.c: revision 1.14
sys/compat/linux/common/linux_statfs.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.57
sys/compat/linux/common/linux_fcntl.h: revision 1.18
sys/compat/linux/common/linux_socket.h: revision 1.24
sys/sys/shm.h: revision 1.54
sys/compat/ossaudio/ossaudio.c: revision 1.75
sys/compat/linux32/common/linux32_signal.c: revision 1.20
sys/miscfs/procfs/procfs_linux.c: revision 1.75
sys/compat/linux/common/linux_signal.c: revision 1.81
sys/compat/linux/common/linux_termios.c: revision 1.38
sys/compat/linux/common/linux_misc.c: revision 1.241
sys/compat/linux/common/linux_misc.c: revision 1.242
sys/compat/linux/common/linux_misc.c: revision 1.243
sys/compat/linux/common/linux_misc.c: revision 1.244

Fix info leaks.

Fix stupid bugs in linux_sys_shmctl(): the index could be out of bound
(page fault) and there was no proper locking.
Maybe we should just remove LINUX_SHM_STAT, like compat_linux32.

Remove printf.

When dealing with an unknown value, set -1, to prevent (harmless)
uninitialized accesses later.

Add a default case, don't call sys_ioctl() with an uninitialized 'com'
argument.

Fix error handling, returns an errno, not -1.

Put the printf under DEBUG_LINUX.


Hum, don't forget the 'pid' argument, otherwise we're not gonna go very
far.

Don't read data from userland directly. This simply does not work on any
recent x86 CPU (thanks to SMAP) and all architectures that forbid direct
access to userland from the kernel. But I guess no one noticed because no
one ever uses compat_linux, right?

Hum, don't pass an mbuf to realloc(). Inspired from copyin32_msg_control().

Fix memory leak.

I don't see the point in having this useless printf, but add a '\n' to it,
so that it at least displays useless stuff correctly.

Hum, remove incorrect assignment. Userland could have passed a smaller
namelen, and the uninitialized bytes from sb_data were being used later in
the network stack.
 1.60.4.1 03-Apr-2021  thorpej Sync with HEAD.
 1.63.10.1 02-Aug-2025  perseant Sync with HEAD
 1.56 29-Jul-2023  rin COMPAT_NETBSD32: Reorganize the previous; Make compat_netbsd32_50 recursively
depended on compat_netbsd32_100, rather than directly depended on it.

Thanks pgoyette@ again for useful comments!
 1.55 29-Jul-2023  rin Now, netbsd32_compat_50 module requires netbsd32_compat_100.
Thanks pgoyette@ for hints.
 1.54 29-Jul-2023  rin COMPAT_NETBSD32: Catch up with sys___kevent100() addition.

XXX
Add epoll_* and memfd_create.
 1.53 26-Oct-2022  riastradh sys: Put externs for time_adjtime and time_adjusted in .h files.

time_adjtime: sys/timex.h (defined in ntp code)
time_adjusted: sys/timevar.h (defined in non-ntp code)

(Not really sure this is a valuable distinction to maintain; there's
non-ntp code that uses time_adjtime too.)
 1.52 07-Sep-2021  riastradh sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.51 18-Feb-2021  simonb In the compat setitimer(2) calls, don't validate which timer is being
used since dosetitimer() does this anyway. The compat functions hadn't
been updated since ITIMER_MONOTONIC was introduced, so they reported
that that ITIMER_MONOTONIC timer was invalid.
 1.50 19-Jan-2021  simonb KNF consistency: No parentheses are needed around the return value.
 1.49 30-Apr-2020  riastradh branches: 1.49.2;
Omit needless #include <sys/rnd.h>.
 1.48 15-Mar-2020  pgoyette Now that we have split the quota code out of the compat_netbsd32_50
module, it no longer depends on compat_50_quota.

Should address PR kern/55073
 1.47 12-Mar-2020  pgoyette Split out the quota code from the rest of compat_netbsd32 module. This
allows loading of compat_netbsd32 on kernels that don't have ``options
QUOTA'' enabled.
 1.46 27-Feb-2020  pgoyette Module compat_netbsd32_50 requires module compat_50_quota
 1.45 29-Jan-2020  ad - Track LWPs in a per-process radixtree. It uses no extra memory in the
single threaded case. Replace scans of p->p_lwps with lookups in the
tree. Find free LIDs for new LWPs in the tree. Replace the hashed sleep
queues for park/unpark with lookups in the tree under cover of a RW lock.

- lwp_wait(): if waiting on a specific LWP, find the LWP via tree lookup and
return EINVAL if it's detached, not ESRCH.

- Group the locks in struct proc at the end of the struct in their own cache
line.

- Add some comments.
 1.44 01-Jan-2020  maxv branches: 1.44.2;
Fix three stack info leaks, found by kMSan when just invoking all syscalls
with a zero page as argument.

MSan: Uninitialized Stack Memory In copyout() At Offset 0, Variable 'sb32' From compat_20_netbsd32_getfsstat()
MSan: Uninitialized Stack Memory In copyout() At Offset 12, Variable 'oss' From compat_43_sys_sigstack()
MSan: Uninitialized Stack Memory In copyout() At Offset 0, Variable 'sb' From compat_50_netbsd32___fhstat40()
 1.43 15-Dec-2019  tsutsui Remove clause 3 and 4 leftovers from TNF licenses in more sources.

Confirmed by martin@ in PR/54760.
 1.42 12-Dec-2019  pgoyette Rather than keeping a separate mutex, condvar, and pserialize for each
module hook, we can share a common set of synchronization structures.
This cuts the amount of cacheline_aligned data for these structures by
50%.

Note that we still have a per-hook localcount, since we need to count
individual references.

As discussed with riastradh@

Welcome to 9.99.22 !
 1.41 05-Oct-2019  kamil Validate input before converting timeval::tv_usec in compat/netbsd32
 1.40 20-Sep-2019  kamil Validate usec ranges in compat_50_netbsd32_select()

Later in the code selcommon() checks for proper timespec, check only
correct usec of timeval before type conversions.
 1.39 27-Jun-2019  christos branches: 1.39.2;
Include the right stuff so compat_netbsd32_50 compiles.
 1.38 18-Jun-2019  kamil Drop unused retval pointer from do_sys_mknod{,at}()

No functional change intended.
 1.37 18-Jun-2019  christos regen
 1.36 01-Mar-2019  pgoyette Rename the MODULE_*_HOOK() macros to MODULE_HOOK_*() as briefly
discussed on irc.

NFCI intended.

Ride the earlier kernel bump - it;s getting crowded.
 1.35 29-Jan-2019  pgoyette Normalize all the compat hooks' names to the form

<subsystem>_<function>_<version>_hook

NFCI

XXX Note that although this introduces a change in the kernel-to-
XXX module interface, we are NOT bumping the kernel version number.
XXX We will bump the version number once the interface stabilizes.
 1.34 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.33 26-Dec-2018  mrg remove duplicated prototypes and dated XXX comments.
 1.32 03-Dec-2015  pgoyette branches: 1.32.10; 1.32.16; 1.32.18;
Split out the SYSV IPC stuff into its own compat_netbsd32_sysvipc
module. Adjust dependencies as needed.
 1.31 01-Dec-2015  pgoyette Prepare for new compat_netbsd32_mqueue module to be split out of
compat_netbsd32. Refactor the COMPAT_50 code related to mqueue,
and update the syscall definitions. Remove dependency on mqueue
from the compat_netbsd32 module (the new module will gain this
dependency).

Continuation of work on PR kern/50489
 1.30 24-Jul-2015  maxv Unused inits (harmless).

Found by Brainy.
 1.29 21-Jun-2015  martin Move compat calls, requested by mrg@
 1.28 27-Oct-2014  christos branches: 1.28.2;
fix multiple mistakes:
- error from copyout was ignored
- the wrong size was specified in copyin
- missing locking.
 1.27 05-Sep-2014  matt Try not to use f_data, use f_{vnode,socket,pipe,mqueue,kqueue,ksem} to get
a correctly typed pointer.
 1.26 05-Sep-2014  matt Don't use private as a variable name since it's reserved in C++
 1.25 21-Aug-2014  maxv Remove dead returns:

return VAR/func(XX);
return VAR;

The latter is never reached. Sent on tech-kern@, no disagreement.
 1.24 24-Jun-2014  maxv branches: 1.24.2;
Allocate directly KQ_NEVENTS bytes. Otherwise a user can panic the system.

ok christos@
 1.23 29-Mar-2013  christos branches: 1.23.8;
compat glue for new lwp_park
 1.22 03-Nov-2012  njoly Move rusage computation to a new getrusage1() function. Adjust all
compat/emulations to make use of it.
 1.21 02-Oct-2012  christos kernel portion of clock_nanosleep()
 1.20 18-Nov-2011  christos branches: 1.20.6; 1.20.10; 1.20.12; 1.20.14;
add a copyin function for sigset so that we can use sigtimedwait1 from
emulations.
 1.19 23-May-2011  joerg branches: 1.19.4;
Update from GNU extension to C99 syntax for designated initializer
 1.18 06-Mar-2011  bouyer merge the bouyer-quota2 branch. This adds a new on-disk format
to store disk quota usage and limits, integrated with ffs
metadata. Usage is checked by fsck_ffs (no more quotacheck)
and is covered by the WAPBL journal. Enabled with kernel
option QUOTA2 (added where QUOTA was enabled in kernel config files),
turned on with tunefs(8) on a per-filesystem
basis. mount_mfs(8) can also turn quotas on.

See http://mail-index.netbsd.org/tech-kern/2011/02/19/msg010025.html
for details.
 1.17 30-May-2010  drochner branches: 1.17.2; 1.17.4;
-fix internal use of sigwaitinfo(2) by sigwait(3): The former returns
the signal number now, as required by POSIX. The latter should just
return 0 on success. Fixes a mysql problem reported by Kurt Schreiner.
-document the new behavior of sigwaitinfo and sigtimedwait
-retain non-POSIX behavior for NetBSD-5 binary compatibility -- the fix
would likely not be polled into the .0-branches, and having 5.0.x and
5.x behave differently would be confusing. Besides that, it was
documented in the manpage all the time.
 1.16 23-Apr-2010  rmind Replace M_IOV and some malloc(9)s with kmem(9), and while there:
- Fix invalid free (M_TEMP vs M_IOV) in do_sys_recvmsg(), spotted by jakllsch@.
Also, same fix in osf1_sys_sendmsg_xopen().
- Fix attempt to free non-allocated memory in error path in netbsd32___getfh30().
- Plug a memory leak in compat_43_netbsd32_orecvmsg().
 1.15 08-Apr-2010  njoly Add a new clock_gettime1() function that holds most of the
clock_gettime syscall code (except for the copyout). Adjust all
corresponding syscalls to make use of it.
 1.14 03-Apr-2010  njoly Move most clock_getres syscall code, except for coypout call, to a new
clock_getres1() function which can be used by emulations. Adjust all
clock_getres syscalls to now make of use it.
 1.13 29-Mar-2010  njoly Convert linux/linux32/netbsd32 clock_settime syscalls, to use the
common clock_settime1() function.
 1.12 29-Mar-2010  njoly Make compat netbsd32 clock_getres copyout the netbsd32 timespec
structure, not the native one.
 1.11 28-Mar-2010  njoly Cleanup compat netbsd32 nanosleep syscalls to use the common
nanosleep1() call instead of their own stuff.
 1.10 02-Mar-2010  pooka branches: 1.10.2;
regen for conditional lfs syscall removal
 1.9 19-Jan-2010  pooka branches: 1.9.2;
A few more instances of __sigtimedwait1 -> sigtimedwait1
 1.8 21-Dec-2009  njoly Do not include fs_lfs.h unless _KERNEL_OPT is defined.
 1.7 11-Nov-2009  rmind - selcommon/pollcommon: drop redundant l argument.
- Use cached curlwp->l_fd, instead of p->p_fd.
- Inline selscan/pollscan.
 1.6 04-Nov-2009  rmind do_sys_wait(): fix previous by checking for ru != NULL. Noticed by
Onno van der Linden. Also, remove redundant arguments (seems that
was_zombie was not used since rev 1.177 ?).
 1.5 09-Aug-2009  haad Add enum uio_seg argument to do_sys_mknod and do_sys_mkdir so these functions
can be called from kernel, too.

Change needed for zfs device node creation, until we have propoer devfs.

Oked by ad@.
 1.4 29-Mar-2009  christos branches: 1.4.2;
Move the internal poll/select related API's to use timespec instead
of timeval (rides the uvm bump).
 1.3 26-Jan-2009  njoly branches: 1.3.2;
Make all fstat(2) compat syscalls consistently use do_sys_fstat(),
instead of fd_getfile()/fd_putfile() dance.

ok by christos.
 1.2 11-Jan-2009  christos branches: 1.2.2; 1.2.4;
merge christos-time_t
 1.1 04-Jan-2009  christos branches: 1.1.2;
file netbsd32_compat_50.c was initially added on branch christos-time_t.
 1.1.2.1 04-Jan-2009  christos add new syscalls.
 1.2.4.4 28-Apr-2009  skrll Sync with HEAD.
 1.2.4.3 03-Mar-2009  skrll Sync with HEAD.
 1.2.4.2 19-Jan-2009  skrll Sync with HEAD.
 1.2.4.1 11-Jan-2009  skrll file netbsd32_compat_50.c was added on branch nick-hppapmap on 2009-01-19 13:17:36 +0000
 1.2.2.2 17-Jan-2009  mjf Sync with HEAD.
 1.2.2.1 11-Jan-2009  mjf file netbsd32_compat_50.c was added on branch mjf-devfs2 on 2009-01-17 13:28:46 +0000
 1.3.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.4.2.5 11-Aug-2010  yamt sync with head.
 1.4.2.4 11-Mar-2010  yamt sync with head
 1.4.2.3 19-Aug-2009  yamt sync with head.
 1.4.2.2 04-May-2009  yamt sync with head.
 1.4.2.1 29-Mar-2009  yamt file netbsd32_compat_50.c was added on branch yamt-nfs-mp on 2009-05-04 08:12:25 +0000
 1.9.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.9.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.10.2.4 31-May-2011  rmind sync with head
 1.10.2.3 21-Apr-2011  rmind sync with head
 1.10.2.2 03-Jul-2010  rmind sync with head
 1.10.2.1 30-May-2010  rmind sync with head
 1.17.4.1 15-Feb-2011  bouyer implement COMPAT_NETBSD32 quotactl syscalls (both new and COMPAT_50)
 1.17.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.19.4.4 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.19.4.3 16-Jan-2013  yamt sync with (a bit old) head
 1.19.4.2 30-Oct-2012  yamt sync with head
 1.19.4.1 17-Apr-2012  yamt sync with head
 1.20.14.2 09-Nov-2014  msaitoh Pull up following revision(s) (requested by maxv in ticket #1179):
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.28
fix multiple mistakes:
- error from copyout was ignored
- the wrong size was specified in copyin
- missing locking.
 1.20.14.1 30-Jun-2014  msaitoh Pull up following revision(s) (requested by maxv in ticket #1090):
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.24
sys/compat/netbsd32/netbsd32_event.c: revision 1.11
Allocate directly KQ_NEVENTS bytes. Otherwise a user can panic the system.
ok christos@
 1.20.12.2 09-Nov-2014  msaitoh Pull up following revision(s) (requested by maxv in ticket #1179):
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.28
fix multiple mistakes:
- error from copyout was ignored
- the wrong size was specified in copyin
- missing locking.
 1.20.12.1 30-Jun-2014  msaitoh Pull up following revision(s) (requested by maxv in ticket #1090):
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.24
sys/compat/netbsd32/netbsd32_event.c: revision 1.11
Allocate directly KQ_NEVENTS bytes. Otherwise a user can panic the system.
ok christos@
 1.20.10.4 03-Dec-2017  jdolecek update from HEAD
 1.20.10.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.20.10.2 23-Jun-2013  tls resync from head
 1.20.10.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.20.6.2 09-Nov-2014  msaitoh Pull up following revision(s) (requested by maxv in ticket #1179):
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.28
fix multiple mistakes:
- error from copyout was ignored
- the wrong size was specified in copyin
- missing locking.
 1.20.6.1 30-Jun-2014  msaitoh Pull up following revision(s) (requested by maxv in ticket #1090):
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.24
sys/compat/netbsd32/netbsd32_event.c: revision 1.11
Allocate directly KQ_NEVENTS bytes. Otherwise a user can panic the system.
ok christos@
 1.23.8.1 10-Aug-2014  tls Rebase.
 1.24.2.2 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1720:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149 (patch)
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54 (patch)

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.24.2.1 30-Oct-2014  martin branches: 1.24.2.1.6;
Pull up following revision(s) (requested by maxv in ticket #166):
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.28
fix multiple mistakes:
- error from copyout was ignored
- the wrong size was specified in copyin
- missing locking.
 1.24.2.1.6.1 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1720:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149 (patch)
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54 (patch)

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.28.2.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.28.2.1 22-Sep-2015  skrll Sync with HEAD
 1.32.18.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.32.18.1 10-Jun-2019  christos Sync with HEAD
 1.32.16.16 23-Jan-2019  pgoyette Convert the macros for setting and unsetting a hook to generate
in-line code rather than using an intermediary hook##set routine.
Hooks are set and unset only in one place, so the intermediary
routine provides no benefit. IMHO using the macro at the point-
of-call is more readable than using it elsewhere in the code and
then calling the generated intermediary routine (for which you
won't even find its declaration or definition unless you remember
to search for the HOOK_SET macro instead).

NFC intended, will verify with a bulk build and an atf test run.
 1.32.16.15 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.32.16.14 26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.32.16.13 12-Oct-2018  pgoyette Use a MP-safe hook for the rnd_ioctl compat_50 calls.
 1.32.16.12 03-Oct-2018  pgoyette Normalize the required lists. Each compat_netbsd32_xx needs the
non-32bit module of the same version _and_ the 32-bit module for
the next higher version.
 1.32.16.11 03-Oct-2018  pgoyette Make sure that each version-specific compat_netbsd32_xx module depends
on all higher-version-specific modules, similar to the non-32bit
compat_xx modules.
 1.32.16.10 25-Sep-2018  pgoyette Additional use of NTP function pointers, since the NTP code might not
exist in the kernel. (NTP is not (yet) a module, so we don't need to
use the MP-safe mechanism.)
 1.32.16.9 23-Sep-2018  pgoyette Be selective about including the NTP syscall ntp_gettime
 1.32.16.8 11-Sep-2018  pgoyette Move the NTP compat_30 and compat_50 routines into the version-specific
modules.
 1.32.16.7 11-Sep-2018  pgoyette Move netbsd32_rndpseudo_50.c out of the main netbsd32 module and into
the module that handles netbsd32_50 compatability.
 1.32.16.6 11-Sep-2018  pgoyette Put the ``extern struct emul'' into the netbsd32_netbsd.h header
so it doesn't have to be separately declared in each source file.

Thanks mrg@
 1.32.16.5 11-Sep-2018  pgoyette Also need to declare the emul_netbsd32 !
 1.32.16.4 11-Sep-2018  pgoyette Install the syscalls into the netbsd32 table, not the default/native table.
 1.32.16.3 11-Sep-2018  pgoyette Use netbsd32 syscall names in the establish/disestablish tables
 1.32.16.2 11-Sep-2018  pgoyette Regen syscall files and fix includes for syscallvar.h
 1.32.16.1 10-Sep-2018  pgoyette More work on splitting the compat_netbsd32 module
 1.32.10.2 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1836):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.32.10.1 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1487:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.39.2.3 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.39.2.2 02-Jan-2020  martin Pull up following revision(s) (requested by maxv in ticket #597):

sys/compat/common/kern_sig_43.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.39
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.59
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.44

Fix sizeof mismatch in copyin. This leads to a user-triggerable stack
overflow. On my test build at least, by luck, the compiler orders the
variables in a way that the overflow hits only local structures which
haven't yet been initialized and used, so the overflow is harmless.

Very easily seeable with kASan - just invoke the syscall from a 32bit
binary.

Fix three stack info leaks, found by kMSan when just invoking all syscalls
with a zero page as argument.

MSan: Uninitialized Stack Memory In copyout() At Offset 0, Variable 'sb32' From compat_20_netbsd32_getfsstat()
MSan: Uninitialized Stack Memory In copyout() At Offset 12, Variable 'oss' From compat_43_sys_sigstack()
MSan: Uninitialized Stack Memory In copyout() At Offset 0, Variable 'sb' From compat_50_netbsd32___fhstat40()
 1.39.2.1 18-Dec-2019  martin Pull up following revision(s) (requested by tsutsui in ticket #570):

sys/compat/netbsd32/netbsd32_compat_50_sysv.c: revision 1.3
sys/dev/raidframe/rf_compat50.h: revision 1.6
sys/arch/emips/emips/bus_space.c: revision 1.3
sys/compat/net/if.h: revision 1.5
sys/arch/emips/stand/common/bootinfo.c: revision 1.2
sys/compat/common/sysv_msg_50.c: revision 1.5
sys/compat/common/kern_time_30.c: revision 1.8
sys/arch/emips/stand/common/bootinfo.h: revision 1.2
sys/arch/ia64/include/bus.h: revision 1.4
sys/arch/ia64/ia64/bus_space.c: revision 1.2
sys/compat/common/sysv_shm_50.c: revision 1.5
sys/dev/ic/adw.h: revision 1.15
sys/compat/common/uipc_syscalls_50.c: revision 1.10
sys/arch/emips/ebus/flash_ebus.c: revision 1.22
sys/dev/ic/adv.h: revision 1.15
sys/dev/ic/adwmcode.c: revision 1.18
sys/dev/ic/advlib.c: revision 1.29
sys/arch/hpcarm/include/kloader.h: revision 1.3
sys/dev/usb/uberry.c: revision 1.16
sys/compat/common/sysv_sem_50.c: revision 1.5
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.43
sys/dev/ic/advlib.h: revision 1.21
sys/dev/ic/adv.c: revision 1.50
sys/compat/netinet6/in6_var.h: revision 1.5
sys/arch/hpc/stand/hpcboot/arm/arm_sa1100_asm.asm: revision 1.2
sys/arch/emips/include/loadfile_machdep.h: revision 1.3
sys/arch/emips/stand/common/prom_iface.c: revision 1.7
sys/dev/ic/adw.c: revision 1.56
sys/dev/ic/adwmcode.h: revision 1.12
sys/dev/ic/advmcode.c: revision 1.10
sys/arch/emips/ebus/ace_ebus.c: revision 1.22
sys/compat/netbsd32/netbsd32_compat_60.c: revision 1.5
sys/dev/raidframe/rf_compat50.c: revision 1.13
sys/arch/x68k/dev/intiovar.h: revision 1.15
sys/dev/usb/uipad.c: revision 1.8
sys/arch/zaurus/include/kloader.h: revision 1.3
sys/arch/emips/stand/common/bootxx.c: revision 1.2
sys/dev/ic/adwlib.h: revision 1.23
sys/dev/ic/adwlib.c: revision 1.44
sys/compat/netbsd32/netbsd32_compat_16.c: revision 1.3
sys/arch/amigappc/include/intr.h: revision 1.27
sys/arch/x68k/dev/mfp.c: revision 1.27
sys/arch/arm/at91/at91dbgu.c: revision 1.17
sys/dev/ic/advmcode.h: revision 1.7
sys/compat/ultrix/ultrix_exec.h: revision 1.7
sys/compat/common/vfs_syscalls_50.c: revision 1.24
sys/arch/mips/cavium/octeon_dma.c: revision 1.3
sys/arch/hpc/stand/hpcboot/arm/arm_pxa2x0_asm.asm: revision 1.2

Remove clause 3 and 4 from TNF licenses.
Ok'ed by martin@ in PR/54760.

Remove clause 3 and 4 leftovers from TNF licenses in more sources.
Confirmed by martin@ in PR/54760.
 1.44.2.1 29-Feb-2020  ad Sync with head.
 1.49.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.2 19-Jan-2021  simonb KNF consistency: No parentheses are needed around the return value.
 1.1 12-Mar-2020  pgoyette branches: 1.1.2; 1.1.6;
Split out the quota code from the rest of compat_netbsd32 module. This
allows loading of compat_netbsd32 on kernels that don't have ``options
QUOTA'' enabled.
 1.1.6.1 03-Apr-2021  thorpej Sync with HEAD.
 1.1.2.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.1.2.1 12-Mar-2020  martin file netbsd32_compat_50_quota.c was added on branch phil-wifi on 2020-04-08 14:08:01 +0000
 1.4 19-Jan-2021  simonb KNF consistency: No parentheses are needed around the return value.
 1.3 15-Dec-2019  tsutsui branches: 1.3.8;
Remove clause 3 and 4 leftovers from TNF licenses in more sources.

Confirmed by martin@ in PR/54760.
 1.2 27-Jan-2019  pgoyette branches: 1.2.4;
Merge the [pgoyette-compat] branch
 1.1 03-Dec-2015  pgoyette branches: 1.1.2; 1.1.18; 1.1.20; 1.1.22;
Split out the SYSV IPC stuff into its own compat_netbsd32_sysvipc
module. Adjust dependencies as needed.
 1.1.22.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.1.22.1 10-Jun-2019  christos Sync with HEAD
 1.1.20.1 12-Sep-2018  pgoyette Split compat_netbsd32_sysvipc into version-specific modules
 1.1.18.2 03-Dec-2017  jdolecek update from HEAD
 1.1.18.1 03-Dec-2015  jdolecek file netbsd32_compat_50_sysv.c was added on branch tls-maxphys on 2017-12-03 11:36:55 +0000
 1.1.2.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.1.2.1 03-Dec-2015  skrll file netbsd32_compat_50_sysv.c was added on branch nick-nhusb on 2015-12-27 12:09:47 +0000
 1.2.4.1 18-Dec-2019  martin Pull up following revision(s) (requested by tsutsui in ticket #570):

sys/compat/netbsd32/netbsd32_compat_50_sysv.c: revision 1.3
sys/dev/raidframe/rf_compat50.h: revision 1.6
sys/arch/emips/emips/bus_space.c: revision 1.3
sys/compat/net/if.h: revision 1.5
sys/arch/emips/stand/common/bootinfo.c: revision 1.2
sys/compat/common/sysv_msg_50.c: revision 1.5
sys/compat/common/kern_time_30.c: revision 1.8
sys/arch/emips/stand/common/bootinfo.h: revision 1.2
sys/arch/ia64/include/bus.h: revision 1.4
sys/arch/ia64/ia64/bus_space.c: revision 1.2
sys/compat/common/sysv_shm_50.c: revision 1.5
sys/dev/ic/adw.h: revision 1.15
sys/compat/common/uipc_syscalls_50.c: revision 1.10
sys/arch/emips/ebus/flash_ebus.c: revision 1.22
sys/dev/ic/adv.h: revision 1.15
sys/dev/ic/adwmcode.c: revision 1.18
sys/dev/ic/advlib.c: revision 1.29
sys/arch/hpcarm/include/kloader.h: revision 1.3
sys/dev/usb/uberry.c: revision 1.16
sys/compat/common/sysv_sem_50.c: revision 1.5
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.43
sys/dev/ic/advlib.h: revision 1.21
sys/dev/ic/adv.c: revision 1.50
sys/compat/netinet6/in6_var.h: revision 1.5
sys/arch/hpc/stand/hpcboot/arm/arm_sa1100_asm.asm: revision 1.2
sys/arch/emips/include/loadfile_machdep.h: revision 1.3
sys/arch/emips/stand/common/prom_iface.c: revision 1.7
sys/dev/ic/adw.c: revision 1.56
sys/dev/ic/adwmcode.h: revision 1.12
sys/dev/ic/advmcode.c: revision 1.10
sys/arch/emips/ebus/ace_ebus.c: revision 1.22
sys/compat/netbsd32/netbsd32_compat_60.c: revision 1.5
sys/dev/raidframe/rf_compat50.c: revision 1.13
sys/arch/x68k/dev/intiovar.h: revision 1.15
sys/dev/usb/uipad.c: revision 1.8
sys/arch/zaurus/include/kloader.h: revision 1.3
sys/arch/emips/stand/common/bootxx.c: revision 1.2
sys/dev/ic/adwlib.h: revision 1.23
sys/dev/ic/adwlib.c: revision 1.44
sys/compat/netbsd32/netbsd32_compat_16.c: revision 1.3
sys/arch/amigappc/include/intr.h: revision 1.27
sys/arch/x68k/dev/mfp.c: revision 1.27
sys/arch/arm/at91/at91dbgu.c: revision 1.17
sys/dev/ic/advmcode.h: revision 1.7
sys/compat/ultrix/ultrix_exec.h: revision 1.7
sys/compat/common/vfs_syscalls_50.c: revision 1.24
sys/arch/mips/cavium/octeon_dma.c: revision 1.3
sys/arch/hpc/stand/hpcboot/arm/arm_pxa2x0_asm.asm: revision 1.2

Remove clause 3 and 4 from TNF licenses.
Ok'ed by martin@ in PR/54760.

Remove clause 3 and 4 leftovers from TNF licenses in more sources.
Confirmed by martin@ in PR/54760.
 1.3.8.1 03-Apr-2021  thorpej Sync with HEAD.
 1.6 29-Jan-2020  ad - Track LWPs in a per-process radixtree. It uses no extra memory in the
single threaded case. Replace scans of p->p_lwps with lookups in the
tree. Find free LIDs for new LWPs in the tree. Replace the hashed sleep
queues for park/unpark with lookups in the tree under cover of a RW lock.

- lwp_wait(): if waiting on a specific LWP, find the LWP via tree lookup and
return EINVAL if it's detached, not ESRCH.

- Group the locks in struct proc at the end of the struct in their own cache
line.

- Add some comments.
 1.5 15-Dec-2019  tsutsui branches: 1.5.2;
Remove clause 3 and 4 leftovers from TNF licenses in more sources.

Confirmed by martin@ in PR/54760.
 1.4 27-Jan-2019  pgoyette branches: 1.4.4;
Merge the [pgoyette-compat] branch
 1.3 06-Dec-2017  christos branches: 1.3.2; 1.3.4;
don't forget to convert the timespec.
XXX: pullup-8
 1.2 21-Aug-2014  maxv branches: 1.2.12;
Remove dead returns:

return VAR/func(XX);
return VAR;

The latter is never reached. Sent on tech-kern@, no disagreement.
 1.1 29-Mar-2013  christos branches: 1.1.4; 1.1.12; 1.1.14;
lwp park glue
 1.1.14.1 13-Mar-2019  msaitoh Pull up following revision(s) (requested by martin in ticket #1683):
sys/compat/netbsd32/netbsd32_compat_60.c: revision 1.3
don't forget to convert the timespec.
XXX: pullup-8
 1.1.12.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.1.12.1 29-Mar-2013  yamt file netbsd32_compat_60.c was added on branch yamt-pagecache on 2014-05-22 11:40:17 +0000
 1.1.4.3 03-Dec-2017  jdolecek update from HEAD
 1.1.4.2 23-Jun-2013  tls resync from head
 1.1.4.1 29-Mar-2013  tls file netbsd32_compat_60.c was added on branch tls-maxphys on 2013-06-23 06:20:16 +0000
 1.2.12.1 12-Mar-2019  snj Pull up following revision(s) (requested by martin in ticket #1211):
sys/compat/netbsd32/netbsd32_compat_60.c: 1.3
don't forget to convert the timespec.
 1.3.4.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.3.4.1 10-Jun-2019  christos Sync with HEAD
 1.3.2.9 03-Oct-2018  pgoyette Normalize the required lists. Each compat_netbsd32_xx needs the
non-32bit module of the same version _and_ the 32-bit module for
the next higher version.
 1.3.2.8 03-Oct-2018  pgoyette Make sure that each version-specific compat_netbsd32_xx module depends
on all higher-version-specific modules, similar to the non-32bit
compat_xx modules.
 1.3.2.7 13-Sep-2018  pgoyette Another dependency typo
 1.3.2.6 11-Sep-2018  pgoyette Put the ``extern struct emul'' into the netbsd32_netbsd.h header
so it doesn't have to be separately declared in each source file.

Thanks mrg@
 1.3.2.5 11-Sep-2018  pgoyette Also need to declare the emul_netbsd32 !
 1.3.2.4 11-Sep-2018  pgoyette Install the syscalls into the netbsd32 table, not the default/native table.
 1.3.2.3 11-Sep-2018  pgoyette Use netbsd32 syscall names in the establish/disestablish tables
 1.3.2.2 11-Sep-2018  pgoyette Regen syscall files and fix includes for syscallvar.h
 1.3.2.1 10-Sep-2018  pgoyette More work on splitting the compat_netbsd32 module
 1.4.4.1 18-Dec-2019  martin Pull up following revision(s) (requested by tsutsui in ticket #570):

sys/compat/netbsd32/netbsd32_compat_50_sysv.c: revision 1.3
sys/dev/raidframe/rf_compat50.h: revision 1.6
sys/arch/emips/emips/bus_space.c: revision 1.3
sys/compat/net/if.h: revision 1.5
sys/arch/emips/stand/common/bootinfo.c: revision 1.2
sys/compat/common/sysv_msg_50.c: revision 1.5
sys/compat/common/kern_time_30.c: revision 1.8
sys/arch/emips/stand/common/bootinfo.h: revision 1.2
sys/arch/ia64/include/bus.h: revision 1.4
sys/arch/ia64/ia64/bus_space.c: revision 1.2
sys/compat/common/sysv_shm_50.c: revision 1.5
sys/dev/ic/adw.h: revision 1.15
sys/compat/common/uipc_syscalls_50.c: revision 1.10
sys/arch/emips/ebus/flash_ebus.c: revision 1.22
sys/dev/ic/adv.h: revision 1.15
sys/dev/ic/adwmcode.c: revision 1.18
sys/dev/ic/advlib.c: revision 1.29
sys/arch/hpcarm/include/kloader.h: revision 1.3
sys/dev/usb/uberry.c: revision 1.16
sys/compat/common/sysv_sem_50.c: revision 1.5
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.43
sys/dev/ic/advlib.h: revision 1.21
sys/dev/ic/adv.c: revision 1.50
sys/compat/netinet6/in6_var.h: revision 1.5
sys/arch/hpc/stand/hpcboot/arm/arm_sa1100_asm.asm: revision 1.2
sys/arch/emips/include/loadfile_machdep.h: revision 1.3
sys/arch/emips/stand/common/prom_iface.c: revision 1.7
sys/dev/ic/adw.c: revision 1.56
sys/dev/ic/adwmcode.h: revision 1.12
sys/dev/ic/advmcode.c: revision 1.10
sys/arch/emips/ebus/ace_ebus.c: revision 1.22
sys/compat/netbsd32/netbsd32_compat_60.c: revision 1.5
sys/dev/raidframe/rf_compat50.c: revision 1.13
sys/arch/x68k/dev/intiovar.h: revision 1.15
sys/dev/usb/uipad.c: revision 1.8
sys/arch/zaurus/include/kloader.h: revision 1.3
sys/arch/emips/stand/common/bootxx.c: revision 1.2
sys/dev/ic/adwlib.h: revision 1.23
sys/dev/ic/adwlib.c: revision 1.44
sys/compat/netbsd32/netbsd32_compat_16.c: revision 1.3
sys/arch/amigappc/include/intr.h: revision 1.27
sys/arch/x68k/dev/mfp.c: revision 1.27
sys/arch/arm/at91/at91dbgu.c: revision 1.17
sys/dev/ic/advmcode.h: revision 1.7
sys/compat/ultrix/ultrix_exec.h: revision 1.7
sys/compat/common/vfs_syscalls_50.c: revision 1.24
sys/arch/mips/cavium/octeon_dma.c: revision 1.3
sys/arch/hpc/stand/hpcboot/arm/arm_pxa2x0_asm.asm: revision 1.2

Remove clause 3 and 4 from TNF licenses.
Ok'ed by martin@ in PR/54760.

Remove clause 3 and 4 leftovers from TNF licenses in more sources.
Confirmed by martin@ in PR/54760.
 1.5.2.1 29-Feb-2020  ad Sync with head.
 1.8 29-Jul-2023  pgoyette Don't skip compat_netbsd32_90 in the dependency chain.
 1.7 29-Jul-2023  rin COMPAT_NETBSD32: Reorganize the previous; Make compat_netbsd32_50 recursively
depended on compat_netbsd32_100, rather than directly depended on it.

Thanks pgoyette@ again for useful comments!
 1.6 12-Dec-2019  pgoyette branches: 1.6.26;
Rather than keeping a separate mutex, condvar, and pserialize for each
module hook, we can share a common set of synchronization structures.
This cuts the amount of cacheline_aligned data for these structures by
50%.

Note that we still have a per-hook localcount, since we need to count
individual references.

As discussed with riastradh@

Welcome to 9.99.22 !
 1.5 01-Mar-2019  pgoyette branches: 1.5.4;
Rename the MODULE_*_HOOK() macros to MODULE_HOOK_*() as briefly
discussed on irc.

NFCI intended.

Ride the earlier kernel bump - it;s getting crowded.
 1.4 30-Jan-2019  pgoyette Remove #ifdef COMPAT_80

The file will only be selected if "options COMPAT_80" is defined in
the config file. The COMPAT_80 macro is defined only if the option
is explicitly defined, and not if it is implicitly defined due to
inclusion of lesser-version COMPATs.
 1.3 28-Jan-2019  pgoyette Include new compatability header
 1.2 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.1 10-Sep-2018  pgoyette branches: 1.1.2;
file netbsd32_compat_80.c was initially added on branch pgoyette-compat.
 1.1.2.6 23-Jan-2019  pgoyette Convert the macros for setting and unsetting a hook to generate
in-line code rather than using an intermediary hook##set routine.
Hooks are set and unset only in one place, so the intermediary
routine provides no benefit. IMHO using the macro at the point-
of-call is more readable than using it elsewhere in the code and
then calling the generated intermediary routine (for which you
won't even find its declaration or definition unless you remember
to search for the HOOK_SET macro instead).

NFC intended, will verify with a bulk build and an atf test run.
 1.1.2.5 18-Sep-2018  pgoyette The COMPAT_HOOK macros were renamed to MODULE_HOOK, adjust all callers
 1.1.2.4 18-Sep-2018  pgoyette Use the MP-safe compat hooks for netbsd32_compat_80.c's modctl
 1.1.2.3 11-Sep-2018  pgoyette Remove unused variable
 1.1.2.2 11-Sep-2018  pgoyette Regen
 1.1.2.1 10-Sep-2018  pgoyette More work on splitting the compat_netbsd32 module
 1.5.4.3 08-Apr-2020  martin Merge changes from current as of 20200406
 1.5.4.2 10-Jun-2019  christos Sync with HEAD
 1.5.4.1 01-Mar-2019  christos file netbsd32_compat_80.c was added on branch phil-wifi on 2019-06-10 22:07:01 +0000
 1.6.26.1 26-Oct-2024  martin Pull up following revision(s) (requested by rin in ticket #987):

sys/compat/netbsd32/netbsd32_compat_80.c: revision 1.7,1.8 (patch)

Don't skip compat_netbsd32_90 in the dependency chain.
 1.2 29-Jul-2023  pgoyette Don't skip compat_netbsd32_90 in the dependency chain.
 1.1 22-Sep-2019  christos branches: 1.1.8;
Add a new member to struct vfsstat and grow the unused members
The new member is caled f_mntfromlabel and it is the dkw_wname
of the corresponding wedge. This is now used by df -W to display
the mountpoint name as NAME=
 1.1.8.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.1.8.1 22-Sep-2019  martin file netbsd32_compat_90.c was added on branch phil-wifi on 2020-04-13 08:04:16 +0000
 1.48 30-Jul-2023  rin COMPAT_NETBSD32: Add support for epoll(2).
 1.47 29-Jul-2023  rin COMPAT_NETBSD32: Catch up with sys___kevent100() addition.

XXX
Add epoll_* and memfd_create.
 1.46 07-Sep-2021  riastradh sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.45 19-Jan-2021  simonb The read/write/send/recv system calls return ssize_t because -1 is
returned on error. Therefore we must restrict the lengths of any
buffers to NETBSD32_SSIZE_MAX with compat32 to avoid garbage return
values.

Fixes ATF lib/libc/sys/t_write:write_err.
 1.44 19-Jan-2021  simonb KNF consistency: No parentheses are needed around the return value.
 1.43 18-Jan-2021  simonb s/u_intN_t/uintN_t/
 1.42 18-Nov-2019  rin branches: 1.42.8;
Sorry, revert unintentional parts of the previous commit:
http://mail-index.netbsd.org/source-changes/2019/11/18/msg110946.html

I was going to commit only netbsd32_signal.c.
 1.41 18-Nov-2019  rin Belatedly catch up with kern_sig.c rev 1.358:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/kern/kern_sig.c#rev1.358

Provide syscall information with SIGTRAP TRAP_SCE/TRAP_SCX so that
picotrace/truss, for example, works fine on COMPAT_NETBSD32.

With some minor changes:

- Centralize netbsd32_si{,32}_si{32,}() into netbsd32_ksi{,32}_ksi{32,}().
- Provide si_status with SIGCHLD.
- Remove the remaining of SA.

XXX
pullup to netbsd-9
 1.40 03-Oct-2019  kamil Switch kevent udata from intptr_t void*

Synchromize the struct field format with other BSDs and Darwin.

No ABI change between older and newer struct form on the ports.

The change will require no changes to most C users during the transition
period as the header keeps a caller cast.

Discussed with core@ and there were no objections for this move.
 1.39 22-Sep-2019  christos Add a new member to struct vfsstat and grow the unused members
The new member is caled f_mntfromlabel and it is the dkw_wname
of the corresponding wedge. This is now used by df -W to display
the mountpoint name as NAME=
 1.38 21-Feb-2019  mrg branches: 1.38.4;
for sysv ipc stat operations, explicitly copy the exported parts
instead of the whole ds structure.

besides triggering a recently added assert in netbsd32, this stops
exposing kernel addresses.

copy the mode clamping to 0777 from sem to shm and msg.


while here, make sure that the compat callers to sysv_ipc clear
the contents of the compat structure before setting the result
members to ensure padding bytes are cleared.

don't set/copy _sem_base, _msg_first, _msg_last or _shm_internal.
even if used, which seems very dodgy, they leak KVAs as well.
possibly this may affect linux binaries, in particular, the
comments around _shm_internal ("XXX Oh well.") may mean apps
rely upon these but hopefully not -- the comments date back to
rev 1.1 in 1995.

the _key, _seq and _msg_cbytes members are exported as before as
i found multiple consumers of these (no less than ipcs(1), and
they appear to be useful for debugging and more.


XXX: the naming of compat functions have too many styles. there
are at least 3 different ones changed here.
 1.37 27-Dec-2018  maxv Fix kernel info leaks.

+ Possible info leak: [len=80, leaked=10]
| #0 0xffffffff80bad7a7 in kleak_copyout
| #1 0xffffffff8048e71b in netbsd32___msgctl50
| #2 0xffffffff8022fb5b in netbsd32_syscall
| #3 0xffffffff802096dd in handle_syscall
 1.36 25-Nov-2018  mlelstv Restore netbsd32 compat code for new NPF ABI.
 1.35 10-May-2018  christos branches: 1.35.2;
add {send,recv}mmsg
 1.34 19-Apr-2018  christos s/static inline/static __inline/g for consistency.
 1.33 31-Oct-2017  martin branches: 1.33.2;
PR kern/52681: fix msghdr conversion.
 1.32 31-Jul-2017  maxv Remove references to COMPAT_OLDSOCK (itself removed years ago).
 1.31 13-Nov-2016  rin branches: 1.31.8;
correct wrong casting. some are considered harmless, but
- tv_sec in netbsd32_timeval is netbsd32_time_t (aka netbsd32_int64_t)
rather than time_t (int64_t)
- tv_sec in netbsd32_timespec is netbsd32_time_t rather than
netbsd32_long (y2038 problem)
approved by martin
 1.30 22-Jun-2015  mrg branches: 1.30.2;
add netbsd32 support for nfssvc(2). we do this by defining 5 copyin/out
functions that do all the ugly work, are just plain copyin/out for the
native system calls, and do the necessary translations for netbsd32.

with this i'm able to run 32 bit nfsd and mountd on 64 bit kernel and
mount the file systems remotely.
 1.29 20-Jun-2015  martin Implement modctl, sigqueinfo and mq_*
 1.28 18-Mar-2014  riastradh branches: 1.28.4; 1.28.6; 1.28.8;
Merge riastradh-drm2 to HEAD.
 1.27 20-Jul-2013  njoly Initialise destination before performing stat structure conversion.
Avoid getting garbage for structure members not set explicitely.
 1.26 06-Mar-2011  bouyer branches: 1.26.4; 1.26.14; 1.26.18; 1.26.26;
merge the bouyer-quota2 branch. This adds a new on-disk format
to store disk quota usage and limits, integrated with ffs
metadata. Usage is checked by fsck_ffs (no more quotacheck)
and is covered by the WAPBL journal. Enabled with kernel
option QUOTA2 (added where QUOTA was enabled in kernel config files),
turned on with tunefs(8) on a per-filesystem
basis. mount_mfs(8) can also turn quotas on.

See http://mail-index.netbsd.org/tech-kern/2011/02/19/msg010025.html
for details.
 1.25 20-Feb-2011  matt Don't bother the iov in netbsd32_to_msghdr since it needs to handled specially.
 1.24 16-Jan-2011  njoly branches: 1.24.2; 1.24.4;
In stat structure conversions, do set st_birthtimespec member values
if exists.
 1.23 04-Jan-2011  matt Need to deal with msg_iov in netbsd32_to_msghdr.
 1.22 25-Jan-2009  christos branches: 1.22.6;
fix casts.
 1.21 11-Jan-2009  christos merge christos-time_t
 1.20 12-Nov-2008  ad branches: 1.20.4;
Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.
 1.19 02-Jun-2008  njoly branches: 1.19.4; 1.19.6; 1.19.12;
When converting msqid_ds structure from/to netbsd32 for msgctl(2)
IPC_STAT/IPC_SET, do not try to fill private struct members
_msg_first/_msg_last which do not exists.
 1.18 29-May-2008  mrg remove clause #3 from my license where there are no other
copyright holders involved.
 1.17 04-Dec-2007  dsl branches: 1.17.12; 1.17.14; 1.17.16; 1.17.18;
Remove all the __P
 1.16 16-Mar-2007  dsl branches: 1.16.8; 1.16.10; 1.16.16; 1.16.18;
remove all the double (and triple) casts used to convert 32bit userspace
pointers to and from 64bit kernel pointers. Instead use the defines
NETBSD32PTR64(p32) to read a 32bit pointer and (the new) NETBSD32PTR32(p32,p64)
to write a 32bit pointer throughout.
The 32bit pointer is now a struct to enforce the above.
amd64 (with linux emul) and sparc64 will both compile (when the arch stuff
goes in soon), and amd64 still runs some i386 binaries.
 1.15 04-Mar-2007  christos branches: 1.15.2; 1.15.4; 1.15.6;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.14 16-Feb-2006  perry branches: 1.14.20;
Change "inline" back to "__inline" in .h files -- C99 is still too
new, and some apps compile things in C89 mode. C89 keywords stay.

As per core@.
 1.13 24-Dec-2005  perry branches: 1.13.2; 1.13.4; 1.13.6;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.12 11-Dec-2005  christos merge ktrace-lwp.
 1.11 23-Oct-2005  cube - Split sys_kevent into kevent1 so that it can be used by COMPAT_NETBSD32
code.

- To achieve COMPAT_NETBSD32 compatibility, introduce a parameter to
kevent1 that points to functions that do the actual copyin/copyout
operations. This is similar to what was done in FreeBSD by Paul Saab.

- Add the COMPAT_NETBSD32 definitions and hooks.
 1.10 13-Sep-2005  christos branches: 1.10.2;
make this compile again.
 1.9 19-Aug-2005  christos Fix lossage I created with the 64 bit ino_t change.
 1.8 19-Aug-2005  christos 64 bit inode changes.
 1.7 23-Jul-2005  cube Constify conversion functions.
 1.6 23-Jul-2005  cube Implement the timer_create(2) family of syscalls.
 1.5 26-Feb-2005  perry branches: 1.5.4;
nuke trailing whitespace
 1.4 17-Jun-2004  cube branches: 1.4.4; 1.4.6;
o Add support for the statvfs family of syscalls (statvfs1, fstatvfs1,
fhstatvfs1 and getvfsstat)
o Move the statfs family out of netbsd32_fs.c and netbsd32_netbsd.c to
netbsd_compat_20.c, compiled with COMPAT_20

Reviewed by christos@.
 1.3 21-Apr-2004  christos try to make this compile. XXX: this will not work yet (hi simon)
 1.2 21-Apr-2004  christos Replace the statfs() family of system calls with statvfs().
Retain binary compatibility.
 1.1 07-Feb-2001  mrg branches: 1.1.2; 1.1.26;
move the static inline conversion functions into a header file so other
files can see these. note a bunch of functions that should be moved
into their own files.
 1.1.26.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.26.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.1.26.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.26.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.26.1 03-Aug-2004  skrll Sync with HEAD
 1.1.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.1.2.1 07-Feb-2001  bouyer file netbsd32_conv.h was added on branch thorpej_scsipi on 2001-02-11 19:14:11 +0000
 1.4.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.4.4.1 29-Apr-2005  kent sync with -current
 1.5.4.3 07-Dec-2007  yamt sync with head
 1.5.4.2 03-Sep-2007  yamt sync with head.
 1.5.4.1 21-Jun-2006  yamt sync with head.
 1.10.2.1 26-Oct-2005  yamt sync with head
 1.13.6.1 22-Apr-2006  simonb Sync with head.
 1.13.4.1 09-Sep-2006  rpaulo sync with head
 1.13.2.1 18-Feb-2006  yamt sync with head.
 1.14.20.2 24-Mar-2007  yamt sync with head.
 1.14.20.1 12-Mar-2007  rmind Sync with HEAD.
 1.15.6.1 18-Mar-2007  reinoud First attempt to bring branch in sync with HEAD
 1.15.4.1 11-Jul-2007  mjf Sync with head.
 1.15.2.1 10-Apr-2007  ad Sync with head.
 1.16.18.1 08-Dec-2007  ad Sync with head.
 1.16.16.1 08-Dec-2007  mjf Sync with HEAD.
 1.16.10.1 09-Jan-2008  matt sync with HEAD
 1.16.8.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.17.18.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.17.16.1 04-May-2009  yamt sync with head.
 1.17.14.1 04-Jun-2008  yamt sync with head
 1.17.12.3 17-Jan-2009  mjf Sync with HEAD.
 1.17.12.2 05-Jun-2008  mjf Sync with HEAD.

Also fix build.
 1.17.12.1 02-Jun-2008  mjf Sync with HEAD.
 1.19.12.1 09-Jun-2010  matt Fix socket passing in netbsd32 compat. unfdpasses and incoming ssh
interactive session now work.
 1.19.6.2 03-Mar-2009  skrll Sync with HEAD.
 1.19.6.1 19-Jan-2009  skrll Sync with HEAD.
 1.19.4.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.20.4.2 04-Jan-2009  christos add new syscalls.
 1.20.4.1 12-Nov-2008  christos file netbsd32_conv.h was added on branch christos-time_t on 2009-01-04 01:56:02 +0000
 1.22.6.2 21-Apr-2011  rmind sync with head
 1.22.6.1 05-Mar-2011  rmind sync with head
 1.24.4.2 05-Mar-2011  bouyer Sync with HEAD
 1.24.4.1 15-Feb-2011  bouyer implement COMPAT_NETBSD32 quotactl syscalls (both new and COMPAT_50)
 1.24.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.26.26.1 23-Jul-2013  riastradh sync with HEAD
 1.26.18.1 28-Aug-2013  rmind sync with head
 1.26.14.2 03-Dec-2017  jdolecek update from HEAD
 1.26.14.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.26.4.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.28.8.2 23-Feb-2019  martin Pull up following revision(s) (requested by mrg in ticket #1679):
sys/compat/sys/ipc.h: revision 1.6
sys/compat/sys/ipc.h: revision 1.7
sys/compat/sys/shm.h: revision 1.8
sys/kern/sysv_shm.c: revision 1.133
sys/compat/sys/sem.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.56
sys/compat/netbsd32/netbsd32_conv.h: revision 1.38
sys/kern/sysv_sem.c: revision 1.96
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.28
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.29
sys/compat/linux32/common/linux32_ipccall.c: revision 1.12
sys/kern/sysv_msg.c: revision 1.73
sys/compat/sys/msg.h: revision 1.6

for sysv ipc stat operations, explicitly copy the exported parts
instead of the whole ds structure.
besides triggering a recently added assert in netbsd32, this stops
exposing kernel addresses.

copy the mode clamping to 0777 from sem to shm and msg.

while here, make sure that the compat callers to sysv_ipc clear
the contents of the compat structure before setting the result
members to ensure padding bytes are cleared.

don't set/copy _sem_base, _msg_first, _msg_last or _shm_internal.
even if used, which seems very dodgy, they leak KVAs as well.
possibly this may affect linux binaries, in particular, the
comments around _shm_internal ("XXX Oh well.") may mean apps
rely upon these but hopefully not -- the comments date back to
rev 1.1 in 1995.

the _key, _seq and _msg_cbytes members are exported as before as
i found multiple consumers of these (no less than ipcs(1), and
they appear to be useful for debugging and more.

XXX: the naming of compat functions have too many styles. there
are at least 3 different ones changed here.

fix naming errors in previous. (this file is no longer compiled, but
this fix makes the pull up more obvious, before deleting this file.)

include libkern.h or strings.h. should fix i386 build issues.
 1.28.8.1 02-Jan-2019  martin Pull up following revision(s) (requested by maxv in ticket #1668):

sys/compat/netbsd32/netbsd32_conv.h: revision 1.37
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.27
sys/compat/sys/msg.h: revision 1.5

Fix kernel info leaks.

+ Possible info leak: [len=80, leaked=10]
| #0 0xffffffff80bad7a7 in kleak_copyout
| #1 0xffffffff8048e71b in netbsd32___msgctl50
| #2 0xffffffff8022fb5b in netbsd32_syscall
| #3 0xffffffff802096dd in handle_syscall
 1.28.6.3 28-Aug-2017  skrll Sync with HEAD
 1.28.6.2 05-Dec-2016  skrll Sync with HEAD
 1.28.6.1 22-Sep-2015  skrll Sync with HEAD
 1.28.4.3 23-Feb-2019  martin Pull up following revision(s) (requested by mrg in ticket #1679):
sys/compat/sys/ipc.h: revision 1.6
sys/compat/sys/ipc.h: revision 1.7
sys/compat/sys/shm.h: revision 1.8
sys/kern/sysv_shm.c: revision 1.133
sys/compat/sys/sem.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.56
sys/compat/netbsd32/netbsd32_conv.h: revision 1.38
sys/kern/sysv_sem.c: revision 1.96
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.28
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.29
sys/compat/linux32/common/linux32_ipccall.c: revision 1.12
sys/kern/sysv_msg.c: revision 1.73
sys/compat/sys/msg.h: revision 1.6

for sysv ipc stat operations, explicitly copy the exported parts
instead of the whole ds structure.
besides triggering a recently added assert in netbsd32, this stops
exposing kernel addresses.

copy the mode clamping to 0777 from sem to shm and msg.

while here, make sure that the compat callers to sysv_ipc clear
the contents of the compat structure before setting the result
members to ensure padding bytes are cleared.

don't set/copy _sem_base, _msg_first, _msg_last or _shm_internal.
even if used, which seems very dodgy, they leak KVAs as well.
possibly this may affect linux binaries, in particular, the
comments around _shm_internal ("XXX Oh well.") may mean apps
rely upon these but hopefully not -- the comments date back to
rev 1.1 in 1995.

the _key, _seq and _msg_cbytes members are exported as before as
i found multiple consumers of these (no less than ipcs(1), and
they appear to be useful for debugging and more.

XXX: the naming of compat functions have too many styles. there
are at least 3 different ones changed here.

fix naming errors in previous. (this file is no longer compiled, but
this fix makes the pull up more obvious, before deleting this file.)

include libkern.h or strings.h. should fix i386 build issues.
 1.28.4.2 02-Jan-2019  martin Pull up following revision(s) (requested by maxv in ticket #1668):

sys/compat/netbsd32/netbsd32_conv.h: revision 1.37
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.27
sys/compat/sys/msg.h: revision 1.5

Fix kernel info leaks.

+ Possible info leak: [len=80, leaked=10]
| #0 0xffffffff80bad7a7 in kleak_copyout
| #1 0xffffffff8048e71b in netbsd32___msgctl50
| #2 0xffffffff8022fb5b in netbsd32_syscall
| #3 0xffffffff802096dd in handle_syscall
 1.28.4.1 04-Nov-2015  riz branches: 1.28.4.1.4;
Pull up following revision(s) (requested by mrg in ticket #956):
sys/compat/netbsd32/files.netbsd32: revision 1.36
sys/compat/netbsd32/netbsd32_sysent.c: revision 1.115
sys/compat/netbsd32/netbsd32_syscallargs.h: revision 1.116
sys/nfs/nfs_var.h: revision 1.93
sys/compat/netbsd32/netbsd32_conv.h: revision 1.30
sys/compat/netbsd32/netbsd32_syscall.h: revision 1.116
sys/compat/netbsd32/netbsd32_syscalls.c: revision 1.115
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.1
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.3
sys/nfs/nfs_syscalls.c: revision 1.156
sys/compat/netbsd32/syscalls.master: revision 1.108
sys/compat/netbsd32/netbsd32.h: revision 1.107
add netbsd32 support for nfssvc(2). we do this by defining 5 copyin/out
functions that do all the ugly work, are just plain copyin/out for the
native system calls, and do the necessary translations for netbsd32.
with this i'm able to run 32 bit nfsd and mountd on 64 bit kernel and
mount the file systems remotely.
don't copy the first netbsd32_export_args nexports times, but actually
advance the userland pointer each entry through the loop. oops.
 1.28.4.1.4.2 23-Feb-2019  martin Pull up following revision(s) (requested by mrg in ticket #1679):
sys/compat/sys/ipc.h: revision 1.6
sys/compat/sys/ipc.h: revision 1.7
sys/compat/sys/shm.h: revision 1.8
sys/kern/sysv_shm.c: revision 1.133
sys/compat/sys/sem.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.56
sys/compat/netbsd32/netbsd32_conv.h: revision 1.38
sys/kern/sysv_sem.c: revision 1.96
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.28
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.29
sys/compat/linux32/common/linux32_ipccall.c: revision 1.12
sys/kern/sysv_msg.c: revision 1.73
sys/compat/sys/msg.h: revision 1.6

for sysv ipc stat operations, explicitly copy the exported parts
instead of the whole ds structure.
besides triggering a recently added assert in netbsd32, this stops
exposing kernel addresses.

copy the mode clamping to 0777 from sem to shm and msg.

while here, make sure that the compat callers to sysv_ipc clear
the contents of the compat structure before setting the result
members to ensure padding bytes are cleared.

don't set/copy _sem_base, _msg_first, _msg_last or _shm_internal.
even if used, which seems very dodgy, they leak KVAs as well.
possibly this may affect linux binaries, in particular, the
comments around _shm_internal ("XXX Oh well.") may mean apps
rely upon these but hopefully not -- the comments date back to
rev 1.1 in 1995.

the _key, _seq and _msg_cbytes members are exported as before as
i found multiple consumers of these (no less than ipcs(1), and
they appear to be useful for debugging and more.

XXX: the naming of compat functions have too many styles. there
are at least 3 different ones changed here.

fix naming errors in previous. (this file is no longer compiled, but
this fix makes the pull up more obvious, before deleting this file.)

include libkern.h or strings.h. should fix i386 build issues.
 1.28.4.1.4.1 02-Jan-2019  martin Pull up following revision(s) (requested by maxv in ticket #1668):

sys/compat/netbsd32/netbsd32_conv.h: revision 1.37
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.27
sys/compat/sys/msg.h: revision 1.5

Fix kernel info leaks.

+ Possible info leak: [len=80, leaked=10]
| #0 0xffffffff80bad7a7 in kleak_copyout
| #1 0xffffffff8048e71b in netbsd32___msgctl50
| #2 0xffffffff8022fb5b in netbsd32_syscall
| #3 0xffffffff802096dd in handle_syscall
 1.30.2.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.31.8.5 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1836):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.31.8.4 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1833):

sys/compat/netbsd32/netbsd32_netbsd.c: revision 1.232
sys/compat/netbsd32/netbsd32_socket.c: revision 1.56
sys/compat/netbsd32/netbsd32_conv.h: revision 1.45
sys/compat/netbsd32/netbsd32_fs.c: revision 1.92
sys/compat/netbsd32/netbsd32.h: revision 1.137

The read/write/send/recv system calls return ssize_t because -1 is
returned on error. Therefore we must restrict the lengths of any
buffers to NETBSD32_SSIZE_MAX with compat32 to avoid garbage return
values.

Fixes ATF lib/libc/sys/t_write:write_err.
 1.31.8.3 23-Feb-2019  martin Pull up following revision(s) (requested by mrg in ticket #1195):
sys/compat/sys/ipc.h: revision 1.6
sys/compat/sys/ipc.h: revision 1.7
sys/compat/sys/shm.h: revision 1.8
sys/kern/sysv_shm.c: revision 1.133
sys/compat/sys/sem.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.56
sys/compat/netbsd32/netbsd32_conv.h: revision 1.38
sys/kern/sysv_sem.c: revision 1.96
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.28
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.29
sys/compat/linux32/common/linux32_ipccall.c: revision 1.12
sys/kern/sysv_msg.c: revision 1.73
sys/compat/sys/msg.h: revision 1.6

for sysv ipc stat operations, explicitly copy the exported parts
instead of the whole ds structure.
besides triggering a recently added assert in netbsd32, this stops
exposing kernel addresses.

copy the mode clamping to 0777 from sem to shm and msg.

while here, make sure that the compat callers to sysv_ipc clear
the contents of the compat structure before setting the result
members to ensure padding bytes are cleared.

don't set/copy _sem_base, _msg_first, _msg_last or _shm_internal.
even if used, which seems very dodgy, they leak KVAs as well.
possibly this may affect linux binaries, in particular, the
comments around _shm_internal ("XXX Oh well.") may mean apps
rely upon these but hopefully not -- the comments date back to
rev 1.1 in 1995.

the _key, _seq and _msg_cbytes members are exported as before as
i found multiple consumers of these (no less than ipcs(1), and
they appear to be useful for debugging and more.

XXX: the naming of compat functions have too many styles. there
are at least 3 different ones changed here.

fix naming errors in previous. (this file is no longer compiled, but
this fix makes the pull up more obvious, before deleting this file.)

include libkern.h or strings.h. should fix i386 build issues.
 1.31.8.2 02-Jan-2019  martin Pull up following revision(s) (requested by maxv in ticket #1151):

sys/compat/netbsd32/netbsd32_conv.h: revision 1.37
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.27
sys/compat/sys/msg.h: revision 1.5

Fix kernel info leaks.

+ Possible info leak: [len=80, leaked=10]
| #0 0xffffffff80bad7a7 in kleak_copyout
| #1 0xffffffff8048e71b in netbsd32___msgctl50
| #2 0xffffffff8022fb5b in netbsd32_syscall
| #3 0xffffffff802096dd in handle_syscall
 1.31.8.1 06-Nov-2017  snj Pull up following revision(s) (requested by martin in ticket #339):
sys/compat/netbsd32/netbsd32_conv.h: revision 1.33
PR kern/52681: fix msghdr conversion.
 1.33.2.5 05-Jan-2019  pgoyette Fix typo in previous
 1.33.2.4 03-Jan-2019  pgoyette Bring in some more changes from HEAD.
 1.33.2.3 26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.33.2.2 21-May-2018  pgoyette Sync with HEAD
 1.33.2.1 22-Apr-2018  pgoyette Sync with HEAD
 1.35.2.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.35.2.1 10-Jun-2019  christos Sync with HEAD
 1.38.4.2 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.38.4.1 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1489):

sys/compat/netbsd32/netbsd32_netbsd.c: revision 1.232
sys/compat/netbsd32/netbsd32_socket.c: revision 1.56
sys/compat/netbsd32/netbsd32_conv.h: revision 1.45
sys/compat/netbsd32/netbsd32_fs.c: revision 1.92
sys/compat/netbsd32/netbsd32.h: revision 1.137

The read/write/send/recv system calls return ssize_t because -1 is
returned on error. Therefore we must restrict the lengths of any
buffers to NETBSD32_SSIZE_MAX with compat32 to avoid garbage return
values.

Fixes ATF lib/libc/sys/t_write:write_err.
 1.42.8.1 03-Apr-2021  thorpej Sync with HEAD.
 1.18 08-Nov-2020  rin Fix typo; s/__LP64/_LP64/
 1.17 04-Nov-2020  pgoyette Use opt_execfmt.h to get build options.

Only include elf32 hooks if we have elf32 defined and elf32 is not the
"native" emulation. This allows for having compat_netbsd32 without
elf32 (although it's probably not too useful), and also enables arm's
old-ABI usage of compat_netbsd32.
 1.16 01-Nov-2020  pgoyette Separate the compat_netbsd32_coredump from the compat_netbsd32 and
coredump modules, into its own module.

Welcome to 7.99.75 !!!
 1.15 20-Nov-2019  pgoyette branches: 1.15.8;
Move all non-emulation-specific coredump code into the coredump module,
and remove all #ifdef COREDUMP conditional compilation. Now, the
coredump module is completely separated from the emulation modules, and
they can all be independently loaded and unloaded.

Welcome to 9.99.18 !
 1.14 02-Feb-2011  chuck branches: 1.14.56;
udpate license clauses on my code to match the new-style BSD licenses.
verified with Mike Hibler it is ok to remove clause 3 on utah copyright,
as per UCB.
based on diff that rmind@ sent me.

no functional change with this commit.
 1.13 11-Dec-2005  christos branches: 1.13.100; 1.13.106; 1.13.108;
merge ktrace-lwp.
 1.12 10-Jun-2005  matt Rework the coredump code to have no explicit knownledge of how coredump
i/o is done. Instead, pass an opaque cookie which is then passed to a
new routine, coredump_write, which does the actual i/o. This allows the
method of doing i/o to change without affecting any future MD code.
Also, make netbsd32_core.c [re]use core_netbsd.c (in a similar manner that
core_elf64.c uses core_elf32.c) and eliminate that code duplication.
cpu_coredump{,32} is now called twice, first with a NULL iocookie to fill
the core structure and a second to actually write md parts of the coredump.
All i/o is nolonger random access and is suitable for shipping over a stream.
 1.11 02-Jun-2005  matt When writing coredumps, don't write zero uninstantiated demand-zero pages.
Also, with ELF core dumps, trim trailing zeroes from sections. These two
changes can shrink coredumps by over 50% in size.
 1.10 17-Sep-2004  skrll There's no need to pass a proc value when using UIO_SYSSPACE with
vn_rdwr(9) and uiomove(9).

OK'd by Jason Thorpe
 1.9 15-Sep-2003  christos catch up with latest sigctx changes; reported by John Heasley, thanks!
 1.8 07-Sep-2003  rafal Catch up to Christos' SIGINFO changes.
 1.7 29-Jun-2003  fvdl branches: 1.7.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.6 29-Jun-2003  martin struct proc * -> struct lwp *
 1.5 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.4 10-Dec-2001  thorpej branches: 1.4.2; 1.4.4;
I can't win today -- make this link.
 1.3 10-Dec-2001  thorpej Move the code that walks the process's VM map during a coredump
into uvm_coredump_walkmap(), and use callbacks into the coredump
routine to do something with each section.
 1.2 09-Dec-2001  thorpej Fix compilation problems.
 1.1 08-Dec-2001  thorpej Make the coredump routine exec-format/emulation specific. Split
out traditional NetBSD coredump routines into core_netbsd.c and
netbsd32_core.c (for COMPAT_NETBSD32).
 1.4.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.4.4.1 10-Dec-2001  thorpej file netbsd32_core.c was added on branch kqueue on 2002-01-10 19:51:54 +0000
 1.4.2.3 23-Aug-2002  petrov lwpification.
 1.4.2.2 08-Jan-2002  nathanw Catch up to -current.
 1.4.2.1 10-Dec-2001  nathanw file netbsd32_core.c was added on branch nathanw_sa on 2002-01-08 00:29:08 +0000
 1.7.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.7.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.7.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.7.2.2 26-Aug-2004  skrll Adapt to branch.

sparc64 GENERIC compiles.
 1.7.2.1 03-Aug-2004  skrll Sync with HEAD
 1.13.108.1 08-Feb-2011  bouyer Sync with HEAD
 1.13.106.1 06-Jun-2011  jruoho Sync with HEAD.
 1.13.100.1 05-Mar-2011  rmind sync with head
 1.14.56.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.15.8.1 14-Dec-2020  thorpej Sync w/ HEAD.
 1.4 28-Sep-2019  christos branches: 1.4.8;
fix sign-compare.
 1.3 20-Aug-2019  christos From maxv@:

1) In compat_drm_agp_info(), seems like it should be info64to32.
2) In compat_drm_getstats(), the assignments in the loop are inverted, it's
st32 which should be set to the values of st64, not the other way around.
3) In compat_drm_dma(), again inverted 32<->64, and there is no copyout (?).
4) In compat_drm_agp_enable(), m64 is uninitialized, everything is wrong in
this function it seems.
 1.2 20-Aug-2019  christos add NetBSD copyright.
 1.1 20-Aug-2019  christos compat32 drm ioctl support from Surya Shankar at GSoC 2019
 1.4.8.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.4.8.1 28-Sep-2019  martin file netbsd32_drm.c was added on branch phil-wifi on 2020-04-13 08:04:16 +0000
 1.5 02-Sep-2023  mrg redo previous: use same variable type for the interator as the comparison
 1.4 30-Aug-2023  mrg use unsigned for iterator, fixes -Wsigned-comapre issue in module build.
 1.3 30-Jul-2023  rin netbsd32_epoll_pwait2: Dedup slightly. NFCI.
 1.2 30-Jul-2023  rin netbsd32_epoll_pwait2: Early return if no event arrived;
Do not attempt to allocate 0-byte buffer by kmem_alloc(9).
 1.1 30-Jul-2023  rin COMPAT_NETBSD32: Add support for epoll(2).
 1.14 29-Jul-2023  rin COMPAT_NETBSD32: No need to have compat_100_netbsd32_kevent_fetch_timeout.
NFCI.
 1.13 29-Jul-2023  rin COMPAT_NETBSD32: Catch up with sys___kevent100() addition.

XXX
Add epoll_* and memfd_create.
 1.12 05-Sep-2014  matt Don't use private as a variable name since it's reserved in C++
 1.11 24-Jun-2014  maxv Allocate directly KQ_NEVENTS bytes. Otherwise a user can panic the system.

ok christos@
 1.10 23-Jan-2014  manu branches: 1.10.2;
Fix netbsd32 compatibility bug in kevent()

The keo_put_events() callback copies the events from kernel to userland.
It is called for sets of up to 8 events (constant chosen in kevbuf
definitition in kevent1()). The callback is called with pointer to userland
buffer, count of events to copy, and an index parameter which tracks where
we are in userland buffer when called multiple time.

COMPAT_NETBSD32's flavor of keo_put_events() is netbsd32_kevent_put_events().
It did not honour the index parameter, which caused invalid event data to
be returned when userland requested more that 8 events. This caused many
reliability problems, and the obvious startup crash of dovecot log process
when it accessed udata in the nineth event in its buffer, which was NULL.
 1.9 23-May-2011  joerg branches: 1.9.4; 1.9.10; 1.9.14; 1.9.16; 1.9.18; 1.9.24;
Update from GNU extension to C99 syntax for designated initializer
 1.8 23-Apr-2010  rmind branches: 1.8.2;
Replace M_IOV and some malloc(9)s with kmem(9), and while there:
- Fix invalid free (M_TEMP vs M_IOV) in do_sys_recvmsg(), spotted by jakllsch@.
Also, same fix in osf1_sys_sendmsg_xopen().
- Fix attempt to free non-allocated memory in error path in netbsd32___getfh30().
- Plug a memory leak in compat_43_netbsd32_orecvmsg().
 1.7 11-Jan-2009  christos branches: 1.7.4; 1.7.6;
merge christos-time_t
 1.6 29-Apr-2008  martin branches: 1.6.8; 1.6.14;
Convert to new 2 clause license
 1.5 21-Mar-2008  ad branches: 1.5.2; 1.5.4;
Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
 1.4 20-Dec-2007  dsl branches: 1.4.6;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.3 10-Sep-2007  cube branches: 1.3.8; 1.3.12;
Remove 3rd clause and my name from all the licences which were only in my
name.
 1.2 11-Dec-2005  christos branches: 1.2.18; 1.2.32; 1.2.46; 1.2.48;
merge ktrace-lwp.
 1.1 23-Oct-2005  cube branches: 1.1.4; 1.1.6;
- Split sys_kevent into kevent1 so that it can be used by COMPAT_NETBSD32
code.

- To achieve COMPAT_NETBSD32 compatibility, introduce a parameter to
kevent1 that points to functions that do the actual copyin/copyout
operations. This is similar to what was done in FreeBSD by Paul Saab.

- Add the COMPAT_NETBSD32 definitions and hooks.
 1.1.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.6.1 23-Oct-2005  skrll file netbsd32_event.c was added on branch ktrace-lwp on 2005-11-10 14:01:21 +0000
 1.1.4.2 26-Oct-2005  yamt sync with head
 1.1.4.1 23-Oct-2005  yamt file netbsd32_event.c was added on branch yamt-vop on 2005-10-26 08:32:44 +0000
 1.2.48.2 09-Jan-2008  matt sync with HEAD
 1.2.48.1 06-Nov-2007  matt sync with HEAD
 1.2.46.1 02-Oct-2007  joerg Sync with HEAD.
 1.2.32.1 09-Oct-2007  ad Sync with head.
 1.2.18.5 24-Mar-2008  yamt sync with head.
 1.2.18.4 21-Jan-2008  yamt sync with head
 1.2.18.3 27-Oct-2007  yamt sync with head.
 1.2.18.2 21-Jun-2006  yamt sync with head.
 1.2.18.1 11-Dec-2005  yamt file netbsd32_event.c was added on branch yamt-lazymbuf on 2006-06-21 14:59:35 +0000
 1.3.12.1 02-Jan-2008  bouyer Sync with HEAD
 1.3.8.1 26-Dec-2007  ad Sync with head.
 1.4.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.4.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.4.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.5.4.3 11-Aug-2010  yamt sync with head.
 1.5.4.2 04-May-2009  yamt sync with head.
 1.5.4.1 16-May-2008  yamt sync with head.
 1.5.2.1 18-May-2008  yamt sync with head.
 1.6.14.2 04-Jan-2009  christos add new syscalls.
 1.6.14.1 29-Apr-2008  christos file netbsd32_event.c was added on branch christos-time_t on 2009-01-04 01:56:02 +0000
 1.6.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.7.6.2 31-May-2011  rmind sync with head
 1.7.6.1 30-May-2010  rmind sync with head
 1.7.4.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.8.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.9.24.1 30-Jun-2014  msaitoh Pull up following revision(s) (requested by maxv in ticket #1090):
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.24
sys/compat/netbsd32/netbsd32_event.c: revision 1.11
Allocate directly KQ_NEVENTS bytes. Otherwise a user can panic the system.
ok christos@
 1.9.18.1 18-May-2014  rmind sync with head
 1.9.16.1 30-Jun-2014  msaitoh Pull up following revision(s) (requested by maxv in ticket #1090):
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.24
sys/compat/netbsd32/netbsd32_event.c: revision 1.11
Allocate directly KQ_NEVENTS bytes. Otherwise a user can panic the system.
ok christos@
 1.9.14.2 03-Dec-2017  jdolecek update from HEAD
 1.9.14.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.9.10.2 30-Jun-2014  msaitoh Pull up following revision(s) (requested by maxv in ticket #1090):
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.24
sys/compat/netbsd32/netbsd32_event.c: revision 1.11
Allocate directly KQ_NEVENTS bytes. Otherwise a user can panic the system.
ok christos@
 1.9.10.1 18-Mar-2014  msaitoh Pull up following revision(s) (requested by manu in ticket #1021):
sys/compat/netbsd32/netbsd32_event.c: revision 1.10
Fix netbsd32 compatibility bug in kevent().

The keo_put_events() callback copies the events from kernel to userland.
It is called for sets of up to 8 events (constant chosen in kevbuf
definitition in kevent1()). The callback is called with pointer to
userland buffer, count of events to copy, and an index parameter which tracks
where we are in userland buffer when called multiple time.
COMPAT_NETBSD32's flavor of keo_put_events() is
netbsd32_kevent_put_events(). It did not honour the index parameter, which
caused invalid event data to be returned when userland requested more that 8
events. This caused many reliability problems, and the obvious startup crash
of dovecot log process when it accessed udata in the nineth event in its
buffer, which was NULL.
 1.9.4.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.10.2.1 10-Aug-2014  tls Rebase.
 1.2 29-Jul-2023  rin COMPAT_NETBSD32: No need to have compat_100_netbsd32_kevent_fetch_timeout.
NFCI.
 1.1 29-Jul-2023  rin COMPAT_NETBSD32: Catch up with sys___kevent100() addition.

XXX
Add epoll_* and memfd_create.
 1.27 01-Dec-2000  jdolecek put a.out/elf32 specific things in netbsd32_exec_{aout|elf32}.c
emul_netbsd32 was moved to netbsd32_netbsd.c
g/c netbsd32_exec.c now
 1.26 01-Dec-2000  jdolecek add e_path (emulation path) to struct emul, which replaces emulation-specific
*_emul_path variables

change macros CHECK_ALT_{CREAT|EXIST} to use that, 'root' doesn't need
to be passed explicitly any more and *_CHECK_ALT_{CREAT|EXIST} are removed
change explicit emul_find() calls in probe functions to get the emulation
path from the checked exec switch entry's emulation

remove no longer needed header files

add e_flags and e_syscall to struct emul; these are unsed and empty for now
 1.25 01-Dec-2000  mrg in netbsd32_elf32_probe(), 'pos' is really a pointer to an Elf_Addr, not a
vaddr_t. cast the pointer before dereferencing it to avoid the alignment
fault that broke compat_netbsd32, cuz pos is defined like:
Elf_Addr phdr = 0, pos = 0;
in exec_elf32.c.
 1.24 27-Nov-2000  jdolecek adapt to execsw[] changes
 1.23 21-Nov-2000  jdolecek restructure struct emul and execsw, in preparation to make emulations LKMable:
* move all exec-type specific information from struct emul to execsw[] and
provide single struct emul per emulation
* elf:
- kern/exec_elf32.c:probe_funcs[] is gone, execsw[] how has one entry
per emulation and contains pointer to respective probe function
- interp is allocated via MALLOC() rather than on stack
- elf_args structure is allocated via MALLOC() rather than malloc()
* ecoff: the per-emulation hooks moved from alpha and mips specific code
to OSF1 and Ultrix compat code as appropriate, execsw[] has one entry per
emulation supporting ecoff with appropriate probe function
* the makecmds/probe functions don't set emulation, pointer to emulation is
part of appropriate execsw[] entry
* constify couple of structures
 1.22 13-Nov-2000  jdolecek change the type of *syscallnames[] array to 'const char * const foo[]'
 1.21 28-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.20 06-Jun-2000  soren defopt SYSCALL_DEBUG.
 1.19 11-Apr-2000  chs branches: 1.19.2;
add a new function vn_marktext() for exec code to let others know
that the vnode is now being used as process text.
 1.18 06-Feb-2000  eeh Add support for -current's ELF32 exec format.
 1.17 30-Dec-1999  eeh Update to 32-bit compatibility routines.
 1.16 11-Oct-1999  eeh branches: 1.16.2;
Add netbsd32_compat_14.c

Rename everything from compat_netbsd32 -> netbsd32 so we don't have silly
names like compat_14_compat_netbsd32_sys_shmctl().
 1.15 26-Mar-1999  eeh branches: 1.15.4; 1.15.8;
COMPAT_SPARC32 -> COMPAT_NETBSD32
 1.14 25-Mar-1999  mrg clean and up make compile
 1.13 25-Mar-1999  mrg move sparc32 to netbsd32; split out MD part (signal handling) (mostly via repository copy, rename and perl -pi :-)
 1.12 18-Dec-1998  drochner OMPAT_xxx option review: add missing opt_compat_sunos.h
 1.11 01-Oct-1998  eeh Overhaul. Now will run simple things like /bin/sh and /bin/echo.
 1.10 10-Sep-1998  eeh Use correct 32-bit signal trampoline code in the emul.
 1.9 09-Sep-1998  thorpej Cosmetic changes.
 1.8 09-Sep-1998  thorpej If we don't find a valid magic, return ENOEXEC, not EINVAL.
 1.7 09-Sep-1998  thorpej If we succeed in preparing the exec package, set the package's emulation
to emul_sparc32.
 1.6 09-Sep-1998  thorpej MID_MACHINE -> MID_SPARC
 1.5 06-Sep-1998  eeh Copyout 32-bit args.
 1.4 30-Aug-1998  eeh Some more 64-bit cleanup. Now everything compiles.
 1.3 29-Aug-1998  eeh Some more 64-bit-ification.
 1.2 26-Aug-1998  mrg fake sendsig for now..
 1.1 26-Aug-1998  mrg add a 32-bit compatibility module for the sparc64 port, so it can run NetBSD/sparc binaries with a LP64 kernel.
 1.15.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.15.4.1 04-Jul-1999  chs after setting VTEXT on a vnode, flush any UBC mappings
to try to prevent unnecessary VAC aliases.
 1.16.2.3 08-Dec-2000  bouyer Sync with HEAD.
 1.16.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.16.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.19.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.37 06-Nov-2021  thorpej COMPAT_NETBSD32 is all about running the 32-bit flavor of native
binaries on a 64-bit platform[*], as such:
- Make the logic about which "sendsig" flavor to call MI (as it is in the
native 64-bit environment) and follow the same rules as the native 32-bit
environment.
- Make COMPAT_NETBSD32 x COMPAT_16 work the same as it would in the
native 32-bit environment by providing a netbsd32_sendsig_sigcontext_16_hook,
rather than overriding the entire sendsig logic with a netbsd32_sendsig_hook.
- In netbsd32___sigaction_sigtramp(), make sure the compat_netbsd32_16
module is loaded if the trampoline version specifies a sigcontext style
handler, otherwise return EINVAL so that libc can try again with siginfo
style.

[*] ...except for arm32, which uses it to mean "run 32-bit OABI binaries
from the 32-bit EABI environment". Doing it this way was arguably a mistake,
but we are stuck with it for now, so support it by providing a machine-
dependent override for netbsd32_sendsig() that also disables the corresponding
logic in netbsd32___sigaction_sigtramp().

Fixes PR kern/56487.
 1.36 19-Jan-2021  simonb Whitespace nits.
 1.35 18-Jan-2021  simonb s/u_intN_t/uintN_t/
 1.34 27-Jan-2019  pgoyette branches: 1.34.12;
Merge the [pgoyette-compat] branch
 1.33 25-Jan-2017  jakllsch branches: 1.33.12; 1.33.14;
Catch netbsd32_copyargs() up to changes in r1.441 src/sys/kern/kern_exec.c
 1.32 24-Oct-2014  christos branches: 1.32.2; 1.32.4; 1.32.6;
sync with the regular method; no functional diff
 1.31 10-Dec-2009  matt branches: 1.31.22;
Change u_long to vaddr_t/vsize_t in exec code where appropriate (mostly
involves setregs and vmcmds). Should result in no code differences.
 1.30 15-Aug-2009  matt Include <sys/exec_aout.h> explicitly instead of relying on <sys/exec.h> to
do it for you.
 1.29 15-Mar-2009  cegger ansify function definition
 1.28 19-Nov-2008  ad branches: 1.28.4; 1.28.6;
Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.27 29-May-2008  mrg branches: 1.27.4; 1.27.6;
remove clause #3 from my license where there are no other
copyright holders involved.
 1.26 04-Dec-2007  dsl branches: 1.26.12; 1.26.14; 1.26.16; 1.26.18;
Remove all the __P
 1.25 26-Mar-2007  cube branches: 1.25.8; 1.25.10; 1.25.16; 1.25.18;
Count environment vars with envc, not argc [hi dsl!]. Reported by Nicolas
Joly in private mail.
 1.24 16-Mar-2007  dsl remove all the double (and triple) casts used to convert 32bit userspace
pointers to and from 64bit kernel pointers. Instead use the defines
NETBSD32PTR64(p32) to read a 32bit pointer and (the new) NETBSD32PTR32(p32,p64)
to write a 32bit pointer throughout.
The 32bit pointer is now a struct to enforce the above.
amd64 (with linux emul) and sparc64 will both compile (when the arch stuff
goes in soon), and amd64 still runs some i386 binaries.
 1.23 16-Feb-2006  perry branches: 1.23.20; 1.23.24; 1.23.26; 1.23.28;
Change "inline" back to "__inline" in .h files -- C99 is still too
new, and some apps compile things in C89 mode. C89 keywords stay.

As per core@.
 1.22 24-Dec-2005  perry branches: 1.22.2; 1.22.4; 1.22.6;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.21 11-Dec-2005  christos merge ktrace-lwp.
 1.20 26-Feb-2005  perry branches: 1.20.4;
nuke trailing whitespace
 1.19 26-Mar-2004  drochner branches: 1.19.8; 1.19.10;
all ports define __HAVE_SIGINFO now, so remove the CPP conditionals
 1.18 11-Oct-2003  chs fix typo in previous.
 1.17 10-Oct-2003  matt Define SIGINFO variant of netbsd32_sendsig when __HAVE_SIGINFO is defined.
 1.16 26-Sep-2003  christos bring in MI declarations.
 1.15 29-Jun-2003  fvdl branches: 1.15.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.14 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.13 23-Oct-2002  scw In preparation for COMPAT_NETBSD32 on SH-5:

- The MD netbsd32_machdep.h header now defines the 32-bit pointer type
instead of using u_int32_t everywhere,
- The MD netbsd32_machdep.h header now defines a macro (at least on
current implementations) which converts a 32-bit pointer to its 64-bit
equivalent,
- Change the MI code to utilise the above two items in all the right places,
- Implement netbsd32___sigaction_sigtramp().

Tested on Sparc64 by Matt Green.
 1.12 26-Aug-2002  christos Implement passing AT_{E,R}{U,G}ID in the elf aux vector, like solaris.
- pass struct proc to copyargs.
- eliminate svr4_copyargs, since it is the same as ours now.
 1.11 04-Jun-2002  eeh Prototype for probing noteless 32-bit emulation binaries.
 1.10 25-Aug-2001  mrg branches: 1.10.12;
update copyright notices.
 1.9 29-Jul-2001  christos Adjust to the new copyargs() footprint.
 1.8 02-Feb-2001  mrg branches: 1.8.2; 1.8.4;
de-static netbsd32_exec_aout_prep_[zno]magic().
de-static netbsd32_from_stat43().
move the guts of netbsd32_execve() into netbsd32_execve2().

all of are for the forthcoming sunos32 compat mode (for sparc64).
 1.7 01-Dec-2000  jdolecek make netbsd32_copyargs() an inline
 1.6 27-Nov-2000  jdolecek adapt to execsw[] changes
 1.5 21-Nov-2000  jdolecek restructure struct emul and execsw, in preparation to make emulations LKMable:
* move all exec-type specific information from struct emul to execsw[] and
provide single struct emul per emulation
* elf:
- kern/exec_elf32.c:probe_funcs[] is gone, execsw[] how has one entry
per emulation and contains pointer to respective probe function
- interp is allocated via MALLOC() rather than on stack
- elf_args structure is allocated via MALLOC() rather than malloc()
* ecoff: the per-emulation hooks moved from alpha and mips specific code
to OSF1 and Ultrix compat code as appropriate, execsw[] has one entry per
emulation supporting ecoff with appropriate probe function
* the makecmds/probe functions don't set emulation, pointer to emulation is
part of appropriate execsw[] entry
* constify couple of structures
 1.4 30-Dec-1999  eeh Update to 32-bit compatibility routines.
 1.3 25-Mar-1999  mrg branches: 1.3.8;
SPARC32->NETBSD32
 1.2 25-Mar-1999  mrg move sparc32 to netbsd32; split out MD part (signal handling) (mostly via repository copy, rename and perl -pi :-)
 1.1 26-Aug-1998  mrg add a 32-bit compatibility module for the sparc64 port, so it can run NetBSD/sparc binaries with a LP64 kernel.
 1.3.8.4 11-Feb-2001  bouyer Sync with HEAD.
 1.3.8.3 08-Dec-2000  bouyer Sync with HEAD.
 1.3.8.2 22-Nov-2000  bouyer Sync with HEAD.
 1.3.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.8.4.4 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.8.4.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.8.4.2 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.8.4.1 03-Aug-2001  lukem update to -current
 1.8.2.5 11-Nov-2002  nathanw Catch up to -current
 1.8.2.4 27-Aug-2002  nathanw Catch up to -current.
 1.8.2.3 20-Jun-2002  nathanw Catch up to -current.
 1.8.2.2 21-Sep-2001  nathanw Catch up to -current.
 1.8.2.1 24-Aug-2001  nathanw Catch up with -current.
 1.10.12.2 29-Aug-2002  gehenna catch up with -current.
 1.10.12.1 20-Jun-2002  gehenna catch up with -current.
 1.15.2.6 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.15.2.5 04-Feb-2005  skrll Adapt to branch.
 1.15.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.15.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.15.2.2 03-Aug-2004  skrll Sync with HEAD
 1.15.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.19.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.19.8.1 29-Apr-2005  kent sync with -current
 1.20.4.3 07-Dec-2007  yamt sync with head
 1.20.4.2 03-Sep-2007  yamt sync with head.
 1.20.4.1 21-Jun-2006  yamt sync with head.
 1.22.6.1 22-Apr-2006  simonb Sync with head.
 1.22.4.1 09-Sep-2006  rpaulo sync with head
 1.22.2.1 18-Feb-2006  yamt sync with head.
 1.23.28.2 29-Mar-2007  reinoud Pullup to -current
 1.23.28.1 18-Mar-2007  reinoud First attempt to bring branch in sync with HEAD
 1.23.26.1 11-Jul-2007  mjf Sync with head.
 1.23.24.1 10-Apr-2007  ad Sync with head.
 1.23.20.2 15-Apr-2007  yamt sync with head.
 1.23.20.1 24-Mar-2007  yamt sync with head.
 1.25.18.1 08-Dec-2007  ad Sync with head.
 1.25.16.1 08-Dec-2007  mjf Sync with HEAD.
 1.25.10.1 09-Jan-2008  matt sync with HEAD
 1.25.8.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.26.18.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.26.16.3 11-Mar-2010  yamt sync with head
 1.26.16.2 19-Aug-2009  yamt sync with head.
 1.26.16.1 04-May-2009  yamt sync with head.
 1.26.14.1 04-Jun-2008  yamt sync with head
 1.26.12.2 17-Jan-2009  mjf Sync with HEAD.
 1.26.12.1 02-Jun-2008  mjf Sync with HEAD.
 1.27.6.2 28-Apr-2009  skrll Sync with HEAD.
 1.27.6.1 19-Jan-2009  skrll Sync with HEAD.
 1.27.4.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.28.6.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.28.4.2 19-Nov-2008  ad Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.28.4.1 19-Nov-2008  ad file netbsd32_exec.h was added on branch christos-time_t on 2008-11-19 18:36:06 +0000
 1.31.22.1 03-Dec-2017  jdolecek update from HEAD
 1.32.6.1 21-Apr-2017  bouyer Sync with HEAD
 1.32.4.1 20-Mar-2017  pgoyette Sync with HEAD
 1.32.2.1 05-Feb-2017  skrll Sync with HEAD
 1.33.14.1 10-Jun-2019  christos Sync with HEAD
 1.33.12.1 11-Sep-2018  pgoyette Put the ``extern struct emul'' into the netbsd32_netbsd.h header
so it doesn't have to be separately declared in each source file.

Thanks mrg@
 1.34.12.1 03-Apr-2021  thorpej Sync with HEAD.
 1.31 19-Jan-2021  simonb KNF consistency: No parentheses are needed around the return value.
 1.30 06-Aug-2016  maxv branches: 1.30.28;
The way the kernel tries to prevent a userland process from allocating page
zero is hugely flawed. It is easy to demonstrate that one can trick UVM
into chosing a NULL hint after the user_va0_disable check from uvm_map.
Such a bypass allows kernel NULL pointer dereferences to be exploitable on
architectures with a shared userland<->kernel VA, like amd64.

Fix this by increasing the limit of the vm space made available for
userland processes. This way, UVM will never chose a NULL hint, since it
would be outside of the vm space.

The user_va0_disable sysctl still controls this feature.
 1.29 05-Dec-2014  christos Add compatibility for pre MIDMAGIC a.out binaries (with COMPAT_NOMID)
Oldzmagic binaries need "sysctl -w vm.user_va0_disable=0"
 1.28 24-Oct-2014  christos branches: 1.28.2;
remove unused prototypes
 1.27 25-Jan-2014  christos Clear the VM_TOPDOWN flag only when we succeed.
 1.26 25-Jan-2014  christos a.out binaries can't handle topdown.
Now 1.0 binaries work correctly on NetBSD-current.
 1.25 23-Apr-2010  rmind branches: 1.25.8; 1.25.18; 1.25.22;
Replace M_IOV and some malloc(9)s with kmem(9), and while there:
- Fix invalid free (M_TEMP vs M_IOV) in do_sys_recvmsg(), spotted by jakllsch@.
Also, same fix in osf1_sys_sendmsg_xopen().
- Fix attempt to free non-allocated memory in error path in netbsd32___getfh30().
- Plug a memory leak in compat_43_netbsd32_orecvmsg().
 1.24 29-May-2008  mrg branches: 1.24.12; 1.24.20; 1.24.22;
remove clause #3 from my license where there are no other
copyright holders involved.
 1.23 08-Dec-2007  dsl branches: 1.23.12; 1.23.14; 1.23.16; 1.23.18;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.22 04-Dec-2007  dsl Remove all the __P
 1.21 11-Dec-2005  christos branches: 1.21.44; 1.21.46; 1.21.52; 1.21.56;
merge ktrace-lwp.
 1.20 26-Feb-2005  perry branches: 1.20.4;
nuke trailing whitespace
 1.19 20-Feb-2004  drochner branches: 1.19.8; 1.19.10;
did this ever work? The EXEC_32 flag must be set _before_
exec_aout_prep_*magic(), otherwise setup_stack() fails.
 1.18 20-Feb-2004  drochner -MID_SPARC->NETBSD32_MID_MACHINE
-check for zero BSS size, as in kern/exec_aout.c rev. 1.23
 1.17 13-Oct-2003  agc Move Matt Green's code from a 4-clause to a 3-clause licence by removing
the advertising clause. Diffs provided in PR 22396 by Joel Baker, the changes
were confirmed to the board by Matt Green.
 1.16 08-Aug-2003  christos - GC all the setup_stack functions
- add one for linux/i386
 1.15 29-Jun-2003  fvdl branches: 1.15.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.14 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.13 01-Apr-2003  thorpej Use PAGE_SIZE rather than NBPG.
 1.12 10-Dec-2002  thorpej Rename __LDPGSZ to AOUT_LDPGSZ, to accurately reflect what it is.
 1.11 10-Dec-2002  thorpej Use __LDPGSZ (which must be == USRTEXT) as the text address for a.out
executables, and eliminate the USRTEXT constant, which was only used
by the a.out exec code.
 1.10 05-Oct-2002  chs count executable image pages as executable for vm-usage purposes.
also, always do the VTEXT vs. v_writecount mutual exclusion
(which we previously skipped if the text or data segment was empty).
 1.9 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.8 13-Nov-2001  lukem branches: 1.8.10;
add RCSIDs (including regeneration of files as appropriate)
 1.7 30-Oct-2001  thorpej - Add a new vnode flag VEXECMAP, which indicates that a vnode has
executable mappings. Stop overloading VTEXT for this purpose (VTEXT
also has another meaning).
- Rename vn_marktext() to vn_markexec(), and use it when executable
mappings of a vnode are established.
- In places where we want to set VTEXT, set it in v_flag directly, rather
than making a function call to do this (it no longer makes sense to
use a function call, since we no longer overload VTEXT with VEXECMAP's
meaning).

VEXECMAP suggested by Chuq Silvers.
 1.6 25-Aug-2001  mrg branches: 1.6.4;
update copyright notices.
 1.5 14-Feb-2001  eeh branches: 1.5.2; 1.5.4;
Support flexible process address space limits and bump kernel version number.
 1.4 03-Feb-2001  mrg s/sizeof(struct exec)/sizeof(struct netbsd32_exec)/ when calculating file offsets. now sunos32 nmagic/omagic work.
 1.3 02-Feb-2001  mrg de-static netbsd32_exec_aout_prep_[zno]magic().
de-static netbsd32_from_stat43().
move the guts of netbsd32_execve() into netbsd32_execve2().

all of are for the forthcoming sunos32 compat mode (for sparc64).
 1.2 18-Dec-2000  mrg copy exec_aout.c:exec_aout_setup_stack to netbsd32_exec_aout_setup_stack,
but use USRSTACK32 not USRSTACK, so that we get 32-bit stack addresses.

now 32 bit a.out binaries work on sparc64.
 1.1 01-Dec-2000  jdolecek branches: 1.1.2;
put a.out/elf32 specific things in netbsd32_exec_{aout|elf32}.c
emul_netbsd32 was moved to netbsd32_netbsd.c
g/c netbsd32_exec.c now
 1.1.2.5 12-Mar-2001  bouyer Sync with HEAD.
 1.1.2.4 11-Feb-2001  bouyer Sync with HEAD.
 1.1.2.3 05-Jan-2001  bouyer Sync with HEAD
 1.1.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.1.2.1 01-Dec-2000  bouyer file netbsd32_exec_aout.c was added on branch thorpej_scsipi on 2000-12-08 09:08:34 +0000
 1.5.4.3 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.5.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.5.4.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.5.2.4 11-Dec-2002  thorpej Sync with HEAD.
 1.5.2.3 18-Oct-2002  nathanw Catch up to -current.
 1.5.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.5.2.1 21-Sep-2001  nathanw Catch up to -current.
 1.6.4.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.8.10.2 02-Oct-2003  tron Pull up revision 1.10 (requested by junyoung in ticket #1488):
count executable image pages as executable for vm-usage purposes.
also, always do the VTEXT vs. v_writecount mutual exclusion
(which we previously skipped if the text or data segment was empty).
 1.8.10.1 27-Sep-2003  tron Pull up revision 1.9 (requested by junyoung in ticket #1466):
remove trailing \n in panic(). approved perry.
 1.15.2.6 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.15.2.5 04-Feb-2005  skrll Adapt to branch.
 1.15.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.15.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.15.2.2 03-Aug-2004  skrll Sync with HEAD
 1.15.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.19.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.19.8.1 29-Apr-2005  kent sync with -current
 1.20.4.3 21-Jan-2008  yamt sync with head
 1.20.4.2 07-Dec-2007  yamt sync with head
 1.20.4.1 21-Jun-2006  yamt sync with head.
 1.21.56.2 26-Dec-2007  ad Sync with head.
 1.21.56.1 08-Dec-2007  ad Sync with head.
 1.21.52.2 27-Dec-2007  mjf Sync with HEAD.
 1.21.52.1 08-Dec-2007  mjf Sync with HEAD.
 1.21.46.1 09-Jan-2008  matt sync with HEAD
 1.21.44.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.23.18.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.23.16.2 11-Aug-2010  yamt sync with head.
 1.23.16.1 04-May-2009  yamt sync with head.
 1.23.14.1 04-Jun-2008  yamt sync with head
 1.23.12.1 02-Jun-2008  mjf Sync with HEAD.
 1.24.22.1 30-May-2010  rmind sync with head
 1.24.20.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.24.12.2 29-May-2008  mrg remove clause #3 from my license where there are no other
copyright holders involved.
 1.24.12.1 29-May-2008  mrg file netbsd32_exec_aout.c was added on branch christos-time_t on 2008-05-29 14:51:27 +0000
 1.25.22.1 18-May-2014  rmind sync with head
 1.25.18.2 03-Dec-2017  jdolecek update from HEAD
 1.25.18.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.25.8.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.28.2.2 05-Oct-2016  skrll Sync with HEAD
 1.28.2.1 06-Apr-2015  skrll Sync with HEAD
 1.30.28.1 03-Apr-2021  thorpej Sync with HEAD.
 1.45 07-Jun-2019  christos deduplicate the elf auxv builder code, welcome to 8.99.43
 1.44 07-Jun-2019  christos Sync auxv vector generation with exec_elf.c. Fixes $ORIGIN on compat_netbsd32.
Found by zerous as part of GSoC
 1.43 01-Mar-2019  pgoyette Rename the MODULE_*_HOOK() macros to MODULE_HOOK_*() as briefly
discussed on irc.

NFCI intended.

Ride the earlier kernel bump - it;s getting crowded.
 1.42 26-Feb-2019  rin Push AT_STACKBASE. Otherwise, pthread_attr_getstack(3) cannot
find the stack address for initial thread (LID 1).

Now, rust for i386 and armv7 work on amd64 and aarch64,
respectively.
 1.41 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.40 06-Aug-2016  maxv branches: 1.40.14; 1.40.16;
The way the kernel tries to prevent a userland process from allocating page
zero is hugely flawed. It is easy to demonstrate that one can trick UVM
into chosing a NULL hint after the user_va0_disable check from uvm_map.
Such a bypass allows kernel NULL pointer dereferences to be exploitable on
architectures with a shared userland<->kernel VA, like amd64.

Fix this by increasing the limit of the vm space made available for
userland processes. This way, UVM will never chose a NULL hint, since it
would be outside of the vm space.

The user_va0_disable sysctl still controls this feature.
 1.39 20-Mar-2015  maxv Zero-fill the ELF auxiliary vectors. Otherwise, on 64bit systems, the
padding between a_v and a_type contains kernel garbage, therefore
exposed to userland.

Original report by uebayasi@
 1.38 24-Oct-2014  christos branches: 1.38.2;
remove unused prototypes
 1.37 25-Jul-2014  maxv branches: 1.37.2;
Remove ELF_ROUND and ELF_TRUNC (unused). Found by my code scanner.
 1.36 03-Aug-2012  matt branches: 1.36.2; 1.36.12;
Only set EXEC_32 if on LP64 platform.
 1.35 03-Feb-2012  matt Add a hook for freeing an ep_emul_arg. Add a wrapper routine
(exec_free_emul_arg) to call the hook and then clear the ep_emul_arg
and ep_emul_arg_free members in the exec_package.
Change users/accessors to use these routines.
Approved by releng.
 1.34 03-Feb-2012  christos elf_args needs to be freed with kmem_free() since it is now allocated with
kmem_alloc(). Should fix running 32 bit elf binaries.
 1.33 07-Mar-2011  joerg branches: 1.33.4; 1.33.8;
Pass down ELF Auxillary Vectors for static NetBSD binaries too.
Rename __libc_init to _libc_init and call it explicitly from CSU code.
This enforces the constructor run order for newly linked programs.
Keep it as constructor with run-once semantic for binary compatibility.
Implement dl_iterate_phdr for statically linked programs.

This material is based upon work partially supported by
The NetBSD Foundation under a contract with Joerg Sonnenberger.
 1.32 14-Dec-2009  mrg branches: 1.32.4; 1.32.6;
replace mips:elf_check_itp() and ELFNAME2(netbsd32,probe_noteless) that
it's based upon with a common compat_elf_check_interp().

tested on MALTA64 and sparc64.
 1.31 14-Dec-2009  matt Merge from matt-nb5-mips64
 1.30 29-Jun-2009  dholland Convert 67 namei call sites to use namei_simple, in these functions:

check_console, veriexecclose, veriexec_delete, veriexec_file_add,
emul_find_root, coff_load_shlib (sh3 version), coff_load_shlib,
compat_20_sys_statfs, compat_20_netbsd32_statfs,
ELFNAME2(netbsd32,probe_noteless), darwin_sys_statfs,
ibcs2_sys_statfs, ibcs2_sys_statvfs, linux_sys_uselib,
osf1_sys_statfs, sunos_sys_statfs, sunos32_sys_statfs,
ultrix_sys_statfs, do_sys_mount, fss_create_files (3 of 4),
adosfs_mount, cd9660_mount, coda_ioctl, coda_mount, ext2fs_mount,
ffs_mount, filecore_mount, hfs_mount, lfs_mount, msdosfs_mount,
ntfs_mount, sysvbfs_mount, udf_mount, union_mount, sys_chflags,
sys_lchflags, sys_chmod, sys_lchmod, sys_chown, sys_lchown,
sys___posix_chown, sys___posix_lchown, sys_link, do_sys_pstatvfs,
sys_quotactl, sys_revoke, sys_truncate, do_sys_utimes, sys_extattrctl,
sys_extattr_set_file, sys_extattr_set_link, sys_extattr_get_file,
sys_extattr_get_link, sys_extattr_delete_file,
sys_extattr_delete_link, sys_extattr_list_file, sys_extattr_list_link,
sys_setxattr, sys_lsetxattr, sys_getxattr, sys_lgetxattr,
sys_listxattr, sys_llistxattr, sys_removexattr, sys_lremovexattr

All have been scrutinized (several times, in fact) and compile-tested,
but not all have been explicitly tested in action.

XXX: While I haven't (intentionally) changed the use or nonuse of
XXX: TRYEMULROOT in any of these places, I'm not convinced all the
XXX: uses are correct; an audit might be desirable.
 1.29 26-Oct-2008  mrg branches: 1.29.8; 1.29.10; 1.29.14;
if the interpreter is literally "/usr/libexec/ld.elf_so" or
"/libexec/ld.elf_so", try <path>-<machine32arch>.
 1.28 29-May-2008  mrg branches: 1.28.4;
remove clause #3 from my license where there are no other
copyright holders involved.
 1.27 22-Apr-2007  dsl branches: 1.27.28; 1.27.30; 1.27.32; 1.27.34;
Change the way that emulations locate files within the emulation root to
avoid having to allocate space in the 'stackgap'
- which is very LWP unfriendly.
The additional code for non-emulation namei() is trivial, the reduction for
the emulations is massive.
The vnode for a processes emulation root is saved in the cwdi structure
during process exec.
If the emulation root the TRYEMULROOT flag are set, namei() will do an initial
search for absolute pathnames in the emulation root, if that fails it will
retry from the normal root.
".." at the emulation root will always go to the real root, even in the middle
of paths and when expanding symlinks.
Absolute symlinks found using absolute paths in the emulation root will be
relative to the emulation root (so /usr/lib/xxx.so -> /lib/xxx.so links
inside the emulation root don't need changing).
If the root of the emulation would be returned (for an emulation lookup), then
the real root is returned instead (matching the behaviour of emul_lookup,
but being a cheap comparison here) so that programs that scan "../.."
looking for the root dircetory don't loop forever.
The target for symbolic links is no longer mangled (it used to get the
CHECK_ALT_xxx() treatment, so could get /emul/xxx prepended).
CHECK_ALT_xxx() are no more. Most of the change is deleting them, and adding
TRYEMULROOT to the flags to NDINIT().
A lot of the emulation system call stubs could now be deleted.
 1.26 23-Jul-2006  ad branches: 1.26.10; 1.26.14; 1.26.16;
Use the LWP cached credentials where sane.
 1.25 14-May-2006  elad integrate kauth.
 1.24 27-Dec-2005  cube branches: 1.24.4; 1.24.6; 1.24.8; 1.24.10; 1.24.12;
More ktrace-lwp merge fallout: netbsd_elf32_signature's prototype has
changed. Too bad C doesn't have signatures in symbols.

Fixes PR#32388 by Nicolas Joly.
 1.23 11-Dec-2005  christos merge ktrace-lwp.
 1.22 26-Feb-2005  perry branches: 1.22.4;
nuke trailing whitespace
 1.21 31-Oct-2003  drochner branches: 1.21.8; 1.21.10;
adapt for changes to kern/exec_elf32.c
 1.20 13-Oct-2003  agc Move Matt Green's code from a 4-clause to a 3-clause licence by removing
the advertising clause. Diffs provided in PR 22396 by Joel Baker, the changes
were confirmed to the board by Matt Green.
 1.19 29-Jun-2003  fvdl branches: 1.19.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.18 29-Jun-2003  martin struct proc * -> struct lwp *
 1.17 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.16 01-Apr-2003  thorpej Use PAGE_SIZE rather than NBPG.
 1.15 01-Dec-2002  agc Make this compile in the presence of -Werror
 1.14 29-Nov-2002  jdolecek use emul_find_interp(), rathern than calling emul_find() second time
with prefix set to "/"
XXX not tested
 1.13 29-Aug-2002  martin Adapt to recent exec changes.
 1.12 29-Aug-2002  christos s/au_/a_/g noticed by martin
 1.11 26-Aug-2002  christos Implement passing AT_{E,R}{U,G}ID in the elf aux vector, like solaris.
- pass struct proc to copyargs.
- eliminate svr4_copyargs, since it is the same as ours now.
 1.10 01-Jun-2002  fvdl Make this compile again since the previous change. KNF.
 1.9 31-May-2002  eeh Support chroot-ing to a 32-bit installation.
 1.8 13-Nov-2001  lukem branches: 1.8.8;
add RCSIDs (including regeneration of files as appropriate)
 1.7 25-Aug-2001  mrg update copyright notices.
 1.6 30-Jul-2001  eeh Add missing `error'.
 1.5 29-Jul-2001  christos Adjust to the new copyargs() footprint.
 1.4 14-Feb-2001  eeh branches: 1.4.2; 1.4.4;
Support flexible process address space limits and bump kernel version number.
 1.3 11-Feb-2001  eeh Don't play fast and loose with pointers.
 1.2 02-Dec-2000  mrg branches: 1.2.2;
pull over lost fix from nebsd32_exec.c:
>revision 1.25
>date: 2000/12/01 08:59:02; author: mrg; state: Exp; lines: +2 -2
>in netbsd32_elf32_probe(), 'pos' is really a pointer to an Elf_Addr, not a
>vaddr_t. cast the pointer before dereferencing it to avoid the alignment
>fault that broke compat_netbsd32, cuz pos is defined like:
> Elf_Addr phdr = 0, pos = 0;
>in exec_elf32.c.
 1.1 01-Dec-2000  jdolecek put a.out/elf32 specific things in netbsd32_exec_{aout|elf32}.c
emul_netbsd32 was moved to netbsd32_netbsd.c
g/c netbsd32_exec.c now
 1.2.2.4 12-Mar-2001  bouyer Sync with HEAD.
 1.2.2.3 11-Feb-2001  bouyer Sync with HEAD.
 1.2.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.2.2.1 02-Dec-2000  bouyer file netbsd32_exec_elf32.c was added on branch thorpej_scsipi on 2000-12-08 09:08:34 +0000
 1.4.4.5 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.4.4.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.4.4.3 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.4.4.2 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.4.4.1 03-Aug-2001  lukem update to -current
 1.4.2.7 11-Dec-2002  thorpej Sync with HEAD.
 1.4.2.6 05-Sep-2002  petrov Catch up with -current.
 1.4.2.5 27-Aug-2002  nathanw Catch up to -current.
 1.4.2.4 20-Jun-2002  nathanw Catch up to -current.
 1.4.2.3 14-Nov-2001  nathanw Catch up to -current.
 1.4.2.2 21-Sep-2001  nathanw Catch up to -current.
 1.4.2.1 24-Aug-2001  nathanw Catch up with -current.
 1.8.8.3 31-Aug-2002  gehenna catch up with -current.
 1.8.8.2 29-Aug-2002  gehenna catch up with -current.
 1.8.8.1 20-Jun-2002  gehenna catch up with -current.
 1.19.2.6 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.19.2.5 21-Sep-2004  skrll Fix the sync with head I botched.
 1.19.2.4 18-Sep-2004  skrll Sync with HEAD.
 1.19.2.3 26-Aug-2004  skrll Adapt to branch.

sparc64 GENERIC compiles.
 1.19.2.2 03-Aug-2004  skrll Sync with HEAD
 1.19.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.21.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.21.8.1 29-Apr-2005  kent sync with -current
 1.22.4.3 03-Sep-2007  yamt sync with head.
 1.22.4.2 30-Dec-2006  yamt sync with head.
 1.22.4.1 21-Jun-2006  yamt sync with head.
 1.24.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.24.10.2 12-May-2006  elad include sys/kauth.h where appropriate.
 1.24.10.1 08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.24.8.2 11-Aug-2006  yamt sync with head
 1.24.8.1 24-May-2006  yamt sync with head.
 1.24.6.1 01-Jun-2006  kardel Sync with head.
 1.24.4.1 09-Sep-2006  rpaulo sync with head
 1.26.16.1 11-Jul-2007  mjf Sync with head.
 1.26.14.1 27-May-2007  ad Sync with head.
 1.26.10.1 07-May-2007  yamt sync with head.
 1.27.34.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.27.32.3 11-Mar-2010  yamt sync with head
 1.27.32.2 18-Jul-2009  yamt sync with head.
 1.27.32.1 04-May-2009  yamt sync with head.
 1.27.30.1 04-Jun-2008  yamt sync with head
 1.27.28.2 17-Jan-2009  mjf Sync with HEAD.
 1.27.28.1 02-Jun-2008  mjf Sync with HEAD.
 1.28.4.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.29.14.2 14-Dec-2009  mrg pullup from -current:
>replace mips:elf_check_itp() and ELFNAME2(netbsd32,probe_noteless) that
>it's based upon with a common compat_elf_check_interp().
>
>tested on MALTA64 and sparc64.
 1.29.14.1 12-Sep-2009  matt Add support/hooks for ELF_MD_PROBE_FUNC and ELF_INTERP_NON_RELOCATABLE.
 1.29.10.1 23-Jul-2009  jym Sync with HEAD.
 1.29.8.2 26-Oct-2008  mrg if the interpreter is literally "/usr/libexec/ld.elf_so" or
"/libexec/ld.elf_so", try <path>-<machine32arch>.
 1.29.8.1 26-Oct-2008  mrg file netbsd32_exec_elf32.c was added on branch christos-time_t on 2008-10-26 07:07:36 +0000
 1.32.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.32.4.1 21-Apr-2011  rmind sync with head
 1.33.8.1 18-Feb-2012  mrg merge to -current.
 1.33.4.2 30-Oct-2012  yamt sync with head
 1.33.4.1 17-Apr-2012  yamt sync with head
 1.36.12.1 10-Aug-2014  tls Rebase.
 1.36.2.2 03-Dec-2017  jdolecek update from HEAD
 1.36.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.37.2.1 29-Mar-2015  martin Pull up following revision(s) (requested by maxv in ticket #650):
sys/compat/netbsd32/netbsd32_exec_elf32.c: revision 1.39
sys/kern/exec_elf.c: revision 1.71
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.18
sys/compat/linux/common/linux_exec_elf32.c: revision 1.92
sys/compat/svr4_32/svr4_32_exec_elf32.c: revision 1.24
Zero-fill the ELF auxiliary vectors. Otherwise, on 64bit systems, the
padding between a_v and a_type contains kernel garbage, therefore
exposed to userland.
Original report by uebayasi@
 1.38.2.2 05-Oct-2016  skrll Sync with HEAD
 1.38.2.1 06-Apr-2015  skrll Sync with HEAD
 1.40.16.1 10-Jun-2019  christos Sync with HEAD
 1.40.14.2 24-Jan-2019  pgoyette Use correct macro name
 1.40.14.1 24-Jan-2019  pgoyette Found a couple other consumers of machine32 - adapt them to use the hook
 1.44 11-Nov-2021  martin Adapt to recent posix_spawn extensions.
 1.43 13-Apr-2021  mrg GCC 10 does not like casting from one identical anonymous enum
to another enum. supply some quietening cast.
 1.42 19-Apr-2020  thorpej branches: 1.42.4;
- Only increment nprocs when we're creating a new process, not just
when allocating a PID.
- Per above, proc_free_pid() no longer decrements nprocs. It's now done
in proc_free() right after proc_free_pid().
- Ensure nprocs is accessed using atomics everywhere.
 1.41 17-Sep-2019  christos branches: 1.41.6;
Add a boolean argument to indicate if we have a path/true (execve) or an
fd/false (fexecve). This is needed to differentiate between them because
NULL/-1 can be readily passed from userland.
 1.40 15-Sep-2019  christos fix fexecve
 1.39 03-Sep-2018  riastradh Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.38 02-Feb-2014  martin branches: 1.38.28; 1.38.30;
Limit the amount of kernel memory a posix_spawn syscall can use (for handling
the file action list) by limiting the maximum number of file actions to
twice the current file descriptor limit.
Fix a few bugs in the support functions and document the new limit.
From Maxime Villard.
 1.37 15-Jan-2013  hannken branches: 1.37.2;
netbsd32_posix_spawn_fa_alloc: use the right length for path allocation.

This error lead to memory pool corruption when freeing kmem with wrong size.
 1.36 02-May-2012  rmind branches: 1.36.2;
Revert posix_spawn() clean up for now, there are some bugs.
 1.35 30-Apr-2012  rmind posix_spawn:
- Remove copy-pasting in error paths, use execve_free_{vmspace,data}().
- Move some code (both in the init and exit paths) out of the locks.
- Slightly simplify do_posix_spawn() callers.
- Add few asserts and comments.
 1.34 08-Apr-2012  martin Rework posix_spawn locking and memory management:
- always provide a vmspace for the new proc, initially borrowing from proc0
(this part fixes PR 46286)
- increase parallelism between parent and child if arguments allow this,
avoiding a potential deadlock on exec_lock
- add a new flag for userland to request old (lockstepped) behaviour for
better error reporting
- adapt test cases to the previous two and add a new variant to test the
diagnostics flag
- fix a few memory (and lock) leaks
- provide netbsd32 compat
 1.33 31-Jan-2012  matt branches: 1.33.2;
Add missing *at syscalls among others
 1.32 29-May-2008  mrg branches: 1.32.12; 1.32.34; 1.32.38;
remove clause #3 from my license where there are no other
copyright holders involved.
 1.31 20-Dec-2007  dsl branches: 1.31.6; 1.31.8; 1.31.10; 1.31.12;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.30 22-Apr-2007  dsl branches: 1.30.8; 1.30.16; 1.30.20;
Change the way that emulations locate files within the emulation root to
avoid having to allocate space in the 'stackgap'
- which is very LWP unfriendly.
The additional code for non-emulation namei() is trivial, the reduction for
the emulations is massive.
The vnode for a processes emulation root is saved in the cwdi structure
during process exec.
If the emulation root the TRYEMULROOT flag are set, namei() will do an initial
search for absolute pathnames in the emulation root, if that fails it will
retry from the normal root.
".." at the emulation root will always go to the real root, even in the middle
of paths and when expanding symlinks.
Absolute symlinks found using absolute paths in the emulation root will be
relative to the emulation root (so /usr/lib/xxx.so -> /lib/xxx.so links
inside the emulation root don't need changing).
If the root of the emulation would be returned (for an emulation lookup), then
the real root is returned instead (matching the behaviour of emul_lookup,
but being a cheap comparison here) so that programs that scan "../.."
looking for the root dircetory don't loop forever.
The target for symbolic links is no longer mangled (it used to get the
CHECK_ALT_xxx() treatment, so could get /emul/xxx prepended).
CHECK_ALT_xxx() are no more. Most of the change is deleting them, and adding
TRYEMULROOT to the flags to NDINIT().
A lot of the emulation system call stubs could now be deleted.
 1.29 18-Mar-2007  dsl Change all the NETBSD32PTR64(SCARG(uap, xxx))) to SCARG_P32(uap, xxx).
 1.28 04-Mar-2007  christos branches: 1.28.2; 1.28.4; 1.28.6;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.27 09-Feb-2007  ad branches: 1.27.2;
Merge newlock2 to head.
 1.26 07-Mar-2006  thorpej branches: 1.26.2; 1.26.12;
Clean up fallout proc_is_traced_p() change:
- proc_is_traced_p() -> trace_is_enabled(), to match trace_enter() and
trace_exit().
- trace_is_enabled() becomes a real function.
- Remove unnecessary include files from various files that used to care
about KTRACE and SYSTRACE, but do no more.
 1.25 11-Dec-2005  christos branches: 1.25.4; 1.25.6; 1.25.8;
merge ktrace-lwp.
 1.24 13-Jul-2005  cube Do the CHECK_ALT_EXIST dance again in netbsd32_execve(). It was lost in
previous commit.
 1.23 11-Jul-2005  cube Split sys_execve() and add execve1() that does most of the work, and takes
as an argument a function that will retrieve an element of the pointer
arrays in user space. This allows COMPAT_NETBSD32 to share the code for
the emulated version of execve(2), and fixes various issues that came from
the slow drift between the two implementations.

Note: when splitting up a syscall function, I'll use two different ways
of naming the resulting helper function. If it stills does
copyin/out operations, it will be named <syscall>1(). If it does
not (as it was the case for get/setitimer), it will be named
do<syscall>.
 1.22 31-May-2005  christos branches: 1.22.2;
- add const
- avoid shadowed variables.
 1.21 19-May-2005  elad Some changes in veriexec.

New features:

- Add a veriexec_report() routine to make most reporting consistent and
remove some common code.
- Add 'strict' mode that controls how veriexec behaves.
- Add sysctl knobs:
o kern.veriexec.verbose controls verbosity levels. Value: 0, 1.
o kern.veriexec.strict controls strict level. Values: 0, 1, 2. See
documentation in sysctl(3) for details.
o kern.veriexec.algorithms returns a string with a space separated
list of supported hashing algorithms in veriexec.
- Updated documentation in man pages for sysctl(3) and sysctl(8).

Bug fixes:

- veriexec_removechk(): Code cleanup + handle FINGERPRINT_NOTEVAL
correctly.
- exec_script(): Don't pass 0 as flag when executing a script; use the
defined VERIEXEC_INDIRECT - which is 1. Makes indirect execution
enforcement work.
- Fix some printing formats and types..
 1.20 01-Apr-2005  yamt merge yamt-km branch.
- don't use managed mappings/backing objects for wired memory allocations.
save some resources like pv_entry. also fix (most of) PR/27030.
- simplify kernel memory management API.
- simplify pmap bootstrap of some ports.
- some related cleanups.
 1.19 26-Feb-2005  perry branches: 1.19.2;
nuke trailing whitespace
 1.18 25-Feb-2004  drochner branches: 1.18.8; 1.18.10;
allow to start other emulations (eg native code)
from here: set p_execsw to the new thing, and call
the new emulation's syscall_intern()

XXX there are more differences to kern_exec.c, sa/ras
related afaics, this is harmliss for now since
netbsd32 doesn't support multithreaded programs yet --
one day one execve() implementation should be shared
by native and netbsd32 code.
 1.17 29-Jun-2003  fvdl branches: 1.17.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.16 29-Jun-2003  martin struct proc * -> struct lwp *
 1.15 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.14 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.13 16-Sep-2002  martin branches: 1.13.2;
p->p_sigacts -> p->p_sigctx
 1.12 26-Aug-2002  christos Implement passing AT_{E,R}{U,G}ID in the elf aux vector, like solaris.
- pass struct proc to copyargs.
- eliminate svr4_copyargs, since it is the same as ours now.
 1.11 25-Aug-2002  thorpej Fix some signed/unsigned comparison warnings from GCC 3.3.
 1.10 06-Jun-2002  fvdl Fix wrong psstr computation.
(XXX why is there an entire copy of sys_execve here?)
 1.9 22-Mar-2002  jdolecek branches: 1.9.2; 1.9.4;
invoke setregs hooks correctly, as in sys_execve()
Problem noted and fix tested by Eduardo Horvath
 1.8 16-Mar-2002  christos make the stackgap_{init,alloc} functions MP friendly (i.e. pass struct proc *
in, instead of using curproc). While there add an optional size argument to
stackgap_init.
 1.7 23-Nov-2001  jdolecek branches: 1.7.4;
if the LKM support is not compiled in, don't bother using exec_lock
at all, it's only needed in LKM case

use #if defined(LKM) || defined(_LKM) condition for netbsd32_execve.c,
to DTRT when either compiled statically into kernel with LKM support,
or compiled as a LKM
 1.6 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.5 29-Jul-2001  christos carry on the copyargs() and exit1() changes from kern_exec.c
 1.4 15-Jun-2001  thorpej branches: 1.4.2;
In check_exec(), don't bother checking P_TRACED along with
MNT_NOSUID, just check MNT_NOSUID to clear the S{U,G}ID bits
in the attributes for the vnode we're about to exec.

We now check P_TRACED right before we would actually perform
the s{u,g}id function in the exec code.

This closes a race condition between exec of a setuid binary
and ptrace(2).
 1.3 30-May-2001  mrg use _KERNEL_OPT.
 1.2 04-Mar-2001  mrg branches: 1.2.2;
be more verbose about failed vmcmds.
 1.1 08-Feb-2001  mrg branches: 1.1.2;
split up netbsd32_netbsd.c into 9 new files, leaving only those syscalls that
have no special interpretations besides simple syscall args conversion.
 1.1.2.3 12-Mar-2001  bouyer Sync with HEAD.
 1.1.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.1.2.1 08-Feb-2001  bouyer file netbsd32_execve.c was added on branch thorpej_scsipi on 2001-02-11 19:14:13 +0000
 1.2.2.10 17-Sep-2002  nathanw Catch up to -current.
 1.2.2.9 27-Aug-2002  nathanw Catch up to -current.
 1.2.2.8 23-Aug-2002  petrov lwpification.
 1.2.2.7 20-Jun-2002  nathanw Catch up to -current.
 1.2.2.6 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.2.2.5 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.2.2.4 08-Jan-2002  nathanw Catch up to -current.
 1.2.2.3 14-Nov-2001  nathanw Catch up to -current.
 1.2.2.2 24-Aug-2001  nathanw Catch up with -current.
 1.2.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.4.2.5 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.4.2.4 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.4.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.4.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.4.2.1 03-Aug-2001  lukem update to -current
 1.7.4.1 17-Mar-2002  thorpej Make the exec_lock an rwlock, and rename it to exec_rwlock.
 1.9.4.1 07-Jun-2002  thorpej pullup-1-6 ticket #189:

syssrc/sys/compat/netbsd32/netbsd32_execve.c 1.10

Original log message:

Fix wrong psstr computation.
(XXX why is there an entire copy of sys_execve here?)
 1.9.2.2 29-Aug-2002  gehenna catch up with -current.
 1.9.2.1 20-Jun-2002  gehenna catch up with -current.
 1.13.2.1 18-Dec-2002  gmcgarry Merge pcred and ucred, and poolify. TBD: check backward compatibility
and factor-out some higher-level functionality.
 1.17.2.8 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.17.2.7 01-Apr-2005  skrll Sync with HEAD.
 1.17.2.6 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.17.2.5 21-Sep-2004  skrll Fix the sync with head I botched.
 1.17.2.4 18-Sep-2004  skrll Sync with HEAD.
 1.17.2.3 26-Aug-2004  skrll Adapt to branch.

sparc64 GENERIC compiles.
 1.17.2.2 03-Aug-2004  skrll Sync with HEAD
 1.17.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.18.10.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.18.10.1 25-Jan-2005  yamt convert to new apis.
 1.18.8.1 29-Apr-2005  kent sync with -current
 1.19.2.2 12-Sep-2005  tron Apply patch (requested by martin in ticket #740):
Defopt VERIFIED_EXEC.
 1.19.2.1 10-Jun-2005  tron Pull up revision 1.21 (requested by elad in ticket #389):
Some changes in veriexec.
New features:
- Add a veriexec_report() routine to make most reporting consistent and
remove some common code.
- Add 'strict' mode that controls how veriexec behaves.
- Add sysctl knobs:
o kern.veriexec.verbose controls verbosity levels. Value: 0, 1.
o kern.veriexec.strict controls strict level. Values: 0, 1, 2. See
documentation in sysctl(3) for details.
o kern.veriexec.algorithms returns a string with a space separated
list of supported hashing algorithms in veriexec.
- Updated documentation in man pages for sysctl(3) and sysctl(8).
Bug fixes:
- veriexec_removechk(): Code cleanup + handle FINGERPRINT_NOTEVAL
correctly.
- exec_script(): Don't pass 0 as flag when executing a script; use the
defined VERIEXEC_INDIRECT - which is 1. Makes indirect execution
enforcement work.
- Fix some printing formats and types..
 1.22.2.4 21-Jan-2008  yamt sync with head
 1.22.2.3 03-Sep-2007  yamt sync with head.
 1.22.2.2 26-Feb-2007  yamt sync with head.
 1.22.2.1 21-Jun-2006  yamt sync with head.
 1.25.8.1 13-Mar-2006  yamt sync with head.
 1.25.6.1 22-Apr-2006  simonb Sync with head.
 1.25.4.1 09-Sep-2006  rpaulo sync with head
 1.26.12.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.26.2.2 07-Mar-2006  thorpej Clean up fallout proc_is_traced_p() change:
- proc_is_traced_p() -> trace_is_enabled(), to match trace_enter() and
trace_exit().
- trace_is_enabled() becomes a real function.
- Remove unnecessary include files from various files that used to care
about KTRACE and SYSTRACE, but do no more.
 1.26.2.1 07-Mar-2006  thorpej file netbsd32_execve.c was added on branch elad-kernelauth on 2006-03-07 03:32:07 +0000
 1.27.2.3 07-May-2007  yamt sync with head.
 1.27.2.2 24-Mar-2007  yamt sync with head.
 1.27.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.28.6.1 29-Mar-2007  reinoud Pullup to -current
 1.28.4.1 11-Jul-2007  mjf Sync with head.
 1.28.2.2 27-May-2007  ad Sync with head.
 1.28.2.1 10-Apr-2007  ad Sync with head.
 1.30.20.1 02-Jan-2008  bouyer Sync with HEAD
 1.30.16.1 26-Dec-2007  ad Sync with head.
 1.30.8.1 09-Jan-2008  matt sync with HEAD
 1.31.12.3 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.31.12.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.31.12.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.31.10.1 04-May-2009  yamt sync with head.
 1.31.8.1 04-Jun-2008  yamt sync with head
 1.31.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.32.38.2 29-Apr-2012  mrg sync to latest -current.
 1.32.38.1 18-Feb-2012  mrg merge to -current.
 1.32.34.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.32.34.2 23-Jan-2013  yamt sync with head
 1.32.34.1 17-Apr-2012  yamt sync with head
 1.32.12.2 29-May-2008  mrg remove clause #3 from my license where there are no other
copyright holders involved.
 1.32.12.1 29-May-2008  mrg file netbsd32_execve.c was added on branch christos-time_t on 2008-05-29 14:51:27 +0000
 1.33.2.3 03-Feb-2014  sborrill Pull up the following revisions(s) (requested by martin in ticket #1023):
lib/libc/gen/posix_spawn.3: revision 1.5
lib/libc/gen/posix_spawn_file_actions_addopen.3: revision 1.4
lib/libc/gen/posix_spawn_file_actions_init.3: revision 1.4
lib/libc/gen/posix_spawn_fileactions.c: revision 1.3
sys/compat/netbsd32/netbsd32_execve.c: revision 1.38
sys/kern/kern_exec.c: revision 1.373

Limit the amount of kernel memory a posix_spawn syscall can use (for
handling the file action list) by limiting the maximum number of file
actions to twice the current file descriptor limit. Fix a few bugs in
the support functions and document the new limit. From Maxime Villard.
 1.33.2.2 08-Feb-2013  riz branches: 1.33.2.2.2;
Pull up following revision(s) (requested by hannken in ticket #793):
sys/compat/netbsd32/netbsd32_execve.c: revision 1.37
netbsd32_posix_spawn_fa_alloc: use the right length for path allocation.
This error lead to memory pool corruption when freeing kmem with wrong size.
 1.33.2.1 12-Apr-2012  riz branches: 1.33.2.1.4;
Pull up following revision(s) (requested by martin in ticket #175):
sys/kern/kern_exit.c: revision 1.238
tests/lib/libc/gen/posix_spawn/t_fileactions.c: revision 1.4
tests/lib/libc/gen/posix_spawn/t_fileactions.c: revision 1.5
sys/uvm/uvm_extern.h: revision 1.183
lib/libc/gen/posix_spawn_fileactions.c: revision 1.2
sys/kern/kern_exec.c: revision 1.348
sys/kern/kern_exec.c: revision 1.349
sys/compat/netbsd32/syscalls.master: revision 1.95
sys/uvm/uvm_glue.c: revision 1.159
sys/uvm/uvm_map.c: revision 1.317
sys/compat/netbsd32/netbsd32.h: revision 1.95
sys/kern/exec_elf.c: revision 1.38
sys/sys/spawn.h: revision 1.2
sys/sys/exec.h: revision 1.135
sys/compat/netbsd32/netbsd32_execve.c: revision 1.34
Rework posix_spawn locking and memory management:
- always provide a vmspace for the new proc, initially borrowing from proc0
(this part fixes PR 46286)
- increase parallelism between parent and child if arguments allow this,
avoiding a potential deadlock on exec_lock
- add a new flag for userland to request old (lockstepped) behaviour for
better error reporting
- adapt test cases to the previous two and add a new variant to test the
diagnostics flag
- fix a few memory (and lock) leaks
- provide netbsd32 compat
Fix asynchronous posix_spawn child exit status (and test for it).
 1.33.2.2.2.1 03-Feb-2014  sborrill Pull up the following revisions(s) (requested by martin in ticket #1023):
lib/libc/gen/posix_spawn.3: revision 1.5
lib/libc/gen/posix_spawn_file_actions_addopen.3: revision 1.4
lib/libc/gen/posix_spawn_file_actions_init.3: revision 1.4
lib/libc/gen/posix_spawn_fileactions.c: revision 1.3
sys/compat/netbsd32/netbsd32_execve.c: revision 1.38
sys/kern/kern_exec.c: revision 1.373

Limit the amount of kernel memory a posix_spawn syscall can use (for
handling the file action list) by limiting the maximum number of file
actions to twice the current file descriptor limit. Fix a few bugs in
the support functions and document the new limit. From Maxime Villard.
 1.33.2.1.4.2 03-Feb-2014  sborrill Pull up the following revisions(s) (requested by martin in ticket #1023):
lib/libc/gen/posix_spawn.3: revision 1.5
lib/libc/gen/posix_spawn_file_actions_addopen.3: revision 1.4
lib/libc/gen/posix_spawn_file_actions_init.3: revision 1.4
lib/libc/gen/posix_spawn_fileactions.c: revision 1.3
sys/compat/netbsd32/netbsd32_execve.c: revision 1.38
sys/kern/kern_exec.c: revision 1.373

Limit the amount of kernel memory a posix_spawn syscall can use (for
handling the file action list) by limiting the maximum number of file
actions to twice the current file descriptor limit. Fix a few bugs in
the support functions and document the new limit. From Maxime Villard.
 1.33.2.1.4.1 08-Feb-2013  riz Pull up following revision(s) (requested by hannken in ticket #793):
sys/compat/netbsd32/netbsd32_execve.c: revision 1.37
netbsd32_posix_spawn_fa_alloc: use the right length for path allocation.
This error lead to memory pool corruption when freeing kmem with wrong size.
 1.36.2.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.36.2.1 25-Feb-2013  tls resync with head
 1.37.2.1 18-May-2014  rmind sync with head
 1.38.30.3 21-Apr-2020  martin Sync with HEAD
 1.38.30.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.38.30.1 10-Jun-2019  christos Sync with HEAD
 1.38.28.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.41.6.1 20-Apr-2020  bouyer Sync with HEAD
 1.42.4.1 17-Apr-2021  thorpej Sync with HEAD.
 1.1 24-Dec-2018  mrg branches: 1.1.2; 1.1.6;
move mmap(), compat 40 mount(), pipe() and getfh() into their own files
as the implementation is non trivial or is compat. mark old mount()
properly instead of manually #if'ing ito to ENOSYS.
 1.1.6.2 10-Jun-2019  christos Sync with HEAD
 1.1.6.1 24-Dec-2018  christos file netbsd32_fd.c was added on branch phil-wifi on 2019-06-10 22:07:01 +0000
 1.1.2.2 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.1.2.1 24-Dec-2018  pgoyette file netbsd32_fd.c was added on branch pgoyette-compat on 2018-12-26 14:01:46 +0000
 1.95 23-Apr-2022  reinoud Implement support for mounting UDF in compat32
Fixes PR#56801
 1.94 11-Sep-2021  riastradh sys/kern: Allow custom fileops to specify fo_seek method.

Previously only vnodes allowed lseek/pread[v]/pwrite[v], which meant
converting a regular device to a cloning device doesn't always work.

Semantics is:

(*fp->f_ops->fo_seek)(fp, delta, whence, newoffp, flags)

1. Compute a new offset according to whence + delta -- that is, if
whence is SEEK_CUR, add delta to fp->f_offset; if whence is
SEEK_END, add delta to end of file; if whence is SEEK_CUR, use delta
as is.

2. If newoffp is nonnull, return the new offset in *newoffp.

3. If flags & FOF_UPDATE_OFFSET, set fp->f_offset to the new offset.

Access to fp->f_offset, and *newoffp if newoffp = &fp->f_offset, must
happen under the object lock (e.g., vnode lock), in order to
synchronize fp->f_offset reads and writes.

This change has the side effect that every call to VOP_SEEK happens
under the vnode lock now, when previously it didn't. However, from a
review of all the VOP_SEEK implementations, it does not appear that
any file system even examines the vnode, let alone locks it. So I
think this is safe -- and essentially the only reasonable way to do
things, given that it is used to validate a change from oldoff to
newoff, and oldoff becomes stale the moment we unlock the vnode.

No kernel bump because this reuses a spare entry in struct fileops,
and it is safe for the entry to be null, so all existing fileops will
continue to work as before (rejecting seek).
 1.93 16-Feb-2021  simonb In netbsd32___mount50() zero out the native fs_args union before use so
we don't pass stack garbage to the lower layers in the MNT_GETARGS case.

Fixes random errors like "Bad address" from "mount -vv" with nfs mounts.
 1.92 19-Jan-2021  simonb The read/write/send/recv system calls return ssize_t because -1 is
returned on error. Therefore we must restrict the lengths of any
buffers to NETBSD32_SSIZE_MAX with compat32 to avoid garbage return
values.

Fixes ATF lib/libc/sys/t_write:write_err.
 1.91 19-Jan-2021  simonb KNF consistency: No parentheses are needed around the return value.
 1.90 23-May-2020  ad branches: 1.90.2;
Move proc_lock into the data segment. It was dynamically allocated because
at the time we had mutex_obj_alloc() but not __cacheline_aligned.
 1.89 27-Apr-2020  christos data_len == 0 on mount means "the kernel knows". Fixes amd on compat32.
 1.88 21-Apr-2020  ad Revert the changes made in February to make cwdinfo use mostly lockless,
which relied on taking extra vnode refs.

Having benchmarked various experimental changes over the past few months it
seems that it's better to avoid vnode refs as much as possible. cwdi_lock
as a RW lock already did that to some extent for getcwd() and will permit
the same for namei() too.
 1.87 23-Feb-2020  ad branches: 1.87.4;
Merge from ad-namecache:

- Have a stab at clustering the members of vnode_t and vnode_impl_t in a
more cache-conscious way. With that done, go back to adjusting v_usecount
with atomics and keep vi_lock directly in vnode_impl_t (saves KVA).

- Allow VOP_LOCK(LK_NONE) for the benefit of VFS_VGET() and VFS_ROOT().
Make sure LK_UPGRADE always comes with LK_NOWAIT.

- Make cwdinfo use mostly lockless.
 1.86 31-Jan-2020  maxv Fix copyout overflows in fhstat, found by the LGTM bot. Not a big problem
since this syscall is privileged.
 1.85 26-Sep-2019  christos branches: 1.85.2;
use size_t for counters (which are compared and set with unsigneds)
 1.84 22-Sep-2019  christos Add a new member to struct vfsstat and grow the unused members
The new member is caled f_mntfromlabel and it is the dkw_wname
of the corresponding wedge. This is now used by df -W to display
the mountpoint name as NAME=
 1.83 21-Sep-2019  maxv Fix netbsd32___mount50():

- zero out fs_args32 to prevent info leaks
- remove unused and non-functional copyin in NFS (lgtm bot)
- declare udata, and don't pass kernel pointers to copyout (lgtm bot)
- make sure data_len is just big enough, to mimic the native behavior
- don't forget to update *retval with the 32bit value
- add an XXX for NFS
 1.82 26-Dec-2018  mrg branches: 1.82.4;
remove duplicated prototypes and dated XXX comments.
 1.81 11-Aug-2018  mrg support nullfs in netbsd32.
 1.80 01-Jun-2017  chs branches: 1.80.2; 1.80.8; 1.80.10;
remove checks for failure after memory allocation calls that cannot fail:

kmem_alloc() with KM_SLEEP
kmem_zalloc() with KM_SLEEP
percpu_alloc()
pserialize_create()
psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.
 1.79 01-Dec-2016  mrg s/netbds32_copyout_statvfs/netbsd32_copyout_statvfs/
 1.78 21-Oct-2016  mrg add a ktrgenio() call to netbsd32___getdents30().
from dholland, tested by me.
 1.77 19-Oct-2016  skrll Oops... unintended commit - one day maybe.
 1.76 19-Oct-2016  skrll PR kern/51514: ptrace(2) fails for 32-bit process on 64-bit kernel

Updated from the original patch in the PR by me.
 1.75 16-Oct-2016  dholland Use ktrgeniov, not ktrgenio, in writev.
 1.74 21-Mar-2016  mrg branches: 1.74.2;
avoid some stupid GCC errors seen only with -Os and -O3.
 1.73 23-Oct-2015  maxv Change do_sys_mount() so that it only takes as argument the type of the
drive instead of its associated vfsops. Makes it more friendly, and allows
compat binaries to autoload VFS modules if needed.

sent on tech-kern@, ok christos@
 1.72 05-Oct-2014  christos branches: 1.72.2;
add tmpfs.
 1.71 05-Sep-2014  matt Try not to use f_data, use f_{vnode,socket,pipe,mqueue,kqueue,ksem} to get
a correctly typed pointer.
 1.70 30-Apr-2014  njoly Do not use native off_t type under compat netbsd32, but a new
netbsd32_off_t that provide the expected alignment for 64bit types.
 1.69 17-Oct-2013  njoly branches: 1.69.2;
Change mknodat(2) device argument type from uint32_t to dev_t.
Adds needed extra PAD argument for 64bit alignment, and libc wrapper.
 1.68 30-Jul-2013  njoly Add a new get_utimens32() helper function that fetch struct timespec
data if not NULL, to be used by netbsd32_utimensat() and
netbsd32_futimens().
 1.67 18-Jul-2013  matt futimens uses two timespec as well.
 1.66 18-Jul-2013  matt Deal with timespecs properly in futimens and utimensat.
PR/48060
 1.65 18-Jul-2013  matt Move *at syscall handlers to netbsd32_fs.c from netbsd32_netbsd.c
Fix netbsd32_fstatat to emit a 32bit stat structure.
 1.64 13-Dec-2012  matt branches: 1.64.2; 1.64.8;
Fix inverted error check.
 1.63 06-Mar-2012  macallan branches: 1.63.2;
allow mounting ext2fs and msdosfs
while there also enable lfs but that's untested
 1.62 25-Jan-2012  christos branches: 1.62.2; 1.62.6;
Add FNOSIGPIPE for compat32; noted by yamt.
 1.61 05-Jun-2011  dsl branches: 1.61.2; 1.61.6;
Delete some splurious commas and very unexpected trailing space
 1.60 22-Jan-2011  matt branches: 1.60.2;
Add the ability to mount NFS filesystems in COMPAT_NETBSD32
If in the kernel and NFS_ARGS_ONLY, just export struct nfs_args and its flags.
 1.59 23-Apr-2010  rmind branches: 1.59.2; 1.59.4;
Replace M_IOV and some malloc(9)s with kmem(9), and while there:
- Fix invalid free (M_TEMP vs M_IOV) in do_sys_recvmsg(), spotted by jakllsch@.
Also, same fix in osf1_sys_sendmsg_xopen().
- Fix attempt to free non-allocated memory in error path in netbsd32___getfh30().
- Plug a memory leak in compat_43_netbsd32_orecvmsg().
 1.58 14-Dec-2009  matt branches: 1.58.2; 1.58.4;
Merge from matt-nb5-mips64
 1.57 26-Jan-2009  njoly Make all fstat(2) compat syscalls consistently use do_sys_fstat(),
instead of fd_getfile()/fd_putfile() dance.

ok by christos.
 1.56 11-Jan-2009  christos merge christos-time_t
 1.55 24-Jun-2008  ad branches: 1.55.4; 1.55.6; 1.55.10; 1.55.14;
Replace references to getsock/getvnode.
 1.54 29-May-2008  mrg branches: 1.54.2;
remove clause #3 from my license where there are no other
copyright holders involved.
 1.53 24-Apr-2008  ad branches: 1.53.2; 1.53.4;
Network protocol interrupts can now block on locks, so merge the globals
proclist_mutex and proclist_lock into a single adaptive mutex (proc_lock).
Implications:

- Inspecting process state requires thread context, so signals can no longer
be sent from a hardware interrupt handler. Signal activity must be
deferred to a soft interrupt or kthread.

- As the proc state locking is simplified, it's now safe to take exit()
and wait() out from under kernel_lock.

- The system spends less time at IPL_SCHED, and there is less lock activity.
 1.52 23-Apr-2008  ad Fix locking.
 1.51 21-Mar-2008  ad branches: 1.51.2;
Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
 1.50 05-Jan-2008  dsl branches: 1.50.6;
Use FILE_LOCK() and FILE_UNLOCK().
Attempt to fix all the code paths so that the 'fp' returned by fd_getfile()
isn't left locked, and is always unlocked (and ref-counted) before
doing anything that might sleep.
 1.49 20-Dec-2007  dsl Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.48 08-Dec-2007  dsl branches: 1.48.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.47 04-Dec-2007  dsl Remove all the __P
 1.46 15-Aug-2007  ad branches: 1.46.2; 1.46.8; 1.46.10;
Changes to make ktrace LKM friendly and reduce ifdef KTRACE. Proposed
on tech-kern.
 1.45 30-Jun-2007  dsl branches: 1.45.2; 1.45.6;
Changes to sompat socket function to avoid the dreaded stackgap.
 1.44 09-Jun-2007  ad Acquire proclist_mutex before sending signals. XXX irix emul needs a bit
of work.
 1.43 12-May-2007  dsl Change the compat sys_[fl]utime code to not use the stackgap.
 1.42 30-Apr-2007  dsl Split the statvfs functions so that the 'work' is done to a kernel buffer
which can either be copied directly to userspace, or converted then copied.
Saves replicating a lot of code in the compat functions (esp. for
getvfsstat) at a cast of an extra function call in the non-emulated case -
which is unlikely to be measurable given the other costs of the actions
involved (even on vax).
Remove dofhstat() and dofhstatvfs() (and the last caller).
Remove some redundant stackgap_init() calls.
 1.41 22-Apr-2007  dsl Actually report an error when sys__stat30() fails.
 1.40 22-Apr-2007  dsl Change the way that emulations locate files within the emulation root to
avoid having to allocate space in the 'stackgap'
- which is very LWP unfriendly.
The additional code for non-emulation namei() is trivial, the reduction for
the emulations is massive.
The vnode for a processes emulation root is saved in the cwdi structure
during process exec.
If the emulation root the TRYEMULROOT flag are set, namei() will do an initial
search for absolute pathnames in the emulation root, if that fails it will
retry from the normal root.
".." at the emulation root will always go to the real root, even in the middle
of paths and when expanding symlinks.
Absolute symlinks found using absolute paths in the emulation root will be
relative to the emulation root (so /usr/lib/xxx.so -> /lib/xxx.so links
inside the emulation root don't need changing).
If the root of the emulation would be returned (for an emulation lookup), then
the real root is returned instead (matching the behaviour of emul_lookup,
but being a cheap comparison here) so that programs that scan "../.."
looking for the root dircetory don't loop forever.
The target for symbolic links is no longer mangled (it used to get the
CHECK_ALT_xxx() treatment, so could get /emul/xxx prepended).
CHECK_ALT_xxx() are no more. Most of the change is deleting them, and adding
TRYEMULROOT to the flags to NDINIT().
A lot of the emulation system call stubs could now be deleted.
 1.39 18-Mar-2007  dsl Change all the NETBSD32PTR64(SCARG(uap, xxx))) to SCARG_P32(uap, xxx).
 1.38 16-Mar-2007  dsl remove all the double (and triple) casts used to convert 32bit userspace
pointers to and from 64bit kernel pointers. Instead use the defines
NETBSD32PTR64(p32) to read a 32bit pointer and (the new) NETBSD32PTR32(p32,p64)
to write a 32bit pointer throughout.
The 32bit pointer is now a struct to enforce the above.
amd64 (with linux emul) and sparc64 will both compile (when the arch stuff
goes in soon), and amd64 still runs some i386 binaries.
 1.37 10-Mar-2007  dsl branches: 1.37.2; 1.37.4;
Update all the compat stuff to not use the 'stackgap' for processing
sys_stat() and friends, instead use do_sys_stat() and do_sys_fstat()
that write the answer into a kernel buffer (on stack) that can be
converted to the correct form and written the userspace.
I've test compiled a few kernels, and tested i386 netbsd1.6 ls.
Given I think I've fixed some bugs, it might be 50-50 with new ones.
 1.36 04-Mar-2007  christos branches: 1.36.2;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.35 09-Feb-2007  ad branches: 1.35.2;
Merge newlock2 to head.
 1.34 14-Nov-2006  elad Clean some KAUTH_GENERIC_ISSUSER usage in compat code.
 1.33 04-Aug-2006  yamt branches: 1.33.4; 1.33.6;
some filehandle syscall related changes.

- remove the support of variable-sized filehandle from compat version of
syscalls. (strictly speaking, it breaks abi. i don't think it's a problem
because this feature is short-lived and there are no affected in-tree
filesystems.)
- unify vfs_copyinfh_alloc and vfs_copyinfh_alloc_size.
- vfs_copyinfh_alloc_size: check fhsize strictly.
- reduce code duplication between compat and current syscalls.
 1.32 31-Jul-2006  martin Make filehandles opaque to userland
 1.31 23-Jul-2006  ad Use the LWP cached credentials where sane.
 1.30 16-Jul-2006  yamt adapt to vfs_copyinfh -> vfs_copyinfh_alloc rename.
 1.29 14-Jul-2006  martin netbsd32_sys___fhstat30 and netbsd32_sys___fhstatvfs have nothing to do
with compat_30 - so use full/variable sized filehandles here too.
Fixes PR kern/34004.
 1.28 13-Jul-2006  martin Fix alignement problems for fhandle_t, exposed by gcc4.1.

While touching all vptofh/fhtovp functions, get rid of VFS_MAXFIDSIZ,
version the getfh(2) syscall and explicitly pass the size available in
the filehandle from userland.

Discussed on tech-kern, with lots of help from yamt (thanks!).
 1.27 14-May-2006  elad branches: 1.27.4;
integrate kauth.
 1.26 05-May-2006  cube Move fhstat as sys___fhstat30 in netbsd32_fs.c because it doesn't belong
to netbsd32_netbsd.c (which incidentally means it had been broken for a
while I guess). Add compat_30 version.
 1.25 15-Mar-2006  cube branches: 1.25.2;
Move malloc calls outside of the block where a lock is held.
 1.24 01-Mar-2006  yamt branches: 1.24.2; 1.24.4;
merge yamt-uio_vmspace branch.

- use vmspace rather than proc or lwp where appropriate.
the latter is more natural to specify an address space.
(and less likely to be abused for random purposes.)
- fix a swdmover race.
 1.23 11-Dec-2005  christos branches: 1.23.2; 1.23.4; 1.23.6;
merge ktrace-lwp.
 1.22 19-Aug-2005  christos Fix lossage I created with the 64 bit ino_t change.
 1.21 19-Aug-2005  christos 64 bit inode changes.
 1.20 10-Jul-2005  cube NOFOLLOW should be passed to NDINIT() instead of FOLLOW for lstat(2).
Reported by Martin Husemann.
 1.19 26-Feb-2005  perry branches: 1.19.4;
nuke trailing whitespace
 1.18 17-Jun-2004  cube branches: 1.18.4; 1.18.6;
o Add support for the statvfs family of syscalls (statvfs1, fstatvfs1,
fhstatvfs1 and getvfsstat)
o Move the statfs family out of netbsd32_fs.c and netbsd32_netbsd.c to
netbsd_compat_20.c, compiled with COMPAT_20

Reviewed by christos@.
 1.17 22-Apr-2004  hannken Fix statfs->statvfs fallout.
 1.16 21-Apr-2004  christos Replace the statfs() family of system calls with statvfs().
Retain binary compatibility.
 1.15 21-Oct-2003  fvdl Don't compare an integer value against 0.
 1.14 29-Jun-2003  fvdl branches: 1.14.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.13 29-Jun-2003  martin struct proc * -> struct lwp *
 1.12 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.11 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.10 23-Oct-2002  scw In preparation for COMPAT_NETBSD32 on SH-5:

- The MD netbsd32_machdep.h header now defines the 32-bit pointer type
instead of using u_int32_t everywhere,
- The MD netbsd32_machdep.h header now defines a macro (at least on
current implementations) which converts a 32-bit pointer to its 64-bit
equivalent,
- Change the MI code to utilise the above two items in all the right places,
- Implement netbsd32___sigaction_sigtramp().

Tested on Sparc64 by Matt Green.
 1.9 24-Mar-2002  jdolecek use FILE_USE()/FILE_UNUSE() as appropriate, use malloc()/free()
instead of MALLOC()/FREE() for variable-size allocations (sync
with kern/sys_generic.c)
XXX not tested
 1.8 16-Mar-2002  christos make the stackgap_{init,alloc} functions MP friendly (i.e. pass struct proc *
in, instead of using curproc). While there add an optional size argument to
stackgap_init.
 1.7 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.6 14-Jun-2001  thorpej branches: 1.6.2;
Fix a partial construction problem that can cause race conditions
between creation of a file descriptor and close(2) when using kernel
assisted threads. What we do is stick descriptors in the table, but
mark them as "larval". This causes essentially everything to treat
it as a non-existent descriptor, except for fdalloc(), which sees a
filled slot so that it won't (incorrectly) allocate it again. When
a descriptor is fully constructed, the code that has constructed it
marks it as "mature" (which actually clears the "larval" flag), and
things continue to work as normal.

While here, gather all the code that gets a descriptor from the table
into a fd_getfile() function, and call it, rather than having the
same (sometimes incorrect) code copied all over the place.
 1.5 30-May-2001  mrg use _KERNEL_OPT.
 1.4 09-Apr-2001  jdolecek Change the first arg to fileops fo_stat routine to struct file *, adjust
callers and appropriate routines to cope. This makes fo_stat more
consistent with rest of fileops routines and also makes the fo_stat
match FreeBSD as an added bonus.
Discussed with Luke Mewburn on tech-kern@.
 1.3 09-Apr-2001  jdolecek Call file descriptor stat function via (*fp->f_ops->fo_stat) instead
of a switch statement and explicit call.
Sprinkle some FILE_USE()/FILE_UNUSE() as appropriate.
 1.2 08-Apr-2001  ross Fix soo_stat() calls for the new parameter, even if the direct call is
now obsolete, so that kernels will at least compile. I guess it was too
much trouble to change all 10 call sites, or perhaps, these days, only
things that build on i386 are important. Maybe it's the full moon tonight.
 1.1 08-Feb-2001  mrg branches: 1.1.2; 1.1.4;
split up netbsd32_netbsd.c into 9 new files, leaving only those syscalls that
have no special interpretations besides simple syscall args conversion.
 1.1.4.7 11-Nov-2002  nathanw Catch up to -current
 1.1.4.6 23-Aug-2002  petrov lwpification.
 1.1.4.5 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.1.4.4 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.1.4.3 14-Nov-2001  nathanw Catch up to -current.
 1.1.4.2 21-Jun-2001  nathanw Catch up to -current.
 1.1.4.1 09-Apr-2001  nathanw Catch up with -current.
 1.1.2.3 21-Apr-2001  bouyer Sync with HEAD
 1.1.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.1.2.1 08-Feb-2001  bouyer file netbsd32_fs.c was added on branch thorpej_scsipi on 2001-02-11 19:14:13 +0000
 1.6.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.6.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.14.2.8 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.14.2.7 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.14.2.6 19-Feb-2005  skrll Make this compile for both KTRACE and !KTRACE builds.
 1.14.2.5 21-Sep-2004  skrll Fix the sync with head I botched.
 1.14.2.4 18-Sep-2004  skrll Sync with HEAD.
 1.14.2.3 26-Aug-2004  skrll Adapt to branch.

sparc64 GENERIC compiles.
 1.14.2.2 03-Aug-2004  skrll Sync with HEAD
 1.14.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.18.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.18.4.1 29-Apr-2005  kent sync with -current
 1.19.4.7 24-Mar-2008  yamt sync with head.
 1.19.4.6 21-Jan-2008  yamt sync with head
 1.19.4.5 07-Dec-2007  yamt sync with head
 1.19.4.4 03-Sep-2007  yamt sync with head.
 1.19.4.3 26-Feb-2007  yamt sync with head.
 1.19.4.2 30-Dec-2006  yamt sync with head.
 1.19.4.1 21-Jun-2006  yamt sync with head.
 1.23.6.2 01-Jun-2006  kardel Sync with head.
 1.23.6.1 22-Apr-2006  simonb Sync with head.
 1.23.4.1 09-Sep-2006  rpaulo sync with head
 1.23.2.1 18-Feb-2006  yamt adapt the rest of MI code.
 1.24.4.6 12-May-2006  elad adapt to kauth kpi, include sys/kauth.h where needed..
 1.24.4.5 12-May-2006  elad include sys/kauth.h where appropriate.
 1.24.4.4 11-May-2006  elad sync with head
 1.24.4.3 19-Apr-2006  elad sync with head.
 1.24.4.2 10-Mar-2006  elad generic_authorize() -> kauth_authorize_generic().
 1.24.4.1 08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.24.2.3 11-Aug-2006  yamt sync with head
 1.24.2.2 24-May-2006  yamt sync with head.
 1.24.2.1 01-Apr-2006  yamt sync with head.
 1.25.2.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.27.4.1 13-Jul-2006  gdamore Merge from HEAD.
 1.33.6.1 10-Dec-2006  yamt sync with head.
 1.33.4.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.33.4.1 18-Nov-2006  ad Sync with head.
 1.35.2.4 17-May-2007  yamt sync with head.
 1.35.2.3 07-May-2007  yamt sync with head.
 1.35.2.2 24-Mar-2007  yamt sync with head.
 1.35.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.36.2.6 20-Aug-2007  ad Sync with HEAD.
 1.36.2.5 15-Jul-2007  ad Sync with head.
 1.36.2.4 27-May-2007  ad Sync with head.
 1.36.2.3 10-Apr-2007  ad Sync with head.
 1.36.2.2 13-Mar-2007  ad Pull in the initial set of changes for the vmlocking branch.
 1.36.2.1 13-Mar-2007  ad Sync with head.
 1.37.4.2 29-Mar-2007  reinoud Pullup to -current
 1.37.4.1 18-Mar-2007  reinoud First attempt to bring branch in sync with HEAD
 1.37.2.1 11-Jul-2007  mjf Sync with head.
 1.45.6.2 09-Dec-2007  jmcneill Sync with HEAD.
 1.45.6.1 16-Aug-2007  jmcneill Sync with HEAD.
 1.45.2.1 03-Sep-2007  skrll Sync with HEAD.
 1.46.10.2 26-Dec-2007  ad Sync with head.
 1.46.10.1 08-Dec-2007  ad Sync with head.
 1.46.8.3 18-Feb-2008  mjf Sync with HEAD.
 1.46.8.2 27-Dec-2007  mjf Sync with HEAD.
 1.46.8.1 08-Dec-2007  mjf Sync with HEAD.
 1.46.2.1 09-Jan-2008  matt sync with HEAD
 1.48.4.2 08-Jan-2008  bouyer Sync with HEAD
 1.48.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.50.6.4 17-Jan-2009  mjf Sync with HEAD.
 1.50.6.3 29-Jun-2008  mjf Sync with HEAD.
 1.50.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.50.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.51.2.2 04-Jun-2008  yamt sync with head
 1.51.2.1 18-May-2008  yamt sync with head.
 1.53.4.4 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.53.4.3 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.53.4.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.53.4.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.53.2.3 11-Aug-2010  yamt sync with head.
 1.53.2.2 11-Mar-2010  yamt sync with head
 1.53.2.1 04-May-2009  yamt sync with head.
 1.54.2.1 27-Jun-2008  simonb Sync with head.
 1.55.14.2 16-Nov-2009  matt remove debug printf
 1.55.14.1 13-Sep-2009  matt Move netbsd32___mount50 from netbsd32_netbsd.c to netbsd32_fs.c
 1.55.10.2 04-Jan-2009  christos add new syscalls.
 1.55.10.1 24-Jun-2008  christos file netbsd32_fs.c was added on branch christos-time_t on 2009-01-04 01:56:02 +0000
 1.55.6.1 13-Jan-2013  bouyer Pull up following revision(s) (requested by matt in ticket #1829):
sys/compat/netbsd32/netbsd32_fs.c: revision 1.64
Fix inverted error check.
 1.55.4.2 03-Mar-2009  skrll Sync with HEAD.
 1.55.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.58.4.3 12-Jun-2011  rmind sync with head
 1.58.4.2 05-Mar-2011  rmind sync with head
 1.58.4.1 30-May-2010  rmind sync with head
 1.58.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.59.4.1 08-Feb-2011  bouyer Sync with HEAD
 1.59.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.60.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.61.6.2 06-Mar-2012  mrg sync to -current
 1.61.6.1 18-Feb-2012  mrg merge to -current.
 1.61.2.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.61.2.2 16-Jan-2013  yamt sync with (a bit old) head
 1.61.2.1 17-Apr-2012  yamt sync with head
 1.62.6.1 17-Dec-2012  riz Pull up following revision(s) (requested by matt in ticket #756):
sys/compat/netbsd32/netbsd32_fs.c: revision 1.64
Fix inverted error check.
 1.62.2.2 17-Dec-2012  riz Pull up following revision(s) (requested by matt in ticket #756):
sys/compat/netbsd32/netbsd32_fs.c: revision 1.64
Fix inverted error check.
 1.62.2.1 13-Dec-2012  riz Pull up following revision(s) (requested by bouyer in ticket #742):
sys/compat/netbsd32/netbsd32.h: revision 1.94
sys/compat/netbsd32/netbsd32_fs.c: revision 1.63
allow mounting ext2fs and msdosfs
while there also enable lfs but that's untested
 1.63.2.3 03-Dec-2017  jdolecek update from HEAD
 1.63.2.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.63.2.1 25-Feb-2013  tls resync with head
 1.64.8.1 23-Jul-2013  riastradh sync with HEAD
 1.64.2.2 18-May-2014  rmind sync with head
 1.64.2.1 28-Aug-2013  rmind sync with head
 1.69.2.1 10-Aug-2014  tls Rebase.
 1.72.2.4 28-Aug-2017  skrll Sync with HEAD
 1.72.2.3 05-Dec-2016  skrll Sync with HEAD
 1.72.2.2 22-Apr-2016  skrll Sync with HEAD
 1.72.2.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.74.2.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.74.2.1 04-Nov-2016  pgoyette Sync with HEAD
 1.80.10.3 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.80.10.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.80.10.1 10-Jun-2019  christos Sync with HEAD
 1.80.8.2 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.80.8.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.80.2.2 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1833):

sys/compat/netbsd32/netbsd32_netbsd.c: revision 1.232
sys/compat/netbsd32/netbsd32_socket.c: revision 1.56
sys/compat/netbsd32/netbsd32_conv.h: revision 1.45
sys/compat/netbsd32/netbsd32_fs.c: revision 1.92
sys/compat/netbsd32/netbsd32.h: revision 1.137

The read/write/send/recv system calls return ssize_t because -1 is
returned on error. Therefore we must restrict the lengths of any
buffers to NETBSD32_SSIZE_MAX with compat32 to avoid garbage return
values.

Fixes ATF lib/libc/sys/t_write:write_err.
 1.80.2.1 25-Aug-2018  martin Pull up following revision(s) (requested by mrg in ticket #977):

sys/compat/netbsd32/netbsd32_fs.c: revision 1.81
sys/compat/netbsd32/netbsd32.h: revision 1.119

support nullfs in netbsd32.
 1.82.4.4 01-Apr-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1620):

sys/compat/netbsd32/netbsd32_fs.c: revision 1.89

data_len == 0 on mount means "the kernel knows". Fixes amd on compat32.
 1.82.4.3 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1489):

sys/compat/netbsd32/netbsd32_netbsd.c: revision 1.232
sys/compat/netbsd32/netbsd32_socket.c: revision 1.56
sys/compat/netbsd32/netbsd32_conv.h: revision 1.45
sys/compat/netbsd32/netbsd32_fs.c: revision 1.92
sys/compat/netbsd32/netbsd32.h: revision 1.137

The read/write/send/recv system calls return ssize_t because -1 is
returned on error. Therefore we must restrict the lengths of any
buffers to NETBSD32_SSIZE_MAX with compat32 to avoid garbage return
values.

Fixes ATF lib/libc/sys/t_write:write_err.
 1.82.4.2 24-Apr-2022  martin Pull up following revision(s) (requested by reinoud in ticket #1438):

sys/compat/netbsd32/netbsd32.h: revision 1.140
sys/compat/netbsd32/netbsd32_fs.c: revision 1.95
sys/fs/udf/udf_subr.c: revision 1.169

Fix endian issue with UDF extended attribute handling

Implement support for mounting UDF in compat32
Fixes PR#56801
 1.82.4.1 16-Oct-2019  martin Pull up following revision(s) (requested by maxv in ticket #337):

sys/compat/netbsd32/netbsd32_fs.c: revision 1.83

Fix netbsd32___mount50():
- zero out fs_args32 to prevent info leaks
- remove unused and non-functional copyin in NFS (lgtm bot)
- declare udata, and don't pass kernel pointers to copyout (lgtm bot)
- make sure data_len is just big enough, to mimic the native behavior
- don't forget to update *retval with the 32bit value
- add an XXX for NFS
 1.85.2.2 29-Feb-2020  ad Sync with head.
 1.85.2.1 25-Jan-2020  ad Make cwdinfo use mostly lockless, and largely hide the details in vfs_cwd.c.
 1.87.4.1 25-Apr-2020  bouyer Sync with bouyer-xenpvh-base2 (HEAD)
 1.90.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.1 26-Apr-2020  thorpej Add a NetBSD native futex implementation, mostly written by riastradh@.
Map the COMPAT_LINUX futex calls to the native ones.
 1.122 10-Nov-2024  riastradh netbsd32_ioctl: Use fd_set_exclose instead of open-coding it.

No functional change intended -- this just reduces unnecessary
copies of open-coded logic which, when copied incompletely, led to:

PR kern/58822: close-on-exec is broken for dup3 and opening cloning
devices
 1.121 11-May-2024  martin branches: 1.121.2;
PR 58235: add support for SIOCGIFDATA and SIOCZIFDATA ioctls.
 1.120 22-Dec-2021  roy branches: 1.120.4;
Handle the SIOCGNBRINFO ioctl for compat32.
arp -a works with compat32 now.

Credit to simonb@ for the ndp fix from which this is cribbed.
 1.119 14-Apr-2021  mlelstv Add DIOCGDISKINFO compat.
 1.118 17-Jan-2021  simonb branches: 1.118.2;
Handle the SIOCGNBRINFO_IN6 ioctl for compat32. ndp -a works with
compat32 now.
 1.117 14-Jan-2021  simonb Remove some blank lines to group the VND and FSS ioctls together.
 1.116 14-Jan-2021  simonb Handle the KFILTER_BYFILTER and KFILTER_BYNAME ioctls for compat32.
Passes "atf kernel/kqueue/t_ioctl".
 1.115 14-Jan-2021  simonb Handle FSSIOCSET and FSSIOCGET; vndconfig(8) works with compat32 now.
XXX: FSSIOCSET50 and FSSIOCGET50 are not (yet) handled.
 1.114 21-Jul-2020  simonb branches: 1.114.2;
Add lockstat(1) ioctl handling.

mrg@: "looks ok."
 1.113 18-Jul-2020  jmcneill Add BIOCSETWF32 (bpf)
 1.112 16-Mar-2020  christos Unfortunately all the clockctl ioctls contain pointers to structs instead
of the structs themselves, so they need special handling. Undo previous
and do the permissions checks explicitly. It would be better to fix the
clockctl ioctls to contain the structs themselves...
 1.111 16-Mar-2020  christos Don't open-code ioctls, pass back to the 64 bit ones (found by maxv@),
 1.110 14-Mar-2020  maxv wrong size passed to copyout
 1.109 11-Feb-2020  mlelstv Where did the +1 came from ?
 1.108 10-Feb-2020  mlelstv Don't use strlcpy to copy untrusted input, it may not be NUL-terminated.
 1.107 01-Feb-2020  riastradh Load struct filedesc::fd_dt with atomic_load_consume.

Exceptions: when fd_refcnt <= 1, or when holding fd_lock.

While here:

- Restore KASSERT(mutex_owned(&fdp->fd_lock)) in fd_unused.
=> This is used only in fd_close and fd_abort, where it holds.
- Move bounds check assertion in fd_putfile to where it matters.
- Store fd_dt with atomic_store_release.
- Move load of fd_dt under lock in knote_fdclose.
- Omit membar_consumer in fdesc_readdir.
=> atomic_load_consume serves the same purpose now.
=> Was needed only on alpha anyway.
 1.106 18-Nov-2019  rin branches: 1.106.2;
Sorry, revert unintentional parts of the previous commit:
http://mail-index.netbsd.org/source-changes/2019/11/18/msg110946.html

I was going to commit only netbsd32_signal.c.
 1.105 18-Nov-2019  rin Belatedly catch up with kern_sig.c rev 1.358:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/kern/kern_sig.c#rev1.358

Provide syscall information with SIGTRAP TRAP_SCE/TRAP_SCX so that
picotrace/truss, for example, works fine on COMPAT_NETBSD32.

With some minor changes:

- Centralize netbsd32_si{,32}_si{32,}() into netbsd32_ksi{,32}_ksi{32,}().
- Provide si_status with SIGCHLD.
- Remove the remaining of SA.

XXX
pullup to netbsd-9
 1.104 20-Aug-2019  christos compat32 drm ioctl support from Surya Shankar at GSoC 2019
 1.103 17-May-2019  msaitoh branches: 1.103.2;
The max subtype of the ifmedia word is 31. It's too small for Ethernet now.
We currently use use it up to 30. We should extend the limit to be able to use
more than 10Gbps speeds. Our ifmedia(4) is inconvenience and have some problem
so we should redesign the interface, but it's too late for netbsd-9 to do it.
So, we keep the data structure size and modify the structure a bit. The
strategy is almost the same as FreeBSD. Many bits of IFM_OMASK for Ethernet
have not used, so use some of them for Ethernet's subtype.

The differences against FreeBSD are:
- We use NetBSD style compat code (i.e. no SIOCGIFXMEDIA).
- FreeBSD's IFM_ETH_XTYPE's bit location is from 11 to "14" even though
IFM_OMASK is from 8 to "15". We use _IFM_ETH_XTMASK from bit 13 to "15".
- FreeBSD changed the meaning of IFM_TYPE_MATCH(). I think we should
not do it. We keep it not changing and added new IFM_TYPE_SUBTYPE_MATCH()
macro for matching both TYPE and SUBTYPE.
- Added up to 400GBASE-SR16.

New layout of the media word is as follows (from ifmedia_h):

* if_media Options word:
* Bits Use
* ---- -------
* 0-4 Media subtype MAX SUBTYPE == 255 for ETH and 31 for others
* 5-7 Media type
* 8-15 Type specific options
* 16-18 Mode (for multi-mode devices)
* 19 (Reserved for Future Use)
* 20-27 Shared (global) options
* 28-31 Instance
*
* 3 2 1
* 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
* +-------+---------------+-+-----+---------------+-----+---------+
* | | |R| | | | |
* | IMASK | GMASK |F|MMASK+-----+ OMASK |NMASK| TMASK |
* | | |U| |XTMSK| | | |
* +-------+---------------+-+-----+-----+---------+-----+---------+
* <-----> <---> <--->
* IFM_INST() IFM_MODE() IFM_TYPE()
*
* IFM_SUBTYPE(other than ETH)<------->
*
* <---> IFM_SUBTYPE(ETH)<------->
*
*
* <-------------> <------------->
* IFM_OPTIONS()
 1.102 23-Apr-2019  msaitoh KNF. No functional change.
 1.101 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.100 25-Nov-2018  mlelstv Restore netbsd32 compat code for new NPF ABI.
 1.99 12-Oct-2018  rin PR kern/53666
Correct misleading names of dummy variables. No binary changes intended.
 1.98 11-Oct-2018  christos PR/53666: Rin Okuyama: tcpdump for i386 does not work with COMPAT_NETBSD32
on amd64. Add BIOCSRTIMEOUT32.
 1.97 06-Oct-2018  christos comment out unused
 1.96 29-Sep-2018  rmind NPF: Major rework -- migrate NPF to the libnv library.
- This conversion significantly simplifies the code and moves NPF to
a binary serialisation format (replacing the XML-like format).
- Fix some memory/reference leaks and possibly use-after-free bugs.
- Bump NPF_VERSION as this change makes libnpf incompatible with the
previous versions. Also, different serialisation format means NPF
connection/config saving and loading is not compatible with the
previous versions either.

Thanks to christos@ for extra testing.
 1.95 24-Sep-2018  jdolecek fix DIOCLWEDGES to at least not fail with ENOTTY due to struct size difference,
but probably more needs to be done to work if any actual wedges are configured
 1.94 24-Sep-2018  jdolecek add support for DIOCGSTRATEGY and DIOCSSTRATEGY
 1.93 03-Sep-2018  riastradh Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.92 06-Mar-2018  mlelstv branches: 1.92.2;
Add DIOCLWEDGES
 1.91 19-Jan-2018  macallan branches: 1.91.2;
add conversion goop for WSDISPLAYIO_LDFONT and _SFONT
tested on mips64
 1.90 26-Nov-2017  jmcneill Add support for SIOCGIFGENERIC and SIOCSIFGENERIC ioctls.
 1.89 14-Jan-2017  maya branches: 1.89.8;
appease coverity by using strlcpy instead of strncpy

ok riastradh
 1.88 26-Dec-2016  christos Sync NPF with the version on github: backport standalone NPF changes,
which allow us to create and run separate NPF instances. Minor fixes.
(from rmind@)
 1.87 21-Nov-2016  rin Handle CLOCKCTL_NTP_ADJTIME32 even when compiled with !NTP;
just return ENOTTY in order to avoid possible failure when
main kernel and compat_netbsd32 module are compiled with
different NTP options in future.

Suggested and approved by mlelstv
 1.86 15-Nov-2016  rin Protect NPT stuff by "#ifdef NTP". Fix non-NTP kernel.
Approved by martin.
 1.85 12-Nov-2016  mlelstv Fix netbsd32 emulation for clockctl_ntp_adjtime.

The ioctl args reference a timex structure that needs to be
transformed to 64bit layout and back.

The 32bit ioctl definition was wrong for mips, as register_t is 64bit
for N32 abi.
 1.84 13-Jul-2016  jmcneill branches: 1.84.2;
Add netbsd32 support for drvctl(4)
 1.83 08-Dec-2015  christos Replace DIOCGPART -> DIOCGPARTINFO which returns the data needed instead of
pointers.
 1.82 02-Aug-2015  maxv Wrong logic. Here, userland can control the size and the data copied, which
basically means it can overflow kernel memory.

ok martin@ christos@
 1.81 01-Jun-2015  roy Add support for NPF ioctls.
 1.80 01-Jun-2015  roy Back out prior

gimpy1@ we don't #include driver .h in netbsd32
 1.79 31-May-2015  roy Revert prior change, optionally include PPPOE and SPPP support again.
Fix compat_netbsd32 module building by enforcing both.
 1.78 31-May-2015  roy It seems we cannot depend on kernel config in modules, so always compile
in PPP(,oE) support.
 1.77 31-May-2015  roy Add support for PPPOEGETPARMS and PPPOESETPARMS.
 1.76 31-May-2015  roy Support SPPPGETAUTHCFG and SPPPSETAUTHCFG.
 1.75 31-May-2015  roy Fixup ifdrv parameter order.
 1.74 27-May-2015  matt Fix netbsd32 ifdrv copy routines to not use memcpy.
 1.73 27-May-2015  matt Add missing SIOCGDRVSPEC32
Fix SIOCGETSGCNT32
 1.72 20-May-2015  matt Rework ksym defines and includes.
 1.71 20-May-2015  matt Change the ksyms ioctls to more compat_netbsd32 friendly. Use _IOWR ioctls
to avoid extra copyouts. With these changes, netstat and vmstat work on
mips64eb with the normal N32 userland and a N64 kernel.
 1.70 18-May-2015  martin Implement SIOCIFGCLONERS for netbsd32, so ifconfig -C works.
 1.69 24-Jan-2014  bouyer branches: 1.69.4; 1.69.6;
Support WSDISPLAYIO_GETCMAP/WSDISPLAYIO_PUTCMAP. Tested on evbmips/loongson
 1.68 24-Jan-2014  manu Add ATAIOCCOMMAND ioctl form COMPAT_NETBSD32

This enables SMART monitoring by a netbsd32 binary.
 1.67 06-Aug-2012  skrll branches: 1.67.2; 1.67.4;
Ensure correct alignment for stack buffers when long != 64-bit, e.g.
arm.
 1.66 28-May-2012  christos compat for 80211 ioctls from jmcneill
 1.65 11-May-2012  christos provide clockctl ioctl emulation
 1.64 06-Oct-2011  macallan branches: 1.64.2; 1.64.6; 1.64.8; 1.64.12; 1.64.14;
fix pasto, now SIOCS80211NWKEY and SIOCG80211NWKEY actually work
 1.63 05-Oct-2011  macallan forgot SIOCG80211NWKEY32 when adding SIOCS80211NWKEY32
 1.62 28-Sep-2011  macallan support WSDISPLAYIO_GCURSOR and WSDISPLAYIO_SCURSOR
 1.61 07-Sep-2011  macallan support ioctl(POWER_EVENT_RECVDICT) - now powerd turns my gdium's backlight
off when the lid is closed
 1.60 30-Aug-2011  bouyer Provide netbsd32 compat for bpf. Beside the ioctls, the structure
returned to userland by read(2) also needs to be converted.
For this, the bpf descriptor is flagged as compat32 (or not) in the
open and ioctl functions (where the user process's pid is also updated
in the descriptor). When the bpf buffer is filled in, the 32bits or native
header is used depending on the information stored in the descriptor.

This won't work if a 64bit binary does the open and ioctls, and then
exec a 32bit program which will do the read. But this is very
unlikely to happen in real life ...

Tested on i386 and loongson; with these changes my loongson can run
dhclient and tcpdump with a n32 userland.
 1.59 30-Aug-2011  macallan support SIOCG80211NWKEY
 1.58 30-Aug-2011  macallan add WSDISPLAYIO_ADDSCREEN
 1.57 27-Aug-2011  bouyer translate WDOGIOC_GWDOGS
 1.56 04-Apr-2011  ahoka remove FLASH_GET_INFO compat as it is no longer using size_t
 1.55 19-Mar-2011  cliff compat/netbsd32 ioctl support for FLASH_GET_INFO
 1.54 01-Feb-2011  matt Define 32bit version of SIOC[GS]IFADDRPREF32. We wouldn't need this to
if i386 actually aligned a uint64_t on a 64bit boundary but it doesn't.
So all that work in sockaddr_storage goes for naught.
 1.53 22-Jan-2011  matt Fix c&p error.
 1.52 18-Jan-2011  matt branches: 1.52.2;
Make struct disklabel 8 byte aligned. This increases its size by 4 bytes
on IPL32 platforms so add code in sys_ioctl (and netbsd32_ioctl) to deal
with the older/smaller diskabel size. This change makes disklabel the
same for both IPL32 and LP64 platforms.
 1.51 24-Sep-2010  njoly branches: 1.51.2;
Add support for envsys(4) version 2 ioctls.
 1.50 19-Sep-2010  mrg add (runtime untested) support for AUDIO_WSEEK.
 1.49 19-Sep-2010  mrg add support for the netbsd 5.0 versions of the VND* ioctls.
 1.48 19-Sep-2010  mrg support VND* ioctls.
 1.47 23-Apr-2010  rmind Replace M_IOV and some malloc(9)s with kmem(9), and while there:
- Fix invalid free (M_TEMP vs M_IOV) in do_sys_recvmsg(), spotted by jakllsch@.
Also, same fix in osf1_sys_sendmsg_xopen().
- Fix attempt to free non-allocated memory in error path in netbsd32___getfh30().
- Plug a memory leak in compat_43_netbsd32_orecvmsg().
 1.46 11-Dec-2009  njoly branches: 1.46.2; 1.46.4;
In netbsd32_from_{ifreq,oifreq}(), use the compat structure size for
memcpy.

From mrg.
 1.45 10-Dec-2009  njoly Kill debug printf.
 1.44 10-Dec-2009  njoly Make netbsd32_from_{ifreq,oifreq}() copy the whole structure, not only
the interface name. Finally fix my own PR/39424.

ok by christos.
 1.43 09-Dec-2009  christos Add netbsd32_oifreq and fix issue in copying the interface name. With this
patch OSIOC{G,S}IFFLAGS is supposed to work, but unfortunately getifaddrs
seems to be the next problem getting the 4.99.x i386 ifconfig working on an
amd64 current machine.
 1.42 24-May-2009  ad More changes to improve kern_descrip.c.

- Avoid atomics in more places.
- Remove the per-descriptor mutex, and just use filedesc_t::fd_lock.
It was only being used to synchronize close, and in any case we needed
to take fd_lock to free the descriptor slot.
- Optimize certain paths for the <NDFDFILE case.
- Sprinkle more comments and assertions.
- Cache more stuff in filedesc_t.
- Fix numerous minor bugs spotted along the way.
- Restructure how the open files array is maintained, for clarity and so
that we can eliminate the membar_consumer() call in fd_getfile(). This is
mostly syntactic sugar; the main functional change is that fd_nfiles now
lives alongside the open file array.

Some measurements with libmicro:

- simple file syscalls are like close() are between 1 to 10% faster.
- some nice improvements, e.g. poll(1000) which is ~50% faster.
 1.41 02-Jul-2008  matt branches: 1.41.10; 1.41.12;
Change {ff,fd}_exclose and ff_allocated to bool. Change exclose arg to
fd_dup to bool. Switch assignments from 1/0 to true/false.

This make alpha kernels compile. Bump kern to 4.99.69 since structure
changed.
 1.40 23-Jun-2008  njoly Update compat netbsd32 SIOCGIFCONF ioctls definitions to follow native
ones.
 1.39 29-May-2008  mrg branches: 1.39.2;
remove clause #3 from my license where there are no other
copyright holders involved.
 1.38 21-Mar-2008  ad branches: 1.38.2; 1.38.4; 1.38.6;
Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
 1.37 20-Dec-2007  dsl branches: 1.37.6;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.36 08-Dec-2007  dsl branches: 1.36.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.35 15-Aug-2007  ad branches: 1.35.2; 1.35.10;
Changes to make ktrace LKM friendly and reduce ifdef KTRACE. Proposed
on tech-kern.
 1.34 30-May-2007  christos branches: 1.34.2; 1.34.6;
make this compile again
XXX: The ioctls will need to be fixed.
 1.33 20-Mar-2007  njoly Add ktrace I/O support to netbsd32_ioctl() syscall.
Reviewed by cube.
 1.32 18-Mar-2007  dsl Change all the NETBSD32PTR64(SCARG(uap, xxx))) to SCARG_P32(uap, xxx).
 1.31 16-Mar-2007  dsl remove all the double (and triple) casts used to convert 32bit userspace
pointers to and from 64bit kernel pointers. Instead use the defines
NETBSD32PTR64(p32) to read a 32bit pointer and (the new) NETBSD32PTR32(p32,p64)
to write a 32bit pointer throughout.
The 32bit pointer is now a struct to enforce the above.
amd64 (with linux emul) and sparc64 will both compile (when the arch stuff
goes in soon), and amd64 still runs some i386 binaries.
 1.30 04-Mar-2007  christos branches: 1.30.2; 1.30.4; 1.30.6;
fix fallout from caddr_t changes.
 1.29 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.28 09-Feb-2007  ad branches: 1.28.2;
Merge newlock2 to head.
 1.27 29-Jan-2007  hubertf Remove more duplicate headers.
Patch by Slava Semushin <slava.semushin@gmail.com>

Again, this was tested by comparing obj files from a pristine and a patched
source tree against an i386/ALL kernel, and also for src/sbin/fsck_ffs,
src/sbin/fsdb and src/usr.sbin/makefs. Only changes in assert() line numbers
were detected in 'objdump -d' output.
 1.26 24-Sep-2006  fvdl EPASSTHROUGH from lower layers is returned as ENOTTY to the (system) caller.
Make it so.
 1.25 24-Dec-2005  perry branches: 1.25.20; 1.25.22;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.24 11-Dec-2005  christos merge ktrace-lwp.
 1.23 26-Feb-2005  perry branches: 1.23.4;
nuke trailing whitespace
 1.22 15-Jan-2004  mrg branches: 1.22.8; 1.22.10;
begin to implement some ifreq ioctls... long long way to go.
 1.21 21-Sep-2003  jdolecek cleanup & uniform descriptor owner handling:
* introduce fsetown(), fgetown(), fownsignal() - this sets/retrieves/signals
the owner of descriptor, according to appropriate sematics
of TIOCSPGRP/FIOSETOWN/SIOCSPGRP/TIOCGPGRP/FIOGETOWN/SIOCGPGRP ioctl; use
these routines instead of custom code where appropriate
* make every place handling TIOCSPGRP/TIOCGPGRP handle also FIOSETOWN/FIOGETOWN
properly, and remove the translation of FIO[SG]OWN to TIOC[SG]PGRP
in sys_ioctl() & sys_fcntl()
* also remove the socket-specific hack in sys_ioctl()/sys_fcntl() and
pass the ioctls down to soo_ioctl() as any other ioctl

change discussed on tech-kern@
 1.20 29-Jun-2003  fvdl branches: 1.20.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.19 29-Jun-2003  martin struct proc * -> struct lwp *
 1.18 12-Apr-2003  christos get rid of the ASYNCMAP ioctls
 1.17 24-Jan-2003  fvdl Bump daddr_t to 64 bits. Replace it with int32_t in all places where
it was used on-disk, so that on-disk formats remain the same.
Remove ufs_daddr_t and ufs_lbn_t for the time being.
 1.16 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.15 23-Oct-2002  scw In preparation for COMPAT_NETBSD32 on SH-5:

- The MD netbsd32_machdep.h header now defines the 32-bit pointer type
instead of using u_int32_t everywhere,
- The MD netbsd32_machdep.h header now defines a macro (at least on
current implementations) which converts a 32-bit pointer to its 64-bit
equivalent,
- Change the MI code to utilise the above two items in all the right places,
- Implement netbsd32___sigaction_sigtramp().

Tested on Sparc64 by Matt Green.
 1.14 03-Jan-2002  mrg move sparc specific ioctl handling (fb & openprom) into arch/sparc64.
 1.13 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.12 19-Sep-2001  thorpej machine/fbio.h -> dev/sun/fbio.h
 1.11 25-Aug-2001  mrg branches: 1.11.2;
update copyright notices.
 1.10 19-Jun-2001  fvdl branches: 1.10.2;
Some of this was sparc-specific, so ifdef __sparc__ it (XXX). Also,
change the alignment of one structure with an MD ifdef. Should
be moved into the netbsd32_machdep parts.
 1.9 14-Jun-2001  thorpej Fix a partial construction problem that can cause race conditions
between creation of a file descriptor and close(2) when using kernel
assisted threads. What we do is stick descriptors in the table, but
mark them as "larval". This causes essentially everything to treat
it as a non-existent descriptor, except for fdalloc(), which sees a
filled slot so that it won't (incorrectly) allocate it again. When
a descriptor is fully constructed, the code that has constructed it
marks it as "mature" (which actually clears the "larval" flag), and
things continue to work as normal.

While here, gather all the code that gets a descriptor from the table
into a fd_getfile() function, and call it, rather than having the
same (sometimes incorrect) code copied all over the place.
 1.8 05-Dec-2000  eeh branches: 1.8.2;
Fix uninitialized pointer bug.
 1.7 19-Aug-2000  eeh Fix netbsd32_ioctls.
 1.6 09-Jul-2000  mrg - massive warning fix fest.
- fix pread/pwrite return values (plus some other syscalls that looked
similarly broken).
- prototypes and clean up for netbsd32_ioctl.c

now getpw*() works under compat32!
 1.5 30-Dec-1999  eeh branches: 1.5.4;
Update to 32-bit compatibility routines.
 1.4 11-Oct-1999  eeh branches: 1.4.2;
Add netbsd32_compat_14.c

Rename everything from compat_netbsd32 -> netbsd32 so we don't have silly
names like compat_14_compat_netbsd32_sys_shmctl().
 1.3 25-Mar-1999  mrg branches: 1.3.8;
SPARC32->NETBSD32
 1.2 25-Mar-1999  mrg move sparc32 to netbsd32; split out MD part (signal handling) (mostly via repository copy, rename and perl -pi :-)
 1.1 26-Aug-1998  mrg add a 32-bit compatibility module for the sparc64 port, so it can run NetBSD/sparc binaries with a LP64 kernel.
 1.3.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.4.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.4.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.5.4.1 26-Aug-2000  mrg pull up 1.7. approved by thorpej:
>Fix netbsd32_ioctls.
 1.8.2.8 11-Nov-2002  nathanw Catch up to -current
 1.8.2.7 23-Aug-2002  petrov lwpification.
 1.8.2.6 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.8.2.5 28-Feb-2002  nathanw Catch up to -current.
 1.8.2.4 11-Jan-2002  nathanw More catchup.
 1.8.2.3 14-Nov-2001  nathanw Catch up to -current.
 1.8.2.2 21-Sep-2001  nathanw Catch up to -current.
 1.8.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.10.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.10.2.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.11.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.20.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.20.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.20.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.20.2.2 26-Aug-2004  skrll Adapt to branch.

sparc64 GENERIC compiles.
 1.20.2.1 03-Aug-2004  skrll Sync with HEAD
 1.22.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.22.8.1 29-Apr-2005  kent sync with -current
 1.23.4.6 24-Mar-2008  yamt sync with head.
 1.23.4.5 21-Jan-2008  yamt sync with head
 1.23.4.4 03-Sep-2007  yamt sync with head.
 1.23.4.3 26-Feb-2007  yamt sync with head.
 1.23.4.2 30-Dec-2006  yamt sync with head.
 1.23.4.1 21-Jun-2006  yamt sync with head.
 1.25.22.1 22-Oct-2006  yamt sync with head
 1.25.20.3 01-Feb-2007  ad Sync with head.
 1.25.20.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.25.20.1 18-Nov-2006  ad Sync with head.
 1.28.2.2 24-Mar-2007  yamt sync with head.
 1.28.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.30.6.2 29-Mar-2007  reinoud Pullup to -current
 1.30.6.1 18-Mar-2007  reinoud First attempt to bring branch in sync with HEAD
 1.30.4.1 11-Jul-2007  mjf Sync with head.
 1.30.2.3 20-Aug-2007  ad Sync with HEAD.
 1.30.2.2 09-Jun-2007  ad Sync with head.
 1.30.2.1 10-Apr-2007  ad Sync with head.
 1.34.6.2 09-Dec-2007  jmcneill Sync with HEAD.
 1.34.6.1 16-Aug-2007  jmcneill Sync with HEAD.
 1.34.2.1 03-Sep-2007  skrll Sync with HEAD.
 1.35.10.1 26-Dec-2007  ad Sync with head.
 1.35.2.1 09-Jan-2008  matt sync with HEAD
 1.36.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.37.6.4 02-Jul-2008  mjf Sync with HEAD.
 1.37.6.3 29-Jun-2008  mjf Sync with HEAD.
 1.37.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.37.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.38.6.4 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.38.6.3 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.38.6.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.38.6.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.38.4.5 09-Oct-2010  yamt sync with head
 1.38.4.4 11-Aug-2010  yamt sync with head.
 1.38.4.3 11-Mar-2010  yamt sync with head
 1.38.4.2 20-Jun-2009  yamt sync with head
 1.38.4.1 04-May-2009  yamt sync with head.
 1.38.2.1 04-Jun-2008  yamt sync with head
 1.39.2.2 03-Jul-2008  simonb Sync with head.
 1.39.2.1 27-Jun-2008  simonb Sync with head.
 1.41.12.1 23-Jul-2009  jym Sync with HEAD.
 1.41.10.2 02-Jul-2008  matt Change {ff,fd}_exclose and ff_allocated to bool. Change exclose arg to
fd_dup to bool. Switch assignments from 1/0 to true/false.

This make alpha kernels compile. Bump kern to 4.99.69 since structure
changed.
 1.41.10.1 02-Jul-2008  matt file netbsd32_ioctl.c was added on branch christos-time_t on 2008-07-02 16:45:21 +0000
 1.46.4.3 21-Apr-2011  rmind sync with head
 1.46.4.2 05-Mar-2011  rmind sync with head
 1.46.4.1 30-May-2010  rmind sync with head
 1.46.2.2 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.46.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.51.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.52.2.1 08-Feb-2011  bouyer Sync with HEAD
 1.64.14.1 02-Aug-2015  martin Pull up following revision(s) (requested by maxv in ticket #1318):
sys/compat/netbsd32/netbsd32_ioctl.c: revision 1.82
Wrong logic. Here, userland can control the size and the data copied, which
basically means it can overflow kernel memory.
ok martin@ christos@
 1.64.12.1 02-Aug-2015  martin Pull up following revision(s) (requested by maxv in ticket #1318):
sys/compat/netbsd32/netbsd32_ioctl.c: revision 1.82
Wrong logic. Here, userland can control the size and the data copied, which
basically means it can overflow kernel memory.
ok martin@ christos@
 1.64.8.2 02-Aug-2015  martin Pull up following revision(s) (requested by maxv in ticket #1318):
sys/compat/netbsd32/netbsd32_ioctl.c: revision 1.82
Wrong logic. Here, userland can control the size and the data copied, which
basically means it can overflow kernel memory.
ok martin@ christos@
 1.64.8.1 18-Mar-2014  msaitoh Pull up following revision(s) (requested by manu in ticket #1022):
sys/compat/netbsd32/netbsd32_ioctl.h: revision 1.44
sys/compat/netbsd32/netbsd32_ioctl.c: revision 1.68
Add ATAIOCCOMMAND ioctl form COMPAT_NETBSD32
This enables SMART monitoring by a netbsd32 binary.
 1.64.6.1 02-Jun-2012  mrg sync to latest -current.
 1.64.2.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.64.2.2 30-Oct-2012  yamt sync with head
 1.64.2.1 23-May-2012  yamt sync with head.
 1.67.4.1 18-May-2014  rmind sync with head
 1.67.2.2 03-Dec-2017  jdolecek update from HEAD
 1.67.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.69.6.6 05-Feb-2017  skrll Sync with HEAD
 1.69.6.5 05-Dec-2016  skrll Sync with HEAD
 1.69.6.4 05-Oct-2016  skrll Sync with HEAD
 1.69.6.3 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.69.6.2 22-Sep-2015  skrll Sync with HEAD
 1.69.6.1 06-Jun-2015  skrll Sync with HEAD
 1.69.4.1 02-Aug-2015  martin Pull up following revision(s) (requested by maxv in ticket #930):
sys/compat/netbsd32/netbsd32_ioctl.c: revision 1.82
Wrong logic. Here, userland can control the size and the data copied, which
basically means it can overflow kernel memory.
ok martin@ christos@
 1.84.2.2 20-Mar-2017  pgoyette Sync with HEAD
 1.84.2.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.89.8.3 13-Feb-2020  martin Pull up following revision(s) (requested by mlelstv in ticket #1504):

sys/compat/netbsd32/netbsd32_ioctl.c: revision 1.108
sys/compat/netbsd32/netbsd32_ioctl.c: revision 1.109

Don't use strlcpy to copy untrusted input, it may not be NUL-terminated.

Where did the +1 came from ?
 1.89.8.2 22-Jul-2019  martin Pull up following revision(s) (requested by rin in ticket #1054):

sys/compat/netbsd32/netbsd32_ioctl.h: revision 1.65
sys/compat/netbsd32/netbsd32_ioctl.c: revision 1.98
sys/compat/netbsd32/netbsd32_ioctl.c: revision 1.99

PR/53666: Rin Okuyama: tcpdump for i386 does not work with COMPAT_NETBSD32
on amd64. Add BIOCSRTIMEOUT32.

-

Correct misleading names of dummy variables. No binary changes intended.
 1.89.8.1 27-Nov-2017  martin Pull up following revision(s) (requested by jmcneill in ticket #396):
sys/compat/netbsd32/netbsd32_ioctl.h: revision 1.57
sys/compat/netbsd32/netbsd32_ioctl.c: revision 1.90
Add support for SIOCGIFGENERIC and SIOCSIFGENERIC ioctls.
 1.91.2.6 26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.91.2.5 20-Oct-2018  pgoyette Sync with head
 1.91.2.4 30-Sep-2018  pgoyette Ssync with HEAD
 1.91.2.3 25-Sep-2018  pgoyette Additional use of NTP function pointers, since the NTP code might not
exist in the kernel. (NTP is not (yet) a module, so we don't need to
use the MP-safe mechanism.)
 1.91.2.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.91.2.1 15-Mar-2018  pgoyette Synch with HEAD
 1.92.2.3 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.92.2.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.92.2.1 10-Jun-2019  christos Sync with HEAD
 1.103.2.3 20-Nov-2024  martin Pull up following revision(s) (requested by riastradh in ticket #1921):

sys/kern/kern_event.c: revision 1.106
sys/kern/sys_select.c: revision 1.51
sys/kern/subr_exec_fd.c: revision 1.10
sys/kern/sys_aio.c: revision 1.46
sys/kern/kern_descrip.c: revision 1.244
sys/kern/kern_descrip.c: revision 1.245
sys/ddb/db_xxx.c: revision 1.72
sys/ddb/db_xxx.c: revision 1.73
sys/miscfs/fdesc/fdesc_vnops.c: revision 1.132
sys/kern/uipc_usrreq.c: revision 1.195
sys/kern/sys_descrip.c: revision 1.36
sys/kern/uipc_usrreq.c: revision 1.196
sys/kern/uipc_socket2.c: revision 1.135
sys/kern/uipc_socket2.c: revision 1.136
sys/kern/kern_sig.c: revision 1.383
sys/kern/kern_sig.c: revision 1.384
sys/compat/netbsd32/netbsd32_ioctl.c: revision 1.107
sys/miscfs/procfs/procfs_vnops.c: revision 1.208
sys/kern/subr_exec_fd.c: revision 1.9
sys/kern/kern_descrip.c: revision 1.252
(all via patch)

Load struct filedesc::fd_dt with atomic_load_consume.

Exceptions: when fd_refcnt <= 1, or when holding fd_lock.

While here:
- Restore KASSERT(mutex_owned(&fdp->fd_lock)) in fd_unused.
=> This is used only in fd_close and fd_abort, where it holds.
- Move bounds check assertion in fd_putfile to where it matters.
- Store fd_dt with atomic_store_release.
- Move load of fd_dt under lock in knote_fdclose.
- Omit membar_consumer in fdesc_readdir.
=> atomic_load_consume serves the same purpose now.
=> Was needed only on alpha anyway.

Load struct fdfile::ff_file with atomic_load_consume.
Exceptions: when we're only testing whether it's there, not about to
dereference it.

Note: We do not use atomic_store_release to set it because the
preceding mutex_exit should be enough.

(That said, it's not clear the mutex_enter/exit is needed unless
refcnt > 0 already, in which case maybe it would be a win to switch
from the membar implied by mutex_enter to the membar implied by
atomic_store_release -- which I would generally expect to be much
cheaper. And a little clearer without a long comment.)
kern_descrip.c: Fix membars around reference count decrement.

In general, the `last one out hit the lights' style of reference
counting (as opposed to the `whoever's destroying must wait for
pending users to finish' style) requires memory barriers like so:

... usage of resources associated with object ...
membar_release();
if (atomic_dec_uint_nv(&obj->refcnt) != 0)
return;
membar_acquire();
... freeing of resources associated with object ...

This way, all usage happens-before all freeing. This fixes several
errors:
- fd_close failed to ensure whatever its caller did would
happen-before the freeing, in the case where another thread is
concurrently trying to close the fd (ff->ff_file == NULL).
Fix: Add membar_release before atomic_dec_uint(&ff->ff_refcnt) in
that branch.
- fd_close failed to ensure all loads its caller had issued will have
happened-before the freeing, in the case where the fd is still in
use by another thread (fdp->fd_refcnt > 1 and ff->ff_refcnt-- > 0).
Fix: Change membar_producer to membar_release before
atomic_dec_uint(&ff->ff_refcnt).
- fd_close failed to ensure that any usage of fp by other callers
would happen-before any freeing it does.
Fix: Add membar_acquire after atomic_dec_uint_nv(&ff->ff_refcnt).
- fd_free failed to ensure that any usage of fdp by other callers
would happen-before any freeing it does.
Fix: Add membar_acquire after atomic_dec_uint_nv(&fdp->fd_refcnt).

While here, change membar_exit -> membar_release. No semantic
change, just updating away from the legacy API.
 1.103.2.2 18-Nov-2024  martin Pull up following revision(s) (requested by 1922):

tests/kernel/Makefile: revision 1.83
sys/sys/filedesc.h: revision 1.71
distrib/sets/lists/tests/mi: revision 1.1346
tests/kernel/h_cloexec.c: revision 1.1
tests/kernel/t_cloexec.c: revision 1.1
sys/compat/netbsd32/netbsd32_ioctl.c: revision 1.122
distrib/sets/lists/debug/mi: revision 1.454

tests/kernel/t_cloexec: New tests for close-on-exec.

Verified that the following tests fail on a netbsd-10 kernel:
- clonedev_posixspawn
- dup3_posixspawn
- fcntldupfd_posixspawn

PR kern/58822: close-on-exec is broken for dup3 and opening cloning
devices
sys/filedesc.h: Add a note about writing to ff_exclose.
No functional change intended -- just a reminder to avoid repeating a
class of bugs we've had.

PR kern/58822: close-on-exec is broken for dup3 and opening cloning
devices

netbsd32_ioctl: Use fd_set_exclose instead of open-coding it.
No functional change intended -- this just reduces unnecessary
copies of open-coded logic which, when copied incompletely, led to:

PR kern/58822: close-on-exec is broken for dup3 and opening cloning
devices
 1.103.2.1 13-Feb-2020  martin Pull up following revision(s) (requested by mlelstv in ticket #706):

sys/compat/netbsd32/netbsd32_ioctl.c: revision 1.108
sys/compat/netbsd32/netbsd32_ioctl.c: revision 1.109

Don't use strlcpy to copy untrusted input, it may not be NUL-terminated.

Where did the +1 came from ?
 1.106.2.1 29-Feb-2020  ad Sync with head.
 1.114.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.118.2.1 17-Apr-2021  thorpej Sync with HEAD.
 1.120.4.2 17-Nov-2024  martin Pull up following revision(s) (requested by riastradh in ticket #1007):

tests/kernel/Makefile: revision 1.83
sys/sys/filedesc.h: revision 1.71
distrib/sets/lists/tests/mi: revision 1.1346
tests/kernel/h_cloexec.c: revision 1.1
tests/kernel/t_cloexec.c: revision 1.1
sys/compat/netbsd32/netbsd32_ioctl.c: revision 1.122
distrib/sets/lists/debug/mi: revision 1.454

tests/kernel/t_cloexec: New tests for close-on-exec.
Verified that the following tests fail on a netbsd-10 kernel:
- clonedev_posixspawn
- dup3_posixspawn
- fcntldupfd_posixspawn
PR kern/58822: close-on-exec is broken for dup3 and opening cloning
devices


sys/filedesc.h: Add a note about writing to ff_exclose.
No functional change intended -- just a reminder to avoid repeating a
class of bugs we've had.
PR kern/58822: close-on-exec is broken for dup3 and opening cloning
devices


netbsd32_ioctl: Use fd_set_exclose instead of open-coding it.
No functional change intended -- this just reduces unnecessary
copies of open-coded logic which, when copied incompletely, led to:
PR kern/58822: close-on-exec is broken for dup3 and opening cloning
devices
 1.120.4.1 26-Oct-2024  martin Pull up following revision(s) (requested by rin in ticket #988):

sys/compat/netbsd32/netbsd32_ioctl.h: revision 1.80
sys/compat/netbsd32/netbsd32_ioctl.c: revision 1.121

PR 58235: add support for SIOCGIFDATA and SIOCZIFDATA ioctls.
 1.121.2.1 02-Aug-2025  perseant Sync with HEAD
 1.80 11-May-2024  martin PR 58235: add support for SIOCGIFDATA and SIOCZIFDATA ioctls.
 1.79 22-Dec-2021  roy branches: 1.79.4;
Handle the SIOCGNBRINFO ioctl for compat32.
arp -a works with compat32 now.

Credit to simonb@ for the ndp fix from which this is cribbed.
 1.78 14-Apr-2021  mlelstv Add DIOCGDISKINFO compat.
 1.77 17-Jan-2021  simonb branches: 1.77.2;
Handle the SIOCGNBRINFO_IN6 ioctl for compat32. ndp -a works with
compat32 now.
 1.76 14-Jan-2021  simonb Handle the KFILTER_BYFILTER and KFILTER_BYNAME ioctls for compat32.
Passes "atf kernel/kqueue/t_ioctl".
 1.75 14-Jan-2021  simonb Handle FSSIOCSET and FSSIOCGET; vndconfig(8) works with compat32 now.
XXX: FSSIOCSET50 and FSSIOCGET50 are not (yet) handled.
 1.74 14-Jan-2021  simonb Use netbsd32_* types instead of relying on __packed in the vnd ioctl
structures. __packed didn't work on archs where 64-bit types were
64-bit aligned with a 32-bit ABI (eg MIPS n32).

OK mrg@
 1.73 07-Sep-2020  mrg branches: 1.73.2;
remove __packed from struct netbsd32_lsdisable. the structure
is already properly aligned (the embedded int64 already has
align(4) marker applied where needed.)

same size structure generated.
 1.72 21-Jul-2020  simonb Add lockstat(1) ioctl handling.

mrg@: "looks ok."
 1.71 18-Jul-2020  jmcneill Add BIOCSETWF32 (bpf)
 1.70 18-Nov-2019  rin Sorry, revert unintentional parts of the previous commit:
http://mail-index.netbsd.org/source-changes/2019/11/18/msg110946.html

I was going to commit only netbsd32_signal.c.
 1.69 18-Nov-2019  rin Belatedly catch up with kern_sig.c rev 1.358:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/kern/kern_sig.c#rev1.358

Provide syscall information with SIGTRAP TRAP_SCE/TRAP_SCX so that
picotrace/truss, for example, works fine on COMPAT_NETBSD32.

With some minor changes:

- Centralize netbsd32_si{,32}_si{32,}() into netbsd32_ksi{,32}_ksi{32,}().
- Provide si_status with SIGCHLD.
- Remove the remaining of SA.

XXX
pullup to netbsd-9
 1.68 20-Aug-2019  christos compat32 drm ioctl support from Surya Shankar at GSoC 2019
 1.67 17-May-2019  msaitoh The max subtype of the ifmedia word is 31. It's too small for Ethernet now.
We currently use use it up to 30. We should extend the limit to be able to use
more than 10Gbps speeds. Our ifmedia(4) is inconvenience and have some problem
so we should redesign the interface, but it's too late for netbsd-9 to do it.
So, we keep the data structure size and modify the structure a bit. The
strategy is almost the same as FreeBSD. Many bits of IFM_OMASK for Ethernet
have not used, so use some of them for Ethernet's subtype.

The differences against FreeBSD are:
- We use NetBSD style compat code (i.e. no SIOCGIFXMEDIA).
- FreeBSD's IFM_ETH_XTYPE's bit location is from 11 to "14" even though
IFM_OMASK is from 8 to "15". We use _IFM_ETH_XTMASK from bit 13 to "15".
- FreeBSD changed the meaning of IFM_TYPE_MATCH(). I think we should
not do it. We keep it not changing and added new IFM_TYPE_SUBTYPE_MATCH()
macro for matching both TYPE and SUBTYPE.
- Added up to 400GBASE-SR16.

New layout of the media word is as follows (from ifmedia_h):

* if_media Options word:
* Bits Use
* ---- -------
* 0-4 Media subtype MAX SUBTYPE == 255 for ETH and 31 for others
* 5-7 Media type
* 8-15 Type specific options
* 16-18 Mode (for multi-mode devices)
* 19 (Reserved for Future Use)
* 20-27 Shared (global) options
* 28-31 Instance
*
* 3 2 1
* 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
* +-------+---------------+-+-----+---------------+-----+---------+
* | | |R| | | | |
* | IMASK | GMASK |F|MMASK+-----+ OMASK |NMASK| TMASK |
* | | |U| |XTMSK| | | |
* +-------+---------------+-+-----+-----+---------+-----+---------+
* <-----> <---> <--->
* IFM_INST() IFM_MODE() IFM_TYPE()
*
* IFM_SUBTYPE(other than ETH)<------->
*
* <---> IFM_SUBTYPE(ETH)<------->
*
*
* <-------------> <------------->
* IFM_OPTIONS()
 1.66 25-Nov-2018  mlelstv Restore netbsd32 compat code for new NPF ABI.
 1.65 11-Oct-2018  christos PR/53666: Rin Okuyama: tcpdump for i386 does not work with COMPAT_NETBSD32
on amd64. Add BIOCSRTIMEOUT32.
 1.64 29-Sep-2018  rmind NPF: Major rework -- migrate NPF to the libnv library.
- This conversion significantly simplifies the code and moves NPF to
a binary serialisation format (replacing the XML-like format).
- Fix some memory/reference leaks and possibly use-after-free bugs.
- Bump NPF_VERSION as this change makes libnpf incompatible with the
previous versions. Also, different serialisation format means NPF
connection/config saving and loading is not compatible with the
previous versions either.

Thanks to christos@ for extra testing.
 1.63 24-Sep-2018  jdolecek fix DIOCLWEDGES to at least not fail with ENOTTY due to struct size difference,
but probably more needs to be done to work if any actual wedges are configured
 1.62 24-Sep-2018  jdolecek add support for DIOCGSTRATEGY and DIOCSSTRATEGY
 1.61 06-Sep-2018  maxv Remove the network ATM code.
 1.60 02-Sep-2018  maxv remove dead references to IPF; also remove references to netccitt/, it was
removed 12 years ago.
 1.59 06-Mar-2018  mlelstv branches: 1.59.2;
Add DIOCLWEDGES
 1.58 19-Jan-2018  macallan branches: 1.58.2;
add conversion goop for WSDISPLAYIO_LDFONT and _SFONT
tested on mips64
 1.57 26-Nov-2017  jmcneill Add support for SIOCGIFGENERIC and SIOCSIFGENERIC ioctls.
 1.56 26-Dec-2016  christos branches: 1.56.8;
Sync NPF with the version on github: backport standalone NPF changes,
which allow us to create and run separate NPF instances. Minor fixes.
(from rmind@)
 1.55 12-Nov-2016  mlelstv Fix netbsd32 emulation for clockctl_ntp_adjtime.

The ioctl args reference a timex structure that needs to be
transformed to 64bit layout and back.

The 32bit ioctl definition was wrong for mips, as register_t is 64bit
for N32 abi.
 1.54 13-Jul-2016  jmcneill branches: 1.54.2;
Add netbsd32 support for drvctl(4)
 1.53 08-Dec-2015  christos Replace DIOCGPART -> DIOCGPARTINFO which returns the data needed instead of
pointers.
 1.52 01-Jun-2015  roy Add support for NPF ioctls.
 1.51 31-May-2015  roy Add support for PPPOEGETPARMS and PPPOESETPARMS.
 1.50 31-May-2015  roy Support SPPPGETAUTHCFG and SPPPSETAUTHCFG.
 1.49 27-May-2015  matt Add missing SIOCGDRVSPEC32
Fix SIOCGETSGCNT32
 1.48 20-May-2015  matt Use Elf_Sym
 1.47 20-May-2015  matt Only define the KIOC netbsd32 stuff if the KIOC ioctls have been defined.
 1.46 20-May-2015  matt Change the ksyms ioctls to more compat_netbsd32 friendly. Use _IOWR ioctls
to avoid extra copyouts. With these changes, netstat and vmstat work on
mips64eb with the normal N32 userland and a N64 kernel.
 1.45 18-May-2015  martin Implement SIOCIFGCLONERS for netbsd32, so ifconfig -C works.
 1.44 24-Jan-2014  manu branches: 1.44.6;
Add ATAIOCCOMMAND ioctl form COMPAT_NETBSD32

This enables SMART monitoring by a netbsd32 binary.
 1.43 28-May-2012  christos branches: 1.43.2; 1.43.4;
compat for 80211 ioctls from jmcneill
 1.42 11-May-2012  christos provide clockctl ioctl emulation
 1.41 28-Sep-2011  macallan branches: 1.41.2; 1.41.6; 1.41.8;
support WSDISPLAYIO_GCURSOR and WSDISPLAYIO_SCURSOR
 1.40 07-Sep-2011  macallan support ioctl(POWER_EVENT_RECVDICT) - now powerd turns my gdium's backlight
off when the lid is closed
 1.39 30-Aug-2011  bouyer Provide netbsd32 compat for bpf. Beside the ioctls, the structure
returned to userland by read(2) also needs to be converted.
For this, the bpf descriptor is flagged as compat32 (or not) in the
open and ioctl functions (where the user process's pid is also updated
in the descriptor). When the bpf buffer is filled in, the 32bits or native
header is used depending on the information stored in the descriptor.

This won't work if a 64bit binary does the open and ioctls, and then
exec a 32bit program which will do the read. But this is very
unlikely to happen in real life ...

Tested on i386 and loongson; with these changes my loongson can run
dhclient and tcpdump with a n32 userland.
 1.38 30-Aug-2011  macallan support SIOCG80211NWKEY
 1.37 30-Aug-2011  macallan add WSDISPLAYIO_ADDSCREEN
 1.36 27-Aug-2011  bouyer translate WDOGIOC_GWDOGS
 1.35 04-Apr-2011  ahoka remove FLASH_GET_INFO compat as it is no longer using size_t
 1.34 04-Apr-2011  ahoka flash_addr_t -> flash_off_t
 1.33 19-Mar-2011  cliff include flashio.h
 1.32 19-Mar-2011  cliff compat/netbsd32 ioctl support for FLASH_GET_INFO
 1.31 06-Mar-2011  bouyer merge the bouyer-quota2 branch. This adds a new on-disk format
to store disk quota usage and limits, integrated with ffs
metadata. Usage is checked by fsck_ffs (no more quotacheck)
and is covered by the WAPBL journal. Enabled with kernel
option QUOTA2 (added where QUOTA was enabled in kernel config files),
turned on with tunefs(8) on a per-filesystem
basis. mount_mfs(8) can also turn quotas on.

See http://mail-index.netbsd.org/tech-kern/2011/02/19/msg010025.html
for details.
 1.30 01-Feb-2011  matt Define 32bit version of SIOC[GS]IFADDRPREF32. We wouldn't need this to
if i386 actually aligned a uint64_t on a 64bit boundary but it doesn't.
So all that work in sockaddr_storage goes for naught.
 1.29 24-Sep-2010  njoly branches: 1.29.2; 1.29.4;
Add support for envsys(4) version 2 ioctls.
 1.28 19-Sep-2010  mrg add (runtime untested) support for AUDIO_WSEEK.
 1.27 19-Sep-2010  mrg add support for the netbsd 5.0 versions of the VND* ioctls.
 1.26 19-Sep-2010  mrg support VND* ioctls.
 1.25 09-Dec-2009  christos branches: 1.25.2; 1.25.4;
Add netbsd32_oifreq and fix issue in copying the interface name. With this
patch OSIOC{G,S}IFFLAGS is supposed to work, but unfortunately getifaddrs
seems to be the next problem getting the 4.99.x i386 ifconfig working on an
amd64 current machine.
 1.24 23-Jun-2008  njoly branches: 1.24.10;
Update compat netbsd32 SIOCGIFCONF ioctls definitions to follow native
ones.
 1.23 22-Jun-2008  njoly netbsd32_ifreq_tp_t should be of type netbsd32_pointer_t, not int32_t.
 1.22 29-May-2008  mrg branches: 1.22.2;
remove clause #3 from my license where there are no other
copyright holders involved.
 1.21 21-Mar-2008  ad branches: 1.21.2; 1.21.4; 1.21.6;
Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
 1.20 16-Mar-2007  dsl branches: 1.20.30;
remove all the double (and triple) casts used to convert 32bit userspace
pointers to and from 64bit kernel pointers. Instead use the defines
NETBSD32PTR64(p32) to read a 32bit pointer and (the new) NETBSD32PTR32(p32,p64)
to write a 32bit pointer throughout.
The 32bit pointer is now a struct to enforce the above.
amd64 (with linux emul) and sparc64 will both compile (when the arch stuff
goes in soon), and amd64 still runs some i386 binaries.
 1.19 04-Mar-2007  christos branches: 1.19.2; 1.19.4; 1.19.6;
fix fallout from caddr_t changes.
 1.18 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.17 11-Dec-2005  christos branches: 1.17.26;
merge ktrace-lwp.
 1.16 26-Feb-2005  perry branches: 1.16.4;
nuke trailing whitespace
 1.15 15-Jan-2004  mrg branches: 1.15.8; 1.15.10;
begin to implement some ifreq ioctls... long long way to go.
 1.14 29-Jun-2003  fvdl branches: 1.14.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.13 29-Jun-2003  martin struct proc * -> struct lwp *
 1.12 12-Apr-2003  christos get rid of the ASYNCMAP ioctls
 1.11 24-Jan-2003  fvdl Bump daddr_t to 64 bits. Replace it with int32_t in all places where
it was used on-disk, so that on-disk formats remain the same.
Remove ufs_daddr_t and ufs_lbn_t for the time being.
 1.10 23-Oct-2002  scw In preparation for COMPAT_NETBSD32 on SH-5:

- The MD netbsd32_machdep.h header now defines the 32-bit pointer type
instead of using u_int32_t everywhere,
- The MD netbsd32_machdep.h header now defines a macro (at least on
current implementations) which converts a 32-bit pointer to its 64-bit
equivalent,
- Change the MI code to utilise the above two items in all the right places,
- Implement netbsd32___sigaction_sigtramp().

Tested on Sparc64 by Matt Green.
 1.9 03-Jan-2002  mrg fix error in previous; pointed out by andrew brown.
 1.8 03-Jan-2002  mrg clean up
 1.7 03-Jan-2002  mrg move sparc specific ioctl handling (fb & openprom) into arch/sparc64.
 1.6 25-Aug-2001  mrg update copyright notices.
 1.5 19-Jun-2001  fvdl branches: 1.5.2;
Some of this was sparc-specific, so ifdef __sparc__ it (XXX). Also,
change the alignment of one structure with an MD ifdef. Should
be moved into the netbsd32_machdep parts.
 1.4 19-Aug-2000  eeh branches: 1.4.2;
Fix netbsd32_ioctls.
 1.3 25-Mar-1999  mrg branches: 1.3.8; 1.3.18;
move sparc32 to netbsd32; split out MD part (signal handling) (mostly via repository copy, rename and perl -pi :-)
 1.2 24-Nov-1998  mrg add some missing comment ends.
 1.1 26-Aug-1998  mrg add a 32-bit compatibility module for the sparc64 port, so it can run NetBSD/sparc binaries with a LP64 kernel.
 1.3.18.1 26-Aug-2000  mrg pull up 1.4. approved by thorpej:
>Fix netbsd32_ioctls.
 1.3.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.4.2.5 11-Nov-2002  nathanw Catch up to -current
 1.4.2.4 28-Feb-2002  nathanw Catch up to -current.
 1.4.2.3 11-Jan-2002  nathanw More catchup.
 1.4.2.2 21-Sep-2001  nathanw Catch up to -current.
 1.4.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.5.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.5.2.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.14.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.14.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.14.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.14.2.2 26-Aug-2004  skrll Adapt to branch.

sparc64 GENERIC compiles.
 1.14.2.1 03-Aug-2004  skrll Sync with HEAD
 1.15.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.15.8.1 29-Apr-2005  kent sync with -current
 1.16.4.3 24-Mar-2008  yamt sync with head.
 1.16.4.2 03-Sep-2007  yamt sync with head.
 1.16.4.1 21-Jun-2006  yamt sync with head.
 1.17.26.2 24-Mar-2007  yamt sync with head.
 1.17.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.19.6.1 18-Mar-2007  reinoud First attempt to bring branch in sync with HEAD
 1.19.4.1 11-Jul-2007  mjf Sync with head.
 1.19.2.1 10-Apr-2007  ad Sync with head.
 1.20.30.3 29-Jun-2008  mjf Sync with HEAD.
 1.20.30.2 02-Jun-2008  mjf Sync with HEAD.
 1.20.30.1 03-Apr-2008  mjf Sync with HEAD.
 1.21.6.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.21.6.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.21.4.3 09-Oct-2010  yamt sync with head
 1.21.4.2 11-Mar-2010  yamt sync with head
 1.21.4.1 04-May-2009  yamt sync with head.
 1.21.2.1 04-Jun-2008  yamt sync with head
 1.22.2.1 27-Jun-2008  simonb Sync with head.
 1.24.10.2 23-Jun-2008  njoly Update compat netbsd32 SIOCGIFCONF ioctls definitions to follow native
ones.
 1.24.10.1 23-Jun-2008  njoly file netbsd32_ioctl.h was added on branch christos-time_t on 2008-06-23 23:14:43 +0000
 1.25.4.2 21-Apr-2011  rmind sync with head
 1.25.4.1 05-Mar-2011  rmind sync with head
 1.25.2.1 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.29.4.2 15-Feb-2011  bouyer implement COMPAT_NETBSD32 quotactl syscalls (both new and COMPAT_50)
 1.29.4.1 08-Feb-2011  bouyer Sync with HEAD
 1.29.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.41.8.1 18-Mar-2014  msaitoh Pull up following revision(s) (requested by manu in ticket #1022):
sys/compat/netbsd32/netbsd32_ioctl.h: revision 1.44
sys/compat/netbsd32/netbsd32_ioctl.c: revision 1.68
Add ATAIOCCOMMAND ioctl form COMPAT_NETBSD32
This enables SMART monitoring by a netbsd32 binary.
 1.41.6.1 02-Jun-2012  mrg sync to latest -current.
 1.41.2.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.41.2.2 30-Oct-2012  yamt sync with head
 1.41.2.1 23-May-2012  yamt sync with head.
 1.43.4.1 18-May-2014  rmind sync with head
 1.43.2.2 03-Dec-2017  jdolecek update from HEAD
 1.43.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.44.6.5 05-Feb-2017  skrll Sync with HEAD
 1.44.6.4 05-Dec-2016  skrll Sync with HEAD
 1.44.6.3 05-Oct-2016  skrll Sync with HEAD
 1.44.6.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.44.6.1 06-Jun-2015  skrll Sync with HEAD
 1.54.2.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.56.8.2 22-Jul-2019  martin Pull up following revision(s) (requested by rin in ticket #1054):

sys/compat/netbsd32/netbsd32_ioctl.h: revision 1.65
sys/compat/netbsd32/netbsd32_ioctl.c: revision 1.98
sys/compat/netbsd32/netbsd32_ioctl.c: revision 1.99

PR/53666: Rin Okuyama: tcpdump for i386 does not work with COMPAT_NETBSD32
on amd64. Add BIOCSRTIMEOUT32.

-

Correct misleading names of dummy variables. No binary changes intended.
 1.56.8.1 27-Nov-2017  martin Pull up following revision(s) (requested by jmcneill in ticket #396):
sys/compat/netbsd32/netbsd32_ioctl.h: revision 1.57
sys/compat/netbsd32/netbsd32_ioctl.c: revision 1.90
Add support for SIOCGIFGENERIC and SIOCSIFGENERIC ioctls.
 1.58.2.5 26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.58.2.4 20-Oct-2018  pgoyette Sync with head
 1.58.2.3 30-Sep-2018  pgoyette Ssync with HEAD
 1.58.2.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.58.2.1 15-Mar-2018  pgoyette Synch with HEAD
 1.59.2.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.59.2.1 10-Jun-2019  christos Sync with HEAD
 1.73.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.77.2.1 17-Apr-2021  thorpej Sync with HEAD.
 1.79.4.1 26-Oct-2024  martin Pull up following revision(s) (requested by rin in ticket #988):

sys/compat/netbsd32/netbsd32_ioctl.h: revision 1.80
sys/compat/netbsd32/netbsd32_ioctl.c: revision 1.121

PR 58235: add support for SIOCGIFDATA and SIOCZIFDATA ioctls.
 1.23 23-May-2025  hannken Fix typos in SEM_PRINTF(): usemid->semid, usops->sops, use NETBSD32PTR64().

Kernels ALL/i386 and ALL/amd64 build again.
 1.22 10-May-2025  riastradh netbsd32_ipc.c: KNF
 1.21 09-May-2025  martin Change semop(2) compat code to use the common code (instead of the syscall
code directly).
Implement semtimedop(2) for compat_netbsd32.
Fixes PR 59352.
 1.20 19-Jan-2021  simonb branches: 1.20.24;
KNF consistency: No parentheses are needed around the return value.
 1.19 27-Jan-2019  pgoyette branches: 1.19.12;
Merge the [pgoyette-compat] branch
 1.18 03-Dec-2015  pgoyette branches: 1.18.16; 1.18.18;
Split out the SYSV IPC stuff into its own compat_netbsd32_sysvipc
module. Adjust dependencies as needed.
 1.17 12-Dec-2009  njoly branches: 1.17.22; 1.17.40;
Add missing semicolons after NETBSD32TOx_UAP macro calls.
 1.16 11-Jan-2009  christos merge christos-time_t
 1.15 29-May-2008  mrg branches: 1.15.6; 1.15.12;
remove clause #3 from my license where there are no other
copyright holders involved.
 1.14 20-Dec-2007  dsl branches: 1.14.6; 1.14.8; 1.14.10; 1.14.12;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.13 08-Dec-2007  dsl branches: 1.13.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.12 03-Jun-2007  dsl branches: 1.12.6; 1.12.8; 1.12.16;
Split netbsd32___semctl14() so that it is callable from
compat_10_netbsd32_sys_semsys() (where the one parameter is already in
kernel space).
Note that the code in compat_10_netbsd32_sys_semsys() has always been wrong,
since it called compat_14_sys___semctl() - which would read 64bit values!
 1.11 18-Mar-2007  dsl Change all the NETBSD32PTR64(SCARG(uap, xxx))) to SCARG_P32(uap, xxx).
 1.10 09-Feb-2007  ad branches: 1.10.2; 1.10.6; 1.10.8; 1.10.10;
Merge newlock2 to head.
 1.9 23-Jul-2006  ad branches: 1.9.4;
Use the LWP cached credentials where sane.
 1.8 06-Mar-2006  cube Implement the SysV IPC family of syscalls.
 1.7 11-Dec-2005  christos branches: 1.7.4; 1.7.6; 1.7.8;
merge ktrace-lwp.
 1.6 19-Aug-2005  christos Fix lossage I created with the 64 bit ino_t change.
 1.5 18-Jan-2003  thorpej branches: 1.5.2; 1.5.18;
Merge the nathanw_sa branch.
 1.4 23-Oct-2002  scw In preparation for COMPAT_NETBSD32 on SH-5:

- The MD netbsd32_machdep.h header now defines the 32-bit pointer type
instead of using u_int32_t everywhere,
- The MD netbsd32_machdep.h header now defines a macro (at least on
current implementations) which converts a 32-bit pointer to its 64-bit
equivalent,
- Change the MI code to utilise the above two items in all the right places,
- Implement netbsd32___sigaction_sigtramp().

Tested on Sparc64 by Matt Green.
 1.3 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.2 30-May-2001  mrg branches: 1.2.2;
use _KERNEL_OPT.
 1.1 08-Feb-2001  mrg branches: 1.1.2; 1.1.4;
split up netbsd32_netbsd.c into 9 new files, leaving only those syscalls that
have no special interpretations besides simple syscall args conversion.
 1.1.4.5 11-Nov-2002  nathanw Catch up to -current
 1.1.4.4 23-Aug-2002  petrov lwpification.
 1.1.4.3 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.1.4.2 14-Nov-2001  nathanw Catch up to -current.
 1.1.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.1.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.1.2.1 08-Feb-2001  bouyer file netbsd32_ipc.c was added on branch thorpej_scsipi on 2001-02-11 19:14:14 +0000
 1.2.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.5.18.5 21-Jan-2008  yamt sync with head
 1.5.18.4 03-Sep-2007  yamt sync with head.
 1.5.18.3 26-Feb-2007  yamt sync with head.
 1.5.18.2 30-Dec-2006  yamt sync with head.
 1.5.18.1 21-Jun-2006  yamt sync with head.
 1.5.2.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.7.8.2 11-Aug-2006  yamt sync with head
 1.7.8.1 13-Mar-2006  yamt sync with head.
 1.7.6.1 22-Apr-2006  simonb Sync with head.
 1.7.4.1 09-Sep-2006  rpaulo sync with head
 1.9.4.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.10.10.1 29-Mar-2007  reinoud Pullup to -current
 1.10.8.1 11-Jul-2007  mjf Sync with head.
 1.10.6.2 09-Jun-2007  ad Sync with head.
 1.10.6.1 10-Apr-2007  ad Sync with head.
 1.10.2.1 24-Mar-2007  yamt sync with head.
 1.12.16.1 26-Dec-2007  ad Sync with head.
 1.12.8.1 09-Jan-2008  matt sync with HEAD
 1.12.6.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.13.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.14.12.3 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.14.12.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.14.12.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.14.10.2 11-Mar-2010  yamt sync with head
 1.14.10.1 04-May-2009  yamt sync with head.
 1.14.8.1 04-Jun-2008  yamt sync with head
 1.14.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.14.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.15.12.2 04-Jan-2009  christos add new syscalls.
 1.15.12.1 29-May-2008  christos file netbsd32_ipc.c was added on branch christos-time_t on 2009-01-04 01:56:02 +0000
 1.15.6.1 19-Jan-2009  skrll Sync with HEAD.
 1.17.40.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.17.22.1 03-Dec-2017  jdolecek update from HEAD
 1.18.18.1 10-Jun-2019  christos Sync with HEAD
 1.18.16.6 13-Sep-2018  pgoyette More clean-up of module dependencies
 1.18.16.5 12-Sep-2018  pgoyette Use correct module name for dependency
 1.18.16.4 12-Sep-2018  pgoyette Split compat_netbsd32_sysvipc into version-specific modules
 1.18.16.3 11-Sep-2018  pgoyette Put the ``extern struct emul'' into the netbsd32_netbsd.h header
so it doesn't have to be separately declared in each source file.

Thanks mrg@
 1.18.16.2 13-Mar-2018  pgoyette Use correct module name for dependency
 1.18.16.1 10-Mar-2018  pgoyette Update module dependency - it now requires compat_sysvipc
 1.19.12.1 03-Apr-2021  thorpej Sync with HEAD.
 1.20.24.1 02-Aug-2025  perseant Sync with HEAD
 1.6 05-Sep-2020  riastradh Round of uvm.h cleanup.

The poorly named uvm.h is generally supposed to be for uvm-internal
users only.

- Narrow it to files that actually need it -- mostly files that need
to query whether curlwp is the pagedaemon, which should maybe be
exposed by an external header.

- Use uvm_extern.h where feasible and uvm_*.h for things not exposed
by it. We should split up uvm_extern.h but this will serve for now
to reduce the uvm.h dependencies.

- Use uvm_stat.h and #ifdef UVMHIST uvm.h for files that use
UVMHIST(ubchist), since ubchist is declared in uvm.h but the
reference evaporates if UVMHIST is not defined, so we reduce header
file dependencies.

- Make uvm_device.h and uvm_swap.h independently includable while
here.

ok chs@
 1.5 12-Dec-2019  pgoyette Rather than keeping a separate mutex, condvar, and pserialize for each
module hook, we can share a common set of synchronization structures.
This cuts the amount of cacheline_aligned data for these structures by
50%.

Note that we still have a per-hook localcount, since we need to count
individual references.

As discussed with riastradh@

Welcome to 9.99.22 !
 1.4 01-Mar-2019  pgoyette branches: 1.4.4;
Rename the MODULE_*_HOOK() macros to MODULE_HOOK_*() as briefly
discussed on irc.

NFCI intended.

Ride the earlier kernel bump - it;s getting crowded.
 1.3 29-Jan-2019  pgoyette Normalize all the compat hooks' names to the form

<subsystem>_<function>_<version>_hook

NFCI

XXX Note that although this introduces a change in the kernel-to-
XXX module interface, we are NOT bumping the kernel version number.
XXX We will bump the version number once the interface stabilizes.
 1.2 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.1 23-Sep-2018  pgoyette branches: 1.1.2;
file netbsd32_kern_proc.c was initially added on branch pgoyette-compat.
 1.1.2.8 23-Jan-2019  pgoyette Convert the macros for setting and unsetting a hook to generate
in-line code rather than using an intermediary hook##set routine.
Hooks are set and unset only in one place, so the intermediary
routine provides no benefit. IMHO using the macro at the point-
of-call is more readable than using it elsewhere in the code and
then calling the generated intermediary routine (for which you
won't even find its declaration or definition unless you remember
to search for the HOOK_SET macro instead).

NFC intended, will verify with a bulk build and an atf test run.
 1.1.2.7 22-Jan-2019  pgoyette Convert the MODULE_{,VOID_}HOOK_CALL macros to do everything in-line
rather than defining an intermediate hook##call function. Almost
all of the hooks are called only once, and although we lose the
ability of doing things like

if (MODULE_HOOK_CALL(...) == 0) ...

we simplify things quite a bit. With this change, we no longer need
to have both declaration and definition macros, and the definition
no longer needs to have both prototype argument list and a "real"
argument list.

FWIW, the above if now needs to written as

int ret;

MODULE_HOOK_CALL(..., ret);
if (ret == 0) ...

with appropriate use of braces {}.
 1.1.2.6 14-Jan-2019  pgoyette Create a variant of the HOOK macros that handles hook routines of
type void, and use them where appropriate.
 1.1.2.5 13-Jan-2019  pgoyette Remove the HOOK2 versions of the MODULE_HOOK macros. There were
only a few uses, and using them led to some lack of clarity in the
code. Instead, we now use two separate hooks, with names that
make it clear(er) what we're doing.

This also positions us to start unraveling some of the rtsock_50
mess, which will need (at least) five hooks.
 1.1.2.4 23-Sep-2018  pgoyette Use a .h file to define the xxx_{init,fini} routines, and include
the compat_stub.h header to get the definition of the kern_proc_32
hook.
 1.1.2.3 23-Sep-2018  pgoyette Use the proper test: _RUMPKERNEL vs _RUMP_KERNEL
 1.1.2.2 23-Sep-2018  pgoyette This hook doesn't exist for _RUMPSERVER
 1.1.2.1 23-Sep-2018  pgoyette More work on kern_proc_32
 1.4.4.3 08-Apr-2020  martin Merge changes from current as of 20200406
 1.4.4.2 10-Jun-2019  christos Sync with HEAD
 1.4.4.1 01-Mar-2019  christos file netbsd32_kern_proc.c was added on branch phil-wifi on 2019-06-10 22:07:02 +0000
 1.2 27-Jan-2019  pgoyette branches: 1.2.4;
Merge the [pgoyette-compat] branch
 1.1 23-Sep-2018  pgoyette branches: 1.1.2;
file netbsd32_kern_proc.h was initially added on branch pgoyette-compat.
 1.1.2.1 23-Sep-2018  pgoyette More work on kern_proc_32
 1.2.4.2 10-Jun-2019  christos Sync with HEAD
 1.2.4.1 27-Jan-2019  christos file netbsd32_kern_proc.h was added on branch phil-wifi on 2019-06-10 22:07:02 +0000
 1.3 08-Dec-2001  thorpej Make the coredump routine exec-format/emulation specific. Split
out traditional NetBSD coredump routines into core_netbsd.c and
netbsd32_core.c (for COMPAT_NETBSD32).
 1.2 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.1 06-Jun-2001  mrg branches: 1.1.2; 1.1.4;
LKM friendly: move coredump32() here
 1.1.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.2.4 28-Feb-2002  nathanw Catch up to -current.
 1.1.2.3 14-Nov-2001  nathanw Catch up to -current.
 1.1.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.1.2.1 06-Jun-2001  nathanw file netbsd32_kern_sig.c was added on branch nathanw_sa on 2001-06-21 20:00:04 +0000
 1.2 16-Jan-2004  mrg clean up a little:
- delete ktrsyscall32()
- add a check #ifdef _LP64 to do the conversion if P_32 is set to the
standard ktrsyscall()
- add a couple of similar _LP64/P_32 checks to the systrace code.

this should get systrace working for 32 bit apps as well as complete
ktrace support for "trace_enter/trace_exit" using platforms such as amd64.

XXX: systrace isn't supported on sparc64 currently... (it doesn't use
trace_enter/trace_exit, or have it's own calls to systrace_xxx()...)
 1.1 15-Jan-2004  mrg add a copy of the ktrsyscall() entry point for 32 bit emulated calls.
the main purpose of this function is to adjust the "argsize" value of
the ktrace syscall record, otherwise userland will see N/2 (rounded
down) arguments instead of N.
 1.23 14-Jan-2021  simonb Handle rev 1.62 of kern/sys_lwp.c
make _lwp_park return the remaining time to sleep in the "ts" argument
if it is a relative timestamp, as discussed in tech-kern.
for compat32. Thanks skrll@ for some cleanup tips.
 1.22 29-Jan-2020  ad branches: 1.22.6;
- Track LWPs in a per-process radixtree. It uses no extra memory in the
single threaded case. Replace scans of p->p_lwps with lookups in the
tree. Find free LIDs for new LWPs in the tree. Replace the hashed sleep
queues for park/unpark with lookups in the tree under cover of a RW lock.

- lwp_wait(): if waiting on a specific LWP, find the LWP via tree lookup and
return EINVAL if it's detached, not ESRCH.

- Group the locks in struct proc at the end of the struct in their own cache
line.

- Add some comments.
 1.21 26-Jan-2020  ad Correction to previous: don't leak newuc if copyout() fails.
 1.20 25-Jan-2020  ad - Fix a race between the kernel and libpthread, where a new thread can start
life without its self->pt_lid being filled in.

- Fix an error path in _lwp_create(). If the new LID can't be copied out,
then get rid of the new LWP (i.e. either succeed or fail, not both).

- Mark l_dopreempt and l_nopreempt volatile in struct lwp.
 1.19 21-Apr-2017  christos branches: 1.19.12; 1.19.18;
- Propagate the signal mask from the ucontext_t to the newly created thread
as specified by _lwp_create(2)
- Reset the signal stack for threads created with _lwp_create(2)
 1.18 15-May-2015  matt branches: 1.18.2; 1.18.4;
Simplify a tiny bit.
 1.17 15-May-2015  matt In lwp_ctl, convert ptr to 32 bits before copyout.
 1.16 15-May-2015  matt Fix _lwp_ctl for big endian 64-bit platforms. (little-endian too but not
as noticable).
 1.15 29-Mar-2013  christos branches: 1.15.10; 1.15.12;
compat glue for new lwp_park
 1.14 20-Jul-2012  christos branches: 1.14.2;
always allocate a full ucontext structure so that we don't corrupt memory.
XXX: needs pullup to 6?
 1.13 21-May-2012  martin Calling _lwp_create() with a bogus ucontext could trigger a kernel
assertion failure (and thus a crash in DIAGNOSTIC kernels). Independently
discovered by YAMAMOTO Takashi and Joel Sing.

To avoid this, introduce a cpu_mcontext_validate() function and move all
sanity checks from cpu_setmcontext() there. Also untangle the netbsd32
compat mess slightly and add a cpu_mcontext32_validate() cousin there.

Add an exhaustive atf test case, based partly on code from Joel Sing.

Should finally fix the remaining open part of PR kern/43903.
 1.12 05-Feb-2011  yamt branches: 1.12.4; 1.12.8; 1.12.10;
netbsd32__lwp_create: add a comment and CTASSERT.
 1.11 11-Jan-2009  christos branches: 1.11.6; 1.11.8; 1.11.10;
merge christos-time_t
 1.10 29-Apr-2008  martin branches: 1.10.8; 1.10.14;
Convert to new 2 clause license
 1.9 20-Dec-2007  dsl branches: 1.9.6; 1.9.8; 1.9.10;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.8 07-Dec-2007  ad branches: 1.8.4;
Add: _lwp_setname, _lwp_getname, _lwp_ctl.
 1.7 10-Sep-2007  cube branches: 1.7.6; 1.7.8;
Some more licence clean up.
 1.6 07-Aug-2007  ad branches: 1.6.2;
- Fix a bug with _lwp_park() where if the computed wakeup time was under
1 microsecond into the future, the thread could enter an untimed sleep.
- Change the signature of _lwp_park() to accept an lwpid_t and second
hint pointer, but do so in a way that remains compatible with older
pthread libraries. This can be used to wake another thread before the
calling thread goes asleep, saving at least one syscall + involuntary
context switch. This turns out to be a fairly large win on the condvar
benchmarks that I have tried.
- Mark some more syscalls MP safe.
 1.5 03-Jun-2007  dsl branches: 1.5.2; 1.5.6;
Split sys__lwp_park() so that the compat/netbsd32 code can copyin and convert
its timeout then call the standard function.
 1.4 18-Mar-2007  dsl Change all the NETBSD32PTR64(SCARG(uap, xxx))) to SCARG_P32(uap, xxx).
 1.3 16-Mar-2007  dsl remove all the double (and triple) casts used to convert 32bit userspace
pointers to and from 64bit kernel pointers. Instead use the defines
NETBSD32PTR64(p32) to read a 32bit pointer and (the new) NETBSD32PTR32(p32,p64)
to write a 32bit pointer throughout.
The 32bit pointer is now a struct to enforce the above.
amd64 (with linux emul) and sparc64 will both compile (when the arch stuff
goes in soon), and amd64 still runs some i386 binaries.
 1.2 04-Mar-2007  christos branches: 1.2.2; 1.2.4; 1.2.6;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.1 18-Feb-2007  cube branches: 1.1.2; 1.1.6;
Add missing lwp syscalls. Put them all together into a new file,
netbsd32_lwp.c, and remove remaining traces of SA.

This still needs some MD (and possibly MI, depending on the chosen
solution) changes to actually work.
 1.1.6.4 24-Mar-2007  yamt sync with head.
 1.1.6.3 12-Mar-2007  rmind Sync with HEAD.
 1.1.6.2 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.1.6.1 18-Feb-2007  yamt file netbsd32_lwp.c was added on branch yamt-idlelwp on 2007-02-27 16:53:38 +0000
 1.1.2.5 21-Jan-2008  yamt sync with head
 1.1.2.4 27-Oct-2007  yamt sync with head.
 1.1.2.3 03-Sep-2007  yamt sync with head.
 1.1.2.2 26-Feb-2007  yamt sync with head.
 1.1.2.1 18-Feb-2007  yamt file netbsd32_lwp.c was added on branch yamt-lazymbuf on 2007-02-26 09:09:31 +0000
 1.2.6.3 09-Dec-2007  reinoud Pullup to HEAD
 1.2.6.2 29-Mar-2007  reinoud Pullup to -current
 1.2.6.1 18-Mar-2007  reinoud First attempt to bring branch in sync with HEAD
 1.2.4.1 11-Jul-2007  mjf Sync with head.
 1.2.2.4 09-Oct-2007  ad Sync with head.
 1.2.2.3 20-Aug-2007  ad Sync with HEAD.
 1.2.2.2 09-Jun-2007  ad Sync with head.
 1.2.2.1 10-Apr-2007  ad Sync with head.
 1.5.6.3 09-Dec-2007  jmcneill Sync with HEAD.
 1.5.6.2 02-Oct-2007  joerg Sync with HEAD.
 1.5.6.1 09-Aug-2007  jmcneill Sync with HEAD.
 1.5.2.1 15-Aug-2007  skrll Sync with HEAD.
 1.6.2.2 09-Jan-2008  matt sync with HEAD
 1.6.2.1 06-Nov-2007  matt sync with HEAD
 1.7.8.2 26-Dec-2007  ad Sync with head.
 1.7.8.1 08-Dec-2007  ad Sync with head.
 1.7.6.2 27-Dec-2007  mjf Sync with HEAD.
 1.7.6.1 08-Dec-2007  mjf Sync with HEAD.
 1.8.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.9.10.2 04-May-2009  yamt sync with head.
 1.9.10.1 16-May-2008  yamt sync with head.
 1.9.8.1 18-May-2008  yamt sync with head.
 1.9.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.9.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.10.14.2 04-Jan-2009  christos add new syscalls.
 1.10.14.1 29-Apr-2008  christos file netbsd32_lwp.c was added on branch christos-time_t on 2009-01-04 01:56:02 +0000
 1.10.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.11.10.1 08-Feb-2011  bouyer Sync with HEAD
 1.11.8.1 06-Jun-2011  jruoho Sync with HEAD.
 1.11.6.1 05-Mar-2011  rmind sync with head
 1.12.10.2 21-Jul-2012  riz Pull up following revision(s) (requested by christos in ticket #431):
sys/compat/netbsd32/netbsd32_lwp.c: revision 1.14
always allocate a full ucontext structure so that we don't corrupt memory.
XXX: needs pullup to 6?
 1.12.10.1 21-May-2012  riz Pull up following revision(s) (requested by martin in ticket #274):
sys/arch/amd64/amd64/process_machdep.c: revision 1.20
sys/kern/sys_lwp.c: revision 1.54
sys/arch/sparc64/sparc64/machdep.c: revision 1.267
sys/arch/mips/mips/cpu_subr.c: revision 1.16
sys/arch/vax/vax/machdep.c: revision 1.188
sys/sys/lwp.h: revision 1.161
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.98
sys/arch/alpha/alpha/machdep.c: revision 1.339
sys/compat/sys/ucontext.h: revision 1.6
sys/arch/hppa/hppa/hppa_machdep.c: revision 1.28
distrib/sets/lists/tests/mi: revision 1.469
sys/arch/powerpc/powerpc/sig_machdep.c: revision 1.42
tests/lib/libc/sys/t_lwp_create.c: revision 1.1
tests/lib/libc/sys/Makefile: revision 1.23
sys/arch/arm/arm/sig_machdep.c: revision 1.42
sys/arch/amd64/include/mcontext.h: revision 1.15
sys/arch/amd64/amd64/machdep.c: revision 1.183
sys/arch/sh3/sh3/sh3_machdep.c: revision 1.99
sys/arch/i386/i386/machdep.c: revision 1.727
sys/compat/netbsd32/netbsd32_lwp.c: revision 1.13
sys/arch/sparc/sparc/machdep.c: revision 1.319
sys/arch/amd64/amd64/netbsd32_machdep.c: revision 1.76
sys/arch/m68k/m68k/sig_machdep.c: revision 1.49
sys/sys/ucontext.h: revision 1.16
sys/arch/mips/mips/netbsd32_machdep.c: revision 1.9
lib/libc/sys/_lwp_create.2: revision 1.5
Calling _lwp_create() with a bogus ucontext could trigger a kernel
assertion failure (and thus a crash in DIAGNOSTIC kernels). Independently
discovered by YAMAMOTO Takashi and Joel Sing.
To avoid this, introduce a cpu_mcontext_validate() function and move all
sanity checks from cpu_setmcontext() there. Also untangle the netbsd32
compat mess slightly and add a cpu_mcontext32_validate() cousin there.
Add an exhaustive atf test case, based partly on code from Joel Sing.
Should finally fix the remaining open part of PR kern/43903.
 1.12.8.1 02-Jun-2012  mrg sync to latest -current.
 1.12.4.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.12.4.2 30-Oct-2012  yamt sync with head
 1.12.4.1 23-May-2012  yamt sync with head.
 1.14.2.2 03-Dec-2017  jdolecek update from HEAD
 1.14.2.1 23-Jun-2013  tls resync from head
 1.15.12.2 28-Aug-2017  skrll Sync with HEAD
 1.15.12.1 06-Jun-2015  skrll Sync with HEAD
 1.15.10.1 16-May-2015  martin Pull up the following revisions, requested by matt in ticket #776:

src/sys/compat/netbsd32/netbsd32_lwp.c 1.15-1.18

Fix _lwp_ctl for big endian 64-bit platforms. (Little-endian too but not
as noticable).
 1.18.4.1 21-Apr-2017  bouyer Sync with HEAD
 1.18.2.1 26-Apr-2017  pgoyette Sync with HEAD
 1.19.18.2 29-Feb-2020  ad Sync with head.
 1.19.18.1 25-Jan-2020  ad Sync with head.
 1.19.12.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.22.6.1 03-Apr-2021  thorpej Sync with HEAD.
 1.23 08-Aug-2020  christos PR/55547: Dan Plassche: Fix BSD/OS binary emulation.
Centralize lcall sniffer and recognize the BSD/OS flavor.
 1.22 21-Mar-2020  pgoyette Restore code to sysctl_free() the compat32 shadow tree
 1.21 15-Mar-2020  pgoyette Use SYSCTL_SETUP mechanism to establish our sysctl tree, rather than
using explicit calls to netbsd32_sysctl_{init,fini}()
 1.20 09-Mar-2020  pgoyette Rework previous, so that the real syscall code is not invoked from within
the module_hook code. Otherwise, if the syscall just happens to be exit()
we will exit while still holding a reference to the hook's localcount, and
nothing will ever release that reference. Attempts to manually unload the
module will hang indefinitely, as will modstat(8).

XXX pullup-9
 1.19 09-Mar-2020  pgoyette If a syscall requires a module to be autoloaded, the initial invocation
of that syscall will return ERESTART. For amd64's netbsd32_syscall()
that means we need to back up the PC saved in the trap frame so we can
re-issue the syscall instruction. For "normal" syscall traps, we saved
the instruction length in the trap frame, but this was missing for the
oosyscall/lcall path. Since the PC was not backed up, the kernel-only
value ERESTART was returned to userland, causing all sort of grief for
old compat_netbsd32 executables!

XXX Pullup-9
 1.18 08-Mar-2020  pgoyette fix indentation. NFCI
 1.17 08-Mar-2020  pgoyette Fix another left-over from last year's [pgoyette-compat] work. This
allows recognition of the oosyscall sequence for amd64.

Fixes PR kern/55038

XXX pullup-9
 1.16 20-Nov-2019  pgoyette Move all non-emulation-specific coredump code into the coredump module,
and remove all #ifdef COREDUMP conditional compilation. Now, the
coredump module is completely separated from the emulation modules, and
they can all be independently loaded and unloaded.

Welcome to 9.99.18 !
 1.15 27-Jan-2019  pgoyette branches: 1.15.4;
Merge the [pgoyette-compat] branch
 1.14 26-Dec-2018  mrg remove duplicated prototypes and dated XXX comments.
 1.13 03-Dec-2015  pgoyette branches: 1.13.16; 1.13.18;
Merge the compat_sysv module into the sysv_ipc module - it should
never have been a separate module in the first place (my bad).

Adjust dependencies as appropriate.
 1.12 01-Dec-2015  pgoyette Prepare for new compat_netbsd32_mqueue module to be split out of
compat_netbsd32. Refactor the COMPAT_50 code related to mqueue,
and update the syscall definitions. Remove dependency on mqueue
from the compat_netbsd32 module (the new module will gain this
dependency).

Continuation of work on PR kern/50489
 1.11 01-Dec-2015  pgoyette Add MODULE infrastructure to netbsd32_nfssvc.c, remove dependency on it
from netbsd32_mod.c
 1.10 30-Nov-2015  pgoyette Factor the basic dependency list out of the #ifdef _KERNEL_OPT block, since
the only difference was ksem (which is available as either built-in or
loadable module).
 1.9 10-Oct-2015  pgoyette Ooops, spell the module name in full. "mqueue" vs "mq"
 1.8 10-Oct-2015  pgoyette And yet another dependency, this time on mq
 1.7 10-Oct-2015  pgoyette Add another dependency for nfsserver
 1.6 13-Jun-2015  christos we need compat_sysv now.
 1.5 22-Jul-2014  maxv branches: 1.5.2; 1.5.4;
1) On 64bit systems, don't add the 32bit execsw[] to the global exec array.
exec_elf32 works on 32bit systems only, and will crash 32bit binaries on
64bit systems.
2) Now that exec_elf32 is dormant, we can give the native ELF loaders the
highest priority.

Binaries will load faster now (system boot, compilation, etc.).

With the help of njloy@. Discussed a bit on tech-kern@, no disagreement.
 1.4 11-Jul-2014  maxv netbsd32 should depend on exec_elf32, since it will use exec_elf32's functions.
This fixes
# modload compat_netbsd32
when exec_elf32 is not loaded.

ok njoly@
 1.3 07-Mar-2014  christos branches: 1.3.2;
c99 initializers for struct execsw
 1.2 19-Sep-2013  christos exec modules need to be of the exec kind
 1.1 19-Nov-2008  ad branches: 1.1.4; 1.1.6; 1.1.8; 1.1.10; 1.1.14; 1.1.26; 1.1.36; 1.1.40;
Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.1.40.1 18-May-2014  rmind sync with head
 1.1.36.2 03-Dec-2017  jdolecek update from HEAD
 1.1.36.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.26.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.1.14.2 04-May-2009  yamt sync with head.
 1.1.14.1 19-Nov-2008  yamt file netbsd32_mod.c was added on branch yamt-nfs-mp on 2009-05-04 08:12:25 +0000
 1.1.10.2 19-Jan-2009  skrll Sync with HEAD.
 1.1.10.1 19-Nov-2008  skrll file netbsd32_mod.c was added on branch nick-hppapmap on 2009-01-19 13:17:36 +0000
 1.1.8.2 17-Jan-2009  mjf Sync with HEAD.
 1.1.8.1 19-Nov-2008  mjf file netbsd32_mod.c was added on branch mjf-devfs2 on 2009-01-17 13:28:46 +0000
 1.1.6.2 19-Nov-2008  ad Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.1.6.1 19-Nov-2008  ad file netbsd32_mod.c was added on branch christos-time_t on 2008-11-19 18:36:06 +0000
 1.1.4.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.1.4.1 19-Nov-2008  haad file netbsd32_mod.c was added on branch haad-dm on 2008-12-13 01:14:03 +0000
 1.3.2.1 10-Aug-2014  tls Rebase.
 1.5.4.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.5.4.1 22-Sep-2015  skrll Sync with HEAD
 1.5.2.2 17-Nov-2015  riz Revert ticket #1020, per pgoyette in ticket #1041.
 1.5.2.1 08-Nov-2015  riz Pull up following revision(s) (requested by pgoyette in ticket #1020):
sys/compat/netbsd32/netbsd32_mod.c: revision 1.6
sys/compat/netbsd32/netbsd32_mod.c: revision 1.7
sys/compat/netbsd32/netbsd32_mod.c: revision 1.8
sys/compat/netbsd32/netbsd32_mod.c: revision 1.9
sys/compat/linux/common/linux_mod.c: revision 1.5
Add an additional dependency on compat_sysv
Add another dependency for nfsserver
And yet another dependency, this time on mq
Ooops, spell the module name in full. "mqueue" vs "mq"
we need compat_sysv now.
 1.13.18.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.13.18.1 10-Jun-2019  christos Sync with HEAD
 1.13.16.19 25-Jan-2019  pgoyette Move the netbsd32_machine32_hook into the main kernel with most of
the other hooks.

Although this hook might better belong in compat/netbsd32/ code,
there are some machines without a netbsd32 module (for example, i386
and sgimips) which still have consumers/users of this hook. :(
 1.13.16.18 24-Jan-2019  pgoyette Rework placement of the new netbsd32_machine32_hook
 1.13.16.17 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.13.16.16 23-Sep-2018  pgoyette Use a .h file to define the xxx_{init,fini} routines, and include
the compat_stub.h header to get the definition of the kern_proc_32
hook.
 1.13.16.15 23-Sep-2018  pgoyette The kern_proc_32 hook is in the main kernel, so don't make another
one here.
 1.13.16.14 23-Sep-2018  pgoyette More work on kern_proc_32
 1.13.16.13 18-Sep-2018  pgoyette The COMPAT_HOOK macros were renamed to MODULE_HOOK, adjust all callers
 1.13.16.12 18-Sep-2018  pgoyette Use the MP-safe compat hooks for netbsd32_compat_80.c's modctl
 1.13.16.11 14-Sep-2018  pgoyette OMG it builds!

Finish rearranging the amd64 MD compat_netbsd32 code.

XXX Other architectures will be dealt with later.
 1.13.16.10 14-Sep-2018  pgoyette Work in progress - get the arch-specific netbsd32_machdep.c code to
build as a module.

XXX Doesn't work when the code is built-in to the kernel.
 1.13.16.9 14-Sep-2018  pgoyette Require coredump since netbsd32 module will be built with COREDUMP enabled.
 1.13.16.8 13-Sep-2018  pgoyette More clean-up of module dependencies
 1.13.16.7 13-Sep-2018  pgoyette Now that compat_netbsd32 is no longer monolithic, it no longer
requires compat_09 (and all higher) compat code. Adjust the
requirements list accordingly.
 1.13.16.6 11-Sep-2018  pgoyette Move netbsd32_rndpseudo_50.c out of the main netbsd32 module and into
the module that handles netbsd32_50 compatability.
 1.13.16.5 11-Sep-2018  pgoyette Install the syscalls into the netbsd32 table, not the default/native table.
 1.13.16.4 10-Sep-2018  pgoyette More work on splitting the compat_netbsd32 module
 1.13.16.3 09-Sep-2018  pgoyette The compat_netbsd32 module requires compat_09 and above. Since we
removed the alias names, we need to explicitly refer to the oldest
non-32 required compat module.
 1.13.16.2 21-Mar-2018  pgoyette Split compat/rndpseudo_50.c into two pieces, one for native compat and
a second piece for compat32. Update both modules accordingly.
 1.13.16.1 11-Mar-2018  pgoyette Update module dependencies
 1.15.4.4 10-Mar-2020  martin Pull up following revision(s) (requested by pgoyette in ticket #778):

sys/compat/netbsd32/netbsd32_mod.c: revision 1.20
sys/arch/amd64/amd64/trap.c: revision 1.127

Rework previous, so that the real syscall code is not invoked from within
the module_hook code. Otherwise, if the syscall just happens to be exit()
we will exit while still holding a reference to the hook's localcount, and
nothing will ever release that reference. Attempts to manually unload the
module will hang indefinitely, as will modstat(8).

XXX pullup-9
 1.15.4.3 09-Mar-2020  martin Pull up following revision(s) (requested by pgoyette in ticket #770):

sys/compat/netbsd32/netbsd32_mod.c: revision 1.19

If a syscall requires a module to be autoloaded, the initial invocation
of that syscall will return ERESTART. For amd64's netbsd32_syscall()
that means we need to back up the PC saved in the trap frame so we can
re-issue the syscall instruction. For "normal" syscall traps, we saved
the instruction length in the trap frame, but this was missing for the
oosyscall/lcall path. Since the PC was not backed up, the kernel-only
value ERESTART was returned to userland, causing all sort of grief for
old compat_netbsd32 executables!

XXX Pullup-9
 1.15.4.2 09-Mar-2020  martin Apply patch, requested by pgoyette in ticket #775 to fix fallout from
ticket #762:

sys/compat/netbsd32/netbsd32_mod.c (patched)

Fiy arguments to MODULE_HOOK_SET for the new amd64_oosyscall_hook.
 1.15.4.1 08-Mar-2020  martin Pull up following revision(s) (requested by pgoyette in ticket #762):

sys/arch/amd64/amd64/trap.c: revision 1.126
sys/compat/netbsd32/netbsd32_mod.c: revision 1.17
sys/compat/netbsd32/netbsd32_mod.c: revision 1.18
sys/sys/compat_stub.h: revision 1.23

Fix another left-over from last year's [pgoyette-compat] work. This
allows recognition of the oosyscall sequence for amd64.

Fixes PR kern/55038
XXX pullup-9

-

fix indentation. NFCI
 1.11 24-May-2022  andvar s/build-in/built-in/ in comments.
 1.10 01-Mar-2019  pgoyette Rename the MODULE_*_HOOK() macros to MODULE_HOOK_*() as briefly
discussed on irc.

NFCI intended.

Ride the earlier kernel bump - it;s getting crowded.
 1.9 31-Jan-2019  christos remove unused variable
 1.8 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.7 03-Sep-2018  riastradh Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.6 18-Jan-2018  maxv branches: 1.6.2; 1.6.4;
Don't return the address of the kernel modules if the user is not
privileged. Discussed on tech-kern@.
 1.5 01-Jun-2017  chs branches: 1.5.8;
remove checks for failure after memory allocation calls that cannot fail:

kmem_alloc() with KM_SLEEP
kmem_zalloc() with KM_SLEEP
percpu_alloc()
pserialize_create()
psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.
 1.4 19-Dec-2015  maxv Missing field (was here before my change).
 1.3 12-Dec-2015  maxv Put the code in charge of handling MODCTL_STAT (32bit) into a separate
function. No functional change.
 1.2 21-Jun-2015  msaitoh branches: 1.2.2;
Add missing sys/kauth.h
 1.1 20-Jun-2015  martin Implement modctl, sigqueinfo and mq_*
 1.2.2.4 28-Aug-2017  skrll Sync with HEAD
 1.2.2.3 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.2.2.2 22-Sep-2015  skrll Sync with HEAD
 1.2.2.1 21-Jun-2015  skrll file netbsd32_module.c was added on branch nick-nhusb on 2015-09-22 12:05:55 +0000
 1.5.8.2 03-Dec-2017  jdolecek update from HEAD
 1.5.8.1 01-Jun-2017  jdolecek file netbsd32_module.c was added on branch tls-maxphys on 2017-12-03 11:36:56 +0000
 1.6.4.1 10-Jun-2019  christos Sync with HEAD
 1.6.2.13 22-Jan-2019  pgoyette Convert the MODULE_{,VOID_}HOOK_CALL macros to do everything in-line
rather than defining an intermediate hook##call function. Almost
all of the hooks are called only once, and although we lose the
ability of doing things like

if (MODULE_HOOK_CALL(...) == 0) ...

we simplify things quite a bit. With this change, we no longer need
to have both declaration and definition macros, and the definition
no longer needs to have both prototype argument list and a "real"
argument list.

FWIW, the above if now needs to written as

int ret;

MODULE_HOOK_CALL(..., ret);
if (ret == 0) ...

with appropriate use of braces {}.
 1.6.2.12 18-Jan-2019  pgoyette Don't restrict hooks to having only int or void types. Pass the hook's
type to the various macros, as needed.

Allows us to reduce diffs to original in at least one or two places (we
no longer have to provide an additional parameter to the hook routine
for returning a non-int return value).
 1.6.2.11 14-Jan-2019  pgoyette Create a variant of the HOOK macros that handles hook routines of
type void, and use them where appropriate.
 1.6.2.10 13-Jan-2019  pgoyette Remove the HOOK2 versions of the MODULE_HOOK macros. There were
only a few uses, and using them led to some lack of clarity in the
code. Instead, we now use two separate hooks, with names that
make it clear(er) what we're doing.

This also positions us to start unraveling some of the rtsock_50
mess, which will need (at least) five hooks.
 1.6.2.9 29-Sep-2018  pgoyette In MODULE_HOOK_CALL_DECL we don't need to provide the actual argument
list for calling the hook function, nor do we need to provide the
default value (for when the hook has not been set).
 1.6.2.8 18-Sep-2018  pgoyette The COMPAT_HOOK macros were renamed to MODULE_HOOK, adjust all callers
 1.6.2.7 18-Sep-2018  pgoyette Use the MP-safe compat hooks for netbsd32_compat_80.c's modctl
 1.6.2.6 14-Sep-2018  pgoyette Move some extern definitions into netbsd32_netbsd.h rather than having
them in the .c files.
 1.6.2.5 11-Sep-2018  pgoyette Install the syscalls into the netbsd32 table, not the default/native table.
 1.6.2.4 10-Sep-2018  pgoyette More work on splitting the compat_netbsd32 module
 1.6.2.3 07-Sep-2018  pgoyette At the request of reviewers, remove the module alias functionality.

We will rely only on module names and duplicate-symbol detection to
detect module conflicts.
 1.6.2.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.6.2.1 03-Apr-2018  pgoyette Remove fixed allocation of modules' "required" lists (previously
limited to MAXMODDEPS entries). Update the modctl(MODCTL_STAT)
syscall to return the required data in a new format, and retain
the previous data format in MODCTL_OSTAT. Update the compat_80
and compat_netbsd32 modules as needed.
 1.7 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.6 01-Dec-2015  pgoyette branches: 1.6.16; 1.6.18; 1.6.20;
Prepare for new compat_netbsd32_mqueue module to be split out of
compat_netbsd32. Refactor the COMPAT_50 code related to mqueue,
and update the syscall definitions. Remove dependency on mqueue
from the compat_netbsd32 module (the new module will gain this
dependency).

Continuation of work on PR kern/50489
 1.5 30-Jun-2015  christos branches: 1.5.2;
whitespace police.
 1.4 30-Jun-2015  martin Fix reversed arguments in copyin(9), c.f. kern/sys_mqueue.c rev 1.39.
 1.3 21-Jun-2015  martin Move compat calls, requested by mrg@
 1.2 21-Jun-2015  martin Fix compat/versioning confusion and add the missing new versioned ones.
 1.1 20-Jun-2015  martin Implement modctl, sigqueinfo and mq_*
 1.5.2.3 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.5.2.2 22-Sep-2015  skrll Sync with HEAD
 1.5.2.1 30-Jun-2015  skrll file netbsd32_mqueue.c was added on branch nick-nhusb on 2015-09-22 12:05:55 +0000
 1.6.20.1 10-Jun-2019  christos Sync with HEAD
 1.6.18.3 11-Sep-2018  pgoyette Put the ``extern struct emul'' into the netbsd32_netbsd.h header
so it doesn't have to be separately declared in each source file.

Thanks mrg@
 1.6.18.2 11-Sep-2018  pgoyette Revert previous - it was wrong.
 1.6.18.1 11-Sep-2018  pgoyette Regen
 1.6.16.2 03-Dec-2017  jdolecek update from HEAD
 1.6.16.1 01-Dec-2015  jdolecek file netbsd32_mqueue.c was added on branch tls-maxphys on 2017-12-03 11:36:56 +0000
 1.237 20-May-2024  christos Rename dup3110 to dup3100 to match historical practice for NetBSD-11,
because we already have kevent100. Fix compat_dup3 to belong in compat_100
not compat_110.
 1.236 19-May-2024  christos version dup3
 1.235 30-Jul-2023  rin COMPAT_NETBSD32: Add support for memfd_create(2).
 1.234 30-Jul-2023  rin netbsd32_netbsd: Sort headers. No binary changes.
 1.233 20-Sep-2021  thorpej Add the eventfd(2) system call to COMPAT_NETBSD32.
 1.232 19-Jan-2021  simonb The read/write/send/recv system calls return ssize_t because -1 is
returned on error. Therefore we must restrict the lengths of any
buffers to NETBSD32_SSIZE_MAX with compat32 to avoid garbage return
values.

Fixes ATF lib/libc/sys/t_write:write_err.
 1.231 15-Jan-2021  simonb Remove unused LIMITCHECK() macro (now contained in netbsd32_rlimit.c).
 1.230 10-Oct-2020  rin branches: 1.230.2;
Teach about getrandom(2) to COMPAT_NETBSD32.
 1.229 16-May-2020  christos Add ACL support for FFS. From FreeBSD.
 1.228 20-Jun-2019  kamil branches: 1.228.2;
Add mkfifo{,at}(2) mode in mknod{,at}(2) as requested by POSIX

mknod with mode & S_IFIFO and dev=0 shall behave like mkfifo.

Update the documentation to reflect this state.

Add ATF tests.

This is an in-kernel implementation as typically user-space programs use
mkfifo(2) directly, however whenever there is need to bypass libc (like in
valgrind) then portable POSIX software calls the mknod syscall.

Noted on tech-kern@ by Greg Troxel.
 1.227 18-Jun-2019  kamil Drop unused retval pointer from do_sys_mknod{,at}()

No functional change intended.
 1.226 18-Jun-2019  christos sort -u opt_ to remove dup.
 1.225 18-Jun-2019  christos Add options for quota.
 1.224 18-Jun-2019  pgoyette Include opt_quota.h

Fixes (at least) the amd64 build.
 1.223 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.222 24-Dec-2018  mrg move mmap(), compat 40 mount(), pipe() and getfh() into their own files
as the implementation is non trivial or is compat. mark old mount()
properly instead of manually #if'ing ito to ENOSYS.
 1.221 24-Dec-2018  mrg move rlimit and quota code into their own modules.

(netbsd32_netbsd.c should have only simple shims. anything more
than copying arguments from one args struct to the other should
not be placed in this file. still a couple more to move out.)
 1.220 24-Dec-2018  mrg fix style consistency.
remove obsolete comments or commented code.
NFC.
 1.219 24-Dec-2018  mrg pset_create() takes a pointer so it needs special handling.
 1.218 10-Aug-2018  pgoyette Allow syscall_establish() to install new syscalls when the existing
entry-point is either sys_nomodule or sys_nosys. Update the
makesyscalls.sh script to create a const array of bits to allow
syscall_disestablish() to properly restore the original entry-point.
Update all the initializers of struct emul to initialize the pointer
to the bit array struct emul.

XXX Regen of all files created by makesyscalls.sh will come soon,
XXX followed by a kernel version bump (since struct emul is being
XXX modified).

This commit should address PR kern/45781 and also removes the need
for the work-around for that PR in file

sys/arch/usermode/modules/syscallemu/syscallemu.c
 1.217 31-Jul-2018  rjs Add getsockopt2().
 1.216 06-May-2018  kamil branches: 1.216.2;
Remove an element from struct emul: e_tracesig

e_tracesig used to be implemented for Darwin compat. Nowadays the Darwin
compatiblity layer is gone and there are no other users.

This functionality isn't used where it shall be used in the existing
codebase.

If we want to emulate debugging interfaces in compat layers we would need
to implement that from scratch anyway. We would need to be bug compatible
with other OSes too.

Proposed on tech-kern@.

Welcome to NetBSD 8.99.16!

Sponsored by <The NetBSD Foundation>
 1.215 15-Mar-2018  christos Untangle the swapctl compat code mess. Welcome to lucky 13.
 1.214 09-Jan-2018  maya branches: 1.214.2;
remove struct emul's e_fault.

It used to be used by COMPAT_IRIX for the purpose of overriding
uvm_fault (only implemented in MIPS), now removed.

Ride 8.99.12 version bump.
 1.213 06-Jan-2018  kamil Revert vadvise(2) removal

This system call was used in legacy Lisp code, that was inherited to modern
age and still compiled against supported compat layers (e.g. in clisp,
oaklisp, Franz Lisp).

It used to instruct the kernel about paging policy (G/C aware, flush etc).

Newly compiled code (assuming that it will detect vadvise()) will use the
libc stub for vadvise(). The headers for this interface are gone.

vadvise(2) could be marked as COMPAT_80, but as long as we support ultrix,
sunos or aout68k ABI, don't bother with this.

Requested by <mrg>
 1.212 26-Dec-2017  kamil Refactor pipe1() and correct a bug in sys_pipe2() (SYS_pipe2)

sys_pipe2() returns two integers (values), the 2nd one is a copy of the 2nd
file descriptor that lands in fildes[2]. This is a side effect of reusing
the code for sys_pipe() (SYS_pipe) and not cleaning it up.

The first returned value is (on success) 0.

Introduced a small refactoring in pipe1() that it does not operate over
retval[], but on an array int[2]. A user sets retval[] for pipe() when
desired and needed.

This refactoring touches compat code: netbsd32, linux, linux32.

Before the changes on NetBSD/amd64:

$ ktruss -i ./a.out
[...]
15131 1 a.out pipe2(0x7f7fff2e62b8, 0) = 0, 4
[...]

After the changes:

$ ktruss -i ./a.out
[...]
782 1 a.out pipe2(0x7f7fff97e850, 0) = 0
[...]

There should not be a visible change for current users.

Sponsored by <The NetBSD Foundation>
 1.211 19-Dec-2017  kamil Drop SYS_vadvise

The (o)vadvise syscall is dummy since the beginning of NetBSD.

It is an obsolete remnant from the old UNIX.

Sponsored by <The NetBSD Foundation>
 1.210 19-Dec-2017  kamil Drop SYS_sbrk

sbrk - change data segment size

This syscall is dummy since the inception of the project.

Sponsored by <The NetBSD Foundation>
 1.209 19-Dec-2017  kamil Drop the sstk(2) syscall stub

sstk - change stack section size

This functionality has never been implemented and is a remnant from 16-bit
UNIX. This stub appeared with the first NetBSD commit.

Sponsored by <The NetBSD Foundation>
 1.208 06-Dec-2017  christos disable 32 bit signal ktrace records; 32 bit traced process produce 64 bit
trace records, the only record that we can't parse is that one :-)
XXX: pullup-8
 1.207 31-Jul-2017  maxv Remove references to COMPAT_OLDSOCK (itself removed years ago).
 1.206 29-Apr-2017  christos branches: 1.206.2;
move MAP_COPY in compat
 1.205 19-Oct-2016  skrll branches: 1.205.6;
PR kern/51514: ptrace(2) fails for 32-bit process on 64-bit kernel

Updated from the original patch in the PR by me.
 1.204 17-Sep-2016  christos deal with not having KTRACE
 1.203 13-Sep-2016  martin Allow emulations to override the creation of ktrace records for posting
signals. In compat_netbsd32 use this to write the 32bit version of
the records, so a 32bit userland kdump is happy.
 1.202 10-Sep-2016  skrll Trailing whitespace
 1.201 10-Sep-2016  skrll +netbsd32__sched_protect
 1.200 13-May-2016  christos branches: 1.200.2;
clamp getrlimit the same way we clamp setrlimit
 1.199 28-Feb-2016  khorben Add missing newline character in error message

This is related to kern/50469.
 1.198 01-Dec-2015  pgoyette Adapt to per-emulation syscall_autoload capability (the table of syscalls
that can be autoloaded is currently empty).
 1.197 30-Jul-2015  maxv Lock before calling uvm_swap_stats(). Otherwise a race condition could
corrupt memory.
 1.196 21-Jun-2015  martin Implement trivial conversion for pset_*
 1.195 16-Jun-2015  martin Implement posix_fallocate and fdiscard compat
 1.194 16-Jun-2015  matt Fix a comment.
 1.193 31-Jul-2014  maxv branches: 1.193.2; 1.193.4; 1.193.6; 1.193.10;
Just return sys_open(). COMPAT_10 will be handled internally.

ok christos@
 1.192 28-Jun-2014  dholland Revert the following changes:

src/sys/sys/quotactl.h 1.37
src/sys/compat/netbsd32/netbsd32.h 1.101
src/sys/compat/netbsd32/netbsd32_netbsd.c 1.188, 1.189
src/sys/kern/vfs_quotactl.c 1.39
src/sys/kern/vfs_syscalls.c 1.483
src/sys/ufs/lfs/ulfs_quota.c 1.11
src/sys/ufs/ufs/ufs_quota.c 1.116
src/lib/libquota/quota_kernel.c 1.5

and do them correctly.

If you're going to change the name of something, you need to change
the name of *all* the things with the same name, not just a handful,
and you should change it to something similar so it still matches the
rest of the system rather than just picking an arbitrarily different
name.

Hi, Joerg.

To wit, rename the quotactl "delete" operation to "del", because
"delete" is a reserved word in C++ and for some reason Joerg wants to
run internal interfaces used only by C code through his C++ compiler.
Do not rename it to "remove" instead, because this doesn't match
libquota or the rest of the usage throughout the system; and rename
all the related identifiers, not just the ones that blew the mind of
Joerg's C++ compiler.

Because this is not a user-facing API (the only userland consumer
sys/quotactl.h is libquota) it is sort of ok to make arbitrary
source-incompatible changes; however, by the same token it's completely
unnecessary. If it *were* a user-facing API that someone might have a
semi-rational reason to want to run a C++ compiler on, it would be
incorrect to change it at this point.
 1.191 28-Jun-2014  maxv Sync getfh() with the native implementation. It also fixes:
a) a return value
b) a vnode lock
c) a user-controlled memory allocation

ok christos@, on tech-kern
 1.190 22-Jun-2014  maxv Sync swapctl() with netbsd32. Return EINVAL when misc<0, and 0 when misc=0
or uvmexp.nswapdev=0.
 1.189 13-Jun-2014  joerg delete -> remove
 1.188 12-Jun-2014  joerg Don't t use a C++ keyword as field name.
 1.187 15-May-2014  manu Fix cases where count <= 0 (thanks to Maxime Villard for raising this)
 1.186 30-Apr-2014  njoly Do not use native off_t type under compat netbsd32, but a new
netbsd32_off_t that provide the expected alignment for 64bit types.
 1.185 22-Mar-2014  maxv branches: 1.185.2;
Fix a potential - but very unlikely - NULL pointer dereference.
(it does not introduce a new error code for open(), since
pathbuf_copyin() is already there and can return ENOMEM)

Found by my code scanner.
 1.184 03-Feb-2014  manu Properly translate struct swapent for COMPAT_NETBSD32
 1.183 25-Jan-2014  christos ifdef debug printf
 1.182 25-Jan-2014  christos compat_10 fix: open(NULL) == open(".");
 1.181 18-Jul-2013  matt Move *at syscall handlers to netbsd32_fs.c from netbsd32_netbsd.c
Fix netbsd32_fstatat to emit a 32bit stat structure.
 1.180 19-Feb-2012  rmind branches: 1.180.2; 1.180.4; 1.180.10;
Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.
 1.179 01-Feb-2012  dholland branches: 1.179.2;
Improve the names of some members of struct quotactl_args. These are
effectively function parameter names, but since they need to be
described with the same names in the man page the choices do matter.
Some.
 1.178 01-Feb-2012  dholland Update compat_netbsd32 for new quotactl.
 1.177 31-Jan-2012  matt Add missing *at syscalls among others
 1.176 29-Jan-2012  dholland Add vfs_quotactl() in between the syscall and VFS_QUOTACTL. Call it
from the COMPAT_50 code as well as the current sys_quotactl instead
of going directly to VFS_QUOTACTL. Doesn't actually do anything yet.
 1.175 15-Nov-2011  njoly branches: 1.175.4;
Fix pipe2 return value.
 1.174 08-Nov-2011  njoly Add kqueue1(2) support.
 1.173 31-Aug-2011  njoly branches: 1.173.2;
Add dup3 syscall support.
 1.172 05-Jul-2011  njoly Add pipe2 syscall now needed for popen(3).
 1.171 05-Jun-2011  dsl Delete some splurious commas and very unexpected trailing space
 1.170 01-May-2011  rmind branches: 1.170.2;
Catch up with lim_privatise() change (missed in previous commit).
 1.169 06-Mar-2011  bouyer merge the bouyer-quota2 branch. This adds a new on-disk format
to store disk quota usage and limits, integrated with ffs
metadata. Usage is checked by fsck_ffs (no more quotacheck)
and is covered by the WAPBL journal. Enabled with kernel
option QUOTA2 (added where QUOTA was enabled in kernel config files),
turned on with tunefs(8) on a per-filesystem
basis. mount_mfs(8) can also turn quotas on.

See http://mail-index.netbsd.org/tech-kern/2011/02/19/msg010025.html
for details.
 1.168 19-Nov-2010  dholland branches: 1.168.2; 1.168.4;
Introduce struct pathbuf. This is an abstraction to hold a pathname
and the metadata required to interpret it. Callers of namei must now
create a pathbuf and pass it to NDINIT (instead of a string and a
uio_seg), then destroy the pathbuf after the namei session is
complete.

Update all namei call sites accordingly. Add a pathbuf(9) man page and
update namei(9).

The pathbuf interface also now appears in a couple of related
additional places that were passing string/uio_seg pairs that were
later fed into NDINIT. Update other call sites accordingly.
 1.167 23-Apr-2010  rmind Replace M_IOV and some malloc(9)s with kmem(9), and while there:
- Fix invalid free (M_TEMP vs M_IOV) in do_sys_recvmsg(), spotted by jakllsch@.
Also, same fix in osf1_sys_sendmsg_xopen().
- Fix attempt to free non-allocated memory in error path in netbsd32___getfh30().
- Plug a memory leak in compat_43_netbsd32_orecvmsg().
 1.166 02-Mar-2010  pooka branches: 1.166.2;
remove nfssvc emulation (or non-emulation)
 1.165 02-Mar-2010  pooka -fs_lfs.h
 1.164 02-Mar-2010  pooka remove unused lfs compat stubs
 1.163 14-Dec-2009  matt branches: 1.163.2;
Merge from matt-nb5-mips64
 1.162 12-Dec-2009  njoly Add missing semicolons after NETBSD32TOx_UAP macro calls.
 1.161 10-Dec-2009  matt Move saemul_netbsd32 to netbsd32_sa.c and allow the KERN_SA bits to be omitted.
 1.160 21-Nov-2009  njoly Kill redundant assignment.
 1.159 25-Oct-2009  rmind Initialise struct emul members by name (it is readable now and one can search
them in the tree).
 1.158 09-Aug-2009  haad Add enum uio_seg argument to do_sys_mknod and do_sys_mkdir so these functions
can be called from kernel, too.

Change needed for zfs device node creation, until we have propoer devfs.

Oked by ad@.
 1.157 17-May-2009  pooka pad -> PAD. Fixes build problem reported by Paul Goyette in private email.
 1.156 16-Mar-2009  njoly Fix dev_t alignment, by not using the new 64bit value directly but
rather a 32bit aligned version (netbsd32_dev_t = netbsd32_uint64).

ok by cube@.
 1.155 04-Mar-2009  skrll Fix the posix_fadvise return value... finally.

Tested martin on sparc64/m68k and me on hppa.
 1.154 30-Jan-2009  njoly branches: 1.154.2;
Cleanup. Kill a few netbsd32_caddr_t in syscalls argument types.
 1.153 21-Jan-2009  tron Revert accidental of some rogue changes which broke the build.
 1.152 20-Jan-2009  tron Include "bsd.own.mk" to get the definition of "NETBSDSRCDIR" via
"/etc/mk.conf". This fixes manual use of "make cleandir".
 1.151 11-Jan-2009  nakayama Follow christos-time_t merge.
 1.150 11-Jan-2009  christos merge christos-time_t
 1.149 22-Nov-2008  mrg branches: 1.149.4;
implement netbsd32__sched_setparam(), netbsd32__sched_getparam(),
netbsd32__sched_setaffinity() and netbsd32__sched_getaffinity().
 1.148 20-Nov-2008  tron Make it possible to compile a kernel with COMPAT_NETBSD32 but without
COMPAT_40. This fixes PR port-amd64/39967.
 1.147 19-Nov-2008  ad Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.146 12-Nov-2008  ad Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.
 1.145 15-Oct-2008  wrstuden branches: 1.145.2; 1.145.4;
Merge wrstuden-revivesa into HEAD.
 1.144 29-May-2008  mrg branches: 1.144.4;
remove clause #3 from my license where there are no other
copyright holders involved.
 1.143 21-Mar-2008  ad branches: 1.143.2; 1.143.4; 1.143.6;
Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
 1.142 24-Feb-2008  martin Remove old posix_fadvise compat code
 1.141 28-Jan-2008  martin branches: 1.141.2; 1.141.6;
wrong argument type
 1.140 27-Jan-2008  martin Catch up with versioning of posix_fadvise
 1.139 27-Jan-2008  dsl Call do_posix_fadvise() in netbsd32_posix_fadvise()
 1.138 26-Jan-2008  dsl Split the return value of sys_lseek() into two 32 bit halves for retval[0/1]
in a manner that is endianness independant.
Should mean the amd64 will return correct offsets > 2^32 (sparc64 had a
special define).
Any new netbsd32 ports should work regardless of the endianness.
 1.137 26-Jan-2008  dsl Don't try to bound the return value for pread/pwrite/pathconf by casting
an 'ssize_t' or 'long' variable to 'register_t'.
If the sizes were different it would either overwrite stack or return
uninitialised stack. On big-endian systems things would be worse!
 1.136 26-Jan-2008  dsl Add a wrapper for posix_fadvise()
 1.135 19-Jan-2008  dsl Add netbsd32 wrapper for sys_mremap(), compiles, and assuming the mmap()
wrapper is ok, it should work!
I presume the kernel knows not to map above 4GB though....
 1.134 20-Dec-2007  dsl Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.133 09-Dec-2007  wiz branches: 1.133.2;
Remove last argument from NDINIT call, following
"Remove cn_lwp from struct componentname. curlwp should be used
from on. The NDINIT() macro no longer takes the lwp parameter and
associates the credentials of the calling thread with the namei
structure." from pooka.
 1.132 08-Dec-2007  dsl branches: 1.132.2;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.131 04-Dec-2007  dsl Remove all the __P
 1.130 10-Nov-2007  dsl branches: 1.130.2;
Fix builds for ports that don't define __HAVE_MINIMAL_EMUL (eg sparc64).
Fallout from a change that made #define names for syscalls (etc) start
NETBSD32 (not netbsd32).
 1.129 09-Nov-2007  dsl Add arguments to sys_syscall and sys___syscall.
Use MI wrappers for them in netbsd32.
Change prefix for constants from netbsd32 to NETBSD32 (used in #defines etc).
 1.128 29-Sep-2007  dsl branches: 1.128.2; 1.128.4;
Change the way p->p_limit (and hence p->p_rlimit) is locked.
Should fix PR/36939 and make the rlimit code MP safe.
Posted for comment to tech-kern (non received!)

The p_limit field (for a process) is only be changed once (on the first
write), and a reference to the old structure is kept (for code paths
that have cached the pointer).
Only p->p_limit is now locked by p->p_mutex, and since the referenced memory
will not go away, is only needed if the pointer is to be changed.
The contents of 'struct plimit' are all locked by pl_mutex, except that the
code doesn't bother to acquire it for reads (which are basically atomic).
Add FORK_SHARELIMIT that causes fork1() to share the limits between parent
and child, use it for the IRIX_PR_SULIMIT.
Fix borked test for both IRIX_PR_SUMASK and IRIX_PR_SDIR being set.
 1.127 21-Sep-2007  dsl branches: 1.127.2;
Rename members of 'struct plimit' so that the fields are 'pl_xxx' and
no longer have the same names as members of 'struct proc'.
 1.126 15-Aug-2007  ad branches: 1.126.2;
Changes to make ktrace LKM friendly and reduce ifdef KTRACE. Proposed
on tech-kern.
 1.125 14-Jul-2007  dsl branches: 1.125.2; 1.125.6;
Adapt for sys_mount() becoming compat_40_sys_mount(),
 1.124 30-Jun-2007  dsl Changes to sompat socket function to avoid the dreaded stackgap.
 1.123 22-Apr-2007  dsl Delete a diagnostic printf and some unused 'stack gap' initialisation.
 1.122 22-Apr-2007  dsl Change the way that emulations locate files within the emulation root to
avoid having to allocate space in the 'stackgap'
- which is very LWP unfriendly.
The additional code for non-emulation namei() is trivial, the reduction for
the emulations is massive.
The vnode for a processes emulation root is saved in the cwdi structure
during process exec.
If the emulation root the TRYEMULROOT flag are set, namei() will do an initial
search for absolute pathnames in the emulation root, if that fails it will
retry from the normal root.
".." at the emulation root will always go to the real root, even in the middle
of paths and when expanding symlinks.
Absolute symlinks found using absolute paths in the emulation root will be
relative to the emulation root (so /usr/lib/xxx.so -> /lib/xxx.so links
inside the emulation root don't need changing).
If the root of the emulation would be returned (for an emulation lookup), then
the real root is returned instead (matching the behaviour of emul_lookup,
but being a cheap comparison here) so that programs that scan "../.."
looking for the root dircetory don't loop forever.
The target for symbolic links is no longer mangled (it used to get the
CHECK_ALT_xxx() treatment, so could get /emul/xxx prepended).
CHECK_ALT_xxx() are no more. Most of the change is deleting them, and adding
TRYEMULROOT to the flags to NDINIT().
A lot of the emulation system call stubs could now be deleted.
 1.121 18-Mar-2007  dsl Change all the NETBSD32PTR64(SCARG(uap, xxx))) to SCARG_P32(uap, xxx).
 1.120 16-Mar-2007  dsl remove all the double (and triple) casts used to convert 32bit userspace
pointers to and from 64bit kernel pointers. Instead use the defines
NETBSD32PTR64(p32) to read a 32bit pointer and (the new) NETBSD32PTR32(p32,p64)
to write a 32bit pointer throughout.
The 32bit pointer is now a struct to enforce the above.
amd64 (with linux emul) and sparc64 will both compile (when the arch stuff
goes in soon), and amd64 still runs some i386 binaries.
 1.119 04-Mar-2007  christos branches: 1.119.2; 1.119.4; 1.119.6;
fix fallout from caddr_t changes.
 1.118 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.117 19-Feb-2007  cube Introduce a new member to struct emul, e_startlwp, to be used by
sys__lwp_create. It allows using the said syscall under COMPAT_NETBSD32.

The libpthread regression tests now pass on amd64 and sparc64.
 1.116 09-Feb-2007  ad branches: 1.116.2;
Merge newlock2 to head.
 1.115 21-Nov-2006  christos deal with RLIM_INFINITY in the setrlimit case.
 1.114 21-Nov-2006  christos Simplify previous commit not to use dosetrlimit(), since we don't want the
kauth tests etc.
 1.113 21-Nov-2006  christos From Nicolas Joly:

> It seems that 32bits programs, running under compat_netbsd32, using
> setrlimit force all other programs to have their maximum data size
> fixed at 3GB, where native 64bits apps used 8GB previously.

I tracked this one to the `netbsd32_adjust_limits()' function (called
when creating a new process under compat_netbsd32), where data and
stack limits are set without checking for shared `p_limit' structure
(p_limit->p_refcnt > 1). This explain the side effect where processes
have their limits changed when a compat_netbsd32 (or compat_linux32)
program is run.

The fix is to use `dosetrlimit()' to ensure the needed copy-on-write
behaviour for shared structure.
 1.112 14-Nov-2006  elad Clean some KAUTH_GENERIC_ISSUSER usage in compat code.
 1.111 01-Sep-2006  matt branches: 1.111.2; 1.111.4;
When calling PTRACE from an LKM, use sysent[SYS_ptrace].sy_call in case
the sys_ptrace symbol isn't present.
 1.110 30-Aug-2006  cube Protect netbsd32_ptrace with options PTRACE.
 1.109 31-Jul-2006  martin Make filehandles opaque to userland
 1.108 23-Jul-2006  ad Use the LWP cached credentials where sane.
 1.107 13-Jul-2006  pavel do not protect the getfh syscall by
#if defined(NFS) || defined(NFSSERVER).
The native syscall also isn't.
 1.106 13-Jul-2006  martin Fix alignement problems for fhandle_t, exposed by gcc4.1.

While touching all vptofh/fhtovp functions, get rid of VFS_MAXFIDSIZ,
version the getfh(2) syscall and explicitly pass the size available in
the filehandle from userland.

Discussed on tech-kern, with lots of help from yamt (thanks!).
 1.105 26-Jun-2006  mrg version the socket(2) syscall. for compat30 socket, we use
EPROTONOSUPPORT instead of EAFNOSUPPORT.

from pavel@ with a little bit of clean up from myself.

XXX: netbsd32 (and perhaps other emulations) should be able
XXX: to call the standard socket calls for this i think, but
XXX: revisit this at another time.
 1.104 14-May-2006  elad branches: 1.104.4;
integrate kauth.
 1.103 11-May-2006  mrg use socklen_t where appropriate.
 1.102 05-May-2006  cube Move fhstat as sys___fhstat30 in netbsd32_fs.c because it doesn't belong
to netbsd32_netbsd.c (which incidentally means it had been broken for a
while I guess). Add compat_30 version.
 1.101 29-Mar-2006  cube Implement the _lwp* and sa_* families of syscalls, using the newly
introduced hooks in the native code.
 1.100 09-Feb-2006  manu branches: 1.100.2; 1.100.4; 1.100.6;
Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.99 11-Dec-2005  christos branches: 1.99.2; 1.99.4; 1.99.6;
merge ktrace-lwp.
 1.98 19-Aug-2005  christos Fix lossage I created with the 64 bit ino_t change.
 1.97 12-Jul-2005  martin When returning 64bit values (from netbsd32_lseek) fix up the return
value vector (of 32bit values, most likely) via a MD macro.
 1.96 12-Jul-2005  cube Add the *xattr(2) family of syscalls. Just like the *extattr(2) family,
they're waiting for an actual FS back-end to be tested, but are still
straightforward enough.
 1.95 11-Jul-2005  cube Add rasctl(2). Thanks to the regression tests for that syscall, I was able
to discover the bugs in netbsd32_setitimer() and netbsd32_execve().
 1.94 10-Jul-2005  cube Add support for fsync_range(2).
 1.93 10-Jul-2005  cube Implement __clone(2).
 1.92 08-Jul-2005  cube Add mlockall(2) and munlockall(2).
 1.91 08-Jul-2005  cube Implement the extattr(3) family of syscalls.

XXX However, those remain untested as there are currently no backend for
XXX extattr(9) in NetBSD.
 1.90 04-Jul-2005  cube branches: 1.90.2;
Implement uuidgen(2).
 1.89 30-May-2005  chs track change to swapctl args in kern/syscalls.master.
 1.88 26-Mar-2005  fvdl Fix some things regarding COMPAT_NETBSD32 and limits/VM addresses.

* For sparc64 and amd64, define *SIZ32 VM constants.
* Add a new function pointer to struct emul, pointing at a function
that will return the default VM map address. The default function
is uvm_map_defaultaddr, which just uses the VM_DEFAULT_ADDRESS
macro. This gives emulations control over the default map address,
and allows things to be mapped at the right address (in 32bit range)
for COMPAT_NETBSD32.
* Add code to adjust the data and stack limits when a COMPAT_NETBSD32
or COMPAT_SVR4_32 binary is executed.
* Don't use USRSTACK in kern_resource.c, use p_vmspace->vm_minsaddr
instead (emulations might have set it differently)
* Since this changes struct emul, bump kernel version to 3.99.2

Tested on amd64, compile-tested on sparc64.
 1.87 26-Feb-2005  perry branches: 1.87.2;
nuke trailing whitespace
 1.86 17-Jun-2004  cube branches: 1.86.4; 1.86.6;
o Add support for the statvfs family of syscalls (statvfs1, fstatvfs1,
fhstatvfs1 and getvfsstat)
o Move the statfs family out of netbsd32_fs.c and netbsd32_netbsd.c to
netbsd_compat_20.c, compiled with COMPAT_20

Reviewed by christos@.
 1.85 22-Apr-2004  christos Add the missing 'v' to fhstatvfs1
 1.84 21-Apr-2004  christos try to make this compile. XXX: this will not work yet (hi simon)
 1.83 21-Apr-2004  christos Replace the statfs() family of system calls with statvfs().
Retain binary compatibility.
 1.82 26-Mar-2004  drochner use netbsd32_sigcode with COMPAT_16 only
 1.81 21-Mar-2004  mrg fix a (syscall args) comment.
 1.80 20-Dec-2003  fvdl Put back Emmanuel's sigfilter hooks, as decided by Core.
 1.79 20-Dec-2003  manu Introduce lwp_emuldata and the associated hooks. No hook is provided for the
exec case, as the emulation already has the ability to intercept that
with the e_proc_exec hook. It is the responsability of the emulation to
take appropriaye action about lwp_emuldata in e_proc_exec.

Patch reviewed by Christos.
 1.78 05-Dec-2003  jdolecek back the sigfilter emulation hook change off
 1.77 04-Dec-2003  atatat Dynamic sysctl.

Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.

Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.

All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.

PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
 1.76 03-Dec-2003  manu Add a sigfilter emulation hook. It is used at the beginning of kpsignal2()
so that a specific emulation has the oportunity to filter out some signals.

if sigfilter returns 0, then no signal is sent by kpsignal2().

There is another place where signals can be generated: trapsignal. Since this
function is already an emulation hook, no call to the sigfilter hook was
introduced in trapsignal.

This is needed to emulate the softsignal feature in COMPAT_DARWIN (signals
sent as Mach exception messages)
 1.75 26-Sep-2003  christos Add necessary include file.
 1.74 24-Aug-2003  chs add support for non-executable mappings (where the hardware allows this)
and make the stack and heap non-executable by default. the changes
fall into two basic catagories:

- pmap and trap-handler changes. these are all MD:
= alpha: we already track per-page execute permission with the (software)
PG_EXEC bit, so just have the trap handler pay attention to it.
= i386: use a new GDT segment for %cs for processes that have no
executable mappings above a certain threshold (currently the
bottom of the stack). track per-page execute permission with
the last unused PTE bit.
= powerpc/ibm4xx: just use the hardware exec bit.
= powerpc/oea: we already track per-page exec bits, but the hardware only
implements non-exec mappings at the segment level. so track the
number of executable mappings in each segment and turn on the no-exec
segment bit iff the count is 0. adjust the trap handler to deal.
= sparc (sun4m): fix our use of the hardware protection bits.
fix the trap handler to recognize text faults.
= sparc64: split the existing unified TSB into data and instruction TSBs,
and only load TTEs into the appropriate TSB(s) for the permissions.
fix the trap handler to check for execute permission.
= not yet implemented: amd64, hppa, sh5

- changes in all the emulations that put a signal trampoline on the stack.
instead, we now put the trampoline into a uvm_aobj and map that into
the process separately.

originally from openbsd, adapted for netbsd by me.
 1.73 29-Jun-2003  fvdl branches: 1.73.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.72 29-Jun-2003  martin struct proc * -> struct lwp *
 1.71 23-Jun-2003  martin Make sure to include opt_foo.h if a defflag option FOO is used.
 1.70 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.69 06-Dec-2002  scw branches: 1.69.2;
After a discussion with various folks, fix the strict-alias warning
by ditching 'void *rt' and passing retval directly to sys_mmap().
 1.68 06-Dec-2002  scw Avoid strict-alias warnings.
 1.67 01-Nov-2002  jdolecek set struct emul's nsysent to compat SYS_NSYSENT, not SYS_MAXSYSCALL
 1.66 23-Oct-2002  scw In preparation for COMPAT_NETBSD32 on SH-5:

- The MD netbsd32_machdep.h header now defines the 32-bit pointer type
instead of using u_int32_t everywhere,
- The MD netbsd32_machdep.h header now defines a macro (at least on
current implementations) which converts a 32-bit pointer to its 64-bit
equivalent,
- Change the MI code to utilise the above two items in all the right places,
- Implement netbsd32___sigaction_sigtramp().

Tested on Sparc64 by Matt Green.
 1.65 21-Sep-2002  manu - Introduce a e_fault field in struct proc to provide emulation specific
memory fault handler. IRIX uses irix_vm_fault, and all other emulation
use NULL, which means to use uvm_fault.

- While we are there, explicitely set to NULL the uninitialized fields in
struct emul: e_fault and e_sysctl on most ports

- e_fault is used by the trap handler, for now only on mips. In order to avoid
intrusive modifications in UVM, the function pointed by e_fault does not
has exactly the same protoype as uvm_fault:
int uvm_fault __P((struct vm_map *, vaddr_t, vm_fault_t, vm_prot_t));
int e_fault __P((struct proc *, vaddr_t, vm_fault_t, vm_prot_t));

- In IRIX share groups, all the VM space is shared, except one page.
This bounds us to have different VM spaces and synchronize modifications
to the VM space accross share group members. We need an IRIX specific hook
to the page fault handler in order to propagate VM space modifications
caused by page faults.
 1.64 07-Jul-2002  fvdl Move netbsd32_sysarch to netbsd32_machdep.c
 1.63 16-Mar-2002  christos branches: 1.63.4;
make the stackgap_{init,alloc} functions MP friendly (i.e. pass struct proc *
in, instead of using curproc). While there add an optional size argument to
stackgap_init.
 1.62 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.61 18-Sep-2001  jdolecek Make the setregs hook emulation-specific, rather than executable
format specific.
Struct emul has a e_setregs hook back, which points to emulation-specific
setregs function. es_setregs of struct execsw now only points to
optional executable-specific setup function (this is only used for
ECOFF).
 1.60 19-Jun-2001  fvdl branches: 1.60.2; 1.60.4;
Some of this was sparc-specific, so ifdef __sparc__ it (XXX). Also,
change the alignment of one structure with an MD ifdef. Should
be moved into the netbsd32_machdep parts.
 1.59 18-Jun-2001  christos Add an e_trapsignal member to struct emul, so that emulated processes can
send the appropriate signal depending on the trap type.
 1.58 30-May-2001  mrg use _KERNEL_OPT.
 1.57 08-Feb-2001  mrg branches: 1.57.2;
split up netbsd32_netbsd.c into 9 new files, leaving only those syscalls that
have no special interpretations besides simple syscall args conversion.
 1.56 07-Feb-2001  mrg move the static inline conversion functions into a header file so other
files can see these. note a bunch of functions that should be moved
into their own files.
 1.55 06-Feb-2001  eeh Specify a process' address space limits for uvmspace_exec().
 1.54 04-Feb-2001  mrg change_utimes32() was copyin()ing a struct timeval, not netbsd32_timeval.
general clean up.
 1.53 04-Feb-2001  mrg emulate kern.boottime. now 32-bit w(1) works properly.
 1.52 04-Feb-2001  mrg make sysctl vm.loadavg work.
 1.51 03-Feb-2001  mrg sync a comment from sys_execve().
make netbsd32_recvfrom() work.
 1.50 02-Feb-2001  mrg implement netbsd32_lchflags & netbsd32_utrace
 1.49 02-Feb-2001  mrg de-static netbsd32_exec_aout_prep_[zno]magic().
de-static netbsd32_from_stat43().
move the guts of netbsd32_execve() into netbsd32_execve2().

all of are for the forthcoming sunos32 compat mode (for sparc64).
 1.48 22-Jan-2001  jdolecek Use CHECK_ALT_SYMLINK() instead CHECK_ALT_EXISTS() where appropriate.
This addresses kern/11757.
 1.47 22-Dec-2000  jdolecek split off thread specific stuff from struct sigacts to struct sigctx, leaving
only signal handler array sharable between threads
move other random signal stuff from struct proc to struct sigctx

This addresses kern/10981 by Matthew Orgass.
 1.46 12-Dec-2000  mycroft Do the __HAVE_SYSCALL_INTERN and __HAVE_MINIMAL_EMUL dance.
 1.45 09-Dec-2000  jdolecek always fill in e_syscall in respective emul_*; if the emulation doesn't
have it's own separated *_syscall() function, use syscall()
 1.44 08-Dec-2000  jdolecek add infrastructure to load emulations and their executable support dynamically
via LKM
 1.43 03-Dec-2000  fvdl Use a copied fktrace syscall arg structure with out 'const int' for the
filedescriptor to copy arguments, avoiding a warning. XXX
 1.42 01-Dec-2000  jdolecek always define COMPAT_OLDSOCK (this tracks rev.1.55 of kern/uipc_syscalls.c)
move definition of emul_netbsd32 from netbsd32_exec.c here
fix couple of compile nits I encountered while compiling this with
sparc cross-compiler
 1.41 01-Dec-2000  jdolecek add e_path (emulation path) to struct emul, which replaces emulation-specific
*_emul_path variables

change macros CHECK_ALT_{CREAT|EXIST} to use that, 'root' doesn't need
to be passed explicitly any more and *_CHECK_ALT_{CREAT|EXIST} are removed
change explicit emul_find() calls in probe functions to get the emulation
path from the checked exec switch entry's emulation

remove no longer needed header files

add e_flags and e_syscall to struct emul; these are unsed and empty for now
 1.40 30-Nov-2000  jdolecek sync netbsd32_execve() with sys_execve() - this involves
VMCMD_RELATIVE support, couple of debugging printfs and addition of
doexechooks() call
also fix one FREE() which should be free()
 1.39 28-Nov-2000  mrg make this compile again, after execsw/lkm changes.
 1.38 28-Sep-2000  eeh Add support for variable end of user stacks needed to support COMPAT_NETBSD32:

`struct vmspace' has a new field `vm_minsaddr' which is the user TOS.

PS_STRINGS is deprecated in favor of curproc->p_pstr which is derived
from `vm_minsaddr'.

Bump the kernel version number.
 1.37 24-Sep-2000  martin The ovadvise syscall is (correctly) listed as STD, so move it's implementation
to another place. This makes kernels without options COMPAT_43 link.
 1.36 19-Aug-2000  eeh Fix netbsd32_ioctls.
 1.35 03-Aug-2000  thorpej Convert namei pathname buffer allocation to use the pool allocator.
 1.34 14-Jul-2000  thorpej - Fix the likely cause of the "ps(1) hangs machine" problem. Always
vslock the user pages for the data being copied out to userspace,
so that we won't sleep while holding a lock in case we need to
fault the pages in.
- Sprinkle some const and ANSI'ify some things while here.
 1.33 13-Jul-2000  thorpej Sync w/ kern_time.c and sys_generic.c
 1.32 09-Jul-2000  mrg - massive warning fix fest.
- fix pread/pwrite return values (plus some other syscalls that looked
similarly broken).
- prototypes and clean up for netbsd32_ioctl.c

now getpw*() works under compat32!
 1.31 09-Jul-2000  mrg look in /emul/netbsd32 for __stat13() and __lstat13().
 1.30 28-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.29 26-Jun-2000  mrg remove/move more mach vm header files:

<vm/pglist.h> -> <uvm/uvm_pglist.h>
<vm/vm_inherit.h> -> <uvm/uvm_inherit.h>
<vm/vm_kern.h> -> into <uvm/uvm_extern.h>
<vm/vm_object.h> -> nothing
<vm/vm_pager.h> -> into <uvm/uvm_pager.h>

also includes a bunch of <vm/vm_page.h> include removals (due to redudancy
with <vm/vm.h>), and a scattering of other similar headers.
 1.28 30-May-2000  eeh branches: 1.28.2;
Include "opt_DDB.h" to enable the DDB sysctls.
 1.27 27-May-2000  thorpej branches: 1.27.2;
sleep() -> tsleep()
 1.26 27-May-2000  sommerfeld Reduce use of curproc in several places:

- Change ktrace interface to pass in the current process, rather than
p->p_tracep, since the various ktr* function need curproc anyway.

- Add curproc as a parameter to mi_switch() since all callers had it
handy anyway.

- Add a second proc argument for inferior() since callers all had
curproc handy.

Also, miscellaneous cleanups in ktrace:

- ktrace now always uses file-based, rather than vnode-based I/O
(simplifies, increases type safety); eliminate KTRFLAG_FD & KTRFAC_FD.
Do non-blocking I/O, and yield a finite number of times when receiving
EWOULDBLOCK before giving up.

- move code duplicated between sys_fktrace and sys_ktrace into ktrace_common.

- simplify interface to ktrwrite()
 1.25 30-Mar-2000  augustss Kill register declarations.
 1.24 23-Mar-2000  thorpej New callout mechanism with two major improvements over the old
timeout()/untimeout() API:
- Clients supply callout handle storage, thus eliminating problems of
resource allocation.
- Insertion and removal of callouts is constant time, important as
this facility is used quite a lot in the kernel.

The old timeout()/untimeout() API has been removed from the kernel.
 1.23 06-Feb-2000  eeh Add support for -current's ELF32 exec format.
 1.22 31-Jan-2000  christos Regen
 1.21 31-Dec-1999  eeh netbsd32_close() would work better if it called sys_close() rather than
sys_write().
netbsd32_getfsstat() cannot just copyin()/copyout(), convert the structures,
and call sys_getffstat(). sys_getffstat() wants to do its own
copyin()/copyout(). So we need to implent the whole of sys_getffstat()
in netbsd32_getfsstat().
 1.20 30-Dec-1999  eeh Update to 32-bit compatibility routines.
 1.19 11-Oct-1999  eeh branches: 1.19.2;
Add netbsd32_compat_14.c

Rename everything from compat_netbsd32 -> netbsd32 so we don't have silly
names like compat_14_compat_netbsd32_sys_shmctl().
 1.18 28-Sep-1999  bouyer branches: 1.18.2;
Remplace kern.shortcorename sysctl with a more flexible sheme,
core filename format, which allow to change the name of the core dump,
and to relocate it in a directory. Credits to Bill Sommerfeld for giving me
the idea :)
The default core filename format can be changed by options DEFCORENAME and/or
kern.defcorename
Create a new sysctl tree, proc, which holds per-process values (for now
the corename format, and resources limits). Process is designed by its pid
at the second level name. These values are inherited on fork, and the corename
fomat is reset to defcorename on suid/sgid exec.
Create a p_sugid() function, to take appropriate actions on suid/sgid
exec (for now set the P_SUGID flag and reset the per-proc corename).
Adjust dosetrlimit() to allow changing limits of one proc by another, with
credential controls.
 1.17 05-Aug-1999  thorpej Change the semantics of splsoftclock() to be like other spl*() functions,
that is priority is rasied. Add a new spllowersoftclock() to provide the
atomic drop-to-softclock semantics that the old splsoftclock() provided,
and update calls accordingly.

This fixes a problem with using the "rnd" pseudo-device from within
interrupt context to extract random data (e.g. from within the softnet
interrupt) where doing so would incorrectly unblock interrupts (causing
all sorts of lossage).

XXX 4 platforms do not have priority-raising capability: newsmips, sparc,
XXX sparc64, and VAX. This platforms still have this bug until their
XXX spl*() functions are fixed.
 1.16 20-Jul-1999  thorpej Move the call of cpu_wait() out of the wait4() functions, and into the
body of reaper(), right before the call to uvm_exit(). cpu_wait() must
be done before uvm_exit() because the resources it frees might be located
in the PCB.
 1.15 17-Jun-1999  thorpej Make uvm_vslock() return the error code from uvm_fault_wire(). All places
which use uvm_vslock() should now test the return value. If it's not
KERN_SUCCESS, wiring the pages failed, so the operation which is using
uvm_vslock() should error out.

XXX We currently just EFAULT a failed uvm_vslock(). We may want to do
more about translating error codes in the future.
 1.14 09-Jun-1999  christos Propagate kern changes
 1.13 26-May-1999  thorpej XXX Pass VM_PROT_NONE to uvm_vslock() as access_type. Why are we even
vslocking here?! copyout() on its own seems to suffice just about everwhere
else, and it's not like the process is going to exit; it's in a system
call!
 1.12 05-May-1999  thorpej Add "use counting" to file entries. When closing a file, and it's reference
count is 0, wait for use count to drain before finishing the close.

This is necessary in order for multiple processes to safely share file
descriptor tables.
 1.11 25-Mar-1999  mrg branches: 1.11.4;
SPARC32->NETBSD32
 1.10 25-Mar-1999  mrg move sparc32 to netbsd32; split out MD part (signal handling) (mostly via repository copy, rename and perl -pi :-)
 1.9 25-Mar-1999  mrg formatting nits
 1.8 24-Mar-1999  mrg completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.
 1.7 18-Dec-1998  drochner solve the COMPAT_OLDSOCK/MSG_COMPAT problem differently:
The source files which need MSG_COMPAT define COMPAT_OLDSOCK.
 1.6 01-Oct-1998  eeh Overhaul. Now will run simple things like /bin/sh and /bin/echo.
 1.5 11-Sep-1998  eeh Add some copyin()/copyout()s. These need to be done but there are more
annoying issues, so I'll just check in this snapshot.
 1.4 30-Aug-1998  eeh Some more 64-bit cleanup. Now everything compiles.
 1.3 29-Aug-1998  eeh Some more 64-bit-ification.
 1.2 26-Aug-1998  mrg use right syscalls. add converters for timespec and semid_ds
 1.1 26-Aug-1998  mrg add a 32-bit compatibility module for the sparc64 port, so it can run NetBSD/sparc binaries with a LP64 kernel.
 1.11.4.2 02-Aug-1999  thorpej Update from trunk.
 1.11.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.18.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.19.2.5 11-Feb-2001  bouyer Sync with HEAD.
 1.19.2.4 05-Jan-2001  bouyer Sync with HEAD
 1.19.2.3 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.19.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.19.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.27.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.28.2.5 16-Jun-2001  he Apply patch (from netbsd32_execve.c revision 1.4, requested by thorpej):
Close a race condition between exec of a setuid binary and
ptrace(2): check P_TRACED right before adjusting the privilege
settings in the exec code.
 1.28.2.4 18-Oct-2000  tv Pullup by patch [eeh]:
Support userspace at multiple addresses by making PSSTRINGS variable (using
p_psstr), and fix stackgap_init() appropriately.
 1.28.2.3 26-Aug-2000  mrg pull up 1.36. approved by thorpej:
>Fix netbsd32_ioctls.
 1.28.2.2 14-Jul-2000  thorpej Update from trunk:
- Fix the likely cause of the "ps(1) hangs machine" problem. Always
vslock the user pages for the data being copied out to userspace,
so that we won't sleep while holding a lock in case we need to
fault the pages in.
- Sprinkle some const and ANSI'ify some things while here.
 1.28.2.1 13-Jul-2000  thorpej Pull up rev. 1.33:
Sync w/ kern_time.c and sys_generic.c
 1.57.2.10 11-Dec-2002  thorpej Sync with HEAD.
 1.57.2.9 11-Nov-2002  nathanw Catch up to -current
 1.57.2.8 18-Oct-2002  nathanw Catch up to -current.
 1.57.2.7 23-Aug-2002  petrov lwpification.
 1.57.2.6 01-Aug-2002  nathanw Catch up to -current.
 1.57.2.5 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.57.2.4 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.57.2.3 14-Nov-2001  nathanw Catch up to -current.
 1.57.2.2 21-Sep-2001  nathanw Catch up to -current.
 1.57.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.60.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.60.2.4 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.60.2.3 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.60.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.60.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.63.4.1 15-Jul-2002  gehenna catch up with -current.
 1.69.2.1 18-Dec-2002  gmcgarry Merge pcred and ucred, and poolify. TBD: check backward compatibility
and factor-out some higher-level functionality.
 1.73.2.7 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.73.2.6 01-Apr-2005  skrll Sync with HEAD.
 1.73.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.73.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.73.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.73.2.2 26-Aug-2004  skrll Adapt to branch.

sparc64 GENERIC compiles.
 1.73.2.1 03-Aug-2004  skrll Sync with HEAD
 1.86.6.2 26-Mar-2005  yamt sync with head.
 1.86.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.86.4.1 29-Apr-2005  kent sync with -current
 1.87.2.1 18-Sep-2005  tron Pull up following revision(s) (requested by fvdl in ticket #798):
sys/compat/sunos/sunos_exec.c: revision 1.47
sys/compat/pecoff/pecoff_emul.c: revision 1.11
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.45
sys/arch/amd64/amd64/netbsd32_machdep.c: revision 1.12
sys/sys/proc.h: revision 1.198
sys/compat/mach/mach_exec.c: revision 1.56
sys/compat/freebsd/freebsd_exec.c: revision 1.27
sys/arch/sparc64/include/vmparam.h: revision 1.27
sys/kern/kern_resource.c: revision 1.91
sys/compat/netbsd32/netbsd32_netbsd.c: revision 1.88
sys/compat/osf1/osf1_exec.c: revision 1.39
sys/compat/svr4_32/svr4_32_resource.c: revision 1.5
sys/compat/ultrix/ultrix_misc.c: revision 1.99
sys/compat/svr4_32/svr4_32_exec.h: revision 1.9
sys/kern/exec_elf32.c: revision 1.103
sys/compat/aoutm68k/aoutm68k_exec.c: revision 1.19
sys/compat/sunos32/sunos32_exec.c: revision 1.20
sys/compat/hpux/hpux_exec.c: revision 1.46
sys/compat/darwin/darwin_exec.c: revision 1.40
sys/kern/sysv_shm.c: revision 1.83
sys/uvm/uvm_extern.h: revision 1.99
sys/uvm/uvm_mmap.c: revision 1.89
sys/kern/kern_exec.c: revision 1.195
sys/compat/netbsd32/netbsd32.h: revision 1.31
sys/arch/sparc64/sparc64/svr4_32_machdep.c: revision 1.20
sys/compat/svr4/svr4_exec.c: revision 1.56
sys/compat/irix/irix_exec.c: revision 1.41
sys/compat/ibcs2/ibcs2_exec.c: revision 1.63
sys/compat/svr4_32/svr4_32_exec.c: revision 1.16
sys/arch/amd64/include/vmparam.h: revision 1.8
sys/compat/linux/common/linux_exec.c: revision 1.73
Fix some things regarding COMPAT_NETBSD32 and limits/VM addresses.
* For sparc64 and amd64, define *SIZ32 VM constants.
* Add a new function pointer to struct emul, pointing at a function
that will return the default VM map address. The default function
is uvm_map_defaultaddr, which just uses the VM_DEFAULT_ADDRESS
macro. This gives emulations control over the default map address,
and allows things to be mapped at the right address (in 32bit range)
for COMPAT_NETBSD32.
* Add code to adjust the data and stack limits when a COMPAT_NETBSD32
or COMPAT_SVR4_32 binary is executed.
* Don't use USRSTACK in kern_resource.c, use p_vmspace->vm_minsaddr
instead (emulations might have set it differently)
* Since this changes struct emul, bump kernel version to 3.99.2
Tested on amd64, compile-tested on sparc64.
 1.90.2.11 24-Mar-2008  yamt sync with head.
 1.90.2.10 27-Feb-2008  yamt sync with head.
 1.90.2.9 04-Feb-2008  yamt sync with head.
 1.90.2.8 21-Jan-2008  yamt sync with head
 1.90.2.7 07-Dec-2007  yamt sync with head
 1.90.2.6 15-Nov-2007  yamt sync with head.
 1.90.2.5 27-Oct-2007  yamt sync with head.
 1.90.2.4 03-Sep-2007  yamt sync with head.
 1.90.2.3 26-Feb-2007  yamt sync with head.
 1.90.2.2 30-Dec-2006  yamt sync with head.
 1.90.2.1 21-Jun-2006  yamt sync with head.
 1.99.6.2 01-Jun-2006  kardel Sync with head.
 1.99.6.1 22-Apr-2006  simonb Sync with head.
 1.99.4.1 09-Sep-2006  rpaulo sync with head
 1.99.2.1 18-Feb-2006  yamt sync with head.
 1.100.6.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.100.6.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.100.4.6 12-May-2006  elad include sys/kauth.h where appropriate.
 1.100.4.5 11-May-2006  elad sync with head
 1.100.4.4 19-Apr-2006  elad sync with head.
 1.100.4.3 18-Apr-2006  elad zap unused var
 1.100.4.2 14-Mar-2006  elad Use kauth_cred_[sg]etgroups() where appropriate.
 1.100.4.1 08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.100.2.4 03-Sep-2006  yamt sync with head.
 1.100.2.3 11-Aug-2006  yamt sync with head
 1.100.2.2 24-May-2006  yamt sync with head.
 1.100.2.1 01-Apr-2006  yamt sync with head.
 1.104.4.1 13-Jul-2006  gdamore Merge from HEAD.
 1.111.4.1 10-Dec-2006  yamt sync with head.
 1.111.2.4 05-Feb-2007  ad - When clearing signals dequeue siginfo first and free later, once
outside the lock permiter.
- Push kernel_lock back in a a couple of places.
- Adjust limcopy() to be MP safe (this needs redoing).
- Fix a couple of bugs noticed along the way.
- Catch up with condvar changes.
 1.111.2.3 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.111.2.2 12-Jan-2007  ad Sync with head.
 1.111.2.1 18-Nov-2006  ad Sync with head.
 1.116.2.4 07-May-2007  yamt sync with head.
 1.116.2.3 24-Mar-2007  yamt sync with head.
 1.116.2.2 12-Mar-2007  rmind Sync with HEAD.
 1.116.2.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.119.6.2 29-Mar-2007  reinoud Pullup to -current
 1.119.6.1 18-Mar-2007  reinoud First attempt to bring branch in sync with HEAD
 1.119.4.1 11-Jul-2007  mjf Sync with head.
 1.119.2.5 09-Oct-2007  ad Sync with head.
 1.119.2.4 20-Aug-2007  ad Sync with HEAD.
 1.119.2.3 15-Jul-2007  ad Sync with head.
 1.119.2.2 27-May-2007  ad Sync with head.
 1.119.2.1 10-Apr-2007  ad Sync with head.
 1.125.6.4 09-Dec-2007  jmcneill Sync with HEAD.
 1.125.6.3 11-Nov-2007  joerg Sync with HEAD.
 1.125.6.2 02-Oct-2007  joerg Sync with HEAD.
 1.125.6.1 16-Aug-2007  jmcneill Sync with HEAD.
 1.125.2.1 03-Sep-2007  skrll Sync with HEAD.
 1.126.2.3 23-Mar-2008  matt sync with HEAD
 1.126.2.2 09-Jan-2008  matt sync with HEAD
 1.126.2.1 06-Nov-2007  matt sync with HEAD
 1.127.2.1 06-Oct-2007  yamt sync with head.
 1.128.4.4 18-Feb-2008  mjf Sync with HEAD.
 1.128.4.3 27-Dec-2007  mjf Sync with HEAD.
 1.128.4.2 08-Dec-2007  mjf Sync with HEAD.
 1.128.4.1 19-Nov-2007  mjf Sync with HEAD.
 1.128.2.1 13-Nov-2007  bouyer Sync with HEAD
 1.130.2.2 26-Dec-2007  ad Sync with head.
 1.130.2.1 08-Dec-2007  ad Sync with head.
 1.132.2.1 11-Dec-2007  yamt sync with head.
 1.133.2.2 20-Jan-2008  bouyer Sync with HEAD
 1.133.2.1 02-Jan-2008  bouyer Sync with HEAD
 1.141.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.141.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.141.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.141.2.1 24-Mar-2008  keiichi sync with head.
 1.143.6.5 28-Sep-2008  skrll Adapt the SA COMPAT_NETBSD32 stuff to this branch.
 1.143.6.4 21-Jul-2008  wrstuden Add support for compiling SA as an option. Implied by COMPAT_40.

i386 kernels both with COMPAT_40 and with no compat options (and thus
no SA) compile.

No functional changes intended.
 1.143.6.3 27-Jun-2008  wrstuden Add getucontext32_sa() and getucontext_sa(), and use them. They
are sa-specific versions of getucontext{,32}(). The main difference
is that they do NOT require the p_lock be held. We report an empty
signal mask, both to avoid needing p_lock and because the process
signal mask is almost always 0 for SA.
 1.143.6.2 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.143.6.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.143.4.5 11-Aug-2010  yamt sync with head.
 1.143.4.4 11-Mar-2010  yamt sync with head
 1.143.4.3 19-Aug-2009  yamt sync with head.
 1.143.4.2 20-Jun-2009  yamt sync with head
 1.143.4.1 04-May-2009  yamt sync with head.
 1.143.2.1 04-Jun-2008  yamt sync with head
 1.144.4.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.144.4.1 19-Oct-2008  haad Sync with HEAD.
 1.145.4.2 25-Nov-2008  snj branches: 1.145.4.2.4;
Pull up following revision(s) (requested by mrg in ticket #121):
sys/compat/netbsd32/syscalls.master: revision 1.74
sys/compat/netbsd32/netbsd32.h: revision 1.78
sys/compat/netbsd32/netbsd32_netbsd.c: revision 1.149
implement netbsd32__sched_setparam(), netbsd32__sched_getparam(),
netbsd32__sched_setaffinity() and netbsd32__sched_getaffinity().
 1.145.4.1 22-Nov-2008  snj Pull up following revision(s) (requested by tron in ticket #100):
sys/compat/netbsd32/netbsd32_netbsd.c: revision 1.148
sys/compat/netbsd32/netbsd32_sa.c: revision 1.8
Make it possible to compile a kernel with COMPAT_NETBSD32 but without
COMPAT_40. This fixes PR port-amd64/39967.
 1.145.4.2.4.2 13-Sep-2009  matt Move netbsd32___mount50 from netbsd32_netbsd.c to netbsd32_fs.c
 1.145.4.2.4.1 12-Sep-2009  matt Add support for netbsd32___mount50. There's got to be a better of doing this.
Maybe pushing it down to vfs. This only supports mfs/ufs/cd9660 and probably
tmpfs.
 1.145.2.3 28-Apr-2009  skrll Sync with HEAD.
 1.145.2.2 03-Mar-2009  skrll Sync with HEAD.
 1.145.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.149.4.2 04-Jan-2009  christos add new syscalls.
 1.149.4.1 22-Nov-2008  christos file netbsd32_netbsd.c was added on branch christos-time_t on 2009-01-04 01:56:02 +0000
 1.154.2.2 23-Jul-2009  jym Sync with HEAD.
 1.154.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.163.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.166.2.5 12-Jun-2011  rmind sync with head
 1.166.2.4 31-May-2011  rmind sync with head
 1.166.2.3 21-Apr-2011  rmind sync with head
 1.166.2.2 05-Mar-2011  rmind sync with head
 1.166.2.1 30-May-2010  rmind sync with head
 1.168.4.3 15-Feb-2011  bouyer implement COMPAT_NETBSD32 quotactl syscalls (both new and COMPAT_50)
 1.168.4.2 09-Feb-2011  bouyer Proper definitions for quotactl
 1.168.4.1 20-Jan-2011  bouyer Snapshot of work in progress on a modernised disk quota system:
- new quotactl syscall (versionned for backward compat), which takes
as parameter a path to a mount point, and a prop_dictionary
(in plistref format) describing commands and arguments.
For each command, status and data are returned as a prop_dictionary.
quota commands features will be added to take advantage of this,
exporting quota data or getting quota commands as plists.

- new on disk-format storage (all 64bit wide), integrated to metadata for
ffs (and playing nicely with wapbl).
Quotas are enabled on a ffs filesystem via superblock flags.
tunefs(8) can enable or disable quotas.
On a quota-enabled filesystem, fsck_ffs(8) will track per-uid/gid
block and inode usages, and will check and update quotas in Pass 6.
quota usage and limits are stored in unliked files (one for users,
one for groups)l fsck_ffs(8) will create the files if needed, or
free them if needed. This means that after enabling or disabling
quotas on a filesystem; a fsck_ffs(8) run is required.
quotacheck(8) is not needed any more, on a unclean shutdown
fsck or journal replay will take care of fixing quotas.
newfs(8) can create a ready-to-mount quota-enabled filesystem
(superblock flags are set and quota inodes are created).
Other new features or semantic changes:
- default quota datas, applied to users or groups which don't already
have a quota entry
- per-user/group grace time (instead of a filesystem global one)
- 0 really means "nothing allowed at all", not "no limit".
If you want "no limit", set the limit to UQUAD_MAX (tools will
understand "unlimited" and "-")

A quota file is structured as follow:
it starts with a header, containing a few per-filesystem values,
and the default quota limits.
Quota entries are linked together as a simple list, each entry has a
pointer (as an offset withing the file) to the next.
The header has a pointer to a list of free quota entries, and
a hash table of in-use entries. The size of the hash table depends
on the filesystem block size (header+hash table should fit in the
first block). The file is not sparse and is a multiple of
filesystem block size (when the free quota entry list is empty a new
filesystem block is allocated). quota entries to not cross
filesystem block boundaries.

In memory, the kernel keeps a cache of recently used quota entries
as a reference to the block number, and offset withing the block.
The quota entry itself is keept in the buf cache.

fsck_ffs(8), tunefs(8) and newfs(8) supports are completed (with
related atf tests :)
The kernel can update disk usage and report it via quotactl(2).

Todo: enforce quotas limits (limits are not checked by kernel yet)
update repquota, edquota and rpc.rquotad to the new world
implement compat_50_quotactl ioctl.
update quotactl(2) man page

fsck_ffs required fixes so that allocating new blocks or inodes will
properly update the superblock and cg sumaries. This was not an issue up
to now because superblock and cg sumaries check happened last, but now
allocations or frees can happen in pass 6.
 1.168.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.170.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.173.2.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.173.2.2 17-Apr-2012  yamt sync with head
 1.173.2.1 10-Nov-2011  yamt sync with head
 1.175.4.2 24-Feb-2012  mrg sync to -current.
 1.175.4.1 18-Feb-2012  mrg merge to -current.
 1.179.2.2 26-Jun-2014  msaitoh Pull up following revision(s) (requested by maxv in ticket #1084):
sys/compat/netbsd32/netbsd32_netbsd.c rev. 1.187

Fix cases where count <= 0 (thanks to Maxime Villard for raising this).
 1.179.2.1 18-Mar-2014  msaitoh Pull up following revision(s) (requested by manu in ticket #1025):
sys/compat/netbsd32/netbsd32_netbsd.c: revision 1.184
sys/uvm/uvm_swap.c: revision 1.166
sys/uvm/uvm_swap.h: revision 1.20
sys/compat/netbsd32/netbsd32.h: revision 1.99
Properly translate struct swapent for COMPAT_NETBSD32
Properly translate struct swapent for COMPAT_NETBSD32 (missing commit)
 1.180.10.1 23-Jul-2013  riastradh sync with HEAD
 1.180.4.2 18-May-2014  rmind sync with head
 1.180.4.1 28-Aug-2013  rmind sync with head
 1.180.2.2 03-Dec-2017  jdolecek update from HEAD
 1.180.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.185.2.1 10-Aug-2014  tls Rebase.
 1.193.10.1 25-Dec-2018  martin Apply patch, requested by maxv in ticket #1666:
Fix similar to:

sys/uvm/uvm_swap.c: revision 1.178

Woah man, fix enormous leak.

Possible info leak: [len=1056, leaked=931]
#0 0xffffffff80bad351 in kleak_copyout
#1 0xffffffff80b2cf64 in uvm_swap_stats.part.1
#2 0xffffffff80b2d38d in uvm_swap_stats
#3 0xffffffff80b2d43c in sys_swapctl
#4 0xffffffff80259b82 in syscall
 1.193.6.1 25-Dec-2018  martin Apply patch, requested by maxv in ticket #1666:
Fix similar to:

sys/uvm/uvm_swap.c: revision 1.178

Woah man, fix enormous leak.

Possible info leak: [len=1056, leaked=931]
#0 0xffffffff80bad351 in kleak_copyout
#1 0xffffffff80b2cf64 in uvm_swap_stats.part.1
#2 0xffffffff80b2d38d in uvm_swap_stats
#3 0xffffffff80b2d43c in sys_swapctl
#4 0xffffffff80259b82 in syscall
 1.193.4.7 28-Aug-2017  skrll Sync with HEAD
 1.193.4.6 05-Dec-2016  skrll Sync with HEAD
 1.193.4.5 05-Oct-2016  skrll Sync with HEAD
 1.193.4.4 29-May-2016  skrll Sync with HEAD
 1.193.4.3 19-Mar-2016  skrll Sync with HEAD
 1.193.4.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.193.4.1 22-Sep-2015  skrll Sync with HEAD
 1.193.2.1 25-Dec-2018  martin Apply patch, requested by maxv in ticket #1666:
Fix similar to:

sys/uvm/uvm_swap.c: revision 1.178

Woah man, fix enormous leak.

Possible info leak: [len=1056, leaked=931]
#0 0xffffffff80bad351 in kleak_copyout
#1 0xffffffff80b2cf64 in uvm_swap_stats.part.1
#2 0xffffffff80b2d38d in uvm_swap_stats
#3 0xffffffff80b2d43c in sys_swapctl
#4 0xffffffff80259b82 in syscall
 1.200.2.1 04-Nov-2016  pgoyette Sync with HEAD
 1.205.6.1 02-May-2017  pgoyette Sync with HEAD - tag prg-localcount2-base1
 1.206.2.3 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1833):

sys/compat/netbsd32/netbsd32_netbsd.c: revision 1.232
sys/compat/netbsd32/netbsd32_socket.c: revision 1.56
sys/compat/netbsd32/netbsd32_conv.h: revision 1.45
sys/compat/netbsd32/netbsd32_fs.c: revision 1.92
sys/compat/netbsd32/netbsd32.h: revision 1.137

The read/write/send/recv system calls return ssize_t because -1 is
returned on error. Therefore we must restrict the lengths of any
buffers to NETBSD32_SSIZE_MAX with compat32 to avoid garbage return
values.

Fixes ATF lib/libc/sys/t_write:write_err.
 1.206.2.2 27-Dec-2018  martin Pull up following revision(s) (requested by mrg in ticket #1146):

sys/compat/netbsd32/netbsd32_netbsd.c: revision 1.219

pset_create() takes a pointer so it needs special handling.
 1.206.2.1 25-Dec-2018  martin Apply patch, requested by maxv in ticket #1142:
Similar to:

sys/uvm/uvm_swap.c: revision 1.178

Fix kernel info leak in swapctl(2).

Possible info leak: [len=1056, leaked=931]
#0 0xffffffff80bad351 in kleak_copyout
#1 0xffffffff80b2cf64 in uvm_swap_stats.part.1
#2 0xffffffff80b2d38d in uvm_swap_stats
#3 0xffffffff80b2d43c in sys_swapctl
#4 0xffffffff80259b82 in syscall
 1.214.2.7 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.214.2.6 14-Sep-2018  pgoyette Move some extern definitions into netbsd32_netbsd.h rather than having
them in the .c files.
 1.214.2.5 12-Sep-2018  pgoyette Add a compat_netbsd32_16 to handle the sigcode stuff.
 1.214.2.4 12-Sep-2018  pgoyette Add a netbsd32_compat40 module, move the 4.0 mount stuff there.
 1.214.2.3 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.214.2.2 21-May-2018  pgoyette Sync with HEAD
 1.214.2.1 15-Mar-2018  pgoyette Synch with HEAD
 1.216.2.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.216.2.1 10-Jun-2019  christos Sync with HEAD
 1.228.2.1 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1489):

sys/compat/netbsd32/netbsd32_netbsd.c: revision 1.232
sys/compat/netbsd32/netbsd32_socket.c: revision 1.56
sys/compat/netbsd32/netbsd32_conv.h: revision 1.45
sys/compat/netbsd32/netbsd32_fs.c: revision 1.92
sys/compat/netbsd32/netbsd32.h: revision 1.137

The read/write/send/recv system calls return ssize_t because -1 is
returned on error. Therefore we must restrict the lengths of any
buffers to NETBSD32_SSIZE_MAX with compat32 to avoid garbage return
values.

Fixes ATF lib/libc/sys/t_write:write_err.
 1.230.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.9 11-Dec-2021  mrg remove clause 3 from all my licenses that aren't conflicting with
another copyright claim line. again. (i did this in 2008 and then
did not update all of my personal templates.)
 1.8 07-Sep-2021  riastradh sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.7 30-Aug-2021  riastradh compat_netbsd32: Copy out 32-bit version in nfssvc32_nsd_out.
 1.6 27-Jan-2019  pgoyette branches: 1.6.4;
Merge the [pgoyette-compat] branch
 1.5 15-Oct-2016  skrll branches: 1.5.8; 1.5.14; 1.5.16; 1.5.18;
Trailing whitespace
 1.4 01-Dec-2015  pgoyette branches: 1.4.2;
Add MODULE infrastructure to netbsd32_nfssvc.c, remove dependency on it
from netbsd32_mod.c
 1.3 05-Aug-2015  mrg branches: 1.3.2; 1.3.4;
don't copy the first netbsd32_export_args nexports times, but actually
advance the userland pointer each entry through the loop. oops.
 1.2 23-Jun-2015  dholland add missing opt_nfsserver.h
 1.1 22-Jun-2015  mrg add netbsd32 support for nfssvc(2). we do this by defining 5 copyin/out
functions that do all the ugly work, are just plain copyin/out for the
native system calls, and do the necessary translations for netbsd32.

with this i'm able to run 32 bit nfsd and mountd on 64 bit kernel and
mount the file systems remotely.
 1.3.4.3 06-Nov-2015  martin Additionally pull up following revision(s) (requested by mrg in ticket #956):
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.2
sys/compat/netbsd32/syscalls.master: revision 1.109
Don't reference netbsd32_nfssvc unless NFSSERVER is defined.
Fixes PR 49994.
add missing opt_nfsserver.h
 1.3.4.2 04-Nov-2015  riz Pull up following revision(s) (requested by mrg in ticket #956):
sys/compat/netbsd32/files.netbsd32: revision 1.36
sys/compat/netbsd32/netbsd32_sysent.c: revision 1.115
sys/compat/netbsd32/netbsd32_syscallargs.h: revision 1.116
sys/nfs/nfs_var.h: revision 1.93
sys/compat/netbsd32/netbsd32_conv.h: revision 1.30
sys/compat/netbsd32/netbsd32_syscall.h: revision 1.116
sys/compat/netbsd32/netbsd32_syscalls.c: revision 1.115
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.1
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.3
sys/nfs/nfs_syscalls.c: revision 1.156
sys/compat/netbsd32/syscalls.master: revision 1.108
sys/compat/netbsd32/netbsd32.h: revision 1.107
add netbsd32 support for nfssvc(2). we do this by defining 5 copyin/out
functions that do all the ugly work, are just plain copyin/out for the
native system calls, and do the necessary translations for netbsd32.
with this i'm able to run 32 bit nfsd and mountd on 64 bit kernel and
mount the file systems remotely.
don't copy the first netbsd32_export_args nexports times, but actually
advance the userland pointer each entry through the loop. oops.
 1.3.4.1 05-Aug-2015  riz file netbsd32_nfssvc.c was added on branch netbsd-7 on 2015-11-04 17:46:21 +0000
 1.3.2.4 05-Dec-2016  skrll Sync with HEAD
 1.3.2.3 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.3.2.2 22-Sep-2015  skrll Sync with HEAD
 1.3.2.1 05-Aug-2015  skrll file netbsd32_nfssvc.c was added on branch nick-nhusb on 2015-09-22 12:05:55 +0000
 1.4.2.1 04-Nov-2016  pgoyette Sync with HEAD
 1.5.18.1 10-Jun-2019  christos Sync with HEAD
 1.5.16.1 11-Sep-2018  pgoyette Put the ``extern struct emul'' into the netbsd32_netbsd.h header
so it doesn't have to be separately declared in each source file.

Thanks mrg@
 1.5.14.2 03-Dec-2017  jdolecek update from HEAD
 1.5.14.1 15-Oct-2016  jdolecek file netbsd32_nfssvc.c was added on branch tls-maxphys on 2017-12-03 11:36:56 +0000
 1.5.8.2 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1840):

sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.7

compat_netbsd32: Copy out 32-bit version in nfssvc32_nsd_out.
 1.5.8.1 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1836):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.6.4.2 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.6.4.1 03-Aug-2022  martin Pull up following revision(s) (requested by riastradh in ticket #1486):

sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.7

compat_netbsd32: Copy out 32-bit version in nfssvc32_nsd_out.
 1.9 07-Sep-2021  riastradh sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.8 24-Dec-2019  kamil Introduce PT_LWPSTATUS + PT_LWPNEXT, obsolete PT_LWPINFO

PT_LWPINFO is a legacy ptrace(2) operation that was originally intended
to retrieve the thread (LWP) information inside a traced process.

It has a number of flaws and is confused with PT_LWPINFO from FreeBSD.

PT_LWPSTATUS and PT_LWPNEXT address the problems (shortly by: rename,
removal of pl_event) and introduces new features: signal context
(pl_sigpend, pl_sigmask), LWP name (pl_name), LWP TLS base address
(pl_private). The private pointer was so far missing information for
a debugger.

PT_LWPSTATUS@nnn is now shipped with core(5) files and contain LWP specific
information, so far missed in the core(5) files.

PT_LWPSTATUS retrieves LWP information for the prompted thread.
PT_LWPNEXT retrieves LWP information for the next thread, borrowing the
semantics from NetBSD specific PT_LWPINFO.

PT_LWPINFO is namespaced with __LEGACY_PT_LWPINFO and still available for
the foreseeable future, without plans of removing it.

Add ATF tests for PT_LWPSTATUS + PT_LWPNEXT.

Keep ATF tests for PT_LWPINFO.

Switch GDB to new API.

Proposed on tech-kern@.
 1.7 04-Jun-2019  mgorny branches: 1.7.2;
compat32: Translate userland PT_* request values into kernel codes

Currently, the compat32 passes PT_* request values to kernel functions
without translation. This works fine for low PT_* requests that happen
to have the same values both on i386 and amd64. However, for requests
higher than PT_SETFPREGS, the value passed from userland (matching i386
const) does not match the correct kernel (amd64) request. As a result,
e.g. when compat32 process calls PT_GETDBREGS, kernel actually processes
it as PT_SETSTEP.

To resolve this, introduce support for compat32 PT_* request
translation. The interface is based on PTRACE_TRANSLATE_REQUEST32 macro
that is defined to a mapping function on architectures needing it.
In case of amd64, this function maps userland i386 PT_* values into
appropriate amd64 PT_* values.

For the time being, the two additional PT_GETXMMREGS and PT_SETXMMREGS
requests are unsupported due to lack of matching free amd64 constant.
 1.6 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.5 17-Dec-2017  christos branches: 1.5.2; 1.5.4;
handle siginfo requests for ptrace32
 1.4 23-Feb-2017  kamil branches: 1.4.6; 1.4.12;
Introduce PT_GETDBREGS and PT_SETDBREGS in ptrace(2) on i386 and amd64

This interface is modeled after FreeBSD API with the usage.

This replaced previous watchpoint API. The previous one was introduced
recently in NetBSD-current and remove its spurs without any
backward-compatibility.

Design choices for Debug Register accessors:
- exec() (TRAP_EXEC event) must remove debug registers from LWP
- debug registers are only per-LWP, not per-process globally
- debug registers must not be inherited after (v)forking a process
- debug registers must not be inherited after forking a thread
- a debugger is responsible to set global watchpoints/breakpoints with the
debug registers, to achieve this PTRACE_LWP_CREATE/PTRACE_LWP_EXIT event
monitoring function is designed to be used
- debug register traps must generate SIGTRAP with si_code TRAP_DBREG
- debugger is responsible to retrieve debug register state to distinguish
the exact debug register trap (DR6 is Status Register on x86)
- kernel must not remove debug register traps after triggering a trap event
a debugger is responsible to detach this trap with appropriate PT_SETDBREGS
call (DR7 is Control Register on x86)
- debug registers must not be exposed in mcontext
- userland must not be allowed to set a trap on the kernel

Implementation notes on i386 and amd64:
- the initial state of debug register is retrieved on boot and this value is
stored in a local copy (initdbregs), this value is used to initialize dbreg
context after PT_GETDBREGS
- struct dbregs is stored in pcb as a pointer and by default not initialized
- reserved registers (DR4-DR5, DR9-DR15) are ignored

Further ideas:
- restrict this interface with securelevel

Tested on real hardware i386 (Intel Pentium IV) and amd64 (Intel i7).

This commit enables 390 debug register ATF tests in kernel/arch/x86.
All tests are passing.

This commit does not cover netbsd32 compat code. Currently other interface
PT_GET_SIGINFO/PT_SET_SIGINFO is required in netbsd32 compat code in order to
validate reliably PT_GETDBREGS/PT_SETDBREGS.

This implementation does not cover FreeBSD specific defines in their
<x86/reg.h>: DBREG_DR7_LOCAL_ENABLE, DBREG_DR7_GLOBAL_ENABLE, DBREG_DR7_LEN_1
etc. These values tend to be reinvented by each tracer on its own. GNU
Debugger (GDB) works with NetBSD debug registers after adding this patch:

--- gdb/amd64bsd-nat.c.orig 2016-02-10 03:19:39.000000000 +0000
+++ gdb/amd64bsd-nat.c
@@ -167,6 +167,10 @@ amd64bsd_target (void)

#ifdef HAVE_PT_GETDBREGS

+#ifndef DBREG_DRX
+#define DBREG_DRX(d,x) ((d)->dr[(x)])
+#endif
+
static unsigned long
amd64bsd_dr_get (ptid_t ptid, int regnum)
{


Another reason to stop introducing unpopular defines covering machine
specific register macros is that these value varies across generations of
the same CPU family.

GDB demo:
(gdb) c
Continuing.

Watchpoint 2: traceme

Old value = 0
New value = 16
main (argc=1, argv=0x7f7fff79fe30) at test.c:8
8 printf("traceme=%d\n", traceme);

(Currently the GDB interface is not reliable due to NetBSD support bugs)

Sponsored by <The NetBSD Foundation>
 1.3 15-Dec-2016  kamil branches: 1.3.2;
Add support for hardware assisted watchpoints/breakpoints API in ptrace(2)

Add new ptrace(2) calls:
- PT_COUNT_WATCHPOINTS - count the number of available hardware watchpoints
- PT_READ_WATCHPOINT - read struct ptrace_watchpoint from the kernel state
- PT_WRITE_WATCHPOINT - write new struct ptrace_watchpoint state, this
includes enabling and disabling watchpoints

The ptrace_watchpoint structure contains MI and MD parts:

typedef struct ptrace_watchpoint {
int pw_index; /* HW Watchpoint ID (count from 0) */
lwpid_t pw_lwpid; /* LWP described */
struct mdpw pw_md; /* MD fields */
} ptrace_watchpoint_t;

For example amd64 defines MD as follows:
struct mdpw {
void *md_address;
int md_condition;
int md_length;
};

These calls are protected with the __HAVE_PTRACE_WATCHPOINTS guard.

Tested on amd64, initial support added for i386 and XEN.

Sponsored by <The NetBSD Foundation>
 1.2 02-Nov-2016  pgoyette branches: 1.2.2; 1.2.4;
* Split sys/kern/sys_process.c into three parts:
1 - ptrace(2) syscall for native emulation
2 - common ptrace(2) syscall code (shared with compat_netbsd32)
3 - support routines that are shared with PROCFS and/or KTRACE

* Add module glue for #1 and #2. Both modules will be built-in to the
kernel if "options PTRACE" is included in the config file (this is
the default, defined in sys/conf/std).

* Mark the ptrace(2) syscall as modular in syscalls.master (generated
files will be committed shortly).

* Conditionalize all remaining portions of PTRACE code on a new kernel
option PTRACE_HOOKS.

XXX Instead of PROCFS depending on 'options PTRACE', we should probably
just add a procfs attribute to the sys/kern/sys_process.c file's
entry in files.kern, and add PROCFS to the "#if defineds" for
process_domem(). It's really confusing to have two different ways
of requiring this file.
 1.1 19-Oct-2016  skrll PR kern/51514: ptrace(2) fails for 32-bit process on 64-bit kernel

Updated from the original patch in the PR by me.
 1.2.4.4 28-Aug-2017  skrll Sync with HEAD
 1.2.4.3 05-Feb-2017  skrll Sync with HEAD
 1.2.4.2 05-Dec-2016  skrll Sync with HEAD
 1.2.4.1 02-Nov-2016  skrll file netbsd32_ptrace.c was added on branch nick-nhusb on 2016-12-05 10:55:00 +0000
 1.2.2.4 20-Mar-2017  pgoyette Sync with HEAD
 1.2.2.3 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.2.2.2 04-Nov-2016  pgoyette Sync with HEAD
 1.2.2.1 02-Nov-2016  pgoyette file netbsd32_ptrace.c was added on branch pgoyette-localcount on 2016-11-04 14:49:07 +0000
 1.3.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.4.12.2 03-Dec-2017  jdolecek update from HEAD
 1.4.12.1 23-Feb-2017  jdolecek file netbsd32_ptrace.c was added on branch tls-maxphys on 2017-12-03 11:36:56 +0000
 1.4.6.2 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1836):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.4.6.1 12-Apr-2018  martin Pull up following revision(s) (requested by kamil in ticket #713):

sys/modules/procfs/Makefile: revision 1.4
sys/miscfs/procfs/procfs_vfsops.c: revision 1.98
bin/ps/ps.1: revision 1.108
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.32
sys/miscfs/procfs/procfs_vnops.c: revision 1.198
sys/kern/sys_ptrace_common.c: revision 1.23
sys/kern/sys_ptrace_common.c: revision 1.24
sbin/mount_procfs/mount_procfs.8: revision 1.36
sys/kern/sys_ptrace_common.c: revision 1.25
sys/kern/sys_ptrace.c: revision 1.5
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.30
sys/sys/proc.h: revision 1.342
sys/kern/sys_ptrace_common.c: revision 1.26
sys/miscfs/procfs/procfs_ctl.c: file removal
sys/kern/sys_ptrace_common.c: revision 1.27
sys/miscfs/procfs/procfs_subr.c: revision 1.109
sys/kern/sys_ptrace_common.c: revision 1.28
sys/secmodel/extensions/secmodel_extensions.c: revision 1.8
sys/kern/sys_ptrace_common.c: revision 1.29
sys/sys/ptrace.h: revision 1.62
sys/compat/netbsd32/netbsd32_signal.c: revision 1.45
share/man/man9/kauth.9: revision 1.109
sys/miscfs/procfs/files.procfs: revision 1.12
sys/compat/netbsd32/netbsd32.h: revision 1.115
sys/miscfs/procfs/procfs.h: revision 1.72
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.5
sys/kern/kern_sig.c: revision 1.337
sys/sys/kauth.h: revision 1.75
sys/sys/sysctl.h: revision 1.224
sys/kern/sys_ptrace_common.c: revision 1.30
sys/kern/sys_ptrace_common.c: revision 1.31
sys/kern/sys_ptrace_common.c: revision 1.32
sys/kern/sys_ptrace_common.c: revision 1.33
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.20
sys/kern/sys_ptrace_common.c: revision 1.34
sys/kern/sys_ptrace_common.c: revision 1.36
sys/kern/kern_proc.c: revision 1.207
sys/kern/kern_exit.c: revision 1.269
doc/TODO.ptrace: revision 1.29

Make {s,g}et{db,fp,}regs work again for PK_32 processes
XXX: pullup-8

add disgusting magic to handle compat_netbsd32 as a module.

use process_*reg32 instead of struct *reg32.

Remove the filesystem tracing feature

This is a legacy interface from 4.4BSD, and it was
introduced to overcome shortcomings of ptrace(2) at that time, which are
no longer relevant (performance). Today /proc/#/ctl offers a narrow
subset of ptrace(2) commands and is not applicable for modern
applications use beyond simplistic tracing scenarios.

This removal will simplify kernel internals. Users will still be able to
use all the other /proc files.

This change won't affect other procfs files neither Linux compat
features within mount_procfs(8). /proc/#/ctl isn't available on Linux.

Remove:
- /proc/#/ctl from mount_procfs(8)
- P_FSTRACE note from the documentation of ps(1)
- /proc/#/ctl and filesystem tracing documentation from mount_procfs(8)
- KAUTH_REQ_PROCESS_PROCFS_CTL documentation from kauth(9)
- source code file miscfs/procfs/procfs_ctl.c
- PFSctl and procfs_doctl() from sys/miscfs/procfs/procfs.h
- KAUTH_REQ_PROCESS_PROCFS_CTL from sys/sys/kauth.h
- PSL_FSTRACE (0x00010000) from sys/sys/proc.h
- P_FSTRACE (0x00010000) from sys/sys/sysctl.h

Reduce code complexity after removal of this functionality.

Update TODO.ptrace accordingly: remove two entries about /proc tracing.

Do not keep legacy notes as comments in the headers about removed

PSL_FSTRACE / P_FSTRACE, as this interface had little number of users
(close or equal to zero).
Proposed on tech-kern@.

All filesystem tracing utility users are encouraged to switch to ptrace(2).

Sponsored by <The NetBSD Foundation>

untangle the mess:
- factor out common code
- break each ptrace subcall to its own sub-function
.. more to come ...
- reduce ifdef ugliness by moving it up top.
- factor out PT_IO and make PT_{READ,WRITE}_{I,D} use it
- factor out PT_DUMPCORE
- factor out sendsig code
.. more to come ...

handle siginfo requests for ptrace32

ptrace: Partially undo PT_{READ,WRITE}_{I,D} and unbreak these commands

The refactored code did not work and was generating EFAULT.

Sponsored by <The NetBSD Foundation>

Merge the code back; the problem was that since we are reading/writing
to a kernel address for PT_{READ,WRITE}_{I,D} we need the kernel vmspace.
provide separate read and write functions to accomodate register functions
that need a size argument.

don't ignore error from copyout_piod

Use the proper process (the tracee) to get information about lwps and
registers and the tracer for vmspace.

Add new sysctl(3) entry: security.models.extensions.user_set_dbregs

Model this new sysctl(3) entry after "user_set_cpu_affinity" in the same
level of sysctl(3) switches.

Allow to read unconditionally Debug Registers (no change here). This is
convenient as even if a user of a debugger does not use hardware assisted
watchpoints/breakpoints, a debugger can still prompt these values to store
in an internal cache with context of registers. Reading them should have
no security concerns.

Add a paranoid MI switch that prohibits by default setting these registers
by a regular user (non-superuser). Make this switch disabled by default.
There are enough reserved bits out there to allow using them
unconditionally on hardened hosts.

Features shipped with Debug Registers are optional features in debuggers.
There is no reduction in elementary functionality.

Reviewed by <christos>

Sponsored by <The NetBSD Foundation>
 1.5.4.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.5.4.1 10-Jun-2019  christos Sync with HEAD
 1.5.2.1 11-Sep-2018  pgoyette Put the ``extern struct emul'' into the netbsd32_netbsd.h header
so it doesn't have to be separately declared in each source file.

Thanks mrg@
 1.7.2.1 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.3 12-Mar-2020  pgoyette Split out the quota code from the rest of compat_netbsd32 module. This
allows loading of compat_netbsd32 on kernels that don't have ``options
QUOTA'' enabled.
 1.2 18-Jun-2019  christos Add options for quota.
 1.1 24-Dec-2018  mrg branches: 1.1.2; 1.1.6;
move rlimit and quota code into their own modules.

(netbsd32_netbsd.c should have only simple shims. anything more
than copying arguments from one args struct to the other should
not be placed in this file. still a couple more to move out.)
 1.1.6.3 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.1.6.2 10-Jun-2019  christos Sync with HEAD
 1.1.6.1 24-Dec-2018  christos file netbsd32_quota.c was added on branch phil-wifi on 2019-06-10 22:07:02 +0000
 1.1.2.2 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.1.2.1 24-Dec-2018  pgoyette file netbsd32_quota.c was added on branch pgoyette-compat on 2018-12-26 14:01:46 +0000
 1.2 19-Jan-2021  simonb KNF consistency: No parentheses are needed around the return value.
 1.1 24-Dec-2018  mrg branches: 1.1.2; 1.1.6; 1.1.16;
move rlimit and quota code into their own modules.

(netbsd32_netbsd.c should have only simple shims. anything more
than copying arguments from one args struct to the other should
not be placed in this file. still a couple more to move out.)
 1.1.16.1 03-Apr-2021  thorpej Sync with HEAD.
 1.1.6.2 10-Jun-2019  christos Sync with HEAD
 1.1.6.1 24-Dec-2018  christos file netbsd32_rlimit.c was added on branch phil-wifi on 2019-06-10 22:07:02 +0000
 1.1.2.2 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.1.2.1 24-Dec-2018  pgoyette file netbsd32_rlimit.c was added on branch pgoyette-compat on 2018-12-26 14:01:46 +0000
 1.6 19-Jan-2021  simonb KNF consistency: No parentheses are needed around the return value.
 1.5 30-Apr-2020  riastradh branches: 1.5.2;
Omit needless #include <sys/rnd.h>.
 1.4 26-Sep-2019  christos use size_t for counters (which are compared and set with unsigneds)
 1.3 27-Jun-2019  christos Include the right stuff so compat_netbsd32_50 compiles.
 1.2 27-Jan-2019  pgoyette branches: 1.2.4;
Merge the [pgoyette-compat] branch
 1.1 21-Mar-2018  pgoyette branches: 1.1.2;
file netbsd32_rndpseudo_50.c was initially added on branch pgoyette-compat.
 1.1.2.1 21-Mar-2018  pgoyette Split compat/rndpseudo_50.c into two pieces, one for native compat and
a second piece for compat32. Update both modules accordingly.
 1.2.4.3 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.2.4.2 10-Jun-2019  christos Sync with HEAD
 1.2.4.1 27-Jan-2019  christos file netbsd32_rndpseudo_50.c was added on branch phil-wifi on 2019-06-10 22:07:02 +0000
 1.5.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.14 19-Feb-2012  rmind Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.
 1.13 04-Jan-2011  pgoyette branches: 1.13.8; 1.13.12;
Fix the build breakage, at least on amd64
 1.12 04-Jan-2011  matt Make the SA support as optional as is possible.
 1.11 10-Dec-2009  matt branches: 1.11.4;
Move saemul_netbsd32 to netbsd32_sa.c and allow the KERN_SA bits to be omitted.
 1.10 21-Jan-2009  tron Revert accidental of some rogue changes which broke the build.
 1.9 20-Jan-2009  tron Include "bsd.own.mk" to get the definition of "NETBSDSRCDIR" via
"/etc/mk.conf". This fixes manual use of "make cleandir".
 1.8 20-Nov-2008  tron branches: 1.8.4;
Make it possible to compile a kernel with COMPAT_NETBSD32 but without
COMPAT_40. This fixes PR port-amd64/39967.
 1.7 15-Oct-2008  wrstuden branches: 1.7.2; 1.7.4;
Merge wrstuden-revivesa into HEAD. Catch some files that I forgot
to revive on HEAD in previous commit.
 1.6 11-May-2008  wrstuden branches: 1.6.2; 1.6.6;
Oops. These are supposed to come alive on the branch, not the head.
 1.5 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.4 18-Feb-2007  cube branches: 1.4.26; 1.4.30;
Add missing lwp syscalls. Put them all together into a new file,
netbsd32_lwp.c, and remove remaining traces of SA.

This still needs some MD (and possibly MI, depending on the chosen
solution) changes to actually work.
 1.3 09-Feb-2007  ad branches: 1.3.2;
Merge newlock2 to head.
 1.2 25-Jun-2006  yamt branches: 1.2.4; 1.2.6;
netbsd32_sacopyout: don't leak kernel stack garbage to userland.
 1.1 29-Mar-2006  cube branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.12; 1.1.14;
Implement the _lwp* and sa_* families of syscalls, using the newly
introduced hooks in the native code.
 1.1.14.4 26-Feb-2007  yamt sync with head.
 1.1.14.3 30-Dec-2006  yamt sync with head.
 1.1.14.2 21-Jun-2006  yamt sync with head.
 1.1.14.1 29-Mar-2006  yamt file netbsd32_sa.c was added on branch yamt-lazymbuf on 2006-06-21 14:59:35 +0000
 1.1.12.1 13-Jul-2006  gdamore Merge from HEAD.
 1.1.8.2 22-Apr-2006  simonb Sync with head.
 1.1.8.1 29-Mar-2006  simonb file netbsd32_sa.c was added on branch simonb-timecounters on 2006-04-22 11:38:17 +0000
 1.1.6.2 19-Apr-2006  elad sync with head.
 1.1.6.1 29-Mar-2006  elad file netbsd32_sa.c was added on branch elad-kernelauth on 2006-04-19 04:01:22 +0000
 1.1.4.3 26-Jun-2006  yamt sync with head.
 1.1.4.2 11-Apr-2006  yamt sync files somehow mis-tagged by yamt-pdpolicy-base2.
 1.1.4.1 29-Mar-2006  yamt file netbsd32_sa.c was added on branch yamt-pdpolicy on 2006-04-11 12:20:52 +0000
 1.1.2.2 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.1.2.1 29-Mar-2006  tron file netbsd32_sa.c was added on branch peter-altq on 2006-03-31 09:45:13 +0000
 1.2.6.2 09-Sep-2006  rpaulo sync with head
 1.2.6.1 25-Jun-2006  rpaulo file netbsd32_sa.c was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:46:12 +0000
 1.2.4.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.3.2.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.4.30.2 11-Mar-2010  yamt sync with head
 1.4.30.1 04-May-2009  yamt sync with head.
 1.4.26.1 17-Jan-2009  mjf Sync with HEAD.
 1.6.6.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.6.6.1 19-Oct-2008  haad Sync with HEAD.
 1.6.2.3 28-Sep-2008  skrll Adapt the SA COMPAT_NETBSD32 stuff to this branch.
 1.6.2.2 11-May-2008  wrstuden Try this again, on the correct branch this time!

Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.6.2.1 11-May-2008  wrstuden file netbsd32_sa.c was added on branch wrstuden-revivesa on 2008-05-11 00:23:34 +0000
 1.7.4.1 22-Nov-2008  snj Pull up following revision(s) (requested by tron in ticket #100):
sys/compat/netbsd32/netbsd32_netbsd.c: revision 1.148
sys/compat/netbsd32/netbsd32_sa.c: revision 1.8
Make it possible to compile a kernel with COMPAT_NETBSD32 but without
COMPAT_40. This fixes PR port-amd64/39967.
 1.7.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.8.4.2 20-Nov-2008  tron Make it possible to compile a kernel with COMPAT_NETBSD32 but without
COMPAT_40. This fixes PR port-amd64/39967.
 1.8.4.1 20-Nov-2008  tron file netbsd32_sa.c was added on branch christos-time_t on 2008-11-20 11:56:41 +0000
 1.11.4.1 05-Mar-2011  rmind sync with head
 1.13.12.1 24-Feb-2012  mrg sync to -current.
 1.13.8.1 17-Apr-2012  yamt sync with head
 1.7 19-Feb-2012  rmind Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.
 1.6 10-Dec-2009  matt branches: 1.6.12; 1.6.16;
Move saemul_netbsd32 to netbsd32_sa.c and allow the KERN_SA bits to be omitted.
 1.5 15-Oct-2008  wrstuden branches: 1.5.8;
Merge wrstuden-revivesa into HEAD. Catch some files that I forgot
to revive on HEAD in previous commit.
 1.4 11-May-2008  wrstuden branches: 1.4.2; 1.4.6;
Oops. These are supposed to come alive on the branch, not the head.
 1.3 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.2 18-Feb-2007  cube branches: 1.2.26; 1.2.30;
Add missing lwp syscalls. Put them all together into a new file,
netbsd32_lwp.c, and remove remaining traces of SA.

This still needs some MD (and possibly MI, depending on the chosen
solution) changes to actually work.
 1.1 29-Mar-2006  cube branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8; 1.1.14; 1.1.20; 1.1.26;
Implement the _lwp* and sa_* families of syscalls, using the newly
introduced hooks in the native code.
 1.1.26.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.1.20.2 09-Sep-2006  rpaulo sync with head
 1.1.20.1 29-Mar-2006  rpaulo file netbsd32_sa.h was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:46:12 +0000
 1.1.14.3 26-Feb-2007  yamt sync with head.
 1.1.14.2 21-Jun-2006  yamt sync with head.
 1.1.14.1 29-Mar-2006  yamt file netbsd32_sa.h was added on branch yamt-lazymbuf on 2006-06-21 14:59:35 +0000
 1.1.8.2 22-Apr-2006  simonb Sync with head.
 1.1.8.1 29-Mar-2006  simonb file netbsd32_sa.h was added on branch simonb-timecounters on 2006-04-22 11:38:17 +0000
 1.1.6.2 19-Apr-2006  elad sync with head.
 1.1.6.1 29-Mar-2006  elad file netbsd32_sa.h was added on branch elad-kernelauth on 2006-04-19 04:01:22 +0000
 1.1.4.2 11-Apr-2006  yamt sync files somehow mis-tagged by yamt-pdpolicy-base2.
 1.1.4.1 29-Mar-2006  yamt file netbsd32_sa.h was added on branch yamt-pdpolicy on 2006-04-11 12:20:52 +0000
 1.1.2.2 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.1.2.1 29-Mar-2006  tron file netbsd32_sa.h was added on branch peter-altq on 2006-03-31 09:45:13 +0000
 1.2.30.2 11-Mar-2010  yamt sync with head
 1.2.30.1 04-May-2009  yamt sync with head.
 1.2.26.1 17-Jan-2009  mjf Sync with HEAD.
 1.4.6.1 19-Oct-2008  haad Sync with HEAD.
 1.4.2.3 28-Sep-2008  skrll Adapt the SA COMPAT_NETBSD32 stuff to this branch.
 1.4.2.2 11-May-2008  wrstuden Try this again, on the correct branch this time!

Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.4.2.1 11-May-2008  wrstuden file netbsd32_sa.h was added on branch wrstuden-revivesa on 2008-05-11 00:23:35 +0000
 1.5.8.2 15-Oct-2008  wrstuden Merge wrstuden-revivesa into HEAD. Catch some files that I forgot
to revive on HEAD in previous commit.
 1.5.8.1 15-Oct-2008  wrstuden file netbsd32_sa.h was added on branch christos-time_t on 2008-10-15 06:52:39 +0000
 1.6.16.1 24-Feb-2012  mrg sync to -current.
 1.6.12.1 17-Apr-2012  yamt sync with head
 1.20 20-Sep-2019  kamil Validate usec ranges in netbsd32___select50()

Later in the code selcommon() checks for proper timespec, check only
correct usec of timeval before type conversions.
 1.19 23-Apr-2010  rmind branches: 1.19.60;
Replace M_IOV and some malloc(9)s with kmem(9), and while there:
- Fix invalid free (M_TEMP vs M_IOV) in do_sys_recvmsg(), spotted by jakllsch@.
Also, same fix in osf1_sys_sendmsg_xopen().
- Fix attempt to free non-allocated memory in error path in netbsd32___getfh30().
- Plug a memory leak in compat_43_netbsd32_orecvmsg().
 1.18 11-Nov-2009  rmind branches: 1.18.2; 1.18.4;
- selcommon/pollcommon: drop redundant l argument.
- Use cached curlwp->l_fd, instead of p->p_fd.
- Inline selscan/pollscan.
 1.17 29-Mar-2009  christos Move the internal poll/select related API's to use timespec instead
of timeval (rides the uvm bump).
 1.16 11-Jan-2009  christos branches: 1.16.2;
merge christos-time_t
 1.15 29-May-2008  mrg branches: 1.15.6; 1.15.12;
remove clause #3 from my license where there are no other
copyright holders involved.
 1.14 20-Dec-2007  dsl branches: 1.14.6; 1.14.8; 1.14.10; 1.14.12;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.13 08-Dec-2007  dsl branches: 1.13.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.12 18-Mar-2007  dsl branches: 1.12.8; 1.12.10; 1.12.18;
Change all the NETBSD32PTR64(SCARG(uap, xxx))) to SCARG_P32(uap, xxx).
 1.11 16-Mar-2007  dsl remove all the double (and triple) casts used to convert 32bit userspace
pointers to and from 64bit kernel pointers. Instead use the defines
NETBSD32PTR64(p32) to read a 32bit pointer and (the new) NETBSD32PTR32(p32,p64)
to write a 32bit pointer throughout.
The 32bit pointer is now a struct to enforce the above.
amd64 (with linux emul) and sparc64 will both compile (when the arch stuff
goes in soon), and amd64 still runs some i386 binaries.
 1.10 04-Mar-2007  christos branches: 1.10.2; 1.10.4; 1.10.6;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.9 11-Dec-2005  christos branches: 1.9.26;
merge ktrace-lwp.
 1.8 19-Aug-2005  christos Fix lossage I created with the 64 bit ino_t change.
 1.7 09-Jul-2005  cube Implement pselect(2) and pollts(2).
 1.6 09-Jul-2005  cube Make netbsd32_select() use selcommon() instead of a gross copy/paste of
the old sys_select() code.
 1.5 26-Oct-2003  christos branches: 1.5.16;
Don't do the tsleep dance if timo is 0; simplify the code.
 1.4 18-Jan-2003  thorpej branches: 1.4.2;
Merge the nathanw_sa branch.
 1.3 23-Oct-2002  scw In preparation for COMPAT_NETBSD32 on SH-5:

- The MD netbsd32_machdep.h header now defines the 32-bit pointer type
instead of using u_int32_t everywhere,
- The MD netbsd32_machdep.h header now defines a macro (at least on
current implementations) which converts a 32-bit pointer to its 64-bit
equivalent,
- Change the MI code to utilise the above two items in all the right places,
- Implement netbsd32___sigaction_sigtramp().

Tested on Sparc64 by Matt Green.
 1.2 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.1 08-Feb-2001  mrg branches: 1.1.2; 1.1.4; 1.1.6;
split up netbsd32_netbsd.c into 9 new files, leaving only those syscalls that
have no special interpretations besides simple syscall args conversion.
 1.1.6.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.4.3 11-Nov-2002  nathanw Catch up to -current
 1.1.4.2 23-Aug-2002  petrov lwpification.
 1.1.4.1 14-Nov-2001  nathanw Catch up to -current.
 1.1.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.1.2.1 08-Feb-2001  bouyer file netbsd32_select.c was added on branch thorpej_scsipi on 2001-02-11 19:14:16 +0000
 1.4.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.4.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.2.1 03-Aug-2004  skrll Sync with HEAD
 1.5.16.3 21-Jan-2008  yamt sync with head
 1.5.16.2 03-Sep-2007  yamt sync with head.
 1.5.16.1 21-Jun-2006  yamt sync with head.
 1.9.26.2 24-Mar-2007  yamt sync with head.
 1.9.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.10.6.2 29-Mar-2007  reinoud Pullup to -current
 1.10.6.1 18-Mar-2007  reinoud First attempt to bring branch in sync with HEAD
 1.10.4.1 11-Jul-2007  mjf Sync with head.
 1.10.2.1 10-Apr-2007  ad Sync with head.
 1.12.18.1 26-Dec-2007  ad Sync with head.
 1.12.10.1 09-Jan-2008  matt sync with HEAD
 1.12.8.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.13.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.14.12.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.14.10.3 11-Aug-2010  yamt sync with head.
 1.14.10.2 11-Mar-2010  yamt sync with head
 1.14.10.1 04-May-2009  yamt sync with head.
 1.14.8.1 04-Jun-2008  yamt sync with head
 1.14.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.14.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.15.12.2 04-Jan-2009  christos add new syscalls.
 1.15.12.1 29-May-2008  christos file netbsd32_select.c was added on branch christos-time_t on 2009-01-04 01:56:02 +0000
 1.15.6.2 28-Apr-2009  skrll Sync with HEAD.
 1.15.6.1 19-Jan-2009  skrll Sync with HEAD.
 1.16.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.18.4.1 30-May-2010  rmind sync with head
 1.18.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.19.60.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.12 03-Feb-2019  thorpej Implement support for "pshared" POSIX semaphores.

Fixes lib/53273 (and Firefox's multi-process tab feature).
 1.11 19-Sep-2014  matt branches: 1.11.20;
#include <sys/condvar.h>
 1.10 10-Mar-2012  joerg branches: 1.10.2;
P1003_1B_SEMAPHORE is no longer optional.
 1.9 08-Mar-2012  joerg Implement sem_timedwait.
 1.8 14-Nov-2008  ad branches: 1.8.4; 1.8.18; 1.8.22;
Replace semid_t with intptr_t. No function change. This is a libc/kernel
private interface and so the name change should not affect any third
party code.
 1.7 29-Apr-2008  martin branches: 1.7.2; 1.7.6; 1.7.8;
Convert to new 2 clause license
 1.6 20-Dec-2007  dsl branches: 1.6.6; 1.6.8; 1.6.10;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.5 10-Sep-2007  cube branches: 1.5.8; 1.5.12;
Remove 3rd clause and my name from all the licences which were only in my
name.
 1.4 18-Mar-2007  dsl branches: 1.4.8; 1.4.10;
Change all the NETBSD32PTR64(SCARG(uap, xxx))) to SCARG_P32(uap, xxx).
 1.3 16-Mar-2007  dsl remove all the double (and triple) casts used to convert 32bit userspace
pointers to and from 64bit kernel pointers. Instead use the defines
NETBSD32PTR64(p32) to read a 32bit pointer and (the new) NETBSD32PTR32(p32,p64)
to write a 32bit pointer throughout.
The 32bit pointer is now a struct to enforce the above.
amd64 (with linux emul) and sparc64 will both compile (when the arch stuff
goes in soon), and amd64 still runs some i386 binaries.
 1.2 09-Feb-2007  ad branches: 1.2.2; 1.2.6; 1.2.8; 1.2.10;
Merge newlock2 to head.
 1.1 05-Mar-2006  cube branches: 1.1.2; 1.1.8; 1.1.14; 1.1.18; 1.1.20;
Implement the ksem_* family of syscalls.
 1.1.20.2 09-Sep-2006  rpaulo sync with head
 1.1.20.1 05-Mar-2006  rpaulo file netbsd32_sem.c was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:46:12 +0000
 1.1.18.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.1.14.6 21-Jan-2008  yamt sync with head
 1.1.14.5 27-Oct-2007  yamt sync with head.
 1.1.14.4 03-Sep-2007  yamt sync with head.
 1.1.14.3 26-Feb-2007  yamt sync with head.
 1.1.14.2 21-Jun-2006  yamt sync with head.
 1.1.14.1 05-Mar-2006  yamt file netbsd32_sem.c was added on branch yamt-lazymbuf on 2006-06-21 14:59:35 +0000
 1.1.8.2 22-Apr-2006  simonb Sync with head.
 1.1.8.1 05-Mar-2006  simonb file netbsd32_sem.c was added on branch simonb-timecounters on 2006-04-22 11:38:17 +0000
 1.1.2.2 05-Mar-2006  cube Implement the ksem_* family of syscalls.
 1.1.2.1 05-Mar-2006  cube file netbsd32_sem.c was added on branch yamt-pdpolicy on 2006-03-05 01:28:21 +0000
 1.2.10.2 29-Mar-2007  reinoud Pullup to -current
 1.2.10.1 18-Mar-2007  reinoud First attempt to bring branch in sync with HEAD
 1.2.8.1 11-Jul-2007  mjf Sync with head.
 1.2.6.2 09-Oct-2007  ad Sync with head.
 1.2.6.1 10-Apr-2007  ad Sync with head.
 1.2.2.1 24-Mar-2007  yamt sync with head.
 1.4.10.2 09-Jan-2008  matt sync with HEAD
 1.4.10.1 06-Nov-2007  matt sync with HEAD
 1.4.8.1 02-Oct-2007  joerg Sync with HEAD.
 1.5.12.1 02-Jan-2008  bouyer Sync with HEAD
 1.5.8.1 26-Dec-2007  ad Sync with head.
 1.6.10.2 04-May-2009  yamt sync with head.
 1.6.10.1 16-May-2008  yamt sync with head.
 1.6.8.1 18-May-2008  yamt sync with head.
 1.6.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.6.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.7.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.7.6.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.7.2.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.7.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.8.22.1 11-Mar-2012  mrg sync to latest -current
 1.8.18.1 17-Apr-2012  yamt sync with head
 1.8.4.2 14-Nov-2008  ad Replace semid_t with intptr_t. No function change. This is a libc/kernel
private interface and so the name change should not affect any third
party code.
 1.8.4.1 14-Nov-2008  ad file netbsd32_sem.c was added on branch christos-time_t on 2008-11-14 15:49:21 +0000
 1.10.2.1 03-Dec-2017  jdolecek update from HEAD
 1.11.20.1 10-Jun-2019  christos Sync with HEAD
 1.55 22-Nov-2024  mlelstv Crude patch to allow building and loading of compat_16 and compat_netbsd32_16 code
on aarch64.
 1.54 29-Apr-2024  mlelstv branches: 1.54.2;
In netbsd32___sigaction_sigtramp continue to use the compat module when
already locked for this process.

Needs pullup to netbsd-10.
 1.53 06-Nov-2021  thorpej branches: 1.53.4;
COMPAT_NETBSD32 is all about running the 32-bit flavor of native
binaries on a 64-bit platform[*], as such:
- Make the logic about which "sendsig" flavor to call MI (as it is in the
native 64-bit environment) and follow the same rules as the native 32-bit
environment.
- Make COMPAT_NETBSD32 x COMPAT_16 work the same as it would in the
native 32-bit environment by providing a netbsd32_sendsig_sigcontext_16_hook,
rather than overriding the entire sendsig logic with a netbsd32_sendsig_hook.
- In netbsd32___sigaction_sigtramp(), make sure the compat_netbsd32_16
module is loaded if the trampoline version specifies a sigcontext style
handler, otherwise return EINVAL so that libc can try again with siginfo
style.

[*] ...except for arm32, which uses it to mean "run 32-bit OABI binaries
from the 32-bit EABI environment". Doing it this way was arguably a mistake,
but we are stuck with it for now, so support it by providing a machine-
dependent override for netbsd32_sendsig() that also disables the corresponding
logic in netbsd32___sigaction_sigtramp().

Fixes PR kern/56487.
 1.52 07-Sep-2021  riastradh sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.51 19-Jan-2021  simonb KNF consistency: No parentheses are needed around the return value.
 1.50 18-Nov-2019  rin branches: 1.50.8;
TRAP_EXEC does not have extra fields to be filled in at the moment.
Explicitly ignore fields for now.

Pointed out by kamil. Thanks!

XXX
pullup to netbsd-9
 1.49 18-Nov-2019  rin When converting siginfo, examine si_code at the beginning,
as explained in siginfo(2).

- If it is SI_NOINFO, there's no additional information.
- If it is non-positive, i.e., codes described in siginfo(2),
we need to fill in _rt.

XXX
Description for SA_ASYNCIO in siginfo(2) seems outdated;
neither si_fd nor si_band are filled in with that code.

XXX
pullup to netbsd-9
 1.48 18-Nov-2019  rin Provide _ptrace_state for SIGTRAP with TRAP_EXEC, TRAP_CHLD, or TRAP_LWP.

Pointed out by kamil. Thanks!

XXX
pullup to netbsd-9
 1.47 18-Nov-2019  rin Sort by signal numbers as far as possible, adjust locations of functions.
No functional changes intended.

XXX
pullup to netbsd-9
 1.46 18-Nov-2019  rin Belatedly catch up with kern_sig.c rev 1.358:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/kern/kern_sig.c#rev1.358

Provide syscall information with SIGTRAP TRAP_SCE/TRAP_SCX so that
picotrace/truss, for example, works fine on COMPAT_NETBSD32.

With some minor changes:

- Centralize netbsd32_si{,32}_si{32,}() into netbsd32_ksi{,32}_ksi{32,}().
- Provide si_status with SIGCHLD.
- Remove the remaining of SA.

XXX
pullup to netbsd-9
 1.45 17-Dec-2017  christos branches: 1.45.4; 1.45.8;
handle siginfo requests for ptrace32
 1.44 06-Dec-2017  christos disable 32 bit signal ktrace records; 32 bit traced process produce 64 bit
trace records, the only record that we can't parse is that one :-)
XXX: pullup-8
 1.43 18-Sep-2016  christos branches: 1.43.8;
remove multiple default.
 1.42 18-Sep-2016  christos more ifdef KTRACE
fix wraps
 1.41 17-Sep-2016  christos deal with not having KTRACE
 1.40 13-Sep-2016  martin Allow emulations to override the creation of ktrace records for posting
signals. In compat_netbsd32 use this to write the 32bit version of
the records, so a 32bit userland kdump is happy.
 1.39 20-Jun-2015  martin branches: 1.39.2;
Implement modctl, sigqueinfo and mq_*
 1.38 24-Jan-2014  christos branches: 1.38.6;
sigaction until 1.4 had an int sigmask, don't trash the stack.
 1.37 19-Feb-2012  rmind branches: 1.37.2; 1.37.4;
Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.
 1.36 18-Nov-2011  christos branches: 1.36.4;
add a copyin function for sigset so that we can use sigtimedwait1 from
emulations.
 1.35 03-Feb-2011  joerg branches: 1.35.4;
Explicitly initialize ucontext before calling getmcontext.
 1.34 23-Apr-2010  rmind branches: 1.34.2; 1.34.4;
Replace M_IOV and some malloc(9)s with kmem(9), and while there:
- Fix invalid free (M_TEMP vs M_IOV) in do_sys_recvmsg(), spotted by jakllsch@.
Also, same fix in osf1_sys_sendmsg_xopen().
- Fix attempt to free non-allocated memory in error path in netbsd32___getfh30().
- Plug a memory leak in compat_43_netbsd32_orecvmsg().
 1.33 19-Jan-2010  pooka branches: 1.33.2; 1.33.4;
A few more instances of __sigtimedwait1 -> sigtimedwait1
 1.32 11-Jan-2009  christos merge christos-time_t
 1.31 15-Oct-2008  wrstuden branches: 1.31.2; 1.31.4; 1.31.8;
Merge wrstuden-revivesa into HEAD.
 1.30 29-May-2008  mrg branches: 1.30.4;
remove clause #3 from my license where there are no other
copyright holders involved.
 1.29 24-Apr-2008  ad branches: 1.29.2; 1.29.4;
Merge proc::p_mutex and proc::p_smutex into a single adaptive mutex, since
we no longer need to guard against access from hardware interrupt handlers.

Additionally, if cloning a process with CLONE_SIGHAND, arrange to have the
child process share the parent's lock so that signal state may be kept in
sync. Partially addresses PR kern/37437.
 1.28 20-Dec-2007  dsl branches: 1.28.6; 1.28.8;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.27 08-Dec-2007  dsl branches: 1.27.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.26 08-Oct-2007  ad branches: 1.26.6;
LOCK_ASSERT -> KASSERT
 1.25 16-Jun-2007  dsl branches: 1.25.6; 1.25.8; 1.25.10;
Modify the (recently added) compat_sigaltstack() #define to take the
values of the SS_ONSTACK and SS_DISABLE constants.
Use it to shorten the source files when this action is replicated.
Actually, given the monstrous complexity of sigaltstack1() there is
probably a much better way to do this...
 1.24 21-May-2007  christos rename si_sigval -> si_value to match POSIX RTS.
 1.23 18-Mar-2007  dsl Change all the NETBSD32PTR64(SCARG(uap, xxx))) to SCARG_P32(uap, xxx).
 1.22 16-Mar-2007  dsl remove all the double (and triple) casts used to convert 32bit userspace
pointers to and from 64bit kernel pointers. Instead use the defines
NETBSD32PTR64(p32) to read a 32bit pointer and (the new) NETBSD32PTR32(p32,p64)
to write a 32bit pointer throughout.
The 32bit pointer is now a struct to enforce the above.
amd64 (with linux emul) and sparc64 will both compile (when the arch stuff
goes in soon), and amd64 still runs some i386 binaries.
 1.21 04-Mar-2007  christos branches: 1.21.2; 1.21.4; 1.21.6;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.20 19-Feb-2007  cube Make netbsd32_{get,set}ucontext and associated functions
{get,set}ucontext32 look like their native counterparts again after
newlock2 merge. This avoids entering sigprocmask1 without the proc mutex
held...
 1.19 09-Feb-2007  ad branches: 1.19.2;
Merge newlock2 to head.
 1.18 08-Nov-2006  drochner -SUS says that a successful call to setcontext(2) does not return. This
implies that _UC_CPU must be set in the context passed. Check for this
and return EINVAL if not; this gives a cheap test for corrupted
ucontexts eg on a signal handler stack which would go unnoticed otherwise.
-Don't ckeck for NULL ucontext pointers explicitely. This is an error,
except in the swapcontext() case where it can be easily caught in
userland.
 1.17 15-Mar-2006  cube branches: 1.17.10; 1.17.12;
SA introduce a new case of siginfo structure. Be ready for it when the
time comes to support SA in COMPAT_NETBSD32 (which is soon).
 1.16 11-Dec-2005  christos branches: 1.16.4; 1.16.6; 1.16.8; 1.16.10;
merge ktrace-lwp.
 1.15 27-Sep-2005  chs make this compile again.
 1.14 24-Sep-2005  christos make the siginfo converters static and comment out the one that is not used.
 1.13 24-Sep-2005  christos include new compat siginfo header.
 1.12 13-Sep-2005  christos make this compile again.
 1.11 19-Aug-2005  christos Fix lossage I created with the 64 bit ino_t change.
 1.10 23-Jul-2005  cube Implement __sigtimedwait(2).
 1.9 02-Jun-2005  drochner branches: 1.9.2;
in siginfo conversion functions, declare the source operand as "const"
 1.8 26-Feb-2005  perry nuke trailing whitespace
 1.7 13-Oct-2003  fvdl branches: 1.7.8; 1.7.10;
Implement 32bit get/setcontext entry points.
 1.6 18-Jan-2003  thorpej branches: 1.6.2;
Merge the nathanw_sa branch.
 1.5 27-Nov-2002  atatat Complete the rename: s/sa_/<compat>_sa_/g

Also tweak the darwin siginfo stuff to avoid the same type of collision.
 1.4 23-Oct-2002  scw In preparation for COMPAT_NETBSD32 on SH-5:

- The MD netbsd32_machdep.h header now defines the 32-bit pointer type
instead of using u_int32_t everywhere,
- The MD netbsd32_machdep.h header now defines a macro (at least on
current implementations) which converts a 32-bit pointer to its 64-bit
equivalent,
- Change the MI code to utilise the above two items in all the right places,
- Implement netbsd32___sigaction_sigtramp().

Tested on Sparc64 by Matt Green.
 1.3 04-Jul-2002  thorpej Add kernel support for having userland provide the signal trampoline:

* struct sigacts gets a new sigact_sigdesc structure, which has the
sigaction and the trampoline/version. Version 0 means "legacy kernel
provided trampoline". Other versions are coordinated with machine-
dependent code in libc.
* sigaction1() grows two more arguments -- the trampoline pointer and
the trampoline version.
* A new __sigaction_sigtramp() system call is provided to register a
trampoline along with a signal handler.
* The handler is no longer passed to sensig() functions. Instead,
sendsig() looks up the handler by peeking in the sigacts for the
process getting the signal (since it has to look in there for the
trampoline anyway).
* Native sendsig() functions now select the appropriate trampoline and
its arguments based on the trampoline version in the sigacts.

Changes to libc to use the new facility will be checked in later. Kernel
version not bumped; we will ride the 1.6C bump made recently.
 1.2 13-Nov-2001  lukem branches: 1.2.8;
add RCSIDs (including regeneration of files as appropriate)
 1.1 08-Feb-2001  mrg branches: 1.1.2; 1.1.4; 1.1.6;
split up netbsd32_netbsd.c into 9 new files, leaving only those syscalls that
have no special interpretations besides simple syscall args conversion.
 1.1.6.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.6.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.4.6 11-Dec-2002  thorpej Sync with HEAD.
 1.1.4.5 20-Nov-2002  petrov lwpify netbsd32___sigaction_sigtramp.
 1.1.4.4 11-Nov-2002  nathanw Catch up to -current
 1.1.4.3 23-Aug-2002  petrov lwpification.
 1.1.4.2 01-Aug-2002  nathanw Catch up to -current.
 1.1.4.1 14-Nov-2001  nathanw Catch up to -current.
 1.1.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.1.2.1 08-Feb-2001  bouyer file netbsd32_signal.c was added on branch thorpej_scsipi on 2001-02-11 19:14:16 +0000
 1.2.8.1 15-Jul-2002  gehenna catch up with -current.
 1.6.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.6.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.6.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.2.1 03-Aug-2004  skrll Sync with HEAD
 1.7.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.7.8.1 29-Apr-2005  kent sync with -current
 1.9.2.6 21-Jan-2008  yamt sync with head
 1.9.2.5 27-Oct-2007  yamt sync with head.
 1.9.2.4 03-Sep-2007  yamt sync with head.
 1.9.2.3 26-Feb-2007  yamt sync with head.
 1.9.2.2 30-Dec-2006  yamt sync with head.
 1.9.2.1 21-Jun-2006  yamt sync with head.
 1.16.10.1 19-Apr-2006  elad sync with head.
 1.16.8.1 01-Apr-2006  yamt sync with head.
 1.16.6.1 22-Apr-2006  simonb Sync with head.
 1.16.4.1 09-Sep-2006  rpaulo sync with head
 1.17.12.1 10-Dec-2006  yamt sync with head.
 1.17.10.4 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.17.10.3 18-Nov-2006  ad Sync with head.
 1.17.10.2 17-Nov-2006  ad Checkpoint work in progress.
 1.17.10.1 21-Oct-2006  ad Checkpoint work in progress on locking and per-LWP signals. Very much a
a work in progress and there is still a lot to do.
 1.19.2.3 24-Mar-2007  yamt sync with head.
 1.19.2.2 12-Mar-2007  rmind Sync with HEAD.
 1.19.2.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.21.6.2 29-Mar-2007  reinoud Pullup to -current
 1.21.6.1 18-Mar-2007  reinoud First attempt to bring branch in sync with HEAD
 1.21.4.1 11-Jul-2007  mjf Sync with head.
 1.21.2.4 22-Aug-2007  ad Make it compile.
 1.21.2.3 15-Jul-2007  ad Sync with head.
 1.21.2.2 27-May-2007  ad Sync with head.
 1.21.2.1 10-Apr-2007  ad Sync with head.
 1.25.10.1 14-Oct-2007  yamt sync with head.
 1.25.8.2 09-Jan-2008  matt sync with HEAD
 1.25.8.1 06-Nov-2007  matt sync with HEAD
 1.25.6.2 09-Dec-2007  jmcneill Sync with HEAD.
 1.25.6.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.26.6.1 26-Dec-2007  ad Sync with head.
 1.27.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.28.8.2 04-Jun-2008  yamt sync with head
 1.28.8.1 18-May-2008  yamt sync with head.
 1.28.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.28.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.29.4.6 28-Sep-2008  skrll Adapt the SA COMPAT_NETBSD32 stuff to this branch.
 1.29.4.5 25-Sep-2008  skrll Typo in comment and define 'p' in getucontext32_sa.
 1.29.4.4 27-Jun-2008  wrstuden Add getucontext32_sa() and getucontext_sa(), and use them. They
are sa-specific versions of getucontext{,32}(). The main difference
is that they do NOT require the p_lock be held. We report an empty
signal mask, both to avoid needing p_lock and because the process
signal mask is almost always 0 for SA.
 1.29.4.3 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.29.4.2 14-May-2008  wrstuden Per discussion with ad at n dot o, revert signal mask handling
changes.

The l_sigstk changes are most likely totally un-needed as SA will
never use a signal stack - we send an upcall (or will as other
diffs are brought in).

The l_sigmask changes were too controvertial. In all honesty, I
think it's probably best to revert them. The main reason they were
there is the fact that in an SA process, we don't mask signals per
kernel thread, we mask them per user thread. In the kernel, we want
them all to get turned into upcalls. Thus the normal state of
l_sigmask in an SA process is for it to always be empty.

While we are in the process of delivering a signal, we want to
temporarily mask a signal (so we don't recursively exhaust our
upcall stacks). However signal delivery is rare (important, but
rare), and delivering back-to-back signals is even rarer. So rather
than cause every user of a signal mask to be prepared for this very
rare case, we will just add a second check later in the signal
delivery code. Said change is not in this diff.

This also un-compensates all of our compatability code for dealing
with SA. SA is a NetBSD-specific thing, so there's no need for
Irix, Linux, Solaris, SVR4 and so on to cope with it.

As previously, everything other than kern_sa.c compiles in i386
GENERIC as of this checkin. I will switch to ALL soon for compile
testing.
 1.29.4.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.29.2.3 11-Aug-2010  yamt sync with head.
 1.29.2.2 11-Mar-2010  yamt sync with head
 1.29.2.1 04-May-2009  yamt sync with head.
 1.30.4.1 19-Oct-2008  haad Sync with HEAD.
 1.31.8.2 04-Jan-2009  christos add new syscalls.
 1.31.8.1 15-Oct-2008  christos file netbsd32_signal.c was added on branch christos-time_t on 2009-01-04 01:56:02 +0000
 1.31.4.1 16-Feb-2011  bouyer Pull up following revision(s) (requested by joerg in ticket #1556):
sys/compat/irix/irix_signal.c: revision 1.56
sys/compat/svr4/svr4_signal.c: revision 1.65
sys/compat/netbsd32/netbsd32_signal.c: revision 1.35
sys/kern/sys_sig.c: revision 1.31
Explicitly initialize ucontext before calling getmcontext.
 1.31.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.33.4.2 05-Mar-2011  rmind sync with head
 1.33.4.1 30-May-2010  rmind sync with head
 1.33.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.34.4.1 08-Feb-2011  bouyer Sync with HEAD
 1.34.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.35.4.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.35.4.1 17-Apr-2012  yamt sync with head
 1.36.4.1 24-Feb-2012  mrg sync to -current.
 1.37.4.1 18-May-2014  rmind sync with head
 1.37.2.2 03-Dec-2017  jdolecek update from HEAD
 1.37.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.38.6.2 05-Oct-2016  skrll Sync with HEAD
 1.38.6.1 22-Sep-2015  skrll Sync with HEAD
 1.39.2.1 04-Nov-2016  pgoyette Sync with HEAD
 1.43.8.2 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1836):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.43.8.1 12-Apr-2018  martin Pull up following revision(s) (requested by kamil in ticket #713):

sys/modules/procfs/Makefile: revision 1.4
sys/miscfs/procfs/procfs_vfsops.c: revision 1.98
bin/ps/ps.1: revision 1.108
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.32
sys/miscfs/procfs/procfs_vnops.c: revision 1.198
sys/kern/sys_ptrace_common.c: revision 1.23
sys/kern/sys_ptrace_common.c: revision 1.24
sbin/mount_procfs/mount_procfs.8: revision 1.36
sys/kern/sys_ptrace_common.c: revision 1.25
sys/kern/sys_ptrace.c: revision 1.5
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.30
sys/sys/proc.h: revision 1.342
sys/kern/sys_ptrace_common.c: revision 1.26
sys/miscfs/procfs/procfs_ctl.c: file removal
sys/kern/sys_ptrace_common.c: revision 1.27
sys/miscfs/procfs/procfs_subr.c: revision 1.109
sys/kern/sys_ptrace_common.c: revision 1.28
sys/secmodel/extensions/secmodel_extensions.c: revision 1.8
sys/kern/sys_ptrace_common.c: revision 1.29
sys/sys/ptrace.h: revision 1.62
sys/compat/netbsd32/netbsd32_signal.c: revision 1.45
share/man/man9/kauth.9: revision 1.109
sys/miscfs/procfs/files.procfs: revision 1.12
sys/compat/netbsd32/netbsd32.h: revision 1.115
sys/miscfs/procfs/procfs.h: revision 1.72
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.5
sys/kern/kern_sig.c: revision 1.337
sys/sys/kauth.h: revision 1.75
sys/sys/sysctl.h: revision 1.224
sys/kern/sys_ptrace_common.c: revision 1.30
sys/kern/sys_ptrace_common.c: revision 1.31
sys/kern/sys_ptrace_common.c: revision 1.32
sys/kern/sys_ptrace_common.c: revision 1.33
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.20
sys/kern/sys_ptrace_common.c: revision 1.34
sys/kern/sys_ptrace_common.c: revision 1.36
sys/kern/kern_proc.c: revision 1.207
sys/kern/kern_exit.c: revision 1.269
doc/TODO.ptrace: revision 1.29

Make {s,g}et{db,fp,}regs work again for PK_32 processes
XXX: pullup-8

add disgusting magic to handle compat_netbsd32 as a module.

use process_*reg32 instead of struct *reg32.

Remove the filesystem tracing feature

This is a legacy interface from 4.4BSD, and it was
introduced to overcome shortcomings of ptrace(2) at that time, which are
no longer relevant (performance). Today /proc/#/ctl offers a narrow
subset of ptrace(2) commands and is not applicable for modern
applications use beyond simplistic tracing scenarios.

This removal will simplify kernel internals. Users will still be able to
use all the other /proc files.

This change won't affect other procfs files neither Linux compat
features within mount_procfs(8). /proc/#/ctl isn't available on Linux.

Remove:
- /proc/#/ctl from mount_procfs(8)
- P_FSTRACE note from the documentation of ps(1)
- /proc/#/ctl and filesystem tracing documentation from mount_procfs(8)
- KAUTH_REQ_PROCESS_PROCFS_CTL documentation from kauth(9)
- source code file miscfs/procfs/procfs_ctl.c
- PFSctl and procfs_doctl() from sys/miscfs/procfs/procfs.h
- KAUTH_REQ_PROCESS_PROCFS_CTL from sys/sys/kauth.h
- PSL_FSTRACE (0x00010000) from sys/sys/proc.h
- P_FSTRACE (0x00010000) from sys/sys/sysctl.h

Reduce code complexity after removal of this functionality.

Update TODO.ptrace accordingly: remove two entries about /proc tracing.

Do not keep legacy notes as comments in the headers about removed

PSL_FSTRACE / P_FSTRACE, as this interface had little number of users
(close or equal to zero).
Proposed on tech-kern@.

All filesystem tracing utility users are encouraged to switch to ptrace(2).

Sponsored by <The NetBSD Foundation>

untangle the mess:
- factor out common code
- break each ptrace subcall to its own sub-function
.. more to come ...
- reduce ifdef ugliness by moving it up top.
- factor out PT_IO and make PT_{READ,WRITE}_{I,D} use it
- factor out PT_DUMPCORE
- factor out sendsig code
.. more to come ...

handle siginfo requests for ptrace32

ptrace: Partially undo PT_{READ,WRITE}_{I,D} and unbreak these commands

The refactored code did not work and was generating EFAULT.

Sponsored by <The NetBSD Foundation>

Merge the code back; the problem was that since we are reading/writing
to a kernel address for PT_{READ,WRITE}_{I,D} we need the kernel vmspace.
provide separate read and write functions to accomodate register functions
that need a size argument.

don't ignore error from copyout_piod

Use the proper process (the tracee) to get information about lwps and
registers and the tracer for vmspace.

Add new sysctl(3) entry: security.models.extensions.user_set_dbregs

Model this new sysctl(3) entry after "user_set_cpu_affinity" in the same
level of sysctl(3) switches.

Allow to read unconditionally Debug Registers (no change here). This is
convenient as even if a user of a debugger does not use hardware assisted
watchpoints/breakpoints, a debugger can still prompt these values to store
in an internal cache with context of registers. Reading them should have
no security concerns.

Add a paranoid MI switch that prohibits by default setting these registers
by a regular user (non-superuser). Make this switch disabled by default.
There are enough reserved bits out there to allow using them
unconditionally on hardened hosts.

Features shipped with Debug Registers are optional features in debuggers.
There is no reduction in elementary functionality.

Reviewed by <christos>

Sponsored by <The NetBSD Foundation>
 1.45.8.2 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.45.8.1 19-Nov-2019  martin Pull up following revision(s) (requested by rin in ticket #456):

sys/compat/netbsd32/netbsd32_signal.c: revision 1.46
sys/compat/netbsd32/netbsd32_signal.c: revision 1.47
sys/compat/netbsd32/netbsd32_signal.c: revision 1.48
sys/compat/netbsd32/netbsd32_signal.c: revision 1.49
sys/compat/netbsd32/netbsd32_signal.c: revision 1.50

Belatedly catch up with kern_sig.c rev 1.358:
Provide syscall information with SIGTRAP TRAP_SCE/TRAP_SCX so that
picotrace/truss, for example, works fine on COMPAT_NETBSD32.
With some minor changes:
- Centralize netbsd32_si{,32}_si{32,}() into netbsd32_ksi{,32}_ksi{32,}().
- Provide si_status with SIGCHLD.
- Remove the remaining of SA.

Sort by signal numbers as far as possible, adjust locations of functions.
No functional changes intended.

XXX
pullup to netbsd-9

Provide _ptrace_state for SIGTRAP with TRAP_EXEC, TRAP_CHLD, or TRAP_LWP.
Pointed out by kamil. Thanks!

XXX
pullup to netbsd-9

When converting siginfo, examine si_code at the beginning,
as explained in siginfo(2).
- If it is SI_NOINFO, there's no additional information.
- If it is non-positive, i.e., codes described in siginfo(2),
we need to fill in _rt.

XXX
Description for SA_ASYNCIO in siginfo(2) seems outdated;
neither si_fd nor si_band are filled in with that code.

XXX
pullup to netbsd-9

TRAP_EXEC does not have extra fields to be filled in at the moment.
Explicitly ignore fields for now.
Pointed out by kamil. Thanks!

XXX
pullup to netbsd-9
 1.45.4.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.50.8.1 03-Apr-2021  thorpej Sync with HEAD.
 1.53.4.1 26-Oct-2024  martin Pull up following revision(s) (requested by rin in ticket #989):

sys/compat/netbsd32/netbsd32_compat_16.c: revision 1.5
sys/compat/netbsd32/netbsd32_compat_16.c: revision 1.6
sys/compat/netbsd32/netbsd32_signal.c: revision 1.54

In netbsd32___sigaction_sigtramp continue to use the compat module when
already locked for this process.

Enable compat sigreturn system call.

netbsd32_compat_16.c: Fix whitespace.
No functional change intended.
 1.54.2.1 02-Aug-2025  perseant Sync with HEAD
 1.56 19-Jan-2021  simonb The read/write/send/recv system calls return ssize_t because -1 is
returned on error. Therefore we must restrict the lengths of any
buffers to NETBSD32_SSIZE_MAX with compat32 to avoid garbage return
values.

Fixes ATF lib/libc/sys/t_write:write_err.
 1.55 19-Jan-2021  simonb KNF consistency: No parentheses are needed around the return value.
 1.54 18-Jan-2021  simonb s/u_intN_t/uintN_t/
 1.53 28-Sep-2019  mlelstv branches: 1.53.8;
signed/unsigned comparison.
 1.52 27-Sep-2019  mlelstv Ensure failure if resid goes negative.
 1.51 27-Sep-2019  mlelstv signed/unsigned mismatch.
 1.50 26-Sep-2019  christos use size_t for counters (which are compared and set with unsigneds)
 1.49 14-Nov-2018  hannken branches: 1.49.4;
Apply the recent fixes to {send,recv}mmsg() to their compat variants.
 1.48 12-Nov-2018  maxv Fix inverted logic, which leads to buffer overflow. Detected by kASan.
 1.47 13-May-2018  christos branches: 1.47.2;
PR/53280: Andreas Gustafsson: Fix panic in the fdpass test. This is probably
the only 32 bit binary in the tests...
 1.46 10-May-2018  christos add {send,recv}mmsg
 1.45 03-May-2018  christos Fix COMPAT_NETBSD32 cmsg handling:

1. alignment was wrong for > 1 message
2. macros were doing incorrect pointer comparisons, fortunately ending
the iteration early after the fists cmsg instead of crashing.
3. don't output 32 bit ktrace records for cmsg. 32 bit programs running
under emulation on 64 bit systems should produce 64 bit ktrace records
so that the native ktrace can handle the records; remove extra arguments
that are now not needed (the 32 bit msghdr).
4. output the correct type for cmsg trace records.
5. output all the cmsg records in traces instead of just the first one.

Welcome to 8.99.15 because of the argument removal.

XXX: Really all the code should be changed to use the CMSG_{FIRST,NXT}HDR
macros...
 1.44 13-Sep-2016  martin branches: 1.44.8; 1.44.14;
Make the ktrace record written by do_sys_sendmsg/do_sys_recvmsg overridable
by the caller. Use this in compat_netbsd32 to log the 32bit version, so
the 32bit userland kdump is happy.
 1.43 08-Sep-2016  martin recvmsg: ktrace the 32bit message header, not the native (64bit) version.
 1.42 22-Jul-2015  maxv Memory leak, triggerable from an unprivileged user.
 1.41 18-Aug-2012  martin branches: 1.41.2; 1.41.14; 1.41.16;
Do not use a userland pointer, but the copied-in kernel version instead.
While there, reorder loop end condition for efficency.
Fixes net/fdpass tests on all archs with separate kernel/userland VA.
 1.40 30-Jul-2012  matt Make SCM_RIGHTS work correctly. (make sure to advance m if we've completely
dealt with, the next mbuf (if any) comes into play).
 1.39 20-Jan-2012  joerg branches: 1.39.2;
Change CMSG_SPACE and CMSG_LEN to provide Integer Constant Expressions
again. This was changed in sys/socket.h r1.51 to work around fallout
from the IPv6 aux data migration. It broke the historic ABI on some
platforms. This commit restores compatibility for netbsd32 code on such
platforms and provides a template for future changes to the CMSG_*
alignment. Revert PCC/Clang workarounds in postfix and tmux.
 1.38 13-Jan-2012  joerg Reduce difference between recvfrom/recvmsg for netbsd32 and the native
version. This fixes the bug of lost file descriptors when the control
space is not large enough.
 1.37 23-Apr-2010  rmind branches: 1.37.8; 1.37.12;
Replace M_IOV and some malloc(9)s with kmem(9), and while there:
- Fix invalid free (M_TEMP vs M_IOV) in do_sys_recvmsg(), spotted by jakllsch@.
Also, same fix in osf1_sys_sendmsg_xopen().
- Fix attempt to free non-allocated memory in error path in netbsd32___getfh30().
- Plug a memory leak in compat_43_netbsd32_orecvmsg().
 1.36 22-Jul-2009  njoly branches: 1.36.2; 1.36.4;
Make compat netbsd32 sendmsg follow the native version by allowing
empty messages. This let unfdpass regression test work as expected.
 1.35 15-Jun-2009  njoly Make netbsd32 sendmsg(2), do not use an uninitialised value for
fetching iovec structures.
While here, sync recvmsg(2) to avoid some unneeded casts.
 1.34 17-Dec-2008  cegger branches: 1.34.2; 1.34.4;
kill MALLOC and FREE macros.
 1.33 24-Jun-2008  ad branches: 1.33.4; 1.33.12;
Replace references to getsock/getvnode.
 1.32 29-May-2008  mrg branches: 1.32.2;
remove clause #3 from my license where there are no other
copyright holders involved.
 1.31 21-Mar-2008  ad branches: 1.31.2; 1.31.4; 1.31.6;
Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
 1.30 20-Dec-2007  dsl branches: 1.30.6;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.29 08-Dec-2007  dsl branches: 1.29.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.28 04-Dec-2007  dsl Remove all the __P
 1.27 15-Aug-2007  ad branches: 1.27.2; 1.27.8; 1.27.10;
Changes to make ktrace LKM friendly and reduce ifdef KTRACE. Proposed
on tech-kern.
 1.26 01-Jun-2007  dsl branches: 1.26.2; 1.26.6;
Split sys_bind() and sys_connect() so that compat code can use common code
once the 'address' has been copied into an mbuf.
Add extra flags for 'struct msghdr.msg_flags' to indicate that the address
and control are already in mbufs, and that the uio structure is in userspace
for sending data, rename sendit() to do_sys_sendmsg() to ensure no old code
passes in random flags.
Changes to compat code to use new functions - removing some stackgap use.
Fix a 'use after free' in compat_43_sys_recvmsg.
I ***THINK*** the code that converts 'cmsg' formatted data is borked!
svr4_stream.c ought to be generated from svr4_32_stream.c during the build.
 1.25 31-May-2007  christos message size == 0 is valid. From Markus Mayer
 1.24 18-Mar-2007  dsl Change all the NETBSD32PTR64(SCARG(uap, xxx))) to SCARG_P32(uap, xxx).
 1.23 16-Mar-2007  dsl remove all the double (and triple) casts used to convert 32bit userspace
pointers to and from 64bit kernel pointers. Instead use the defines
NETBSD32PTR64(p32) to read a 32bit pointer and (the new) NETBSD32PTR32(p32,p64)
to write a 32bit pointer throughout.
The 32bit pointer is now a struct to enforce the above.
amd64 (with linux emul) and sparc64 will both compile (when the arch stuff
goes in soon), and amd64 still runs some i386 binaries.
 1.22 04-Mar-2007  christos branches: 1.22.2; 1.22.4; 1.22.6;
fix fallout from caddr_t changes.
 1.21 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.20 09-Feb-2007  ad branches: 1.20.2;
Merge newlock2 to head.
 1.19 19-Mar-2006  matt branches: 1.19.8;
More variable sized MALLOC -> malloc changes.
 1.18 18-Mar-2006  matt MALLOC -> malloc
 1.17 01-Mar-2006  yamt branches: 1.17.2; 1.17.4; 1.17.6;
merge yamt-uio_vmspace branch.

- use vmspace rather than proc or lwp where appropriate.
the latter is more natural to specify an address space.
(and less likely to be abused for random purposes.)
- fix a swdmover race.
 1.16 11-Dec-2005  christos branches: 1.16.2; 1.16.4; 1.16.6;
merge ktrace-lwp.
 1.15 19-Aug-2005  christos Fix lossage I created with the 64 bit ino_t change.
 1.14 31-May-2005  christos branches: 1.14.2;
- add const
- avoid shadowed variables.
 1.13 26-Feb-2005  perry nuke trailing whitespace
 1.12 21-Oct-2003  fvdl branches: 1.12.8; 1.12.10;
Fix some int vs. NULL comparisons.
 1.11 29-Jun-2003  fvdl branches: 1.11.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.10 29-Jun-2003  martin struct proc * -> struct lwp *
 1.9 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.8 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.7 23-Oct-2002  scw In preparation for COMPAT_NETBSD32 on SH-5:

- The MD netbsd32_machdep.h header now defines the 32-bit pointer type
instead of using u_int32_t everywhere,
- The MD netbsd32_machdep.h header now defines a macro (at least on
current implementations) which converts a 32-bit pointer to its 64-bit
equivalent,
- Change the MI code to utilise the above two items in all the right places,
- Implement netbsd32___sigaction_sigtramp().

Tested on Sparc64 by Matt Green.
 1.6 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.5 17-Jul-2001  jdolecek Expel MSG_COMPAT/COMPAT_OLDSOCK, make the COMPAT_43 wrappers
arrange things as needed. Unfortunately, the check in sockargs()
have to stay, since 4.3BSD bind(2), connect(2) and sendto(2) were
not versioned at the time :(

This code was tested to pass regression tests.
 1.4 25-Jun-2001  jdolecek branches: 1.4.2;
Back off the sendit()/recvit() change, some have problems with it
 1.3 25-Jun-2001  jdolecek Add 'kernsa' parameter for sendit()/recvit(); if nonzero, msg->msg_name
is supposed to point directly to struct mbuf or struct sockaddr in kernel
space as appropriate, rather than being a pointer to memory in userland.

This is to be used by compat/* when emulation needs to wrap
send{to|msg}(2)/recv{from|msg}(2) and modify the passed struct
sockaddr.
 1.2 30-May-2001  mrg use _KERNEL_OPT.
 1.1 08-Feb-2001  mrg branches: 1.1.2; 1.1.4;
split up netbsd32_netbsd.c into 9 new files, leaving only those syscalls that
have no special interpretations besides simple syscall args conversion.
 1.1.4.6 11-Nov-2002  nathanw Catch up to -current
 1.1.4.5 23-Aug-2002  petrov lwpification.
 1.1.4.4 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.1.4.3 14-Nov-2001  nathanw Catch up to -current.
 1.1.4.2 24-Aug-2001  nathanw Catch up with -current.
 1.1.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.1.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.1.2.1 08-Feb-2001  bouyer file netbsd32_socket.c was added on branch thorpej_scsipi on 2001-02-11 19:14:17 +0000
 1.4.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.4.2.1 03-Aug-2001  lukem update to -current
 1.11.2.7 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.11.2.6 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.11.2.5 21-Sep-2004  skrll Fix the sync with head I botched.
 1.11.2.4 18-Sep-2004  skrll Sync with HEAD.
 1.11.2.3 26-Aug-2004  skrll Adapt to branch.

sparc64 GENERIC compiles.
 1.11.2.2 03-Aug-2004  skrll Sync with HEAD
 1.11.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.12.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.12.8.1 29-Apr-2005  kent sync with -current
 1.14.2.6 24-Mar-2008  yamt sync with head.
 1.14.2.5 21-Jan-2008  yamt sync with head
 1.14.2.4 07-Dec-2007  yamt sync with head
 1.14.2.3 03-Sep-2007  yamt sync with head.
 1.14.2.2 26-Feb-2007  yamt sync with head.
 1.14.2.1 21-Jun-2006  yamt sync with head.
 1.16.6.1 22-Apr-2006  simonb Sync with head.
 1.16.4.1 09-Sep-2006  rpaulo sync with head
 1.16.2.1 18-Feb-2006  yamt adapt the rest of MI code.
 1.17.6.1 28-Mar-2006  tron Merge 2006-03-28 NetBSD-current into the "peter-altq" branch.
 1.17.4.1 19-Apr-2006  elad sync with head.
 1.17.2.1 01-Apr-2006  yamt sync with head.
 1.19.8.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.20.2.2 24-Mar-2007  yamt sync with head.
 1.20.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.22.6.2 29-Mar-2007  reinoud Pullup to -current
 1.22.6.1 18-Mar-2007  reinoud First attempt to bring branch in sync with HEAD
 1.22.4.1 11-Jul-2007  mjf Sync with head.
 1.22.2.3 20-Aug-2007  ad Sync with HEAD.
 1.22.2.2 09-Jun-2007  ad Sync with head.
 1.22.2.1 10-Apr-2007  ad Sync with head.
 1.26.6.2 09-Dec-2007  jmcneill Sync with HEAD.
 1.26.6.1 16-Aug-2007  jmcneill Sync with HEAD.
 1.26.2.1 03-Sep-2007  skrll Sync with HEAD.
 1.27.10.2 26-Dec-2007  ad Sync with head.
 1.27.10.1 08-Dec-2007  ad Sync with head.
 1.27.8.2 27-Dec-2007  mjf Sync with HEAD.
 1.27.8.1 08-Dec-2007  mjf Sync with HEAD.
 1.27.2.1 09-Jan-2008  matt sync with HEAD
 1.29.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.30.6.4 17-Jan-2009  mjf Sync with HEAD.
 1.30.6.3 29-Jun-2008  mjf Sync with HEAD.
 1.30.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.30.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.31.6.4 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.31.6.3 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.31.6.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.31.6.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.31.4.4 11-Aug-2010  yamt sync with head.
 1.31.4.3 19-Aug-2009  yamt sync with head.
 1.31.4.2 20-Jun-2009  yamt sync with head
 1.31.4.1 04-May-2009  yamt sync with head.
 1.31.2.1 04-Jun-2008  yamt sync with head
 1.32.2.1 27-Jun-2008  simonb Sync with head.
 1.33.12.1 09-Jun-2010  matt Fix socket passing in netbsd32 compat. unfdpasses and incoming ssh
interactive session now work.
 1.33.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.34.4.1 23-Jul-2009  jym Sync with HEAD.
 1.34.2.2 17-Dec-2008  cegger kill MALLOC and FREE macros.
 1.34.2.1 17-Dec-2008  cegger file netbsd32_socket.c was added on branch christos-time_t on 2008-12-17 20:51:35 +0000
 1.36.4.1 30-May-2010  rmind sync with head
 1.36.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.37.12.1 18-Feb-2012  mrg merge to -current.
 1.37.8.2 30-Oct-2012  yamt sync with head
 1.37.8.1 17-Apr-2012  yamt sync with head
 1.39.2.3 21-Apr-2016  martin Pull up following revision(s) (requested by christos in ticket #1378):
sys/compat/netbsd32/netbsd32_socket.c: revision 1.42
Memory leak, triggerable from an unprivileged user.
 1.39.2.2 18-Aug-2012  riz branches: 1.39.2.2.4; 1.39.2.2.6;
Pull up following revision(s) (requested by martin in ticket #510):
sys/compat/netbsd32/netbsd32_socket.c: revision 1.41
Do not use a userland pointer, but the copied-in kernel version instead.
While there, reorder loop end condition for efficency.
Fixes net/fdpass tests on all archs with separate kernel/userland VA.
 1.39.2.1 30-Jul-2012  martin Pull up following revision(s) (requested by matt in ticket #452):
sys/compat/netbsd32/netbsd32_socket.c: revision 1.40
Make SCM_RIGHTS work correctly. (make sure to advance m if we've completely
dealt with, the next mbuf (if any) comes into play).
 1.39.2.2.6.1 21-Apr-2016  martin Pull up following revision(s) (requested by christos in ticket #1378):
sys/compat/netbsd32/netbsd32_socket.c: revision 1.42
Memory leak, triggerable from an unprivileged user.
 1.39.2.2.4.1 21-Apr-2016  martin Pull up following revision(s) (requested by christos in ticket #1378):
sys/compat/netbsd32/netbsd32_socket.c: revision 1.42
Memory leak, triggerable from an unprivileged user.
 1.41.16.2 05-Oct-2016  skrll Sync with HEAD
 1.41.16.1 22-Sep-2015  skrll Sync with HEAD
 1.41.14.2 21-Nov-2018  martin Pull up following revision(s) (requested by maxv in ticket #1652):

sys/compat/netbsd32/netbsd32_socket.c: revision 1.48 (via patch)

Fix inverted logic, which leads to buffer overflow. Detected by kASan.
 1.41.14.1 08-Aug-2015  martin branches: 1.41.14.1.2; 1.41.14.1.6;
Pull up following revision(s) (requested by maxv in ticket #941):
sys/compat/netbsd32/netbsd32_socket.c: revision 1.42
Memory leak, triggerable from an unprivileged user.
 1.41.14.1.6.1 21-Nov-2018  martin Pull up following revision(s) (requested by maxv in ticket #1652):

sys/compat/netbsd32/netbsd32_socket.c: revision 1.48 (via patch)

Fix inverted logic, which leads to buffer overflow. Detected by kASan.
 1.41.14.1.2.1 21-Nov-2018  martin Pull up following revision(s) (requested by maxv in ticket #1652):

sys/compat/netbsd32/netbsd32_socket.c: revision 1.48 (via patch)

Fix inverted logic, which leads to buffer overflow. Detected by kASan.
 1.41.2.1 03-Dec-2017  jdolecek update from HEAD
 1.44.14.2 26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.44.14.1 21-May-2018  pgoyette Sync with HEAD
 1.44.8.2 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1833):

sys/compat/netbsd32/netbsd32_netbsd.c: revision 1.232
sys/compat/netbsd32/netbsd32_socket.c: revision 1.56
sys/compat/netbsd32/netbsd32_conv.h: revision 1.45
sys/compat/netbsd32/netbsd32_fs.c: revision 1.92
sys/compat/netbsd32/netbsd32.h: revision 1.137

The read/write/send/recv system calls return ssize_t because -1 is
returned on error. Therefore we must restrict the lengths of any
buffers to NETBSD32_SSIZE_MAX with compat32 to avoid garbage return
values.

Fixes ATF lib/libc/sys/t_write:write_err.
 1.44.8.1 13-Nov-2018  snj Pull up following revision(s) (requested by maxv in ticket #1093):
sys/compat/netbsd32/netbsd32_socket.c: 1.48
Fix inverted logic, which leads to buffer overflow. Detected by kASan.
 1.47.2.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.47.2.1 10-Jun-2019  christos Sync with HEAD
 1.49.4.1 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1489):

sys/compat/netbsd32/netbsd32_netbsd.c: revision 1.232
sys/compat/netbsd32/netbsd32_socket.c: revision 1.56
sys/compat/netbsd32/netbsd32_conv.h: revision 1.45
sys/compat/netbsd32/netbsd32_fs.c: revision 1.92
sys/compat/netbsd32/netbsd32.h: revision 1.137

The read/write/send/recv system calls return ssize_t because -1 is
returned on error. Therefore we must restrict the lengths of any
buffers to NETBSD32_SSIZE_MAX with compat32 to avoid garbage return
values.

Fixes ATF lib/libc/sys/t_write:write_err.
 1.53.8.1 03-Apr-2021  thorpej Sync with HEAD.
 1.163 09-May-2025  martin PR 59352: netbsd32 compat for semtimedop(2): regen
 1.162 20-May-2024  christos branches: 1.162.2;
regen
 1.161 19-May-2024  christos regen
 1.160 30-Jul-2023  rin COMPAT_NETBSD32: Regen for syscalls.master,v 1.144
 1.159 30-Jul-2023  rin COMPANT_NETBSD32: Regen for syscalls.master,v 1.143
 1.158 29-Jul-2023  rin COMPAT_NETBSD32: Regen for syscalls.master,v 1.142
 1.157 20-Sep-2021  thorpej Regen for eventfd(2).
 1.156 20-Sep-2021  thorpej Regen for timerfd.
 1.155 10-Oct-2020  rin regen for getrandom(2)
 1.154 16-May-2020  christos Add ACL support for FFS. From FreeBSD.
 1.153 26-Apr-2020  thorpej Regen for native futex calls.
 1.152 22-Apr-2020  thorpej Regen for removal of _lwp_gettid(2).
 1.151 04-Apr-2020  thorpej branches: 1.151.2;
Regen for _lwp_gettid(2).
 1.150 12-Mar-2020  pgoyette regen
 1.149 07-Mar-2020  pgoyette Regen
 1.148 18-Jan-2020  pgoyette Regen generated files _after_ committing changes to the source file.

This gets the "Generated from" comments to use the new version number.

No functional change.
 1.147 18-Jan-2020  kamil Catch up after getpid/getgid/getuid changes in native ABI in 2008

getpid(), getuid() and getgid() used to call respectively sys_getpid(),
sys_getuid() and sys_getgid(). In the BSD4.3 compat mode there was a
fallback to call sys_getpid_with_ppid() and related functions.

In 2008 the compat ifdef was removed in sys/kern/syscalls.master r. 1.216.

For purity reasons we probably shall restore the NetBSD original behavior
and implement BSD4.3 one as a compat module, however it is not worth the
complexity.

Align the netbsd32 compat ABI to native ABI and call functions that return
two integers as in BSD4.3.
 1.146 04-Nov-2019  rin branches: 1.146.2;
regen
 1.145 04-Nov-2019  rin regen
 1.144 13-Oct-2019  christos regen
 1.143 22-Sep-2019  christos regen
 1.142 18-Jun-2019  christos branches: 1.142.2;
Regen
 1.141 18-Jun-2019  christos regen
 1.140 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.139 24-Dec-2018  mrg regen.
 1.138 10-Aug-2018  pgoyette Regen
 1.137 31-Jul-2018  rjs regen.
 1.136 12-Jul-2018  maxv Remove the kernel PMC code. Sent yesterday on tech-kern@.

This change:

* Removes "options PERFCTRS", the associated includes, and the associated
ifdefs. In doing so, it removes several XXXSMPs in the MI code, which is
good.

* Removes the PMC code of ARM XSCALE.

* Removes all the pmc.h files. They were all empty, except for ARM XSCALE.

* Reorders the x86 PMC code not to rely on the legacy pmc.h file. The
definitions are put in sysarch.h.

* Removes the kern/sys_pmc.c file, and along with it, the sys_pmc_control
and sys_pmc_get_info syscalls. They are marked as OBSOL in kern,
netbsd32 and rump.

* Removes the pmc_evid_t and pmc_ctr_t types.

* Removes all the associated man pages. The sets are marked as obsolete.
 1.135 10-May-2018  christos branches: 1.135.2;
regen
 1.134 06-Jan-2018  kamil branches: 1.134.2;
Revert vadvise(2) removal

This system call was used in legacy Lisp code, that was inherited to modern
age and still compiled against supported compat layers (e.g. in clisp,
oaklisp, Franz Lisp).

It used to instruct the kernel about paging policy (G/C aware, flush etc).

Newly compiled code (assuming that it will detect vadvise()) will use the
libc stub for vadvise(). The headers for this interface are gone.

vadvise(2) could be marked as COMPAT_80, but as long as we support ultrix,
sunos or aout68k ABI, don't bother with this.

Requested by <mrg>
 1.133 19-Dec-2017  kamil Drop SYS_vadvise

The (o)vadvise syscall is dummy since the beginning of NetBSD.

It is an obsolete remnant from the old UNIX.

Sponsored by <The NetBSD Foundation>
 1.132 19-Dec-2017  kamil Drop SYS_sbrk

sbrk - change data segment size

This syscall is dummy since the inception of the project.

Sponsored by <The NetBSD Foundation>
 1.131 19-Dec-2017  kamil Drop the sstk(2) syscall stub

sstk - change stack section size

This functionality has never been implemented and is a remnant from 16-bit
UNIX. This stub appeared with the first NetBSD commit.

Sponsored by <The NetBSD Foundation>
 1.130 19-Dec-2017  kamil Sync syscalls.master in compat_netbsd32(8) with kern/syscalls.master

___lwp_part60 removed 'const' from the ts argument.

'const struct timespec *ts' -> 'struct timespec *ts'

Sponsored by <The NetBSD Foundation>
 1.129 10-May-2017  riastradh branches: 1.129.2;
regen
 1.128 16-Jan-2017  christos branches: 1.128.4;
regen
 1.127 13-Jan-2017  christos branches: 1.127.2;
regen
 1.126 28-Oct-2016  christos regen
 1.125 19-Oct-2016  skrll Regen
 1.124 23-Sep-2016  skrll regen
 1.123 10-Sep-2016  skrll Regen
 1.122 03-Dec-2015  pgoyette branches: 1.122.2;
Regen syscall definitions - the compat_netbsd32 sysv-ipc stuff is now
modular and can be autoloaded when needed
 1.121 01-Dec-2015  pgoyette Regen for new compat_netbsd32_mqueue module
 1.120 01-Dec-2015  pgoyette Regen.
 1.119 01-Dec-2015  pgoyette Regen
 1.118 24-Sep-2015  christos regen
 1.117 23-Jun-2015  dholland regen
 1.116 22-Jun-2015  mrg add netbsd32 support for nfssvc(2). we do this by defining 5 copyin/out
functions that do all the ugly work, are just plain copyin/out for the
native system calls, and do the necessary translations for netbsd32.

with this i'm able to run 32 bit nfsd and mountd on 64 bit kernel and
mount the file systems remotely.
 1.115 21-Jun-2015  martin Regen (pset_*)
 1.114 21-Jun-2015  martin regen (versioned mq_* calls)
 1.113 20-Jun-2015  martin Regen (sigqueinfo, modctl, mq_*)
 1.112 16-Jun-2015  martin Regen for posix_fallocate and fdiscard
 1.111 07-Mar-2015  christos regen
 1.110 25-Feb-2015  christos regen
 1.109 13-Jun-2014  joerg branches: 1.109.2; 1.109.4;
Regnerate
 1.108 15-May-2014  njoly Regen for setcontext signature.
 1.107 30-Apr-2014  njoly Regen for netbsd32_off_t.
 1.106 17-Oct-2013  njoly branches: 1.106.2;
Regen for mknodat(2) device argument type change.
 1.105 29-Mar-2013  christos branches: 1.105.4;
regen
 1.104 02-Oct-2012  christos regen
 1.103 08-Apr-2012  martin branches: 1.103.2;
Regen (posix_spawn)
 1.102 10-Mar-2012  joerg P1003_1B_SEMAPHORE is no longer optional.
 1.101 08-Mar-2012  joerg Implement sem_timedwait.
 1.100 19-Feb-2012  rmind Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.
 1.99 01-Feb-2012  dholland branches: 1.99.2;
Regen syscalls with proper id info.
 1.98 01-Feb-2012  dholland Update compat_netbsd32 for new quotactl.
 1.97 31-Jan-2012  matt Regen.
 1.96 08-Nov-2011  njoly branches: 1.96.4;
Regen for kqueue1.
 1.95 31-Aug-2011  njoly branches: 1.95.2;
Regen for dup3.
 1.94 05-Jul-2011  njoly Regen for pipe2.
 1.93 06-Mar-2011  bouyer merge the bouyer-quota2 branch. This adds a new on-disk format
to store disk quota usage and limits, integrated with ffs
metadata. Usage is checked by fsck_ffs (no more quotacheck)
and is covered by the WAPBL journal. Enabled with kernel
option QUOTA2 (added where QUOTA was enabled in kernel config files),
turned on with tunefs(8) on a per-filesystem
basis. mount_mfs(8) can also turn quotas on.

See http://mail-index.netbsd.org/tech-kern/2011/02/19/msg010025.html
for details.
 1.92 02-Mar-2010  pooka branches: 1.92.2; 1.92.4; 1.92.6;
regen:
- remove nfssvc / fs_nfs.h / #ifdef NFS
- make getfh unconditional
 1.91 02-Mar-2010  pooka regen for conditional lfs syscall removal
 1.90 14-Dec-2009  matt branches: 1.90.2;
Regen (new makesyscalls.sh)
 1.89 14-Dec-2009  matt Merge from matt-nb5-mips64
 1.88 17-May-2009  pooka regen: pad -> PAD
 1.87 16-Mar-2009  njoly Regen for netbsd32_dev_t.
 1.86 26-Feb-2009  christos Regen
 1.85 13-Jan-2009  pooka branches: 1.85.2;
Regen to prove I didn't screw up the conversion: purely RCSID changes.
 1.84 13-Jan-2009  pooka regen: UNIMPL police
 1.83 11-Jan-2009  christos merge christos-time_t
 1.82 22-Nov-2008  mrg branches: 1.82.4;
regenerate
 1.81 19-Nov-2008  ad Regen.
 1.80 14-Nov-2008  ad Regen.
 1.79 12-Nov-2008  ad Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.
 1.78 15-Oct-2008  wrstuden branches: 1.78.2; 1.78.4;
Merge wrstuden-revivesa into HEAD.
 1.77 24-Apr-2008  ad branches: 1.77.2; 1.77.4; 1.77.8;
Regen.
 1.76 24-Feb-2008  martin branches: 1.76.2;
Regen (old posix_fadvise ignored)
 1.75 27-Jan-2008  martin branches: 1.75.2; 1.75.6;
Regen (posix_fadvise versionend)
 1.74 26-Jan-2008  dsl regen
 1.73 19-Jan-2008  dsl Regen for netbsd32_mremap
 1.72 20-Dec-2007  dsl regen
 1.71 17-Dec-2007  dsl Regen without any 'const' members of the syscall argument structures.
 1.70 07-Dec-2007  ad branches: 1.70.4;
Reg... hang on, why don't we build this at compile time?!?
 1.69 09-Nov-2007  dsl branches: 1.69.2;
Regen
 1.68 15-Aug-2007  ad branches: 1.68.2; 1.68.6; 1.68.8;
Regen.
 1.67 07-Aug-2007  ad Regen.
 1.66 04-Mar-2007  christos branches: 1.66.2; 1.66.6; 1.66.10; 1.66.14;
fix fallout from caddr_t changes.
 1.65 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.64 19-Feb-2007  cube Regen (a few MPSAFE additions).
 1.63 18-Feb-2007  cube Regen (missing lwp syscalls).
 1.62 09-Feb-2007  ad branches: 1.62.2;
Merge newlock2 to head.
 1.61 09-Nov-2006  cube Regen (PR#34951 fixes).
 1.60 01-Sep-2006  matt branches: 1.60.2; 1.60.4;
Regen.
 1.59 30-Aug-2006  cube Regen (netbsd32_ptrace protection).
 1.58 31-Jul-2006  martin Make filehandles opaque to userland
 1.57 13-Jul-2006  pavel regen.
 1.56 13-Jul-2006  martin regen
 1.55 13-Jul-2006  martin Fix alignement problems for fhandle_t, exposed by gcc4.1.

While touching all vptofh/fhtovp functions, get rid of VFS_MAXFIDSIZ,
version the getfh(2) syscall and explicitly pass the size available in
the filehandle from userland.

Discussed on tech-kern, with lots of help from yamt (thanks!).
 1.54 26-Jun-2006  mrg regenerate.
 1.53 31-May-2006  drochner branches: 1.53.2;
regen
 1.52 29-May-2006  drochner regen
 1.51 05-May-2006  cube branches: 1.51.2;
Regen (fhstat versioning, posix_fadvise).
 1.50 29-Mar-2006  cube Regen (_lwp*, sa_*).
 1.49 06-Mar-2006  cube branches: 1.49.2; 1.49.4;
Regen (SysV IPC).
 1.48 05-Mar-2006  cube branches: 1.48.2;
Regen (ksem_*).
 1.47 11-Dec-2005  christos branches: 1.47.4; 1.47.6;
merge ktrace-lwp.
 1.46 23-Oct-2005  cube Regen (kqueue, kevent).
 1.45 19-Aug-2005  christos branches: 1.45.2;
Fix lossage I created with the 64 bit ino_t change.
 1.44 23-Jul-2005  cube Regen (__sigtimedwait(2)).
 1.43 23-Jul-2005  cube Regen (timer_create(2) and friends).
 1.42 12-Jul-2005  cube Regen (*xattr(2)).
 1.41 11-Jul-2005  cube Regen (rasctl(2)).
 1.40 10-Jul-2005  cube Regen.
 1.39 10-Jul-2005  cube Regen.
 1.38 09-Jul-2005  cube Regen.
 1.37 08-Jul-2005  cube Regen.
 1.36 08-Jul-2005  cube Regen
 1.35 04-Jul-2005  cube branches: 1.35.2;
Regen
 1.34 30-May-2005  chs regen
 1.33 26-Feb-2005  perry regen
 1.32 17-Jun-2004  cube branches: 1.32.4; 1.32.6;
Regen.
 1.31 25-Oct-2003  chs regen
 1.30 13-Oct-2003  fvdl Regenerate.
 1.29 18-Jan-2003  thorpej branches: 1.29.2;
Regen for correct RCS ID.
 1.28 18-Jan-2003  thorpej Regen: Merge the nathanw_sa branch.
 1.27 01-Nov-2002  jdolecek set nsysent to 512
 1.26 23-Oct-2002  scw Regen to pick up netbsd32___sigaction_sigtramp addition.
 1.25 29-Apr-2002  mrg regenerate.
 1.24 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.23 30-May-2001  mrg branches: 1.23.2;
use _KERNEL_OPT.
 1.22 10-Apr-2001  kleink Regen.
 1.21 02-Feb-2001  mrg branches: 1.21.2;
regen
 1.20 27-Jan-2001  thorpej Regen; getpid(2) is MP-safe.
 1.19 27-Jan-2001  thorpej Regen; add sy_flags.
 1.18 09-Dec-2000  mycroft Regen.
 1.17 30-Nov-2000  jdolecek always include netbsd32_ntp_adjtime(), LKMify
 1.16 18-Aug-2000  cgd update for changed makesyscalls.master
 1.15 07-Aug-2000  bjh21 Second phase of changes to remove ntp_adjtime(2) from the kernel entirely if
NTP is not defined.

Also removes sysctl_ntptime, since that's unreferenced without NTP.

ntp_gettime(2) is left alone, since it doesn't raise SIGSYS, which sys_nosys()
does.
 1.14 09-Jul-2000  mrg regen
 1.13 31-Jan-2000  christos Regen
 1.12 30-Dec-1999  eeh Update to 32-bit compatibility routines.
 1.11 11-Oct-1999  eeh branches: 1.11.2;
Add netbsd32_compat_14.c

Rename everything from compat_netbsd32 -> netbsd32 so we don't have silly
names like compat_14_compat_netbsd32_sys_shmctl().
 1.10 09-Jun-1999  christos branches: 1.10.2;
Regen
 1.9 25-Mar-1999  mrg branches: 1.9.4;
regen
 1.8 25-Mar-1999  mrg move sparc32 to netbsd32; split out MD part (signal handling) (mostly via repository copy, rename and perl -pi :-)
 1.7 25-Mar-1999  mrg regen
 1.6 10-Dec-1998  christos Regen
 1.5 19-Oct-1998  tron Regen.
 1.4 01-Oct-1998  eeh Overhaul. Now will run simple things like /bin/sh and /bin/echo.
 1.3 26-Aug-1998  mrg regen.
 1.2 26-Aug-1998  mrg regen
 1.1 26-Aug-1998  mrg add a 32-bit compatibility module for the sparc64 port, so it can run NetBSD/sparc binaries with a LP64 kernel.
 1.9.4.2 02-Aug-1999  thorpej Regen.
 1.9.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.10.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.11.2.5 21-Apr-2001  bouyer Sync with HEAD
 1.11.2.4 11-Feb-2001  bouyer Sync with HEAD.
 1.11.2.3 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.11.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.11.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.21.2.5 11-Nov-2002  nathanw Catch up to -current
 1.21.2.4 20-Jun-2002  nathanw Catch up to -current.
 1.21.2.3 29-May-2002  nathanw Regen.
 1.21.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.21.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.23.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.23.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.29.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.29.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.29.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.29.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.29.2.1 03-Aug-2004  skrll Sync with HEAD
 1.32.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.32.4.1 29-Apr-2005  kent sync with -current
 1.35.2.8 27-Feb-2008  yamt sync with head.
 1.35.2.7 04-Feb-2008  yamt sync with head.
 1.35.2.6 21-Jan-2008  yamt sync with head
 1.35.2.5 15-Nov-2007  yamt sync with head.
 1.35.2.4 03-Sep-2007  yamt sync with head.
 1.35.2.3 26-Feb-2007  yamt sync with head.
 1.35.2.2 30-Dec-2006  yamt sync with head.
 1.35.2.1 21-Jun-2006  yamt sync with head.
 1.45.2.1 26-Oct-2005  yamt sync with head
 1.47.6.2 01-Jun-2006  kardel Sync with head.
 1.47.6.1 22-Apr-2006  simonb Sync with head.
 1.47.4.1 09-Sep-2006  rpaulo sync with head
 1.48.2.7 03-Sep-2006  yamt sync with head.
 1.48.2.6 11-Aug-2006  yamt sync with head
 1.48.2.5 26-Jun-2006  yamt sync with head.
 1.48.2.4 24-May-2006  yamt sync with head.
 1.48.2.3 01-Apr-2006  yamt sync with head.
 1.48.2.2 13-Mar-2006  yamt sync with head.
 1.48.2.1 05-Mar-2006  yamt file netbsd32_syscall.h was added on branch yamt-pdpolicy on 2006-03-13 09:07:08 +0000
 1.49.4.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.49.4.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.49.2.2 11-May-2006  elad sync with head
 1.49.2.1 19-Apr-2006  elad sync with head.
 1.51.2.1 19-Jun-2006  chap Sync with head.
 1.53.2.1 13-Jul-2006  gdamore Merge from HEAD.
 1.60.4.1 10-Dec-2006  yamt sync with head.
 1.60.2.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.60.2.1 18-Nov-2006  ad Sync with head.
 1.62.2.2 12-Mar-2007  rmind Sync with HEAD.
 1.62.2.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.66.14.4 09-Dec-2007  jmcneill Sync with HEAD.
 1.66.14.3 11-Nov-2007  joerg Sync with HEAD.
 1.66.14.2 16-Aug-2007  jmcneill Sync with HEAD.
 1.66.14.1 09-Aug-2007  jmcneill Sync with HEAD.
 1.66.10.2 03-Sep-2007  skrll Sync with HEAD.
 1.66.10.1 15-Aug-2007  skrll Sync with HEAD.
 1.66.6.1 09-Dec-2007  reinoud Pullup to HEAD
 1.66.2.1 20-Aug-2007  ad Sync with HEAD.
 1.68.8.4 18-Feb-2008  mjf Sync with HEAD.
 1.68.8.3 27-Dec-2007  mjf Sync with HEAD.
 1.68.8.2 08-Dec-2007  mjf Sync with HEAD.
 1.68.8.1 19-Nov-2007  mjf Sync with HEAD.
 1.68.6.1 13-Nov-2007  bouyer Sync with HEAD
 1.68.2.2 23-Mar-2008  matt sync with HEAD
 1.68.2.1 09-Jan-2008  matt sync with HEAD
 1.69.2.2 26-Dec-2007  ad Sync with head.
 1.69.2.1 08-Dec-2007  ad Sync with head.
 1.70.4.2 20-Jan-2008  bouyer Sync with HEAD
 1.70.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.75.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.75.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.75.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.75.2.1 24-Mar-2008  keiichi sync with head.
 1.76.2.1 18-May-2008  yamt sync with head.
 1.77.8.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.77.8.1 19-Oct-2008  haad Sync with HEAD.
 1.77.4.2 28-Sep-2008  skrll Regen.
 1.77.4.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.77.2.3 11-Mar-2010  yamt sync with head
 1.77.2.2 20-Jun-2009  yamt sync with head
 1.77.2.1 04-May-2009  yamt sync with head.
 1.78.4.1 25-Nov-2008  snj branches: 1.78.4.1.4;
Regen for ticket 121.
 1.78.4.1.4.1 12-Sep-2009  matt Regen.
 1.78.2.3 28-Apr-2009  skrll Sync with HEAD.
 1.78.2.2 03-Mar-2009  skrll Sync with HEAD.
 1.78.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.82.4.3 04-Jan-2009  christos fix module build.
 1.82.4.2 04-Jan-2009  christos add new syscalls.
 1.82.4.1 22-Nov-2008  christos file netbsd32_syscall.h was added on branch christos-time_t on 2009-01-04 01:56:02 +0000
 1.85.2.2 23-Jul-2009  jym Sync with HEAD.
 1.85.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.90.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.92.6.2 09-Feb-2011  bouyer Regen
 1.92.6.1 20-Jan-2011  bouyer Snapshot of work in progress on a modernised disk quota system:
- new quotactl syscall (versionned for backward compat), which takes
as parameter a path to a mount point, and a prop_dictionary
(in plistref format) describing commands and arguments.
For each command, status and data are returned as a prop_dictionary.
quota commands features will be added to take advantage of this,
exporting quota data or getting quota commands as plists.

- new on disk-format storage (all 64bit wide), integrated to metadata for
ffs (and playing nicely with wapbl).
Quotas are enabled on a ffs filesystem via superblock flags.
tunefs(8) can enable or disable quotas.
On a quota-enabled filesystem, fsck_ffs(8) will track per-uid/gid
block and inode usages, and will check and update quotas in Pass 6.
quota usage and limits are stored in unliked files (one for users,
one for groups)l fsck_ffs(8) will create the files if needed, or
free them if needed. This means that after enabling or disabling
quotas on a filesystem; a fsck_ffs(8) run is required.
quotacheck(8) is not needed any more, on a unclean shutdown
fsck or journal replay will take care of fixing quotas.
newfs(8) can create a ready-to-mount quota-enabled filesystem
(superblock flags are set and quota inodes are created).
Other new features or semantic changes:
- default quota datas, applied to users or groups which don't already
have a quota entry
- per-user/group grace time (instead of a filesystem global one)
- 0 really means "nothing allowed at all", not "no limit".
If you want "no limit", set the limit to UQUAD_MAX (tools will
understand "unlimited" and "-")

A quota file is structured as follow:
it starts with a header, containing a few per-filesystem values,
and the default quota limits.
Quota entries are linked together as a simple list, each entry has a
pointer (as an offset withing the file) to the next.
The header has a pointer to a list of free quota entries, and
a hash table of in-use entries. The size of the hash table depends
on the filesystem block size (header+hash table should fit in the
first block). The file is not sparse and is a multiple of
filesystem block size (when the free quota entry list is empty a new
filesystem block is allocated). quota entries to not cross
filesystem block boundaries.

In memory, the kernel keeps a cache of recently used quota entries
as a reference to the block number, and offset withing the block.
The quota entry itself is keept in the buf cache.

fsck_ffs(8), tunefs(8) and newfs(8) supports are completed (with
related atf tests :)
The kernel can update disk usage and report it via quotactl(2).

Todo: enforce quotas limits (limits are not checked by kernel yet)
update repquota, edquota and rpc.rquotad to the new world
implement compat_50_quotactl ioctl.
update quotactl(2) man page

fsck_ffs required fixes so that allocating new blocks or inodes will
properly update the superblock and cg sumaries. This was not an issue up
to now because superblock and cg sumaries check happened last, but now
allocations or frees can happen in pass 6.
 1.92.4.1 06-Jun-2011  jruoho Sync with HEAD.
 1.92.2.1 21-Apr-2011  rmind sync with head
 1.95.2.4 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.95.2.3 30-Oct-2012  yamt sync with head
 1.95.2.2 17-Apr-2012  yamt sync with head
 1.95.2.1 10-Nov-2011  yamt sync with head
 1.96.4.4 29-Apr-2012  mrg sync to latest -current.
 1.96.4.3 11-Mar-2012  mrg sync to latest -current
 1.96.4.2 24-Feb-2012  mrg sync to -current.
 1.96.4.1 18-Feb-2012  mrg merge to -current.
 1.99.2.2 14-Apr-2015  msaitoh Pull up following revision(s) (requested by khorben in ticket #1264):

include/unistd.h 1.144
sys/kern/init_sysent.c regen
sys/kern/syscalls.c regen
sys/kern/syscalls.master 1.272
sys/rump/include/rump/rump_syscalls.h regen
sys/rump/librump/rumpkern/rump_syscalls.c regen
sys/sys/syscall.h regen
sys/sys/syscallargs.h regen
sys/compat/netbds32/netbsd32_syscall.h regen
sys/compat/netbds32/netbsd32_syscallargs.h regen
sys/compat/netbds32/netbsd32_syscalls.c regen
sys/compat/netbds32/netbsd32_sysent.c regen
sys/compat/netbsd32/syscalls.master 1.102

Fix return type of the readlinkat(2) syscall. PR#49684.
 1.99.2.1 12-Apr-2012  riz Regen for ticket 175.
 1.103.2.4 03-Dec-2017  jdolecek update from HEAD
 1.103.2.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.103.2.2 23-Jun-2013  tls resync from head
 1.103.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.105.4.1 18-May-2014  rmind sync with head
 1.106.2.1 10-Aug-2014  tls Rebase.
 1.109.4.5 05-Dec-2016  skrll Sync with HEAD
 1.109.4.4 05-Oct-2016  skrll Sync with HEAD
 1.109.4.3 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.109.4.2 22-Sep-2015  skrll Sync with HEAD
 1.109.4.1 06-Apr-2015  skrll Sync with HEAD
 1.109.2.4 04-Nov-2019  martin Regen for ticket #1711
 1.109.2.3 06-Nov-2015  martin regen
 1.109.2.2 04-Nov-2015  riz Pull up following revision(s) (requested by mrg in ticket #956):
sys/compat/netbsd32/files.netbsd32: revision 1.36
sys/compat/netbsd32/netbsd32_sysent.c: revision 1.115
sys/compat/netbsd32/netbsd32_syscallargs.h: revision 1.116
sys/nfs/nfs_var.h: revision 1.93
sys/compat/netbsd32/netbsd32_conv.h: revision 1.30
sys/compat/netbsd32/netbsd32_syscall.h: revision 1.116
sys/compat/netbsd32/netbsd32_syscalls.c: revision 1.115
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.1
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.3
sys/nfs/nfs_syscalls.c: revision 1.156
sys/compat/netbsd32/syscalls.master: revision 1.108
sys/compat/netbsd32/netbsd32.h: revision 1.107
add netbsd32 support for nfssvc(2). we do this by defining 5 copyin/out
functions that do all the ugly work, are just plain copyin/out for the
native system calls, and do the necessary translations for netbsd32.
with this i'm able to run 32 bit nfsd and mountd on 64 bit kernel and
mount the file systems remotely.
don't copy the first netbsd32_export_args nexports times, but actually
advance the userland pointer each entry through the loop. oops.
 1.109.2.1 07-Mar-2015  snj regen for ticket 560
 1.122.2.2 20-Mar-2017  pgoyette Sync with HEAD
 1.122.2.1 04-Nov-2016  pgoyette Sync with HEAD
 1.127.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.128.4.1 11-May-2017  pgoyette Sync with HEAD
 1.129.2.1 04-Nov-2019  martin Regen for ticket #398
 1.134.2.18 09-Jan-2019  pgoyette Regen - otherwise compat_40_mount() is wrongly included in sysent.c

Missed this during earlier conflict resolution.
 1.134.2.17 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.134.2.16 29-Sep-2018  pgoyette Regen
 1.134.2.15 29-Sep-2018  pgoyette Regen
 1.134.2.14 14-Sep-2018  pgoyette Regen
 1.134.2.13 14-Sep-2018  pgoyette Regen
 1.134.2.12 13-Sep-2018  pgoyette Regen
 1.134.2.11 12-Sep-2018  pgoyette Regen
 1.134.2.10 12-Sep-2018  pgoyette Regen
 1.134.2.9 12-Sep-2018  pgoyette regen
 1.134.2.8 12-Sep-2018  pgoyette Regen with updated module information for ntp 30 and 50 compat calls
 1.134.2.7 11-Sep-2018  pgoyette Regen
 1.134.2.6 11-Sep-2018  pgoyette And regen again
 1.134.2.5 11-Sep-2018  pgoyette Regen
 1.134.2.4 11-Sep-2018  pgoyette Regen syscall files and fix includes for syscallvar.h
 1.134.2.3 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.134.2.2 28-Jul-2018  pgoyette Sync with HEAD
 1.134.2.1 21-May-2018  pgoyette Sync with HEAD
 1.135.2.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.135.2.1 10-Jun-2019  christos Sync with HEAD
 1.142.2.2 08-Mar-2020  martin Regen (for ticket #761)
 1.142.2.1 04-Nov-2019  martin Regen for ticket #398
 1.146.2.1 25-Jan-2020  ad Sync with head.
 1.151.2.1 25-Apr-2020  bouyer Sync with bouyer-xenpvh-base2 (HEAD)
 1.162.2.1 02-Aug-2025  perseant Sync with HEAD
 1.162 09-May-2025  martin PR 59352: netbsd32 compat for semtimedop(2): regen
 1.161 20-May-2024  christos branches: 1.161.2;
regen
 1.160 19-May-2024  christos regen
 1.159 30-Jul-2023  rin COMPAT_NETBSD32: Regen for syscalls.master,v 1.144
 1.158 30-Jul-2023  rin COMPANT_NETBSD32: Regen for syscalls.master,v 1.143
 1.157 29-Jul-2023  rin COMPAT_NETBSD32: Regen for syscalls.master,v 1.142
 1.156 20-Sep-2021  thorpej Regen for eventfd(2).
 1.155 20-Sep-2021  thorpej Regen for timerfd.
 1.154 10-Oct-2020  rin regen for getrandom(2)
 1.153 16-May-2020  christos Add ACL support for FFS. From FreeBSD.
 1.152 26-Apr-2020  thorpej Regen for native futex calls.
 1.151 22-Apr-2020  thorpej Regen for removal of _lwp_gettid(2).
 1.150 04-Apr-2020  thorpej branches: 1.150.2;
Regen for _lwp_gettid(2).
 1.149 12-Mar-2020  pgoyette regen
 1.148 07-Mar-2020  pgoyette Regen
 1.147 18-Jan-2020  pgoyette Regen generated files _after_ committing changes to the source file.

This gets the "Generated from" comments to use the new version number.

No functional change.
 1.146 18-Jan-2020  kamil Catch up after getpid/getgid/getuid changes in native ABI in 2008

getpid(), getuid() and getgid() used to call respectively sys_getpid(),
sys_getuid() and sys_getgid(). In the BSD4.3 compat mode there was a
fallback to call sys_getpid_with_ppid() and related functions.

In 2008 the compat ifdef was removed in sys/kern/syscalls.master r. 1.216.

For purity reasons we probably shall restore the NetBSD original behavior
and implement BSD4.3 one as a compat module, however it is not worth the
complexity.

Align the netbsd32 compat ABI to native ABI and call functions that return
two integers as in BSD4.3.
 1.145 04-Nov-2019  rin branches: 1.145.2;
regen
 1.144 04-Nov-2019  rin regen
 1.143 13-Oct-2019  christos regen
 1.142 22-Sep-2019  christos regen
 1.141 18-Jun-2019  christos branches: 1.141.2;
Regen
 1.140 18-Jun-2019  christos regen
 1.139 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.138 24-Dec-2018  mrg regen.
 1.137 10-Aug-2018  pgoyette Regen
 1.136 31-Jul-2018  rjs regen.
 1.135 10-May-2018  christos branches: 1.135.2;
regen
 1.134 06-Jan-2018  kamil branches: 1.134.2;
Revert vadvise(2) removal

This system call was used in legacy Lisp code, that was inherited to modern
age and still compiled against supported compat layers (e.g. in clisp,
oaklisp, Franz Lisp).

It used to instruct the kernel about paging policy (G/C aware, flush etc).

Newly compiled code (assuming that it will detect vadvise()) will use the
libc stub for vadvise(). The headers for this interface are gone.

vadvise(2) could be marked as COMPAT_80, but as long as we support ultrix,
sunos or aout68k ABI, don't bother with this.

Requested by <mrg>
 1.133 19-Dec-2017  kamil Drop SYS_vadvise

The (o)vadvise syscall is dummy since the beginning of NetBSD.

It is an obsolete remnant from the old UNIX.

Sponsored by <The NetBSD Foundation>
 1.132 19-Dec-2017  kamil Drop SYS_sbrk

sbrk - change data segment size

This syscall is dummy since the inception of the project.

Sponsored by <The NetBSD Foundation>
 1.131 19-Dec-2017  kamil Drop the sstk(2) syscall stub

sstk - change stack section size

This functionality has never been implemented and is a remnant from 16-bit
UNIX. This stub appeared with the first NetBSD commit.

Sponsored by <The NetBSD Foundation>
 1.130 19-Dec-2017  kamil Sync syscalls.master in compat_netbsd32(8) with kern/syscalls.master

___lwp_part60 removed 'const' from the ts argument.

'const struct timespec *ts' -> 'struct timespec *ts'

Sponsored by <The NetBSD Foundation>
 1.129 10-May-2017  riastradh branches: 1.129.2;
regen
 1.128 16-Jan-2017  christos branches: 1.128.4;
regen
 1.127 13-Jan-2017  christos branches: 1.127.2;
regen
 1.126 28-Oct-2016  christos regen
 1.125 19-Oct-2016  skrll Regen
 1.124 23-Sep-2016  skrll regen
 1.123 10-Sep-2016  skrll Regen
 1.122 03-Dec-2015  pgoyette branches: 1.122.2;
Regen syscall definitions - the compat_netbsd32 sysv-ipc stuff is now
modular and can be autoloaded when needed
 1.121 01-Dec-2015  pgoyette Regen for new compat_netbsd32_mqueue module
 1.120 01-Dec-2015  pgoyette Regen.
 1.119 01-Dec-2015  pgoyette Regen
 1.118 24-Sep-2015  christos regen
 1.117 23-Jun-2015  dholland regen
 1.116 22-Jun-2015  mrg add netbsd32 support for nfssvc(2). we do this by defining 5 copyin/out
functions that do all the ugly work, are just plain copyin/out for the
native system calls, and do the necessary translations for netbsd32.

with this i'm able to run 32 bit nfsd and mountd on 64 bit kernel and
mount the file systems remotely.
 1.115 21-Jun-2015  martin Regen (pset_*)
 1.114 21-Jun-2015  martin regen (versioned mq_* calls)
 1.113 20-Jun-2015  martin Regen (sigqueinfo, modctl, mq_*)
 1.112 16-Jun-2015  martin Regen for posix_fallocate and fdiscard
 1.111 07-Mar-2015  christos regen
 1.110 25-Feb-2015  christos regen
 1.109 13-Jun-2014  joerg branches: 1.109.2; 1.109.4;
Regnerate
 1.108 15-May-2014  njoly Regen for setcontext signature.
 1.107 30-Apr-2014  njoly Regen for netbsd32_off_t.
 1.106 17-Oct-2013  njoly branches: 1.106.2;
Regen for mknodat(2) device argument type change.
 1.105 29-Mar-2013  christos branches: 1.105.4;
regen
 1.104 02-Oct-2012  christos regen
 1.103 08-Apr-2012  martin branches: 1.103.2;
Regen (posix_spawn)
 1.102 10-Mar-2012  joerg P1003_1B_SEMAPHORE is no longer optional.
 1.101 08-Mar-2012  joerg Implement sem_timedwait.
 1.100 19-Feb-2012  rmind Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.
 1.99 01-Feb-2012  dholland branches: 1.99.2;
Regen syscalls with proper id info.
 1.98 01-Feb-2012  dholland Update compat_netbsd32 for new quotactl.
 1.97 31-Jan-2012  matt Regen.
 1.96 08-Nov-2011  njoly branches: 1.96.4;
Regen for kqueue1.
 1.95 31-Aug-2011  njoly branches: 1.95.2;
Regen for dup3.
 1.94 05-Jul-2011  njoly Regen for pipe2.
 1.93 06-Mar-2011  bouyer merge the bouyer-quota2 branch. This adds a new on-disk format
to store disk quota usage and limits, integrated with ffs
metadata. Usage is checked by fsck_ffs (no more quotacheck)
and is covered by the WAPBL journal. Enabled with kernel
option QUOTA2 (added where QUOTA was enabled in kernel config files),
turned on with tunefs(8) on a per-filesystem
basis. mount_mfs(8) can also turn quotas on.

See http://mail-index.netbsd.org/tech-kern/2011/02/19/msg010025.html
for details.
 1.92 02-Mar-2010  pooka branches: 1.92.2; 1.92.4; 1.92.6;
regen:
- remove nfssvc / fs_nfs.h / #ifdef NFS
- make getfh unconditional
 1.91 02-Mar-2010  pooka regen for conditional lfs syscall removal
 1.90 14-Dec-2009  matt branches: 1.90.2;
Regen (new makesyscalls.sh)
 1.89 14-Dec-2009  matt Merge from matt-nb5-mips64
 1.88 17-May-2009  pooka regen: pad -> PAD
 1.87 16-Mar-2009  njoly Regen for netbsd32_dev_t.
 1.86 26-Feb-2009  christos Regen
 1.85 13-Jan-2009  pooka branches: 1.85.2;
Regen to prove I didn't screw up the conversion: purely RCSID changes.
 1.84 13-Jan-2009  pooka regen: UNIMPL police
 1.83 11-Jan-2009  christos merge christos-time_t
 1.82 22-Nov-2008  mrg branches: 1.82.4;
regenerate
 1.81 19-Nov-2008  ad Regen.
 1.80 14-Nov-2008  ad Regen.
 1.79 12-Nov-2008  ad Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.
 1.78 15-Oct-2008  wrstuden branches: 1.78.2; 1.78.4;
Merge wrstuden-revivesa into HEAD.
 1.77 24-Apr-2008  ad branches: 1.77.2; 1.77.4; 1.77.8;
Regen.
 1.76 24-Feb-2008  martin branches: 1.76.2;
Regen (old posix_fadvise ignored)
 1.75 27-Jan-2008  martin branches: 1.75.2; 1.75.6;
Regen (posix_fadvise versionend)
 1.74 26-Jan-2008  dsl regen
 1.73 19-Jan-2008  dsl Regen for netbsd32_mremap
 1.72 20-Dec-2007  dsl regen
 1.71 17-Dec-2007  dsl Regen without any 'const' members of the syscall argument structures.
 1.70 07-Dec-2007  ad branches: 1.70.4;
Reg... hang on, why don't we build this at compile time?!?
 1.69 09-Nov-2007  dsl branches: 1.69.2;
Regen
 1.68 15-Aug-2007  ad branches: 1.68.2; 1.68.6; 1.68.8;
Regen.
 1.67 07-Aug-2007  ad Regen.
 1.66 04-Mar-2007  christos branches: 1.66.2; 1.66.6; 1.66.10; 1.66.14;
fix fallout from caddr_t changes.
 1.65 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.64 19-Feb-2007  cube Regen (a few MPSAFE additions).
 1.63 18-Feb-2007  cube Regen (missing lwp syscalls).
 1.62 09-Feb-2007  ad branches: 1.62.2;
Merge newlock2 to head.
 1.61 09-Nov-2006  cube Regen (PR#34951 fixes).
 1.60 01-Sep-2006  matt branches: 1.60.2; 1.60.4;
Regen.
 1.59 30-Aug-2006  cube Regen (netbsd32_ptrace protection).
 1.58 31-Jul-2006  martin Make filehandles opaque to userland
 1.57 13-Jul-2006  pavel regen.
 1.56 13-Jul-2006  martin regen
 1.55 13-Jul-2006  martin Fix alignement problems for fhandle_t, exposed by gcc4.1.

While touching all vptofh/fhtovp functions, get rid of VFS_MAXFIDSIZ,
version the getfh(2) syscall and explicitly pass the size available in
the filehandle from userland.

Discussed on tech-kern, with lots of help from yamt (thanks!).
 1.54 26-Jun-2006  mrg regenerate.
 1.53 31-May-2006  drochner branches: 1.53.2;
regen
 1.52 29-May-2006  drochner regen
 1.51 05-May-2006  cube branches: 1.51.2;
Regen (fhstat versioning, posix_fadvise).
 1.50 29-Mar-2006  cube Regen (_lwp*, sa_*).
 1.49 06-Mar-2006  cube branches: 1.49.2; 1.49.4;
Regen (SysV IPC).
 1.48 05-Mar-2006  cube branches: 1.48.2;
Regen (ksem_*).
 1.47 11-Dec-2005  christos branches: 1.47.4; 1.47.6;
merge ktrace-lwp.
 1.46 23-Oct-2005  cube Regen (kqueue, kevent).
 1.45 19-Aug-2005  christos branches: 1.45.2;
Fix lossage I created with the 64 bit ino_t change.
 1.44 23-Jul-2005  cube Regen (__sigtimedwait(2)).
 1.43 23-Jul-2005  cube Regen (timer_create(2) and friends).
 1.42 12-Jul-2005  cube Regen (*xattr(2)).
 1.41 11-Jul-2005  cube Regen (rasctl(2)).
 1.40 10-Jul-2005  cube Regen.
 1.39 10-Jul-2005  cube Regen.
 1.38 09-Jul-2005  cube Regen.
 1.37 08-Jul-2005  cube Regen.
 1.36 08-Jul-2005  cube Regen
 1.35 04-Jul-2005  cube branches: 1.35.2;
Regen
 1.34 30-May-2005  chs regen
 1.33 26-Feb-2005  perry regen
 1.32 17-Jun-2004  cube branches: 1.32.4; 1.32.6;
Regen.
 1.31 25-Oct-2003  chs regen
 1.30 13-Oct-2003  fvdl Regenerate.
 1.29 18-Jan-2003  thorpej branches: 1.29.2;
Regen for correct RCS ID.
 1.28 18-Jan-2003  thorpej Regen: Merge the nathanw_sa branch.
 1.27 23-Oct-2002  scw Regen to pick up netbsd32___sigaction_sigtramp addition.
 1.26 29-Apr-2002  mrg regenerate.
 1.25 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.24 30-May-2001  mrg branches: 1.24.2;
use _KERNEL_OPT.
 1.23 10-Apr-2001  kleink Regen.
 1.22 02-Feb-2001  mrg branches: 1.22.2;
regen
 1.21 27-Jan-2001  thorpej Regen; getpid(2) is MP-safe.
 1.20 27-Jan-2001  thorpej Regen; add sy_flags.
 1.19 09-Dec-2000  mycroft Regen.
 1.18 30-Nov-2000  jdolecek always include netbsd32_ntp_adjtime(), LKMify
 1.17 18-Aug-2000  cgd update for changed makesyscalls.master
 1.16 18-Aug-2000  cgd update for changed makesyscalls.sh
 1.15 07-Aug-2000  bjh21 Second phase of changes to remove ntp_adjtime(2) from the kernel entirely if
NTP is not defined.

Also removes sysctl_ntptime, since that's unreferenced without NTP.

ntp_gettime(2) is left alone, since it doesn't raise SIGSYS, which sys_nosys()
does.
 1.14 09-Jul-2000  mrg regen
 1.13 31-Jan-2000  christos Regen
 1.12 30-Dec-1999  eeh Update to 32-bit compatibility routines.
 1.11 11-Oct-1999  eeh branches: 1.11.2;
Add netbsd32_compat_14.c

Rename everything from compat_netbsd32 -> netbsd32 so we don't have silly
names like compat_14_compat_netbsd32_sys_shmctl().
 1.10 09-Jun-1999  christos branches: 1.10.2;
Regen
 1.9 25-Mar-1999  mrg branches: 1.9.4;
regen
 1.8 25-Mar-1999  mrg move sparc32 to netbsd32; split out MD part (signal handling) (mostly via repository copy, rename and perl -pi :-)
 1.7 25-Mar-1999  mrg regen
 1.6 10-Dec-1998  christos Regen
 1.5 19-Oct-1998  tron Regen.
 1.4 01-Oct-1998  eeh Overhaul. Now will run simple things like /bin/sh and /bin/echo.
 1.3 26-Aug-1998  mrg regen.
 1.2 26-Aug-1998  mrg regen
 1.1 26-Aug-1998  mrg add a 32-bit compatibility module for the sparc64 port, so it can run NetBSD/sparc binaries with a LP64 kernel.
 1.9.4.2 02-Aug-1999  thorpej Regen.
 1.9.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.10.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.11.2.5 21-Apr-2001  bouyer Sync with HEAD
 1.11.2.4 11-Feb-2001  bouyer Sync with HEAD.
 1.11.2.3 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.11.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.11.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.22.2.5 11-Nov-2002  nathanw Catch up to -current
 1.22.2.4 20-Jun-2002  nathanw Catch up to -current.
 1.22.2.3 29-May-2002  nathanw Regen.
 1.22.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.22.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.24.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.24.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.29.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.29.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.29.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.29.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.29.2.1 03-Aug-2004  skrll Sync with HEAD
 1.32.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.32.4.1 29-Apr-2005  kent sync with -current
 1.35.2.8 27-Feb-2008  yamt sync with head.
 1.35.2.7 04-Feb-2008  yamt sync with head.
 1.35.2.6 21-Jan-2008  yamt sync with head
 1.35.2.5 15-Nov-2007  yamt sync with head.
 1.35.2.4 03-Sep-2007  yamt sync with head.
 1.35.2.3 26-Feb-2007  yamt sync with head.
 1.35.2.2 30-Dec-2006  yamt sync with head.
 1.35.2.1 21-Jun-2006  yamt sync with head.
 1.45.2.1 26-Oct-2005  yamt sync with head
 1.47.6.2 01-Jun-2006  kardel Sync with head.
 1.47.6.1 22-Apr-2006  simonb Sync with head.
 1.47.4.1 09-Sep-2006  rpaulo sync with head
 1.48.2.7 03-Sep-2006  yamt sync with head.
 1.48.2.6 11-Aug-2006  yamt sync with head
 1.48.2.5 26-Jun-2006  yamt sync with head.
 1.48.2.4 24-May-2006  yamt sync with head.
 1.48.2.3 01-Apr-2006  yamt sync with head.
 1.48.2.2 13-Mar-2006  yamt sync with head.
 1.48.2.1 05-Mar-2006  yamt file netbsd32_syscallargs.h was added on branch yamt-pdpolicy on 2006-03-13 09:07:08 +0000
 1.49.4.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.49.4.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.49.2.2 11-May-2006  elad sync with head
 1.49.2.1 19-Apr-2006  elad sync with head.
 1.51.2.1 19-Jun-2006  chap Sync with head.
 1.53.2.1 13-Jul-2006  gdamore Merge from HEAD.
 1.60.4.1 10-Dec-2006  yamt sync with head.
 1.60.2.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.60.2.1 18-Nov-2006  ad Sync with head.
 1.62.2.2 12-Mar-2007  rmind Sync with HEAD.
 1.62.2.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.66.14.4 09-Dec-2007  jmcneill Sync with HEAD.
 1.66.14.3 11-Nov-2007  joerg Sync with HEAD.
 1.66.14.2 16-Aug-2007  jmcneill Sync with HEAD.
 1.66.14.1 09-Aug-2007  jmcneill Sync with HEAD.
 1.66.10.2 03-Sep-2007  skrll Sync with HEAD.
 1.66.10.1 15-Aug-2007  skrll Sync with HEAD.
 1.66.6.1 09-Dec-2007  reinoud Pullup to HEAD
 1.66.2.1 20-Aug-2007  ad Sync with HEAD.
 1.68.8.4 18-Feb-2008  mjf Sync with HEAD.
 1.68.8.3 27-Dec-2007  mjf Sync with HEAD.
 1.68.8.2 08-Dec-2007  mjf Sync with HEAD.
 1.68.8.1 19-Nov-2007  mjf Sync with HEAD.
 1.68.6.1 13-Nov-2007  bouyer Sync with HEAD
 1.68.2.2 23-Mar-2008  matt sync with HEAD
 1.68.2.1 09-Jan-2008  matt sync with HEAD
 1.69.2.2 26-Dec-2007  ad Sync with head.
 1.69.2.1 08-Dec-2007  ad Sync with head.
 1.70.4.2 20-Jan-2008  bouyer Sync with HEAD
 1.70.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.75.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.75.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.75.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.75.2.1 24-Mar-2008  keiichi sync with head.
 1.76.2.1 18-May-2008  yamt sync with head.
 1.77.8.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.77.8.1 19-Oct-2008  haad Sync with HEAD.
 1.77.4.2 28-Sep-2008  skrll Regen.
 1.77.4.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.77.2.3 11-Mar-2010  yamt sync with head
 1.77.2.2 20-Jun-2009  yamt sync with head
 1.77.2.1 04-May-2009  yamt sync with head.
 1.78.4.1 25-Nov-2008  snj branches: 1.78.4.1.4;
Regen for ticket 121.
 1.78.4.1.4.1 12-Sep-2009  matt Regen.
 1.78.2.3 28-Apr-2009  skrll Sync with HEAD.
 1.78.2.2 03-Mar-2009  skrll Sync with HEAD.
 1.78.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.82.4.3 04-Jan-2009  christos fix module build.
 1.82.4.2 04-Jan-2009  christos add new syscalls.
 1.82.4.1 22-Nov-2008  christos file netbsd32_syscallargs.h was added on branch christos-time_t on 2009-01-04 01:56:02 +0000
 1.85.2.2 23-Jul-2009  jym Sync with HEAD.
 1.85.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.90.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.92.6.2 09-Feb-2011  bouyer Regen
 1.92.6.1 20-Jan-2011  bouyer Snapshot of work in progress on a modernised disk quota system:
- new quotactl syscall (versionned for backward compat), which takes
as parameter a path to a mount point, and a prop_dictionary
(in plistref format) describing commands and arguments.
For each command, status and data are returned as a prop_dictionary.
quota commands features will be added to take advantage of this,
exporting quota data or getting quota commands as plists.

- new on disk-format storage (all 64bit wide), integrated to metadata for
ffs (and playing nicely with wapbl).
Quotas are enabled on a ffs filesystem via superblock flags.
tunefs(8) can enable or disable quotas.
On a quota-enabled filesystem, fsck_ffs(8) will track per-uid/gid
block and inode usages, and will check and update quotas in Pass 6.
quota usage and limits are stored in unliked files (one for users,
one for groups)l fsck_ffs(8) will create the files if needed, or
free them if needed. This means that after enabling or disabling
quotas on a filesystem; a fsck_ffs(8) run is required.
quotacheck(8) is not needed any more, on a unclean shutdown
fsck or journal replay will take care of fixing quotas.
newfs(8) can create a ready-to-mount quota-enabled filesystem
(superblock flags are set and quota inodes are created).
Other new features or semantic changes:
- default quota datas, applied to users or groups which don't already
have a quota entry
- per-user/group grace time (instead of a filesystem global one)
- 0 really means "nothing allowed at all", not "no limit".
If you want "no limit", set the limit to UQUAD_MAX (tools will
understand "unlimited" and "-")

A quota file is structured as follow:
it starts with a header, containing a few per-filesystem values,
and the default quota limits.
Quota entries are linked together as a simple list, each entry has a
pointer (as an offset withing the file) to the next.
The header has a pointer to a list of free quota entries, and
a hash table of in-use entries. The size of the hash table depends
on the filesystem block size (header+hash table should fit in the
first block). The file is not sparse and is a multiple of
filesystem block size (when the free quota entry list is empty a new
filesystem block is allocated). quota entries to not cross
filesystem block boundaries.

In memory, the kernel keeps a cache of recently used quota entries
as a reference to the block number, and offset withing the block.
The quota entry itself is keept in the buf cache.

fsck_ffs(8), tunefs(8) and newfs(8) supports are completed (with
related atf tests :)
The kernel can update disk usage and report it via quotactl(2).

Todo: enforce quotas limits (limits are not checked by kernel yet)
update repquota, edquota and rpc.rquotad to the new world
implement compat_50_quotactl ioctl.
update quotactl(2) man page

fsck_ffs required fixes so that allocating new blocks or inodes will
properly update the superblock and cg sumaries. This was not an issue up
to now because superblock and cg sumaries check happened last, but now
allocations or frees can happen in pass 6.
 1.92.4.1 06-Jun-2011  jruoho Sync with HEAD.
 1.92.2.1 21-Apr-2011  rmind sync with head
 1.95.2.4 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.95.2.3 30-Oct-2012  yamt sync with head
 1.95.2.2 17-Apr-2012  yamt sync with head
 1.95.2.1 10-Nov-2011  yamt sync with head
 1.96.4.4 29-Apr-2012  mrg sync to latest -current.
 1.96.4.3 11-Mar-2012  mrg sync to latest -current
 1.96.4.2 24-Feb-2012  mrg sync to -current.
 1.96.4.1 18-Feb-2012  mrg merge to -current.
 1.99.2.2 14-Apr-2015  msaitoh Pull up following revision(s) (requested by khorben in ticket #1264):

include/unistd.h 1.144
sys/kern/init_sysent.c regen
sys/kern/syscalls.c regen
sys/kern/syscalls.master 1.272
sys/rump/include/rump/rump_syscalls.h regen
sys/rump/librump/rumpkern/rump_syscalls.c regen
sys/sys/syscall.h regen
sys/sys/syscallargs.h regen
sys/compat/netbds32/netbsd32_syscall.h regen
sys/compat/netbds32/netbsd32_syscallargs.h regen
sys/compat/netbds32/netbsd32_syscalls.c regen
sys/compat/netbds32/netbsd32_sysent.c regen
sys/compat/netbsd32/syscalls.master 1.102

Fix return type of the readlinkat(2) syscall. PR#49684.
 1.99.2.1 12-Apr-2012  riz Regen for ticket 175.
 1.103.2.4 03-Dec-2017  jdolecek update from HEAD
 1.103.2.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.103.2.2 23-Jun-2013  tls resync from head
 1.103.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.105.4.1 18-May-2014  rmind sync with head
 1.106.2.1 10-Aug-2014  tls Rebase.
 1.109.4.6 28-Aug-2017  skrll Sync with HEAD
 1.109.4.5 05-Dec-2016  skrll Sync with HEAD
 1.109.4.4 05-Oct-2016  skrll Sync with HEAD
 1.109.4.3 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.109.4.2 22-Sep-2015  skrll Sync with HEAD
 1.109.4.1 06-Apr-2015  skrll Sync with HEAD
 1.109.2.4 04-Nov-2019  martin Regen for ticket #1711
 1.109.2.3 06-Nov-2015  martin regen
 1.109.2.2 04-Nov-2015  riz Pull up following revision(s) (requested by mrg in ticket #956):
sys/compat/netbsd32/files.netbsd32: revision 1.36
sys/compat/netbsd32/netbsd32_sysent.c: revision 1.115
sys/compat/netbsd32/netbsd32_syscallargs.h: revision 1.116
sys/nfs/nfs_var.h: revision 1.93
sys/compat/netbsd32/netbsd32_conv.h: revision 1.30
sys/compat/netbsd32/netbsd32_syscall.h: revision 1.116
sys/compat/netbsd32/netbsd32_syscalls.c: revision 1.115
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.1
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.3
sys/nfs/nfs_syscalls.c: revision 1.156
sys/compat/netbsd32/syscalls.master: revision 1.108
sys/compat/netbsd32/netbsd32.h: revision 1.107
add netbsd32 support for nfssvc(2). we do this by defining 5 copyin/out
functions that do all the ugly work, are just plain copyin/out for the
native system calls, and do the necessary translations for netbsd32.
with this i'm able to run 32 bit nfsd and mountd on 64 bit kernel and
mount the file systems remotely.
don't copy the first netbsd32_export_args nexports times, but actually
advance the userland pointer each entry through the loop. oops.
 1.109.2.1 07-Mar-2015  snj regen for ticket 560
 1.122.2.2 20-Mar-2017  pgoyette Sync with HEAD
 1.122.2.1 04-Nov-2016  pgoyette Sync with HEAD
 1.127.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.128.4.1 11-May-2017  pgoyette Sync with HEAD
 1.129.2.1 04-Nov-2019  martin Regen for ticket #398
 1.134.2.17 09-Jan-2019  pgoyette Regen - otherwise compat_40_mount() is wrongly included in sysent.c

Missed this during earlier conflict resolution.
 1.134.2.16 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.134.2.15 29-Sep-2018  pgoyette Regen
 1.134.2.14 29-Sep-2018  pgoyette Regen
 1.134.2.13 14-Sep-2018  pgoyette Regen
 1.134.2.12 14-Sep-2018  pgoyette Regen
 1.134.2.11 13-Sep-2018  pgoyette Regen
 1.134.2.10 12-Sep-2018  pgoyette Regen
 1.134.2.9 12-Sep-2018  pgoyette Regen
 1.134.2.8 12-Sep-2018  pgoyette regen
 1.134.2.7 12-Sep-2018  pgoyette Regen with updated module information for ntp 30 and 50 compat calls
 1.134.2.6 11-Sep-2018  pgoyette Regen
 1.134.2.5 11-Sep-2018  pgoyette And regen again
 1.134.2.4 11-Sep-2018  pgoyette Regen
 1.134.2.3 11-Sep-2018  pgoyette Regen syscall files and fix includes for syscallvar.h
 1.134.2.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.134.2.1 21-May-2018  pgoyette Sync with HEAD
 1.135.2.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.135.2.1 10-Jun-2019  christos Sync with HEAD
 1.141.2.2 08-Mar-2020  martin Regen (for ticket #761)
 1.141.2.1 04-Nov-2019  martin Regen for ticket #398
 1.145.2.1 25-Jan-2020  ad Sync with head.
 1.150.2.1 25-Apr-2020  bouyer Sync with bouyer-xenpvh-base2 (HEAD)
 1.161.2.1 02-Aug-2025  perseant Sync with HEAD
 1.162 09-May-2025  martin PR 59352: netbsd32 compat for semtimedop(2): regen
 1.161 20-May-2024  christos branches: 1.161.2;
regen
 1.160 19-May-2024  christos regen
 1.159 30-Jul-2023  rin COMPAT_NETBSD32: Regen for syscalls.master,v 1.144
 1.158 30-Jul-2023  rin COMPANT_NETBSD32: Regen for syscalls.master,v 1.143
 1.157 29-Jul-2023  rin COMPAT_NETBSD32: Regen for syscalls.master,v 1.142
 1.156 20-Sep-2021  thorpej Regen for eventfd(2).
 1.155 20-Sep-2021  thorpej Regen for timerfd.
 1.154 10-Oct-2020  rin regen for getrandom(2)
 1.153 16-May-2020  christos Add ACL support for FFS. From FreeBSD.
 1.152 26-Apr-2020  thorpej Regen for native futex calls.
 1.151 22-Apr-2020  thorpej Regen for removal of _lwp_gettid(2).
 1.150 04-Apr-2020  thorpej branches: 1.150.2;
Regen for _lwp_gettid(2).
 1.149 12-Mar-2020  pgoyette regen
 1.148 07-Mar-2020  pgoyette Regen
 1.147 18-Jan-2020  pgoyette Regen generated files _after_ committing changes to the source file.

This gets the "Generated from" comments to use the new version number.

No functional change.
 1.146 18-Jan-2020  kamil Catch up after getpid/getgid/getuid changes in native ABI in 2008

getpid(), getuid() and getgid() used to call respectively sys_getpid(),
sys_getuid() and sys_getgid(). In the BSD4.3 compat mode there was a
fallback to call sys_getpid_with_ppid() and related functions.

In 2008 the compat ifdef was removed in sys/kern/syscalls.master r. 1.216.

For purity reasons we probably shall restore the NetBSD original behavior
and implement BSD4.3 one as a compat module, however it is not worth the
complexity.

Align the netbsd32 compat ABI to native ABI and call functions that return
two integers as in BSD4.3.
 1.145 04-Nov-2019  rin branches: 1.145.2;
regen
 1.144 04-Nov-2019  rin regen
 1.143 13-Oct-2019  christos regen
 1.142 22-Sep-2019  christos regen
 1.141 18-Jun-2019  christos branches: 1.141.2;
Regen
 1.140 18-Jun-2019  christos regen
 1.139 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.138 24-Dec-2018  mrg regen.
 1.137 24-Dec-2018  mrg move mmap(), compat 40 mount(), pipe() and getfh() into their own files
as the implementation is non trivial or is compat. mark old mount()
properly instead of manually #if'ing ito to ENOSYS.
 1.136 10-Aug-2018  pgoyette Regen
 1.135 31-Jul-2018  rjs regen.
 1.134 12-Jul-2018  maxv Remove the kernel PMC code. Sent yesterday on tech-kern@.

This change:

* Removes "options PERFCTRS", the associated includes, and the associated
ifdefs. In doing so, it removes several XXXSMPs in the MI code, which is
good.

* Removes the PMC code of ARM XSCALE.

* Removes all the pmc.h files. They were all empty, except for ARM XSCALE.

* Reorders the x86 PMC code not to rely on the legacy pmc.h file. The
definitions are put in sysarch.h.

* Removes the kern/sys_pmc.c file, and along with it, the sys_pmc_control
and sys_pmc_get_info syscalls. They are marked as OBSOL in kern,
netbsd32 and rump.

* Removes the pmc_evid_t and pmc_ctr_t types.

* Removes all the associated man pages. The sets are marked as obsolete.
 1.133 10-May-2018  christos branches: 1.133.2;
regen
 1.132 06-Jan-2018  kamil branches: 1.132.2;
Revert vadvise(2) removal

This system call was used in legacy Lisp code, that was inherited to modern
age and still compiled against supported compat layers (e.g. in clisp,
oaklisp, Franz Lisp).

It used to instruct the kernel about paging policy (G/C aware, flush etc).

Newly compiled code (assuming that it will detect vadvise()) will use the
libc stub for vadvise(). The headers for this interface are gone.

vadvise(2) could be marked as COMPAT_80, but as long as we support ultrix,
sunos or aout68k ABI, don't bother with this.

Requested by <mrg>
 1.131 19-Dec-2017  kamil Drop SYS_vadvise

The (o)vadvise syscall is dummy since the beginning of NetBSD.

It is an obsolete remnant from the old UNIX.

Sponsored by <The NetBSD Foundation>
 1.130 19-Dec-2017  kamil Drop SYS_sbrk

sbrk - change data segment size

This syscall is dummy since the inception of the project.

Sponsored by <The NetBSD Foundation>
 1.129 19-Dec-2017  kamil Drop the sstk(2) syscall stub

sstk - change stack section size

This functionality has never been implemented and is a remnant from 16-bit
UNIX. This stub appeared with the first NetBSD commit.

Sponsored by <The NetBSD Foundation>
 1.128 10-May-2017  riastradh branches: 1.128.2;
regen
 1.127 16-Jan-2017  christos branches: 1.127.4;
regen
 1.126 13-Jan-2017  christos branches: 1.126.2;
regen
 1.125 28-Oct-2016  christos regen
 1.124 19-Oct-2016  skrll Regen
 1.123 23-Sep-2016  skrll regen
 1.122 10-Sep-2016  skrll Regen
 1.121 03-Dec-2015  pgoyette branches: 1.121.2;
Regen syscall definitions - the compat_netbsd32 sysv-ipc stuff is now
modular and can be autoloaded when needed
 1.120 01-Dec-2015  pgoyette Regen for new compat_netbsd32_mqueue module
 1.119 01-Dec-2015  pgoyette Regen.
 1.118 01-Dec-2015  pgoyette Regen
 1.117 24-Sep-2015  christos regen
 1.116 23-Jun-2015  dholland regen
 1.115 22-Jun-2015  mrg add netbsd32 support for nfssvc(2). we do this by defining 5 copyin/out
functions that do all the ugly work, are just plain copyin/out for the
native system calls, and do the necessary translations for netbsd32.

with this i'm able to run 32 bit nfsd and mountd on 64 bit kernel and
mount the file systems remotely.
 1.114 21-Jun-2015  martin Regen (pset_*)
 1.113 21-Jun-2015  martin regen (versioned mq_* calls)
 1.112 20-Jun-2015  martin Regen (sigqueinfo, modctl, mq_*)
 1.111 16-Jun-2015  martin Regen for posix_fallocate and fdiscard
 1.110 07-Mar-2015  christos regen
 1.109 25-Feb-2015  christos regen
 1.108 13-Jun-2014  joerg branches: 1.108.2; 1.108.4;
Regnerate
 1.107 15-May-2014  njoly Regen for setcontext signature.
 1.106 30-Apr-2014  njoly Regen for netbsd32_off_t.
 1.105 17-Oct-2013  njoly branches: 1.105.2;
Regen for mknodat(2) device argument type change.
 1.104 29-Mar-2013  christos branches: 1.104.4;
regen
 1.103 02-Oct-2012  christos regen
 1.102 08-Apr-2012  martin branches: 1.102.2;
Regen (posix_spawn)
 1.101 10-Mar-2012  joerg P1003_1B_SEMAPHORE is no longer optional.
 1.100 08-Mar-2012  joerg Implement sem_timedwait.
 1.99 19-Feb-2012  rmind Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.
 1.98 01-Feb-2012  dholland branches: 1.98.2;
Regen syscalls with proper id info.
 1.97 01-Feb-2012  dholland Update compat_netbsd32 for new quotactl.
 1.96 31-Jan-2012  matt Regen.
 1.95 08-Nov-2011  njoly branches: 1.95.4;
Regen for kqueue1.
 1.94 31-Aug-2011  njoly branches: 1.94.2;
Regen for dup3.
 1.93 05-Jul-2011  njoly Regen for pipe2.
 1.92 06-Mar-2011  bouyer merge the bouyer-quota2 branch. This adds a new on-disk format
to store disk quota usage and limits, integrated with ffs
metadata. Usage is checked by fsck_ffs (no more quotacheck)
and is covered by the WAPBL journal. Enabled with kernel
option QUOTA2 (added where QUOTA was enabled in kernel config files),
turned on with tunefs(8) on a per-filesystem
basis. mount_mfs(8) can also turn quotas on.

See http://mail-index.netbsd.org/tech-kern/2011/02/19/msg010025.html
for details.
 1.91 02-Mar-2010  pooka branches: 1.91.2; 1.91.4; 1.91.6;
regen:
- remove nfssvc / fs_nfs.h / #ifdef NFS
- make getfh unconditional
 1.90 02-Mar-2010  pooka regen for conditional lfs syscall removal
 1.89 14-Dec-2009  matt branches: 1.89.2;
Regen (new makesyscalls.sh)
 1.88 14-Dec-2009  matt Merge from matt-nb5-mips64
 1.87 17-May-2009  pooka regen: pad -> PAD
 1.86 16-Mar-2009  njoly Regen for netbsd32_dev_t.
 1.85 26-Feb-2009  christos Regen
 1.84 13-Jan-2009  pooka branches: 1.84.2;
Regen to prove I didn't screw up the conversion: purely RCSID changes.
 1.83 13-Jan-2009  pooka regen: UNIMPL police
 1.82 11-Jan-2009  christos merge christos-time_t
 1.81 22-Nov-2008  mrg branches: 1.81.4;
regenerate
 1.80 19-Nov-2008  ad Regen.
 1.79 14-Nov-2008  ad Regen.
 1.78 12-Nov-2008  ad Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.
 1.77 15-Oct-2008  wrstuden branches: 1.77.2; 1.77.4;
Merge wrstuden-revivesa into HEAD.
 1.76 24-Apr-2008  ad branches: 1.76.2; 1.76.4; 1.76.8;
Regen.
 1.75 24-Feb-2008  martin branches: 1.75.2;
Regen (old posix_fadvise ignored)
 1.74 27-Jan-2008  martin branches: 1.74.2; 1.74.6;
Regen (posix_fadvise versionend)
 1.73 26-Jan-2008  dsl regen
 1.72 19-Jan-2008  dsl Regen for netbsd32_mremap
 1.71 20-Dec-2007  dsl regen
 1.70 17-Dec-2007  dsl Regen without any 'const' members of the syscall argument structures.
 1.69 07-Dec-2007  ad branches: 1.69.4;
Reg... hang on, why don't we build this at compile time?!?
 1.68 09-Nov-2007  dsl branches: 1.68.2;
Regen
 1.67 15-Aug-2007  ad branches: 1.67.2; 1.67.6; 1.67.8;
Regen.
 1.66 07-Aug-2007  ad Regen.
 1.65 04-Mar-2007  christos branches: 1.65.2; 1.65.6; 1.65.10; 1.65.14;
fix fallout from caddr_t changes.
 1.64 19-Feb-2007  cube Regen (a few MPSAFE additions).
 1.63 18-Feb-2007  cube Regen (missing lwp syscalls).
 1.62 09-Feb-2007  ad branches: 1.62.2;
Merge newlock2 to head.
 1.61 09-Nov-2006  cube Regen (PR#34951 fixes).
 1.60 01-Sep-2006  matt branches: 1.60.2; 1.60.4;
Regen.
 1.59 30-Aug-2006  cube Regen (netbsd32_ptrace protection).
 1.58 31-Jul-2006  martin Make filehandles opaque to userland
 1.57 13-Jul-2006  pavel regen.
 1.56 13-Jul-2006  martin regen
 1.55 13-Jul-2006  martin Fix alignement problems for fhandle_t, exposed by gcc4.1.

While touching all vptofh/fhtovp functions, get rid of VFS_MAXFIDSIZ,
version the getfh(2) syscall and explicitly pass the size available in
the filehandle from userland.

Discussed on tech-kern, with lots of help from yamt (thanks!).
 1.54 26-Jun-2006  mrg regenerate.
 1.53 31-May-2006  drochner branches: 1.53.2;
regen
 1.52 29-May-2006  drochner regen
 1.51 05-May-2006  cube branches: 1.51.2;
Regen (fhstat versioning, posix_fadvise).
 1.50 29-Mar-2006  cube Regen (_lwp*, sa_*).
 1.49 06-Mar-2006  cube branches: 1.49.2; 1.49.4;
Regen (SysV IPC).
 1.48 05-Mar-2006  cube branches: 1.48.2;
Regen (ksem_*).
 1.47 11-Dec-2005  christos branches: 1.47.4; 1.47.6;
merge ktrace-lwp.
 1.46 23-Oct-2005  cube Regen (kqueue, kevent).
 1.45 19-Aug-2005  christos branches: 1.45.2;
Fix lossage I created with the 64 bit ino_t change.
 1.44 23-Jul-2005  cube Regen (__sigtimedwait(2)).
 1.43 23-Jul-2005  cube Regen (timer_create(2) and friends).
 1.42 12-Jul-2005  cube Regen (*xattr(2)).
 1.41 11-Jul-2005  cube Regen (rasctl(2)).
 1.40 10-Jul-2005  cube Regen.
 1.39 10-Jul-2005  cube Regen.
 1.38 09-Jul-2005  cube Regen.
 1.37 08-Jul-2005  cube Regen.
 1.36 08-Jul-2005  cube Regen
 1.35 04-Jul-2005  cube branches: 1.35.2;
Regen
 1.34 30-May-2005  chs regen
 1.33 26-Feb-2005  perry regen
 1.32 17-Jun-2004  cube branches: 1.32.4; 1.32.6;
Regen.
 1.31 25-Oct-2003  chs regen
 1.30 13-Oct-2003  fvdl Regenerate.
 1.29 18-Jan-2003  thorpej branches: 1.29.2;
Regen for correct RCS ID.
 1.28 18-Jan-2003  thorpej Regen: Merge the nathanw_sa branch.
 1.27 23-Oct-2002  scw Regen to pick up netbsd32___sigaction_sigtramp addition.
 1.26 29-Apr-2002  mrg regenerate.
 1.25 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.24 30-May-2001  mrg branches: 1.24.2;
use _KERNEL_OPT.
 1.23 10-Apr-2001  kleink Regen.
 1.22 02-Feb-2001  mrg branches: 1.22.2;
regen
 1.21 27-Jan-2001  thorpej Regen; getpid(2) is MP-safe.
 1.20 27-Jan-2001  thorpej Regen; add sy_flags.
 1.19 09-Dec-2000  mycroft Regen.
 1.18 30-Nov-2000  jdolecek always include netbsd32_ntp_adjtime(), LKMify
 1.17 13-Nov-2000  jdolecek change the type of *syscallnames[] array to 'const char * const foo[]'
 1.16 18-Aug-2000  cgd update for changed makesyscalls.master
 1.15 07-Aug-2000  bjh21 Second phase of changes to remove ntp_adjtime(2) from the kernel entirely if
NTP is not defined.

Also removes sysctl_ntptime, since that's unreferenced without NTP.

ntp_gettime(2) is left alone, since it doesn't raise SIGSYS, which sys_nosys()
does.
 1.14 09-Jul-2000  mrg regen
 1.13 31-Jan-2000  christos Regen
 1.12 30-Dec-1999  eeh Update to 32-bit compatibility routines.
 1.11 11-Oct-1999  eeh branches: 1.11.2;
Add netbsd32_compat_14.c

Rename everything from compat_netbsd32 -> netbsd32 so we don't have silly
names like compat_14_compat_netbsd32_sys_shmctl().
 1.10 09-Jun-1999  christos branches: 1.10.2;
Regen
 1.9 25-Mar-1999  mrg branches: 1.9.4;
regen
 1.8 25-Mar-1999  mrg move sparc32 to netbsd32; split out MD part (signal handling) (mostly via repository copy, rename and perl -pi :-)
 1.7 25-Mar-1999  mrg regen
 1.6 10-Dec-1998  christos Regen
 1.5 19-Oct-1998  tron Regen.
 1.4 01-Oct-1998  eeh Overhaul. Now will run simple things like /bin/sh and /bin/echo.
 1.3 26-Aug-1998  mrg regen.
 1.2 26-Aug-1998  mrg regen
 1.1 26-Aug-1998  mrg add a 32-bit compatibility module for the sparc64 port, so it can run NetBSD/sparc binaries with a LP64 kernel.
 1.9.4.2 02-Aug-1999  thorpej Regen.
 1.9.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.10.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.11.2.6 21-Apr-2001  bouyer Sync with HEAD
 1.11.2.5 11-Feb-2001  bouyer Sync with HEAD.
 1.11.2.4 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.11.2.3 08-Dec-2000  bouyer Sync with HEAD.
 1.11.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.11.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.22.2.5 11-Nov-2002  nathanw Catch up to -current
 1.22.2.4 20-Jun-2002  nathanw Catch up to -current.
 1.22.2.3 29-May-2002  nathanw Regen.
 1.22.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.22.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.24.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.24.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.29.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.29.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.29.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.29.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.29.2.1 03-Aug-2004  skrll Sync with HEAD
 1.32.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.32.4.1 29-Apr-2005  kent sync with -current
 1.35.2.8 27-Feb-2008  yamt sync with head.
 1.35.2.7 04-Feb-2008  yamt sync with head.
 1.35.2.6 21-Jan-2008  yamt sync with head
 1.35.2.5 15-Nov-2007  yamt sync with head.
 1.35.2.4 03-Sep-2007  yamt sync with head.
 1.35.2.3 26-Feb-2007  yamt sync with head.
 1.35.2.2 30-Dec-2006  yamt sync with head.
 1.35.2.1 21-Jun-2006  yamt sync with head.
 1.45.2.1 26-Oct-2005  yamt sync with head
 1.47.6.2 01-Jun-2006  kardel Sync with head.
 1.47.6.1 22-Apr-2006  simonb Sync with head.
 1.47.4.1 09-Sep-2006  rpaulo sync with head
 1.48.2.7 03-Sep-2006  yamt sync with head.
 1.48.2.6 11-Aug-2006  yamt sync with head
 1.48.2.5 26-Jun-2006  yamt sync with head.
 1.48.2.4 24-May-2006  yamt sync with head.
 1.48.2.3 01-Apr-2006  yamt sync with head.
 1.48.2.2 13-Mar-2006  yamt sync with head.
 1.48.2.1 05-Mar-2006  yamt file netbsd32_syscalls.c was added on branch yamt-pdpolicy on 2006-03-13 09:07:08 +0000
 1.49.4.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.49.4.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.49.2.2 11-May-2006  elad sync with head
 1.49.2.1 19-Apr-2006  elad sync with head.
 1.51.2.1 19-Jun-2006  chap Sync with head.
 1.53.2.1 13-Jul-2006  gdamore Merge from HEAD.
 1.60.4.1 10-Dec-2006  yamt sync with head.
 1.60.2.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.60.2.1 18-Nov-2006  ad Sync with head.
 1.62.2.2 12-Mar-2007  rmind Sync with HEAD.
 1.62.2.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.65.14.4 09-Dec-2007  jmcneill Sync with HEAD.
 1.65.14.3 11-Nov-2007  joerg Sync with HEAD.
 1.65.14.2 16-Aug-2007  jmcneill Sync with HEAD.
 1.65.14.1 09-Aug-2007  jmcneill Sync with HEAD.
 1.65.10.2 03-Sep-2007  skrll Sync with HEAD.
 1.65.10.1 15-Aug-2007  skrll Sync with HEAD.
 1.65.6.1 09-Dec-2007  reinoud Pullup to HEAD
 1.65.2.1 20-Aug-2007  ad Sync with HEAD.
 1.67.8.4 18-Feb-2008  mjf Sync with HEAD.
 1.67.8.3 27-Dec-2007  mjf Sync with HEAD.
 1.67.8.2 08-Dec-2007  mjf Sync with HEAD.
 1.67.8.1 19-Nov-2007  mjf Sync with HEAD.
 1.67.6.1 13-Nov-2007  bouyer Sync with HEAD
 1.67.2.2 23-Mar-2008  matt sync with HEAD
 1.67.2.1 09-Jan-2008  matt sync with HEAD
 1.68.2.2 26-Dec-2007  ad Sync with head.
 1.68.2.1 08-Dec-2007  ad Sync with head.
 1.69.4.2 20-Jan-2008  bouyer Sync with HEAD
 1.69.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.74.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.74.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.74.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.74.2.1 24-Mar-2008  keiichi sync with head.
 1.75.2.1 18-May-2008  yamt sync with head.
 1.76.8.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.76.8.1 19-Oct-2008  haad Sync with HEAD.
 1.76.4.3 28-Sep-2008  skrll Regen.
 1.76.4.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.76.4.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.76.2.3 11-Mar-2010  yamt sync with head
 1.76.2.2 20-Jun-2009  yamt sync with head
 1.76.2.1 04-May-2009  yamt sync with head.
 1.77.4.1 25-Nov-2008  snj branches: 1.77.4.1.4;
Regen for ticket 121.
 1.77.4.1.4.1 12-Sep-2009  matt Regen.
 1.77.2.3 28-Apr-2009  skrll Sync with HEAD.
 1.77.2.2 03-Mar-2009  skrll Sync with HEAD.
 1.77.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.81.4.3 04-Jan-2009  christos fix module build.
 1.81.4.2 04-Jan-2009  christos add new syscalls.
 1.81.4.1 22-Nov-2008  christos file netbsd32_syscalls.c was added on branch christos-time_t on 2009-01-04 01:56:02 +0000
 1.84.2.2 23-Jul-2009  jym Sync with HEAD.
 1.84.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.89.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.91.6.2 09-Feb-2011  bouyer Regen
 1.91.6.1 20-Jan-2011  bouyer Snapshot of work in progress on a modernised disk quota system:
- new quotactl syscall (versionned for backward compat), which takes
as parameter a path to a mount point, and a prop_dictionary
(in plistref format) describing commands and arguments.
For each command, status and data are returned as a prop_dictionary.
quota commands features will be added to take advantage of this,
exporting quota data or getting quota commands as plists.

- new on disk-format storage (all 64bit wide), integrated to metadata for
ffs (and playing nicely with wapbl).
Quotas are enabled on a ffs filesystem via superblock flags.
tunefs(8) can enable or disable quotas.
On a quota-enabled filesystem, fsck_ffs(8) will track per-uid/gid
block and inode usages, and will check and update quotas in Pass 6.
quota usage and limits are stored in unliked files (one for users,
one for groups)l fsck_ffs(8) will create the files if needed, or
free them if needed. This means that after enabling or disabling
quotas on a filesystem; a fsck_ffs(8) run is required.
quotacheck(8) is not needed any more, on a unclean shutdown
fsck or journal replay will take care of fixing quotas.
newfs(8) can create a ready-to-mount quota-enabled filesystem
(superblock flags are set and quota inodes are created).
Other new features or semantic changes:
- default quota datas, applied to users or groups which don't already
have a quota entry
- per-user/group grace time (instead of a filesystem global one)
- 0 really means "nothing allowed at all", not "no limit".
If you want "no limit", set the limit to UQUAD_MAX (tools will
understand "unlimited" and "-")

A quota file is structured as follow:
it starts with a header, containing a few per-filesystem values,
and the default quota limits.
Quota entries are linked together as a simple list, each entry has a
pointer (as an offset withing the file) to the next.
The header has a pointer to a list of free quota entries, and
a hash table of in-use entries. The size of the hash table depends
on the filesystem block size (header+hash table should fit in the
first block). The file is not sparse and is a multiple of
filesystem block size (when the free quota entry list is empty a new
filesystem block is allocated). quota entries to not cross
filesystem block boundaries.

In memory, the kernel keeps a cache of recently used quota entries
as a reference to the block number, and offset withing the block.
The quota entry itself is keept in the buf cache.

fsck_ffs(8), tunefs(8) and newfs(8) supports are completed (with
related atf tests :)
The kernel can update disk usage and report it via quotactl(2).

Todo: enforce quotas limits (limits are not checked by kernel yet)
update repquota, edquota and rpc.rquotad to the new world
implement compat_50_quotactl ioctl.
update quotactl(2) man page

fsck_ffs required fixes so that allocating new blocks or inodes will
properly update the superblock and cg sumaries. This was not an issue up
to now because superblock and cg sumaries check happened last, but now
allocations or frees can happen in pass 6.
 1.91.4.1 06-Jun-2011  jruoho Sync with HEAD.
 1.91.2.1 21-Apr-2011  rmind sync with head
 1.94.2.4 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.94.2.3 30-Oct-2012  yamt sync with head
 1.94.2.2 17-Apr-2012  yamt sync with head
 1.94.2.1 10-Nov-2011  yamt sync with head
 1.95.4.4 29-Apr-2012  mrg sync to latest -current.
 1.95.4.3 11-Mar-2012  mrg sync to latest -current
 1.95.4.2 24-Feb-2012  mrg sync to -current.
 1.95.4.1 18-Feb-2012  mrg merge to -current.
 1.98.2.2 14-Apr-2015  msaitoh Pull up following revision(s) (requested by khorben in ticket #1264):

include/unistd.h 1.144
sys/kern/init_sysent.c regen
sys/kern/syscalls.c regen
sys/kern/syscalls.master 1.272
sys/rump/include/rump/rump_syscalls.h regen
sys/rump/librump/rumpkern/rump_syscalls.c regen
sys/sys/syscall.h regen
sys/sys/syscallargs.h regen
sys/compat/netbds32/netbsd32_syscall.h regen
sys/compat/netbds32/netbsd32_syscallargs.h regen
sys/compat/netbds32/netbsd32_syscalls.c regen
sys/compat/netbds32/netbsd32_sysent.c regen
sys/compat/netbsd32/syscalls.master 1.102

Fix return type of the readlinkat(2) syscall. PR#49684.
 1.98.2.1 12-Apr-2012  riz Regen for ticket 175.
 1.102.2.4 03-Dec-2017  jdolecek update from HEAD
 1.102.2.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.102.2.2 23-Jun-2013  tls resync from head
 1.102.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.104.4.1 18-May-2014  rmind sync with head
 1.105.2.1 10-Aug-2014  tls Rebase.
 1.108.4.5 05-Dec-2016  skrll Sync with HEAD
 1.108.4.4 05-Oct-2016  skrll Sync with HEAD
 1.108.4.3 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.108.4.2 22-Sep-2015  skrll Sync with HEAD
 1.108.4.1 06-Apr-2015  skrll Sync with HEAD
 1.108.2.4 04-Nov-2019  martin Regen for ticket #1711
 1.108.2.3 06-Nov-2015  martin regen
 1.108.2.2 04-Nov-2015  riz Pull up following revision(s) (requested by mrg in ticket #956):
sys/compat/netbsd32/files.netbsd32: revision 1.36
sys/compat/netbsd32/netbsd32_sysent.c: revision 1.115
sys/compat/netbsd32/netbsd32_syscallargs.h: revision 1.116
sys/nfs/nfs_var.h: revision 1.93
sys/compat/netbsd32/netbsd32_conv.h: revision 1.30
sys/compat/netbsd32/netbsd32_syscall.h: revision 1.116
sys/compat/netbsd32/netbsd32_syscalls.c: revision 1.115
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.1
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.3
sys/nfs/nfs_syscalls.c: revision 1.156
sys/compat/netbsd32/syscalls.master: revision 1.108
sys/compat/netbsd32/netbsd32.h: revision 1.107
add netbsd32 support for nfssvc(2). we do this by defining 5 copyin/out
functions that do all the ugly work, are just plain copyin/out for the
native system calls, and do the necessary translations for netbsd32.
with this i'm able to run 32 bit nfsd and mountd on 64 bit kernel and
mount the file systems remotely.
don't copy the first netbsd32_export_args nexports times, but actually
advance the userland pointer each entry through the loop. oops.
 1.108.2.1 07-Mar-2015  snj regen for ticket 560
 1.121.2.2 20-Mar-2017  pgoyette Sync with HEAD
 1.121.2.1 04-Nov-2016  pgoyette Sync with HEAD
 1.126.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.127.4.1 11-May-2017  pgoyette Sync with HEAD
 1.128.2.1 04-Nov-2019  martin Regen for ticket #398
 1.132.2.18 09-Jan-2019  pgoyette Regen - otherwise compat_40_mount() is wrongly included in sysent.c

Missed this during earlier conflict resolution.
 1.132.2.17 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.132.2.16 29-Sep-2018  pgoyette Regen
 1.132.2.15 29-Sep-2018  pgoyette Regen
 1.132.2.14 14-Sep-2018  pgoyette Regen
 1.132.2.13 14-Sep-2018  pgoyette Regen
 1.132.2.12 13-Sep-2018  pgoyette Regen
 1.132.2.11 12-Sep-2018  pgoyette Regen
 1.132.2.10 12-Sep-2018  pgoyette Regen
 1.132.2.9 12-Sep-2018  pgoyette regen
 1.132.2.8 12-Sep-2018  pgoyette Regen with updated module information for ntp 30 and 50 compat calls
 1.132.2.7 11-Sep-2018  pgoyette Regen
 1.132.2.6 11-Sep-2018  pgoyette And regen again
 1.132.2.5 11-Sep-2018  pgoyette Regen
 1.132.2.4 11-Sep-2018  pgoyette Regen syscall files and fix includes for syscallvar.h
 1.132.2.3 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.132.2.2 28-Jul-2018  pgoyette Sync with HEAD
 1.132.2.1 21-May-2018  pgoyette Sync with HEAD
 1.133.2.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.133.2.1 10-Jun-2019  christos Sync with HEAD
 1.141.2.2 08-Mar-2020  martin Regen (for ticket #761)
 1.141.2.1 04-Nov-2019  martin Regen for ticket #398
 1.145.2.1 25-Jan-2020  ad Sync with head.
 1.150.2.1 25-Apr-2020  bouyer Sync with bouyer-xenpvh-base2 (HEAD)
 1.161.2.1 02-Aug-2025  perseant Sync with HEAD
 1.42 09-May-2025  martin PR 59352: netbsd32 compat for semtimedop(2): regen
 1.41 20-May-2024  christos branches: 1.41.2;
regen
 1.40 19-May-2024  christos regen
 1.39 30-Jul-2023  rin COMPAT_NETBSD32: Regen for syscalls.master,v 1.144
 1.38 30-Jul-2023  rin COMPANT_NETBSD32: Regen for syscalls.master,v 1.143
 1.37 29-Jul-2023  rin COMPAT_NETBSD32: Regen for syscalls.master,v 1.142
 1.36 20-Sep-2021  thorpej Regen for eventfd(2).
 1.35 20-Sep-2021  thorpej Regen for timerfd.
 1.34 10-Oct-2020  rin regen for getrandom(2)
 1.33 16-May-2020  christos Add ACL support for FFS. From FreeBSD.
 1.32 26-Apr-2020  thorpej Regen for native futex calls.
 1.31 22-Apr-2020  thorpej Regen for removal of _lwp_gettid(2).
 1.30 04-Apr-2020  thorpej branches: 1.30.2;
Regen for _lwp_gettid(2).
 1.29 12-Mar-2020  pgoyette regen
 1.28 07-Mar-2020  pgoyette Regen
 1.27 18-Jan-2020  pgoyette Regen generated files _after_ committing changes to the source file.

This gets the "Generated from" comments to use the new version number.

No functional change.
 1.26 18-Jan-2020  kamil Catch up after getpid/getgid/getuid changes in native ABI in 2008

getpid(), getuid() and getgid() used to call respectively sys_getpid(),
sys_getuid() and sys_getgid(). In the BSD4.3 compat mode there was a
fallback to call sys_getpid_with_ppid() and related functions.

In 2008 the compat ifdef was removed in sys/kern/syscalls.master r. 1.216.

For purity reasons we probably shall restore the NetBSD original behavior
and implement BSD4.3 one as a compat module, however it is not worth the
complexity.

Align the netbsd32 compat ABI to native ABI and call functions that return
two integers as in BSD4.3.
 1.25 04-Nov-2019  rin branches: 1.25.2;
regen
 1.24 04-Nov-2019  rin regen
 1.23 13-Oct-2019  christos regen
 1.22 22-Sep-2019  christos regen
 1.21 18-Jun-2019  christos branches: 1.21.2;
Regen
 1.20 18-Jun-2019  christos regen
 1.19 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.18 24-Dec-2018  mrg regen.
 1.17 24-Dec-2018  mrg move mmap(), compat 40 mount(), pipe() and getfh() into their own files
as the implementation is non trivial or is compat. mark old mount()
properly instead of manually #if'ing ito to ENOSYS.
 1.16 10-Aug-2018  pgoyette Regen
 1.15 31-Jul-2018  rjs regen.
 1.14 10-May-2018  christos branches: 1.14.2;
regen
 1.13 06-Jan-2018  kamil branches: 1.13.2;
Revert vadvise(2) removal

This system call was used in legacy Lisp code, that was inherited to modern
age and still compiled against supported compat layers (e.g. in clisp,
oaklisp, Franz Lisp).

It used to instruct the kernel about paging policy (G/C aware, flush etc).

Newly compiled code (assuming that it will detect vadvise()) will use the
libc stub for vadvise(). The headers for this interface are gone.

vadvise(2) could be marked as COMPAT_80, but as long as we support ultrix,
sunos or aout68k ABI, don't bother with this.

Requested by <mrg>
 1.12 19-Dec-2017  kamil Drop SYS_vadvise

The (o)vadvise syscall is dummy since the beginning of NetBSD.

It is an obsolete remnant from the old UNIX.

Sponsored by <The NetBSD Foundation>
 1.11 10-May-2017  riastradh branches: 1.11.2; 1.11.8;
regen
 1.10 16-Jan-2017  christos branches: 1.10.4;
regen
 1.9 13-Jan-2017  christos branches: 1.9.2;
regen
 1.8 28-Oct-2016  christos regen
 1.7 19-Oct-2016  skrll Regen
 1.6 23-Sep-2016  skrll regen
 1.5 10-Sep-2016  skrll Regen
 1.4 03-Dec-2015  pgoyette branches: 1.4.2; 1.4.4;
Regen syscall definitions - the compat_netbsd32 sysv-ipc stuff is now
modular and can be autoloaded when needed
 1.3 01-Dec-2015  pgoyette Regen for new compat_netbsd32_mqueue module
 1.2 01-Dec-2015  pgoyette Regen.
 1.1 01-Dec-2015  pgoyette Regen
 1.4.4.2 20-Mar-2017  pgoyette Sync with HEAD
 1.4.4.1 04-Nov-2016  pgoyette Sync with HEAD
 1.4.2.4 05-Dec-2016  skrll Sync with HEAD
 1.4.2.3 05-Oct-2016  skrll Sync with HEAD
 1.4.2.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.4.2.1 03-Dec-2015  skrll file netbsd32_syscalls_autoload.c was added on branch nick-nhusb on 2015-12-27 12:09:47 +0000
 1.9.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.10.4.1 11-May-2017  pgoyette Sync with HEAD
 1.11.8.2 03-Dec-2017  jdolecek update from HEAD
 1.11.8.1 10-May-2017  jdolecek file netbsd32_syscalls_autoload.c was added on branch tls-maxphys on 2017-12-03 11:36:56 +0000
 1.11.2.1 04-Nov-2019  martin Regen for ticket #398
 1.13.2.17 09-Jan-2019  pgoyette Regen - otherwise compat_40_mount() is wrongly included in sysent.c

Missed this during earlier conflict resolution.
 1.13.2.16 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.13.2.15 29-Sep-2018  pgoyette Regen
 1.13.2.14 29-Sep-2018  pgoyette Regen
 1.13.2.13 14-Sep-2018  pgoyette Regen
 1.13.2.12 14-Sep-2018  pgoyette Regen
 1.13.2.11 13-Sep-2018  pgoyette Regen
 1.13.2.10 12-Sep-2018  pgoyette Regen
 1.13.2.9 12-Sep-2018  pgoyette Regen
 1.13.2.8 12-Sep-2018  pgoyette regen
 1.13.2.7 12-Sep-2018  pgoyette Regen with updated module information for ntp 30 and 50 compat calls
 1.13.2.6 11-Sep-2018  pgoyette Regen
 1.13.2.5 11-Sep-2018  pgoyette And regen again
 1.13.2.4 11-Sep-2018  pgoyette Regen
 1.13.2.3 11-Sep-2018  pgoyette Regen syscall files and fix includes for syscallvar.h
 1.13.2.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.13.2.1 21-May-2018  pgoyette Sync with HEAD
 1.14.2.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.14.2.1 10-Jun-2019  christos Sync with HEAD
 1.21.2.2 08-Mar-2020  martin Regen (for ticket #761)
 1.21.2.1 04-Nov-2019  martin Regen for ticket #398
 1.25.2.1 25-Jan-2020  ad Sync with head.
 1.30.2.1 25-Apr-2020  bouyer Sync with bouyer-xenpvh-base2 (HEAD)
 1.41.2.1 02-Aug-2025  perseant Sync with HEAD
 1.45 19-Jan-2021  simonb KNF consistency: No parentheses are needed around the return value.
 1.44 21-Mar-2020  pgoyette branches: 1.44.4;
Restore code to sysctl_free() the compat32 shadow tree
 1.43 17-Mar-2020  pgoyette Remove a debug printf() that accidentally got committed. :(
 1.42 15-Mar-2020  pgoyette Use SYSCTL_SETUP mechanism to establish our sysctl tree, rather than
using explicit calls to netbsd32_sysctl_{init,fini}()
 1.41 02-Jan-2020  thorpej - Eliminate the global "boottime" variable, which was being accessed
without any synchronization against changes by e.g. clock_settime().
- Replace with new getbinboottime() / getnanoboottime() / getmicroboottime()
functions (naming mirrors that of other time access functions in kern_tc.c).
It returns the (maybe-converted) value of timebasebin, which also tracks
our estimate of when the system was booted (i.e. the legacy "boottime" was
redundant).

XXX There needs to be a lockless synchronization mechanism for reading
timebasebin, but this is a problem in kern_tc.c that pre-existed these
"boottime" changes. At least now the problem is centralized in one location.
 1.40 26-May-2018  kamil branches: 1.40.2;
Fix sysctl(3):vm.minaddress in compat_netbsd32(8)

Cast minaddress from LP64-specific long (64-bit) to 32-bit long (int).

This value is usually 0 or 0+PAGE_SIZE. There is need to change type in
order to keep original code functional, without prompting the value with
'long long' or a similar approach.


There are more CTLTYPE_LONG with a need for fixes in the compat code:

uipc_usrreq.c
1975 CTLTYPE_LONG, "sendspace",
1981 CTLTYPE_LONG, "recvspace",
1987 CTLTYPE_LONG, "sendspace",
1993 CTLTYPE_LONG, "recvspace",
vfs_bio.c
1921 CTLTYPE_LONG, "bufmem",
1928 CTLTYPE_LONG, "bufmem_lowater",
1935 CTLTYPE_LONG, "bufmem_hiwater",

Sponsored by <The NetBSD Foundation>
 1.39 26-May-2018  kamil Handle vm.maxaddress in compat_netbsd32(8)

Return VM_MAXUSER_ADDRESS32 instead of the 64-bit specific address.

Use CTLTYPE_INT instead of CTLTYPE_LONG in order to retain the same integer
type between 64-bit native kernel and 32-bit emulated program.

There probably should be CTLTYPE_LONG32 available for this purpose.

On NetBSD/i386:
vm.maxaddress=bfeff000

On NetBSD/amd64:
vm.maxaddress=7fbfdfeff000

On NetBSD/amd64 running i386 program:
vm.maxaddress=fffff000

A 32-bit program on the 64-bit kernel can use larger user space, this
difference is on purpose and expected.

Sponsored by <The NetBSD Foundation>
 1.38 31-Oct-2017  kre branches: 1.38.2;

unconst machine_arch32 for sysctl data .. pointed out by Riccardo Mottola
 1.37 31-Oct-2017  martin Allow architectures to define a macro PROC_MACHINE_ARCH(P) and
PROC_MACHINE_ARCH32(P) to override the value for sysctl hw.machine_arch
(native and netbsd32 commpat resp.).

Use these for arm and mips instead of the (not working, noisy, in case
of arm) sysctl override and #ifdef __mips__ in architecture neutral
code.
 1.36 17-May-2015  matt machine_arch on mips depends on the ABI so we need a routine to return
the right value.
 1.35 13-Jun-2014  joerg branches: 1.35.4;
Rename stack gap arguments.
 1.34 16-May-2014  martin Get rid of all sysc_init_field uses - initialize fields directly in C99
notation.
 1.33 20-Jan-2012  joerg branches: 1.33.6; 1.33.10; 1.33.20;
Change CMSG_SPACE and CMSG_LEN to provide Integer Constant Expressions
again. This was changed in sys/socket.h r1.51 to work around fallout
from the IPv6 aux data migration. It broke the historic ABI on some
platforms. This commit restores compatibility for netbsd32 code on such
platforms and provides a template for future changes to the CMSG_*
alignment. Revert PCC/Clang workarounds in postfix and tmux.
 1.32 23-May-2011  joerg branches: 1.32.4; 1.32.8;
Use __UNCONST to get rid of const
 1.31 23-Apr-2010  rmind branches: 1.31.2;
Replace M_IOV and some malloc(9)s with kmem(9), and while there:
- Fix invalid free (M_TEMP vs M_IOV) in do_sys_recvmsg(), spotted by jakllsch@.
Also, same fix in osf1_sys_sendmsg_xopen().
- Fix attempt to free non-allocated memory in error path in netbsd32___getfh30().
- Plug a memory leak in compat_43_netbsd32_orecvmsg().
 1.30 11-Jan-2009  christos branches: 1.30.4; 1.30.6;
merge christos-time_t
 1.29 19-Nov-2008  ad branches: 1.29.4;
Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.28 07-Jan-2008  ad branches: 1.28.6; 1.28.10; 1.28.12; 1.28.16; 1.28.18;
Patch up sysctl locking:

- Lock processes, credentials, filehead etc correctly.
- Acquire a read hold on sysctl_treelock if only doing a query.
- Don't wire down the output buffer. It doesn't work correctly and the code
regularly does long term sleeps with it held - it's not worth it.
- Don't hold locks other than sysctl_lock while doing copyout().
- Drop sysctl_lock while doing copyout / allocating memory in a few places.
- Don't take kernel_lock for sysctl.
- Fix a number of bugs spotted along the way
 1.27 20-Dec-2007  dsl Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.26 08-Dec-2007  dsl branches: 1.26.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.25 15-Aug-2007  ad branches: 1.25.2; 1.25.8; 1.25.10;
Changes to make ktrace LKM friendly and reduce ifdef KTRACE. Proposed
on tech-kern.
 1.24 18-Mar-2007  dsl branches: 1.24.4; 1.24.8;
Change all the NETBSD32PTR64(SCARG(uap, xxx))) to SCARG_P32(uap, xxx).
 1.23 09-Feb-2007  ad branches: 1.23.2; 1.23.6; 1.23.8; 1.23.10;
Merge newlock2 to head.
 1.22 23-Sep-2006  manu Add sysctl tracing to emulations.
While we are there, fix a bug in FreeBSD sysctl emulation: use copyin for
moving data to the kernel
 1.21 11-Dec-2005  christos branches: 1.21.20; 1.21.22;
merge ktrace-lwp.
 1.20 19-Aug-2005  christos Fix lossage I created with the 64 bit ino_t change.
 1.19 03-Jul-2005  cube branches: 1.19.2;
Constify machine32 and machine_arch32.
 1.18 03-Jul-2005  cube Make COMPAT_NETBSD32 emulate hw.machine. While it might seem wrong to do
so, it introduces breakage because a lot of applications make assumptions
from its value. It's especially bad in the sparc64 case, where 64-bits
instructions can be used in 32-bits addressing mode. However, there are
other means to know the capabilities of the CPU.
 1.17 22-Jun-2005  atatat Also fix (wrt the new const stuff) the one user of sysctl_locate()
outside of the main sysctl code.
 1.16 20-Jun-2005  atatat Change the rest of the sysctl subsystem to use const consistently.
The __UNCONST macro is now used only where necessary and the RW macros
are gone. Most of the changes here are consumers of the
sysctl_createv(9) interface that now takes a pair of const pointers
which used not to be.
 1.15 27-Apr-2004  atatat Be consistent about using sysc_init_field()
 1.14 24-Mar-2004  atatat branches: 1.14.2;
Tango on sysctl_createv() and flags. The flags have all been renamed,
and sysctl_createv() now uses more arguments.
 1.13 09-Mar-2004  atatat I obviously put this (__SYSCTL_PRIVATE) here, but I have no
recollection of what it was for and it's now just useless, so it goes.
 1.12 04-Dec-2003  atatat Dynamic sysctl.

Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.

Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.

All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.

PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
 1.11 21-Oct-2003  fvdl Fix some int vs. NULL comparisons.
 1.10 29-Jun-2003  fvdl branches: 1.10.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.9 29-Jun-2003  martin struct proc * -> struct lwp *
 1.8 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.7 23-Oct-2002  scw In preparation for COMPAT_NETBSD32 on SH-5:

- The MD netbsd32_machdep.h header now defines the 32-bit pointer type
instead of using u_int32_t everywhere,
- The MD netbsd32_machdep.h header now defines a macro (at least on
current implementations) which converts a 32-bit pointer to its 64-bit
equivalent,
- Change the MI code to utilise the above two items in all the right places,
- Implement netbsd32___sigaction_sigtramp().

Tested on Sparc64 by Matt Green.
 1.6 14-Jun-2002  eeh Provide the correct architecture for HW_MACHINE_ARCH so things like
"sysctl -p" can tell they are in 32-bit land.
 1.5 14-Feb-2002  chs branches: 1.5.4; 1.5.8; 1.5.10;
allow writing to write-only mappings. fixes PR 3493.
 1.4 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.3 30-May-2001  mrg branches: 1.3.2;
use _KERNEL_OPT.
 1.2 15-Mar-2001  chs eliminate the KERN_* error codes in favor of the traditional E* codes.
the mapping is:

KERN_SUCCESS 0
KERN_INVALID_ADDRESS EFAULT
KERN_PROTECTION_FAILURE EACCES
KERN_NO_SPACE ENOMEM
KERN_INVALID_ARGUMENT EINVAL
KERN_FAILURE various, mostly turn into KASSERTs
KERN_RESOURCE_SHORTAGE ENOMEM
KERN_NOT_RECEIVER <unused>
KERN_NO_ACCESS <unused>
KERN_PAGES_LOCKED <unused>
 1.1 08-Feb-2001  mrg branches: 1.1.2; 1.1.4;
split up netbsd32_netbsd.c into 9 new files, leaving only those syscalls that
have no special interpretations besides simple syscall args conversion.
 1.1.4.8 11-Nov-2002  nathanw Catch up to -current
 1.1.4.7 23-Aug-2002  petrov lwpification.
 1.1.4.6 20-Jun-2002  nathanw Catch up to -current.
 1.1.4.5 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.1.4.4 28-Feb-2002  nathanw Catch up to -current.
 1.1.4.3 14-Nov-2001  nathanw Catch up to -current.
 1.1.4.2 21-Jun-2001  nathanw Catch up to -current.
 1.1.4.1 09-Apr-2001  nathanw Catch up with -current.
 1.1.2.3 27-Mar-2001  bouyer Sync with HEAD.
 1.1.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.1.2.1 08-Feb-2001  bouyer file netbsd32_sysctl.c was added on branch thorpej_scsipi on 2001-02-11 19:14:21 +0000
 1.3.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.3.2.2 16-Mar-2002  jdolecek Catch up with -current.
 1.3.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.5.10.1 15-Jun-2002  lukem Pull up revision 1.6 (requested by eeh in ticket #275):
Provide the correct architecture for HW_MACHINE_ARCH so things like
"sysctl -p" can tell they are in 32-bit land.
 1.5.8.1 20-Jun-2002  gehenna catch up with -current.
 1.5.4.1 11-Mar-2002  thorpej Convert sysctl_memlock to an adaptive mutex.
 1.10.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.10.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.10.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.10.2.1 03-Aug-2004  skrll Sync with HEAD
 1.14.2.1 29-Apr-2004  jmc Pullup rev 1.15 (requested by atatat in ticket #206)

Be consistent about using sysc_init_field()
 1.19.2.5 21-Jan-2008  yamt sync with head
 1.19.2.4 03-Sep-2007  yamt sync with head.
 1.19.2.3 26-Feb-2007  yamt sync with head.
 1.19.2.2 30-Dec-2006  yamt sync with head.
 1.19.2.1 21-Jun-2006  yamt sync with head.
 1.21.22.1 22-Oct-2006  yamt sync with head
 1.21.20.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.21.20.1 18-Nov-2006  ad Sync with head.
 1.23.10.1 29-Mar-2007  reinoud Pullup to -current
 1.23.8.1 11-Jul-2007  mjf Sync with head.
 1.23.6.2 20-Aug-2007  ad Sync with HEAD.
 1.23.6.1 10-Apr-2007  ad Sync with head.
 1.23.2.1 24-Mar-2007  yamt sync with head.
 1.24.8.2 09-Dec-2007  jmcneill Sync with HEAD.
 1.24.8.1 16-Aug-2007  jmcneill Sync with HEAD.
 1.24.4.1 03-Sep-2007  skrll Sync with HEAD.
 1.25.10.1 26-Dec-2007  ad Sync with head.
 1.25.8.1 18-Feb-2008  mjf Sync with HEAD.
 1.25.2.1 09-Jan-2008  matt sync with HEAD
 1.26.4.2 08-Jan-2008  bouyer Sync with HEAD
 1.26.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.28.18.1 19-Jan-2009  skrll Sync with HEAD.
 1.28.16.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.28.12.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.28.12.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.28.10.2 11-Aug-2010  yamt sync with head.
 1.28.10.1 04-May-2009  yamt sync with head.
 1.28.6.1 17-Jan-2009  mjf Sync with HEAD.
 1.29.4.2 04-Jan-2009  christos add new syscalls.
 1.29.4.1 19-Nov-2008  christos file netbsd32_sysctl.c was added on branch christos-time_t on 2009-01-04 01:56:02 +0000
 1.30.6.2 31-May-2011  rmind sync with head
 1.30.6.1 30-May-2010  rmind sync with head
 1.30.4.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.31.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.32.8.1 18-Feb-2012  mrg merge to -current.
 1.32.4.1 17-Apr-2012  yamt sync with head
 1.33.20.1 10-Aug-2014  tls Rebase.
 1.33.10.1 18-May-2014  rmind sync with head
 1.33.6.2 03-Dec-2017  jdolecek update from HEAD
 1.33.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.35.4.1 06-Jun-2015  skrll Sync with HEAD
 1.38.2.6 25-Jan-2019  pgoyette Revert previous change(s). There's no good reason to use the hook when
the required value is available locally (in the current module).

Thanks mrg@ for pointing this out.
 1.38.2.5 24-Jan-2019  pgoyette I must be getting tired - use the correct name of the hook
 1.38.2.4 24-Jan-2019  pgoyette I wrote this stuff, when will I ever learn to use MODULE_CALL_HOOK
instead of MODULE_HOOK_CALL ? :)
 1.38.2.3 24-Jan-2019  pgoyette Use the hook to get the value of machine32
 1.38.2.2 24-Jan-2019  pgoyette Found a couple other consumers of machine32 - adapt them to use the hook
 1.38.2.1 25-Jun-2018  pgoyette Sync with HEAD
 1.40.2.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.44.4.1 03-Apr-2021  thorpej Sync with HEAD.
 1.3 21-Mar-2020  pgoyette Restore code to sysctl_free() the compat32 shadow tree
 1.2 15-Mar-2020  pgoyette Use SYSCTL_SETUP mechanism to establish our sysctl tree, rather than
using explicit calls to netbsd32_sysctl_{init,fini}()
 1.1 19-Nov-2008  ad branches: 1.1.4; 1.1.6; 1.1.8; 1.1.10; 1.1.14; 1.1.78;
Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.1.78.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.1.14.2 04-May-2009  yamt sync with head.
 1.1.14.1 19-Nov-2008  yamt file netbsd32_sysctl.h was added on branch yamt-nfs-mp on 2009-05-04 08:12:25 +0000
 1.1.10.2 19-Jan-2009  skrll Sync with HEAD.
 1.1.10.1 19-Nov-2008  skrll file netbsd32_sysctl.h was added on branch nick-hppapmap on 2009-01-19 13:17:37 +0000
 1.1.8.2 17-Jan-2009  mjf Sync with HEAD.
 1.1.8.1 19-Nov-2008  mjf file netbsd32_sysctl.h was added on branch mjf-devfs2 on 2009-01-17 13:28:47 +0000
 1.1.6.2 19-Nov-2008  ad Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.1.6.1 19-Nov-2008  ad file netbsd32_sysctl.h was added on branch christos-time_t on 2008-11-19 18:36:06 +0000
 1.1.4.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.1.4.1 19-Nov-2008  haad file netbsd32_sysctl.h was added on branch haad-dm on 2008-12-13 01:14:03 +0000
 1.163 09-May-2025  martin PR 59352: netbsd32 compat for semtimedop(2): regen
 1.162 20-May-2024  christos branches: 1.162.2;
regen
 1.161 19-May-2024  christos regen
 1.160 01-May-2024  mlelstv Revert previous, the syscall needs to be enabled at runtime.

The compat_16 module just enables it for the "netbsd" emulation, but
nothing enables it yet for "netbsd32".
 1.159 30-Apr-2024  mlelstv Enable compat sigreturn system call.

The previous bug in netbsd32___sigaction_sigtramp hid the problem,
as it failed all but the first installation of a signal handler.
 1.158 30-Jul-2023  rin COMPAT_NETBSD32: Regen for syscalls.master,v 1.144
 1.157 30-Jul-2023  rin COMPANT_NETBSD32: Regen for syscalls.master,v 1.143
 1.156 29-Jul-2023  rin COMPAT_NETBSD32: Regen for syscalls.master,v 1.142
 1.155 20-Sep-2021  thorpej Regen for eventfd(2).
 1.154 20-Sep-2021  thorpej Regen for timerfd.
 1.153 10-Oct-2020  rin regen for getrandom(2)
 1.152 16-May-2020  christos Add ACL support for FFS. From FreeBSD.
 1.151 26-Apr-2020  thorpej Regen for native futex calls.
 1.150 22-Apr-2020  thorpej Regen for removal of _lwp_gettid(2).
 1.149 04-Apr-2020  thorpej branches: 1.149.2;
Regen for _lwp_gettid(2).
 1.148 12-Mar-2020  pgoyette regen
 1.147 07-Mar-2020  pgoyette Regen
 1.146 18-Jan-2020  pgoyette Regen generated files _after_ committing changes to the source file.

This gets the "Generated from" comments to use the new version number.

No functional change.
 1.145 18-Jan-2020  kamil Catch up after getpid/getgid/getuid changes in native ABI in 2008

getpid(), getuid() and getgid() used to call respectively sys_getpid(),
sys_getuid() and sys_getgid(). In the BSD4.3 compat mode there was a
fallback to call sys_getpid_with_ppid() and related functions.

In 2008 the compat ifdef was removed in sys/kern/syscalls.master r. 1.216.

For purity reasons we probably shall restore the NetBSD original behavior
and implement BSD4.3 one as a compat module, however it is not worth the
complexity.

Align the netbsd32 compat ABI to native ABI and call functions that return
two integers as in BSD4.3.
 1.144 04-Nov-2019  rin branches: 1.144.2;
regen
 1.143 04-Nov-2019  rin regen
 1.142 13-Oct-2019  christos regen
 1.141 22-Sep-2019  christos regen
 1.140 18-Jun-2019  christos branches: 1.140.2;
Regen
 1.139 18-Jun-2019  christos regen
 1.138 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.137 24-Dec-2018  mrg regen.
 1.136 24-Dec-2018  mrg move mmap(), compat 40 mount(), pipe() and getfh() into their own files
as the implementation is non trivial or is compat. mark old mount()
properly instead of manually #if'ing ito to ENOSYS.
 1.135 10-Aug-2018  pgoyette Regen
 1.134 31-Jul-2018  rjs regen.
 1.133 10-May-2018  christos branches: 1.133.2;
regen
 1.132 06-Jan-2018  kamil branches: 1.132.2;
Revert vadvise(2) removal

This system call was used in legacy Lisp code, that was inherited to modern
age and still compiled against supported compat layers (e.g. in clisp,
oaklisp, Franz Lisp).

It used to instruct the kernel about paging policy (G/C aware, flush etc).

Newly compiled code (assuming that it will detect vadvise()) will use the
libc stub for vadvise(). The headers for this interface are gone.

vadvise(2) could be marked as COMPAT_80, but as long as we support ultrix,
sunos or aout68k ABI, don't bother with this.

Requested by <mrg>
 1.131 19-Dec-2017  kamil Drop SYS_vadvise

The (o)vadvise syscall is dummy since the beginning of NetBSD.

It is an obsolete remnant from the old UNIX.

Sponsored by <The NetBSD Foundation>
 1.130 19-Dec-2017  kamil Drop SYS_sbrk

sbrk - change data segment size

This syscall is dummy since the inception of the project.

Sponsored by <The NetBSD Foundation>
 1.129 19-Dec-2017  kamil Drop the sstk(2) syscall stub

sstk - change stack section size

This functionality has never been implemented and is a remnant from 16-bit
UNIX. This stub appeared with the first NetBSD commit.

Sponsored by <The NetBSD Foundation>
 1.128 10-May-2017  riastradh branches: 1.128.2;
regen
 1.127 16-Jan-2017  christos branches: 1.127.4;
regen
 1.126 13-Jan-2017  christos branches: 1.126.2;
regen
 1.125 28-Oct-2016  christos regen
 1.124 19-Oct-2016  skrll Regen
 1.123 23-Sep-2016  skrll regen
 1.122 10-Sep-2016  skrll Regen
 1.121 03-Dec-2015  pgoyette branches: 1.121.2;
Regen syscall definitions - the compat_netbsd32 sysv-ipc stuff is now
modular and can be autoloaded when needed
 1.120 01-Dec-2015  pgoyette Regen for new compat_netbsd32_mqueue module
 1.119 01-Dec-2015  pgoyette Regen.
 1.118 01-Dec-2015  pgoyette Regen
 1.117 24-Sep-2015  christos regen
 1.116 23-Jun-2015  dholland regen
 1.115 22-Jun-2015  mrg add netbsd32 support for nfssvc(2). we do this by defining 5 copyin/out
functions that do all the ugly work, are just plain copyin/out for the
native system calls, and do the necessary translations for netbsd32.

with this i'm able to run 32 bit nfsd and mountd on 64 bit kernel and
mount the file systems remotely.
 1.114 21-Jun-2015  martin Regen (pset_*)
 1.113 21-Jun-2015  martin regen (versioned mq_* calls)
 1.112 20-Jun-2015  martin Regen (sigqueinfo, modctl, mq_*)
 1.111 16-Jun-2015  martin Regen for posix_fallocate and fdiscard
 1.110 07-Mar-2015  christos regen
 1.109 25-Feb-2015  christos regen
 1.108 13-Jun-2014  joerg branches: 1.108.2; 1.108.4;
Regnerate
 1.107 15-May-2014  njoly Regen for setcontext signature.
 1.106 30-Apr-2014  njoly Regen for netbsd32_off_t.
 1.105 17-Oct-2013  njoly branches: 1.105.2;
Regen for mknodat(2) device argument type change.
 1.104 29-Mar-2013  christos branches: 1.104.4;
regen
 1.103 02-Oct-2012  christos regen
 1.102 08-Apr-2012  martin branches: 1.102.2;
Regen (posix_spawn)
 1.101 10-Mar-2012  joerg P1003_1B_SEMAPHORE is no longer optional.
 1.100 08-Mar-2012  joerg Implement sem_timedwait.
 1.99 19-Feb-2012  rmind Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.
 1.98 01-Feb-2012  dholland branches: 1.98.2;
Regen syscalls with proper id info.
 1.97 01-Feb-2012  dholland Update compat_netbsd32 for new quotactl.
 1.96 31-Jan-2012  matt Regen.
 1.95 08-Nov-2011  njoly branches: 1.95.4;
Regen for kqueue1.
 1.94 31-Aug-2011  njoly branches: 1.94.2;
Regen for dup3.
 1.93 05-Jul-2011  njoly Regen for pipe2.
 1.92 06-Mar-2011  bouyer merge the bouyer-quota2 branch. This adds a new on-disk format
to store disk quota usage and limits, integrated with ffs
metadata. Usage is checked by fsck_ffs (no more quotacheck)
and is covered by the WAPBL journal. Enabled with kernel
option QUOTA2 (added where QUOTA was enabled in kernel config files),
turned on with tunefs(8) on a per-filesystem
basis. mount_mfs(8) can also turn quotas on.

See http://mail-index.netbsd.org/tech-kern/2011/02/19/msg010025.html
for details.
 1.91 02-Mar-2010  pooka branches: 1.91.2; 1.91.4; 1.91.6;
regen:
- remove nfssvc / fs_nfs.h / #ifdef NFS
- make getfh unconditional
 1.90 02-Mar-2010  pooka regen for conditional lfs syscall removal
 1.89 14-Dec-2009  matt branches: 1.89.2;
Regen (new makesyscalls.sh)
 1.88 14-Dec-2009  matt Merge from matt-nb5-mips64
 1.87 17-May-2009  pooka regen: pad -> PAD
 1.86 16-Mar-2009  njoly Regen for netbsd32_dev_t.
 1.85 26-Feb-2009  christos Regen
 1.84 13-Jan-2009  pooka branches: 1.84.2;
Regen to prove I didn't screw up the conversion: purely RCSID changes.
 1.83 13-Jan-2009  pooka regen: UNIMPL police
 1.82 11-Jan-2009  christos merge christos-time_t
 1.81 22-Nov-2008  mrg branches: 1.81.4;
regenerate
 1.80 19-Nov-2008  ad Regen.
 1.79 14-Nov-2008  ad Regen.
 1.78 12-Nov-2008  ad Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.
 1.77 15-Oct-2008  wrstuden branches: 1.77.2; 1.77.4;
Merge wrstuden-revivesa into HEAD.
 1.76 24-Apr-2008  ad branches: 1.76.2; 1.76.4; 1.76.8;
Regen.
 1.75 24-Feb-2008  martin branches: 1.75.2;
Regen (old posix_fadvise ignored)
 1.74 27-Jan-2008  martin branches: 1.74.2; 1.74.6;
Regen (posix_fadvise versionend)
 1.73 26-Jan-2008  dsl regen
 1.72 19-Jan-2008  dsl Regen for netbsd32_mremap
 1.71 20-Dec-2007  dsl regen
 1.70 17-Dec-2007  dsl Regen without any 'const' members of the syscall argument structures.
 1.69 07-Dec-2007  ad branches: 1.69.4;
Reg... hang on, why don't we build this at compile time?!?
 1.68 09-Nov-2007  dsl branches: 1.68.2;
Regen
 1.67 15-Aug-2007  ad branches: 1.67.2; 1.67.6; 1.67.8;
Regen.
 1.66 07-Aug-2007  ad Regen.
 1.65 04-Mar-2007  christos branches: 1.65.2; 1.65.6; 1.65.10; 1.65.14;
fix fallout from caddr_t changes.
 1.64 19-Feb-2007  cube Regen (a few MPSAFE additions).
 1.63 18-Feb-2007  cube Regen (missing lwp syscalls).
 1.62 09-Feb-2007  ad branches: 1.62.2;
Merge newlock2 to head.
 1.61 09-Nov-2006  cube Regen (PR#34951 fixes).
 1.60 01-Sep-2006  matt branches: 1.60.2; 1.60.4;
Regen.
 1.59 30-Aug-2006  cube Regen (netbsd32_ptrace protection).
 1.58 31-Jul-2006  martin Make filehandles opaque to userland
 1.57 13-Jul-2006  pavel regen.
 1.56 13-Jul-2006  martin regen
 1.55 13-Jul-2006  martin Fix alignement problems for fhandle_t, exposed by gcc4.1.

While touching all vptofh/fhtovp functions, get rid of VFS_MAXFIDSIZ,
version the getfh(2) syscall and explicitly pass the size available in
the filehandle from userland.

Discussed on tech-kern, with lots of help from yamt (thanks!).
 1.54 26-Jun-2006  mrg regenerate.
 1.53 31-May-2006  drochner branches: 1.53.2;
regen
 1.52 29-May-2006  drochner regen
 1.51 05-May-2006  cube branches: 1.51.2;
Regen (fhstat versioning, posix_fadvise).
 1.50 29-Mar-2006  cube Regen (_lwp*, sa_*).
 1.49 06-Mar-2006  cube branches: 1.49.2; 1.49.4;
Regen (SysV IPC).
 1.48 05-Mar-2006  cube branches: 1.48.2;
Regen (ksem_*).
 1.47 11-Dec-2005  christos branches: 1.47.4; 1.47.6;
merge ktrace-lwp.
 1.46 23-Oct-2005  cube Regen (kqueue, kevent).
 1.45 19-Aug-2005  christos branches: 1.45.2;
Fix lossage I created with the 64 bit ino_t change.
 1.44 23-Jul-2005  cube Regen (__sigtimedwait(2)).
 1.43 23-Jul-2005  cube Regen (timer_create(2) and friends).
 1.42 12-Jul-2005  cube Regen (*xattr(2)).
 1.41 11-Jul-2005  cube Regen (rasctl(2)).
 1.40 10-Jul-2005  cube Regen.
 1.39 10-Jul-2005  cube Regen.
 1.38 09-Jul-2005  cube Regen.
 1.37 08-Jul-2005  cube Regen.
 1.36 08-Jul-2005  cube Regen
 1.35 04-Jul-2005  cube branches: 1.35.2;
Regen
 1.34 30-May-2005  chs regen
 1.33 26-Feb-2005  perry regen
 1.32 17-Jun-2004  cube branches: 1.32.4; 1.32.6;
Regen.
 1.31 25-Oct-2003  chs regen
 1.30 13-Oct-2003  fvdl Implement 32bit get/setcontext entry points.
 1.29 18-Jan-2003  thorpej branches: 1.29.2;
Regen for correct RCS ID.
 1.28 18-Jan-2003  thorpej Regen: Merge the nathanw_sa branch.
 1.27 01-Nov-2002  jdolecek set nsysent to 512
 1.26 23-Oct-2002  scw Regen to pick up netbsd32___sigaction_sigtramp addition.
 1.25 29-Apr-2002  mrg regenerate.
 1.24 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.23 30-May-2001  mrg branches: 1.23.2;
use _KERNEL_OPT.
 1.22 10-Apr-2001  kleink Regen.
 1.21 02-Feb-2001  mrg branches: 1.21.2;
regen
 1.20 27-Jan-2001  thorpej Regen; getpid(2) is MP-safe.
 1.19 27-Jan-2001  thorpej Regen; add sy_flags.
 1.18 09-Dec-2000  mycroft Regen.
 1.17 30-Nov-2000  jdolecek always include netbsd32_ntp_adjtime(), LKMify
 1.16 18-Aug-2000  cgd update for changed makesyscalls.master
 1.15 07-Aug-2000  bjh21 Second phase of changes to remove ntp_adjtime(2) from the kernel entirely if
NTP is not defined.

Also removes sysctl_ntptime, since that's unreferenced without NTP.

ntp_gettime(2) is left alone, since it doesn't raise SIGSYS, which sys_nosys()
does.
 1.14 09-Jul-2000  mrg regen
 1.13 31-Jan-2000  christos Regen
 1.12 30-Dec-1999  eeh Update to 32-bit compatibility routines.
 1.11 11-Oct-1999  eeh branches: 1.11.2;
Add netbsd32_compat_14.c

Rename everything from compat_netbsd32 -> netbsd32 so we don't have silly
names like compat_14_compat_netbsd32_sys_shmctl().
 1.10 09-Jun-1999  christos branches: 1.10.2;
Regen
 1.9 25-Mar-1999  mrg branches: 1.9.4;
regen
 1.8 25-Mar-1999  mrg move sparc32 to netbsd32; split out MD part (signal handling) (mostly via repository copy, rename and perl -pi :-)
 1.7 25-Mar-1999  mrg regen
 1.6 10-Dec-1998  christos Regen
 1.5 19-Oct-1998  tron Regen.
 1.4 01-Oct-1998  eeh Overhaul. Now will run simple things like /bin/sh and /bin/echo.
 1.3 26-Aug-1998  mrg regen.
 1.2 26-Aug-1998  mrg regen
 1.1 26-Aug-1998  mrg add a 32-bit compatibility module for the sparc64 port, so it can run NetBSD/sparc binaries with a LP64 kernel.
 1.9.4.2 02-Aug-1999  thorpej Regen.
 1.9.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.10.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.11.2.5 21-Apr-2001  bouyer Sync with HEAD
 1.11.2.4 11-Feb-2001  bouyer Sync with HEAD.
 1.11.2.3 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.11.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.11.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.21.2.5 11-Nov-2002  nathanw Catch up to -current
 1.21.2.4 20-Jun-2002  nathanw Catch up to -current.
 1.21.2.3 29-May-2002  nathanw Regen.
 1.21.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.21.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.23.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.23.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.29.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.29.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.29.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.29.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.29.2.1 03-Aug-2004  skrll Sync with HEAD
 1.32.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.32.4.1 29-Apr-2005  kent sync with -current
 1.35.2.8 27-Feb-2008  yamt sync with head.
 1.35.2.7 04-Feb-2008  yamt sync with head.
 1.35.2.6 21-Jan-2008  yamt sync with head
 1.35.2.5 15-Nov-2007  yamt sync with head.
 1.35.2.4 03-Sep-2007  yamt sync with head.
 1.35.2.3 26-Feb-2007  yamt sync with head.
 1.35.2.2 30-Dec-2006  yamt sync with head.
 1.35.2.1 21-Jun-2006  yamt sync with head.
 1.45.2.1 26-Oct-2005  yamt sync with head
 1.47.6.2 01-Jun-2006  kardel Sync with head.
 1.47.6.1 22-Apr-2006  simonb Sync with head.
 1.47.4.1 09-Sep-2006  rpaulo sync with head
 1.48.2.7 03-Sep-2006  yamt sync with head.
 1.48.2.6 11-Aug-2006  yamt sync with head
 1.48.2.5 26-Jun-2006  yamt sync with head.
 1.48.2.4 24-May-2006  yamt sync with head.
 1.48.2.3 01-Apr-2006  yamt sync with head.
 1.48.2.2 13-Mar-2006  yamt sync with head.
 1.48.2.1 05-Mar-2006  yamt file netbsd32_sysent.c was added on branch yamt-pdpolicy on 2006-03-13 09:07:08 +0000
 1.49.4.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.49.4.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.49.2.2 11-May-2006  elad sync with head
 1.49.2.1 19-Apr-2006  elad sync with head.
 1.51.2.1 19-Jun-2006  chap Sync with head.
 1.53.2.1 13-Jul-2006  gdamore Merge from HEAD.
 1.60.4.1 10-Dec-2006  yamt sync with head.
 1.60.2.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.60.2.1 18-Nov-2006  ad Sync with head.
 1.62.2.2 12-Mar-2007  rmind Sync with HEAD.
 1.62.2.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.65.14.4 09-Dec-2007  jmcneill Sync with HEAD.
 1.65.14.3 11-Nov-2007  joerg Sync with HEAD.
 1.65.14.2 16-Aug-2007  jmcneill Sync with HEAD.
 1.65.14.1 09-Aug-2007  jmcneill Sync with HEAD.
 1.65.10.2 03-Sep-2007  skrll Sync with HEAD.
 1.65.10.1 15-Aug-2007  skrll Sync with HEAD.
 1.65.6.1 09-Dec-2007  reinoud Pullup to HEAD
 1.65.2.1 20-Aug-2007  ad Sync with HEAD.
 1.67.8.4 18-Feb-2008  mjf Sync with HEAD.
 1.67.8.3 27-Dec-2007  mjf Sync with HEAD.
 1.67.8.2 08-Dec-2007  mjf Sync with HEAD.
 1.67.8.1 19-Nov-2007  mjf Sync with HEAD.
 1.67.6.1 13-Nov-2007  bouyer Sync with HEAD
 1.67.2.2 23-Mar-2008  matt sync with HEAD
 1.67.2.1 09-Jan-2008  matt sync with HEAD
 1.68.2.2 26-Dec-2007  ad Sync with head.
 1.68.2.1 08-Dec-2007  ad Sync with head.
 1.69.4.2 20-Jan-2008  bouyer Sync with HEAD
 1.69.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.74.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.74.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.74.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.74.2.1 24-Mar-2008  keiichi sync with head.
 1.75.2.1 18-May-2008  yamt sync with head.
 1.76.8.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.76.8.1 19-Oct-2008  haad Sync with HEAD.
 1.76.4.3 28-Sep-2008  skrll Missed this one in the regen.
 1.76.4.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.76.4.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.76.2.3 11-Mar-2010  yamt sync with head
 1.76.2.2 20-Jun-2009  yamt sync with head
 1.76.2.1 04-May-2009  yamt sync with head.
 1.77.4.1 25-Nov-2008  snj branches: 1.77.4.1.4;
Regen for ticket 121.
 1.77.4.1.4.2 12-Sep-2009  matt Regen.
 1.77.4.1.4.1 12-Sep-2009  matt Regen.
 1.77.2.3 28-Apr-2009  skrll Sync with HEAD.
 1.77.2.2 03-Mar-2009  skrll Sync with HEAD.
 1.77.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.81.4.3 04-Jan-2009  christos fix module build.
 1.81.4.2 04-Jan-2009  christos add new syscalls.
 1.81.4.1 22-Nov-2008  christos file netbsd32_sysent.c was added on branch christos-time_t on 2009-01-04 01:56:02 +0000
 1.84.2.2 23-Jul-2009  jym Sync with HEAD.
 1.84.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.89.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.91.6.2 09-Feb-2011  bouyer Regen
 1.91.6.1 20-Jan-2011  bouyer Snapshot of work in progress on a modernised disk quota system:
- new quotactl syscall (versionned for backward compat), which takes
as parameter a path to a mount point, and a prop_dictionary
(in plistref format) describing commands and arguments.
For each command, status and data are returned as a prop_dictionary.
quota commands features will be added to take advantage of this,
exporting quota data or getting quota commands as plists.

- new on disk-format storage (all 64bit wide), integrated to metadata for
ffs (and playing nicely with wapbl).
Quotas are enabled on a ffs filesystem via superblock flags.
tunefs(8) can enable or disable quotas.
On a quota-enabled filesystem, fsck_ffs(8) will track per-uid/gid
block and inode usages, and will check and update quotas in Pass 6.
quota usage and limits are stored in unliked files (one for users,
one for groups)l fsck_ffs(8) will create the files if needed, or
free them if needed. This means that after enabling or disabling
quotas on a filesystem; a fsck_ffs(8) run is required.
quotacheck(8) is not needed any more, on a unclean shutdown
fsck or journal replay will take care of fixing quotas.
newfs(8) can create a ready-to-mount quota-enabled filesystem
(superblock flags are set and quota inodes are created).
Other new features or semantic changes:
- default quota datas, applied to users or groups which don't already
have a quota entry
- per-user/group grace time (instead of a filesystem global one)
- 0 really means "nothing allowed at all", not "no limit".
If you want "no limit", set the limit to UQUAD_MAX (tools will
understand "unlimited" and "-")

A quota file is structured as follow:
it starts with a header, containing a few per-filesystem values,
and the default quota limits.
Quota entries are linked together as a simple list, each entry has a
pointer (as an offset withing the file) to the next.
The header has a pointer to a list of free quota entries, and
a hash table of in-use entries. The size of the hash table depends
on the filesystem block size (header+hash table should fit in the
first block). The file is not sparse and is a multiple of
filesystem block size (when the free quota entry list is empty a new
filesystem block is allocated). quota entries to not cross
filesystem block boundaries.

In memory, the kernel keeps a cache of recently used quota entries
as a reference to the block number, and offset withing the block.
The quota entry itself is keept in the buf cache.

fsck_ffs(8), tunefs(8) and newfs(8) supports are completed (with
related atf tests :)
The kernel can update disk usage and report it via quotactl(2).

Todo: enforce quotas limits (limits are not checked by kernel yet)
update repquota, edquota and rpc.rquotad to the new world
implement compat_50_quotactl ioctl.
update quotactl(2) man page

fsck_ffs required fixes so that allocating new blocks or inodes will
properly update the superblock and cg sumaries. This was not an issue up
to now because superblock and cg sumaries check happened last, but now
allocations or frees can happen in pass 6.
 1.91.4.1 06-Jun-2011  jruoho Sync with HEAD.
 1.91.2.1 21-Apr-2011  rmind sync with head
 1.94.2.4 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.94.2.3 30-Oct-2012  yamt sync with head
 1.94.2.2 17-Apr-2012  yamt sync with head
 1.94.2.1 10-Nov-2011  yamt sync with head
 1.95.4.4 29-Apr-2012  mrg sync to latest -current.
 1.95.4.3 11-Mar-2012  mrg sync to latest -current
 1.95.4.2 24-Feb-2012  mrg sync to -current.
 1.95.4.1 18-Feb-2012  mrg merge to -current.
 1.98.2.2 14-Apr-2015  msaitoh Pull up following revision(s) (requested by khorben in ticket #1264):

include/unistd.h 1.144
sys/kern/init_sysent.c regen
sys/kern/syscalls.c regen
sys/kern/syscalls.master 1.272
sys/rump/include/rump/rump_syscalls.h regen
sys/rump/librump/rumpkern/rump_syscalls.c regen
sys/sys/syscall.h regen
sys/sys/syscallargs.h regen
sys/compat/netbds32/netbsd32_syscall.h regen
sys/compat/netbds32/netbsd32_syscallargs.h regen
sys/compat/netbds32/netbsd32_syscalls.c regen
sys/compat/netbds32/netbsd32_sysent.c regen
sys/compat/netbsd32/syscalls.master 1.102

Fix return type of the readlinkat(2) syscall. PR#49684.
 1.98.2.1 12-Apr-2012  riz Regen for ticket 175.
 1.102.2.4 03-Dec-2017  jdolecek update from HEAD
 1.102.2.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.102.2.2 23-Jun-2013  tls resync from head
 1.102.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.104.4.1 18-May-2014  rmind sync with head
 1.105.2.1 10-Aug-2014  tls Rebase.
 1.108.4.5 05-Dec-2016  skrll Sync with HEAD
 1.108.4.4 05-Oct-2016  skrll Sync with HEAD
 1.108.4.3 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.108.4.2 22-Sep-2015  skrll Sync with HEAD
 1.108.4.1 06-Apr-2015  skrll Sync with HEAD
 1.108.2.4 04-Nov-2019  martin Regen for ticket #1711
 1.108.2.3 06-Nov-2015  martin regen
 1.108.2.2 04-Nov-2015  riz Pull up following revision(s) (requested by mrg in ticket #956):
sys/compat/netbsd32/files.netbsd32: revision 1.36
sys/compat/netbsd32/netbsd32_sysent.c: revision 1.115
sys/compat/netbsd32/netbsd32_syscallargs.h: revision 1.116
sys/nfs/nfs_var.h: revision 1.93
sys/compat/netbsd32/netbsd32_conv.h: revision 1.30
sys/compat/netbsd32/netbsd32_syscall.h: revision 1.116
sys/compat/netbsd32/netbsd32_syscalls.c: revision 1.115
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.1
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.3
sys/nfs/nfs_syscalls.c: revision 1.156
sys/compat/netbsd32/syscalls.master: revision 1.108
sys/compat/netbsd32/netbsd32.h: revision 1.107
add netbsd32 support for nfssvc(2). we do this by defining 5 copyin/out
functions that do all the ugly work, are just plain copyin/out for the
native system calls, and do the necessary translations for netbsd32.
with this i'm able to run 32 bit nfsd and mountd on 64 bit kernel and
mount the file systems remotely.
don't copy the first netbsd32_export_args nexports times, but actually
advance the userland pointer each entry through the loop. oops.
 1.108.2.1 07-Mar-2015  snj regen for ticket 560
 1.121.2.2 20-Mar-2017  pgoyette Sync with HEAD
 1.121.2.1 04-Nov-2016  pgoyette Sync with HEAD
 1.126.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.127.4.1 11-May-2017  pgoyette Sync with HEAD
 1.128.2.1 04-Nov-2019  martin Regen for ticket #398
 1.132.2.17 09-Jan-2019  pgoyette Regen - otherwise compat_40_mount() is wrongly included in sysent.c

Missed this during earlier conflict resolution.
 1.132.2.16 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.132.2.15 29-Sep-2018  pgoyette Regen
 1.132.2.14 29-Sep-2018  pgoyette Regen
 1.132.2.13 14-Sep-2018  pgoyette Regen
 1.132.2.12 14-Sep-2018  pgoyette Regen
 1.132.2.11 13-Sep-2018  pgoyette Regen
 1.132.2.10 12-Sep-2018  pgoyette Regen
 1.132.2.9 12-Sep-2018  pgoyette Regen
 1.132.2.8 12-Sep-2018  pgoyette regen
 1.132.2.7 12-Sep-2018  pgoyette Regen with updated module information for ntp 30 and 50 compat calls
 1.132.2.6 11-Sep-2018  pgoyette Regen
 1.132.2.5 11-Sep-2018  pgoyette And regen again
 1.132.2.4 11-Sep-2018  pgoyette Regen
 1.132.2.3 11-Sep-2018  pgoyette Regen syscall files and fix includes for syscallvar.h
 1.132.2.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.132.2.1 21-May-2018  pgoyette Sync with HEAD
 1.133.2.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.133.2.1 10-Jun-2019  christos Sync with HEAD
 1.140.2.2 08-Mar-2020  martin Regen (for ticket #761)
 1.140.2.1 04-Nov-2019  martin Regen for ticket #398
 1.144.2.1 25-Jan-2020  ad Sync with head.
 1.149.2.1 25-Apr-2020  bouyer Sync with bouyer-xenpvh-base2 (HEAD)
 1.162.2.1 02-Aug-2025  perseant Sync with HEAD
 1.55 09-May-2025  martin PR 59352: netbsd32 compat for semtimedop(2): regen
 1.54 20-May-2024  christos branches: 1.54.2;
regen
 1.53 19-May-2024  christos regen
 1.52 30-Jul-2023  rin COMPAT_NETBSD32: Regen for syscalls.master,v 1.144
 1.51 30-Jul-2023  rin COMPANT_NETBSD32: Regen for syscalls.master,v 1.143
 1.50 29-Jul-2023  rin COMPAT_NETBSD32: Regen for syscalls.master,v 1.142
 1.49 20-Sep-2021  thorpej Regen for eventfd(2).
 1.48 20-Sep-2021  thorpej Regen for timerfd.
 1.47 14-Apr-2021  christos regen
 1.46 13-Apr-2021  christos regen
 1.45 10-Oct-2020  rin branches: 1.45.4;
regen for getrandom(2)
 1.44 16-May-2020  christos Add ACL support for FFS. From FreeBSD.
 1.43 26-Apr-2020  thorpej Regen for native futex calls.
 1.42 22-Apr-2020  thorpej Regen for removal of _lwp_gettid(2).
 1.41 04-Apr-2020  thorpej branches: 1.41.2;
Regen for _lwp_gettid(2).
 1.40 12-Mar-2020  pgoyette regen
 1.39 07-Mar-2020  pgoyette Regen
 1.38 18-Jan-2020  pgoyette Regen generated files _after_ committing changes to the source file.

This gets the "Generated from" comments to use the new version number.

No functional change.
 1.37 18-Jan-2020  kamil Catch up after getpid/getgid/getuid changes in native ABI in 2008

getpid(), getuid() and getgid() used to call respectively sys_getpid(),
sys_getuid() and sys_getgid(). In the BSD4.3 compat mode there was a
fallback to call sys_getpid_with_ppid() and related functions.

In 2008 the compat ifdef was removed in sys/kern/syscalls.master r. 1.216.

For purity reasons we probably shall restore the NetBSD original behavior
and implement BSD4.3 one as a compat module, however it is not worth the
complexity.

Align the netbsd32 compat ABI to native ABI and call functions that return
two integers as in BSD4.3.
 1.36 04-Nov-2019  rin branches: 1.36.2;
regen
 1.35 04-Nov-2019  rin regen
 1.34 13-Oct-2019  christos regen
 1.33 22-Sep-2019  christos regen
 1.32 18-Jun-2019  christos branches: 1.32.2;
Regen
 1.31 18-Jun-2019  christos regen
 1.30 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.29 24-Dec-2018  mrg regen.
 1.28 24-Dec-2018  mrg move mmap(), compat 40 mount(), pipe() and getfh() into their own files
as the implementation is non trivial or is compat. mark old mount()
properly instead of manually #if'ing ito to ENOSYS.
 1.27 10-Aug-2018  pgoyette Regen
 1.26 31-Jul-2018  rjs regen.
 1.25 10-May-2018  christos branches: 1.25.2;
regen
 1.24 06-Jan-2018  kamil branches: 1.24.2;
Revert vadvise(2) removal

This system call was used in legacy Lisp code, that was inherited to modern
age and still compiled against supported compat layers (e.g. in clisp,
oaklisp, Franz Lisp).

It used to instruct the kernel about paging policy (G/C aware, flush etc).

Newly compiled code (assuming that it will detect vadvise()) will use the
libc stub for vadvise(). The headers for this interface are gone.

vadvise(2) could be marked as COMPAT_80, but as long as we support ultrix,
sunos or aout68k ABI, don't bother with this.

Requested by <mrg>
 1.23 19-Dec-2017  kamil Drop SYS_vadvise

The (o)vadvise syscall is dummy since the beginning of NetBSD.

It is an obsolete remnant from the old UNIX.

Sponsored by <The NetBSD Foundation>
 1.22 19-Dec-2017  kamil Drop SYS_sbrk

sbrk - change data segment size

This syscall is dummy since the inception of the project.

Sponsored by <The NetBSD Foundation>
 1.21 19-Dec-2017  kamil Drop the sstk(2) syscall stub

sstk - change stack section size

This functionality has never been implemented and is a remnant from 16-bit
UNIX. This stub appeared with the first NetBSD commit.

Sponsored by <The NetBSD Foundation>
 1.20 19-Dec-2017  kamil Sync syscalls.master in compat_netbsd32(8) with kern/syscalls.master

___lwp_part60 removed 'const' from the ts argument.

'const struct timespec *ts' -> 'struct timespec *ts'

Sponsored by <The NetBSD Foundation>
 1.19 10-May-2017  riastradh branches: 1.19.2; 1.19.8;
regen
 1.18 16-Jan-2017  christos branches: 1.18.4;
regen
 1.17 13-Jan-2017  christos branches: 1.17.2;
regen
 1.16 28-Oct-2016  christos regen
 1.15 19-Oct-2016  skrll Regen
 1.14 23-Sep-2016  skrll regen
 1.13 10-Sep-2016  skrll Regen
 1.12 03-Dec-2015  pgoyette branches: 1.12.2;
Regen syscall definitions - the compat_netbsd32 sysv-ipc stuff is now
modular and can be autoloaded when needed
 1.11 01-Dec-2015  pgoyette Regen for new compat_netbsd32_mqueue module
 1.10 01-Dec-2015  pgoyette Regen.
 1.9 01-Dec-2015  pgoyette Regen
 1.8 24-Sep-2015  christos regen
 1.7 23-Jun-2015  dholland regen
 1.6 22-Jun-2015  mrg add netbsd32 support for nfssvc(2). we do this by defining 5 copyin/out
functions that do all the ugly work, are just plain copyin/out for the
native system calls, and do the necessary translations for netbsd32.

with this i'm able to run 32 bit nfsd and mountd on 64 bit kernel and
mount the file systems remotely.
 1.5 21-Jun-2015  martin Regen (pset_*)
 1.4 21-Jun-2015  martin regen (versioned mq_* calls)
 1.3 20-Jun-2015  martin Regen (sigqueinfo, modctl, mq_*)
 1.2 16-Jun-2015  martin Regen for posix_fallocate and fdiscard
 1.1 07-Mar-2015  christos branches: 1.1.2;
regen
 1.1.2.6 05-Feb-2017  skrll Sync with HEAD
 1.1.2.5 05-Oct-2016  skrll Sync with HEAD
 1.1.2.4 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.1.2.3 22-Sep-2015  skrll Sync with HEAD
 1.1.2.2 06-Apr-2015  skrll Sync with HEAD
 1.1.2.1 07-Mar-2015  skrll file netbsd32_systrace_args.c was added on branch nick-nhusb on 2015-04-06 15:18:07 +0000
 1.12.2.2 20-Mar-2017  pgoyette Sync with HEAD
 1.12.2.1 04-Nov-2016  pgoyette Sync with HEAD
 1.17.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.18.4.1 11-May-2017  pgoyette Sync with HEAD
 1.19.8.2 03-Dec-2017  jdolecek update from HEAD
 1.19.8.1 10-May-2017  jdolecek file netbsd32_systrace_args.c was added on branch tls-maxphys on 2017-12-03 11:36:56 +0000
 1.19.2.1 04-Nov-2019  martin Regen for ticket #398
 1.24.2.16 09-Jan-2019  pgoyette Regen - otherwise compat_40_mount() is wrongly included in sysent.c

Missed this during earlier conflict resolution.
 1.24.2.15 29-Sep-2018  pgoyette Regen
 1.24.2.14 29-Sep-2018  pgoyette Regen
 1.24.2.13 14-Sep-2018  pgoyette Regen
 1.24.2.12 14-Sep-2018  pgoyette Regen
 1.24.2.11 13-Sep-2018  pgoyette Regen
 1.24.2.10 12-Sep-2018  pgoyette Regen
 1.24.2.9 12-Sep-2018  pgoyette Regen
 1.24.2.8 12-Sep-2018  pgoyette regen
 1.24.2.7 12-Sep-2018  pgoyette Regen with updated module information for ntp 30 and 50 compat calls
 1.24.2.6 11-Sep-2018  pgoyette Regen
 1.24.2.5 11-Sep-2018  pgoyette And regen again
 1.24.2.4 11-Sep-2018  pgoyette Regen
 1.24.2.3 11-Sep-2018  pgoyette Regen syscall files and fix includes for syscallvar.h
 1.24.2.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.24.2.1 21-May-2018  pgoyette Sync with HEAD
 1.25.2.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.25.2.1 10-Jun-2019  christos Sync with HEAD
 1.32.2.2 08-Mar-2020  martin Regen (for ticket #761)
 1.32.2.1 04-Nov-2019  martin Regen for ticket #398
 1.36.2.1 25-Jan-2020  ad Sync with head.
 1.41.2.1 25-Apr-2020  bouyer Sync with bouyer-xenpvh-base2 (HEAD)
 1.45.4.1 17-Apr-2021  thorpej Sync with HEAD.
 1.54.2.1 02-Aug-2025  perseant Sync with HEAD
 1.58 26-Oct-2022  riastradh sys: Put externs for time_adjtime and time_adjusted in .h files.

time_adjtime: sys/timex.h (defined in ntp code)
time_adjusted: sys/timevar.h (defined in non-ntp code)

(Not really sure this is a valuable distinction to maintain; there's
non-ntp code that uses time_adjtime too.)
 1.57 20-Sep-2021  thorpej Add timerfd system calls to COMPAT_NETBSD32.
 1.56 07-Sep-2021  riastradh sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.55 18-Feb-2021  simonb In the compat setitimer(2) calls, don't validate which timer is being
used since dosetitimer() does this anyway. The compat functions hadn't
been updated since ITIMER_MONOTONIC was introduced, so they reported
that that ITIMER_MONOTONIC timer was invalid.
 1.54 19-Jan-2021  simonb KNF consistency: No parentheses are needed around the return value.
 1.53 05-Oct-2019  kamil branches: 1.53.8;
Validate input before converting timeval::tv_usec in compat/netbsd32
 1.52 26-Sep-2019  christos make the ?: expression types match
 1.51 27-Jan-2019  pgoyette branches: 1.51.4;
Merge the [pgoyette-compat] branch
 1.50 30-Oct-2018  riastradh Paranoia: zero COMPAT_30 ntptimeval and 32-bit ntptimeval too.

These structs don't have padding but safer to keep the code
structured the same way between the various ntp_gettimes in case
anyone makes more copypasta of it for future updates.
 1.49 26-Feb-2017  njoly branches: 1.49.6; 1.49.12; 1.49.14;
Apply fix from natuve clock_nanosleep(2) to not copyout remaining time
struct if TIMER_ABSTIME flag is set.
 1.48 23-Sep-2016  skrll branches: 1.48.2;
Trailing whitespace
 1.47 23-Sep-2016  skrll Add netbsd32_clock_getcpuclockid2 and netbsd32_wait6 functions
 1.46 31-Oct-2015  njoly branches: 1.46.2;
Adjust compat netbsd32 clock_nanosleep(2) to match recent native
changes that return error number.
 1.45 22-Jul-2015  maxv Set 'error' properly.
 1.44 17-Jul-2015  skrll Unwrap lines.
 1.43 12-Jul-2015  martin Use the right type in sizeof() for copyin() in adjtime
 1.42 02-Oct-2012  christos branches: 1.42.12; 1.42.14;
kernel portion of clock_nanosleep()
 1.41 08-Apr-2010  njoly branches: 1.41.8; 1.41.18;
Add a new clock_gettime1() function that holds most of the
clock_gettime syscall code (except for the copyout). Adjust all
corresponding syscalls to make use of it.
 1.40 03-Apr-2010  njoly Move most clock_getres syscall code, except for coypout call, to a new
clock_getres1() function which can be used by emulations. Adjust all
clock_getres syscalls to now make of use it.
 1.39 29-Mar-2010  njoly Convert linux/linux32/netbsd32 clock_settime syscalls, to use the
common clock_settime1() function.
 1.38 29-Mar-2010  njoly Make compat netbsd32 clock_getres copyout the netbsd32 timespec
structure, not the native one.
 1.37 28-Mar-2010  njoly Cleanup compat netbsd32 nanosleep syscalls to use the common
nanosleep1() call instead of their own stuff.
 1.36 26-Feb-2009  christos branches: 1.36.2; 1.36.4;
fix kernel build with no options NTP
 1.35 11-Jan-2009  christos branches: 1.35.2;
merge christos-time_t
 1.34 15-Jul-2008  christos branches: 1.34.2; 1.34.8;
Use more timespecs internally. From Alexander Shishkin and me.
Welcome to 4.99.70, 30 more to go for 100.
 1.33 29-May-2008  mrg branches: 1.33.2; 1.33.4;
remove clause #3 from my license where there are no other
copyright holders involved.
 1.32 20-Jan-2008  joerg branches: 1.32.6; 1.32.8; 1.32.10; 1.32.12;
Now that __HAVE_TIMECOUNTER and __HAVE_GENERIC_TODR are invariants,
remove the conditionals and the code associated with the undef case.
 1.31 21-Dec-2007  dsl Fix prototypes used when NTP is not in use.
Pointed out by Robert Swindells.
 1.30 20-Dec-2007  dsl Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.29 08-Dec-2007  dsl branches: 1.29.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.28 25-Nov-2007  elad branches: 1.28.2;
Refactor time modification checks and place them in the secmodel code.

okay christos@
 1.27 18-Mar-2007  dsl branches: 1.27.8; 1.27.10; 1.27.16;
Change all the NETBSD32PTR64(SCARG(uap, xxx))) to SCARG_P32(uap, xxx).
 1.26 16-Mar-2007  dsl remove all the double (and triple) casts used to convert 32bit userspace
pointers to and from 64bit kernel pointers. Instead use the defines
NETBSD32PTR64(p32) to read a 32bit pointer and (the new) NETBSD32PTR32(p32,p64)
to write a 32bit pointer throughout.
The 32bit pointer is now a struct to enforce the above.
amd64 (with linux emul) and sparc64 will both compile (when the arch stuff
goes in soon), and amd64 still runs some i386 binaries.
 1.25 04-Mar-2007  christos branches: 1.25.2; 1.25.4; 1.25.6;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.24 14-Nov-2006  elad branches: 1.24.4;
Clean some KAUTH_GENERIC_ISSUSER usage in compat code.
 1.23 23-Jul-2006  ad branches: 1.23.4; 1.23.6;
Use the LWP cached credentials where sane.
 1.22 07-Jun-2006  kardel merge FreeBSD timecounters from branch simonb-timecounters
- struct timeval time is gone
time.tv_sec -> time_second
- struct timeval mono_time is gone
mono_time.tv_sec -> time_uptime
- access to time via
{get,}{micro,nano,bin}time()
get* versions are fast but less precise
- support NTP nanokernel implementation (NTP API 4)
- further reading:
Timecounter Paper: http://phk.freebsd.dk/pubs/timecounter.pdf
NTP Nanokernel: http://www.eecis.udel.edu/~mills/ntp/html/kern.html
 1.21 31-May-2006  drochner support ntp_gettime again
compile tested by Havard Eidnes
 1.20 14-May-2006  elad branches: 1.20.2;
integrate kauth.
 1.19 17-Feb-2006  he branches: 1.19.2; 1.19.4; 1.19.6;
Paste in the conditional declaration of the pps_* extern variables
from kern_ntptime.c, so that this file can build under PPS_SYNC.
 1.18 06-Dec-2005  christos branches: 1.18.2; 1.18.4; 1.18.6;
netbsd32_timevalp_t is not really a pointer.
 1.17 05-Dec-2005  christos remove conflict.
 1.16 05-Dec-2005  christos untagle a bit.
 1.15 05-Dec-2005  kleink Sync with kern_time.c rev. 1.98:
- make settime take timespec.
- pass struct proc down so that we can log a detailed message.
 1.14 11-Nov-2005  simonb Call nanotime() directly, instead of doing the
microtime()/TIMEVAL_TO_TIMESPEC() dance.
 1.13 23-Oct-2005  cube Implement a few changes needed to properly resolve PR#30924, as
discussed in the PR.

- introduce sys/timevar.h to hold kernel-specific stuff relevant to
sys/time.h. Ideally, timevar.h would contain all (or almost) of the
#ifdef _KERNEL part of time.h, but that's a pretty big and tedious
change to make. For now, it will contain only the prototypes I
introduced when working on COMPAT_NETBSD32.

- split copyinout_t into copyin_t and copyout_t, it makes prototypes more
explicit about the meaning of a given argument. Suggested by yamt@.

- move copyinout_t definition in sys/time.h to systm.h as copyin_t and
copyout_t

- make everything uses the new types and include the proper headers at
the proper places.
 1.12 19-Aug-2005  christos branches: 1.12.2;
Fix lossage I created with the 64 bit ino_t change.
 1.11 23-Jul-2005  cube Implement the timer_create(2) family of syscalls.
 1.10 11-Jul-2005  cube Split sys_getitimer and sys_setitimer to make it possible to share the
relevant code with the COMPAT_NETBSD32 version, and make the latter use
the new functions.

This fixes netbsd32_setitimer() which had drifted from the native syscall
and did not work properly anymore.
 1.9 31-May-2005  christos branches: 1.9.2;
- add const
- avoid shadowed variables.
 1.8 26-Feb-2005  perry nuke trailing whitespace
 1.7 14-Nov-2004  atatat branches: 1.7.4; 1.7.6;
Wrap TIMEVAL_TO_TIMESPEC and TIMESPEC_TO_TIMEVAL macros in

do { ... } while(/*CONSTCOND*/0)

so that they can be used unadorned in if/else blocks, etc. This means
that you now *have* to put a ; at the end of the "call" to these
macros.
 1.6 21-Oct-2003  fvdl Fix NULL vs. int comparison.
 1.5 18-Jan-2003  thorpej branches: 1.5.2;
Merge the nathanw_sa branch.
 1.4 23-Oct-2002  scw In preparation for COMPAT_NETBSD32 on SH-5:

- The MD netbsd32_machdep.h header now defines the 32-bit pointer type
instead of using u_int32_t everywhere,
- The MD netbsd32_machdep.h header now defines a macro (at least on
current implementations) which converts a 32-bit pointer to its 64-bit
equivalent,
- Change the MI code to utilise the above two items in all the right places,
- Implement netbsd32___sigaction_sigtramp().

Tested on Sparc64 by Matt Green.
 1.3 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.2 30-May-2001  mrg branches: 1.2.2;
use _KERNEL_OPT.
 1.1 08-Feb-2001  mrg branches: 1.1.2; 1.1.4;
split up netbsd32_netbsd.c into 9 new files, leaving only those syscalls that
have no special interpretations besides simple syscall args conversion.
 1.1.4.5 20-Nov-2002  petrov p_timers changes.
 1.1.4.4 11-Nov-2002  nathanw Catch up to -current
 1.1.4.3 23-Aug-2002  petrov lwpification.
 1.1.4.2 14-Nov-2001  nathanw Catch up to -current.
 1.1.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.1.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.1.2.1 08-Feb-2001  bouyer file netbsd32_time.c was added on branch thorpej_scsipi on 2001-02-11 19:14:22 +0000
 1.2.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.5.2.7 11-Dec-2005  christos Sync with head.
 1.5.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.5.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.5.2.4 29-Nov-2004  skrll Sync with HEAD.
 1.5.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.2.1 03-Aug-2004  skrll Sync with HEAD
 1.7.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.7.4.1 29-Apr-2005  kent sync with -current
 1.9.2.5 21-Jan-2008  yamt sync with head
 1.9.2.4 07-Dec-2007  yamt sync with head
 1.9.2.3 03-Sep-2007  yamt sync with head.
 1.9.2.2 30-Dec-2006  yamt sync with head.
 1.9.2.1 21-Jun-2006  yamt sync with head.
 1.12.2.1 26-Oct-2005  yamt sync with head
 1.18.6.5 03-Jun-2006  kardel remove unused decls
adjtime to ntp_adjtime1() interface
 1.18.6.4 02-Jun-2006  drochner remove a leftover CVS conflict marker
 1.18.6.3 01-Jun-2006  kardel Sync with head.
 1.18.6.2 30-Apr-2006  kardel - simplify emulation layer by avoiding code
replication from the actual implementation
 1.18.6.1 22-Apr-2006  simonb Sync with head.
 1.18.4.1 09-Sep-2006  rpaulo sync with head
 1.18.2.1 18-Feb-2006  yamt sync with head.
 1.19.6.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.19.4.3 12-May-2006  elad include sys/kauth.h where appropriate.
 1.19.4.2 10-Mar-2006  elad generic_authorize() -> kauth_authorize_generic().
 1.19.4.1 08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.19.2.3 11-Aug-2006  yamt sync with head
 1.19.2.2 26-Jun-2006  yamt sync with head.
 1.19.2.1 24-May-2006  yamt sync with head.
 1.20.2.1 19-Jun-2006  chap Sync with head.
 1.23.6.1 10-Dec-2006  yamt sync with head.
 1.23.4.1 18-Nov-2006  ad Sync with head.
 1.24.4.2 24-Mar-2007  yamt sync with head.
 1.24.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.25.6.2 29-Mar-2007  reinoud Pullup to -current
 1.25.6.1 18-Mar-2007  reinoud First attempt to bring branch in sync with HEAD
 1.25.4.1 11-Jul-2007  mjf Sync with head.
 1.25.2.1 10-Apr-2007  ad Sync with head.
 1.27.16.3 18-Feb-2008  mjf Sync with HEAD.
 1.27.16.2 27-Dec-2007  mjf Sync with HEAD.
 1.27.16.1 08-Dec-2007  mjf Sync with HEAD.
 1.27.10.2 23-Mar-2008  matt sync with HEAD
 1.27.10.1 09-Jan-2008  matt sync with HEAD
 1.27.8.2 09-Dec-2007  jmcneill Sync with HEAD.
 1.27.8.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.28.2.1 26-Dec-2007  ad Sync with head.
 1.29.4.2 23-Jan-2008  bouyer Sync with HEAD.
 1.29.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.32.12.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.32.12.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.32.10.2 11-Aug-2010  yamt sync with head.
 1.32.10.1 04-May-2009  yamt sync with head.
 1.32.8.1 04-Jun-2008  yamt sync with head
 1.32.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.32.6.2 28-Sep-2008  mjf Sync with HEAD.
 1.32.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.33.4.1 19-Oct-2008  haad Sync with HEAD.
 1.33.2.1 18-Jul-2008  simonb Sync with head.
 1.34.8.3 04-Jan-2009  christos fix module build.
 1.34.8.2 04-Jan-2009  christos add new syscalls.
 1.34.8.1 15-Jul-2008  christos file netbsd32_time.c was added on branch christos-time_t on 2009-01-04 01:56:02 +0000
 1.34.2.2 03-Mar-2009  skrll Sync with HEAD.
 1.34.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.35.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.36.4.1 30-May-2010  rmind sync with head
 1.36.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.41.18.2 03-Dec-2017  jdolecek update from HEAD
 1.41.18.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.41.8.1 30-Oct-2012  yamt sync with head
 1.42.14.4 28-Aug-2017  skrll Sync with HEAD
 1.42.14.3 05-Oct-2016  skrll Sync with HEAD
 1.42.14.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.42.14.1 22-Sep-2015  skrll Sync with HEAD
 1.42.12.1 17-Jul-2015  snj Pull up following revision(s) (requested by martin in ticket #879):
sys/compat/netbsd32/netbsd32_time.c: revision 1.43
Use the right type in sizeof() for copyin() in adjtime
 1.46.2.2 20-Mar-2017  pgoyette Sync with HEAD
 1.46.2.1 04-Nov-2016  pgoyette Sync with HEAD
 1.48.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.49.14.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.49.14.1 10-Jun-2019  christos Sync with HEAD
 1.49.12.4 26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.49.12.3 27-Sep-2018  pgoyette typo: insert missing ')'
 1.49.12.2 25-Sep-2018  pgoyette Additional use of NTP function pointers, since the NTP code might not
exist in the kernel. (NTP is not (yet) a module, so we don't need to
use the MP-safe mechanism.)
 1.49.12.1 11-Sep-2018  pgoyette Move the NTP compat_30 and compat_50 routines into the version-specific
modules.
 1.49.6.2 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1839):

sys/compat/common/kern_time_30.c: revision 1.6
sys/compat/netbsd32/netbsd32_time.c: revision 1.50

Paranoia: zero COMPAT_30 ntptimeval and 32-bit ntptimeval too.

These structs don't have padding but safer to keep the code
structured the same way between the various ntp_gettimes in case
anyone makes more copypasta of it for future updates.
 1.49.6.1 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1836):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.51.4.1 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.53.8.1 03-Apr-2021  thorpej Sync with HEAD.
 1.4 08-Dec-2001  thorpej Make the coredump routine exec-format/emulation specific. Split
out traditional NetBSD coredump routines into core_netbsd.c and
netbsd32_core.c (for COMPAT_NETBSD32).
 1.3 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.2 06-Jun-2001  mrg branches: 1.2.2; 1.2.4;
sync with uvm_unix.c 1.23
 1.1 06-Jun-2001  mrg LKM friendly: move uvm_coredump32() here
 1.2.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.2.4 28-Feb-2002  nathanw Catch up to -current.
 1.2.2.3 14-Nov-2001  nathanw Catch up to -current.
 1.2.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.2.2.1 06-Jun-2001  nathanw file netbsd32_uvm_unix.c was added on branch nathanw_sa on 2001-06-21 20:00:12 +0000
 1.3 19-Jan-2021  simonb Also print mmap return value and error code #ifdef DEBUG_MMAP.
 1.2 07-Jan-2020  mrg branches: 1.2.8;
don't check the value of retval in netbsd32_mmap() if sys_mmap()
was not successful.
 1.1 24-Dec-2018  mrg branches: 1.1.2; 1.1.6;
move mmap(), compat 40 mount(), pipe() and getfh() into their own files
as the implementation is non trivial or is compat. mark old mount()
properly instead of manually #if'ing ito to ENOSYS.
 1.1.6.3 08-Apr-2020  martin Merge changes from current as of 20200406
 1.1.6.2 10-Jun-2019  christos Sync with HEAD
 1.1.6.1 24-Dec-2018  christos file netbsd32_vm.c was added on branch phil-wifi on 2019-06-10 22:07:02 +0000
 1.1.2.2 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.1.2.1 24-Dec-2018  pgoyette file netbsd32_vm.c was added on branch pgoyette-compat on 2018-12-26 14:01:46 +0000
 1.2.8.1 03-Apr-2021  thorpej Sync with HEAD.
 1.26 05-Dec-2021  msaitoh s/sytle/style/ in comment.
 1.25 07-Sep-2021  riastradh sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.24 15-Oct-2020  rin wait4(2): make error paths match with that of native wait4(2):

https://nxr.netbsd.org/xref/src/sys/kern/kern_exit.c#720
 1.23 23-Sep-2016  skrll branches: 1.23.8; 1.23.20;
Add netbsd32_clock_getcpuclockid2 and netbsd32_wait6 functions
 1.22 03-Nov-2012  njoly branches: 1.22.14; 1.22.18;
Move rusage computation to a new getrusage1() function. Adjust all
compat/emulations to make use of it.
 1.21 04-Nov-2009  rmind branches: 1.21.12; 1.21.22;
do_sys_wait(): fix previous by checking for ru != NULL. Noticed by
Onno van der Linden. Also, remove redundant arguments (seems that
was_zombie was not used since rev 1.177 ?).
 1.20 11-Jan-2009  christos merge christos-time_t
 1.19 29-May-2008  mrg branches: 1.19.6; 1.19.12;
remove clause #3 from my license where there are no other
copyright holders involved.
 1.18 24-Apr-2008  ad branches: 1.18.2; 1.18.4;
Merge proc::p_mutex and proc::p_smutex into a single adaptive mutex, since
we no longer need to guard against access from hardware interrupt handlers.

Additionally, if cloning a process with CLONE_SIGHAND, arrange to have the
child process share the parent's lock so that signal state may be kept in
sync. Partially addresses PR kern/37437.
 1.17 20-Dec-2007  dsl branches: 1.17.6; 1.17.8;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.16 08-Dec-2007  dsl branches: 1.16.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.15 07-May-2007  dsl branches: 1.15.6; 1.15.8; 1.15.16;
Split sys_wait4() so that compat code can fiddle with the returned 'status'
and 'rusage' without having to copy data to/from stackgap buffers.
The old split (find_stopped_child) could be removed.
amd64 seems to run netbsd32, linux and linux32 emulations. sparc64 compiles.
 1.14 18-Mar-2007  dsl Change all the NETBSD32PTR64(SCARG(uap, xxx))) to SCARG_P32(uap, xxx).
 1.13 16-Mar-2007  dsl remove all the double (and triple) casts used to convert 32bit userspace
pointers to and from 64bit kernel pointers. Instead use the defines
NETBSD32PTR64(p32) to read a 32bit pointer and (the new) NETBSD32PTR32(p32,p64)
to write a 32bit pointer throughout.
The 32bit pointer is now a struct to enforce the above.
amd64 (with linux emul) and sparc64 will both compile (when the arch stuff
goes in soon), and amd64 still runs some i386 binaries.
 1.12 04-Mar-2007  christos branches: 1.12.2; 1.12.4; 1.12.6;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.11 09-Feb-2007  ad branches: 1.11.2;
Merge newlock2 to head.
 1.10 11-Dec-2005  christos branches: 1.10.20;
merge ktrace-lwp.
 1.9 19-Aug-2005  christos Fix lossage I created with the 64 bit ino_t change.
 1.8 22-Jul-2005  cube Remove duplication of code for netbsd32_wait4() by using stackgap(9).
 1.7 10-Jul-2005  cube Report changes from sys_wait4().
 1.6 14-Feb-2003  dsl branches: 1.6.2; 1.6.18;
Use find_stopped_child() and proc_free() in compat wait() code to
avoid code duplication.
(approved by christos)
 1.5 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.4 23-Oct-2002  scw branches: 1.4.2;
In preparation for COMPAT_NETBSD32 on SH-5:

- The MD netbsd32_machdep.h header now defines the 32-bit pointer type
instead of using u_int32_t everywhere,
- The MD netbsd32_machdep.h header now defines a macro (at least on
current implementations) which converts a 32-bit pointer to its 64-bit
equivalent,
- Change the MI code to utilise the above two items in all the right places,
- Implement netbsd32___sigaction_sigtramp().

Tested on Sparc64 by Matt Green.
 1.3 28-Jul-2002  jdolecek Convert to use p_opptr rather than p_oppid. Part of fix for
security/14444 by David Sainty.
 1.2 13-Nov-2001  lukem branches: 1.2.8; 1.2.10;
add RCSIDs (including regeneration of files as appropriate)
 1.1 08-Feb-2001  mrg branches: 1.1.2; 1.1.4; 1.1.6;
split up netbsd32_netbsd.c into 9 new files, leaving only those syscalls that
have no special interpretations besides simple syscall args conversion.
 1.1.6.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.6.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.4.4 11-Nov-2002  nathanw Catch up to -current
 1.1.4.3 23-Aug-2002  petrov lwpification.
 1.1.4.2 01-Aug-2002  nathanw Catch up to -current.
 1.1.4.1 14-Nov-2001  nathanw Catch up to -current.
 1.1.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.1.2.1 08-Feb-2001  bouyer file netbsd32_wait.c was added on branch thorpej_scsipi on 2001-02-11 19:14:23 +0000
 1.2.10.1 29-Jul-2002  lukem Pull up revision 1.3 (requested by jdolocek in ticket #557):
Convert to use p_opptr rather than p_oppid. Part of fix for
security/14444 by David Sainty.
 1.2.8.1 29-Aug-2002  gehenna catch up with -current.
 1.4.2.1 18-Dec-2002  gmcgarry Merge pcred and ucred, and poolify. TBD: check backward compatibility
and factor-out some higher-level functionality.
 1.6.18.4 21-Jan-2008  yamt sync with head
 1.6.18.3 03-Sep-2007  yamt sync with head.
 1.6.18.2 26-Feb-2007  yamt sync with head.
 1.6.18.1 21-Jun-2006  yamt sync with head.
 1.6.2.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.10.20.1 17-Nov-2006  ad Checkpoint work in progress.
 1.11.2.3 17-May-2007  yamt sync with head.
 1.11.2.2 24-Mar-2007  yamt sync with head.
 1.11.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.12.6.2 29-Mar-2007  reinoud Pullup to -current
 1.12.6.1 18-Mar-2007  reinoud First attempt to bring branch in sync with HEAD
 1.12.4.1 11-Jul-2007  mjf Sync with head.
 1.12.2.2 27-May-2007  ad Sync with head.
 1.12.2.1 10-Apr-2007  ad Sync with head.
 1.15.16.1 26-Dec-2007  ad Sync with head.
 1.15.8.1 09-Jan-2008  matt sync with HEAD
 1.15.6.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.16.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.17.8.2 04-Jun-2008  yamt sync with head
 1.17.8.1 18-May-2008  yamt sync with head.
 1.17.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.17.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.18.4.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.18.2.2 11-Mar-2010  yamt sync with head
 1.18.2.1 04-May-2009  yamt sync with head.
 1.19.12.2 04-Jan-2009  christos add new syscalls.
 1.19.12.1 29-May-2008  christos file netbsd32_wait.c was added on branch christos-time_t on 2009-01-04 01:56:02 +0000
 1.19.6.1 19-Jan-2009  skrll Sync with HEAD.
 1.21.22.2 03-Dec-2017  jdolecek update from HEAD
 1.21.22.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.21.12.1 16-Jan-2013  yamt sync with (a bit old) head
 1.22.18.1 04-Nov-2016  pgoyette Sync with HEAD
 1.22.14.1 05-Oct-2016  skrll Sync with HEAD
 1.23.20.1 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.23.8.1 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1836):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.19 19-May-2024  christos version dup3
 1.18 19-Dec-2022  pgoyette Create compat_100 module infrastructure now that we have branched
for NetBSD-10
 1.17 22-Sep-2019  christos Add a new member to struct vfsstat and grow the unused members
The new member is caled f_mntfromlabel and it is the dkw_wname
of the corresponding wedge. This is now used by df -W to display
the mountpoint name as NAME=
 1.16 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.15 01-Dec-2015  pgoyette branches: 1.15.16; 1.15.18;
Adapt to per-emulation syscall_autoload capability (the table of syscalls
that can be autoloaded is currently empty).
 1.14 07-Mar-2015  christos regen
 1.13 16-Aug-2014  apb branches: 1.13.2;
Add COMPAT_70 to conf/files; add compat_70 to kern/syscalls.conf
and compat/netbsd32/syscalls.conf.
 1.12 29-Mar-2013  christos compat glue for new lwp_park
 1.11 11-Jan-2009  christos branches: 1.11.14; 1.11.24;
merge christos-time_t
 1.10 09-Nov-2007  dsl branches: 1.10.14; 1.10.18; 1.10.26; 1.10.32;
Add arguments to sys_syscall and sys___syscall.
Use MI wrappers for them in netbsd32.
Change prefix for constants from netbsd32 to NETBSD32 (used in #defines etc).
 1.9 05-May-2006  cube branches: 1.9.32; 1.9.34; 1.9.38; 1.9.40;
Add compat_30 as a compatopts.
 1.8 11-Dec-2005  christos branches: 1.8.4; 1.8.6; 1.8.8; 1.8.10; 1.8.12;
merge ktrace-lwp.
 1.7 21-Apr-2004  christos branches: 1.7.12;
Replace the statfs() family of system calls with statvfs().
Retain binary compatibility.
 1.6 13-Oct-2003  fvdl Define compat_16 as valid prefix; define the 1.6 compat sigreturn.
 1.5 01-Nov-2002  jdolecek branches: 1.5.6;
set nsysent to 512
 1.4 11-Oct-1999  eeh branches: 1.4.12;
Add netbsd32_compat_14.c

Rename everything from compat_netbsd32 -> netbsd32 so we don't have silly
names like compat_14_compat_netbsd32_sys_shmctl().
 1.3 25-Mar-1999  mrg branches: 1.3.8;
move sparc32 to netbsd32; split out MD part (signal handling) (mostly via repository copy, rename and perl -pi :-)
 1.2 01-Oct-1998  eeh Overhaul. Now will run simple things like /bin/sh and /bin/echo.
 1.1 26-Aug-1998  mrg add a 32-bit compatibility module for the sparc64 port, so it can run NetBSD/sparc binaries with a LP64 kernel.
 1.3.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.4.12.1 11-Nov-2002  nathanw Catch up to -current
 1.5.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.6.1 03-Aug-2004  skrll Sync with HEAD
 1.7.12.2 15-Nov-2007  yamt sync with head.
 1.7.12.1 21-Jun-2006  yamt sync with head.
 1.8.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.8.10.1 11-May-2006  elad sync with head
 1.8.8.1 24-May-2006  yamt sync with head.
 1.8.6.1 01-Jun-2006  kardel Sync with head.
 1.8.4.1 09-Sep-2006  rpaulo sync with head
 1.9.40.1 19-Nov-2007  mjf Sync with HEAD.
 1.9.38.1 13-Nov-2007  bouyer Sync with HEAD
 1.9.34.1 09-Jan-2008  matt sync with HEAD
 1.9.32.1 11-Nov-2007  joerg Sync with HEAD.
 1.10.32.1 04-Jan-2009  christos add new syscalls.
 1.10.26.1 19-Jan-2009  skrll Sync with HEAD.
 1.10.18.1 04-May-2009  yamt sync with head.
 1.10.14.1 17-Jan-2009  mjf Sync with HEAD.
 1.11.24.2 03-Dec-2017  jdolecek update from HEAD
 1.11.24.1 23-Jun-2013  tls resync from head
 1.11.14.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.13.2.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.13.2.1 06-Apr-2015  skrll Sync with HEAD
 1.15.18.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.15.18.1 10-Jun-2019  christos Sync with HEAD
 1.15.16.1 10-Sep-2018  pgoyette Another compat_80
 1.147 09-May-2025  martin PR 59352: add netbsd32 compat for semtimedop(2)
 1.146 20-May-2024  christos branches: 1.146.2;
Rename dup3110 to dup3100 to match historical practice for NetBSD-11,
because we already have kevent100. Fix compat_dup3 to belong in compat_100
not compat_110.
 1.145 19-May-2024  christos version dup3
 1.144 30-Jul-2023  rin COMPAT_NETBSD32: Add support for epoll(2).
 1.143 30-Jul-2023  rin COMPAT_NETBSD32: Add support for memfd_create(2).
 1.142 29-Jul-2023  rin COMPAT_NETBSD32: Catch up with sys___kevent100() addition.

XXX
Add epoll_* and memfd_create.
 1.141 20-Sep-2021  thorpej Add the eventfd(2) system call to COMPAT_NETBSD32.
 1.140 20-Sep-2021  thorpej Add timerfd system calls to COMPAT_NETBSD32.
 1.139 10-Oct-2020  rin Teach about getrandom(2) to COMPAT_NETBSD32.
 1.138 16-May-2020  christos Add ACL support for FFS. From FreeBSD.
 1.137 26-Apr-2020  thorpej Mirror the change made to native -- move futex calls to 166-168.
 1.136 26-Apr-2020  thorpej Add a NetBSD native futex implementation, mostly written by riastradh@.
Map the COMPAT_LINUX futex calls to the native ones.
 1.135 22-Apr-2020  thorpej Remove _lwp_gettid(2) system call. This problem is going to be solved
another way. (Note: this call was never exposed in libc, so we can just
recycle the syscall number.)
 1.134 04-Apr-2020  thorpej branches: 1.134.2;
Add support for lazily generating a "global thread ID" for a LWP. This
identifier uniquely identifies an LWP across the entire system, and will
be used in future improvements in user-space synchronization primitives.

(Test disabled and libc stub not included intentionally so as to avoid
multiple libc version bumps.)
 1.133 12-Mar-2020  pgoyette Split out the quota code from the rest of compat_netbsd32 module. This
allows loading of compat_netbsd32 on kernels that don't have ``options
QUOTA'' enabled.
 1.132 07-Mar-2020  pgoyette Properly mark netbsd32_compat_43 syscalls that are directly implemented
by calling their compat_43 equivalents. With these changes, and with
built-in versions of COMPAT_NETBSD32, COMPAT_NOMID, and COMPAT_09, I can
now run a netbsd-0.9 statically linked i386 (32-bit) version of /bin/ls
on a 9.99.x amd64 host!

Addresses PR kern/55047 but more changes coming to handle non-built-in
modules.

XXX pullup-9
 1.131 18-Jan-2020  kamil Catch up after getpid/getgid/getuid changes in native ABI in 2008

getpid(), getuid() and getgid() used to call respectively sys_getpid(),
sys_getuid() and sys_getgid(). In the BSD4.3 compat mode there was a
fallback to call sys_getpid_with_ppid() and related functions.

In 2008 the compat ifdef was removed in sys/kern/syscalls.master r. 1.216.

For purity reasons we probably shall restore the NetBSD original behavior
and implement BSD4.3 one as a compat module, however it is not worth the
complexity.

Align the netbsd32 compat ABI to native ABI and call functions that return
two integers as in BSD4.3.
 1.130 04-Nov-2019  rin branches: 1.130.2;
netbsd32_size_t should be used instead of size_t for argument of
32-bit syscalls:

- netbsd32___getvfsstat90: bufsize
- netbsd32___fhstatvfs190: fh_size

No need to pullup, since these syscalls were introduced after
branch of netbsd-9.
 1.129 04-Nov-2019  rin For netbsd32_readlinkat(2), bufsize is netbsd_size_t, not size_t.
Since bufsize is the last argument, this affects only LP64EB.

XXX
pullup to netbsd-9, -8, and -7
 1.128 22-Sep-2019  christos Add a new member to struct vfsstat and grow the unused members
The new member is caled f_mntfromlabel and it is the dkw_wname
of the corresponding wedge. This is now used by df -W to display
the mountpoint name as NAME=
 1.127 18-Jun-2019  christos branches: 1.127.2;
Add ifdef for quota and include the syscall numbers header
 1.126 18-Jun-2019  christos use option quota
 1.125 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.124 24-Dec-2018  mrg move mmap(), compat 40 mount(), pipe() and getfh() into their own files
as the implementation is non trivial or is compat. mark old mount()
properly instead of manually #if'ing ito to ENOSYS.
 1.123 31-Jul-2018  rjs Add getsockopt2().
 1.122 12-Jul-2018  maxv Remove the kernel PMC code. Sent yesterday on tech-kern@.

This change:

* Removes "options PERFCTRS", the associated includes, and the associated
ifdefs. In doing so, it removes several XXXSMPs in the MI code, which is
good.

* Removes the PMC code of ARM XSCALE.

* Removes all the pmc.h files. They were all empty, except for ARM XSCALE.

* Reorders the x86 PMC code not to rely on the legacy pmc.h file. The
definitions are put in sysarch.h.

* Removes the kern/sys_pmc.c file, and along with it, the sys_pmc_control
and sys_pmc_get_info syscalls. They are marked as OBSOL in kern,
netbsd32 and rump.

* Removes the pmc_evid_t and pmc_ctr_t types.

* Removes all the associated man pages. The sets are marked as obsolete.
 1.121 10-May-2018  christos branches: 1.121.2;
add {send,recv}mmsg
 1.120 06-Jan-2018  kamil branches: 1.120.2;
Revert vadvise(2) removal

This system call was used in legacy Lisp code, that was inherited to modern
age and still compiled against supported compat layers (e.g. in clisp,
oaklisp, Franz Lisp).

It used to instruct the kernel about paging policy (G/C aware, flush etc).

Newly compiled code (assuming that it will detect vadvise()) will use the
libc stub for vadvise(). The headers for this interface are gone.

vadvise(2) could be marked as COMPAT_80, but as long as we support ultrix,
sunos or aout68k ABI, don't bother with this.

Requested by <mrg>
 1.119 19-Dec-2017  kamil Drop SYS_vadvise

The (o)vadvise syscall is dummy since the beginning of NetBSD.

It is an obsolete remnant from the old UNIX.

Sponsored by <The NetBSD Foundation>
 1.118 19-Dec-2017  kamil Drop SYS_sbrk

sbrk - change data segment size

This syscall is dummy since the inception of the project.

Sponsored by <The NetBSD Foundation>
 1.117 19-Dec-2017  kamil Drop the sstk(2) syscall stub

sstk - change stack section size

This functionality has never been implemented and is a remnant from 16-bit
UNIX. This stub appeared with the first NetBSD commit.

Sponsored by <The NetBSD Foundation>
 1.116 19-Dec-2017  kamil Sync syscalls.master in compat_netbsd32(8) with kern/syscalls.master

___lwp_part60 removed 'const' from the ts argument.

'const struct timespec *ts' -> 'struct timespec *ts'

Sponsored by <The NetBSD Foundation>
 1.115 19-Oct-2016  skrll branches: 1.115.8;
PR kern/51514: ptrace(2) fails for 32-bit process on 64-bit kernel

Updated from the original patch in the PR by me.
 1.114 23-Sep-2016  skrll Add wait6 and clock_getcpuclockid2
 1.113 10-Sep-2016  skrll Add _sched_protect
 1.112 03-Dec-2015  pgoyette branches: 1.112.2;
Split out the SYSV IPC stuff into its own compat_netbsd32_sysvipc
module. Adjust dependencies as needed.
 1.111 01-Dec-2015  pgoyette Prepare for new compat_netbsd32_mqueue module to be split out of
compat_netbsd32. Refactor the COMPAT_50 code related to mqueue,
and update the syscall definitions. Remove dependency on mqueue
from the compat_netbsd32 module (the new module will gain this
dependency).

Continuation of work on PR kern/50489
 1.110 01-Dec-2015  pgoyette Mark the nfssvc syscall as auto-loadable from the compat_netbsd32_nfssrv
module (to be committed shortly).
 1.109 23-Jun-2015  dholland Don't reference netbsd32_nfssvc unless NFSSERVER is defined.
Fixes PR 49994.
 1.108 22-Jun-2015  mrg add netbsd32 support for nfssvc(2). we do this by defining 5 copyin/out
functions that do all the ugly work, are just plain copyin/out for the
native system calls, and do the necessary translations for netbsd32.

with this i'm able to run 32 bit nfsd and mountd on 64 bit kernel and
mount the file systems remotely.
 1.107 21-Jun-2015  martin Add pset_* calls
 1.106 21-Jun-2015  martin Cosmetics: fill in details about some currently unimplemented syscalls.
 1.105 21-Jun-2015  martin Add the two versioned mq_* calls I missed in the last round
 1.104 20-Jun-2015  martin Add sigqueuinfo, modctl and mq_*.
 1.103 16-Jun-2015  martin Add posix_fallocate and fdiscard
 1.102 25-Feb-2015  christos readlinkat returns ssize_t
 1.101 13-Jun-2014  joerg branches: 1.101.2; 1.101.4;
Rename argument like the native syscall.
 1.100 15-May-2014  njoly Fix setcontext signature, which has a single argument not three.
 1.99 30-Apr-2014  njoly Do not use native off_t type under compat netbsd32, but a new
netbsd32_off_t that provide the expected alignment for 64bit types.
 1.98 17-Oct-2013  njoly branches: 1.98.2;
Change mknodat(2) device argument type from uint32_t to dev_t.
Adds needed extra PAD argument for 64bit alignment, and libc wrapper.
 1.97 29-Mar-2013  christos branches: 1.97.4;
compat glue for new lwp_park
 1.96 02-Oct-2012  christos kernel portion of clock_nanosleep()
 1.95 08-Apr-2012  martin branches: 1.95.2;
Rework posix_spawn locking and memory management:
- always provide a vmspace for the new proc, initially borrowing from proc0
(this part fixes PR 46286)
- increase parallelism between parent and child if arguments allow this,
avoiding a potential deadlock on exec_lock
- add a new flag for userland to request old (lockstepped) behaviour for
better error reporting
- adapt test cases to the previous two and add a new variant to test the
diagnostics flag
- fix a few memory (and lock) leaks
- provide netbsd32 compat
 1.94 10-Mar-2012  joerg P1003_1B_SEMAPHORE is no longer optional.
 1.93 08-Mar-2012  joerg Add entry for _ksem_timedwait.
 1.92 19-Feb-2012  rmind Make SA calls obsolete (use stubs in kern case, as libc needs them for now).
 1.91 01-Feb-2012  dholland branches: 1.91.2;
Update compat_netbsd32 for new quotactl.
 1.90 01-Feb-2012  dholland Change the syscall API for quotas over to the new non-proplib one.

- struct vfs_quotactl_args -> struct quotactl_args
- add sys/stdint.h to sys/quotactl.h for clean userland build
- install sys/quotactl.h in /usr/include
- update set lists for same
- add new marshalling code in libquota
- add new unmarshalling code in vfs_syscalls.c
- discard proplib interpreter code in vfs_quotactl.c
- add dispatching code for the 14 quotactl ops in vfs_quotactl.c
- mark the proplib quotactl syscall obsolete
- add a new syscall number for the new quotactl syscall
- change the name of the syscall to __quotactl()
- remove the decl of the old quotactl from quota/quotaprop.h
- add a decl of the new quotactl to sys/quotactl.h
- update the libc build
- update ktruss
- remove proplib marshalling code from libquota
- update copy of syscall table in gdb ppc sources
- hack rumphijack to accomodate new quotactl name (as I recall,
pooka wanted such a name change to simplify something, but I
don't really see what/how)

This change appears to require a kernel version bump for rumpish
reasons.
 1.89 31-Jan-2012  matt Add the *at syscalls and other missing syscalls.
 1.88 08-Nov-2011  njoly branches: 1.88.4;
Add kqueue1(2) support.
 1.87 31-Aug-2011  njoly branches: 1.87.2;
Add dup3 syscall support.
 1.86 05-Jul-2011  njoly Add pipe2 syscall now needed for popen(3).
 1.85 06-Mar-2011  bouyer merge the bouyer-quota2 branch. This adds a new on-disk format
to store disk quota usage and limits, integrated with ffs
metadata. Usage is checked by fsck_ffs (no more quotacheck)
and is covered by the WAPBL journal. Enabled with kernel
option QUOTA2 (added where QUOTA was enabled in kernel config files),
turned on with tunefs(8) on a per-filesystem
basis. mount_mfs(8) can also turn quotas on.

See http://mail-index.netbsd.org/tech-kern/2011/02/19/msg010025.html
for details.
 1.84 02-Mar-2010  pooka branches: 1.84.2; 1.84.4; 1.84.6;
Kill fs_nfs.h and #ifdef NFS by making getfh() support unconditional
and nfssvc unsupport unconditional. nfs server was just a fancy
NOP anyway for all except Ultrix. I know I'm boring but I couldn't
imagine why someone would want to run an Ultrix nfs server (and I
also doubt that it would work anymore with all the changes to fs
exporting etc).
 1.83 02-Mar-2010  pooka -fs_lfs.h
 1.82 02-Mar-2010  pooka Remove lfs syscall support from compat. I can't really imagine
anyone wanting to run lfs megamaid as a e.g. FreeBSD binary.
Besides, the real action has been in fcntl() for >5 years now.
The only place where the compat syscalls might have made the tiniest
bit of sense was netbsd32, but they were unimplemented there.
 1.81 14-Dec-2009  matt branches: 1.81.2;
Merge from matt-nb5-mips64
 1.80 17-May-2009  pooka pad -> PAD
 1.79 16-Mar-2009  njoly Fix dev_t alignment, by not using the new 64bit value directly but
rather a 32bit aligned version (netbsd32_dev_t = netbsd32_uint64).

ok by cube@.
 1.78 26-Feb-2009  christos fix kernel build with no options NTP
 1.77 13-Jan-2009  pooka branches: 1.77.2;
Convert the syscalls.master to a format from which it is easier
to parse and generate the compat name and basename (e.g. __stat50
and stat). Use this to autogenerate __RENAME()'s to the rump_syscalls
header so that they can be called e.g. rump_sys_socket() instead
of rump_sys___socket30().
 1.76 13-Jan-2009  pooka UNIMPL police: remove pseudo-prototypes
 1.75 11-Jan-2009  christos merge christos-time_t
 1.74 22-Nov-2008  mrg branches: 1.74.4;
implement netbsd32__sched_setparam(), netbsd32__sched_getparam(),
netbsd32__sched_setaffinity() and netbsd32__sched_getaffinity().
 1.73 19-Nov-2008  ad Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.72 14-Nov-2008  ad Replace semid_t with intptr_t. No function change. This is a libc/kernel
private interface and so the name change should not affect any third
party code.
 1.71 12-Nov-2008  ad Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.
 1.70 15-Oct-2008  wrstuden branches: 1.70.2; 1.70.4;
Merge wrstuden-revivesa into HEAD.
 1.69 24-Apr-2008  ad branches: 1.69.2; 1.69.4; 1.69.8;
- Retire SYCALL_MPSAFE. With the exceptions of darwin and irix emulations,
all system calls are now MPSAFE.
- Remove unneeded acquire/release of kernel_lock.
 1.68 24-Feb-2008  martin branches: 1.68.2;
Desupport compatibility for the old posix_fadvise syscall per yamt's
request and just ignore it.
 1.67 27-Jan-2008  martin branches: 1.67.2; 1.67.6;
Catch up with versioning of posix_fadvise
 1.66 26-Jan-2008  dsl Add a wrapper for posix_fadvise()
 1.65 19-Jan-2008  dsl Add netbsd32 wrapper for sys_mremap(), compiles, and assuming the mmap()
wrapper is ok, it should work!
I presume the kernel knows not to map above 4GB though....
 1.64 17-Dec-2007  dsl Remove all the 'const'. Although the fields might be 32bit pointers to
constant data, the 'const' applies to the field itself - which is stupid.
 1.63 07-Dec-2007  ad branches: 1.63.4;
Add: _lwp_setname, _lwp_getname, _lwp_ctl.
 1.62 09-Nov-2007  dsl branches: 1.62.2;
Add arguments to sys_syscall and sys___syscall.
Use MI wrappers for them in netbsd32.
Change prefix for constants from netbsd32 to NETBSD32 (used in #defines etc).
 1.61 15-Aug-2007  ad branches: 1.61.2; 1.61.6; 1.61.8;
Changes to make ktrace LKM friendly and reduce ifdef KTRACE. Proposed
on tech-kern.
 1.60 07-Aug-2007  ad - Fix a bug with _lwp_park() where if the computed wakeup time was under
1 microsecond into the future, the thread could enter an untimed sleep.
- Change the signature of _lwp_park() to accept an lwpid_t and second
hint pointer, but do so in a way that remains compatible with older
pthread libraries. This can be used to wake another thread before the
calling thread goes asleep, saving at least one syscall + involuntary
context switch. This turns out to be a fairly large win on the condvar
benchmarks that I have tried.
- Mark some more syscalls MP safe.
 1.59 04-Mar-2007  christos branches: 1.59.2; 1.59.6; 1.59.10; 1.59.14;
fix fallout from caddr_t changes.
 1.58 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.57 19-Feb-2007  cube Mark MPSAFE the syscalls that are not translated (and of course, only when
the native syscall is itself marked MPSAFE).
 1.56 18-Feb-2007  cube Add missing lwp syscalls. Put them all together into a new file,
netbsd32_lwp.c, and remove remaining traces of SA.

This still needs some MD (and possibly MI, depending on the chosen
solution) changes to actually work.
 1.55 09-Feb-2007  ad branches: 1.55.2;
Merge newlock2 to head.
 1.54 09-Nov-2006  cube - Make better use of COMPAT_XX type in syscalls.master
- Remove useless (thanks to COMPAT_XX behaviour) #ifdefs in
syscalls.master
- Make netbsd32_compat_43.c compiled per COMPAT_LINUX32 because the latter
needs stuff from it.

Fixes Perry's PR#34951.
 1.53 01-Sep-2006  matt branches: 1.53.2; 1.53.4;
Don't conditionalize *sys_ptrace. The lack of sys_ptrace will be dealt
with differently.
 1.52 30-Aug-2006  cube Protect netbsd32_ptrace with options PTRACE.
 1.51 31-Jul-2006  martin Step 1 to make filehandles completely opaque to userland
 1.50 13-Jul-2006  pavel do not protect the getfh syscall by
#if defined(NFS) || defined(NFSSERVER).
The native syscall also isn't.
 1.49 13-Jul-2006  martin Fix alignement problems for fhandle_t, exposed by gcc4.1.

While touching all vptofh/fhtovp functions, get rid of VFS_MAXFIDSIZ,
version the getfh(2) syscall and explicitly pass the size available in
the filehandle from userland.

Discussed on tech-kern, with lots of help from yamt (thanks!).
 1.48 26-Jun-2006  mrg version the socket(2) syscall. for compat30 socket, we use
EPROTONOSUPPORT instead of EAFNOSUPPORT.

from pavel@ with a little bit of clean up from myself.

XXX: netbsd32 (and perhaps other emulations) should be able
XXX: to call the standard socket calls for this i think, but
XXX: revisit this at another time.
 1.47 31-May-2006  drochner branches: 1.47.2;
support ntp_gettime again
compile tested by Havard Eidnes
 1.46 29-May-2006  drochner Remove emulation of ntp_gettime. In preparation for "timecounters" we
will change "struct ntptimeval", so some translation would be necessary.
ntp_gettine is considered dispensable, the only userland program known
to use it is "ntptime".
 1.45 05-May-2006  cube branches: 1.45.2;
Follow on fhstat(2) versioning. While there, add sys_posix_fadvise (no
emulation needed there).
 1.44 29-Mar-2006  cube Implement the _lwp* and sa_* families of syscalls, using the newly
introduced hooks in the native code.
 1.43 06-Mar-2006  cube branches: 1.43.2; 1.43.4;
Implement the SysV IPC family of syscalls.
 1.42 05-Mar-2006  cube branches: 1.42.2;
Implement the ksem_* family of syscalls.
 1.41 11-Dec-2005  christos branches: 1.41.4; 1.41.6;
merge ktrace-lwp.
 1.40 23-Oct-2005  cube - Split sys_kevent into kevent1 so that it can be used by COMPAT_NETBSD32
code.

- To achieve COMPAT_NETBSD32 compatibility, introduce a parameter to
kevent1 that points to functions that do the actual copyin/copyout
operations. This is similar to what was done in FreeBSD by Paul Saab.

- Add the COMPAT_NETBSD32 definitions and hooks.
 1.39 19-Aug-2005  christos branches: 1.39.2;
Fix lossage I created with the 64 bit ino_t change.
 1.38 19-Aug-2005  christos 64 bit inode changes.
 1.37 23-Jul-2005  cube Implement __sigtimedwait(2).
 1.36 23-Jul-2005  cube Implement the timer_create(2) family of syscalls.
 1.35 12-Jul-2005  cube Add the *xattr(2) family of syscalls. Just like the *extattr(2) family,
they're waiting for an actual FS back-end to be tested, but are still
straightforward enough.
 1.34 11-Jul-2005  cube Add rasctl(2). Thanks to the regression tests for that syscall, I was able
to discover the bugs in netbsd32_setitimer() and netbsd32_execve().
 1.33 10-Jul-2005  cube Add support for fsync_range(2).
 1.32 10-Jul-2005  cube Implement __clone(2).
 1.31 09-Jul-2005  cube Implement pselect(2) and pollts(2).
 1.30 08-Jul-2005  cube Add mlockall(2) and munlockall(2).
 1.29 08-Jul-2005  cube Implement the extattr(3) family of syscalls.

XXX However, those remain untested as there are currently no backend for
XXX extattr(9) in NetBSD.
 1.28 04-Jul-2005  cube branches: 1.28.2;
Implement uuidgen(2).
 1.27 30-May-2005  chs track change to swapctl args in kern/syscalls.master.
 1.26 17-Jun-2004  cube o Add support for the statvfs family of syscalls (statvfs1, fstatvfs1,
fhstatvfs1 and getvfsstat)
o Move the statfs family out of netbsd32_fs.c and netbsd32_netbsd.c to
netbsd_compat_20.c, compiled with COMPAT_20

Reviewed by christos@.
 1.25 25-Oct-2003  chs allow COMPAT_SUNOS without COMPAT_43.
 1.24 13-Oct-2003  fvdl Define compat_16 as valid prefix; define the 1.6 compat sigreturn.
 1.23 18-Jan-2003  thorpej branches: 1.23.2;
Merge the nathanw_sa branch.
 1.22 23-Oct-2002  scw In preparation for COMPAT_NETBSD32 on SH-5:

- The MD netbsd32_machdep.h header now defines the 32-bit pointer type
instead of using u_int32_t everywhere,
- The MD netbsd32_machdep.h header now defines a macro (at least on
current implementations) which converts a 32-bit pointer to its 64-bit
equivalent,
- Change the MI code to utilise the above two items in all the right places,
- Implement netbsd32___sigaction_sigtramp().

Tested on Sparc64 by Matt Green.
 1.21 29-Apr-2002  mrg build the netbsd32_compat* objects into libcompat.a, so they are available
to emulations not just netbsd itself. rename the compat_10 functions to
match everything else. fixes a problem reported by julian coleman.
 1.20 30-May-2001  mrg branches: 1.20.2;
use _KERNEL_OPT.
 1.19 10-Apr-2001  kleink Slight indentation nit.
 1.18 02-Feb-2001  mrg branches: 1.18.2;
add lchflags, issetugid, utrace, reserves for [gs]etcontext, and sched/SA.
 1.17 27-Jan-2001  thorpej getpid(2) is MP-safe.
 1.16 09-Dec-2000  mycroft Add the %% separators.
 1.15 30-Nov-2000  jdolecek always include netbsd32_ntp_adjtime(), LKMify
 1.14 07-Aug-2000  bjh21 Changes to syscalls.master to exclude ntp_adjtime(2) entirely if NTP is not
defined. Changes to other files will follow in a moment.
 1.13 09-Jul-2000  mrg - massive warning fix fest.
- fix pread/pwrite return values (plus some other syscalls that looked
similarly broken).
- prototypes and clean up for netbsd32_ioctl.c

now getpw*() works under compat32!
 1.12 31-Jan-2000  christos __semctl13 -> ____semctl13
 1.11 30-Dec-1999  eeh Update to 32-bit compatibility routines.
 1.10 11-Oct-1999  eeh branches: 1.10.2;
Add netbsd32_compat_14.c

Rename everything from compat_netbsd32 -> netbsd32 so we don't have silly
names like compat_14_compat_netbsd32_sys_shmctl().
 1.9 12-Jul-1999  kleink branches: 1.9.2;
XSH5: change function signature to `void *sbrk(intptr_t)'.
 1.8 09-Jun-1999  christos Propagate kern changes
 1.7 25-Mar-1999  mrg branches: 1.7.4;
move sparc32 to netbsd32; split out MD part (signal handling) (mostly via repository copy, rename and perl -pi :-)
 1.6 25-Mar-1999  mrg make this match the main syscalls.master a bit better.
 1.5 10-Dec-1998  christos Defopt COMPAT_43
 1.4 19-Oct-1998  tron Defopt SYSVMSG, SYSVSEM and SYSVSHM.
 1.3 01-Oct-1998  eeh Overhaul. Now will run simple things like /bin/sh and /bin/echo.
 1.2 26-Aug-1998  mrg make oreboot work.
 1.1 26-Aug-1998  mrg add a 32-bit compatibility module for the sparc64 port, so it can run NetBSD/sparc binaries with a LP64 kernel.
 1.7.4.2 02-Aug-1999  thorpej Update from trunk.
 1.7.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.9.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.10.2.5 21-Apr-2001  bouyer Sync with HEAD
 1.10.2.4 11-Feb-2001  bouyer Sync with HEAD.
 1.10.2.3 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.10.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.10.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.18.2.4 11-Nov-2002  nathanw Catch up to -current
 1.18.2.3 20-Jun-2002  nathanw Catch up to -current.
 1.18.2.2 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.18.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.20.2.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.23.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.23.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.23.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.23.2.1 03-Aug-2004  skrll Sync with HEAD
 1.28.2.8 27-Feb-2008  yamt sync with head.
 1.28.2.7 04-Feb-2008  yamt sync with head.
 1.28.2.6 21-Jan-2008  yamt sync with head
 1.28.2.5 15-Nov-2007  yamt sync with head.
 1.28.2.4 03-Sep-2007  yamt sync with head.
 1.28.2.3 26-Feb-2007  yamt sync with head.
 1.28.2.2 30-Dec-2006  yamt sync with head.
 1.28.2.1 21-Jun-2006  yamt sync with head.
 1.39.2.1 26-Oct-2005  yamt sync with head
 1.41.6.2 01-Jun-2006  kardel Sync with head.
 1.41.6.1 22-Apr-2006  simonb Sync with head.
 1.41.4.1 09-Sep-2006  rpaulo sync with head
 1.42.2.6 11-Aug-2006  yamt sync with head
 1.42.2.5 26-Jun-2006  yamt sync with head.
 1.42.2.4 24-May-2006  yamt sync with head.
 1.42.2.3 01-Apr-2006  yamt sync with head.
 1.42.2.2 13-Mar-2006  yamt sync with head.
 1.42.2.1 05-Mar-2006  yamt file syscalls.master was added on branch yamt-pdpolicy on 2006-03-13 09:07:08 +0000
 1.43.4.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.43.4.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.43.2.2 11-May-2006  elad sync with head
 1.43.2.1 19-Apr-2006  elad sync with head.
 1.45.2.1 19-Jun-2006  chap Sync with head.
 1.47.2.1 13-Jul-2006  gdamore Merge from HEAD.
 1.53.4.1 10-Dec-2006  yamt sync with head.
 1.53.2.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.53.2.1 18-Nov-2006  ad Sync with head.
 1.55.2.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.59.14.4 09-Dec-2007  jmcneill Sync with HEAD.
 1.59.14.3 11-Nov-2007  joerg Sync with HEAD.
 1.59.14.2 16-Aug-2007  jmcneill Sync with HEAD.
 1.59.14.1 09-Aug-2007  jmcneill Sync with HEAD.
 1.59.10.2 03-Sep-2007  skrll Sync with HEAD.
 1.59.10.1 15-Aug-2007  skrll Sync with HEAD.
 1.59.6.1 09-Dec-2007  reinoud Pullup to HEAD
 1.59.2.1 20-Aug-2007  ad Sync with HEAD.
 1.61.8.4 18-Feb-2008  mjf Sync with HEAD.
 1.61.8.3 27-Dec-2007  mjf Sync with HEAD.
 1.61.8.2 08-Dec-2007  mjf Sync with HEAD.
 1.61.8.1 19-Nov-2007  mjf Sync with HEAD.
 1.61.6.1 13-Nov-2007  bouyer Sync with HEAD
 1.61.2.2 23-Mar-2008  matt sync with HEAD
 1.61.2.1 09-Jan-2008  matt sync with HEAD
 1.62.2.2 26-Dec-2007  ad Sync with head.
 1.62.2.1 08-Dec-2007  ad Sync with head.
 1.63.4.2 20-Jan-2008  bouyer Sync with HEAD
 1.63.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.67.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.67.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.67.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.67.2.1 24-Mar-2008  keiichi sync with head.
 1.68.2.1 18-May-2008  yamt sync with head.
 1.69.8.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.69.8.1 19-Oct-2008  haad Sync with HEAD.
 1.69.4.3 28-Sep-2008  skrll Re-add SA syscalls.
 1.69.4.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.69.4.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.69.2.3 11-Mar-2010  yamt sync with head
 1.69.2.2 20-Jun-2009  yamt sync with head
 1.69.2.1 04-May-2009  yamt sync with head.
 1.70.4.1 25-Nov-2008  snj branches: 1.70.4.1.4;
Pull up following revision(s) (requested by mrg in ticket #121):
sys/compat/netbsd32/syscalls.master: revision 1.74
sys/compat/netbsd32/netbsd32.h: revision 1.78
sys/compat/netbsd32/netbsd32_netbsd.c: revision 1.149
implement netbsd32__sched_setparam(), netbsd32__sched_getparam(),
netbsd32__sched_setaffinity() and netbsd32__sched_getaffinity().
 1.70.4.1.4.1 12-Sep-2009  matt Add netbsd32___mount50
 1.70.2.3 28-Apr-2009  skrll Sync with HEAD.
 1.70.2.2 03-Mar-2009  skrll Sync with HEAD.
 1.70.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.74.4.3 04-Jan-2009  christos fix module build.
 1.74.4.2 04-Jan-2009  christos add new syscalls.
 1.74.4.1 22-Nov-2008  christos file syscalls.master was added on branch christos-time_t on 2009-01-04 01:56:02 +0000
 1.77.2.2 23-Jul-2009  jym Sync with HEAD.
 1.77.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.81.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.84.6.2 09-Feb-2011  bouyer Proper definitions for quotactl
 1.84.6.1 20-Jan-2011  bouyer Snapshot of work in progress on a modernised disk quota system:
- new quotactl syscall (versionned for backward compat), which takes
as parameter a path to a mount point, and a prop_dictionary
(in plistref format) describing commands and arguments.
For each command, status and data are returned as a prop_dictionary.
quota commands features will be added to take advantage of this,
exporting quota data or getting quota commands as plists.

- new on disk-format storage (all 64bit wide), integrated to metadata for
ffs (and playing nicely with wapbl).
Quotas are enabled on a ffs filesystem via superblock flags.
tunefs(8) can enable or disable quotas.
On a quota-enabled filesystem, fsck_ffs(8) will track per-uid/gid
block and inode usages, and will check and update quotas in Pass 6.
quota usage and limits are stored in unliked files (one for users,
one for groups)l fsck_ffs(8) will create the files if needed, or
free them if needed. This means that after enabling or disabling
quotas on a filesystem; a fsck_ffs(8) run is required.
quotacheck(8) is not needed any more, on a unclean shutdown
fsck or journal replay will take care of fixing quotas.
newfs(8) can create a ready-to-mount quota-enabled filesystem
(superblock flags are set and quota inodes are created).
Other new features or semantic changes:
- default quota datas, applied to users or groups which don't already
have a quota entry
- per-user/group grace time (instead of a filesystem global one)
- 0 really means "nothing allowed at all", not "no limit".
If you want "no limit", set the limit to UQUAD_MAX (tools will
understand "unlimited" and "-")

A quota file is structured as follow:
it starts with a header, containing a few per-filesystem values,
and the default quota limits.
Quota entries are linked together as a simple list, each entry has a
pointer (as an offset withing the file) to the next.
The header has a pointer to a list of free quota entries, and
a hash table of in-use entries. The size of the hash table depends
on the filesystem block size (header+hash table should fit in the
first block). The file is not sparse and is a multiple of
filesystem block size (when the free quota entry list is empty a new
filesystem block is allocated). quota entries to not cross
filesystem block boundaries.

In memory, the kernel keeps a cache of recently used quota entries
as a reference to the block number, and offset withing the block.
The quota entry itself is keept in the buf cache.

fsck_ffs(8), tunefs(8) and newfs(8) supports are completed (with
related atf tests :)
The kernel can update disk usage and report it via quotactl(2).

Todo: enforce quotas limits (limits are not checked by kernel yet)
update repquota, edquota and rpc.rquotad to the new world
implement compat_50_quotactl ioctl.
update quotactl(2) man page

fsck_ffs required fixes so that allocating new blocks or inodes will
properly update the superblock and cg sumaries. This was not an issue up
to now because superblock and cg sumaries check happened last, but now
allocations or frees can happen in pass 6.
 1.84.4.1 06-Jun-2011  jruoho Sync with HEAD.
 1.84.2.1 21-Apr-2011  rmind sync with head
 1.87.2.4 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.87.2.3 30-Oct-2012  yamt sync with head
 1.87.2.2 17-Apr-2012  yamt sync with head
 1.87.2.1 10-Nov-2011  yamt sync with head
 1.88.4.4 29-Apr-2012  mrg sync to latest -current.
 1.88.4.3 11-Mar-2012  mrg sync to latest -current
 1.88.4.2 24-Feb-2012  mrg sync to -current.
 1.88.4.1 18-Feb-2012  mrg merge to -current.
 1.91.2.2 14-Apr-2015  msaitoh Pull up following revision(s) (requested by khorben in ticket #1264):

include/unistd.h 1.144
sys/kern/init_sysent.c regen
sys/kern/syscalls.c regen
sys/kern/syscalls.master 1.272
sys/rump/include/rump/rump_syscalls.h regen
sys/rump/librump/rumpkern/rump_syscalls.c regen
sys/sys/syscall.h regen
sys/sys/syscallargs.h regen
sys/compat/netbds32/netbsd32_syscall.h regen
sys/compat/netbds32/netbsd32_syscallargs.h regen
sys/compat/netbds32/netbsd32_syscalls.c regen
sys/compat/netbds32/netbsd32_sysent.c regen
sys/compat/netbsd32/syscalls.master 1.102

Fix return type of the readlinkat(2) syscall. PR#49684.
 1.91.2.1 12-Apr-2012  riz Pull up following revision(s) (requested by martin in ticket #175):
sys/kern/kern_exit.c: revision 1.238
tests/lib/libc/gen/posix_spawn/t_fileactions.c: revision 1.4
tests/lib/libc/gen/posix_spawn/t_fileactions.c: revision 1.5
sys/uvm/uvm_extern.h: revision 1.183
lib/libc/gen/posix_spawn_fileactions.c: revision 1.2
sys/kern/kern_exec.c: revision 1.348
sys/kern/kern_exec.c: revision 1.349
sys/compat/netbsd32/syscalls.master: revision 1.95
sys/uvm/uvm_glue.c: revision 1.159
sys/uvm/uvm_map.c: revision 1.317
sys/compat/netbsd32/netbsd32.h: revision 1.95
sys/kern/exec_elf.c: revision 1.38
sys/sys/spawn.h: revision 1.2
sys/sys/exec.h: revision 1.135
sys/compat/netbsd32/netbsd32_execve.c: revision 1.34
Rework posix_spawn locking and memory management:
- always provide a vmspace for the new proc, initially borrowing from proc0
(this part fixes PR 46286)
- increase parallelism between parent and child if arguments allow this,
avoiding a potential deadlock on exec_lock
- add a new flag for userland to request old (lockstepped) behaviour for
better error reporting
- adapt test cases to the previous two and add a new variant to test the
diagnostics flag
- fix a few memory (and lock) leaks
- provide netbsd32 compat
Fix asynchronous posix_spawn child exit status (and test for it).
 1.95.2.4 03-Dec-2017  jdolecek update from HEAD
 1.95.2.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.95.2.2 23-Jun-2013  tls resync from head
 1.95.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.97.4.1 18-May-2014  rmind sync with head
 1.98.2.1 10-Aug-2014  tls Rebase.
 1.101.4.5 05-Dec-2016  skrll Sync with HEAD
 1.101.4.4 05-Oct-2016  skrll Sync with HEAD
 1.101.4.3 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.101.4.2 22-Sep-2015  skrll Sync with HEAD
 1.101.4.1 06-Apr-2015  skrll Sync with HEAD
 1.101.2.4 04-Nov-2019  martin Pull up following revision(s) (requested by rin in ticket #1711):

sys/compat/netbsd32/syscalls.master: revision 1.129

For netbsd32_readlinkat(2), bufsize is netbsd_size_t, not size_t.

Since bufsize is the last argument, this affects only LP64EB.

XXX
pullup to netbsd-9, -8, and -7
 1.101.2.3 06-Nov-2015  martin Additionally pull up following revision(s) (requested by mrg in ticket #956):
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.2
sys/compat/netbsd32/syscalls.master: revision 1.109
Don't reference netbsd32_nfssvc unless NFSSERVER is defined.
Fixes PR 49994.
add missing opt_nfsserver.h
 1.101.2.2 04-Nov-2015  riz Pull up following revision(s) (requested by mrg in ticket #956):
sys/compat/netbsd32/files.netbsd32: revision 1.36
sys/compat/netbsd32/netbsd32_sysent.c: revision 1.115
sys/compat/netbsd32/netbsd32_syscallargs.h: revision 1.116
sys/nfs/nfs_var.h: revision 1.93
sys/compat/netbsd32/netbsd32_conv.h: revision 1.30
sys/compat/netbsd32/netbsd32_syscall.h: revision 1.116
sys/compat/netbsd32/netbsd32_syscalls.c: revision 1.115
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.1
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.3
sys/nfs/nfs_syscalls.c: revision 1.156
sys/compat/netbsd32/syscalls.master: revision 1.108
sys/compat/netbsd32/netbsd32.h: revision 1.107
add netbsd32 support for nfssvc(2). we do this by defining 5 copyin/out
functions that do all the ugly work, are just plain copyin/out for the
native system calls, and do the necessary translations for netbsd32.
with this i'm able to run 32 bit nfsd and mountd on 64 bit kernel and
mount the file systems remotely.
don't copy the first netbsd32_export_args nexports times, but actually
advance the userland pointer each entry through the loop. oops.
 1.101.2.1 07-Mar-2015  snj Pull up following revision(s) (requested by khorben in ticket #560):
sys/compat/netbsd32/syscalls.master: revision 1.102
readlinkat returns ssize_t
 1.112.2.1 04-Nov-2016  pgoyette Sync with HEAD
 1.115.8.1 04-Nov-2019  martin Pull up following revision(s) (requested by rin in ticket #398):

sys/compat/netbsd32/syscalls.master: revision 1.129

For netbsd32_readlinkat(2), bufsize is netbsd_size_t, not size_t.

Since bufsize is the last argument, this affects only LP64EB.

XXX
pullup to netbsd-9, -8, and -7
 1.120.2.19 29-Sep-2018  pgoyette Only keep the compat syscall entry; the main entry needs to remain
conditional.
 1.120.2.18 29-Sep-2018  pgoyette Don't #ifdef out the NTP compat calls.

The syscall number needs to be defined (for the autoload table) whether
or not the compat code is built in. The compat code will be included
in the module in all cases, but it makes explicit checks to ensure that
NTP code exists before executing.
 1.120.2.17 14-Sep-2018  pgoyette Add MODULAR attribute to sigreturn. I think this is the last one.
 1.120.2.16 14-Sep-2018  pgoyette Make sigreturn14 MODULAR
 1.120.2.15 13-Sep-2018  pgoyette More MODULAR tags
 1.120.2.14 12-Sep-2018  pgoyette Missed a couple of MODULAR tags
 1.120.2.13 12-Sep-2018  pgoyette Prepare for splitting compat_netbsd32_sysvipc into version-specific modules
 1.120.2.12 12-Sep-2018  pgoyette The netbsd32 40 mount code belongs in a netbsd32 40 module
 1.120.2.11 11-Sep-2018  pgoyette Move the NTP compat_30 and compat_50 routines into the version-specific
modules.
 1.120.2.10 11-Sep-2018  pgoyette Insert "MODULAR compat_netbsd32_43" as neeed
 1.120.2.9 11-Sep-2018  pgoyette More over-zealousness - what was I thinking?
 1.120.2.8 11-Sep-2018  pgoyette Don't be overzealous with changes! Return a few syscalls to their
original COMPAT_xx status (rather than STD)
 1.120.2.7 11-Sep-2018  pgoyette Update for module-provided compat syscalls
 1.120.2.6 10-Sep-2018  pgoyette More work on splitting the compat_netbsd32 module
 1.120.2.5 10-Sep-2018  pgoyette More compat_netbsd32_xx modules
 1.120.2.4 10-Sep-2018  pgoyette Initial cut at a compat_netbsd32_09 and compat_netbsd32_12 modules.
 1.120.2.3 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.120.2.2 28-Jul-2018  pgoyette Sync with HEAD
 1.120.2.1 21-May-2018  pgoyette Sync with HEAD
 1.121.2.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.121.2.1 10-Jun-2019  christos Sync with HEAD
 1.127.2.2 08-Mar-2020  martin Pull up following revision(s) (requested by pgoyette in ticket #761):

sys/compat/netbsd32/syscalls.master: revision 1.132
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.60

Properly mark netbsd32_compat_43 syscalls that are directly implemented
by calling their compat_43 equivalents. With these changes, and with
built-in versions of COMPAT_NETBSD32, COMPAT_NOMID, and COMPAT_09, I can
now run a netbsd-0.9 statically linked i386 (32-bit) version of /bin/ls
on a 9.99.x amd64 host!

Addresses PR kern/55047 but more changes coming to handle non-built-in
modules.

XXX pullup-9
 1.127.2.1 04-Nov-2019  martin Pull up following revision(s) (requested by rin in ticket #398):

sys/compat/netbsd32/syscalls.master: revision 1.129

For netbsd32_readlinkat(2), bufsize is netbsd_size_t, not size_t.

Since bufsize is the last argument, this affects only LP64EB.

XXX
pullup to netbsd-9, -8, and -7
 1.130.2.1 25-Jan-2020  ad Sync with head.
 1.134.2.1 25-Apr-2020  bouyer Sync with bouyer-xenpvh-base2 (HEAD)
 1.146.2.1 02-Aug-2025  perseant Sync with HEAD
 1.6 12-Jun-2020  roy Remove in-kernel handling of Router Advertisements

This is much better handled by a user-land tool.
Proposed on tech-net here:
https://mail-index.netbsd.org/tech-net/2020/04/22/msg007766.html

Note that the ioctl SIOCGIFINFO_IN6 no longer sets flags. That now
needs to be done using the pre-existing SIOCSIFINFO_FLAGS ioctl.

Compat is fully provided where it makes sense, but trying to turn on
RA handling will obviously throw an error as it no longer exists.

Note that if you use IPv6 temporary addresses, this now needs to be
turned on in dhcpcd.conf(5) rather than in sysctl.conf(5).
 1.5 15-Dec-2019  tsutsui Remove clause 3 and 4 leftovers from TNF licenses in more sources.

Confirmed by martin@ in PR/54760.
 1.4 19-Apr-2018  christos branches: 1.4.2; 1.4.6;
s/static inline/static __inline/g for consistency.
 1.3 06-Sep-2015  dholland branches: 1.3.16;
More on PR 41200: headers that declare ioctls should include sys/ioccom.h.
This covers (I think) all the MI headers outside of external/ (and dist/).
 1.2 15-Jan-2009  christos branches: 1.2.2; 1.2.4; 1.2.8; 1.2.30; 1.2.48;
Emulate a couple more ioctls. Thanks to Matthias Drochner for pointing them out.
 1.1 15-Jan-2009  christos compat glue.
 1.2.48.1 22-Sep-2015  skrll Sync with HEAD
 1.2.30.1 03-Dec-2017  jdolecek update from HEAD
 1.2.8.2 04-May-2009  yamt sync with head.
 1.2.8.1 15-Jan-2009  yamt file in6_var.h was added on branch yamt-nfs-mp on 2009-05-04 08:12:26 +0000
 1.2.4.2 19-Jan-2009  skrll Sync with HEAD.
 1.2.4.1 15-Jan-2009  skrll file in6_var.h was added on branch nick-hppapmap on 2009-01-19 13:17:37 +0000
 1.2.2.2 17-Jan-2009  mjf Sync with HEAD.
 1.2.2.1 15-Jan-2009  mjf file in6_var.h was added on branch mjf-devfs2 on 2009-01-17 13:28:47 +0000
 1.3.16.1 22-Apr-2018  pgoyette Sync with HEAD
 1.4.6.1 18-Dec-2019  martin Pull up following revision(s) (requested by tsutsui in ticket #570):

sys/compat/netbsd32/netbsd32_compat_50_sysv.c: revision 1.3
sys/dev/raidframe/rf_compat50.h: revision 1.6
sys/arch/emips/emips/bus_space.c: revision 1.3
sys/compat/net/if.h: revision 1.5
sys/arch/emips/stand/common/bootinfo.c: revision 1.2
sys/compat/common/sysv_msg_50.c: revision 1.5
sys/compat/common/kern_time_30.c: revision 1.8
sys/arch/emips/stand/common/bootinfo.h: revision 1.2
sys/arch/ia64/include/bus.h: revision 1.4
sys/arch/ia64/ia64/bus_space.c: revision 1.2
sys/compat/common/sysv_shm_50.c: revision 1.5
sys/dev/ic/adw.h: revision 1.15
sys/compat/common/uipc_syscalls_50.c: revision 1.10
sys/arch/emips/ebus/flash_ebus.c: revision 1.22
sys/dev/ic/adv.h: revision 1.15
sys/dev/ic/adwmcode.c: revision 1.18
sys/dev/ic/advlib.c: revision 1.29
sys/arch/hpcarm/include/kloader.h: revision 1.3
sys/dev/usb/uberry.c: revision 1.16
sys/compat/common/sysv_sem_50.c: revision 1.5
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.43
sys/dev/ic/advlib.h: revision 1.21
sys/dev/ic/adv.c: revision 1.50
sys/compat/netinet6/in6_var.h: revision 1.5
sys/arch/hpc/stand/hpcboot/arm/arm_sa1100_asm.asm: revision 1.2
sys/arch/emips/include/loadfile_machdep.h: revision 1.3
sys/arch/emips/stand/common/prom_iface.c: revision 1.7
sys/dev/ic/adw.c: revision 1.56
sys/dev/ic/adwmcode.h: revision 1.12
sys/dev/ic/advmcode.c: revision 1.10
sys/arch/emips/ebus/ace_ebus.c: revision 1.22
sys/compat/netbsd32/netbsd32_compat_60.c: revision 1.5
sys/dev/raidframe/rf_compat50.c: revision 1.13
sys/arch/x68k/dev/intiovar.h: revision 1.15
sys/dev/usb/uipad.c: revision 1.8
sys/arch/zaurus/include/kloader.h: revision 1.3
sys/arch/emips/stand/common/bootxx.c: revision 1.2
sys/dev/ic/adwlib.h: revision 1.23
sys/dev/ic/adwlib.c: revision 1.44
sys/compat/netbsd32/netbsd32_compat_16.c: revision 1.3
sys/arch/amigappc/include/intr.h: revision 1.27
sys/arch/x68k/dev/mfp.c: revision 1.27
sys/arch/arm/at91/at91dbgu.c: revision 1.17
sys/dev/ic/advmcode.h: revision 1.7
sys/compat/ultrix/ultrix_exec.h: revision 1.7
sys/compat/common/vfs_syscalls_50.c: revision 1.24
sys/arch/mips/cavium/octeon_dma.c: revision 1.3
sys/arch/hpc/stand/hpcboot/arm/arm_pxa2x0_asm.asm: revision 1.2

Remove clause 3 and 4 from TNF licenses.
Ok'ed by martin@ in PR/54760.

Remove clause 3 and 4 leftovers from TNF licenses in more sources.
Confirmed by martin@ in PR/54760.
 1.4.2.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.1 12-Jun-2020  roy Add nd6.h compat header
 1.4 17-Nov-2014  uebayasi Define compat modules (but without dependencies yet).
 1.3 18-Jan-2003  christos branches: 1.3.150;
add compat_ossaudio
 1.2 20-Jul-1997  pk config.new => config
 1.1 04-Apr-1997  augustss * Move the Linux audio emulation into its own directory and rename it
OSS (aka VoxWare) audio emulation.
* Use the OSS audio emulation for Linux and FreeBSD.
* Add mixer emulation to the OSS emulator.
 1.3.150.1 03-Dec-2017  jdolecek update from HEAD
 1.85 20-Jun-2023  riastradh compat_ossaudio: Zero-initialize idat before copyout.

Unclear if there are any paths to the copyout without initialization,
but let's play it safe to keep the auditing effort low.

XXX pullup-8
XXX pullup-9
XXX pullup-10
 1.84 07-Sep-2021  riastradh branches: 1.84.4;
sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.83 19-Apr-2020  nia ossaudio: Avoid giving userland uninitialized memory. Noticed by maxv.

The uninitalized field in this structure is `fillers`, an array that
simply reserves space for later changes in OSSv4, which this version
of the OSS compat layer (specifically for Linux applications) makes no
effort to implement.
 1.82 19-Apr-2020  nia ossaudio: Implement SNDCTL_DSP_(SET|GET)TRIGGER.
 1.81 15-Apr-2020  nia ossaudio: If the user's channel count is rejected, use the hardware count
 1.80 15-Apr-2020  nia ossaudio: Make SNDCTL_DSP_SETFMT conform with OSSv4.

The OSSv4 spec says we shouldn't really error if an invalid format is
chosen by an application. Things are especially likely to be confused
if we return MULAW, since in OSSv4 terms that means that's the native
hardware format. Instead, set and return the current hardware format
if an invalid format is chosen.

For the 24-bit sample formats, note that the NetBSD kernel currently
can't handle them in its default configuration, and will return an error
code if you attempt to use them. So, if an applicaton requests 24-bit PCM,
promote it to 32-bit PCM. According to the spec, this is valid and
applications should be checking the return value anyway.

In the Linux compat layer, we just use S16LE as a fallback. The OSSv3
headers that are still being shipped with Linux don't contain definitions
for fancier formats and we can reasonably expect all applications to
support S16LE.
 1.79 15-Apr-2020  nia ossaudio: Make SNDCTL_DSP_SPEED more robust when using invalid rates.

From the perspective of reading the OSSv4 specification, NetBSD's
behaviour when an invalid sample rate is set makes no sense at all:
AUDIO_SETINFO simply returns an error code, and then we immediately
fall through to getting the sample rate, which is still set to the
legacy default of 8000 Hz.

Instead, what OSS applications generally expect is that they will be
able to receive the actual hardware sample rate. This is very, very
unlikely to be 8000 Hz on a modern machine.

No functional change when setting a sample rate between the supported
rates of 1000 and 192000 Hz. When a rate outside this range is requested,
the hardware rate is returned (on modern hardware, generally always 48000
Hz or a multiple of 48000 Hz).
 1.78 03-Nov-2019  isaki branches: 1.78.6;
Use record field for recording even on
SNDCTL_DSP_STEREO, SNDCTL_DSP_SETFMT, and SNDCTL_DSP_CHANNELS.
 1.77 02-Nov-2019  isaki Use record.sample_rate for recording on SNDCTL_DSP_SPEED.
It's kernel side of PR lib/54667.
 1.76 26-Sep-2019  christos - "source" is u_long in the kernel (and int in userland). Cast -1 to u_long.
- make "s" unsigned since blocksize is too.
 1.75 23-Aug-2019  maxv Fix error handling, returns an errno, not -1.
 1.74 03-Feb-2019  mrg branches: 1.74.4;
- add or adjust /* FALLTHROUGH */ where appropriate
- add __unreachable() after functions that can return but won't in
this case, and thus can't be marked __dead easily
 1.73 02-Feb-2019  isaki Correct debug messages.
 1.72 02-Feb-2019  isaki Fix minor bugs of SNDCTL_DSP_GETISPACE.
- hiwat is playback-only parameter.
- 'bytes' should not be rounded down.
 1.71 29-Jan-2019  isaki Revert a wrong OSS_SNDCTL_DSP_GETOSPACE part of rev1.70.
- 'fragments' is the number of full free blocks and should not be
negative value.
- 'bytes' should not be rounded down.
 1.70 24-Mar-2017  nat branches: 1.70.6; 1.70.14;
Update compat/ossaudio with GETISPACE/GETOSPACE corrections from
libossaudio.
 1.69 05-Sep-2014  matt branches: 1.69.2; 1.69.4; 1.69.6;
Try not to use f_data, use f_{vnode,socket,pipe,mqueue,kqueue,ksem} to get
a correctly typed pointer.
 1.68 19-Sep-2013  christos branches: 1.68.4; 1.68.10;
exec modules need to be of the exec kind
 1.67 14-Oct-2011  hannken branches: 1.67.2; 1.67.12; 1.67.16;
Change the vnode locking protocol of VOP_GETATTR() to request at least
a shared lock. Make all calls outside of file systems respect it.

The calls from file systems need review.

No objections from tech-kern.
 1.66 06-Sep-2011  jmcneill Add support for AFMT_AC3
 1.65 22-Aug-2009  christos add a lot more debugging and error checking. Alas, skype seems to be happy
getting back our values, but still does not work.
 1.64 13-Nov-2008  ad compat_ossaudio module, so others can depend on it.
 1.63 28-Apr-2008  martin branches: 1.63.2; 1.63.6; 1.63.8;
Remove clause 3 and 4 from TNF licenses
 1.62 21-Mar-2008  ad branches: 1.62.2; 1.62.4;
Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
 1.61 20-Dec-2007  dsl branches: 1.61.6;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.60 08-Dec-2007  dsl branches: 1.60.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.59 04-Dec-2007  dsl Remove all the __P
 1.58 26-Nov-2007  pooka branches: 1.58.2;
Remove the "struct lwp *" argument from all VFS and VOP interfaces.
The general trend is to remove it from all kernel interfaces and
this is a start. In case the calling lwp is desired, curlwp should
be used.

quick consensus on tech-kern
 1.57 18-Sep-2007  mlelstv branches: 1.57.6;
Implement OSS_SNDCTL_DSP_GETODELAY and provide a no-op function
for OSS_SNDCTL_DSP_PROFILE.
 1.56 11-Jun-2007  joerg branches: 1.56.6; 1.56.8;
Add a new ioctl AUDIO_GETBUFINFO. It works like AUDIO_GETINFO, but
doesn't obtain the ports, gain and balance related parameters.
Those generally require reading from the hardware and therefore are much
more expensive to obtain. Modify OSS emulation to use the new ioctl
where possible.

This reduces CPU usage of mplayer during mp3 playback with my Thinkpad
from 20% to < 1% and from 50% to 20% during Xvid playback.

Review and comments from jmcneill@
 1.55 04-Mar-2007  christos branches: 1.55.2; 1.55.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.54 09-Feb-2007  ad branches: 1.54.2;
Merge newlock2 to head.
 1.53 03-Sep-2006  christos branches: 1.53.2; 1.53.6; 1.53.8;
remove unneeded initializer.
 1.52 23-Jul-2006  ad Use the LWP cached credentials where sane.
 1.51 14-May-2006  elad integrate kauth.
 1.50 04-Mar-2006  xtraeme branches: 1.50.2; 1.50.4; 1.50.6;
Instead of getting properties from calling ioctl with AUDIO_GETINFO, use
AUDIO_INITINFO(). Now the sound with the linux flash plugin works
properly.

From OpenBSD.
 1.49 11-Dec-2005  christos branches: 1.49.4; 1.49.6;
merge ktrace-lwp.
 1.48 08-Dec-2005  tron Fix problem in ioctl() handling in OSS audio emulation which caused
unintentional changes of the audio settings e.g. when running "kphone".

Patch submitted by George Michaelson on "tech-kern@NetBSD.org".
 1.47 26-Feb-2005  perry branches: 1.47.2; 1.47.4;
nuke trailing whitespace
 1.46 18-Nov-2004  kent branches: 1.46.4; 1.46.6;
getdevinfo():
If a mixer item does not match with AudioNsomething, check whether
it ends with '.' + AudioNsomething. PR#15441
 1.45 29-Jun-2003  fvdl branches: 1.45.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.44 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.43 23-Jun-2003  augustss Fix missing call to FILE_UNUSE. From kern/21946, from Todd Vierling.
 1.42 21-Mar-2003  dsl Change 'data' argument to fo_ioctl and fo_fcntl from 'caddr_t' to 'void *'.
Avoids a lot of casting and removes the need for some line breaks.
Removed a load of (caddr_t) casts from calls to copyin/copyout as well.
(approved by christos - he has a plan to remove caddr_t...)
 1.41 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.40 12-Jan-2003  jdolecek add support for SNDCTL_DSP_SETDUPLEX ioctl to ossaudio emulation code
code provided by Andreas Wrede in PR kern/19793
 1.39 24-Dec-2001  mycroft branches: 1.39.10;
Make SNDCTL_DSP_POST a nop. It's explicitly *not* supposed to sleep, and as
it's merely advisory (and in fact is implemented as a nop in the OSS->ALSA
shim), it should be safe to ignore it.
 1.38 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.37 09-Jul-2001  kim branches: 1.37.2;
Map OSS mixer device "line1" to native mixer device "aux".
 1.36 14-Jun-2001  thorpej Fix a partial construction problem that can cause race conditions
between creation of a file descriptor and close(2) when using kernel
assisted threads. What we do is stick descriptors in the table, but
mark them as "larval". This causes essentially everything to treat
it as a non-existent descriptor, except for fdalloc(), which sees a
filled slot so that it won't (incorrectly) allocate it again. When
a descriptor is fully constructed, the code that has constructed it
marks it as "mature" (which actually clears the "larval" flag), and
things continue to work as normal.

While here, gather all the code that gets a descriptor from the table
into a fd_getfile() function, and call it, rather than having the
same (sometimes incorrect) code copied all over the place.
 1.35 10-May-2001  augustss Improved fix of PR12796, from Frederick Bruckman <fb@enteract.com>
 1.34 09-May-2001  augustss Apply patch in PR lib/12796 from Frederick Bruckman <fb@enteract.com>
 1.33 18-Jan-2001  jdolecek branches: 1.33.2;
constify
 1.32 16-Aug-2000  tron Use accurate rounding in conversion between OSS and NetBSD volume values.
The optimized integer formula was supplied by Wolfgang Solfrank on
"tech-kern@netbsd.org". This fixes problems with e.g FreeBSD TV (fxtv),
RealPlayer-7.0 Beta 2 (PR pkg/10818) and KDE's "kscd".
 1.31 04-Jul-2000  augustss Implement OSS_GETVERSION.
Accept mixer values above max (100).
Handle the info from AUDIO_MIXER_DEVINFO properly, parts of it is opaque.
 1.30 17-Nov-1999  augustss branches: 1.30.4;
Implement OSS_SOUND_MIXER_INFO.
 1.29 22-Aug-1999  kleink branches: 1.29.2; 1.29.8;
Per discussion with Lennart Augustsson, change the behaviour to report emulated
encodings, too. (This is currently an issue with the eso(4) driver, which,
due to different byte orders in playing and recording directions, sets the
emulated flag for all 16-bit encodings, although it could be argued that this
is an unfortunate weakness of the query_encoding() interface.)
 1.28 05-May-1999  thorpej Add "use counting" to file entries. When closing a file, and it's reference
count is 0, wait for use count to drain before finishing the close.

This is necessary in order for multiple processes to safely share file
descriptor tables.
 1.27 13-Apr-1999  augustss Make copyright conform.
 1.26 07-Aug-1998  augustss branches: 1.26.6;
Add MIDI support. The MIDI devices can be accessed as ``raw'' through
the /dev/rmidiN devices, or with a sequencer interface via /dev/music.
So far the only supported MIDI device is the MPU401 port on SoundBlaster
(and only on SB on isapnp, since we do not have locators with multiple
values yet).
 1.25 25-May-1998  augustss Fix off by 1 error
 1.24 19-Mar-1998  mycroft SETFRAGMENT ignores the high bit.
 1.23 19-Oct-1997  augustss branches: 1.23.2;
Make the audio API (almost) SunOS compatible.
The changes is to allow some limited mixer manipulation through
the audio device (instead of the mixer device).
This rendered 4 methods in audio_hw_if unused so garbage collect these.
 1.22 16-Oct-1997  augustss Insert missing NetBSD copyright notices.
 1.21 07-Oct-1997  augustss Emulate setting the hiwater mark with SETFRAGMENT the right way.
Get rid of some 'register'.
 1.20 24-Aug-1997  augustss Increase the number of mixer devices the emulation looks at.
 1.19 11-Aug-1997  augustss Oops, forgot two lines in last commit.
 1.18 11-Aug-1997  augustss Implement OSS_SNDCTL_DSP_NONBLOCK.
 1.17 11-Aug-1997  augustss Some more debugging output.
 1.16 07-Aug-1997  augustss Make sure OSS_SNDCTL_DSP_GETFMTS returns the formats the audio driver
can handle and not just some random guess.
Also add some debugging stuff.
 1.15 06-Aug-1997  augustss Improve ioctl decoding.
Change mixer name mappings.
 1.14 28-Jul-1997  augustss branches: 1.14.2;
Make sure the blocksize is always a power of 2 when inspected.
OSS only uses powers of 2 so some programs expect this.
Now Quake works!
 1.13 27-Jul-1997  augustss Changes to the sudio system:
- It is now possible to handle devices that want "looping" DMA,
e.g. the SoundBlaster correctly. The WSS and SB drivers use this.
To do this several new methods were introduced in audio_hw_if.
- Different silence handling (forced by previous change).
- The audio driver can now be mmap()-ed, but due to problems in
the VM system only for writing for now.
- The OSS (Linux) audio emulation takes advantage of some of the
new features.
 1.12 15-Jul-1997  augustss In the name of backwards compatibility AUDIO_ENCODING_LINEAR has been
renamed AUDIO_ENCODING_SLINEAR and AUDIO_ENCODING_LINEAR reverts to the
NetBSD 1.2 sematics. A kernel with COMPAT_12 defined will accept
AUDIO_ENCODING_LINEAR and treat it as before, without COMPAT_12 it
will be rejected.
 1.11 19-May-1997  augustss Add missing initialization.
 1.10 19-May-1997  augustss Fix recording source selection bug.
 1.9 07-May-1997  augustss Return audio buffer size in audio_info_t with ioctl() AUDIO_GETINFO.
Use the buffer size to implement one more OSS ioctl().
 1.8 07-May-1997  augustss Convert to new orthogonal audio encoding scheme and implement
some of the new encodings. The change to ioctl AUDIO_GETENC is
NOT backwards compatible.
 1.7 06-Apr-1997  augustss Improve setting of record source.
 1.6 04-Apr-1997  augustss * Move the Linux audio emulation into its own directory and rename it
OSS (aka VoxWare) audio emulation.
* Use the OSS audio emulation for Linux and FreeBSD.
* Add mixer emulation to the OSS emulator.
 1.5 20-Mar-1997  mycroft Copy back the format we set in SNDCTL_DSP_SETFMT.
 1.4 20-Mar-1997  mycroft SOUND_PCM_WRITE_CHANNELS -> SNDCTL_DSP_CHANNELS, to match current Linux code.
 1.3 19-Mar-1997  mycroft Emulate the SOUND_PCM_WRITE_CHANNELS ioctl. From PR 3356, by Lennart
Augustsson. Also add hooks for mixer ioctls.
 1.2 17-Oct-1996  fvdl Add RCS Id.
 1.1 08-Mar-1996  mycroft Separate ioctl emulation by group. Add (minimal) audio emulation.
 1.14.2.3 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.14.2.2 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.14.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.23.2.1 08-May-1998  mycroft Pull up 1.24, per request of mycroft.
 1.26.6.2 26-Aug-2000  he Pull up revision 1.32 (via patch, requested by tron):
Use accurate rounding in conversion between OSS and NetBSD
volume values. Fixes among other things PR#10818.
 1.26.6.1 16-Apr-1999  augustss branches: 1.26.6.1.2;
Make a bunch of copyright headers conform to the standard.
Pullup approved by Perry.
 1.26.6.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.29.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.29.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.29.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.30.4.4 27-Dec-2001  he Pull up revision 1.39 (requested by mycroft):
Change our emulation of SNDCTL_DSP_POST so that OSS applications
(e.g. xmms) don't randomly pause.
 1.30.4.3 16-Aug-2001  tv Pullup [fb]:

lib/libossaudio/ossaudio.c 1.13-1.14
lib/libossaudio/soundcard.h 1.11
sys/compat/ossaudio/ossaudio.c 1.34-1.35

Correctly calculate input and output hardware buffer sizes.
Fixes PR lib/12796.
 1.30.4.2 16-Aug-2000  tron pullup (approved by releng-1-5)

Use accurate rounding in conversion between OSS and NetBSD volume values.
The optimized integer formula was supplied by Wolfgang Solfrank on
"tech-kern@netbsd.org". This fixes problems with e.g FreeBSD TV (fxtv),
RealPlayer-7.0 Beta 2 (PR pkg/10818) and KDE's "kscd".

syssrc/sys/compat/ossaudio/ossaudio.c 1.31 -> 1.32
basesrc/lib/libossaudio/ossaudio.c 1.11 -> 1.12
 1.30.4.1 07-Aug-2000  augustss Pull up:
sys/compat/ossaudio/ossaudio.c 1.30-1.31
sys/compat/ossaudio/ossaudiovar.h 1.7-1.9
lib/libossaudio/ossaudio.c 1.10-1.11
Accept mixer values above max (100).
Handle the info from AUDIO_MIXER_DEVINFO properly, parts of it is opaque.
Approved by thorpej.
 1.33.2.6 15-Jan-2003  thorpej Sync with HEAD.
 1.33.2.5 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.33.2.4 08-Jan-2002  nathanw Catch up to -current.
 1.33.2.3 14-Nov-2001  nathanw Catch up to -current.
 1.33.2.2 24-Aug-2001  nathanw Catch up with -current.
 1.33.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.37.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.39.10.1 17-Aug-2003  tron Pull up revision 1.43 (requested by tv in ticket #1422):
Fix missing call to FILE_UNUSE. From kern/21946, from Todd Vierling.
 1.45.2.7 11-Dec-2005  christos Sync with head.
 1.45.2.6 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.45.2.5 29-Nov-2004  skrll Sync with HEAD.
 1.45.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.45.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.45.2.2 19-Aug-2003  skrll Fix patch botch.
 1.45.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.46.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.46.4.1 29-Apr-2005  kent sync with -current
 1.47.4.8 24-Mar-2008  yamt sync with head.
 1.47.4.7 21-Jan-2008  yamt sync with head
 1.47.4.6 07-Dec-2007  yamt sync with head
 1.47.4.5 27-Oct-2007  yamt sync with head.
 1.47.4.4 03-Sep-2007  yamt sync with head.
 1.47.4.3 26-Feb-2007  yamt sync with head.
 1.47.4.2 30-Dec-2006  yamt sync with head.
 1.47.4.1 21-Jun-2006  yamt sync with head.
 1.47.2.1 21-Jan-2006  snj Pull up following revision(s) (requested by tron in ticket #1127):
sys/compat/ossaudio/ossaudio.c: revision 1.48
Fix problem in ioctl() handling in OSS audio emulation which caused
unintentional changes of the audio settings e.g. when running "kphone".
Patch submitted by George Michaelson on "tech-kern@NetBSD.org".
 1.49.6.2 01-Jun-2006  kardel Sync with head.
 1.49.6.1 22-Apr-2006  simonb Sync with head.
 1.49.4.1 09-Sep-2006  rpaulo sync with head
 1.50.6.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.50.4.1 08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.50.2.3 14-Sep-2006  yamt sync with head.
 1.50.2.2 11-Aug-2006  yamt sync with head
 1.50.2.1 24-May-2006  yamt sync with head.
 1.53.8.1 03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.53.6.1 12-Jun-2007  liamjfoy Pull up following revision(s) (requested by jmcneill in ticket #716):
share/man/man4/audio.4: revision 1.66
sys/compat/ossaudio/ossaudio.c: revision 1.56
sys/sys/audioio.h: revision 1.32
lib/libossaudio/ossaudio.c: revision 1.21
sys/dev/audio.c: revision 1.222
Add a new ioctl AUDIO_GETBUFINFO. It works like AUDIO_GETINFO, but
doesn't obtain the ports, gain and balance related parameters.
Those generally require reading from the hardware and therefore are
much
more expensive to obtain. Modify OSS emulation to use the new ioctl
where possible.
This reduces CPU usage of mplayer during mp3 playback with my Thinkpad
from 20% to < 1% and from 50% to 20% during Xvid playback.
Review and comments from jmcneill@
 1.53.2.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.54.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.55.4.1 11-Jul-2007  mjf Sync with head.
 1.55.2.2 09-Oct-2007  ad Sync with head.
 1.55.2.1 15-Jul-2007  ad Sync with head.
 1.56.8.2 09-Jan-2008  matt sync with HEAD
 1.56.8.1 06-Nov-2007  matt sync with HEAD
 1.56.6.3 09-Dec-2007  jmcneill Sync with HEAD.
 1.56.6.2 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.56.6.1 02-Oct-2007  joerg Sync with HEAD.
 1.57.6.2 27-Dec-2007  mjf Sync with HEAD.
 1.57.6.1 08-Dec-2007  mjf Sync with HEAD.
 1.58.2.2 26-Dec-2007  ad Sync with head.
 1.58.2.1 08-Dec-2007  ad Sync with head.
 1.60.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.61.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.61.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.61.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.62.4.3 16-Sep-2009  yamt sync with head
 1.62.4.2 04-May-2009  yamt sync with head.
 1.62.4.1 16-May-2008  yamt sync with head.
 1.62.2.1 18-May-2008  yamt sync with head.
 1.63.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.63.6.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.63.2.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.63.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.67.16.1 18-May-2014  rmind sync with head
 1.67.12.2 03-Dec-2017  jdolecek update from HEAD
 1.67.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.67.2.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.68.10.1 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1720:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149 (patch)
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54 (patch)

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.68.4.1 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1720:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149 (patch)
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54 (patch)

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.69.6.1 21-Apr-2017  bouyer Sync with HEAD
 1.69.4.1 26-Apr-2017  pgoyette Sync with HEAD
 1.69.2.1 28-Aug-2017  skrll Sync with HEAD
 1.70.14.3 21-Apr-2020  martin Sync with HEAD
 1.70.14.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.70.14.1 10-Jun-2019  christos Sync with HEAD
 1.70.6.5 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1841):

sys/compat/sunos32/sunos32_misc.c: revision 1.86
sys/compat/ossaudio/ossaudio.c: revision 1.85
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.48

compat_sunos32: Memset zero before copyout.

Unclear if this can leak anything but let's be on the safe side.

compat_ossaudio: Zero-initialize idat before copyout.
Unclear if there are any paths to the copyout without initialization,
but let's play it safe to keep the auditing effort low.

linux32_rt_sendsig: Memset zero before copyout.
Not sure if there's any padding here, but it's a pretty big
structure, fairly likely, so let's be rather safe than sorry.
 1.70.6.4 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1836):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.70.6.3 22-Apr-2020  martin Pull up following revision(s) (requested by maxv in ticket #1535):

sys/compat/ossaudio/ossaudio.c: revision 1.83

ossaudio: Avoid giving userland uninitialized memory. Noticed by maxv.

The uninitalized field in this structure is `fillers`, an array that
simply reserves space for later changes in OSSv4, which this version
of the OSS compat layer (specifically for Linux applications) makes no
effort to implement.
 1.70.6.2 21-Jan-2020  martin Pull up the following, requested by christos in ticket #1487:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.70.6.1 09-Feb-2019  martin Pull up following revision(s) (requested by isaki in ticket #1185):

lib/libossaudio/ossaudio.c: revision 1.35
sys/compat/ossaudio/ossaudio.c: revision 1.71

Revert a wrong SNDCTL_DSP_GETOSPACE part of rev1.33.
- 'fragments' is the number of full free blocks and should not be
negative value.
- 'bytes' should not be rounded down.

It makes mpv work correctly (fixes a second half of kern/53028).
Reviewed by mlelstv@

-

Revert a wrong OSS_SNDCTL_DSP_GETOSPACE part of rev1.70.
- 'fragments' is the number of full free blocks and should not be
negative value.
- 'bytes' should not be rounded down.
 1.74.4.6 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1650):

sys/compat/sunos32/sunos32_misc.c: revision 1.86
sys/compat/ossaudio/ossaudio.c: revision 1.85
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.48

compat_sunos32: Memset zero before copyout.

Unclear if this can leak anything but let's be on the safe side.

compat_ossaudio: Zero-initialize idat before copyout.
Unclear if there are any paths to the copyout without initialization,
but let's play it safe to keep the auditing effort low.

linux32_rt_sendsig: Memset zero before copyout.
Not sure if there's any padding here, but it's a pretty big
structure, fairly likely, so let's be rather safe than sorry.
 1.74.4.5 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.74.4.4 27-Apr-2020  martin Pull up following revision(s) (requested by nia in ticket #855):

lib/libossaudio/ossaudio.c: revision 1.41
lib/libossaudio/ossaudio.c: revision 1.42
lib/libossaudio/ossaudio.c: revision 1.43
sys/compat/ossaudio/ossaudio.c: revision 1.80
sys/compat/ossaudio/ossaudio.c: revision 1.81
sys/compat/ossaudio/ossaudio.c: revision 1.82
lib/libossaudio/ossaudio.c: revision 1.39
sys/compat/ossaudio/ossaudio.c: revision 1.79
lib/libossaudio/ossaudio.c: revision 1.40

ossaudio: Make SNDCTL_DSP_SPEED more robust when using invalid rates.

From the perspective of reading the OSSv4 specification, NetBSD's
behaviour when an invalid sample rate is set makes no sense at all:
AUDIO_SETINFO simply returns an error code, and then we immediately
fall through to getting the sample rate, which is still set to the
legacy default of 8000 Hz.

Instead, what OSS applications generally expect is that they will be
able to receive the actual hardware sample rate. This is very, very
unlikely to be 8000 Hz on a modern machine.

No functional change when setting a sample rate between the supported
rates of 1000 and 192000 Hz. When a rate outside this range is requested,
the hardware rate is returned (on modern hardware, generally always 48000
Hz or a multiple of 48000 Hz).

ossaudio: Make SNDCTL_DSP_SETFMT conform with OSSv4.

The OSSv4 spec says we shouldn't really error if an invalid format is
chosen by an application. Things are especially likely to be confused
if we return MULAW, since in OSSv4 terms that means that's the native
hardware format. Instead, set and return the current hardware format
if an invalid format is chosen.

For the 24-bit sample formats, note that the NetBSD kernel currently
can't handle them in its default configuration, and will return an error
code if you attempt to use them. So, if an applicaton requests 24-bit PCM,
promote it to 32-bit PCM. According to the spec, this is valid and
applications should be checking the return value anyway.

In the Linux compat layer, we just use S16LE as a fallback. The OSSv3
headers that are still being shipped with Linux don't contain definitions
for fancier formats and we can reasonably expect all applications to
support S16LE.

ossaudio: If the user's channel count is rejected, use the hardware count

ossaudio: Make SNDCTL_DSP_[GET|SET][PLAY|RECORD]VOL closer to OSSv4

Problems in the previous code include returning values in the 0-255
range NetBSD uses instead of the 0-100 range OSSv4 expects, using
AUDIO_GETBUFINFO (which doesn't even return the mixer bits), and
not encoding channels as specified: "level=(left)|(right << 8)".

In reality, setting the gain in this way (through /dev/audio rather
than /dev/mixer) doesn't seem to work properly, and the mixer-set
value seems to be retained.

However, these changes at least ensure that the return values are
correct and the balance is set correctly.

I've only found one application using this API (audio/audacious), and
OSSv4 support in it is currently disabled precisely because it breaks
when it attempts to set the track volume using it.

ossaudio: Implement SNDCTL_DSP_(SET|GET)TRIGGER.
 1.74.4.3 22-Apr-2020  martin Pull up following revision(s) (requested by maxv in ticket #841):

sys/compat/ossaudio/ossaudio.c: revision 1.83

ossaudio: Avoid giving userland uninitialized memory. Noticed by maxv.

The uninitalized field in this structure is `fillers`, an array that
simply reserves space for later changes in OSSv4, which this version
of the OSS compat layer (specifically for Linux applications) makes no
effort to implement.
 1.74.4.2 19-Nov-2019  martin Pull up following revision(s) (requested by isaki in ticket #446):
lib/libossaudio/ossaudio.c: revision 1.37
lib/libossaudio/ossaudio.c: revision 1.38
sys/compat/ossaudio/ossaudio.c: revision 1.77
sys/compat/ossaudio/ossaudio.c: revision 1.78
Use record.sample_rate for recording on SNDCTL_DSP_SPEED.
Fix PR lib/54667.
Use record.sample_rate for recording on SNDCTL_DSP_SPEED.
It's kernel side of PR lib/54667.
Use record field for recording even on
SNDCTL_DSP_STEREO, SNDCTL_DSP_SETFMT, and SNDCTL_DSP_CHANNELS.
 1.74.4.1 13-Sep-2019  martin Pull up following revision(s) (requested by maxv in ticket #194):

sys/compat/linux/common/linux_socket.c: revision 1.146
sys/compat/linux/common/linux_socket.c: revision 1.147
sys/compat/linux/common/linux_socket.c: revision 1.148
sys/compat/linux/common/linux_socket.c: revision 1.149
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.59
sys/compat/linux32/common/linux32_sysinfo.c: revision 1.8
sys/kern/sysv_shm.c: revision 1.138
sys/compat/linux/common/linux_file64.c: revision 1.61
sys/compat/linux/common/linux_file64.c: revision 1.62
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.58
sys/compat/linux32/common/linux32_dirent.c: revision 1.20
sys/compat/linux32/common/linux32_utsname.c: revision 1.10
sys/compat/linux/common/linux_termios.h: revision 1.22
sys/compat/linux32/common/linux32_termios.c: revision 1.15
sys/compat/linux32/common/linux32_misc.c: revision 1.27
sys/compat/linux32/common/linux32_ioctl.c: revision 1.14
sys/compat/linux/common/linux_statfs.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.57
sys/compat/linux/common/linux_fcntl.h: revision 1.18
sys/compat/linux/common/linux_socket.h: revision 1.24
sys/sys/shm.h: revision 1.54
sys/compat/ossaudio/ossaudio.c: revision 1.75
sys/compat/linux32/common/linux32_signal.c: revision 1.20
sys/miscfs/procfs/procfs_linux.c: revision 1.75
sys/compat/linux/common/linux_signal.c: revision 1.81
sys/compat/linux/common/linux_termios.c: revision 1.38
sys/compat/linux/common/linux_misc.c: revision 1.241
sys/compat/linux/common/linux_misc.c: revision 1.242
sys/compat/linux/common/linux_misc.c: revision 1.243
sys/compat/linux/common/linux_misc.c: revision 1.244

Fix info leaks.

Fix stupid bugs in linux_sys_shmctl(): the index could be out of bound
(page fault) and there was no proper locking.
Maybe we should just remove LINUX_SHM_STAT, like compat_linux32.

Remove printf.

When dealing with an unknown value, set -1, to prevent (harmless)
uninitialized accesses later.

Add a default case, don't call sys_ioctl() with an uninitialized 'com'
argument.

Fix error handling, returns an errno, not -1.

Put the printf under DEBUG_LINUX.


Hum, don't forget the 'pid' argument, otherwise we're not gonna go very
far.

Don't read data from userland directly. This simply does not work on any
recent x86 CPU (thanks to SMAP) and all architectures that forbid direct
access to userland from the kernel. But I guess no one noticed because no
one ever uses compat_linux, right?

Hum, don't pass an mbuf to realloc(). Inspired from copyin32_msg_control().

Fix memory leak.

I don't see the point in having this useless printf, but add a '\n' to it,
so that it at least displays useless stuff correctly.

Hum, remove incorrect assignment. Userland could have passed a smaller
namelen, and the uninitialized bytes from sb_data were being used later in
the network stack.
 1.78.6.1 20-Apr-2020  bouyer Sync with HEAD
 1.84.4.1 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #204):

sys/compat/sunos32/sunos32_misc.c: revision 1.86
sys/compat/ossaudio/ossaudio.c: revision 1.85
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.48

compat_sunos32: Memset zero before copyout.

Unclear if this can leak anything but let's be on the safe side.

compat_ossaudio: Zero-initialize idat before copyout.
Unclear if there are any paths to the copyout without initialization,
but let's play it safe to keep the auditing effort low.

linux32_rt_sendsig: Memset zero before copyout.
Not sure if there's any padding here, but it's a pretty big
structure, fairly likely, so let's be rather safe than sorry.
 1.12 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.11 20-Dec-2007  dsl branches: 1.11.6; 1.11.8; 1.11.10;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.10 04-Dec-2007  dsl branches: 1.10.4;
Remove all the __P
 1.9 11-Dec-2005  christos branches: 1.9.44; 1.9.46; 1.9.52; 1.9.56;
merge ktrace-lwp.
 1.8 29-Jun-2003  fvdl branches: 1.8.2; 1.8.18;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.7 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.6 13-Apr-1999  augustss Make copyright conform.
 1.5 16-Oct-1997  augustss branches: 1.5.10;
Insert missing NetBSD copyright notices.
 1.4 04-Apr-1997  augustss * Move the Linux audio emulation into its own directory and rename it
OSS (aka VoxWare) audio emulation.
* Use the OSS audio emulation for Linux and FreeBSD.
* Add mixer emulation to the OSS emulator.
 1.3 20-Mar-1997  mycroft SOUND_PCM_WRITE_CHANNELS -> SNDCTL_DSP_CHANNELS, to match current Linux code.
 1.2 19-Mar-1997  mycroft Emulate the SOUND_PCM_WRITE_CHANNELS ioctl. From PR 3356, by Lennart
Augustsson. Also add hooks for mixer ioctls.
 1.1 08-Mar-1996  mycroft Separate ioctl emulation by group. Add (minimal) audio emulation.
 1.5.10.1 16-Apr-1999  augustss branches: 1.5.10.1.2;
Make a bunch of copyright headers conform to the standard.
Pullup approved by Perry.
 1.5.10.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.8.18.3 21-Jan-2008  yamt sync with head
 1.8.18.2 07-Dec-2007  yamt sync with head
 1.8.18.1 21-Jun-2006  yamt sync with head.
 1.8.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.8.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.8.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.9.56.2 26-Dec-2007  ad Sync with head.
 1.9.56.1 08-Dec-2007  ad Sync with head.
 1.9.52.2 27-Dec-2007  mjf Sync with HEAD.
 1.9.52.1 08-Dec-2007  mjf Sync with HEAD.
 1.9.46.1 09-Jan-2008  matt sync with HEAD
 1.9.44.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.10.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.11.10.1 16-May-2008  yamt sync with head.
 1.11.8.1 18-May-2008  yamt sync with head.
 1.11.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.16 06-Sep-2011  jmcneill Add support for AFMT_AC3
 1.15 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.14 22-Jan-2008  jmcneill branches: 1.14.6; 1.14.8; 1.14.10;
Add ossaudio support for COMPAT_LINUX32, with help from mrg. With this
change, audio now works on amd64 with native firefox, nspluginwrapper, and
the 32-bit linux flash binaries.
 1.13 18-Sep-2007  mlelstv branches: 1.13.6; 1.13.12;
Implement OSS_SNDCTL_DSP_GETODELAY and provide a no-op function
for OSS_SNDCTL_DSP_PROFILE.
 1.12 04-Mar-2007  christos branches: 1.12.2; 1.12.14; 1.12.16;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.11 11-Dec-2005  christos branches: 1.11.24; 1.11.26; 1.11.30;
merge ktrace-lwp.
 1.10 26-Feb-2005  perry branches: 1.10.4;
nuke trailing whitespace
 1.9 04-Jul-2000  augustss branches: 1.9.24; 1.9.32; 1.9.34;
Implement OSS_GETVERSION.
Accept mixer values above max (100).
Handle the info from AUDIO_MIXER_DEVINFO properly, parts of it is opaque.
 1.8 19-Nov-1999  augustss branches: 1.8.4;
Fix typo in comment. From Brad <brad@openbsd.org>
 1.7 17-Nov-1999  augustss Implement OSS_SOUND_MIXER_INFO.
 1.6 13-Apr-1999  augustss branches: 1.6.2; 1.6.8;
Make copyright conform.
 1.5 07-Aug-1998  augustss branches: 1.5.6;
Add MIDI support. The MIDI devices can be accessed as ``raw'' through
the /dev/rmidiN devices, or with a sequencer interface via /dev/music.
So far the only supported MIDI device is the MPU401 port on SoundBlaster
(and only on SB on isapnp, since we do not have locators with multiple
values yet).
 1.4 16-Oct-1997  augustss Insert missing NetBSD copyright notices.
 1.3 06-Aug-1997  augustss Improve ioctl decoding.
Change mixer name mappings.
 1.2 27-Jul-1997  augustss branches: 1.2.2;
Changes to the sudio system:
- It is now possible to handle devices that want "looping" DMA,
e.g. the SoundBlaster correctly. The WSS and SB drivers use this.
To do this several new methods were introduced in audio_hw_if.
- Different silence handling (forced by previous change).
- The audio driver can now be mmap()-ed, but due to problems in
the VM system only for writing for now.
- The OSS (Linux) audio emulation takes advantage of some of the
new features.
 1.1 04-Apr-1997  augustss * Move the Linux audio emulation into its own directory and rename it
OSS (aka VoxWare) audio emulation.
* Use the OSS audio emulation for Linux and FreeBSD.
* Add mixer emulation to the OSS emulator.
 1.2.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.5.6.1 16-Apr-1999  augustss branches: 1.5.6.1.2;
Make a bunch of copyright headers conform to the standard.
Pullup approved by Perry.
 1.5.6.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.6.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.6.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.8.4.1 07-Aug-2000  augustss Pull up:
sys/compat/ossaudio/ossaudio.c 1.30-1.31
sys/compat/ossaudio/ossaudiovar.h 1.7-1.9
lib/libossaudio/ossaudio.c 1.10-1.11
Accept mixer values above max (100).
Handle the info from AUDIO_MIXER_DEVINFO properly, parts of it is opaque.
Approved by thorpej.
 1.9.34.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.9.32.1 29-Apr-2005  kent sync with -current
 1.9.24.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.10.4.3 04-Feb-2008  yamt sync with head.
 1.10.4.2 27-Oct-2007  yamt sync with head.
 1.10.4.1 03-Sep-2007  yamt sync with head.
 1.11.30.1 04-Sep-2008  skrll Sync with netbsd-4.
 1.11.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.11.24.1 20-Aug-2008  bouyer Pull up following revision(s) (requested by jmcneill in ticket #1051):
sys/compat/linux32/common/linux32_ioctl.c: revision 1.10 via patch
sys/compat/ossaudio/ossaudiovar.h: revision 1.14
Add ossaudio support for COMPAT_LINUX32, with help from mrg. With this
change, audio now works on amd64 with native firefox, nspluginwrapper, and
the 32-bit linux flash binaries.
 1.12.16.2 23-Mar-2008  matt sync with HEAD
 1.12.16.1 06-Nov-2007  matt sync with HEAD
 1.12.14.1 02-Oct-2007  joerg Sync with HEAD.
 1.12.2.1 09-Oct-2007  ad Sync with head.
 1.13.12.1 23-Jan-2008  bouyer Sync with HEAD.
 1.13.6.1 18-Feb-2008  mjf Sync with HEAD.
 1.14.10.1 16-May-2008  yamt sync with head.
 1.14.8.1 18-May-2008  yamt sync with head.
 1.14.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.7 07-Mar-2015  christos fix typo
 1.6 14-Jan-2014  christos branches: 1.6.6;
use new bsd.syscall.mk
 1.5 11-Dec-2005  christos branches: 1.5.110; 1.5.120; 1.5.126;
merge ktrace-lwp.
 1.4 26-Feb-2005  perry make this rebuild generated files by default
 1.3 15-Nov-2003  thorpej branches: 1.3.8; 1.3.10;
We have CVS; there is no reason to make .bak files when generating the
syscall tables.
 1.2 26-Oct-2003  lukem Use ${HOST_SH} instead of `sh'.

If necessary, pull in <bsd.sys.mk> to get the definition of HOST_SH;
Makefiles that pull in one of (most of) <bsd.*.mk> will get this anyway.
 1.1 05-May-1996  veego branches: 1.1.64;
Added a missing Makefile and run it
Moved the prototyp for sunos_sendsig in an #ifndef sparc
 1.1.64.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.1.64.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.64.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.64.1 03-Aug-2004  skrll Sync with HEAD
 1.3.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.3.8.1 29-Apr-2005  kent sync with -current
 1.5.126.1 18-May-2014  rmind sync with head
 1.5.120.2 03-Dec-2017  jdolecek update from HEAD
 1.5.120.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.5.110.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.6.6.1 06-Apr-2015  skrll Sync with HEAD
 1.5 04-Dec-1997  tv Standardize COMPAT_SUNOS -- remove all references to
sunos_exec_aout_makecmds() in machdep.c for various architectures and put
it in exec_conf.c like the other emulations; rename exec.h to
sunos_exec.h.
 1.4 25-Oct-1994  deraadt rename, new syscall interface, etc.
 1.3 29-Jun-1994  cgd New RCS ID's, take two. they're more aesthecially pleasant, and use 'NetBSD'
 1.2 28-Jan-1994  jtc Fix spelling error in Copyright notice
 1.1 28-Nov-1993  deraadt branches: 1.1.2;
compat exec() stuff is done more sensibly now
(hpux and ultrix compat stuff will be done the same way)
 1.1.2.2 28-Nov-1993  deraadt compat exec() stuff is done more sensibly now
(hpux and ultrix compat stuff will be done the same way)
 1.1.2.1 28-Nov-1993  deraadt file exec.h was added on branch magnum on 1993-11-28 18:03:19 +0000
 1.11 12-Feb-2019  mrg compat_sunos depends upon compat_09. fixes:

[ 1.8785495] WARNING: module error: built-in module compat_sunos can't find builtin dependency `compat_09'
[ 1.8785495] WARNING: module error: built-in module compat_sunos prerequisite compat_09 failed, error 2
 1.10 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.9 17-Nov-2014  uebayasi branches: 1.9.18; 1.9.20;
Define compat modules (but without dependencies yet).
 1.8 19-Nov-2008  ad branches: 1.8.26;
Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.7 02-Feb-2001  mrg branches: 1.7.122; 1.7.126; 1.7.132; 1.7.136;
don't build these files if we're doing compat_netbsd32 as well.
a different set are required.
 1.6 01-Dec-2000  jdolecek put aout specific sunos code from sunos_exec.c to separate file
sunos_exec_aout.c
make LKM safe
add EMUL_GETPID_PASS_PPID|EMUL_GETID_PASS_EID to emul_sunos flags
 1.5 06-Aug-1998  mrg branches: 1.5.12;
if syscall_debug & compat_sunos, include sunos_syscalls.c
 1.4 20-Jul-1997  pk branches: 1.4.8;
config.new => config
 1.3 24-Jun-1995  christos Use compat_util.[ch]
 1.2 11-Jun-1995  pk Go with the flow; use `/emul/sunos' pseudo-root (from Matthew Green).
Note: sunos_stat() and sunos_lstat() were added too.
 1.1 27-Apr-1995  christos Try to make the reboot system call compile under sun3 with RB_STRING
support [not tested]
Add files.sunos
Rename system call switch table file from sunos_init_sysent.c to sunos_sysent.c
like other emulations.
 1.4.8.1 30-Jul-1998  eeh Split vm_offset_t and vm_size_t into paddr_t, psize_t, vaddr_t, and vsize_t.
 1.5.12.2 11-Feb-2001  bouyer Sync with HEAD.
 1.5.12.1 08-Dec-2000  bouyer Sync with HEAD.
 1.7.136.1 19-Jan-2009  skrll Sync with HEAD.
 1.7.132.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.7.126.1 04-May-2009  yamt sync with head.
 1.7.122.1 17-Jan-2009  mjf Sync with HEAD.
 1.8.26.1 03-Dec-2017  jdolecek update from HEAD
 1.9.20.1 10-Jun-2019  christos Sync with HEAD
 1.9.18.1 12-Mar-2018  pgoyette Update dependencies for modules when they are built-in. Now we don't
(or at least, shouldn't) need reminders in the GENERIC config files
about which module options require other options.

Update branch status doc accordingly.
 1.10 25-Oct-1994  mycroft Clean up deleted files.
 1.9 30-Jun-1994  cgd fix a botch, and gen syscall files
 1.8 30-Jun-1994  cgd fix up for new ID format, and consistency
 1.7 29-Jun-1994  cgd New RCS ID's, take two. they're more aesthecially pleasant, and use 'NetBSD'
 1.6 01-May-1994  cgd keep appropriate id's in 'created from' lines
 1.5 04-Apr-1994  deraadt SYS_* -> SUN_SYS_* to avoid name space clash
 1.4 22-Nov-1993  deraadt branches: 1.4.2;
moved from arch/sparc/sunos to compat/sunos
 1.3 10-Nov-1993  deraadt chmod 444 on the output files is a bad idea
 1.2 11-Oct-1993  deraadt various changes, suffice to say that 4.4 syscalls do not look like ours
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.4.2.2 22-Nov-1993  deraadt moved from arch/sparc/sunos to compat/sunos
 1.4.2.1 22-Nov-1993  deraadt file makesyscalls.sh was added on branch magnum on 1993-11-22 22:54:49 +0000
 1.7 25-Oct-1994  mycroft Clean up deleted files.
 1.6 12-Jul-1994  gwr Avoid some macro redefinitions that have appeared since exec.h
now includes exec_aout.h
 1.5 29-Jun-1994  cgd branches: 1.5.2;
New RCS ID's, take two. they're more aesthecially pleasant, and use 'NetBSD'
 1.4 28-Jan-1994  jtc Fix spelling error in Copyright notice
 1.3 28-Jan-1994  deraadt for new exec, from mw
 1.2 12-Dec-1993  deraadt m68k/sparc sunos binary compatibility code, pulled down from magnum branch
for consumption by the m68k masses
 1.1 28-Nov-1993  deraadt branches: 1.1.2;
compat exec() stuff is done more sensibly now
(hpux and ultrix compat stuff will be done the same way)
 1.1.2.2 28-Nov-1993  deraadt handle the emul mode more carefully.
 1.1.2.1 28-Nov-1993  deraadt file sun_exec.c was added on branch magnum on 1993-11-28 22:59:35 +0000
 1.5.2.1 12-Jul-1994  cgd update from trunk, per gwr & theo
 1.4 28-Nov-1993  mycroft Clean up deleted files.
 1.3 22-Nov-1993  deraadt branches: 1.3.2;
moved from arch/sparc/sunos to compat/sunos
 1.2 20-Nov-1993  deraadt cannonicalize #include's
 1.1 10-Nov-1993  deraadt sunos compat execve() helper routines.
these routines are not useful/used on the sparc, but are needed
by the sun3.
 1.3.2.1 24-Nov-1993  deraadt munged includes into better shape
 1.13 25-Oct-1994  mycroft Clean up deleted files.
 1.12 20-Oct-1994  cgd pay a small amount of lip service to the new syscall args mechanism.
In reality, none of these will compile.
 1.11 29-Jun-1994  cgd New RCS ID's, take two. they're more aesthecially pleasant, and use 'NetBSD'
 1.10 21-May-1994  deraadt bail on SIOCGARP
 1.9 26-Apr-1994  pk Fix typo.
Give TIOCTCNTL a try.
 1.8 28-Jan-1994  jtc Fix spelling error in Copyright notice
 1.7 15-Jan-1994  deraadt sync with magnum
 1.6 12-Dec-1993  deraadt m68k/sparc sunos binary compatibility code, pulled down from magnum branch
for consumption by the m68k masses
 1.5 22-Nov-1993  deraadt branches: 1.5.2;
moved from arch/sparc/sunos to compat/sunos
 1.4 20-Nov-1993  deraadt fake support for TIOCSSOFTCAR and TIOCGSOFTCAR
(one of which used to point to NetBSD's TIOCSTAT :-)
 1.3 14-Nov-1993  deraadt disassembly shows the %f2 register being accessed, and of course the
kernel panics.
why wasit using %f2? some expressions were too complicated and gcc2 (with
the optimizer off, mind you) ran out of integer registers and thus used
started using a float register for a temporary.
 1.2 10-Nov-1993  deraadt replacement set of sun ioctl functions. markus wild added a
whole slew of new ioctl's that are much more close to reality.

the comat-sunos tree is now almost good enough to be used in
both m68k and sparc kernels.
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.5.2.4 28-Dec-1993  pk Pass address of argument in TIOCSIG ioctl function.
One EOPNOTSUPP => ENODEV on tty descriptors.
 1.5.2.3 30-Nov-1993  pk One more ioctl translation (TIOCSIGNAL).
 1.5.2.2 28-Nov-1993  deraadt initial SIOC* support from pk. needs more work.
 1.5.2.1 22-Nov-1993  deraadt file sun_ioctl.c was added on branch magnum on 1993-11-28 02:31:11 +0000
 1.33 25-Oct-1994  mycroft Clean up deleted files.
 1.32 20-Oct-1994  cgd pay a small amount of lip service to the new syscall args mechanism.
In reality, none of these will compile.
 1.31 28-Sep-1994  deraadt use STACKGAPBASE
 1.30 29-Jun-1994  cgd New RCS ID's, take two. they're more aesthecially pleasant, and use 'NetBSD'
 1.29 22-Jun-1994  pk sun_mount: fill in one more field.
 1.28 15-Jun-1994  deraadt async_daemon only if NFSCLIENT
 1.27 10-Jun-1994  pk Adapt to 4.4-lite.
 1.26 08-Jun-1994  mycroft Minor change.
 1.25 06-Jun-1994  deraadt tricky
 1.24 24-May-1994  deraadt maxfdescs -> maxfiles
 1.23 21-May-1994  deraadt iszerodev
 1.22 19-May-1994  deraadt fix uname after sysctl
 1.21 05-May-1994  deraadt p->p_sig -> p->p_siglist
 1.20 05-May-1994  cgd fix my forgetfulness; from gwr
 1.19 04-May-1994  cgd expand the rlimit struct, kill last vestiges of off_t bogosity.
 1.18 29-Apr-1994  cgd kill syscall name aliases. no user-visible changes
 1.17 26-Apr-1994  pk SunOS's RLIMIT_NOFILE is different: add sun_[gs]rlimit().
 1.16 24-Apr-1994  deraadt make sunos mount(2) work again
 1.15 02-Apr-1994  cgd sickness to get SunOS mmap right
 1.14 27-Mar-1994  cgd expand uid_t/gid_t/off_t
 1.13 03-Mar-1994  deraadt DoH!
 1.12 03-Mar-1994  deraadt first cut at a SUNOS_COMPAT sysconf() system call.
 1.11 20-Feb-1994  chopps place conditional around sun_nfssvc.
 1.10 12-Dec-1993  deraadt m68k/sparc sunos binary compatibility code, pulled down from magnum branch
for consumption by the m68k masses
 1.9 22-Nov-1993  deraadt branches: 1.9.2;
moved from arch/sparc/sunos to compat/sunos
 1.8 20-Nov-1993  deraadt new compat functions: sun_open, sun_auditsys, sun_setpgid, sun_uname
some from Markus.
 1.7 12-Nov-1993  deraadt specdev.h moves
 1.6 10-Nov-1993  deraadt silly typo
 1.5 10-Nov-1993  deraadt support both sun3 & sparc concepts of minor/major #'s for /dev/zero
 1.4 15-Oct-1993  deraadt fix sun_getdents()
fix sun_mmap()
Note: delete the "struct dirent" in here when sys/dirent.h is created.
 1.3 13-Oct-1993  deraadt Add a stub auditsys() system call that does nothing.
SunOS /sbin/fsck calls it..
 1.2 11-Oct-1993  deraadt various changes, suffice to say that 4.4 syscalls do not look like ours
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.9.2.11 23-Jan-1994  deraadt make sun_misc compile without NFSSERVER. thanks to
Niklas Hallqvist <niklas@appli.se>
 1.9.2.10 01-Dec-1993  pk Introduced sun_mknod() which also deals with FIFOs (ie. `mknod xxx p' on SunOS).
 1.9.2.9 30-Nov-1993  deraadt impliment fstatfs() and statfs() better
 1.9.2.8 27-Nov-1993  deraadt very rudimentary exportfs(2) support, ie. "return 0"
 1.9.2.7 27-Nov-1993  deraadt statfs(2) and fstatfs(2) support. `df' now works.
 1.9.2.6 27-Nov-1993  deraadt add vhangup(2)
generalize m68k support for /dev/zero..
 1.9.2.5 26-Nov-1993  deraadt add real wimpy quotactl(2) emulation
 1.9.2.4 26-Nov-1993  deraadt add basically bogus ustat(2) support.
 1.9.2.3 26-Nov-1993  deraadt nfssvc(2) system call emulation. might work, might not -- have to
wait for exportfs(2) support for mountd..
 1.9.2.2 26-Nov-1993  deraadt added mount(2) nfs support
 1.9.2.1 22-Nov-1993  deraadt file sun_misc.c was added on branch magnum on 1993-11-26 12:07:43 +0000
 1.18 01-Mar-1995  mycroft Clean up deleted files.
 1.17 30-Jun-1994  cgd fix a botch, and gen syscall files
 1.16 14-Jun-1994  chopps update to match recent getdtablesize() change
 1.15 07-May-1994  deraadt follow
 1.14 01-May-1994  cgd sun syscalls.master update
 1.13 26-Apr-1994  pk SunOS's RLIMIT_NOFILE is different: add sun_[gs]rlimit().
 1.12 04-Apr-1994  deraadt nice unique SUN_SYS_ names..
 1.11 27-Mar-1994  cgd expand uid_t/gid_t/off_t
 1.10 03-Mar-1994  deraadt update to syscall.master (for sysconf)
 1.9 12-Dec-1993  deraadt update to latest syscalls.master
 1.8 22-Nov-1993  deraadt branches: 1.8.2;
moved from arch/sparc/sunos to compat/sunos
 1.7 20-Nov-1993  deraadt update to new syscalls.master
 1.6 14-Nov-1993  deraadt update to latest syscalls.master
 1.5 10-Nov-1993  deraadt update from new syscalls.master
 1.4 15-Oct-1993  deraadt rebuilt from syscall.master: {get,set}domainname change
 1.3 13-Oct-1993  deraadt rebuild files from syscalls.master
 1.2 11-Oct-1993  deraadt various changes, suffice to say that 4.4 syscalls do not look like ours
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.8.2.6 01-Dec-1993  deraadt update with new sun_mknod
 1.8.2.5 27-Nov-1993  deraadt update (as always)
 1.8.2.4 27-Nov-1993  deraadt update
 1.8.2.3 27-Nov-1993  deraadt update..
 1.8.2.2 26-Nov-1993  deraadt update to syscalls.master
 1.8.2.1 22-Nov-1993  deraadt file sun_syscall.h was added on branch magnum on 1993-11-26 13:39:12 +0000
 1.18 01-Mar-1995  mycroft Clean up deleted files.
 1.17 30-Jun-1994  cgd fix a botch, and gen syscall files
 1.16 14-Jun-1994  chopps update to match recent getdtablesize() change
 1.15 07-May-1994  deraadt follow
 1.14 01-May-1994  cgd sun syscalls.master update
 1.13 26-Apr-1994  pk SunOS's RLIMIT_NOFILE is different: add sun_[gs]rlimit().
 1.12 04-Apr-1994  deraadt nice unique SUN_SYS_ names..
 1.11 27-Mar-1994  cgd expand uid_t/gid_t/off_t
 1.10 03-Mar-1994  deraadt update to syscall.master (for sysconf)
 1.9 12-Dec-1993  deraadt update to latest syscalls.master
 1.8 22-Nov-1993  deraadt branches: 1.8.2;
moved from arch/sparc/sunos to compat/sunos
 1.7 20-Nov-1993  deraadt update to new syscalls.master
 1.6 14-Nov-1993  deraadt update to latest syscalls.master
 1.5 10-Nov-1993  deraadt update from new syscalls.master
 1.4 15-Oct-1993  deraadt rebuilt from syscall.master: {get,set}domainname change
 1.3 13-Oct-1993  deraadt rebuild files from syscalls.master
 1.2 11-Oct-1993  deraadt various changes, suffice to say that 4.4 syscalls do not look like ours
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.8.2.6 01-Dec-1993  deraadt update with new sun_mknod
 1.8.2.5 27-Nov-1993  deraadt update (as always)
 1.8.2.4 27-Nov-1993  deraadt update
 1.8.2.3 27-Nov-1993  deraadt update..
 1.8.2.2 26-Nov-1993  deraadt update to syscalls.master
 1.8.2.1 22-Nov-1993  deraadt file sun_syscalls.c was added on branch magnum on 1993-11-26 13:39:14 +0000
 1.18 01-Mar-1995  mycroft Clean up deleted files.
 1.17 30-Jun-1994  cgd fix a botch, and gen syscall files
 1.16 14-Jun-1994  chopps update to match recent getdtablesize() change
 1.15 07-May-1994  deraadt follow
 1.14 01-May-1994  cgd sun syscalls.master update
 1.13 26-Apr-1994  pk SunOS's RLIMIT_NOFILE is different: add sun_[gs]rlimit().
 1.12 04-Apr-1994  deraadt nice unique SUN_SYS_ names..
 1.11 27-Mar-1994  cgd expand uid_t/gid_t/off_t
 1.10 03-Mar-1994  deraadt update to syscall.master (for sysconf)
 1.9 12-Dec-1993  deraadt update to latest syscalls.master
 1.8 22-Nov-1993  deraadt branches: 1.8.2;
moved from arch/sparc/sunos to compat/sunos
 1.7 20-Nov-1993  deraadt update to new syscalls.master
 1.6 14-Nov-1993  deraadt update to latest syscalls.master
 1.5 10-Nov-1993  deraadt update from new syscalls.master
 1.4 15-Oct-1993  deraadt rebuilt from syscall.master: {get,set}domainname change
 1.3 13-Oct-1993  deraadt rebuild files from syscalls.master
 1.2 11-Oct-1993  deraadt various changes, suffice to say that 4.4 syscalls do not look like ours
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.8.2.6 01-Dec-1993  deraadt update with new sun_mknod
 1.8.2.5 27-Nov-1993  deraadt update (as always)
 1.8.2.4 27-Nov-1993  deraadt update
 1.8.2.3 27-Nov-1993  deraadt update..
 1.8.2.2 26-Nov-1993  deraadt update to syscalls.master
 1.8.2.1 22-Nov-1993  deraadt file sun_sysent.c was added on branch magnum on 1993-11-26 13:39:15 +0000
 1.24 06-Sep-2015  dholland More on PR 41200: headers that declare ioctls should include sys/ioccom.h.
This covers (I think) all the MI headers outside of external/ (and dist/).
 1.23 11-Jan-2009  christos branches: 1.23.24; 1.23.42;
merge christos-time_t
 1.22 04-Dec-2007  dsl branches: 1.22.12; 1.22.14; 1.22.18; 1.22.26;
Remove all the __P
 1.21 04-Mar-2007  christos branches: 1.21.14; 1.21.16; 1.21.22; 1.21.24;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.20 11-Dec-2005  christos branches: 1.20.26;
merge ktrace-lwp.
 1.19 19-Aug-2005  christos 64 bit inode changes.
 1.18 26-Mar-2004  drochner branches: 1.18.16;
all ports define __HAVE_SIGINFO now, so remove the CPP conditionals
 1.17 28-Sep-2003  cl catch up with const sigset_t and const ksiginfo_t
 1.16 26-Sep-2003  simonb Fix "constify sendsig/trapsignal" fallout for non-siginfo'd archs. Test
compiled on most architectures.
 1.15 22-Sep-2003  cl SA_SIGINFO support for m68k (compat sunos)
 1.14 24-Jan-2003  fvdl branches: 1.14.2;
Bump daddr_t to 64 bits. Replace it with int32_t in all places where
it was used on-disk, so that on-disk formats remain the same.
Remove ufs_daddr_t and ufs_lbn_t for the time being.
 1.13 04-Jul-2002  thorpej Add kernel support for having userland provide the signal trampoline:

* struct sigacts gets a new sigact_sigdesc structure, which has the
sigaction and the trampoline/version. Version 0 means "legacy kernel
provided trampoline". Other versions are coordinated with machine-
dependent code in libc.
* sigaction1() grows two more arguments -- the trampoline pointer and
the trampoline version.
* A new __sigaction_sigtramp() system call is provided to register a
trampoline along with a signal handler.
* The handler is no longer passed to sensig() functions. Instead,
sendsig() looks up the handler by peeking in the sigacts for the
process getting the signal (since it has to look in there for the
trampoline anyway).
* Native sendsig() functions now select the appropriate trampoline and
its arguments based on the trampoline version in the sigacts.

Changes to libc to use the new facility will be checked in later. Kernel
version not bumped; we will ride the 1.6C bump made recently.
 1.12 02-Feb-2001  mrg branches: 1.12.2; 1.12.4; 1.12.16;
make this useful when compiled on sparc64: two members in sunos_nfs_args
become typedefs.
 1.11 13-Sep-1998  pk branches: 1.11.12;
Since the last signal restructuring the sparc also has an sunos_sendsig().
 1.10 22-Aug-1998  mrg change sunos compat structure members from long to int so they stay the same on sparc64
 1.9 07-Sep-1996  mycroft Definition of pollfd is no longer needed.
 1.8 05-May-1996  veego Added a missing Makefile and run it
Moved the prototyp for sunos_sendsig in an #ifndef sparc
 1.7 05-May-1996  briggs Put prototype for sunos_sendsig() in sunos.h as suggested by veego.
 1.6 18-Feb-1996  pk Adapt compat NFS mount code to NFSv3.
 1.5 09-Oct-1995  mycroft Remove struct sunos_dirent from here.
 1.4 04-Mar-1995  pk Move SunOS audio_info compat stuff here (from sparc/dev/bsd_audio.c).
 1.3 20-Nov-1994  deraadt ptrace from chs+@CS.cmu.edu, poll from christos
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 25-Oct-1994  deraadt and these
 1.11.12.1 11-Feb-2001  bouyer Sync with HEAD.
 1.12.16.1 15-Jul-2002  gehenna catch up with -current.
 1.12.4.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.12.2.1 01-Aug-2002  nathanw Catch up to -current.
 1.14.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.14.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.14.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.14.2.1 03-Aug-2004  skrll Sync with HEAD
 1.18.16.3 07-Dec-2007  yamt sync with head
 1.18.16.2 03-Sep-2007  yamt sync with head.
 1.18.16.1 21-Jun-2006  yamt sync with head.
 1.20.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.21.24.1 08-Dec-2007  ad Sync with head.
 1.21.22.1 08-Dec-2007  mjf Sync with HEAD.
 1.21.16.1 09-Jan-2008  matt sync with HEAD
 1.21.14.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.22.26.1 19-Jan-2009  skrll Sync with HEAD.
 1.22.18.1 04-May-2009  yamt sync with head.
 1.22.14.1 29-Mar-2008  christos Welcome to the time_t=long long dev_t=uint64_t branch.
 1.22.12.1 17-Jan-2009  mjf Sync with HEAD.
 1.23.42.1 22-Sep-2015  skrll Sync with HEAD
 1.23.24.1 03-Dec-2017  jdolecek update from HEAD
 1.4 19-Dec-2018  maxv Remove compat_svr4 and compat_svr4_32, as discussed on tech-kern@ recently,
but also as discussed several times in the past.
 1.3 28-Apr-2008  martin branches: 1.3.86; 1.3.88;
Remove clause 3 and 4 from TNF licenses
 1.2 05-Sep-1998  christos branches: 1.2.144; 1.2.146; 1.2.148;
Assign copyright to TNF.
 1.1 09-Oct-1995  mycroft Use cookies for directory offset, mostly from Greg Hudson.
 1.2.148.1 16-May-2008  yamt sync with head.
 1.2.146.1 18-May-2008  yamt sync with head.
 1.2.144.1 02-Jun-2008  mjf Sync with HEAD.
 1.3.88.1 10-Jun-2019  christos Sync with HEAD
 1.3.86.1 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.57 10-Aug-2018  pgoyette Allow syscall_establish() to install new syscalls when the existing
entry-point is either sys_nomodule or sys_nosys. Update the
makesyscalls.sh script to create a const array of bits to allow
syscall_disestablish() to properly restore the original entry-point.
Update all the initializers of struct emul to initialize the pointer
to the bit array struct emul.

XXX Regen of all files created by makesyscalls.sh will come soon,
XXX followed by a kernel version bump (since struct emul is being
XXX modified).

This commit should address PR kern/45781 and also removes the need
for the work-around for that PR in file

sys/arch/usermode/modules/syscallemu/syscallemu.c
 1.56 06-May-2018  kamil branches: 1.56.2;
Remove an element from struct emul: e_tracesig

e_tracesig used to be implemented for Darwin compat. Nowadays the Darwin
compatiblity layer is gone and there are no other users.

This functionality isn't used where it shall be used in the existing
codebase.

If we want to emulate debugging interfaces in compat layers we would need
to implement that from scratch anyway. We would need to be bug compatible
with other OSes too.

Proposed on tech-kern@.

Welcome to NetBSD 8.99.16!

Sponsored by <The NetBSD Foundation>
 1.55 09-Jan-2018  maya branches: 1.55.2;
remove struct emul's e_fault.

It used to be used by COMPAT_IRIX for the purpose of overriding
uvm_fault (only implemented in MIPS), now removed.

Ride 8.99.12 version bump.
 1.54 19-Feb-2012  rmind Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.
 1.53 07-Jul-2010  chs branches: 1.53.8; 1.53.12;
many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
- support new-style (NPTL) linux pthreads on all platforms.
clone() with CLONE_THREAD uses 1 process with many LWPs
instead of separate processes.
- move the contents of sys__lwp_setprivate() into a new
lwp_setprivate() and use that everywhere.
- update linux_release[] and linux32_release[] to "2.6.18".
- adjust placement of emul fork/exec/exit hooks as needed
and adjust other emul code to match.
- convert all struct emul definitions to use named initializers.
- change the pid allocator to allow multiple pids to refer to the same proc.
- remove a few fields from struct proc that are no longer needed.
- disable the non-functional "vdso" code in linux32/amd64,
glibc works fine without it.
- fix a race in the futex code where we could miss a wakeup after
a requeue operation.
- redo futex locking to be a little more efficient.
 1.52 19-Nov-2008  ad branches: 1.52.6; 1.52.8;
Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.51 04-Dec-2007  dsl branches: 1.51.12; 1.51.16; 1.51.22; 1.51.24;
Remove all the __P
 1.50 11-Dec-2005  christos branches: 1.50.44; 1.50.46; 1.50.52; 1.50.56;
merge ktrace-lwp.
 1.49 11-Jul-2005  christos Add a sunos_machdep include file to deal with MD implementations of
sunos_syscall_intern.
 1.48 10-Jul-2005  christos More syscall_intern lossage.
 1.47 26-Mar-2005  fvdl branches: 1.47.2;
Fix some things regarding COMPAT_NETBSD32 and limits/VM addresses.

* For sparc64 and amd64, define *SIZ32 VM constants.
* Add a new function pointer to struct emul, pointing at a function
that will return the default VM map address. The default function
is uvm_map_defaultaddr, which just uses the VM_DEFAULT_ADDRESS
macro. This gives emulations control over the default map address,
and allows things to be mapped at the right address (in 32bit range)
for COMPAT_NETBSD32.
* Add code to adjust the data and stack limits when a COMPAT_NETBSD32
or COMPAT_SVR4_32 binary is executed.
* Don't use USRSTACK in kern_resource.c, use p_vmspace->vm_minsaddr
instead (emulations might have set it differently)
* Since this changes struct emul, bump kernel version to 3.99.2

Tested on amd64, compile-tested on sparc64.
 1.46 26-Feb-2005  perry branches: 1.46.2;
nuke trailing whitespace
 1.45 20-Dec-2003  fvdl branches: 1.45.8; 1.45.10;
Put back Emmanuel's sigfilter hooks, as decided by Core.
 1.44 20-Dec-2003  manu Introduce lwp_emuldata and the associated hooks. No hook is provided for the
exec case, as the emulation already has the ability to intercept that
with the e_proc_exec hook. It is the responsability of the emulation to
take appropriaye action about lwp_emuldata in e_proc_exec.

Patch reviewed by Christos.
 1.43 05-Dec-2003  jdolecek back the sigfilter emulation hook change off
 1.42 03-Dec-2003  manu Add a sigfilter emulation hook. It is used at the beginning of kpsignal2()
so that a specific emulation has the oportunity to filter out some signals.

if sigfilter returns 0, then no signal is sent by kpsignal2().

There is another place where signals can be generated: trapsignal. Since this
function is already an emulation hook, no call to the sigfilter hook was
introduced in trapsignal.

This is needed to emulate the softsignal feature in COMPAT_DARWIN (signals
sent as Mach exception messages)
 1.41 24-Aug-2003  chs add support for non-executable mappings (where the hardware allows this)
and make the stack and heap non-executable by default. the changes
fall into two basic catagories:

- pmap and trap-handler changes. these are all MD:
= alpha: we already track per-page execute permission with the (software)
PG_EXEC bit, so just have the trap handler pay attention to it.
= i386: use a new GDT segment for %cs for processes that have no
executable mappings above a certain threshold (currently the
bottom of the stack). track per-page execute permission with
the last unused PTE bit.
= powerpc/ibm4xx: just use the hardware exec bit.
= powerpc/oea: we already track per-page exec bits, but the hardware only
implements non-exec mappings at the segment level. so track the
number of executable mappings in each segment and turn on the no-exec
segment bit iff the count is 0. adjust the trap handler to deal.
= sparc (sun4m): fix our use of the hardware protection bits.
fix the trap handler to recognize text faults.
= sparc64: split the existing unified TSB into data and instruction TSBs,
and only load TTEs into the appropriate TSB(s) for the permissions.
fix the trap handler to check for execute permission.
= not yet implemented: amd64, hppa, sh5

- changes in all the emulations that put a signal trampoline on the stack.
instead, we now put the trampoline into a uvm_aobj and map that into
the process separately.

originally from openbsd, adapted for netbsd by me.
 1.40 10-Nov-2002  jdolecek branches: 1.40.6;
handle __HAVE_MINIMAL_EMUL
 1.39 01-Nov-2002  jdolecek set struct emul's nsysent to compat SYS_NSYSENT, not SYS_MAXSYSCALL
 1.38 21-Sep-2002  manu - Introduce a e_fault field in struct proc to provide emulation specific
memory fault handler. IRIX uses irix_vm_fault, and all other emulation
use NULL, which means to use uvm_fault.

- While we are there, explicitely set to NULL the uninitialized fields in
struct emul: e_fault and e_sysctl on most ports

- e_fault is used by the trap handler, for now only on mips. In order to avoid
intrusive modifications in UVM, the function pointed by e_fault does not
has exactly the same protoype as uvm_fault:
int uvm_fault __P((struct vm_map *, vaddr_t, vm_fault_t, vm_prot_t));
int e_fault __P((struct proc *, vaddr_t, vm_fault_t, vm_prot_t));

- In IRIX share groups, all the VM space is shared, except one page.
This bounds us to have different VM spaces and synchronize modifications
to the VM space accross share group members. We need an IRIX specific hook
to the page fault handler in order to propagate VM space modifications
caused by page faults.
 1.37 13-Jul-2002  scw m68k syscall rototill:

- Switch all m68k-based ports over to __HAVE_SYSCALL_INTERN.
- Add systrace glue.
- Define struct mdproc in <m68k/proc.h> instead of <machine/proc.h>.
(They were all defined exactly the same anyway, other than a couple
of the MDP_* flags.)
 1.36 13-Nov-2001  lukem branches: 1.36.8;
add RCSIDs (including regeneration of files as appropriate)
 1.35 18-Sep-2001  jdolecek Make the setregs hook emulation-specific, rather than executable
format specific.
Struct emul has a e_setregs hook back, which points to emulation-specific
setregs function. es_setregs of struct execsw now only points to
optional executable-specific setup function (this is only used for
ECOFF).
 1.34 18-Jun-2001  christos branches: 1.34.2; 1.34.4;
Add an e_trapsignal member to struct emul, so that emulated processes can
send the appropriate signal depending on the trap type.
 1.33 16-Jun-2001  manu Removed obsoletes EMUL_NO_BSD_ASYNCIO_PIPE and EMUL_NO_SIGIO_ON_READ flags.
Async I/O OS specifities should now handled in OS specific code. Linux
has been done, but other emulation should be handled. See case LINUX_F_SETFL
in sys/compat/linux/common/linux_file.c:linux_sys_fcntl() for more details.

The data that has been collected yet:

Net Free Open Linux SunOS AIX OSF1 Darwin
send SIGIO to write end of pipe Y N N N N N Y Y
send SIGIO to read end of pipe Y Y N N N ? Y ?
send SIGIO to write end of socket Y Y Y N N Y Y Y
send SIGIO to read end of socket Y Y Y Y Y ? Y ?
 1.32 30-May-2001  mrg use _KERNEL_OPT.
 1.31 07-May-2001  manu Changed EMUL_BSD_ASYNCIO_PIPE to EMUL_NO_BSD_ASYNCIO_PIPE, so that
the native emulation (NetBSD) does not have a flag.
 1.30 06-May-2001  manu Added two flags to emulation packages:

EMUL_BSD_ASYNCIO_PIPE notes that the emulated binaries expect the original
BSD pipe behavior for asynchronous I/O, which is to fire SIGIO on read() and
write(). OSes without this flag do not expect any SIGIO to be fired on
read() and write() for pipes, even when async I/O was requested. As far as
we know, the OSes that need EMUL_BSD_ASYNCIO_PIPE are NetBSD, OSF/1 and
Darwin.

EMUL_NO_SIGIO_ON_READ notes that the emulated binaries that requested
asynchrnous I/O expect the reader process to be notified by a SIGIO, but
not the writer process. OSes without this flag expect the reader and the
writer to be notified when some data has arrived or when some data have been
read. As far as we know, the OSes that need EMUL_NO_SIGIO_ON_READ are Linux
and SunOS.
 1.29 11-Dec-2000  mycroft branches: 1.29.2;
Introduce 2 new flags in types.h:
* __HAVE_SYSCALL_INTERN. If this is defined, e_syscall is replaced by
e_syscall_intern, which is called at key places in the kernel. This can be
used to set a MD syscall handler pointer. This obsoletes and replaces the
*_HAS_SEPARATED_SYSCALL flags.
* __HAVE_MINIMAL_EMUL. If this is defined, certain (deprecated) elements in
struct emul are omitted.
 1.28 09-Dec-2000  jdolecek always fill in e_syscall in respective emul_*; if the emulation doesn't
have it's own separated *_syscall() function, use syscall()
 1.27 09-Dec-2000  mycroft Get rid of the damn EMUL_GET* flags.
 1.26 01-Dec-2000  jdolecek put aout specific sunos code from sunos_exec.c to separate file
sunos_exec_aout.c
make LKM safe
add EMUL_GETPID_PASS_PPID|EMUL_GETID_PASS_EID to emul_sunos flags
 1.25 01-Dec-2000  jdolecek fix the emulation path
 1.24 01-Dec-2000  jdolecek add e_path (emulation path) to struct emul, which replaces emulation-specific
*_emul_path variables

change macros CHECK_ALT_{CREAT|EXIST} to use that, 'root' doesn't need
to be passed explicitly any more and *_CHECK_ALT_{CREAT|EXIST} are removed
change explicit emul_find() calls in probe functions to get the emulation
path from the checked exec switch entry's emulation

remove no longer needed header files

add e_flags and e_syscall to struct emul; these are unsed and empty for now
 1.23 24-Nov-2000  scw Make these compile with the latest execsw[] changes. Someone with
SunOS binaries needs to test this...
 1.22 21-Nov-2000  jdolecek restructure struct emul and execsw, in preparation to make emulations LKMable:
* move all exec-type specific information from struct emul to execsw[] and
provide single struct emul per emulation
* elf:
- kern/exec_elf32.c:probe_funcs[] is gone, execsw[] how has one entry
per emulation and contains pointer to respective probe function
- interp is allocated via MALLOC() rather than on stack
- elf_args structure is allocated via MALLOC() rather than malloc()
* ecoff: the per-emulation hooks moved from alpha and mips specific code
to OSF1 and Ultrix compat code as appropriate, execsw[] has one entry per
emulation supporting ecoff with appropriate probe function
* the makecmds/probe functions don't set emulation, pointer to emulation is
part of appropriate execsw[] entry
* constify couple of structures
 1.21 13-Nov-2000  jdolecek change the type of *syscallnames[] array to 'const char * const foo[]'
 1.20 28-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.19 06-Jun-2000  soren defopt SYSCALL_DEBUG.
 1.18 11-Apr-2000  chs branches: 1.18.2;
add a new function vn_marktext() for exec code to let others know
that the vnode is now being used as process text.
 1.17 29-Apr-1999  christos branches: 1.17.2;
Need sunos_sigcode and sunos_esigcode now that our sigreturn is
different.
 1.16 01-Apr-1999  drochner branches: 1.16.2;
remove unneeded <vm/*> includes
 1.15 13-Sep-1998  pk Everyone uses sunos_sendsig().
 1.14 09-Aug-1998  mrg use __sparc__ not sparc
 1.13 04-Dec-1997  tv Standardize COMPAT_SUNOS -- remove all references to
sunos_exec_aout_makecmds() in machdep.c for various architectures and put
it in exec_conf.c like the other emulations; rename exec.h to
sunos_exec.h.
 1.12 07-Oct-1996  cgd don't include <machine/exec.h> explicitly. No other changes needed, since
<sys/exec.h> was already being included.
 1.11 05-May-1996  briggs Put prototype for sunos_sendsig() in sunos.h as suggested by veego.
 1.10 14-Mar-1996  christos Bring prototypes into scope and fix compiler warnings.
 1.9 25-Jun-1995  briggs Add sunos_emul_path (/emul/sunos). I don't know if this is correct, but
this will at least aid the compilation step and is similar to the
others.
 1.8 22-Apr-1995  christos - added struct emul to all emulations.
- removed all setup functions.
- added copyargs() functions where needed.
 1.7 25-Oct-1994  deraadt rename, new syscall interface, etc.
 1.6 12-Jul-1994  gwr Avoid some macro redefinitions that have appeared since exec.h
now includes exec_aout.h
 1.5 29-Jun-1994  cgd branches: 1.5.2;
New RCS ID's, take two. they're more aesthecially pleasant, and use 'NetBSD'
 1.4 28-Jan-1994  jtc Fix spelling error in Copyright notice
 1.3 28-Jan-1994  deraadt for new exec, from mw
 1.2 12-Dec-1993  deraadt m68k/sparc sunos binary compatibility code, pulled down from magnum branch
for consumption by the m68k masses
 1.1 28-Nov-1993  deraadt branches: 1.1.2;
compat exec() stuff is done more sensibly now
(hpux and ultrix compat stuff will be done the same way)
 1.1.2.1 28-Nov-1993  deraadt handle the emul mode more carefully.
 1.5.2.1 12-Jul-1994  cgd update from trunk, per gwr & theo
 1.16.2.1 30-Apr-1999  perry branches: 1.16.2.1.2;
pullup 1.16->1.17 (christos)
 1.16.2.1.2.2 04-Jul-1999  chs after setting VTEXT on a vnode, flush any UBC mappings
to try to prevent unnecessary VAC aliases.
 1.16.2.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.17.2.4 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.17.2.3 08-Dec-2000  bouyer Sync with HEAD.
 1.17.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.17.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.18.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.29.2.6 11-Nov-2002  nathanw Catch up to -current
 1.29.2.5 18-Oct-2002  nathanw Catch up to -current.
 1.29.2.4 01-Aug-2002  nathanw Catch up to -current.
 1.29.2.3 14-Nov-2001  nathanw Catch up to -current.
 1.29.2.2 21-Sep-2001  nathanw Catch up to -current.
 1.29.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.34.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.34.2.3 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.34.2.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.34.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.36.8.1 15-Jul-2002  gehenna catch up with -current.
 1.40.6.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.40.6.5 01-Apr-2005  skrll Sync with HEAD.
 1.40.6.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.40.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.40.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.40.6.1 03-Aug-2004  skrll Sync with HEAD
 1.45.10.2 26-Mar-2005  yamt sync with head.
 1.45.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.45.8.1 29-Apr-2005  kent sync with -current
 1.46.2.1 18-Sep-2005  tron Pull up following revision(s) (requested by fvdl in ticket #798):
sys/compat/sunos/sunos_exec.c: revision 1.47
sys/compat/pecoff/pecoff_emul.c: revision 1.11
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.45
sys/arch/amd64/amd64/netbsd32_machdep.c: revision 1.12
sys/sys/proc.h: revision 1.198
sys/compat/mach/mach_exec.c: revision 1.56
sys/compat/freebsd/freebsd_exec.c: revision 1.27
sys/arch/sparc64/include/vmparam.h: revision 1.27
sys/kern/kern_resource.c: revision 1.91
sys/compat/netbsd32/netbsd32_netbsd.c: revision 1.88
sys/compat/osf1/osf1_exec.c: revision 1.39
sys/compat/svr4_32/svr4_32_resource.c: revision 1.5
sys/compat/ultrix/ultrix_misc.c: revision 1.99
sys/compat/svr4_32/svr4_32_exec.h: revision 1.9
sys/kern/exec_elf32.c: revision 1.103
sys/compat/aoutm68k/aoutm68k_exec.c: revision 1.19
sys/compat/sunos32/sunos32_exec.c: revision 1.20
sys/compat/hpux/hpux_exec.c: revision 1.46
sys/compat/darwin/darwin_exec.c: revision 1.40
sys/kern/sysv_shm.c: revision 1.83
sys/uvm/uvm_extern.h: revision 1.99
sys/uvm/uvm_mmap.c: revision 1.89
sys/kern/kern_exec.c: revision 1.195
sys/compat/netbsd32/netbsd32.h: revision 1.31
sys/arch/sparc64/sparc64/svr4_32_machdep.c: revision 1.20
sys/compat/svr4/svr4_exec.c: revision 1.56
sys/compat/irix/irix_exec.c: revision 1.41
sys/compat/ibcs2/ibcs2_exec.c: revision 1.63
sys/compat/svr4_32/svr4_32_exec.c: revision 1.16
sys/arch/amd64/include/vmparam.h: revision 1.8
sys/compat/linux/common/linux_exec.c: revision 1.73
Fix some things regarding COMPAT_NETBSD32 and limits/VM addresses.
* For sparc64 and amd64, define *SIZ32 VM constants.
* Add a new function pointer to struct emul, pointing at a function
that will return the default VM map address. The default function
is uvm_map_defaultaddr, which just uses the VM_DEFAULT_ADDRESS
macro. This gives emulations control over the default map address,
and allows things to be mapped at the right address (in 32bit range)
for COMPAT_NETBSD32.
* Add code to adjust the data and stack limits when a COMPAT_NETBSD32
or COMPAT_SVR4_32 binary is executed.
* Don't use USRSTACK in kern_resource.c, use p_vmspace->vm_minsaddr
instead (emulations might have set it differently)
* Since this changes struct emul, bump kernel version to 3.99.2
Tested on amd64, compile-tested on sparc64.
 1.47.2.2 07-Dec-2007  yamt sync with head
 1.47.2.1 21-Jun-2006  yamt sync with head.
 1.50.56.1 08-Dec-2007  ad Sync with head.
 1.50.52.1 08-Dec-2007  mjf Sync with HEAD.
 1.50.46.1 09-Jan-2008  matt sync with HEAD
 1.50.44.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.51.24.1 19-Jan-2009  skrll Sync with HEAD.
 1.51.22.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.51.16.2 11-Aug-2010  yamt sync with head.
 1.51.16.1 04-May-2009  yamt sync with head.
 1.51.12.1 17-Jan-2009  mjf Sync with HEAD.
 1.52.8.1 05-Mar-2011  rmind sync with head
 1.52.6.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.53.12.1 24-Feb-2012  mrg sync to -current.
 1.53.8.1 17-Apr-2012  yamt sync with head
 1.55.2.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.55.2.1 21-May-2018  pgoyette Sync with HEAD
 1.56.2.1 10-Jun-2019  christos Sync with HEAD
 1.11 19-Nov-2008  ad Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.10 04-Dec-2007  dsl branches: 1.10.12; 1.10.16; 1.10.22; 1.10.24;
Remove all the __P
 1.9 11-Dec-2005  christos branches: 1.9.44; 1.9.46; 1.9.52; 1.9.56;
merge ktrace-lwp.
 1.8 12-Jul-2005  christos Delete define for sunos_syscall_intern.
 1.7 10-Jul-2005  christos define sunos_syscall_intern now that sparc needs it.
 1.6 29-Jun-2003  fvdl branches: 1.6.2; 1.6.18;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.5 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.4 26-Nov-2001  fredette Added support for running 68010 SunOS executables.
 1.3 24-Nov-2000  scw branches: 1.3.2; 1.3.4;
Make these compile with the latest execsw[] changes. Someone with
SunOS binaries needs to test this...
 1.2 09-Aug-1998  mrg branches: 1.2.12;
use __sparc__ not sparc
 1.1 04-Dec-1997  tv Standardize COMPAT_SUNOS -- remove all references to
sunos_exec_aout_makecmds() in machdep.c for various architectures and put
it in exec_conf.c like the other emulations; rename exec.h to
sunos_exec.h.
 1.2.12.1 08-Dec-2000  bouyer Sync with HEAD.
 1.3.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.3.2.1 08-Jan-2002  nathanw Catch up to -current.
 1.6.18.2 07-Dec-2007  yamt sync with head
 1.6.18.1 21-Jun-2006  yamt sync with head.
 1.6.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.9.56.1 08-Dec-2007  ad Sync with head.
 1.9.52.1 08-Dec-2007  mjf Sync with HEAD.
 1.9.46.1 09-Jan-2008  matt sync with HEAD
 1.9.44.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.10.24.1 19-Jan-2009  skrll Sync with HEAD.
 1.10.22.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.10.16.1 04-May-2009  yamt sync with head.
 1.10.12.1 17-Jan-2009  mjf Sync with HEAD.
 1.19 18-Oct-2015  maxv Make sure we have space for the aout header.
 1.18 15-Aug-2009  matt branches: 1.18.22; 1.18.40;
Include <sys/exec_aout.h> explicitly instead of relying on <sys/exec.h> to
do it for you.
 1.17 08-Dec-2007  dsl branches: 1.17.16;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.16 04-Dec-2007  dsl Remove all the __P
 1.15 19-Oct-2007  ad branches: 1.15.2; 1.15.4;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.14 11-Dec-2005  christos branches: 1.14.30; 1.14.44; 1.14.46; 1.14.50;
merge ktrace-lwp.
 1.13 26-Feb-2005  perry branches: 1.13.4;
nuke trailing whitespace
 1.12 30-Jan-2005  christos Don't try to map a 0 size bss.
 1.11 08-Aug-2003  christos branches: 1.11.8; 1.11.10;
- GC all the setup_stack functions
- add one for linux/i386
 1.10 29-Jun-2003  fvdl branches: 1.10.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.9 29-Jun-2003  darrenr More changes for providing lwpid for ktrace (sparc GENERIC built)
 1.8 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.7 01-Apr-2003  thorpej Use PAGE_SIZE rather than NBPG.
 1.6 05-Oct-2002  chs count executable image pages as executable for vm-usage purposes.
also, always do the VTEXT vs. v_writecount mutual exclusion
(which we previously skipped if the text or data segment was empty).
 1.5 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.4 26-Nov-2001  fredette branches: 1.4.10;
Added support for running 68010 SunOS executables.
 1.3 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.2 30-Oct-2001  thorpej - Add a new vnode flag VEXECMAP, which indicates that a vnode has
executable mappings. Stop overloading VTEXT for this purpose (VTEXT
also has another meaning).
- Rename vn_marktext() to vn_markexec(), and use it when executable
mappings of a vnode are established.
- In places where we want to set VTEXT, set it in v_flag directly, rather
than making a function call to do this (it no longer makes sense to
use a function call, since we no longer overload VTEXT with VEXECMAP's
meaning).

VEXECMAP suggested by Chuq Silvers.
 1.1 01-Dec-2000  jdolecek branches: 1.1.2; 1.1.4; 1.1.6; 1.1.10;
put aout specific sunos code from sunos_exec.c to separate file
sunos_exec_aout.c
 1.1.10.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.1.6.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.1.6.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.4.3 18-Oct-2002  nathanw Catch up to -current.
 1.1.4.2 08-Jan-2002  nathanw Catch up to -current.
 1.1.4.1 14-Nov-2001  nathanw Catch up to -current.
 1.1.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.1.2.1 01-Dec-2000  bouyer file sunos_exec_aout.c was added on branch thorpej_scsipi on 2000-12-08 09:08:43 +0000
 1.4.10.2 02-Oct-2003  tron Pull up revision 1.6 (requested by junyoung in ticket #1488):
count executable image pages as executable for vm-usage purposes.
also, always do the VTEXT vs. v_writecount mutual exclusion
(which we previously skipped if the text or data segment was empty).
 1.4.10.1 27-Sep-2003  tron Pull up revision 1.5 (requested by junyoung in ticket #1466):
remove trailing \n in panic(). approved perry.
 1.10.2.8 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.10.2.7 04-Feb-2005  skrll Sync with HEAD.
 1.10.2.6 04-Feb-2005  skrll Adapt to branch.
 1.10.2.5 21-Nov-2004  skrll Adapt to branch.
 1.10.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.10.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.10.2.2 03-Aug-2004  skrll Sync with HEAD
 1.10.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.11.10.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.11.10.1 12-Feb-2005  yamt sync with head.
 1.11.8.1 29-Apr-2005  kent sync with -current
 1.13.4.4 21-Jan-2008  yamt sync with head
 1.13.4.3 07-Dec-2007  yamt sync with head
 1.13.4.2 27-Oct-2007  yamt sync with head.
 1.13.4.1 21-Jun-2006  yamt sync with head.
 1.14.50.1 25-Oct-2007  bouyer Sync with HEAD.
 1.14.46.2 09-Jan-2008  matt sync with HEAD
 1.14.46.1 06-Nov-2007  matt sync with HEAD
 1.14.44.2 09-Dec-2007  jmcneill Sync with HEAD.
 1.14.44.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.14.30.1 23-Oct-2007  ad Sync with head.
 1.15.4.2 26-Dec-2007  ad Sync with head.
 1.15.4.1 08-Dec-2007  ad Sync with head.
 1.15.2.2 27-Dec-2007  mjf Sync with HEAD.
 1.15.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.17.16.1 19-Aug-2009  yamt sync with head.
 1.18.40.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.18.22.1 03-Dec-2017  jdolecek update from HEAD
 1.10 27-Apr-1995  christos Try to make the reboot system call compile under sun3 with RB_STRING
support [not tested]
Add files.sunos
Rename system call switch table file from sunos_init_sysent.c to sunos_sysent.c
like other emulations.
 1.9 22-Apr-1995  christos syscalls.master was changed
 1.8 22-Apr-1995  christos - added struct emul to all emulations.
- removed all setup functions.
- added copyargs() functions where needed.
 1.7 06-Dec-1994  deraadt update
 1.6 26-Nov-1994  deraadt update
 1.5 20-Nov-1994  deraadt new syscalls
 1.4 14-Nov-1994  deraadt syscalls.master changed
 1.3 26-Oct-1994  deraadt update
 1.2 25-Oct-1994  deraadt and we update these
 1.1 25-Oct-1994  deraadt and these
 1.71 07-Sep-2021  riastradh sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.70 23-Sep-2019  christos Add missing break
 1.69 23-Apr-2019  msaitoh branches: 1.69.2;
KNF. No functional change.
 1.68 08-Oct-2016  maxv branches: 1.68.8; 1.68.16;
Uninitialized var, found by mootja; not tested, but obvious enough
 1.67 12-Dec-2015  nakayama branches: 1.67.2;
Redo previous. zero check before modulo.
 1.66 11-Dec-2015  mlelstv d_secpercyl is gone and we use the value from disklabel anyway.
 1.65 11-Dec-2015  mlelstv PR 50518 bad switch
 1.64 08-Dec-2015  christos Replace DIOCGPART -> DIOCGPARTINFO which returns the data needed instead of
pointers.
 1.63 26-Sep-2015  christos rename sun ioctls
 1.62 05-Sep-2014  matt branches: 1.62.2;
Try not to use f_data, use f_{vnode,socket,pipe,mqueue,kqueue,ksem} to get
a correctly typed pointer.
 1.61 19-Nov-2008  ad branches: 1.61.26;
Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.60 21-Mar-2008  ad branches: 1.60.4; 1.60.6; 1.60.10; 1.60.12;
Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
 1.59 20-Dec-2007  dsl branches: 1.59.6;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.58 08-Dec-2007  dsl branches: 1.58.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.57 04-Dec-2007  dsl Remove all the __P
 1.56 01-Jun-2007  he branches: 1.56.6; 1.56.8; 1.56.14; 1.56.16;
Fallout from the interface ioctl changes:

OSIOCGIFADDR -> OOSIOCGIFADDR
OSIOCGIFDSTADDR -> OOSIOCGIFDSTADDR
OSIOCGIFNETMASK -> OOSIOCGIFNETMASK

Also, one instance of needing to include <net/if.h> before
<compat/sys/sockio.h> due to use of IFNAMSIZ in the latter.

Discussed with christos.
 1.55 29-May-2007  christos Add a sockaddr_storage member to "struct ifreq" maintaining backwards
compatibility with the older ioctls. This avoids stack smashing and
abuse of "struct sockaddr" when ioctls placed "struct sockaddr_foo's" that
were longer than "struct sockaddr".
XXX: Some of the emulations might be broken; I tried to add code for
them but I did not test them.
 1.54 12-May-2007  dsl Split the fcntl locking code out from its copyin/out.
Use to avoid all the stackgap stuff in compat code.
 1.53 04-Mar-2007  christos branches: 1.53.2; 1.53.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.52 09-Feb-2007  ad branches: 1.52.2;
Merge newlock2 to head.
 1.51 11-Dec-2005  christos branches: 1.51.20;
merge ktrace-lwp.
 1.50 02-Jun-2005  tsutsui branches: 1.50.2;
Fix shadow warnings.
 1.49 01-Jun-2004  pk sunos_ioctl(): acquire a reference to the file.
This also fixes a locking botch reported in PR#25738.
 1.48 25-Apr-2004  matt Constify the speedtab arrays
 1.47 29-Jun-2003  fvdl branches: 1.47.2; 1.47.4;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.46 29-Jun-2003  darrenr More changes for providing lwpid for ktrace (sparc GENERIC built)
 1.45 21-Mar-2003  dsl Change 'data' argument to fo_ioctl and fo_fcntl from 'caddr_t' to 'void *'.
Avoids a lot of casting and removes the need for some line breaks.
Removed a load of (caddr_t) casts from calls to copyin/copyout as well.
(approved by christos - he has a plan to remove caddr_t...)
 1.44 23-Feb-2003  pk Make updating a file's reference and use count MP-safe.
 1.43 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.42 04-Jan-2003  wiz Spell output with two ts.
 1.41 30-May-2002  thorpej Statements must follow labels.
 1.40 16-Mar-2002  christos branches: 1.40.4; 1.40.6;
make the stackgap_{init,alloc} functions MP friendly (i.e. pass struct proc *
in, instead of using curproc). While there add an optional size argument to
stackgap_init.
 1.39 02-Mar-2002  mrg move the COMPAT_SUNOS TIOCGPGRP handling in the compat sunos code proper.
this is the final fix needed for it to run properly as an LKM. no more
COMPAT_SUNOS hacks around the tree!
 1.38 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.37 14-Jun-2001  thorpej branches: 1.37.2;
Fix a partial construction problem that can cause race conditions
between creation of a file descriptor and close(2) when using kernel
assisted threads. What we do is stick descriptors in the table, but
mark them as "larval". This causes essentially everything to treat
it as a non-existent descriptor, except for fdalloc(), which sees a
filled slot so that it won't (incorrectly) allocate it again. When
a descriptor is fully constructed, the code that has constructed it
marks it as "mature" (which actually clears the "larval" flag), and
things continue to work as normal.

While here, gather all the code that gets a descriptor from the table
into a fd_getfile() function, and call it, rather than having the
same (sometimes incorrect) code copied all over the place.
 1.36 30-May-2001  mrg use _KERNEL_OPT.
 1.35 03-Feb-2001  mrg branches: 1.35.2;
add missing !LKM check, noted by <tih@kpnQwest.no>
 1.34 02-Feb-2001  mrg sunos_ioctl.c is included by sunos32_ioctl.c. include the sunos32 &
netbsd32 headers if we are in sunos32 mode.
 1.33 01-Dec-2000  jdolecek add e_path (emulation path) to struct emul, which replaces emulation-specific
*_emul_path variables

change macros CHECK_ALT_{CREAT|EXIST} to use that, 'root' doesn't need
to be passed explicitly any more and *_CHECK_ALT_{CREAT|EXIST} are removed
change explicit emul_find() calls in probe functions to get the emulation
path from the checked exec switch entry's emulation

remove no longer needed header files

add e_flags and e_syscall to struct emul; these are unsed and empty for now
 1.32 27-Jul-2000  mrg fix LP64 warnings.
 1.31 30-Mar-2000  augustss Kill register declarations.
 1.30 09-Aug-1998  perry branches: 1.30.12;
bzero->memset, bcopy->memcpy, bcmp->memcmp
 1.29 20-Jun-1998  mrg use <dev/sun/disklabel.h> for new (old) compat ioctls: DKIOCGGEOM, DKIOCINFO and DKIOCGPART
 1.28 11-Dec-1997  pk Pull in fcntl GETLK/SETLK/UNLK compat functions from SVR4 sibling.
 1.27 19-Oct-1997  is - Doesn't need to privately define AUDIO_SPEAKER and AUDIO_HEADPHONE any
longer.
- XXX Don't access the nonexistant backlog structure element.
 1.26 11-May-1997  jeremy Ignore use of sunos_audioio.monitor_gain because it has no equivalent in the
audio sub-system. It used to use the ``__spare'' member of the audio_info
struct, but that has been removed.
 1.25 02-Jul-1996  pk Translate EIO to ENOTTY after a SunOS `TIOCGETPGRP' (tcgetpgrp(3)) fails
on a pty (see also kern/pty_tty.c).
 1.24 26-May-1996  pk I_SIGSET => I_SETSIG (pointed out by Greg Earle).
 1.23 14-Mar-1996  christos Bring prototypes into scope and fix compiler warnings.
 1.22 28-Feb-1996  pk Insert sunos_sys_fcntl().
 1.21 07-Oct-1995  mycroft Prefix names of system call implementation functions with `sys_'.
 1.20 19-Sep-1995  thorpej Make system calls conform to a standard prototype and bring those
prototypes into scope.
 1.19 11-Jun-1995  pk Go with the flow; use `/emul/sunos' pseudo-root (from Matthew Green).
Note: sunos_stat() and sunos_lstat() were added too.
 1.18 04-May-1995  pk init `mode' field in sunaudiogetinfo().
 1.17 02-Apr-1995  pk Fix TCGETA compat, from Matthew Green.
SunOS `setaudioinfo' does implicit `getaudioinfo'.
Recognise streams flush/setsig ioctls.
 1.16 04-Mar-1995  pk Move SunOS audio_info compat stuff here (from sparc/dev/bsd_audio.c).
 1.15 20-Nov-1994  deraadt improve VMIN/VTIME emulation (from chs+@CS.cmu.edu)
 1.14 31-Oct-1994  deraadt fix CS[5678] code
 1.13 25-Oct-1994  deraadt rename, new syscall interface, etc.
 1.12 20-Oct-1994  cgd pay a small amount of lip service to the new syscall args mechanism.
In reality, none of these will compile.
 1.11 29-Jun-1994  cgd New RCS ID's, take two. they're more aesthecially pleasant, and use 'NetBSD'
 1.10 21-May-1994  deraadt bail on SIOCGARP
 1.9 26-Apr-1994  pk Fix typo.
Give TIOCTCNTL a try.
 1.8 28-Jan-1994  jtc Fix spelling error in Copyright notice
 1.7 15-Jan-1994  deraadt sync with magnum
 1.6 12-Dec-1993  deraadt m68k/sparc sunos binary compatibility code, pulled down from magnum branch
for consumption by the m68k masses
 1.5 22-Nov-1993  deraadt branches: 1.5.2;
moved from arch/sparc/sunos to compat/sunos
 1.4 20-Nov-1993  deraadt fake support for TIOCSSOFTCAR and TIOCGSOFTCAR
(one of which used to point to NetBSD's TIOCSTAT :-)
 1.3 14-Nov-1993  deraadt disassembly shows the %f2 register being accessed, and of course the
kernel panics.
why wasit using %f2? some expressions were too complicated and gcc2 (with
the optimizer off, mind you) ran out of integer registers and thus used
started using a float register for a temporary.
 1.2 10-Nov-1993  deraadt replacement set of sun ioctl functions. markus wild added a
whole slew of new ioctl's that are much more close to reality.

the comat-sunos tree is now almost good enough to be used in
both m68k and sparc kernels.
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.5.2.3 28-Dec-1993  pk Pass address of argument in TIOCSIG ioctl function.
One EOPNOTSUPP => ENODEV on tty descriptors.
 1.5.2.2 30-Nov-1993  pk One more ioctl translation (TIOCSIGNAL).
 1.5.2.1 28-Nov-1993  deraadt initial SIOC* support from pk. needs more work.
 1.30.12.3 11-Feb-2001  bouyer Sync with HEAD.
 1.30.12.2 08-Dec-2000  bouyer Sync with HEAD.
 1.30.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.35.2.8 07-Jan-2003  thorpej Sync with HEAD.
 1.35.2.7 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.35.2.6 20-Jun-2002  nathanw Catch up to -current.
 1.35.2.5 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.35.2.4 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.35.2.3 15-Nov-2001  pk LWP system call signature conversion.
 1.35.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.35.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.37.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.37.2.2 16-Mar-2002  jdolecek Catch up with -current.
 1.37.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.40.6.1 30-May-2002  tv Pull up revision 1.41 (requested by thorpej in ticket #92):
Statements must follow labels.
 1.40.4.1 20-Jun-2002  gehenna catch up with -current.
 1.47.4.1 04-Jun-2004  jmc Pullup rev 1.49 (requested by pk in ticket #434)

sunos_ioctl(): acquire a reference to the file. PR#25738
 1.47.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.47.2.4 21-Nov-2004  skrll Adapt to branch.
 1.47.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.47.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.47.2.1 03-Aug-2004  skrll Sync with HEAD
 1.50.2.6 24-Mar-2008  yamt sync with head.
 1.50.2.5 21-Jan-2008  yamt sync with head
 1.50.2.4 07-Dec-2007  yamt sync with head
 1.50.2.3 03-Sep-2007  yamt sync with head.
 1.50.2.2 26-Feb-2007  yamt sync with head.
 1.50.2.1 21-Jun-2006  yamt sync with head.
 1.51.20.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.52.2.2 17-May-2007  yamt sync with head.
 1.52.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.53.4.1 11-Jul-2007  mjf Sync with head.
 1.53.2.2 09-Jun-2007  ad Sync with head.
 1.53.2.1 27-May-2007  ad Sync with head.
 1.56.16.2 26-Dec-2007  ad Sync with head.
 1.56.16.1 08-Dec-2007  ad Sync with head.
 1.56.14.2 27-Dec-2007  mjf Sync with HEAD.
 1.56.14.1 08-Dec-2007  mjf Sync with HEAD.
 1.56.8.1 09-Jan-2008  matt sync with HEAD
 1.56.6.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.58.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.59.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.59.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.60.12.1 19-Jan-2009  skrll Sync with HEAD.
 1.60.10.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.60.6.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.60.6.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.60.4.1 04-May-2009  yamt sync with head.
 1.61.26.1 03-Dec-2017  jdolecek update from HEAD
 1.62.2.2 05-Dec-2016  skrll Sync with HEAD
 1.62.2.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.67.2.1 04-Nov-2016  pgoyette Sync with HEAD
 1.68.16.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.68.16.1 10-Jun-2019  christos Sync with HEAD
 1.68.8.1 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1836):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.69.2.1 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.177 07-Sep-2021  riastradh sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.176 26-Oct-2019  christos use strlcpy() for the uts conversion, makes the code simpler and more readable.
 1.175 04-Oct-2019  mrg replace memcpy() with src bounds overflow with single char write.
 1.174 23-Sep-2019  christos make this compile again.
 1.173 03-Jul-2019  dholland branches: 1.173.2;
Stack buffers mustn't escape their scope. PR 54326 from David Binderman
 1.172 03-Sep-2018  riastradh Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.171 28-Jul-2017  riastradh branches: 1.171.2; 1.171.4;
Fail, don't panic, on bad dirents from file system.

Controllable via puffs from userland.

From Ilja Van Sprundel.
 1.170 23-Oct-2015  maxv branches: 1.170.10;
Change do_sys_mount() so that it only takes as argument the type of the
drive instead of its associated vfsops. Makes it more friendly, and allows
compat binaries to autoload VFS modules if needed.

sent on tech-kern@, ok christos@
 1.169 05-Sep-2014  matt branches: 1.169.2;
Try not to use f_data, use f_{vnode,socket,pipe,mqueue,kqueue,ksem} to get
a correctly typed pointer.
 1.168 24-Jun-2010  hannken branches: 1.168.14; 1.168.18; 1.168.20; 1.168.28; 1.168.34; 1.168.36; 1.168.40;
Clean up vnode lock operations pass 2:

VOP_UNLOCK(vp, flags) -> VOP_UNLOCK(vp): Remove the unneeded flags argument.

Welcome to 5.99.32.

Discussed on tech-kern.
 1.167 03-Mar-2010  pooka branches: 1.167.2;
One more overcomplex ENOSYS bites the dust.
 1.166 03-Mar-2010  he When implementing "read directory", when there are too many empty entries
in a row, and we need to try to read the next block, and have passed a
non-NULL cookie pointer to VOP_READDIR, ensure that we free the cookie
buffer before re-doing VOP_READDIR, so that we don't leak memory.
This fix is similar to nfs_serv.c revisions 1.115 + 1.124.

This should fix the long-standing problem observed by e.g. using Linux-
emulated programs to take backup of servers, which is one of the problems
which were reported in PR#42661.

Thanks to pooka@ for the hints for traversing the VOP* layer.
 1.165 29-Jun-2009  dholland branches: 1.165.2;
Convert 67 namei call sites to use namei_simple, in these functions:

check_console, veriexecclose, veriexec_delete, veriexec_file_add,
emul_find_root, coff_load_shlib (sh3 version), coff_load_shlib,
compat_20_sys_statfs, compat_20_netbsd32_statfs,
ELFNAME2(netbsd32,probe_noteless), darwin_sys_statfs,
ibcs2_sys_statfs, ibcs2_sys_statvfs, linux_sys_uselib,
osf1_sys_statfs, sunos_sys_statfs, sunos32_sys_statfs,
ultrix_sys_statfs, do_sys_mount, fss_create_files (3 of 4),
adosfs_mount, cd9660_mount, coda_ioctl, coda_mount, ext2fs_mount,
ffs_mount, filecore_mount, hfs_mount, lfs_mount, msdosfs_mount,
ntfs_mount, sysvbfs_mount, udf_mount, union_mount, sys_chflags,
sys_lchflags, sys_chmod, sys_lchmod, sys_chown, sys_lchown,
sys___posix_chown, sys___posix_lchown, sys_link, do_sys_pstatvfs,
sys_quotactl, sys_revoke, sys_truncate, do_sys_utimes, sys_extattrctl,
sys_extattr_set_file, sys_extattr_set_link, sys_extattr_get_file,
sys_extattr_get_link, sys_extattr_delete_file,
sys_extattr_delete_link, sys_extattr_list_file, sys_extattr_list_link,
sys_setxattr, sys_lsetxattr, sys_getxattr, sys_lgetxattr,
sys_listxattr, sys_llistxattr, sys_removexattr, sys_lremovexattr

All have been scrutinized (several times, in fact) and compile-tested,
but not all have been explicitly tested in action.

XXX: While I haven't (intentionally) changed the use or nonuse of
XXX: TRYEMULROOT in any of these places, I'm not convinced all the
XXX: uses are correct; an audit might be desirable.
 1.164 11-Jan-2009  tsutsui branches: 1.164.2;
Update for compat_50 stuff. (compile test only)
 1.163 19-Nov-2008  ad Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.162 12-Nov-2008  ad Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.
 1.161 07-Aug-2008  plunky branches: 1.161.2; 1.161.4; 1.161.8;
convert some [left behind] compat code to use new sockopt API
 1.160 24-Jun-2008  ad branches: 1.160.2;
Replace references to getsock/getvnode.
 1.159 21-Mar-2008  ad branches: 1.159.4; 1.159.6; 1.159.8;
Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
 1.158 27-Dec-2007  martin branches: 1.158.6;
Remove now superflous (and wrong) extern declaration for maxfiles.
 1.157 20-Dec-2007  dsl Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.156 08-Dec-2007  pooka branches: 1.156.4;
Remove cn_lwp from struct componentname. curlwp should be used
from on. The NDINIT() macro no longer takes the lwp parameter and
associates the credentials of the calling thread with the namei
structure.
 1.155 08-Dec-2007  dsl ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.154 04-Dec-2007  dsl Remove all the __P
 1.153 27-Nov-2007  dogcow branches: 1.153.2;
more VFS_STATVFS(x,y,z) fallout; change them to VFS_STATVFS(x,y). (hi, pooka!)
 1.152 08-Oct-2007  ad branches: 1.152.4;
Merge file descriptor locking, cwdi locking and cross-call changes
from the vmlocking branch.
 1.151 17-Jul-2007  christos branches: 1.151.6; 1.151.8; 1.151.10;
include <compat/sys/mount.h> for MFSNAMELEN
 1.150 12-Jul-2007  dsl Change compat mount code to pass do_sys_mount() kernel resident buffers.
Possibly the standard nfs code needs teaching how to set the length and
address family in order to support non-netbsd sockaddr.
There are now no active stackgap() calls in the compat tree.
 1.149 12-May-2007  dsl Change interface to settimeofday1() so that it can also be used from
compat code in order to avoid the stackgap.
 1.148 28-Apr-2007  dogcow and unbork some more changes.
 1.147 22-Apr-2007  dsl Change the way that emulations locate files within the emulation root to
avoid having to allocate space in the 'stackgap'
- which is very LWP unfriendly.
The additional code for non-emulation namei() is trivial, the reduction for
the emulations is massive.
The vnode for a processes emulation root is saved in the cwdi structure
during process exec.
If the emulation root the TRYEMULROOT flag are set, namei() will do an initial
search for absolute pathnames in the emulation root, if that fails it will
retry from the normal root.
".." at the emulation root will always go to the real root, even in the middle
of paths and when expanding symlinks.
Absolute symlinks found using absolute paths in the emulation root will be
relative to the emulation root (so /usr/lib/xxx.so -> /lib/xxx.so links
inside the emulation root don't need changing).
If the root of the emulation would be returned (for an emulation lookup), then
the real root is returned instead (matching the behaviour of emul_lookup,
but being a cheap comparison here) so that programs that scan "../.."
looking for the root dircetory don't loop forever.
The target for symbolic links is no longer mangled (it used to get the
CHECK_ALT_xxx() treatment, so could get /emul/xxx prepended).
CHECK_ALT_xxx() are no more. Most of the change is deleting them, and adding
TRYEMULROOT to the flags to NDINIT().
A lot of the emulation system call stubs could now be deleted.
 1.146 04-Mar-2007  tsutsui branches: 1.146.2; 1.146.4;
- don't forget to add * to all params
- use (char *) where pointer arith is required
 1.145 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.144 09-Feb-2007  ad branches: 1.144.2;
Merge newlock2 to head.
 1.143 14-Nov-2006  elad branches: 1.143.2;
Clean some KAUTH_GENERIC_ISSUSER usage in compat code.
 1.142 01-Sep-2006  matt branches: 1.142.2; 1.142.4;
When calling PTRACE from an LKM, use sysent[SYS_ptrace].sy_call in case
the sys_ptrace symbol isn't present.
 1.141 30-Aug-2006  he Update for options PTRACE.
 1.140 23-Jul-2006  ad Use the LWP cached credentials where sane.
 1.139 26-Jun-2006  mrg version the socket(2) syscall. for compat30 socket, we use
EPROTONOSUPPORT instead of EAFNOSUPPORT.

from pavel@ with a little bit of clean up from myself.

XXX: netbsd32 (and perhaps other emulations) should be able
XXX: to call the standard socket calls for this i think, but
XXX: revisit this at another time.
 1.138 15-May-2006  yamt branches: 1.138.4;
- include kauth.h for kauth_authorize_generic.
- wrap a long line.
 1.137 14-May-2006  elad integrate kauth.
 1.136 01-Mar-2006  yamt branches: 1.136.2; 1.136.4; 1.136.6;
merge yamt-uio_vmspace branch.

- use vmspace rather than proc or lwp where appropriate.
the latter is more natural to specify an address space.
(and less likely to be abused for random purposes.)
- fix a swdmover race.
 1.135 24-Dec-2005  perry branches: 1.135.2; 1.135.4; 1.135.6;
__inline__ -> inline
 1.134 11-Dec-2005  christos merge ktrace-lwp.
 1.133 14-Sep-2005  he This now needs <compat/sys/signal.h> to build.
 1.132 19-Apr-2005  christos branches: 1.132.2;
PR/29696: Joel Carnat: NetBSD freezes when accessing smbfs mounted FS with
firefox/linux due to compat getdents() call assumption that all filesystems
support cookies.
 1.131 26-Feb-2005  perry branches: 1.131.2;
nuke trailing whitespace
 1.130 17-Sep-2004  skrll branches: 1.130.4; 1.130.6;
There's no need to pass a proc value when using UIO_SYSSPACE with
vn_rdwr(9) and uiomove(9).

OK'd by Jason Thorpe
 1.129 25-Apr-2004  matt Constify sreq2breq
 1.128 25-Apr-2004  matt Constify a few read-only arrays/variables.
 1.127 22-Apr-2004  hannken Make it compile again after statvfs import.
 1.126 21-Apr-2004  christos Replace the statfs() family of system calls with statvfs().
Retain binary compatibility.
 1.125 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.124 29-Jun-2003  fvdl branches: 1.124.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.123 29-Jun-2003  darrenr More changes for providing lwpid for ktrace (sparc GENERIC built)
 1.122 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.121 16-May-2003  itojun use strlcpy
[compat/svr4_32 should have bound check for SVR4_32_AUX_ARGSIZ]
 1.120 23-Feb-2003  pk Make updating a file's reference and use count MP-safe.
 1.119 29-Jan-2003  atatat Cull unused variables. Sigh.

PS - Cross compilers are cool.
 1.118 28-Jan-2003  atatat No need to pick a "default address" for mmap in compat code, since we
merely call sys_mmap() at the end anyway, and that will pick the
address for us, if it's needed.

Likewise for checking if /dev/zero is being mapped.
 1.117 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.116 06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.115 04-Jul-2002  thorpej Add kernel support for having userland provide the signal trampoline:

* struct sigacts gets a new sigact_sigdesc structure, which has the
sigaction and the trampoline/version. Version 0 means "legacy kernel
provided trampoline". Other versions are coordinated with machine-
dependent code in libc.
* sigaction1() grows two more arguments -- the trampoline pointer and
the trampoline version.
* A new __sigaction_sigtramp() system call is provided to register a
trampoline along with a signal handler.
* The handler is no longer passed to sensig() functions. Instead,
sendsig() looks up the handler by peeking in the sigacts for the
process getting the signal (since it has to look in there for the
trampoline anyway).
* Native sendsig() functions now select the appropriate trampoline and
its arguments based on the trampoline version in the sigacts.

Changes to libc to use the new facility will be checked in later. Kernel
version not bumped; we will ride the 1.6C bump made recently.
 1.114 16-Mar-2002  christos branches: 1.114.4;
make the stackgap_{init,alloc} functions MP friendly (i.e. pass struct proc *
in, instead of using curproc). While there add an optional size argument to
stackgap_init.
 1.113 03-Jan-2002  mrg move the COMPAT_SUNOS SO_BROADCAST hack out of uipc_socket.c into the
compat/sunos code. besides being cleaner this allows the sunos LKM
to properly work without any special kernel hacks.
 1.112 02-Dec-2001  tsutsui Don't define COMPAT_SUNOS here. It is defined in opt_compat_sunos.h
and <sys/ioctl.h> and <sys/tty.h> include it properly.

XXX Is this needed for LKM?
 1.111 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.110 14-Jun-2001  thorpej branches: 1.110.2; 1.110.4;
Fix a partial construction problem that can cause race conditions
between creation of a file descriptor and close(2) when using kernel
assisted threads. What we do is stick descriptors in the table, but
mark them as "larval". This causes essentially everything to treat
it as a non-existent descriptor, except for fdalloc(), which sees a
filled slot so that it won't (incorrectly) allocate it again. When
a descriptor is fully constructed, the code that has constructed it
marks it as "mature" (which actually clears the "larval" flag), and
things continue to work as normal.

While here, gather all the code that gets a descriptor from the table
into a fd_getfile() function, and call it, rather than having the
same (sometimes incorrect) code copied all over the place.
 1.109 30-May-2001  mrg use _KERNEL_OPT.
 1.108 12-Feb-2001  fvdl branches: 1.108.2;
Cast 32bit sunos_nfs_arg member to (char *)(long) to avoid warning
after sunos.h change (cast is safe; a SunOS binary will pas a 32 bit
pointer).
 1.107 01-Dec-2000  jdolecek make LKM safe
 1.106 01-Dec-2000  jdolecek add e_path (emulation path) to struct emul, which replaces emulation-specific
*_emul_path variables

change macros CHECK_ALT_{CREAT|EXIST} to use that, 'root' doesn't need
to be passed explicitly any more and *_CHECK_ALT_{CREAT|EXIST} are removed
change explicit emul_find() calls in probe functions to get the emulation
path from the checked exec switch entry's emulation

remove no longer needed header files

add e_flags and e_syscall to struct emul; these are unsed and empty for now
 1.105 28-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.104 30-Mar-2000  augustss Kill register declarations.
 1.103 28-Mar-2000  simonb Centralise the declarations of cpu_model, machine, machine_arch,
osrelease, and ostype and remove "extern char foo[];" (for hostname
and domainname too).

Also delete redunctant decl of boottime in kern_info_43.c.
 1.102 26-Mar-2000  kleink Merge parts of chs-ubc2 into the trunk:
* Remove the casts to vaddr_t from the round_page() and trunc_page() macros to
make them type-generic, which is necessary i.e. to operate on file offsets
without truncating them.
* In due course, cast pointer arguments to these macros to an appropriate
integral type (paddr_t, vaddr_t).

Originally done by Chuck Silvers, updated by myself.
 1.101 05-May-1999  thorpej branches: 1.101.2;
Add "use counting" to file entries. When closing a file, and it's reference
count is 0, wait for use count to drain before finishing the close.

This is necessary in order for multiple processes to safely share file
descriptor tables.
 1.100 22-Mar-1999  sommerfe branches: 1.100.4;
Use regular system fchroot, now that we have it.
 1.99 09-Feb-1999  christos Const poisoning and CHECK_ALT_CREAT fixes
 1.98 21-Dec-1998  drochner g/c SA_USERTRAMP (ok'd by pk)
 1.97 19-Dec-1998  drochner get "opt_compat_xxx.h" includes out of <sys/signal.h>
 1.96 14-Sep-1998  pk Fix copyout() argument switch.
 1.95 13-Sep-1998  pk Signal compat: sunos sigset_t conversions;
new sunos_sigvec() & sunos_sigpending()
 1.94 08-Sep-1998  rvb ufs_readdir no longer checks if vp->v_type != VDIR so
the individual emulated readdirs must check.
Since netbsd and freebsd return EINVAL for the error
and I don't know what the other platforms do, return
EINVAL for them too.
 1.93 29-Aug-1998  mrg move <vm/vm_swap.h> to <sys/swap.h>. <vm/vm_swap.h> still works for now (goes away later)
 1.92 09-Aug-1998  perry bzero->memset, bcopy->memcpy, bcmp->memcmp
 1.91 26-Jun-1998  hannken Include NFSSERVER option header opt_nfsserver.h.
 1.90 04-Mar-1998  fvdl Make this compile again.
 1.89 03-Mar-1998  fvdl Only free cookiebuf when sure that the vop actually allocated it.
 1.88 01-Mar-1998  fvdl Merge with Lite2 + local changes
 1.87 19-Feb-1998  thorpej Include the NFS option header.
 1.86 21-Oct-1997  fvdl branches: 1.86.2;
Update for new msync (== __msync13), use flags
 1.85 19-Oct-1997  christos Simplify use of round_page() like in other emulations.
 1.84 19-Oct-1997  carrel cast to void * not caddr_t
 1.83 10-Oct-1997  fvdl Fix braino in my interpretation of the eof flag to VOP_READDIR.
 1.82 10-Oct-1997  fvdl Signal error when getting a 64 bit offset cookie that can't be stored
in 32 bits. Provide an error message to the user, and return EINVAL.
Also, pay attention to the EOF flag from VOP_READDIR. Correct a
misspell in a panic message.
 1.81 04-Aug-1997  bouyer branches: 1.81.2;
Fix "missing entries" bug when reading large directories: When reading a
directory and running out of space in the dest buffer, off should point to the
current entry (which was not saved) and not to the next.
I discovered this bug using linux and SunOS emulation over NFS, but seems to
affect other emulations as well.
 1.80 13-Jun-1997  thorpej branches: 1.80.4;
Garbage-collect sunos_sys_swapon(); it is not needed.
 1.79 12-Jun-1997  mrg bring mrg-vm-swap2 onto mainline.
 1.78 08-May-1997  mycroft branches: 1.78.2;
Pass the vnode type to vaccess(), and use it when checking VEXEC. Make sure
that the mode bits passed to vaccess() and returned by foo_getattr() contain
only permission bits.
 1.77 08-May-1997  mycroft VEXEC -> VLOOKUP, as appropriate.
 1.76 31-Jan-1997  thorpej NFSCLIENT -> NFS
 1.75 28-Dec-1996  cjs branches: 1.75.2;
This recently stopped compiling due to a warning about const being
dropped. This fix suggested by cgd.
 1.74 13-Oct-1996  christos Remove STACKGAPBASE dependencies.
 1.73 13-Oct-1996  christos catch up with Jason's changes.
 1.72 07-Sep-1996  mycroft Implement poll(2).
 1.71 03-Sep-1996  mycroft Define execv() and execve() consistently across emulations.
Do path name translation.
 1.70 30-Aug-1996  christos add obsolete stime(2)
 1.69 26-Aug-1996  thorpej Implement sunos_sys_execve(). The previous code simply called
sys_execve() without doing an alternate patch check, which was
incorrect. Bug pointed out by Krister Walfridsson <cato@df.lth.se>
on port-sparc@NetBSD.ORG.
 1.68 11-Aug-1996  mrg update sunos_sys_reboot() to actually work again.
 1.67 09-Aug-1996  mrg Change reboot(2) to take two arguments: bootopt like normal and also
a boot string for firmware that can do this, such as the SPARC and
the sun3 models. It is currently silently ignored on all other
hardware now, however. The MD function "boot()" has been changed to
also take a char *.
 1.66 14-Jun-1996  cgd avoid unnecessary checks of m_get/MGET/etc.'s return values. When
they're called with M_WAIT, they are defined to never return NULL.
 1.65 22-Apr-1996  christos branches: 1.65.4;
remove include of <sys/cpu.h>
 1.64 14-Mar-1996  christos Bring prototypes into scope and fix compiler warnings.
 1.63 28-Feb-1996  gwr dir => dirent
 1.62 25-Feb-1996  pk If NFS `rsize' is specified, set `readdirsize' too.
 1.61 18-Feb-1996  pk Adapt compat NFS mount code to NFSv3.
 1.60 05-Jan-1996  pk Implement vhangup(); more or less as suggested in PR#1560 (matthew green).
I'm vrele'ing s_ttyvp here too, so sys_exit() won't have to go over it
again.
 1.59 14-Dec-1995  ghudson Reverse pk's changes from 1.57; the faked cookies are not valid,
and are no longer necessary now that NFS provides cookies.
 1.58 07-Nov-1995  gwr ufs ==> ffs
 1.57 11-Oct-1995  pk Gets NFS-mounted /emul/sunos going again by faking readdir cookies if
not supported by VOP_READDIR().
 1.56 09-Oct-1995  mycroft branches: 1.56.2;
Use cookies for directory offset, mostly from Greg Hudson.
 1.55 07-Oct-1995  mycroft Prefix names of system call implementation functions with `sys_'.
 1.54 19-Sep-1995  thorpej Make system calls conform to a standard prototype and bring those
prototypes into scope.
 1.53 15-Aug-1995  gwr Catch up with renamed SA_DISABLE flag and update
sunos_sigvec to allow the new SA_RESETHAND flag.
 1.52 05-Jul-1995  pk Start using sunos_sigvec().
 1.51 25-Jun-1995  briggs * Don't include sys/exec.h explicitly--it's not protected against multiple
inclusions and compat_util.h now includes it.
* Declare struct emul *e=p->p_emul in a couple of places so we can use
STACKGAPBASE macro (should this macro be modified to take a struct
emul * or struct proc * parameter?).
* Declare extern struct emul emul_sunos for sunos_sigvec's comparison.
 1.50 24-Jun-1995  christos Use compat_util.[ch]
 1.49 18-Jun-1995  cgd don't assume the f_fsnamelen is nul-truncated or longer than MFSNAMELEN
 1.48 11-Jun-1995  pk Go with the flow; use `/emul/sunos' pseudo-root (from Matthew Green).
Note: sunos_stat() and sunos_lstat() were added too.
 1.47 27-Apr-1995  christos Try to make the reboot system call compile under sun3 with RB_STRING
support [not tested]
Add files.sunos
Rename system call switch table file from sunos_init_sysent.c to sunos_sysent.c
like other emulations.
 1.46 26-Apr-1995  gwr Make sunos_reboot(RB_STRING,"...") work for sun3.
Could be made to work for sparc too.
 1.45 23-Apr-1995  briggs Fix compiler error in sunos_reboot().
 1.44 22-Apr-1995  christos Added sunos_reboot().
 1.43 21-Mar-1995  mycroft Update to use timer{add,sub}().
 1.42 09-Mar-1995  mycroft copy*str() should use size_t.
 1.41 17-Dec-1994  mycroft timevaladd -> __timeradd (AGAIN)
 1.40 16-Dec-1994  deraadt correct ansi glitch
 1.39 15-Dec-1994  pk mode/flags confusion in sunos_open().
 1.38 11-Dec-1994  mycroft Use __timeradd(), not timervaladd().
 1.37 30-Nov-1994  pk Convert SunOS IP multicast socket options.
 1.36 23-Nov-1994  deraadt m68k does not have PT_{SET,GET}FPREGS
 1.35 20-Nov-1994  deraadt ptrace from chs+@CS.cmu.edu, poll from christos
 1.34 14-Nov-1994  deraadt fix sunos_mmap
 1.33 25-Oct-1994  deraadt rename, new syscall interface, etc.
 1.32 20-Oct-1994  cgd pay a small amount of lip service to the new syscall args mechanism.
In reality, none of these will compile.
 1.31 28-Sep-1994  deraadt use STACKGAPBASE
 1.30 29-Jun-1994  cgd New RCS ID's, take two. they're more aesthecially pleasant, and use 'NetBSD'
 1.29 22-Jun-1994  pk sun_mount: fill in one more field.
 1.28 15-Jun-1994  deraadt async_daemon only if NFSCLIENT
 1.27 10-Jun-1994  pk Adapt to 4.4-lite.
 1.26 08-Jun-1994  mycroft Minor change.
 1.25 06-Jun-1994  deraadt tricky
 1.24 24-May-1994  deraadt maxfdescs -> maxfiles
 1.23 21-May-1994  deraadt iszerodev
 1.22 19-May-1994  deraadt fix uname after sysctl
 1.21 05-May-1994  deraadt p->p_sig -> p->p_siglist
 1.20 05-May-1994  cgd fix my forgetfulness; from gwr
 1.19 04-May-1994  cgd expand the rlimit struct, kill last vestiges of off_t bogosity.
 1.18 29-Apr-1994  cgd kill syscall name aliases. no user-visible changes
 1.17 26-Apr-1994  pk SunOS's RLIMIT_NOFILE is different: add sun_[gs]rlimit().
 1.16 24-Apr-1994  deraadt make sunos mount(2) work again
 1.15 02-Apr-1994  cgd sickness to get SunOS mmap right
 1.14 27-Mar-1994  cgd expand uid_t/gid_t/off_t
 1.13 03-Mar-1994  deraadt DoH!
 1.12 03-Mar-1994  deraadt first cut at a SUNOS_COMPAT sysconf() system call.
 1.11 20-Feb-1994  chopps place conditional around sun_nfssvc.
 1.10 12-Dec-1993  deraadt m68k/sparc sunos binary compatibility code, pulled down from magnum branch
for consumption by the m68k masses
 1.9 22-Nov-1993  deraadt branches: 1.9.2;
moved from arch/sparc/sunos to compat/sunos
 1.8 20-Nov-1993  deraadt new compat functions: sun_open, sun_auditsys, sun_setpgid, sun_uname
some from Markus.
 1.7 12-Nov-1993  deraadt specdev.h moves
 1.6 10-Nov-1993  deraadt silly typo
 1.5 10-Nov-1993  deraadt support both sun3 & sparc concepts of minor/major #'s for /dev/zero
 1.4 15-Oct-1993  deraadt fix sun_getdents()
fix sun_mmap()
Note: delete the "struct dirent" in here when sys/dirent.h is created.
 1.3 13-Oct-1993  deraadt Add a stub auditsys() system call that does nothing.
SunOS /sbin/fsck calls it..
 1.2 11-Oct-1993  deraadt various changes, suffice to say that 4.4 syscalls do not look like ours
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.9.2.10 23-Jan-1994  deraadt make sun_misc compile without NFSSERVER. thanks to
Niklas Hallqvist <niklas@appli.se>
 1.9.2.9 01-Dec-1993  pk Introduced sun_mknod() which also deals with FIFOs (ie. `mknod xxx p' on SunOS).
 1.9.2.8 30-Nov-1993  deraadt impliment fstatfs() and statfs() better
 1.9.2.7 27-Nov-1993  deraadt very rudimentary exportfs(2) support, ie. "return 0"
 1.9.2.6 27-Nov-1993  deraadt statfs(2) and fstatfs(2) support. `df' now works.
 1.9.2.5 27-Nov-1993  deraadt add vhangup(2)
generalize m68k support for /dev/zero..
 1.9.2.4 26-Nov-1993  deraadt add real wimpy quotactl(2) emulation
 1.9.2.3 26-Nov-1993  deraadt add basically bogus ustat(2) support.
 1.9.2.2 26-Nov-1993  deraadt nfssvc(2) system call emulation. might work, might not -- have to
wait for exportfs(2) support for mountd..
 1.9.2.1 26-Nov-1993  deraadt added mount(2) nfs support
 1.56.2.2 07-Nov-1995  gwr From Head: ufs ==> ffs
 1.56.2.1 13-Oct-1995  pk Update from trunk: fake cookies
 1.65.4.1 10-Dec-1996  mycroft From trunk:
Do execv() and execve() path name translation consistently across
emulations.
 1.75.2.1 14-Jan-1997  thorpej Snapshot of work-in-progress, committed to private branch.

These changes implement machine-independent root device and file system
selection. Notable features:

- All ports behave in a consistent manner regarding root
device selection.
- No more "options GENERIC"; all kernels have the ability
to boot with RB_ASKNAME to select root device and file system
type.
- Root file system type can be wildcarded; a machine-independent
function will try all possible file systems for the selected
root device until one succeeds.
- If the root file system fails to mount, the operator will
be given the chance to select a new root device and file
system type, rather than having the machine simply panic.
- nfs_mountroot() no longer panics if any part of the NFS
mount process fails; it now returns an error, giving the
operator a chance to recover.
- New, more consistent, config(8) grammar. The constructs:

config netbsd swap generic
config netbsd root on nfs

have been replaced with:

config netbsd root on ? type ?
config netbsd root on ? type nfs

Additionally, the operator may select or wildcard root file
system type in the kernel configuration file:

config netbsd root on cd0a type cd9660

config(8) now requires that a "root" specification be
made. "root" may be wired down or wildcarded. "swap" and
"dump" specifications are optional, and follow previous
semantics.

- config(8) has a new "file-system" keyword, used to configure
file systems into the kernel. Eventually, this will be used
to generate the default vfssw[].

- "options NFSCLIENT" is obsolete, and is replaced by
"file-system NFS". "options NFSSERVER" still exists, since
NFS server support is independent of the NFS file system
client.

- sys/arch/<foo>/<foo>/swapgeneric.c is no longer used, and
will be removed; all information is now generated by config(8).

As of this commit, all ports except arm32 have been updated to use
the new setroot(). Only SPARC, i386, and Alpha ports have been
tested at this time. Port masters should test these changes on their
ports, and report any problems back to me.

More changes are on their way, including RB_ASKNAME support in
nfs_mountroot() (to prompt for server address and path) and, potentially,
the ability to select rarp/bootparam or bootp in nfs_mountroot().
 1.78.2.2 01-Jun-1997  mrg implement sunos_sys_swapon().
 1.78.2.1 08-May-1997  mrg file sunos_misc.c was added on branch mrg-vm-swap2 on 1997-06-01 14:14:12 +0000
 1.80.4.2 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.80.4.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.81.2.1 08-Sep-1997  thorpej Significantly restructure the way signal state for a process is stored.
Rather than using bitmasks to redundantly store the information kept
in the process's sigacts (because the sigacts was kept in the u-area),
hang sigacts directly off the process, and access it directly.

Simplify signal setup code tremendously by storing information in
the sigacts as an array of struct sigactions, rather than in a different
format, since userspace uses sigactions.

Make sigacts sharable by adding reference counting.
 1.86.2.2 21-Oct-1997  fvdl Update for new msync (== __msync13), use flags
 1.86.2.1 21-Oct-1997  fvdl file sunos_misc.c was added on branch netbsd-1-3 on 1997-10-21 00:58:42 +0000
 1.100.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.101.2.3 12-Mar-2001  bouyer Sync with HEAD.
 1.101.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.101.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.108.2.12 17-Sep-2002  nathanw Catch up to -current.
 1.108.2.11 01-Aug-2002  nathanw Catch up to -current.
 1.108.2.10 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.108.2.9 21-Jun-2002  gmcgarry LWPify socket syscalls.
 1.108.2.8 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.108.2.7 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.108.2.6 28-Feb-2002  nathanw Catch up to -current.
 1.108.2.5 11-Jan-2002  nathanw More catchup.
 1.108.2.4 08-Jan-2002  nathanw Catch up to -current.
 1.108.2.3 15-Nov-2001  pk LWP system call signature conversion.
 1.108.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.108.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.110.4.1 26-Sep-2001  fvdl * add a VCLONED vnode flag that indicates a vnode representing a cloned
device.
* rename REVOKEALL to REVOKEALIAS, and add a REVOKECLONE flag, to pass
to VOP_REVOKE
* the revoke system call will revoke all aliases, as before, but not the
clones
* vdevgone is called when detaching a device, so make it use REVOKECLONE
to get rid of all clones as well
* clean up all uses of VOP_OPEN wrt. locking.
* add a few VOPS to spec_vnops that need to do something when it's a
clone vnode (access and getattr)
* add a copy of the vnode vattr structure of the original 'master' vnode
to the specinfo of a cloned vnode. could possibly redirect getattr to
the 'master' vnode, but this has issues with revoke
* add a vdev_reassignvp function that disassociates a vnode from its
original device, and reassociates it with the specified dev_t. to be
used by cloning devices only, in case a new minor is allocated.
* change all direct references in drivers to v_devcookie and v_rdev
to vdev_privdata(vp) and vdev_rdev(vp). for diagnostic purposes
when debugging race conditions that still exist wrt. locking and
revoking vnodes.
* make the locking state of a vnode consistent when passed to
d_open and d_close (unlocked). locked would be better, but has
some deadlock issues
 1.110.2.4 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.110.2.3 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.110.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.110.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.114.4.2 15-Jul-2002  gehenna catch up with -current.
 1.114.4.1 16-May-2002  gehenna Get rid of iszerodev. Use the 'zerodev' (dev_t for /dev/zero).
 1.124.2.7 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.124.2.6 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.124.2.5 21-Nov-2004  skrll Adapt to branch.
 1.124.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.124.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.124.2.2 03-Aug-2004  skrll Sync with HEAD
 1.124.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.130.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.130.4.1 29-Apr-2005  kent sync with -current
 1.131.2.1 01-Oct-2005  tron Pull up following revision(s) (requested by christos in ticket #838):
sys/compat/svr4/svr4_misc.c: revision 1.112
sys/compat/ibcs2/ibcs2_misc.c: revision 1.74
sys/compat/linux/common/linux_misc.c: revision 1.136
sys/compat/irix/irix_dirent.c: revision 1.14
sys/compat/sunos/sunos_misc.c: revision 1.132
sys/compat/svr4_32/svr4_32_misc.c: revision 1.31
sys/compat/sunos32/sunos32_misc.c: revision 1.30
sys/compat/linux/common/linux_file64.c: revision 1.26
PR/29696: Joel Carnat: NetBSD freezes when accessing smbfs mounted FS with
firefox/linux due to compat getdents() call assumption that all filesystems
support cookies.
 1.132.2.8 24-Mar-2008  yamt sync with head.
 1.132.2.7 21-Jan-2008  yamt sync with head
 1.132.2.6 07-Dec-2007  yamt sync with head
 1.132.2.5 27-Oct-2007  yamt sync with head.
 1.132.2.4 03-Sep-2007  yamt sync with head.
 1.132.2.3 26-Feb-2007  yamt sync with head.
 1.132.2.2 30-Dec-2006  yamt sync with head.
 1.132.2.1 21-Jun-2006  yamt sync with head.
 1.135.6.2 01-Jun-2006  kardel Sync with head.
 1.135.6.1 22-Apr-2006  simonb Sync with head.
 1.135.4.1 09-Sep-2006  rpaulo sync with head
 1.135.2.1 18-Feb-2006  yamt adapt the rest of MI code.
 1.136.6.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.136.4.2 10-Mar-2006  elad generic_authorize() -> kauth_authorize_generic().
 1.136.4.1 08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.136.2.3 03-Sep-2006  yamt sync with head.
 1.136.2.2 11-Aug-2006  yamt sync with head
 1.136.2.1 24-May-2006  yamt sync with head.
 1.138.4.1 13-Jul-2006  gdamore Merge from HEAD.
 1.142.4.1 10-Dec-2006  yamt sync with head.
 1.142.2.3 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.142.2.2 12-Jan-2007  ad sparc MD changes.
 1.142.2.1 18-Nov-2006  ad Sync with head.
 1.143.2.1 12-Jun-2010  riz Pull up following revision(s) (requested by he in ticket #1387):
sys/compat/svr4/svr4_misc.c: revision 1.149
sys/compat/linux/common/linux_misc.c: revision 1.214
sys/compat/common/vfs_syscalls_30.c: revision 1.31
sys/compat/sunos/sunos_misc.c: revision 1.166
sys/compat/linux/common/linux_file64.c: revision 1.50
sys/compat/svr4_32/svr4_32_misc.c: revision 1.68
sys/compat/ibcs2/ibcs2_misc.c: revision 1.110
sys/compat/linux32/common/linux32_dirent.c: revision 1.10
sys/compat/sunos32/sunos32_misc.c: revision 1.69
sys/compat/irix/irix_dirent.c: revision 1.24
sys/compat/osf1/osf1_file.c: revision 1.38
When implementing "read directory", when there are too many empty entries
in a row, and we need to try to read the next block, and have passed a
non-NULL cookie pointer to VOP_READDIR, ensure that we free the cookie
buffer before re-doing VOP_READDIR, so that we don't leak memory.
This fix is similar to nfs_serv.c revisions 1.115 + 1.124.
This should fix the long-standing problem observed by e.g. using Linux-
emulated programs to take backup of servers, which is one of the problems
which were reported in PR#42661.
Thanks to pooka@ for the hints for traversing the VOP* layer.
 1.144.2.3 17-May-2007  yamt sync with head.
 1.144.2.2 07-May-2007  yamt sync with head.
 1.144.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.146.4.1 11-Jul-2007  mjf Sync with head.
 1.146.2.4 09-Oct-2007  ad Sync with head.
 1.146.2.3 20-Aug-2007  ad Sync with HEAD.
 1.146.2.2 15-Jul-2007  ad Sync with head.
 1.146.2.1 27-May-2007  ad Sync with head.
 1.151.10.1 14-Oct-2007  yamt sync with head.
 1.151.8.2 09-Jan-2008  matt sync with HEAD
 1.151.8.1 06-Nov-2007  matt sync with HEAD
 1.151.6.3 09-Dec-2007  jmcneill Sync with HEAD.
 1.151.6.2 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.151.6.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.152.4.3 18-Feb-2008  mjf Sync with HEAD.
 1.152.4.2 27-Dec-2007  mjf Sync with HEAD.
 1.152.4.1 08-Dec-2007  mjf Sync with HEAD.
 1.153.2.2 26-Dec-2007  ad Sync with head.
 1.153.2.1 08-Dec-2007  ad Sync with head.
 1.156.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.158.6.4 17-Jan-2009  mjf Sync with HEAD.
 1.158.6.3 28-Sep-2008  mjf Sync with HEAD.
 1.158.6.2 29-Jun-2008  mjf Sync with HEAD.
 1.158.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.159.8.1 27-Jun-2008  simonb Sync with head.
 1.159.6.3 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.159.6.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.159.6.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.159.4.4 11-Aug-2010  yamt sync with head.
 1.159.4.3 11-Mar-2010  yamt sync with head
 1.159.4.2 18-Jul-2009  yamt sync with head.
 1.159.4.1 04-May-2009  yamt sync with head.
 1.160.2.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.160.2.1 19-Oct-2008  haad Sync with HEAD.
 1.161.8.1 21-Apr-2010  matt sync to netbsd-5
 1.161.4.1 17-Mar-2010  snj Pull up following revision(s) (requested by he in ticket #1323):
sys/compat/common/vfs_syscalls_30.c: revision 1.31
sys/compat/ibcs2/ibcs2_misc.c: revision 1.110
sys/compat/irix/irix_dirent.c: revision 1.24
sys/compat/linux/common/linux_file64.c: revision 1.50
sys/compat/linux/common/linux_misc.c: revision 1.214
sys/compat/linux32/common/linux32_dirent.c: revision 1.10
sys/compat/sunos/sunos_misc.c: revision 1.166
sys/compat/sunos32/sunos32_misc.c: revision 1.69
sys/compat/svr4/svr4_misc.c: revision 1.149
sys/compat/svr4_32/svr4_32_misc.c: revision 1.68
When implementing "read directory", when there are too many empty entries
in a row, and we need to try to read the next block, and have passed a
non-NULL cookie pointer to VOP_READDIR, ensure that we free the cookie
buffer before re-doing VOP_READDIR, so that we don't leak memory.
This fix is similar to nfs_serv.c revisions 1.115 + 1.124.
This should fix the long-standing problem observed by e.g. using Linux-
emulated programs to take backup of servers, which is one of the problems
which were reported in PR#42661.
Thanks to pooka@ for the hints for traversing the VOP* layer.
 1.161.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.164.2.1 23-Jul-2009  jym Sync with HEAD.
 1.165.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.165.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.167.2.1 03-Jul-2010  rmind sync with head
 1.168.40.1 12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1479):
sys/compat/common/vfs_syscalls_12.c: revision 1.34
sys/rump/kern/lib/libsys_sunos/rump_sunos_compat.c: revision 1.2
sys/compat/svr4_32/svr4_32_misc.c: revision 1.78
sys/compat/sunos32/sunos32_misc.c: revision 1.78
sys/compat/linux/common/linux_misc.c: revision 1.239
sys/compat/osf1/osf1_file.c: revision 1.44
sys/compat/common/vfs_syscalls_43.c: revision 1.60
sys/compat/svr4/svr4_misc.c: revision 1.158
sys/compat/ibcs2/ibcs2_misc.c: revision 1.114
sys/compat/linux/common/linux_file64.c: revision 1.59
sys/compat/linux32/common/linux32_dirent.c: revision 1.18
sys/compat/sunos/sunos_misc.c: revision 1.171
Fail, don't panic, on bad dirents from file system.
Controllable via puffs from userland.
From Ilja Van Sprundel.
 1.168.36.1 12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1479):
sys/compat/common/vfs_syscalls_12.c: revision 1.34
sys/rump/kern/lib/libsys_sunos/rump_sunos_compat.c: revision 1.2
sys/compat/svr4_32/svr4_32_misc.c: revision 1.78
sys/compat/sunos32/sunos32_misc.c: revision 1.78
sys/compat/linux/common/linux_misc.c: revision 1.239
sys/compat/osf1/osf1_file.c: revision 1.44
sys/compat/common/vfs_syscalls_43.c: revision 1.60
sys/compat/svr4/svr4_misc.c: revision 1.158
sys/compat/ibcs2/ibcs2_misc.c: revision 1.114
sys/compat/linux/common/linux_file64.c: revision 1.59
sys/compat/linux32/common/linux32_dirent.c: revision 1.18
sys/compat/sunos/sunos_misc.c: revision 1.171
Fail, don't panic, on bad dirents from file system.
Controllable via puffs from userland.
From Ilja Van Sprundel.
 1.168.34.1 12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1479):
sys/compat/common/vfs_syscalls_12.c: revision 1.34
sys/rump/kern/lib/libsys_sunos/rump_sunos_compat.c: revision 1.2
sys/compat/svr4_32/svr4_32_misc.c: revision 1.78
sys/compat/sunos32/sunos32_misc.c: revision 1.78
sys/compat/linux/common/linux_misc.c: revision 1.239
sys/compat/osf1/osf1_file.c: revision 1.44
sys/compat/common/vfs_syscalls_43.c: revision 1.60
sys/compat/svr4/svr4_misc.c: revision 1.158
sys/compat/ibcs2/ibcs2_misc.c: revision 1.114
sys/compat/linux/common/linux_file64.c: revision 1.59
sys/compat/linux32/common/linux32_dirent.c: revision 1.18
sys/compat/sunos/sunos_misc.c: revision 1.171
Fail, don't panic, on bad dirents from file system.
Controllable via puffs from userland.
From Ilja Van Sprundel.
 1.168.28.1 19-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1483):
sys/compat/common/vfs_syscalls_12.c: revision 1.34
sys/compat/svr4_32/svr4_32_misc.c: revision 1.78
sys/compat/sunos32/sunos32_misc.c: revision 1.78
sys/compat/linux/common/linux_misc.c: revision 1.239
sys/compat/osf1/osf1_file.c: revision 1.44
sys/compat/common/vfs_syscalls_43.c: revision 1.60
sys/compat/svr4/svr4_misc.c: revision 1.158
sys/compat/ibcs2/ibcs2_misc.c: revision 1.114
sys/compat/linux/common/linux_file64.c: revision 1.59
sys/compat/linux32/common/linux32_dirent.c: revision 1.18
sys/compat/sunos/sunos_misc.c: revision 1.171
Fail, don't panic, on bad dirents from file system.
Controllable via puffs from userland.
From Ilja Van Sprundel.
 1.168.20.1 19-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1483):
sys/compat/common/vfs_syscalls_12.c: revision 1.34
sys/compat/svr4_32/svr4_32_misc.c: revision 1.78
sys/compat/sunos32/sunos32_misc.c: revision 1.78
sys/compat/linux/common/linux_misc.c: revision 1.239
sys/compat/osf1/osf1_file.c: revision 1.44
sys/compat/common/vfs_syscalls_43.c: revision 1.60
sys/compat/svr4/svr4_misc.c: revision 1.158
sys/compat/ibcs2/ibcs2_misc.c: revision 1.114
sys/compat/linux/common/linux_file64.c: revision 1.59
sys/compat/linux32/common/linux32_dirent.c: revision 1.18
sys/compat/sunos/sunos_misc.c: revision 1.171
Fail, don't panic, on bad dirents from file system.
Controllable via puffs from userland.
From Ilja Van Sprundel.
 1.168.18.1 03-Dec-2017  jdolecek update from HEAD
 1.168.14.1 19-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1483):
sys/compat/common/vfs_syscalls_12.c: revision 1.34
sys/compat/svr4_32/svr4_32_misc.c: revision 1.78
sys/compat/sunos32/sunos32_misc.c: revision 1.78
sys/compat/linux/common/linux_misc.c: revision 1.239
sys/compat/osf1/osf1_file.c: revision 1.44
sys/compat/common/vfs_syscalls_43.c: revision 1.60
sys/compat/svr4/svr4_misc.c: revision 1.158
sys/compat/ibcs2/ibcs2_misc.c: revision 1.114
sys/compat/linux/common/linux_file64.c: revision 1.59
sys/compat/linux32/common/linux32_dirent.c: revision 1.18
sys/compat/sunos/sunos_misc.c: revision 1.171
Fail, don't panic, on bad dirents from file system.
Controllable via puffs from userland.
From Ilja Van Sprundel.
 1.169.2.2 28-Aug-2017  skrll Sync with HEAD
 1.169.2.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.170.10.2 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1836):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.170.10.1 09-Aug-2017  snj Pull up following revision(s) (requested by spz in ticket #193):
sys/compat/common/vfs_syscalls_12.c: revision 1.34
sys/rump/kern/lib/libsys_sunos/rump_sunos_compat.c: revision 1.2
sys/compat/svr4_32/svr4_32_misc.c: revision 1.78
sys/compat/sunos32/sunos32_misc.c: revision 1.78
sys/compat/linux/common/linux_misc.c: revision 1.239
sys/compat/osf1/osf1_file.c: revision 1.44
sys/compat/common/vfs_syscalls_43.c: revision 1.60
sys/compat/svr4/svr4_misc.c: revision 1.158
sys/compat/ibcs2/ibcs2_misc.c: revision 1.114
sys/compat/linux/common/linux_file64.c: revision 1.59
sys/compat/linux32/common/linux32_dirent.c: revision 1.18
sys/compat/sunos/sunos_misc.c: revision 1.171
Fail, don't panic, on bad dirents from file system.
Controllable via puffs from userland.
From Ilja Van Sprundel.
 1.171.4.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.171.4.1 10-Jun-2019  christos Sync with HEAD
 1.171.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.173.2.1 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.7 12-Dec-2019  pgoyette Rather than keeping a separate mutex, condvar, and pserialize for each
module hook, we can share a common set of synchronization structures.
This cuts the amount of cacheline_aligned data for these structures by
50%.

Note that we still have a per-hook localcount, since we need to count
individual references.

As discussed with riastradh@

Welcome to 9.99.22 !
 1.6 01-Mar-2019  pgoyette Rename the MODULE_*_HOOK() macros to MODULE_HOOK_*() as briefly
discussed on irc.

NFCI intended.

Ride the earlier kernel bump - it;s getting crowded.
 1.5 05-Feb-2019  pgoyette The sunos and sunos32 modules require compat_09, not compat (the
latter no longer exists).

Should fix "missing prerequisite" errors seen during qemu boot
of sparc64's MODULAR kernel.
 1.4 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.3 07-Mar-2014  christos branches: 1.3.28; 1.3.30;
c99 initializers for struct execsw
 1.2 19-Sep-2013  christos exec modules need to be of the exec kind
 1.1 19-Nov-2008  ad branches: 1.1.4; 1.1.6; 1.1.8; 1.1.12; 1.1.24; 1.1.34; 1.1.38;
Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.1.38.1 18-May-2014  rmind sync with head
 1.1.34.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.24.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.1.12.2 04-May-2009  yamt sync with head.
 1.1.12.1 19-Nov-2008  yamt file sunos_mod.c was added on branch yamt-nfs-mp on 2009-05-04 08:12:27 +0000
 1.1.8.2 19-Jan-2009  skrll Sync with HEAD.
 1.1.8.1 19-Nov-2008  skrll file sunos_mod.c was added on branch nick-hppapmap on 2009-01-19 13:17:40 +0000
 1.1.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.1.6.1 19-Nov-2008  mjf file sunos_mod.c was added on branch mjf-devfs2 on 2009-01-17 13:28:48 +0000
 1.1.4.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.1.4.1 19-Nov-2008  haad file sunos_mod.c was added on branch haad-dm on 2008-12-13 01:14:04 +0000
 1.3.30.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.3.30.1 10-Jun-2019  christos Sync with HEAD
 1.3.28.3 23-Jan-2019  pgoyette Convert the macros for setting and unsetting a hook to generate
in-line code rather than using an intermediary hook##set routine.
Hooks are set and unset only in one place, so the intermediary
routine provides no benefit. IMHO using the macro at the point-
of-call is more readable than using it elsewhere in the code and
then calling the generated intermediary routine (for which you
won't even find its declaration or definition unless you remember
to search for the HOOK_SET macro instead).

NFC intended, will verify with a bulk build and an atf test run.
 1.3.28.2 18-Oct-2018  pgoyette Add a few more references to the (currently always but not forever)
built-in compat_util module
 1.3.28.1 02-Oct-2018  pgoyette Use a hook callback to allow sparc fpu code to determine if a process
is running under sunos emulation (in which case, fpu cleanup uses a
different set of fpu_codes[]).
 1.99 11-Jun-2020  dholland Regen after -r1.82 of compat_sunos syscalls.master last September.

(Apparently forgotten.)

"Treat valsize as unsigned"
 1.98 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.97 10-Aug-2018  pgoyette Regen
 1.96 06-Jan-2018  kamil branches: 1.96.2; 1.96.4;
Revert vadvise(2) removal

This system call was used in legacy Lisp code, that was inherited to modern
age and still compiled against supported compat layers (e.g. in clisp,
oaklisp, Franz Lisp).

It used to instruct the kernel about paging policy (G/C aware, flush etc).

Newly compiled code (assuming that it will detect vadvise()) will use the
libc stub for vadvise(). The headers for this interface are gone.

vadvise(2) could be marked as COMPAT_80, but as long as we support ultrix,
sunos or aout68k ABI, don't bother with this.

Requested by <mrg>
 1.95 19-Dec-2017  kamil compat/sunos: Drop SYS_vadvise

The (o)vadvise syscall is dummy since the beginning of NetBSD.

Sponsored by <The NetBSD Foundation>
 1.94 19-Dec-2017  kamil compat/sunos: Drop SYS_sbrk

sbrk - change data segment size

This syscall is dummy since the inception of the project.

Sponsored by <The NetBSD Foundation>
 1.93 19-Dec-2017  kamil compat sunos: Drop the sstk(2) syscall

sstk(2) has never been implemented by the NetBSD kernel.

Sponsored by <The NetBSD Foundation>
 1.92 10-May-2017  riastradh regen
 1.91 16-Jan-2017  christos branches: 1.91.4;
regen
 1.90 13-Jan-2017  christos branches: 1.90.2;
regen
 1.89 24-Sep-2015  christos branches: 1.89.2;
regen
 1.88 07-Mar-2015  christos regen
 1.87 07-Nov-2013  njoly branches: 1.87.6;
Regen for dup/dup2/dup3 argument types fix.
 1.86 03-Mar-2010  pooka branches: 1.86.10; 1.86.20; 1.86.24;
regen: ENOSYS nfssvc honestly
 1.85 14-Dec-2009  matt branches: 1.85.2;
Regen (new makesyscalls.sh)
 1.84 13-Jan-2009  pooka Regen to prove I didn't screw up the conversion: purely RCSID changes.
 1.83 13-Jan-2009  pooka regen: unimpl police
 1.82 11-Jan-2009  tsutsui Regen from syscalls.master rev 1.72:
> Update for compat_50 stuff. (compile test only)
 1.81 19-Nov-2008  ad Regen.
 1.80 21-Jun-2008  tsutsui branches: 1.80.2; 1.80.4;
Regen from syscalls.master rev 1.69:
> Include <sys/sched.h> before <sys/syscallargs.h> for cpuset_t.
 1.79 27-Dec-2007  martin branches: 1.79.6; 1.79.10; 1.79.12; 1.79.14;
Remove now superflous (and wrong) extern declaration for maxfiles.
 1.78 20-Dec-2007  dsl regen
 1.77 04-Mar-2007  christos branches: 1.77.16; 1.77.22; 1.77.24; 1.77.28;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.76 01-Sep-2006  matt branches: 1.76.8;
Regen.
 1.75 30-Aug-2006  he Regen (for PTRACE).
 1.74 13-Jul-2006  pavel regen
 1.73 11-Dec-2005  christos branches: 1.73.4; 1.73.8;
merge ktrace-lwp.
 1.72 26-Feb-2005  perry branches: 1.72.4;
regen
 1.71 26-Feb-2005  perry regen
 1.70 18-Jan-2003  thorpej branches: 1.70.2; 1.70.10; 1.70.12;
Regen for correct RCS ID.
 1.69 18-Jan-2003  thorpej Regen: Merge the nathanw_sa branch.
 1.68 01-Nov-2002  jdolecek set nsysent to 256
 1.67 03-Jan-2002  mrg move the COMPAT_SUNOS SO_BROADCAST hack out of uipc_socket.c into the
compat/sunos code. besides being cleaner this allows the sunos LKM
to properly work without any special kernel hacks.
 1.66 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.65 30-May-2001  mrg branches: 1.65.2;
use _KERNEL_OPT.
 1.64 27-Jan-2001  thorpej branches: 1.64.2;
Regen; add sy_flags.
 1.63 09-Dec-2000  mycroft Regen.
 1.62 09-Dec-2000  mycroft Regen.
 1.61 18-Aug-2000  cgd update for changed makesyscalls.master
 1.60 09-Apr-2000  mrg regen
 1.59 12-Jul-1999  kleink branches: 1.59.2;
Regen.
 1.58 22-Mar-1999  sommerfe branches: 1.58.4;
Use regular system fchroot, now that we have it.
 1.57 09-Feb-1999  christos Regen
 1.56 18-Dec-1998  drochner regen
 1.55 10-Dec-1998  christos Regen
 1.54 19-Oct-1998  tron Regen.
 1.53 13-Sep-1998  pk regen.
 1.52 25-Jun-1998  thorpej Regen: defopt NFSSERVER
 1.51 19-Feb-1998  thorpej Regen: makesyscalls.sh changed.
 1.50 19-Feb-1998  thorpej regen; syscalls.master and makesyscalls.sh changed.
 1.49 09-Jan-1998  thorpej Regen.
 1.48 08-Jan-1998  thorpej Regen: back out RCD ID related changes.
 1.47 05-Jan-1998  perry regened with RCSIDs in place
 1.46 19-Oct-1997  christos Regen.
 1.45 17-Oct-1997  christos Regen
 1.44 10-Oct-1997  fvdl Regen.
 1.43 13-Jun-1997  thorpej branches: 1.43.4;
Regen: Use compat_12_sys_swapon().
 1.42 12-Jun-1997  mrg bring mrg-vm-swap2 onto mainline.
 1.41 31-Jan-1997  thorpej branches: 1.41.6;
Syscalls.master chagned, regen. (NFSCLIENT -> NFS)
 1.40 13-Jan-1997  thorpej branches: 1.40.2;
Regen; makesyscalls.sh emits comments now.
 1.39 07-Sep-1996  mycroft Regen.
 1.38 07-Sep-1996  mycroft Regen.
 1.37 30-Aug-1996  christos regen syscall tables
 1.36 26-Aug-1996  thorpej Regen; syscalls.master changed.
 1.35 23-Jun-1996  mycroft Regen.
 1.34 05-May-1996  veego branches: 1.34.4;
Added a missing Makefile and run it
Moved the prototyp for sunos_sendsig in an #ifndef sparc
 1.33 07-Oct-1995  mycroft Reran makesyscalls.sh.
 1.32 19-Sep-1995  thorpej makesyscalls.sh changed.
 1.31 05-Jul-1995  pk Start using sunos_sigvec().
 1.30 25-Jun-1995  briggs Oops... NOARGS for compat_43_sigvec.
 1.29 25-Jun-1995  briggs syscalls.master changed.
 1.28 24-Jun-1995  christos Syscalls.master was changed
 1.27 11-Jun-1995  pk Go with the flow; use `/emul/sunos' pseudo-root (from Matthew Green).
Note: sunos_stat() and sunos_lstat() were added too.
 1.26 22-Apr-1995  christos syscalls.master was changed
 1.25 22-Apr-1995  christos - added struct emul to all emulations.
- removed all setup functions.
- added copyargs() functions where needed.
 1.24 06-Dec-1994  deraadt update
 1.23 26-Nov-1994  deraadt update
 1.22 20-Nov-1994  deraadt new syscalls
 1.21 14-Nov-1994  deraadt syscalls.master changed
 1.20 26-Oct-1994  deraadt update
 1.19 25-Oct-1994  deraadt and we update these
 1.18 25-Oct-1994  deraadt rename, new syscall interface, etc.
 1.17 30-Jun-1994  cgd fix a botch, and gen syscall files
 1.16 14-Jun-1994  chopps update to match recent getdtablesize() change
 1.15 07-May-1994  deraadt follow
 1.14 01-May-1994  cgd sun syscalls.master update
 1.13 26-Apr-1994  pk SunOS's RLIMIT_NOFILE is different: add sun_[gs]rlimit().
 1.12 04-Apr-1994  deraadt nice unique SUN_SYS_ names..
 1.11 27-Mar-1994  cgd expand uid_t/gid_t/off_t
 1.10 03-Mar-1994  deraadt update to syscall.master (for sysconf)
 1.9 12-Dec-1993  deraadt update to latest syscalls.master
 1.8 22-Nov-1993  deraadt branches: 1.8.2;
moved from arch/sparc/sunos to compat/sunos
 1.7 20-Nov-1993  deraadt update to new syscalls.master
 1.6 14-Nov-1993  deraadt update to latest syscalls.master
 1.5 10-Nov-1993  deraadt update from new syscalls.master
 1.4 15-Oct-1993  deraadt rebuilt from syscall.master: {get,set}domainname change
 1.3 13-Oct-1993  deraadt rebuild files from syscalls.master
 1.2 11-Oct-1993  deraadt various changes, suffice to say that 4.4 syscalls do not look like ours
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.8.2.5 01-Dec-1993  deraadt update with new sun_mknod
 1.8.2.4 27-Nov-1993  deraadt update (as always)
 1.8.2.3 27-Nov-1993  deraadt update
 1.8.2.2 27-Nov-1993  deraadt update..
 1.8.2.1 26-Nov-1993  deraadt update to syscalls.master
 1.34.4.1 10-Dec-1996  mycroft Regen.
 1.40.2.1 14-Jan-1997  thorpej syscalls.master changed; regen.
 1.41.6.1 01-Jun-1997  mrg regen.
 1.43.4.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.58.4.1 02-Aug-1999  thorpej Regen.
 1.59.2.2 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.59.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.64.2.6 11-Nov-2002  nathanw Catch up to -current
 1.64.2.5 29-May-2002  nathanw Regen.
 1.64.2.4 28-Feb-2002  nathanw Catch up to -current.
 1.64.2.3 15-Nov-2001  pk Regenerate.
 1.64.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.64.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.65.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.70.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.70.10.1 29-Apr-2005  kent sync with -current
 1.70.2.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.72.4.3 21-Jan-2008  yamt sync with head
 1.72.4.2 03-Sep-2007  yamt sync with head.
 1.72.4.1 30-Dec-2006  yamt sync with head.
 1.73.8.2 03-Sep-2006  yamt sync with head.
 1.73.8.1 11-Aug-2006  yamt sync with head
 1.73.4.1 09-Sep-2006  rpaulo sync with head
 1.76.8.1 12-Mar-2007  rmind Sync with HEAD.
 1.77.28.1 02-Jan-2008  bouyer Sync with HEAD
 1.77.24.1 26-Dec-2007  ad Sync with head.
 1.77.22.1 18-Feb-2008  mjf Sync with HEAD.
 1.77.16.1 09-Jan-2008  matt sync with HEAD
 1.79.14.1 27-Jun-2008  simonb Sync with head.
 1.79.12.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.79.10.2 11-Mar-2010  yamt sync with head
 1.79.10.1 04-May-2009  yamt sync with head.
 1.79.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.79.6.1 29-Jun-2008  mjf Sync with HEAD.
 1.80.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.80.2.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.85.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.86.24.1 18-May-2014  rmind sync with head
 1.86.20.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.86.10.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.87.6.1 06-Apr-2015  skrll Sync with HEAD
 1.89.2.1 20-Mar-2017  pgoyette Sync with HEAD
 1.90.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.91.4.1 11-May-2017  pgoyette Sync with HEAD
 1.96.4.1 10-Jun-2019  christos Sync with HEAD
 1.96.2.3 29-Sep-2018  pgoyette Regen
 1.96.2.2 29-Sep-2018  pgoyette Regen
 1.96.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.83 11-Jun-2020  dholland Regen after -r1.82 of compat_sunos syscalls.master last September.

(Apparently forgotten.)

"Treat valsize as unsigned"
 1.82 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.81 10-Aug-2018  pgoyette Regen
 1.80 06-Jan-2018  kamil branches: 1.80.2; 1.80.4;
Revert vadvise(2) removal

This system call was used in legacy Lisp code, that was inherited to modern
age and still compiled against supported compat layers (e.g. in clisp,
oaklisp, Franz Lisp).

It used to instruct the kernel about paging policy (G/C aware, flush etc).

Newly compiled code (assuming that it will detect vadvise()) will use the
libc stub for vadvise(). The headers for this interface are gone.

vadvise(2) could be marked as COMPAT_80, but as long as we support ultrix,
sunos or aout68k ABI, don't bother with this.

Requested by <mrg>
 1.79 19-Dec-2017  kamil compat/sunos: Drop SYS_vadvise

The (o)vadvise syscall is dummy since the beginning of NetBSD.

Sponsored by <The NetBSD Foundation>
 1.78 19-Dec-2017  kamil compat/sunos: Drop SYS_sbrk

sbrk - change data segment size

This syscall is dummy since the inception of the project.

Sponsored by <The NetBSD Foundation>
 1.77 19-Dec-2017  kamil compat sunos: Drop the sstk(2) syscall

sstk(2) has never been implemented by the NetBSD kernel.

Sponsored by <The NetBSD Foundation>
 1.76 10-May-2017  riastradh regen
 1.75 16-Jan-2017  christos branches: 1.75.4;
regen
 1.74 13-Jan-2017  christos branches: 1.74.2;
regen
 1.73 24-Sep-2015  christos branches: 1.73.2;
regen
 1.72 07-Mar-2015  christos regen
 1.71 07-Nov-2013  njoly branches: 1.71.6;
Regen for dup/dup2/dup3 argument types fix.
 1.70 03-Mar-2010  pooka branches: 1.70.10; 1.70.20; 1.70.24;
regen: ENOSYS nfssvc honestly
 1.69 14-Dec-2009  matt branches: 1.69.2;
Regen (new makesyscalls.sh)
 1.68 13-Jan-2009  pooka Regen to prove I didn't screw up the conversion: purely RCSID changes.
 1.67 13-Jan-2009  pooka regen: unimpl police
 1.66 11-Jan-2009  tsutsui Regen from syscalls.master rev 1.72:
> Update for compat_50 stuff. (compile test only)
 1.65 19-Nov-2008  ad Regen.
 1.64 21-Jun-2008  tsutsui branches: 1.64.2; 1.64.4;
Regen from syscalls.master rev 1.69:
> Include <sys/sched.h> before <sys/syscallargs.h> for cpuset_t.
 1.63 27-Dec-2007  martin branches: 1.63.6; 1.63.10; 1.63.12; 1.63.14;
Remove now superflous (and wrong) extern declaration for maxfiles.
 1.62 20-Dec-2007  dsl regen
 1.61 04-Mar-2007  christos branches: 1.61.16; 1.61.22; 1.61.24; 1.61.28;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.60 01-Sep-2006  matt branches: 1.60.8;
Regen.
 1.59 30-Aug-2006  he Regen (for PTRACE).
 1.58 13-Jul-2006  pavel regen
 1.57 11-Dec-2005  christos branches: 1.57.4; 1.57.8;
merge ktrace-lwp.
 1.56 26-Feb-2005  perry branches: 1.56.4;
regen
 1.55 26-Feb-2005  perry regen
 1.54 18-Jan-2003  thorpej branches: 1.54.2; 1.54.10; 1.54.12;
Regen for correct RCS ID.
 1.53 18-Jan-2003  thorpej Regen: Merge the nathanw_sa branch.
 1.52 03-Jan-2002  mrg move the COMPAT_SUNOS SO_BROADCAST hack out of uipc_socket.c into the
compat/sunos code. besides being cleaner this allows the sunos LKM
to properly work without any special kernel hacks.
 1.51 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.50 30-May-2001  mrg branches: 1.50.2;
use _KERNEL_OPT.
 1.49 27-Jan-2001  thorpej branches: 1.49.2;
Regen; add sy_flags.
 1.48 09-Dec-2000  mycroft Regen.
 1.47 09-Dec-2000  mycroft Regen.
 1.46 18-Aug-2000  cgd update for changed makesyscalls.master
 1.45 18-Aug-2000  cgd update for changed makesyscalls.sh
 1.44 09-Apr-2000  mrg regen
 1.43 12-Jul-1999  kleink branches: 1.43.2;
Regen.
 1.42 22-Mar-1999  sommerfe branches: 1.42.4;
Use regular system fchroot, now that we have it.
 1.41 09-Feb-1999  christos Regen
 1.40 18-Dec-1998  drochner regen
 1.39 10-Dec-1998  christos Regen
 1.38 19-Oct-1998  tron Regen.
 1.37 03-Oct-1998  eeh Fixup big-endian syscall args.
 1.36 13-Sep-1998  pk regen.
 1.35 25-Jun-1998  thorpej Regen: defopt NFSSERVER
 1.34 19-Feb-1998  thorpej Regen: makesyscalls.sh changed.
 1.33 19-Feb-1998  thorpej regen; syscalls.master and makesyscalls.sh changed.
 1.32 09-Jan-1998  thorpej Regen.
 1.31 08-Jan-1998  thorpej Regen: back out RCD ID related changes.
 1.30 05-Jan-1998  perry regened with RCSIDs in place
 1.29 19-Oct-1997  christos Regen.
 1.28 17-Oct-1997  christos Regen
 1.27 10-Oct-1997  fvdl Regen.
 1.26 13-Jun-1997  thorpej branches: 1.26.4;
Regen: Use compat_12_sys_swapon().
 1.25 12-Jun-1997  mrg bring mrg-vm-swap2 onto mainline.
 1.24 31-Jan-1997  thorpej branches: 1.24.2; 1.24.6;
Syscalls.master chagned, regen. (NFSCLIENT -> NFS)
 1.23 07-Sep-1996  mycroft branches: 1.23.2;
Regen.
 1.22 07-Sep-1996  mycroft Regen.
 1.21 30-Aug-1996  christos regen syscall tables
 1.20 26-Aug-1996  thorpej Regen; syscalls.master changed.
 1.19 23-Jun-1996  mycroft Regen.
 1.18 05-May-1996  veego branches: 1.18.4;
Added a missing Makefile and run it
Moved the prototyp for sunos_sendsig in an #ifndef sparc
 1.17 28-Feb-1996  pk syscalls.master changed.
 1.16 07-Oct-1995  mycroft Reran makesyscalls.sh.
 1.15 19-Sep-1995  thorpej makesyscalls.sh changed.
 1.14 05-Jul-1995  pk Start using sunos_sigvec().
 1.13 25-Jun-1995  briggs Oops... NOARGS for compat_43_sigvec.
 1.12 25-Jun-1995  briggs syscalls.master changed.
 1.11 24-Jun-1995  christos Syscalls.master was changed
 1.10 11-Jun-1995  pk Go with the flow; use `/emul/sunos' pseudo-root (from Matthew Green).
Note: sunos_stat() and sunos_lstat() were added too.
 1.9 22-Apr-1995  christos syscalls.master was changed
 1.8 22-Apr-1995  christos - added struct emul to all emulations.
- removed all setup functions.
- added copyargs() functions where needed.
 1.7 06-Dec-1994  deraadt update
 1.6 26-Nov-1994  deraadt update
 1.5 20-Nov-1994  deraadt new syscalls
 1.4 14-Nov-1994  deraadt syscalls.master changed
 1.3 26-Oct-1994  deraadt update
 1.2 25-Oct-1994  deraadt and we update these
 1.1 25-Oct-1994  deraadt and these
 1.18.4.1 10-Dec-1996  mycroft Regen.
 1.23.2.1 14-Jan-1997  thorpej syscalls.master changed; regen.
 1.24.6.1 01-Jun-1997  mrg regen.
 1.24.2.1 14-Feb-1997  mrg regen.
 1.26.4.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.42.4.1 02-Aug-1999  thorpej Regen.
 1.43.2.2 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.43.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.49.2.6 29-May-2002  nathanw Regen.
 1.49.2.5 28-Feb-2002  nathanw Catch up to -current.
 1.49.2.4 11-Jan-2002  nathanw More catchup.
 1.49.2.3 15-Nov-2001  pk Regenerate.
 1.49.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.49.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.50.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.54.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.54.10.1 29-Apr-2005  kent sync with -current
 1.54.2.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.56.4.3 21-Jan-2008  yamt sync with head
 1.56.4.2 03-Sep-2007  yamt sync with head.
 1.56.4.1 30-Dec-2006  yamt sync with head.
 1.57.8.2 03-Sep-2006  yamt sync with head.
 1.57.8.1 11-Aug-2006  yamt sync with head
 1.57.4.1 09-Sep-2006  rpaulo sync with head
 1.60.8.1 12-Mar-2007  rmind Sync with HEAD.
 1.61.28.1 02-Jan-2008  bouyer Sync with HEAD
 1.61.24.1 26-Dec-2007  ad Sync with head.
 1.61.22.1 18-Feb-2008  mjf Sync with HEAD.
 1.61.16.1 09-Jan-2008  matt sync with HEAD
 1.63.14.1 27-Jun-2008  simonb Sync with head.
 1.63.12.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.63.10.2 11-Mar-2010  yamt sync with head
 1.63.10.1 04-May-2009  yamt sync with head.
 1.63.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.63.6.1 29-Jun-2008  mjf Sync with HEAD.
 1.64.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.64.2.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.69.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.70.24.1 18-May-2014  rmind sync with head
 1.70.20.2 03-Dec-2017  jdolecek update from HEAD
 1.70.20.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.70.10.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.71.6.2 28-Aug-2017  skrll Sync with HEAD
 1.71.6.1 06-Apr-2015  skrll Sync with HEAD
 1.73.2.1 20-Mar-2017  pgoyette Sync with HEAD
 1.74.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.75.4.1 11-May-2017  pgoyette Sync with HEAD
 1.80.4.1 10-Jun-2019  christos Sync with HEAD
 1.80.2.3 29-Sep-2018  pgoyette Regen
 1.80.2.2 29-Sep-2018  pgoyette Regen
 1.80.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.98 11-Jun-2020  dholland Regen after -r1.82 of compat_sunos syscalls.master last September.

(Apparently forgotten.)

"Treat valsize as unsigned"
 1.97 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.96 10-Aug-2018  pgoyette Regen
 1.95 06-Jan-2018  kamil branches: 1.95.2; 1.95.4;
Revert vadvise(2) removal

This system call was used in legacy Lisp code, that was inherited to modern
age and still compiled against supported compat layers (e.g. in clisp,
oaklisp, Franz Lisp).

It used to instruct the kernel about paging policy (G/C aware, flush etc).

Newly compiled code (assuming that it will detect vadvise()) will use the
libc stub for vadvise(). The headers for this interface are gone.

vadvise(2) could be marked as COMPAT_80, but as long as we support ultrix,
sunos or aout68k ABI, don't bother with this.

Requested by <mrg>
 1.94 19-Dec-2017  kamil compat/sunos: Drop SYS_vadvise

The (o)vadvise syscall is dummy since the beginning of NetBSD.

Sponsored by <The NetBSD Foundation>
 1.93 19-Dec-2017  kamil compat/sunos: Drop SYS_sbrk

sbrk - change data segment size

This syscall is dummy since the inception of the project.

Sponsored by <The NetBSD Foundation>
 1.92 19-Dec-2017  kamil compat sunos: Drop the sstk(2) syscall

sstk(2) has never been implemented by the NetBSD kernel.

Sponsored by <The NetBSD Foundation>
 1.91 10-May-2017  riastradh regen
 1.90 16-Jan-2017  christos branches: 1.90.4;
regen
 1.89 13-Jan-2017  christos branches: 1.89.2;
regen
 1.88 24-Sep-2015  christos branches: 1.88.2;
regen
 1.87 07-Mar-2015  christos regen
 1.86 07-Nov-2013  njoly branches: 1.86.6;
Regen for dup/dup2/dup3 argument types fix.
 1.85 03-Mar-2010  pooka branches: 1.85.10; 1.85.20; 1.85.24;
regen: ENOSYS nfssvc honestly
 1.84 14-Dec-2009  matt branches: 1.84.2;
Regen (new makesyscalls.sh)
 1.83 13-Jan-2009  pooka Regen to prove I didn't screw up the conversion: purely RCSID changes.
 1.82 13-Jan-2009  pooka regen: unimpl police
 1.81 11-Jan-2009  tsutsui Regen from syscalls.master rev 1.72:
> Update for compat_50 stuff. (compile test only)
 1.80 19-Nov-2008  ad Regen.
 1.79 21-Jun-2008  tsutsui branches: 1.79.2; 1.79.4;
Regen from syscalls.master rev 1.69:
> Include <sys/sched.h> before <sys/syscallargs.h> for cpuset_t.
 1.78 27-Dec-2007  martin branches: 1.78.6; 1.78.10; 1.78.12; 1.78.14;
Remove now superflous (and wrong) extern declaration for maxfiles.
 1.77 20-Dec-2007  dsl regen
 1.76 09-Feb-2007  ad branches: 1.76.20; 1.76.26; 1.76.28; 1.76.32;
Merge newlock2 to head.
 1.75 01-Sep-2006  matt branches: 1.75.2;
Regen.
 1.74 30-Aug-2006  he Regen (for PTRACE).
 1.73 13-Jul-2006  pavel regen
 1.72 11-Dec-2005  christos branches: 1.72.4; 1.72.8;
merge ktrace-lwp.
 1.71 26-Feb-2005  perry branches: 1.71.4;
regen
 1.70 26-Feb-2005  perry regen
 1.69 18-Jan-2003  thorpej branches: 1.69.2; 1.69.10; 1.69.12;
Regen for correct RCS ID.
 1.68 18-Jan-2003  thorpej Regen: Merge the nathanw_sa branch.
 1.67 03-Jan-2002  mrg move the COMPAT_SUNOS SO_BROADCAST hack out of uipc_socket.c into the
compat/sunos code. besides being cleaner this allows the sunos LKM
to properly work without any special kernel hacks.
 1.66 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.65 30-May-2001  mrg branches: 1.65.2;
use _KERNEL_OPT.
 1.64 27-Jan-2001  thorpej branches: 1.64.2;
Regen; add sy_flags.
 1.63 09-Dec-2000  mycroft Regen.
 1.62 09-Dec-2000  mycroft Regen.
 1.61 13-Nov-2000  jdolecek change the type of *syscallnames[] array to 'const char * const foo[]'
 1.60 18-Aug-2000  cgd update for changed makesyscalls.master
 1.59 09-Apr-2000  mrg regen
 1.58 12-Jul-1999  kleink branches: 1.58.2;
Regen.
 1.57 22-Mar-1999  sommerfe branches: 1.57.4;
Use regular system fchroot, now that we have it.
 1.56 09-Feb-1999  christos Regen
 1.55 18-Dec-1998  drochner regen
 1.54 10-Dec-1998  christos Regen
 1.53 19-Oct-1998  tron Regen.
 1.52 13-Sep-1998  pk regen.
 1.51 25-Jun-1998  thorpej Regen: defopt NFSSERVER
 1.50 19-Feb-1998  thorpej Regen: makesyscalls.sh changed.
 1.49 19-Feb-1998  thorpej regen; syscalls.master and makesyscalls.sh changed.
 1.48 09-Jan-1998  thorpej Regen.
 1.47 08-Jan-1998  thorpej Regen: back out RCD ID related changes.
 1.46 05-Jan-1998  perry regened with RCSIDs in place
 1.45 19-Oct-1997  christos Regen.
 1.44 17-Oct-1997  christos Regen
 1.43 10-Oct-1997  fvdl Regen.
 1.42 13-Jun-1997  thorpej branches: 1.42.4;
Regen: Use compat_12_sys_swapon().
 1.41 12-Jun-1997  mrg bring mrg-vm-swap2 onto mainline.
 1.40 31-Jan-1997  thorpej branches: 1.40.6;
Syscalls.master chagned, regen. (NFSCLIENT -> NFS)
 1.39 07-Sep-1996  mycroft branches: 1.39.2;
Regen.
 1.38 07-Sep-1996  mycroft Regen.
 1.37 30-Aug-1996  christos regen syscall tables
 1.36 26-Aug-1996  thorpej Regen; syscalls.master changed.
 1.35 23-Jun-1996  mycroft Regen.
 1.34 05-May-1996  veego branches: 1.34.4;
Added a missing Makefile and run it
Moved the prototyp for sunos_sendsig in an #ifndef sparc
 1.33 07-Oct-1995  mycroft Reran makesyscalls.sh.
 1.32 19-Sep-1995  thorpej makesyscalls.sh changed.
 1.31 05-Jul-1995  pk Start using sunos_sigvec().
 1.30 25-Jun-1995  briggs Oops... NOARGS for compat_43_sigvec.
 1.29 25-Jun-1995  briggs syscalls.master changed.
 1.28 24-Jun-1995  christos Syscalls.master was changed
 1.27 11-Jun-1995  pk Go with the flow; use `/emul/sunos' pseudo-root (from Matthew Green).
Note: sunos_stat() and sunos_lstat() were added too.
 1.26 22-Apr-1995  christos syscalls.master was changed
 1.25 22-Apr-1995  christos - added struct emul to all emulations.
- removed all setup functions.
- added copyargs() functions where needed.
 1.24 06-Dec-1994  deraadt update
 1.23 26-Nov-1994  deraadt update
 1.22 20-Nov-1994  deraadt new syscalls
 1.21 14-Nov-1994  deraadt syscalls.master changed
 1.20 26-Oct-1994  deraadt update
 1.19 25-Oct-1994  deraadt and we update these
 1.18 25-Oct-1994  deraadt rename, new syscall interface, etc.
 1.17 30-Jun-1994  cgd fix a botch, and gen syscall files
 1.16 14-Jun-1994  chopps update to match recent getdtablesize() change
 1.15 07-May-1994  deraadt follow
 1.14 01-May-1994  cgd sun syscalls.master update
 1.13 26-Apr-1994  pk SunOS's RLIMIT_NOFILE is different: add sun_[gs]rlimit().
 1.12 04-Apr-1994  deraadt nice unique SUN_SYS_ names..
 1.11 27-Mar-1994  cgd expand uid_t/gid_t/off_t
 1.10 03-Mar-1994  deraadt update to syscall.master (for sysconf)
 1.9 12-Dec-1993  deraadt update to latest syscalls.master
 1.8 22-Nov-1993  deraadt branches: 1.8.2;
moved from arch/sparc/sunos to compat/sunos
 1.7 20-Nov-1993  deraadt update to new syscalls.master
 1.6 14-Nov-1993  deraadt update to latest syscalls.master
 1.5 10-Nov-1993  deraadt update from new syscalls.master
 1.4 15-Oct-1993  deraadt rebuilt from syscall.master: {get,set}domainname change
 1.3 13-Oct-1993  deraadt rebuild files from syscalls.master
 1.2 11-Oct-1993  deraadt various changes, suffice to say that 4.4 syscalls do not look like ours
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.8.2.5 01-Dec-1993  deraadt update with new sun_mknod
 1.8.2.4 27-Nov-1993  deraadt update (as always)
 1.8.2.3 27-Nov-1993  deraadt update
 1.8.2.2 27-Nov-1993  deraadt update..
 1.8.2.1 26-Nov-1993  deraadt update to syscalls.master
 1.34.4.1 10-Dec-1996  mycroft Regen.
 1.39.2.1 14-Jan-1997  thorpej syscalls.master changed; regen.
 1.40.6.1 01-Jun-1997  mrg regen.
 1.42.4.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.57.4.1 02-Aug-1999  thorpej Regen.
 1.58.2.3 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.58.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.58.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.64.2.6 29-May-2002  nathanw Regen.
 1.64.2.5 28-Feb-2002  nathanw Catch up to -current.
 1.64.2.4 11-Jan-2002  nathanw More catchup.
 1.64.2.3 15-Nov-2001  pk Regenerate.
 1.64.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.64.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.65.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.69.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.69.10.1 29-Apr-2005  kent sync with -current
 1.69.2.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.71.4.3 21-Jan-2008  yamt sync with head
 1.71.4.2 26-Feb-2007  yamt sync with head.
 1.71.4.1 30-Dec-2006  yamt sync with head.
 1.72.8.2 03-Sep-2006  yamt sync with head.
 1.72.8.1 11-Aug-2006  yamt sync with head
 1.72.4.1 09-Sep-2006  rpaulo sync with head
 1.75.2.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.76.32.1 02-Jan-2008  bouyer Sync with HEAD
 1.76.28.1 26-Dec-2007  ad Sync with head.
 1.76.26.1 18-Feb-2008  mjf Sync with HEAD.
 1.76.20.1 09-Jan-2008  matt sync with HEAD
 1.78.14.1 27-Jun-2008  simonb Sync with head.
 1.78.12.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.78.10.2 11-Mar-2010  yamt sync with head
 1.78.10.1 04-May-2009  yamt sync with head.
 1.78.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.78.6.1 29-Jun-2008  mjf Sync with HEAD.
 1.79.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.79.2.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.84.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.85.24.1 18-May-2014  rmind sync with head
 1.85.20.2 03-Dec-2017  jdolecek update from HEAD
 1.85.20.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.85.10.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.86.6.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.86.6.1 06-Apr-2015  skrll Sync with HEAD
 1.88.2.1 20-Mar-2017  pgoyette Sync with HEAD
 1.89.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.90.4.1 11-May-2017  pgoyette Sync with HEAD
 1.95.4.1 10-Jun-2019  christos Sync with HEAD
 1.95.2.3 29-Sep-2018  pgoyette Regen
 1.95.2.2 29-Sep-2018  pgoyette Regen
 1.95.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.94 11-Jun-2020  dholland Regen after -r1.82 of compat_sunos syscalls.master last September.

(Apparently forgotten.)

"Treat valsize as unsigned"
 1.93 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.92 10-Aug-2018  pgoyette Regen
 1.91 06-Jan-2018  kamil branches: 1.91.2; 1.91.4;
Revert vadvise(2) removal

This system call was used in legacy Lisp code, that was inherited to modern
age and still compiled against supported compat layers (e.g. in clisp,
oaklisp, Franz Lisp).

It used to instruct the kernel about paging policy (G/C aware, flush etc).

Newly compiled code (assuming that it will detect vadvise()) will use the
libc stub for vadvise(). The headers for this interface are gone.

vadvise(2) could be marked as COMPAT_80, but as long as we support ultrix,
sunos or aout68k ABI, don't bother with this.

Requested by <mrg>
 1.90 19-Dec-2017  kamil compat/sunos: Drop SYS_vadvise

The (o)vadvise syscall is dummy since the beginning of NetBSD.

Sponsored by <The NetBSD Foundation>
 1.89 19-Dec-2017  kamil compat/sunos: Drop SYS_sbrk

sbrk - change data segment size

This syscall is dummy since the inception of the project.

Sponsored by <The NetBSD Foundation>
 1.88 19-Dec-2017  kamil compat sunos: Drop the sstk(2) syscall

sstk(2) has never been implemented by the NetBSD kernel.

Sponsored by <The NetBSD Foundation>
 1.87 10-May-2017  riastradh regen
 1.86 16-Jan-2017  christos branches: 1.86.4;
regen
 1.85 13-Jan-2017  christos branches: 1.85.2;
regen
 1.84 24-Sep-2015  christos branches: 1.84.2;
regen
 1.83 07-Mar-2015  christos regen
 1.82 07-Nov-2013  njoly branches: 1.82.6;
Regen for dup/dup2/dup3 argument types fix.
 1.81 03-Mar-2010  pooka branches: 1.81.10; 1.81.20; 1.81.24;
regen: ENOSYS nfssvc honestly
 1.80 14-Dec-2009  matt branches: 1.80.2;
Regen (new makesyscalls.sh)
 1.79 13-Jan-2009  pooka Regen to prove I didn't screw up the conversion: purely RCSID changes.
 1.78 13-Jan-2009  pooka regen: unimpl police
 1.77 11-Jan-2009  tsutsui Regen from syscalls.master rev 1.72:
> Update for compat_50 stuff. (compile test only)
 1.76 19-Nov-2008  ad Regen.
 1.75 21-Jun-2008  tsutsui branches: 1.75.2; 1.75.4;
Regen from syscalls.master rev 1.69:
> Include <sys/sched.h> before <sys/syscallargs.h> for cpuset_t.
 1.74 17-Jun-2008  tsutsui Include <sys/sched.h> before <sys/syscallargs.h> for cpuset_t.
 1.73 27-Dec-2007  martin branches: 1.73.6; 1.73.10; 1.73.12; 1.73.14;
Remove now superflous (and wrong) extern declaration for maxfiles.
 1.72 20-Dec-2007  dsl regen
 1.71 09-Feb-2007  ad branches: 1.71.20; 1.71.26; 1.71.28; 1.71.32;
Merge newlock2 to head.
 1.70 01-Sep-2006  matt branches: 1.70.2;
Regen.
 1.69 30-Aug-2006  he Regen (for PTRACE).
 1.68 13-Jul-2006  pavel regen
 1.67 13-Jul-2006  martin COMPAT_SUNOS* uses COMPAT_30 getfh too
 1.66 11-Dec-2005  christos branches: 1.66.4; 1.66.8;
merge ktrace-lwp.
 1.65 26-Feb-2005  perry branches: 1.65.4;
regen
 1.64 26-Feb-2005  perry regen
 1.63 18-Jan-2003  thorpej branches: 1.63.2; 1.63.10; 1.63.12;
Regen for correct RCS ID.
 1.62 18-Jan-2003  thorpej Regen: Merge the nathanw_sa branch.
 1.61 01-Nov-2002  jdolecek set nsysent to 256
 1.60 03-Jan-2002  mrg move the COMPAT_SUNOS SO_BROADCAST hack out of uipc_socket.c into the
compat/sunos code. besides being cleaner this allows the sunos LKM
to properly work without any special kernel hacks.
 1.59 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.58 30-May-2001  mrg branches: 1.58.2;
use _KERNEL_OPT.
 1.57 27-Jan-2001  thorpej branches: 1.57.2;
Regen; add sy_flags.
 1.56 09-Dec-2000  mycroft Regen.
 1.55 09-Dec-2000  mycroft Regen.
 1.54 30-Nov-2000  jdolecek LKMify
 1.53 18-Aug-2000  cgd update for changed makesyscalls.master
 1.52 09-Apr-2000  mrg regen
 1.51 12-Jul-1999  kleink branches: 1.51.2;
Regen.
 1.50 22-Mar-1999  sommerfe branches: 1.50.4;
Use regular system fchroot, now that we have it.
 1.49 09-Feb-1999  christos Regen
 1.48 18-Dec-1998  drochner regen
 1.47 10-Dec-1998  christos Regen
 1.46 19-Oct-1998  tron Regen.
 1.45 13-Sep-1998  pk regen.
 1.44 25-Jun-1998  thorpej Regen: defopt NFSSERVER
 1.43 19-Feb-1998  thorpej Regen: makesyscalls.sh changed.
 1.42 19-Feb-1998  thorpej regen; syscalls.master and makesyscalls.sh changed.
 1.41 09-Jan-1998  thorpej Regen.
 1.40 08-Jan-1998  thorpej Regen: back out RCD ID related changes.
 1.39 05-Jan-1998  perry regened with RCSIDs in place
 1.38 19-Oct-1997  christos Regen.
 1.37 17-Oct-1997  christos Regen
 1.36 10-Oct-1997  fvdl Regen.
 1.35 13-Jun-1997  thorpej branches: 1.35.4;
Regen: Use compat_12_sys_swapon().
 1.34 12-Jun-1997  mrg bring mrg-vm-swap2 onto mainline.
 1.33 31-Jan-1997  thorpej branches: 1.33.2; 1.33.6;
Syscalls.master chagned, regen. (NFSCLIENT -> NFS)
 1.32 07-Sep-1996  mycroft branches: 1.32.2;
Regen.
 1.31 07-Sep-1996  mycroft Regen.
 1.30 30-Aug-1996  christos regen syscall tables
 1.29 26-Aug-1996  thorpej Regen; syscalls.master changed.
 1.28 23-Jun-1996  mycroft Regen.
 1.27 05-May-1996  veego branches: 1.27.4;
Added a missing Makefile and run it
Moved the prototyp for sunos_sendsig in an #ifndef sparc
 1.26 28-Feb-1996  pk syscalls.master changed.
 1.25 07-Oct-1995  mycroft Reran makesyscalls.sh.
 1.24 19-Sep-1995  thorpej makesyscalls.sh changed.
 1.23 05-Jul-1995  pk Start using sunos_sigvec().
 1.22 25-Jun-1995  briggs Oops... NOARGS for compat_43_sigvec.
 1.21 25-Jun-1995  briggs syscalls.master changed.
 1.20 24-Jun-1995  christos Syscalls.master was changed
 1.19 11-Jun-1995  pk Go with the flow; use `/emul/sunos' pseudo-root (from Matthew Green).
Note: sunos_stat() and sunos_lstat() were added too.
 1.18 27-Apr-1995  christos Try to make the reboot system call compile under sun3 with RB_STRING
support [not tested]
Add files.sunos
Rename system call switch table file from sunos_init_sysent.c to sunos_sysent.c
like other emulations.
 1.17 30-Jun-1994  cgd fix a botch, and gen syscall files
 1.16 14-Jun-1994  chopps update to match recent getdtablesize() change
 1.15 07-May-1994  deraadt follow
 1.14 01-May-1994  cgd sun syscalls.master update
 1.13 26-Apr-1994  pk SunOS's RLIMIT_NOFILE is different: add sun_[gs]rlimit().
 1.12 04-Apr-1994  deraadt nice unique SUN_SYS_ names..
 1.11 27-Mar-1994  cgd expand uid_t/gid_t/off_t
 1.10 03-Mar-1994  deraadt update to syscall.master (for sysconf)
 1.9 12-Dec-1993  deraadt update to latest syscalls.master
 1.8 22-Nov-1993  deraadt branches: 1.8.2;
moved from arch/sparc/sunos to compat/sunos
 1.7 20-Nov-1993  deraadt update to new syscalls.master
 1.6 14-Nov-1993  deraadt update to latest syscalls.master
 1.5 10-Nov-1993  deraadt update from new syscalls.master
 1.4 15-Oct-1993  deraadt rebuilt from syscall.master: {get,set}domainname change
 1.3 13-Oct-1993  deraadt rebuild files from syscalls.master
 1.2 11-Oct-1993  deraadt various changes, suffice to say that 4.4 syscalls do not look like ours
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.8.2.5 01-Dec-1993  deraadt update with new sun_mknod
 1.8.2.4 27-Nov-1993  deraadt update (as always)
 1.8.2.3 27-Nov-1993  deraadt update
 1.8.2.2 27-Nov-1993  deraadt update..
 1.8.2.1 26-Nov-1993  deraadt update to syscalls.master
 1.27.4.1 10-Dec-1996  mycroft Regen.
 1.32.2.1 14-Jan-1997  thorpej syscalls.master changed; regen.
 1.33.6.1 01-Jun-1997  mrg regen.
 1.33.2.1 14-Feb-1997  mrg regen.
 1.35.4.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.50.4.1 02-Aug-1999  thorpej Regen.
 1.51.2.4 11-Feb-2001  bouyer Sync with HEAD.
 1.51.2.3 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.51.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.51.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.57.2.7 11-Nov-2002  nathanw Catch up to -current
 1.57.2.6 29-May-2002  nathanw Regen.
 1.57.2.5 28-Feb-2002  nathanw Catch up to -current.
 1.57.2.4 11-Jan-2002  nathanw More catchup.
 1.57.2.3 15-Nov-2001  pk Regenerate.
 1.57.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.57.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.58.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.63.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.63.10.1 29-Apr-2005  kent sync with -current
 1.63.2.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.65.4.3 21-Jan-2008  yamt sync with head
 1.65.4.2 26-Feb-2007  yamt sync with head.
 1.65.4.1 30-Dec-2006  yamt sync with head.
 1.66.8.2 03-Sep-2006  yamt sync with head.
 1.66.8.1 11-Aug-2006  yamt sync with head
 1.66.4.1 09-Sep-2006  rpaulo sync with head
 1.70.2.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.71.32.1 02-Jan-2008  bouyer Sync with HEAD
 1.71.28.1 26-Dec-2007  ad Sync with head.
 1.71.26.1 18-Feb-2008  mjf Sync with HEAD.
 1.71.20.1 09-Jan-2008  matt sync with HEAD
 1.73.14.2 27-Jun-2008  simonb Sync with head.
 1.73.14.1 18-Jun-2008  simonb Sync with head.
 1.73.12.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.73.10.2 11-Mar-2010  yamt sync with head
 1.73.10.1 04-May-2009  yamt sync with head.
 1.73.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.73.6.1 29-Jun-2008  mjf Sync with HEAD.
 1.75.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.75.2.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.80.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.81.24.1 18-May-2014  rmind sync with head
 1.81.20.2 03-Dec-2017  jdolecek update from HEAD
 1.81.20.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.81.10.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.82.6.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.82.6.1 06-Apr-2015  skrll Sync with HEAD
 1.84.2.1 20-Mar-2017  pgoyette Sync with HEAD
 1.85.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.86.4.1 11-May-2017  pgoyette Sync with HEAD
 1.91.4.1 10-Jun-2019  christos Sync with HEAD
 1.91.2.3 29-Sep-2018  pgoyette Regen
 1.91.2.2 29-Sep-2018  pgoyette Regen
 1.91.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.2 24-Jun-1995  christos Use compat_util.[ch]
 1.1 11-Jun-1995  pk Go with the flow; use `/emul/sunos' pseudo-root (from Matthew Green).
Note: sunos_stat() and sunos_lstat() were added too.
 1.7 01-Dec-2000  jdolecek add e_path (emulation path) to struct emul, which replaces emulation-specific
*_emul_path variables

change macros CHECK_ALT_{CREAT|EXIST} to use that, 'root' doesn't need
to be passed explicitly any more and *_CHECK_ALT_{CREAT|EXIST} are removed
change explicit emul_find() calls in probe functions to get the emulation
path from the checked exec switch entry's emulation

remove no longer needed header files

add e_flags and e_syscall to struct emul; these are unsed and empty for now
 1.6 09-Feb-1999  christos branches: 1.6.8;
Const poisoning and CHECK_ALT_CREAT fixes
 1.5 05-Sep-1998  christos Assign copyright to TNF.
 1.4 10-Oct-1997  mrg remove advertising clause from all my licenses.
 1.3 05-Oct-1996  mrg branches: 1.3.10;
minor copyright update.
 1.2 24-Jun-1995  christos Use compat_util.[ch]
 1.1 11-Jun-1995  pk Go with the flow; use `/emul/sunos' pseudo-root (from Matthew Green).
Note: sunos_stat() and sunos_lstat() were added too.
 1.3.10.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.6.8.1 08-Dec-2000  bouyer Sync with HEAD.
 1.5 01-Nov-2002  jdolecek set nsysent to 256
 1.4 18-Dec-1998  drochner branches: 1.4.20;
remove compat_xxx dependencies where they don't belong
 1.3 27-Apr-1995  christos Try to make the reboot system call compile under sun3 with RB_STRING
support [not tested]
Add files.sunos
Rename system call switch table file from sunos_init_sysent.c to sunos_sysent.c
like other emulations.
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 25-Oct-1994  deraadt and these
 1.4.20.1 11-Nov-2002  nathanw Catch up to -current
 1.82 23-Sep-2019  christos Treat valsize as unsigned
 1.81 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.80 06-Jan-2018  kamil branches: 1.80.2; 1.80.4;
Revert vadvise(2) removal

This system call was used in legacy Lisp code, that was inherited to modern
age and still compiled against supported compat layers (e.g. in clisp,
oaklisp, Franz Lisp).

It used to instruct the kernel about paging policy (G/C aware, flush etc).

Newly compiled code (assuming that it will detect vadvise()) will use the
libc stub for vadvise(). The headers for this interface are gone.

vadvise(2) could be marked as COMPAT_80, but as long as we support ultrix,
sunos or aout68k ABI, don't bother with this.

Requested by <mrg>
 1.79 19-Dec-2017  kamil compat/sunos: Drop SYS_vadvise

The (o)vadvise syscall is dummy since the beginning of NetBSD.

Sponsored by <The NetBSD Foundation>
 1.78 19-Dec-2017  kamil compat/sunos: Drop SYS_sbrk

sbrk - change data segment size

This syscall is dummy since the inception of the project.

Sponsored by <The NetBSD Foundation>
 1.77 19-Dec-2017  kamil compat sunos: Drop the sstk(2) syscall

sstk(2) has never been implemented by the NetBSD kernel.

Sponsored by <The NetBSD Foundation>
 1.76 07-Nov-2013  njoly Fix dup/dup2/dup3 argument types (u_int -> int).
 1.75 03-Mar-2010  pooka branches: 1.75.10; 1.75.20; 1.75.24;
One more overcomplex ENOSYS bites the dust.
 1.74 13-Jan-2009  pooka branches: 1.74.4;
Convert the syscalls.master to a format from which it is easier
to parse and generate the compat name and basename (e.g. __stat50
and stat). Use this to autogenerate __RENAME()'s to the rump_syscalls
header so that they can be called e.g. rump_sys_socket() instead
of rump_sys___socket30().
 1.73 13-Jan-2009  pooka UNIMPL police
 1.72 11-Jan-2009  tsutsui Update for compat_50 stuff. (compile test only)
 1.71 11-Jan-2009  christos merge christos-time_t
 1.70 19-Nov-2008  ad Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.69 21-Jun-2008  tsutsui branches: 1.69.2; 1.69.4;
Include <sys/sched.h> before <sys/syscallargs.h> for cpuset_t.
 1.68 20-Dec-2007  dsl branches: 1.68.6; 1.68.8; 1.68.12; 1.68.14; 1.68.16;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.67 04-Mar-2007  christos branches: 1.67.16; 1.67.24; 1.67.28;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.66 09-Feb-2007  ad branches: 1.66.2;
Merge newlock2 to head.
 1.65 01-Sep-2006  matt branches: 1.65.2;
Don't conditionalize *sys_ptrace. The lack of sys_ptrace will be dealt
with differently.
 1.64 30-Aug-2006  he Update for options PTRACE.
 1.63 13-Jul-2006  pavel request the COMPAT_30 getfh in the master files. (Changes to the generated
ones would be lost.)
 1.62 11-Dec-2005  christos branches: 1.62.4; 1.62.8;
merge ktrace-lwp.
 1.61 26-Feb-2005  perry branches: 1.61.4;
nuke trailing whitespace
 1.60 18-Jan-2003  thorpej branches: 1.60.2; 1.60.10; 1.60.12;
Merge the nathanw_sa branch.
 1.59 03-Jan-2002  mrg move the COMPAT_SUNOS SO_BROADCAST hack out of uipc_socket.c into the
compat/sunos code. besides being cleaner this allows the sunos LKM
to properly work without any special kernel hacks.
 1.58 30-May-2001  mrg branches: 1.58.2;
use _KERNEL_OPT.
 1.57 09-Dec-2000  mycroft branches: 1.57.2;
Get rid of the damn EMUL_GET* flags.
 1.56 09-Dec-2000  mycroft Add the %% separators.
 1.55 30-Nov-2000  jdolecek LKMify
 1.54 09-Apr-2000  mrg rename some unimplimented (because they are OLD in sunos) syscalls to avoid confusion.
 1.53 12-Jul-1999  kleink branches: 1.53.2;
XSH5: change function signature to `void *sbrk(intptr_t)'.
 1.52 22-Mar-1999  sommerfe branches: 1.52.4;
Use standard system fchroot instead of emulation-specific copy.
 1.51 09-Feb-1999  christos Const poisoning and CHECK_ALT_CREAT fixes
 1.50 18-Dec-1998  drochner remove compat_xxx dependencies where they don't belong
 1.49 10-Dec-1998  christos Defopt COMPAT_43
 1.48 19-Oct-1998  tron Defopt SYSVMSG, SYSVSEM and SYSVSHM.
 1.47 13-Sep-1998  pk Signal compat: sunos sigset_t conversions;
new sunos_sigvec() & sunos_sigpending()
 1.46 25-Jun-1998  thorpej defopt NFSSERVER
 1.45 19-Feb-1998  thorpej Include the NFS option header.
 1.44 19-Oct-1997  christos Make mman(2) functions args consistent (caddr_t -> void *)
 1.43 16-Oct-1997  christos ostat -> stat43
 1.42 10-Oct-1997  fvdl sys_getdirentries -> compat_12_sys_getdirentries from Juergen Hannken-Illjes.
 1.41 13-Jun-1997  thorpej branches: 1.41.4;
Use compat_12_sys_swapon().
 1.40 12-Jun-1997  mrg now need sunos_sys_swapon() as ours is different.
 1.39 31-Jan-1997  thorpej branches: 1.39.2; 1.39.6;
NFSCLIENT -> NFS
 1.38 07-Sep-1996  mycroft branches: 1.38.2;
Modify poll(2) prototype.
 1.37 07-Sep-1996  mycroft Implement poll(2).
 1.36 30-Aug-1996  christos add obsolete stime(2)
 1.35 26-Aug-1996  thorpej Implement sunos_sys_execve(). The previous code simply called
sys_execve() without doing an alternate patch check, which was
incorrect. Bug pointed out by Krister Walfridsson <cato@df.lth.se>
on port-sparc@NetBSD.ORG.
 1.34 23-Jun-1996  mycroft Catch up with setre[ug]id() changes.
 1.33 28-Feb-1996  pk branches: 1.33.4;
Insert sunos_sys_fcntl().
 1.32 07-Oct-1995  mycroft Prefix names of system call implementation functions with `sys_'.
 1.31 05-Jul-1995  pk Start using sunos_sigvec().
 1.30 25-Jun-1995  briggs Oops... NOARGS for compat_43_sigvec.
 1.29 25-Jun-1995  briggs sigvec -> compat_43_sigvec.
 1.28 24-Jun-1995  christos Use compat_util.[ch]
 1.27 11-Jun-1995  pk Go with the flow; use `/emul/sunos' pseudo-root (from Matthew Green).
Note: sunos_stat() and sunos_lstat() were added too.
 1.26 22-Apr-1995  christos Added sunos_reboot().
 1.25 22-Apr-1995  christos - added struct emul to all emulations.
- removed all setup functions.
- added copyargs() functions where needed.
 1.24 06-Dec-1994  deraadt repair SYSV_* system calls
 1.23 25-Nov-1994  deraadt a few other things which work
 1.22 20-Nov-1994  deraadt sunos ptrace & poll emulation
 1.21 14-Nov-1994  deraadt fix sunos_mmap
 1.20 26-Oct-1994  cgd new RCS ID format.
 1.19 26-Oct-1994  deraadt whoops
 1.18 25-Oct-1994  deraadt rename, new syscall interface, etc.
 1.17 29-Jun-1994  cgd New RCS ID's, take two. they're more aesthecially pleasant, and use 'NetBSD'
 1.16 14-Jun-1994  chopps update to match recent getdtablesize() change
 1.15 07-May-1994  deraadt backwards compat for a few things.
 1.14 01-May-1994  cgd three changes i forgot, from Gordon Ross (gwr@lamp)
 1.13 26-Apr-1994  pk SunOS's RLIMIT_NOFILE is different: add sun_[gs]rlimit().
 1.12 27-Mar-1994  cgd fix botch
 1.11 27-Mar-1994  cgd do the syscall shuffle
 1.10 03-Mar-1994  deraadt first cut at a SUNOS_COMPAT sysconf() system call.
 1.9 12-Dec-1993  deraadt m68k/sparc sunos binary compatibility code, pulled down from magnum branch
for consumption by the m68k masses
 1.8 22-Nov-1993  deraadt branches: 1.8.2;
moved from arch/sparc/sunos to compat/sunos
 1.7 20-Nov-1993  deraadt new compat functions: sun_open, sun_auditsys, sun_setpgid, sun_uname
some from Markus.
 1.6 14-Nov-1993  deraadt update to kern/syscalls.master, for SYSVSEM & SYSVMSG
 1.5 10-Nov-1993  deraadt update to 4.4 way of doing syscall#0
 1.4 15-Oct-1993  deraadt use the standard {get,set}domainname stuff
 1.3 13-Oct-1993  deraadt Add a stub auditsys() system call that does nothing.
SunOS /sbin/fsck calls it..
 1.2 11-Oct-1993  deraadt various changes, suffice to say that 4.4 syscalls do not look like ours
 1.1 02-Oct-1993  deraadt Chris Torek's sparc port. Missing lots of things.
 1.8.2.8 01-Dec-1993  pk Introduced sun_mknod() which also deals with FIFOs (ie. `mknod xxx p' on SunOS).
 1.8.2.7 27-Nov-1993  deraadt very rudimentary exportfs(2) support, ie. "return 0"
 1.8.2.6 27-Nov-1993  deraadt statfs(2) is different..
 1.8.2.5 27-Nov-1993  deraadt support sunos vhangup(2) call (getty needs it)
 1.8.2.4 26-Nov-1993  deraadt support quotactl(2)
 1.8.2.3 26-Nov-1993  deraadt add ustat(2) system call. bleah.
 1.8.2.2 26-Nov-1993  deraadt support nfssvc, getfh, and async_daemon system calls.
 1.8.2.1 22-Nov-1993  deraadt file syscalls.master was added on branch magnum on 1993-11-26 13:25:49 +0000
 1.33.4.2 10-Dec-1996  mycroft From trunk:
Do execv() and execve() path name translation consistently across
emulations.
 1.33.4.1 10-Dec-1996  mycroft From trunk:
Implement setre[ug]id() for real.
 1.38.2.1 14-Jan-1997  thorpej Snapshot of work-in-progress, committed to private branch.

These changes implement machine-independent root device and file system
selection. Notable features:

- All ports behave in a consistent manner regarding root
device selection.
- No more "options GENERIC"; all kernels have the ability
to boot with RB_ASKNAME to select root device and file system
type.
- Root file system type can be wildcarded; a machine-independent
function will try all possible file systems for the selected
root device until one succeeds.
- If the root file system fails to mount, the operator will
be given the chance to select a new root device and file
system type, rather than having the machine simply panic.
- nfs_mountroot() no longer panics if any part of the NFS
mount process fails; it now returns an error, giving the
operator a chance to recover.
- New, more consistent, config(8) grammar. The constructs:

config netbsd swap generic
config netbsd root on nfs

have been replaced with:

config netbsd root on ? type ?
config netbsd root on ? type nfs

Additionally, the operator may select or wildcard root file
system type in the kernel configuration file:

config netbsd root on cd0a type cd9660

config(8) now requires that a "root" specification be
made. "root" may be wired down or wildcarded. "swap" and
"dump" specifications are optional, and follow previous
semantics.

- config(8) has a new "file-system" keyword, used to configure
file systems into the kernel. Eventually, this will be used
to generate the default vfssw[].

- "options NFSCLIENT" is obsolete, and is replaced by
"file-system NFS". "options NFSSERVER" still exists, since
NFS server support is independent of the NFS file system
client.

- sys/arch/<foo>/<foo>/swapgeneric.c is no longer used, and
will be removed; all information is now generated by config(8).

As of this commit, all ports except arm32 have been updated to use
the new setroot(). Only SPARC, i386, and Alpha ports have been
tested at this time. Port masters should test these changes on their
ports, and report any problems back to me.

More changes are on their way, including RB_ASKNAME support in
nfs_mountroot() (to prompt for server address and path) and, potentially,
the ability to select rarp/bootparam or bootp in nfs_mountroot().
 1.39.6.1 01-Jun-1997  mrg we now need sunos_sys_swapon().
 1.39.2.1 12-Feb-1997  mrg initial work for dynamic swap additions.
 1.41.4.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.52.4.1 02-Aug-1999  thorpej Update from trunk.
 1.53.2.3 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.53.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.53.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.57.2.4 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.57.2.3 28-Feb-2002  nathanw Catch up to -current.
 1.57.2.2 11-Jan-2002  nathanw More catchup.
 1.57.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.58.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.60.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.60.10.1 29-Apr-2005  kent sync with -current
 1.60.2.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.61.4.4 21-Jan-2008  yamt sync with head
 1.61.4.3 03-Sep-2007  yamt sync with head.
 1.61.4.2 26-Feb-2007  yamt sync with head.
 1.61.4.1 30-Dec-2006  yamt sync with head.
 1.62.8.1 11-Aug-2006  yamt sync with head
 1.62.4.1 09-Sep-2006  rpaulo sync with head
 1.65.2.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.66.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.67.28.1 02-Jan-2008  bouyer Sync with HEAD
 1.67.24.1 26-Dec-2007  ad Sync with head.
 1.67.16.1 09-Jan-2008  matt sync with HEAD
 1.68.16.1 27-Jun-2008  simonb Sync with head.
 1.68.14.3 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.68.14.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.68.14.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.68.12.2 11-Mar-2010  yamt sync with head
 1.68.12.1 04-May-2009  yamt sync with head.
 1.68.8.3 20-Nov-2008  christos merge with head.
 1.68.8.2 01-Nov-2008  christos Sync with head.
 1.68.8.1 29-Mar-2008  christos Welcome to the time_t=long long dev_t=uint64_t branch.
 1.68.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.68.6.1 29-Jun-2008  mjf Sync with HEAD.
 1.69.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.69.2.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.74.4.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.75.24.1 18-May-2014  rmind sync with head
 1.75.20.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.75.10.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.80.4.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.80.4.1 10-Jun-2019  christos Sync with HEAD
 1.80.2.2 29-Sep-2018  pgoyette Conditionalize the compat_10 sysv ipc syscalls on both the COMPAT_10
and SYSVxxx attributes
 1.80.2.1 29-Sep-2018  pgoyette Conditionalize compat_09 syscalls
 1.6 14-Jan-2014  christos use new bsd.syscall.mk
 1.5 11-Dec-2005  christos branches: 1.5.110; 1.5.120; 1.5.126;
merge ktrace-lwp.
 1.4 26-Feb-2005  perry make this rebuild generated files by default, also clean up and make
more like other similar Makefiles.
 1.3 15-Nov-2003  thorpej branches: 1.3.8; 1.3.10;
We have CVS; there is no reason to make .bak files when generating the
syscall tables.
 1.2 26-Oct-2003  lukem Use ${HOST_SH} instead of `sh'.

If necessary, pull in <bsd.sys.mk> to get the definition of HOST_SH;
Makefiles that pull in one of (most of) <bsd.*.mk> will get this anyway.
 1.1 02-Feb-2001  mrg branches: 1.1.2; 1.1.26;
initial support for sunos binaries running on a 64 bit sparc64 kernel.
some programs work, many do not yet.
 1.1.26.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.1.26.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.26.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.26.1 03-Aug-2004  skrll Sync with HEAD
 1.1.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.1.2.1 02-Feb-2001  bouyer file Makefile was added on branch thorpej_scsipi on 2001-02-11 19:14:28 +0000
 1.3.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.3.8.1 29-Apr-2005  kent sync with -current
 1.5.126.1 18-May-2014  rmind sync with head
 1.5.120.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.5.110.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.4 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.3 17-Nov-2014  uebayasi branches: 1.3.18; 1.3.20;
Define compat modules (but without dependencies yet).
 1.2 19-Nov-2008  ad branches: 1.2.26;
Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.1 02-Feb-2001  mrg branches: 1.1.2; 1.1.124; 1.1.128; 1.1.134; 1.1.138;
initial support for sunos binaries running on a 64 bit sparc64 kernel.
some programs work, many do not yet.
 1.1.138.1 19-Jan-2009  skrll Sync with HEAD.
 1.1.134.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.1.128.1 04-May-2009  yamt sync with head.
 1.1.124.1 17-Jan-2009  mjf Sync with HEAD.
 1.1.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.1.2.1 02-Feb-2001  bouyer file files.sunos32 was added on branch thorpej_scsipi on 2001-02-11 19:14:30 +0000
 1.2.26.1 03-Dec-2017  jdolecek update from HEAD
 1.3.20.1 10-Jun-2019  christos Sync with HEAD
 1.3.18.3 02-Oct-2018  pgoyette Revert most of previous. Leave the original dependencies, but still
remove the duplicate attribute definition to make config(1) happier.
 1.3.18.2 22-Sep-2018  pgoyette Use attribute compat_sunos32 rather than duplicating compat_sunos
(config(1) doesn't like duplication)
 1.3.18.1 12-Mar-2018  pgoyette Update dependencies for modules when they are built-in. Now we don't
(or at least, shouldn't) need reminders in the GENERIC config files
about which module options require other options.

Update branch status doc accordingly.
 1.13 29-May-2008  mrg remove clause #3 from my license where there are no other
copyright holders involved.
 1.12 12-May-2007  dsl branches: 1.12.28; 1.12.30; 1.12.32; 1.12.34;
Change interface to settimeofday1() so that it can also be used from
compat code in order to avoid the stackgap.
 1.11 22-Apr-2007  dsl Change the way that emulations locate files within the emulation root to
avoid having to allocate space in the 'stackgap'
- which is very LWP unfriendly.
The additional code for non-emulation namei() is trivial, the reduction for
the emulations is massive.
The vnode for a processes emulation root is saved in the cwdi structure
during process exec.
If the emulation root the TRYEMULROOT flag are set, namei() will do an initial
search for absolute pathnames in the emulation root, if that fails it will
retry from the normal root.
".." at the emulation root will always go to the real root, even in the middle
of paths and when expanding symlinks.
Absolute symlinks found using absolute paths in the emulation root will be
relative to the emulation root (so /usr/lib/xxx.so -> /lib/xxx.so links
inside the emulation root don't need changing).
If the root of the emulation would be returned (for an emulation lookup), then
the real root is returned instead (matching the behaviour of emul_lookup,
but being a cheap comparison here) so that programs that scan "../.."
looking for the root dircetory don't loop forever.
The target for symbolic links is no longer mangled (it used to get the
CHECK_ALT_xxx() treatment, so could get /emul/xxx prepended).
CHECK_ALT_xxx() are no more. Most of the change is deleting them, and adding
TRYEMULROOT to the flags to NDINIT().
A lot of the emulation system call stubs could now be deleted.
 1.10 16-Mar-2007  dsl remove all the double (and triple) casts used to convert 32bit userspace
pointers to and from 64bit kernel pointers. Instead use the defines
NETBSD32PTR64(p32) to read a 32bit pointer and (the new) NETBSD32PTR32(p32,p64)
to write a 32bit pointer throughout.
The 32bit pointer is now a struct to enforce the above.
amd64 (with linux emul) and sparc64 will both compile (when the arch stuff
goes in soon), and amd64 still runs some i386 binaries.
 1.9 11-Dec-2005  christos branches: 1.9.26; 1.9.30; 1.9.32; 1.9.34;
merge ktrace-lwp.
 1.8 26-Feb-2005  perry branches: 1.8.4;
nuke trailing whitespace
 1.7 26-Mar-2004  drochner branches: 1.7.8; 1.7.10;
all ports define __HAVE_SIGINFO now, so remove the CPP conditionals
 1.6 26-Oct-2003  christos Add __HAVE_SIGINFO
 1.5 28-Sep-2003  martin constify
 1.4 29-Jun-2003  fvdl branches: 1.4.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.3 29-Jun-2003  martin struct proc * -> struct lwp *
 1.2 04-Jul-2002  thorpej Add kernel support for having userland provide the signal trampoline:

* struct sigacts gets a new sigact_sigdesc structure, which has the
sigaction and the trampoline/version. Version 0 means "legacy kernel
provided trampoline". Other versions are coordinated with machine-
dependent code in libc.
* sigaction1() grows two more arguments -- the trampoline pointer and
the trampoline version.
* A new __sigaction_sigtramp() system call is provided to register a
trampoline along with a signal handler.
* The handler is no longer passed to sensig() functions. Instead,
sendsig() looks up the handler by peeking in the sigacts for the
process getting the signal (since it has to look in there for the
trampoline anyway).
* Native sendsig() functions now select the appropriate trampoline and
its arguments based on the trampoline version in the sigacts.

Changes to libc to use the new facility will be checked in later. Kernel
version not bumped; we will ride the 1.6C bump made recently.
 1.1 02-Feb-2001  mrg branches: 1.1.2; 1.1.4; 1.1.6; 1.1.18;
initial support for sunos binaries running on a 64 bit sparc64 kernel.
some programs work, many do not yet.
 1.1.18.1 15-Jul-2002  gehenna catch up with -current.
 1.1.6.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.4.1 01-Aug-2002  nathanw Catch up to -current.
 1.1.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.1.2.1 02-Feb-2001  bouyer file sunos32.h was added on branch thorpej_scsipi on 2001-02-11 19:14:30 +0000
 1.4.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.4.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.4.2.2 26-Aug-2004  skrll Adapt to branch.

sparc64 GENERIC compiles.
 1.4.2.1 03-Aug-2004  skrll Sync with HEAD
 1.7.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.7.8.1 29-Apr-2005  kent sync with -current
 1.8.4.2 03-Sep-2007  yamt sync with head.
 1.8.4.1 21-Jun-2006  yamt sync with head.
 1.9.34.1 18-Mar-2007  reinoud First attempt to bring branch in sync with HEAD
 1.9.32.1 11-Jul-2007  mjf Sync with head.
 1.9.30.2 27-May-2007  ad Sync with head.
 1.9.30.1 10-Apr-2007  ad Sync with head.
 1.9.26.3 17-May-2007  yamt sync with head.
 1.9.26.2 07-May-2007  yamt sync with head.
 1.9.26.1 24-Mar-2007  yamt sync with head.
 1.12.34.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.12.32.1 04-May-2009  yamt sync with head.
 1.12.30.1 04-Jun-2008  yamt sync with head
 1.12.28.1 02-Jun-2008  mjf Sync with HEAD.
 1.3 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.2 06-Feb-2001  mrg branches: 1.2.2; 1.2.124; 1.2.126; 1.2.128;
add from NetBSD Id.
 1.1 06-Feb-2001  mrg use struct sunos32_dirent. now getwd() works.
 1.2.128.1 16-May-2008  yamt sync with head.
 1.2.126.1 18-May-2008  yamt sync with head.
 1.2.124.1 02-Jun-2008  mjf Sync with HEAD.
 1.2.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.2.2.1 06-Feb-2001  bouyer file sunos32_dirent.h was added on branch thorpej_scsipi on 2001-02-11 19:14:30 +0000
 1.36 10-Aug-2018  pgoyette Allow syscall_establish() to install new syscalls when the existing
entry-point is either sys_nomodule or sys_nosys. Update the
makesyscalls.sh script to create a const array of bits to allow
syscall_disestablish() to properly restore the original entry-point.
Update all the initializers of struct emul to initialize the pointer
to the bit array struct emul.

XXX Regen of all files created by makesyscalls.sh will come soon,
XXX followed by a kernel version bump (since struct emul is being
XXX modified).

This commit should address PR kern/45781 and also removes the need
for the work-around for that PR in file

sys/arch/usermode/modules/syscallemu/syscallemu.c
 1.35 06-May-2018  kamil branches: 1.35.2;
Remove an element from struct emul: e_tracesig

e_tracesig used to be implemented for Darwin compat. Nowadays the Darwin
compatiblity layer is gone and there are no other users.

This functionality isn't used where it shall be used in the existing
codebase.

If we want to emulate debugging interfaces in compat layers we would need
to implement that from scratch anyway. We would need to be bug compatible
with other OSes too.

Proposed on tech-kern@.

Welcome to NetBSD 8.99.16!

Sponsored by <The NetBSD Foundation>
 1.34 09-Jan-2018  maya branches: 1.34.2;
remove struct emul's e_fault.

It used to be used by COMPAT_IRIX for the purpose of overriding
uvm_fault (only implemented in MIPS), now removed.

Ride 8.99.12 version bump.
 1.33 19-Feb-2012  rmind Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.
 1.32 07-Jul-2010  chs branches: 1.32.8; 1.32.12;
many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
- support new-style (NPTL) linux pthreads on all platforms.
clone() with CLONE_THREAD uses 1 process with many LWPs
instead of separate processes.
- move the contents of sys__lwp_setprivate() into a new
lwp_setprivate() and use that everywhere.
- update linux_release[] and linux32_release[] to "2.6.18".
- adjust placement of emul fork/exec/exit hooks as needed
and adjust other emul code to match.
- convert all struct emul definitions to use named initializers.
- change the pid allocator to allow multiple pids to refer to the same proc.
- remove a few fields from struct proc that are no longer needed.
- disable the non-functional "vdso" code in linux32/amd64,
glibc works fine without it.
- fix a race in the futex code where we could miss a wakeup after
a requeue operation.
- redo futex locking to be a little more efficient.
 1.31 19-Nov-2008  ad branches: 1.31.6; 1.31.8;
Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.30 15-Oct-2008  wrstuden branches: 1.30.2;
Merge wrstuden-revivesa into HEAD.
 1.29 29-May-2008  mrg branches: 1.29.4;
remove clause #3 from my license where there are no other
copyright holders involved.
 1.28 16-Mar-2007  dsl branches: 1.28.30; 1.28.32; 1.28.34; 1.28.36;
remove all the double (and triple) casts used to convert 32bit userspace
pointers to and from 64bit kernel pointers. Instead use the defines
NETBSD32PTR64(p32) to read a 32bit pointer and (the new) NETBSD32PTR32(p32,p64)
to write a 32bit pointer throughout.
The 32bit pointer is now a struct to enforce the above.
amd64 (with linux emul) and sparc64 will both compile (when the arch stuff
goes in soon), and amd64 still runs some i386 binaries.
 1.27 19-Feb-2007  cube branches: 1.27.4; 1.27.6; 1.27.8;
Introduce a new member to struct emul, e_startlwp, to be used by
sys__lwp_create. It allows using the said syscall under COMPAT_NETBSD32.

The libpthread regression tests now pass on amd64 and sparc64.
 1.26 09-Feb-2007  ad branches: 1.26.2;
Merge newlock2 to head.
 1.25 15-Oct-2006  martin Missing initializers
 1.24 11-Dec-2005  christos branches: 1.24.20; 1.24.22;
merge ktrace-lwp.
 1.23 11-Jul-2005  christos Add a sunos_machdep include file to deal with MD implementations of
sunos_syscall_intern.
 1.22 10-Jul-2005  christos define syscall again.
 1.21 10-Jul-2005  christos We have syscall_intern now.
 1.20 26-Mar-2005  fvdl branches: 1.20.2;
Fix some things regarding COMPAT_NETBSD32 and limits/VM addresses.

* For sparc64 and amd64, define *SIZ32 VM constants.
* Add a new function pointer to struct emul, pointing at a function
that will return the default VM map address. The default function
is uvm_map_defaultaddr, which just uses the VM_DEFAULT_ADDRESS
macro. This gives emulations control over the default map address,
and allows things to be mapped at the right address (in 32bit range)
for COMPAT_NETBSD32.
* Add code to adjust the data and stack limits when a COMPAT_NETBSD32
or COMPAT_SVR4_32 binary is executed.
* Don't use USRSTACK in kern_resource.c, use p_vmspace->vm_minsaddr
instead (emulations might have set it differently)
* Since this changes struct emul, bump kernel version to 3.99.2

Tested on amd64, compile-tested on sparc64.
 1.19 20-Dec-2003  fvdl branches: 1.19.8; 1.19.10; 1.19.14;
Put back Emmanuel's sigfilter hooks, as decided by Core.
 1.18 20-Dec-2003  manu Introduce lwp_emuldata and the associated hooks. No hook is provided for the
exec case, as the emulation already has the ability to intercept that
with the e_proc_exec hook. It is the responsability of the emulation to
take appropriaye action about lwp_emuldata in e_proc_exec.

Patch reviewed by Christos.
 1.17 05-Dec-2003  jdolecek back the sigfilter emulation hook change off
 1.16 03-Dec-2003  manu Add a sigfilter emulation hook. It is used at the beginning of kpsignal2()
so that a specific emulation has the oportunity to filter out some signals.

if sigfilter returns 0, then no signal is sent by kpsignal2().

There is another place where signals can be generated: trapsignal. Since this
function is already an emulation hook, no call to the sigfilter hook was
introduced in trapsignal.

This is needed to emulate the softsignal feature in COMPAT_DARWIN (signals
sent as Mach exception messages)
 1.15 24-Aug-2003  chs add support for non-executable mappings (where the hardware allows this)
and make the stack and heap non-executable by default. the changes
fall into two basic catagories:

- pmap and trap-handler changes. these are all MD:
= alpha: we already track per-page execute permission with the (software)
PG_EXEC bit, so just have the trap handler pay attention to it.
= i386: use a new GDT segment for %cs for processes that have no
executable mappings above a certain threshold (currently the
bottom of the stack). track per-page execute permission with
the last unused PTE bit.
= powerpc/ibm4xx: just use the hardware exec bit.
= powerpc/oea: we already track per-page exec bits, but the hardware only
implements non-exec mappings at the segment level. so track the
number of executable mappings in each segment and turn on the no-exec
segment bit iff the count is 0. adjust the trap handler to deal.
= sparc (sun4m): fix our use of the hardware protection bits.
fix the trap handler to recognize text faults.
= sparc64: split the existing unified TSB into data and instruction TSBs,
and only load TTEs into the appropriate TSB(s) for the permissions.
fix the trap handler to check for execute permission.
= not yet implemented: amd64, hppa, sh5

- changes in all the emulations that put a signal trampoline on the stack.
instead, we now put the trampoline into a uvm_aobj and map that into
the process separately.

originally from openbsd, adapted for netbsd by me.
 1.14 10-Nov-2002  jdolecek branches: 1.14.6;
handle __HAVE_MINIMAL_EMUL
 1.13 01-Nov-2002  jdolecek set struct emul's nsysent to compat SYS_NSYSENT, not SYS_MAXSYSCALL
 1.12 21-Sep-2002  manu - Introduce a e_fault field in struct proc to provide emulation specific
memory fault handler. IRIX uses irix_vm_fault, and all other emulation
use NULL, which means to use uvm_fault.

- While we are there, explicitely set to NULL the uninitialized fields in
struct emul: e_fault and e_sysctl on most ports

- e_fault is used by the trap handler, for now only on mips. In order to avoid
intrusive modifications in UVM, the function pointed by e_fault does not
has exactly the same protoype as uvm_fault:
int uvm_fault __P((struct vm_map *, vaddr_t, vm_fault_t, vm_prot_t));
int e_fault __P((struct proc *, vaddr_t, vm_fault_t, vm_prot_t));

- In IRIX share groups, all the VM space is shared, except one page.
This bounds us to have different VM spaces and synchronize modifications
to the VM space accross share group members. We need an IRIX specific hook
to the page fault handler in order to propagate VM space modifications
caused by page faults.
 1.11 05-May-2002  thorpej Add missing const.
 1.10 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.9 20-Sep-2001  thorpej Add sunos32_setregs(), thus making sunos32 compile again.
 1.8 18-Sep-2001  jdolecek Make the setregs hook emulation-specific, rather than executable
format specific.
Struct emul has a e_setregs hook back, which points to emulation-specific
setregs function. es_setregs of struct execsw now only points to
optional executable-specific setup function (this is only used for
ECOFF).
 1.7 18-Jun-2001  christos branches: 1.7.2; 1.7.4;
Add an e_trapsignal member to struct emul, so that emulated processes can
send the appropriate signal depending on the trap type.
 1.6 16-Jun-2001  manu Removed obsoletes EMUL_NO_BSD_ASYNCIO_PIPE and EMUL_NO_SIGIO_ON_READ flags.
Async I/O OS specifities should now handled in OS specific code. Linux
has been done, but other emulation should be handled. See case LINUX_F_SETFL
in sys/compat/linux/common/linux_file.c:linux_sys_fcntl() for more details.

The data that has been collected yet:

Net Free Open Linux SunOS AIX OSF1 Darwin
send SIGIO to write end of pipe Y N N N N N Y Y
send SIGIO to read end of pipe Y Y N N N ? Y ?
send SIGIO to write end of socket Y Y Y N N Y Y Y
send SIGIO to read end of socket Y Y Y Y Y ? Y ?
 1.5 30-May-2001  mrg use _KERNEL_OPT.
 1.4 07-May-2001  manu Changed EMUL_BSD_ASYNCIO_PIPE to EMUL_NO_BSD_ASYNCIO_PIPE, so that
the native emulation (NetBSD) does not have a flag.
 1.3 06-May-2001  manu Added two flags to emulation packages:

EMUL_BSD_ASYNCIO_PIPE notes that the emulated binaries expect the original
BSD pipe behavior for asynchronous I/O, which is to fire SIGIO on read() and
write(). OSes without this flag do not expect any SIGIO to be fired on
read() and write() for pipes, even when async I/O was requested. As far as
we know, the OSes that need EMUL_BSD_ASYNCIO_PIPE are NetBSD, OSF/1 and
Darwin.

EMUL_NO_SIGIO_ON_READ notes that the emulated binaries that requested
asynchrnous I/O expect the reader process to be notified by a SIGIO, but
not the writer process. OSes without this flag expect the reader and the
writer to be notified when some data has arrived or when some data have been
read. As far as we know, the OSes that need EMUL_NO_SIGIO_ON_READ are Linux
and SunOS.
 1.2 05-Feb-2001  mrg branches: 1.2.2; 1.2.4;
s/sunos_sendsig/sunos32_sendsig/
 1.1 02-Feb-2001  mrg initial support for sunos binaries running on a 64 bit sparc64 kernel.
some programs work, many do not yet.
 1.2.4.6 11-Nov-2002  nathanw Catch up to -current
 1.2.4.5 18-Oct-2002  nathanw Catch up to -current.
 1.2.4.4 20-Jun-2002  nathanw Catch up to -current.
 1.2.4.3 14-Nov-2001  nathanw Catch up to -current.
 1.2.4.2 21-Sep-2001  nathanw Catch up to -current.
 1.2.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.2.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.2.2.1 05-Feb-2001  bouyer file sunos32_exec.c was added on branch thorpej_scsipi on 2001-02-11 19:14:31 +0000
 1.7.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.7.2.3 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.7.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.7.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.14.6.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.14.6.4 01-Apr-2005  skrll Sync with HEAD.
 1.14.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.14.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.14.6.1 03-Aug-2004  skrll Sync with HEAD
 1.19.14.1 18-Sep-2005  tron Pull up following revision(s) (requested by fvdl in ticket #798):
sys/compat/sunos/sunos_exec.c: revision 1.47
sys/compat/pecoff/pecoff_emul.c: revision 1.11
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.45
sys/arch/amd64/amd64/netbsd32_machdep.c: revision 1.12
sys/sys/proc.h: revision 1.198
sys/compat/mach/mach_exec.c: revision 1.56
sys/compat/freebsd/freebsd_exec.c: revision 1.27
sys/arch/sparc64/include/vmparam.h: revision 1.27
sys/kern/kern_resource.c: revision 1.91
sys/compat/netbsd32/netbsd32_netbsd.c: revision 1.88
sys/compat/osf1/osf1_exec.c: revision 1.39
sys/compat/svr4_32/svr4_32_resource.c: revision 1.5
sys/compat/ultrix/ultrix_misc.c: revision 1.99
sys/compat/svr4_32/svr4_32_exec.h: revision 1.9
sys/kern/exec_elf32.c: revision 1.103
sys/compat/aoutm68k/aoutm68k_exec.c: revision 1.19
sys/compat/sunos32/sunos32_exec.c: revision 1.20
sys/compat/hpux/hpux_exec.c: revision 1.46
sys/compat/darwin/darwin_exec.c: revision 1.40
sys/kern/sysv_shm.c: revision 1.83
sys/uvm/uvm_extern.h: revision 1.99
sys/uvm/uvm_mmap.c: revision 1.89
sys/kern/kern_exec.c: revision 1.195
sys/compat/netbsd32/netbsd32.h: revision 1.31
sys/arch/sparc64/sparc64/svr4_32_machdep.c: revision 1.20
sys/compat/svr4/svr4_exec.c: revision 1.56
sys/compat/irix/irix_exec.c: revision 1.41
sys/compat/ibcs2/ibcs2_exec.c: revision 1.63
sys/compat/svr4_32/svr4_32_exec.c: revision 1.16
sys/arch/amd64/include/vmparam.h: revision 1.8
sys/compat/linux/common/linux_exec.c: revision 1.73
Fix some things regarding COMPAT_NETBSD32 and limits/VM addresses.
* For sparc64 and amd64, define *SIZ32 VM constants.
* Add a new function pointer to struct emul, pointing at a function
that will return the default VM map address. The default function
is uvm_map_defaultaddr, which just uses the VM_DEFAULT_ADDRESS
macro. This gives emulations control over the default map address,
and allows things to be mapped at the right address (in 32bit range)
for COMPAT_NETBSD32.
* Add code to adjust the data and stack limits when a COMPAT_NETBSD32
or COMPAT_SVR4_32 binary is executed.
* Don't use USRSTACK in kern_resource.c, use p_vmspace->vm_minsaddr
instead (emulations might have set it differently)
* Since this changes struct emul, bump kernel version to 3.99.2
Tested on amd64, compile-tested on sparc64.
 1.19.10.1 26-Mar-2005  yamt sync with head.
 1.19.8.1 29-Apr-2005  kent sync with -current
 1.20.2.4 03-Sep-2007  yamt sync with head.
 1.20.2.3 26-Feb-2007  yamt sync with head.
 1.20.2.2 30-Dec-2006  yamt sync with head.
 1.20.2.1 21-Jun-2006  yamt sync with head.
 1.24.22.1 22-Oct-2006  yamt sync with head
 1.24.20.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.24.20.1 18-Nov-2006  ad Sync with head.
 1.26.2.2 24-Mar-2007  yamt sync with head.
 1.26.2.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.27.8.1 18-Mar-2007  reinoud First attempt to bring branch in sync with HEAD
 1.27.6.1 11-Jul-2007  mjf Sync with head.
 1.27.4.1 10-Apr-2007  ad Sync with head.
 1.28.36.2 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.28.36.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.28.34.2 11-Aug-2010  yamt sync with head.
 1.28.34.1 04-May-2009  yamt sync with head.
 1.28.32.1 04-Jun-2008  yamt sync with head
 1.28.30.2 17-Jan-2009  mjf Sync with HEAD.
 1.28.30.1 02-Jun-2008  mjf Sync with HEAD.
 1.29.4.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.29.4.1 19-Oct-2008  haad Sync with HEAD.
 1.30.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.31.8.1 05-Mar-2011  rmind sync with head
 1.31.6.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.32.12.1 24-Feb-2012  mrg sync to -current.
 1.32.8.1 17-Apr-2012  yamt sync with head
 1.34.2.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.34.2.1 21-May-2018  pgoyette Sync with HEAD
 1.35.2.1 10-Jun-2019  christos Sync with HEAD
 1.10 19-Nov-2008  ad Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.9 29-May-2008  mrg branches: 1.9.4; 1.9.6;
remove clause #3 from my license where there are no other
copyright holders involved.
 1.8 04-Dec-2007  dsl branches: 1.8.12; 1.8.14; 1.8.16; 1.8.18;
Remove all the __P
 1.7 11-Dec-2005  christos branches: 1.7.44; 1.7.46; 1.7.52; 1.7.56;
merge ktrace-lwp.
 1.6 29-Jun-2003  fvdl branches: 1.6.2; 1.6.18;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.5 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.4 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.3 20-Sep-2001  thorpej Add sunos32_setregs(), thus making sunos32 compile again.
 1.2 08-Feb-2001  mrg branches: 1.2.2; 1.2.4; 1.2.6; 1.2.8;
header is struct netbsd32_exec
 1.1 02-Feb-2001  mrg initial support for sunos binaries running on a 64 bit sparc64 kernel.
some programs work, many do not yet.
 1.2.8.1 01-Oct-2001  fvdl Catch up with -current.
 1.2.6.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.4.2 23-Aug-2002  petrov lwpfication
 1.2.4.1 21-Sep-2001  nathanw Catch up to -current.
 1.2.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.2.2.1 08-Feb-2001  bouyer file sunos32_exec.h was added on branch thorpej_scsipi on 2001-02-11 19:14:31 +0000
 1.6.18.2 07-Dec-2007  yamt sync with head
 1.6.18.1 21-Jun-2006  yamt sync with head.
 1.6.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.7.56.1 08-Dec-2007  ad Sync with head.
 1.7.52.1 08-Dec-2007  mjf Sync with HEAD.
 1.7.46.1 09-Jan-2008  matt sync with HEAD
 1.7.44.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.8.18.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.8.16.1 04-May-2009  yamt sync with head.
 1.8.14.1 04-Jun-2008  yamt sync with head
 1.8.12.2 17-Jan-2009  mjf Sync with HEAD.
 1.8.12.1 02-Jun-2008  mjf Sync with HEAD.
 1.9.6.1 19-Jan-2009  skrll Sync with HEAD.
 1.9.4.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.12 18-Oct-2015  maxv Make sure we have space for the aout header.
 1.11 29-May-2008  mrg branches: 1.11.42; 1.11.62;
remove clause #3 from my license where there are no other
copyright holders involved.
 1.10 08-Dec-2007  dsl branches: 1.10.12; 1.10.14; 1.10.16; 1.10.18;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.9 16-Mar-2007  dsl branches: 1.9.8; 1.9.10; 1.9.18;
remove all the double (and triple) casts used to convert 32bit userspace
pointers to and from 64bit kernel pointers. Instead use the defines
NETBSD32PTR64(p32) to read a 32bit pointer and (the new) NETBSD32PTR32(p32,p64)
to write a 32bit pointer throughout.
The 32bit pointer is now a struct to enforce the above.
amd64 (with linux emul) and sparc64 will both compile (when the arch stuff
goes in soon), and amd64 still runs some i386 binaries.
 1.8 11-Dec-2005  christos branches: 1.8.26; 1.8.30; 1.8.32; 1.8.34;
merge ktrace-lwp.
 1.7 29-Jun-2003  fvdl branches: 1.7.2; 1.7.18;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.6 29-Jun-2003  martin struct proc * -> struct lwp *
 1.5 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.4 29-Nov-2001  briggs SUNOS_M_NATIVE is now a macro that takes an arg, not a constant.
 1.3 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.2 30-May-2001  mrg branches: 1.2.2;
use _KERNEL_OPT.
 1.1 02-Feb-2001  mrg branches: 1.1.2; 1.1.4;
initial support for sunos binaries running on a 64 bit sparc64 kernel.
some programs work, many do not yet.
 1.1.4.3 08-Jan-2002  nathanw Catch up to -current.
 1.1.4.2 14-Nov-2001  nathanw Catch up to -current.
 1.1.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.1.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.1.2.1 02-Feb-2001  bouyer file sunos32_exec_aout.c was added on branch thorpej_scsipi on 2001-02-11 19:14:31 +0000
 1.2.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.7.18.3 21-Jan-2008  yamt sync with head
 1.7.18.2 03-Sep-2007  yamt sync with head.
 1.7.18.1 21-Jun-2006  yamt sync with head.
 1.7.2.5 04-Feb-2005  skrll Adapt to branch.
 1.7.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.7.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.7.2.2 26-Aug-2004  skrll Adapt to branch.

sparc64 GENERIC compiles.
 1.7.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.8.34.1 18-Mar-2007  reinoud First attempt to bring branch in sync with HEAD
 1.8.32.1 11-Jul-2007  mjf Sync with head.
 1.8.30.1 10-Apr-2007  ad Sync with head.
 1.8.26.1 24-Mar-2007  yamt sync with head.
 1.9.18.1 26-Dec-2007  ad Sync with head.
 1.9.10.1 09-Jan-2008  matt sync with HEAD
 1.9.8.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.10.18.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.10.16.1 04-May-2009  yamt sync with head.
 1.10.14.1 04-Jun-2008  yamt sync with head
 1.10.12.1 02-Jun-2008  mjf Sync with HEAD.
 1.11.62.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.11.42.1 03-Dec-2017  jdolecek update from HEAD
 1.36 07-Sep-2021  riastradh sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.35 23-Apr-2019  msaitoh branches: 1.35.2;
KNF. No functional change.
 1.34 11-Dec-2015  mlelstv branches: 1.34.10; 1.34.18;
PR 50517 bad switch
 1.33 08-Dec-2015  christos Replace DIOCGPART -> DIOCGPARTINFO which returns the data needed instead of
pointers.
 1.32 26-Sep-2015  christos rename sun ioctls
 1.31 05-Sep-2014  nakayama branches: 1.31.2;
Fix previous. There is no uap.
 1.30 05-Sep-2014  matt Try not to use f_data, use f_{vnode,socket,pipe,mqueue,kqueue,ksem} to get
a correctly typed pointer.
 1.29 29-May-2008  mrg branches: 1.29.42;
remove clause #3 from my license where there are no other
copyright holders involved.
 1.28 21-Mar-2008  ad branches: 1.28.2; 1.28.4; 1.28.6;
Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
 1.27 05-Jan-2008  dsl branches: 1.27.6;
Use FILE_LOCK() and FILE_UNLOCK().
Attempt to fix all the code paths so that the 'fp' returned by fd_getfile()
isn't left locked, and is always unlocked (and ref-counted) before
doing anything that might sleep.
 1.26 20-Dec-2007  dsl Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.25 08-Dec-2007  dsl branches: 1.25.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.24 04-Dec-2007  dsl Remove all the __P
 1.23 01-Jun-2007  hannken branches: 1.23.6; 1.23.8; 1.23.14; 1.23.16;
Fallout from last commit:

OSIOCGIFADDR -> OOSIOCGIFADDR
OSIOCGIFDSTADDR -> OOSIOCGIFDSTADDR
OSIOCGIFNETMASK -> OOSIOCGIFNETMASK

Sparc64 compiles again.
 1.22 29-May-2007  christos Add a sockaddr_storage member to "struct ifreq" maintaining backwards
compatibility with the older ioctls. This avoids stack smashing and
abuse of "struct sockaddr" when ioctls placed "struct sockaddr_foo's" that
were longer than "struct sockaddr".
XXX: Some of the emulations might be broken; I tried to add code for
them but I did not test them.
 1.21 12-May-2007  dsl Split the fcntl locking code out from its copyin/out.
Use to avoid all the stackgap stuff in compat code.
 1.20 16-Mar-2007  dsl remove all the double (and triple) casts used to convert 32bit userspace
pointers to and from 64bit kernel pointers. Instead use the defines
NETBSD32PTR64(p32) to read a 32bit pointer and (the new) NETBSD32PTR32(p32,p64)
to write a 32bit pointer throughout.
The 32bit pointer is now a struct to enforce the above.
amd64 (with linux emul) and sparc64 will both compile (when the arch stuff
goes in soon), and amd64 still runs some i386 binaries.
 1.19 04-Mar-2007  christos branches: 1.19.2; 1.19.4; 1.19.6;
fix fallout from caddr_t changes.
 1.18 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.17 09-Feb-2007  ad branches: 1.17.2;
Merge newlock2 to head.
 1.16 11-Dec-2005  christos branches: 1.16.20;
merge ktrace-lwp.
 1.15 31-May-2005  christos branches: 1.15.2;
- add const
- fix shadowed variables
 1.14 25-Apr-2004  matt Constify the speedtab arrays
 1.13 29-Jun-2003  fvdl branches: 1.13.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.12 29-Jun-2003  martin struct proc * -> struct lwp *
 1.11 21-Mar-2003  dsl Change 'data' argument to fo_ioctl and fo_fcntl from 'caddr_t' to 'void *'.
Avoids a lot of casting and removes the need for some line breaks.
Removed a load of (caddr_t) casts from calls to copyin/copyout as well.
(approved by christos - he has a plan to remove caddr_t...)
 1.10 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.9 04-Jan-2003  wiz Spell output with two ts.
 1.8 16-Mar-2002  christos make the stackgap_{init,alloc} functions MP friendly (i.e. pass struct proc *
in, instead of using curproc). While there add an optional size argument to
stackgap_init.
 1.7 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.6 14-Jun-2001  thorpej branches: 1.6.2;
Fix a partial construction problem that can cause race conditions
between creation of a file descriptor and close(2) when using kernel
assisted threads. What we do is stick descriptors in the table, but
mark them as "larval". This causes essentially everything to treat
it as a non-existent descriptor, except for fdalloc(), which sees a
filled slot so that it won't (incorrectly) allocate it again. When
a descriptor is fully constructed, the code that has constructed it
marks it as "mature" (which actually clears the "larval" flag), and
things continue to work as normal.

While here, gather all the code that gets a descriptor from the table
into a fd_getfile() function, and call it, rather than having the
same (sometimes incorrect) code copied all over the place.
 1.5 04-Jun-2001  mrg fix lint exposed by GCC 3.0 20010604 (prerelease).
 1.4 30-May-2001  mrg use _KERNEL_OPT.
 1.3 05-Feb-2001  mrg branches: 1.3.2; 1.3.4;
s/long/netbsd32_long/ in various places. call netbsd32_fcntl, not sys_fcntl.
 1.2 04-Feb-2001  mrg we don't #include ../sunos/sunos_ioctl.c anymore...sigh
 1.1 02-Feb-2001  mrg initial support for sunos binaries running on a 64 bit sparc64 kernel.
some programs work, many do not yet.
 1.3.4.6 07-Jan-2003  thorpej Sync with HEAD.
 1.3.4.5 23-Aug-2002  petrov lwpfication
 1.3.4.4 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.3.4.3 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.3.4.2 14-Nov-2001  nathanw Catch up to -current.
 1.3.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.3.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.3.2.1 05-Feb-2001  bouyer file sunos32_ioctl.c was added on branch thorpej_scsipi on 2001-02-11 19:14:31 +0000
 1.6.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.6.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.13.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.13.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.13.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.13.2.2 26-Aug-2004  skrll Adapt to branch.

sparc64 GENERIC compiles.
 1.13.2.1 03-Aug-2004  skrll Sync with HEAD
 1.15.2.6 24-Mar-2008  yamt sync with head.
 1.15.2.5 21-Jan-2008  yamt sync with head
 1.15.2.4 07-Dec-2007  yamt sync with head
 1.15.2.3 03-Sep-2007  yamt sync with head.
 1.15.2.2 26-Feb-2007  yamt sync with head.
 1.15.2.1 21-Jun-2006  yamt sync with head.
 1.16.20.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.17.2.3 17-May-2007  yamt sync with head.
 1.17.2.2 24-Mar-2007  yamt sync with head.
 1.17.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.19.6.1 18-Mar-2007  reinoud First attempt to bring branch in sync with HEAD
 1.19.4.1 11-Jul-2007  mjf Sync with head.
 1.19.2.3 09-Jun-2007  ad Sync with head.
 1.19.2.2 27-May-2007  ad Sync with head.
 1.19.2.1 10-Apr-2007  ad Sync with head.
 1.23.16.2 26-Dec-2007  ad Sync with head.
 1.23.16.1 08-Dec-2007  ad Sync with head.
 1.23.14.3 18-Feb-2008  mjf Sync with HEAD.
 1.23.14.2 27-Dec-2007  mjf Sync with HEAD.
 1.23.14.1 08-Dec-2007  mjf Sync with HEAD.
 1.23.8.1 09-Jan-2008  matt sync with HEAD
 1.23.6.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.25.4.2 08-Jan-2008  bouyer Sync with HEAD
 1.25.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.27.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.27.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.28.6.3 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.28.6.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.28.6.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.28.4.1 04-May-2009  yamt sync with head.
 1.28.2.1 04-Jun-2008  yamt sync with head
 1.29.42.1 03-Dec-2017  jdolecek update from HEAD
 1.31.2.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.34.18.1 10-Jun-2019  christos Sync with HEAD
 1.34.10.1 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1836):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.35.2.1 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.86 20-Jun-2023  riastradh compat_sunos32: Memset zero before copyout.

Unclear if this can leak anything but let's be on the safe side.

XXX pullup-8
XXX pullup-9
XXX pullup-10
 1.85 07-Sep-2021  riastradh branches: 1.85.4;
sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.84 24-Jun-2020  jdolecek remove special handling for symbolic links for COMPAT_43 lstat, it's
not necessary; this removes the only places in kernel which did namei
LOOKUP with LOCKPARENT

fixes diagnostic KASSERT() in namei() code

Reported-by: syzbot+628382ecf1438e53d08d@syzkaller.appspotmail.com
 1.83 26-Oct-2019  christos use strlcpy() for the uts conversion, makes the code simpler and more readable.
 1.82 23-Sep-2019  christos make this compile again
 1.81 17-Sep-2019  christos Add a boolean argument to indicate if we have a path/true (execve) or an
fd/false (fexecve). This is needed to differentiate between them because
NULL/-1 can be readily passed from userland.
 1.80 17-Sep-2019  mrg pass new missing fd argument to execve1().

fixes sparc64 build.
 1.79 03-Sep-2018  riastradh branches: 1.79.4;
Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.78 28-Jul-2017  riastradh branches: 1.78.2; 1.78.4;
Fail, don't panic, on bad dirents from file system.

Controllable via puffs from userland.

From Ilja Van Sprundel.
 1.77 28-Feb-2016  khorben branches: 1.77.10;
Add missing newline character in error message

This is related to kern/50469.
 1.76 23-Oct-2015  maxv Change do_sys_mount() so that it only takes as argument the type of the
drive instead of its associated vfsops. Makes it more friendly, and allows
compat binaries to autoload VFS modules if needed.

sent on tech-kern@, ok christos@
 1.75 05-Sep-2014  matt branches: 1.75.2;
Try not to use f_data, use f_{vnode,socket,pipe,mqueue,kqueue,ksem} to get
a correctly typed pointer.
 1.74 12-Feb-2012  matt branches: 1.74.2; 1.74.6; 1.74.8; 1.74.16; 1.74.22; 1.74.24; 1.74.28;
Change old-style function defintions to C89 prototypes.

Approved by releng.
 1.73 19-Nov-2010  dholland branches: 1.73.8; 1.73.12;
Introduce struct pathbuf. This is an abstraction to hold a pathname
and the metadata required to interpret it. Callers of namei must now
create a pathbuf and pass it to NDINIT (instead of a string and a
uio_seg), then destroy the pathbuf after the namei session is
complete.

Update all namei call sites accordingly. Add a pathbuf(9) man page and
update namei(9).

The pathbuf interface also now appears in a couple of related
additional places that were passing string/uio_seg pairs that were
later fed into NDINIT. Update other call sites accordingly.
 1.72 24-Jun-2010  hannken Clean up vnode lock operations pass 2:

VOP_UNLOCK(vp, flags) -> VOP_UNLOCK(vp): Remove the unneeded flags argument.

Welcome to 5.99.32.

Discussed on tech-kern.
 1.71 03-Mar-2010  pooka branches: 1.71.2;
Remove nfssvc non-emulations I missed yesterday.
 1.70 03-Mar-2010  martin Add prototype and forward declarations to make the empty nfs stub compile.
 1.69 03-Mar-2010  he When implementing "read directory", when there are too many empty entries
in a row, and we need to try to read the next block, and have passed a
non-NULL cookie pointer to VOP_READDIR, ensure that we free the cookie
buffer before re-doing VOP_READDIR, so that we don't leak memory.
This fix is similar to nfs_serv.c revisions 1.115 + 1.124.

This should fix the long-standing problem observed by e.g. using Linux-
emulated programs to take backup of servers, which is one of the problems
which were reported in PR#42661.

Thanks to pooka@ for the hints for traversing the VOP* layer.
 1.68 02-Mar-2010  pooka remove nfssvc emulation (or non-emulation)
 1.67 29-Jun-2009  dholland branches: 1.67.2;
Convert 67 namei call sites to use namei_simple, in these functions:

check_console, veriexecclose, veriexec_delete, veriexec_file_add,
emul_find_root, coff_load_shlib (sh3 version), coff_load_shlib,
compat_20_sys_statfs, compat_20_netbsd32_statfs,
ELFNAME2(netbsd32,probe_noteless), darwin_sys_statfs,
ibcs2_sys_statfs, ibcs2_sys_statvfs, linux_sys_uselib,
osf1_sys_statfs, sunos_sys_statfs, sunos32_sys_statfs,
ultrix_sys_statfs, do_sys_mount, fss_create_files (3 of 4),
adosfs_mount, cd9660_mount, coda_ioctl, coda_mount, ext2fs_mount,
ffs_mount, filecore_mount, hfs_mount, lfs_mount, msdosfs_mount,
ntfs_mount, sysvbfs_mount, udf_mount, union_mount, sys_chflags,
sys_lchflags, sys_chmod, sys_lchmod, sys_chown, sys_lchown,
sys___posix_chown, sys___posix_lchown, sys_link, do_sys_pstatvfs,
sys_quotactl, sys_revoke, sys_truncate, do_sys_utimes, sys_extattrctl,
sys_extattr_set_file, sys_extattr_set_link, sys_extattr_get_file,
sys_extattr_get_link, sys_extattr_delete_file,
sys_extattr_delete_link, sys_extattr_list_file, sys_extattr_list_link,
sys_setxattr, sys_lsetxattr, sys_getxattr, sys_lgetxattr,
sys_listxattr, sys_llistxattr, sys_removexattr, sys_lremovexattr

All have been scrutinized (several times, in fact) and compile-tested,
but not all have been explicitly tested in action.

XXX: While I haven't (intentionally) changed the use or nonuse of
XXX: TRYEMULROOT in any of these places, I'm not convinced all the
XXX: uses are correct; an audit might be desirable.
 1.66 16-May-2009  nakayama Follow pad to PAD change.
 1.65 11-Jan-2009  nakayama branches: 1.65.2;
Follow christos-time_t merge.
 1.64 19-Nov-2008  ad Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.63 12-Nov-2008  ad Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.
 1.62 07-Aug-2008  plunky branches: 1.62.2; 1.62.4; 1.62.8;
convert some [left behind] compat code to use new sockopt API
 1.61 24-Jun-2008  ad branches: 1.61.2;
Replace references to getsock/getvnode.
 1.60 29-May-2008  mrg branches: 1.60.2;
remove clause #3 from my license where there are no other
copyright holders involved.
 1.59 21-Mar-2008  ad branches: 1.59.2; 1.59.4; 1.59.6;
Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
 1.58 05-Jan-2008  dsl branches: 1.58.6;
Use FILE_LOCK() and FILE_UNLOCK().
Attempt to fix all the code paths so that the 'fp' returned by fd_getfile()
isn't left locked, and is always unlocked (and ref-counted) before
doing anything that might sleep.
 1.57 28-Dec-2007  hannken maxfiles is now an u_int.
 1.56 20-Dec-2007  dsl Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.55 08-Dec-2007  pooka branches: 1.55.4;
Remove cn_lwp from struct componentname. curlwp should be used
from on. The NDINIT() macro no longer takes the lwp parameter and
associates the credentials of the calling thread with the namei
structure.
 1.54 08-Dec-2007  dsl ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.53 04-Dec-2007  dsl Remove all the __P
 1.52 27-Nov-2007  dogcow branches: 1.52.2;
more VFS_STATVFS(x,y,z) fallout; change them to VFS_STATVFS(x,y). (hi, pooka!)
 1.51 17-Jul-2007  christos branches: 1.51.6; 1.51.8; 1.51.14;
include <compat/sys/mount.h> for MFSNAMELEN.
 1.50 12-Jul-2007  dsl Change compat mount code to pass do_sys_mount() kernel resident buffers.
Possibly the standard nfs code needs teaching how to set the length and
address family in order to support non-netbsd sockaddr.
There are now no active stackgap() calls in the compat tree.
 1.49 12-May-2007  dsl Change interface to settimeofday1() so that it can also be used from
compat code in order to avoid the stackgap.
 1.48 22-Apr-2007  dsl Change the way that emulations locate files within the emulation root to
avoid having to allocate space in the 'stackgap'
- which is very LWP unfriendly.
The additional code for non-emulation namei() is trivial, the reduction for
the emulations is massive.
The vnode for a processes emulation root is saved in the cwdi structure
during process exec.
If the emulation root the TRYEMULROOT flag are set, namei() will do an initial
search for absolute pathnames in the emulation root, if that fails it will
retry from the normal root.
".." at the emulation root will always go to the real root, even in the middle
of paths and when expanding symlinks.
Absolute symlinks found using absolute paths in the emulation root will be
relative to the emulation root (so /usr/lib/xxx.so -> /lib/xxx.so links
inside the emulation root don't need changing).
If the root of the emulation would be returned (for an emulation lookup), then
the real root is returned instead (matching the behaviour of emul_lookup,
but being a cheap comparison here) so that programs that scan "../.."
looking for the root dircetory don't loop forever.
The target for symbolic links is no longer mangled (it used to get the
CHECK_ALT_xxx() treatment, so could get /emul/xxx prepended).
CHECK_ALT_xxx() are no more. Most of the change is deleting them, and adding
TRYEMULROOT to the flags to NDINIT().
A lot of the emulation system call stubs could now be deleted.
 1.47 16-Mar-2007  dsl remove all the double (and triple) casts used to convert 32bit userspace
pointers to and from 64bit kernel pointers. Instead use the defines
NETBSD32PTR64(p32) to read a 32bit pointer and (the new) NETBSD32PTR32(p32,p64)
to write a 32bit pointer throughout.
The 32bit pointer is now a struct to enforce the above.
amd64 (with linux emul) and sparc64 will both compile (when the arch stuff
goes in soon), and amd64 still runs some i386 binaries.
 1.46 10-Mar-2007  dsl branches: 1.46.2; 1.46.4;
Update all the compat stuff to not use the 'stackgap' for processing
sys_stat() and friends, instead use do_sys_stat() and do_sys_fstat()
that write the answer into a kernel buffer (on stack) that can be
converted to the correct form and written the userspace.
I've test compiled a few kernels, and tested i386 netbsd1.6 ls.
Given I think I've fixed some bugs, it might be 50-50 with new ones.
 1.45 04-Mar-2007  christos branches: 1.45.2;
fix fallout from caddr_t changes.
 1.44 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.43 09-Feb-2007  ad branches: 1.43.2;
Merge newlock2 to head.
 1.42 14-Nov-2006  elad branches: 1.42.2;
Clean some KAUTH_GENERIC_ISSUSER usage in compat code.
 1.41 01-Sep-2006  matt branches: 1.41.2; 1.41.4;
When calling PTRACE from an LKM, use sysent[SYS_ptrace].sy_call in case
the sys_ptrace symbol isn't present.
 1.40 01-Sep-2006  mrg clean up ptrace changes: #include "opt_ptrace.h"
 1.39 23-Jul-2006  ad Use the LWP cached credentials where sane.
 1.38 26-Jun-2006  mrg version the socket(2) syscall. for compat30 socket, we use
EPROTONOSUPPORT instead of EAFNOSUPPORT.

from pavel@ with a little bit of clean up from myself.

XXX: netbsd32 (and perhaps other emulations) should be able
XXX: to call the standard socket calls for this i think, but
XXX: revisit this at another time.
 1.37 14-May-2006  elad branches: 1.37.4;
integrate kauth.
 1.36 01-Mar-2006  yamt branches: 1.36.2; 1.36.4; 1.36.6;
merge yamt-uio_vmspace branch.

- use vmspace rather than proc or lwp where appropriate.
the latter is more natural to specify an address space.
(and less likely to be abused for random purposes.)
- fix a swdmover race.
 1.35 24-Dec-2005  perry branches: 1.35.2; 1.35.4; 1.35.6;
__inline__ -> inline
 1.34 24-Dec-2005  perry Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.33 11-Dec-2005  christos merge ktrace-lwp.
 1.32 13-Jul-2005  cube Rework sunos32_execv{,e} after removal of netbsd32_execve2.

XXX COMPAT_SUNOS32 needs a SUNOS32PTR64() macro.
 1.31 31-May-2005  christos branches: 1.31.2;
- fix 32 -> 64 pointer casts properly.
- add const
- fix shadow
 1.30 19-Apr-2005  christos PR/29696: Joel Carnat: NetBSD freezes when accessing smbfs mounted FS with
firefox/linux due to compat getdents() call assumption that all filesystems
support cookies.
 1.29 26-Feb-2005  perry branches: 1.29.2;
nuke trailing whitespace
 1.28 17-Sep-2004  skrll branches: 1.28.4; 1.28.6;
There's no need to pass a proc value when using UIO_SYSSPACE with
vn_rdwr(9) and uiomove(9).

OK'd by Jason Thorpe
 1.27 25-Apr-2004  matt Constify a few read-only arrays/variables.
 1.26 22-Apr-2004  hannken Fix statfs->statvfs fallout.
 1.25 21-Apr-2004  christos Replace the statfs() family of system calls with statvfs().
Retain binary compatibility.
 1.24 21-Oct-2003  kleink Don't use NULL in integer-type assignments/comparisons.
 1.23 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.22 29-Jun-2003  fvdl branches: 1.22.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.21 29-Jun-2003  martin struct proc * -> struct lwp *
 1.20 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.19 17-May-2003  nakayama Avoid strict-ailas warnings in gcc 3.3;
refer to change of sys/compat/netbsd32/netbsd32_netbsd.c r1.67 to r1.69.
 1.18 16-May-2003  itojun use strlcpy
[compat/svr4_32 should have bound check for SVR4_32_AUX_ARGSIZ]
 1.17 29-Jan-2003  atatat Cull unused variables. Sigh.

PS - Cross compilers are cool.
 1.16 28-Jan-2003  atatat No need to pick a "default address" for mmap in compat code, since we
merely call sys_mmap() at the end anyway, and that will pick the
address for us, if it's needed.

Likewise for checking if /dev/zero is being mapped.
 1.15 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.14 06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.13 04-Jul-2002  thorpej Add kernel support for having userland provide the signal trampoline:

* struct sigacts gets a new sigact_sigdesc structure, which has the
sigaction and the trampoline/version. Version 0 means "legacy kernel
provided trampoline". Other versions are coordinated with machine-
dependent code in libc.
* sigaction1() grows two more arguments -- the trampoline pointer and
the trampoline version.
* A new __sigaction_sigtramp() system call is provided to register a
trampoline along with a signal handler.
* The handler is no longer passed to sensig() functions. Instead,
sendsig() looks up the handler by peeking in the sigacts for the
process getting the signal (since it has to look in there for the
trampoline anyway).
* Native sendsig() functions now select the appropriate trampoline and
its arguments based on the trampoline version in the sigacts.

Changes to libc to use the new facility will be checked in later. Kernel
version not bumped; we will ride the 1.6C bump made recently.
 1.12 16-Mar-2002  christos branches: 1.12.4;
make the stackgap_{init,alloc} functions MP friendly (i.e. pass struct proc *
in, instead of using curproc). While there add an optional size argument to
stackgap_init.
 1.11 03-Jan-2002  mrg move the COMPAT_SUNOS SO_BROADCAST hack out of uipc_socket.c into the
compat/sunos code. besides being cleaner this allows the sunos LKM
to properly work without any special kernel hacks.
 1.10 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.9 14-Jun-2001  thorpej branches: 1.9.2; 1.9.4;
Fix a partial construction problem that can cause race conditions
between creation of a file descriptor and close(2) when using kernel
assisted threads. What we do is stick descriptors in the table, but
mark them as "larval". This causes essentially everything to treat
it as a non-existent descriptor, except for fdalloc(), which sees a
filled slot so that it won't (incorrectly) allocate it again. When
a descriptor is fully constructed, the code that has constructed it
marks it as "mature" (which actually clears the "larval" flag), and
things continue to work as normal.

While here, gather all the code that gets a descriptor from the table
into a fd_getfile() function, and call it, rather than having the
same (sometimes incorrect) code copied all over the place.
 1.8 30-May-2001  mrg use _KERNEL_OPT.
 1.7 07-Feb-2001  mrg branches: 1.7.2; 1.7.4;
use the standard alt check for creat.
 1.6 06-Feb-2001  mrg use struct sunos32_dirent. now getwd() works.
 1.5 06-Feb-2001  mrg stat/lstat must use netbsd32_stat43 not stat43.
 1.4 05-Feb-2001  mrg make sunos32_sys_stime() & sunos32_sys_sigvec() work.
 1.3 04-Feb-2001  mrg clean up sunos32_sys_mmap(), modelling it more like netbsd32_mmap()
 1.2 02-Feb-2001  mrg implement stat & fstat properly.
 1.1 02-Feb-2001  mrg initial support for sunos binaries running on a 64 bit sparc64 kernel.
some programs work, many do not yet.
 1.7.4.9 17-Sep-2002  nathanw Catch up to -current.
 1.7.4.8 23-Aug-2002  petrov lwpfication
 1.7.4.7 01-Aug-2002  nathanw Catch up to -current.
 1.7.4.6 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.7.4.5 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.7.4.4 28-Feb-2002  nathanw Catch up to -current.
 1.7.4.3 11-Jan-2002  nathanw More catchup.
 1.7.4.2 14-Nov-2001  nathanw Catch up to -current.
 1.7.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.7.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.7.2.1 07-Feb-2001  bouyer file sunos32_misc.c was added on branch thorpej_scsipi on 2001-02-11 19:14:32 +0000
 1.9.4.1 26-Sep-2001  fvdl * add a VCLONED vnode flag that indicates a vnode representing a cloned
device.
* rename REVOKEALL to REVOKEALIAS, and add a REVOKECLONE flag, to pass
to VOP_REVOKE
* the revoke system call will revoke all aliases, as before, but not the
clones
* vdevgone is called when detaching a device, so make it use REVOKECLONE
to get rid of all clones as well
* clean up all uses of VOP_OPEN wrt. locking.
* add a few VOPS to spec_vnops that need to do something when it's a
clone vnode (access and getattr)
* add a copy of the vnode vattr structure of the original 'master' vnode
to the specinfo of a cloned vnode. could possibly redirect getattr to
the 'master' vnode, but this has issues with revoke
* add a vdev_reassignvp function that disassociates a vnode from its
original device, and reassociates it with the specified dev_t. to be
used by cloning devices only, in case a new minor is allocated.
* change all direct references in drivers to v_devcookie and v_rdev
to vdev_privdata(vp) and vdev_rdev(vp). for diagnostic purposes
when debugging race conditions that still exist wrt. locking and
revoking vnodes.
* make the locking state of a vnode consistent when passed to
d_open and d_close (unlocked). locked would be better, but has
some deadlock issues
 1.9.2.4 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.9.2.3 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.9.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.9.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.12.4.2 15-Jul-2002  gehenna catch up with -current.
 1.12.4.1 16-May-2002  gehenna Get rid of iszerodev. Use the 'zerodev' (dev_t for /dev/zero).
 1.22.2.7 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.22.2.6 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.22.2.5 21-Sep-2004  skrll Fix the sync with head I botched.
 1.22.2.4 18-Sep-2004  skrll Sync with HEAD.
 1.22.2.3 26-Aug-2004  skrll Adapt to branch.

sparc64 GENERIC compiles.
 1.22.2.2 03-Aug-2004  skrll Sync with HEAD
 1.22.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.28.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.28.4.1 29-Apr-2005  kent sync with -current
 1.29.2.1 01-Oct-2005  tron Pull up following revision(s) (requested by christos in ticket #838):
sys/compat/svr4/svr4_misc.c: revision 1.112
sys/compat/ibcs2/ibcs2_misc.c: revision 1.74
sys/compat/linux/common/linux_misc.c: revision 1.136
sys/compat/irix/irix_dirent.c: revision 1.14
sys/compat/sunos/sunos_misc.c: revision 1.132
sys/compat/svr4_32/svr4_32_misc.c: revision 1.31
sys/compat/sunos32/sunos32_misc.c: revision 1.30
sys/compat/linux/common/linux_file64.c: revision 1.26
PR/29696: Joel Carnat: NetBSD freezes when accessing smbfs mounted FS with
firefox/linux due to compat getdents() call assumption that all filesystems
support cookies.
 1.31.2.7 24-Mar-2008  yamt sync with head.
 1.31.2.6 21-Jan-2008  yamt sync with head
 1.31.2.5 07-Dec-2007  yamt sync with head
 1.31.2.4 03-Sep-2007  yamt sync with head.
 1.31.2.3 26-Feb-2007  yamt sync with head.
 1.31.2.2 30-Dec-2006  yamt sync with head.
 1.31.2.1 21-Jun-2006  yamt sync with head.
 1.35.6.2 01-Jun-2006  kardel Sync with head.
 1.35.6.1 22-Apr-2006  simonb Sync with head.
 1.35.4.1 09-Sep-2006  rpaulo sync with head
 1.35.2.1 18-Feb-2006  yamt adapt the rest of MI code.
 1.36.6.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.36.4.3 12-May-2006  elad adapt to kauth kpi, include sys/kauth.h where needed..
 1.36.4.2 10-Mar-2006  elad generic_authorize() -> kauth_authorize_generic().
 1.36.4.1 08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.36.2.3 03-Sep-2006  yamt sync with head.
 1.36.2.2 11-Aug-2006  yamt sync with head
 1.36.2.1 24-May-2006  yamt sync with head.
 1.37.4.1 13-Jul-2006  gdamore Merge from HEAD.
 1.41.4.1 10-Dec-2006  yamt sync with head.
 1.41.2.3 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.41.2.2 11-Jan-2007  ad Checkpoint work in progress.
 1.41.2.1 18-Nov-2006  ad Sync with head.
 1.42.2.1 12-Jun-2010  riz Pull up following revision(s) (requested by he in ticket #1387):
sys/compat/svr4/svr4_misc.c: revision 1.149
sys/compat/linux/common/linux_misc.c: revision 1.214
sys/compat/common/vfs_syscalls_30.c: revision 1.31
sys/compat/sunos/sunos_misc.c: revision 1.166
sys/compat/linux/common/linux_file64.c: revision 1.50
sys/compat/svr4_32/svr4_32_misc.c: revision 1.68
sys/compat/ibcs2/ibcs2_misc.c: revision 1.110
sys/compat/linux32/common/linux32_dirent.c: revision 1.10
sys/compat/sunos32/sunos32_misc.c: revision 1.69
sys/compat/irix/irix_dirent.c: revision 1.24
sys/compat/osf1/osf1_file.c: revision 1.38
When implementing "read directory", when there are too many empty entries
in a row, and we need to try to read the next block, and have passed a
non-NULL cookie pointer to VOP_READDIR, ensure that we free the cookie
buffer before re-doing VOP_READDIR, so that we don't leak memory.
This fix is similar to nfs_serv.c revisions 1.115 + 1.124.
This should fix the long-standing problem observed by e.g. using Linux-
emulated programs to take backup of servers, which is one of the problems
which were reported in PR#42661.
Thanks to pooka@ for the hints for traversing the VOP* layer.
 1.43.2.4 17-May-2007  yamt sync with head.
 1.43.2.3 07-May-2007  yamt sync with head.
 1.43.2.2 24-Mar-2007  yamt sync with head.
 1.43.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.45.2.5 20-Aug-2007  ad Sync with HEAD.
 1.45.2.4 15-Jul-2007  ad Sync with head.
 1.45.2.3 27-May-2007  ad Sync with head.
 1.45.2.2 10-Apr-2007  ad Sync with head.
 1.45.2.1 13-Mar-2007  ad Sync with head.
 1.46.4.1 18-Mar-2007  reinoud First attempt to bring branch in sync with HEAD
 1.46.2.1 11-Jul-2007  mjf Sync with head.
 1.51.14.3 18-Feb-2008  mjf Sync with HEAD.
 1.51.14.2 27-Dec-2007  mjf Sync with HEAD.
 1.51.14.1 08-Dec-2007  mjf Sync with HEAD.
 1.51.8.1 09-Jan-2008  matt sync with HEAD
 1.51.6.2 09-Dec-2007  jmcneill Sync with HEAD.
 1.51.6.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.52.2.2 26-Dec-2007  ad Sync with head.
 1.52.2.1 08-Dec-2007  ad Sync with head.
 1.55.4.2 08-Jan-2008  bouyer Sync with HEAD
 1.55.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.58.6.5 17-Jan-2009  mjf Sync with HEAD.
 1.58.6.4 28-Sep-2008  mjf Sync with HEAD.
 1.58.6.3 29-Jun-2008  mjf Sync with HEAD.
 1.58.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.58.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.59.6.4 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.59.6.3 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.59.6.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.59.6.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.59.4.5 11-Aug-2010  yamt sync with head.
 1.59.4.4 11-Mar-2010  yamt sync with head
 1.59.4.3 18-Jul-2009  yamt sync with head.
 1.59.4.2 20-Jun-2009  yamt sync with head
 1.59.4.1 04-May-2009  yamt sync with head.
 1.59.2.1 04-Jun-2008  yamt sync with head
 1.60.2.1 27-Jun-2008  simonb Sync with head.
 1.61.2.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.61.2.1 19-Oct-2008  haad Sync with HEAD.
 1.62.8.1 21-Apr-2010  matt sync to netbsd-5
 1.62.4.1 17-Mar-2010  snj Pull up following revision(s) (requested by he in ticket #1323):
sys/compat/common/vfs_syscalls_30.c: revision 1.31
sys/compat/ibcs2/ibcs2_misc.c: revision 1.110
sys/compat/irix/irix_dirent.c: revision 1.24
sys/compat/linux/common/linux_file64.c: revision 1.50
sys/compat/linux/common/linux_misc.c: revision 1.214
sys/compat/linux32/common/linux32_dirent.c: revision 1.10
sys/compat/sunos/sunos_misc.c: revision 1.166
sys/compat/sunos32/sunos32_misc.c: revision 1.69
sys/compat/svr4/svr4_misc.c: revision 1.149
sys/compat/svr4_32/svr4_32_misc.c: revision 1.68
When implementing "read directory", when there are too many empty entries
in a row, and we need to try to read the next block, and have passed a
non-NULL cookie pointer to VOP_READDIR, ensure that we free the cookie
buffer before re-doing VOP_READDIR, so that we don't leak memory.
This fix is similar to nfs_serv.c revisions 1.115 + 1.124.
This should fix the long-standing problem observed by e.g. using Linux-
emulated programs to take backup of servers, which is one of the problems
which were reported in PR#42661.
Thanks to pooka@ for the hints for traversing the VOP* layer.
 1.62.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.65.2.1 23-Jul-2009  jym Sync with HEAD.
 1.67.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.67.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.71.2.2 05-Mar-2011  rmind sync with head
 1.71.2.1 03-Jul-2010  rmind sync with head
 1.73.12.1 18-Feb-2012  mrg merge to -current.
 1.73.8.1 17-Apr-2012  yamt sync with head
 1.74.28.1 12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1479):
sys/compat/common/vfs_syscalls_12.c: revision 1.34
sys/rump/kern/lib/libsys_sunos/rump_sunos_compat.c: revision 1.2
sys/compat/svr4_32/svr4_32_misc.c: revision 1.78
sys/compat/sunos32/sunos32_misc.c: revision 1.78
sys/compat/linux/common/linux_misc.c: revision 1.239
sys/compat/osf1/osf1_file.c: revision 1.44
sys/compat/common/vfs_syscalls_43.c: revision 1.60
sys/compat/svr4/svr4_misc.c: revision 1.158
sys/compat/ibcs2/ibcs2_misc.c: revision 1.114
sys/compat/linux/common/linux_file64.c: revision 1.59
sys/compat/linux32/common/linux32_dirent.c: revision 1.18
sys/compat/sunos/sunos_misc.c: revision 1.171
Fail, don't panic, on bad dirents from file system.
Controllable via puffs from userland.
From Ilja Van Sprundel.
 1.74.24.1 12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1479):
sys/compat/common/vfs_syscalls_12.c: revision 1.34
sys/rump/kern/lib/libsys_sunos/rump_sunos_compat.c: revision 1.2
sys/compat/svr4_32/svr4_32_misc.c: revision 1.78
sys/compat/sunos32/sunos32_misc.c: revision 1.78
sys/compat/linux/common/linux_misc.c: revision 1.239
sys/compat/osf1/osf1_file.c: revision 1.44
sys/compat/common/vfs_syscalls_43.c: revision 1.60
sys/compat/svr4/svr4_misc.c: revision 1.158
sys/compat/ibcs2/ibcs2_misc.c: revision 1.114
sys/compat/linux/common/linux_file64.c: revision 1.59
sys/compat/linux32/common/linux32_dirent.c: revision 1.18
sys/compat/sunos/sunos_misc.c: revision 1.171
Fail, don't panic, on bad dirents from file system.
Controllable via puffs from userland.
From Ilja Van Sprundel.
 1.74.22.1 12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1479):
sys/compat/common/vfs_syscalls_12.c: revision 1.34
sys/rump/kern/lib/libsys_sunos/rump_sunos_compat.c: revision 1.2
sys/compat/svr4_32/svr4_32_misc.c: revision 1.78
sys/compat/sunos32/sunos32_misc.c: revision 1.78
sys/compat/linux/common/linux_misc.c: revision 1.239
sys/compat/osf1/osf1_file.c: revision 1.44
sys/compat/common/vfs_syscalls_43.c: revision 1.60
sys/compat/svr4/svr4_misc.c: revision 1.158
sys/compat/ibcs2/ibcs2_misc.c: revision 1.114
sys/compat/linux/common/linux_file64.c: revision 1.59
sys/compat/linux32/common/linux32_dirent.c: revision 1.18
sys/compat/sunos/sunos_misc.c: revision 1.171
Fail, don't panic, on bad dirents from file system.
Controllable via puffs from userland.
From Ilja Van Sprundel.
 1.74.16.1 19-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1483):
sys/compat/common/vfs_syscalls_12.c: revision 1.34
sys/compat/svr4_32/svr4_32_misc.c: revision 1.78
sys/compat/sunos32/sunos32_misc.c: revision 1.78
sys/compat/linux/common/linux_misc.c: revision 1.239
sys/compat/osf1/osf1_file.c: revision 1.44
sys/compat/common/vfs_syscalls_43.c: revision 1.60
sys/compat/svr4/svr4_misc.c: revision 1.158
sys/compat/ibcs2/ibcs2_misc.c: revision 1.114
sys/compat/linux/common/linux_file64.c: revision 1.59
sys/compat/linux32/common/linux32_dirent.c: revision 1.18
sys/compat/sunos/sunos_misc.c: revision 1.171
Fail, don't panic, on bad dirents from file system.
Controllable via puffs from userland.
From Ilja Van Sprundel.
 1.74.8.1 19-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1483):
sys/compat/common/vfs_syscalls_12.c: revision 1.34
sys/compat/svr4_32/svr4_32_misc.c: revision 1.78
sys/compat/sunos32/sunos32_misc.c: revision 1.78
sys/compat/linux/common/linux_misc.c: revision 1.239
sys/compat/osf1/osf1_file.c: revision 1.44
sys/compat/common/vfs_syscalls_43.c: revision 1.60
sys/compat/svr4/svr4_misc.c: revision 1.158
sys/compat/ibcs2/ibcs2_misc.c: revision 1.114
sys/compat/linux/common/linux_file64.c: revision 1.59
sys/compat/linux32/common/linux32_dirent.c: revision 1.18
sys/compat/sunos/sunos_misc.c: revision 1.171
Fail, don't panic, on bad dirents from file system.
Controllable via puffs from userland.
From Ilja Van Sprundel.
 1.74.6.1 03-Dec-2017  jdolecek update from HEAD
 1.74.2.1 19-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1483):
sys/compat/common/vfs_syscalls_12.c: revision 1.34
sys/compat/svr4_32/svr4_32_misc.c: revision 1.78
sys/compat/sunos32/sunos32_misc.c: revision 1.78
sys/compat/linux/common/linux_misc.c: revision 1.239
sys/compat/osf1/osf1_file.c: revision 1.44
sys/compat/common/vfs_syscalls_43.c: revision 1.60
sys/compat/svr4/svr4_misc.c: revision 1.158
sys/compat/ibcs2/ibcs2_misc.c: revision 1.114
sys/compat/linux/common/linux_file64.c: revision 1.59
sys/compat/linux32/common/linux32_dirent.c: revision 1.18
sys/compat/sunos/sunos_misc.c: revision 1.171
Fail, don't panic, on bad dirents from file system.
Controllable via puffs from userland.
From Ilja Van Sprundel.
 1.75.2.3 28-Aug-2017  skrll Sync with HEAD
 1.75.2.2 19-Mar-2016  skrll Sync with HEAD
 1.75.2.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.77.10.3 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1841):

sys/compat/sunos32/sunos32_misc.c: revision 1.86
sys/compat/ossaudio/ossaudio.c: revision 1.85
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.48

compat_sunos32: Memset zero before copyout.

Unclear if this can leak anything but let's be on the safe side.

compat_ossaudio: Zero-initialize idat before copyout.
Unclear if there are any paths to the copyout without initialization,
but let's play it safe to keep the auditing effort low.

linux32_rt_sendsig: Memset zero before copyout.
Not sure if there's any padding here, but it's a pretty big
structure, fairly likely, so let's be rather safe than sorry.
 1.77.10.2 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1836):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.77.10.1 09-Aug-2017  snj Pull up following revision(s) (requested by spz in ticket #193):
sys/compat/common/vfs_syscalls_12.c: revision 1.34
sys/rump/kern/lib/libsys_sunos/rump_sunos_compat.c: revision 1.2
sys/compat/svr4_32/svr4_32_misc.c: revision 1.78
sys/compat/sunos32/sunos32_misc.c: revision 1.78
sys/compat/linux/common/linux_misc.c: revision 1.239
sys/compat/osf1/osf1_file.c: revision 1.44
sys/compat/common/vfs_syscalls_43.c: revision 1.60
sys/compat/svr4/svr4_misc.c: revision 1.158
sys/compat/ibcs2/ibcs2_misc.c: revision 1.114
sys/compat/linux/common/linux_file64.c: revision 1.59
sys/compat/linux32/common/linux32_dirent.c: revision 1.18
sys/compat/sunos/sunos_misc.c: revision 1.171
Fail, don't panic, on bad dirents from file system.
Controllable via puffs from userland.
From Ilja Van Sprundel.
 1.78.4.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.78.4.1 10-Jun-2019  christos Sync with HEAD
 1.78.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.79.4.2 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1650):

sys/compat/sunos32/sunos32_misc.c: revision 1.86
sys/compat/ossaudio/ossaudio.c: revision 1.85
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.48

compat_sunos32: Memset zero before copyout.

Unclear if this can leak anything but let's be on the safe side.

compat_ossaudio: Zero-initialize idat before copyout.
Unclear if there are any paths to the copyout without initialization,
but let's play it safe to keep the auditing effort low.

linux32_rt_sendsig: Memset zero before copyout.
Not sure if there's any padding here, but it's a pretty big
structure, fairly likely, so let's be rather safe than sorry.
 1.79.4.1 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.85.4.1 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #204):

sys/compat/sunos32/sunos32_misc.c: revision 1.86
sys/compat/ossaudio/ossaudio.c: revision 1.85
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.48

compat_sunos32: Memset zero before copyout.

Unclear if this can leak anything but let's be on the safe side.

compat_ossaudio: Zero-initialize idat before copyout.
Unclear if there are any paths to the copyout without initialization,
but let's play it safe to keep the auditing effort low.

linux32_rt_sendsig: Memset zero before copyout.
Not sure if there's any padding here, but it's a pretty big
structure, fairly likely, so let's be rather safe than sorry.
 1.7 12-Dec-2019  pgoyette Rather than keeping a separate mutex, condvar, and pserialize for each
module hook, we can share a common set of synchronization structures.
This cuts the amount of cacheline_aligned data for these structures by
50%.

Note that we still have a per-hook localcount, since we need to count
individual references.

As discussed with riastradh@

Welcome to 9.99.22 !
 1.6 01-Mar-2019  pgoyette Rename the MODULE_*_HOOK() macros to MODULE_HOOK_*() as briefly
discussed on irc.

NFCI intended.

Ride the earlier kernel bump - it;s getting crowded.
 1.5 05-Feb-2019  pgoyette The sunos and sunos32 modules require compat_09, not compat (the
latter no longer exists).

Should fix "missing prerequisite" errors seen during qemu boot
of sparc64's MODULAR kernel.
 1.4 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.3 07-Mar-2014  christos branches: 1.3.28; 1.3.30;
c99 initializers for struct execsw
 1.2 19-Sep-2013  christos exec modules need to be of the exec kind
 1.1 19-Nov-2008  ad branches: 1.1.4; 1.1.6; 1.1.8; 1.1.12; 1.1.24; 1.1.34; 1.1.38;
Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.1.38.1 18-May-2014  rmind sync with head
 1.1.34.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.24.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.1.12.2 04-May-2009  yamt sync with head.
 1.1.12.1 19-Nov-2008  yamt file sunos32_mod.c was added on branch yamt-nfs-mp on 2009-05-04 08:12:27 +0000
 1.1.8.2 19-Jan-2009  skrll Sync with HEAD.
 1.1.8.1 19-Nov-2008  skrll file sunos32_mod.c was added on branch nick-hppapmap on 2009-01-19 13:17:40 +0000
 1.1.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.1.6.1 19-Nov-2008  mjf file sunos32_mod.c was added on branch mjf-devfs2 on 2009-01-17 13:28:48 +0000
 1.1.4.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.1.4.1 19-Nov-2008  haad file sunos32_mod.c was added on branch haad-dm on 2008-12-13 01:14:04 +0000
 1.3.30.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.3.30.1 10-Jun-2019  christos Sync with HEAD
 1.3.28.3 23-Jan-2019  pgoyette Convert the macros for setting and unsetting a hook to generate
in-line code rather than using an intermediary hook##set routine.
Hooks are set and unset only in one place, so the intermediary
routine provides no benefit. IMHO using the macro at the point-
of-call is more readable than using it elsewhere in the code and
then calling the generated intermediary routine (for which you
won't even find its declaration or definition unless you remember
to search for the HOOK_SET macro instead).

NFC intended, will verify with a bulk build and an atf test run.
 1.3.28.2 18-Oct-2018  pgoyette Add a few more references to the (currently always but not forever)
built-in compat_util module
 1.3.28.1 02-Oct-2018  pgoyette Use a hook callback to allow sparc fpu code to determine if a process
is running under sunos emulation (in which case, fpu cleanup uses a
different set of fpu_codes[]).
 1.38 10-Aug-2018  pgoyette Regen
 1.37 06-Jan-2018  kamil branches: 1.37.2; 1.37.4;
Revert vadvise(2) removal

This system call was used in legacy Lisp code, that was inherited to modern
age and still compiled against supported compat layers (e.g. in clisp,
oaklisp, Franz Lisp).

It used to instruct the kernel about paging policy (G/C aware, flush etc).

Newly compiled code (assuming that it will detect vadvise()) will use the
libc stub for vadvise(). The headers for this interface are gone.

vadvise(2) could be marked as COMPAT_80, but as long as we support ultrix,
sunos or aout68k ABI, don't bother with this.

Requested by <mrg>
 1.36 19-Dec-2017  kamil compat/sunos32: Drop SYS_vadvise

The (o)vadvise syscall is dummy since the beginning of NetBSD.

Sponsored by <The NetBSD Foundation>
 1.35 19-Dec-2017  kamil compat/sunos32: Drop SYS_sbrk

sbrk - change data segment size

This syscall is dummy since the inception of the project.

Sponsored by <The NetBSD Foundation>
 1.34 19-Dec-2017  kamil compat sunos32: Drop the sstk(2) syscall

sstk(2) has never been implemented by the NetBSD kernel.

Sponsored by <The NetBSD Foundation>
 1.33 10-May-2017  riastradh regen
 1.32 16-Jan-2017  christos branches: 1.32.4;
regen
 1.31 13-Jan-2017  christos branches: 1.31.2;
regen
 1.30 24-Sep-2015  christos branches: 1.30.2;
regen
 1.29 07-Mar-2015  christos regen
 1.28 07-Nov-2013  njoly branches: 1.28.6;
Regen for dup/dup2/dup3 argument types fix.
 1.27 02-Mar-2010  pooka branches: 1.27.10; 1.27.20; 1.27.24;
regen:
- remove nfssvc / fs_nfs.h / #ifdef NFS
- make getfh unconditional
 1.26 14-Dec-2009  matt branches: 1.26.2;
Regen (new makesyscalls.sh)
 1.25 13-Jan-2009  pooka Regen to prove I didn't screw up the conversion: purely RCSID changes.
 1.24 13-Jan-2009  pooka regen
 1.23 11-Jan-2009  nakayama Regen for following christos-time_t merge.
 1.22 19-Nov-2008  ad Regen.
 1.21 20-Dec-2007  dsl branches: 1.21.6; 1.21.10; 1.21.16; 1.21.18;
regen
 1.20 04-Mar-2007  christos branches: 1.20.16; 1.20.24; 1.20.28;
fix fallout from caddr_t changes.
 1.19 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.18 13-Jul-2006  pavel branches: 1.18.10;
regen
 1.17 11-Dec-2005  christos branches: 1.17.4; 1.17.8;
merge ktrace-lwp.
 1.16 27-Sep-2005  chs regen
 1.15 26-Feb-2005  perry branches: 1.15.4;
regen
 1.14 26-Feb-2005  perry regen
 1.13 26-Oct-2003  christos branches: 1.13.8; 1.13.10;
Regen
 1.12 18-Jan-2003  thorpej branches: 1.12.2;
Regen for correct RCS ID.
 1.11 18-Jan-2003  thorpej Regen: Merge the nathanw_sa branch.
 1.10 01-Nov-2002  jdolecek set nsysent to 256
 1.9 29-Apr-2002  mrg regenerate.
 1.8 03-Jan-2002  mrg regen
 1.7 03-Jan-2002  mrg move the COMPAT_SUNOS SO_BROADCAST hack out of uipc_socket.c into the
compat/sunos code. besides being cleaner this allows the sunos LKM
to properly work without any special kernel hacks.
 1.6 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.5 30-May-2001  mrg branches: 1.5.2;
use _KERNEL_OPT.
 1.4 06-Feb-2001  mrg branches: 1.4.2; 1.4.4;
regen
 1.3 05-Feb-2001  mrg regen
 1.2 04-Feb-2001  mrg regen
 1.1 02-Feb-2001  mrg generate.
 1.4.4.6 11-Nov-2002  nathanw Catch up to -current
 1.4.4.5 29-May-2002  nathanw Regen.
 1.4.4.4 28-Feb-2002  nathanw Catch up to -current.
 1.4.4.3 11-Jan-2002  nathanw More catchup.
 1.4.4.2 14-Nov-2001  nathanw Catch up to -current.
 1.4.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.4.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.4.2.1 06-Feb-2001  bouyer file sunos32_syscall.h was added on branch thorpej_scsipi on 2001-02-11 19:14:32 +0000
 1.5.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.5.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.12.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.12.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.12.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.12.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.12.2.1 03-Aug-2004  skrll Sync with HEAD
 1.13.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.13.8.1 29-Apr-2005  kent sync with -current
 1.15.4.4 21-Jan-2008  yamt sync with head
 1.15.4.3 03-Sep-2007  yamt sync with head.
 1.15.4.2 30-Dec-2006  yamt sync with head.
 1.15.4.1 21-Jun-2006  yamt sync with head.
 1.17.8.1 11-Aug-2006  yamt sync with head
 1.17.4.1 09-Sep-2006  rpaulo sync with head
 1.18.10.1 12-Mar-2007  rmind Sync with HEAD.
 1.20.28.1 02-Jan-2008  bouyer Sync with HEAD
 1.20.24.1 26-Dec-2007  ad Sync with head.
 1.20.16.1 09-Jan-2008  matt sync with HEAD
 1.21.18.1 19-Jan-2009  skrll Sync with HEAD.
 1.21.16.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.21.10.2 11-Mar-2010  yamt sync with head
 1.21.10.1 04-May-2009  yamt sync with head.
 1.21.6.1 17-Jan-2009  mjf Sync with HEAD.
 1.26.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.27.24.1 18-May-2014  rmind sync with head
 1.27.20.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.27.10.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.28.6.1 06-Apr-2015  skrll Sync with HEAD
 1.30.2.1 20-Mar-2017  pgoyette Sync with HEAD
 1.31.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.32.4.1 11-May-2017  pgoyette Sync with HEAD
 1.37.4.1 10-Jun-2019  christos Sync with HEAD
 1.37.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.37 10-Aug-2018  pgoyette Regen
 1.36 06-Jan-2018  kamil branches: 1.36.2; 1.36.4;
Revert vadvise(2) removal

This system call was used in legacy Lisp code, that was inherited to modern
age and still compiled against supported compat layers (e.g. in clisp,
oaklisp, Franz Lisp).

It used to instruct the kernel about paging policy (G/C aware, flush etc).

Newly compiled code (assuming that it will detect vadvise()) will use the
libc stub for vadvise(). The headers for this interface are gone.

vadvise(2) could be marked as COMPAT_80, but as long as we support ultrix,
sunos or aout68k ABI, don't bother with this.

Requested by <mrg>
 1.35 19-Dec-2017  kamil compat/sunos32: Drop SYS_vadvise

The (o)vadvise syscall is dummy since the beginning of NetBSD.

Sponsored by <The NetBSD Foundation>
 1.34 19-Dec-2017  kamil compat/sunos32: Drop SYS_sbrk

sbrk - change data segment size

This syscall is dummy since the inception of the project.

Sponsored by <The NetBSD Foundation>
 1.33 19-Dec-2017  kamil compat sunos32: Drop the sstk(2) syscall

sstk(2) has never been implemented by the NetBSD kernel.

Sponsored by <The NetBSD Foundation>
 1.32 10-May-2017  riastradh regen
 1.31 16-Jan-2017  christos branches: 1.31.4;
regen
 1.30 13-Jan-2017  christos branches: 1.30.2;
regen
 1.29 24-Sep-2015  christos branches: 1.29.2;
regen
 1.28 07-Mar-2015  christos regen
 1.27 07-Nov-2013  njoly branches: 1.27.6;
Regen for dup/dup2/dup3 argument types fix.
 1.26 02-Mar-2010  pooka branches: 1.26.10; 1.26.20; 1.26.24;
regen:
- remove nfssvc / fs_nfs.h / #ifdef NFS
- make getfh unconditional
 1.25 14-Dec-2009  matt branches: 1.25.2;
Regen (new makesyscalls.sh)
 1.24 13-Jan-2009  pooka Regen to prove I didn't screw up the conversion: purely RCSID changes.
 1.23 13-Jan-2009  pooka regen
 1.22 11-Jan-2009  nakayama Regen for following christos-time_t merge.
 1.21 19-Nov-2008  ad Regen.
 1.20 20-Dec-2007  dsl branches: 1.20.6; 1.20.10; 1.20.16; 1.20.18;
regen
 1.19 04-Mar-2007  christos branches: 1.19.16; 1.19.24; 1.19.28;
fix fallout from caddr_t changes.
 1.18 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.17 13-Jul-2006  pavel branches: 1.17.10;
regen
 1.16 11-Dec-2005  christos branches: 1.16.4; 1.16.8;
merge ktrace-lwp.
 1.15 27-Sep-2005  chs regen
 1.14 26-Feb-2005  perry branches: 1.14.4;
regen
 1.13 26-Feb-2005  perry regen
 1.12 26-Oct-2003  christos branches: 1.12.8; 1.12.10;
Regen
 1.11 18-Jan-2003  thorpej branches: 1.11.2;
Regen for correct RCS ID.
 1.10 18-Jan-2003  thorpej Regen: Merge the nathanw_sa branch.
 1.9 29-Apr-2002  mrg regenerate.
 1.8 03-Jan-2002  mrg regen
 1.7 03-Jan-2002  mrg move the COMPAT_SUNOS SO_BROADCAST hack out of uipc_socket.c into the
compat/sunos code. besides being cleaner this allows the sunos LKM
to properly work without any special kernel hacks.
 1.6 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.5 30-May-2001  mrg branches: 1.5.2;
use _KERNEL_OPT.
 1.4 06-Feb-2001  mrg branches: 1.4.2; 1.4.4;
regen
 1.3 05-Feb-2001  mrg regen
 1.2 04-Feb-2001  mrg regen
 1.1 02-Feb-2001  mrg generate.
 1.4.4.6 20-Jun-2002  nathanw Catch up to -current.
 1.4.4.5 29-May-2002  nathanw Regen.
 1.4.4.4 28-Feb-2002  nathanw Catch up to -current.
 1.4.4.3 11-Jan-2002  nathanw More catchup.
 1.4.4.2 14-Nov-2001  nathanw Catch up to -current.
 1.4.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.4.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.4.2.1 06-Feb-2001  bouyer file sunos32_syscallargs.h was added on branch thorpej_scsipi on 2001-02-11 19:14:33 +0000
 1.5.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.5.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.11.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.11.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.11.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.11.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.11.2.1 03-Aug-2004  skrll Sync with HEAD
 1.12.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.12.8.1 29-Apr-2005  kent sync with -current
 1.14.4.4 21-Jan-2008  yamt sync with head
 1.14.4.3 03-Sep-2007  yamt sync with head.
 1.14.4.2 30-Dec-2006  yamt sync with head.
 1.14.4.1 21-Jun-2006  yamt sync with head.
 1.16.8.1 11-Aug-2006  yamt sync with head
 1.16.4.1 09-Sep-2006  rpaulo sync with head
 1.17.10.1 12-Mar-2007  rmind Sync with HEAD.
 1.19.28.1 02-Jan-2008  bouyer Sync with HEAD
 1.19.24.1 26-Dec-2007  ad Sync with head.
 1.19.16.1 09-Jan-2008  matt sync with HEAD
 1.20.18.1 19-Jan-2009  skrll Sync with HEAD.
 1.20.16.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.20.10.2 11-Mar-2010  yamt sync with head
 1.20.10.1 04-May-2009  yamt sync with head.
 1.20.6.1 17-Jan-2009  mjf Sync with HEAD.
 1.25.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.26.24.1 18-May-2014  rmind sync with head
 1.26.20.2 03-Dec-2017  jdolecek update from HEAD
 1.26.20.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.26.10.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.27.6.2 28-Aug-2017  skrll Sync with HEAD
 1.27.6.1 06-Apr-2015  skrll Sync with HEAD
 1.29.2.1 20-Mar-2017  pgoyette Sync with HEAD
 1.30.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.31.4.1 11-May-2017  pgoyette Sync with HEAD
 1.36.4.1 10-Jun-2019  christos Sync with HEAD
 1.36.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.37 10-Aug-2018  pgoyette Regen
 1.36 06-Jan-2018  kamil branches: 1.36.2; 1.36.4;
Revert vadvise(2) removal

This system call was used in legacy Lisp code, that was inherited to modern
age and still compiled against supported compat layers (e.g. in clisp,
oaklisp, Franz Lisp).

It used to instruct the kernel about paging policy (G/C aware, flush etc).

Newly compiled code (assuming that it will detect vadvise()) will use the
libc stub for vadvise(). The headers for this interface are gone.

vadvise(2) could be marked as COMPAT_80, but as long as we support ultrix,
sunos or aout68k ABI, don't bother with this.

Requested by <mrg>
 1.35 19-Dec-2017  kamil compat/sunos32: Drop SYS_vadvise

The (o)vadvise syscall is dummy since the beginning of NetBSD.

Sponsored by <The NetBSD Foundation>
 1.34 19-Dec-2017  kamil compat/sunos32: Drop SYS_sbrk

sbrk - change data segment size

This syscall is dummy since the inception of the project.

Sponsored by <The NetBSD Foundation>
 1.33 19-Dec-2017  kamil compat sunos32: Drop the sstk(2) syscall

sstk(2) has never been implemented by the NetBSD kernel.

Sponsored by <The NetBSD Foundation>
 1.32 10-May-2017  riastradh regen
 1.31 16-Jan-2017  christos branches: 1.31.4;
regen
 1.30 13-Jan-2017  christos branches: 1.30.2;
regen
 1.29 24-Sep-2015  christos branches: 1.29.2;
regen
 1.28 07-Mar-2015  christos regen
 1.27 07-Nov-2013  njoly branches: 1.27.6;
Regen for dup/dup2/dup3 argument types fix.
 1.26 02-Mar-2010  pooka branches: 1.26.10; 1.26.20; 1.26.24;
regen:
- remove nfssvc / fs_nfs.h / #ifdef NFS
- make getfh unconditional
 1.25 14-Dec-2009  matt branches: 1.25.2;
Regen (new makesyscalls.sh)
 1.24 13-Jan-2009  pooka Regen to prove I didn't screw up the conversion: purely RCSID changes.
 1.23 13-Jan-2009  pooka regen
 1.22 11-Jan-2009  nakayama Regen for following christos-time_t merge.
 1.21 19-Nov-2008  ad Regen.
 1.20 20-Dec-2007  dsl branches: 1.20.6; 1.20.10; 1.20.16; 1.20.18;
regen
 1.19 04-Mar-2007  christos branches: 1.19.16; 1.19.24; 1.19.28;
fix fallout from caddr_t changes.
 1.18 09-Feb-2007  ad branches: 1.18.2;
Merge newlock2 to head.
 1.17 13-Jul-2006  pavel branches: 1.17.4;
regen
 1.16 11-Dec-2005  christos branches: 1.16.4; 1.16.8;
merge ktrace-lwp.
 1.15 27-Sep-2005  chs regen
 1.14 26-Feb-2005  perry branches: 1.14.4;
regen
 1.13 26-Feb-2005  perry regen
 1.12 26-Oct-2003  christos branches: 1.12.8; 1.12.10;
Regen
 1.11 18-Jan-2003  thorpej branches: 1.11.2;
Regen for correct RCS ID.
 1.10 18-Jan-2003  thorpej Regen: Merge the nathanw_sa branch.
 1.9 29-Apr-2002  mrg regenerate.
 1.8 03-Jan-2002  mrg regen
 1.7 03-Jan-2002  mrg move the COMPAT_SUNOS SO_BROADCAST hack out of uipc_socket.c into the
compat/sunos code. besides being cleaner this allows the sunos LKM
to properly work without any special kernel hacks.
 1.6 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.5 30-May-2001  mrg branches: 1.5.2;
use _KERNEL_OPT.
 1.4 06-Feb-2001  mrg branches: 1.4.2; 1.4.4;
regen
 1.3 05-Feb-2001  mrg regen
 1.2 04-Feb-2001  mrg regen
 1.1 02-Feb-2001  mrg generate.
 1.4.4.5 29-May-2002  nathanw Regen.
 1.4.4.4 28-Feb-2002  nathanw Catch up to -current.
 1.4.4.3 11-Jan-2002  nathanw More catchup.
 1.4.4.2 14-Nov-2001  nathanw Catch up to -current.
 1.4.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.4.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.4.2.1 06-Feb-2001  bouyer file sunos32_syscalls.c was added on branch thorpej_scsipi on 2001-02-11 19:14:33 +0000
 1.5.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.5.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.11.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.11.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.11.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.11.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.11.2.1 03-Aug-2004  skrll Sync with HEAD
 1.12.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.12.8.1 29-Apr-2005  kent sync with -current
 1.14.4.5 21-Jan-2008  yamt sync with head
 1.14.4.4 03-Sep-2007  yamt sync with head.
 1.14.4.3 26-Feb-2007  yamt sync with head.
 1.14.4.2 30-Dec-2006  yamt sync with head.
 1.14.4.1 21-Jun-2006  yamt sync with head.
 1.16.8.1 11-Aug-2006  yamt sync with head
 1.16.4.1 09-Sep-2006  rpaulo sync with head
 1.17.4.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.18.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.19.28.1 02-Jan-2008  bouyer Sync with HEAD
 1.19.24.1 26-Dec-2007  ad Sync with head.
 1.19.16.1 09-Jan-2008  matt sync with HEAD
 1.20.18.1 19-Jan-2009  skrll Sync with HEAD.
 1.20.16.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.20.10.2 11-Mar-2010  yamt sync with head
 1.20.10.1 04-May-2009  yamt sync with head.
 1.20.6.1 17-Jan-2009  mjf Sync with HEAD.
 1.25.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.26.24.1 18-May-2014  rmind sync with head
 1.26.20.2 03-Dec-2017  jdolecek update from HEAD
 1.26.20.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.26.10.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.27.6.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.27.6.1 06-Apr-2015  skrll Sync with HEAD
 1.29.2.1 20-Mar-2017  pgoyette Sync with HEAD
 1.30.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.31.4.1 11-May-2017  pgoyette Sync with HEAD
 1.36.4.1 10-Jun-2019  christos Sync with HEAD
 1.36.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.39 10-Aug-2018  pgoyette Regen
 1.38 06-Jan-2018  kamil branches: 1.38.2; 1.38.4;
Revert vadvise(2) removal

This system call was used in legacy Lisp code, that was inherited to modern
age and still compiled against supported compat layers (e.g. in clisp,
oaklisp, Franz Lisp).

It used to instruct the kernel about paging policy (G/C aware, flush etc).

Newly compiled code (assuming that it will detect vadvise()) will use the
libc stub for vadvise(). The headers for this interface are gone.

vadvise(2) could be marked as COMPAT_80, but as long as we support ultrix,
sunos or aout68k ABI, don't bother with this.

Requested by <mrg>
 1.37 19-Dec-2017  kamil compat/sunos32: Drop SYS_vadvise

The (o)vadvise syscall is dummy since the beginning of NetBSD.

Sponsored by <The NetBSD Foundation>
 1.36 19-Dec-2017  kamil compat/sunos32: Drop SYS_sbrk

sbrk - change data segment size

This syscall is dummy since the inception of the project.

Sponsored by <The NetBSD Foundation>
 1.35 19-Dec-2017  kamil compat sunos32: Drop the sstk(2) syscall

sstk(2) has never been implemented by the NetBSD kernel.

Sponsored by <The NetBSD Foundation>
 1.34 10-May-2017  riastradh regen
 1.33 16-Jan-2017  christos branches: 1.33.4;
regen
 1.32 13-Jan-2017  christos branches: 1.32.2;
regen
 1.31 24-Sep-2015  christos branches: 1.31.2;
regen
 1.30 07-Mar-2015  christos regen
 1.29 07-Nov-2013  njoly branches: 1.29.6;
Regen for dup/dup2/dup3 argument types fix.
 1.28 02-Mar-2010  pooka branches: 1.28.10; 1.28.20; 1.28.24;
regen:
- remove nfssvc / fs_nfs.h / #ifdef NFS
- make getfh unconditional
 1.27 14-Dec-2009  matt branches: 1.27.2;
Regen (new makesyscalls.sh)
 1.26 13-Jan-2009  pooka Regen to prove I didn't screw up the conversion: purely RCSID changes.
 1.25 13-Jan-2009  pooka regen
 1.24 11-Jan-2009  nakayama Regen for following christos-time_t merge.
 1.23 19-Nov-2008  ad Regen.
 1.22 20-Dec-2007  dsl branches: 1.22.6; 1.22.10; 1.22.16; 1.22.18;
regen
 1.21 04-Mar-2007  christos branches: 1.21.16; 1.21.24; 1.21.28;
fix fallout from caddr_t changes.
 1.20 09-Feb-2007  ad branches: 1.20.2;
Merge newlock2 to head.
 1.19 13-Jul-2006  pavel branches: 1.19.4;
regen
 1.18 13-Jul-2006  martin COMPAT_SUNOS* uses COMPAT_30 getfh too
 1.17 11-Dec-2005  christos branches: 1.17.4; 1.17.8;
merge ktrace-lwp.
 1.16 27-Sep-2005  chs regen
 1.15 26-Feb-2005  perry branches: 1.15.4;
regen
 1.14 26-Feb-2005  perry regen
 1.13 26-Oct-2003  christos branches: 1.13.8; 1.13.10;
Regen
 1.12 18-Jan-2003  thorpej branches: 1.12.2;
Regen for correct RCS ID.
 1.11 18-Jan-2003  thorpej Regen: Merge the nathanw_sa branch.
 1.10 01-Nov-2002  jdolecek set nsysent to 256
 1.9 29-Apr-2002  mrg regenerate.
 1.8 03-Jan-2002  mrg regen
 1.7 03-Jan-2002  mrg move the COMPAT_SUNOS SO_BROADCAST hack out of uipc_socket.c into the
compat/sunos code. besides being cleaner this allows the sunos LKM
to properly work without any special kernel hacks.
 1.6 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.5 30-May-2001  mrg branches: 1.5.2;
use _KERNEL_OPT.
 1.4 06-Feb-2001  mrg branches: 1.4.2; 1.4.4;
regen
 1.3 05-Feb-2001  mrg regen
 1.2 04-Feb-2001  mrg regen
 1.1 02-Feb-2001  mrg generate.
 1.4.4.7 11-Nov-2002  nathanw Catch up to -current
 1.4.4.6 20-Jun-2002  nathanw Catch up to -current.
 1.4.4.5 29-May-2002  nathanw Regen.
 1.4.4.4 28-Feb-2002  nathanw Catch up to -current.
 1.4.4.3 11-Jan-2002  nathanw More catchup.
 1.4.4.2 14-Nov-2001  nathanw Catch up to -current.
 1.4.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.4.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.4.2.1 06-Feb-2001  bouyer file sunos32_sysent.c was added on branch thorpej_scsipi on 2001-02-11 19:14:33 +0000
 1.5.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.5.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.12.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.12.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.12.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.12.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.12.2.1 03-Aug-2004  skrll Sync with HEAD
 1.13.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.13.8.1 29-Apr-2005  kent sync with -current
 1.15.4.5 21-Jan-2008  yamt sync with head
 1.15.4.4 03-Sep-2007  yamt sync with head.
 1.15.4.3 26-Feb-2007  yamt sync with head.
 1.15.4.2 30-Dec-2006  yamt sync with head.
 1.15.4.1 21-Jun-2006  yamt sync with head.
 1.17.8.1 11-Aug-2006  yamt sync with head
 1.17.4.1 09-Sep-2006  rpaulo sync with head
 1.19.4.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.20.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.21.28.1 02-Jan-2008  bouyer Sync with HEAD
 1.21.24.1 26-Dec-2007  ad Sync with head.
 1.21.16.1 09-Jan-2008  matt sync with HEAD
 1.22.18.1 19-Jan-2009  skrll Sync with HEAD.
 1.22.16.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.22.10.2 11-Mar-2010  yamt sync with head
 1.22.10.1 04-May-2009  yamt sync with head.
 1.22.6.1 17-Jan-2009  mjf Sync with HEAD.
 1.27.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.28.24.1 18-May-2014  rmind sync with head
 1.28.20.2 03-Dec-2017  jdolecek update from HEAD
 1.28.20.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.28.10.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.29.6.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.29.6.1 06-Apr-2015  skrll Sync with HEAD
 1.31.2.1 20-Mar-2017  pgoyette Sync with HEAD
 1.32.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.33.4.1 11-May-2017  pgoyette Sync with HEAD
 1.38.4.1 10-Jun-2019  christos Sync with HEAD
 1.38.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.2 01-Nov-2002  jdolecek set nsysent to 256
 1.1 02-Feb-2001  mrg branches: 1.1.2; 1.1.4;
initial support for sunos binaries running on a 64 bit sparc64 kernel.
some programs work, many do not yet.
 1.1.4.1 11-Nov-2002  nathanw Catch up to -current
 1.1.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.1.2.1 02-Feb-2001  bouyer file syscalls.conf was added on branch thorpej_scsipi on 2001-02-11 19:14:34 +0000
 1.26 06-Jan-2018  kamil Revert vadvise(2) removal

This system call was used in legacy Lisp code, that was inherited to modern
age and still compiled against supported compat layers (e.g. in clisp,
oaklisp, Franz Lisp).

It used to instruct the kernel about paging policy (G/C aware, flush etc).

Newly compiled code (assuming that it will detect vadvise()) will use the
libc stub for vadvise(). The headers for this interface are gone.

vadvise(2) could be marked as COMPAT_80, but as long as we support ultrix,
sunos or aout68k ABI, don't bother with this.

Requested by <mrg>
 1.25 19-Dec-2017  kamil compat/sunos32: Drop SYS_vadvise

The (o)vadvise syscall is dummy since the beginning of NetBSD.

Sponsored by <The NetBSD Foundation>
 1.24 19-Dec-2017  kamil compat/sunos32: Drop SYS_sbrk

sbrk - change data segment size

This syscall is dummy since the inception of the project.

Sponsored by <The NetBSD Foundation>
 1.23 19-Dec-2017  kamil compat sunos32: Drop the sstk(2) syscall

sstk(2) has never been implemented by the NetBSD kernel.

Sponsored by <The NetBSD Foundation>
 1.22 07-Nov-2013  njoly Fix dup/dup2/dup3 argument types (u_int -> int).
 1.21 02-Mar-2010  pooka branches: 1.21.10; 1.21.20; 1.21.24;
Kill fs_nfs.h and #ifdef NFS by making getfh() support unconditional
and nfssvc unsupport unconditional. nfs server was just a fancy
NOP anyway for all except Ultrix. I know I'm boring but I couldn't
imagine why someone would want to run an Ultrix nfs server (and I
also doubt that it would work anymore with all the changes to fs
exporting etc).
 1.20 13-Jan-2009  pooka branches: 1.20.4;
Convert the syscalls.master to a format from which it is easier
to parse and generate the compat name and basename (e.g. __stat50
and stat). Use this to autogenerate __RENAME()'s to the rump_syscalls
header so that they can be called e.g. rump_sys_socket() instead
of rump_sys___socket30().
 1.19 13-Jan-2009  pooka UNIMPL police
 1.18 11-Jan-2009  nakayama Follow christos-time_t merge.
 1.17 19-Nov-2008  ad Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.16 04-Mar-2007  christos branches: 1.16.36; 1.16.40; 1.16.42; 1.16.46; 1.16.50;
fix fallout from caddr_t changes.
 1.15 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.14 09-Feb-2007  ad Merge newlock2 to head.
 1.13 13-Jul-2006  pavel branches: 1.13.4;
request the COMPAT_30 getfh in the master files. (Changes to the generated
ones would be lost.)
 1.12 11-Dec-2005  christos branches: 1.12.4; 1.12.8;
merge ktrace-lwp.
 1.11 27-Sep-2005  chs include "opt_compat_sunos.h", netbsd32_syscallargs.h wants it.
 1.10 26-Feb-2005  perry branches: 1.10.4;
nuke trailing whitespace
 1.9 18-Jan-2003  thorpej branches: 1.9.2; 1.9.10; 1.9.12;
Merge the nathanw_sa branch.
 1.8 29-Apr-2002  mrg build the netbsd32_compat* objects into libcompat.a, so they are available
to emulations not just netbsd itself. rename the compat_10 functions to
match everything else. fixes a problem reported by julian coleman.
 1.7 03-Jan-2002  mrg ooops, socket() and socketpair() need args now.
 1.6 03-Jan-2002  mrg move the COMPAT_SUNOS SO_BROADCAST hack out of uipc_socket.c into the
compat/sunos code. besides being cleaner this allows the sunos LKM
to properly work without any special kernel hacks.
 1.5 30-May-2001  mrg branches: 1.5.2;
use _KERNEL_OPT.
 1.4 06-Feb-2001  mrg branches: 1.4.2; 1.4.4;
oops, use netbsd32_select().
 1.3 05-Feb-2001  mrg use sunos32_sys_sigreturn
 1.2 04-Feb-2001  mrg s/long/netbsd32_long/ in sunos32_sys_mmap(). noted by chuq.
 1.1 02-Feb-2001  mrg initial support for sunos binaries running on a 64 bit sparc64 kernel.
some programs work, many do not yet.
 1.4.4.5 20-Jun-2002  nathanw Catch up to -current.
 1.4.4.4 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.4.4.3 28-Feb-2002  nathanw Catch up to -current.
 1.4.4.2 11-Jan-2002  nathanw More catchup.
 1.4.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.4.2.2 11-Feb-2001  bouyer Sync with HEAD.
 1.4.2.1 06-Feb-2001  bouyer file syscalls.master was added on branch thorpej_scsipi on 2001-02-11 19:14:34 +0000
 1.5.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.5.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.9.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.9.10.1 29-Apr-2005  kent sync with -current
 1.9.2.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.9.2.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.10.4.3 26-Feb-2007  yamt sync with head.
 1.10.4.2 30-Dec-2006  yamt sync with head.
 1.10.4.1 21-Jun-2006  yamt sync with head.
 1.12.8.1 11-Aug-2006  yamt sync with head
 1.12.4.1 09-Sep-2006  rpaulo sync with head
 1.13.4.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.16.50.1 19-Jan-2009  skrll Sync with HEAD.
 1.16.46.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.16.42.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.16.42.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.16.40.2 11-Mar-2010  yamt sync with head
 1.16.40.1 04-May-2009  yamt sync with head.
 1.16.36.1 17-Jan-2009  mjf Sync with HEAD.
 1.20.4.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.21.24.1 18-May-2014  rmind sync with head
 1.21.20.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.21.10.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.1 18-Mar-2018  christos branches: 1.1.2;
factor out the ccd COMPAT_60 code.
 1.1.2.2 18-Mar-2018  pgoyette Import compat_60 changes for dev/ccd
 1.1.2.1 18-Mar-2018  pgoyette file ccdvar.h was added on branch pgoyette-compat on 2018-03-18 21:41:31 +0000
 1.5 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.4 06-Sep-2015  dholland branches: 1.4.16; 1.4.18;
More on PR 41200: headers that declare ioctls should include sys/ioccom.h.
This covers (I think) all the MI headers outside of external/ (and dist/).
 1.3 04-Jan-2012  apb branches: 1.3.6; 1.3.24;
Provide a COMPAT_50 version of the CLOCKCTL_NTP_ADJTIME ioctl.
When time_t was changed from 32 to 64 bits, this ioctl's number
was changed from _IOWR('C', 0x4, struct clockctl_ntp_adjtime)
to _IOWR('C', 0x8, struct clockctl_ntp_adjtime), but the data
structure did not change, so all the compat code has to do is
change the number and try again.
 1.2 11-Jan-2009  christos branches: 1.2.2; 1.2.4; 1.2.18; 1.2.22;
merge christos-time_t
 1.1 29-Mar-2008  christos branches: 1.1.2; 1.1.6;
file clockctl.h was initially added on branch christos-time_t.
 1.1.6.1 04-May-2009  yamt sync with head.
 1.1.2.1 29-Mar-2008  christos new files
 1.2.22.1 18-Feb-2012  mrg merge to -current.
 1.2.18.1 17-Apr-2012  yamt sync with head
 1.2.4.2 19-Jan-2009  skrll Sync with HEAD.
 1.2.4.1 11-Jan-2009  skrll file clockctl.h was added on branch nick-hppapmap on 2009-01-19 13:17:44 +0000
 1.2.2.2 17-Jan-2009  mjf Sync with HEAD.
 1.2.2.1 11-Jan-2009  mjf file clockctl.h was added on branch mjf-devfs2 on 2009-01-17 13:28:49 +0000
 1.3.24.1 22-Sep-2015  skrll Sync with HEAD
 1.3.6.1 03-Dec-2017  jdolecek update from HEAD
 1.4.18.1 10-Jun-2019  christos Sync with HEAD
 1.4.16.1 21-Mar-2018  pgoyette Split the compat_50 code out from the dev/clockctl driver and include
it in the compat_50 and compat modules.
 1.10 27-Jan-2019  christos remove extra ifdef.
 1.9 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.8 18-Mar-2018  christos branches: 1.8.2;
include compat/sys/cpuio.h and multiple include protection.
 1.7 18-Mar-2018  christos finish MD glue for compat ucode module.
 1.6 17-Mar-2018  christos redo the cpu ucode compat code.
 1.5 06-Sep-2015  dholland branches: 1.5.16;
More on PR 41200: headers that declare ioctls should include sys/ioccom.h.
This covers (I think) all the MI headers outside of external/ (and dist/).
 1.4 29-Aug-2012  drochner branches: 1.4.2; 1.4.16;
Extend the CPU microcode update framework to support Intel x86 CPUs.
Contrary to the AMD implementation, it doesn't use xcalls to distribute
the update to all CPUs but relies on cpuctl(8) to bind itself to the
right CPU -- to keep it simple and avoid possible problems with
hyperthreading.
Also, it doesn't parse the vendor supplied file to pick the right
part for the present CPU model but relies on userland to prepare
files with specific filenames. I'll commit a pkg for this in a minute
(pkgsrc/sysutils/intel-microcode).
The ioctl interface changed; compatibility is provided (should be
limited to COMPAT_NETBSD6 as soon as this is available).
 1.3 19-Apr-2009  ad branches: 1.3.10;
cpuctl:

- Add interrupt shielding (direct hardware interrupts away from the
specified CPUs). Not documented just yet but will be soon.

- Redo /dev/cpu time_t compat so no kernel changes are needed.

x86:

- Make intr_establish, intr_disestablish safe to use when !cold.

- Distribute hardware interrupts among the CPUs, instead of directing
everything to the boot CPU.

- Add MD code for interrupt sheilding. This works in most cases but there is
a bug where delivery is not accepted by an LAPIC after redistribution. It
also needs re-balancing to make things fair after interrupts are turned
back on for a CPU.
 1.2 19-Jan-2009  njoly branches: 1.2.2; 1.2.4;
Fix typo in compat ioctl name.
 1.1 19-Jan-2009  christos provide compat_50
 1.2.4.3 28-Apr-2009  skrll Sync with HEAD.
 1.2.4.2 03-Mar-2009  skrll Sync with HEAD.
 1.2.4.1 19-Jan-2009  skrll file cpuio.h was added on branch nick-hppapmap on 2009-03-03 18:30:30 +0000
 1.2.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.3.10.1 30-Oct-2012  yamt sync with head
 1.4.16.1 22-Sep-2015  skrll Sync with HEAD
 1.4.2.1 03-Dec-2017  jdolecek update from HEAD
 1.5.16.6 22-Mar-2018  pgoyette Synch with HEAD, resolve conflicts
 1.5.16.5 18-Mar-2018  pgoyette Merge changes from HEAD into ccd_60.c

For all of the individual xxx_60_{init,fini} routines, don't force
them to artificially return a status; just make them void. This
simplifies the compat_60_{init,fini} handling of errors that remain.
 1.5.16.4 18-Mar-2018  pgoyette Clean-up for kern_cpu_60 code.

Also, although not strictly necessary, include the kern_sa_60 stuff in
the compat_60 module, for completeness.

Still need to deal with some tty code and the ccd driver to finish off
the compat_60 module.
 1.5.16.3 18-Mar-2018  pgoyette Import from -current the MD glue code for compat cpu_ucode
 1.5.16.2 17-Mar-2018  pgoyette Add copyright, protect against double-inclusion
 1.5.16.1 17-Mar-2018  pgoyette Import christos's changes for the compat_60 cpu_ucode stuff
 1.8.2.1 10-Jun-2019  christos Sync with HEAD
 1.3 28-Jan-2014  christos add a struct for the 4.3BSD struct direct
 1.2 11-Dec-2005  christos branches: 1.2.18; 1.2.112; 1.2.118; 1.2.122; 1.2.124; 1.2.128; 1.2.134;
merge ktrace-lwp.
 1.1 13-Sep-2005  christos branches: 1.1.6;
compat code reorg.
 1.1.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.6.1 13-Sep-2005  skrll file dirent.h was added on branch ktrace-lwp on 2005-11-10 14:01:40 +0000
 1.2.134.1 12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1469):
sys/compat/common/vfs_syscalls_12.c: revision 1.30
sys/compat/common/vfs_syscalls_43.c: revision 1.56
sys/compat/sys/dirent.h: revision 1.3
It is wishful thinking that vn_readdir will return dirent12 structures.
--
Fix the compat-4.3 getdirentries call (pre d_type). This is used in NetBSD-0.9.
--
add a struct for the 4.3BSD struct direct
 1.2.128.1 18-May-2014  rmind sync with head
 1.2.124.1 12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1469):
sys/compat/common/vfs_syscalls_12.c: revision 1.30
sys/compat/common/vfs_syscalls_43.c: revision 1.56
sys/compat/sys/dirent.h: revision 1.3
It is wishful thinking that vn_readdir will return dirent12 structures.
--
Fix the compat-4.3 getdirentries call (pre d_type). This is used in NetBSD-0.9.
--
add a struct for the 4.3BSD struct direct
 1.2.122.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.118.1 12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1469):
sys/compat/common/vfs_syscalls_12.c: revision 1.30
sys/compat/common/vfs_syscalls_43.c: revision 1.56
sys/compat/sys/dirent.h: revision 1.3
It is wishful thinking that vn_readdir will return dirent12 structures.
--
Fix the compat-4.3 getdirentries call (pre d_type). This is used in NetBSD-0.9.
--
add a struct for the 4.3BSD struct direct
 1.2.112.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.2.18.2 21-Jun-2006  yamt sync with head.
 1.2.18.1 11-Dec-2005  yamt file dirent.h was added on branch yamt-lazymbuf on 2006-06-21 15:00:00 +0000
 1.5 04-Apr-2025  riastradh compat/sys/event.h: Add struct timespec50 forward declaration.

Needed below by function prototypes.

PR lib/59240: POSIX.1-2024: cancellation point audit
 1.4 29-Jul-2023  rin branches: 1.4.6;
Sprinkle __inline to compat_100___kevent50_{fetch_changes,put_events}
 1.3 28-Jul-2023  christos Add epoll(2) from Theodore Preduta as part of GSoC 2023
 1.2 11-Jan-2009  christos branches: 1.2.2; 1.2.4; 1.2.8;
merge christos-time_t
 1.1 09-Nov-2008  christos branches: 1.1.2;
file event.h was initially added on branch christos-time_t.
 1.1.2.1 09-Nov-2008  christos fix kevent
 1.2.8.2 04-May-2009  yamt sync with head.
 1.2.8.1 11-Jan-2009  yamt file event.h was added on branch yamt-nfs-mp on 2009-05-04 08:12:28 +0000
 1.2.4.2 19-Jan-2009  skrll Sync with HEAD.
 1.2.4.1 11-Jan-2009  skrll file event.h was added on branch nick-hppapmap on 2009-01-19 13:17:44 +0000
 1.2.2.2 17-Jan-2009  mjf Sync with HEAD.
 1.2.2.1 11-Jan-2009  mjf file event.h was added on branch mjf-devfs2 on 2009-01-17 13:28:49 +0000
 1.4.6.1 02-Aug-2025  perseant Sync with HEAD
 1.1 08-Mar-2018  pgoyette branches: 1.1.2;
file if.h was initially added on branch pgoyette-compat.
 1.1.2.2 15-Oct-2018  pgoyette Convert a couple more hooks to the MP-safe mechanism.

While here, clean up some headers and remove any that are now empty.
 1.1.2.1 08-Mar-2018  pgoyette Handle ifconf() compat vectors
 1.7 21-Feb-2019  mrg include libkern.h or strings.h. should fix i386 build issues.
 1.6 21-Feb-2019  mrg for sysv ipc stat operations, explicitly copy the exported parts
instead of the whole ds structure.

besides triggering a recently added assert in netbsd32, this stops
exposing kernel addresses.

copy the mode clamping to 0777 from sem to shm and msg.


while here, make sure that the compat callers to sysv_ipc clear
the contents of the compat structure before setting the result
members to ensure padding bytes are cleared.

don't set/copy _sem_base, _msg_first, _msg_last or _shm_internal.
even if used, which seems very dodgy, they leak KVAs as well.
possibly this may affect linux binaries, in particular, the
comments around _shm_internal ("XXX Oh well.") may mean apps
rely upon these but hopefully not -- the comments date back to
rev 1.1 in 1995.

the _key, _seq and _msg_cbytes members are exported as before as
i found multiple consumers of these (no less than ipcs(1), and
they appear to be useful for debugging and more.


XXX: the naming of compat functions have too many styles. there
are at least 3 different ones changed here.
 1.5 19-Apr-2018  christos branches: 1.5.2;
s/static inline/static __inline/g for consistency.
 1.4 24-May-2011  joerg branches: 1.4.30; 1.4.34; 1.4.42; 1.4.48; 1.4.54;
Give the body the same static inline treatment as the definition
 1.3 19-Jan-2009  christos branches: 1.3.6; 1.3.8;
Provide compatibility for pre-christos-time_t sysv sysctls.
 1.2 11-Jan-2009  christos merge christos-time_t
 1.1 11-Nov-2005  christos branches: 1.1.4; 1.1.22; 1.1.76; 1.1.80; 1.1.90; 1.1.94;
Move more compat stuff from sys.
 1.1.94.1 09-Nov-2008  christos garbage collect all the conversion functions and put them in the header
files so that userland can share them. Also fix bugs in them!
 1.1.90.2 03-Mar-2009  skrll Sync with HEAD.
 1.1.90.1 19-Jan-2009  skrll Sync with HEAD.
 1.1.80.1 04-May-2009  yamt sync with head.
 1.1.76.1 17-Jan-2009  mjf Sync with HEAD.
 1.1.22.2 21-Jun-2006  yamt sync with head.
 1.1.22.1 11-Nov-2005  yamt file ipc.h was added on branch yamt-lazymbuf on 2006-06-21 15:00:00 +0000
 1.1.4.2 11-Dec-2005  christos Sync with head.
 1.1.4.1 11-Nov-2005  christos file ipc.h was added on branch ktrace-lwp on 2005-12-11 10:28:47 +0000
 1.3.8.1 06-Jun-2011  jruoho Sync with HEAD.
 1.3.6.1 31-May-2011  rmind sync with head
 1.4.54.1 22-Apr-2018  pgoyette Sync with HEAD
 1.4.48.1 23-Feb-2019  martin Pull up following revision(s) (requested by mrg in ticket #1195):
sys/compat/sys/ipc.h: revision 1.6
sys/compat/sys/ipc.h: revision 1.7
sys/compat/sys/shm.h: revision 1.8
sys/kern/sysv_shm.c: revision 1.133
sys/compat/sys/sem.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.56
sys/compat/netbsd32/netbsd32_conv.h: revision 1.38
sys/kern/sysv_sem.c: revision 1.96
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.28
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.29
sys/compat/linux32/common/linux32_ipccall.c: revision 1.12
sys/kern/sysv_msg.c: revision 1.73
sys/compat/sys/msg.h: revision 1.6

for sysv ipc stat operations, explicitly copy the exported parts
instead of the whole ds structure.
besides triggering a recently added assert in netbsd32, this stops
exposing kernel addresses.

copy the mode clamping to 0777 from sem to shm and msg.

while here, make sure that the compat callers to sysv_ipc clear
the contents of the compat structure before setting the result
members to ensure padding bytes are cleared.

don't set/copy _sem_base, _msg_first, _msg_last or _shm_internal.
even if used, which seems very dodgy, they leak KVAs as well.
possibly this may affect linux binaries, in particular, the
comments around _shm_internal ("XXX Oh well.") may mean apps
rely upon these but hopefully not -- the comments date back to
rev 1.1 in 1995.

the _key, _seq and _msg_cbytes members are exported as before as
i found multiple consumers of these (no less than ipcs(1), and
they appear to be useful for debugging and more.

XXX: the naming of compat functions have too many styles. there
are at least 3 different ones changed here.

fix naming errors in previous. (this file is no longer compiled, but
this fix makes the pull up more obvious, before deleting this file.)

include libkern.h or strings.h. should fix i386 build issues.
 1.4.42.1 23-Feb-2019  martin Pull up following revision(s) (requested by mrg in ticket #1679):
sys/compat/sys/ipc.h: revision 1.6
sys/compat/sys/ipc.h: revision 1.7
sys/compat/sys/shm.h: revision 1.8
sys/kern/sysv_shm.c: revision 1.133
sys/compat/sys/sem.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.56
sys/compat/netbsd32/netbsd32_conv.h: revision 1.38
sys/kern/sysv_sem.c: revision 1.96
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.28
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.29
sys/compat/linux32/common/linux32_ipccall.c: revision 1.12
sys/kern/sysv_msg.c: revision 1.73
sys/compat/sys/msg.h: revision 1.6

for sysv ipc stat operations, explicitly copy the exported parts
instead of the whole ds structure.
besides triggering a recently added assert in netbsd32, this stops
exposing kernel addresses.

copy the mode clamping to 0777 from sem to shm and msg.

while here, make sure that the compat callers to sysv_ipc clear
the contents of the compat structure before setting the result
members to ensure padding bytes are cleared.

don't set/copy _sem_base, _msg_first, _msg_last or _shm_internal.
even if used, which seems very dodgy, they leak KVAs as well.
possibly this may affect linux binaries, in particular, the
comments around _shm_internal ("XXX Oh well.") may mean apps
rely upon these but hopefully not -- the comments date back to
rev 1.1 in 1995.

the _key, _seq and _msg_cbytes members are exported as before as
i found multiple consumers of these (no less than ipcs(1), and
they appear to be useful for debugging and more.

XXX: the naming of compat functions have too many styles. there
are at least 3 different ones changed here.

fix naming errors in previous. (this file is no longer compiled, but
this fix makes the pull up more obvious, before deleting this file.)

include libkern.h or strings.h. should fix i386 build issues.
 1.4.34.1 23-Feb-2019  martin Pull up following revision(s) (requested by mrg in ticket #1679):
sys/compat/sys/ipc.h: revision 1.6
sys/compat/sys/ipc.h: revision 1.7
sys/compat/sys/shm.h: revision 1.8
sys/kern/sysv_shm.c: revision 1.133
sys/compat/sys/sem.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.56
sys/compat/netbsd32/netbsd32_conv.h: revision 1.38
sys/kern/sysv_sem.c: revision 1.96
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.28
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.29
sys/compat/linux32/common/linux32_ipccall.c: revision 1.12
sys/kern/sysv_msg.c: revision 1.73
sys/compat/sys/msg.h: revision 1.6

for sysv ipc stat operations, explicitly copy the exported parts
instead of the whole ds structure.
besides triggering a recently added assert in netbsd32, this stops
exposing kernel addresses.

copy the mode clamping to 0777 from sem to shm and msg.

while here, make sure that the compat callers to sysv_ipc clear
the contents of the compat structure before setting the result
members to ensure padding bytes are cleared.

don't set/copy _sem_base, _msg_first, _msg_last or _shm_internal.
even if used, which seems very dodgy, they leak KVAs as well.
possibly this may affect linux binaries, in particular, the
comments around _shm_internal ("XXX Oh well.") may mean apps
rely upon these but hopefully not -- the comments date back to
rev 1.1 in 1995.

the _key, _seq and _msg_cbytes members are exported as before as
i found multiple consumers of these (no less than ipcs(1), and
they appear to be useful for debugging and more.

XXX: the naming of compat functions have too many styles. there
are at least 3 different ones changed here.

fix naming errors in previous. (this file is no longer compiled, but
this fix makes the pull up more obvious, before deleting this file.)

include libkern.h or strings.h. should fix i386 build issues.
 1.4.30.1 23-Feb-2019  martin Pull up following revision(s) (requested by mrg in ticket #1679):
sys/compat/sys/ipc.h: revision 1.6
sys/compat/sys/ipc.h: revision 1.7
sys/compat/sys/shm.h: revision 1.8
sys/kern/sysv_shm.c: revision 1.133
sys/compat/sys/sem.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.56
sys/compat/netbsd32/netbsd32_conv.h: revision 1.38
sys/kern/sysv_sem.c: revision 1.96
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.28
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.29
sys/compat/linux32/common/linux32_ipccall.c: revision 1.12
sys/kern/sysv_msg.c: revision 1.73
sys/compat/sys/msg.h: revision 1.6

for sysv ipc stat operations, explicitly copy the exported parts
instead of the whole ds structure.
besides triggering a recently added assert in netbsd32, this stops
exposing kernel addresses.

copy the mode clamping to 0777 from sem to shm and msg.

while here, make sure that the compat callers to sysv_ipc clear
the contents of the compat structure before setting the result
members to ensure padding bytes are cleared.

don't set/copy _sem_base, _msg_first, _msg_last or _shm_internal.
even if used, which seems very dodgy, they leak KVAs as well.
possibly this may affect linux binaries, in particular, the
comments around _shm_internal ("XXX Oh well.") may mean apps
rely upon these but hopefully not -- the comments date back to
rev 1.1 in 1995.

the _key, _seq and _msg_cbytes members are exported as before as
i found multiple consumers of these (no less than ipcs(1), and
they appear to be useful for debugging and more.

XXX: the naming of compat functions have too many styles. there
are at least 3 different ones changed here.

fix naming errors in previous. (this file is no longer compiled, but
this fix makes the pull up more obvious, before deleting this file.)

include libkern.h or strings.h. should fix i386 build issues.
 1.5.2.1 10-Jun-2019  christos Sync with HEAD
 1.3 29-Apr-2017  christos move MAP_COPY in compat
 1.2 11-Dec-2005  christos branches: 1.2.18; 1.2.122; 1.2.142; 1.2.156;
merge ktrace-lwp.
 1.1 13-Sep-2005  christos branches: 1.1.6;
compat code reorg.
 1.1.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.6.1 13-Sep-2005  skrll file mman.h was added on branch ktrace-lwp on 2005-11-10 14:01:40 +0000
 1.2.156.1 02-May-2017  pgoyette Sync with HEAD - tag prg-localcount2-base1
 1.2.142.1 28-Aug-2017  skrll Sync with HEAD
 1.2.122.1 03-Dec-2017  jdolecek update from HEAD
 1.2.18.2 21-Jun-2006  yamt sync with head.
 1.2.18.1 11-Dec-2005  yamt file mman.h was added on branch yamt-lazymbuf on 2006-06-21 15:00:00 +0000
 1.2 28-Jan-2019  pgoyette branches: 1.2.4;
Use the correct macro name for dup-include checking
 1.1 27-Jan-2019  christos - autoload the compat_80 for modstat
- move compat struct to a compat header
 1.2.4.2 10-Jun-2019  christos Sync with HEAD
 1.2.4.1 28-Jan-2019  christos file module.h was added on branch phil-wifi on 2019-06-10 22:07:03 +0000
 1.16 19-Jan-2024  christos Add missing decls, make rusage_to_rusage50 static inline.
 1.15 30-Aug-2021  riastradh sys/compat: Don't clobber f_oflags with zero.

Mistake was introduced in previous refactoring.
 1.14 03-Jul-2020  jdolecek don't overallocate (follows similar change to compat/sys/statvfs.h)
 1.13 27-Jun-2020  christos Ignore the supplied size, and always use the argument size that we know.
Found by maxv@
 1.12 27-Jun-2020  maxv Yet another idiotic compat syscall that was developed with literally zero
test made. Simply invoking this syscall with _valid parameters_ triggers a
fatal fault, because the kernel tries to write to userland addresses.

With specially-crafted parameters it is easy to completely escalate
privileges into the kernel.

Also the size of the allocation is just obviously wrong, but it looks like
the callers are even more wrong, so not gonna fix it for now.

Reported-by: syzbot+b05096f3114b2820d81c@syzkaller.appspotmail.com
 1.11 04-Oct-2019  christos deduplicate the conversion function from statvfs -> statfs12
 1.10 04-Oct-2013  christos branches: 1.10.30;
prefix compat with __ in case __dso_hidden is not available
 1.9 04-Oct-2013  christos avoid linker warning for compat symbols that are used internally in libc,
by introducing a hidden compat_foo() function, using that internally in
libc, and exposing foo as a strong alias to compat_foo(). I am open for
better ideas.
 1.8 11-Jan-2009  christos branches: 1.8.14; 1.8.24; 1.8.28;
merge christos-time_t
 1.7 17-Jul-2007  christos branches: 1.7.28; 1.7.32; 1.7.42; 1.7.46;
MFSNAMELEN only belongs in compat.
 1.6 04-Aug-2006  yamt branches: 1.6.14;
whitespace.
 1.5 31-Jul-2006  martin Make filehandles opaque to userland
 1.4 13-Jul-2006  martin Fix alignement problems for fhandle_t, exposed by gcc4.1.

While touching all vptofh/fhtovp functions, get rid of VFS_MAXFIDSIZ,
version the getfh(2) syscall and explicitly pass the size available in
the filehandle from userland.

Discussed on tech-kern, with lots of help from yamt (thanks!).
 1.3 04-May-2006  christos branches: 1.3.4; 1.3.6;
update for fhstat.
 1.2 11-Dec-2005  christos branches: 1.2.4; 1.2.6; 1.2.8; 1.2.10; 1.2.12;
merge ktrace-lwp.
 1.1 13-Sep-2005  christos branches: 1.1.6;
compat code reorg.
 1.1.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.6.1 13-Sep-2005  skrll file mount.h was added on branch ktrace-lwp on 2005-11-10 14:01:40 +0000
 1.2.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.2.10.1 11-May-2006  elad sync with head
 1.2.8.2 11-Aug-2006  yamt sync with head
 1.2.8.1 24-May-2006  yamt sync with head.
 1.2.6.1 01-Jun-2006  kardel Sync with head.
 1.2.4.1 09-Sep-2006  rpaulo sync with head
 1.3.6.4 03-Sep-2007  yamt sync with head.
 1.3.6.3 30-Dec-2006  yamt sync with head.
 1.3.6.2 21-Jun-2006  yamt sync with head.
 1.3.6.1 04-May-2006  yamt file mount.h was added on branch yamt-lazymbuf on 2006-06-21 15:00:00 +0000
 1.3.4.1 13-Jul-2006  gdamore Merge from HEAD.
 1.6.14.1 20-Aug-2007  ad Sync with HEAD.
 1.7.46.2 09-Nov-2008  christos fix fhstat decls
 1.7.46.1 09-Nov-2008  christos fix fhstat.
 1.7.42.1 19-Jan-2009  skrll Sync with HEAD.
 1.7.32.1 04-May-2009  yamt sync with head.
 1.7.28.1 17-Jan-2009  mjf Sync with HEAD.
 1.8.28.1 18-May-2014  rmind sync with head
 1.8.24.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.8.14.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.10.30.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.7 12-Feb-2023  andvar s/strucure/structure/ and s/structues/structures/ in comments.
 1.6 21-Feb-2019  mrg for sysv ipc stat operations, explicitly copy the exported parts
instead of the whole ds structure.

besides triggering a recently added assert in netbsd32, this stops
exposing kernel addresses.

copy the mode clamping to 0777 from sem to shm and msg.


while here, make sure that the compat callers to sysv_ipc clear
the contents of the compat structure before setting the result
members to ensure padding bytes are cleared.

don't set/copy _sem_base, _msg_first, _msg_last or _shm_internal.
even if used, which seems very dodgy, they leak KVAs as well.
possibly this may affect linux binaries, in particular, the
comments around _shm_internal ("XXX Oh well.") may mean apps
rely upon these but hopefully not -- the comments date back to
rev 1.1 in 1995.

the _key, _seq and _msg_cbytes members are exported as before as
i found multiple consumers of these (no less than ipcs(1), and
they appear to be useful for debugging and more.


XXX: the naming of compat functions have too many styles. there
are at least 3 different ones changed here.
 1.5 27-Dec-2018  maxv Fix kernel info leaks.

+ Possible info leak: [len=80, leaked=10]
| #0 0xffffffff80bad7a7 in kleak_copyout
| #1 0xffffffff8048e71b in netbsd32___msgctl50
| #2 0xffffffff8022fb5b in netbsd32_syscall
| #3 0xffffffff802096dd in handle_syscall
 1.4 19-Jan-2009  christos branches: 1.4.40; 1.4.44; 1.4.52; 1.4.58; 1.4.64; 1.4.66;
Provide compatibility for pre-christos-time_t sysv sysctls.
 1.3 11-Jan-2009  christos merge christos-time_t
 1.2 12-Nov-2005  simonb branches: 1.2.4; 1.2.22; 1.2.76; 1.2.78; 1.2.82; 1.2.92;
Copyright maintenance - only include the copyrights from the original
sys/*.h files that were in the files at the time the old structures
were present.
 1.1 11-Nov-2005  christos Move more compat stuff from sys.
 1.2.92.2 03-Mar-2009  skrll Sync with HEAD.
 1.2.92.1 19-Jan-2009  skrll Sync with HEAD.
 1.2.82.1 04-May-2009  yamt sync with head.
 1.2.78.2 09-Nov-2008  christos garbage collect all the conversion functions and put them in the header
files so that userland can share them. Also fix bugs in them!
 1.2.78.1 29-Mar-2008  christos Welcome to the time_t=long long dev_t=uint64_t branch.
 1.2.76.1 17-Jan-2009  mjf Sync with HEAD.
 1.2.22.2 21-Jun-2006  yamt sync with head.
 1.2.22.1 12-Nov-2005  yamt file msg.h was added on branch yamt-lazymbuf on 2006-06-21 15:00:00 +0000
 1.2.4.2 11-Dec-2005  christos Sync with head.
 1.2.4.1 12-Nov-2005  christos file msg.h was added on branch ktrace-lwp on 2005-12-11 10:28:47 +0000
 1.4.66.1 10-Jun-2019  christos Sync with HEAD
 1.4.64.1 03-Jan-2019  pgoyette Bring in some more changes from HEAD.
 1.4.58.2 23-Feb-2019  martin Pull up following revision(s) (requested by mrg in ticket #1195):
sys/compat/sys/ipc.h: revision 1.6
sys/compat/sys/ipc.h: revision 1.7
sys/compat/sys/shm.h: revision 1.8
sys/kern/sysv_shm.c: revision 1.133
sys/compat/sys/sem.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.56
sys/compat/netbsd32/netbsd32_conv.h: revision 1.38
sys/kern/sysv_sem.c: revision 1.96
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.28
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.29
sys/compat/linux32/common/linux32_ipccall.c: revision 1.12
sys/kern/sysv_msg.c: revision 1.73
sys/compat/sys/msg.h: revision 1.6

for sysv ipc stat operations, explicitly copy the exported parts
instead of the whole ds structure.
besides triggering a recently added assert in netbsd32, this stops
exposing kernel addresses.

copy the mode clamping to 0777 from sem to shm and msg.

while here, make sure that the compat callers to sysv_ipc clear
the contents of the compat structure before setting the result
members to ensure padding bytes are cleared.

don't set/copy _sem_base, _msg_first, _msg_last or _shm_internal.
even if used, which seems very dodgy, they leak KVAs as well.
possibly this may affect linux binaries, in particular, the
comments around _shm_internal ("XXX Oh well.") may mean apps
rely upon these but hopefully not -- the comments date back to
rev 1.1 in 1995.

the _key, _seq and _msg_cbytes members are exported as before as
i found multiple consumers of these (no less than ipcs(1), and
they appear to be useful for debugging and more.

XXX: the naming of compat functions have too many styles. there
are at least 3 different ones changed here.

fix naming errors in previous. (this file is no longer compiled, but
this fix makes the pull up more obvious, before deleting this file.)

include libkern.h or strings.h. should fix i386 build issues.
 1.4.58.1 02-Jan-2019  martin Pull up following revision(s) (requested by maxv in ticket #1151):

sys/compat/netbsd32/netbsd32_conv.h: revision 1.37
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.27
sys/compat/sys/msg.h: revision 1.5

Fix kernel info leaks.

+ Possible info leak: [len=80, leaked=10]
| #0 0xffffffff80bad7a7 in kleak_copyout
| #1 0xffffffff8048e71b in netbsd32___msgctl50
| #2 0xffffffff8022fb5b in netbsd32_syscall
| #3 0xffffffff802096dd in handle_syscall
 1.4.52.2 23-Feb-2019  martin Pull up following revision(s) (requested by mrg in ticket #1679):
sys/compat/sys/ipc.h: revision 1.6
sys/compat/sys/ipc.h: revision 1.7
sys/compat/sys/shm.h: revision 1.8
sys/kern/sysv_shm.c: revision 1.133
sys/compat/sys/sem.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.56
sys/compat/netbsd32/netbsd32_conv.h: revision 1.38
sys/kern/sysv_sem.c: revision 1.96
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.28
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.29
sys/compat/linux32/common/linux32_ipccall.c: revision 1.12
sys/kern/sysv_msg.c: revision 1.73
sys/compat/sys/msg.h: revision 1.6

for sysv ipc stat operations, explicitly copy the exported parts
instead of the whole ds structure.
besides triggering a recently added assert in netbsd32, this stops
exposing kernel addresses.

copy the mode clamping to 0777 from sem to shm and msg.

while here, make sure that the compat callers to sysv_ipc clear
the contents of the compat structure before setting the result
members to ensure padding bytes are cleared.

don't set/copy _sem_base, _msg_first, _msg_last or _shm_internal.
even if used, which seems very dodgy, they leak KVAs as well.
possibly this may affect linux binaries, in particular, the
comments around _shm_internal ("XXX Oh well.") may mean apps
rely upon these but hopefully not -- the comments date back to
rev 1.1 in 1995.

the _key, _seq and _msg_cbytes members are exported as before as
i found multiple consumers of these (no less than ipcs(1), and
they appear to be useful for debugging and more.

XXX: the naming of compat functions have too many styles. there
are at least 3 different ones changed here.

fix naming errors in previous. (this file is no longer compiled, but
this fix makes the pull up more obvious, before deleting this file.)

include libkern.h or strings.h. should fix i386 build issues.
 1.4.52.1 02-Jan-2019  martin Pull up following revision(s) (requested by maxv in ticket #1668):

sys/compat/netbsd32/netbsd32_conv.h: revision 1.37
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.27
sys/compat/sys/msg.h: revision 1.5

Fix kernel info leaks.

+ Possible info leak: [len=80, leaked=10]
| #0 0xffffffff80bad7a7 in kleak_copyout
| #1 0xffffffff8048e71b in netbsd32___msgctl50
| #2 0xffffffff8022fb5b in netbsd32_syscall
| #3 0xffffffff802096dd in handle_syscall
 1.4.44.2 23-Feb-2019  martin Pull up following revision(s) (requested by mrg in ticket #1679):
sys/compat/sys/ipc.h: revision 1.6
sys/compat/sys/ipc.h: revision 1.7
sys/compat/sys/shm.h: revision 1.8
sys/kern/sysv_shm.c: revision 1.133
sys/compat/sys/sem.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.56
sys/compat/netbsd32/netbsd32_conv.h: revision 1.38
sys/kern/sysv_sem.c: revision 1.96
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.28
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.29
sys/compat/linux32/common/linux32_ipccall.c: revision 1.12
sys/kern/sysv_msg.c: revision 1.73
sys/compat/sys/msg.h: revision 1.6

for sysv ipc stat operations, explicitly copy the exported parts
instead of the whole ds structure.
besides triggering a recently added assert in netbsd32, this stops
exposing kernel addresses.

copy the mode clamping to 0777 from sem to shm and msg.

while here, make sure that the compat callers to sysv_ipc clear
the contents of the compat structure before setting the result
members to ensure padding bytes are cleared.

don't set/copy _sem_base, _msg_first, _msg_last or _shm_internal.
even if used, which seems very dodgy, they leak KVAs as well.
possibly this may affect linux binaries, in particular, the
comments around _shm_internal ("XXX Oh well.") may mean apps
rely upon these but hopefully not -- the comments date back to
rev 1.1 in 1995.

the _key, _seq and _msg_cbytes members are exported as before as
i found multiple consumers of these (no less than ipcs(1), and
they appear to be useful for debugging and more.

XXX: the naming of compat functions have too many styles. there
are at least 3 different ones changed here.

fix naming errors in previous. (this file is no longer compiled, but
this fix makes the pull up more obvious, before deleting this file.)

include libkern.h or strings.h. should fix i386 build issues.
 1.4.44.1 02-Jan-2019  martin Pull up following revision(s) (requested by maxv in ticket #1668):

sys/compat/netbsd32/netbsd32_conv.h: revision 1.37
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.27
sys/compat/sys/msg.h: revision 1.5

Fix kernel info leaks.

+ Possible info leak: [len=80, leaked=10]
| #0 0xffffffff80bad7a7 in kleak_copyout
| #1 0xffffffff8048e71b in netbsd32___msgctl50
| #2 0xffffffff8022fb5b in netbsd32_syscall
| #3 0xffffffff802096dd in handle_syscall
 1.4.40.2 23-Feb-2019  martin Pull up following revision(s) (requested by mrg in ticket #1679):
sys/compat/sys/ipc.h: revision 1.6
sys/compat/sys/ipc.h: revision 1.7
sys/compat/sys/shm.h: revision 1.8
sys/kern/sysv_shm.c: revision 1.133
sys/compat/sys/sem.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.56
sys/compat/netbsd32/netbsd32_conv.h: revision 1.38
sys/kern/sysv_sem.c: revision 1.96
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.28
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.29
sys/compat/linux32/common/linux32_ipccall.c: revision 1.12
sys/kern/sysv_msg.c: revision 1.73
sys/compat/sys/msg.h: revision 1.6

for sysv ipc stat operations, explicitly copy the exported parts
instead of the whole ds structure.
besides triggering a recently added assert in netbsd32, this stops
exposing kernel addresses.

copy the mode clamping to 0777 from sem to shm and msg.

while here, make sure that the compat callers to sysv_ipc clear
the contents of the compat structure before setting the result
members to ensure padding bytes are cleared.

don't set/copy _sem_base, _msg_first, _msg_last or _shm_internal.
even if used, which seems very dodgy, they leak KVAs as well.
possibly this may affect linux binaries, in particular, the
comments around _shm_internal ("XXX Oh well.") may mean apps
rely upon these but hopefully not -- the comments date back to
rev 1.1 in 1995.

the _key, _seq and _msg_cbytes members are exported as before as
i found multiple consumers of these (no less than ipcs(1), and
they appear to be useful for debugging and more.

XXX: the naming of compat functions have too many styles. there
are at least 3 different ones changed here.

fix naming errors in previous. (this file is no longer compiled, but
this fix makes the pull up more obvious, before deleting this file.)

include libkern.h or strings.h. should fix i386 build issues.
 1.4.40.1 02-Jan-2019  martin Pull up following revision(s) (requested by maxv in ticket #1668):

sys/compat/netbsd32/netbsd32_conv.h: revision 1.37
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.27
sys/compat/sys/msg.h: revision 1.5

Fix kernel info leaks.

+ Possible info leak: [len=80, leaked=10]
| #0 0xffffffff80bad7a7 in kleak_copyout
| #1 0xffffffff8048e71b in netbsd32___msgctl50
| #2 0xffffffff8022fb5b in netbsd32_syscall
| #3 0xffffffff802096dd in handle_syscall
 1.2 11-Jan-2009  christos branches: 1.2.2; 1.2.4; 1.2.8;
merge christos-time_t
 1.1 08-Nov-2008  christos branches: 1.1.2;
file poll.h was initially added on branch christos-time_t.
 1.1.2.2 28-Dec-2008  christos add fwd decl.
 1.1.2.1 08-Nov-2008  christos expose more functions to userland
 1.2.8.2 04-May-2009  yamt sync with head.
 1.2.8.1 11-Jan-2009  yamt file poll.h was added on branch yamt-nfs-mp on 2009-05-04 08:12:28 +0000
 1.2.4.2 19-Jan-2009  skrll Sync with HEAD.
 1.2.4.1 11-Jan-2009  skrll file poll.h was added on branch nick-hppapmap on 2009-01-19 13:17:44 +0000
 1.2.2.2 17-Jan-2009  mjf Sync with HEAD.
 1.2.2.1 11-Jan-2009  mjf file poll.h was added on branch mjf-devfs2 on 2009-01-17 13:28:49 +0000
 1.7 20-Jan-2024  kre Now that rusage_to_rusage50() has switched from being an external
function, to a static inline, we need <resource.h> for it to work.
Not all callers provide that (and nor should they need to), so include
it here.

Should unbreak the builds.
 1.6 19-Jan-2024  christos Add missing decls, make rusage_to_rusage50 static inline.
 1.5 04-Oct-2013  christos prefix compat with __ in case __dso_hidden is not available
 1.4 04-Oct-2013  christos avoid linker warning for compat symbols that are used internally in libc,
by introducing a hidden compat_foo() function, using that internally in
libc, and exposing foo as a strong alias to compat_foo(). I am open for
better ideas.
 1.3 17-Jan-2009  njoly branches: 1.3.2; 1.3.16; 1.3.26; 1.3.30;
Convert linux/linux32 wait(4) to use a compat50 rusage structure.
 1.2 11-Jan-2009  christos branches: 1.2.2;
merge christos-time_t
 1.1 29-Mar-2008  christos branches: 1.1.2; 1.1.6;
file resource.h was initially added on branch christos-time_t.
 1.1.6.1 04-May-2009  yamt sync with head.
 1.1.2.1 29-Mar-2008  christos new files
 1.2.2.2 17-Jan-2009  mjf Sync with HEAD.
 1.2.2.1 11-Jan-2009  mjf file resource.h was added on branch mjf-devfs2 on 2009-01-17 13:28:49 +0000
 1.3.30.1 18-May-2014  rmind sync with head
 1.3.26.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.3.16.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.3.2.2 19-Jan-2009  skrll Sync with HEAD.
 1.3.2.1 17-Jan-2009  skrll file resource.h was added on branch nick-hppapmap on 2009-01-19 13:17:44 +0000
 1.7 27-Jun-2019  christos This actually needs the netbsd32 stuff present since the struct for the
32 bit syscall has a netbsd32_voidp... This header is used also for
compat/common, so just revert (helped us to fix a bug though :-)
 1.6 27-Jun-2019  christos Always include the 32 bit structure and definitions on _LP64 regardless
of compat32 being on or off, because we want the headers to work when
compiling modular kernels. Of course the 32 bit structs do not make sense
on platforms that don't have 32 bit modes (alpha), but we don't have
a define for that and it does not hurt.
 1.5 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.4 14-Apr-2015  riastradh branches: 1.4.16; 1.4.18;
No need for <sys/rnd.h> here either. Missed this one yesterday too.
 1.3 14-Apr-2015  nat Include rndio.h for missing defines.
 1.2 20-Dec-2011  drochner branches: 1.2.4; 1.2.6; 1.2.10; 1.2.28;
allow kernels w/o COMPAT_50 to build
 1.1 19-Dec-2011  apb Add COMPAT_50 and COMPAT_NETBSD32 compatibility code for rnd(4)
ioctl commands.

Tested with "rndctl -ls" using an old 32-bit version of rndctl(8)
(built for NetBSD-5.99.56/i386) and a new 64-bit kernel
(NetBSD-5.99.59/amd64).
 1.2.28.1 06-Jun-2015  skrll Sync with HEAD
 1.2.10.1 03-Dec-2017  jdolecek update from HEAD
 1.2.6.2 17-Apr-2012  yamt sync with head
 1.2.6.1 20-Dec-2011  yamt file rnd.h was added on branch yamt-pagecache on 2012-04-17 00:07:23 +0000
 1.2.4.2 18-Feb-2012  mrg merge to -current.
 1.2.4.1 20-Dec-2011  mrg file rnd.h was added on branch jmcneill-usbmp on 2012-02-18 07:34:01 +0000
 1.4.18.1 10-Jun-2019  christos Sync with HEAD
 1.4.16.1 21-Mar-2018  pgoyette Split compat/rndpseudo_50.c into two pieces, one for native compat and
a second piece for compat32. Update both modules accordingly.
 1.2 11-Jan-2009  christos branches: 1.2.2; 1.2.4; 1.2.8;
merge christos-time_t
 1.1 08-Nov-2008  christos branches: 1.1.2;
file select.h was initially added on branch christos-time_t.
 1.1.2.1 08-Nov-2008  christos expose more functions to userland
 1.2.8.2 04-May-2009  yamt sync with head.
 1.2.8.1 11-Jan-2009  yamt file select.h was added on branch yamt-nfs-mp on 2009-05-04 08:12:28 +0000
 1.2.4.2 19-Jan-2009  skrll Sync with HEAD.
 1.2.4.1 11-Jan-2009  skrll file select.h was added on branch nick-hppapmap on 2009-01-19 13:17:44 +0000
 1.2.2.2 17-Jan-2009  mjf Sync with HEAD.
 1.2.2.1 11-Jan-2009  mjf file select.h was added on branch mjf-devfs2 on 2009-01-17 13:28:49 +0000
 1.7 21-Feb-2019  mrg for sysv ipc stat operations, explicitly copy the exported parts
instead of the whole ds structure.

besides triggering a recently added assert in netbsd32, this stops
exposing kernel addresses.

copy the mode clamping to 0777 from sem to shm and msg.


while here, make sure that the compat callers to sysv_ipc clear
the contents of the compat structure before setting the result
members to ensure padding bytes are cleared.

don't set/copy _sem_base, _msg_first, _msg_last or _shm_internal.
even if used, which seems very dodgy, they leak KVAs as well.
possibly this may affect linux binaries, in particular, the
comments around _shm_internal ("XXX Oh well.") may mean apps
rely upon these but hopefully not -- the comments date back to
rev 1.1 in 1995.

the _key, _seq and _msg_cbytes members are exported as before as
i found multiple consumers of these (no less than ipcs(1), and
they appear to be useful for debugging and more.


XXX: the naming of compat functions have too many styles. there
are at least 3 different ones changed here.
 1.6 19-Jan-2009  christos branches: 1.6.40; 1.6.44; 1.6.52; 1.6.58; 1.6.66;
Provide compatibility for pre-christos-time_t sysv sysctls.
 1.5 11-Jan-2009  christos merge christos-time_t
 1.4 17-Jun-2007  dsl branches: 1.4.28; 1.4.30; 1.4.34; 1.4.44;
Expose semid_ds14_to_native() to otherparts of the system.
Don't leak kernel stack back to userspace.
 1.3 12-Nov-2005  simonb branches: 1.3.20; 1.3.34; 1.3.36;
Copyright maintenance - only include the copyrights from the original
sys/*.h files that were in the files at the time the old structures
were present.
 1.2 11-Nov-2005  christos Move more compat stuff from sys.
 1.1 13-Sep-2005  christos branches: 1.1.6;
compat code reorg.
 1.1.6.3 11-Dec-2005  christos Sync with head.
 1.1.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.6.1 13-Sep-2005  skrll file sem.h was added on branch ktrace-lwp on 2005-11-10 14:01:40 +0000
 1.3.36.1 11-Jul-2007  mjf Sync with head.
 1.3.34.1 15-Jul-2007  ad Sync with head.
 1.3.20.3 03-Sep-2007  yamt sync with head.
 1.3.20.2 21-Jun-2006  yamt sync with head.
 1.3.20.1 12-Nov-2005  yamt file sem.h was added on branch yamt-lazymbuf on 2006-06-21 15:00:00 +0000
 1.4.44.2 03-Mar-2009  skrll Sync with HEAD.
 1.4.44.1 19-Jan-2009  skrll Sync with HEAD.
 1.4.34.1 04-May-2009  yamt sync with head.
 1.4.30.3 05-Jan-2009  christos fix sem prototypes.
 1.4.30.2 09-Nov-2008  christos garbage collect all the conversion functions and put them in the header
files so that userland can share them. Also fix bugs in them!
 1.4.30.1 29-Mar-2008  christos Welcome to the time_t=long long dev_t=uint64_t branch.
 1.4.28.1 17-Jan-2009  mjf Sync with HEAD.
 1.6.66.1 10-Jun-2019  christos Sync with HEAD
 1.6.58.1 23-Feb-2019  martin Pull up following revision(s) (requested by mrg in ticket #1195):
sys/compat/sys/ipc.h: revision 1.6
sys/compat/sys/ipc.h: revision 1.7
sys/compat/sys/shm.h: revision 1.8
sys/kern/sysv_shm.c: revision 1.133
sys/compat/sys/sem.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.56
sys/compat/netbsd32/netbsd32_conv.h: revision 1.38
sys/kern/sysv_sem.c: revision 1.96
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.28
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.29
sys/compat/linux32/common/linux32_ipccall.c: revision 1.12
sys/kern/sysv_msg.c: revision 1.73
sys/compat/sys/msg.h: revision 1.6

for sysv ipc stat operations, explicitly copy the exported parts
instead of the whole ds structure.
besides triggering a recently added assert in netbsd32, this stops
exposing kernel addresses.

copy the mode clamping to 0777 from sem to shm and msg.

while here, make sure that the compat callers to sysv_ipc clear
the contents of the compat structure before setting the result
members to ensure padding bytes are cleared.

don't set/copy _sem_base, _msg_first, _msg_last or _shm_internal.
even if used, which seems very dodgy, they leak KVAs as well.
possibly this may affect linux binaries, in particular, the
comments around _shm_internal ("XXX Oh well.") may mean apps
rely upon these but hopefully not -- the comments date back to
rev 1.1 in 1995.

the _key, _seq and _msg_cbytes members are exported as before as
i found multiple consumers of these (no less than ipcs(1), and
they appear to be useful for debugging and more.

XXX: the naming of compat functions have too many styles. there
are at least 3 different ones changed here.

fix naming errors in previous. (this file is no longer compiled, but
this fix makes the pull up more obvious, before deleting this file.)

include libkern.h or strings.h. should fix i386 build issues.
 1.6.52.1 23-Feb-2019  martin Pull up following revision(s) (requested by mrg in ticket #1679):
sys/compat/sys/ipc.h: revision 1.6
sys/compat/sys/ipc.h: revision 1.7
sys/compat/sys/shm.h: revision 1.8
sys/kern/sysv_shm.c: revision 1.133
sys/compat/sys/sem.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.56
sys/compat/netbsd32/netbsd32_conv.h: revision 1.38
sys/kern/sysv_sem.c: revision 1.96
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.28
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.29
sys/compat/linux32/common/linux32_ipccall.c: revision 1.12
sys/kern/sysv_msg.c: revision 1.73
sys/compat/sys/msg.h: revision 1.6

for sysv ipc stat operations, explicitly copy the exported parts
instead of the whole ds structure.
besides triggering a recently added assert in netbsd32, this stops
exposing kernel addresses.

copy the mode clamping to 0777 from sem to shm and msg.

while here, make sure that the compat callers to sysv_ipc clear
the contents of the compat structure before setting the result
members to ensure padding bytes are cleared.

don't set/copy _sem_base, _msg_first, _msg_last or _shm_internal.
even if used, which seems very dodgy, they leak KVAs as well.
possibly this may affect linux binaries, in particular, the
comments around _shm_internal ("XXX Oh well.") may mean apps
rely upon these but hopefully not -- the comments date back to
rev 1.1 in 1995.

the _key, _seq and _msg_cbytes members are exported as before as
i found multiple consumers of these (no less than ipcs(1), and
they appear to be useful for debugging and more.

XXX: the naming of compat functions have too many styles. there
are at least 3 different ones changed here.

fix naming errors in previous. (this file is no longer compiled, but
this fix makes the pull up more obvious, before deleting this file.)

include libkern.h or strings.h. should fix i386 build issues.
 1.6.44.1 23-Feb-2019  martin Pull up following revision(s) (requested by mrg in ticket #1679):
sys/compat/sys/ipc.h: revision 1.6
sys/compat/sys/ipc.h: revision 1.7
sys/compat/sys/shm.h: revision 1.8
sys/kern/sysv_shm.c: revision 1.133
sys/compat/sys/sem.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.56
sys/compat/netbsd32/netbsd32_conv.h: revision 1.38
sys/kern/sysv_sem.c: revision 1.96
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.28
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.29
sys/compat/linux32/common/linux32_ipccall.c: revision 1.12
sys/kern/sysv_msg.c: revision 1.73
sys/compat/sys/msg.h: revision 1.6

for sysv ipc stat operations, explicitly copy the exported parts
instead of the whole ds structure.
besides triggering a recently added assert in netbsd32, this stops
exposing kernel addresses.

copy the mode clamping to 0777 from sem to shm and msg.

while here, make sure that the compat callers to sysv_ipc clear
the contents of the compat structure before setting the result
members to ensure padding bytes are cleared.

don't set/copy _sem_base, _msg_first, _msg_last or _shm_internal.
even if used, which seems very dodgy, they leak KVAs as well.
possibly this may affect linux binaries, in particular, the
comments around _shm_internal ("XXX Oh well.") may mean apps
rely upon these but hopefully not -- the comments date back to
rev 1.1 in 1995.

the _key, _seq and _msg_cbytes members are exported as before as
i found multiple consumers of these (no less than ipcs(1), and
they appear to be useful for debugging and more.

XXX: the naming of compat functions have too many styles. there
are at least 3 different ones changed here.

fix naming errors in previous. (this file is no longer compiled, but
this fix makes the pull up more obvious, before deleting this file.)

include libkern.h or strings.h. should fix i386 build issues.
 1.6.40.1 23-Feb-2019  martin Pull up following revision(s) (requested by mrg in ticket #1679):
sys/compat/sys/ipc.h: revision 1.6
sys/compat/sys/ipc.h: revision 1.7
sys/compat/sys/shm.h: revision 1.8
sys/kern/sysv_shm.c: revision 1.133
sys/compat/sys/sem.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.56
sys/compat/netbsd32/netbsd32_conv.h: revision 1.38
sys/kern/sysv_sem.c: revision 1.96
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.28
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.29
sys/compat/linux32/common/linux32_ipccall.c: revision 1.12
sys/kern/sysv_msg.c: revision 1.73
sys/compat/sys/msg.h: revision 1.6

for sysv ipc stat operations, explicitly copy the exported parts
instead of the whole ds structure.
besides triggering a recently added assert in netbsd32, this stops
exposing kernel addresses.

copy the mode clamping to 0777 from sem to shm and msg.

while here, make sure that the compat callers to sysv_ipc clear
the contents of the compat structure before setting the result
members to ensure padding bytes are cleared.

don't set/copy _sem_base, _msg_first, _msg_last or _shm_internal.
even if used, which seems very dodgy, they leak KVAs as well.
possibly this may affect linux binaries, in particular, the
comments around _shm_internal ("XXX Oh well.") may mean apps
rely upon these but hopefully not -- the comments date back to
rev 1.1 in 1995.

the _key, _seq and _msg_cbytes members are exported as before as
i found multiple consumers of these (no less than ipcs(1), and
they appear to be useful for debugging and more.

XXX: the naming of compat functions have too many styles. there
are at least 3 different ones changed here.

fix naming errors in previous. (this file is no longer compiled, but
this fix makes the pull up more obvious, before deleting this file.)

include libkern.h or strings.h. should fix i386 build issues.
 1.8 21-Feb-2019  mrg for sysv ipc stat operations, explicitly copy the exported parts
instead of the whole ds structure.

besides triggering a recently added assert in netbsd32, this stops
exposing kernel addresses.

copy the mode clamping to 0777 from sem to shm and msg.


while here, make sure that the compat callers to sysv_ipc clear
the contents of the compat structure before setting the result
members to ensure padding bytes are cleared.

don't set/copy _sem_base, _msg_first, _msg_last or _shm_internal.
even if used, which seems very dodgy, they leak KVAs as well.
possibly this may affect linux binaries, in particular, the
comments around _shm_internal ("XXX Oh well.") may mean apps
rely upon these but hopefully not -- the comments date back to
rev 1.1 in 1995.

the _key, _seq and _msg_cbytes members are exported as before as
i found multiple consumers of these (no less than ipcs(1), and
they appear to be useful for debugging and more.


XXX: the naming of compat functions have too many styles. there
are at least 3 different ones changed here.
 1.7 01-Apr-2009  christos branches: 1.7.38; 1.7.42; 1.7.50; 1.7.56; 1.7.64;
cast segsz to int.
 1.6 19-Jan-2009  christos branches: 1.6.2;
Provide compatibility for pre-christos-time_t sysv sysctls.
 1.5 11-Jan-2009  christos merge christos-time_t
 1.4 12-Nov-2005  simonb branches: 1.4.4; 1.4.22; 1.4.76; 1.4.78; 1.4.82; 1.4.92;
Copyright maintenance - only include the copyrights from the original
sys/*.h files that were in the files at the time the old structures
were present.
 1.3 11-Nov-2005  christos Move more compat stuff from sys.
 1.2 11-Nov-2005  tron Include "sys/ipc.h" to get definition of "ipc_perm14" structure.
This fixes the build of "pecoff_exec" LKM.
 1.1 10-Nov-2005  christos move the compat code out of the sys file.
 1.4.92.3 28-Apr-2009  skrll Sync with HEAD.
 1.4.92.2 03-Mar-2009  skrll Sync with HEAD.
 1.4.92.1 19-Jan-2009  skrll Sync with HEAD.
 1.4.82.1 04-May-2009  yamt sync with head.
 1.4.78.2 09-Nov-2008  christos garbage collect all the conversion functions and put them in the header
files so that userland can share them. Also fix bugs in them!
 1.4.78.1 29-Mar-2008  christos Welcome to the time_t=long long dev_t=uint64_t branch.
 1.4.76.1 17-Jan-2009  mjf Sync with HEAD.
 1.4.22.2 21-Jun-2006  yamt sync with head.
 1.4.22.1 12-Nov-2005  yamt file shm.h was added on branch yamt-lazymbuf on 2006-06-21 15:00:00 +0000
 1.4.4.2 11-Dec-2005  christos Sync with head.
 1.4.4.1 12-Nov-2005  christos file shm.h was added on branch ktrace-lwp on 2005-12-11 10:28:47 +0000
 1.6.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.7.64.1 10-Jun-2019  christos Sync with HEAD
 1.7.56.1 23-Feb-2019  martin Pull up following revision(s) (requested by mrg in ticket #1195):
sys/compat/sys/ipc.h: revision 1.6
sys/compat/sys/ipc.h: revision 1.7
sys/compat/sys/shm.h: revision 1.8
sys/kern/sysv_shm.c: revision 1.133
sys/compat/sys/sem.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.56
sys/compat/netbsd32/netbsd32_conv.h: revision 1.38
sys/kern/sysv_sem.c: revision 1.96
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.28
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.29
sys/compat/linux32/common/linux32_ipccall.c: revision 1.12
sys/kern/sysv_msg.c: revision 1.73
sys/compat/sys/msg.h: revision 1.6

for sysv ipc stat operations, explicitly copy the exported parts
instead of the whole ds structure.
besides triggering a recently added assert in netbsd32, this stops
exposing kernel addresses.

copy the mode clamping to 0777 from sem to shm and msg.

while here, make sure that the compat callers to sysv_ipc clear
the contents of the compat structure before setting the result
members to ensure padding bytes are cleared.

don't set/copy _sem_base, _msg_first, _msg_last or _shm_internal.
even if used, which seems very dodgy, they leak KVAs as well.
possibly this may affect linux binaries, in particular, the
comments around _shm_internal ("XXX Oh well.") may mean apps
rely upon these but hopefully not -- the comments date back to
rev 1.1 in 1995.

the _key, _seq and _msg_cbytes members are exported as before as
i found multiple consumers of these (no less than ipcs(1), and
they appear to be useful for debugging and more.

XXX: the naming of compat functions have too many styles. there
are at least 3 different ones changed here.

fix naming errors in previous. (this file is no longer compiled, but
this fix makes the pull up more obvious, before deleting this file.)

include libkern.h or strings.h. should fix i386 build issues.
 1.7.50.1 23-Feb-2019  martin Pull up following revision(s) (requested by mrg in ticket #1679):
sys/compat/sys/ipc.h: revision 1.6
sys/compat/sys/ipc.h: revision 1.7
sys/compat/sys/shm.h: revision 1.8
sys/kern/sysv_shm.c: revision 1.133
sys/compat/sys/sem.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.56
sys/compat/netbsd32/netbsd32_conv.h: revision 1.38
sys/kern/sysv_sem.c: revision 1.96
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.28
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.29
sys/compat/linux32/common/linux32_ipccall.c: revision 1.12
sys/kern/sysv_msg.c: revision 1.73
sys/compat/sys/msg.h: revision 1.6

for sysv ipc stat operations, explicitly copy the exported parts
instead of the whole ds structure.
besides triggering a recently added assert in netbsd32, this stops
exposing kernel addresses.

copy the mode clamping to 0777 from sem to shm and msg.

while here, make sure that the compat callers to sysv_ipc clear
the contents of the compat structure before setting the result
members to ensure padding bytes are cleared.

don't set/copy _sem_base, _msg_first, _msg_last or _shm_internal.
even if used, which seems very dodgy, they leak KVAs as well.
possibly this may affect linux binaries, in particular, the
comments around _shm_internal ("XXX Oh well.") may mean apps
rely upon these but hopefully not -- the comments date back to
rev 1.1 in 1995.

the _key, _seq and _msg_cbytes members are exported as before as
i found multiple consumers of these (no less than ipcs(1), and
they appear to be useful for debugging and more.

XXX: the naming of compat functions have too many styles. there
are at least 3 different ones changed here.

fix naming errors in previous. (this file is no longer compiled, but
this fix makes the pull up more obvious, before deleting this file.)

include libkern.h or strings.h. should fix i386 build issues.
 1.7.42.1 23-Feb-2019  martin Pull up following revision(s) (requested by mrg in ticket #1679):
sys/compat/sys/ipc.h: revision 1.6
sys/compat/sys/ipc.h: revision 1.7
sys/compat/sys/shm.h: revision 1.8
sys/kern/sysv_shm.c: revision 1.133
sys/compat/sys/sem.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.56
sys/compat/netbsd32/netbsd32_conv.h: revision 1.38
sys/kern/sysv_sem.c: revision 1.96
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.28
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.29
sys/compat/linux32/common/linux32_ipccall.c: revision 1.12
sys/kern/sysv_msg.c: revision 1.73
sys/compat/sys/msg.h: revision 1.6

for sysv ipc stat operations, explicitly copy the exported parts
instead of the whole ds structure.
besides triggering a recently added assert in netbsd32, this stops
exposing kernel addresses.

copy the mode clamping to 0777 from sem to shm and msg.

while here, make sure that the compat callers to sysv_ipc clear
the contents of the compat structure before setting the result
members to ensure padding bytes are cleared.

don't set/copy _sem_base, _msg_first, _msg_last or _shm_internal.
even if used, which seems very dodgy, they leak KVAs as well.
possibly this may affect linux binaries, in particular, the
comments around _shm_internal ("XXX Oh well.") may mean apps
rely upon these but hopefully not -- the comments date back to
rev 1.1 in 1995.

the _key, _seq and _msg_cbytes members are exported as before as
i found multiple consumers of these (no less than ipcs(1), and
they appear to be useful for debugging and more.

XXX: the naming of compat functions have too many styles. there
are at least 3 different ones changed here.

fix naming errors in previous. (this file is no longer compiled, but
this fix makes the pull up more obvious, before deleting this file.)

include libkern.h or strings.h. should fix i386 build issues.
 1.7.38.1 23-Feb-2019  martin Pull up following revision(s) (requested by mrg in ticket #1679):
sys/compat/sys/ipc.h: revision 1.6
sys/compat/sys/ipc.h: revision 1.7
sys/compat/sys/shm.h: revision 1.8
sys/kern/sysv_shm.c: revision 1.133
sys/compat/sys/sem.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.56
sys/compat/netbsd32/netbsd32_conv.h: revision 1.38
sys/kern/sysv_sem.c: revision 1.96
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.28
sys/compat/netbsd32/netbsd32_compat_14.c: revision 1.29
sys/compat/linux32/common/linux32_ipccall.c: revision 1.12
sys/kern/sysv_msg.c: revision 1.73
sys/compat/sys/msg.h: revision 1.6

for sysv ipc stat operations, explicitly copy the exported parts
instead of the whole ds structure.
besides triggering a recently added assert in netbsd32, this stops
exposing kernel addresses.

copy the mode clamping to 0777 from sem to shm and msg.

while here, make sure that the compat callers to sysv_ipc clear
the contents of the compat structure before setting the result
members to ensure padding bytes are cleared.

don't set/copy _sem_base, _msg_first, _msg_last or _shm_internal.
even if used, which seems very dodgy, they leak KVAs as well.
possibly this may affect linux binaries, in particular, the
comments around _shm_internal ("XXX Oh well.") may mean apps
rely upon these but hopefully not -- the comments date back to
rev 1.1 in 1995.

the _key, _seq and _msg_cbytes members are exported as before as
i found multiple consumers of these (no less than ipcs(1), and
they appear to be useful for debugging and more.

XXX: the naming of compat functions have too many styles. there
are at least 3 different ones changed here.

fix naming errors in previous. (this file is no longer compiled, but
this fix makes the pull up more obvious, before deleting this file.)

include libkern.h or strings.h. should fix i386 build issues.
 1.9 18-Nov-2019  rin 8-byte objects on i386 or arm-oabi are aligned in 4-byte boundary.
Therefore, we must use __attribute__((__aligned__(4))) for them.
netbsd32_{,u}int64 are provided for this purpose. However, we
cannot use it in <compat/sys/siginfo.h> due to circular dependency
b/w <machine/netbsd32_machdep.h>.

In order to distangle it, we choose here to have a duplicate type,
netbsd32_siginfo_uint64, in <compat/sys/siginfo.h>. The equivalence
with netbsd32_uint64 is asserted in <compat/netbsd32/netbsd32.h>.

Now, gdb for i386 works again on amd64 kernel.

Based on patch provided by kamil. Thanks!

XXX
pullup to netbsd-9
 1.8 30-Sep-2019  kamil Move TRAP_CHLD/TRAP_LWP ptrace information from struct proc to siginfo

Storing struct ptrace_state information inside struct proc was vulnerable
to synchronization bugs, as multiple events emitted in the same time were
overwritting other ones.

Cache the original parent process id in p_oppid. Reusing here p_opptr is
in theory prone to slight race codition.

Change the semantics of PT_GET_PROCESS_STATE, reutning EINVAL for calls
prompting for the value in cases when there wasn't registered an
appropriate event.

Add an alternative approach to check the ptrace_state information, directly
from the siginfo_t value returned from PT_GET_SIGINFO. The original
PT_GET_PROCESS_STATE approach is kept for compat with older NetBSD and
OpenBSD. New code is recommended to keep using PT_GET_PROCESS_STATE.

Add a couple of compile-time asserts for assumptions in the code.

No functional change intended in existing ptrace(2) software.

All ATF ptrace(2) and ATF GDB tests pass.

This change improves reliability of the threading ptrace(2) code.
 1.7 30-Jun-2019  martin branches: 1.7.2;
Provide the compat structures even if not building 64bit kernels, as
we have same-bitness netbsd32 emulations for different ABIs on some
architectures.
 1.6 27-Jun-2019  christos Always include the 32 bit structure and definitions on _LP64 regardless
of compat32 being on or off, because we want the headers to work when
compiling modular kernels. Of course the 32 bit structs do not make sense
on platforms that don't have 32 bit modes (alpha), but we don't have
a define for that and it does not hurt.
 1.5 19-Jun-2019  maya Match the regular _ksiginfo size since sys/sys/siginfo.h:1.33

"Expand siginfo_t (struct size not changed) to new values for
SIGTRAP TRAP_SCE/TRAP_SCX events."

Fixes port-mips/54309: gdb doesn't work on mips64 (32bit userland,
64bit kernel)
 1.4 28-Apr-2008  martin branches: 1.4.88;
Remove clause 3 and 4 from TNF licenses
 1.3 22-May-2007  cube branches: 1.3.28; 1.3.30; 1.3.32;
Rename si_sigval -> si_value to match POSIX RTS. [hi christos!]
 1.2 11-Dec-2005  christos branches: 1.2.18; 1.2.32; 1.2.34;
merge ktrace-lwp.
 1.1 24-Sep-2005  christos branches: 1.1.6;
more header cleanup.
 1.1.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.6.1 24-Sep-2005  skrll file siginfo.h was added on branch ktrace-lwp on 2005-11-10 14:01:40 +0000
 1.2.34.1 11-Jul-2007  mjf Sync with head.
 1.2.32.1 08-Jun-2007  ad Sync with head.
 1.2.18.3 03-Sep-2007  yamt sync with head.
 1.2.18.2 21-Jun-2006  yamt sync with head.
 1.2.18.1 11-Dec-2005  yamt file siginfo.h was added on branch yamt-lazymbuf on 2006-06-21 15:00:00 +0000
 1.3.32.1 16-May-2008  yamt sync with head.
 1.3.30.1 18-May-2008  yamt sync with head.
 1.3.28.1 02-Jun-2008  mjf Sync with HEAD.
 1.4.88.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.7.2.2 19-Nov-2019  martin Pull up following revision(s) (requested by rin in ticket #457):

sys/compat/sys/siginfo.h: revision 1.9
sys/compat/netbsd32/netbsd32.h: revision 1.131

8-byte objects on i386 or arm-oabi are aligned in 4-byte boundary.

Therefore, we must use __attribute__((__aligned__(4))) for them.
netbsd32_{,u}int64 are provided for this purpose. However, we
cannot use it in <compat/sys/siginfo.h> due to circular dependency
b/w <machine/netbsd32_machdep.h>.

In order to distangle it, we choose here to have a duplicate type,
netbsd32_siginfo_uint64, in <compat/sys/siginfo.h>. The equivalence
with netbsd32_uint64 is asserted in <compat/netbsd32/netbsd32.h>.

Now, gdb for i386 works again on amd64 kernel.

Based on patch provided by kamil. Thanks!

XXX
pullup to netbsd-9
 1.7.2.1 15-Oct-2019  martin Pull up following revision(s) (requested by kamil in ticket #311):

sys/sys/siginfo.h: revision 1.34
sys/kern/sys_ptrace_common.c: revision 1.59
sys/kern/sys_lwp.c: revision 1.70
sys/compat/sys/siginfo.h: revision 1.8
sys/kern/kern_sig.c: revision 1.365
sys/kern/kern_lwp.c: revision 1.203
sys/sys/signalvar.h: revision 1.96
sys/kern/kern_exec.c: revision 1.482
sys/kern/kern_fork.c: revision 1.214

Move TRAP_CHLD/TRAP_LWP ptrace information from struct proc to siginfo

Storing struct ptrace_state information inside struct proc was vulnerable
to synchronization bugs, as multiple events emitted in the same time were
overwritting other ones.

Cache the original parent process id in p_oppid. Reusing here p_opptr is
in theory prone to slight race codition.

Change the semantics of PT_GET_PROCESS_STATE, reutning EINVAL for calls
prompting for the value in cases when there wasn't registered an
appropriate event.

Add an alternative approach to check the ptrace_state information, directly
from the siginfo_t value returned from PT_GET_SIGINFO. The original
PT_GET_PROCESS_STATE approach is kept for compat with older NetBSD and
OpenBSD. New code is recommended to keep using PT_GET_PROCESS_STATE.
Add a couple of compile-time asserts for assumptions in the code.

No functional change intended in existing ptrace(2) software.

All ATF ptrace(2) and ATF GDB tests pass.

This change improves reliability of the threading ptrace(2) code.
 1.2 11-Dec-2005  christos branches: 1.2.18;
merge ktrace-lwp.
 1.1 13-Sep-2005  christos branches: 1.1.6;
compat code reorg.
 1.1.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.6.1 13-Sep-2005  skrll file signal.h was added on branch ktrace-lwp on 2005-11-10 14:01:40 +0000
 1.2.18.2 21-Jun-2006  yamt sync with head.
 1.2.18.1 11-Dec-2005  yamt file signal.h was added on branch yamt-lazymbuf on 2006-06-21 15:00:00 +0000
 1.3 01-Nov-2021  thorpej Use "stack_t" instead of "struct sigaltstack", as the former is the
newer standardized name. NFC.
 1.2 11-Dec-2005  christos branches: 1.2.18;
merge ktrace-lwp.
 1.1 13-Sep-2005  christos branches: 1.1.6;
compat code reorg.
 1.1.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.6.1 13-Sep-2005  skrll file signalvar.h was added on branch ktrace-lwp on 2005-11-10 14:01:40 +0000
 1.2.18.2 21-Jun-2006  yamt sync with head.
 1.2.18.1 11-Dec-2005  yamt file signalvar.h was added on branch yamt-lazymbuf on 2006-06-21 15:00:00 +0000
 1.4 30-Jun-2019  christos This code is used in 32 bit arm emulations so always expose the stack32_t
and the 32 bit machine context structure definition and types.
 1.3 27-Jun-2019  christos Always include the 32 bit structure and definitions on _LP64 regardless
of compat32 being on or off, because we want the headers to work when
compiling modular kernels. Of course the 32 bit structs do not make sense
on platforms that don't have 32 bit modes (alpha), but we don't have
a define for that and it does not hurt.
 1.2 11-Dec-2005  christos branches: 1.2.18; 1.2.166;
merge ktrace-lwp.
 1.1 13-Sep-2005  christos branches: 1.1.6;
compat code reorg.
 1.1.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.6.1 13-Sep-2005  skrll file sigtypes.h was added on branch ktrace-lwp on 2005-11-10 14:01:40 +0000
 1.2.166.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.2.18.2 21-Jun-2006  yamt sync with head.
 1.2.18.1 11-Dec-2005  yamt file sigtypes.h was added on branch yamt-lazymbuf on 2006-06-21 15:00:00 +0000
 1.19 26-Sep-2019  christos accrightslen is always used in an unsigned context so make it.
 1.18 11-Apr-2019  msaitoh Remove unused macro definitions. OK'd by pgoyette.
 1.17 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.16 19-Dec-2018  maxv Remove compat_svr4 and compat_svr4_32, as discussed on tech-kern@ recently,
but also as discussed several times in the past.
 1.15 29-Jul-2017  maxv branches: 1.15.2; 1.15.4;
Only compat_43 needs compat_osock. Note that the use of vec_compat_ifioctl
is racy.
 1.14 07-Apr-2016  mrg include opt_compat_netbsd.h to get COMPAT_SOCKCRED70 defined.
 1.13 06-Apr-2016  roy Add sc_pid to sockcred so that SOCK_DGRAM and LOCAL_CREDS socket option
can learn the process id of the AF_LOCAL sender.
Add compat glue for old structure.
 1.12 13-Feb-2009  apb branches: 1.12.22; 1.12.40;
Use "defopt MODULAR" in sys/conf/files, and #include "opt_modular.h"
in all kernel sources that use the MODULAR option.
Proposed in tech-kern on 18 Jan 2009.
 1.11 19-Jan-2009  christos branches: 1.11.2;
Provide compatibility to the old timeval SCM_TIMESTAMP messages.
 1.10 12-Nov-2008  ad Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.
 1.9 20-Aug-2007  skd branches: 1.9.22; 1.9.26; 1.9.32; 1.9.34;
Clean up net compat ioctls, and clean up handling of wireless ioctls.
 1.8 30-Jun-2007  dsl branches: 1.8.2; 1.8.6;
Changes to sompat socket function to avoid the dreaded stackgap.
 1.7 30-May-2007  christos Move the nasty ifdefs in one place. Requested by ad and dyoung.
 1.6 29-May-2007  christos Add a sockaddr_storage member to "struct ifreq" maintaining backwards
compatibility with the older ioctls. This avoids stack smashing and
abuse of "struct sockaddr" when ioctls placed "struct sockaddr_foo's" that
were longer than "struct sockaddr".
XXX: Some of the emulations might be broken; I tried to add code for
them but I did not test them.
 1.5 04-Mar-2007  christos branches: 1.5.2; 1.5.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.4 26-Jun-2006  mrg branches: 1.4.10;
version the socket(2) syscall. for compat30 socket, we use
EPROTONOSUPPORT instead of EAFNOSUPPORT.

from pavel@ with a little bit of clean up from myself.

XXX: netbsd32 (and perhaps other emulations) should be able
XXX: to call the standard socket calls for this i think, but
XXX: revisit this at another time.
 1.3 11-Dec-2005  christos branches: 1.3.4; 1.3.8; 1.3.16; 1.3.18;
merge ktrace-lwp.
 1.2 24-Sep-2005  christos branches: 1.2.6;
add struct forwards.
 1.1 24-Sep-2005  christos factor out some of the osockaddr, omsghdr code.
 1.2.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.2.6.1 24-Sep-2005  skrll file socket.h was added on branch ktrace-lwp on 2005-11-10 14:01:40 +0000
 1.3.18.4 03-Sep-2007  yamt sync with head.
 1.3.18.3 30-Dec-2006  yamt sync with head.
 1.3.18.2 21-Jun-2006  yamt sync with head.
 1.3.18.1 11-Dec-2005  yamt file socket.h was added on branch yamt-lazymbuf on 2006-06-21 15:00:00 +0000
 1.3.16.1 13-Jul-2006  gdamore Merge from HEAD.
 1.3.8.1 11-Aug-2006  yamt sync with head
 1.3.4.1 09-Sep-2006  rpaulo sync with head
 1.4.10.1 12-Mar-2007  rmind Sync with HEAD.
 1.5.4.1 11-Jul-2007  mjf Sync with head.
 1.5.2.3 20-Aug-2007  ad Sync with HEAD.
 1.5.2.2 15-Jul-2007  ad Sync with head.
 1.5.2.1 09-Jun-2007  ad Sync with head.
 1.8.6.1 03-Sep-2007  jmcneill Sync with HEAD.
 1.8.2.1 03-Sep-2007  skrll Sync with HEAD.
 1.9.34.2 03-Mar-2009  skrll Sync with HEAD.
 1.9.34.1 19-Jan-2009  skrll Sync with HEAD.
 1.9.32.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.9.26.1 04-May-2009  yamt sync with head.
 1.9.22.1 17-Jan-2009  mjf Sync with HEAD.
 1.11.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.12.40.2 28-Aug-2017  skrll Sync with HEAD
 1.12.40.1 22-Apr-2016  skrll Sync with HEAD
 1.12.22.1 03-Dec-2017  jdolecek update from HEAD
 1.15.4.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.15.4.1 10-Jun-2019  christos Sync with HEAD
 1.15.2.4 18-Jan-2019  pgoyette Don't restrict hooks to having only int or void types. Pass the hook's
type to the various macros, as needed.

Allows us to reduce diffs to original in at least one or two places (we
no longer have to provide an additional parameter to the hook routine
for returning a non-int return value).
 1.15.2.3 14-Jan-2019  pgoyette Create a variant of the HOOK macros that handles hook routines of
type void, and use them where appropriate.
 1.15.2.2 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.15.2.1 15-Oct-2018  pgoyette Convert the compat70_unp_addsockcred hook to the MP-safe mechanism.

XXX One more remaining: sysvipc50_sysctl
 1.21 28-Sep-2022  msaitoh Simplify sys/compat/sys/sockio.h. No functional change intended.

- Move some definitions from sys/compat/sockio.h to compat/net/if.h.
struct oif_data in sockio.h and if_data50 are the same, so remove oif_data.
Do the same thing to oifdatareq, too.
- u_quad_t -> uint64_t. No functional change.
 1.20 28-Sep-2022  msaitoh s/u_quad_t/uint64_t/. No functional change.
 1.19 17-May-2019  msaitoh The max subtype of the ifmedia word is 31. It's too small for Ethernet now.
We currently use use it up to 30. We should extend the limit to be able to use
more than 10Gbps speeds. Our ifmedia(4) is inconvenience and have some problem
so we should redesign the interface, but it's too late for netbsd-9 to do it.
So, we keep the data structure size and modify the structure a bit. The
strategy is almost the same as FreeBSD. Many bits of IFM_OMASK for Ethernet
have not used, so use some of them for Ethernet's subtype.

The differences against FreeBSD are:
- We use NetBSD style compat code (i.e. no SIOCGIFXMEDIA).
- FreeBSD's IFM_ETH_XTYPE's bit location is from 11 to "14" even though
IFM_OMASK is from 8 to "15". We use _IFM_ETH_XTMASK from bit 13 to "15".
- FreeBSD changed the meaning of IFM_TYPE_MATCH(). I think we should
not do it. We keep it not changing and added new IFM_TYPE_SUBTYPE_MATCH()
macro for matching both TYPE and SUBTYPE.
- Added up to 400GBASE-SR16.

New layout of the media word is as follows (from ifmedia_h):

* if_media Options word:
* Bits Use
* ---- -------
* 0-4 Media subtype MAX SUBTYPE == 255 for ETH and 31 for others
* 5-7 Media type
* 8-15 Type specific options
* 16-18 Mode (for multi-mode devices)
* 19 (Reserved for Future Use)
* 20-27 Shared (global) options
* 28-31 Instance
*
* 3 2 1
* 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
* +-------+---------------+-+-----+---------------+-----+---------+
* | | |R| | | | |
* | IMASK | GMASK |F|MMASK+-----+ OMASK |NMASK| TMASK |
* | | |U| |XTMSK| | | |
* +-------+---------------+-+-----+-----+---------+-----+---------+
* <-----> <---> <--->
* IFM_INST() IFM_MODE() IFM_TYPE()
*
* IFM_SUBTYPE(other than ETH)<------->
*
* <---> IFM_SUBTYPE(ETH)<------->
*
*
* <-------------> <------------->
* IFM_OPTIONS()
 1.18 16-Apr-2019  msaitoh Rename ifreqo2n() and ifreqo2n() to IFREQO2N_43() and IFREQN2O_43():
- ifreqo2n() and ifreqn2o() are for COMPAT_43, so add _43 to the name.
- Uppercase to make it clear those are macros.
 1.17 11-Apr-2019  msaitoh Restore sys/ioccom.h.
 1.16 11-Apr-2019  msaitoh Remove unused macro definitions. OK'd by pgoyette.
 1.15 10-Apr-2019  msaitoh Whitespace change. No functional change.
 1.14 10-Apr-2019  msaitoh Fix ifdata"o2n"() macro. This is not a real bug because this macro is not used
from anywhere. Both of SIOCGIFDATA and SIOCZIFDATA use "n2o" because
ZIFDATA is almost the same as GIFDATA except zeroing after read.
 1.13 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.12 15-Apr-2018  pgoyette branches: 1.12.2;
Remove unnecessary __BEGIN_DECLS ... __END_DECLS at Christos's suggestion.
 1.11 12-Apr-2018  christos provide vectors for the ifconf compat code and ifdatareq compat code.
 1.10 14-Nov-2010  uebayasi branches: 1.10.58;
Include sys/ioccom.h directly because it's used.
 1.9 07-Nov-2010  pooka If someone wants to define COMPAT_OIFDATA / COMPAT_OIFREQ outside
of config, let them.
 1.8 28-Nov-2009  dsl branches: 1.8.4;
Add LINUX_SIOCGIFMTU and LINUX_IP_HDRINCL support.
Fixes part of PR/31358
The other parts are rather too intrusive to be fixed as in the PR.
 1.7 13-Feb-2009  apb Use "defopt MODULAR" in sys/conf/files, and #include "opt_modular.h"
in all kernel sources that use the MODULAR option.
Proposed in tech-kern on 18 Jan 2009.
 1.6 11-Jan-2009  christos branches: 1.6.2;
merge christos-time_t
 1.5 19-Nov-2008  ad branches: 1.5.4;
Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.4 20-Aug-2007  skd branches: 1.4.4; 1.4.24; 1.4.28; 1.4.34; 1.4.36;
Clean up net compat ioctls, and clean up handling of wireless ioctls.
 1.3 30-May-2007  christos branches: 1.3.2; 1.3.4; 1.3.6; 1.3.10;
Move the nasty ifdefs in one place. Requested by ad and dyoung.
 1.2 30-May-2007  xtraeme Fix for SIOGIFCAP provided by christos, test successful.
 1.1 29-May-2007  christos Add a sockaddr_storage member to "struct ifreq" maintaining backwards
compatibility with the older ioctls. This avoids stack smashing and
abuse of "struct sockaddr" when ioctls placed "struct sockaddr_foo's" that
were longer than "struct sockaddr".
XXX: Some of the emulations might be broken; I tried to add code for
them but I did not test them.
 1.3.10.1 03-Sep-2007  jmcneill Sync with HEAD.
 1.3.6.1 03-Sep-2007  skrll Sync with HEAD.
 1.3.4.2 11-Jul-2007  mjf Sync with head.
 1.3.4.1 30-May-2007  mjf file sockio.h was added on branch mjf-ufs-trans on 2007-07-11 20:04:50 +0000
 1.3.2.5 20-Aug-2007  ad Sync with HEAD.
 1.3.2.4 15-Jul-2007  ad Sync with head.
 1.3.2.3 09-Jun-2007  ad Sync with head.
 1.3.2.2 09-Jun-2007  ad Sync with head.
 1.3.2.1 30-May-2007  ad file sockio.h was added on branch vmlocking on 2007-06-09 21:37:09 +0000
 1.4.36.2 03-Mar-2009  skrll Sync with HEAD.
 1.4.36.1 19-Jan-2009  skrll Sync with HEAD.
 1.4.34.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.4.28.2 11-Mar-2010  yamt sync with head
 1.4.28.1 04-May-2009  yamt sync with head.
 1.4.24.1 17-Jan-2009  mjf Sync with HEAD.
 1.4.4.2 03-Sep-2007  yamt sync with head.
 1.4.4.1 20-Aug-2007  yamt file sockio.h was added on branch yamt-lazymbuf on 2007-09-03 14:33:02 +0000
 1.5.4.2 27-Dec-2008  christos provide support for oifdata.
 1.5.4.1 19-Nov-2008  christos file sockio.h was added on branch christos-time_t on 2008-12-27 22:47:46 +0000
 1.6.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.8.4.1 05-Mar-2011  rmind sync with head
 1.10.58.6 22-Apr-2018  pgoyette Sync with HEAD
 1.10.58.5 16-Apr-2018  pgoyette Rename if_[45]0_{init,fini} entry points to more appropriate and more
consistent uipc_syscalls_[45]0_{init,fini} and remove some multiple
declarations.
 1.10.58.4 16-Apr-2018  pgoyette Sync with HEAD, resolve some conflicts
 1.10.58.3 15-Apr-2018  pgoyette Make compat_ifconf() and compat_ifdatareq() static
 1.10.58.2 12-Apr-2018  pgoyette Merge christos's recent changes on HEAD
 1.10.58.1 08-Mar-2018  pgoyette Declare the if_50_{init,fini} entry points
 1.12.2.1 10-Jun-2019  christos Sync with HEAD
 1.7 27-Aug-2016  dholland update comment
 1.6 04-Oct-2013  christos branches: 1.6.6;
prefix compat with __ in case __dso_hidden is not available
 1.5 04-Oct-2013  christos avoid linker warning for compat symbols that are used internally in libc,
by introducing a hidden compat_foo() function, using that internally in
libc, and exposing foo as a strong alias to compat_foo(). I am open for
better ideas.
 1.4 11-Jan-2009  christos branches: 1.4.14; 1.4.24; 1.4.28;
merge christos-time_t
 1.3 12-Dec-2007  dsl branches: 1.3.6; 1.3.8; 1.3.12; 1.3.20;
Add a definition of compat_12_stat_conv() here so I can kill compat_file.h
 1.2 11-Dec-2005  christos branches: 1.2.18; 1.2.48; 1.2.58; 1.2.60; 1.2.62;
merge ktrace-lwp.
 1.1 13-Sep-2005  christos branches: 1.1.6;
compat code reorg.
 1.1.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.6.1 13-Sep-2005  skrll file stat.h was added on branch ktrace-lwp on 2005-11-10 14:01:40 +0000
 1.2.62.1 13-Dec-2007  bouyer Sync with HEAD
 1.2.60.1 13-Dec-2007  yamt sync with head.
 1.2.58.1 26-Dec-2007  ad Sync with head.
 1.2.48.1 09-Jan-2008  matt sync with HEAD
 1.2.18.3 21-Jan-2008  yamt sync with head
 1.2.18.2 21-Jun-2006  yamt sync with head.
 1.2.18.1 11-Dec-2005  yamt file stat.h was added on branch yamt-lazymbuf on 2006-06-21 15:00:00 +0000
 1.3.20.1 19-Jan-2009  skrll Sync with HEAD.
 1.3.12.1 04-May-2009  yamt sync with head.
 1.3.8.2 09-Nov-2008  christos version mknod
 1.3.8.1 29-Mar-2008  christos Welcome to the time_t=long long dev_t=uint64_t branch.
 1.3.6.1 17-Jan-2009  mjf Sync with HEAD.
 1.4.28.1 18-May-2014  rmind sync with head
 1.4.24.2 03-Dec-2017  jdolecek update from HEAD
 1.4.24.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.4.14.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.6.6.1 05-Oct-2016  skrll Sync with HEAD
 1.5 19-Jan-2024  christos Add missing decls, make rusage_to_rusage50 static inline.
 1.4 07-Sep-2021  riastradh sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.3 03-Jul-2020  christos sync with mount.h, always use the structure size.
 1.2 03-Jul-2020  christos don't overallocate (requested by maxv@)
 1.1 22-Sep-2019  christos branches: 1.1.8;
new files for statvfs90
 1.1.8.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.1.8.1 22-Sep-2019  martin file statvfs.h was added on branch phil-wifi on 2020-04-13 08:04:17 +0000
 1.1 10-Oct-2012  christos branches: 1.1.2; 1.1.4;
compat hook.
 1.1.4.2 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.1.4.1 10-Oct-2012  tls file syslog.h was added on branch tls-maxphys on 2012-11-20 03:01:57 +0000
 1.1.2.2 30-Oct-2012  yamt sync with head
 1.1.2.1 10-Oct-2012  yamt file syslog.h was added on branch yamt-pagecache on 2012-10-30 17:20:48 +0000
 1.5 04-Oct-2013  christos prefix compat with __ in case __dso_hidden is not available
 1.4 04-Oct-2013  christos avoid linker warning for compat symbols that are used internally in libc,
by introducing a hidden compat_foo() function, using that internally in
libc, and exposing foo as a strong alias to compat_foo(). I am open for
better ideas.
 1.3 05-Nov-2009  pooka branches: 1.3.12; 1.3.22; 1.3.26;
Fling portion of time.h dealing strictly with types to a separate
time_types.h file. Include latter from former.
 1.2 11-Jan-2009  christos branches: 1.2.2; 1.2.4;
merge christos-time_t
 1.1 29-Mar-2008  christos branches: 1.1.2; 1.1.6;
file time.h was initially added on branch christos-time_t.
 1.1.6.2 11-Mar-2010  yamt sync with head
 1.1.6.1 04-May-2009  yamt sync with head.
 1.1.2.4 04-Jan-2009  christos fix casts of tv_sec and tv_usec
 1.1.2.3 20-Nov-2008  christos old timeval was long, long.
 1.1.2.2 08-Nov-2008  christos expose more functions to userland
 1.1.2.1 29-Mar-2008  christos new files
 1.2.4.2 19-Jan-2009  skrll Sync with HEAD.
 1.2.4.1 11-Jan-2009  skrll file time.h was added on branch nick-hppapmap on 2009-01-19 13:17:45 +0000
 1.2.2.2 17-Jan-2009  mjf Sync with HEAD.
 1.2.2.1 11-Jan-2009  mjf file time.h was added on branch mjf-devfs2 on 2009-01-17 13:28:49 +0000
 1.3.26.1 18-May-2014  rmind sync with head
 1.3.22.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.3.12.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.6 07-Sep-2021  riastradh sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.5 15-Jun-2018  kre branches: 1.5.6;

Revert previous, mrg's fix is better (even with possible namespace issues,
which I guess are not great in compat includes) .... the perils of two
people doing fixes at around the same time.
 1.4 15-Jun-2018  kre If we are going to use offsetof() we'd need to include <stddef.h> to
get it defined. Rather than deal with potential namespace issues
with that, just clear the entire struct, rather than attempting to
stop after the potential padding field. If the compiler is good enough
it should make no difference (there are just 3 fields, 2 named ones
are assigned to, immediately after the memset() - the compiler can
detect that, and not bother assigning (via memset()) to the unmamed
3rd padding field). If the compiler is not smart enough to deal
with this, then I doubt writing 8 more zero bytes will make enough
difference to matter.
 1.3 15-Jun-2018  mrg include libkern.h or string.h & stddef.h, to get the offsetof()
and memset() definitions.
 1.2 14-Jun-2018  uwe timespec_to_timespec50 - don't leak kernel memory in struct padding.

On 64-bit machines struct timespec50 has padding between 32-bit tv_sec
and long tv_nsec that is not affected by normal assignment. Scrub it.
The result is most likely about to be passed to the user space by the
caller, so do it here to take care of them all.
 1.1 05-Nov-2009  pooka branches: 1.1.4; 1.1.40; 1.1.44; 1.1.52; 1.1.58; 1.1.64;
Fling portion of time.h dealing strictly with types to a separate
time_types.h file. Include latter from former.
 1.1.64.1 25-Jun-2018  pgoyette Sync with HEAD
 1.1.58.2 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1836):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.1.58.1 03-Jan-2019  martin Additionally pull up the following for ticket #1151:

sys/compat/sys/time_types.h 1.3

include libkern.h or string.h & stddef.h, to get the offsetof()
and memset() definitions.
 1.1.52.1 03-Jan-2019  martin Additionally pull up the following for ticket #1668:

sys/compat/sys/time_types.h 1.3

include libkern.h or string.h & stddef.h, to get the offsetof()
and memset() definitions.
 1.1.44.1 03-Jan-2019  martin Additionally pull up the following for ticket #1668:

sys/compat/sys/time_types.h 1.3

include libkern.h or string.h & stddef.h, to get the offsetof()
and memset() definitions.
 1.1.40.1 03-Jan-2019  martin Additionally pull up the following for ticket #1668:

sys/compat/sys/time_types.h 1.3

include libkern.h or string.h & stddef.h, to get the offsetof()
and memset() definitions.
 1.1.4.2 11-Mar-2010  yamt sync with head
 1.1.4.1 05-Nov-2009  yamt file time_types.h was added on branch yamt-nfs-mp on 2010-03-11 15:03:20 +0000
 1.5.6.1 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.3 11-Dec-2005  christos branches: 1.3.18;
merge ktrace-lwp.
 1.2 15-Sep-2005  christos branches: 1.2.6;
Fix a comment.
 1.1 13-Sep-2005  christos compat code reorg.
 1.2.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.2.6.1 15-Sep-2005  skrll file times.h was added on branch ktrace-lwp on 2005-11-10 14:01:40 +0000
 1.3.18.2 21-Jun-2006  yamt sync with head.
 1.3.18.1 11-Dec-2005  yamt file times.h was added on branch yamt-lazymbuf on 2006-06-21 15:00:00 +0000
 1.2 11-Jan-2009  christos merge christos-time_t
 1.1 29-May-2006  drochner branches: 1.1.2; 1.1.6; 1.1.8; 1.1.10; 1.1.16; 1.1.66; 1.1.68; 1.1.72; 1.1.82;
Extend "struct ntptimeval" for the needs of "timecounters".
Allocate a new syscall for ntp_gettime() and set up COMPAT_30 for
the old one.
 1.1.82.1 19-Jan-2009  skrll Sync with HEAD.
 1.1.72.1 04-May-2009  yamt sync with head.
 1.1.68.2 30-Mar-2008  christos does not return void
 1.1.68.1 29-Mar-2008  christos Welcome to the time_t=long long dev_t=uint64_t branch.
 1.1.66.1 17-Jan-2009  mjf Sync with HEAD.
 1.1.16.2 09-Sep-2006  rpaulo sync with head
 1.1.16.1 29-May-2006  rpaulo file timex.h was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:46:39 +0000
 1.1.10.2 26-Jun-2006  yamt sync with head.
 1.1.10.1 29-May-2006  yamt file timex.h was added on branch yamt-pdpolicy on 2006-06-26 12:46:37 +0000
 1.1.8.2 21-Jun-2006  yamt sync with head.
 1.1.8.1 29-May-2006  yamt file timex.h was added on branch yamt-lazymbuf on 2006-06-21 15:00:00 +0000
 1.1.6.2 19-Jun-2006  chap Sync with head.
 1.1.6.1 29-May-2006  chap file timex.h was added on branch chap-midi on 2006-06-19 03:46:56 +0000
 1.1.2.2 01-Jun-2006  kardel Sync with head.
 1.1.2.1 29-May-2006  kardel file timex.h was added on branch simonb-timecounters on 2006-06-01 22:36:01 +0000
 1.5 27-Jun-2019  christos Always include the 32 bit structure and definitions on _LP64 regardless
of compat32 being on or off, because we want the headers to work when
compiling modular kernels. Of course the 32 bit structs do not make sense
on platforms that don't have 32 bit modes (alpha), but we don't have
a define for that and it does not hurt.
 1.4 28-Jan-2019  christos - provide a hook for the 43 tty ioctls
- make the 60 tty ioctl hook look the same
- fix the tty code to call both hooks and remove unused lock
 1.3 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.2 19-Oct-2012  apb branches: 1.2.2; 1.2.4; 1.2.40; 1.2.42;
Fix NetBSD version number in a comment
 1.1 19-Oct-2012  apb Add COMPAT_60 versions of the TIOCPTMGET and TIOCPTSNAME ioctls.
 1.2.42.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.2.42.1 10-Jun-2019  christos Sync with HEAD
 1.2.40.1 04-Sep-2018  pgoyette Separate COMPAT_BSDPTY stuff from tty COMPAT_60 stuff. Enables
building of COMPAT_60 module whether or not COMPAT_BSDPTY is
defined in the kernel.
 1.2.4.2 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.2.4.1 19-Oct-2012  tls file ttycom.h was added on branch tls-maxphys on 2012-11-20 03:01:57 +0000
 1.2.2.2 30-Oct-2012  yamt sync with head
 1.2.2.1 19-Oct-2012  yamt file ttycom.h was added on branch yamt-pagecache on 2012-10-30 17:20:48 +0000
 1.8 30-Jun-2019  christos This code is used in 32 bit arm emulations so always expose the stack32_t
and the 32 bit machine context structure definition and types.
 1.7 27-Jun-2019  christos Always include the 32 bit structure and definitions on _LP64 regardless
of compat32 being on or off, because we want the headers to work when
compiling modular kernels. Of course the 32 bit structs do not make sense
on platforms that don't have 32 bit modes (alpha), but we don't have
a define for that and it does not hurt.
 1.6 21-May-2012  martin branches: 1.6.40;
Calling _lwp_create() with a bogus ucontext could trigger a kernel
assertion failure (and thus a crash in DIAGNOSTIC kernels). Independently
discovered by YAMAMOTO Takashi and Joel Sing.

To avoid this, introduce a cpu_mcontext_validate() function and move all
sanity checks from cpu_setmcontext() there. Also untangle the netbsd32
compat mess slightly and add a cpu_mcontext32_validate() cousin there.

Add an exhaustive atf test case, based partly on code from Joel Sing.

Should finally fix the remaining open part of PR kern/43903.
 1.5 18-Mar-2012  njoly Add missing semi-colon.
 1.4 23-Feb-2011  joerg branches: 1.4.4; 1.4.8; 1.4.10;
Fix ucontext32_t on AMD64. Add optional compile time assertions for
ucontext_t and ucontext32_t to ensure that they don't change.
Provide the constants for AMD64, ARM, i386, and M68K.
 1.3 28-Apr-2008  martin branches: 1.3.22; 1.3.28; 1.3.30;
Remove clause 3 and 4 from TNF licenses
 1.2 11-Dec-2005  christos branches: 1.2.18; 1.2.72; 1.2.74; 1.2.76;
merge ktrace-lwp.
 1.1 13-Sep-2005  christos branches: 1.1.6;
add compat netbsd32 context.
 1.1.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.6.1 13-Sep-2005  skrll file ucontext.h was added on branch ktrace-lwp on 2005-11-10 14:01:40 +0000
 1.2.76.1 16-May-2008  yamt sync with head.
 1.2.74.1 18-May-2008  yamt sync with head.
 1.2.72.1 02-Jun-2008  mjf Sync with HEAD.
 1.2.18.2 21-Jun-2006  yamt sync with head.
 1.2.18.1 11-Dec-2005  yamt file ucontext.h was added on branch yamt-lazymbuf on 2006-06-21 15:00:00 +0000
 1.3.30.1 05-Mar-2011  bouyer Sync with HEAD
 1.3.28.1 06-Jun-2011  jruoho Sync with HEAD.
 1.3.22.1 05-Mar-2011  rmind sync with head
 1.4.10.2 25-Jun-2012  riz Pull up following revision(s) (requested by jdc in ticket #371):
sys/compat/sys/ucontext.h: revision 1.5
sys/sys/ucontext.h: revision 1.15
Add a semicolon to __CTASSERT() since it was removed from the macro
in cdefs.h rev 1.97 by christos.
Add missing semi-colon.
 1.4.10.1 21-May-2012  riz Pull up following revision(s) (requested by martin in ticket #274):
sys/arch/amd64/amd64/process_machdep.c: revision 1.20
sys/kern/sys_lwp.c: revision 1.54
sys/arch/sparc64/sparc64/machdep.c: revision 1.267
sys/arch/mips/mips/cpu_subr.c: revision 1.16
sys/arch/vax/vax/machdep.c: revision 1.188
sys/sys/lwp.h: revision 1.161
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.98
sys/arch/alpha/alpha/machdep.c: revision 1.339
sys/compat/sys/ucontext.h: revision 1.6
sys/arch/hppa/hppa/hppa_machdep.c: revision 1.28
distrib/sets/lists/tests/mi: revision 1.469
sys/arch/powerpc/powerpc/sig_machdep.c: revision 1.42
tests/lib/libc/sys/t_lwp_create.c: revision 1.1
tests/lib/libc/sys/Makefile: revision 1.23
sys/arch/arm/arm/sig_machdep.c: revision 1.42
sys/arch/amd64/include/mcontext.h: revision 1.15
sys/arch/amd64/amd64/machdep.c: revision 1.183
sys/arch/sh3/sh3/sh3_machdep.c: revision 1.99
sys/arch/i386/i386/machdep.c: revision 1.727
sys/compat/netbsd32/netbsd32_lwp.c: revision 1.13
sys/arch/sparc/sparc/machdep.c: revision 1.319
sys/arch/amd64/amd64/netbsd32_machdep.c: revision 1.76
sys/arch/m68k/m68k/sig_machdep.c: revision 1.49
sys/sys/ucontext.h: revision 1.16
sys/arch/mips/mips/netbsd32_machdep.c: revision 1.9
lib/libc/sys/_lwp_create.2: revision 1.5
Calling _lwp_create() with a bogus ucontext could trigger a kernel
assertion failure (and thus a crash in DIAGNOSTIC kernels). Independently
discovered by YAMAMOTO Takashi and Joel Sing.
To avoid this, introduce a cpu_mcontext_validate() function and move all
sanity checks from cpu_setmcontext() there. Also untangle the netbsd32
compat mess slightly and add a cpu_mcontext32_validate() cousin there.
Add an exhaustive atf test case, based partly on code from Joel Sing.
Should finally fix the remaining open part of PR kern/43903.
 1.4.8.2 02-Jun-2012  mrg sync to latest -current.
 1.4.8.1 05-Apr-2012  mrg sync to latest -current.
 1.4.4.2 23-May-2012  yamt sync with head.
 1.4.4.1 17-Apr-2012  yamt sync with head
 1.6.40.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.2 15-Mar-2018  christos branches: 1.2.2;
tidy up
 1.1 15-Mar-2018  christos add uvm swap compat code.
 1.2.2.2 15-Mar-2018  pgoyette Synch with HEAD
 1.2.2.1 15-Mar-2018  pgoyette file uvm.h was added on branch pgoyette-compat on 2018-03-15 09:12:05 +0000
 1.2 11-Jan-2009  christos branches: 1.2.2; 1.2.4; 1.2.8;
merge christos-time_t
 1.1 09-Nov-2008  christos branches: 1.1.2;
file wait.h was initially added on branch christos-time_t.
 1.1.2.1 09-Nov-2008  christos add wait stuff.
 1.2.8.2 04-May-2009  yamt sync with head.
 1.2.8.1 11-Jan-2009  yamt file wait.h was added on branch yamt-nfs-mp on 2009-05-04 08:12:28 +0000
 1.2.4.2 19-Jan-2009  skrll Sync with HEAD.
 1.2.4.1 11-Jan-2009  skrll file wait.h was added on branch nick-hppapmap on 2009-01-19 13:17:45 +0000
 1.2.2.2 17-Jan-2009  mjf Sync with HEAD.
 1.2.2.1 11-Jan-2009  mjf file wait.h was added on branch mjf-devfs2 on 2009-01-17 13:28:49 +0000
 1.1 20-Jan-2024  christos add compat decls
 1.6 14-Jan-2014  christos use new bsd.syscall.mk
 1.5 11-Dec-2005  christos branches: 1.5.110; 1.5.120; 1.5.126;
merge ktrace-lwp.
 1.4 26-Feb-2005  perry make this rebuild generated files by default
 1.3 15-Nov-2003  thorpej branches: 1.3.8; 1.3.10;
We have CVS; there is no reason to make .bak files when generating the
syscall tables.
 1.2 26-Oct-2003  lukem Use ${HOST_SH} instead of `sh'.

If necessary, pull in <bsd.sys.mk> to get the definition of HOST_SH;
Makefiles that pull in one of (most of) <bsd.*.mk> will get this anyway.
 1.1 03-Sep-1996  mycroft branches: 1.1.2; 1.1.64;
Give every emulation its own Makefile for the syscall table.
 1.1.64.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.1.64.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.64.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.64.1 03-Aug-2004  skrll Sync with HEAD
 1.1.2.2 10-Dec-1996  mycroft From trunk:
Give all the emulations a consistent Makefile.
 1.1.2.1 03-Sep-1996  mycroft file Makefile was added on branch netbsd-1-2 on 1996-12-10 08:38:25 +0000
 1.3.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.3.8.1 29-Apr-2005  kent sync with -current
 1.5.126.1 18-May-2014  rmind sync with head
 1.5.120.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.5.110.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.7 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.6 17-Nov-2014  uebayasi branches: 1.6.18; 1.6.20;
Define compat modules (but without dependencies yet).
 1.5 19-Nov-2008  ad branches: 1.5.26;
Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.4 09-Dec-2000  jdolecek branches: 1.4.122; 1.4.126; 1.4.132; 1.4.136;
split ecoff specific code to separate file ultrix_exec_ecoff.c
 1.3 07-Jan-1996  jonathan branches: 1.3.30;
Add '/emul/ultrix' pathname processing to Ultrix emulation, and move
Ultrix syscalls that require that processing out of ultrix_misc.c
to ultrix_pathname.c.
 1.2 26-Dec-1995  jonathan Add emulation of Ultrix select: before calling native sys_select(),
limit the number of FDs to select on to the maximum supported by NetBSD --
which is as many FDs as the emul_ultrix process can have open, anyway.

Add emulation of Ultrix getmnt(2) in ultrix_fs.c

Add partial emulation of Ultrix tty ioctl()s in ultrix_ioctl.c, derived
from compat/sunos/sunos_ioctl.c. Ultrix libc's ``isatty()'' now works
in compat_emul processes.
 1.1 20-Sep-1995  thorpej Add common file lists, similar to what the other emulation modules use.
 1.3.30.1 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.4.136.1 19-Jan-2009  skrll Sync with HEAD.
 1.4.132.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.4.126.1 04-May-2009  yamt sync with head.
 1.4.122.1 17-Jan-2009  mjf Sync with HEAD.
 1.5.26.1 03-Dec-2017  jdolecek update from HEAD
 1.6.20.1 10-Jun-2019  christos Sync with HEAD
 1.6.18.1 12-Mar-2018  pgoyette Update dependencies for modules when they are built-in. Now we don't
(or at least, shouldn't) need reminders in the GENERIC config files
about which module options require other options.

Update branch status doc accordingly.
 1.7 19-Sep-1995  thorpej Obsolete; use the one in /sys/kern
 1.6 02-Dec-1994  dean new sysent version.
 1.5 30-Jun-1994  cgd fix a botch, and gen syscall files
 1.4 30-Jun-1994  cgd fix up for new ID format, and consistency
 1.3 29-Jun-1994  cgd New RCS ID's, take two. they're more aesthecially pleasant, and use 'NetBSD'
 1.2 15-Jun-1994  glass much works but untested w/new fs. expect more tomorrow
 1.1 02-Jun-1994  glass first swipe at ultrix compat. expect many bug fixes. very related to compat/sunos
 1.4 01-Nov-2002  jdolecek set nsysent to 512 (oh well, just three syscalls too many for 256)
 1.3 18-Dec-1998  drochner branches: 1.3.20;
remove compat_xxx dependencies where they don't belong
 1.2 22-Jan-1998  mycroft This doesn't actually use COMPAT_10.
 1.1 23-Nov-1994  dean changes for new sysent structure (from J. Stone)
 1.3.20.1 11-Nov-2002  nathanw Catch up to -current
 1.58 03-Mar-2019  pgoyette The compat_09_{get,set}domainname() syscalls should not be defined
based on existence of COMPAT_09. Make them modular instead, and
reference the compat_09 module.
 1.57 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.56 06-Jan-2018  kamil branches: 1.56.2; 1.56.4;
Revert vadvise(2) removal

This system call was used in legacy Lisp code, that was inherited to modern
age and still compiled against supported compat layers (e.g. in clisp,
oaklisp, Franz Lisp).

It used to instruct the kernel about paging policy (G/C aware, flush etc).

Newly compiled code (assuming that it will detect vadvise()) will use the
libc stub for vadvise(). The headers for this interface are gone.

vadvise(2) could be marked as COMPAT_80, but as long as we support ultrix,
sunos or aout68k ABI, don't bother with this.

Requested by <mrg>
 1.55 19-Dec-2017  kamil compat/ultrix: Drop SYS_vadvise

The (o)vadvise syscall is dummy since the beginning of NetBSD.

Sponsored by <The NetBSD Foundation>
 1.54 19-Dec-2017  kamil compat/ultrix: Drop SYS_sbrk

sbrk - change data segment size

This syscall is dummy since the inception of the project.

Sponsored by <The NetBSD Foundation>
 1.53 19-Dec-2017  kamil compat ultrix: Drop the sstk(2) syscall

sstk(2) has never been implemented by the NetBSD kernel.

Sponsored by <The NetBSD Foundation>
 1.52 07-Nov-2013  njoly Fix dup/dup2/dup3 argument types (u_int -> int).
 1.51 02-Mar-2010  pooka branches: 1.51.10; 1.51.20; 1.51.24;
Kill fs_nfs.h and #ifdef NFS by making getfh() support unconditional
and nfssvc unsupport unconditional. nfs server was just a fancy
NOP anyway for all except Ultrix. I know I'm boring but I couldn't
imagine why someone would want to run an Ultrix nfs server (and I
also doubt that it would work anymore with all the changes to fs
exporting etc).
 1.50 17-Jan-2009  he branches: 1.50.4;
Adapt to the state after the recent time_t change.
Type changes:
timeval -> timeval50
itimerval -> itimerval50
rusage -> rusage50
and use of the compat_50 calls where appropriate.
Untested, but at least it builds.

Discussed with christos@
 1.49 13-Jan-2009  pooka Convert the syscalls.master to a format from which it is easier
to parse and generate the compat name and basename (e.g. __stat50
and stat). Use this to autogenerate __RENAME()'s to the rump_syscalls
header so that they can be called e.g. rump_sys_socket() instead
of rump_sys___socket30().
 1.48 13-Jan-2009  pooka UNIMPL police (two mount syscalls with the same signature?!?)
 1.47 19-Nov-2008  ad Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.46 19-Jun-2008  hans branches: 1.46.2; 1.46.4;
include <sys/sched.h> for cpuset_t
 1.45 23-Apr-2008  ad branches: 1.45.2; 1.45.4; 1.45.6;
-SYCALL_MPSAFE
 1.44 04-Mar-2007  christos branches: 1.44.36; 1.44.38;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.43 09-Feb-2007  ad branches: 1.43.2;
Merge newlock2 to head.
 1.42 13-Jul-2006  pavel branches: 1.42.4;
use the COMPAT_30 getfh.
 1.41 26-Jun-2006  mrg version the socket(2) syscall. for compat30 socket, we use
EPROTONOSUPPORT instead of EAFNOSUPPORT.

from pavel@ with a little bit of clean up from myself.

XXX: netbsd32 (and perhaps other emulations) should be able
XXX: to call the standard socket calls for this i think, but
XXX: revisit this at another time.
 1.40 11-Dec-2005  christos branches: 1.40.4; 1.40.8; 1.40.16;
merge ktrace-lwp.
 1.39 26-Feb-2005  perry branches: 1.39.4;
nuke trailing whitespace
 1.38 18-Jan-2003  thorpej branches: 1.38.2; 1.38.10; 1.38.12;
Merge the nathanw_sa branch.
 1.37 30-May-2001  mrg use _KERNEL_OPT.
 1.36 27-Jan-2001  thorpej branches: 1.36.2;
getpid(2) is MP-safe.
 1.35 09-Dec-2000  mycroft Add the %% separators.
 1.34 09-Dec-2000  mycroft Add the %% separators.
 1.33 30-Nov-2000  jdolecek LKMify
 1.32 30-Jul-1999  drochner branches: 1.32.2;
emulate fcntl(F_SETLK) & Co.
(seti@home works now:-)
 1.31 12-Jul-1999  kleink XSH5: change function signature to `void *sbrk(intptr_t)'.
 1.30 09-Feb-1999  christos branches: 1.30.2; 1.30.4;
const poisoning and CHECK_ALT_CREAT fixes.
 1.29 18-Dec-1998  drochner remove compat_xxx dependencies where they don't belong
 1.28 10-Dec-1998  christos Defopt COMPAT_43
 1.27 03-Oct-1998  drochner Use a private implementation of sys_sigvec(). Ultrix uses an sv_flags bit
unknown to NetBSD and sigaction1() does (now?) complain about it.
 1.26 26-Sep-1998  drochner Make Ultrix emulation private functions for sigreturn and sigsuspend
because the NetBSD implementation differs now.
 1.25 25-Jun-1998  thorpej defopt NFSSERVER
 1.24 19-Feb-1998  thorpej Include the NFS option header.
 1.23 14-Feb-1998  kleink Use sys___posix_{chown,fchown}() instead of sys_{chown,fchown}().
 1.22 16-Oct-1997  christos ostat -> stat43
 1.21 13-Jun-1997  thorpej Use compat_12_sys_swapon().
 1.20 09-Jun-1997  jonathan Emulate RISC Ultrix cacheflush() and cachectl() syscalls on mips.
 1.19 09-Jun-1997  jonathan Declare ultrix_sys_symshs(). Ultrix uses the standard (BRL?) hack to
implement sysV shm using one system call.
 1.18 31-Jan-1997  thorpej branches: 1.18.2;
NFSCLIENT -> NFS
 1.17 03-Sep-1996  mycroft branches: 1.17.2;
Define execv() and execve() consistently across emulations.
Do path name translation.
 1.16 23-Jun-1996  mycroft Catch up with setre[ug]id() changes.
 1.15 07-Jan-1996  jonathan branches: 1.15.4;
Add '/emul/ultrix' pathname processing to Ultrix emulation, and move
Ultrix syscalls that require that processing out of ultrix_misc.c
to ultrix_pathname.c.
 1.14 26-Dec-1995  jonathan Add emulation of ultrix mount(2). Sufficient to NFS-mount filesystems
using a NetBSD kernel in an ultrix root filesystem.

Move wait emulation to the old (v7) wait syscall number, as that's
what the Ultrix ufs_mount binary uses.
 1.13 26-Dec-1995  jonathan Fix ultrix_sys_select() entry.
 1.12 26-Dec-1995  jonathan Add emulation of Ultrix select: before calling native sys_select(),
limit the number of FDs to select on to the maximum supported by NetBSD --
which is as many FDs as the emul_ultrix process can have open, anyway.

Add emulation of Ultrix getmnt(2) in ultrix_fs.c

Add partial emulation of Ultrix tty ioctl()s in ultrix_ioctl.c, derived
from compat/sunos/sunos_ioctl.c. Ultrix libc's ``isatty()'' now works
in compat_emul processes.
 1.11 07-Oct-1995  mycroft Prefix names of system call implementation functions with `sys_'.
 1.10 01-Jun-1995  mellon Clear up name conflict between Ultrix syscall 103 and 139.
 1.9 01-Feb-1995  mellon Fix up some incompatibilities and some indentation botches
 1.8 02-Dec-1994  dean fixed typo
 1.7 01-Dec-1994  dean added sigreturn
 1.6 23-Nov-1994  dean changes for new sysent structure (from J. Stone)
 1.5 01-Aug-1994  glass ultrix_{get,set}info from Arne H Juul <arnej@dsl.unit.no>
 1.4 29-Jun-1994  cgd branches: 1.4.2;
New RCS ID's, take two. they're more aesthecially pleasant, and use 'NetBSD'
 1.3 22-Jun-1994  glass update for getdtablesize change, and track compat_sunos
 1.2 15-Jun-1994  glass much works but untested w/new fs. expect more tomorrow
 1.1 02-Jun-1994  glass first swipe at ultrix compat. expect many bug fixes. very related to compat/sunos
 1.4.2.1 01-Aug-1994  cgd From trunk.
 1.15.4.2 10-Dec-1996  mycroft From trunk:
Do execv() and execve() path name translation consistently across
emulations.
 1.15.4.1 10-Dec-1996  mycroft From trunk:
Implement setre[ug]id() for real.
 1.17.2.1 14-Jan-1997  thorpej Snapshot of work-in-progress, committed to private branch.

These changes implement machine-independent root device and file system
selection. Notable features:

- All ports behave in a consistent manner regarding root
device selection.
- No more "options GENERIC"; all kernels have the ability
to boot with RB_ASKNAME to select root device and file system
type.
- Root file system type can be wildcarded; a machine-independent
function will try all possible file systems for the selected
root device until one succeeds.
- If the root file system fails to mount, the operator will
be given the chance to select a new root device and file
system type, rather than having the machine simply panic.
- nfs_mountroot() no longer panics if any part of the NFS
mount process fails; it now returns an error, giving the
operator a chance to recover.
- New, more consistent, config(8) grammar. The constructs:

config netbsd swap generic
config netbsd root on nfs

have been replaced with:

config netbsd root on ? type ?
config netbsd root on ? type nfs

Additionally, the operator may select or wildcard root file
system type in the kernel configuration file:

config netbsd root on cd0a type cd9660

config(8) now requires that a "root" specification be
made. "root" may be wired down or wildcarded. "swap" and
"dump" specifications are optional, and follow previous
semantics.

- config(8) has a new "file-system" keyword, used to configure
file systems into the kernel. Eventually, this will be used
to generate the default vfssw[].

- "options NFSCLIENT" is obsolete, and is replaced by
"file-system NFS". "options NFSSERVER" still exists, since
NFS server support is independent of the NFS file system
client.

- sys/arch/<foo>/<foo>/swapgeneric.c is no longer used, and
will be removed; all information is now generated by config(8).

As of this commit, all ports except arm32 have been updated to use
the new setroot(). Only SPARC, i386, and Alpha ports have been
tested at this time. Port masters should test these changes on their
ports, and report any problems back to me.

More changes are on their way, including RB_ASKNAME support in
nfs_mountroot() (to prompt for server address and path) and, potentially,
the ability to select rarp/bootparam or bootp in nfs_mountroot().
 1.18.2.1 12-Feb-1997  mrg initial work for dynamic swap additions.
 1.30.4.1 02-Aug-1999  thorpej Update from trunk.
 1.30.2.1 31-Jan-2000  he Pull up revision 1.32 (requested by mhitch):
Emulate Ultrix fcntl(F_SETLK) & Co. so the Ultrix seti@home client
works.
 1.32.2.3 11-Feb-2001  bouyer Sync with HEAD.
 1.32.2.2 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.32.2.1 08-Dec-2000  bouyer Sync with HEAD.
 1.36.2.2 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.36.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.38.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.38.10.1 29-Apr-2005  kent sync with -current
 1.38.2.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.39.4.3 03-Sep-2007  yamt sync with head.
 1.39.4.2 26-Feb-2007  yamt sync with head.
 1.39.4.1 30-Dec-2006  yamt sync with head.
 1.40.16.1 13-Jul-2006  gdamore Merge from HEAD.
 1.40.8.1 11-Aug-2006  yamt sync with head
 1.40.4.1 09-Sep-2006  rpaulo sync with head
 1.42.4.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.43.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.44.38.1 18-May-2008  yamt sync with head.
 1.44.36.3 17-Jan-2009  mjf Sync with HEAD.
 1.44.36.2 29-Jun-2008  mjf Sync with HEAD.
 1.44.36.1 02-Jun-2008  mjf Sync with HEAD.
 1.45.6.1 27-Jun-2008  simonb Sync with head.
 1.45.4.3 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.45.4.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.45.4.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.45.2.2 11-Mar-2010  yamt sync with head
 1.45.2.1 04-May-2009  yamt sync with head.
 1.46.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.46.2.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.50.4.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.51.24.1 18-May-2014  rmind sync with head
 1.51.20.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.51.10.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.56.4.1 10-Jun-2019  christos Sync with HEAD
 1.56.2.1 29-Sep-2018  pgoyette Conditionalize compat_09_sys_{get,set}domainname syscalls appropriately.
 1.7 15-Dec-2019  tsutsui Remove clause 3 and 4 leftovers from TNF licenses in more sources.

Confirmed by martin@ in PR/54760.
 1.6 19-Nov-2008  ad branches: 1.6.68; 1.6.72;
Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.5 11-Dec-2005  christos branches: 1.5.70; 1.5.74; 1.5.80; 1.5.84;
merge ktrace-lwp.
 1.4 21-Apr-2004  simonb branches: 1.4.12;
ANSIfy, some KNF.
 1.3 29-Jun-2003  fvdl branches: 1.3.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.2 29-Jun-2003  simonb Fix 'struct lwp *' lossage.
 1.1 21-Nov-2000  jdolecek branches: 1.1.2;
restructure struct emul and execsw, in preparation to make emulations LKMable:
* move all exec-type specific information from struct emul to execsw[] and
provide single struct emul per emulation
* elf:
- kern/exec_elf32.c:probe_funcs[] is gone, execsw[] how has one entry
per emulation and contains pointer to respective probe function
- interp is allocated via MALLOC() rather than on stack
- elf_args structure is allocated via MALLOC() rather than malloc()
* ecoff: the per-emulation hooks moved from alpha and mips specific code
to OSF1 and Ultrix compat code as appropriate, execsw[] has one entry per
emulation supporting ecoff with appropriate probe function
* the makecmds/probe functions don't set emulation, pointer to emulation is
part of appropriate execsw[] entry
* constify couple of structures
 1.1.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.1.2.1 21-Nov-2000  bouyer file ultrix_exec.h was added on branch thorpej_scsipi on 2000-11-22 16:03:00 +0000
 1.3.2.4 28-Nov-2004  skrll Adapt to branch
 1.3.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.2.1 03-Aug-2004  skrll Sync with HEAD
 1.4.12.1 21-Jun-2006  yamt sync with head.
 1.5.84.1 19-Jan-2009  skrll Sync with HEAD.
 1.5.80.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.5.74.1 04-May-2009  yamt sync with head.
 1.5.70.1 17-Jan-2009  mjf Sync with HEAD.
 1.6.72.1 18-Dec-2019  martin Pull up following revision(s) (requested by tsutsui in ticket #570):

sys/compat/netbsd32/netbsd32_compat_50_sysv.c: revision 1.3
sys/dev/raidframe/rf_compat50.h: revision 1.6
sys/arch/emips/emips/bus_space.c: revision 1.3
sys/compat/net/if.h: revision 1.5
sys/arch/emips/stand/common/bootinfo.c: revision 1.2
sys/compat/common/sysv_msg_50.c: revision 1.5
sys/compat/common/kern_time_30.c: revision 1.8
sys/arch/emips/stand/common/bootinfo.h: revision 1.2
sys/arch/ia64/include/bus.h: revision 1.4
sys/arch/ia64/ia64/bus_space.c: revision 1.2
sys/compat/common/sysv_shm_50.c: revision 1.5
sys/dev/ic/adw.h: revision 1.15
sys/compat/common/uipc_syscalls_50.c: revision 1.10
sys/arch/emips/ebus/flash_ebus.c: revision 1.22
sys/dev/ic/adv.h: revision 1.15
sys/dev/ic/adwmcode.c: revision 1.18
sys/dev/ic/advlib.c: revision 1.29
sys/arch/hpcarm/include/kloader.h: revision 1.3
sys/dev/usb/uberry.c: revision 1.16
sys/compat/common/sysv_sem_50.c: revision 1.5
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.43
sys/dev/ic/advlib.h: revision 1.21
sys/dev/ic/adv.c: revision 1.50
sys/compat/netinet6/in6_var.h: revision 1.5
sys/arch/hpc/stand/hpcboot/arm/arm_sa1100_asm.asm: revision 1.2
sys/arch/emips/include/loadfile_machdep.h: revision 1.3
sys/arch/emips/stand/common/prom_iface.c: revision 1.7
sys/dev/ic/adw.c: revision 1.56
sys/dev/ic/adwmcode.h: revision 1.12
sys/dev/ic/advmcode.c: revision 1.10
sys/arch/emips/ebus/ace_ebus.c: revision 1.22
sys/compat/netbsd32/netbsd32_compat_60.c: revision 1.5
sys/dev/raidframe/rf_compat50.c: revision 1.13
sys/arch/x68k/dev/intiovar.h: revision 1.15
sys/dev/usb/uipad.c: revision 1.8
sys/arch/zaurus/include/kloader.h: revision 1.3
sys/arch/emips/stand/common/bootxx.c: revision 1.2
sys/dev/ic/adwlib.h: revision 1.23
sys/dev/ic/adwlib.c: revision 1.44
sys/compat/netbsd32/netbsd32_compat_16.c: revision 1.3
sys/arch/amigappc/include/intr.h: revision 1.27
sys/arch/x68k/dev/mfp.c: revision 1.27
sys/arch/arm/at91/at91dbgu.c: revision 1.17
sys/dev/ic/advmcode.h: revision 1.7
sys/compat/ultrix/ultrix_exec.h: revision 1.7
sys/compat/common/vfs_syscalls_50.c: revision 1.24
sys/arch/mips/cavium/octeon_dma.c: revision 1.3
sys/arch/hpc/stand/hpcboot/arm/arm_pxa2x0_asm.asm: revision 1.2

Remove clause 3 and 4 from TNF licenses.
Ok'ed by martin@ in PR/54760.

Remove clause 3 and 4 leftovers from TNF licenses in more sources.
Confirmed by martin@ in PR/54760.
 1.6.68.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.9 11-Dec-2005  christos merge ktrace-lwp.
 1.8 26-Feb-2005  perry branches: 1.8.4;
nuke trailing whitespace
 1.7 21-Apr-2004  simonb branches: 1.7.4; 1.7.6;
ANSIfy, some KNF.
 1.6 13-Feb-2004  wiz Uppercase CPU, plural is CPUs.
 1.5 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.4 29-Jun-2003  fvdl branches: 1.4.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.3 29-Jun-2003  simonb Fix 'struct lwp *' lossage.
 1.2 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.1 09-Dec-2000  jdolecek branches: 1.1.2; 1.1.4; 1.1.6;
split ecoff specific code to separate file ultrix_exec_ecoff.c
 1.1.6.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.4.1 14-Nov-2001  nathanw Catch up to -current.
 1.1.2.2 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.1.2.1 09-Dec-2000  bouyer file ultrix_exec_ecoff.c was added on branch thorpej_scsipi on 2000-12-13 15:49:57 +0000
 1.4.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.4.2.4 28-Nov-2004  skrll Adapt to branch
 1.4.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.2.1 03-Aug-2004  skrll Sync with HEAD
 1.7.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.7.4.1 29-Apr-2005  kent sync with -current
 1.8.4.1 21-Jun-2006  yamt sync with head.
 1.2 14-Dec-2009  matt Merge from matt-nb5-mips64
 1.1 30-Jul-1999  drochner branches: 1.1.2; 1.1.12; 1.1.142; 1.1.162;
emulate fcntl(F_SETLK) & Co.
(seti@home works now:-)
 1.1.162.1 09-Sep-2009  matt Change to use fixed sized types.
 1.1.142.1 11-Mar-2010  yamt sync with head
 1.1.12.2 31-Jan-2000  he Pull up revision 1.1 (new, requested by mhitch):
Emulate Ultrix fcntl(F_SETLK) & Co. so the Ultrix seti@home client
works.
 1.1.12.1 30-Jul-1999  he file ultrix_flock.h was added on branch netbsd-1-4 on 2000-01-31 20:40:56 +0000
 1.1.2.2 02-Aug-1999  thorpej Update from trunk.
 1.1.2.1 30-Jul-1999  thorpej file ultrix_flock.h was added on branch chs-ubc2 on 1999-08-02 21:55:14 +0000
 1.60 05-Jul-2022  andvar s/retrys/retries/ in comments.
 1.59 29-Sep-2020  msaitoh s/parition/partition/
 1.58 03-Dec-2017  maxv Fix uninitialized pointer, found by Mootja. Not a surprise in untested
code.
 1.57 13-Apr-2017  hannken branches: 1.57.4;
Switch ultrix_sys_getmnt() to mountlist iterator.
Really skip "start" items instead of a useless loop.
Compile tested only.
 1.56 23-Oct-2015  maxv branches: 1.56.2; 1.56.4;
Change do_sys_mount() so that it only takes as argument the type of the
drive instead of its associated vfsops. Makes it more friendly, and allows
compat binaries to autoload VFS modules if needed.

sent on tech-kern@, ok christos@
 1.55 24-Jul-2015  maxv Unused inits (harmless).

Found by Brainy.
 1.54 27-Nov-2013  christos branches: 1.54.6;
Change the queue.3 *_END(&head) macros to NULL. Since we don't have CIRCLEQ
anymore, all the macros expand to NULL anyway, so this improves readability.
Requested by rmind@
 1.53 23-Nov-2013  christos fix previous, list ends in NULL, and don't open-code
 1.52 23-Nov-2013  riz Since mountlist is now a TAILQ, convert some missed usages
so things build again.
 1.51 14-Dec-2009  matt branches: 1.51.12; 1.51.22; 1.51.26;
Merge from matt-nb5-mips64
 1.50 17-Dec-2008  cegger kill MALLOC and FREE macros.
 1.49 06-May-2008  ad branches: 1.49.2; 1.49.8; 1.49.16;
PR kern/38141 lookup/vfs_busy acquire rwlock recursively

Simplify the mount locking. Remove all the crud to deal with recursion on
the mount lock, and crud to deal with unmount as another weirdo lock.

Hopefully this will once and for all fix the deadlocks with this. With this
commit there are two locks on each mount:

- krwlock_t mnt_unmounting. This is used to prevent unmount across critical
sections like getnewvnode(). It's only ever read locked with rw_tryenter(),
and is only ever write locked in dounmount(). A write hold can't be taken
on this lock if the current LWP could hold a vnode lock.

- kmutex_t mnt_updating. This is taken by threads updating the mount, for
example when going r/o -> r/w, and is only present to serialize updates.
In order to take this lock, a read hold must first be taken on
mnt_unmounting, and the two need to be held across the operation.

One effect of this change: previously if an unmount failed, we would make a
half hearted attempt to back out of it gracefully, but that was unlikely to
work in a lot of cases. Now while an unmount that will be aborted is in
progress, new file operations within the mount will fail instead of being
delayed. That is unlikely to be a problem though, because if the admin
requests unmount of a file system then s(he) has made a decision to deny
access to the resource.
 1.48 30-Apr-2008  ad PR kern/38135 vfs_busy/vfs_trybusy confusion

The previous fix worked, but it opened a window where mounts could have
disappeared from mountlist while the caller was traversing it using
vfs_trybusy(). Fix that.
 1.47 30-Apr-2008  jmmv Fix build of these files after the vfs_trybusy change. Apply the same
modification done in compat/common/vfs_syscalls_20.c:1.27.
 1.46 30-Jan-2008  ad branches: 1.46.6; 1.46.8; 1.46.10;
PR kern/37706 (forced unmount of file systems is unsafe):

- Do reference counting for 'struct mount'. Each vnode associated with a
mount takes a reference, and in turn the mount takes a reference to the
vfsops.
- Now that mounts are reference counted, replace the overcomplicated mount
locking inherited from 4.4BSD with a recursable rwlock.
 1.45 27-Dec-2007  christos make this compile again.
 1.44 20-Dec-2007  dsl Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.43 27-Nov-2007  dogcow branches: 1.43.2; 1.43.6;
more VFS_STATVFS(x,y,z) fallout; change them to VFS_STATVFS(x,y). (hi, pooka!)
 1.42 23-Oct-2007  pooka branches: 1.42.2;
vfs_getopsbyname("ngs") -> vfs_getopsbyname("nfs"). 'nuff said
 1.41 10-Oct-2007  ad branches: 1.41.2;
Merge from vmlocking:

- Split vnode::v_flag into three fields, depending on field locking.
- simple_lock -> kmutex in a few places.
- Fix some simple locking problems.
 1.40 17-Jul-2007  christos branches: 1.40.6; 1.40.8; 1.40.10;
include <compat/sys/mount.h> for MFSNAMELEN
 1.39 14-Jul-2007  ad <dsl> I suspect my set of test build kernels is longer than ad's :-)

tsk!
 1.38 12-Jul-2007  dsl Change compat mount code to pass do_sys_mount() kernel resident buffers.
Possibly the standard nfs code needs teaching how to set the length and
address family in order to support non-netbsd sockaddr.
There are now no active stackgap() calls in the compat tree.
 1.37 05-Mar-2007  he branches: 1.37.2;
Need a char* for doing pointer arithmetic.
 1.36 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.35 09-Feb-2007  ad branches: 1.35.2;
Merge newlock2 to head.
 1.34 11-Dec-2005  christos branches: 1.34.20;
merge ktrace-lwp.
 1.33 24-Sep-2005  jmmv Instead of trying to clear ufs_args' export member, zero the whole
structure so that we don't rely on that (renamed) field. Should fix
the build. Found by he@.
 1.32 31-Aug-2005  he Now that <ufs/ufsmount.h> includes <ufs/extattr.h>, we also need
<sys/vnode.h> and <sys/vnode_if.h> to bring the definition of struct
vop_getextattr_args into scope. Fixes build problem for arc.
 1.31 01-Jun-2005  drochner branches: 1.31.2;
fix const'ification fallout
 1.30 26-Feb-2005  perry nuke trailing whitespace
 1.29 21-Apr-2004  simonb branches: 1.29.4; 1.29.6;
ANSIfy, some KNF.
 1.28 21-Apr-2004  simonb Fix some statfs->statvfs fallout. Compile tested only...
 1.27 29-Jun-2003  fvdl branches: 1.27.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.26 29-Jun-2003  simonb Fix 'struct lwp *' lossage.
 1.25 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.24 06-Jan-2003  wiz compatibility, not compatiblity.
 1.23 02-Nov-2002  jdolecek retval is 'register_t *', not 'int *'
 1.22 16-Mar-2002  christos make the stackgap_{init,alloc} functions MP friendly (i.e. pass struct proc *
in, instead of using curproc). While there add an optional size argument to
stackgap_init.
 1.21 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.20 03-May-2001  matt branches: 1.20.2;
Use NULL instead of an explicit cast.
 1.19 28-Jun-2000  mrg branches: 1.19.2;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.18 30-Mar-2000  augustss Kill register declarations.
 1.17 25-Apr-1999  simonb branches: 1.17.2;
Shut 'gcc -Wuninitialized' up.
 1.16 09-Aug-1998  perry branches: 1.16.8;
bzero->memset, bcopy->memcpy, bcmp->memcmp
 1.15 05-Mar-1998  thorpej Make this compile again in light of Lite2.
 1.14 05-Mar-1998  thorpej Arrgh, I said "abort", dammit...
 1.13 05-Mar-1998  thorpej *** empty log message ***
 1.12 25-May-1997  jonathan Update copyright.
 1.11 25-May-1997  jonathan lint: add prototype for static function make_ultrix_mntent().
 1.10 24-May-1997  jonathan lint: gc unused variables in ultrix_sys_mount().
 1.9 06-Apr-1997  jonathan Add changes to make vic-2.8 Ultrix binaries work on NetBSD with COMPAT_ULTRIX:
* Add IPmulticast setsockopt emulation.
* Add Ultrix shmsys emulation (untested).
* tidy up use of stackgap.
 1.8 15-Jan-1997  jonathan Fix const-pointer lint in copyout of consed-up native fstype string,
from consed-up native mount args.
 1.7 19-Oct-1996  jonathan branches: 1.7.2;
Update copyright.
 1.6 13-Oct-1996  christos Backout previous kprintf change.
 1.5 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.4 07-Apr-1996  jonathan Remove gcc -Wall lint from ultrix emulation.-
Mostly adding explicit != comparison to "if (error = copyin/out( ... ))".
Fix comment glitch in ultrix_fs.c
 1.3 19-Feb-1996  pk Adapt to NFSv3.
 1.2 26-Dec-1995  jonathan Add emulation of ultrix mount(2). Sufficient to NFS-mount filesystems
using a NetBSD kernel in an ultrix root filesystem.

Move wait emulation to the old (v7) wait syscall number, as that's
what the Ultrix ufs_mount binary uses.
 1.1 26-Dec-1995  jonathan Add emulation of Ultrix select: before calling native sys_select(),
limit the number of FDs to select on to the maximum supported by NetBSD --
which is as many FDs as the emul_ultrix process can have open, anyway.

Add emulation of Ultrix getmnt(2) in ultrix_fs.c

Add partial emulation of Ultrix tty ioctl()s in ultrix_ioctl.c, derived
from compat/sunos/sunos_ioctl.c. Ultrix libc's ``isatty()'' now works
in compat_emul processes.
 1.7.2.1 18-Jan-1997  thorpej Update from trunk.
 1.16.8.1 21-Jun-1999  thorpej Sync w/ -current.
 1.17.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.19.2.8 07-Jan-2003  thorpej Sync with HEAD.
 1.19.2.7 11-Nov-2002  nathanw Catch up to -current
 1.19.2.6 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.19.2.5 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.19.2.4 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.19.2.3 06-Dec-2001  wdk struct proc -> struct lwp changes for COMPAT_ULTRIX support
 1.19.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.19.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.20.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.20.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.27.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.27.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.27.2.4 28-Nov-2004  skrll Adapt to branch
 1.27.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.27.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.27.2.1 03-Aug-2004  skrll Sync with HEAD
 1.29.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.29.4.1 29-Apr-2005  kent sync with -current
 1.31.2.7 04-Feb-2008  yamt sync with head.
 1.31.2.6 21-Jan-2008  yamt sync with head
 1.31.2.5 07-Dec-2007  yamt sync with head
 1.31.2.4 27-Oct-2007  yamt sync with head.
 1.31.2.3 03-Sep-2007  yamt sync with head.
 1.31.2.2 26-Feb-2007  yamt sync with head.
 1.31.2.1 21-Jun-2006  yamt sync with head.
 1.34.20.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.35.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.37.2.3 20-Aug-2007  ad Sync with HEAD.
 1.37.2.2 15-Jul-2007  ad Sync with head.
 1.37.2.1 13-Mar-2007  ad Pull in the initial set of changes for the vmlocking branch.
 1.40.10.1 14-Oct-2007  yamt sync with head.
 1.40.8.3 23-Mar-2008  matt sync with HEAD
 1.40.8.2 09-Jan-2008  matt sync with HEAD
 1.40.8.1 06-Nov-2007  matt sync with HEAD
 1.40.6.2 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.40.6.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.41.2.1 13-Nov-2007  bouyer Sync with HEAD
 1.42.2.3 18-Feb-2008  mjf Sync with HEAD.
 1.42.2.2 27-Dec-2007  mjf Sync with HEAD.
 1.42.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.43.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.43.2.3 26-Dec-2007  ad Sync with head.
 1.43.2.2 08-Dec-2007  ad Fix typo.
 1.43.2.1 04-Dec-2007  ad Pull the vmlocking changes into a new branch.
 1.46.10.3 11-Mar-2010  yamt sync with head
 1.46.10.2 04-May-2009  yamt sync with head.
 1.46.10.1 16-May-2008  yamt sync with head.
 1.46.8.1 18-May-2008  yamt sync with head.
 1.46.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.46.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.49.16.1 09-Sep-2009  matt Change to use fixed sized types.
 1.49.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.49.2.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.49.2.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.51.26.1 18-May-2014  rmind sync with head
 1.51.22.2 03-Dec-2017  jdolecek update from HEAD
 1.51.22.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.51.12.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.54.6.3 28-Aug-2017  skrll Sync with HEAD
 1.54.6.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.54.6.1 22-Sep-2015  skrll Sync with HEAD
 1.56.4.1 21-Apr-2017  bouyer Sync with HEAD
 1.56.2.1 26-Apr-2017  pgoyette Sync with HEAD
 1.57.4.1 21-Dec-2017  snj Pull up following revision(s) (requested by maxv in ticket #434):
sys/compat/ultrix/ultrix_fs.c: revision 1.58
Fix uninitialized pointer, found by Mootja. Not a surprise in untested
code.
 1.40 09-Feb-2022  andvar fix various typos in comments.
 1.39 07-Sep-2021  riastradh sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.38 23-Apr-2019  msaitoh branches: 1.38.2;
KNF. No functional change.
 1.37 08-Oct-2016  maxv branches: 1.37.8; 1.37.16;
Uninitialized var, found by mootja; not tested, but obvious enough
 1.36 14-Dec-2009  matt branches: 1.36.22; 1.36.40; 1.36.44;
Merge from matt-nb5-mips64
 1.35 21-Mar-2008  ad branches: 1.35.4; 1.35.6; 1.35.22;
Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
 1.34 05-Jan-2008  dsl branches: 1.34.6;
Use FILE_LOCK() and FILE_UNLOCK().
Attempt to fix all the code paths so that the 'fp' returned by fd_getfile()
isn't left locked, and is always unlocked (and ref-counted) before
doing anything that might sleep.
 1.33 27-Dec-2007  christos make this compile again.
 1.32 20-Dec-2007  dsl Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.31 01-Jun-2007  he branches: 1.31.8; 1.31.14; 1.31.16; 1.31.20;
Fallout from the interface ioctl changes:

OSIOCGIFADDR -> OOSIOCGIFADDR
OSIOCGIFDSTADDR -> OOSIOCGIFDSTADDR
OSIOCGIFNETMASK -> OOSIOCGIFNETMASK

Also, one instance of needing to include <net/if.h> before
<compat/sys/sockio.h> due to use of IFNAMSIZ in the latter.

Discussed with christos.
 1.30 29-May-2007  christos Add a sockaddr_storage member to "struct ifreq" maintaining backwards
compatibility with the older ioctls. This avoids stack smashing and
abuse of "struct sockaddr" when ioctls placed "struct sockaddr_foo's" that
were longer than "struct sockaddr".
XXX: Some of the emulations might be broken; I tried to add code for
them but I did not test them.
 1.29 09-Feb-2007  ad branches: 1.29.6; 1.29.8;
Merge newlock2 to head.
 1.28 11-Dec-2005  christos branches: 1.28.20;
merge ktrace-lwp.
 1.27 01-Jun-2005  drochner branches: 1.27.2;
avoid shadow warnings
 1.26 26-Feb-2005  perry nuke trailing whitespace
 1.25 25-Apr-2004  matt branches: 1.25.4; 1.25.6;
Constify the speedtab arrays
 1.24 21-Apr-2004  simonb ANSIfy, some KNF.
 1.23 29-Jun-2003  fvdl branches: 1.23.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.22 29-Jun-2003  simonb Fix 'struct lwp *' lossage.
 1.21 07-May-2003  christos sort the ioctl's so we can see what we've implemented and what we have not.
 1.20 21-Mar-2003  dsl Change 'data' argument to fo_ioctl and fo_fcntl from 'caddr_t' to 'void *'.
Avoids a lot of casting and removes the need for some line breaks.
Removed a load of (caddr_t) casts from calls to copyin/copyout as well.
(approved by christos - he has a plan to remove caddr_t...)
 1.19 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.18 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.17 14-Jun-2001  thorpej branches: 1.17.2;
Fix a partial construction problem that can cause race conditions
between creation of a file descriptor and close(2) when using kernel
assisted threads. What we do is stick descriptors in the table, but
mark them as "larval". This causes essentially everything to treat
it as a non-existent descriptor, except for fdalloc(), which sees a
filled slot so that it won't (incorrectly) allocate it again. When
a descriptor is fully constructed, the code that has constructed it
marks it as "mature" (which actually clears the "larval" flag), and
things continue to work as normal.

While here, gather all the code that gets a descriptor from the table
into a fd_getfile() function, and call it, rather than having the
same (sometimes incorrect) code copied all over the place.
 1.16 30-May-2001  mrg use _KERNEL_OPT.
 1.15 29-Nov-2000  jdolecek branches: 1.15.2;
LKMify
 1.14 30-Mar-2000  augustss Kill register declarations.
 1.13 09-Aug-1998  perry branches: 1.13.12;
bzero->memset, bcopy->memcpy, bcmp->memcmp
 1.12 25-Jun-1998  thorpej defopt COMPAT_SUNOS
 1.11 25-Jun-1998  thorpej defopt COMPAT_ULTRIX
 1.10 25-May-1997  jonathan lint: add prototypes for termio/termios emul conversions and ioctl handlers.
 1.9 05-May-1997  jonathan NetBSD doesn't have VSWTCH, so we can't emulate it; clarify. (see PR#2793).
 1.8 06-Apr-1997  jonathan * Fix typo in SIOGIFCONF handling.
* Change explicit SunOS-compat ioctl codes to Ultrix-compat codes.
 1.7 13-Oct-1996  christos Backout previous kprintf change.
 1.6 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.5 09-Oct-1996  thorpej Merge the netbsd-1-2 branch back into the mainline.
 1.4 13-Jun-1996  jonathan Fix typos in SUSP and DSUSP mapping when setting Ultrix posixmode tty
attributes (was 112 and 113, should be 12 and 13).
 1.3 07-Apr-1996  jonathan branches: 1.3.4;
Remove gcc -Wall lint from ultrix emulation.-
Mostly adding explicit != comparison to "if (error = copyin/out( ... ))".
Fix comment glitch in ultrix_fs.c
 1.2 04-Jan-1996  jonathan Rewrite (a copy of) the emul-sunos termio/termios emulation code to
emulate Ultrix termio/termios instead. Ultrix termio c_cc has separate
VMIM/VTIME attributes, and the Ultrix termios c_cc is a strict
superset of Ultrix termio c_cc. The termios-only c_cc indices are
all changed, relative to SunOS.
 1.1 26-Dec-1995  jonathan Add emulation of Ultrix select: before calling native sys_select(),
limit the number of FDs to select on to the maximum supported by NetBSD --
which is as many FDs as the emul_ultrix process can have open, anyway.

Add emulation of Ultrix getmnt(2) in ultrix_fs.c

Add partial emulation of Ultrix tty ioctl()s in ultrix_ioctl.c, derived
from compat/sunos/sunos_ioctl.c. Ultrix libc's ``isatty()'' now works
in compat_emul processes.
 1.3.4.3 10-Sep-1996  thorpej Back out previos change (typo fix) by request from Jonathan Stone; the
change fixed a typo in an #ifdef, but the code within the #ifdef is broken
and doesn't compile. For more details, "grep XXX ultrix_ioctl.c".
 1.3.4.2 08-Sep-1996  jonathan Fix typo (CMOPAT_ULTRIX -> COMPAT_ULTRIX) around code that uses the Ultrix
termios VSWITCH to set the native VSWITCH. (#ifdef'ed to support a future
merge with other 4.3BSD compat tty code, e.g., SunOS.)
 1.3.4.1 13-Jun-1996  jonathan pull up fix for SUSP and DSUSP from main branch
 1.13.12.2 08-Dec-2000  bouyer Sync with HEAD.
 1.13.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.15.2.5 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.15.2.4 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.15.2.3 06-Dec-2001  wdk struct proc -> struct lwp changes for COMPAT_ULTRIX support
 1.15.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.15.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.17.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.23.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.23.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.23.2.4 28-Nov-2004  skrll Adapt to branch
 1.23.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.23.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.23.2.1 03-Aug-2004  skrll Sync with HEAD
 1.25.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.25.4.1 29-Apr-2005  kent sync with -current
 1.27.2.5 24-Mar-2008  yamt sync with head.
 1.27.2.4 21-Jan-2008  yamt sync with head
 1.27.2.3 03-Sep-2007  yamt sync with head.
 1.27.2.2 26-Feb-2007  yamt sync with head.
 1.27.2.1 21-Jun-2006  yamt sync with head.
 1.28.20.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.29.8.1 11-Jul-2007  mjf Sync with head.
 1.29.6.1 09-Jun-2007  ad Sync with head.
 1.31.20.2 08-Jan-2008  bouyer Sync with HEAD
 1.31.20.1 02-Jan-2008  bouyer Sync with HEAD
 1.31.16.1 26-Dec-2007  ad Sync with head.
 1.31.14.1 18-Feb-2008  mjf Sync with HEAD.
 1.31.8.1 09-Jan-2008  matt sync with HEAD
 1.34.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.35.22.1 09-Sep-2009  matt Change to use fixed sized types.
 1.35.6.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.35.6.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.35.4.1 11-Mar-2010  yamt sync with head
 1.36.44.1 04-Nov-2016  pgoyette Sync with HEAD
 1.36.40.1 05-Dec-2016  skrll Sync with HEAD
 1.36.22.1 03-Dec-2017  jdolecek update from HEAD
 1.37.16.1 10-Jun-2019  christos Sync with HEAD
 1.37.8.1 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1836):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.38.2.1 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.127 03-Aug-2023  mrg avoid uninitialised accesses

found by GCC 12.
 1.126 07-Sep-2021  riastradh sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.125 10-Aug-2018  pgoyette branches: 1.125.4;
Allow syscall_establish() to install new syscalls when the existing
entry-point is either sys_nomodule or sys_nosys. Update the
makesyscalls.sh script to create a const array of bits to allow
syscall_disestablish() to properly restore the original entry-point.
Update all the initializers of struct emul to initialize the pointer
to the bit array struct emul.

XXX Regen of all files created by makesyscalls.sh will come soon,
XXX followed by a kernel version bump (since struct emul is being
XXX modified).

This commit should address PR kern/45781 and also removes the need
for the work-around for that PR in file

sys/arch/usermode/modules/syscallemu/syscallemu.c
 1.124 06-May-2018  kamil branches: 1.124.2;
Remove an element from struct emul: e_tracesig

e_tracesig used to be implemented for Darwin compat. Nowadays the Darwin
compatiblity layer is gone and there are no other users.

This functionality isn't used where it shall be used in the existing
codebase.

If we want to emulate debugging interfaces in compat layers we would need
to implement that from scratch anyway. We would need to be bug compatible
with other OSes too.

Proposed on tech-kern@.

Welcome to NetBSD 8.99.16!

Sponsored by <The NetBSD Foundation>
 1.123 09-Jan-2018  maya branches: 1.123.2;
remove struct emul's e_fault.

It used to be used by COMPAT_IRIX for the purpose of overriding
uvm_fault (only implemented in MIPS), now removed.

Ride 8.99.12 version bump.
 1.122 19-Feb-2012  rmind branches: 1.122.32;
Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.
 1.121 07-Jul-2010  chs branches: 1.121.8; 1.121.12;
many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
- support new-style (NPTL) linux pthreads on all platforms.
clone() with CLONE_THREAD uses 1 process with many LWPs
instead of separate processes.
- move the contents of sys__lwp_setprivate() into a new
lwp_setprivate() and use that everywhere.
- update linux_release[] and linux32_release[] to "2.6.18".
- adjust placement of emul fork/exec/exit hooks as needed
and adjust other emul code to match.
- convert all struct emul definitions to use named initializers.
- change the pid allocator to allow multiple pids to refer to the same proc.
- remove a few fields from struct proc that are no longer needed.
- disable the non-functional "vdso" code in linux32/amd64,
glibc works fine without it.
- fix a race in the futex code where we could miss a wakeup after
a requeue operation.
- redo futex locking to be a little more efficient.
 1.120 03-Mar-2010  pooka branches: 1.120.2;
Remove nfssvc non-emulations I missed yesterday.
 1.119 02-Mar-2010  pooka remove nfssvc emulation (or non-emulation)
 1.118 17-Jan-2009  he branches: 1.118.4;
Adapt to the state after the recent time_t change.
Type changes:
timeval -> timeval50
itimerval -> itimerval50
rusage -> rusage50
and use of the compat_50 calls where appropriate.
Untested, but at least it builds.

Discussed with christos@
 1.117 19-Nov-2008  ad Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.116 15-Oct-2008  wrstuden branches: 1.116.2;
Merge wrstuden-revivesa into HEAD.
 1.115 08-Aug-2008  bjs 'if (error = 0)' -> 'if (error == 0)'
 1.114 07-Aug-2008  plunky convert some [left behind] compat code to use new sockopt API
 1.113 24-Jun-2008  ad branches: 1.113.2;
Replace references to getsock/getvnode.
 1.112 23-Apr-2008  christos branches: 1.112.2; 1.112.4; 1.112.6;
Make this compile again, from Jan-Benedict Glaw jbglaw at lug-owl dot de
 1.111 21-Mar-2008  ad branches: 1.111.2;
Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
 1.110 27-Dec-2007  christos branches: 1.110.6;
make this compile again.
 1.109 20-Dec-2007  dsl Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.108 13-May-2007  dsl branches: 1.108.8; 1.108.14; 1.108.16; 1.108.20;
Delete fom stackgap lines that seem to have got left in.
 1.107 12-May-2007  dsl Split the fcntl locking code out from its copyin/out.
Use to avoid all the stackgap stuff in compat code.
 1.106 04-Mar-2007  christos branches: 1.106.2; 1.106.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.105 09-Feb-2007  ad branches: 1.105.2;
Merge newlock2 to head.
 1.104 11-Dec-2005  christos branches: 1.104.20;
merge ktrace-lwp.
 1.103 16-Sep-2005  christos add <compat/sys/signal*.h>
 1.102 19-Aug-2005  christos 64 bit inode changes.
 1.101 10-Jul-2005  christos define syscall again.
 1.100 10-Jul-2005  christos No point in declaring syscall_intern and syscall in a zillion places.
 1.99 26-Mar-2005  fvdl branches: 1.99.2;
Fix some things regarding COMPAT_NETBSD32 and limits/VM addresses.

* For sparc64 and amd64, define *SIZ32 VM constants.
* Add a new function pointer to struct emul, pointing at a function
that will return the default VM map address. The default function
is uvm_map_defaultaddr, which just uses the VM_DEFAULT_ADDRESS
macro. This gives emulations control over the default map address,
and allows things to be mapped at the right address (in 32bit range)
for COMPAT_NETBSD32.
* Add code to adjust the data and stack limits when a COMPAT_NETBSD32
or COMPAT_SVR4_32 binary is executed.
* Don't use USRSTACK in kern_resource.c, use p_vmspace->vm_minsaddr
instead (emulations might have set it differently)
* Since this changes struct emul, bump kernel version to 3.99.2

Tested on amd64, compile-tested on sparc64.
 1.98 26-Feb-2005  perry branches: 1.98.2;
nuke trailing whitespace
 1.97 25-Jan-2005  drochner Hmm - vax is different. sendsig_sigcontext() is for __mips only.
Should fix build error found by Havard Eidnes.
 1.96 24-Jan-2005  drochner branches: 1.96.2;
use sendsig_sigcontext() directly instead of the generic sendsig()
 1.95 27-Oct-2004  david branches: 1.95.4;
Bounds check syscall arguments where appropriate
 1.94 25-Apr-2004  matt Constify a few read-only arrays/variables.
 1.93 21-Apr-2004  simonb ANSIfy, some KNF.
 1.92 20-Dec-2003  fvdl branches: 1.92.2;
Put back Emmanuel's sigfilter hooks, as decided by Core.
 1.91 20-Dec-2003  manu Introduce lwp_emuldata and the associated hooks. No hook is provided for the
exec case, as the emulation already has the ability to intercept that
with the e_proc_exec hook. It is the responsability of the emulation to
take appropriaye action about lwp_emuldata in e_proc_exec.

Patch reviewed by Christos.
 1.90 05-Dec-2003  jdolecek back the sigfilter emulation hook change off
 1.89 03-Dec-2003  manu Add a sigfilter emulation hook. It is used at the beginning of kpsignal2()
so that a specific emulation has the oportunity to filter out some signals.

if sigfilter returns 0, then no signal is sent by kpsignal2().

There is another place where signals can be generated: trapsignal. Since this
function is already an emulation hook, no call to the sigfilter hook was
introduced in trapsignal.

This is needed to emulate the softsignal feature in COMPAT_DARWIN (signals
sent as Mach exception messages)
 1.88 27-Oct-2003  simonb Fix bogus uninitialised warnings.
 1.87 24-Aug-2003  chs add support for non-executable mappings (where the hardware allows this)
and make the stack and heap non-executable by default. the changes
fall into two basic catagories:

- pmap and trap-handler changes. these are all MD:
= alpha: we already track per-page execute permission with the (software)
PG_EXEC bit, so just have the trap handler pay attention to it.
= i386: use a new GDT segment for %cs for processes that have no
executable mappings above a certain threshold (currently the
bottom of the stack). track per-page execute permission with
the last unused PTE bit.
= powerpc/ibm4xx: just use the hardware exec bit.
= powerpc/oea: we already track per-page exec bits, but the hardware only
implements non-exec mappings at the segment level. so track the
number of executable mappings in each segment and turn on the no-exec
segment bit iff the count is 0. adjust the trap handler to deal.
= sparc (sun4m): fix our use of the hardware protection bits.
fix the trap handler to recognize text faults.
= sparc64: split the existing unified TSB into data and instruction TSBs,
and only load TTEs into the appropriate TSB(s) for the permissions.
fix the trap handler to check for execute permission.
= not yet implemented: amd64, hppa, sh5

- changes in all the emulations that put a signal trampoline on the stack.
instead, we now put the trampoline into a uvm_aobj and map that into
the process separately.

originally from openbsd, adapted for netbsd by me.
 1.86 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.85 29-Jun-2003  fvdl branches: 1.85.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.84 29-Jun-2003  simonb Fix 'struct lwp *' lossage.
 1.83 29-Jan-2003  atatat Cull unused variables. Sigh.

PS - Cross compilers are cool.
 1.82 28-Jan-2003  atatat No need to pick a "default address" for mmap in compat code, since we
merely call sys_mmap() at the end anyway, and that will pick the
address for us, if it's needed.

Likewise for checking if /dev/zero is being mapped.
 1.81 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.80 01-Nov-2002  jdolecek set struct emul's nsysent to compat SYS_NSYSENT, not SYS_MAXSYSCALL
 1.79 21-Sep-2002  manu - Introduce a e_fault field in struct proc to provide emulation specific
memory fault handler. IRIX uses irix_vm_fault, and all other emulation
use NULL, which means to use uvm_fault.

- While we are there, explicitely set to NULL the uninitialized fields in
struct emul: e_fault and e_sysctl on most ports

- e_fault is used by the trap handler, for now only on mips. In order to avoid
intrusive modifications in UVM, the function pointed by e_fault does not
has exactly the same protoype as uvm_fault:
int uvm_fault __P((struct vm_map *, vaddr_t, vm_fault_t, vm_prot_t));
int e_fault __P((struct proc *, vaddr_t, vm_fault_t, vm_prot_t));

- In IRIX share groups, all the VM space is shared, except one page.
This bounds us to have different VM spaces and synchronize modifications
to the VM space accross share group members. We need an IRIX specific hook
to the page fault handler in order to propagate VM space modifications
caused by page faults.
 1.78 06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.77 04-Jul-2002  thorpej Add kernel support for having userland provide the signal trampoline:

* struct sigacts gets a new sigact_sigdesc structure, which has the
sigaction and the trampoline/version. Version 0 means "legacy kernel
provided trampoline". Other versions are coordinated with machine-
dependent code in libc.
* sigaction1() grows two more arguments -- the trampoline pointer and
the trampoline version.
* A new __sigaction_sigtramp() system call is provided to register a
trampoline along with a signal handler.
* The handler is no longer passed to sensig() functions. Instead,
sendsig() looks up the handler by peeking in the sigacts for the
process getting the signal (since it has to look in there for the
trampoline anyway).
* Native sendsig() functions now select the appropriate trampoline and
its arguments based on the trampoline version in the sigacts.

Changes to libc to use the new facility will be checked in later. Kernel
version not bumped; we will ride the 1.6C bump made recently.
 1.76 16-Mar-2002  christos branches: 1.76.4; 1.76.6;
get rid of STACKGAP* shit.
 1.75 16-Mar-2002  christos make the stackgap_{init,alloc} functions MP friendly (i.e. pass struct proc *
in, instead of using curproc). While there add an optional size argument to
stackgap_init.
 1.74 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.73 18-Sep-2001  jdolecek Make the setregs hook emulation-specific, rather than executable
format specific.
Struct emul has a e_setregs hook back, which points to emulation-specific
setregs function. es_setregs of struct execsw now only points to
optional executable-specific setup function (this is only used for
ECOFF).
 1.72 17-Sep-2001  jdolecek g/c dead code
 1.71 18-Jun-2001  christos branches: 1.71.2; 1.71.4;
Add an e_trapsignal member to struct emul, so that emulated processes can
send the appropriate signal depending on the trap type.
 1.70 14-Jun-2001  thorpej Fix a partial construction problem that can cause race conditions
between creation of a file descriptor and close(2) when using kernel
assisted threads. What we do is stick descriptors in the table, but
mark them as "larval". This causes essentially everything to treat
it as a non-existent descriptor, except for fdalloc(), which sees a
filled slot so that it won't (incorrectly) allocate it again. When
a descriptor is fully constructed, the code that has constructed it
marks it as "mature" (which actually clears the "larval" flag), and
things continue to work as normal.

While here, gather all the code that gets a descriptor from the table
into a fd_getfile() function, and call it, rather than having the
same (sometimes incorrect) code copied all over the place.
 1.69 30-May-2001  mrg use _KERNEL_OPT.
 1.68 15-Jan-2001  thorpej branches: 1.68.2;
Grok __HAVE_MINIMAL_EMUL and __HAVE_SYSCALL_INTERN.
 1.67 07-Jan-2001  simonb Move prototypes for mips_user_cachectl() and mips_user_cacheflush()
to <mips/cachectl.h>.
 1.66 16-Dec-2000  jdolecek adapt to recent struct emul changes
 1.65 09-Dec-2000  jdolecek always fill in e_syscall in respective emul_*; if the emulation doesn't
have it's own separated *_syscall() function, use syscall()
 1.64 09-Dec-2000  jdolecek split ecoff specific code to separate file ultrix_exec_ecoff.c
 1.63 01-Dec-2000  jdolecek make LKM safe
 1.62 01-Dec-2000  jdolecek add e_path (emulation path) to struct emul, which replaces emulation-specific
*_emul_path variables

change macros CHECK_ALT_{CREAT|EXIST} to use that, 'root' doesn't need
to be passed explicitly any more and *_CHECK_ALT_{CREAT|EXIST} are removed
change explicit emul_find() calls in probe functions to get the emulation
path from the checked exec switch entry's emulation

remove no longer needed header files

add e_flags and e_syscall to struct emul; these are unsed and empty for now
 1.61 21-Nov-2000  jdolecek restructure struct emul and execsw, in preparation to make emulations LKMable:
* move all exec-type specific information from struct emul to execsw[] and
provide single struct emul per emulation
* elf:
- kern/exec_elf32.c:probe_funcs[] is gone, execsw[] how has one entry
per emulation and contains pointer to respective probe function
- interp is allocated via MALLOC() rather than on stack
- elf_args structure is allocated via MALLOC() rather than malloc()
* ecoff: the per-emulation hooks moved from alpha and mips specific code
to OSF1 and Ultrix compat code as appropriate, execsw[] has one entry per
emulation supporting ecoff with appropriate probe function
* the makecmds/probe functions don't set emulation, pointer to emulation is
part of appropriate execsw[] entry
* constify couple of structures
 1.60 19-Nov-2000  simonb Update extern declarations of {hpux,ultrix}_syscallnames for change
to e_syscallnames in struct emul. Untested on HP, but should be ok.
 1.59 20-Jul-2000  nisimura version[] string was const'ifed. Pointed out by Izumi Tsutsui.
 1.58 28-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.57 28-Apr-2000  simonb branches: 1.57.4;
The size of the members of struct ultrix_utsname were nothing like
reality - adjust and fill in "version" the same way that some other
compat routines do. An Ultrix "uname -a" returns something meaninful
now instead of just "NetBSD ".
 1.56 30-Mar-2000  augustss Kill register declarations.
 1.55 28-Mar-2000  simonb Centralise the declarations of cpu_model, machine, machine_arch,
osrelease, and ostype and remove "extern char foo[];" (for hostname
and domainname too).

Also delete redunctant decl of boottime in kern_info_43.c.
 1.54 26-Mar-2000  kleink Merge parts of chs-ubc2 into the trunk:
* Remove the casts to vaddr_t from the round_page() and trunc_page() macros to
make them type-generic, which is necessary i.e. to operate on file offsets
without truncating them.
* In due course, cast pointer arguments to these macros to an appropriate
integral type (paddr_t, vaddr_t).

Originally done by Chuck Silvers, updated by myself.
 1.53 25-Aug-1999  thorpej branches: 1.53.2;
Update for new msgctl()/semctl()/shmctl() calls.
 1.52 30-Jul-1999  drochner emulate fcntl(F_SETLK) & Co.
(seti@home works now:-)
 1.51 05-May-1999  thorpej Add "use counting" to file entries. When closing a file, and it's reference
count is 0, wait for use count to drain before finishing the close.

This is necessary in order for multiple processes to safely share file
descriptor tables.
 1.50 09-Feb-1999  christos branches: 1.50.2; 1.50.4;
Regen
 1.49 26-Oct-1998  sommerfe s/SunOS/Ultrix/ in comment
 1.48 20-Oct-1998  matt vax -> __vax__ (and mips to __mips__ in ultrix_misc.c)
 1.47 19-Oct-1998  tron Defopt SYSVMSG, SYSVSEM and SYSVSHM.
 1.46 03-Oct-1998  drochner Use a private implementation of sys_sigvec(). Ultrix uses an sv_flags bit
unknown to NetBSD and sigaction1() does (now?) complain about it.
 1.45 02-Oct-1998  drochner repair signal handling:
-use own sigcode since the native one uses a sigreturn syscall not present
in Ultrix
-route sigreturn to compat_13_sigreturn
 1.44 26-Sep-1998  drochner Make Ultrix emulation private functions for sigreturn and sigsuspend
because the NetBSD implementation differs now.
 1.43 26-Sep-1998  drochner Update for sigmask changes.
 1.42 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.41 09-Aug-1998  perry bzero->memset, bcopy->memcpy, bcmp->memcmp
 1.40 03-Jul-1998  mhitch branches: 1.40.2;
Add missing include of "opt_nfsserver.h".
 1.39 19-Feb-1998  thorpej Include the NFS option header.
 1.38 19-Oct-1997  jonathan Use void* not caddr_t for 'addr' argument to native mmap().
 1.37 10-Oct-1997  jonathan Correct name of author in license clause 3, as per email with mrg.
 1.36 24-Sep-1997  mhitch Fix a missed *setregs() change.
 1.35 09-Jun-1997  jonathan branches: 1.35.4;
Emulate RISC Ultrix cacheflush() and cachectl() syscalls on mips.
 1.34 25-May-1997  jonathan GC old ultrix-emul syscall stub used to debug ultrix signals.
 1.33 24-May-1997  jonathan Add prototype for cpu_exec_ecoff_setregs() to mips/inuclde/ecoff_machdep.h.
Use it in compat/ultrix/ultrix_misc.c (setting emul type on mips).
 1.32 24-May-1997  jonathan lint: add explicit return type to ultrix_sys_shmsys().
 1.31 26-Apr-1997  jonathan Correct shm ifdefs for when SVSHM is defined. Fix from Ted Lemon in PR 3542.
 1.30 06-Apr-1997  jonathan Add changes to make vic-2.8 Ultrix binaries work on NetBSD with COMPAT_ULTRIX:
* Add IPmulticast setsockopt emulation.
* Add Ultrix shmsys emulation (untested).
* tidy up use of stackgap.
 1.29 31-Jan-1997  thorpej NFSCLIENT -> NFS
 1.28 19-Oct-1996  jonathan branches: 1.28.2;
Update copyright.
 1.27 13-Oct-1996  christos Backout previous kprintf change.
 1.26 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.25 10-Aug-1996  mycroft sys/dir.h -> sys/dirent.h
 1.24 14-Jun-1996  cgd avoid unnecessary checks of m_get/MGET/etc.'s return values. When
they're called with M_WAIT, they are defined to never return NULL.
 1.23 07-Apr-1996  jonathan branches: 1.23.4;
Remove gcc -Wall lint from ultrix emulation.-
Mostly adding explicit != comparison to "if (error = copyin/out( ... ))".
Fix comment glitch in ultrix_fs.c
 1.22 07-Apr-1996  jonathan Add vax setregs() support for exec'ing vax ultrix a.out binaries.
 1.21 19-Feb-1996  pk Adapt to NFSv3.
 1.20 07-Jan-1996  jonathan Add '/emul/ultrix' pathname processing to Ultrix emulation, and move
Ultrix syscalls that require that processing out of ultrix_misc.c
to ultrix_pathname.c.
 1.19 03-Jan-1996  jonathan Add sigcode and esigcode to emul_ultrix, so that signal trampoline
code is set up for emul_ultrix processes.
 1.18 26-Dec-1995  jonathan Add emulation of Ultrix select: before calling native sys_select(),
limit the number of FDs to select on to the maximum supported by NetBSD --
which is as many FDs as the emul_ultrix process can have open, anyway.

Add emulation of Ultrix getmnt(2) in ultrix_fs.c

Add partial emulation of Ultrix tty ioctl()s in ultrix_ioctl.c, derived
from compat/sunos/sunos_ioctl.c. Ultrix libc's ``isatty()'' now works
in compat_emul processes.
 1.17 30-Nov-1995  jtc merge in changes from 1.1 release branch
 1.16 07-Oct-1995  mycroft branches: 1.16.2;
Prefix names of system call implementation functions with `sys_'.
 1.15 19-Sep-1995  thorpej Make system calls conform to a standard prototype and bring those
prototypes into scope.
 1.14 18-Jun-1995  cgd don't assume the f_fsnamelen is nul-truncated or longer than MFSNAMELEN
 1.13 01-Jun-1995  mellon Clear up name conflict between Ultrix syscall 103 and 139.
 1.12 25-Apr-1995  mellon sigcode and esigcode aren't defined for ultrix emulation
 1.11 22-Apr-1995  christos - added struct emul to all emulations.
- removed all setup functions.
- added copyargs() functions where needed.
 1.10 09-Mar-1995  mycroft copy*str() should use size_t.
 1.9 18-Jan-1995  mellon Fix up non-ANSI code (which was a no-op anyway)
 1.8 23-Nov-1994  dean {get,set}rlimit functions (From Jonathan Stone)
 1.7 20-Oct-1994  cgd pay a small amount of lip service to the new syscall args mechanism.
In reality, none of these will compile.
 1.6 01-Aug-1994  glass ultrix_{get,set}info from Arne H Juul <arnej@dsl.unit.no>
 1.5 29-Jun-1994  cgd branches: 1.5.2;
New RCS ID's, take two. they're more aesthecially pleasant, and use 'NetBSD'
 1.4 25-Jun-1994  glass oops
 1.3 22-Jun-1994  glass update for getdtablesize change, and track compat_sunos
 1.2 15-Jun-1994  glass much works but untested w/new fs. expect more tomorrow
 1.1 02-Jun-1994  glass first swipe at ultrix compat. expect many bug fixes. very related to compat/sunos
 1.5.2.1 01-Aug-1994  cgd From trunk.
 1.16.2.1 18-Oct-1995  jonathan Fix arg mismatch in ultrix-compat open(), which broke groff. (there is no
version of gcc that both compiles for NetBSD/mips and also compiles groff,
so I use an groff binary compiled on Ultrix.)
 1.23.4.1 10-Dec-1996  mycroft From trunk:
sys/dir.h -> sys/dirent.h
 1.28.2.1 14-Jan-1997  thorpej Snapshot of work-in-progress, committed to private branch.

These changes implement machine-independent root device and file system
selection. Notable features:

- All ports behave in a consistent manner regarding root
device selection.
- No more "options GENERIC"; all kernels have the ability
to boot with RB_ASKNAME to select root device and file system
type.
- Root file system type can be wildcarded; a machine-independent
function will try all possible file systems for the selected
root device until one succeeds.
- If the root file system fails to mount, the operator will
be given the chance to select a new root device and file
system type, rather than having the machine simply panic.
- nfs_mountroot() no longer panics if any part of the NFS
mount process fails; it now returns an error, giving the
operator a chance to recover.
- New, more consistent, config(8) grammar. The constructs:

config netbsd swap generic
config netbsd root on nfs

have been replaced with:

config netbsd root on ? type ?
config netbsd root on ? type nfs

Additionally, the operator may select or wildcard root file
system type in the kernel configuration file:

config netbsd root on cd0a type cd9660

config(8) now requires that a "root" specification be
made. "root" may be wired down or wildcarded. "swap" and
"dump" specifications are optional, and follow previous
semantics.

- config(8) has a new "file-system" keyword, used to configure
file systems into the kernel. Eventually, this will be used
to generate the default vfssw[].

- "options NFSCLIENT" is obsolete, and is replaced by
"file-system NFS". "options NFSSERVER" still exists, since
NFS server support is independent of the NFS file system
client.

- sys/arch/<foo>/<foo>/swapgeneric.c is no longer used, and
will be removed; all information is now generated by config(8).

As of this commit, all ports except arm32 have been updated to use
the new setroot(). Only SPARC, i386, and Alpha ports have been
tested at this time. Port masters should test these changes on their
ports, and report any problems back to me.

More changes are on their way, including RB_ASKNAME support in
nfs_mountroot() (to prompt for server address and path) and, potentially,
the ability to select rarp/bootparam or bootp in nfs_mountroot().
 1.35.4.2 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.35.4.1 29-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.40.2.1 30-Jul-1998  eeh Split vm_offset_t and vm_size_t into paddr_t, psize_t, vaddr_t, and vsize_t.
 1.50.4.2 02-Aug-1999  thorpej Update from trunk.
 1.50.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.50.2.1 31-Jan-2000  he Pull up revision 1.52 (requested by mhitch):
Emulate Ultrix fcntl(F_SETLK) & Co. so the Ultrix seti@home client
works.
 1.53.2.6 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.53.2.5 05-Jan-2001  bouyer Sync with HEAD
 1.53.2.4 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.53.2.3 08-Dec-2000  bouyer Sync with HEAD.
 1.53.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.53.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.57.4.1 21-Jul-2000  nisimura Pull up 1.59 with approval notice from thorpej.

version[] string was const'ifed.
 1.68.2.11 11-Nov-2002  nathanw Catch up to -current
 1.68.2.10 18-Oct-2002  nathanw Catch up to -current.
 1.68.2.9 17-Sep-2002  nathanw Catch up to -current.
 1.68.2.8 01-Aug-2002  nathanw Catch up to -current.
 1.68.2.7 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.68.2.6 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.68.2.5 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.68.2.4 06-Dec-2001  wdk struct proc -> struct lwp changes for COMPAT_ULTRIX support
 1.68.2.3 14-Nov-2001  nathanw Catch up to -current.
 1.68.2.2 21-Sep-2001  nathanw Catch up to -current.
 1.68.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.71.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.71.2.4 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.71.2.3 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.71.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.71.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.76.6.1 16-Dec-2004  jmc Pullup patch (requested by david in ticket #1800)

Bounds check syscall arguments where appropriate.
 1.76.4.2 15-Jul-2002  gehenna catch up with -current.
 1.76.4.1 16-May-2002  gehenna Get rid of iszerodev. Use the 'zerodev' (dev_t for /dev/zero).
 1.85.2.9 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.85.2.8 01-Apr-2005  skrll Sync with HEAD.
 1.85.2.7 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.85.2.6 04-Feb-2005  skrll Sync with HEAD.
 1.85.2.5 28-Nov-2004  skrll Adapt to branch
 1.85.2.4 02-Nov-2004  skrll Sync with HEAD.
 1.85.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.85.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.85.2.1 03-Aug-2004  skrll Sync with HEAD
 1.92.2.1 12-Nov-2004  jmc Pullup rev 1.95 (requested by david in ticket #946)

Bounds check syscall arguments where appropriate.
 1.95.4.1 29-Apr-2005  kent sync with -current
 1.96.2.3 26-Mar-2005  yamt sync with head.
 1.96.2.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.96.2.1 12-Feb-2005  yamt sync with head.
 1.98.2.1 18-Sep-2005  tron Pull up following revision(s) (requested by fvdl in ticket #798):
sys/compat/sunos/sunos_exec.c: revision 1.47
sys/compat/pecoff/pecoff_emul.c: revision 1.11
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.45
sys/arch/amd64/amd64/netbsd32_machdep.c: revision 1.12
sys/sys/proc.h: revision 1.198
sys/compat/mach/mach_exec.c: revision 1.56
sys/compat/freebsd/freebsd_exec.c: revision 1.27
sys/arch/sparc64/include/vmparam.h: revision 1.27
sys/kern/kern_resource.c: revision 1.91
sys/compat/netbsd32/netbsd32_netbsd.c: revision 1.88
sys/compat/osf1/osf1_exec.c: revision 1.39
sys/compat/svr4_32/svr4_32_resource.c: revision 1.5
sys/compat/ultrix/ultrix_misc.c: revision 1.99
sys/compat/svr4_32/svr4_32_exec.h: revision 1.9
sys/kern/exec_elf32.c: revision 1.103
sys/compat/aoutm68k/aoutm68k_exec.c: revision 1.19
sys/compat/sunos32/sunos32_exec.c: revision 1.20
sys/compat/hpux/hpux_exec.c: revision 1.46
sys/compat/darwin/darwin_exec.c: revision 1.40
sys/kern/sysv_shm.c: revision 1.83
sys/uvm/uvm_extern.h: revision 1.99
sys/uvm/uvm_mmap.c: revision 1.89
sys/kern/kern_exec.c: revision 1.195
sys/compat/netbsd32/netbsd32.h: revision 1.31
sys/arch/sparc64/sparc64/svr4_32_machdep.c: revision 1.20
sys/compat/svr4/svr4_exec.c: revision 1.56
sys/compat/irix/irix_exec.c: revision 1.41
sys/compat/ibcs2/ibcs2_exec.c: revision 1.63
sys/compat/svr4_32/svr4_32_exec.c: revision 1.16
sys/arch/amd64/include/vmparam.h: revision 1.8
sys/compat/linux/common/linux_exec.c: revision 1.73
Fix some things regarding COMPAT_NETBSD32 and limits/VM addresses.
* For sparc64 and amd64, define *SIZ32 VM constants.
* Add a new function pointer to struct emul, pointing at a function
that will return the default VM map address. The default function
is uvm_map_defaultaddr, which just uses the VM_DEFAULT_ADDRESS
macro. This gives emulations control over the default map address,
and allows things to be mapped at the right address (in 32bit range)
for COMPAT_NETBSD32.
* Add code to adjust the data and stack limits when a COMPAT_NETBSD32
or COMPAT_SVR4_32 binary is executed.
* Don't use USRSTACK in kern_resource.c, use p_vmspace->vm_minsaddr
instead (emulations might have set it differently)
* Since this changes struct emul, bump kernel version to 3.99.2
Tested on amd64, compile-tested on sparc64.
 1.99.2.5 24-Mar-2008  yamt sync with head.
 1.99.2.4 21-Jan-2008  yamt sync with head
 1.99.2.3 03-Sep-2007  yamt sync with head.
 1.99.2.2 26-Feb-2007  yamt sync with head.
 1.99.2.1 21-Jun-2006  yamt sync with head.
 1.104.20.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.104.20.1 29-Dec-2006  ad Checkpoint work in progress.
 1.105.2.2 17-May-2007  yamt sync with head.
 1.105.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.106.4.1 11-Jul-2007  mjf Sync with head.
 1.106.2.1 08-Jun-2007  ad Sync with head.
 1.108.20.1 02-Jan-2008  bouyer Sync with HEAD
 1.108.16.1 26-Dec-2007  ad Sync with head.
 1.108.14.1 18-Feb-2008  mjf Sync with HEAD.
 1.108.8.1 09-Jan-2008  matt sync with HEAD
 1.110.6.5 17-Jan-2009  mjf Sync with HEAD.
 1.110.6.4 28-Sep-2008  mjf Sync with HEAD.
 1.110.6.3 29-Jun-2008  mjf Sync with HEAD.
 1.110.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.110.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.111.2.1 18-May-2008  yamt sync with head.
 1.112.6.1 27-Jun-2008  simonb Sync with head.
 1.112.4.3 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.112.4.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.112.4.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.112.2.3 11-Aug-2010  yamt sync with head.
 1.112.2.2 11-Mar-2010  yamt sync with head
 1.112.2.1 04-May-2009  yamt sync with head.
 1.113.2.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.113.2.1 19-Oct-2008  haad Sync with HEAD.
 1.116.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.118.4.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.118.4.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.120.2.1 05-Mar-2011  rmind sync with head
 1.121.12.1 24-Feb-2012  mrg sync to -current.
 1.121.8.1 17-Apr-2012  yamt sync with head
 1.122.32.1 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1836):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.123.2.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.123.2.1 21-May-2018  pgoyette Sync with HEAD
 1.124.2.1 10-Jun-2019  christos Sync with HEAD
 1.125.4.1 03-Aug-2022  martin Pull up following revision(s), all via patch
(requested by riastradh in ticket #1487):

sys/compat/linux/arch/i386/linux_machdep.c: revision 1.168
sys/compat/sunos/sunos_misc.c: revision 1.177
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.52
sys/compat/common/kern_resource_43.c: revision 1.23
sys/compat/netbsd32/netbsd32_conv.h: revision 1.46
sys/compat/linux/arch/i386/linux_ptrace.c: revision 1.35
sys/compat/common/vfs_syscalls_12.c: revision 1.38
sys/compat/ultrix/ultrix_misc.c: revision 1.126
sys/compat/common/kern_sig_43.c: revision 1.37
sys/compat/linux/common/linux_mtio.c: revision 1.8
sys/compat/freebsd/freebsd_misc.c: revision 1.34
sys/compat/freebsd/freebsd_machdep.c: revision 1.5
sys/compat/linux/common/linux_olduname.c: revision 1.67
sys/compat/linux/arch/mips/linux_machdep.c: revision 1.44
sys/compat/freebsd/freebsd_sched.c: revision 1.23
sys/compat/ossaudio/ossaudio.c: revision 1.84
sys/compat/sys/time_types.h: revision 1.6
sys/compat/linux/arch/powerpc/linux_machdep.c: revision 1.51
sys/compat/common/ieee80211_20.c: revision 1.7
sys/compat/linux/common/linux_file.c: revision 1.119
sys/compat/linux/arch/arm/linux_machdep.c: revision 1.34
sys/compat/netbsd32/netbsd32_wait.c: revision 1.25
sys/compat/linux32/common/linux32_time.c: revision 1.38
sys/compat/linux/arch/powerpc/linux_ptrace.c: revision 1.33
sys/compat/linux/arch/alpha/linux_machdep.c: revision 1.52
sys/compat/linux32/arch/amd64/linux32_machdep.c: revision 1.46
sys/compat/netbsd32/netbsd32_compat_12.c: revision 1.36
sys/compat/ultrix/ultrix_ioctl.c: revision 1.39
sys/compat/linux/common/linux_misc.c: revision 1.252
sys/compat/linux/common/linux_hdio.c: revision 1.19
sys/compat/sunos/sunos_ioctl.c: revision 1.71
sys/compat/linux/common/linux_sched.c: revision 1.79
sys/compat/common/kern_info_43.c: revision 1.40
sys/compat/linux32/common/linux32_exec_elf32.c: revision 1.20
sys/compat/linux/common/linux_socket.c: revision 1.153
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.60
sys/compat/common/vfs_syscalls_43.c: revision 1.68
sys/compat/linux/arch/powerpc/linux_exec_powerpc.c: revision 1.25
sys/compat/netbsd32/netbsd32_ptrace.c: revision 1.9
sys/compat/common/kern_time_50.c: revision 1.37
sys/compat/netbsd32/netbsd32_compat_20.c: revision 1.42
sys/compat/linux/common/linux_cdrom.c: revision 1.28
sys/compat/linux/arch/m68k/linux_machdep.c: revision 1.43
sys/compat/common/kern_info_09.c: revision 1.22
sys/compat/linux32/common/linux32_resource.c: revision 1.12
sys/compat/linux/common/linux_oldolduname.c: revision 1.67
sys/compat/common/if_media_80.c: revision 1.4
sys/compat/linux/arch/alpha/linux_osf1.c: revision 1.5
sys/compat/netbsd32/netbsd32_nfssvc.c: revision 1.8
sys/compat/linux32/common/linux32_signal.c: revision 1.21
sys/compat/common/kern_sig_13.c: revision 1.22
sys/compat/sunos32/sunos32_ioctl.c: revision 1.36
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.62
sys/compat/linux/arch/arm/linux_ptrace.c: revision 1.23
sys/compat/netbsd32/netbsd32_time.c: revision 1.56
sys/compat/linux/common/linux_signal.c: revision 1.84
sys/compat/netbsd32/netbsd32_signal.c: revision 1.52
sys/compat/sunos32/sunos32_misc.c: revision 1.85
sys/compat/linux/common/linux_time.c: revision 1.40
sys/compat/linux/common/linux_fdio.c: revision 1.14
sys/compat/common/vfs_syscalls_30.c: revision 1.43

sys/compat: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.
 1.6 03-Mar-2019  pgoyette Fix the required-list for compat_ultrix. With the merge of the
[pgoyette-compat] branch there is no longer a "compat" module;
instead we have lots of version-specific compat_xx modules.

Code inspection shows compat_ultrix uses compat_13 (and newer)
stuff, so set the requirements list accordingly.

Should fix PR port-pmax/54037
 1.5 07-Mar-2014  christos branches: 1.5.30;
c99 initializers for struct execsw
 1.4 19-Sep-2013  christos exec modules need to be of the exec kind
 1.3 24-Nov-2008  ad branches: 1.3.4; 1.3.6; 1.3.8; 1.3.12; 1.3.24; 1.3.34; 1.3.38;
COMPAT_ULTRIX does not work on vax because there are no hooks, but make
it compile anyway.
 1.2 20-Nov-2008  cegger take ecoff header for ecoff code.
 1.1 19-Nov-2008  ad Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.3.38.1 18-May-2014  rmind sync with head
 1.3.34.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.3.24.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.3.12.2 04-May-2009  yamt sync with head.
 1.3.12.1 24-Nov-2008  yamt file ultrix_mod.c was added on branch yamt-nfs-mp on 2009-05-04 08:12:29 +0000
 1.3.8.2 19-Jan-2009  skrll Sync with HEAD.
 1.3.8.1 24-Nov-2008  skrll file ultrix_mod.c was added on branch nick-hppapmap on 2009-01-19 13:17:45 +0000
 1.3.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.3.6.1 24-Nov-2008  mjf file ultrix_mod.c was added on branch mjf-devfs2 on 2009-01-17 13:28:49 +0000
 1.3.4.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.3.4.1 24-Nov-2008  haad file ultrix_mod.c was added on branch haad-dm on 2008-12-13 01:14:07 +0000
 1.5.30.1 10-Jun-2019  christos Sync with HEAD
 1.40 12-Oct-2022  andvar fix few typos in comments.
 1.39 05-Sep-2014  matt Try not to use f_data, use f_{vnode,socket,pipe,mqueue,kqueue,ksem} to get
a correctly typed pointer.
 1.38 14-Dec-2009  matt branches: 1.38.22;
Merge from matt-nb5-mips64
 1.37 29-Jun-2009  dholland Convert 67 namei call sites to use namei_simple, in these functions:

check_console, veriexecclose, veriexec_delete, veriexec_file_add,
emul_find_root, coff_load_shlib (sh3 version), coff_load_shlib,
compat_20_sys_statfs, compat_20_netbsd32_statfs,
ELFNAME2(netbsd32,probe_noteless), darwin_sys_statfs,
ibcs2_sys_statfs, ibcs2_sys_statvfs, linux_sys_uselib,
osf1_sys_statfs, sunos_sys_statfs, sunos32_sys_statfs,
ultrix_sys_statfs, do_sys_mount, fss_create_files (3 of 4),
adosfs_mount, cd9660_mount, coda_ioctl, coda_mount, ext2fs_mount,
ffs_mount, filecore_mount, hfs_mount, lfs_mount, msdosfs_mount,
ntfs_mount, sysvbfs_mount, udf_mount, union_mount, sys_chflags,
sys_lchflags, sys_chmod, sys_lchmod, sys_chown, sys_lchown,
sys___posix_chown, sys___posix_lchown, sys_link, do_sys_pstatvfs,
sys_quotactl, sys_revoke, sys_truncate, do_sys_utimes, sys_extattrctl,
sys_extattr_set_file, sys_extattr_set_link, sys_extattr_get_file,
sys_extattr_get_link, sys_extattr_delete_file,
sys_extattr_delete_link, sys_extattr_list_file, sys_extattr_list_link,
sys_setxattr, sys_lsetxattr, sys_getxattr, sys_lgetxattr,
sys_listxattr, sys_llistxattr, sys_removexattr, sys_lremovexattr

All have been scrutinized (several times, in fact) and compile-tested,
but not all have been explicitly tested in action.

XXX: While I haven't (intentionally) changed the use or nonuse of
XXX: TRYEMULROOT in any of these places, I'm not convinced all the
XXX: uses are correct; an audit might be desirable.
 1.36 17-Jan-2009  he branches: 1.36.2;
Adapt to the state after the recent time_t change.
Type changes:
timeval -> timeval50
itimerval -> itimerval50
rusage -> rusage50
and use of the compat_50 calls where appropriate.
Untested, but at least it builds.

Discussed with christos@
 1.35 24-Jun-2008  ad branches: 1.35.4; 1.35.12;
Replace references to getsock/getvnode.
 1.34 21-Mar-2008  ad branches: 1.34.4; 1.34.6; 1.34.8;
Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
 1.33 05-Jan-2008  dsl branches: 1.33.6;
Use FILE_LOCK() and FILE_UNLOCK().
Attempt to fix all the code paths so that the 'fp' returned by fd_getfile()
isn't left locked, and is always unlocked (and ref-counted) before
doing anything that might sleep.
 1.32 27-Dec-2007  christos make this compile again.
 1.31 20-Dec-2007  dsl Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.30 08-Dec-2007  pooka branches: 1.30.4;
Remove cn_lwp from struct componentname. curlwp should be used
from on. The NDINIT() macro no longer takes the lwp parameter and
associates the credentials of the calling thread with the namei
structure.
 1.29 27-Nov-2007  dogcow branches: 1.29.2;
more VFS_STATVFS(x,y,z) fallout; change them to VFS_STATVFS(x,y). (hi, pooka!)
 1.28 25-Apr-2007  matt branches: 1.28.6; 1.28.8; 1.28.14;
Make this compile again (after stackgap removal)
 1.27 22-Apr-2007  dsl Change the way that emulations locate files within the emulation root to
avoid having to allocate space in the 'stackgap'
- which is very LWP unfriendly.
The additional code for non-emulation namei() is trivial, the reduction for
the emulations is massive.
The vnode for a processes emulation root is saved in the cwdi structure
during process exec.
If the emulation root the TRYEMULROOT flag are set, namei() will do an initial
search for absolute pathnames in the emulation root, if that fails it will
retry from the normal root.
".." at the emulation root will always go to the real root, even in the middle
of paths and when expanding symlinks.
Absolute symlinks found using absolute paths in the emulation root will be
relative to the emulation root (so /usr/lib/xxx.so -> /lib/xxx.so links
inside the emulation root don't need changing).
If the root of the emulation would be returned (for an emulation lookup), then
the real root is returned instead (matching the behaviour of emul_lookup,
but being a cheap comparison here) so that programs that scan "../.."
looking for the root dircetory don't loop forever.
The target for symbolic links is no longer mangled (it used to get the
CHECK_ALT_xxx() treatment, so could get /emul/xxx prepended).
CHECK_ALT_xxx() are no more. Most of the change is deleting them, and adding
TRYEMULROOT to the flags to NDINIT().
A lot of the emulation system call stubs could now be deleted.
 1.26 04-Mar-2007  christos branches: 1.26.2; 1.26.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.25 09-Feb-2007  ad branches: 1.25.2;
Merge newlock2 to head.
 1.24 11-Dec-2005  christos branches: 1.24.20;
merge ktrace-lwp.
 1.23 26-Feb-2005  perry branches: 1.23.4;
nuke trailing whitespace
 1.22 21-Apr-2004  simonb branches: 1.22.4; 1.22.6;
ANSIfy, some KNF.
 1.21 21-Apr-2004  simonb Fix some statfs->statvfs fallout. Compile tested only...
 1.20 21-Apr-2004  christos Replace the statfs() family of system calls with statvfs().
Retain binary compatibility.
 1.19 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.18 29-Jun-2003  fvdl branches: 1.18.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.17 29-Jun-2003  simonb Fix 'struct lwp *' lossage.
 1.16 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.15 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.14 16-Mar-2002  christos make the stackgap_{init,alloc} functions MP friendly (i.e. pass struct proc *
in, instead of using curproc). While there add an optional size argument to
stackgap_init.
 1.13 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.12 14-Jun-2001  thorpej branches: 1.12.2;
Fix a partial construction problem that can cause race conditions
between creation of a file descriptor and close(2) when using kernel
assisted threads. What we do is stick descriptors in the table, but
mark them as "larval". This causes essentially everything to treat
it as a non-existent descriptor, except for fdalloc(), which sees a
filled slot so that it won't (incorrectly) allocate it again. When
a descriptor is fully constructed, the code that has constructed it
marks it as "mature" (which actually clears the "larval" flag), and
things continue to work as normal.

While here, gather all the code that gets a descriptor from the table
into a fd_getfile() function, and call it, rather than having the
same (sometimes incorrect) code copied all over the place.
 1.11 01-Dec-2000  jdolecek branches: 1.11.2;
add e_path (emulation path) to struct emul, which replaces emulation-specific
*_emul_path variables

change macros CHECK_ALT_{CREAT|EXIST} to use that, 'root' doesn't need
to be passed explicitly any more and *_CHECK_ALT_{CREAT|EXIST} are removed
change explicit emul_find() calls in probe functions to get the emulation
path from the checked exec switch entry's emulation

remove no longer needed header files

add e_flags and e_syscall to struct emul; these are unsed and empty for now
 1.10 30-Mar-2000  augustss Kill register declarations.
 1.9 05-May-1999  thorpej branches: 1.9.2;
Add "use counting" to file entries. When closing a file, and it's reference
count is 0, wait for use count to drain before finishing the close.

This is necessary in order for multiple processes to safely share file
descriptor tables.
 1.8 09-Feb-1999  christos branches: 1.8.4;
const poisoning and CHECK_ALT_CREAT fixes.
 1.7 09-Aug-1998  perry bzero->memset, bcopy->memcpy, bcmp->memcmp
 1.6 25-May-1997  jonathan lint: add prototype for static local function ultrixstatfs().
 1.5 14-Oct-1996  mhitch Now needs sys/proc.h since compat/common/compat_util.h doesn't anymore.
 1.4 29-Sep-1996  jonathan Fix cut-and-paste (ouap vs ap) bugs so the previous revision actually
compiles. Change variable names to use "ap" instead of "ouap" everywhere
to avoid similar bugs in future.
 1.3 03-Sep-1996  mycroft Define execv() and execve() consistently across emulations.
Do path name translation.
 1.2 07-Apr-1996  jonathan branches: 1.2.4;
Remove gcc -Wall lint from ultrix emulation.-
Mostly adding explicit != comparison to "if (error = copyin/out( ... ))".
Fix comment glitch in ultrix_fs.c
 1.1 07-Jan-1996  jonathan Add '/emul/ultrix' pathname processing to Ultrix emulation, and move
Ultrix syscalls that require that processing out of ultrix_misc.c
to ultrix_pathname.c.
 1.2.4.1 10-Dec-1996  mycroft From trunk:
Do execv() and execve() path name translation consistently across
emulations.
 1.8.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.9.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.9.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.11.2.5 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.11.2.4 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.11.2.3 06-Dec-2001  wdk struct proc -> struct lwp changes for COMPAT_ULTRIX support
 1.11.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.11.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.12.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.12.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.18.2.6 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.18.2.5 28-Nov-2004  skrll Adapt to branch
 1.18.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.18.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.18.2.2 03-Aug-2004  skrll Sync with HEAD
 1.18.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.22.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.22.4.1 29-Apr-2005  kent sync with -current
 1.23.4.6 24-Mar-2008  yamt sync with head.
 1.23.4.5 21-Jan-2008  yamt sync with head
 1.23.4.4 07-Dec-2007  yamt sync with head
 1.23.4.3 03-Sep-2007  yamt sync with head.
 1.23.4.2 26-Feb-2007  yamt sync with head.
 1.23.4.1 21-Jun-2006  yamt sync with head.
 1.24.20.2 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.24.20.1 29-Dec-2006  ad Checkpoint work in progress.
 1.25.2.2 07-May-2007  yamt sync with head.
 1.25.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.26.4.1 11-Jul-2007  mjf Sync with head.
 1.26.2.1 08-Jun-2007  ad Sync with head.
 1.28.14.3 18-Feb-2008  mjf Sync with HEAD.
 1.28.14.2 27-Dec-2007  mjf Sync with HEAD.
 1.28.14.1 08-Dec-2007  mjf Sync with HEAD.
 1.28.8.1 09-Jan-2008  matt sync with HEAD
 1.28.6.2 09-Dec-2007  jmcneill Sync with HEAD.
 1.28.6.1 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.29.2.1 26-Dec-2007  ad Sync with head.
 1.30.4.2 08-Jan-2008  bouyer Sync with HEAD
 1.30.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.33.6.2 29-Jun-2008  mjf Sync with HEAD.
 1.33.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.34.8.1 27-Jun-2008  simonb Sync with head.
 1.34.6.3 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.34.6.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.34.6.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.34.4.3 11-Mar-2010  yamt sync with head
 1.34.4.2 18-Jul-2009  yamt sync with head.
 1.34.4.1 04-May-2009  yamt sync with head.
 1.35.12.1 09-Sep-2009  matt Change to use fixed sized types.
 1.35.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.36.2.1 23-Jul-2009  jym Sync with HEAD.
 1.38.22.1 03-Dec-2017  jdolecek update from HEAD
 1.75 03-Mar-2019  pgoyette Regen
 1.74 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.73 10-Aug-2018  pgoyette Regen
 1.72 06-Jan-2018  kamil branches: 1.72.2; 1.72.4;
Revert vadvise(2) removal

This system call was used in legacy Lisp code, that was inherited to modern
age and still compiled against supported compat layers (e.g. in clisp,
oaklisp, Franz Lisp).

It used to instruct the kernel about paging policy (G/C aware, flush etc).

Newly compiled code (assuming that it will detect vadvise()) will use the
libc stub for vadvise(). The headers for this interface are gone.

vadvise(2) could be marked as COMPAT_80, but as long as we support ultrix,
sunos or aout68k ABI, don't bother with this.

Requested by <mrg>
 1.71 19-Dec-2017  kamil compat/ultrix: Drop SYS_vadvise

The (o)vadvise syscall is dummy since the beginning of NetBSD.

Sponsored by <The NetBSD Foundation>
 1.70 19-Dec-2017  kamil compat/ultrix: Drop SYS_sbrk

sbrk - change data segment size

This syscall is dummy since the inception of the project.

Sponsored by <The NetBSD Foundation>
 1.69 19-Dec-2017  kamil compat ultrix: Drop the sstk(2) syscall

sstk(2) has never been implemented by the NetBSD kernel.

Sponsored by <The NetBSD Foundation>
 1.68 10-May-2017  riastradh regen
 1.67 16-Jan-2017  christos branches: 1.67.4;
regen
 1.66 13-Jan-2017  christos branches: 1.66.2;
regen
 1.65 24-Sep-2015  christos branches: 1.65.2;
regen
 1.64 07-Mar-2015  christos regen
 1.63 07-Nov-2013  njoly branches: 1.63.6;
Regen for dup/dup2/dup3 argument types fix.
 1.62 02-Mar-2010  pooka branches: 1.62.10; 1.62.20; 1.62.24;
regen:
- remove nfssvc / fs_nfs.h / #ifdef NFS
- make getfh unconditional
 1.61 14-Dec-2009  matt branches: 1.61.2;
Regen (new makesyscalls.sh)
 1.60 17-Jan-2009  he Regenerate files after updating syscalls.master for compat_ultrix:

Adapt to the state after the recent time_t change.
Type changes:
timeval -> timeval50
itimerval -> itimerval50
rusage -> rusage50
and use of the compat_50 calls where appropriate.
Untested, but at least it builds.

Discussed with christos@
 1.59 13-Jan-2009  pooka Regen to prove I didn't screw up the conversion: purely RCSID changes.
 1.58 13-Jan-2009  pooka regen
 1.57 19-Nov-2008  ad Regen.
 1.56 19-Jun-2008  hans branches: 1.56.2; 1.56.4;
regen from syscalls.master r1.46
 1.55 23-Apr-2008  ad branches: 1.55.2; 1.55.4; 1.55.6;
Regen.
 1.54 20-Dec-2007  dsl branches: 1.54.6; 1.54.8;
regen
 1.53 04-Mar-2007  christos branches: 1.53.16; 1.53.24; 1.53.28;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.52 13-Jul-2006  pavel branches: 1.52.10;
regen (sys_getfh -> compat_30_sys_getfh)
 1.51 26-Jun-2006  mrg regenerate.
 1.50 11-Dec-2005  christos branches: 1.50.4; 1.50.8; 1.50.16;
merge ktrace-lwp.
 1.49 26-Feb-2005  perry branches: 1.49.4;
regen
 1.48 26-Feb-2005  perry regen
 1.47 18-Jan-2003  thorpej branches: 1.47.2; 1.47.10; 1.47.12;
Regen for correct RCS ID.
 1.46 18-Jan-2003  thorpej Regen: Merge the nathanw_sa branch.
 1.45 01-Nov-2002  jdolecek set nsysent to 512 (oh well, just three syscalls too many for 256)
 1.44 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.43 30-May-2001  mrg branches: 1.43.2;
use _KERNEL_OPT.
 1.42 27-Jan-2001  thorpej branches: 1.42.2;
egen; getpid(2) is MP-safe.
 1.41 27-Jan-2001  thorpej Regen; add sy_flags.
 1.40 09-Dec-2000  mycroft Regen.
 1.39 18-Aug-2000  cgd update for changed makesyscalls.master
 1.38 30-Jul-1999  drochner branches: 1.38.2;
regen
 1.37 12-Jul-1999  kleink Regen.
 1.36 09-Feb-1999  christos branches: 1.36.2; 1.36.4;
Regen
 1.35 18-Dec-1998  drochner regen
 1.34 10-Dec-1998  christos Regen
 1.33 03-Oct-1998  drochner regen
 1.32 26-Sep-1998  drochner regen
 1.31 25-Jun-1998  thorpej Regen: defopt NFSSERVER
 1.30 19-Feb-1998  thorpej Regen: makesyscalls.sh changed.
 1.29 19-Feb-1998  thorpej Regen; syscalls.master and makesyscalls.sh changed.
 1.28 14-Feb-1998  kleink Regen: use POSIX semantics for chown()/fchown().
 1.27 22-Jan-1998  mycroft Regen.
 1.26 09-Jan-1998  thorpej Regen.
 1.25 08-Jan-1998  thorpej Regen: back out RCD ID related changes.
 1.24 05-Jan-1998  perry regened with RCSIDs in place
 1.23 16-Oct-1997  christos Regen.
 1.22 13-Jun-1997  thorpej Regen: Use compat_12_sys_swapon().
 1.21 09-Jun-1997  jonathan Emulate RISC Ultrix cacheflush() and cachectl() syscalls on mips.
 1.20 06-Apr-1997  jonathan Add changes to make vic-2.8 Ultrix binaries work on NetBSD with COMPAT_ULTRIX:
* Add IPmulticast setsockopt emulation.
* Add Ultrix shmsys emulation (untested).
* tidy up use of stackgap.
 1.19 31-Jan-1997  thorpej Syscalls.master changed, regen. (NFSCLIENT -> NFS)
 1.18 13-Jan-1997  thorpej Regen; makesyscalls.sh emits comments now.
 1.17 03-Sep-1996  mycroft Regen.
 1.16 23-Jun-1996  mycroft Regen.
 1.15 07-Jan-1996  jonathan branches: 1.15.4;
Add '/emul/ultrix' pathname processing to Ultrix emulation, and move
Ultrix syscalls that require that processing out of ultrix_misc.c
to ultrix_pathname.c.
 1.14 26-Dec-1995  jonathan Add emulation of ultrix mount(2). Sufficient to NFS-mount filesystems
using a NetBSD kernel in an ultrix root filesystem.

Move wait emulation to the old (v7) wait syscall number, as that's
what the Ultrix ufs_mount binary uses.
 1.13 26-Dec-1995  jonathan Add emulation of Ultrix select: before calling native sys_select(),
limit the number of FDs to select on to the maximum supported by NetBSD --
which is as many FDs as the emul_ultrix process can have open, anyway.

Add emulation of Ultrix getmnt(2) in ultrix_fs.c

Add partial emulation of Ultrix tty ioctl()s in ultrix_ioctl.c, derived
from compat/sunos/sunos_ioctl.c. Ultrix libc's ``isatty()'' now works
in compat_emul processes.
 1.12 07-Oct-1995  mycroft Reran makesyscalls.sh.
 1.11 19-Sep-1995  thorpej makesyscalls.sh changed
 1.10 01-Jun-1995  mellon Clear up name conflict between Ultrix syscall 103 and 139.
 1.9 29-May-1995  mellon syscall 139 is ULTRIX_SYS_sigcleanup (from Simon Burge)
 1.8 22-Apr-1995  christos - added struct emul to all emulations.
- removed all setup functions.
- added copyargs() functions where needed.
 1.7 01-Dec-1994  dean added sigreturn
 1.6 23-Nov-1994  dean changes for new sysent structure (from J. Stone)
 1.5 01-Aug-1994  glass add ultrix_{get,set}sysinfo() from Arne H Juul <arnej@dsl.unit.no>
 1.4 30-Jun-1994  cgd branches: 1.4.2;
fix a botch, and gen syscall files
 1.3 22-Jun-1994  glass update to reflect compat_ultrix syscalls.master
 1.2 15-Jun-1994  glass much works but untested w/new fs. expect more tomorrow
 1.1 02-Jun-1994  glass first swipe at ultrix compat. expect many bug fixes. very related to compat/sunos
 1.4.2.1 01-Aug-1994  cgd From trunk.
 1.15.4.1 10-Dec-1996  mycroft Regen.
 1.36.4.1 02-Aug-1999  thorpej Regen.
 1.36.2.1 31-Jan-2000  he Pull up regenerated files (requested by mhitch):
Emulate Ultrix fcntl(F_SETLK) & Co. so the Ultrix seti@home client
works.
 1.38.2.3 11-Feb-2001  bouyer Sync with HEAD.
 1.38.2.2 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.38.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.42.2.5 11-Nov-2002  nathanw Catch up to -current
 1.42.2.4 29-May-2002  nathanw Regen.
 1.42.2.3 06-Dec-2001  wdk Regen to incorperate LWP support
 1.42.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.42.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.43.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.47.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.47.10.1 29-Apr-2005  kent sync with -current
 1.47.2.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.49.4.3 21-Jan-2008  yamt sync with head
 1.49.4.2 03-Sep-2007  yamt sync with head.
 1.49.4.1 30-Dec-2006  yamt sync with head.
 1.50.16.1 13-Jul-2006  gdamore Merge from HEAD.
 1.50.8.1 11-Aug-2006  yamt sync with head
 1.50.4.1 09-Sep-2006  rpaulo sync with head
 1.52.10.1 12-Mar-2007  rmind Sync with HEAD.
 1.53.28.1 02-Jan-2008  bouyer Sync with HEAD
 1.53.24.1 26-Dec-2007  ad Sync with head.
 1.53.16.1 09-Jan-2008  matt sync with HEAD
 1.54.8.1 18-May-2008  yamt sync with head.
 1.54.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.54.6.2 29-Jun-2008  mjf Sync with HEAD.
 1.54.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.55.6.1 27-Jun-2008  simonb Sync with head.
 1.55.4.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.55.2.2 11-Mar-2010  yamt sync with head
 1.55.2.1 04-May-2009  yamt sync with head.
 1.56.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.56.2.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.61.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.62.24.1 18-May-2014  rmind sync with head
 1.62.20.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.62.10.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.63.6.1 06-Apr-2015  skrll Sync with HEAD
 1.65.2.1 20-Mar-2017  pgoyette Sync with HEAD
 1.66.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.67.4.1 11-May-2017  pgoyette Sync with HEAD
 1.72.4.1 10-Jun-2019  christos Sync with HEAD
 1.72.2.2 29-Sep-2018  pgoyette Regen
 1.72.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.70 03-Mar-2019  pgoyette Regen
 1.69 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.68 10-Aug-2018  pgoyette Regen
 1.67 06-Jan-2018  kamil branches: 1.67.2; 1.67.4;
Revert vadvise(2) removal

This system call was used in legacy Lisp code, that was inherited to modern
age and still compiled against supported compat layers (e.g. in clisp,
oaklisp, Franz Lisp).

It used to instruct the kernel about paging policy (G/C aware, flush etc).

Newly compiled code (assuming that it will detect vadvise()) will use the
libc stub for vadvise(). The headers for this interface are gone.

vadvise(2) could be marked as COMPAT_80, but as long as we support ultrix,
sunos or aout68k ABI, don't bother with this.

Requested by <mrg>
 1.66 19-Dec-2017  kamil compat/ultrix: Drop SYS_vadvise

The (o)vadvise syscall is dummy since the beginning of NetBSD.

Sponsored by <The NetBSD Foundation>
 1.65 19-Dec-2017  kamil compat/ultrix: Drop SYS_sbrk

sbrk - change data segment size

This syscall is dummy since the inception of the project.

Sponsored by <The NetBSD Foundation>
 1.64 19-Dec-2017  kamil compat ultrix: Drop the sstk(2) syscall

sstk(2) has never been implemented by the NetBSD kernel.

Sponsored by <The NetBSD Foundation>
 1.63 10-May-2017  riastradh regen
 1.62 16-Jan-2017  christos branches: 1.62.4;
regen
 1.61 13-Jan-2017  christos branches: 1.61.2;
regen
 1.60 24-Sep-2015  christos branches: 1.60.2;
regen
 1.59 07-Mar-2015  christos regen
 1.58 07-Nov-2013  njoly branches: 1.58.6;
Regen for dup/dup2/dup3 argument types fix.
 1.57 02-Mar-2010  pooka branches: 1.57.10; 1.57.20; 1.57.24;
regen:
- remove nfssvc / fs_nfs.h / #ifdef NFS
- make getfh unconditional
 1.56 14-Dec-2009  matt branches: 1.56.2;
Regen (new makesyscalls.sh)
 1.55 17-Jan-2009  he Regenerate files after updating syscalls.master for compat_ultrix:

Adapt to the state after the recent time_t change.
Type changes:
timeval -> timeval50
itimerval -> itimerval50
rusage -> rusage50
and use of the compat_50 calls where appropriate.
Untested, but at least it builds.

Discussed with christos@
 1.54 13-Jan-2009  pooka Regen to prove I didn't screw up the conversion: purely RCSID changes.
 1.53 13-Jan-2009  pooka regen
 1.52 19-Nov-2008  ad Regen.
 1.51 19-Jun-2008  hans branches: 1.51.2; 1.51.4;
regen from syscalls.master r1.46
 1.50 23-Apr-2008  ad branches: 1.50.2; 1.50.4; 1.50.6;
Regen.
 1.49 27-Dec-2007  christos branches: 1.49.6; 1.49.8;
make this compile again.
 1.48 20-Dec-2007  dsl regen
 1.47 04-Mar-2007  christos branches: 1.47.16; 1.47.22; 1.47.24; 1.47.28;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.46 13-Jul-2006  pavel branches: 1.46.10;
regen (sys_getfh -> compat_30_sys_getfh)
 1.45 26-Jun-2006  mrg regenerate.
 1.44 11-Dec-2005  christos branches: 1.44.4; 1.44.8; 1.44.16;
merge ktrace-lwp.
 1.43 26-Feb-2005  perry branches: 1.43.4;
regen
 1.42 26-Feb-2005  perry regen
 1.41 18-Jan-2003  thorpej branches: 1.41.2; 1.41.10; 1.41.12;
Regen for correct RCS ID.
 1.40 18-Jan-2003  thorpej Regen: Merge the nathanw_sa branch.
 1.39 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.38 30-May-2001  mrg branches: 1.38.2;
use _KERNEL_OPT.
 1.37 27-Jan-2001  thorpej branches: 1.37.2;
egen; getpid(2) is MP-safe.
 1.36 27-Jan-2001  thorpej Regen; add sy_flags.
 1.35 09-Dec-2000  mycroft Regen.
 1.34 18-Aug-2000  cgd update for changed makesyscalls.master
 1.33 18-Aug-2000  cgd update for my change to makesyscalls.sh, and apparently previous
changes as well...
 1.32 30-Jul-1999  drochner branches: 1.32.2;
regen
 1.31 12-Jul-1999  kleink Regen.
 1.30 09-Feb-1999  christos branches: 1.30.2; 1.30.4;
Regen
 1.29 18-Dec-1998  drochner regen
 1.28 10-Dec-1998  christos Regen
 1.27 03-Oct-1998  eeh Fixup big-endian syscall args.
 1.26 03-Oct-1998  drochner regen
 1.25 26-Sep-1998  drochner regen
 1.24 25-Jun-1998  thorpej Regen: defopt NFSSERVER
 1.23 19-Feb-1998  thorpej Regen: makesyscalls.sh changed.
 1.22 19-Feb-1998  thorpej Regen; syscalls.master and makesyscalls.sh changed.
 1.21 14-Feb-1998  kleink Regen: use POSIX semantics for chown()/fchown().
 1.20 22-Jan-1998  mycroft Regen.
 1.19 09-Jan-1998  thorpej Regen.
 1.18 08-Jan-1998  thorpej Regen: back out RCD ID related changes.
 1.17 05-Jan-1998  perry regened with RCSIDs in place
 1.16 16-Oct-1997  christos Regen.
 1.15 13-Jun-1997  thorpej Regen: Use compat_12_sys_swapon().
 1.14 09-Jun-1997  jonathan Emulate RISC Ultrix cacheflush() and cachectl() syscalls on mips.
 1.13 06-Apr-1997  jonathan Add changes to make vic-2.8 Ultrix binaries work on NetBSD with COMPAT_ULTRIX:
* Add IPmulticast setsockopt emulation.
* Add Ultrix shmsys emulation (untested).
* tidy up use of stackgap.
 1.12 31-Jan-1997  thorpej branches: 1.12.2;
Syscalls.master changed, regen. (NFSCLIENT -> NFS)
 1.11 03-Sep-1996  mycroft branches: 1.11.2;
Regen.
 1.10 23-Jun-1996  mycroft Regen.
 1.9 07-Jan-1996  jonathan branches: 1.9.4;
Add '/emul/ultrix' pathname processing to Ultrix emulation, and move
Ultrix syscalls that require that processing out of ultrix_misc.c
to ultrix_pathname.c.
 1.8 26-Dec-1995  jonathan Add emulation of ultrix mount(2). Sufficient to NFS-mount filesystems
using a NetBSD kernel in an ultrix root filesystem.

Move wait emulation to the old (v7) wait syscall number, as that's
what the Ultrix ufs_mount binary uses.
 1.7 26-Dec-1995  jonathan Add emulation of Ultrix select: before calling native sys_select(),
limit the number of FDs to select on to the maximum supported by NetBSD --
which is as many FDs as the emul_ultrix process can have open, anyway.

Add emulation of Ultrix getmnt(2) in ultrix_fs.c

Add partial emulation of Ultrix tty ioctl()s in ultrix_ioctl.c, derived
from compat/sunos/sunos_ioctl.c. Ultrix libc's ``isatty()'' now works
in compat_emul processes.
 1.6 07-Oct-1995  mycroft Reran makesyscalls.sh.
 1.5 19-Sep-1995  thorpej makesyscalls.sh changed
 1.4 01-Jun-1995  mellon Clear up name conflict between Ultrix syscall 103 and 139.
 1.3 22-Apr-1995  christos - added struct emul to all emulations.
- removed all setup functions.
- added copyargs() functions where needed.
 1.2 01-Dec-1994  dean added sigreturn
 1.1 01-Dec-1994  dean New syscall stuff
 1.9.4.1 10-Dec-1996  mycroft Regen.
 1.11.2.1 14-Jan-1997  thorpej syscalls.master changed; regen.
 1.12.2.1 14-Feb-1997  mrg regen.
 1.30.4.1 02-Aug-1999  thorpej Regen.
 1.30.2.1 31-Jan-2000  he Pull up regenerated files (requested by mhitch):
Emulate Ultrix fcntl(F_SETLK) & Co. so the Ultrix seti@home client
works.
 1.32.2.3 11-Feb-2001  bouyer Sync with HEAD.
 1.32.2.2 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.32.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.37.2.4 29-May-2002  nathanw Regen.
 1.37.2.3 06-Dec-2001  wdk Regen to incorperate LWP support
 1.37.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.37.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.38.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.41.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.41.10.1 29-Apr-2005  kent sync with -current
 1.41.2.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.43.4.3 21-Jan-2008  yamt sync with head
 1.43.4.2 03-Sep-2007  yamt sync with head.
 1.43.4.1 30-Dec-2006  yamt sync with head.
 1.44.16.1 13-Jul-2006  gdamore Merge from HEAD.
 1.44.8.1 11-Aug-2006  yamt sync with head
 1.44.4.1 09-Sep-2006  rpaulo sync with head
 1.46.10.1 12-Mar-2007  rmind Sync with HEAD.
 1.47.28.1 02-Jan-2008  bouyer Sync with HEAD
 1.47.24.1 26-Dec-2007  ad Sync with head.
 1.47.22.1 18-Feb-2008  mjf Sync with HEAD.
 1.47.16.1 09-Jan-2008  matt sync with HEAD
 1.49.8.1 18-May-2008  yamt sync with head.
 1.49.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.49.6.2 29-Jun-2008  mjf Sync with HEAD.
 1.49.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.50.6.1 27-Jun-2008  simonb Sync with head.
 1.50.4.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.50.2.2 11-Mar-2010  yamt sync with head
 1.50.2.1 04-May-2009  yamt sync with head.
 1.51.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.51.2.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.56.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.57.24.1 18-May-2014  rmind sync with head
 1.57.20.2 03-Dec-2017  jdolecek update from HEAD
 1.57.20.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.57.10.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.58.6.2 28-Aug-2017  skrll Sync with HEAD
 1.58.6.1 06-Apr-2015  skrll Sync with HEAD
 1.60.2.1 20-Mar-2017  pgoyette Sync with HEAD
 1.61.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.62.4.1 11-May-2017  pgoyette Sync with HEAD
 1.67.4.1 10-Jun-2019  christos Sync with HEAD
 1.67.2.2 29-Sep-2018  pgoyette Regen
 1.67.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.74 03-Mar-2019  pgoyette Regen
 1.73 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.72 10-Aug-2018  pgoyette Regen
 1.71 06-Jan-2018  kamil branches: 1.71.2; 1.71.4;
Revert vadvise(2) removal

This system call was used in legacy Lisp code, that was inherited to modern
age and still compiled against supported compat layers (e.g. in clisp,
oaklisp, Franz Lisp).

It used to instruct the kernel about paging policy (G/C aware, flush etc).

Newly compiled code (assuming that it will detect vadvise()) will use the
libc stub for vadvise(). The headers for this interface are gone.

vadvise(2) could be marked as COMPAT_80, but as long as we support ultrix,
sunos or aout68k ABI, don't bother with this.

Requested by <mrg>
 1.70 19-Dec-2017  kamil compat/ultrix: Drop SYS_vadvise

The (o)vadvise syscall is dummy since the beginning of NetBSD.

Sponsored by <The NetBSD Foundation>
 1.69 19-Dec-2017  kamil compat/ultrix: Drop SYS_sbrk

sbrk - change data segment size

This syscall is dummy since the inception of the project.

Sponsored by <The NetBSD Foundation>
 1.68 19-Dec-2017  kamil compat ultrix: Drop the sstk(2) syscall

sstk(2) has never been implemented by the NetBSD kernel.

Sponsored by <The NetBSD Foundation>
 1.67 10-May-2017  riastradh regen
 1.66 16-Jan-2017  christos branches: 1.66.4;
regen
 1.65 13-Jan-2017  christos branches: 1.65.2;
regen
 1.64 24-Sep-2015  christos branches: 1.64.2;
regen
 1.63 07-Mar-2015  christos regen
 1.62 07-Nov-2013  njoly branches: 1.62.6;
Regen for dup/dup2/dup3 argument types fix.
 1.61 02-Mar-2010  pooka branches: 1.61.10; 1.61.20; 1.61.24;
regen:
- remove nfssvc / fs_nfs.h / #ifdef NFS
- make getfh unconditional
 1.60 14-Dec-2009  matt branches: 1.60.2;
Regen (new makesyscalls.sh)
 1.59 17-Jan-2009  he Regenerate files after updating syscalls.master for compat_ultrix:

Adapt to the state after the recent time_t change.
Type changes:
timeval -> timeval50
itimerval -> itimerval50
rusage -> rusage50
and use of the compat_50 calls where appropriate.
Untested, but at least it builds.

Discussed with christos@
 1.58 13-Jan-2009  pooka Regen to prove I didn't screw up the conversion: purely RCSID changes.
 1.57 13-Jan-2009  pooka regen
 1.56 19-Nov-2008  ad Regen.
 1.55 19-Jun-2008  hans branches: 1.55.2; 1.55.4;
regen from syscalls.master r1.46
 1.54 23-Apr-2008  ad branches: 1.54.2; 1.54.4; 1.54.6;
Regen.
 1.53 20-Dec-2007  dsl branches: 1.53.6; 1.53.8;
regen
 1.52 04-Mar-2007  christos branches: 1.52.16; 1.52.24; 1.52.28;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.51 09-Feb-2007  ad branches: 1.51.2;
Merge newlock2 to head.
 1.50 13-Jul-2006  pavel branches: 1.50.4;
regen (sys_getfh -> compat_30_sys_getfh)
 1.49 26-Jun-2006  mrg regenerate.
 1.48 11-Dec-2005  christos branches: 1.48.4; 1.48.8; 1.48.16;
merge ktrace-lwp.
 1.47 26-Feb-2005  perry branches: 1.47.4;
regen
 1.46 26-Feb-2005  perry regen
 1.45 18-Jan-2003  thorpej branches: 1.45.2; 1.45.10; 1.45.12;
Regen for correct RCS ID.
 1.44 18-Jan-2003  thorpej Regen: Merge the nathanw_sa branch.
 1.43 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.42 30-May-2001  mrg branches: 1.42.2;
use _KERNEL_OPT.
 1.41 27-Jan-2001  thorpej branches: 1.41.2;
egen; getpid(2) is MP-safe.
 1.40 27-Jan-2001  thorpej Regen; add sy_flags.
 1.39 09-Dec-2000  mycroft Regen.
 1.38 13-Nov-2000  jdolecek change the type of *syscallnames[] array to 'const char * const foo[]'
 1.37 18-Aug-2000  cgd update for changed makesyscalls.master
 1.36 30-Jul-1999  drochner branches: 1.36.2;
regen
 1.35 12-Jul-1999  kleink Regen.
 1.34 09-Feb-1999  christos branches: 1.34.2; 1.34.4;
Regen
 1.33 18-Dec-1998  drochner regen
 1.32 10-Dec-1998  christos Regen
 1.31 03-Oct-1998  drochner regen
 1.30 26-Sep-1998  drochner regen
 1.29 25-Jun-1998  thorpej Regen: defopt NFSSERVER
 1.28 19-Feb-1998  thorpej Regen: makesyscalls.sh changed.
 1.27 19-Feb-1998  thorpej Regen; syscalls.master and makesyscalls.sh changed.
 1.26 14-Feb-1998  kleink Regen: use POSIX semantics for chown()/fchown().
 1.25 22-Jan-1998  mycroft Regen.
 1.24 09-Jan-1998  thorpej Regen.
 1.23 08-Jan-1998  thorpej Regen: back out RCD ID related changes.
 1.22 05-Jan-1998  perry regened with RCSIDs in place
 1.21 16-Oct-1997  christos Regen.
 1.20 13-Jun-1997  thorpej Regen: Use compat_12_sys_swapon().
 1.19 09-Jun-1997  jonathan Emulate RISC Ultrix cacheflush() and cachectl() syscalls on mips.
 1.18 06-Apr-1997  jonathan Add changes to make vic-2.8 Ultrix binaries work on NetBSD with COMPAT_ULTRIX:
* Add IPmulticast setsockopt emulation.
* Add Ultrix shmsys emulation (untested).
* tidy up use of stackgap.
 1.17 31-Jan-1997  thorpej Syscalls.master changed, regen. (NFSCLIENT -> NFS)
 1.16 03-Sep-1996  mycroft branches: 1.16.2;
Regen.
 1.15 23-Jun-1996  mycroft Regen.
 1.14 07-Jan-1996  jonathan branches: 1.14.4;
Add '/emul/ultrix' pathname processing to Ultrix emulation, and move
Ultrix syscalls that require that processing out of ultrix_misc.c
to ultrix_pathname.c.
 1.13 26-Dec-1995  jonathan Add emulation of ultrix mount(2). Sufficient to NFS-mount filesystems
using a NetBSD kernel in an ultrix root filesystem.

Move wait emulation to the old (v7) wait syscall number, as that's
what the Ultrix ufs_mount binary uses.
 1.12 26-Dec-1995  jonathan Add emulation of Ultrix select: before calling native sys_select(),
limit the number of FDs to select on to the maximum supported by NetBSD --
which is as many FDs as the emul_ultrix process can have open, anyway.

Add emulation of Ultrix getmnt(2) in ultrix_fs.c

Add partial emulation of Ultrix tty ioctl()s in ultrix_ioctl.c, derived
from compat/sunos/sunos_ioctl.c. Ultrix libc's ``isatty()'' now works
in compat_emul processes.
 1.11 07-Oct-1995  mycroft Reran makesyscalls.sh.
 1.10 19-Sep-1995  thorpej makesyscalls.sh changed
 1.9 01-Jun-1995  mellon Clear up name conflict between Ultrix syscall 103 and 139.
 1.8 22-Apr-1995  christos - added struct emul to all emulations.
- removed all setup functions.
- added copyargs() functions where needed.
 1.7 01-Dec-1994  dean added sigreturn
 1.6 23-Nov-1994  dean changes for new sysent structure (from J. Stone)
 1.5 01-Aug-1994  glass add ultrix_{get,set}sysinfo() from Arne H Juul <arnej@dsl.unit.no>
 1.4 30-Jun-1994  cgd branches: 1.4.2;
fix a botch, and gen syscall files
 1.3 22-Jun-1994  glass update to reflect compat_ultrix syscalls.master
 1.2 15-Jun-1994  glass much works but untested w/new fs. expect more tomorrow
 1.1 02-Jun-1994  glass first swipe at ultrix compat. expect many bug fixes. very related to compat/sunos
 1.4.2.1 01-Aug-1994  cgd From trunk.
 1.14.4.1 10-Dec-1996  mycroft Regen.
 1.16.2.1 14-Jan-1997  thorpej syscalls.master changed; regen.
 1.34.4.1 02-Aug-1999  thorpej Regen.
 1.34.2.1 31-Jan-2000  he Pull up regenerated files (requested by mhitch):
Emulate Ultrix fcntl(F_SETLK) & Co. so the Ultrix seti@home client
works.
 1.36.2.4 11-Feb-2001  bouyer Sync with HEAD.
 1.36.2.3 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.36.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.36.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.41.2.4 29-May-2002  nathanw Regen.
 1.41.2.3 06-Dec-2001  wdk Regen to incorperate LWP support
 1.41.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.41.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.42.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.45.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.45.10.1 29-Apr-2005  kent sync with -current
 1.45.2.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.47.4.4 21-Jan-2008  yamt sync with head
 1.47.4.3 03-Sep-2007  yamt sync with head.
 1.47.4.2 26-Feb-2007  yamt sync with head.
 1.47.4.1 30-Dec-2006  yamt sync with head.
 1.48.16.1 13-Jul-2006  gdamore Merge from HEAD.
 1.48.8.1 11-Aug-2006  yamt sync with head
 1.48.4.1 09-Sep-2006  rpaulo sync with head
 1.50.4.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.51.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.52.28.1 02-Jan-2008  bouyer Sync with HEAD
 1.52.24.1 26-Dec-2007  ad Sync with head.
 1.52.16.1 09-Jan-2008  matt sync with HEAD
 1.53.8.1 18-May-2008  yamt sync with head.
 1.53.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.53.6.2 29-Jun-2008  mjf Sync with HEAD.
 1.53.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.54.6.1 27-Jun-2008  simonb Sync with head.
 1.54.4.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.54.2.2 11-Mar-2010  yamt sync with head
 1.54.2.1 04-May-2009  yamt sync with head.
 1.55.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.55.2.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.60.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.61.24.1 18-May-2014  rmind sync with head
 1.61.20.2 03-Dec-2017  jdolecek update from HEAD
 1.61.20.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.61.10.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.62.6.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.62.6.1 06-Apr-2015  skrll Sync with HEAD
 1.64.2.1 20-Mar-2017  pgoyette Sync with HEAD
 1.65.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.66.4.1 11-May-2017  pgoyette Sync with HEAD
 1.71.4.1 10-Jun-2019  christos Sync with HEAD
 1.71.2.2 29-Sep-2018  pgoyette Regen
 1.71.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.77 03-Mar-2019  pgoyette Regen
 1.76 27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.75 10-Aug-2018  pgoyette Regen
 1.74 06-Jan-2018  kamil branches: 1.74.2; 1.74.4;
Revert vadvise(2) removal

This system call was used in legacy Lisp code, that was inherited to modern
age and still compiled against supported compat layers (e.g. in clisp,
oaklisp, Franz Lisp).

It used to instruct the kernel about paging policy (G/C aware, flush etc).

Newly compiled code (assuming that it will detect vadvise()) will use the
libc stub for vadvise(). The headers for this interface are gone.

vadvise(2) could be marked as COMPAT_80, but as long as we support ultrix,
sunos or aout68k ABI, don't bother with this.

Requested by <mrg>
 1.73 19-Dec-2017  kamil compat/ultrix: Drop SYS_vadvise

The (o)vadvise syscall is dummy since the beginning of NetBSD.

Sponsored by <The NetBSD Foundation>
 1.72 19-Dec-2017  kamil compat/ultrix: Drop SYS_sbrk

sbrk - change data segment size

This syscall is dummy since the inception of the project.

Sponsored by <The NetBSD Foundation>
 1.71 19-Dec-2017  kamil compat ultrix: Drop the sstk(2) syscall

sstk(2) has never been implemented by the NetBSD kernel.

Sponsored by <The NetBSD Foundation>
 1.70 10-May-2017  riastradh regen
 1.69 16-Jan-2017  christos branches: 1.69.4;
regen
 1.68 13-Jan-2017  christos branches: 1.68.2;
regen
 1.67 24-Sep-2015  christos branches: 1.67.2;
regen
 1.66 07-Mar-2015  christos regen
 1.65 07-Nov-2013  njoly branches: 1.65.6;
Regen for dup/dup2/dup3 argument types fix.
 1.64 02-Mar-2010  pooka branches: 1.64.10; 1.64.20; 1.64.24;
regen:
- remove nfssvc / fs_nfs.h / #ifdef NFS
- make getfh unconditional
 1.63 14-Dec-2009  matt branches: 1.63.2;
Regen (new makesyscalls.sh)
 1.62 17-Jan-2009  he Regenerate files after updating syscalls.master for compat_ultrix:

Adapt to the state after the recent time_t change.
Type changes:
timeval -> timeval50
itimerval -> itimerval50
rusage -> rusage50
and use of the compat_50 calls where appropriate.
Untested, but at least it builds.

Discussed with christos@
 1.61 13-Jan-2009  pooka Regen to prove I didn't screw up the conversion: purely RCSID changes.
 1.60 13-Jan-2009  pooka regen
 1.59 19-Nov-2008  ad Regen.
 1.58 19-Jun-2008  hans branches: 1.58.2; 1.58.4;
regen from syscalls.master r1.46
 1.57 23-Apr-2008  ad branches: 1.57.2; 1.57.4; 1.57.6;
Regen.
 1.56 20-Dec-2007  dsl branches: 1.56.6; 1.56.8;
regen
 1.55 04-Mar-2007  christos branches: 1.55.16; 1.55.24; 1.55.28;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.54 09-Feb-2007  ad branches: 1.54.2;
Merge newlock2 to head.
 1.53 13-Jul-2006  pavel branches: 1.53.4;
regen (sys_getfh -> compat_30_sys_getfh)
 1.52 26-Jun-2006  mrg regenerate.
 1.51 11-Dec-2005  christos branches: 1.51.4; 1.51.8; 1.51.16;
merge ktrace-lwp.
 1.50 26-Feb-2005  perry branches: 1.50.4;
regen
 1.49 26-Feb-2005  perry regen
 1.48 21-Apr-2004  simonb branches: 1.48.4; 1.48.6;
ANSIfy, some KNF.
 1.47 18-Jan-2003  thorpej branches: 1.47.2;
Regen for correct RCS ID.
 1.46 18-Jan-2003  thorpej Regen: Merge the nathanw_sa branch.
 1.45 01-Nov-2002  jdolecek set nsysent to 512 (oh well, just three syscalls too many for 256)
 1.44 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.43 30-May-2001  mrg branches: 1.43.2;
use _KERNEL_OPT.
 1.42 27-Jan-2001  thorpej branches: 1.42.2;
egen; getpid(2) is MP-safe.
 1.41 27-Jan-2001  thorpej Regen; add sy_flags.
 1.40 09-Dec-2000  mycroft Regen.
 1.39 30-Nov-2000  jdolecek LKMify
 1.38 18-Aug-2000  cgd update for changed makesyscalls.master
 1.37 30-Jul-1999  drochner branches: 1.37.2;
regen
 1.36 12-Jul-1999  kleink Regen.
 1.35 09-Feb-1999  christos branches: 1.35.2; 1.35.4;
Regen
 1.34 18-Dec-1998  drochner regen
 1.33 10-Dec-1998  christos Regen
 1.32 03-Oct-1998  drochner regen
 1.31 26-Sep-1998  drochner regen
 1.30 25-Jun-1998  thorpej Regen: defopt NFSSERVER
 1.29 19-Feb-1998  thorpej Regen: makesyscalls.sh changed.
 1.28 19-Feb-1998  thorpej Regen; syscalls.master and makesyscalls.sh changed.
 1.27 14-Feb-1998  kleink Regen: use POSIX semantics for chown()/fchown().
 1.26 22-Jan-1998  mycroft Regen.
 1.25 09-Jan-1998  thorpej Regen.
 1.24 08-Jan-1998  thorpej Regen: back out RCD ID related changes.
 1.23 05-Jan-1998  perry regened with RCSIDs in place
 1.22 16-Oct-1997  christos Regen.
 1.21 13-Jun-1997  thorpej Regen: Use compat_12_sys_swapon().
 1.20 09-Jun-1997  jonathan Emulate RISC Ultrix cacheflush() and cachectl() syscalls on mips.
 1.19 06-Apr-1997  jonathan Add changes to make vic-2.8 Ultrix binaries work on NetBSD with COMPAT_ULTRIX:
* Add IPmulticast setsockopt emulation.
* Add Ultrix shmsys emulation (untested).
* tidy up use of stackgap.
 1.18 31-Jan-1997  thorpej branches: 1.18.2;
Syscalls.master changed, regen. (NFSCLIENT -> NFS)
 1.17 03-Sep-1996  mycroft branches: 1.17.2;
Regen.
 1.16 23-Jun-1996  mycroft Regen.
 1.15 07-Jan-1996  jonathan branches: 1.15.4;
Add '/emul/ultrix' pathname processing to Ultrix emulation, and move
Ultrix syscalls that require that processing out of ultrix_misc.c
to ultrix_pathname.c.
 1.14 26-Dec-1995  jonathan Add emulation of ultrix mount(2). Sufficient to NFS-mount filesystems
using a NetBSD kernel in an ultrix root filesystem.

Move wait emulation to the old (v7) wait syscall number, as that's
what the Ultrix ufs_mount binary uses.
 1.13 26-Dec-1995  jonathan Add emulation of Ultrix select: before calling native sys_select(),
limit the number of FDs to select on to the maximum supported by NetBSD --
which is as many FDs as the emul_ultrix process can have open, anyway.

Add emulation of Ultrix getmnt(2) in ultrix_fs.c

Add partial emulation of Ultrix tty ioctl()s in ultrix_ioctl.c, derived
from compat/sunos/sunos_ioctl.c. Ultrix libc's ``isatty()'' now works
in compat_emul processes.
 1.12 07-Oct-1995  mycroft Reran makesyscalls.sh.
 1.11 19-Sep-1995  thorpej makesyscalls.sh changed
 1.10 01-Jun-1995  mellon Clear up name conflict between Ultrix syscall 103 and 139.
 1.9 22-Apr-1995  christos - added struct emul to all emulations.
- removed all setup functions.
- added copyargs() functions where needed.
 1.8 02-Dec-1994  dean fixed typo
 1.7 01-Dec-1994  dean added sigreturn
 1.6 23-Nov-1994  dean changes for new sysent structure (from J. Stone)
 1.5 01-Aug-1994  glass add ultrix_{get,set}sysinfo() from Arne H Juul <arnej@dsl.unit.no>
 1.4 30-Jun-1994  cgd branches: 1.4.2;
fix a botch, and gen syscall files
 1.3 22-Jun-1994  glass update to reflect compat_ultrix syscalls.master
 1.2 15-Jun-1994  glass much works but untested w/new fs. expect more tomorrow
 1.1 02-Jun-1994  glass first swipe at ultrix compat. expect many bug fixes. very related to compat/sunos
 1.4.2.1 01-Aug-1994  cgd From trunk.
 1.15.4.1 10-Dec-1996  mycroft Regen.
 1.17.2.1 14-Jan-1997  thorpej syscalls.master changed; regen.
 1.18.2.1 14-Feb-1997  mrg regen.
 1.35.4.1 02-Aug-1999  thorpej Regen.
 1.35.2.1 31-Jan-2000  he Pull up regenerated files (requested by mhitch):
Emulate Ultrix fcntl(F_SETLK) & Co. so the Ultrix seti@home client
works.
 1.37.2.4 11-Feb-2001  bouyer Sync with HEAD.
 1.37.2.3 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.37.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.37.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.42.2.5 11-Nov-2002  nathanw Catch up to -current
 1.42.2.4 29-May-2002  nathanw Regen.
 1.42.2.3 06-Dec-2001  wdk Regen to incorperate LWP support
 1.42.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.42.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.43.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.47.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.47.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.47.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.47.2.1 03-Aug-2004  skrll Sync with HEAD
 1.48.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.48.4.1 29-Apr-2005  kent sync with -current
 1.50.4.4 21-Jan-2008  yamt sync with head
 1.50.4.3 03-Sep-2007  yamt sync with head.
 1.50.4.2 26-Feb-2007  yamt sync with head.
 1.50.4.1 30-Dec-2006  yamt sync with head.
 1.51.16.1 13-Jul-2006  gdamore Merge from HEAD.
 1.51.8.1 11-Aug-2006  yamt sync with head
 1.51.4.1 09-Sep-2006  rpaulo sync with head
 1.53.4.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.54.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.55.28.1 02-Jan-2008  bouyer Sync with HEAD
 1.55.24.1 26-Dec-2007  ad Sync with head.
 1.55.16.1 09-Jan-2008  matt sync with HEAD
 1.56.8.1 18-May-2008  yamt sync with head.
 1.56.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.56.6.2 29-Jun-2008  mjf Sync with HEAD.
 1.56.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.57.6.1 27-Jun-2008  simonb Sync with head.
 1.57.4.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.57.2.2 11-Mar-2010  yamt sync with head
 1.57.2.1 04-May-2009  yamt sync with head.
 1.58.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.58.2.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.63.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.64.24.1 18-May-2014  rmind sync with head
 1.64.20.2 03-Dec-2017  jdolecek update from HEAD
 1.64.20.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.64.10.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.65.6.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.65.6.1 06-Apr-2015  skrll Sync with HEAD
 1.67.2.1 20-Mar-2017  pgoyette Sync with HEAD
 1.68.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.69.4.1 11-May-2017  pgoyette Sync with HEAD
 1.74.4.1 10-Jun-2019  christos Sync with HEAD
 1.74.2.2 29-Sep-2018  pgoyette Regen
 1.74.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.4 06-Sep-2015  dholland More on PR 41200: headers that declare ioctls should include sys/ioccom.h.
This covers (I think) all the MI headers outside of external/ (and dist/).
 1.3 14-Dec-2009  matt branches: 1.3.22; 1.3.40;
Merge from matt-nb5-mips64
 1.2 04-Jan-1996  jonathan branches: 1.2.166; 1.2.186;
Rewrite (a copy of) the emul-sunos termio/termios emulation code to
emulate Ultrix termio/termios instead. Ultrix termio c_cc has separate
VMIM/VTIME attributes, and the Ultrix termios c_cc is a strict
superset of Ultrix termio c_cc. The termios-only c_cc indices are
all changed, relative to SunOS.
 1.1 27-Dec-1995  jonathan Ultrix-compatible termios struct and ioctl() definitions.
 1.2.186.1 09-Sep-2009  matt Change to use fixed sized types.
 1.2.166.1 11-Mar-2010  yamt sync with head
 1.3.40.1 22-Sep-2015  skrll Sync with HEAD
 1.3.22.1 03-Dec-2017  jdolecek update from HEAD
 1.6 01-Dec-2000  jdolecek add e_path (emulation path) to struct emul, which replaces emulation-specific
*_emul_path variables

change macros CHECK_ALT_{CREAT|EXIST} to use that, 'root' doesn't need
to be passed explicitly any more and *_CHECK_ALT_{CREAT|EXIST} are removed
change explicit emul_find() calls in probe functions to get the emulation
path from the checked exec switch entry's emulation

remove no longer needed header files

add e_flags and e_syscall to struct emul; these are unsed and empty for now
 1.5 09-Feb-1999  christos branches: 1.5.8;
const poisoning and CHECK_ALT_CREAT fixes.
 1.4 05-Sep-1998  christos Assign copyright to TNF.
 1.3 10-Oct-1997  mrg remove advertising clause from all my licenses.
 1.2 05-Oct-1996  mrg branches: 1.2.10;
minor copyright update.
 1.1 07-Jan-1996  jonathan Add '/emul/ultrix' pathname processing to Ultrix emulation, and move
Ultrix syscalls that require that processing out of ultrix_misc.c
to ultrix_pathname.c.
 1.2.10.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.5.8.1 08-Dec-2000  bouyer Sync with HEAD.
 1.3 17-Nov-2014  uebayasi Define compat modules (but without dependencies yet).
 1.2 29-Aug-2001  chuck branches: 1.2.168;
make 4.3 binaries run once again on the vax. tested with
omagic/nmagic/zmagic binaries from guest account on
Lord Isildur's tahoe system (thanks). enabled if both
COMPAT_43 and COMPAT_VAX1K are defined.

basically rewrote exec_vax1k_prep_anymagic() to handle more
file formats. we remove vax1k_subr.c because we now use the
standard vmcmd_readvn function.

XXX: suspect the code for MID_VAX1K NMAGIC binaries is wrong,
need a binary to confirm this... the old code did not pad the
end of the text segment to a page boundary, and that seems wrong.
you definitely need to pad it on a 4.3BSD NMAGIC binary and i
don't see why MID_VAX1K should be different?
 1.1 21-Aug-1998  ragge branches: 1.1.22; 1.1.24; 1.1.26;
VAX 1k page size compatibility executable handling.
 1.1.26.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.1.24.1 21-Sep-2001  nathanw Catch up to -current.
 1.1.22.1 30-Sep-2001  he Pull up revision 1.2 (requested by chuck):
Once again make BSD 4.3 binaries run on the vax.
 1.2.168.1 03-Dec-2017  jdolecek update from HEAD
 1.20 08-Sep-2024  rillig fix a/an grammar in obvious cases
 1.19 20-Nov-2019  pgoyette branches: 1.19.32;
Move all non-emulation-specific coredump code into the coredump module,
and remove all #ifdef COREDUMP conditional compilation. Now, the
coredump module is completely separated from the emulation modules, and
they can all be independently loaded and unloaded.

Welcome to 9.99.18 !
 1.18 07-Mar-2014  christos branches: 1.18.30;
c99 initializers for struct execsw
 1.17 19-Sep-2013  christos exec modules need to be of the exec kind
 1.16 19-Nov-2008  ad branches: 1.16.16; 1.16.26; 1.16.30;
Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.15 13-Feb-2008  matt branches: 1.15.6; 1.15.10; 1.15.16; 1.15.18;
Update to c99.
 1.14 08-Dec-2007  dsl ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.13 04-Dec-2007  dsl Remove all the __P
 1.12 11-Dec-2005  christos branches: 1.12.44; 1.12.46; 1.12.52; 1.12.56;
merge ktrace-lwp.
 1.11 26-Feb-2005  perry branches: 1.11.4;
nuke trailing whitespace
 1.10 13-Feb-2004  wiz branches: 1.10.8; 1.10.10;
Uppercase CPU, plural is CPUs.
 1.9 08-Aug-2003  christos - GC all the setup_stack functions
- add one for linux/i386
 1.8 29-Jun-2003  fvdl branches: 1.8.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.7 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.6 13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.5 08-Sep-2001  chuck only include opt_compat_43.h if _KERNEL_OPT defined so lkm compiles
 1.4 31-Aug-2001  chuck branches: 1.4.2;
confirmed the code for MID_VAX1K NMAGIC binaries was wrong,
you've got to pad the text just like with 4.3BSD binaries.
fix it.

i have now successfully tested compat-vax1k with real
o/m/z magic binaries from both 4.3BSD and netbsd 1.3.
 1.3 29-Aug-2001  chuck make 4.3 binaries run once again on the vax. tested with
omagic/nmagic/zmagic binaries from guest account on
Lord Isildur's tahoe system (thanks). enabled if both
COMPAT_43 and COMPAT_VAX1K are defined.

basically rewrote exec_vax1k_prep_anymagic() to handle more
file formats. we remove vax1k_subr.c because we now use the
standard vmcmd_readvn function.

XXX: suspect the code for MID_VAX1K NMAGIC binaries is wrong,
need a binary to confirm this... the old code did not pad the
end of the text segment to a page boundary, and that seems wrong.
you definitely need to pad it on a 4.3BSD NMAGIC binary and i
don't see why MID_VAX1K should be different?
 1.2 28-Jun-2000  mrg branches: 1.2.2; 1.2.4;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.1 21-Aug-1998  ragge branches: 1.1.12; 1.1.22;
VAX 1k page size compatibility executable handling.
 1.1.22.1 30-Sep-2001  he Pull up revisions 1.3-1.4 (requested by chuck):
Once again make BSD 4.3 binaries run on the vax.
 1.1.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.2.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.4.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.2.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.2.2.1 21-Sep-2001  nathanw Catch up to -current.
 1.4.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.8.2.7 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.8.2.6 04-Feb-2005  skrll Adapt to branch.
 1.8.2.5 21-Sep-2004  skrll Fix the sync with head I botched.
 1.8.2.4 18-Sep-2004  skrll Sync with HEAD.
 1.8.2.3 12-Aug-2004  skrll Adapt to new world order.

Vax GENERIC compiles.
 1.8.2.2 03-Aug-2004  skrll Sync with HEAD
 1.8.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.10.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.10.8.1 29-Apr-2005  kent sync with -current
 1.11.4.4 27-Feb-2008  yamt sync with head.
 1.11.4.3 21-Jan-2008  yamt sync with head
 1.11.4.2 07-Dec-2007  yamt sync with head
 1.11.4.1 21-Jun-2006  yamt sync with head.
 1.12.56.2 26-Dec-2007  ad Sync with head.
 1.12.56.1 08-Dec-2007  ad Sync with head.
 1.12.52.3 18-Feb-2008  mjf Sync with HEAD.
 1.12.52.2 27-Dec-2007  mjf Sync with HEAD.
 1.12.52.1 08-Dec-2007  mjf Sync with HEAD.
 1.12.46.2 23-Mar-2008  matt sync with HEAD
 1.12.46.1 09-Jan-2008  matt sync with HEAD
 1.12.44.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.15.18.1 19-Jan-2009  skrll Sync with HEAD.
 1.15.16.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.15.10.1 04-May-2009  yamt sync with head.
 1.15.6.1 17-Jan-2009  mjf Sync with HEAD.
 1.16.30.1 18-May-2014  rmind sync with head
 1.16.26.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.16.16.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.18.30.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.19.32.1 02-Aug-2025  perseant Sync with HEAD
 1.8 15-Aug-2009  matt Include <sys/exec_aout.h> explicitly instead of relying on <sys/exec.h> to
do it for you.
 1.7 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.6 13-Feb-2008  matt branches: 1.6.6; 1.6.8; 1.6.10;
Update to c99.
 1.5 04-Dec-2007  dsl Remove all the __P
 1.4 11-Dec-2005  christos branches: 1.4.44; 1.4.46; 1.4.52; 1.4.56;
merge ktrace-lwp.
 1.3 29-Jun-2003  fvdl branches: 1.3.2; 1.3.18;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.2 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.1 21-Aug-1998  ragge VAX 1k page size compatibility executable handling.
 1.3.18.3 27-Feb-2008  yamt sync with head.
 1.3.18.2 07-Dec-2007  yamt sync with head
 1.3.18.1 21-Jun-2006  yamt sync with head.
 1.3.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.4.56.1 08-Dec-2007  ad Sync with head.
 1.4.52.2 18-Feb-2008  mjf Sync with HEAD.
 1.4.52.1 08-Dec-2007  mjf Sync with HEAD.
 1.4.46.2 23-Mar-2008  matt sync with HEAD
 1.4.46.1 09-Jan-2008  matt sync with HEAD
 1.4.44.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.6.10.2 19-Aug-2009  yamt sync with head.
 1.6.10.1 16-May-2008  yamt sync with head.
 1.6.8.1 18-May-2008  yamt sync with head.
 1.6.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.7 29-Aug-2001  chuck make 4.3 binaries run once again on the vax. tested with
omagic/nmagic/zmagic binaries from guest account on
Lord Isildur's tahoe system (thanks). enabled if both
COMPAT_43 and COMPAT_VAX1K are defined.

basically rewrote exec_vax1k_prep_anymagic() to handle more
file formats. we remove vax1k_subr.c because we now use the
standard vmcmd_readvn function.

XXX: suspect the code for MID_VAX1K NMAGIC binaries is wrong,
need a binary to confirm this... the old code did not pad the
end of the text segment to a page boundary, and that seems wrong.
you definitely need to pad it on a 4.3BSD NMAGIC binary and i
don't see why MID_VAX1K should be different?
 1.6 15-Mar-2001  chs branches: 1.6.2;
eliminate the KERN_* error codes in favor of the traditional E* codes.
the mapping is:

KERN_SUCCESS 0
KERN_INVALID_ADDRESS EFAULT
KERN_PROTECTION_FAILURE EACCES
KERN_NO_SPACE ENOMEM
KERN_INVALID_ARGUMENT EINVAL
KERN_FAILURE various, mostly turn into KASSERTs
KERN_RESOURCE_SHORTAGE ENOMEM
KERN_NOT_RECEIVER <unused>
KERN_NO_ACCESS <unused>
KERN_PAGES_LOCKED <unused>
 1.5 13-Sep-2000  thorpej branches: 1.5.2;
Add an align argument to uvm_map() and some callers of that
routine. Works similarly fto pmap_prefer(), but allows callers
to specify a minimum power-of-two alignment of the region.
How we ever got along without this for so long is beyond me.
 1.4 28-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.3 04-Mar-2000  matt branches: 1.3.4;
expunge vm_offset_t/vm_size_t
 1.2 24-Mar-1999  mrg branches: 1.2.8;
completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.
 1.1 21-Aug-1998  ragge VAX 1k page size compatibility executable handling.
 1.2.8.2 27-Mar-2001  bouyer Sync with HEAD.
 1.2.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.3.4.1 30-Sep-2001  he Pull up fila removal (requested by chuck):
Once again make BSD 4.3 binaries run on the vax.
 1.5.2.2 28-Feb-2002  nathanw Catch up to -current.
 1.5.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.6.2.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.

RSS XML Feed