Commit Graph

108 Commits

Author SHA1 Message Date
Josef Söntgen
343266b06e Noux: add F_GETFL handling to terminal_io_channel
There are certain programms which check if an fd is open by calling
fcntl(fd, F_GETFL, ...). So to keep them happy we return true if
such an request was done to our terminal fd's.
2012-08-22 09:51:30 +02:00
Josef Söntgen
7dfbd9e191 Noux/net: fix write() in socket_io_channel 2012-08-22 09:51:30 +02:00
Josef Söntgen
1c495b79f4 Noux/net: add proper fcntl() to socket_io_channel 2012-08-22 09:51:30 +02:00
Josef Söntgen
8dfb3d5d81 Noux: add cleanup_socket_descriptors() function
When a child exists it makes sure that all remaining socket descriptors
are closed.
2012-08-22 09:51:30 +02:00
Josef Söntgen
2010a74fba Noux/net: add reset_all() method to sd registry
This method is called when a child is exiting to remove all remaining
sockets from the socket descriptor registry to close all sockets.
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
a4f4a5fb5a Noux: add /dev/null and /dev/zero filesystems
These device are mandatory for most programs (well, at least null
is required to be present for a POSIX compliant OS, which Noux is
actually not). But for proper shell-script support we will need
them anyway.
2012-08-22 09:51:28 +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
606ff66407 Noux: Toggle syscall tracing via config
Noux used to trace syscalls by default, which significantly slows down
its execution. This patch disables the tracing by default. It can be
enabled by specifying 'trace_syscalls="yes"' attribute to the Noux
configuration.
2012-08-22 09:51:27 +02:00
Norman Feske
e60eb0f57f noux: pass correct mode to Fs_vfs_handle
This patch resolves a problem with running 'noux_gdb.run'. Right at the
start, GDB would output a message like:

  ...cli-script.c:1614: internal-error: called with NULL file pointer!
  A problem internal to GDB has been detected,
  further debugging may prove unreliable.
  Quit this debugging session? (y or n)

The LOG output hints at the cause of the problem:

  [init -> noux -> /bin/genode-x86-gdb] fcntl: F_GETFL for libc_fd=3

Thanks to cproc for the fix!
2012-08-22 09:51:27 +02:00
Norman Feske
fab7b514e3 Move path utility from noux to 'os/include/os'
It turns out that the path-handling utility is valuable not only for
Noux. By moving it to a public header, we can use it for the libc.
2012-08-16 10:03:06 +02:00
Josef Söntgen
ae89f88cfb Noux/net: adjust noux/net to lwip-1.4.1-rc1
Fixes #328.
2012-08-16 10:03:01 +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
a55b883146 Noux: fix setup of child environment
Fixes #315.
2012-08-07 22:27:53 +02:00
Norman Feske
d079ef51ae Adapt GDB monitor and Noux to CPU session changes 2012-08-03 12:06:31 +02:00
Christian Prochaska
6c68850524 Noux: add virtual '~Vfs_handle()' destructor
This patch adds a virtual destructor to the 'Vfs_handle' class to have
subclass destructors called on 'destroy()' on a base class pointer.

Fixes #305.
2012-08-01 12:48:26 +02:00
Christian Prochaska
5f1a66b90c Noux: handle 'not a directory' error in fchdir()
Fixes #298.
2012-07-26 11:29:08 +02:00
Christian Prochaska
55815e4a3a Noux: add support for executing shell scripts
With this patch Noux recognizes the '#!' character sequence in executable
files and executes the specified interpreter.

Fixes #255.
2012-07-26 11:22:04 +02:00
Christian Prochaska
f99648f355 Noux: implement 'Fs_file_system::dataspace()'
Fixes #261.
2012-07-26 11:21:14 +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
d28465cb3a Noux: fix missing mode propagation
When opening a new file, a new Fs_vfs_handle is created but with the
initial mode set to 0 which is not expected by functions like fdopen()
that check if the original flags given to the open() call match the
returned ones on the used fd.

Fixes #289.
2012-07-19 21:05:52 +02:00
Christian Prochaska
9a8fb36b1c Catch 'File_system::Lookup_failed' exception
In 'Fs_file_system::open()' the call of '_fs.dir()' can throw a
'File_system::Lookup_failed' exception, which gets explicitly caught
with this patch.

