Commit Graph

310 Commits

Author SHA1 Message Date
justin 6f964b7d23 Minix also has getenv_r support 2014-09-29 15:54:28 +00:00
pooka b124cf15b4 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.
2014-08-25 14:58:48 +00:00
justin 404e3c9501 lso translate errno in the rumpfiber version 2014-08-25 10:33:32 +00:00
justin 103543d43b Add errno translation for bio operations 2014-08-25 10:21:39 +00:00
pooka 82dada912f RCS Id police (because we can. or have you heard of git id police?) 2014-08-24 14:37:31 +00:00
pooka de743a993f * attempt to clarify what "POSIX" means
* link to Platforms page on wiki for a list of known implementation
2014-08-24 14:35:27 +00:00
justin aaf730d309 Add missing include 2014-08-20 12:09:15 +00:00
justin 28e2f06e08 Clean up error handling in rumpuser_init() 2014-07-25 14:00:31 +00:00
justin 648d66f04b 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@
2014-07-22 22:41:58 +00:00
alnsn e77183a6da Remove unused file. 2014-07-14 10:36:33 +00:00
justin 3620d3dbee Add a fiber based implementation of librumpuser in addition to the
default pthreads based version.

Discussed with pooka@
2014-07-11 20:26:31 +00:00
justin 10b89fe038 Reinstate include of netdb.h, needed on some cross builds 2014-07-10 08:17:43 +00:00
justin 4ce85d0b6f 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@
2014-07-09 23:41:40 +00:00
pooka 2f525beeee Hrmph, revert previous pending another fix. I tested it yesterday with
a slightly older tree, and of course it doesn't work anymore ...
2014-06-23 12:38:18 +00:00
pooka fbc749c67d 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).
2014-06-22 20:17:23 +00:00
justin 9dd44a1195 Applications are not supposed to and do not need to include <features.h> explicitly 2014-06-17 09:53:59 +00:00
alnsn f6181a22c5 Antti objected to including rumpuser_sync_icache. Exclude it from the build. 2014-06-17 08:42:35 +00:00
alnsn e0a3ca70e0 For consistency with other files in the same directory
don't include <sys/cdefs.h> before __RCSID.
2014-06-17 06:43:21 +00:00
alnsn bb8c3186cb Implement rumpuser_sync_icache hypercall. 2014-06-17 06:31:47 +00:00
alnsn 46b0c1cbc8 Add __RCSID. 2014-06-16 21:07:28 +00:00
pooka ce1cd03e24 Remove one more symbol reference to librump (missed in previous commit
to this file)
2014-06-14 11:52:42 +00:00
pooka d5b308ef63 do previous the right way to avoid rumpuser linkage dependency on librump 2014-05-23 16:57:42 +00:00
pooka 5fbc8e741c 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).
2014-05-23 11:04:03 +00:00
pooka 0cafe662ce weak alias removal implication: rumpuser_dl_globalsym() can now sleep
with the fishes.
2014-04-27 15:18:59 +00:00
justin 95e41b89b5 Add Android support for rump kernel.
Reviewed by pooka@
2014-04-02 17:09:23 +00:00
pooka cd76e7c732 Always use sysconf() to query host processor count instead of separate
tricks for each platform.
2014-04-02 13:54:42 +00:00
pooka 0ab0c8a502 fix name of HAVE_PTHREAD_SETNAME_3 2014-03-21 16:03:35 +00:00
pooka fe7fe5876f fix braces 2014-03-21 16:03:07 +00:00
pooka bc215c110d use a probe result to decide which pthread_setname_np() to use 2014-03-21 12:28:54 +00:00
pooka fa5f7ef47e set threadname for correct pthread_t 2014-03-21 12:07:10 +00:00
njoly 61d6bfec15 Do not use uninitialized pointer if posix_memalign() fails. 2014-03-16 10:23:59 +00:00
justin 54d90457f6 If dlopen returns NULL assume we are statically linked and return,
rather than getting a warning when dlinfo fails.
2014-03-14 01:18:39 +00:00
pooka 300f37afc0 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
2014-03-13 11:21:54 +00:00
justin cf83766ecf Revert conversion to __thread as breaks on archs without TLS support 2014-03-10 22:37:51 +00:00
justin 587ef2949a Use __thread rather than pthread_getspecific for rumpuser curlwp.
This has better performance and curlwp is a performance bottleneck
in rump kernel code.
2014-03-09 23:01:11 +00:00
pooka 8a7d14d1c2 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.
2014-02-28 13:55:36 +00:00
pooka a2867970a4 emulate printflike properly to avoid fatal error on clang 2014-02-25 20:58:18 +00:00
pooka 613311d8d7 remember to commit this file too 2014-02-20 01:24:49 +00:00
pooka fb8e281673 make implementation of rumpuser_kill() match the documentation 2014-02-20 00:44:20 +00:00
pooka 64a85ea946 document rumpuser_kill() 2014-02-20 00:43:26 +00:00
pooka 437e54a701 Translate signal numbers between rump kernel and (POSIX) host. 2014-02-20 00:42:27 +00:00
pooka 177c2413c9 minor clarification: rumpuser_thread_create() is used to create the host
thread context for kernel threads, never for application threads.

