History log of /netbsd-current/sys/compat/netbsd32/netbsd32_netbsd.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 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


Revision tags: thorpej-ifq-base thorpej-altq-separation-base
# 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.


Revision tags: netbsd-10-0-RELEASE netbsd-10-0-RC6 netbsd-10-0-RC5 netbsd-10-0-RC4 netbsd-10-0-RC3 netbsd-10-0-RC2 netbsd-10-0-RC1 netbsd-10-base bouyer-sunxi-drm-base
# 1.233 20-Sep-2021 thorpej

Add the eventfd(2) system call to COMPAT_NETBSD32.


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base
# 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.


Revision tags: netbsd-9-2-RELEASE netbsd-9-1-RELEASE bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base
# 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.


Revision tags: phil-wifi-20190609 isaki-audio2-base
# 1.223 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 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.


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 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().


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521
# 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>


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315
# 1.215 15-Mar-2018 christos

Untangle the swapctl compat code mess. Welcome to lucky 13.


Revision tags: pgoyette-compat-base
# 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


Revision tags: tls-maxphys-base-20171202 nick-nhusb-base-20170825
# 1.207 31-Jul-2017 maxv

Remove references to COMPAT_OLDSOCK (itself removed years ago).


Revision tags: netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1
# 1.206 29-Apr-2017 christos

branches: 1.206.2;
move MAP_COPY in compat


Revision tags: prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104
# 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.


Revision tags: nick-nhusb-base-20161004
# 1.204 17-Sep-2016 christos

deal with not having KTRACE


Revision tags: localcount-20160914
# 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


Revision tags: pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529
# 1.200 13-May-2016 christos

branches: 1.200.2;
clamp getrlimit the same way we clamp setrlimit


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.199 28-Feb-2016 khorben

Add missing newline character in error message

This is related to kern/50469.


Revision tags: nick-nhusb-base-20151226
# 1.198 01-Dec-2015 pgoyette

Adapt to per-emulation syscall_autoload capability (the table of syscalls
that can be autoloaded is currently empty).


Revision tags: nick-nhusb-base-20150921
# 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.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 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.


Revision tags: rmind-smpnet-nbase rmind-smpnet-base
# 1.187 15-May-2014 manu

Fix cases where count <= 0 (thanks to Maxime Villard for raising this)


Revision tags: yamt-pagecache-base9
# 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.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 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.


Revision tags: riastradh-drm2-base3
# 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(".");


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1
# 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.


Revision tags: riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 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@.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base2 netbsd-6-base
# 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.


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base
# 1.175 15-Nov-2011 njoly

branches: 1.175.4;
Fix pipe2 return value.


Revision tags: yamt-pagecache-base3
# 1.174 08-Nov-2011 njoly

Add kqueue1(2) support.


Revision tags: yamt-pagecache-base2 yamt-pagecache-base
# 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).


Revision tags: rmind-uvmplock-nbase rmind-uvmplock-base
# 1.171 05-Jun-2011 dsl

Delete some splurious commas and very unexpected trailing space


Revision tags: cherry-xenmp-base
# 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.


Revision tags: bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231
# 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.


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1
# 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().


Revision tags: yamt-nfs-mp-base9
# 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


Revision tags: uebayasi-xip-base
# 1.163 14-Dec-2009 matt

branches: 1.163.2;
Merge from matt-nb5-mips64


Revision tags: matt-premerge-20091211
# 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.


Revision tags: jym-xensuspend-nbase
# 1.159 25-Oct-2009 rmind

Initialise struct emul members by name (it is readable now and one can search
them in the tree).


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 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@.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5
# 1.157 17-May-2009 pooka

pad -> PAD. Fixes build problem reported by Paul Goyette in private email.


Revision tags: yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 jym-xensuspend-base nick-hppapmap-base
# 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.


Revision tags: nick-hppapmap-base2
# 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".


Revision tags: mjf-devfs2-base
# 1.151 11-Jan-2009 nakayama

Follow christos-time_t merge.


# 1.150 11-Jan-2009 christos

merge christos-time_t


Revision tags: christos-time_t-nbase christos-time_t-base haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 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@.


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.145 15-Oct-2008 wrstuden

branches: 1.145.2; 1.145.4;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.144 29-May-2008 mrg

branches: 1.144.4;
remove clause #3 from my license where there are no other
copyright holders involved.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14
# 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.


Revision tags: keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.142 24-Feb-2008 martin

Remove old posix_fadvise compat code


Revision tags: nick-net80211-sync-base mjf-devfs-base
# 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()


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base
# 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....


Revision tags: vmlocking2-base3 matt-armv6-base
# 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.


Revision tags: yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 jmcneill-pm-base
# 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.


Revision tags: yamt-kmem-base
# 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 ...


Revision tags: vmlocking2-base2 reinoud-bufcleanup-nbase reinoud-bufcleanup-base
# 1.131 04-Dec-2007 dsl

Remove all the __P


Revision tags: vmlocking2-base1 bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base
# 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).


Revision tags: jmcneill-base yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 vmlocking-base
# 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.


Revision tags: yamt-x86pmap-base
# 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'.


Revision tags: nick-csl-alignment-base5
# 1.126 15-Aug-2007 ad

branches: 1.126.2;
Changes to make ktrace LKM friendly and reduce ifdef KTRACE. Proposed
on tech-kern.


Revision tags: matt-mips64-base nick-csl-alignment-base
# 1.125 14-Jul-2007 dsl

branches: 1.125.2; 1.125.6;
Adapt for sys_mount() becoming compat_40_sys_mount(),


Revision tags: mjf-ufs-trans-base
# 1.124 30-Jun-2007 dsl

Changes to sompat socket function to avoid the dreaded stackgap.


Revision tags: yamt-idlelwp-base8
# 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.


Revision tags: thorpej-atomic-base
# 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.


Revision tags: ad-audiomp-base
# 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.


Revision tags: post-newlock2-merge
# 1.116 09-Feb-2007 ad

branches: 1.116.2;
Merge newlock2 to head.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 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.


Revision tags: yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 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.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7
# 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.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.104 14-May-2006 elad

branches: 1.104.4;
integrate kauth.


Revision tags: elad-kernelauth-base
# 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.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3
# 1.101 29-Mar-2006 cube

Implement the _lwp* and sa_* families of syscalls, using the newly
introduced hooks in the native code.


Revision tags: peter-altq-base yamt-pdpolicy-base2 yamt-pdpolicy-base yamt-uio_vmspace-base5
# 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.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 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.


Revision tags: yamt-km-base4 kent-audio2-base
# 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.


Revision tags: yamt-km-base3 netbsd-3-base
# 1.87 26-Feb-2005 perry

branches: 1.87.2;
nuke trailing whitespace


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 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.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 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.


Revision tags: kqueue-aftermerge kqueue-beforemerge kqueue-base
# 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.


Revision tags: gehenna-devsw-base
# 1.64 07-Jul-2002 fvdl

Move netbsd32_sysarch to netbsd32_machdep.c


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base
# 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.


Revision tags: newlock-base ifpoll-base
# 1.62 13-Nov-2001 lukem

add RCSIDs (including regeneration of files as appropriate)


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2
# 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).


Revision tags: post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 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.


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 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.


Revision tags: netbsd-1-5-base
# 1.28 30-May-2000 eeh

branches: 1.28.2;
Include "opt_DDB.h" to enable the DDB sysctls.


Revision tags: minoura-xpg4dl-base
# 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.


Revision tags: chs-ubc2-newbase
# 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.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base
# 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.


Revision tags: chs-ubc2-base
# 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.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 netbsd-1-4-RELEASE netbsd-1-4-base
# 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.


Revision tags: kenh-if-detach-base chs-ubc-base
# 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.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.


Revision tags: netbsd-10-base bouyer-sunxi-drm-base
# 1.233 20-Sep-2021 thorpej

Add the eventfd(2) system call to COMPAT_NETBSD32.


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base
# 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.


Revision tags: netbsd-9-2-RELEASE netbsd-9-1-RELEASE bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base
# 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.


Revision tags: phil-wifi-20190609 isaki-audio2-base
# 1.223 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 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.


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 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().


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521
# 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>


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315
# 1.215 15-Mar-2018 christos

Untangle the swapctl compat code mess. Welcome to lucky 13.


Revision tags: pgoyette-compat-base
# 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


Revision tags: tls-maxphys-base-20171202 nick-nhusb-base-20170825
# 1.207 31-Jul-2017 maxv

Remove references to COMPAT_OLDSOCK (itself removed years ago).


Revision tags: netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1
# 1.206 29-Apr-2017 christos

branches: 1.206.2;
move MAP_COPY in compat


Revision tags: prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104
# 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.


Revision tags: nick-nhusb-base-20161004
# 1.204 17-Sep-2016 christos

deal with not having KTRACE


Revision tags: localcount-20160914
# 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


Revision tags: pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529
# 1.200 13-May-2016 christos

branches: 1.200.2;
clamp getrlimit the same way we clamp setrlimit


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.199 28-Feb-2016 khorben

Add missing newline character in error message

This is related to kern/50469.


Revision tags: nick-nhusb-base-20151226
# 1.198 01-Dec-2015 pgoyette

Adapt to per-emulation syscall_autoload capability (the table of syscalls
that can be autoloaded is currently empty).


Revision tags: nick-nhusb-base-20150921
# 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.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 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.


Revision tags: rmind-smpnet-nbase rmind-smpnet-base
# 1.187 15-May-2014 manu

Fix cases where count <= 0 (thanks to Maxime Villard for raising this)


Revision tags: yamt-pagecache-base9
# 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.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 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.


Revision tags: riastradh-drm2-base3
# 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(".");


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1
# 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.


Revision tags: riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 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@.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base2 netbsd-6-base
# 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.


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base
# 1.175 15-Nov-2011 njoly

branches: 1.175.4;
Fix pipe2 return value.


Revision tags: yamt-pagecache-base3
# 1.174 08-Nov-2011 njoly

Add kqueue1(2) support.


Revision tags: yamt-pagecache-base2 yamt-pagecache-base
# 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).


Revision tags: rmind-uvmplock-nbase rmind-uvmplock-base
# 1.171 05-Jun-2011 dsl

Delete some splurious commas and very unexpected trailing space


Revision tags: cherry-xenmp-base
# 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.


Revision tags: bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231
# 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.


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1
# 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().


Revision tags: yamt-nfs-mp-base9
# 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


Revision tags: uebayasi-xip-base
# 1.163 14-Dec-2009 matt

branches: 1.163.2;
Merge from matt-nb5-mips64


Revision tags: matt-premerge-20091211
# 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.


Revision tags: jym-xensuspend-nbase
# 1.159 25-Oct-2009 rmind

Initialise struct emul members by name (it is readable now and one can search
them in the tree).


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 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@.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5
# 1.157 17-May-2009 pooka

pad -> PAD. Fixes build problem reported by Paul Goyette in private email.


Revision tags: yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 jym-xensuspend-base nick-hppapmap-base
# 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.


Revision tags: nick-hppapmap-base2
# 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".


Revision tags: mjf-devfs2-base
# 1.151 11-Jan-2009 nakayama

Follow christos-time_t merge.


# 1.150 11-Jan-2009 christos

merge christos-time_t


Revision tags: christos-time_t-nbase christos-time_t-base haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 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@.


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.145 15-Oct-2008 wrstuden

branches: 1.145.2; 1.145.4;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.144 29-May-2008 mrg

branches: 1.144.4;
remove clause #3 from my license where there are no other
copyright holders involved.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14
# 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.


Revision tags: keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.142 24-Feb-2008 martin

Remove old posix_fadvise compat code


Revision tags: nick-net80211-sync-base mjf-devfs-base
# 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()


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base
# 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....


Revision tags: vmlocking2-base3 matt-armv6-base
# 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.


Revision tags: yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 jmcneill-pm-base
# 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.


Revision tags: yamt-kmem-base
# 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 ...


Revision tags: vmlocking2-base2 reinoud-bufcleanup-nbase reinoud-bufcleanup-base
# 1.131 04-Dec-2007 dsl

Remove all the __P


Revision tags: vmlocking2-base1 bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base
# 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).


Revision tags: jmcneill-base yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 vmlocking-base
# 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.


Revision tags: yamt-x86pmap-base
# 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'.


Revision tags: nick-csl-alignment-base5
# 1.126 15-Aug-2007 ad

