Commit Graph

14593 Commits

Author SHA1 Message Date
jruoho 5c9efd7bb1 Xref __builtin_return_address(3). 2010-12-19 09:33:52 +00:00
jruoho a20c806d96 Small modifications to wording, tidy up SEE ALSO. 2010-12-19 08:28:40 +00:00
jruoho 6f013d76df Fix SYNOPSIS, add CAVEATS. 2010-12-19 08:21:36 +00:00
christos 66f16a1fa6 I've had this patch in my tree for a while and since it only improves
the situation, I decided to commit it. There is an inherent problem
with ASLR and the way the pthread library is using the thread stack.

Our pthread library chooses that stack for each thread strategically
so that it can locate the location of the pthread struct for each
thread by masking the stack pointer and looking just below the red
zone it creates. Unfortunately with ASLR you get many random values
for the initial stack, and there are situations where the masked
stack base ends up below the base of the stack. (this happens on
x86 when the stack base happens to be 0x???02000 for example and
your mask is stackmask is 0xffe00000). To fix this, we detect the
pathological cases (this happens only in the main thread), allocate
more stack, and mprotect it appropriately. Then we stash the main
base and the main struct, so that when we look for the pthread
struct in pthread__id, we can special case the main thread.

Another way to work around the problem is unlimiting stacksize,
but the proper way is to use TLS to find the thread structure and
not to play games with the thread stacks.
2010-12-18 15:54:27 +00:00
njoly 53ac8d2f21 Fix typo in cross-refernce. 2010-12-17 23:57:07 +00:00
christos 3a693ad8ca PR/44248: Antti Kantee: Fix multi-threaded localtime hang. 2010-12-17 23:11:57 +00:00
njoly 9f266c104e Fix cross-reference, dir(5) -> dirent(3). 2010-12-17 19:20:42 +00:00
wiz db9d3e0efd Sort ERRORS. Fix a typo. Readd macro usage lost in previous.
Remove trailing whitespace.
2010-12-17 01:30:50 +00:00
wiz a5f2300ef5 Sort SEE ALSO, add a serial comma. 2010-12-17 01:30:14 +00:00
wiz 72b0a97144 Use more markup. 2010-12-17 01:29:45 +00:00
joerg c4120e324e Replace use of errlist with a single concatenated version and an offset
array. This requires less storage and avoids one runtime relocation per
errno value.
2010-12-16 22:52:32 +00:00
christos d6bc393ba9 it is getname not time. 2010-12-16 22:18:37 +00:00
christos 84df4ad5ec add the 3 missing man pages. 2010-12-16 21:53:56 +00:00
christos 5a87b22ec6 Provide a re-entrant and thread-safe set of timezone API's that
don't require locking and can operate on user-specified timezones
as opposed to having to alter the environment to change a timezone.
This work was presented to the tzcode folks and it was generally
accepted, but there seems to be a lot of inertia.
2010-12-16 18:36:47 +00:00
jruoho 595da22eed Reference __builtin_object_size(3) and attribute(3) with each other. 2010-12-16 17:50:39 +00:00
wiz 3d3c5d42cb Observe the following spelling:
- wide character (noun)
- wide-character (adjective)

Inspired by jmc@OpenBSD.
2010-12-16 17:42:25 +00:00
wiz 9d8035939e Add missing word. 2010-12-16 17:17:07 +00:00
pooka 393eecc12a 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.
2010-12-16 17:05:44 +00:00
pooka 02d25938f6 Describe the rump_sp facility a bit. 2010-12-16 15:29:28 +00:00
pooka f55f15b84d xfer rump_etfs 2010-12-16 12:39:39 +00:00
pooka 3c4a27f7cd Print a banner a connecting client. The banner contains rump sp
protocol version, os name, os revision and machine.
2010-12-16 12:38:20 +00:00
jruoho 9f95187844 .Fn, offset indent, complete reference. 2010-12-16 12:08:16 +00:00
jruoho fe6e1d361b Fix the references and -offset indent. 2010-12-16 11:57:20 +00:00
jruoho c1a91d0bee Use .Fn. 2010-12-16 11:49:35 +00:00
wiz d714991586 Use full month name in dates. 2010-12-16 10:08:27 +00:00
plunky aaac48679d bump date for previous 2010-12-16 08:45:32 +00:00
plunky a1c148fc46 remove unnecessary step in example code
(sdp_service_attribute() did that already)
while here, start new paragraph for next example
2010-12-16 08:44:23 +00:00
jruoho 91e230c6b8 Fix xref; module(4) -> module(7). 2010-12-14 16:23:59 +00:00
jruoho 5c1bce6b00 Reference strsuftoll(3) and orders(7) with each other. 2010-12-14 13:00:34 +00:00
joerg 674a655551 Prefix ctype bitmask macros with _CTYPE 2010-12-14 02:28:57 +00:00
pooka 0c0346ae48 Don't __weak_alias non-existent symbols. Apparently the alpha
compiler doesn't like it.
2010-12-13 23:10:12 +00:00
pooka 5f35396ed8 last of the RUMP_ACTION syscall swappers 2010-12-13 21:07:54 +00:00
pooka 2f36209c20 Mirror sysctlgetmibinfo RUMP_ACTION change. 2010-12-13 14:17:11 +00:00
jruoho 05a9f55544 Xref module(4). 2010-12-13 10:07:46 +00:00
pooka 33c6814d7a document abortop. part of PR kern/44208 2010-12-13 09:06:51 +00:00
joerg 230ccda64c Don't bother with SCCS or the other RCSID conditionals. 2010-12-12 22:34:44 +00:00
christos b3ddcb3ea2 errlist.c is automatically generated now. 2010-12-12 20:22:48 +00:00
christos 5eeef29dbe remove comment 2010-12-12 20:16:09 +00:00
christos 91083d6e86 Automatically generate the error list. 2010-12-12 20:08:27 +00:00
christos 245a0c0325 remove old libpcap. 2010-12-12 18:52:41 +00:00
christos 49f71b9cd5 PR/42549: Izumi Tsutsui: parsedate does not work after 2038.
Fix multiple issues:
- Remove bogus 2038 check and add overflow checks in the appropriate places.
- Correct incomplete leap year calculation that broke things after 2100.
- Check localtime return values
- Change int calculations to time_t to avoid oveflow.
- Consistently check/return -1 and remove bogus comment about not being
  able to return -1.