Fixes #246.
2012-06-20 19:44:07 +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
Norman Feske
288fd4e56e Add support for allocating DMA memory
This patch extends the RAM session interface with the ability to
allocate DMA buffers. The client specifies the type of RAM dataspace to
allocate via the new 'cached' argument of the 'Ram_session::alloc()'
function. By default, 'cached' is true, which correponds to the common
case and the original behavior. When setting 'cached' to 'false', core
takes the precautions needed to register the memory as uncached in the
page table of each process that has the dataspace attached.

Currently, the support for allocating DMA buffers is implemented for
Fiasco.OC only. On x86 platforms, it is generally not needed. But on
platforms with more relaxed cache coherence (such as ARM), user-level
device drivers should always use uncacheable memory for DMA transactions.
2012-06-20 09:17:48 +02:00
Josef Söntgen
6d8a7c0cc4 Initial version of networking support for Noux
Noux/net adds network functionality to noux. Currently most basic
network related system calls including 'accept', 'bind', 'connect',
'listen', 'recv', 'send', 'shutdown', and 'socket' are implemented by
wrapping lwip's network functions.

At the moment noux/net is rarely usable, though it is possible to
use netcat to send a message to a netcat server which listen on a
given port in noux/net.
2012-05-29 13:54:59 +02:00
Josef Söntgen
4ba1669b39 Add dynamic_pointer_cast method to Shared_pointer
This methods is currently only used for casting an Io_channel
object to an Socket_io_channel object.
2012-05-29 13:54:59 +02:00
Christian Prochaska
171f46c770 Fix Noux x86_64 compile error
Fixes #209.
2012-05-21 17:16:23 +02:00
Norman Feske
6f12659369 Improve path handling (stripping pairs of dots) 2012-05-18 18:47:10 +02:00
Norman Feske
e436d60ce7 Remove debugging output, emulate access syscall 2012-05-18 18:47:02 +02:00
Norman Feske
0f6b59097e Detect execve failure 2012-05-18 17:10:54 +02:00
Norman Feske
66290ea46d Stacked file systems for Noux
This patch introduces support for stacked file systems alongside new
glue for accessing file-system implementations provided via Genode's
new file-system-session interface.

Using stacked file systems, an arbitrary number of file systems (such
as tar archives or file systems implemented as separate Genode
components) can be composed to form one merged virtual file system.

An example is given via the 'ports/run/noux_bash.run' script. This run
script creates a virtual file system out of multiple tar archives each
containing the content of a particular GNU package. In addition, one
'ram_fs' is mounted, which enables Noux to perform write operations.
This way, the shell output can be redirected to a file, or files can
be saved in VIM.

Fixes #103.
2012-05-17 20:34:00 +02:00
Norman Feske
5bedeef814 Simplify use of namespace Genode within Noux 2012-04-23 20:43:43 +02:00
Christian Prochaska
7a369bc74d Add an 'executable' flag to 'Rm_session::attach()'
With this patch clients of the RM service can state if they want a mapping
to be executable or not. This allows dataspaces to be mapped as
non-executable on Linux by default and as executable only if needed.