branches: 1.126.2;
Changes to make ktrace LKM friendly and reduce ifdef KTRACE. Proposed
on tech-kern.


Revision tags: matt-mips64-base nick-csl-alignment-base
# 1.125 14-Jul-2007 dsl

branches: 1.125.2; 1.125.6;
Adapt for sys_mount() becoming compat_40_sys_mount(),


Revision tags: mjf-ufs-trans-base
# 1.124 30-Jun-2007 dsl

Changes to sompat socket function to avoid the dreaded stackgap.


Revision tags: yamt-idlelwp-base8
# 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.


Revision tags: thorpej-atomic-base
# 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.


Revision tags: ad-audiomp-base
# 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.


Revision tags: post-newlock2-merge
# 1.116 09-Feb-2007 ad

branches: 1.116.2;
Merge newlock2 to head.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 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.


Revision tags: yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 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.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7
# 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.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.104 14-May-2006 elad

branches: 1.104.4;
integrate kauth.


Revision tags: elad-kernelauth-base
# 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.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3
# 1.101 29-Mar-2006 cube

Implement the _lwp* and sa_* families of syscalls, using the newly
introduced hooks in the native code.


Revision tags: peter-altq-base yamt-pdpolicy-base2 yamt-pdpolicy-base yamt-uio_vmspace-base5
# 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.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 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.


Revision tags: yamt-km-base4 kent-audio2-base
# 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.


Revision tags: yamt-km-base3 netbsd-3-base
# 1.87 26-Feb-2005 perry

branches: 1.87.2;
nuke trailing whitespace


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 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.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 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.


Revision tags: kqueue-aftermerge kqueue-beforemerge kqueue-base
# 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.


Revision tags: gehenna-devsw-base
# 1.64 07-Jul-2002 fvdl

Move netbsd32_sysarch to netbsd32_machdep.c


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base
# 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.


Revision tags: newlock-base ifpoll-base
# 1.62 13-Nov-2001 lukem

add RCSIDs (including regeneration of files as appropriate)


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2
# 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).


Revision tags: post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 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.


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 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.


Revision tags: netbsd-1-5-base
# 1.28 30-May-2000 eeh

branches: 1.28.2;
Include "opt_DDB.h" to enable the DDB sysctls.


Revision tags: minoura-xpg4dl-base
# 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.


Revision tags: chs-ubc2-newbase
# 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.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base
# 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.


Revision tags: chs-ubc2-base
# 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.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 netbsd-1-4-RELEASE netbsd-1-4-base
# 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.


Revision tags: kenh-if-detach-base chs-ubc-base
# 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.233 20-Sep-2021 thorpej

Add the eventfd(2) system call to COMPAT_NETBSD32.


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base
# 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.


Revision tags: netbsd-9-2-RELEASE netbsd-9-1-RELEASE bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base
# 1.228 20-Jun-2019 kamil

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.


Revision tags: phil-wifi-20190609 isaki-audio2-base
# 1.223 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 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.


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 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().


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521
# 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>


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315
# 1.215 15-Mar-2018 christos

Untangle the swapctl compat code mess. Welcome to lucky 13.


Revision tags: pgoyette-compat-base
# 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


Revision tags: tls-maxphys-base-20171202 nick-nhusb-base-20170825
# 1.207 31-Jul-2017 maxv

Remove references to COMPAT_OLDSOCK (itself removed years ago).


Revision tags: netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1
# 1.206 29-Apr-2017 christos

branches: 1.206.2;
move MAP_COPY in compat


Revision tags: prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104
# 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.


Revision tags: nick-nhusb-base-20161004
# 1.204 17-Sep-2016 christos

deal with not having KTRACE


Revision tags: localcount-20160914
# 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


Revision tags: pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529
# 1.200 13-May-2016 christos

branches: 1.200.2;
clamp getrlimit the same way we clamp setrlimit


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.199 28-Feb-2016 khorben

Add missing newline character in error message

This is related to kern/50469.


Revision tags: nick-nhusb-base-20151226
# 1.198 01-Dec-2015 pgoyette

Adapt to per-emulation syscall_autoload capability (the table of syscalls
that can be autoloaded is currently empty).


Revision tags: nick-nhusb-base-20150921
# 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.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 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.


Revision tags: rmind-smpnet-nbase rmind-smpnet-base
# 1.187 15-May-2014 manu

Fix cases where count <= 0 (thanks to Maxime Villard for raising this)


Revision tags: yamt-pagecache-base9
# 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.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 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.


Revision tags: riastradh-drm2-base3
# 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(".");


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1
# 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.


Revision tags: riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 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@.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base2 netbsd-6-base
# 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.


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base
# 1.175 15-Nov-2011 njoly

branches: 1.175.4;
Fix pipe2 return value.


Revision tags: yamt-pagecache-base3
# 1.174 08-Nov-2011 njoly

Add kqueue1(2) support.


Revision tags: yamt-pagecache-base2 yamt-pagecache-base
# 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).


Revision tags: rmind-uvmplock-nbase rmind-uvmplock-base
# 1.171 05-Jun-2011 dsl

Delete some splurious commas and very unexpected trailing space


Revision tags: cherry-xenmp-base
# 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.


Revision tags: bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231
# 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.


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1
# 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().


Revision tags: yamt-nfs-mp-base9
# 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


Revision tags: uebayasi-xip-base
# 1.163 14-Dec-2009 matt

branches: 1.163.2;
Merge from matt-nb5-mips64


Revision tags: matt-premerge-20091211
# 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.


Revision tags: jym-xensuspend-nbase
# 1.159 25-Oct-2009 rmind

Initialise struct emul members by name (it is readable now and one can search
them in the tree).


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 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@.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5
# 1.157 17-May-2009 pooka

pad -> PAD. Fixes build problem reported by Paul Goyette in private email.


Revision tags: yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 jym-xensuspend-base nick-hppapmap-base
# 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.


Revision tags: nick-hppapmap-base2
# 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".


Revision tags: mjf-devfs2-base
# 1.151 11-Jan-2009 nakayama

Follow christos-time_t merge.


# 1.150 11-Jan-2009 christos

merge christos-time_t


Revision tags: christos-time_t-nbase christos-time_t-base haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 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@.


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.145 15-Oct-2008 wrstuden

branches: 1.145.2; 1.145.4;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.144 29-May-2008 mrg

branches: 1.144.4;
remove clause #3 from my license where there are no other
copyright holders involved.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14
# 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.


Revision tags: keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.142 24-Feb-2008 martin

Remove old posix_fadvise compat code


Revision tags: nick-net80211-sync-base mjf-devfs-base
# 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()


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base
# 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....


Revision tags: vmlocking2-base3 matt-armv6-base
# 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.


Revision tags: yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 jmcneill-pm-base
# 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.


Revision tags: yamt-kmem-base
# 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 ...


Revision tags: vmlocking2-base2 reinoud-bufcleanup-nbase reinoud-bufcleanup-base
# 1.131 04-Dec-2007 dsl

Remove all the __P


Revision tags: vmlocking2-base1 bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base
# 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).


Revision tags: jmcneill-base yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 vmlocking-base
# 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.


Revision tags: yamt-x86pmap-base
# 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'.


Revision tags: nick-csl-alignment-base5
# 1.126 15-Aug-2007 ad

branches: 1.126.2;
Changes to make ktrace LKM friendly and reduce ifdef KTRACE. Proposed
on tech-kern.


Revision tags: matt-mips64-base nick-csl-alignment-base
# 1.125 14-Jul-2007 dsl

branches: 1.125.2; 1.125.6;
Adapt for sys_mount() becoming compat_40_sys_mount(),


Revision tags: mjf-ufs-trans-base
# 1.124 30-Jun-2007 dsl

Changes to sompat socket function to avoid the dreaded stackgap.


Revision tags: yamt-idlelwp-base8
# 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.


Revision tags: thorpej-atomic-base
# 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.


Revision tags: ad-audiomp-base
# 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.


Revision tags: post-newlock2-merge
# 1.116 09-Feb-2007 ad

branches: 1.116.2;
Merge newlock2 to head.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 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.


Revision tags: yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 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.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7
# 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.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.104 14-May-2006 elad

branches: 1.104.4;
integrate kauth.


Revision tags: elad-kernelauth-base
# 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.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3
# 1.101 29-Mar-2006 cube

Implement the _lwp* and sa_* families of syscalls, using the newly
introduced hooks in the native code.


Revision tags: peter-altq-base yamt-pdpolicy-base2 yamt-pdpolicy-base yamt-uio_vmspace-base5
# 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.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 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.


Revision tags: yamt-km-base4 kent-audio2-base
# 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.


Revision tags: yamt-km-base3 netbsd-3-base
# 1.87 26-Feb-2005 perry

branches: 1.87.2;
nuke trailing whitespace


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 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.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 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.


Revision tags: kqueue-aftermerge kqueue-beforemerge kqueue-base
# 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.


Revision tags: gehenna-devsw-base
# 1.64 07-Jul-2002 fvdl

Move netbsd32_sysarch to netbsd32_machdep.c


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base
# 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.


Revision tags: newlock-base ifpoll-base
# 1.62 13-Nov-2001 lukem

add RCSIDs (including regeneration of files as appropriate)


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2
# 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).


Revision tags: post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 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.


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 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.


Revision tags: netbsd-1-5-base
# 1.28 30-May-2000 eeh

branches: 1.28.2;
Include "opt_DDB.h" to enable the DDB sysctls.


Revision tags: minoura-xpg4dl-base
# 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.


Revision tags: chs-ubc2-newbase
# 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.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base
# 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.


Revision tags: chs-ubc2-base
# 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.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 netbsd-1-4-RELEASE netbsd-1-4-base
# 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.


Revision tags: kenh-if-detach-base chs-ubc-base
# 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.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).


Revision tags: thorpej-futex-base
# 1.230 10-Oct-2020 rin

Teach about getrandom(2) to COMPAT_NETBSD32.


# 1.229 16-May-2020 christos

Add ACL support for FFS. From FreeBSD.


Revision tags: netbsd-9-1-RELEASE bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base
# 1.228 20-Jun-2019 kamil

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.


Revision tags: phil-wifi-20190609 isaki-audio2-base
# 1.223 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 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.


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 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().


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521
# 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>


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315
# 1.215 15-Mar-2018 christos

Untangle the swapctl compat code mess. Welcome to lucky 13.


Revision tags: pgoyette-compat-base
# 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


Revision tags: tls-maxphys-base-20171202 nick-nhusb-base-20170825
# 1.207 31-Jul-2017 maxv

Remove references to COMPAT_OLDSOCK (itself removed years ago).


Revision tags: netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1
# 1.206 29-Apr-2017 christos

branches: 1.206.2;
move MAP_COPY in compat


Revision tags: prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104
# 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.


Revision tags: nick-nhusb-base-20161004
# 1.204 17-Sep-2016 christos

deal with not having KTRACE


Revision tags: localcount-20160914
# 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


Revision tags: pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529
# 1.200 13-May-2016 christos

branches: 1.200.2;
clamp getrlimit the same way we clamp setrlimit


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.199 28-Feb-2016 khorben

Add missing newline character in error message

This is related to kern/50469.


Revision tags: nick-nhusb-base-20151226
# 1.198 01-Dec-2015 pgoyette

Adapt to per-emulation syscall_autoload capability (the table of syscalls
that can be autoloaded is currently empty).


Revision tags: nick-nhusb-base-20150921
# 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.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 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.


Revision tags: rmind-smpnet-nbase rmind-smpnet-base
# 1.187 15-May-2014 manu

Fix cases where count <= 0 (thanks to Maxime Villard for raising this)


Revision tags: yamt-pagecache-base9
# 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.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 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.


Revision tags: riastradh-drm2-base3
# 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(".");


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1
# 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.


Revision tags: riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 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@.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base2 netbsd-6-base
# 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.


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base
# 1.175 15-Nov-2011 njoly

branches: 1.175.4;
Fix pipe2 return value.


Revision tags: yamt-pagecache-base3
# 1.174 08-Nov-2011 njoly

Add kqueue1(2) support.


Revision tags: yamt-pagecache-base2 yamt-pagecache-base
# 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).


Revision tags: rmind-uvmplock-nbase rmind-uvmplock-base
# 1.171 05-Jun-2011 dsl

Delete some splurious commas and very unexpected trailing space


Revision tags: cherry-xenmp-base
# 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.


Revision tags: bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231
# 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.


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1
# 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().


