Commit Graph

67 Commits

Author SHA1 Message Date
Stefan Kalkowski 1f9890d635 Follow-up for: "Merge libc_vfs plugin into libc"
This patch avoids the construction of the Genode::Config object in Noux
processes. The construction of this object would populate the Noux
process with additional capabilities, which cannot be handled by
'fork()'.
2014-05-07 10:37:51 +02:00
Norman Feske 60d9c90921 Merge libc_vfs plugin into libc
Issue #999
2014-04-29 15:27:13 +02:00
Norman Feske c3c6a82d13 Move VFS from noux to 'os/include/vfs'
By separating the VFS from Noux, we become able to reuse the
VFS for libc-using programs. The most substantial change is the
removal of Noux::Sysio data structures from the VFS. Instead, the
Noux::Sysio refers to the VFS types now.

The new VFS library is located at 'os/include/vfs/'.

Furthermore, the patch removes various code duplications related
to pseudo file systems that provide a single file (block, zero,
random, terminal, null). The new 'Single_file_system' holds the
common boilerplate code for those.

Issue #999
2014-04-29 15:19:27 +02:00
Norman Feske 797a6c7422 libc_noux: style fix 2014-04-24 14:56:36 +02:00
Martin Stein a99a33e93e noux: enhance stack of all noux programs
This is done because we ran into a stack overflow while compiling
Genodes core/main.cc with GCC in Noux.

fix #1075
2014-03-14 13:17:36 +01:00
Martin Stein 0b64328944 base: setup thread object for main thread in CRT0
For a main thread a thread object is created by the CRT0 before _main gets
called so that _main can already run in a generic environment that, e.g.,
catches stack overflows as a page-fault instead of corrupting the BSS.
Additionally dynamic programs have only one CRT0 - the one of the LDSO -
which does the initialization for both LDSO and program.

ref #989
2014-02-25 14:58:05 +01:00
Martin Stein cfd4310684 libc_noux & 64bit: fix printf format-warning
Normally for intptr_t the printf format PRIiPTR should be used. As Genode
printf doens't support this format we cast it to long int (intptr_t is int
for 32 bit and long int for 64 bit).

ref #989
2014-02-25 14:58:05 +01:00
Martin Stein c2af646ad8 noux: Noux_connection::context_area_rm_session()
This enables a forked process to update the capability of its
context area RM session.

ref #989
2014-02-25 14:58:04 +01:00
Christian Prochaska 27ff408985 Noux: POSIX signal improvements
- 'kill()' syscall added
- 'wait()' gets unblocked when a signal occurs
- syscalls can get called from a signal handler without corrupting the 'sysio' object
- the child's exit status gets correctly reported to 'wait()'
- SIGCHLD gets ignored by default
- pending signals survive 'execve()'

Fixes #1035.
2014-01-30 10:05:44 +01:00
Josef Söntgen c4c43ffc9d noux: add block device file system
Access to a block session is provided by using the block file system.
By specifying the label, each block session request can be routed to
the proper block session provider:

! <fstab>
! 	...
! 	<dir name="dev">
! 		<block name="blkdev0" label="block_session_0" />
! 	</dir>
! 	...
! </fstab>

In addition to this file system, support for the DIOCGMEDIASIZE ioctl
request was added. This request is used by FreeBSD and therefore our
libc to query the size of the block device in bytes.

Fixes #1010.
2014-01-17 14:04:29 +01:00
Josef Söntgen f71e38702f noux: add SYSCALL_SYNC
File systems using the File_system_session interface can now be
synchronized by using this syscall. This is needed for file system
that maintain an internal cache, which should be flushed.

Fixes #1008.
2013-12-20 15:21:08 +01:00
Christian Prochaska 047d851fb6 Noux: add basic 'Ctrl-C' support
This patch implements the POSIX signal functionality needed to interrupt a
running Noux GDB by pressing 'Ctrl-C'.

It allows to register a signal handler for the 'SIGINT' signal, which
gets executed after 'Ctrl-C' is received from the terminal. With the
current state of the implementation, the signal handler only gets executed
when the Noux application calls a 'read()', 'write()', 'ftruncate()' or
'select()' syscall.

Fixes #923.
2013-10-22 08:00:16 +02:00
Christian Prochaska eeacc5a297 Noux: register inherited file descriptors
With this patch, a Noux process registers all inherited open file
descriptors in its local libc file descriptor registry at program start.

Fixes #882.
2013-09-23 14:26:00 +02:00
Alexander Boettcher 8ca068be43 noux: implement some libc dummy function
and quieten some noisy messages in non-verbose mode

