Commit Graph

119 Commits

Author SHA1 Message Date
christos
e2bebf7172 * Arrange for interfaces that create new file descriptors to be able to
set close-on-exec on creation (http://udrepper.livejournal.com/20407.html).

    - Add F_DUPFD_CLOEXEC to fcntl(2).
    - Add MSG_CMSG_CLOEXEC to recvmsg(2) for unix file descriptor passing.
    - Add dup3(2) syscall with a flags argument for O_CLOEXEC, O_NONBLOCK.
    - Add pipe2(2) syscall with a flags argument for O_CLOEXEC, O_NONBLOCK.
    - Add flags SOCK_CLOEXEC, SOCK_NONBLOCK to the socket type parameter
      for socket(2) and socketpair(2).
    - Add new paccept(2) syscall that takes an additional sigset_t to alter
      the sigmask temporarily and a flags argument to set SOCK_CLOEXEC,
      SOCK_NONBLOCK.
    - Add new mode character 'e' to fopen(3) and popen(3) to open pipes
      and file descriptors for close on exec.
    - Add new kqueue1(2) syscall with a new flags argument to open the
      kqueue file descriptor with O_CLOEXEC, O_NONBLOCK.

* Fix the system calls that take socklen_t arguments to actually do so.

* Don't include userland header files (signal.h) from system header files
  (rump_syscallargs.h).

* Bump libc version for the new syscalls.
2011-06-26 16:42:39 +00:00
njoly
7c78532f22 Create empty temporary rumphdr.types file if missing; to avoid error
messages for compat syscalls files regen.
2011-06-05 14:13:53 +00:00
pooka
50313877de Include syscall.h and syscallargs.h from <srcsys> instead of <sys>
in the RUMP_CLIENT case.  This makes librumpclient compile against
-current sources regardless of host.

inspired by Taylor R Campbell
2011-03-08 18:29:49 +00:00
pooka
44586e77b0 Get rid of one explicit typecast in previous and let the compiler
figure it out.
2011-02-22 14:08:58 +00:00
pooka
9537ed0bcb Redo the register_t casting, but include a provision to make the
case where sizeof(rv) < sizeof(register_t) work.  Hopefully it
works now everywhere.  Only tests will show ...
2011-02-22 14:05:20 +00:00
pooka
55a5122e61 revert previous fix. it's not 100% correct and some compilers setups
complain about the generated code.

pointed out by mrg
2011-02-22 13:04:22 +00:00
pooka
c13b689c0c Use the whole contents of rval instead of just rval[0] for rump
syscall return.  Fixes at least lseek() on various architectures
in various ways.
2011-02-22 10:33:12 +00:00
pooka
f7f707facb S'no way bro!
Return the correct return value from NOERR, which is retval
instead of error.
2011-02-21 23:30:12 +00:00
pooka
0aac2843ad Add syscall type NOERR which signals that a system call is STD but
does not return an errno the usual way.  The main use case is to
fix the posix_fadvise() rump stub (yes, posix_fadvise is a bit
special... bologna).

The list of NOERR syscalls currently matches the libc NOERR list
(and the libc Makefile can in the future be autogenerated from this
info).

Problem spotted by, *shocker*, the automated test runs, specifically
the posix_fadvise test.
2011-02-21 23:20:19 +00:00
pooka
310e8fbde4 Make sure we don't expose any errno set as a side-effect of us
executing the system call.  Some software ignores the return value
and looks only at errno.
2011-02-21 11:29:53 +00:00
pooka
53c9307857 Rework how syscall compat is handled for rump syscalls. The old
one had the problem of bypassing the syscall layer and doing a
function call into the kernel directly.  Therefore there was no
way for users of librumpclient to specify compat.  The new model
pushes the compat handling in the kernel and leaves only the task
of selecting the right syscall number to the client.

This change also introduces a stable ABI for rump syscalls, i.e.
it is possible to use the same syscall client library both on NetBSD
5.0 and -current and get the syscalls resolved to the right place
depending on the ABI at the time the client binary is compiled.

A list of what to be called when will have to maintained separately
simply because this information is not available in syscalls.master
-- in the case of the normal kernel we always want to resolve a
newly linked syscall to the latest version, whereas in rump we
might want to resolve a syscall to a -current kernel to the 5.0
compat call (because our client namespace is 5.0).  This information
in maintained in rump_syscalls_compat.h with the current format:

/* time_t change */
#if !__NetBSD_Prereq__(5,99,7)
#define RUMP_SYS_RENAME_STAT rump___sysimpl_stat30
....

If no compat override is given, a syscall resolves automatically
to the latest version of the syscall.

Also, this change autogenerates forward declarations for all syscall
types where it is possible (i.e. ones without typedef insanity).
This makes it possible to include rump_syscalls.h without including
rump.h.
2011-01-17 16:16:54 +00:00
pooka
2f7b77901e Include system call name in comment even for unimplemented syscalls
in rump_syscalls.c.
2010-12-30 20:09:53 +00:00
pooka
afe2ca27dd Mark syscalls not supported by a rump kernel with SYCALL_NOSYS, as
pure function pointer comparison brings weak alias confusion (weak
aliases are necessary for static linkage).
2010-12-30 16:49:24 +00:00
pooka
cb92cf6235 whitespace polish in rump_syscalls.c 2010-12-30 13:38:10 +00:00
pooka
8b73c28f1c snafu in previous: extra printf arg 2010-12-30 11:54:50 +00:00
pooka
c86a7bcf7c Fill syscallnames up to nsysent so that n<nsysent has a non-hyperspace
string mapping.
2010-12-30 11:42:53 +00:00
pooka
b991c38551 Skip one extra function in the rump syscall local path and use
sy_call() directly from rump_syscalls.c.
2010-11-17 21:47:11 +00:00
pooka
c099830b29 Create rump_syscalls.c in two flavours: one which can be compiled
standalone as the clientside and one which expects to be compiled
into the rump kernel.
2010-11-04 20:50:29 +00:00
pooka
3c0f9a592b apply "shut up, lint" for syscallargs.h 2010-11-04 17:02:34 +00:00
pooka
8553c5887b Align comment column in output, no functional change. 2010-11-01 16:21:29 +00:00
pooka
5c6beee9f6 Use the generally more useful funcalias for rump syscalls. 2010-08-30 10:24:04 +00:00
pooka
7f9f73897e Include <rump/rump_syscalls_compat.h> from rump_syscalls.h. This
file will contain compat defs which are not autogenerated.
2010-07-19 15:25:47 +00:00
njoly
a00a76ca8d Add multiple inclusion protection to rump_syscalls.h. 2010-05-17 12:35:20 +00:00
pooka
14d288df20 _RUMPKERNEL -> _KERNEL 2010-05-11 20:09:11 +00:00
pooka
6ec71a1c75 Use sys_nomodule for modular rump system calls so that they can be
autoloaded.
2010-04-27 10:57:46 +00:00
pooka
e867c34ab2 Make is possible to add extra output at the top of syscallargs.h.
Use this feature to stick sys/mount.h in there.
2010-03-02 19:33:12 +00:00
skrll
e359b65038 Check for dev_t and time_t arguments and mark them as 64bit. 2010-01-05 15:23:32 +00:00
matt
dfa7467a6e Pullup from matt-nb5-mips64.
For each syscall, add a flag for the return value or an argument indicating
that it is a 64-bit argument.  Also include the number of 64-bit arguments.
In theory this could get most of the code in compat/netbsd32/netbsd32_netbsd.c
but not at the moment due to multiply defined structures.
2009-12-13 04:47:45 +00:00
pooka
baffc0cbae typo in comment (it actually breaks the script totally. i wish
more typos in comments were as effective)
2009-11-26 17:23:48 +00:00
pooka
67ff6315cd Add rump support for the special handling required by pipe(2). 2009-11-26 17:19:54 +00:00
pooka
a91020162b Instead of a single register_t as the retval of rump syscalls,
use an array of two.  No functional change ... yet.
2009-11-26 16:34:24 +00:00
pooka
0d8bdf6131 For varargs syscalls, create rump prototypes which match the regular
system call counterparts, e.g.:
open(const char *, int, mode_t) -> open(const char *, int, ...)
2009-10-13 21:54:29 +00:00
pooka
6c68c84345 Use argname PAD to signal that an argument is used only for padding
and not part of the C interface.  Use this information for rump
syscalls to generate syscall interfaces without the extra parameter.
2009-05-15 15:51:27 +00:00
pooka
500fdd36a7 In addition to off_t alignment, check for dev_t and time_t too
(we don't currently have any syscalls passing time_t, though)
2009-05-15 14:52:47 +00:00
pooka
2941a7af6e Include some headers to make rump_syscalls.h self-contained.
(not strictly correct wrt portability, but there are bigger fish
to saltgrill in that area)
2009-03-29 07:56:19 +00:00
pooka
0ef29cbdba Rename rump argument marshalling structure variable to "callarg" to
avoid collision with system calls which use "arg".
2009-03-18 17:27:04 +00:00
pooka
b50bd8632e Instead of linking rump system call entry points directly to the
backend, perform all calls through a syscall table.  This makes it
possible to make system calls to non-local rump kernels.
(requires a bit support code.  it's written but quite messy currently)
2009-02-20 17:56:36 +00:00
pooka
3e656734b8 cosmetic: don't print empty line at end of init_sysent.c 2009-02-14 16:21:23 +00:00
pooka
06abc8c3f9 Remove debug print -- this is what happens when there's several
hours between implementation and commit.
2009-01-23 19:29:38 +00:00
pooka
c7e5a8be4e Remove the "int *error" parameter from rump syscalls. Instead use
rumpuser_seterrno() to set the errno for the caller.  This makes
the difference between real and rump syscalls way less intrusive
in calling code.
2009-01-23 19:27:18 +00:00
pooka
32713ca49c Generate local prototypes in rump_syscalls.c and disallow using
the rump_syscalls.h interface from inside the rump kernel.
2009-01-14 19:40:30 +00:00
pooka
a9a2ce837b Convert the syscalls.master to a format from which it is easier
to parse and generate the compat name and basename (e.g. __stat50
and stat).  Use this to autogenerate __RENAME()'s to the rump_syscalls
header so that they can be called e.g. rump_sys_socket() instead
of rump_sys___socket30().
2009-01-13 22:27:43 +00:00
pooka
71ef2103a7 Print delimiters around expected string in parse error message. 2009-01-13 16:29:19 +00:00
pooka
b2acbf4328 fix error message: expecting (, not ) 2009-01-13 16:25:43 +00:00
pooka
786ff94e12 <rump/rump_syscalls.h>, not "rump_syscalls.h" 2008-11-16 18:40:13 +00:00
ad
119366618e Atomic insertion/removal of groups of system call vectors at runtime with
a basic facility for rollback.

Proposed on tech-kern@.
2008-11-12 14:29:31 +00:00
pooka
3a64aae825 Fix previous: weak symbols work so much better if they are exported
from the object as weak symbols...

There's also something to be said about "cosmetic" tweaks after
testing, but I do think I'll bother.
2008-10-13 18:16:33 +00:00
pooka
cf05fbf706 Weak alias all rump system calls to rump_enosys() 2008-10-13 16:25:12 +00:00
pooka
23bef54996 For rumpsyscalls, properly return -1 in case of error. 2008-09-07 19:27:58 +00:00
apb
7cb9e72bbb Avoid using \$ in an awk script. Instead, store '$NetBSD$'
in an awk variable and interpolate it where needed.

Based on the patch by Martin Husemann in PR 38766.
2008-07-23 21:17:25 +00:00