Revision tags: yamt-nfs-mp-base9
# 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


Revision tags: uebayasi-xip-base
# 1.163 14-Dec-2009 matt

branches: 1.163.2;
Merge from matt-nb5-mips64


Revision tags: matt-premerge-20091211
# 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.


Revision tags: jym-xensuspend-nbase
# 1.159 25-Oct-2009 rmind

Initialise struct emul members by name (it is readable now and one can search
them in the tree).


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 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@.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5
# 1.157 17-May-2009 pooka

pad -> PAD. Fixes build problem reported by Paul Goyette in private email.


Revision tags: yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 jym-xensuspend-base nick-hppapmap-base
# 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.


Revision tags: nick-hppapmap-base2
# 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".


Revision tags: mjf-devfs2-base
# 1.151 11-Jan-2009 nakayama

Follow christos-time_t merge.


# 1.150 11-Jan-2009 christos

merge christos-time_t


Revision tags: christos-time_t-nbase christos-time_t-base haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 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@.


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.145 15-Oct-2008 wrstuden

branches: 1.145.2; 1.145.4;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.144 29-May-2008 mrg

branches: 1.144.4;
remove clause #3 from my license where there are no other
copyright holders involved.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14
# 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.


Revision tags: keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.142 24-Feb-2008 martin

Remove old posix_fadvise compat code


Revision tags: nick-net80211-sync-base mjf-devfs-base
# 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()


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base
# 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....


Revision tags: vmlocking2-base3 matt-armv6-base
# 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.


Revision tags: yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 jmcneill-pm-base
# 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.


Revision tags: yamt-kmem-base
# 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 ...


Revision tags: vmlocking2-base2 reinoud-bufcleanup-nbase reinoud-bufcleanup-base
# 1.131 04-Dec-2007 dsl

Remove all the __P


Revision tags: vmlocking2-base1 bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base
# 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).


Revision tags: jmcneill-base yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 vmlocking-base
# 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.


Revision tags: yamt-x86pmap-base
# 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'.


Revision tags: nick-csl-alignment-base5
# 1.126 15-Aug-2007 ad

branches: 1.126.2;
Changes to make ktrace LKM friendly and reduce ifdef KTRACE. Proposed
on tech-kern.


Revision tags: matt-mips64-base nick-csl-alignment-base
# 1.125 14-Jul-2007 dsl

branches: 1.125.2; 1.125.6;
Adapt for sys_mount() becoming compat_40_sys_mount(),


Revision tags: mjf-ufs-trans-base
# 1.124 30-Jun-2007 dsl

Changes to sompat socket function to avoid the dreaded stackgap.


Revision tags: yamt-idlelwp-base8
# 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.


Revision tags: thorpej-atomic-base
# 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.


Revision tags: ad-audiomp-base
# 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.


Revision tags: post-newlock2-merge
# 1.116 09-Feb-2007 ad

branches: 1.116.2;
Merge newlock2 to head.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 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.


Revision tags: yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 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.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7
# 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.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.104 14-May-2006 elad

branches: 1.104.4;
integrate kauth.


Revision tags: elad-kernelauth-base
# 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.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3
# 1.101 29-Mar-2006 cube

Implement the _lwp* and sa_* families of syscalls, using the newly
introduced hooks in the native code.


Revision tags: peter-altq-base yamt-pdpolicy-base2 yamt-pdpolicy-base yamt-uio_vmspace-base5
# 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.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 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.


Revision tags: yamt-km-base4 kent-audio2-base
# 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.


Revision tags: yamt-km-base3 netbsd-3-base
# 1.87 26-Feb-2005 perry

branches: 1.87.2;
nuke trailing whitespace


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 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.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 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.


Revision tags: kqueue-aftermerge kqueue-beforemerge kqueue-base
# 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.


Revision tags: gehenna-devsw-base
# 1.64 07-Jul-2002 fvdl

Move netbsd32_sysarch to netbsd32_machdep.c


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base
# 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.


Revision tags: newlock-base ifpoll-base
# 1.62 13-Nov-2001 lukem

add RCSIDs (including regeneration of files as appropriate)


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2
# 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).


Revision tags: post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 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.


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 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.


Revision tags: netbsd-1-5-base
# 1.28 30-May-2000 eeh

branches: 1.28.2;
Include "opt_DDB.h" to enable the DDB sysctls.


Revision tags: minoura-xpg4dl-base
# 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.


Revision tags: chs-ubc2-newbase
# 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.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base
# 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.


Revision tags: chs-ubc2-base
# 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.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 netbsd-1-4-RELEASE netbsd-1-4-base
# 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.


Revision tags: kenh-if-detach-base chs-ubc-base
# 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.231 15-Jan-2021 simonb

Remove unused LIMITCHECK() macro (now contained in netbsd32_rlimit.c).


Revision tags: thorpej-futex-base
# 1.230 10-Oct-2020 rin

Teach about getrandom(2) to COMPAT_NETBSD32.


# 1.229 16-May-2020 christos

Add ACL support for FFS. From FreeBSD.


Revision tags: netbsd-9-1-RELEASE bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base
# 1.228 20-Jun-2019 kamil

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.


Revision tags: phil-wifi-20190609 isaki-audio2-base
# 1.223 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 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.


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 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().


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521
# 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>


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315
# 1.215 15-Mar-2018 christos

Untangle the swapctl compat code mess. Welcome to lucky 13.


Revision tags: pgoyette-compat-base
# 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


Revision tags: tls-maxphys-base-20171202 nick-nhusb-base-20170825
# 1.207 31-Jul-2017 maxv

Remove references to COMPAT_OLDSOCK (itself removed years ago).


Revision tags: netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1
# 1.206 29-Apr-2017 christos

branches: 1.206.2;
move MAP_COPY in compat


Revision tags: prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104
# 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.


Revision tags: nick-nhusb-base-20161004
# 1.204 17-Sep-2016 christos

deal with not having KTRACE


Revision tags: localcount-20160914
# 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


Revision tags: pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529
# 1.200 13-May-2016 christos

branches: 1.200.2;
clamp getrlimit the same way we clamp setrlimit


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.199 28-Feb-2016 khorben

Add missing newline character in error message

This is related to kern/50469.


Revision tags: nick-nhusb-base-20151226
# 1.198 01-Dec-2015 pgoyette

Adapt to per-emulation syscall_autoload capability (the table of syscalls
that can be autoloaded is currently empty).


Revision tags: nick-nhusb-base-20150921
# 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.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 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.


Revision tags: rmind-smpnet-nbase rmind-smpnet-base
# 1.187 15-May-2014 manu

Fix cases where count <= 0 (thanks to Maxime Villard for raising this)


Revision tags: yamt-pagecache-base9
# 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.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 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.


Revision tags: riastradh-drm2-base3
# 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(".");


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1
# 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.


Revision tags: riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 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@.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base2 netbsd-6-base
# 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.


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base
# 1.175 15-Nov-2011 njoly

branches: 1.175.4;
Fix pipe2 return value.


Revision tags: yamt-pagecache-base3
# 1.174 08-Nov-2011 njoly

Add kqueue1(2) support.


Revision tags: yamt-pagecache-base2 yamt-pagecache-base
# 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).


Revision tags: rmind-uvmplock-nbase rmind-uvmplock-base
# 1.171 05-Jun-2011 dsl

Delete some splurious commas and very unexpected trailing space


Revision tags: cherry-xenmp-base
# 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.


Revision tags: bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231
# 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.


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1
# 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().


Revision tags: yamt-nfs-mp-base9
# 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


Revision tags: uebayasi-xip-base
# 1.163 14-Dec-2009 matt

branches: 1.163.2;
Merge from matt-nb5-mips64


Revision tags: matt-premerge-20091211
# 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.


Revision tags: jym-xensuspend-nbase
# 1.159 25-Oct-2009 rmind

Initialise struct emul members by name (it is readable now and one can search
them in the tree).


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 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@.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5
# 1.157 17-May-2009 pooka

pad -> PAD. Fixes build problem reported by Paul Goyette in private email.


Revision tags: yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 jym-xensuspend-base nick-hppapmap-base
# 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.


Revision tags: nick-hppapmap-base2
# 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".


Revision tags: mjf-devfs2-base
# 1.151 11-Jan-2009 nakayama

Follow christos-time_t merge.


# 1.150 11-Jan-2009 christos

merge christos-time_t


Revision tags: christos-time_t-nbase christos-time_t-base haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 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@.


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.145 15-Oct-2008 wrstuden

branches: 1.145.2; 1.145.4;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.144 29-May-2008 mrg

branches: 1.144.4;
remove clause #3 from my license where there are no other
copyright holders involved.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14
# 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.


Revision tags: keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.142 24-Feb-2008 martin

Remove old posix_fadvise compat code


Revision tags: nick-net80211-sync-base mjf-devfs-base
# 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()


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base
# 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....


Revision tags: vmlocking2-base3 matt-armv6-base
# 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.


Revision tags: yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 jmcneill-pm-base
# 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.


Revision tags: yamt-kmem-base
# 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 ...


Revision tags: vmlocking2-base2 reinoud-bufcleanup-nbase reinoud-bufcleanup-base
# 1.131 04-Dec-2007 dsl

Remove all the __P


Revision tags: vmlocking2-base1 bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base
# 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).


Revision tags: jmcneill-base yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 vmlocking-base
# 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.


Revision tags: yamt-x86pmap-base
# 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'.


Revision tags: nick-csl-alignment-base5
# 1.126 15-Aug-2007 ad

branches: 1.126.2;
Changes to make ktrace LKM friendly and reduce ifdef KTRACE. Proposed
on tech-kern.


Revision tags: matt-mips64-base nick-csl-alignment-base
# 1.125 14-Jul-2007 dsl

branches: 1.125.2; 1.125.6;
Adapt for sys_mount() becoming compat_40_sys_mount(),


Revision tags: mjf-ufs-trans-base
# 1.124 30-Jun-2007 dsl

Changes to sompat socket function to avoid the dreaded stackgap.


Revision tags: yamt-idlelwp-base8
# 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.


Revision tags: thorpej-atomic-base
# 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.


Revision tags: ad-audiomp-base
# 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.


Revision tags: post-newlock2-merge
# 1.116 09-Feb-2007 ad

branches: 1.116.2;
Merge newlock2 to head.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 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.


Revision tags: yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 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.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7
# 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.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.104 14-May-2006 elad

branches: 1.104.4;
integrate kauth.


Revision tags: elad-kernelauth-base
# 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.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3
# 1.101 29-Mar-2006 cube

Implement the _lwp* and sa_* families of syscalls, using the newly
introduced hooks in the native code.


Revision tags: peter-altq-base yamt-pdpolicy-base2 yamt-pdpolicy-base yamt-uio_vmspace-base5
# 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.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 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.


Revision tags: yamt-km-base4 kent-audio2-base
# 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.


Revision tags: yamt-km-base3 netbsd-3-base
# 1.87 26-Feb-2005 perry

branches: 1.87.2;
nuke trailing whitespace


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 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.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 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.


Revision tags: kqueue-aftermerge kqueue-beforemerge kqueue-base
# 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.


Revision tags: gehenna-devsw-base
# 1.64 07-Jul-2002 fvdl

Move netbsd32_sysarch to netbsd32_machdep.c


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base
# 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.


Revision tags: newlock-base ifpoll-base
# 1.62 13-Nov-2001 lukem

add RCSIDs (including regeneration of files as appropriate)


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2
# 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).


Revision tags: post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 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.


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 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.


Revision tags: netbsd-1-5-base
# 1.28 30-May-2000 eeh

branches: 1.28.2;
Include "opt_DDB.h" to enable the DDB sysctls.


Revision tags: minoura-xpg4dl-base
# 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.


Revision tags: chs-ubc2-newbase
# 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.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base
# 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.


Revision tags: chs-ubc2-base
# 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.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 netbsd-1-4-RELEASE netbsd-1-4-base
# 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.


Revision tags: kenh-if-detach-base chs-ubc-base
# 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.230 10-Oct-2020 rin

Teach about getrandom(2) to COMPAT_NETBSD32.


# 1.229 16-May-2020 christos

Add ACL support for FFS. From FreeBSD.


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base
# 1.228 20-Jun-2019 kamil

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.


Revision tags: phil-wifi-20190609 isaki-audio2-base
# 1.223 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 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.


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 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().


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521
# 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>


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315
# 1.215 15-Mar-2018 christos