Now:
$ date -d 20991201
Tue Dec  1 00:00:00 EST 2099
$ date -d 40991201
Tue Dec  1 00:00:00 EST 4099
$ date -d 10000000991201
Tue Dec  1 00:00:00 EST 1000000099
TIME=0:04.48 CPU=117.8% (5.288u 0.000s) SWAPS=0 (0+95)pf (0i+0o) (0Kc+0Kd)
$ date -d 100000000991201
date: Cannot parse `100000000991201'
TIME=0:53.48 CPU=99.2% (53.086u 0.000s) SWAPS=0 (0+96)pf (0i+0o) (0Kc+0Kd)
Exit 1
2010-12-12 18:39:57 +00:00
pooka 34c8240044 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?)
2010-12-12 17:58:28 +00:00
pooka c59435eea2 add rumpuser_sp_fini, which surpringly is the opposite of rumpuser_sp_init 2010-12-12 17:10:36 +00:00
pooka 939300d48c outdated comment 2010-12-12 13:48:55 +00:00
plunky 90c70dd232 rearrange libraries to reduce the number of .WAITs (14 -> 6)
during that, fix some outdated comments & list dependents
2010-12-12 12:09:51 +00:00
tsutsui be1c859466 We can't assume syscall retains t0, unless it's documented as ABI. 2010-12-12 09:03:06 +00:00
tsutsui f3f411dad2 brk(2) should update __curbrk, not __minbrk or garbage. 2010-12-12 09:00:37 +00:00
joerg 6ccee47911 Revert last as gcc(1) checks for -r to disable passing down --relax e.g.
on Sparc.
2010-12-10 20:06:17 +00:00
abs eb439bf1a7 Add noieee versions for lround(), lroundf(), lrint(), lrintf(),
llrint() and llrintf().  Code copied from round(), roundf() and
rint() and modified for return values.  Its possible this may not
do the right things in edge cases, but if so its likely to have
the same issues as the existing round(), roundf() and rint().

All this used by vax (only), and should allow xnest to complete
build.
2010-12-09 22:52:59 +00:00
joerg cb6cc2679c Wrap sys_errlist constants in a macro to make it easier to extract
the strings reliably with sed/awk.
2010-12-09 21:27:31 +00:00
njoly a2a0aef6cd s/curses_fileo/curses_fileio/ in xrefs. 2010-12-09 13:26:27 +00:00
njoly b0b35bdc77 Add missing space in fread xref. 2010-12-09 11:21:49 +00:00
njoly 5db815a78e Convert a few macros to Vt (variable type). 2010-12-09 09:22:31 +00:00
christos 75a9445418 use %option noinput 2010-12-08 03:19:19 +00:00
joerg 72183148bb Explicitly pass down -r as linker option. 2010-12-08 02:07:25 +00:00
joerg 3b7d8067b3 Don't redeclare __isthreaded. 2010-12-08 02:07:03 +00:00
joerg 6ab2cfd0b3 Use __isthreaded from reentrant.h and don't redeclare it. 2010-12-08 02:06:38 +00:00
joerg 7a8f98483f input() is not used, so don't provide it. 2010-12-08 02:05:39 +00:00
joerg bd9a53cf30 Since limit and l are both unsigned, comparing to 0 doesn't work, so compare
the values directly.
2010-12-07 22:02:52 +00:00
joerg e325eedcc1 Remove tautology. 2010-12-07 22:01:45 +00:00
joerg aaf356760f Mark function as static and give it an explicit return type. 2010-12-07 22:01:22 +00:00
joerg cb63bb73c3 Don't use argument as direct format string. 2010-12-07 20:10:53 +00:00
joerg c37869d883 Build assembler sources with assembler compile rules. 2010-12-07 19:51:02 +00:00
pooka 248168affc Remove PUFFS_WITH_THREADS ifdef garbage, just use libc weak symbols. 2010-12-06 14:50:34 +00:00
dholland eb1ab8ee50 Improve previous to avoid changing the interface of an externally
exposed function. (But note that this function is neither documented
nor declared in any installed header file, and it probably should not
be externally exposed.) Related to PR 44183, closes PR 44186.
2010-12-06 00:05:38 +00:00
pooka fee25d6c52 rumpcrypto should never have been its own faction, so finally make
it a component under kern, i.e. rumpcrypto -> rumpkern_crypto.
2010-12-05 20:11:21 +00:00
christos 3542a25b9b hook new libpcap 2010-12-05 05:58:12 +00:00
plunky f33b316b63 Remove the do-external-lib and do-gnu-lib targets, along with
external/lib/Makefile and crypto/external/lib/Makefile, replacing
them all with SUBDIRs directly from lib/Makefile.

compat/compatsubdirs.mk becomes simpler now, as everything is built
from lib/Makefile, meaning all the libraries will now be built under
compat so update the set lists to account for that.
2010-12-03 21:38:46 +00:00
dholland 574c2fc5a2 add const, from PR 44183. 2010-12-02 04:42:46 +00:00
dholland 92417c82c1 Fix up bodgy code for printing completion matches; it used to sometimes
skip entries, print (null), run off the end of the array, or occasionally
receive SIGSEGV, and now will, hopefully at least, do none of that.

Based in part on the patch in PR 44183 from Sergio Acereda; I also
did some tidyup and fixed it to print top-to-bottom first like ls(1).
2010-12-02 04:35:17 +00:00
pooka 48ac8b3849 implement mutex_owner() 2010-12-01 17:22:51 +00:00
pooka 0f9fe55ba4 Umm, delete recursive mutex interface instead of renaming it. 2010-12-01 15:01:52 +00:00
pooka 5e1b7bf36d 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.
2010-12-01 14:59:37 +00:00
pooka 03f765ec9e lint care 2010-11-30 22:32:01 +00:00
pooka cc95cda0d4 lintsquelch 2010-11-30 22:30:43 +00:00
wiz 5657c17871 Add some consistency dots though they make not much typographic sense; however,
just as much as in the other places in the enumeration.
Use Pa for a path.
2010-11-30 22:00:01 +00:00
jruoho b4ba5c1508 Xref glob(7). 2010-11-30 21:03:07 +00:00
pooka ff46270ebc Hands off of stuff we need to keep hands off of. 2010-11-30 20:33:43 +00:00
pooka 82747810db Add missing .El
Maybe next we can have typoed comments break builds?
2010-11-30 19:50:25 +00:00
joerg cb0b8d7cc6 Fix stack alignment for non-constructor/destructor calls.
AMD64 stack is 16 Byte aligned at the start of the function,
so always push rbx.
2010-11-30 18:37:59 +00:00
pooka 0161ae951b ahem, use public interface names in the doc 2010-11-30 18:08:46 +00:00
pooka fe96301432 document rump_etfs 2010-11-30 17:32:28 +00:00
pooka 9670fcaf80 Remove dead code from previous revision. 2010-11-30 15:42:11 +00:00
tnozaki 96bcb898d4 variable must to be nul terminated before "CODESET=foo".
ISO2022 module doesn't understand this and may fail setlocale(3).
2010-11-30 15:25:05 +00:00
pooka fbdc3da9ae Change RUMP_SP_CLIENT to RUMP_SERVER. The former was, in addition
to being annoying to write, slightly misguiding, since it contains
the server url.
2010-11-30 14:24:40 +00:00
pooka 7332ad1515 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.
2010-11-30 14:23:24 +00:00
pooka 1e3b8bd985 add commented-out -D_DIAGNOSTIC 2010-11-30 14:08:39 +00:00
dholland 297e393f26 SAVENAME and HASBUF namei flags have been removed; update accordingly.
(pooka@ says not to worry about compat.)
2010-11-30 10:49:22 +00:00
pooka d402686fe2 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.
2010-11-29 16:08:03 +00:00
drochner 240e9917d0 fix accuracy problems in argument ranges where j0(x) is small, closes
PR lib/44170 by Henning Petersen
(originally from Steven G. Kargl per FreeBSD PR bin/144306)
2010-11-29 15:10:06 +00:00
pooka ea8aecd4f3 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.
2010-11-29 11:40:54 +00:00
skrll 15fa0783d7 Centralise USE_COMPILERCRTSTUFF.
PCC might need help.
2010-11-28 18:40:54 +00:00
wiz 80b39d395e Fix typo in comment. 2010-11-28 01:31:26 +00:00
wiz cb676ec98b Remove superfluous comma. 2010-11-28 01:28:21 +00:00
christos fabd9ea05b explain better what's going on here. 2010-11-28 00:50:16 +00:00
jnemeth 22405528a4 Rename the autoloaded property list from <module>.prop to <module>.plist
as discussed on tech-kern.
2010-11-28 00:26:38 +00:00
christos 5fe11453fa fix lint warning. 2010-11-27 21:22:11 +00:00
christos d5ea004dc7 Implement VIS_NOESCAPE and VIS_HTTP1866. 2010-11-27 19:44:21 +00:00
christos b77d89c7da ansify 2010-11-27 18:33:54 +00:00
pooka bd26e667a8 Since we are going to handle syscalls in our threads, limit stacksize.
(unfortunately though, pthread_attr_setstacksize() has no effect on NetBSD)
2010-11-27 18:30:51 +00:00
dholland 01cef2d63e Return error on failure instead of hiding it and always returning zero.
From Henning Petersen in PR 44152.
2010-11-26 22:01:53 +00:00
pooka f0d58f7830 Fix a few locking problems with multithreaded clients.
TODO: make server deal graciously with out-of-resources conditions
2010-11-26 18:51:03 +00:00
pooka 6e0e64ab1b Improve reliability in cases where client disconnects mid-operation. 2010-11-26 14:37:08 +00:00
pooka 404fa78c67 update comment 2010-11-26 11:12:06 +00:00
pooka 22b33166de rumpuser should not be included outside of the rump kernel (and
rumpuser itself)
2010-11-26 11:10:53 +00:00
pooka 7ca02bea53 Plug recently introduced memory leak: release lwp after use instead of
just switching away.

Also, make freeing syscall arguments a little more symmetric.
2010-11-26 10:59:14 +00:00
dholland 6e4e77d46e No file system I know of reports directory sizes that are multiples of
sizeof(struct dirent) except by accident. So, sync with reality. Brought
to my attention by Taylor R Campbell in chat.
2010-11-25 20:53:23 +00:00
pooka 6b71288c49 *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.
2010-11-25 17:59:02 +00:00
pooka 6d4b60f246 create pthread attribute only once 2010-11-24 20:29:13 +00:00
pooka d693e691bf unsnafu previous 2010-11-24 17:20:24 +00:00
pooka 5e5fac56c7 update locking proto, use unputwait 2010-11-24 17:03:39 +00:00
pooka 0f9bd961a2 Unschedule from CPU for out-of-kernel blocking ops. Otherwise we
might even deadlock if the thread that wakes us up wants a CPU.
2010-11-24 17:00:10 +00:00
pooka b99a42f8f3 improve threadsafety 2010-11-24 15:17:46 +00:00
pooka adabf68496 missed part of earlier commit 2010-11-24 14:32:42 +00:00
pooka c21ac41b0b Sneeze some locking into connect/disconnect. 2010-11-24 11:40:24 +00:00
christos 05f534f3c7 PR/44132: Wolfgang Stukenbrock: libc/rpc may overwrite not-allocated memory
Return XPRT_DIED when realloc fails for lack of a better error.
2010-11-23 14:02:01 +00:00
pooka 85503d7b13 Install rumpclient to /lib to allow non-/usr users.
pointed out by tron (thanks!)
2010-11-23 12:41:47 +00:00
tnozaki 115137ad39 to initialize mbstate_t, use memset instead mbrtowc. 2010-11-23 05:38:35 +00:00
pooka 9be034428c 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.
2010-11-22 20:42:19 +00:00
plunky 33166e16fa use cached values directly rather than querying device for
features and buffer_size
2010-11-22 19:59:04 +00:00
adam d26d65ff82 Use ssh_add_identity_constrained() instead of ssh_add_identity() 2010-11-21 20:41:36 +00:00
christos cd56d093b1 build the ldap libraries; am-utils needs them. 2010-11-21 03:43:39 +00:00
plunky 231f6b581d use atomic ops wisely 2010-11-20 12:12:21 +00:00
pooka ad5cf5ab43 squelch the compiler whine 2010-11-19 17:47:44 +00:00
pooka 120195d187 document RUMP_NVNODES 2010-11-19 17:35:04 +00:00
pooka a2b42bab81 Support multithreaded clients and fix a few bugs. 2010-11-19 17:09:44 +00:00
pooka b82590c0a3 delint 2010-11-19 15:40:55 +00:00
pooka 52f22b2c6a 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.
2010-11-19 15:25:49 +00:00
christos b0f3f04a67 PR/44113: Nicolas Joly: printf(3) should ignore zero padding for nan/inf 2010-11-19 00:44:18 +00:00
pooka 48257b3e61 free syscall data after use 2010-11-17 17:36:14 +00:00
tron 4a3a313897 Include "namespace.h" to get namespace protection. 2010-11-17 13:25:53 +00:00
tron aacd5349be Provide proper namespace protection for rbtree(3) because it is now
used by "libc" internally.
2010-11-17 13:19:32 +00:00
tron d0e6f50de3 Implement mark & sweep garbage collection as suggested by Enami Tsugutomo
on "current-users" mailing list. Garbage collection is performed if:
1.) We previously allocated memory for the environment array which
    is no longer used because the application overwrote "environ".
2.) We find a non-NULL pointer in the allocated environment array after
    the end of the environment. This happens if the applications attempts
    to clear the environment with something like "environ[0] = NULL;".
2010-11-16 17:23:10 +00:00
enami 4f54ea7667 Fix typos in comment. 2010-11-16 03:02:20 +00:00
christos a85c37d8d9 don't increment i twice in the loop. From Michael Byrnes 2010-11-15 21:24:31 +00:00
pooka e9e1ac535f Make int *error and optional parameter (i.e. it can be NULL).
Sometimes the caller just doesn't care which errno close() might
throw.
2010-11-15 15:23:32 +00:00
tron 103af04b49 Don't use internal libc function __findenv(). 2010-11-14 22:25:23 +00:00
tron 2f85740ecc 1.) Rename internal function __findvar() to __findenvvar().
2.) Add a wrapper function __findenv() which implements the previous
    *internal* interface. It turns out that ld.elf_so(1) and pthread(3)
    both use it.

Stripping e.g. "LD_LIBRARY_PATH" from the environment while running
setuid binaries works again now.
2010-11-14 22:04:36 +00:00
tron 268c79e4cc Set errno to ENOENT if we reject the environment variable name in
getenv_r() instead of leaving it unchanged.
2010-11-14 20:37:02 +00:00
tron fbf4aa1699 Improve and simplify implementation of *env(3) functions:
- Use RB tree to keep track of memory allocated via setenv(3) as
  suggested by Enami Tsugutomo in private e-mail.
  This simplifies the code a lot as we no longer need to keep the size
  of "environ" in sync with an array of allocated environment variables.
  It also makes it possible to free environment variables in unsetenv(3)
  if something has changed the order of the "environ" array.
- Fix a bug in getenv(3) and getenv_r(3) which would return bogus
  results e.g. for " getenv("A=B") " if an environment variable "A"
  with value "B=C" exists.
- Clean up the internal functions:
  - Don't expose the read/write lock for the environment to other parts
    of "libc". Provide locking functions instead.
  - Use "bool" to report success or failure.
  - Use "ssize_t" or "size_t" instead of "int" for indexes.
  - Provide internal functions with simpler interfaces e.g. don't
    combine return values and reference arguments.
  - Don't copy "environ" into an allocated block unless we really need
    to grow it.

Code reviewed by Joerg Sonnenberger and Christos Zoulas, tested by
Joerg Sonnenberger and me. These changes also fix problems in
zsh 4.3.* and pam_ssh according to Joerg.
2010-11-14 18:11:42 +00:00
plunky 9dc6fb5c3d quell some lint warnings 2010-11-13 19:43:56 +00:00
christos f214ecbad3 forgot to commit this one for two months!
add vdprintf.
2010-11-13 19:41:32 +00:00
uebayasi 9a0d0defa9 Fix build. 2010-11-12 04:52:08 +00:00
pooka ac0efea1ab 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.
2010-11-10 16:12:15 +00:00
enami 5260b632e4 Clear all entries past the NULL while scrubing environ vector. 2010-11-10 02:40:08 +00:00
enami ef075363bd Indent using tab rather than four spaces. 2010-11-10 02:33:49 +00:00
pooka 2ddc760fc7 Need getifaddrs() for the rump client since it executes sysctl(2) 2010-11-05 16:23:56 +00:00
pooka 08fc937c06 make sysctl(8) work as a rump client 2010-11-05 15:55:23 +00:00
pooka 01eecd68eb Implement support for unix domain sockets (important especially
for testing since we don't want to depend on global resources such
as tcp ports).
2010-11-05 14:23:45 +00:00
pooka 83463bddd0 use -1/errno for failure: it's much more convenient for the users 2010-11-05 13:50:48 +00:00
blymn eb6f26d7ad Don't echo key symbols. 2010-11-05 11:38:54 +00:00
christos ee29967bad scrub the whole array, not just the first n malloced entries. 2010-11-04 21:49:45 +00:00
pooka 6b1f3dc0a5 Add library for rump syscall client stubs. 2010-11-04 21:01:28 +00:00
pooka 13e503f148 Refactor the sysproxy code so that rumpuser contains only the server side. 2010-11-04 20:54:07 +00:00
christos 9bc86f7706 PR/43998, PR/44021: In narrow history emulation, don't treat UTF-8 character
sets specially as far as history goes since we always need to do the conversion
from narrow [history] to wide [editline].
2010-11-04 13:53:12 +00:00
plunky 5cf5f72e75 this page title is CDBW 2010-11-03 16:17:48 +00:00
christos 3954ad831d Handle the case where a program attempted to cleanup the environment by
setting *environ = NULL;
2010-11-03 15:01:07 +00:00
skrll 162991256a Spell immediately correctly. 2010-11-02 20:49:47 +00:00
enami b447d18264 - Simplify the code
- Reword the comment.
2010-11-02 03:44:05 +00:00
pooka 5629968a95 Missed a few symbols in previous ...
Also, reorganize rumpuser header inclusion to make sure problem is
caught already by the compiler.
2010-11-01 13:55:19 +00:00
pooka 8fc7f9077e Make librumpuser linkage once again free of librump.
problem pointed out by <he>
2010-11-01 13:49:10 +00:00
enami ee9d44a7c1 Double the array only when really necessary. Otherwise memory will be
exhausted if user modifies the variable envrion itself repeatedly..
2010-11-01 02:41:27 +00:00
mbalmer aa94cc597c Link Lua to the build and add the resulting files to the distribution sets.
Document the addition of Lua and the change we made to the default settings.
2010-10-31 11:52:50 +00:00
pooka 4b75e68c49 update with reality 2010-10-29 15:38:15 +00:00
pooka f128c061ef 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.
2010-10-28 14:37:29 +00:00
pooka b1842c2201 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).
2010-10-27 20:44:49 +00:00
wiz 51a05c8628 Fix a typo and remove trailing whitespace. 2010-10-27 19:18:00 +00:00
christos de19ef9132 markup improvements, document ctype_r, time_t is not a "long integer" 2010-10-27 19:16:04 +00:00
wiz 83306973da Improve wording after consultation with njoly. 2010-10-26 22:34:33 +00:00
njoly 5d63576039 Make putenv(3) fails with EINVAL for a null pointer, or for a string
that either miss or start with a `=' character.