Issue #485
2013-09-18 14:58:54 +02:00
Norman Feske b1f63e3356 Turn 'platform_env.h' into a private header
This patch removes 'platform_env.h' from the public API headers because
this header was not part of the API anyway.
2013-02-14 13:23:36 +01:00
Christian Prochaska f109f4b02d Noux: initialize the 'termios' structure
Fixes #614.
2013-01-15 12:09:00 +01:00
Norman Feske 73ab30c22c Update copyright headers to 2013 2013-01-10 21:44:47 +01:00
Josef Söntgen 2e6de3759c Noux: add getrlimit() dummy to libc_noux
As long as there is no proper getrlimit() support prevent programs
from using it by providing a dummy implementation.
2012-11-26 20:58:10 +01:00
Josef Söntgen 569e0a2e6c Remove unneeded PDBG() messages 2012-11-26 20:58:10 +01:00
Josef Söntgen 59c369a608 Noux: add TIOCSETAF/W support
These ioctl() request are used to set attributes of the underlying
terminal device.
2012-11-26 20:58:09 +01:00
Josef Söntgen 3c562d042d Noux: fix resetting wrong number of fds
Since the number of the fds in the select call is not necassarily equal
to the number of fds SYSCALL_SELECT returns we have to reset the number
of fds given as argument to select().

This keeps OpenSSH from reading from a non-ready socket.

Fixes #494.
2012-11-14 16:57:13 +01:00
Josef Söntgen 8f372b469a Noux: fix dup() in libc_noux
The previous implementation disregards the fact that we actually have
to use libc's plugin mechanism if we play with fds. So in the end the
libc did not know to which plugin the fd belonged.

Fixes #493.
2012-11-14 16:51:15 +01:00
Josef Söntgen ac3a362fdf Noux: add dup() to libc_noux
This library function is implemented upon SYSCALL_DUP2. Therfor the
syscall was slightly changed. It now returns the new allocated fd in
dup2_out.fd.
2012-11-07 13:34:54 +01:00
Josef Söntgen db9dc3388d Noux: fix resetting fds in unmarshal_fds
Since FD_ZERO() resets a whole fd_set (which is 128 bytes) using it to
reset dst_fds will override otherwise used memory if the memory was
allocated dynamically and is less than sizeof (fd_set). So instead of
using this macro we reset the fd_set manually.
2012-11-07 11:32:26 +01:00
Josef Söntgen 837f913094 Noux: more useful gettimeofday() implementation
There are certain programs that need gettimeofday(), e.g.
network-related tools like ping(1) etc. but also filesystem-related
programs like find(1) etc. and of course time-related programs like
date(1).

As there is currently no interface in Genode for actually using clock
devices like RTC on x86 (though there is a driver for it) we "abuse"
the timeout_scheduler thread to at least provide flow-of-time.

Noux: add clock_gettime() implementation

For now, only CLOCK_SECOND is supported.

Noux: add utimes() dummy

Fixes #401
2012-10-24 11:34:39 +02:00
Christian Prochaska be171d86bb libc: handle 'O_APPEND' flag for 'open()'
Fixes #319.
2012-10-11 17:10:21 +02:00
Christian Prochaska e9ac4b653b Add support for symbolic links
This patch adds support for symbolic links in libc, libc plugins, file
system servers and Noux.

Fixes #322.
2012-10-08 15:05:02 +02:00
Christian Prochaska 1497d5e48f libc_noux: fix 'lseek()' error message
Print 'lseek: ERR_FD_INVALID' instead of 'dirent: ERR_FD_INVALID'.

Fixes #370.
2012-09-28 17:05:36 +02:00
Christian Prochaska d4499cba41 libc_noux: return the new file descriptor in 'dup2()'
Fixes #369.
2012-09-28 17:05:22 +02:00
Christian Prochaska d6402041bc Noux: return dummy time in 'gettimeofday()'
The 'find' program can abort if the 'gettimeofday()' function returns -1,
which it currently does. With this patch the 'gettimeofday()' returns a
dummy time instead to prevent such a termination.

Fixes #353.
2012-09-14 12:21:54 +02:00
Christian Prochaska 78b0bd57f7 Noux: store environment variables zero-separated
With this patch environment variables always get stored as zero-separated
strings in buffers of type 'Sysio::Env'. This fixes the problem that
environment variables with non-alphanumeric characters did not get set
correctly in child processes.

Fixes #340.
2012-08-30 10:44:53 +02:00
Josef Söntgen 9cff243f42 Noux: add proper errno handling to network funcs
Programs use the errno value to check which error exactly occured.
It is mandatory for non-blocking I/O, e.g. connect() gets the current
state of the connection by looking at the returned errno values.