Untangle the swapctl compat code mess. Welcome to lucky 13.


Revision tags: pgoyette-compat-base
# 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


Revision tags: tls-maxphys-base-20171202 nick-nhusb-base-20170825
# 1.207 31-Jul-2017 maxv

Remove references to COMPAT_OLDSOCK (itself removed years ago).


Revision tags: netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1
# 1.206 29-Apr-2017 christos

branches: 1.206.2;
move MAP_COPY in compat


Revision tags: prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104
# 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.


Revision tags: nick-nhusb-base-20161004
# 1.204 17-Sep-2016 christos

deal with not having KTRACE


Revision tags: localcount-20160914
# 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


Revision tags: pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529
# 1.200 13-May-2016 christos

branches: 1.200.2;
clamp getrlimit the same way we clamp setrlimit


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.199 28-Feb-2016 khorben

Add missing newline character in error message

This is related to kern/50469.


Revision tags: nick-nhusb-base-20151226
# 1.198 01-Dec-2015 pgoyette

Adapt to per-emulation syscall_autoload capability (the table of syscalls
that can be autoloaded is currently empty).


Revision tags: nick-nhusb-base-20150921
# 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.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 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.


Revision tags: rmind-smpnet-nbase rmind-smpnet-base
# 1.187 15-May-2014 manu

Fix cases where count <= 0 (thanks to Maxime Villard for raising this)


Revision tags: yamt-pagecache-base9
# 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.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 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.


Revision tags: riastradh-drm2-base3
# 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(".");


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1
# 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.


Revision tags: riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 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@.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base2 netbsd-6-base
# 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.


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base
# 1.175 15-Nov-2011 njoly

branches: 1.175.4;
Fix pipe2 return value.


Revision tags: yamt-pagecache-base3
# 1.174 08-Nov-2011 njoly

Add kqueue1(2) support.


Revision tags: yamt-pagecache-base2 yamt-pagecache-base
# 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).


Revision tags: rmind-uvmplock-nbase rmind-uvmplock-base
# 1.171 05-Jun-2011 dsl

Delete some splurious commas and very unexpected trailing space


Revision tags: cherry-xenmp-base
# 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.


Revision tags: bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231
# 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.


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1
# 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().


Revision tags: yamt-nfs-mp-base9
# 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


Revision tags: uebayasi-xip-base
# 1.163 14-Dec-2009 matt

branches: 1.163.2;
Merge from matt-nb5-mips64


Revision tags: matt-premerge-20091211
# 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.


Revision tags: jym-xensuspend-nbase
# 1.159 25-Oct-2009 rmind

Initialise struct emul members by name (it is readable now and one can search
them in the tree).


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 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@.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5
# 1.157 17-May-2009 pooka

pad -> PAD. Fixes build problem reported by Paul Goyette in private email.


Revision tags: yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 jym-xensuspend-base nick-hppapmap-base
# 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.


Revision tags: nick-hppapmap-base2
# 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".


Revision tags: mjf-devfs2-base
# 1.151 11-Jan-2009 nakayama

Follow christos-time_t merge.


# 1.150 11-Jan-2009 christos

merge christos-time_t


Revision tags: christos-time_t-nbase christos-time_t-base haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 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@.


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.145 15-Oct-2008 wrstuden

branches: 1.145.2; 1.145.4;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.144 29-May-2008 mrg

branches: 1.144.4;
remove clause #3 from my license where there are no other
copyright holders involved.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14
# 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.


Revision tags: keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.142 24-Feb-2008 martin

Remove old posix_fadvise compat code


Revision tags: nick-net80211-sync-base mjf-devfs-base
# 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()


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base
# 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....


Revision tags: vmlocking2-base3 matt-armv6-base
# 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.


Revision tags: yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 jmcneill-pm-base
# 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.


Revision tags: yamt-kmem-base
# 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 ...


Revision tags: vmlocking2-base2 reinoud-bufcleanup-nbase reinoud-bufcleanup-base
# 1.131 04-Dec-2007 dsl

Remove all the __P


Revision tags: vmlocking2-base1 bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base
# 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).


Revision tags: jmcneill-base yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 vmlocking-base
# 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.


Revision tags: yamt-x86pmap-base
# 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'.


Revision tags: nick-csl-alignment-base5
# 1.126 15-Aug-2007 ad

branches: 1.126.2;
Changes to make ktrace LKM friendly and reduce ifdef KTRACE. Proposed
on tech-kern.


Revision tags: matt-mips64-base nick-csl-alignment-base
# 1.125 14-Jul-2007 dsl

branches: 1.125.2; 1.125.6;
Adapt for sys_mount() becoming compat_40_sys_mount(),


Revision tags: mjf-ufs-trans-base
# 1.124 30-Jun-2007 dsl

Changes to sompat socket function to avoid the dreaded stackgap.


Revision tags: yamt-idlelwp-base8
# 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.


Revision tags: thorpej-atomic-base
# 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.


Revision tags: ad-audiomp-base
# 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.


Revision tags: post-newlock2-merge
# 1.116 09-Feb-2007 ad

branches: 1.116.2;
Merge newlock2 to head.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 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.


Revision tags: yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 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.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7
# 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.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.104 14-May-2006 elad

branches: 1.104.4;
integrate kauth.


Revision tags: elad-kernelauth-base
# 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.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3
# 1.101 29-Mar-2006 cube

Implement the _lwp* and sa_* families of syscalls, using the newly
introduced hooks in the native code.


Revision tags: peter-altq-base yamt-pdpolicy-base2 yamt-pdpolicy-base yamt-uio_vmspace-base5
# 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.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 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.


Revision tags: yamt-km-base4 kent-audio2-base
# 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.


Revision tags: yamt-km-base3 netbsd-3-base
# 1.87 26-Feb-2005 perry

branches: 1.87.2;
nuke trailing whitespace


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 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.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 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.


Revision tags: kqueue-aftermerge kqueue-beforemerge kqueue-base
# 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.


Revision tags: gehenna-devsw-base
# 1.64 07-Jul-2002 fvdl

Move netbsd32_sysarch to netbsd32_machdep.c


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base
# 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.


Revision tags: newlock-base ifpoll-base
# 1.62 13-Nov-2001 lukem

add RCSIDs (including regeneration of files as appropriate)


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2
# 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).


Revision tags: post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 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.


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 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.


Revision tags: netbsd-1-5-base
# 1.28 30-May-2000 eeh

branches: 1.28.2;
Include "opt_DDB.h" to enable the DDB sysctls.


Revision tags: minoura-xpg4dl-base
# 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.


Revision tags: chs-ubc2-newbase
# 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.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base
# 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.


Revision tags: chs-ubc2-base
# 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.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 netbsd-1-4-RELEASE netbsd-1-4-base
# 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.


Revision tags: kenh-if-detach-base chs-ubc-base
# 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.229 16-May-2020 christos

Add ACL support for FFS. From FreeBSD.


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base
# 1.228 20-Jun-2019 kamil

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.


Revision tags: phil-wifi-20190609 isaki-audio2-base
# 1.223 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 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.


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 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().


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521
# 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>


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315
# 1.215 15-Mar-2018 christos

Untangle the swapctl compat code mess. Welcome to lucky 13.


Revision tags: pgoyette-compat-base
# 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


Revision tags: tls-maxphys-base-20171202 nick-nhusb-base-20170825
# 1.207 31-Jul-2017 maxv

Remove references to COMPAT_OLDSOCK (itself removed years ago).


Revision tags: netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1
# 1.206 29-Apr-2017 christos

branches: 1.206.2;
move MAP_COPY in compat


Revision tags: prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104
# 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.


Revision tags: nick-nhusb-base-20161004
# 1.204 17-Sep-2016 christos

deal with not having KTRACE


Revision tags: localcount-20160914
# 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


Revision tags: pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529
# 1.200 13-May-2016 christos

branches: 1.200.2;
clamp getrlimit the same way we clamp setrlimit


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.199 28-Feb-2016 khorben

Add missing newline character in error message

This is related to kern/50469.


Revision tags: nick-nhusb-base-20151226
# 1.198 01-Dec-2015 pgoyette

Adapt to per-emulation syscall_autoload capability (the table of syscalls
that can be autoloaded is currently empty).


Revision tags: nick-nhusb-base-20150921
# 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.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 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.


Revision tags: rmind-smpnet-nbase rmind-smpnet-base
# 1.187 15-May-2014 manu

Fix cases where count <= 0 (thanks to Maxime Villard for raising this)


Revision tags: yamt-pagecache-base9
# 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.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 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.


Revision tags: riastradh-drm2-base3
# 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(".");


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1
# 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.


Revision tags: riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 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@.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base2 netbsd-6-base
# 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.


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base
# 1.175 15-Nov-2011 njoly

branches: 1.175.4;
Fix pipe2 return value.


Revision tags: yamt-pagecache-base3
# 1.174 08-Nov-2011 njoly

Add kqueue1(2) support.


Revision tags: yamt-pagecache-base2 yamt-pagecache-base
# 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).


Revision tags: rmind-uvmplock-nbase rmind-uvmplock-base
# 1.171 05-Jun-2011 dsl

Delete some splurious commas and very unexpected trailing space


Revision tags: cherry-xenmp-base
# 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.


Revision tags: bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231
# 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.


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1
# 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().


Revision tags: yamt-nfs-mp-base9
# 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


Revision tags: uebayasi-xip-base
# 1.163 14-Dec-2009 matt

branches: 1.163.2;
Merge from matt-nb5-mips64


Revision tags: matt-premerge-20091211
# 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.


Revision tags: jym-xensuspend-nbase
# 1.159 25-Oct-2009 rmind

Initialise struct emul members by name (it is readable now and one can search
them in the tree).


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 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@.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5
# 1.157 17-May-2009 pooka

pad -> PAD. Fixes build problem reported by Paul Goyette in private email.


Revision tags: yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 jym-xensuspend-base nick-hppapmap-base
# 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.


Revision tags: nick-hppapmap-base2
# 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".


Revision tags: mjf-devfs2-base
# 1.151 11-Jan-2009 nakayama

Follow christos-time_t merge.


# 1.150 11-Jan-2009 christos

merge christos-time_t


Revision tags: christos-time_t-nbase christos-time_t-base haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 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@.


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.145 15-Oct-2008 wrstuden

branches: 1.145.2; 1.145.4;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.144 29-May-2008 mrg

branches: 1.144.4;
remove clause #3 from my license where there are no other
copyright holders involved.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14
# 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.


Revision tags: keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.142 24-Feb-2008 martin

Remove old posix_fadvise compat code


Revision tags: nick-net80211-sync-base mjf-devfs-base
# 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()


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base
# 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....


Revision tags: vmlocking2-base3 matt-armv6-base
# 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.


Revision tags: yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 jmcneill-pm-base
# 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.


Revision tags: yamt-kmem-base
# 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 ...


Revision tags: vmlocking2-base2 reinoud-bufcleanup-nbase reinoud-bufcleanup-base
# 1.131 04-Dec-2007 dsl

Remove all the __P


Revision tags: vmlocking2-base1 bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base
# 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).


Revision tags: jmcneill-base yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 vmlocking-base
# 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.


Revision tags: yamt-x86pmap-base
# 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'.


Revision tags: nick-csl-alignment-base5
# 1.126 15-Aug-2007 ad

branches: 1.126.2;
Changes to make ktrace LKM friendly and reduce ifdef KTRACE. Proposed
on tech-kern.


Revision tags: matt-mips64-base nick-csl-alignment-base
# 1.125 14-Jul-2007 dsl

branches: 1.125.2; 1.125.6;
Adapt for sys_mount() becoming compat_40_sys_mount(),


Revision tags: mjf-ufs-trans-base
# 1.124 30-Jun-2007 dsl

Changes to sompat socket function to avoid the dreaded stackgap.


Revision tags: yamt-idlelwp-base8
# 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.


Revision tags: thorpej-atomic-base
# 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.


Revision tags: ad-audiomp-base
# 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.


Revision tags: post-newlock2-merge
# 1.116 09-Feb-2007 ad

branches: 1.116.2;
Merge newlock2 to head.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 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.


Revision tags: yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 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.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7
# 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.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.104 14-May-2006 elad

branches: 1.104.4;
integrate kauth.


Revision tags: elad-kernelauth-base
# 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.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3
# 1.101 29-Mar-2006 cube

