Home | History | Annotate | only in /src/lib/librumpuser
History log of /src/lib/librumpuser
RevisionDateAuthorComments
 1.30 03-Jun-2023  lukem bsd.own.mk: rename GCC_NO_* to CC_WNO_*

Rename compiler-warning-disable variables from
GCC_NO_warning
to
CC_WNO_warning
where warning is the full warning name as used by the compiler.

GCC_NO_IMPLICIT_FALLTHRU is CC_WNO_IMPLICIT_FALLTHROUGH

Using the convention CC_compilerflag, where compilerflag
is based on the full compiler flag name.
 1.29 01-Nov-2021  nia Force at most partial RELRO for rump_server and related libraries

rump_server with -l uses lazy resolution by default and thus cannot be
used with full RELRO/BIND_NOW.
 1.28 13-Oct-2019  mrg introduce some common variables for use in GCC warning disables:

GCC_NO_FORMAT_TRUNCATION -Wno-format-truncation (GCC 7/8)
GCC_NO_STRINGOP_TRUNCATION -Wno-stringop-truncation (GCC 8)
GCC_NO_STRINGOP_OVERFLOW -Wno-stringop-overflow (GCC 8)
GCC_NO_CAST_FUNCTION_TYPE -Wno-cast-function-type (GCC 8)

use these to turn off warnings for most GCC-8 complaints. many
of these are false positives, most of the real bugs are already
commited, or are yet to come.


we plan to introduce versions of (some?) of these that use the
"-Wno-error=" form, which still displays the warnings but does
not make it an error, and all of the above will be re-considered
as either being "fix me" (warning still displayed) or "warning
is wrong."
 1.27 11-May-2017  sevan branches: 1.27.10;
With the removal of HAVE_REGISTER_T from rumpuser_port.h, _KERNTYPES does not
need to be defined. This allows register_t to be typedef'd to RUMP_REGISTER_T
without conflict, as highlighted in PR kern/52206.
 1.26 10-May-2017  sevan Revert previous change so builds can resume.
_KERNTYPES needs to be defined for NetBSD builds to succeed.
_KERNTYPES must not be defined for buildrum.sh builds to succeed.
 1.25 10-May-2017  sevan Do not define _KERNTYPES as this breaks build with buildrump.sh due to
conflicting types for register_t.
Closes PR kern/52206
Steered in the right direction by christos.
 1.24 23-Jan-2016  christos branches: 1.24.6;
Define _KERNTYPES for things that need it.
 1.23 09-Nov-2014  pooka Move rump kernel man pages from various sources to sys/rump

namely:
* src/lib is used only when building for POSIX'y platforms, but
the man pages have their use for all platforms
* rumpuser.3 is a function of the rump kernel, not one of the of
the POSIX'y implementation hosted in src/lib/librumpuser

no functional change
 1.22 28-Oct-2014  pooka Don't install rumpuser.h here.

It's already installed by the rump kernel build (sys/rump/include/rump)
 1.21 22-Jul-2014  justin Clean up random implementation for librumpuser

Use /dev/urandom for platforms without arc4random, not srandom(),
deduplicate code, do not read excessive random bytes

Reviewed by pooka@
 1.20 11-Jul-2014  justin Add a fiber based implementation of librumpuser in addition to the
default pthreads based version.

Discussed with pooka@
 1.19 09-Jul-2014  justin Split out file and memory access in librumpuser

This allows alternate implementations to reuse these parts, and the file
parts will at the next hypercall revision be moved to their own driver.

Discussed with pooka@
 1.18 17-Jun-2014  alnsn Antti objected to including rumpuser_sync_icache. Exclude it from the build.
 1.17 17-Jun-2014  alnsn Implement rumpuser_sync_icache hypercall.
 1.16 20-Feb-2014  pooka branches: 1.16.2;
Translate signal numbers between rump kernel and (POSIX) host.
 1.15 10-Sep-2013  pooka Install rumpuser_port.h
 1.14 15-May-2013  pooka also, bsd.own.mk to pick up mk.conf
 1.13 15-May-2013  pooka Make it possible for external parties to specify additional dplibs.
This is useful for example on platforms which require -ldl.
 1.12 30-Apr-2013  pooka put optional modules on a separate SRCS line
 1.11 30-Apr-2013  pooka Translate error codes between the hypervisor and rump kernel.
 1.10 29-Apr-2013  pooka Rework how the bio hypercalls work, part 1/n:

Reduce the set of hypercalls to one: "do block i/o". This not only
eliminates a lot of pseudo-duplicate code, it also gives the
hypervisor a lot more freedom on how to optimize the i/o.
 1.9 18-Mar-2013  pooka Move the rumpuser_net set of hypercalls to be a private to the sockin
component. This cleans up the generic hypercall interfaces from ones
specific to only one component. They should always have been private,
but the infrastructure to "make it so" didn't exist earlier.

no functional change
 1.8 01-Mar-2013  pooka Add interfaces that out-of-librumpuser hypercalls can use to unschedule
and reschedule themselves if they plan to block.
 1.7 01-Mar-2013  pooka limit use of rumpuser.h to where it is meant to be used from
 1.6 21-Mar-2012  matt branches: 1.6.2;
These directories default to WARNS?=5
 1.5 30-Nov-2010  pooka branches: 1.5.6;
Require server to be explicitly initialized with rump_init_server(url).
Also, add rump_daemonize_begin() / rump_daemonize_end() to help
with the "can't daemon() after pthread_create()" problem. Applications
could accomplish the same, but since it's such a common operation,
provide a little help.
 1.4 30-Nov-2010  pooka add commented-out -D_DIAGNOSTIC
 1.3 27-Oct-2010  pooka Start rework of system call proxying over socket ("sysproxy").
This incarnation is written in the user namespace as opposed to
the previous one which was done in kernel namespace. Also, rump
does all the handshaking now instead of excepting an application
to come up with the user namespace socket.

There's still a lot to do, including making code "a bit" more
robust, actually running different clients in a different process
inside the kernel and splitting the client side library from librump.
I'm committing this now so that I don't lose it, plus it generally
works as long as you don't use it in unexcepted ways: i've tested
ifconfig(8), route(8), envstat(8) and sysctl(8).
 1.2 26-Feb-2010  pooka librumpuser is not _KERNEL code and does not belong in sys. Move
the source files from src/sys/rump/librump/rumpuser to src/lib/librumpuser
(from where it is already built). Even so, keep rumpuser.h in
sys/rump/include for kernel source tree self-containment.
 1.1 29-Jul-2008  pooka branches: 1.1.2;
Install rump libraries and utilities to the base system and remove the
private non-installed build infrastructure from sys/rump.

breakdown of commit:
* install relevant headers into /usr/include/rump
* build sys/rump/librump/rumpuser and sys/rump/librump/rumpkern
from src/lib and install as librumpuser and librump, respectively
+ this retains the ability to test a librump build with just the
kernel sources at hand
* move sys/rump/fs/lib/libukfs and sys/rump/fs/lib/libp2k to src/lib
for general consumption, they are not kernel-space dwellers anyway
* build and install sys/rump/fs/lib/lib$fs as librumpfs_$fs
* add chapter 3 manual pages for rump, rumpuser, ukfs and p2k
* build and install userspace kernel file system daemons if MKPUFFS=yes
is spexified
* retire fsconsole for now, it will make a comeback with an actually
implemented version shortly
 1.1.2.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.1.2.1 29-Jul-2008  wrstuden file Makefile was added on branch wrstuden-revivesa on 2008-09-18 04:39:25 +0000
 1.5.6.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.5.6.1 17-Apr-2012  yamt sync with head
 1.6.2.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.6.2.1 23-Jun-2013  tls resync from head
 1.16.2.1 10-Aug-2014  tls Rebase.
 1.24.6.2 19-May-2017  pgoyette Resolve conflicts from previous merge (all resulting from $NetBSD
keywork expansion)
 1.24.6.1 11-May-2017  pgoyette Sync with HEAD
 1.27.10.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.3 05-Jul-2023  lukem mk.conf(5): document rump variables

Update mk.conf(5) with the rump variables from
- lib/librumpuser/README.compileopts
- sys/rump/README.compileopts

Add cross-references back to mk.conf(5) in those files.

Ensure that the Default: is listed last in a description,
for consistency with the convention in this file.
 1.2 02-Aug-2021  andvar fix typo in README.compileopts text.
 1.1 25-Jan-2016  pooka Move librumpuser compile-time options into the librumpuser source
directory. Those options apply only for the in-tree implementation.
 1.1 03-Apr-2013  agc branches: 1.1.2;
file Version.map was initially added on branch agc-symver.
 1.1.2.1 03-Apr-2013  agc Add symbol versioning information for the following libraries:

libbluetooth
libbsdmalloc
libexecinfo
libform
libintl
libipsec
libkvm
liblwres
libnpf
libp2k
libpci
libperfuse
libppath
libprop
libpuffs
librefuse
librpcsvc
librt
librumpclient
librumphijack
librumpuser
libukfs
libusbhid
libwrap
 1.7 16-Oct-2024  ozaki-r librumpuser: regen (autoreconf -iv)
 1.6 15-Jul-2023  lukem branches: 1.6.2;
