Commit Graph

130 Commits

Author SHA1 Message Date
Stefan Kalkowski
42cce8668b noux: upgrade RM session for client (fix #1138) 2014-05-07 10:37:40 +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
3bb7d4e67b noux: Decouple Dir_file_system from file systems
By introducing the new 'File_system_registry', we can remove the
knowledge about the actual file-system implementations from the
'Dir_file_system'. Thereby the code becomes more generic, which is
a precondition for using it as the basis for Genode's VFS library.

Issue #999
2014-04-24 14:56:36 +02:00
Norman Feske
28a5404281 noux: Handle SYSCALL_KILL in switch (fix warning) 2014-04-24 14:56:36 +02:00
Martin Stein
ff28a89000 noux: make RM replay less noisy in release mode
As the message "replay: missing dataspace info for ..." occurs multiple times
on every fork, it slows down at least noux_tool_chain_auto with hw_arndale
about 10 seconds. To avoid this overhead in release mode I've turned it into a
warning rather than an error.

ref #1096
2014-04-07 17:01:21 +02:00
Martin Stein
ba8e61653f noux & 64bit: fix printf format-warning
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
Josef Söntgen
8b8e3ef7a5 noux: calculate inode value from path
There are programms that use struct stat's st_ino field to check certain
conditions. Since we are using multiple filesystems in a noux session we
cannot use the inode number which the actual filesystem provides.
Therefore we calculate a random inode number by hashing the stated path.

Fixes #299.
2013-11-05 12:54:04 +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
Stefan Kalkowski
4f541538bd noux: use lwip dhcp plugin, avoid code duplication
Ref #892
2013-10-22 08:00:14 +02:00
Martin Stein
ee5d213c1f base: do not allow unnamed threads
fix #901
2013-10-22 08:00:07 +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
Christian Prochaska
9370ba160b Noux: increase entrypoint stack size
Needed to run Noux built with -O0

Fixes #880.
2013-09-23 14:26:00 +02:00
Norman Feske
8243329ad4 os: Move Genode::Config into 'config' library
Originally, the convenience utility for accessing a process
configuration came in the form of a header file. But this causes
aliasing problems if multiple compilation units access the config while
the configuration gets dynamically updated. Moving the implementation of
the accessor to the singleton object into a library solves those
problems.
2013-09-23 14:25:58 +02:00
Alexander Boettcher
94bce1425e noux: avoid 'no attachment at 0' messages
binary_ds cap is attempted to free up twice by
_root_dir->release(_name, _binary_ds) in ~Child de-constructor and by
Static_dataspace_info _binary_ds_info de-constructor.

This commit keeps all binary related information inside a struct which gets
freed up after all noux session book keep cleaning is done.

Issue #485
2013-09-18 14:58:54 +02:00
Alexander Boettcher
73bfdb8bb8 noux: fix deadlock during destruction
Issue #485
2013-09-18 14:58:54 +02:00
Alexander Boettcher
71aacd7ed8 noux: first remove from list, then dissolve
Avoids deadlock - which is out of the list can't be found twice to be deleted.

Issue #485
2013-09-18 14:58:54 +02:00
Alexander Boettcher
7c591a8151 noux: lock region list
Issue #485
2013-09-18 14:58:54 +02:00
Alexander Boettcher
bbb9c6daec noux: avoid dangling pointer
Issue #485
2013-09-18 14:58:54 +02:00
Alexander Boettcher
773b0ecc3d noux: add verbose config parameter
Explicitly enable verbose output if required.
2013-08-22 15:13:12 +02:00
Norman Feske
a2b15349fd base: Add tracing support to CPU session interface 2013-08-13 17:27:40 +02:00
Josef Söntgen
9b28395f0d noux: construct new child only if binary is valid
If a script is executed which uses a interpreter that does not exist the
construction of the child fails and potentially leaks memory because the
wrong delete operator is called.
Therefore the binary dataspace of the script and the binary dataspace of
the interpreter are now checked before a new child will be created.

Fixes #812.
2013-08-13 17:08:26 +02:00
Norman Feske
6d837c9e26 Attach affinity information to session requests
This patch extends the 'Parent::session()' and 'Root::session()'
functions with an additional 'affinity' parameter, which is inteded to
express the preferred affinity of the new session. For CPU sessions
provided by core, the values will be used to select the set of CPUs
assigned to the CPU session. For other services, the session affinity
information can be utilized to optimize the locality of the server
thread with the client. For example, to enable the IRQ session to route
an IRQ to the CPU core on which the corresponding device driver (the IRQ
client) is running.
2013-08-13 17:08:25 +02:00
Norman Feske
5fe29e8e4a Express affinities via Cartesian coordinates
This patch introduces new types for expressing CPU affinities. Instead
of dealing with physical CPU numbers, affinities are expressed as
rectangles in a grid of virtual CPU nodes. This clears the way to
conveniently assign sets of adjacent CPUs to subsystems, each of them
managing their respective viewport of the coordinate space.

By using 2D Cartesian coordinates, the locality of CPU nodes can be
modeled for different topologies such as SMP (simple Nx1 grid), grids of
NUMA nodes, or ring topologies.
2013-08-13 17:08:24 +02:00
Norman Feske
956cab5fdb noux: Keep track of how dataspaces are used
This patch eliminates the "no attachment at..." warnings, which
were caused by a use-after-free problem of dataspaces. When a
dataspace was destroyed, the users of the dataspace were not
informed and therefore could not revert possible attachments to
RM sessions. The fix introduces a callback mechanism that allows
dataspace users (i.e., RM regions) to register for the event that
a dataspace vanishes.

The following types of dataspaces are handled:
* RAM dataspaces
* ROM dataspaces
* The process binary
* The binary of the dynamic linker
* Args dataspace
* Sysio dataspace
* Env dataspace
* managed RM dataspaces

The handling of ROM dataspaces is still not complete. When forking,
the ROM dataspace of the parent process gets just reused without
creating proper meta data ('Dataspace_info') for the forked process.
Similar issues might arise from other special dataspaces (e.g.,
args, env, sysio).

This patch removes all "no attachment at..." warnings except for
one (an attachment at 0).

Issue #485
2013-08-06 17:40:10 +02:00
Alexander Boettcher
01d267e551 noux: calculate rm::attach parameters correctly
Previous commit denies the creation of regions larger then the dataspace.
Noux does it by setting the default size to the dataspace size without
subtracting the offset.

Fixes #591
2013-08-05 15:15:56 +02:00
Josef Söntgen
29b8370f73 noux: add local cpu and ram service
Use a local CPU service to prevent a redirection to noux' parent (in
this case init which does not know noux' local capabilities).

Fixes #791.
2013-07-05 12:37:42 +02:00
Norman Feske
fae63f4fa9 Merge base libraries into a single library
This patch simplifies the way of how Genode's base libraries are
organized. Originally, the base API was implemented in the form of many
small libraries such as 'thread', 'env', 'server', etc. Most of them
used to consist of only a small number of files. Because those libraries
are incorporated in any build, the checking of their inter-dependencies
made the build process more verbose than desired. Also, the number of
libraries and their roles (core only, non-core only, shared by both core
and non-core) were not easy to capture.

Hereby, the base libraries have been reduced to the following few
libraries:

- startup.mk contains the startup code for normal Genode processes.
  On some platform, core is able to use the library as well.
- base-common.mk contains the parts of the base library that are
  identical by core and non-core processes.
- base.mk contains the complete base API implementation for non-core
  processes

Consequently, the 'LIBS' declaration in 'target.mk' files becomes
simpler as well. In the most simple case, only the 'base' library must
be mentioned.

Fixes #18
2013-02-19 14:45:55 +01:00
Alexander Boettcher
9453d319cb base: add remove_client to rm_session
Fixes #13
2013-02-11 12:01:25 +01:00
Christian Prochaska
a6acab6d0d Synchronize signal context destruction
With this patch, the 'Signal_receiver::dissolve()' function does not return
as long as the signal context to be dissolved is still referenced by one
or more 'Signal' objects. This is supposed to delay the destruction of the
signal context while it is still in use.

Fixes #594.
2013-01-15 15:03:21 +01:00
Norman Feske
73ab30c22c Update copyright headers to 2013 2013-01-10 21:44:47 +01:00
Christian Prochaska
6fa57141ae Noux: delayed 'Child' object destruction
With this patch the destruction of Noux 'Child' objects gets delayed
further until the exit signal has been dispatched. This prevents the
self-destruction of the signal dispatcher, which is a member of the
'Child' object.

Fixes #603.
2013-01-10 21:16:37 +01:00
Norman Feske
13d4108fea Unify 'Signal_dispatcher' interfaces
Several users of the signal API used custom convenience classes to
invoke signal-handling functions on the reception of incoming signals.
The 'Signal_dispatcher' pattern turned out to be particularly useful. To
avoid the duplication of this code across the code base, this patch
adds the interface to 'base/signal.h'.

Furthermore, the patch changes the 'Signal::num()' return type from int
to unsigned because negative numbers are meaningless here.

Fixes #511
2013-01-10 21:09:14 +01:00
Alexander Boettcher
c2d3543e62 base: replace obj_by_* by lookup_and_lock
Add functionality to lookup an object and lock it. Additional the case is
handled that a object may be already in-destruction and the lookup will deny
returning the object.

The object_pool generalize the lookup and lock functionality of the rpc_server
and serve as base for following up patches to fix dangling pointer issues.
2013-01-10 11:13:13 +01:00
Christian Prochaska
ec0b6f82a5 Noux: add tar hardlink support in 'stat()'
Fixes #481.
2012-11-26 20:58:10 +01:00
Josef Söntgen
5c413929ef Noux: add ioctl() to Vfs
File_io_channel now includes ioctl() because pseudo devices which are
implemented as a file-system, e.g. /dev/tty, are controlled via ioctl()
requests. The method is exported to the Vfs through the Vfs_io_channel
class.
2012-11-26 20:58:09 +01:00
Josef Söntgen
c24a95b819 Noux: add random_file_system
The random file-system provides an arc4 based urandom implementation
which is needed for OpenSSL.

NOTE: the Arc4random class currently _does not collect enough_ random
bytes!
2012-11-26 20:58:09 +01:00
Josef Söntgen
7f359a5978 Noux: add stdio_file_system
This file-system provides a connection to the terminal through a device
node, e.g. /dev/tty.
2012-11-26 20:58:09 +01:00
Josef Söntgen
ebfe49ca84 Noux: use Terminal::Connection as singleton
We will reuse the terminal connection in the stdio filesystem
to implement /dev/tty. Therefor we need to access the terminal
from different locations which is simplified if it is provided
by a singleton.
2012-11-26 20:58:09 +01:00
Josef Söntgen
82eb0e9f9a Noux: add TIOCSETAF/W dummy to Terminal_io_channel 2012-11-26 20:58:09 +01:00
Martin Stein
05f5999e71 cpu_session: Access thread state by value 2012-11-23 12:20:22 +01:00
Josef Söntgen
a3c45412aa Noux: fix num_* return value in SYSCALL_SELECT
select_out.num_* was unecessarily set multiple times and not at all
if unblock_* was 0.

Fixes #494.
2012-11-14 16:56:58 +01:00
Christian Prochaska
fb216f370b Noux: speed up tar record lookup
Currently the lookup of a specific record in a tar archive may take a long
time, because the records get searched in sequence. With this patch a tree
structure representing the directory layout gets created when loading the
tar file for speeding up record lookups.

Fixes #491.
2012-11-14 16:53:36 +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
0539c7180b Noux: add Io_receptor to SYSCALL_SELECT + bugfix
The Io_receptor is now used to unblock certain I/O channels from lwip's
callback-function.

There was also a bug in which all ready-to-ready fds were overriden by
the ready-to-write ones.
2012-11-07 11:32:16 +01:00
Josef Söntgen
c74bdbf8d8 Noux: add Io_receptor_registry 2012-11-07 11:32:11 +01:00
Josef Söntgen
082d8d6623 Noux/net: refactoring of Socket_io_channel
The Socket_io_channel class now uses the Io_channel_backend to provide
the network related methods. In addition the Socket_io_channel_registry
was replaced with a simpler implementation which uses Io_receptors to
unblock I/O channels from the callback-function of lwip.
2012-11-07 11:32:06 +01:00