Implement the _lwp* and sa_* families of syscalls, using the newly
introduced hooks in the native code.


Revision tags: peter-altq-base yamt-pdpolicy-base2 yamt-pdpolicy-base yamt-uio_vmspace-base5
# 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.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 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.


Revision tags: yamt-km-base4 kent-audio2-base
# 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.


Revision tags: yamt-km-base3 netbsd-3-base
# 1.87 26-Feb-2005 perry

branches: 1.87.2;
nuke trailing whitespace


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 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.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 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.


Revision tags: kqueue-aftermerge kqueue-beforemerge kqueue-base
# 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.


Revision tags: gehenna-devsw-base
# 1.64 07-Jul-2002 fvdl

Move netbsd32_sysarch to netbsd32_machdep.c


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base
# 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.


Revision tags: newlock-base ifpoll-base
# 1.62 13-Nov-2001 lukem

add RCSIDs (including regeneration of files as appropriate)


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2
# 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).


Revision tags: post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 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.


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 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.


Revision tags: netbsd-1-5-base
# 1.28 30-May-2000 eeh

branches: 1.28.2;
Include "opt_DDB.h" to enable the DDB sysctls.


Revision tags: minoura-xpg4dl-base
# 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.


Revision tags: chs-ubc2-newbase
# 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.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base
# 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.


Revision tags: chs-ubc2-base
# 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.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 netbsd-1-4-RELEASE netbsd-1-4-base
# 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.


Revision tags: kenh-if-detach-base chs-ubc-base
# 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.228 20-Jun-2019 kamil

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.


Revision tags: phil-wifi-20190609 isaki-audio2-base
# 1.223 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 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.


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 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().


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521
# 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>


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315
# 1.215 15-Mar-2018 christos

Untangle the swapctl compat code mess. Welcome to lucky 13.


Revision tags: pgoyette-compat-base
# 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


Revision tags: tls-maxphys-base-20171202 nick-nhusb-base-20170825
# 1.207 31-Jul-2017 maxv

Remove references to COMPAT_OLDSOCK (itself removed years ago).


Revision tags: netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1
# 1.206 29-Apr-2017 christos

branches: 1.206.2;
move MAP_COPY in compat


Revision tags: prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104
# 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.


Revision tags: nick-nhusb-base-20161004
# 1.204 17-Sep-2016 christos

deal with not having KTRACE


Revision tags: localcount-20160914
# 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


Revision tags: pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529
# 1.200 13-May-2016 christos

branches: 1.200.2;
clamp getrlimit the same way we clamp setrlimit


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.199 28-Feb-2016 khorben

Add missing newline character in error message

This is related to kern/50469.


Revision tags: nick-nhusb-base-20151226
# 1.198 01-Dec-2015 pgoyette

Adapt to per-emulation syscall_autoload capability (the table of syscalls
that can be autoloaded is currently empty).


Revision tags: nick-nhusb-base-20150921
# 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.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 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.


Revision tags: rmind-smpnet-nbase rmind-smpnet-base
# 1.187 15-May-2014 manu

Fix cases where count <= 0 (thanks to Maxime Villard for raising this)


Revision tags: yamt-pagecache-base9
# 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.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 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.


Revision tags: riastradh-drm2-base3
# 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(".");


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1
# 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.


Revision tags: riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 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@.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base2 netbsd-6-base
# 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.


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base
# 1.175 15-Nov-2011 njoly

branches: 1.175.4;
Fix pipe2 return value.


Revision tags: yamt-pagecache-base3
# 1.174 08-Nov-2011 njoly

Add kqueue1(2) support.


Revision tags: yamt-pagecache-base2 yamt-pagecache-base
# 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).


Revision tags: rmind-uvmplock-nbase rmind-uvmplock-base
# 1.171 05-Jun-2011 dsl

Delete some splurious commas and very unexpected trailing space


Revision tags: cherry-xenmp-base
# 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.


Revision tags: bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231
# 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.


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1
# 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().


Revision tags: yamt-nfs-mp-base9
# 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


Revision tags: uebayasi-xip-base
# 1.163 14-Dec-2009 matt

branches: 1.163.2;
Merge from matt-nb5-mips64


Revision tags: matt-premerge-20091211
# 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.


Revision tags: jym-xensuspend-nbase
# 1.159 25-Oct-2009 rmind

Initialise struct emul members by name (it is readable now and one can search
them in the tree).


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 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@.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5
# 1.157 17-May-2009 pooka

pad -> PAD. Fixes build problem reported by Paul Goyette in private email.


Revision tags: yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 jym-xensuspend-base nick-hppapmap-base
# 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.


Revision tags: nick-hppapmap-base2
# 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".


Revision tags: mjf-devfs2-base
# 1.151 11-Jan-2009 nakayama

Follow christos-time_t merge.


# 1.150 11-Jan-2009 christos

merge christos-time_t


Revision tags: christos-time_t-nbase christos-time_t-base haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 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@.


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.145 15-Oct-2008 wrstuden

branches: 1.145.2; 1.145.4;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.144 29-May-2008 mrg

branches: 1.144.4;
remove clause #3 from my license where there are no other
copyright holders involved.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14
# 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.


Revision tags: keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.142 24-Feb-2008 martin

Remove old posix_fadvise compat code


Revision tags: nick-net80211-sync-base mjf-devfs-base
# 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()


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base
# 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....


Revision tags: vmlocking2-base3 matt-armv6-base
# 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.


Revision tags: yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 jmcneill-pm-base
# 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.


Revision tags: yamt-kmem-base
# 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 ...


Revision tags: vmlocking2-base2 reinoud-bufcleanup-nbase reinoud-bufcleanup-base
# 1.131 04-Dec-2007 dsl

Remove all the __P


Revision tags: vmlocking2-base1 bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base
# 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).


Revision tags: jmcneill-base yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 vmlocking-base
# 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.


Revision tags: yamt-x86pmap-base
# 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'.


Revision tags: nick-csl-alignment-base5
# 1.126 15-Aug-2007 ad

branches: 1.126.2;
Changes to make ktrace LKM friendly and reduce ifdef KTRACE. Proposed
on tech-kern.


Revision tags: matt-mips64-base nick-csl-alignment-base
# 1.125 14-Jul-2007 dsl

branches: 1.125.2; 1.125.6;
Adapt for sys_mount() becoming compat_40_sys_mount(),


Revision tags: mjf-ufs-trans-base
# 1.124 30-Jun-2007 dsl

Changes to sompat socket function to avoid the dreaded stackgap.


Revision tags: yamt-idlelwp-base8
# 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.


Revision tags: thorpej-atomic-base
# 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.


Revision tags: ad-audiomp-base
# 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.


Revision tags: post-newlock2-merge
# 1.116 09-Feb-2007 ad

branches: 1.116.2;
Merge newlock2 to head.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 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.


Revision tags: yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 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.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7
# 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.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.104 14-May-2006 elad

branches: 1.104.4;
integrate kauth.


Revision tags: elad-kernelauth-base
# 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.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3
# 1.101 29-Mar-2006 cube

Implement the _lwp* and sa_* families of syscalls, using the newly
introduced hooks in the native code.


Revision tags: peter-altq-base yamt-pdpolicy-base2 yamt-pdpolicy-base yamt-uio_vmspace-base5
# 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.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 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.


Revision tags: yamt-km-base4 kent-audio2-base
# 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.


Revision tags: yamt-km-base3 netbsd-3-base
# 1.87 26-Feb-2005 perry

branches: 1.87.2;
nuke trailing whitespace


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 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.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 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.


Revision tags: kqueue-aftermerge kqueue-beforemerge kqueue-base
# 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.


Revision tags: gehenna-devsw-base
# 1.64 07-Jul-2002 fvdl

Move netbsd32_sysarch to netbsd32_machdep.c


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base
# 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.


Revision tags: newlock-base ifpoll-base
# 1.62 13-Nov-2001 lukem

add RCSIDs (including regeneration of files as appropriate)


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2
# 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).


Revision tags: post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 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.


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 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.


Revision tags: netbsd-1-5-base
# 1.28 30-May-2000 eeh

branches: 1.28.2;
Include "opt_DDB.h" to enable the DDB sysctls.


Revision tags: minoura-xpg4dl-base
# 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.


Revision tags: chs-ubc2-newbase
# 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.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base
# 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.


Revision tags: chs-ubc2-base
# 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.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 netbsd-1-4-RELEASE netbsd-1-4-base
# 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.


Revision tags: kenh-if-detach-base chs-ubc-base
# 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.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.


Revision tags: phil-wifi-20190609 isaki-audio2-base
# 1.223 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 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.


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 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().


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521
# 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>


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315
# 1.215 15-Mar-2018 christos

Untangle the swapctl compat code mess. Welcome to lucky 13.


Revision tags: pgoyette-compat-base
# 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


Revision tags: tls-maxphys-base-20171202 nick-nhusb-base-20170825
# 1.207 31-Jul-2017 maxv

Remove references to COMPAT_OLDSOCK (itself removed years ago).


Revision tags: netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1
# 1.206 29-Apr-2017 christos

branches: 1.206.2;
move MAP_COPY in compat


Revision tags: prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104
# 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.


Revision tags: nick-nhusb-base-20161004
# 1.204 17-Sep-2016 christos

deal with not having KTRACE


Revision tags: localcount-20160914
# 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


Revision tags: pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529
# 1.200 13-May-2016 christos

branches: 1.200.2;
clamp getrlimit the same way we clamp setrlimit


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.199 28-Feb-2016 khorben

Add missing newline character in error message

This is related to kern/50469.


Revision tags: nick-nhusb-base-20151226
# 1.198 01-Dec-2015 pgoyette

Adapt to per-emulation syscall_autoload capability (the table of syscalls
that can be autoloaded is currently empty).


Revision tags: nick-nhusb-base-20150921
# 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.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 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.


Revision tags: rmind-smpnet-nbase rmind-smpnet-base
# 1.187 15-May-2014 manu

Fix cases where count <= 0 (thanks to Maxime Villard for raising this)


Revision tags: yamt-pagecache-base9
# 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.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 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.


Revision tags: riastradh-drm2-base3
# 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(".");


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1
# 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.


Revision tags: riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 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@.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base2 netbsd-6-base
# 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.


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base
# 1.175 15-Nov-2011 njoly

branches: 1.175.4;
Fix pipe2 return value.


Revision tags: yamt-pagecache-base3
# 1.174 08-Nov-2011 njoly

Add kqueue1(2) support.


Revision tags: yamt-pagecache-base2 yamt-pagecache-base
# 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).


Revision tags: rmind-uvmplock-nbase rmind-uvmplock-base
# 1.171 05-Jun-2011 dsl

Delete some splurious commas and very unexpected trailing space


Revision tags: cherry-xenmp-base
# 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.


Revision tags: bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231
# 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.


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1
# 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().


Revision tags: yamt-nfs-mp-base9
# 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


Revision tags: uebayasi-xip-base
# 1.163 14-Dec-2009 matt

branches: 1.163.2;
Merge from matt-nb5-mips64


Revision tags: matt-premerge-20091211
# 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.


Revision tags: jym-xensuspend-nbase
# 1.159 25-Oct-2009 rmind

Initialise struct emul members by name (it is readable now and one can search
them in the tree).


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 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@.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5
# 1.157 17-May-2009 pooka

pad -> PAD. Fixes build problem reported by Paul Goyette in private email.


Revision tags: yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 jym-xensuspend-base nick-hppapmap-base
# 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.


Revision tags: nick-hppapmap-base2
# 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".


Revision tags: mjf-devfs2-base
# 1.151 11-Jan-2009 nakayama

Follow christos-time_t merge.


# 1.150 11-Jan-2009 christos

merge christos-time_t


Revision tags: christos-time_t-nbase christos-time_t-base haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 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@.


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.145 15-Oct-2008 wrstuden

branches: 1.145.2; 1.145.4;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.144 29-May-2008 mrg

branches: 1.144.4;
remove clause #3 from my license where there are no other
copyright holders involved.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14
# 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.


Revision tags: keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.142 24-Feb-2008 martin

Remove old posix_fadvise compat code


Revision tags: nick-net80211-sync-base mjf-devfs-base
# 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()


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base
# 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....


Revision tags: vmlocking2-base3 matt-armv6-base
# 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.


Revision tags: yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 jmcneill-pm-base
# 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.


Revision tags: yamt-kmem-base
# 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 ...