Partially fixes #176.
2012-04-20 11:21:19 +02:00
Norman Feske
d6e30c19de Replace 'Native_capability::copy_to' by accessor
The 'copy_to' function turned out to be not flexible enough to
accommodate the Noux fork mechanism. This patch removes the function,
adds an accessor for the capability destination and a compound type
'Native_capability::Raw' to be used wherever plain capability
information must be communicated.
2012-03-28 09:58:51 +02:00
Norman Feske
8bd02a5333 Let Noux deliver EOF when pressing control-d 2012-03-26 17:00:06 +02:00
Norman Feske
afeb54ebed Add pipe and dup2 syscalls to Noux
Fixes #133.
2012-03-21 21:37:17 +01:00
Norman Feske
1896c09a2d Fixed initial reference counter value 2012-03-21 21:37:15 +01:00
Norman Feske
d0285edcb7 Fixed inconsistent include guard 2012-03-21 21:37:15 +01:00
Norman Feske
5b6de825e6 Noux: propagate environment to execve
Fixes #131.
2012-03-21 21:36:49 +01:00
Norman Feske
207abe647b Handle current working directory in Noux 2012-03-16 18:23:00 +01:00
Norman Feske
a9152ff412 Handle lifetime of dynamic allocations in Noux 2012-02-26 13:34:48 +01:00
Norman Feske
780507f42b Implementation of wait4 syscall
The 'noux_bash.run' script has become able to present the user with an
interactive bash shell for executing various coreutils programs. It is
still pretty limited, i.e., the environment is not correctly passed to
child processes and pipes are not supported. But bash and coreutils are
operational.
2012-02-24 23:43:35 +01:00
Norman Feske
7e7d290008 Fixed missing counter increment in assign operator 2012-02-24 23:32:08 +01:00
Norman Feske
18d0b316d4 Add wait4 syscall to Noux, just blocking for now 2012-02-24 15:19:38 +01:00
Norman Feske
7c98268901 Noux cleanup and source documentation
This patch decomposes the former 'child.h' into several header files,
unifies the naming of classes, and adds source-code documentation.
2012-02-23 10:42:12 +01:00
Norman Feske
cbd4830977 Propagate new parent cap to forked process
This patch removes the hardcoded parent cap for the new child by
introducing a facility called 'poke' similar to copy-to-user. This
change makes the fork mechanism kernel-agnostic. The 'noux_fork'
test works on L4/Fiasco, OKL4, NOVA, Fiasco.OC, and L4ka::Pistachio.
Linux is not supported yet.
2012-02-23 10:42:11 +01:00
Norman Feske
fe2addf5b0 Noux: first functional version of fork
The resource virtualization layer has been extended to support sub RM
sessions because this feature is used by the dynamic linker. Currently,
the address space of the forking process is copied eagerly. However,
different dataspace types are treated differently. For example, only RAM
dataspaces are copied but no ROM dataspaces.

At the libc side, a setjmp/longjmp-based trampoline mechanism is used to
implement the continuation of the main thread inside the new process.
This procedure is also responsible for re-establishing the relationship
to the new process' parent as well as its Noux session.

This version is still in flux and has many rough edges. It is tied to
OKL4 for now.
2012-02-23 10:42:11 +01:00
Norman Feske
869c6e1df2 Noux: dim naming noise using the Genode namespace
Because 'Noux::Child' implements several abstract Genode interfaces, the
'Genode::' prefix became almost ubiquitous, making the code harder to
read. By importing the 'Genode' namespace into the 'Noux' namespace,
this patch remedies this inconvenience.
2012-02-22 15:56:45 +01:00
Norman Feske
5aaf04915c Intercept CPU session of Noux::Child
To implement fork semantics, we need to customize the bootstrapping of
the newly created process, in particular the startup of the main thread.
The CPU session interface provides a suitable hook. By virtualizing the
CPU connection of the process to core, we can defer (and parametrize)
the startup of the main thread. Furthermore, this enables us to detect
illegal attempts by the Noux process to create threads in addition to
the main thread.
2012-02-22 15:56:45 +01:00
Norman Feske
652a4afd51 Intercept RAM and RM of Noux processes
By letting Noux processes talk to service implementations local to the
Noux server, we can track RAM allocations and RM operations. This is
needed as a prerequisite to implement fork.
2012-02-22 15:56:45 +01:00
Norman Feske
15f0879402 Noux: skeleton for getpid and fork 2012-02-22 15:56:45 +01:00
Norman Feske
da5bf709e6 Consider count_in in Noux terminal-read function
It does not suffice to constrain the amount of returned data with chunk
size of the transport buffer because the client may have specified an
even smaller value. For example, libreadline reads single characters
from the terminal and expects a single character in return. A different
amount is interpreted as EOF.
2012-01-28 02:54:29 +01:00
Norman Feske
76127433b7 Rationale for not quoting single '"' chars 2012-01-12 09:18:34 +01:00
Norman Feske
8c3f832f09 Noux: quote env values, fix #66
When reading the values of environment variables supplied via Genode
config mechanism, the XML attribute values were taken as is. On the libc
side, however, the values are processed using Genode's 'Arg_string'
functions. When unquoted, 'Arg_string' expects values to be either
identifiers or numbers. In the general case, however, env values cannot
be expected to satisfy these requirements. Hence, it is better to always
quote these values when reading the XML config. An alternative (maybe
better) solution would be to not use the 'Arg_string' classes in the
libc side.
2012-01-12 09:18:13 +01:00
Norman Feske
08ce32215d Bump year in copyright headers to 2012 2012-01-03 15:35:05 +01:00
Genode Labs
da4e1feaa5 Imported Genode release 11.11 2011-12-22 16:19:25 +01:00