Adjust man page and testcase accordingly.
2010-10-25 20:35:36 +00:00
wiz ecad7beb9c Bump date. 2010-10-25 07:37:11 +00:00
dholland 6d14a316d9 Mention err/warn. Note that they're generally preferred to perror().
Might want to strengthen the wording.
2010-10-24 23:10:51 +00:00
tron 1dc4fb4ea1 Double the size of the allocate environment vector when we resize it.
This should speed up extending the environment via setenv(3).
2010-10-24 17:53:27 +00:00
tron 410614d6b3 Replace _FPOS_OVERFLOW() macro with a static inline function called
__fpos_overflow() that doesn't cause any lint warnings.
2010-10-24 17:44:32 +00:00
christos f70a466a92 fix fd leak found by Igor Zinovik 2010-10-23 23:27:40 +00:00
stacktic 7bede9ad38 Do not return -1 on _kvm_read when all the requested data could be read (fix bin/38648) 2010-10-23 14:34:12 +00:00
christos 3dbfe3dd7e tell lint to shut up. 2010-10-23 14:12:50 +00:00
christos 13fa4dc134 not that it can happen, but make the test more robust. 2010-10-22 22:00:32 +00:00
christos ec053f73a0 implement EOVERFLOW 2010-10-22 21:29:45 +00:00
christos 603e33ef32 Fix return value documentation. Add EOVERFLOW for ftell, but not for fseek. 2010-10-22 21:29:31 +00:00
njoly 4c968434a3 Make setenv(3) follow the standard, by rejecting invalid strings. It
now fails with EINVAL errno when variable is NULL, empty or contains
an `=' character; or value is NULL.

Adjust the man page accordingly, and exercize them in the existing
environment testcase.
2010-10-16 11:23:41 +00:00
skrll e6cdac9c4b Implement dl_iterate_phdr.
Somewhat taken from FreeBSD. Manual page from OpenBSD.
2010-10-16 10:27:06 +00:00
christos f207e61c08 replace `` with $(). Hopefully with enough examples around people will
forget about ``.
2010-10-12 12:57:51 +00:00
christos e6dabc3c76 PR/43961: YAMAMOTO Takashi: uninitialized variable in termcap.c
Remove dead code.
2010-10-12 12:49:27 +00:00
manu f4f951a0c1 Remove code supporting SOCK_STREAM, as SOCK_DGRAM works fine 2010-10-11 05:37:58 +00:00
manu f782f0a9e3 FUSE filesystems' readlink returns a resolved link with a NUL trailing
character, and PUFFS do not want it. This fixes this bug, that returned
stat the informations for x instead of reporting ENOENT:
mkdir x && ln x z && stat -x z/whatever/you/want
2010-10-11 01:52:05 +00:00
manu 5b646d774b - fix access control: pcn->pcn_cred is not user credentials
- Keep track of file generation
- remove size tracking in pnd_size, we have it in pn_va.va_size
2010-10-11 01:08:26 +00:00
enami 3cef3e6eba The was is not an argument but simply a part of sentense. 2010-10-07 00:14:14 +00:00
jym f15c6971d1 Import PAE support for kvm(3):
- add kvm_i386pae.c (used for PAE memory translations), and update Makefile
  for libkvm build.
- in pdppaddr: pass a flag to indicate PAE mode. Use a bit ignored
  by the MMU. Mask address with PG_FRAME to avoid side effects.

Tested with vmstat(1)/netstat(1) to debug core files of PAE and !PAE
kernels. Older kernel dumps will default to native i386 (!PAE) mode.

XXX Currently, savecore(8) will fail to dump a PAE kernel in a !PAE
    environment (and reciprocally). So you need to sync and reboot
    with a kernel of the same mode as the one that crashed. Once the dump
    is successful, this does not matter anymore.
2010-10-05 23:48:16 +00:00
enami 4a94dc0b8f Avoid unnecessary malloc(). Since __findenv() kindly treats
equal sign as an end of string, we can pass the string of
form "key=value" to lookup "key".
2010-10-05 02:23:38 +00:00
manu 3a9497b97a - delete an obsoelte comment about inactive
- remove a test for getattr return field that was never filled
- correctly send filehandle and filehandle flags for getaattr
2010-10-04 03:56:24 +00:00
manu 2ff0ea03a7 - Correctly handle rename whith overwritten destination
- Keep track of file name to avoid lookups when we can. This makes sure we
  do not have two cookies for the same inode, a situation that cause wreak
  havoc when we come to remove or rename a node.
- Do not use PUFFS_FLAG_BUILDPATH at all, since we now track file names
- In open, queue requests after checking for access, as there is no merit
  to queue a will-be-denied request while we can deny it immediatly
- request reclaim of removed nodes at inactive stage
2010-10-03 05:46:47 +00:00
tron ae557324e5 Restore binary compatibility with applications which use putenv(3)
on constant strings (e.g. postdrop(1)):
- Don't write to the environment string passed to putenv(3).
- Don't overwrite the value of an existing environment string
  unless the memory was actually allocated by setenv(3).
2010-10-02 16:56:03 +00:00
tron c3bcf19cf7 Make sure that all extra elements of the environment vector are set
to NULL. This stop su(1) from crashing.
2010-10-02 10:51:07 +00:00
tron 12c10b36d2 Remember that we didn't malloc() memory for an environment variable
if it has been set via putenv(3).
2010-10-02 10:05:55 +00:00
wiz 732dd678dd Fix a typo, remove trailing whitespace. 2010-10-01 20:57:50 +00:00
christos 7acc3301d8 make putenv POSIX compliant. 2010-10-01 20:11:32 +00:00
tron 2445ce72d2 Be slightly more careful about freeing memory allocated for environment
variables: only free memory if the current value points to the same
memory area as the allocated block. This will prevent crashes if an
application changes the order of the environment array.

Unfortunately this is still not enough to stop zsh 4.2.* from crashing.
zsh 4.3.* works fine before and after this change.
2010-09-30 12:41:33 +00:00
manu f7174423c5 = Open files =
- Restore open on our own in fsycn and readdir, as the node may not already
be open, and FUSE really wants it to be. No need to close immediatly, it
can be done at inactive time.

= Write operations =
- fix a nasty bug that corrupted files on write (written added twice)
- Keep track of file size in order to honour PUFFS_IO_APPEND

= many fixes in rename =
- handler overwritten nodes correctly
- wait for all operations on the node to drain before doing rename, as
filesystems may not cope with operations on a moving file.
- setback PUFFS_SETBACK_INACT_N1 cannot be used from rename, we therefore
miss the inactive time for an overwritten node. This bounds us to give up
PUFFS_KFLAG_IAONDEMAND.

= Removed files =
- forbid most operations on a removed node, return ENOENT
- setback PUFFS_SETBACK_NOREF_N1 at inactive stage to cause removed
file reclaim

= Misc =
- Update outdated ARGSUSED for lint
- Fix a memory leak (puffs_pn_remove instead of puffs_pn_put)
- Do not use PUFFS_FLAG_BUILDPATH except for debug output. It makes the
lookup code much simplier.
2010-09-29 08:01:10 +00:00
enami be59ef257e If new length is exactly equals to the current length,
there is nothing to do.
2010-09-29 00:44:04 +00:00
enami 248290ef3a Don't put space before close paren. 2010-09-29 00:40:17 +00:00
enami abfd061908 Add missing period at the end of sentense. 2010-09-28 00:39:56 +00:00
tnozaki 9ef74dfbcf validate flags/oflags from __sflag() befere call __sfp().
reviewed by enami-san, thanks.
2010-09-27 17:08:29 +00:00
tnozaki 6d102a3218 fix off-by-one, pointed out by enami-san, thanks! 2010-09-27 16:50:13 +00:00
jym 8bb0c87c7e Define KREAD() inside kvm_private.h, for reusability. 2010-09-26 22:28:05 +00:00
yamt ab5972b02c fix rewinddir on nfs. fix PR/42879 (and probably PR/40229.) 2010-09-26 02:26:59 +00:00
christos 0588f13b3b be more conservative about allocing. 2010-09-25 19:31:51 +00:00
tron ed5e497e60 Remember the correct pointer which we will free later. 2010-09-25 19:10:37 +00:00
tron 1f5de17d4a Unlock the environment lock if __alocenv() fails. 2010-09-25 18:37:24 +00:00
tron 5cdca2e600 Remember memory used by allocated environment variables instead of
using a bitmap. This deals with the case where a variable is first
set via setenv(3) or putenv(3), then overwritten by changing
"environ" directory and afterwards overwritten with setenv(3) again.

This stops "zsh" from crashing under NetBSD-current.

Code reviewed by Christos Zoulas.
2010-09-25 18:11:40 +00:00
tron ac440cccfd Change last commit to Use "ptrdiff_t" instead of "intptr_t" because the
former is more appropriate in this case.
2010-09-25 14:00:30 +00:00
tron abf0c843b2 Add explicit cast to fix lint error on 32bit platforms. 2010-09-25 13:45:11 +00:00
wiz 14087bca56 Remove trailing whitespace, merge error sections for same error, nits. 2010-09-25 09:44:08 +00:00
uwe 46b35128cb Make groff happy. 2010-09-25 01:19:39 +00:00
christos 97fddff649 add man page as promised. 2010-09-24 21:50:56 +00:00
matt 3edad85883 If not using O32 on mips, we need to read ELF64 symbols too. 2010-09-24 15:57:15 +00:00
christos da3a4052e4 protect the __allocenv call with the mutex; from Enami 2010-09-24 14:34:44 +00:00
christos f6033a77ae Fix memory leaks; thanks Enami! 2010-09-24 14:31:15 +00:00
tnozaki 93b7363c93 add fmemopen(3) derrived from POSIX:2008.
libc minor bump.
2010-09-24 09:21:53 +00:00
christos 7db74b9a82 Use a bit array to keep track of malloced environment entries so we can
free them.
2010-09-23 17:30:49 +00:00
christos e957123b85 PR/43899: Nicolas Joly: setenv(3)/unsetenv(3) memory leak.
Partial fix: Don't allocate a new string if the length is equal to the
old length, because presumably the old string was also nul terminated
so it has the extra byte needed.
The real fix is to keep an adjunct array of bits, one for each environment
variable and keep track if the entry was allocated or not so that we can
free it in unsetenv.
2010-09-23 16:02:41 +00:00
manu bcf6f2f32a == file close operations ==
- use PUFFS_KFLAG_WTCACHE to puffs_init so that all writes are
immediatly send to the filesystem, and we do not have anymore write
after inactive. As a consequence, we can close files at inactive
stage, and there is not any concern left with files opened at
create time. We also do not have anymore to open ourselves in readdir and
fsync.

- Fsync on close (inactive stage). That makes sure we will not need to
do these operations once the file is closed (FUSE want an open file).
short sircuit the request that come after the close, bu not fsinc'ing
closed files,

- Use PUFFS_KFLAG_IAONDEMAND to get less inactive calls

== Removed nodes ==
- more ENOENT retunred for operations on removed node (but there
are probably some still missing): getattr, ooen, setattr, fsync

- set PND_REMOVE before sending the UNLINK/RMDIR operations so that we avoid
races during UNLINK completion. Also set PND_REMOVED on node we overwirte
in rename

== Filehandle fixes ==
- queue open operation to avoid getting two fh for one file

- set FH in getattr, if the file is open

- Just requires a read FH for fsyncdir, as we always opendir in read
mode. Ok, this is misleading :-)

== Misc ==
- do not set FUSE_FATTR_ATIME_NOW in setattr, as we provide the time

- short circuit nilpotent operations in setattr

- add a filename diagnostic flag to dump file names
2010-09-23 16:02:34 +00:00
njoly abdcf63ade Add empty line in ERRORS section. 2010-09-23 12:49:31 +00:00
wiz 98890d79a7 Bump date for O_DIRECTORY, more markup, merge two error sections. 2010-09-22 17:58:09 +00:00
roy 215c5976aa Our API just uses typedefs, so don't use the struct symbol which will avoid
any potential conflicts with userland.
2010-09-22 06:10:51 +00:00
chs 38b9dc3505 implement O_DIRECTORY as standardized in POSIX-2008,
for both native and linux emulations.
this fixes the rest of PR 43695.
2010-09-21 19:26:18 +00:00
jym 962a341df6 Change kvm_pa2off() and kvm_kvatop() prototypes (private to kvm(3)):
-int     _kvm_kvatop(kvm_t *, u_long, u_long *);
-off_t   _kvm_pa2off(kvm_t *, u_long);
+int     _kvm_kvatop(kvm_t *, vaddr_t, paddr_t *);
+off_t   _kvm_pa2off(kvm_t *, paddr_t);

Basically, use vaddr_t for VA and paddr_t for PA. In addition, for variables
representing addresses, use paddr_t or vaddr_t, depending on the context.

For most arches, vaddr_t and paddr_t are equivalent to unsigned long. However,
the change was needed for exotic situations, like i386 PAE, were unsigned long
is not suitable for PA which are 64 bits long. As this required a complete
change of the function prototypes, all arches had to be adapted accordingly.

Core files from before this commit should still work with the new code; I did
not see any direct dependency between core's structure and kvatop/pa2off.

The change was compile tested for all arches, as it impacts all of them.

See also:

http://mail-index.netbsd.org/current-users/2010/09/07/msg014249.html
2010-09-20 23:23:16 +00:00
christos fda2d7ca9f deal with infinity on the vax. 2010-09-20 17:51:38 +00:00
christos c80a34bc23 no more ieee ifdefs 2010-09-20 16:55:20 +00:00
christos 0a9ef41cbe get rid of ieee dependencies. 2010-09-20 16:53:30 +00:00
christos 852d033d43 shouldn't need ieee.h here. 2010-09-20 15:38:48 +00:00
manu 3d6861b56c - performance improvement for read, readdir and write. Now we use
SOCK_DGRAM, we can send many pages at once without hitting any bug

- when creating a file, it is open for FUSE, but not for the kernel.
If the kernel does not do a subsequent open, we have a leak. We fight
against this by trying to close such file that the kernel left unopen
for some time.

- some code refactoring to make message exchange debug easier (more to come)
2010-09-20 07:00:21 +00:00
jym f0583e593c KNF 2010-09-19 11:37:40 +00:00
jym 6dc46b923b Ansify and KNF all functions within kvm(3). No objection on current-users@.
Used as ground for u_long => vaddr_t/paddr_t replacements in kvm(3)
private functions.

Compile tested for all arches. See also:

http://mail-index.netbsd.org/current-users/2010/09/07/msg014249.html
2010-09-19 02:07:00 +00:00
christos 92da7545e1 don't compile long double support for the havenots. 2010-09-17 20:39:39 +00:00
drochner de41a05aef fix an obvious botch which made eg conjl(3) a no-op 2010-09-16 20:39:50 +00:00
christos b354315033 unbreak readline history. 2010-09-16 20:08:51 +00:00
yamt 53cf9ce3be - remove a wrong _DIAGASSERT
- update comments
- whitespace
2010-09-16 02:38:50 +00:00
wiz 0d8d67869e Remove trailing whitespace. 2010-09-15 18:40:27 +00:00
christos 98b923b685 commit long double SoC code from Stathis Kamperis 2010-09-15 16:12:05 +00:00
christos e2a86dd3c7 Commit SoC long double support from Stathis Kamperis 2010-09-15 16:11:28 +00:00
yamt f15acd14df remove RESTRICTIONS section, which seems unrelated to our implementation 2010-09-15 07:28:46 +00:00
manu e9a8a6acc0 - Use SOCK_DGRAM instead of SOCK_STREAM, as the filesystem seems to
assume datagram semantics: when using SOCK_STREAM, if perfused sends
frames faster than the filesystem consumes them, it will grab multiple
frames at once and discard anything beyond the first one. For now the
code can work both with SOCK_DGRAM and SOCK_STREAM, but SOCK_STREAM
support will probably have to be removed for the sake of readability.

- Remeber to sync parent directories when moving a node

- In debug output, display the requeue type (readdir, write, etc...)
2010-09-15 01:51:43 +00:00
matt 8e09c95f97 Resurrect this for MIPS softfloat. 2010-09-10 16:32:35 +00:00
drochner 927f8fc1e3 apply an 11 years old fix from FreeBSD:
if EBADF is returned due to a read from a write-only stream, also
set ferror()
found by a selftest of Python-2.6.6, thanks to obache for pointing
out the details
2010-09-10 10:29:23 +00:00
skrll 2a4732aadc Only do the __libc_init hack in libc, i.e. remove it from ld.elf_so.
This fixes hppa ld.elf_so by reducing the number of PLABELs required to
the number before the hack was applied.

Hi Joerg!
2010-09-09 10:19:31 +00:00
manu 17ce0ff611 - call FSYNCDIR for directories
- directories can be open R/W (for FSYNCDIR)
- do not skip calls to FSYNC or FSYNCDIR if the filesystem returned ENOSYS:
it may change its mind, and it may also actually do something when retunring
ENOSYS
- When FSYNC and FSYNCDIR return ENOSYS, do not report it to kernel (silent
failure)
2010-09-09 09:12:35 +00:00
pooka d33a80444e Simplify now that ukfs deals with being called from a thread which
already has a rump lwp context.
2010-09-07 17:22:53 +00:00
pooka 607d9b612a Migrate from rump private interfaces to syscalls. 2010-09-07 17:16:18 +00:00
manu fac2d0c060 Mode argument must contain the file type (S_* items) for create and mknod 2010-09-07 16:58:13 +00:00