Revision tags: vmlocking2-base2 reinoud-bufcleanup-nbase reinoud-bufcleanup-base
# 1.131 04-Dec-2007 dsl

Remove all the __P


Revision tags: vmlocking2-base1 bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base
# 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).


Revision tags: jmcneill-base yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 vmlocking-base
# 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.


Revision tags: yamt-x86pmap-base
# 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'.


Revision tags: nick-csl-alignment-base5
# 1.126 15-Aug-2007 ad

branches: 1.126.2;
Changes to make ktrace LKM friendly and reduce ifdef KTRACE. Proposed
on tech-kern.


Revision tags: matt-mips64-base nick-csl-alignment-base
# 1.125 14-Jul-2007 dsl

branches: 1.125.2; 1.125.6;
Adapt for sys_mount() becoming compat_40_sys_mount(),


Revision tags: mjf-ufs-trans-base
# 1.124 30-Jun-2007 dsl

Changes to sompat socket function to avoid the dreaded stackgap.


Revision tags: yamt-idlelwp-base8
# 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.


Revision tags: thorpej-atomic-base
# 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.


Revision tags: ad-audiomp-base
# 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.


Revision tags: post-newlock2-merge
# 1.116 09-Feb-2007 ad

branches: 1.116.2;
Merge newlock2 to head.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 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.


Revision tags: yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 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.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7
# 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.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.104 14-May-2006 elad

branches: 1.104.4;
integrate kauth.


Revision tags: elad-kernelauth-base
# 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.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3
# 1.101 29-Mar-2006 cube

Implement the _lwp* and sa_* families of syscalls, using the newly
introduced hooks in the native code.


Revision tags: peter-altq-base yamt-pdpolicy-base2 yamt-pdpolicy-base yamt-uio_vmspace-base5
# 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.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 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.


Revision tags: yamt-km-base4 kent-audio2-base
# 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.


Revision tags: yamt-km-base3 netbsd-3-base
# 1.87 26-Feb-2005 perry

branches: 1.87.2;
nuke trailing whitespace


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 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.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 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.


Revision tags: kqueue-aftermerge kqueue-beforemerge kqueue-base
# 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.


Revision tags: gehenna-devsw-base
# 1.64 07-Jul-2002 fvdl

Move netbsd32_sysarch to netbsd32_machdep.c


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base
# 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.


Revision tags: newlock-base ifpoll-base
# 1.62 13-Nov-2001 lukem

add RCSIDs (including regeneration of files as appropriate)


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2
# 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).


Revision tags: post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 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.


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 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.


Revision tags: netbsd-1-5-base
# 1.28 30-May-2000 eeh

branches: 1.28.2;
Include "opt_DDB.h" to enable the DDB sysctls.


Revision tags: minoura-xpg4dl-base
# 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.


Revision tags: chs-ubc2-newbase
# 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.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base
# 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.


Revision tags: chs-ubc2-base
# 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.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 netbsd-1-4-RELEASE netbsd-1-4-base
# 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.


Revision tags: kenh-if-detach-base chs-ubc-base
# 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.


Revision tags: isaki-audio2-base
# 1.223 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226
# 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.


Revision tags: pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 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().


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521
# 1.216 06-May-2018 kamil

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>


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315
# 1.215 15-Mar-2018 christos

Untangle the swapctl compat code mess. Welcome to lucky 13.


Revision tags: pgoyette-compat-base
# 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


Revision tags: tls-maxphys-base-20171202 nick-nhusb-base-20170825
# 1.207 31-Jul-2017 maxv

Remove references to COMPAT_OLDSOCK (itself removed years ago).


Revision tags: netbsd-8-0-RELEASE netbsd-8-0-RC2 netbsd-8-0-RC1 matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1
# 1.206 29-Apr-2017 christos

branches: 1.206.2;
move MAP_COPY in compat


Revision tags: prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104
# 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.


Revision tags: nick-nhusb-base-20161004
# 1.204 17-Sep-2016 christos

deal with not having KTRACE


Revision tags: localcount-20160914
# 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


Revision tags: pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529
# 1.200 13-May-2016 christos

branches: 1.200.2;
clamp getrlimit the same way we clamp setrlimit


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.199 28-Feb-2016 khorben

Add missing newline character in error message

This is related to kern/50469.


Revision tags: nick-nhusb-base-20151226
# 1.198 01-Dec-2015 pgoyette

Adapt to per-emulation syscall_autoload capability (the table of syscalls
that can be autoloaded is currently empty).


Revision tags: nick-nhusb-base-20150921
# 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.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 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.


Revision tags: rmind-smpnet-nbase rmind-smpnet-base
# 1.187 15-May-2014 manu

Fix cases where count <= 0 (thanks to Maxime Villard for raising this)


Revision tags: yamt-pagecache-base9
# 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.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 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.


Revision tags: riastradh-drm2-base3
# 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(".");


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1
# 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.


Revision tags: riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 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@.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base2 netbsd-6-base
# 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.


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base
# 1.175 15-Nov-2011 njoly

branches: 1.175.4;
Fix pipe2 return value.


Revision tags: yamt-pagecache-base3
# 1.174 08-Nov-2011 njoly

Add kqueue1(2) support.


Revision tags: yamt-pagecache-base2 yamt-pagecache-base
# 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).


Revision tags: rmind-uvmplock-nbase rmind-uvmplock-base
# 1.171 05-Jun-2011 dsl

Delete some splurious commas and very unexpected trailing space


Revision tags: cherry-xenmp-base
# 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.


Revision tags: bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231
# 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.


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1
# 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().


Revision tags: yamt-nfs-mp-base9
# 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


Revision tags: uebayasi-xip-base
# 1.163 14-Dec-2009 matt

branches: 1.163.2;
Merge from matt-nb5-mips64


Revision tags: matt-premerge-20091211
# 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.


Revision tags: jym-xensuspend-nbase
# 1.159 25-Oct-2009 rmind

Initialise struct emul members by name (it is readable now and one can search
them in the tree).


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 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@.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5
# 1.157 17-May-2009 pooka

pad -> PAD. Fixes build problem reported by Paul Goyette in private email.


Revision tags: yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 jym-xensuspend-base nick-hppapmap-base
# 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.


Revision tags: nick-hppapmap-base2
# 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".


Revision tags: mjf-devfs2-base
# 1.151 11-Jan-2009 nakayama

Follow christos-time_t merge.


# 1.150 11-Jan-2009 christos

merge christos-time_t


Revision tags: christos-time_t-nbase christos-time_t-base haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 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@.


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.145 15-Oct-2008 wrstuden

branches: 1.145.2; 1.145.4;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.144 29-May-2008 mrg

branches: 1.144.4;
remove clause #3 from my license where there are no other
copyright holders involved.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14
# 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.


Revision tags: keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.142 24-Feb-2008 martin

Remove old posix_fadvise compat code


Revision tags: nick-net80211-sync-base mjf-devfs-base
# 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()


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base
# 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....


Revision tags: vmlocking2-base3 matt-armv6-base
# 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.


Revision tags: yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 jmcneill-pm-base
# 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.


Revision tags: yamt-kmem-base
# 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 ...


Revision tags: vmlocking2-base2 reinoud-bufcleanup-nbase reinoud-bufcleanup-base
# 1.131 04-Dec-2007 dsl

Remove all the __P


Revision tags: vmlocking2-base1 bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base
# 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).


Revision tags: jmcneill-base yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 vmlocking-base
# 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.


Revision tags: yamt-x86pmap-base
# 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'.


Revision tags: nick-csl-alignment-base5
# 1.126 15-Aug-2007 ad

branches: 1.126.2;
Changes to make ktrace LKM friendly and reduce ifdef KTRACE. Proposed
on tech-kern.


Revision tags: matt-mips64-base nick-csl-alignment-base
# 1.125 14-Jul-2007 dsl

branches: 1.125.2; 1.125.6;
Adapt for sys_mount() becoming compat_40_sys_mount(),


Revision tags: mjf-ufs-trans-base
# 1.124 30-Jun-2007 dsl

Changes to sompat socket function to avoid the dreaded stackgap.


Revision tags: yamt-idlelwp-base8
# 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.


Revision tags: thorpej-atomic-base
# 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.


Revision tags: ad-audiomp-base
# 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.


Revision tags: post-newlock2-merge
# 1.116 09-Feb-2007 ad

branches: 1.116.2;
Merge newlock2 to head.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 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.


Revision tags: yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 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.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7
# 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.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.104 14-May-2006 elad

branches: 1.104.4;
integrate kauth.


Revision tags: elad-kernelauth-base
# 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.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3
# 1.101 29-Mar-2006 cube

Implement the _lwp* and sa_* families of syscalls, using the newly
introduced hooks in the native code.


Revision tags: peter-altq-base yamt-pdpolicy-base2 yamt-pdpolicy-base yamt-uio_vmspace-base5
# 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.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 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.


Revision tags: yamt-km-base4 kent-audio2-base
# 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.


Revision tags: yamt-km-base3 netbsd-3-base
# 1.87 26-Feb-2005 perry

branches: 1.87.2;
nuke trailing whitespace


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 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.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 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.


Revision tags: kqueue-aftermerge kqueue-beforemerge kqueue-base
# 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.


Revision tags: gehenna-devsw-base
# 1.64 07-Jul-2002 fvdl

Move netbsd32_sysarch to netbsd32_machdep.c


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base
# 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.


Revision tags: newlock-base ifpoll-base
# 1.62 13-Nov-2001 lukem

add RCSIDs (including regeneration of files as appropriate)


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2
# 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).


Revision tags: post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 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.


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 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.


Revision tags: netbsd-1-5-base
# 1.28 30-May-2000 eeh

branches: 1.28.2;
Include "opt_DDB.h" to enable the DDB sysctls.


Revision tags: minoura-xpg4dl-base
# 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.


Revision tags: chs-ubc2-newbase
# 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.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base
# 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.


Revision tags: chs-ubc2-base
# 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.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 netbsd-1-4-RELEASE netbsd-1-4-base
# 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.


Revision tags: kenh-if-detach-base chs-ubc-base
# 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.214 09-Jan-2018 maya

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


Revision tags: tls-maxphys-base-20171202 nick-nhusb-base-20170825
# 1.207 31-Jul-2017 maxv

Remove references to COMPAT_OLDSOCK (itself removed years ago).


Revision tags: matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1
# 1.206 29-Apr-2017 christos

move MAP_COPY in compat


Revision tags: prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104
# 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.


Revision tags: nick-nhusb-base-20161004
# 1.204 17-Sep-2016 christos

deal with not having KTRACE


Revision tags: localcount-20160914
# 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


Revision tags: pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529
# 1.200 13-May-2016 christos

branches: 1.200.2;
clamp getrlimit the same way we clamp setrlimit


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.199 28-Feb-2016 khorben

Add missing newline character in error message

This is related to kern/50469.


Revision tags: nick-nhusb-base-20151226
# 1.198 01-Dec-2015 pgoyette

Adapt to per-emulation syscall_autoload capability (the table of syscalls
that can be autoloaded is currently empty).


Revision tags: nick-nhusb-base-20150921
# 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.


Revision tags: netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.193 31-Jul-2014 maxv

branches: 1.193.4;
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.


Revision tags: rmind-smpnet-nbase rmind-smpnet-base
# 1.187 15-May-2014 manu

Fix cases where count <= 0 (thanks to Maxime Villard for raising this)


Revision tags: yamt-pagecache-base9
# 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.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 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.


Revision tags: riastradh-drm2-base3
# 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(".");


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1
# 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.


Revision tags: riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 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@.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base2 netbsd-6-base
# 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.


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base
# 1.175 15-Nov-2011 njoly

branches: 1.175.4;
Fix pipe2 return value.


Revision tags: yamt-pagecache-base3
# 1.174 08-Nov-2011 njoly

Add kqueue1(2) support.


Revision tags: yamt-pagecache-base2 yamt-pagecache-base
# 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).


Revision tags: rmind-uvmplock-nbase rmind-uvmplock-base
# 1.171 05-Jun-2011 dsl

Delete some splurious commas and very unexpected trailing space


Revision tags: cherry-xenmp-base
# 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.


Revision tags: bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231
# 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.


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1
# 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().


Revision tags: yamt-nfs-mp-base9
# 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


Revision tags: uebayasi-xip-base
# 1.163 14-Dec-2009 matt

