Commit Graph

108 Commits

Author SHA1 Message Date
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
Josef Söntgen 08bd41b1ec Noux: add backend pointer to Io_channel
The backend pointer may be used to provide additional methods in a
Io_channel derived class.
2012-11-07 11:32:01 +01:00
Christian Prochaska ecb6947f9c Noux: fix 'Rm_session_component' destructor
Fixes #434.
2012-10-30 12:17:43 +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
Alexander Boettcher 83039267fa Cleanup: remove 'first' and 'next' of cpu_session
Fixes #10
2012-10-24 11:34:38 +02:00
Norman Feske 5a1c47e943 Noux: simplify 'User_info' constructor
This patch removes the '_dup_str' function, which was unsafe due to a
missing check of the dst boundary.
2012-10-12 13:10:48 +02:00
Norman Feske 4a1b545770 Move 'Child' API implementation to library 2012-10-09 13:45:33 +02:00
Norman Feske f4bc08c16f Whitespace fixes in Noux 2012-10-08 15:08:17 +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 963b77bc27 Noux: release binary dataspace in SYSCALL_EXECVE
Fixes #375.
2012-09-30 13:37:49 +02:00
Christian Prochaska 20fcede93a Noux: fix error handling in 'Dir_file_system'
If during the file system iterations in the 'stat()', 'rename()' or
'mkdir()' funtions of the 'Dir_file_system' class any file system
returns an error code other than 'ERR_NO_ENTRY', return immediately.

Fixes #376.
2012-09-28 17:08:20 +02:00
Christian Prochaska 0a12e262ce Noux: fix interpreter argument processing
Don't write a '\0' into the argument buffer if no interpreter argument is
given.

Fixes #368.
2012-09-28 17:05:04 +02:00
Christian Prochaska 55a8bae2f8 Noux: close all file descriptors on child exit
With this patch, when a child exits, all of its open file descriptors get
closed immediately. This is necessary to unblock the parent if it is
trying to read from a pipe (connected to the child) before calling
'wait4()'.

Fixes #357.
2012-09-24 09:18:00 +02:00
Josef Söntgen af58d39854 Noux: fix previous attempt of fixing SYSCALL_READ 2012-09-24 09:18:00 +02:00
Christian Prochaska 97c3f6599d Noux, libc_terminal: initialize 'stat' buffer
Initialize the 'stat' buffer in the 'stat()' function to avoid potential
non-deterministic program behavior.

Fixes #362.
2012-09-24 09:17:59 +02:00
Josef Söntgen 83dd1640fc Noux: fix SYSCALL_READ return value
There is an error if reading from a Io_channel returns -1. In this
case the syscall should fail.

Fixes #356.
2012-09-14 12:24:13 +02:00
Christian Prochaska 4b81cf3e63 Noux: fix 'Vfs_io_channel::lseek()' calculations
With this patch the 'Vfs_io_channel::lseek()' function takes the offset
argument into account when calculating the new seek offset in the SEEK_CUR
and SEEK_END cases.

Fixes #352.
2012-09-14 12:21:16 +02:00
Christian Prochaska 4ab9782b8b Noux: use correct member in Vfs_io_channel::size()
Fixes #351.
2012-09-14 12:20:33 +02:00
Norman Feske 83bdfea9b0 Extend Cpu_session with thread-affinity API
This patch introduces the functions 'affinity' and 'num_cpus' to the CPU
session interface. The interface extension will allow the assignment of
individual threads to CPUs. At this point, it is just a stub with no
actual platform support.
2012-09-05 10:25:04 +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 1b9c356aa3 Noux: override uid/gid in SYSCALL_STAT
Change the uid/gid entries in the stat syscall to have the same values
on all filesystems that are used in the current noux-instance according
to the specified values in noux' config.

Fixes #338.
2012-08-30 10:44:22 +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
Josef Söntgen 95f71a5f71 Noux: add is_nonblocking() method
Certain programs tend to set their sockets non-blocking. As previously
descriptors in Noux were only blocking we now introduce a method to mark
the used Io_channel as non-blocking.
2012-08-22 09:51:30 +02:00