per discussion with justin
2014-02-14 00:33:51 +00:00
pooka 8d2ee87e24 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).
2014-01-16 16:03:33 +00:00
pooka 29316c504c Make setprogname() a nop where it's not supported. 2014-01-15 16:53:15 +00:00
pooka 2b361b10dd remove obsolete definitions 2014-01-08 11:04:47 +00:00
pooka 6459f6aa95 do as the comment says and #if defined(every_other) || defined(platform) || ...
===> #if !defined(__NetBSD__)
2014-01-08 01:47:31 +00:00
pooka f67143f64b OpenBSD support
from Justin Cormack via github
2014-01-08 01:45:29 +00:00
pooka 55ffc8641a Do not export symbols which don't need to be exported.
via Justin Cormack
2013-12-31 00:25:17 +00:00
pooka cbbcae5f8b remove outdated comment (since quite a few months ago) 2013-12-18 20:24:04 +00:00
pooka 9f9913cebe Workaround a gcc -Wuninitilized whine
github/buildrump.sh issue #44
2013-11-01 23:22:13 +00:00
pooka d3852222c9 Oh, stdint.h isn't written with a comma ... 2013-10-30 13:08:14 +00:00
pooka e5aed19d72 need to include stdint.h before rump/rumpuser.h 2013-10-30 12:55:53 +00:00
pooka 079cd2100d glibc on MIPS uses the same DYN d_ptr variant as NetBSD and musl.
from Justin Cormack
2013-10-30 12:30:32 +00:00
rmind d60eb8c12f librumpuser: add some #ifdef __APPLE__ and missing bits to build it on OS X.
OK pooka@
2013-10-27 16:39:46 +00:00
rmind 0f412aba18 Give RUMP mutex and rwlock their own cache-line. Also give a separate
cache-line for the rwlock's reader counter.
2013-09-26 00:41:51 +00:00
rmind 72b022939e 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.
2013-09-24 23:45:16 +00:00
pooka 4be69cd08b 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)
2013-09-23 10:35:20 +00:00
pooka b3e8687dfb more platform-specific qualifiers 2013-09-10 17:58:39 +00:00
pooka 6cd40f3fba Install rumpuser_port.h 2013-09-10 16:51:24 +00:00
pooka e9fe155c86 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.
2013-08-14 08:29:25 +00:00
pooka f3adf1e54f comment polish: just musl 2013-07-30 18:56:03 +00:00
pooka aaf7a23bf7 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
2013-07-30 18:48:51 +00:00
njoly f2bb7e6625 Use <major>.<minor> for NetBSD version. 2013-07-22 12:36:56 +00:00
pooka 3fcbbf6450 TIMEVAL_TO_TIMESPEC (for musl)
from Justin Cormack
2013-07-22 08:58:31 +00:00
pooka 40fd6d6fa3 Fixes when compiling against musl libc.
from Justin Cormack via private email
2013-07-20 18:46:15 +00:00
pooka f768d01c4f Fix build where compiler can throw an array-bounds error and
code is built with NDEBUG
	or
	platform's assert is not __dead