branches: 1.163.2;
Merge from matt-nb5-mips64


Revision tags: matt-premerge-20091211
# 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.


Revision tags: jym-xensuspend-nbase
# 1.159 25-Oct-2009 rmind

Initialise struct emul members by name (it is readable now and one can search
them in the tree).


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 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@.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5
# 1.157 17-May-2009 pooka

pad -> PAD. Fixes build problem reported by Paul Goyette in private email.


Revision tags: yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 jym-xensuspend-base nick-hppapmap-base
# 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.


Revision tags: nick-hppapmap-base2
# 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".


Revision tags: mjf-devfs2-base
# 1.151 11-Jan-2009 nakayama

Follow christos-time_t merge.


# 1.150 11-Jan-2009 christos

merge christos-time_t


Revision tags: christos-time_t-nbase christos-time_t-base haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 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@.


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.145 15-Oct-2008 wrstuden

branches: 1.145.2; 1.145.4;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.144 29-May-2008 mrg

branches: 1.144.4;
remove clause #3 from my license where there are no other
copyright holders involved.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14
# 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.


Revision tags: keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.142 24-Feb-2008 martin

Remove old posix_fadvise compat code


Revision tags: nick-net80211-sync-base mjf-devfs-base
# 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()


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base
# 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....


Revision tags: vmlocking2-base3 matt-armv6-base
# 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.


Revision tags: yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 jmcneill-pm-base
# 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.


Revision tags: yamt-kmem-base
# 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 ...


Revision tags: vmlocking2-base2 reinoud-bufcleanup-nbase reinoud-bufcleanup-base
# 1.131 04-Dec-2007 dsl

Remove all the __P


Revision tags: vmlocking2-base1 bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base
# 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).


Revision tags: jmcneill-base yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 vmlocking-base
# 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.


Revision tags: yamt-x86pmap-base
# 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'.


Revision tags: nick-csl-alignment-base5
# 1.126 15-Aug-2007 ad

branches: 1.126.2;
Changes to make ktrace LKM friendly and reduce ifdef KTRACE. Proposed
on tech-kern.


Revision tags: matt-mips64-base nick-csl-alignment-base
# 1.125 14-Jul-2007 dsl

branches: 1.125.2; 1.125.6;
Adapt for sys_mount() becoming compat_40_sys_mount(),


Revision tags: mjf-ufs-trans-base
# 1.124 30-Jun-2007 dsl

Changes to sompat socket function to avoid the dreaded stackgap.


Revision tags: yamt-idlelwp-base8
# 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.


Revision tags: thorpej-atomic-base
# 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.


Revision tags: ad-audiomp-base
# 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.


Revision tags: post-newlock2-merge
# 1.116 09-Feb-2007 ad

branches: 1.116.2;
Merge newlock2 to head.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 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.


Revision tags: yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 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.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7
# 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.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.104 14-May-2006 elad

branches: 1.104.4;
integrate kauth.


Revision tags: elad-kernelauth-base
# 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.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3
# 1.101 29-Mar-2006 cube

Implement the _lwp* and sa_* families of syscalls, using the newly
introduced hooks in the native code.


Revision tags: peter-altq-base yamt-pdpolicy-base2 yamt-pdpolicy-base yamt-uio_vmspace-base5
# 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.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 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.


Revision tags: yamt-km-base4 kent-audio2-base
# 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.


Revision tags: yamt-km-base3 netbsd-3-base
# 1.87 26-Feb-2005 perry

branches: 1.87.2;
nuke trailing whitespace


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 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.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 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.


Revision tags: kqueue-aftermerge kqueue-beforemerge kqueue-base
# 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.


Revision tags: gehenna-devsw-base
# 1.64 07-Jul-2002 fvdl

Move netbsd32_sysarch to netbsd32_machdep.c


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base
# 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.


Revision tags: newlock-base ifpoll-base
# 1.62 13-Nov-2001 lukem

add RCSIDs (including regeneration of files as appropriate)


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2
# 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).


Revision tags: post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 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.


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 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.


Revision tags: netbsd-1-5-base
# 1.28 30-May-2000 eeh

branches: 1.28.2;
Include "opt_DDB.h" to enable the DDB sysctls.


Revision tags: minoura-xpg4dl-base
# 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.


Revision tags: chs-ubc2-newbase
# 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.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base
# 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.


Revision tags: chs-ubc2-base
# 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.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 netbsd-1-4-RELEASE netbsd-1-4-base
# 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.


Revision tags: kenh-if-detach-base chs-ubc-base
# 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.207 31-Jul-2017 maxv

Remove references to COMPAT_OLDSOCK (itself removed years ago).


Revision tags: perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1
# 1.206 29-Apr-2017 christos

move MAP_COPY in compat


Revision tags: prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104
# 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.


Revision tags: nick-nhusb-base-20161004
# 1.204 17-Sep-2016 christos

deal with not having KTRACE


Revision tags: localcount-20160914
# 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


Revision tags: pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529
# 1.200 13-May-2016 christos

branches: 1.200.2;
clamp getrlimit the same way we clamp setrlimit


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.199 28-Feb-2016 khorben

Add missing newline character in error message

This is related to kern/50469.


Revision tags: nick-nhusb-base-20151226
# 1.198 01-Dec-2015 pgoyette

Adapt to per-emulation syscall_autoload capability (the table of syscalls
that can be autoloaded is currently empty).


Revision tags: nick-nhusb-base-20150921
# 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.


Revision tags: netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.193 31-Jul-2014 maxv

branches: 1.193.4;
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.


Revision tags: rmind-smpnet-nbase rmind-smpnet-base
# 1.187 15-May-2014 manu

Fix cases where count <= 0 (thanks to Maxime Villard for raising this)


Revision tags: yamt-pagecache-base9
# 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.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 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.


Revision tags: riastradh-drm2-base3
# 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(".");


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1
# 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.


Revision tags: riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 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@.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base2 netbsd-6-base
# 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.


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base
# 1.175 15-Nov-2011 njoly

branches: 1.175.4;
Fix pipe2 return value.


Revision tags: yamt-pagecache-base3
# 1.174 08-Nov-2011 njoly

Add kqueue1(2) support.


Revision tags: yamt-pagecache-base2 yamt-pagecache-base
# 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).


Revision tags: rmind-uvmplock-nbase rmind-uvmplock-base
# 1.171 05-Jun-2011 dsl

Delete some splurious commas and very unexpected trailing space


Revision tags: cherry-xenmp-base
# 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.


Revision tags: bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231
# 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.


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1
# 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().


Revision tags: yamt-nfs-mp-base9
# 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


Revision tags: uebayasi-xip-base
# 1.163 14-Dec-2009 matt

branches: 1.163.2;
Merge from matt-nb5-mips64


Revision tags: matt-premerge-20091211
# 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.


Revision tags: jym-xensuspend-nbase
# 1.159 25-Oct-2009 rmind

Initialise struct emul members by name (it is readable now and one can search
them in the tree).


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 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@.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5
# 1.157 17-May-2009 pooka

pad -> PAD. Fixes build problem reported by Paul Goyette in private email.


Revision tags: yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 jym-xensuspend-base nick-hppapmap-base
# 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.


Revision tags: nick-hppapmap-base2
# 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".


Revision tags: mjf-devfs2-base
# 1.151 11-Jan-2009 nakayama

Follow christos-time_t merge.


# 1.150 11-Jan-2009 christos

merge christos-time_t


Revision tags: christos-time_t-nbase christos-time_t-base haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 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@.


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.145 15-Oct-2008 wrstuden

branches: 1.145.2; 1.145.4;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.144 29-May-2008 mrg

branches: 1.144.4;
remove clause #3 from my license where there are no other
copyright holders involved.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14
# 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.


Revision tags: keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.142 24-Feb-2008 martin

Remove old posix_fadvise compat code


Revision tags: nick-net80211-sync-base mjf-devfs-base
# 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()


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base
# 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....


Revision tags: vmlocking2-base3 matt-armv6-base
# 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.


Revision tags: yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 jmcneill-pm-base
# 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.


Revision tags: yamt-kmem-base
# 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 ...


Revision tags: vmlocking2-base2 reinoud-bufcleanup-nbase reinoud-bufcleanup-base
# 1.131 04-Dec-2007 dsl

Remove all the __P


Revision tags: vmlocking2-base1 bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base
# 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).


Revision tags: jmcneill-base yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 vmlocking-base
# 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.


Revision tags: yamt-x86pmap-base
# 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'.


Revision tags: nick-csl-alignment-base5
# 1.126 15-Aug-2007 ad

branches: 1.126.2;
Changes to make ktrace LKM friendly and reduce ifdef KTRACE. Proposed
on tech-kern.


Revision tags: matt-mips64-base nick-csl-alignment-base
# 1.125 14-Jul-2007 dsl

branches: 1.125.2; 1.125.6;
Adapt for sys_mount() becoming compat_40_sys_mount(),


Revision tags: mjf-ufs-trans-base
# 1.124 30-Jun-2007 dsl

Changes to sompat socket function to avoid the dreaded stackgap.


Revision tags: yamt-idlelwp-base8
# 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.


Revision tags: thorpej-atomic-base
# 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.


Revision tags: ad-audiomp-base
# 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.


Revision tags: post-newlock2-merge
# 1.116 09-Feb-2007 ad

branches: 1.116.2;
Merge newlock2 to head.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 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.


Revision tags: yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 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.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7
# 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.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.104 14-May-2006 elad

branches: 1.104.4;
integrate kauth.


Revision tags: elad-kernelauth-base
# 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.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3
# 1.101 29-Mar-2006 cube

Implement the _lwp* and sa_* families of syscalls, using the newly
introduced hooks in the native code.


Revision tags: peter-altq-base yamt-pdpolicy-base2 yamt-pdpolicy-base yamt-uio_vmspace-base5
# 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.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 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.


Revision tags: yamt-km-base4 kent-audio2-base
# 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.


Revision tags: yamt-km-base3 netbsd-3-base
# 1.87 26-Feb-2005 perry

branches: 1.87.2;
nuke trailing whitespace


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 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.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 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.


Revision tags: kqueue-aftermerge kqueue-beforemerge kqueue-base
# 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.


Revision tags: gehenna-devsw-base
# 1.64 07-Jul-2002 fvdl

Move netbsd32_sysarch to netbsd32_machdep.c


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base
# 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.


Revision tags: newlock-base ifpoll-base
# 1.62 13-Nov-2001 lukem

add RCSIDs (including regeneration of files as appropriate)


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2
# 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).


Revision tags: post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 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.


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 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.


Revision tags: netbsd-1-5-base
# 1.28 30-May-2000 eeh

branches: 1.28.2;
Include "opt_DDB.h" to enable the DDB sysctls.


Revision tags: minoura-xpg4dl-base
# 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.


Revision tags: chs-ubc2-newbase
# 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.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base
# 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.


Revision tags: chs-ubc2-base
# 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.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 netbsd-1-4-RELEASE netbsd-1-4-base
# 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.


Revision tags: kenh-if-detach-base chs-ubc-base
# 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.206 29-Apr-2017 christos

move MAP_COPY in compat


Revision tags: prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204 pgoyette-localcount-20161104
# 1.205 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.


Revision tags: nick-nhusb-base-20161004
# 1.204 17-Sep-2016 christos

deal with not having KTRACE


Revision tags: localcount-20160914
# 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


Revision tags: pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529
# 1.200 13-May-2016 christos

branches: 1.200.2;
clamp getrlimit the same way we clamp setrlimit


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.199 28-Feb-2016 khorben

Add missing newline character in error message

This is related to kern/50469.


Revision tags: nick-nhusb-base-20151226
# 1.198 01-Dec-2015 pgoyette

Adapt to per-emulation syscall_autoload capability (the table of syscalls
that can be autoloaded is currently empty).


Revision tags: nick-nhusb-base-20150921
# 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.


Revision tags: netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 netbsd-7-1-RC1 netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.193 31-Jul-2014 maxv

branches: 1.193.4;
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.


Revision tags: rmind-smpnet-nbase rmind-smpnet-base
# 1.187 15-May-2014 manu

Fix cases where count <= 0 (thanks to Maxime Villard for raising this)


Revision tags: yamt-pagecache-base9
# 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.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 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.


Revision tags: riastradh-drm2-base3
# 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(".");


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1
# 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.


Revision tags: riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 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@.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base2 netbsd-6-base
# 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.


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base
# 1.175 15-Nov-2011 njoly