librumpuser/configure: regen for URL fixes
 1.5 05-Mar-2015  pooka check for utimensat
 1.4 03-Jan-2015  pooka check that sys/cdefs.h builds with -Werror (not the case on alpine linux
where it contains an unconditional #warning)
 1.3 05-Nov-2014  pooka check for clock_gettime from librt too
 1.2 05-Nov-2014  pooka actually check for clock_nanosleep()
 1.1 04-Nov-2014  pooka Use autoconf for rump kernel posix hypercall layer.

This gets rid of homegrown hacks and puts all probes in one place.

Tested for NetBSD (build.sh + anita) and Linux (buildrump.sh)
 1.6.2.1 02-Aug-2025  perseant Sync with HEAD
 1.8 16-Oct-2024  ozaki-r librumpuser/configure.ac: check preadv and pwritev
 1.7 15-Jul-2023  lukem branches: 1.7.2;
librumpuser/configure: fix missing directory warning

Use "build-aux" instead of the non-existant "m4" as the
directory for AC_CONFIG_MACRO_DIR.

Avoids autoreconf warning:
aclocal: warning: couldn't open directory 'm4': No such file or directory

No change to generated files.
 1.6 14-Jul-2023  lukem fix rump URLs

Link to https://github.com/rumpkernel/ instead of
a site now taken over by an SEO squatter.

Per discussion on github.com/rumpkernel issues with pooka.

PR misc/57501
 1.5 05-Mar-2015  pooka branches: 1.5.26;
check for utimensat
 1.4 03-Jan-2015  pooka check that sys/cdefs.h builds with -Werror (not the case on alpine linux
where it contains an unconditional #warning)
 1.3 05-Nov-2014  pooka check for clock_gettime from librt too
 1.2 05-Nov-2014  pooka actually check for clock_nanosleep()
 1.1 04-Nov-2014  pooka Use autoconf for rump kernel posix hypercall layer.

This gets rid of homegrown hacks and puts all probes in one place.

Tested for NetBSD (build.sh + anita) and Linux (buildrump.sh)
 1.5.26.1 20-Sep-2024  martin Pull up following revision(s) (requested by rin in ticket #889):

lib/librumpuser/configure.ac: revision 1.6
lib/librumpuser/rumpuser_port.h: revision 1.53
lib/libpthread/Makefile: revision 1.97
sys/rump/share/man/man3/rumpuser.3: revision 1.4
sys/rump/share/man/man7/rumpkernel.7: revision 1.4
sys/rump/share/man/man7/rumpkernel.7: revision 1.5

fix rump URLs in man pages

Link to https://github.com/rumpkernel/wiki/wiki instead of
a site now taken over by an SEO squatter.
Per discussion on github.com/rumpkernel issues
with pooka.
PR misc/57501

fix rump URLs
Link to https://github.com/rumpkernel/ instead of
a site now taken over by an SEO squatter.
Per discussion on github.com/rumpkernel issues with pooka.
PR misc/57501

use rumpkernel.github.io as the entry point
 1.7.2.1 02-Aug-2025  perseant Sync with HEAD
 1.13 27-Dec-2017  ozaki-r Distinguish spin mutex and adaptive mutex on rump kernels for LOCKDEBUG

Formerly rump kernels treated the two types of mutexes as both adaptive for
LOCKDEBUG for some reasons.

Now we can detect violations of mutex restrictions on rump kernels such as
taking an adaptive mutex with holding a spin mutex as well as normal kernels.
 1.12 15-Feb-2015  justin branches: 1.12.8;
Minor fixes to types and includes
 1.11 13-Feb-2015  justin Whitespace fixes, no functional change
 1.10 13-Feb-2015  justin Fix some return value checks
 1.9 29-Dec-2014  justin Just abort on currently unsupported functions.
 1.8 08-Nov-2014  justin Remove superfluous getcontext()
 1.7 08-Nov-2014  justin Move makecontext into function with getcontext for consistency
 1.6 08-Nov-2014  justin Fix some error handling cases.
 1.5 05-Nov-2014  pooka assert that clock_gettime() does not fail
 1.4 24-Aug-2014  pooka RCS Id police (because we can. or have you heard of git id police?)
 1.3 25-Jul-2014  justin branches: 1.3.2; 1.3.6;
Clean up error handling in rumpuser_init()
 1.2 22-Jul-2014  justin Clean up random implementation for librumpuser

Use /dev/urandom for platforms without arc4random, not srandom(),
deduplicate code, do not read excessive random bytes

Reviewed by pooka@
 1.1 11-Jul-2014  justin Add a fiber based implementation of librumpuser in addition to the
default pthreads based version.

Discussed with pooka@
 1.3.6.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.3.6.1 25-Jul-2014  tls file rumpfiber.c was added on branch tls-maxphys on 2014-08-20 00:02:21 +0000
 1.3.2.2 10-Aug-2014  tls Rebase.
 1.3.2.1 25-Jul-2014  tls file rumpfiber.c was added on branch tls-earlyentropy on 2014-08-10 06:52:25 +0000
 1.12.8.1 13-Jan-2018  snj Pull up following revision(s) (requested by ozaki-r in ticket #495):
lib/librumpuser/rumpfiber.c: revision 1.13
lib/librumpuser/rumpuser_pth.c: revision 1.46
lib/librumpuser/rumpuser_pth_dummy.c: revision 1.18
sys/kern/kern_condvar.c: revision 1.40
sys/kern/kern_lock.c: revision 1.161
sys/kern/kern_mutex.c: revision 1.68
sys/kern/kern_rwlock.c: revision 1.48
sys/rump/include/rump/rumpuser.h: revision 1.115
sys/rump/librump/rumpkern/locks.c: revision 1.76-1.79
Apply C99-style struct initialization to lockops_t
--
Tweak LOCKDEBUG macros (NFC)
--
Distinguish spin mutex and adaptive mutex on rump kernels for LOCKDEBUG
Formerly rump kernels treated the two types of mutexes as both adaptive for
LOCKDEBUG for some reasons.
Now we can detect violations of mutex restrictions on rump kernels such as
taking an adaptive mutex with holding a spin mutex as well as normal kernels.
--
rump: check if the mutex is surely owned by the caller in mutex_exit
Unlocking a not-owned mutex wasn't detected well (it could detect if the mutex
is not held by anyone but that's not enough). Let's check it (the check is the
same as normal kernel's mutex).
If LOCKDEBUG is enabled, give the check over LOCKDEBUG because it can provide
better debugging information.
 1.4 15-Feb-2015  justin Minor fixes to types and includes
 1.3 29-Dec-2014  justin Just abort on currently unsupported functions.
 1.2 24-Aug-2014  pooka RCS Id police (because we can. or have you heard of git id police?)
 1.1 11-Jul-2014  justin branches: 1.1.2; 1.1.6;
Add a fiber based implementation of librumpuser in addition to the
default pthreads based version.

Discussed with pooka@
 1.1.6.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.6.1 11-Jul-2014  tls file rumpfiber.h was added on branch tls-maxphys on 2014-08-20 00:02:21 +0000
 1.1.2.2 10-Aug-2014  tls Rebase.
 1.1.2.1 11-Jul-2014  tls file rumpfiber.h was added on branch tls-earlyentropy on 2014-08-10 06:52:25 +0000
 1.5 04-Nov-2014  pooka Use autoconf for rump kernel posix hypercall layer.

This gets rid of homegrown hacks and puts all probes in one place.

Tested for NetBSD (build.sh + anita) and Linux (buildrump.sh)
 1.4 25-Aug-2014  justin lso translate errno in the rumpfiber version
 1.3 24-Aug-2014  pooka RCS Id police (because we can. or have you heard of git id police?)
 1.2 20-Aug-2014  justin Add missing include
 1.1 11-Jul-2014  justin branches: 1.1.2; 1.1.6;
Add a fiber based implementation of librumpuser in addition to the
default pthreads based version.

Discussed with pooka@
 1.1.6.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.6.1 11-Jul-2014  tls file rumpfiber_bio.c was added on branch tls-maxphys on 2014-08-20 00:02:21 +0000
 1.1.2.2 10-Aug-2014  tls Rebase.
 1.1.2.1 11-Jul-2014  tls file rumpfiber_bio.c was added on branch tls-earlyentropy on 2014-08-10 06:52:25 +0000
 1.4 15-Feb-2015  justin Minor fixes to types and includes
 1.3 29-Dec-2014  justin Just abort on currently unsupported functions.
 1.2 24-Aug-2014  pooka RCS Id police (because we can. or have you heard of git id police?)
 1.1 11-Jul-2014  justin branches: 1.1.2; 1.1.6;
Add a fiber based implementation of librumpuser in addition to the
default pthreads based version.

Discussed with pooka@
 1.1.6.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.6.1 11-Jul-2014  tls file rumpfiber_sp.c was added on branch tls-maxphys on 2014-08-20 00:02:21 +0000
 1.1.2.2 10-Aug-2014  tls Rebase.
 1.1.2.1 11-Jul-2014  tls file rumpfiber_sp.c was added on branch tls-earlyentropy on 2014-08-10 06:52:25 +0000
 1.20 09-Nov-2014  pooka Move rump kernel man pages from various sources to sys/rump

namely:
* src/lib is used only when building for POSIX'y platforms, but
the man pages have their use for all platforms
* rumpuser.3 is a function of the rump kernel, not one of the of
the POSIX'y implementation hosted in src/lib/librumpuser

no functional change
 1.19 24-Aug-2014  pooka * attempt to clarify what "POSIX" means
* link to Platforms page on wiki for a list of known implementation
 1.18 20-Feb-2014  pooka document rumpuser_kill()
 1.17 14-Feb-2014  pooka minor clarification: rumpuser_thread_create() is used to create the host
thread context for kernel threads, never for application threads.

per discussion with justin
 1.16 22-Jul-2013  njoly Use <major>.<minor> for NetBSD version.
 1.15 15-May-2013  wiz branches: 1.15.2;
More markup, less typos.
 1.14 15-May-2013  pooka Improve documentation on the locking order of cv_wait mtx/cpu.
 1.13 15-May-2013  pooka Add a generalized rumpuser_syncfd() call which allows the caller
to request a sync or a barrier for fd.
 1.12 15-May-2013  pooka Pass off_t over the hypercall interface as int64_t to avoid potential
problems in setups where off_t doesn't want to be 64bit.

I'm already excitedly waiting for 128bit off_t and _LARGE_LARGE_FILES
 1.11 15-May-2013  pooka Pass enums over the hypercall interface as ints to avoid some
pathological scenarios from arising in setups where enums might be
of a different size in the rump kernel and hypervisor.
 1.10 15-May-2013  pooka Add RUMPUSER_LWP_CLEAR instead of overloading RUMPUSER_LWP_SET.
This simplifies some alternative hypervisor implementations.
 1.9 03-May-2013  wiz Fix some punctuation nits and bump date for previous.
 1.8 02-May-2013  pooka update for previous change
 1.7 02-May-2013  pooka Push rwlock upgrade and downgrade into the hypervisor where there's
at least a chance to implement them with minimal fuss.
 1.6 02-May-2013  pooka Inform the rump kernel hypervisor of valid thread contexts so
that the implementation can allocate and release storage for them
in an optimal fashion, if necessary.
 1.5 02-May-2013  pooka add HISTORY
 1.4 02-May-2013  pooka expand the intended usage of rumpuser_open()
 1.3 30-Apr-2013  pooka document the hypercall interface
 1.2 01-Mar-2010  pooka branches: 1.2.6; 1.2.12;
Join today's manpage mania by updating this to reflect the current
situation a "little" better.
 1.1 26-Feb-2010  pooka librumpuser is not _KERNEL code and does not belong in sys. Move
the source files from src/sys/rump/librump/rumpuser to src/lib/librumpuser
(from where it is already built). Even so, keep rumpuser.h in
sys/rump/include for kernel source tree self-containment.
 1.2.12.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.12.1 23-Jun-2013  tls resync from head
 1.2.6.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.15.2.1 23-Jul-2013  riastradh sync with HEAD
 1.68 24-Sep-2023  martin PR kern/57626: instead of an (arbitrary) FAKE_PAGE_SHIFT (and always
using 4k pages), query the hypervisor for the real page size of the host
kernel and use that for architectures that do not have compile time
constant page sizes.
 1.67 16-Aug-2015  pooka Fix return value inspection for clock_nanosleep() (not displayed in the
diff, need to look at the entire file for context).

from Robert Millan <rmh@freebsd.org> via rumpkernel-users
 1.66 27-Jul-2015  pooka Print the "halted\n" from previous commit to stdout, not stderr.

The putchar hypercall writes to stdout, so this change restores
the original "functionality" (which was not intended to change).

from gson, via tests
 1.65 24-Jul-2015  pooka Since the rump kernel does not know when the container it's running in
actually halts, print "halted" in the hypercall.
 1.64 05-Nov-2014  pooka check clock_gettime() rv
 1.63 25-Jul-2014  justin Clean up error handling in rumpuser_init()
 1.62 22-Jul-2014  justin Clean up random implementation for librumpuser

Use /dev/urandom for platforms without arc4random, not srandom(),
deduplicate code, do not read excessive random bytes

Reviewed by pooka@
 1.61 10-Jul-2014  justin Reinstate include of netdb.h, needed on some cross builds
 1.60 09-Jul-2014  justin Split out file and memory access in librumpuser

This allows alternate implementations to reuse these parts, and the file
parts will at the next hypercall revision be moved to their own driver.

Discussed with pooka@
 1.59 02-Apr-2014  pooka branches: 1.59.2;
Always use sysconf() to query host processor count instead of separate
tricks for each platform.
 1.58 16-Mar-2014  njoly Do not use uninitialized pointer if posix_memalign() fails.
 1.57 20-Feb-2014  pooka make implementation of rumpuser_kill() match the documentation
 1.56 20-Feb-2014  pooka Translate signal numbers between rump kernel and (POSIX) host.
 1.55 27-Oct-2013  rmind librumpuser: add some #ifdef __APPLE__ and missing bits to build it on OS X.
OK pooka@
 1.54 14-Aug-2013  pooka Change the default value of rump kernels CPUs to 2. It used to be
the number of host cores, but that value is overkill for most uses,
especially with massively multicore hosts. Dozens of useless virtual
CPUs are relatively speaking expensive in terms of bootstrap time and
memory footprint. On the other end of the spectrum, defaulting to 2
might shake out some bugs from the qemu test runs.
 1.53 15-May-2013  pooka Add a generalized rumpuser_syncfd() call which allows the caller
to request a sync or a barrier for fd.
 1.52 15-May-2013  pooka Pass off_t over the hypercall interface as int64_t to avoid potential
problems in setups where off_t doesn't want to be 64bit.

I'm already excitedly waiting for 128bit off_t and _LARGE_LARGE_FILES
 1.51 15-May-2013  pooka Pass enums over the hypercall interface as ints to avoid some
pathological scenarios from arising in setups where enums might be
of a different size in the rump kernel and hypervisor.
 1.50 02-May-2013  pooka Ok, maybe using int64 for nanoseconds in the (sec,nsec) tuple was
a bit too future-proof. I think long is enough there (let's just
hope nobody redefines "nano"). Also, make seconds signed just in
case someone wants their clock to be in 1901.
 1.49 01-May-2013  pooka avoid Wunused on !NetBSD
 1.48 30-Apr-2013  pooka Flip parameter order in the clock hypercalls to make them consistent
with everything else wrt in/out parameters.
 1.47 30-Apr-2013  pooka Translate error codes between the hypervisor and rump kernel.
 1.46 30-Apr-2013  pooka Some systems don't provide preadv/pwritev (hi Solaris!), so implement
that with lseek + readv/writev instead (and avoid rewinding the
pointer with soon-to-be documentation).
 1.45 30-Apr-2013  pooka Make hypercall calling conventions consistent: iff a hypercall can fail,
it returns an int containing the error value.
 1.44 29-Apr-2013  pooka Reduce hypercalls related to reading to essentially an amalgamation
of readv and preadv. ditto for writing. Hypercalls are so seldomly
used that it doesn't justify 3x the calls for syntactic sugar.
 1.43 29-Apr-2013  pooka Replace the various "get info from hypervisor" interfaces with one
unified rumpuser_getparam(), and make it return a plist. The
contents can come e.g. from the env or a config file. Make
identifiers starting with an underscore denote system identifiers
which must be implemented by hypervisor. (yea, j/k about the plist bit)
 1.42 29-Apr-2013  pooka The fsync hypercall is now used only with close, so get rid of it.
rumpuser_bio() should do the necessary syncing.
 1.41 29-Apr-2013  pooka Make the rump kernel upcalls which were previous available only to
the sysproxy module available for the entire hypervisor.
 1.40 29-Apr-2013  pooka RUMPUSER_OPEN_DIRECT is no longer necessary
 1.39 29-Apr-2013  pooka changes to bio hypercalls, part 3/n:

retire the filemmap/memsync hypercalls, they're no longer used
 1.38 29-Apr-2013  pooka Rework how the bio hypercalls work, part 1/n:

Reduce the set of hypercalls to one: "do block i/o". This not only
eliminates a lot of pseudo-duplicate code, it also gives the
hypervisor a lot more freedom on how to optimize the i/o.
 1.37 28-Apr-2013  pooka don't need event.h here anymore
 1.36 28-Apr-2013  pooka Improve the time-related hypercalls so that's it's possible to
sleep until an absolute time on the host's monotonic clock (should
something like that be supported).
 1.35 28-Apr-2013  pooka make the file monitoring hypercalls private to shmif
 1.34 28-Apr-2013  pooka The ioctl hypercall is used only by the usb host controller driver,
so make it exclusive to that component. I'm happy to see it gone.
 1.33 27-Apr-2013  pooka make the random hypercall more generic
 1.32 27-Apr-2013  pooka * treat kern_malloc.c as an unreal allocator (it's so lightweight)
* get rid of the rumpuser_realloc() hypercall
* pass size to rumpuser_free()
 1.31 27-Apr-2013  pooka rumpuser_poll() is used only by sockin, so make the hypercall
private to that component.
 1.30 27-Apr-2013  pooka * integrate rumpuser_getversion() with the hypervisor initialization
* rename some identifiers to better match reality
 1.29 18-Mar-2013  pooka Terminate result of readlink(). Makes writefilewatch_setup() work in
cases when the buffer doesn't accidentally contain suitable zeroes.

Thanks to Juan RP who debugged this with me!
 1.28 14-Jan-2013  pooka Use the /proc way for counting host cores on Cygwin.
 1.27 10-Jan-2013  pooka .. and make it compile on said platforms.
 1.26 10-Jan-2013  pooka Provide an implementation of writewatchfile for platforms without kqueue
or inotify (it's a rather simple implementation ;)
 1.25 14-Dec-2012  pooka FreeBSD and DragonFly also provide hosts cpus via sysctl hw.ncpu.
 1.24 13-Dec-2012  pooka Apparently MAP_ANON mmap() on Linux requires MAP_PRIVATE to be specified
for the addr parameter to have a sane effect. Make it so.
 1.23 18-Nov-2012  pooka Fixes for Solarisa.
 1.22 14-Nov-2012  pooka Check return value of ftruncate(). Some versions of gcc give
warnings if I don't.
 1.21 10-Oct-2012  pooka Implement the writewatchfile routines for a Linux hypervisor. As a
result, the shmif network driver now works when hosted on Linux.
 1.20 14-Sep-2012  pooka Do not assume that O_FOO flags have matching values in the rump kernel
and hypervisor.
 1.19 25-Aug-2012  pooka branches: 1.19.2;
Make librumphijack compile and work on Linux. Do not try to hijack
calls which are not supported on Linux and therefore cannot be
handled by the rump kernel side syscall emulation (not that they'd
be present in the calling binaries anyway).
 1.18 27-Jul-2012  pooka Once again, make the rump kernel hypercall layer work on Linux.
 1.17 25-Jun-2012  abs Update old-style definitions to ANSI, remove a couple of register
definitions along the way. Fixed gcc 4.1 build (thank you vax)
 1.16 28-Nov-2011  tls Remove arc4random() and arc4randbytes() from the kernel API. Replace
arc4random() hacks in rump with stubs that call the host arc4random() to
get numbers that are hopefully actually random (arc4random() keyed with
stack junk is not). This should fix some of the currently failing anita
tests -- we should no longer generate duplicate "random" MAC addresses in
the test environment.
 1.15 06-Feb-2011  pooka branches: 1.15.4;
Support query of the partition size in case underlying device is
a wedge. This still lacks the proplibistic query of the sector
size and just assumes 512. It's good that we make asking a file's
size as simple as requiring one stat(), one open() and three (3)
different ioctls plus some proplist mumbojumbo. I'm surprised it's
available at all by means other than #wish.

code mostly from Taylor R Campbell, rant from me.
 1.14 22-Jan-2011  pooka happiness is a quiet lint
 1.13 20-Jan-2011  pooka include pid of rump server in hostname
 1.12 05-Jan-2011  pooka branches: 1.12.2;
Fix fd leak also in non-NetBSD code path.
 1.11 05-Jan-2011  wiz Fix fdleak in error case. Found by cppcheck.
 1.10 15-Nov-2010  pooka Make int *error and optional parameter (i.e. it can be NULL).
Sometimes the caller just doesn't care which errno close() might
throw.
 1.9 11-Aug-2010  pooka * if kevent() fails with EINTR, try again instead of returning an error
* stuff rumpuser_dprintf to stderr instead of stdout
 1.8 09-Jun-2010  pooka Version rumpuser ABI with a lightweight mechanism.
 1.7 09-Jun-2010  pooka Add the ability to specify a preferred address the "map anon memory"
hypercall.
 1.6 02-Jun-2010  pooka Check return value of posix_memalign ... always helpful to not return
garbage memory in case of failure.
 1.5 01-Jun-2010  pooka Don't pass "canfail" down to rumpuser_malloc -- there's quite little
we can do with that info way down there. Instead, pass alignment.
Implement rumpuser_malloc() with posix_memalign().
 1.4 28-Apr-2010  pooka Add rumpuser interface to fetch number of host cpus.
 1.3 21-Apr-2010  pooka Actually, support rumpuser_kill() only on NetBSD, since signal
numbers may not match on non-NetBSD hosts.
 1.2 21-Apr-2010  pooka Add rumpuser_kill, which sends a signal to a host process.
 1.1 26-Feb-2010  pooka librumpuser is not _KERNEL code and does not belong in sys. Move
the source files from src/sys/rump/librump/rumpuser to src/lib/librumpuser
(from where it is already built). Even so, keep rumpuser.h in
sys/rump/include for kernel source tree self-containment.
 1.12.2.1 08-Feb-2011  bouyer Sync with HEAD
 1.15.4.5 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.15.4.4 23-Jan-2013  yamt sync with head
 1.15.4.3 16-Jan-2013  yamt sync with (a bit old) head
 1.15.4.2 30-Oct-2012  yamt sync with head
 1.15.4.1 17-Apr-2012  yamt sync with head
 1.19.2.4 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.19.2.3 23-Jun-2013  tls resync from head
 1.19.2.2 25-Feb-2013  tls resync with head
 1.19.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.59.2.1 10-Aug-2014  tls Rebase.
 1.10 04-Nov-2014  pooka Use autoconf for rump kernel posix hypercall layer.

This gets rid of homegrown hacks and puts all probes in one place.

Tested for NetBSD (build.sh + anita) and Linux (buildrump.sh)
 1.9 25-Aug-2014  justin Add errno translation for bio operations
 1.8 16-Jun-2014  alnsn Add __RCSID.
 1.7 15-May-2013  pooka branches: 1.7.2; 1.7.6; 1.7.8;
Pass off_t over the hypercall interface as int64_t to avoid potential
problems in setups where off_t doesn't want to be 64bit.

I'm already excitedly waiting for 128bit off_t and _LARGE_LARGE_FILES
 1.6 07-May-2013  pooka include stdint.h before rumpuser.h (on some platforms it doesn't get
there automagically)
 1.5 29-Apr-2013  pooka Create a kernel thread context for the bio upcalls.
 1.4 29-Apr-2013  pooka Make the rump kernel upcalls which were previous available only to
the sysproxy module available for the entire hypervisor.
 1.3 29-Apr-2013  pooka set default bio mode to threaded
 1.2 29-Apr-2013  pooka unschedule around blocking i/o
 1.1 29-Apr-2013  pooka Rework how the bio hypercalls work, part 1/n:

Reduce the set of hypercalls to one: "do block i/o". This not only
eliminates a lot of pseudo-duplicate code, it also gives the
hypervisor a lot more freedom on how to optimize the i/o.
 1.7.8.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.7.8.1 15-May-2013  yamt file rumpuser_bio.c was added on branch yamt-pagecache on 2014-05-22 11:37:00 +0000
 1.7.6.1 10-Aug-2014  tls Rebase.
 1.7.2.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.7.2.2 23-Jun-2013  tls resync from head
 1.7.2.1 15-May-2013  tls file rumpuser_bio.c was added on branch tls-maxphys on 2013-06-23 06:21:08 +0000
 1.2 14-Jul-2014  alnsn Remove unused file.
 1.1 17-Jun-2014  alnsn Implement rumpuser_sync_icache hypercall.
 1.6 07-May-2013  pooka branches: 1.6.2; 1.6.8;
include stdint.h before rumpuser.h (on some platforms it doesn't get
there automagically)
 1.5 30-Apr-2013  pooka Translate error codes between the hypervisor and rump kernel.
 1.4 29-Apr-2013  pooka Give private hypercalls the ability to meddle with kthread contexts too.
 1.3 29-Apr-2013  pooka Make the rump kernel upcalls which were previous available only to
the sysproxy module available for the entire hypervisor.
 1.2 27-Apr-2013  pooka * integrate rumpuser_getversion() with the hypervisor initialization
* rename some identifiers to better match reality
 1.1 01-Mar-2013  pooka Add interfaces that out-of-librumpuser hypercalls can use to unschedule
and reschedule themselves if they plan to block.
 1.6.8.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.6.8.1 07-May-2013  yamt file rumpuser_component.c was added on branch yamt-pagecache on 2014-05-22 11:37:00 +0000
 1.6.2.2 23-Jun-2013  tls resync from head
 1.6.2.1 07-May-2013  tls file rumpuser_component.c was added on branch tls-maxphys on 2013-06-23 06:21:08 +0000
 1.3 30-Apr-2013  pooka branches: 1.3.2; 1.3.8;
Translate error codes between the hypervisor and rump kernel.
 1.2 29-Apr-2013  pooka Give private hypercalls the ability to meddle with kthread contexts too.
 1.1 01-Mar-2013  pooka Add interfaces that out-of-librumpuser hypercalls can use to unschedule
and reschedule themselves if they plan to block.
 1.3.8.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.3.8.1 30-Apr-2013  yamt file rumpuser_component.h was added on branch yamt-pagecache on 2014-05-22 11:37:00 +0000
 1.3.2.2 23-Jun-2013  tls resync from head
 1.3.2.1 30-Apr-2013  tls file rumpuser_component.h was added on branch tls-maxphys on 2013-06-23 06:21:08 +0000
 1.5 16-Oct-2024  ozaki-r librumpuser: regen (autoreconf -iv)
 1.4 05-Mar-2015  pooka branches: 1.4.28;
check for utimensat
 1.3 05-Nov-2014  pooka check for clock_gettime from librt too
 1.2 05-Nov-2014  pooka actually check for clock_nanosleep()
 1.1 04-Nov-2014  pooka Use autoconf for rump kernel posix hypercall layer.

This gets rid of homegrown hacks and puts all probes in one place.

Tested for NetBSD (build.sh + anita) and Linux (buildrump.sh)
 1.4.28.1 02-Aug-2025  perseant Sync with HEAD
 1.10 04-Apr-2024  riastradh Temporarily make PR t_sp:sigsafe noisier.

This is an attempt to diagnose why it's flaky in the releng testbeds
but not when I run it. This change will be backed out once we get
new testbed output.
 1.9 04-Apr-2024  riastradh rumpuser(3): New RUMP_STDOUT, RUMP_STDERR environment variables.

If set, then when rump daemonizes, it opens the path in RUMP_STDOUT
and redirects fd 1 to that (which mostly gets the kernel console
output), and opens the path in RUMP_STDERR and redirects fd 2 to that
(no idea what this gets but it's probably good to record if it ever
gets anything).

This will allow tests that rely on rump_server daemons to stash the
output for diagnostics in case, e.g., the rump kernel crashes.

PR bin/58112
 1.8 03-Aug-2023  andvar fix typos in comments and one definition, mainly s/sucket/socket/.
 1.7 04-Nov-2014  pooka branches: 1.7.26;
Use autoconf for rump kernel posix hypercall layer.

This gets rid of homegrown hacks and puts all probes in one place.

Tested for NetBSD (build.sh + anita) and Linux (buildrump.sh)
 1.6 07-May-2013  pooka include stdint.h before rumpuser.h (on some platforms it doesn't get
there automagically)
 1.5 30-Apr-2013  pooka Translate error codes between the hypervisor and rump kernel.
 1.4 18-Nov-2012  pooka Fixes for Solarisa.
 1.3 27-Jul-2012  pooka branches: 1.3.2;
Once again, make the rump kernel hypercall layer work on Linux.
 1.2 22-Jan-2011  pooka branches: 1.2.4;
shush lint
 1.1 30-Nov-2010  pooka branches: 1.1.2;
Require server to be explicitly initialized with rump_init_server(url).
Also, add rump_daemonize_begin() / rump_daemonize_end() to help
with the "can't daemon() after pthread_create()" problem. Applications
could accomplish the same, but since it's such a common operation,
provide a little help.
 1.1.2.1 08-Feb-2011  bouyer Sync with HEAD
 1.2.4.3 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.2.4.2 16-Jan-2013  yamt sync with (a bit old) head
 1.2.4.1 30-Oct-2012  yamt sync with head
 1.3.2.2 23-Jun-2013  tls resync from head
 1.3.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.7.26.1 11-Sep-2024  martin Pull up following revision(s) (requested by rin in ticket #824):

lib/librumpuser/rumpuser_daemonize.c: revision 1.9
lib/librumpuser/rumpuser_daemonize.c: revision 1.10

rumpuser(3): New RUMP_STDOUT, RUMP_STDERR environment variables.

If set, then when rump daemonizes, it opens the path in RUMP_STDOUT
and redirects fd 1 to that (which mostly gets the kernel console
output), and opens the path in RUMP_STDERR and redirects fd 2 to that
(no idea what this gets but it's probably good to record if it ever
gets anything).

This will allow tests that rely on rump_server daemons to stash the
output for diagnostics in case, e.g., the rump kernel crashes.
PR bin/58112
 1.34 19-Apr-2022  rillig lib: remove CONSTCOND comment

Since 2021-01-31, lint doesn't need it anymore for the common pattern of
'do ... while (0)'.
 1.33 22-Mar-2020  pgoyette Teach rump to process __link_set_evcnts entries. (Second part of
fix for PR kern/55088)
 1.32 21-Mar-2020  pgoyette Teach rump how to process __link_set_sysctl_funcs so it can handle
modules the same as a real kernel.

Partly addresses PR kern/55088 - __link_set_evcnts not yet handled
(that will happen later)
 1.31 26-Dec-2019  msaitoh s/lenght/length/
 1.30 04-Nov-2014  pooka branches: 1.30.16;
Use autoconf for rump kernel posix hypercall layer.

This gets rid of homegrown hacks and puts all probes in one place.

Tested for NetBSD (build.sh + anita) and Linux (buildrump.sh)
 1.29 27-Apr-2014  pooka weak alias removal implication: rumpuser_dl_globalsym() can now sleep
with the fishes.
 1.28 02-Apr-2014  justin branches: 1.28.2;
Add Android support for rump kernel.

Reviewed by pooka@
 1.27 14-Mar-2014  justin If dlopen returns NULL assume we are statically linked and return,
rather than getting a warning when dlinfo fails.
 1.26 13-Mar-2014  pooka Do not process linkmaps if there is exactly one link map present
(i.e. there is no ld.so). Makes statically linked rump kernels work on
glibc (at least for me).

based on some discussion with Justin Cormack
 1.25 30-Oct-2013  pooka Oh, stdint.h isn't written with a comma ...
 1.24 30-Oct-2013  pooka need to include stdint.h before rump/rumpuser.h
 1.23 30-Oct-2013  pooka glibc on MIPS uses the same DYN d_ptr variant as NetBSD and musl.

from Justin Cormack
 1.22 27-Oct-2013  rmind librumpuser: add some #ifdef __APPLE__ and missing bits to build it on OS X.
OK pooka@
 1.21 30-Jul-2013  pooka comment polish: just musl
 1.20 30-Jul-2013  pooka Decide ET_DYN behavior based on __GLIBC__ instead of __linux__,
e.g. musl libc doesn't follow glibc behavior.

per discussions with a number of people
 1.19 04-Jun-2013  pooka FreeBSD does the Solaris-like map->l_addr boogie.

from Ben Gras
 1.18 29-Apr-2013  pooka Make rumpuser_dl_bootstrap() optional for platforms which don't
provide dynamic linking.
 1.17 20-Mar-2013  pooka Attempt two for the previous: _ILP32 comes from headers, so don't use
it to decide if we want to muddle with _FILE_OFFSET_BITS.
 1.16 20-Mar-2013  pooka Use _FILE_OFFSET_BITS=64 on Solaris too (necessary for 32bit builds).
 1.15 12-Mar-2013  pooka DragonFly is in the Solaris camp in the "how to access ELF DYN at runtime"
valley of joy and love.
 1.14 09-Mar-2013  pooka Tiny fix for Solaris.
 1.13 08-Mar-2013  pooka Ensure that rump kernel component constructors from the main object
get processed. This applies to ones which were linked statically.
Unfortunately, that's where it got a bit tricky, since the dlsym()
interface searches the handle and all its dependencies. For the main
object the list of dependencies includes all the dynamic rump kernel
components that were included when the binary is linked. So, a long
story short, make only one pass through the objects to harvest all the
component entries, weed out the dupes, and initialize components from
an in-memory dupe-free list when so requested.
 1.12 14-Jan-2013  pooka Support Cygwin as a hypervisor.
 1.11 11-Dec-2012  pooka Support binaries which use DT_GNU_HASH instead of DT_HASH.
 1.10 26-Nov-2012  pooka Support DragonFly BSD.
 1.9 26-Nov-2012  pooka const poison is the cure
 1.8 27-Jul-2012  pooka branches: 1.8.2;
Once again, make the rump kernel hypercall layer work on Linux.
 1.7 22-Mar-2011  pooka branches: 1.7.4;
make work on nb5 again
 1.6 16-Mar-2011  njoly Convert hashtab to Elf_Symindx type, and use it directly to get symbol
count. Remove now unused GETVECWORDn macro.

This is needed to make it work on alpha which use non-standard 64bit
values for the symbol hash table section, unlike all other archs.
 1.5 30-Dec-2010  pooka Allow rump kernel to call dlsym(RTLD_DEFAULT).
 1.4 08-Jun-2010  pooka Allow loading the symbols from objects which are not directly mapped
into memory, namely the main object (i.e. map->l_addr is NULL).
 1.3 05-Mar-2010  pooka During bootstrap, process all modinfos in a DSO in one go. Get
rid of dependency tricks, since they are no longer necessary.
 1.2 01-Mar-2010  pooka Introduce RUMP_COMPONENT. It behaves mostly like a simplified
module which is linked into the kernel and cannot be unloaded.
The main purpose is to get the proper constructors run and create
any /dev nodes necessary for said component. Once more of the
kernel (e.g. networking stack and device drivers) are converted to
MODULE and devfs pops up from somewhere, rump components can be
retired.
 1.1 26-Feb-2010  pooka librumpuser is not _KERNEL code and does not belong in sys. Move
the source files from src/sys/rump/librump/rumpuser to src/lib/librumpuser
(from where it is already built). Even so, keep rumpuser.h in
sys/rump/include for kernel source tree self-containment.
 1.7.4.4 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.7.4.3 23-Jan-2013  yamt sync with head
 1.7.4.2 16-Jan-2013  yamt sync with (a bit old) head
 1.7.4.1 30-Oct-2012  yamt sync with head
 1.8.2.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.8.2.2 23-Jun-2013  tls resync from head
 1.8.2.1 25-Feb-2013  tls resync with head
 1.28.2.1 10-Aug-2014  tls Rebase.
 1.30.16.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.1 30-Apr-2013  pooka branches: 1.1.2; 1.1.8;
Translate error codes between the hypervisor and rump kernel.
 1.1.8.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.1.8.1 30-Apr-2013  yamt file rumpuser_errtrans.c was added on branch yamt-pagecache on 2014-05-22 11:37:00 +0000
 1.1.2.2 23-Jun-2013  tls resync from head
 1.1.2.1 30-Apr-2013  tls file rumpuser_errtrans.c was added on branch tls-maxphys on 2013-06-23 06:21:08 +0000
 1.5 16-Oct-2024  ozaki-r librumpuser: use preadv/pwritev if available

Because Calling lseek then readv/writev is racy.
 1.4 04-Nov-2014  pooka branches: 1.4.28;
More finegrained disklabel macro checks, for FreeBSD
 1.3 04-Nov-2014  pooka Use autoconf for rump kernel posix hypercall layer.

This gets rid of homegrown hacks and puts all probes in one place.

Tested for NetBSD (build.sh + anita) and Linux (buildrump.sh)
 1.2 24-Aug-2014  pooka RCS Id police (because we can. or have you heard of git id police?)
 1.1 09-Jul-2014  justin branches: 1.1.2; 1.1.6;
Split out file and memory access in librumpuser

This allows alternate implementations to reuse these parts, and the file
parts will at the next hypercall revision be moved to their own driver.

Discussed with pooka@
 1.1.6.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.6.1 09-Jul-2014  tls file rumpuser_file.c was added on branch tls-maxphys on 2014-08-20 00:02:21 +0000
 1.1.2.2 10-Aug-2014  tls Rebase.
 1.1.2.1 09-Jul-2014  tls file rumpuser_file.c was added on branch tls-earlyentropy on 2014-08-10 06:52:26 +0000
 1.4.28.1 02-Aug-2025  perseant Sync with HEAD
 1.11 19-Apr-2022  rillig lib: remove CONSTCOND comment

Since 2021-01-31, lint doesn't need it anymore for the common pattern of
'do ... while (0)'.
 1.10 22-Jul-2014  justin Clean up random implementation for librumpuser

Use /dev/urandom for platforms without arc4random, not srandom(),
deduplicate code, do not read excessive random bytes

Reviewed by pooka@
 1.9 20-Feb-2014  pooka branches: 1.9.2;
remember to commit this file too
 1.8 30-Apr-2013  pooka Translate error codes between the hypervisor and rump kernel.
 1.7 29-Apr-2013  pooka Make the rump kernel upcalls which were previous available only to
the sysproxy module available for the entire hypervisor.
 1.6 29-Apr-2013  pooka Rework how the bio hypercalls work, part 1/n:

Reduce the set of hypercalls to one: "do block i/o". This not only
eliminates a lot of pseudo-duplicate code, it also gives the
hypervisor a lot more freedom on how to optimize the i/o.
 1.5 27-Apr-2013  pooka * integrate rumpuser_getversion() with the hypervisor initialization
* rename some identifiers to better match reality
 1.4 15-Nov-2010  pooka branches: 1.4.6; 1.4.12;
Make int *error and optional parameter (i.e. it can be NULL).
Sometimes the caller just doesn't care which errno close() might
throw.
 1.3 18-May-2010  pooka Make it possible to use the scheduler lock as the rumpuser condvar
interlock. This is applicable in cases where the actual interlock
is the CPU the currently running thread is scheduled on. Borrowing
the scheduler lock as the mutex mandated by pthread_cond_wait()
does away with need to have an additional mutex. This both optimizes
runtime execution and simplifies code, as the extra lock typically
lead to quite some trickeries to avoid the dungeon collapsing due
to zaps from the wand of deadlock.
 1.2 22-Mar-2010  pooka Wrap DOCALL and DOCALL_KLOCK in a new block (for easy adding of
debug prints before them.

XXX: can't use the standard do-while0 because lint doesn't like it.
 1.1 26-Feb-2010  pooka librumpuser is not _KERNEL code and does not belong in sys. Move
the source files from src/sys/rump/librump/rumpuser to src/lib/librumpuser
(from where it is already built). Even so, keep rumpuser.h in
sys/rump/include for kernel source tree self-containment.
 1.4.12.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.4.12.1 23-Jun-2013  tls resync from head
 1.4.6.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.9.2.1 10-Aug-2014  tls Rebase.
 1.2 24-Aug-2014  pooka RCS Id police (because we can. or have you heard of git id police?)
 1.1 09-Jul-2014  justin branches: 1.1.2; 1.1.6;
Split out file and memory access in librumpuser

This allows alternate implementations to reuse these parts, and the file
parts will at the next hypercall revision be moved to their own driver.

Discussed with pooka@
 1.1.6.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.6.1 09-Jul-2014  tls file rumpuser_mem.c was added on branch tls-maxphys on 2014-08-20 00:02:21 +0000
 1.1.2.2 10-Aug-2014  tls Rebase.
 1.1.2.1 09-Jul-2014  tls file rumpuser_mem.c was added on branch tls-earlyentropy on 2014-08-10 06:52:26 +0000
 1.4 18-Mar-2013  pooka Move the rumpuser_net set of hypercalls to be a private to the sockin
component. This cleans up the generic hypercall interfaces from ones
specific to only one component. They should always have been private,
but the infrastructure to "make it so" didn't exist earlier.

no functional change
 1.3 27-Jul-2012  pooka branches: 1.3.2;
Once again, make the rump kernel hypercall layer work on Linux.
 1.2 15-Nov-2010  pooka branches: 1.2.6;
Make int *error and optional parameter (i.e. it can be NULL).
Sometimes the caller just doesn't care which errno close() might
throw.
 1.1 26-Feb-2010  pooka librumpuser is not _KERNEL code and does not belong in sys. Move
the source files from src/sys/rump/librump/rumpuser to src/lib/librumpuser
(from where it is already built). Even so, keep rumpuser.h in
sys/rump/include for kernel source tree self-containment.
 1.2.6.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.2.6.1 30-Oct-2012  yamt sync with head
 1.3.2.1 23-Jun-2013  tls resync from head
 1.54 16-Oct-2024  ozaki-r librumpuser/rumpuser_port.h: import new flags for NetBSD
 1.53 14-Jul-2023  lukem branches: 1.53.2;
fix rump URLs

Link to https://github.com/rumpkernel/ instead of
a site now taken over by an SEO squatter.

Per discussion on github.com/rumpkernel issues with pooka.

PR misc/57501
 1.52 19-Apr-2022  rillig branches: 1.52.2;
lib: remove CONSTCOND comment

Since 2021-01-31, lint doesn't need it anymore for the common pattern of
'do ... while (0)'.
 1.51 03-Apr-2021  simonb For MIPS N32, register_t needs to be uint64_t as "long" isn't
big enough.
 1.50 11-May-2017  martin Evil hack to fix the build: provide PRIxREGISTER here.
Sevan, please check and fix correctly ;-)
 1.49 11-May-2017  sevan Update NetBSD values obtained from running configure as instructed in comment.
This paves the way to resolve rump build process using buildrump.sh, where the definition of
HAVE_REGISTER_T caused conflicting definitions of register_t.
 1.48 12-Jan-2017  christos branches: 1.48.4;
Don't go redefining system constants, without checking if the system provides
them.
 1.47 07-Nov-2015  nros branches: 1.47.2;
Add the C11 function aligned_alloc to libc.
 1.46 21-Sep-2015  pooka Add more compat defs for code compiled for !NetBSD targets.

At least GNU Hurd lacks MAXHOSTNAMELEN/MAXPATHLEN/PATH_MAX, so make sure
those have some arbitrary semi-sane values.

from Robert Millan in PR misc/50166, with some modifications from myself
 1.45 16-Aug-2015  pooka Hurd support, part 1

from Robert Millan <rmh@gnu.org> via rumpkernel-users
 1.44 05-Mar-2015  pooka check for utimensat
 1.43 17-Jan-2015  justin Remove no longer required definitions
 1.42 10-Nov-2014  pooka work around c11 visibility problems on some version(s) of FreeBSD
 1.41 10-Nov-2014  pooka Just _GNU_SOURCE should be enough to expose everything necessary on Linux
 1.40 05-Nov-2014  justin Add some prototypes for Android rump kernel builds

See buildrump.sh #70, some Android versins are missing prototypes for
these libc functions
 1.39 05-Nov-2014  pooka fix clock_gettime emulation
 1.38 05-Nov-2014  pooka update for NetBSD-current having clock_nanosleep
 1.37 04-Nov-2014  pooka Use autoconf for rump kernel posix hypercall layer.

This gets rid of homegrown hacks and puts all probes in one place.

Tested for NetBSD (build.sh + anita) and Linux (buildrump.sh)
 1.36 07-Oct-2014  justin Canonical Minix check as pointed out by Marc
 1.35 29-Sep-2014  justin Minix also has getenv_r support
 1.34 22-Jul-2014  justin Clean up random implementation for librumpuser

Use /dev/urandom for platforms without arc4random, not srandom(),
deduplicate code, do not read excessive random bytes

Reviewed by pooka@
 1.33 17-Jun-2014  justin Applications are not supposed to and do not need to include <features.h> explicitly
 1.32 02-Apr-2014  justin branches: 1.32.2;
Add Android support for rump kernel.

Reviewed by pooka@
 1.31 21-Mar-2014  pooka fix name of HAVE_PTHREAD_SETNAME_3
 1.30 21-Mar-2014  pooka use a probe result to decide which pthread_setname_np() to use
 1.29 25-Feb-2014  pooka emulate printflike properly to avoid fatal error on clang
 1.28 16-Jan-2014  pooka Do not force _FILE_OFFSET_BITS=64 here. It's no longer strictly speaking
required (rumpuser interface no longer uses off_t) and force-defining
it causes foo() to magically become foo64() on glibc (even on 64bit
platforms).
 1.27 15-Jan-2014  pooka Make setprogname() a nop where it's not supported.
 1.26 08-Jan-2014  pooka remove obsolete definitions
 1.25 08-Jan-2014  pooka do as the comment says and #if defined(every_other) || defined(platform) || ...
===> #if !defined(__NetBSD__)
 1.24 08-Jan-2014  pooka OpenBSD support

from Justin Cormack via github
 1.23 18-Dec-2013  pooka remove outdated comment (since quite a few months ago)
 1.22 27-Oct-2013  rmind librumpuser: add some #ifdef __APPLE__ and missing bits to build it on OS X.
OK pooka@
 1.21 10-Sep-2013  pooka more platform-specific qualifiers
 1.20 22-Jul-2013  pooka TIMEVAL_TO_TIMESPEC (for musl)

from Justin Cormack
 1.19 20-Jul-2013  pooka Fixes when compiling against musl libc.

from Justin Cormack via private email
 1.18 28-Apr-2013  pooka branches: 1.18.2;
Improve the time-related hypercalls so that's it's possible to
sleep until an absolute time on the host's monotonic clock (should
something like that be supported).
 1.17 27-Apr-2013  pooka make the random hypercall more generic
 1.16 20-Mar-2013  pooka Attempt two for the previous: _ILP32 comes from headers, so don't use
it to decide if we want to muddle with _FILE_OFFSET_BITS.
 1.15 20-Mar-2013  pooka Use _FILE_OFFSET_BITS=64 on Solaris too (necessary for 32bit builds).
 1.14 14-Mar-2013  pooka Refine previous: sys/sysmacros.h is where MIN/MAX comes from on Solaris,
so it needs to be included unconditionally.
 1.13 14-Mar-2013  pooka StunOS >= 5.11 has posix_memalign(), so add an additional constraint for
when we need to emulate it with memalign() and when not.
 1.12 17-Jan-2013  pooka Include sys/sysmacros.h on solaris for MIN/MAX.
 1.11 14-Jan-2013  pooka Support Cygwin as a hypervisor.
 1.10 26-Nov-2012  pooka fix previous
 1.9 26-Nov-2012  pooka One more thing required by DragonFly
 1.8 26-Nov-2012  pooka FreeBSD fixes.

from philip@freebsd.org
 1.7 26-Nov-2012  pooka Since SA_SETLEN() is used only for sockaddr_in, convert it to SIN_SETLEN()
to avoid compiler whining on breaking strict aliasing rules.
 1.6 22-Nov-2012  pooka satisfy the slightly more picky clang
 1.5 21-Nov-2012  pooka export register_t to rump kernel users on solaris
 1.4 18-Nov-2012  pooka Fixes for Solarisa.
 1.3 03-Sep-2012  pooka branches: 1.3.2; 1.3.4;
More fixes for Linux (or glibc, really).
 1.2 25-Aug-2012  pooka Make librumphijack compile and work on Linux. Do not try to hijack
calls which are not supported on Linux and therefore cannot be
handled by the rump kernel side syscall emulation (not that they'd
be present in the calling binaries anyway).
 1.1 27-Jul-2012  pooka Once again, make the rump kernel hypercall layer work on Linux.
 1.3.4.5 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.3.4.4 23-Jan-2013  yamt sync with head
 1.3.4.3 16-Jan-2013  yamt sync with (a bit old) head
 1.3.4.2 30-Oct-2012  yamt sync with head
 1.3.4.1 03-Sep-2012  yamt file rumpuser_port.h was added on branch yamt-pagecache on 2012-10-30 18:59:17 +0000
 1.3.2.4 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.3.2.3 23-Jun-2013  tls resync from head
 1.3.2.2 25-Feb-2013  tls resync with head
 1.3.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.18.2.1 23-Jul-2013  riastradh sync with HEAD
 1.32.2.1 10-Aug-2014  tls Rebase.
 1.47.2.1 20-Mar-2017  pgoyette Sync with HEAD
 1.48.4.1 19-May-2017  pgoyette Resolve conflicts from previous merge (all resulting from $NetBSD
keywork expansion)
 1.52.2.1 20-Sep-2024  martin Pull up following revision(s) (requested by rin in ticket #889):

lib/librumpuser/configure.ac: revision 1.6
lib/librumpuser/rumpuser_port.h: revision 1.53
lib/libpthread/Makefile: revision 1.97
sys/rump/share/man/man3/rumpuser.3: revision 1.4
sys/rump/share/man/man7/rumpkernel.7: revision 1.4
sys/rump/share/man/man7/rumpkernel.7: revision 1.5

fix rump URLs in man pages

Link to https://github.com/rumpkernel/wiki/wiki instead of
a site now taken over by an SEO squatter.
Per discussion on github.com/rumpkernel issues
with pooka.
PR misc/57501

fix rump URLs
Link to https://github.com/rumpkernel/ instead of
a site now taken over by an SEO squatter.
Per discussion on github.com/rumpkernel issues with pooka.
PR misc/57501

use rumpkernel.github.io as the entry point
 1.53.2.1 02-Aug-2025  perseant Sync with HEAD
 1.46 27-Dec-2017  ozaki-r Distinguish spin mutex and adaptive mutex on rump kernels for LOCKDEBUG

Formerly rump kernels treated the two types of mutexes as both adaptive for
LOCKDEBUG for some reasons.

Now we can detect violations of mutex restrictions on rump kernels such as
taking an adaptive mutex with holding a spin mutex as well as normal kernels.
 1.45 18-Sep-2015  pooka branches: 1.45.8;
Fix typos to match values from rumpuser_config.h

from Hajime Tazaki via rumpkernel-users
 1.44 16-Dec-2014  pooka With glibc on ARM kthread_exit() aborts because pthread_exit() fails
to unwind the stack. Add a temporary workaround where we simply don't
allow the thread to exit (a kernel thread exit is a relatively uncommon
event in a rump kernel anyway).
 1.43 04-Nov-2014  pooka Use autoconf for rump kernel posix hypercall layer.

This gets rid of homegrown hacks and puts all probes in one place.

Tested for NetBSD (build.sh + anita) and Linux (buildrump.sh)
 1.42 23-Jun-2014  pooka Hrmph, revert previous pending another fix. I tested it yesterday with
a slightly older tree, and of course it doesn't work anymore ...
 1.41 22-Jun-2014  pooka Wrap pthread_create(). Shouldn't really have a functional effect,
apart from testing that rumpuser_thread_create() can actually survive
an unschedule/schedule cycle (which may or may not be necessary with
other hypercall implementations).
 1.40 02-Apr-2014  justin branches: 1.40.2;
Add Android support for rump kernel.

Reviewed by pooka@
 1.39 21-Mar-2014  pooka fix braces
 1.38 21-Mar-2014  pooka use a probe result to decide which pthread_setname_np() to use
 1.37 21-Mar-2014  pooka set threadname for correct pthread_t
 1.36 10-Mar-2014  justin Revert conversion to __thread as breaks on archs without TLS support
 1.35 09-Mar-2014  justin Use __thread rather than pthread_getspecific for rumpuser curlwp.
This has better performance and curlwp is a performance bottleneck
in rump kernel code.
 1.34 27-Oct-2013  rmind librumpuser: add some #ifdef __APPLE__ and missing bits to build it on OS X.
OK pooka@
 1.33 26-Sep-2013  rmind Give RUMP mutex and rwlock their own cache-line. Also give a separate
cache-line for the rwlock's reader counter.
 1.32 24-Sep-2013  rmind rumpuser_rwlock: replace internal pthread_spin_lock (for protecting reader
count) with atomic operations. As pthread_spin_lock is not adaptive lock, it
can have hugely negative impact if contended here, especially with priority
inversions. Now contended rwlock(9) no longer falls flat in RUMP kernels.
 1.31 23-Sep-2013  pooka If pthread_create() fails with EAGAIN, try a few more times with short
sleeps in between. If it helps, good. If it doesn't, oh well, at
least we tried. pthread_create() returning EAGAIN has been observed in
real life at least on Linux (buildrump.sh issue #40)
 1.30 15-May-2013  pooka Pass enums over the hypercall interface as ints to avoid some
pathological scenarios from arising in setups where enums might be
of a different size in the rump kernel and hypervisor.
 1.29 15-May-2013  pooka Add RUMPUSER_LWP_CLEAR instead of overloading RUMPUSER_LWP_SET.
This simplifies some alternative hypervisor implementations.
 1.28 05-May-2013  pooka Initialize rw->downgrade when allocating a rwlock.

should/might/etc fix recent test hangs reported by martin & pgoyette
 1.27 03-May-2013  pooka Support proper rw_downgrade() semantics.
 1.26 02-May-2013  pooka reorder for better locality. no functional change.
 1.25 02-May-2013  pooka Push rwlock upgrade and downgrade into the hypervisor where there's
at least a chance to implement them with minimal fuss.
 1.24 02-May-2013  pooka Retry enabling spin mutexes. We should be able to avoid poking the
scheduler by just making wakeup from cv_wait() honor the same locking
order as when a spin mutex is acquired though mutex_enter().
*fingers crossed*
 1.23 02-May-2013  pooka Inform the rump kernel hypervisor of valid thread contexts so
that the implementation can allocate and release storage for them
in an optimal fashion, if necessary.
 1.22 02-May-2013  pooka Clear rwlock's "writer" field when releasing the lock. Otherwise it might
have been possible for "readers" to reach visibility before "writer"
when another CPU took the lock, thus leading the previous owner to
incorrectly think that it still owned the lock in rw_write_held().

Also, remove duplicate clause from assert().
 1.21 30-Apr-2013  pooka In kthread_create(), pass the priority and cpu index down to the
rump kernel hypervisor (though the current implementation doesn't take
advantage of them).
 1.20 30-Apr-2013  pooka Translate error codes between the hypervisor and rump kernel.
 1.19 30-Apr-2013  pooka Make hypercall calling conventions consistent: iff a hypercall can fail,
it returns an int containing the error value.
 1.18 29-Apr-2013  pooka Make the rump kernel upcalls which were previous available only to
the sysproxy module available for the entire hypervisor.
 1.17 29-Apr-2013  pooka Rework how the bio hypercalls work, part 1/n:

Reduce the set of hypercalls to one: "do block i/o". This not only
eliminates a lot of pseudo-duplicate code, it also gives the
hypervisor a lot more freedom on how to optimize the i/o.
 1.16 28-Apr-2013  pooka Change rumpuser_cv_timedwait() from absolute time to relative time.
It's then the hypervisor's problem to translate it accordingly.
Now we no longer have to worry about the kernel having to know the
hypervisor's time and vice versa.
 1.15 27-Apr-2013  pooka roll mutex init hypercalls into one (one of them already took a flag anyway)
 1.14 27-Apr-2013  pooka * integrate rumpuser_getversion() with the hypervisor initialization
* rename some identifiers to better match reality
 1.13 27-Apr-2013  pooka Try to make sure that the appropriate calls to mutex_enter() takes
a spin mutex (i.e. does not relinquish cpu context while trying to
take the mutex).

Bump the hypercall interface version number. I'll be doing a bunch
of other cleanups to simplify the interface for the benefit of
alternative hypervisor implementations. I'll be riding this bump
and doing a second one only after I'm finished with all of the
changes.
 1.12 11-Feb-2013  pooka As reported by several people, the signature of pthread_setname_np() varies
from one Linux distro to another (didn't suspect it to be *that* _np).
Comment out the call on Linux pending autoconf support.
 1.11 14-Jan-2013  pooka Support Cygwin as a hypervisor.
 1.10 26-Nov-2012  pooka PTHREAD_PROCESS_SHARED private doesn't seem to work on DragonFly, so
init the spin lock _PRIVATE (we don't really care which it is).
 1.9 08-Oct-2012  pooka call pthread_setname_np() on Linux too.
 1.8 27-Jul-2012  pooka branches: 1.8.2;
Once again, make the rump kernel hypercall layer work on Linux.
 1.7 05-Feb-2011  yamt branches: 1.7.4;
fix indent. no functional changes.
 1.6 01-Dec-2010  pooka branches: 1.6.2;
implement mutex_owner()
 1.5 01-Dec-2010  pooka Umm, delete recursive mutex interface instead of renaming it.
 1.4 01-Dec-2010  pooka Track lwp as the rumpuser mutex owner instead of pthread_t (this
is done in rumpuser for simplicity, since on the kernel side things
we assume we have only one pointer of space). As a side-effect,
we can no longer know if the current thread is holding on to a
mutex locked without curlwp context (basically all mutexes inited
outside of mutex_init()). The only thing that called rumpuser_mutex_held()
for a non-kmutex was the giant lock. So, instead implement recursive
locking for the giant lock in the rump kernel and get rid of the
now-unused recursive pthread mutex in the hypercall interface.
 1.3 31-May-2010  pooka Support KTHREAD_JOINABLE/kthread_join(). Also fixes earlier bug
where all pthreads were created non-detached.
 1.2 18-May-2010  pooka Make it possible to use the scheduler lock as the rumpuser condvar
interlock. This is applicable in cases where the actual interlock
is the CPU the currently running thread is scheduled on. Borrowing
the scheduler lock as the mutex mandated by pthread_cond_wait()
does away with need to have an additional mutex. This both optimizes
runtime execution and simplifies code, as the extra lock typically
lead to quite some trickeries to avoid the dungeon collapsing due
to zaps from the wand of deadlock.
 1.1 26-Feb-2010  pooka librumpuser is not _KERNEL code and does not belong in sys. Move
the source files from src/sys/rump/librump/rumpuser to src/lib/librumpuser
(from where it is already built). Even so, keep rumpuser.h in
sys/rump/include for kernel source tree self-containment.
 1.6.2.1 08-Feb-2011  bouyer Sync with HEAD
 1.7.4.4 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.7.4.3 23-Jan-2013  yamt sync with head
 1.7.4.2 16-Jan-2013  yamt sync with (a bit old) head
 1.7.4.1 30-Oct-2012  yamt sync with head
 1.8.2.4 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.8.2.3 23-Jun-2013  tls resync from head
 1.8.2.2 25-Feb-2013  tls resync with head
 1.8.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.40.2.1 10-Aug-2014  tls Rebase.
 1.45.8.1 13-Jan-2018  snj Pull up following revision(s) (requested by ozaki-r in ticket #495):
lib/librumpuser/rumpfiber.c: revision 1.13
lib/librumpuser/rumpuser_pth.c: revision 1.46
lib/librumpuser/rumpuser_pth_dummy.c: revision 1.18
sys/kern/kern_condvar.c: revision 1.40
sys/kern/kern_lock.c: revision 1.161
sys/kern/kern_mutex.c: revision 1.68
sys/kern/kern_rwlock.c: revision 1.48
sys/rump/include/rump/rumpuser.h: revision 1.115
sys/rump/librump/rumpkern/locks.c: revision 1.76-1.79
Apply C99-style struct initialization to lockops_t
--
Tweak LOCKDEBUG macros (NFC)
--
Distinguish spin mutex and adaptive mutex on rump kernels for LOCKDEBUG
Formerly rump kernels treated the two types of mutexes as both adaptive for
LOCKDEBUG for some reasons.
Now we can detect violations of mutex restrictions on rump kernels such as
taking an adaptive mutex with holding a spin mutex as well as normal kernels.
--
rump: check if the mutex is surely owned by the caller in mutex_exit
Unlocking a not-owned mutex wasn't detected well (it could detect if the mutex
is not held by anyone but that's not enough). Let's check it (the check is the
same as normal kernel's mutex).
If LOCKDEBUG is enabled, give the check over LOCKDEBUG because it can provide
better debugging information.
 1.19 18-Aug-2025  andvar s/flgas/flags/ in rumpuser_mutex_init() second argument name.
No functional changes intended.
 1.18 27-Dec-2017  ozaki-r Distinguish spin mutex and adaptive mutex on rump kernels for LOCKDEBUG

Formerly rump kernels treated the two types of mutexes as both adaptive for
LOCKDEBUG for some reasons.

Now we can detect violations of mutex restrictions on rump kernels such as
taking an adaptive mutex with holding a spin mutex as well as normal kernels.
 1.17 17-Jun-2014  alnsn branches: 1.17.16;
For consistency with other files in the same directory
don't include <sys/cdefs.h> before __RCSID.
 1.16 15-May-2013  pooka branches: 1.16.4;
Pass enums over the hypercall interface as ints to avoid some
pathological scenarios from arising in setups where enums might be
of a different size in the rump kernel and hypervisor.
 1.15 07-May-2013  pooka need the rw_downgrade/tryupgrade methods too
 1.14 07-May-2013  pooka update to recent interface changes
 1.13 02-May-2013  pooka Inform the rump kernel hypervisor of valid thread contexts so
that the implementation can allocate and release storage for them
in an optimal fashion, if necessary.
 1.12 30-Apr-2013  pooka make this build/work again
 1.11 30-Apr-2013  pooka In kthread_create(), pass the priority and cpu index down to the
rump kernel hypervisor (though the current implementation doesn't take
advantage of them).
 1.10 27-Apr-2013  pooka roll mutex init hypercalls into one (one of them already took a flag anyway)
 1.9 27-Apr-2013  pooka * integrate rumpuser_getversion() with the hypervisor initialization
* rename some identifiers to better match reality
 1.8 27-Apr-2013  pooka Try to make sure that the appropriate calls to mutex_enter() takes
a spin mutex (i.e. does not relinquish cpu context while trying to
take the mutex).

Bump the hypercall interface version number. I'll be doing a bunch
of other cleanups to simplify the interface for the benefit of
alternative hypervisor implementations. I'll be riding this bump
and doing a second one only after I'm finished with all of the
changes.
 1.7 06-Nov-2012  pooka Actually define the klock/unlock pointers. Not having the storage
allocated for them created "interesting" effects with one compiler setup.
 1.6 06-Nov-2012  pooka one more routine
 1.5 02-Nov-2012  pooka implement mutex_owner()
 1.4 02-Nov-2012  pooka need rumpuser_mutex_init_kmutex() these days
 1.3 02-Nov-2012  pooka Start restoring the ability to run rump kernels on non-threading
hypervisors.

Step 1: make this compile again (it's not complete, but
at least it compiles).
 1.2 23-May-2011  joerg branches: 1.2.4; 1.2.10;
Ensure that rumpuser_thread_exit doesn't return.
 1.1 26-Feb-2010  pooka librumpuser is not _KERNEL code and does not belong in sys. Move
the source files from src/sys/rump/librump/rumpuser to src/lib/librumpuser
(from where it is already built). Even so, keep rumpuser.h in
sys/rump/include for kernel source tree self-containment.
 1.2.10.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.10.2 23-Jun-2013  tls resync from head
 1.2.10.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.2.4.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.2.4.1 16-Jan-2013  yamt sync with (a bit old) head
 1.16.4.1 10-Aug-2014  tls Rebase.
 1.17.16.1 13-Jan-2018  snj Pull up following revision(s) (requested by ozaki-r in ticket #495):
lib/librumpuser/rumpfiber.c: revision 1.13
lib/librumpuser/rumpuser_pth.c: revision 1.46
lib/librumpuser/rumpuser_pth_dummy.c: revision 1.18
sys/kern/kern_condvar.c: revision 1.40
sys/kern/kern_lock.c: revision 1.161
sys/kern/kern_mutex.c: revision 1.68
sys/kern/kern_rwlock.c: revision 1.48
sys/rump/include/rump/rumpuser.h: revision 1.115
sys/rump/librump/rumpkern/locks.c: revision 1.76-1.79
Apply C99-style struct initialization to lockops_t
--
Tweak LOCKDEBUG macros (NFC)
--
Distinguish spin mutex and adaptive mutex on rump kernels for LOCKDEBUG
Formerly rump kernels treated the two types of mutexes as both adaptive for
LOCKDEBUG for some reasons.
Now we can detect violations of mutex restrictions on rump kernels such as
taking an adaptive mutex with holding a spin mutex as well as normal kernels.
--
rump: check if the mutex is surely owned by the caller in mutex_exit
Unlocking a not-owned mutex wasn't detected well (it could detect if the mutex
is not held by anyone but that's not enough). Let's check it (the check is the
same as normal kernel's mutex).
If LOCKDEBUG is enabled, give the check over LOCKDEBUG because it can provide
better debugging information.
 1.4 04-Nov-2014  pooka Use autoconf for rump kernel posix hypercall layer.

This gets rid of homegrown hacks and puts all probes in one place.

Tested for NetBSD (build.sh + anita) and Linux (buildrump.sh)
 1.3 24-Aug-2014  pooka RCS Id police (because we can. or have you heard of git id police?)
 1.2 25-Jul-2014  justin branches: 1.2.2; 1.2.6;
Clean up error handling in rumpuser_init()
 1.1 22-Jul-2014  justin Clean up random implementation for librumpuser

Use /dev/urandom for platforms without arc4random, not srandom(),
deduplicate code, do not read excessive random bytes

Reviewed by pooka@
 1.2.6.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.2.6.1 25-Jul-2014  tls file rumpuser_random.c was added on branch tls-maxphys on 2014-08-20 00:02:21 +0000
 1.2.2.2 10-Aug-2014  tls Rebase.
 1.2.2.1 25-Jul-2014  tls file rumpuser_random.c was added on branch tls-earlyentropy on 2014-08-10 06:52:26 +0000
 1.1 20-Feb-2014  pooka branches: 1.1.4; 1.1.8;
Translate signal numbers between rump kernel and (POSIX) host.
 1.1.8.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.1.8.1 20-Feb-2014  tls file rumpuser_sigtrans.c was added on branch tls-maxphys on 2014-08-20 00:02:21 +0000
 1.1.4.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.1.4.1 20-Feb-2014  yamt file rumpuser_sigtrans.c was added on branch yamt-pagecache on 2014-05-22 11:37:00 +0000
 1.77 06-May-2020  christos Allocate one more byte so that we are always NUL-terminated, and remove
the extra commented out NUL-terminations. As suggested in:

http://mail-index.netbsd.org/source-changes-d/2020/04/01/msg012470.html
 1.76 06-May-2020  kamil Avoid buffer overflow

Disable the offending code.

OK by kre@
 1.75 24-Mar-2020  kre If we're going to loop, pausing and then retrying malloc() after it
has failed, in the hope that some other thread has free'd some memory,
but we want to bound the number of attempts, it helps if we actually
count them - otherwise we never get nearer to the limit.

In practice, malloc() for a reasonable application on a modern system
almost never fails, so the code containing this bug has probably never
been, and never will be, executed, but just in case, someday.

For this, it isn't clear if the intent was to have 10 retries (ie: 11
attempts) or 10 tries, but as the code said "retries > 10", I am
assuming the former (not that it matters, if the malloc() has failed
10 times in a row, with 10 second pauses between, the chances of an
11th succeeding aren't great).
 1.74 24-Mar-2020  kamil Revert previous

It will be addressed in a better way.

Requested by <kre>
 1.73 24-Mar-2020  kamil Avoid buffer overflow

Detected with ASan + RUMPKERNEL.
 1.72 06-Sep-2016  martin branches: 1.72.14;
Redo previous by avoiding the casts and using PRIxREGISTER instead
 1.71 06-Sep-2016  martin Can not print register_t with %d, cast to long and use %ld instead.
 1.70 16-Aug-2015  pooka Hurd support, part 1

from Robert Millan <rmh@gnu.org> via rumpkernel-users
 1.69 04-Feb-2015  pooka If binding fails, print URL with which it failed.
 1.68 08-Dec-2014  justin Avoid uninitialised variable warning when gcc is feeling lazy
 1.67 25-Aug-2014  pooka No longer create a special process context to fork remote clients off
of, simply always rfork off of proc1 closing all descriptors, and have
the rump kernel open 0/1/2 if the parent process is "1".

Fixes tests/rump/rumpkernel/t_sp, which was failing since the
abovementioned special process change due to attempting to deliver a
signal to the special process and the special process was not equipped
to handle one.
 1.66 14-Jun-2014  pooka branches: 1.66.2;
Remove one more symbol reference to librump (missed in previous commit
to this file)
 1.65 23-May-2014  pooka do previous the right way to avoid rumpuser linkage dependency on librump
 1.64 23-May-2014  pooka Create remote clients with standard file descriptors open. Fixes at
least editing a new file with ed in rumpremote (because ed calls
isatty(0) in case a file does not exist).
 1.63 28-Feb-2014  pooka branches: 1.63.2;
Fix locking SNAFU.

Is someone can explain why the code worked for 3+ years with multiple
different pthread implementations, I'll buy you a banana.
 1.62 08-Jan-2014  pooka OpenBSD support

from Justin Cormack via github
 1.61 01-Nov-2013  pooka Workaround a gcc -Wuninitilized whine

github/buildrump.sh issue #44
 1.60 27-Oct-2013  rmind librumpuser: add some #ifdef __APPLE__ and missing bits to build it on OS X.
OK pooka@
 1.59 18-Jul-2013  pooka Fix build where compiler can throw an array-bounds error and
code is built with NDEBUG
or
platform's assert is not __dead
 1.58 30-Apr-2013  pooka branches: 1.58.2;
Translate error codes between the hypervisor and rump kernel.
 1.57 30-Apr-2013  pooka Make hypercall calling conventions consistent: iff a hypercall can fail,
it returns an int containing the error value.
 1.56 29-Apr-2013  pooka Make the rump kernel upcalls which were previous available only to
the sysproxy module available for the entire hypervisor.
 1.55 27-Apr-2013  pooka nuke unused var
 1.54 27-Apr-2013  pooka make the random hypercall more generic
 1.53 27-Apr-2013  pooka wrap unportable register_t with a long. should do it in the front
of the house too, but at least this is a start.
 1.52 27-Apr-2013  pooka * integrate rumpuser_getversion() with the hypervisor initialization
* rename some identifiers to better match reality
 1.51 14-Jan-2013  pooka Support Cygwin as a hypervisor.
 1.50 26-Nov-2012  pooka Support DragonFly BSD.
 1.49 26-Nov-2012  pooka FreeBSD fixes.

from philip@freebsd.org
 1.48 21-Sep-2012  pooka For the rumpsp protocol, don't assume that the bit representation of
errnos match on the client and server platforms (the syscall subprotocol
errnos are handled by the server compat code).
 1.47 27-Jul-2012  pooka branches: 1.47.2;
Once again, make the rump kernel hypercall layer work on Linux.
 1.46 09-Mar-2012  joerg Disable reduced stack for now. It creates fallout I'm not willing to
deal with.
 1.45 08-Mar-2011  pooka branches: 1.45.4;
Use sendmsg() instead multiple calls to sendto(). It behaves
slightly better in the multithreaded exec case in terms of partial
frames sent. Plus, it's theoretically a little cheaper.

There's still a gray area with partial transfer from sendmsg(),
but I'm not sure I care enough about some academic scenario to
start fixing it (it basically needs an OOB exec signaller).
 1.44 08-Mar-2011  pooka Nuke all threads belonging to a process calling exec before allowing
the exec handshake to return.

In addition to being The Right Thing To Do, fixes some nasty
conditions for CLOEXEC fd's (or at least does so in theory, I
couldn't create any problems although I tried).
 1.43 07-Mar-2011  pooka use nwork-adjusted amount of idle workers to decide is they are truly idle.
 1.42 15-Feb-2011  pooka Cleanup server socket before sending back "ok" for halt. Fixes
some occasionally-seen race conditions in tests which do server
restarts (e.g. the raidframe tests).
 1.41 15-Feb-2011  pooka support HANDSHAKE_EXEC
 1.40 08-Feb-2011  pooka Turn the "idle workers available" from a flag into a counter so
that we can finally avoid all races (*knock knock*).
 1.39 06-Feb-2011  pooka Fix a race condition in the worker thread caching logic: if we got
two or more syscall requests before any worker thread ran, we might
not have enough threads to handle the requests. In some scenarios
this could lead to a deadlock.
 1.38 28-Jan-2011  pooka Pass the value of getprogname() from the client to the server and
record it in p_comm. This is nice for things like sockstat, since
they now display the client command name:

pain-rustique:43:~> rump.sockstat
USER COMMAND PID FD PROTO LOCAL ADDRESS FOREIGN ADDRESS
root xulrunner- 16 0 tcp 192.168.2.114.65507 204.152.190.12.80
root xulrunner- 16 1 tcp 192.168.2.114.65501 204.152.190.12.80
root xulrunner- 16 2 tcp 192.168.2.114.65500 204.152.190.12.80
root xulrunner- 16 3 tcp 192.168.2.114.65499 204.152.190.12.80
root xulrunner- 16 5 tcp 192.168.2.114.65498 204.152.190.12.80
root xulrunner- 16 6 tcp 192.168.2.114.65497 204.152.190.12.80
root socket 62 0 tcp6 *.http *.*
root socket 62 1 tcp *.http *.*
root socket 63 0 tcp6 *.81 *.*
root socket 63 1 tcp *.81 *.*
 1.37 22-Jan-2011  pooka In case sys_reboot() was called by a remote client, put the response
in the socket before we shut down. This way the response to the
syscall travels to the caller and they know things worked correctly
instead of having to just assume.
 1.36 14-Jan-2011  pooka branches: 1.36.2;
Add RUMPSP_RAISE: the kernel sends a signal to the client.
 1.35 12-Jan-2011  pooka call procexit when a connection closes
 1.34 10-Jan-2011  pooka A bunch of improvements:

* don't hold spc mutex while sending data
* use send() for the banner to avoid SIGPIPE in case a client
connects and immediately goes away
* fix error path locking
* use kevent() instead of pollts() in the client. Apparently that
is the only sensible way for a library to support both multithreading
and signal-reentrancy in a race-free manner.
(can I catch all signals with one kevent instead of installing
NSIG different ones??)
* mark client comm descriptor non-blocking so that clients have
better signal-interruptibility (we now sleep in signal-accepting
kevent() instead of signal-masked recvfrom())
 1.33 10-Jan-2011  pooka g/c code which is unused in the server
 1.32 09-Jan-2011  pooka Separate rw_data and rw_done. Otherwise we don't get wakeups for
requests which have a 0-length response (such as copyin 0/0).

This change makes links(1) work against a rump kernel which contains
rumpnet_local. The presence of unix domain sockets caused links
to select() with 0 fds and a timeout, and because copyin never woke
up in the kernel the application blocked indefinitely.
 1.31 06-Jan-2011  pooka Make rumpclient syscalls safe to call from signal handlers.
 1.30 05-Jan-2011  pooka Release sender lock before zeroing out "wanted" status during
violent disconnect. Fixes some race conditions (maybe the one
occasionally showing up on tests/rump/rumpkern/t_stress).

thanks to schmonz for some discussion
 1.29 05-Jan-2011  pooka Support fork() for rumpclient users.
 1.28 02-Jan-2011  pooka rump_lwproc_newproc -> rump_lwproc_rfork
 1.27 16-Dec-2010  pooka Have the client and server perform some sort of handshake first.
It's pretty much a placeholder for now. One plan for the future
is to require some sort of authentication for superuser clients.
The code will need a little massage then, though, to prevent DoS
attacks.
 1.26 16-Dec-2010  pooka Print a banner a connecting client. The banner contains rump sp
protocol version, os name, os revision and machine.
 1.25 12-Dec-2010  pooka Unlink unix socket as part of server exit.
(whatever happened to the code that was supposed to do it automatically
when the binding process exits?)
 1.24 12-Dec-2010  pooka add rumpuser_sp_fini, which surpringly is the opposite of rumpuser_sp_init
 1.23 12-Dec-2010  pooka outdated comment
 1.22 30-Nov-2010  pooka lint care
 1.21 29-Nov-2010  pooka Remove remaining panic()s from server-side code. Also, allow to
send an out-of-band error. Make the client retry syscall requests
if this error is EAGAIN, fail them otherwise.
 1.20 29-Nov-2010  pooka Cache syscall worker threads and include some stetson-harrison
limits. This improves syscall throughput about 2x for non-userio
syscalls (no copyin/out, e.g. getpid()) and almost 1.5x even for
things like __sysctl().
(measured for cases where the remote process is on the local machine)

XXX: if the pthread deadqueue sucks for anything which cares about
performance, why does it exist? Nuking it would make supporting
variable stack size easier.
 1.19 27-Nov-2010  pooka Since we are going to handle syscalls in our threads, limit stacksize.
(unfortunately though, pthread_attr_setstacksize() has no effect on NetBSD)
 1.18 26-Nov-2010  pooka Fix a few locking problems with multithreaded clients.

TODO: make server deal graciously with out-of-resources conditions
 1.17 26-Nov-2010  pooka Improve reliability in cases where client disconnects mid-operation.
 1.16 26-Nov-2010  pooka Plug recently introduced memory leak: release lwp after use instead of
just switching away.

Also, make freeing syscall arguments a little more symmetric.
 1.15 25-Nov-2010  pooka *facepalm*, adjust remote copyinstr to work in cases where the end
of the max copyin extends to an unmapped page.

Noticed, as usual, by tests.
 1.14 24-Nov-2010  pooka create pthread attribute only once
 1.13 24-Nov-2010  pooka Unschedule from CPU for out-of-kernel blocking ops. Otherwise we
might even deadlock if the thread that wakes us up wants a CPU.
 1.12 24-Nov-2010  pooka improve threadsafety
 1.11 24-Nov-2010  pooka Sneeze some locking into connect/disconnect.
 1.10 22-Nov-2010  pooka Support physio for remote processes.
==> add support for remote vmspace vmapbuf/vunmapbuf
==> add proper support for copyin/out_vmspace
==> add support for remote vmspace uvm_io
==> add support for non-curproc rumpuser_sp_copyin/out
==> store remote context in vm_map->pmap instead of
pthread_specificdata

In short, makes read/write of most (all?) block devices work from
a remote rump client via rump syscalls.
 1.9 19-Nov-2010  pooka squelch the compiler whine
 1.8 19-Nov-2010  pooka Support multithreaded clients and fix a few bugs.
 1.7 19-Nov-2010  pooka Start working on making the syscall proxy code threadsafe. The
basics are there, but a few more tweaks are needed. The reason
I'm committing it now is that the code was mindnumbingly boring to
write (no wonder it took me almost 3 years to get it done), and I
might burn it if it's not in a safe place.
 1.6 17-Nov-2010  pooka free syscall data after use
 1.5 04-Nov-2010  pooka Refactor the sysproxy code so that rumpuser contains only the server side.
 1.4 01-Nov-2010  pooka Missed a few symbols in previous ...

Also, reorganize rumpuser header inclusion to make sure problem is
caught already by the compiler.
 1.3 01-Nov-2010  pooka Make librumpuser linkage once again free of librump.

problem pointed out by <he>
 1.2 28-Oct-2010  pooka Run different clients (different sockets) in different processes
inside the rump kernel. Now different host processes can no longer
step on each other inside the rump kernel.
 1.1 27-Oct-2010  pooka Start rework of system call proxying over socket ("sysproxy").
This incarnation is written in the user namespace as opposed to
the previous one which was done in kernel namespace. Also, rump
does all the handshaking now instead of excepting an application
to come up with the user namespace socket.

There's still a lot to do, including making code "a bit" more
robust, actually running different clients in a different process
inside the kernel and splitting the client side library from librump.
I'm committing this now so that I don't lose it, plus it generally
works as long as you don't use it in unexcepted ways: i've tested
ifconfig(8), route(8), envstat(8) and sysctl(8).
 1.36.2.2 17-Feb-2011  bouyer Sync with HEAD
 1.36.2.1 08-Feb-2011  bouyer Sync with HEAD
 1.45.4.5 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.45.4.4 23-Jan-2013  yamt sync with head
 1.45.4.3 16-Jan-2013  yamt sync with (a bit old) head
 1.45.4.2 30-Oct-2012  yamt sync with head
 1.45.4.1 17-Apr-2012  yamt sync with head
 1.47.2.4 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.47.2.3 23-Jun-2013  tls resync from head
 1.47.2.2 25-Feb-2013  tls resync with head
 1.47.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.58.2.1 23-Jul-2013  riastradh sync with HEAD
 1.63.2.1 10-Aug-2014  tls Rebase.
 1.66.2.1 09-Dec-2014  martin Pull up following revision(s) (requested by gson in ticket #299):
sys/rump/librump/rumpkern/cons.c: revision 1.4
sys/rump/librump/rumpkern/rump.c: revision 1.311
lib/librumpuser/rumpuser_sp.c: revision 1.67
No longer create a special process context to fork remote clients off
of, simply always rfork off of proc1 closing all descriptors, and have
the rump kernel open 0/1/2 if the parent process is "1".
Fixes tests/rump/rumpkernel/t_sp, which was failing since the
abovementioned special process change due to attempting to deliver a
signal to the special process and the special process was not equipped
to handle one.
 1.72.14.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.2 01-Mar-2013  pooka Add interfaces that out-of-librumpuser hypercalls can use to unschedule
and reschedule themselves if they plan to block.
 1.1 26-Feb-2010  pooka branches: 1.1.6; 1.1.12;
librumpuser is not _KERNEL code and does not belong in sys. Move
the source files from src/sys/rump/librump/rumpuser to src/lib/librumpuser
(from where it is already built). Even so, keep rumpuser.h in
sys/rump/include for kernel source tree self-containment.
 1.1.12.1 23-Jun-2013  tls resync from head
 1.1.6.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.45 02-Apr-2025  martin Revert accidental local test change from previous - the DEBUG define
is passed on the command line already.
 1.44 02-Apr-2025  riastradh librumpuser: New RUMPUSER_DEBUG env var enables debug output.

Use it in t_sp:sigsafe to see if we can get more diagnostics out.
 1.43 07-Dec-2021  gson branches: 1.43.4;
In unix_parse(), always allocate memory for the entire struct sockaddr_un
and not just the part used by the present pathname, because the entire
struct will be passed to bind() and an EFAULT can result if not all of
it is a valid allocation. Fixes PR kern/56533.
 1.42 13-Jun-2020  kamil Fix incompatible function pointer casts
 1.41 06-May-2020  christos Allocate one more byte so that we are always NUL-terminated, and remove
the extra commented out NUL-terminations. As suggested in:

http://mail-index.netbsd.org/source-changes-d/2020/04/01/msg012470.html
 1.40 24-Mar-2020  kamil Fix off-by-one

Before accessing array member, check whether it is not out of valid range.

Detected with ASan + RUMPKERNEL.
 1.39 05-Sep-2016  dholland branches: 1.39.14;
printf functions should be tagged as printf functions. Noticed by
martin, whose build broke for some reason yet to be determined.
 1.38 08-Jan-2014  pooka OpenBSD support

from Justin Cormack via github
 1.37 31-Dec-2013  pooka Do not export symbols which don't need to be exported.

via Justin Cormack
 1.36 14-Jan-2013  pooka Support Cygwin as a hypervisor.
 1.35 26-Nov-2012  pooka Since SA_SETLEN() is used only for sockaddr_in, convert it to SIN_SETLEN()
to avoid compiler whining on breaking strict aliasing rules.
 1.34 18-Nov-2012  pooka Fixes for Solarisa.
 1.33 21-Sep-2012  pooka For the rumpsp protocol, don't assume that the bit representation of
errnos match on the client and server platforms (the syscall subprotocol
errnos are handled by the server compat code).
 1.32 27-Jul-2012  pooka branches: 1.32.2;
Once again, make the rump kernel hypercall layer work on Linux.
 1.31 08-Mar-2011  pooka branches: 1.31.4;
Use sendmsg() instead multiple calls to sendto(). It behaves
slightly better in the multithreaded exec case in terms of partial
frames sent. Plus, it's theoretically a little cheaper.

There's still a gray area with partial transfer from sendmsg(),
but I'm not sure I care enough about some academic scenario to
start fixing it (it basically needs an OOB exec signaller).
 1.30 08-Mar-2011  pooka Nuke all threads belonging to a process calling exec before allowing
the exec handshake to return.

In addition to being The Right Thing To Do, fixes some nasty
conditions for CLOEXEC fd's (or at least does so in theory, I
couldn't create any problems although I tried).
 1.29 08-Mar-2011  pooka return correct value when reading a short frame
 1.28 15-Feb-2011  pooka support HANDSHAKE_EXEC
 1.27 14-Feb-2011  pooka A bunch of changes which essentially make sshd work with a hijacked
rump tcp/ip stack:

* sshd likes to fork and then re-exec itself
==> trap execve() and augment the env with the current parameters
essential to a rump kernel (kernel communication fd, information
about dup2'd file descriptors)

* sshd likes to play lots of games with pipes, socketpairs and dup{,2}()
==> make sure we do not close essential rump client descriptors:
dup() them to a safe place, except for F_CLOSEM where we
simply leave them alone. also, partially solved by the above,
make sure the process's set of rump kernel descriptors persists
over exec()

* sshd likes to chdir() before exec
==> for unix-style rump_sp(7) sockets save the full path on the
initial exec and use it afterwards. thread the path through
the environment in execve()
 1.26 24-Jan-2011  pooka Add reconnect code to librumpclient. In case the connection to
the kernel server is lost, the client will now automatically attempt
to reconnect.

Among other things, this makes it possible to "reboot" and restart
the TCP/IP stack from under firefox without any perceivable less
of service. If pages were loading at the time the TCP/IP server
was killed, there may be some broken links, but nothing a ctrl-r
cannot fix.
 1.25 22-Jan-2011  pooka In case sys_reboot() was called by a remote client, put the response
in the socket before we shut down. This way the response to the
syscall travels to the caller and they know things worked correctly
instead of having to just assume.
 1.24 14-Jan-2011  pooka branches: 1.24.2;
Add RUMPSP_RAISE: the kernel sends a signal to the client.
 1.23 10-Jan-2011  pooka A bunch of improvements:

* don't hold spc mutex while sending data
* use send() for the banner to avoid SIGPIPE in case a client
connects and immediately goes away
* fix error path locking
* use kevent() instead of pollts() in the client. Apparently that
is the only sensible way for a library to support both multithreading
and signal-reentrancy in a race-free manner.
(can I catch all signals with one kevent instead of installing
NSIG different ones??)
* mark client comm descriptor non-blocking so that clients have
better signal-interruptibility (we now sleep in signal-accepting
kevent() instead of signal-masked recvfrom())
 1.22 10-Jan-2011  pooka g/c code which is unused in the server
 1.21 09-Jan-2011  pooka Separate rw_data and rw_done. Otherwise we don't get wakeups for
requests which have a 0-length response (such as copyin 0/0).

This change makes links(1) work against a rump kernel which contains
rumpnet_local. The presence of unix domain sockets caused links
to select() with 0 fds and a timeout, and because copyin never woke
up in the kernel the application blocked indefinitely.
 1.20 07-Jan-2011  pooka Make rumpclient impervious to LD_PRELOAD syscall hijacking by using
dlsym(RTLD_NEXT) to lookup a host_syscall() function pointer which
is used instead of syscall() to communicate with the kernel server.

WARNING: popular opinion classifies this as "ugly code". if you
have a weak heart/mind/soul/sole meuniere, read max. 1 line of the
diff per day, preferably with food.
 1.19 06-Jan-2011  pooka Make rumpclient syscalls safe to call from signal handlers.
 1.18 05-Jan-2011  pooka Support fork() for rumpclient users.
 1.17 16-Dec-2010  pooka Have the client and server perform some sort of handshake first.
It's pretty much a placeholder for now. One plan for the future
is to require some sort of authentication for superuser clients.
The code will need a little massage then, though, to prevent DoS
attacks.
 1.16 16-Dec-2010  pooka Print a banner a connecting client. The banner contains rump sp
protocol version, os name, os revision and machine.
 1.15 12-Dec-2010  pooka Unlink unix socket as part of server exit.
(whatever happened to the code that was supposed to do it automatically
when the binding process exits?)
 1.14 30-Nov-2010  pooka Hands off of stuff we need to keep hands off of.
 1.13 29-Nov-2010  pooka Remove remaining panic()s from server-side code. Also, allow to
send an out-of-band error. Make the client retry syscall requests
if this error is EAGAIN, fail them otherwise.
 1.12 26-Nov-2010  pooka Fix a few locking problems with multithreaded clients.

TODO: make server deal graciously with out-of-resources conditions
 1.11 26-Nov-2010  pooka Improve reliability in cases where client disconnects mid-operation.
 1.10 25-Nov-2010  pooka *facepalm*, adjust remote copyinstr to work in cases where the end
of the max copyin extends to an unmapped page.

Noticed, as usual, by tests.
 1.9 24-Nov-2010  pooka unsnafu previous
 1.8 24-Nov-2010  pooka Unschedule from CPU for out-of-kernel blocking ops. Otherwise we
might even deadlock if the thread that wakes us up wants a CPU.
 1.7 24-Nov-2010  pooka missed part of earlier commit
 1.6 19-Nov-2010  pooka Support multithreaded clients and fix a few bugs.
 1.5 19-Nov-2010  pooka delint
 1.4 19-Nov-2010  pooka Start working on making the syscall proxy code threadsafe. The
basics are there, but a few more tweaks are needed. The reason
I'm committing it now is that the code was mindnumbingly boring to
write (no wonder it took me almost 3 years to get it done), and I
might burn it if it's not in a safe place.
 1.3 10-Nov-2010  pooka Don't puff sigpipe if the connection has been severed. May happen
e.g. when a client executes a blocking call such a poll() and
decides to exit before the result is ready.
 1.2 05-Nov-2010  pooka Implement support for unix domain sockets (important especially
for testing since we don't want to depend on global resources such
as tcp ports).
 1.1 04-Nov-2010  pooka Refactor the sysproxy code so that rumpuser contains only the server side.
 1.24.2.2 17-Feb-2011  bouyer Sync with HEAD
 1.24.2.1 08-Feb-2011  bouyer Sync with HEAD
 1.31.4.4 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.31.4.3 23-Jan-2013  yamt sync with head
 1.31.4.2 16-Jan-2013  yamt sync with (a bit old) head
 1.31.4.1 30-Oct-2012  yamt sync with head
 1.32.2.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.32.2.2 25-Feb-2013  tls resync with head
 1.32.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.39.14.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.43.4.1 02-Aug-2025  perseant Sync with HEAD
 1.1 04-Nov-2014  pooka Use autoconf for rump kernel posix hypercall layer.

This gets rid of homegrown hacks and puts all probes in one place.

Tested for NetBSD (build.sh + anita) and Linux (buildrump.sh)
 1.3 17-Nov-2020  rin Support aarch64eb in */config.guess.

Cherry-picked from upstream:
https://git.savannah.gnu.org/gitweb/?p=config.git;a=commit;h=1c4398015583eb77bc043234f5734be055e64bea

Everything except external/apache2/llvm/dist/llvm/cmake/config.guess
is patched, which is under vendor tag and cannot be modified. I expect
that this file is not actually used as we use hand-crafted version of
configure script instead of cmake for building LLVM.

Note that external/apache2/llvm/autoconf/autoconf/config.guess has
already been committed on Oct. 20, but commit message disappeared as
cvs aborted due to "permission denied" when trying to modify the file
mentioned above. Sorry for confusing you.

Also note that GMP uses its own config.guess Patch for
external/lgpl3/gmp/dist/config.guess is provided by ryo@. Thanks!
 1.2 01-Feb-2017  sevan Update supporting files for components which rely on autoconf to allow systems
introducing since release of software to be recognised. This should hopefully
allow the builds to progress a littles further on systems such as the POWER8
which features a little endian 64-bit PowerPC CPU identified as ppc64le.
 1.1 04-Nov-2014  pooka branches: 1.1.2; 1.1.4;
Use autoconf for rump kernel posix hypercall layer.

This gets rid of homegrown hacks and puts all probes in one place.

Tested for NetBSD (build.sh + anita) and Linux (buildrump.sh)
 1.1.4.1 21-Apr-2017  bouyer Sync with HEAD
 1.1.2.1 20-Mar-2017  pgoyette Sync with HEAD
 1.3 01-Feb-2017  sevan Update supporting files for components which rely on autoconf to allow systems
introducing since release of software to be recognised. This should hopefully
allow the builds to progress a littles further on systems such as the POWER8
which features a little endian 64-bit PowerPC CPU identified as ppc64le.
 1.2 04-Nov-2014  pooka branches: 1.2.2; 1.2.4;
be happy with netbsd*-* to recognize arm--netbsdelf-eabi

from pkg/48126, simplified
 1.1 04-Nov-2014  pooka Use autoconf for rump kernel posix hypercall layer.

This gets rid of homegrown hacks and puts all probes in one place.

Tested for NetBSD (build.sh + anita) and Linux (buildrump.sh)
 1.2.4.1 21-Apr-2017  bouyer Sync with HEAD
 1.2.2.1 20-Mar-2017  pgoyette Sync with HEAD
 1.2 03-Jun-2023  andvar fix various typos in comments and messages.
 1.1 04-Nov-2014  pooka Use autoconf for rump kernel posix hypercall layer.

This gets rid of homegrown hacks and puts all probes in one place.

Tested for NetBSD (build.sh + anita) and Linux (buildrump.sh)
 1.3 19-Oct-2016  maya Revert previous. it shouldn't have an effect.
$$ should make it sufficiently unique.
 1.2 17-Oct-2016  maya use mktemp instead of $RANDOM for tmpdir

..$RANDOM won't work with our /bin/sh.

unsure if this script is used, but it is wrong.
might help the spurious build failures that occasionally
show up on autobuilds.
 1.1 04-Nov-2014  pooka Use autoconf for rump kernel posix hypercall layer.

This gets rid of homegrown hacks and puts all probes in one place.

Tested for NetBSD (build.sh + anita) and Linux (buildrump.sh)
 1.1 04-Nov-2014  pooka Use autoconf for rump kernel posix hypercall layer.

This gets rid of homegrown hacks and puts all probes in one place.

Tested for NetBSD (build.sh + anita) and Linux (buildrump.sh)

RSS XML Feed