Home | History | Annotate | Download | only in netbsd32
History log of /src/sys/compat/netbsd32/netbsd32_netbsd.c
RevisionDateAuthorComments
 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.

RSS XML Feed