2013-07-18 12:28:26 +00:00
pooka 69c4f929cd FreeBSD does the Solaris-like map->l_addr boogie.
from Ben Gras
2013-06-04 15:17:28 +00:00
wiz 890db9708a More markup, less typos. 2013-05-15 22:09:32 +00:00
pooka 03395b4cf5 also, bsd.own.mk to pick up mk.conf 2013-05-15 20:47:20 +00:00
pooka 5666bf4b73 Make it possible for external parties to specify additional dplibs.
This is useful for example on platforms which require -ldl.
2013-05-15 20:27:00 +00:00
pooka 907ce8379e Improve documentation on the locking order of cv_wait mtx/cpu. 2013-05-15 17:53:09 +00:00
pooka 3306a659de Add a generalized rumpuser_syncfd() call which allows the caller
to request a sync or a barrier for fd.
2013-05-15 15:57:01 +00:00
pooka 601de6b09f 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
2013-05-15 14:58:24 +00:00
pooka 15dc8bf975 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.
2013-05-15 14:52:49 +00:00
pooka d0d5069c1a Add RUMPUSER_LWP_CLEAR instead of overloading RUMPUSER_LWP_SET.
This simplifies some alternative hypervisor implementations.
2013-05-15 14:07:26 +00:00
pooka af9586a1db need the rw_downgrade/tryupgrade methods too 2013-05-07 16:40:31 +00:00
pooka c0e1ad2997 update to recent interface changes 2013-05-07 15:37:05 +00:00
pooka 059f8df6f9 include stdint.h before rumpuser.h (on some platforms it doesn't get
there automagically)
2013-05-07 15:18:35 +00:00
pooka 302678cea5 Initialize rw->downgrade when allocating a rwlock.
should/might/etc fix recent test hangs reported by martin & pgoyette
2013-05-05 12:27:38 +00:00
wiz 1747869c0f Fix some punctuation nits and bump date for previous. 2013-05-03 20:27:16 +00:00
pooka cfbb87e05b Support proper rw_downgrade() semantics. 2013-05-03 00:23:49 +00:00
pooka 92e27cb3c3 reorder for better locality. no functional change. 2013-05-02 22:07:57 +00:00
pooka f448fededb update for previous change 2013-05-02 21:47:12 +00:00
pooka 5606f9bf46 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.
2013-05-02 21:45:28 +00:00
pooka f950fd3d52 Push rwlock upgrade and downgrade into the hypervisor where there's
at least a chance to implement them with minimal fuss.
2013-05-02 21:35:19 +00:00
pooka 9a6702d07c 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*
2013-05-02 20:33:54 +00:00
pooka 939c69c331 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.
2013-05-02 19:14:59 +00:00
pooka 5fe33bdc4b 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().
2013-05-02 16:49:08 +00:00
pooka 75af291e99 add HISTORY 2013-05-02 15:32:19 +00:00
pooka 47795d39b6 expand the intended usage of rumpuser_open() 2013-05-02 12:27:08 +00:00
pooka a4068b6249 avoid Wunused on !NetBSD 2013-05-01 17:17:54 +00:00
pooka aed84d6b35 document the hypercall interface 2013-04-30 21:18:40 +00:00
pooka 152588e3a9 Flip parameter order in the clock hypercalls to make them consistent
with everything else wrt in/out parameters.
2013-04-30 16:03:44 +00:00
pooka 6601e4ea9f put optional modules on a separate SRCS line 2013-04-30 15:48:29 +00:00
pooka 2e5a2855bd make this build/work again 2013-04-30 13:37:03 +00:00
pooka c46eb786b4 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).
2013-04-30 13:29:28 +00:00
pooka be085dcd72 Translate error codes between the hypervisor and rump kernel. 2013-04-30 12:39:20 +00:00
pooka 8f668dabd5 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).
2013-04-30 11:26:26 +00:00
pooka 32a34307fa Make hypercall calling conventions consistent: iff a hypercall can fail,
it returns an int containing the error value.
2013-04-30 00:03:52 +00:00
pooka 0dc3609e1c 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.
2013-04-29 20:08:48 +00:00