Fixes #337.
2012-08-30 10:44:06 +02:00
Norman Feske f4881a37c8 libc_noux: fix compile warnings 2012-08-22 09:51:31 +02:00
Josef Söntgen a6904b4deb Noux: add F_SETFL to libc_noux's fcntl()
Among other things it is used to set non-blocking mode, so we should
support it (e.g. fcntl(d, F_SETFL, fl | O_NONBLOCK)).
2012-08-22 09:51:30 +02:00
Josef Söntgen 4aac3933b3 Noux: add FIONBIO handling support to libc_noux 2012-08-22 09:51:30 +02:00
Josef Söntgen 57b0490fc6 Noux: remove {get,free}addrinfo
This dead-code will not be needed in the future because we now use
libc_resolv.
2012-08-22 09:51:29 +02:00
Josef Söntgen a77c3dffd0 Noux: add user information support (struct passwd)
There are certain programs which need the information that is stored in
'struct passwd'. This commit introduces configurable user information
support to NOUX.

One can set the user information via <user> in NOUX config:

! <config>
!   <user name="baron" uid="1" gid="1">
!     <shell name="/bin/bash" />
!     <home name="/home" />
!   </user>
! [...]
! </config>

When <user> is not specified default values are used. Currently these
are 'root', 0, 0, '/bin/bash', '/'.

Note: this is just a single user implementation because each Noux instance
has only one user or rather one identity and there will be no complete
multi-user support in Noux. If you need different users, just start new
Noux instances for each of them.
2012-08-22 09:51:28 +02:00
Josef Söntgen ae524e4beb Noux: add timeout handling to select()
Previously there was not actual timeout handling. If a select() call
set an timeout it would be set to zero instead and was always handled
as blocking i/o. While this works fine for file descriptors which
will be triggerd externally (for example vim through terminal i/o) it
does not work at all for socket descriptors and network operations in
general.

So this commit introduces proper timeout handling and changes the
behaviour of SYSCALL_SELECT so that it now returns more than just
one descriptor at a time.

noux/minimal and noux/net now depend on thread and alarm libraries.
2012-08-22 09:51:27 +02:00
Norman Feske 7a7adfbb63 Add mmap and nunmap to libc_noux, libc_fs
In the current form, only PROT_READ is supported. This case is emulated
by copying the file content into new allocated backing store. Even
though the performance benefits of mmap-using code will not be
preserved, code that relies on mmap can be executed via the libc_noux
or libc_fs plugins, i.e. lightttpd.
2012-08-17 11:52:02 +02:00
Josef Söntgen ba5ec3a29e Noux: recv* functions override the buffer
Instead of appending to the buffer it is overriden on
continous calls.

Fixes #325.
2012-08-16 10:03:06 +02:00
Christian Prochaska 94fad13adb libc: add support for 'O_TRUNC' flag in 'open()'
Fixes #320.
2012-08-09 11:09:43 +02:00
Christian Prochaska dcfcbce856 libc: add support for 'ftruncate()'
Fixes #307.
2012-08-09 11:09:43 +02:00
Christian Prochaska 280fc59edf Fix 'O_CREAT' flag handling in 'open()'
Fixes #313.
2012-08-09 11:09:43 +02:00
Christian Prochaska fa541b4545 libc_noux: fix 'read()' function
This patch fixes the problem that data in the read buffer would get
overwritten in cases where multiple 'read()' syscalls are necessary.

Fixes #303.
2012-08-01 12:47:15 +02:00
Christian Prochaska 5f1a66b90c Noux: handle 'not a directory' error in fchdir()
Fixes #298.
2012-07-26 11:29:08 +02:00
Josef Söntgen 7e26c79455 Noux: add recvfrom()
Add SYSTEMCALL_RECVFROM to noux/net and the corresponding libc function.

Fixes #290.
2012-07-19 21:05:52 +02:00
Josef Söntgen 976e7b4288 Noux: fix send(), set fd before each syscall
The fd has to be set before each syscall.

Fixes #288.
2012-07-19 21:05:52 +02:00
Josef Söntgen 883453c65d Noux: fix sendto(), set args before each syscall
Set addrlen and dest_addr explicitly before each system call.

Fixes #287.
2012-07-19 21:05:51 +02:00
Christian Prochaska 1bf7967463 Noux terminal file system
This patch adds a new "terminal" file system type to Noux, which allows to
create a "character device" file that is connected to a Genode 'Terminal'
service.

The 'Terminal' session created by the file system has the label
"noux(terminal_fs)" to distinguish it from the 'Terminal' session
created by Noux itself.

Fixes #244.
2012-06-20 10:20:35 +02:00
Josef Söntgen f325f314b5 Fix libc_noux's Plugin::getpeername() method
The argument's order was wrong in the memcpy() call. In addition
the wrong sysio struct was used for the addrlen argument.

Fixes #238.
2012-06-08 14:32:20 +02:00