branches: 1.175.4;
Fix pipe2 return value.


Revision tags: yamt-pagecache-base3
# 1.174 08-Nov-2011 njoly

Add kqueue1(2) support.


Revision tags: yamt-pagecache-base2 yamt-pagecache-base
# 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).


Revision tags: rmind-uvmplock-nbase rmind-uvmplock-base
# 1.171 05-Jun-2011 dsl

Delete some splurious commas and very unexpected trailing space


Revision tags: cherry-xenmp-base
# 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.


Revision tags: bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231
# 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.


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1
# 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().


Revision tags: yamt-nfs-mp-base9
# 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


Revision tags: uebayasi-xip-base
# 1.163 14-Dec-2009 matt

branches: 1.163.2;
Merge from matt-nb5-mips64


Revision tags: matt-premerge-20091211
# 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.


Revision tags: jym-xensuspend-nbase
# 1.159 25-Oct-2009 rmind

Initialise struct emul members by name (it is readable now and one can search
them in the tree).


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 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@.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5
# 1.157 17-May-2009 pooka

pad -> PAD. Fixes build problem reported by Paul Goyette in private email.


Revision tags: yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 jym-xensuspend-base nick-hppapmap-base
# 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.


Revision tags: nick-hppapmap-base2
# 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".


Revision tags: mjf-devfs2-base
# 1.151 11-Jan-2009 nakayama

Follow christos-time_t merge.


# 1.150 11-Jan-2009 christos

merge christos-time_t


Revision tags: christos-time_t-nbase christos-time_t-base haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 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@.


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.145 15-Oct-2008 wrstuden

branches: 1.145.2; 1.145.4;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.144 29-May-2008 mrg

branches: 1.144.4;
remove clause #3 from my license where there are no other
copyright holders involved.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14
# 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.


Revision tags: keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.142 24-Feb-2008 martin

Remove old posix_fadvise compat code


Revision tags: nick-net80211-sync-base mjf-devfs-base
# 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()


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base
# 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....


Revision tags: vmlocking2-base3 matt-armv6-base
# 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.


Revision tags: yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 jmcneill-pm-base
# 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.


Revision tags: yamt-kmem-base
# 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 ...


Revision tags: vmlocking2-base2 reinoud-bufcleanup-nbase reinoud-bufcleanup-base
# 1.131 04-Dec-2007 dsl

Remove all the __P


Revision tags: vmlocking2-base1 bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base
# 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).


Revision tags: jmcneill-base yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 vmlocking-base
# 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.


Revision tags: yamt-x86pmap-base
# 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'.


Revision tags: nick-csl-alignment-base5
# 1.126 15-Aug-2007 ad

branches: 1.126.2;
Changes to make ktrace LKM friendly and reduce ifdef KTRACE. Proposed
on tech-kern.


Revision tags: matt-mips64-base nick-csl-alignment-base
# 1.125 14-Jul-2007 dsl

branches: 1.125.2; 1.125.6;
Adapt for sys_mount() becoming compat_40_sys_mount(),


Revision tags: mjf-ufs-trans-base
# 1.124 30-Jun-2007 dsl

Changes to sompat socket function to avoid the dreaded stackgap.


Revision tags: yamt-idlelwp-base8
# 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.


Revision tags: thorpej-atomic-base
# 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.


Revision tags: ad-audiomp-base
# 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.


Revision tags: post-newlock2-merge
# 1.116 09-Feb-2007 ad

branches: 1.116.2;
Merge newlock2 to head.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 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.


Revision tags: yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 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.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7
# 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.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.104 14-May-2006 elad

branches: 1.104.4;
integrate kauth.


Revision tags: elad-kernelauth-base
# 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.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3
# 1.101 29-Mar-2006 cube

Implement the _lwp* and sa_* families of syscalls, using the newly
introduced hooks in the native code.


Revision tags: peter-altq-base yamt-pdpolicy-base2 yamt-pdpolicy-base yamt-uio_vmspace-base5
# 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.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 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.


Revision tags: yamt-km-base4 kent-audio2-base
# 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.


Revision tags: yamt-km-base3 netbsd-3-base
# 1.87 26-Feb-2005 perry

branches: 1.87.2;
nuke trailing whitespace


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 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.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 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.


Revision tags: kqueue-aftermerge kqueue-beforemerge kqueue-base
# 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.


Revision tags: gehenna-devsw-base
# 1.64 07-Jul-2002 fvdl

Move netbsd32_sysarch to netbsd32_machdep.c


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base
# 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.


Revision tags: newlock-base ifpoll-base
# 1.62 13-Nov-2001 lukem

add RCSIDs (including regeneration of files as appropriate)


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2
# 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).


Revision tags: post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 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.


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 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.


Revision tags: netbsd-1-5-base
# 1.28 30-May-2000 eeh

branches: 1.28.2;
Include "opt_DDB.h" to enable the DDB sysctls.


Revision tags: minoura-xpg4dl-base
# 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.


Revision tags: chs-ubc2-newbase
# 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.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base
# 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.


Revision tags: chs-ubc2-base
# 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.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 netbsd-1-4-RELEASE netbsd-1-4-base
# 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.


Revision tags: kenh-if-detach-base chs-ubc-base
# 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.


Revision tags: nick-nhusb-base-20161204 pgoyette-localcount-20161104
# 1.205 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.


Revision tags: nick-nhusb-base-20161004
# 1.204 17-Sep-2016 christos

deal with not having KTRACE


Revision tags: localcount-20160914
# 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


Revision tags: pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529
# 1.200 13-May-2016 christos

branches: 1.200.2;
clamp getrlimit the same way we clamp setrlimit


Revision tags: nick-nhusb-base-20160422 nick-nhusb-base-20160319
# 1.199 28-Feb-2016 khorben

Add missing newline character in error message

This is related to kern/50469.


Revision tags: nick-nhusb-base-20151226
# 1.198 01-Dec-2015 pgoyette

Adapt to per-emulation syscall_autoload capability (the table of syscalls
that can be autoloaded is currently empty).


Revision tags: nick-nhusb-base-20150921
# 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.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-nhusb-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.193 31-Jul-2014 maxv

branches: 1.193.4;
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.


Revision tags: rmind-smpnet-nbase rmind-smpnet-base
# 1.187 15-May-2014 manu

Fix cases where count <= 0 (thanks to Maxime Villard for raising this)


Revision tags: yamt-pagecache-base9
# 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.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15
# 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.


Revision tags: riastradh-drm2-base3
# 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(".");


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1
# 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.


Revision tags: riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 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@.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 netbsd-6-1-RC2 netbsd-6-1-RC1 netbsd-6-0-1-RELEASE matt-nb6-plus-nbase netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base2 netbsd-6-base
# 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.


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base
# 1.175 15-Nov-2011 njoly

branches: 1.175.4;
Fix pipe2 return value.


Revision tags: yamt-pagecache-base3
# 1.174 08-Nov-2011 njoly

Add kqueue1(2) support.


Revision tags: yamt-pagecache-base2 yamt-pagecache-base
# 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).


Revision tags: rmind-uvmplock-nbase rmind-uvmplock-base
# 1.171 05-Jun-2011 dsl

Delete some splurious commas and very unexpected trailing space


Revision tags: cherry-xenmp-base
# 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.


Revision tags: bouyer-quota2-nbase bouyer-quota2-base jruoho-x86intr-base matt-mips64-premerge-20101231
# 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.


Revision tags: uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1
# 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().


Revision tags: yamt-nfs-mp-base9
# 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


Revision tags: uebayasi-xip-base
# 1.163 14-Dec-2009 matt

branches: 1.163.2;
Merge from matt-nb5-mips64


Revision tags: matt-premerge-20091211
# 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.


Revision tags: jym-xensuspend-nbase
# 1.159 25-Oct-2009 rmind

Initialise struct emul members by name (it is readable now and one can search
them in the tree).


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7
# 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@.


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5
# 1.157 17-May-2009 pooka

pad -> PAD. Fixes build problem reported by Paul Goyette in private email.


Revision tags: yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 jym-xensuspend-base nick-hppapmap-base
# 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.


Revision tags: nick-hppapmap-base2
# 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".


Revision tags: mjf-devfs2-base
# 1.151 11-Jan-2009 nakayama

Follow christos-time_t merge.


# 1.150 11-Jan-2009 christos

merge christos-time_t


Revision tags: christos-time_t-nbase christos-time_t-base haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 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@.


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.145 15-Oct-2008 wrstuden

branches: 1.145.2; 1.145.4;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.144 29-May-2008 mrg

branches: 1.144.4;
remove clause #3 from my license where there are no other
copyright holders involved.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14
# 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.


Revision tags: keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase hpcarm-cleanup-base
# 1.142 24-Feb-2008 martin

Remove old posix_fadvise compat code


Revision tags: nick-net80211-sync-base mjf-devfs-base
# 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()


Revision tags: bouyer-xeni386-nbase bouyer-xeni386-base
# 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....


Revision tags: vmlocking2-base3 matt-armv6-base
# 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.


Revision tags: yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 jmcneill-pm-base
# 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.


Revision tags: yamt-kmem-base
# 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 ...


Revision tags: vmlocking2-base2 reinoud-bufcleanup-nbase reinoud-bufcleanup-base
# 1.131 04-Dec-2007 dsl

Remove all the __P


Revision tags: vmlocking2-base1 bouyer-xenamd64-base2 vmlocking-nbase bouyer-xenamd64-base
# 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).


Revision tags: jmcneill-base yamt-x86pmap-base4 yamt-x86pmap-base3 yamt-x86pmap-base2 vmlocking-base
# 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.


Revision tags: yamt-x86pmap-base
# 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'.


Revision tags: nick-csl-alignment-base5
# 1.126 15-Aug-2007 ad

branches: 1.126.2;
Changes to make ktrace LKM friendly and reduce ifdef KTRACE. Proposed
on tech-kern.


Revision tags: matt-mips64-base nick-csl-alignment-base
# 1.125 14-Jul-2007 dsl

branches: 1.125.2; 1.125.6;
Adapt for sys_mount() becoming compat_40_sys_mount(),


Revision tags: mjf-ufs-trans-base
# 1.124 30-Jun-2007 dsl

Changes to sompat socket function to avoid the dreaded stackgap.


Revision tags: yamt-idlelwp-base8
# 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.


Revision tags: thorpej-atomic-base
# 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.


Revision tags: ad-audiomp-base
# 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.


Revision tags: post-newlock2-merge
# 1.116 09-Feb-2007 ad

branches: 1.116.2;
Merge newlock2 to head.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 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.


Revision tags: yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 rpaulo-netinet-merge-pcb-base
# 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.


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7
# 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.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.104 14-May-2006 elad

branches: 1.104.4;
integrate kauth.


Revision tags: elad-kernelauth-base
# 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.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3
# 1.101 29-Mar-2006 cube

Implement the _lwp* and sa_* families of syscalls, using the newly
introduced hooks in the native code.


Revision tags: peter-altq-base yamt-pdpolicy-base2 yamt-pdpolicy-base yamt-uio_vmspace-base5
# 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.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base ktrace-lwp-base
# 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.


Revision tags: yamt-km-base4 kent-audio2-base
# 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.


Revision tags: yamt-km-base3 netbsd-3-base
# 1.87 26-Feb-2005 perry

branches: 1.87.2;
nuke trailing whitespace


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 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.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 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.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 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.


Revision tags: kqueue-aftermerge kqueue-beforemerge kqueue-base
# 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.


Revision tags: gehenna-devsw-base
# 1.64 07-Jul-2002 fvdl

Move netbsd32_sysarch to netbsd32_machdep.c


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base eeh-devprop-base
# 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.


Revision tags: newlock-base ifpoll-base
# 1.62 13-Nov-2001 lukem

add RCSIDs (including regeneration of files as appropriate)


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2
# 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).


Revision tags: post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 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.


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 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.


Revision tags: netbsd-1-5-base
# 1.28 30-May-2000 eeh

branches: 1.28.2;
Include "opt_DDB.h" to enable the DDB sysctls.


Revision tags: minoura-xpg4dl-base
# 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.


Revision tags: chs-ubc2-newbase
# 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.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base
# 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.


Revision tags: chs-ubc2-base
# 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.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 netbsd-1-4-RELEASE netbsd-1-4-base
# 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.


Revision tags: kenh-if-detach-base chs-ubc-base
# 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.