Commit Graph

266 Commits

Author SHA1 Message Date
Emery Hemingway
2deddf1e6d Check for symlink target length errors
Check for symlink length errors at the VFS library and the ram_fs and
vfs servers.

Fix #2462
2017-08-17 11:04:21 +02:00
Emery Hemingway
c5c9d71df3 libc: track O_ACCMODE flags from open
Fix #2457
2017-08-17 11:04:19 +02:00
Alexander Senier
87c19cb11a libc: handle O_CREAT|O_NOFOLLOW in open correctly
We return ELOOP if the file already exists on
open(...,O_CREAT|O_NOFOLLOW).

Fixes #2458
2017-08-17 11:04:19 +02:00
Christian Helmuth
c9db94313c libc: improve VFS error handling 2017-06-19 12:35:57 +02:00
Christian Helmuth
c223f74ce5 libc: support getsockopt(SO_TYPE) 2017-06-19 12:35:57 +02:00
Christian Helmuth
854b70fd7d Prevent warning about "narrowing conversion" 2017-05-31 13:16:23 +02:00
Alexander Boettcher
f865b71f27 libc: fix expired-timer calculation 2017-05-31 13:16:17 +02:00
Josef Söntgen
b361de8379 libc: return true on writefd checks in select on sockets
Instead of files we have to check this condition on sockets but
technically our sockets are regular files as well...
2017-05-31 13:16:15 +02:00
Josef Söntgen
dbec8d7710 libc: pretend to support SO_ERROR
There are programs, e.g. curl, that check if a connection was
established successfully by looking at SO_ERROR. Pretend that
the getsockopt() call was executed to keep them happy. If they
try to use a broken connection, the other socket functions will
bail.
2017-05-31 13:16:15 +02:00
Josef Söntgen
028aeafabe libc: only return requested events in poll()
Even if the underlying select() reports events, only report those
to the caller that were initially requested.
2017-05-31 13:16:15 +02:00
Norman Feske
53253ba422 base: add reinit functionality to 'Env'
The 'reinit' and 'reinit_main_thread' methods are needed to implement
fork in Noux. Until now, they were provided by the 'Deprecated_env'
only.
2017-05-31 13:16:14 +02:00
Martin Stein
c70fed29f7 os/timer: interpolate time via timestamps
Previously, the Genode::Timer::curr_time always used the
Timer_session::elapsed_ms RPC as back end.  Now, Genode::Timer reads
this remote time only in a periodic fashion independently from the calls
to Genode::Timer::curr_time. If now one calls Genode::Timer::curr_time,
the function takes the last read remote time value and adapts it using
the timestamp difference since the remote-time read. The conversion
factor from timestamps to time is estimated on every remote-time read
using the last read remote-time value and the timestamp difference since
the last remote time read.

This commit also re-works the timeout test. The test now has two stages.
In the first stage, it tests fast polling of the
Genode::Timer::curr_time. This stage checks the error between locally
interpolated and timer-driver time as well as wether the locally
interpolated time is monotone and sufficiently homogeneous. In the
second stage several periodic and one-shot timeouts are scheduled at
once. This stage checks if the timeouts trigger sufficiently precise.

This commit adds the new Kernel::time syscall to base-hw. The syscall is
solely used by the Genode::Timer on base-hw as substitute for the
timestamp. This is because on ARM, the timestamp function uses the ARM
performance counter that stops counting when the WFI (wait for
interrupt) instruction is active. This instruction, however is used by
the base-hw idle contexts that get active when no user thread needs to
be scheduled.  Thus, the ARM performance counter is not a good choice for
time interpolation and we use the kernel internal time instead.

With this commit, the timeout library becomes a basic library. That means
that it is linked against the LDSO which then provides it to the program it
serves. Furthermore, you can't use the timeout library anymore without the
LDSO because through the kernel-dependent LDSO make-files we can achieve a
kernel-dependent timeout implementation.

This commit introduces a structured Duration type that shall successively
replace the use of Microseconds, Milliseconds, and integer types for duration
values.

Open issues:

* The timeout test fails on Raspberry PI because of precision errors in the
  first stage. However, this does not render the framework unusable in general
  on the RPI but merely is an issue when speaking of microseconds precision.

* If we run on ARM with another Kernel than HW the timestamp speed may
  continuously vary from almost 0 up to CPU speed. The Timer, however,
  only uses interpolation if the timestamp speed remained stable (12.5%
  tolerance) for at least 3 observation periods. Currently, one period is
  100ms, so its 300ms. As long as this is not the case,
  Timer_session::elapsed_ms is called instead.

  Anyway, it might happen that the CPU load was stable for some time so
  interpolation becomes active and now the timestamp speed drops. In the
  worst case, we would now have 100ms of slowed down time. The bad thing
  about it would be, that this also affects the timeout of the period.
  Thus, it might "freeze" the local time for more than 100ms.

  On the other hand, if the timestamp speed suddenly raises after some
  stable time, interpolated time can get too fast. This would shorten the
  period but nonetheless may result in drifting away into the far future.
  Now we would have the problem that we can't deliver the real time
  anymore until it has caught up because the output of Timer::curr_time
  shall be monotone. So, effectively local time might "freeze" again for
  more than 100ms.

  It would be a solution to not use the Trace::timestamp on ARM w/o HW but
  a function whose return value causes the Timer to never use
  interpolation because of its stability policy.

Fixes #2400
2017-05-31 13:16:11 +02:00
Christian Helmuth
bf96c4a4da libc: align malloc() allocations at 16-byte
Fixes #754
2017-05-31 13:16:11 +02:00
Christian Helmuth
6d25c614d3 libc: remove deprecated API from malloc() 2017-05-31 13:16:09 +02:00
Norman Feske
4d442bca30 Streamline exception types
This patch reduces the number of exception types by facilitating
globally defined exceptions for common usage patterns shared by most
services. In particular, RPC functions that demand a session-resource
upgrade not longer reflect this condition via a session-specific
exception but via the 'Out_of_ram' or 'Out_of_caps' types.

Furthermore, the 'Parent::Service_denied', 'Parent::Unavailable',
'Root::Invalid_args', 'Root::Unavailable', 'Service::Invalid_args',
'Service::Unavailable', and 'Local_service::Factory::Denied' types have
been replaced by the single 'Service_denied' exception type defined in
'session/session.h'.

This consolidation eases the error handling (there are fewer exceptions
to handle), alleviates the need to convert exceptions along the
session-creation call chain, and avoids possible aliasing problems
(catching the wrong type with the same name but living in a different
scope).
2017-05-31 13:16:07 +02:00
Norman Feske
e44f65f3b2 core: RAM service based on 'Session_object'
This patch reworks the implementation of core's RAM service to make use
of the 'Session_object' and to remove the distinction between the
"metadata" quota and the managed RAM quota. With the new implementation,
the session implicitly allocates its metadata from its own account. So
there is not need to handle 'Out_of_metadata' and 'Quota_exceeded' via
different exceptions. Instead, the new version solely uses the
'Out_of_ram' exception.

Furthermore, the 'Allocator::Out_of_memory' exception has become an alias
for 'Out_of_ram', which simplifies the error handling.

Issue #2398
2017-05-31 13:16:06 +02:00
Norman Feske
58f44d39c5 base: use 'Ram_quota' in 'Ram_session' args
This patch replaces the former use of size_t with the use of the
'Ram_quota' type to improve type safety (in particular to avoid
accidentally mixing up RAM quotas with cap quotas).

Issue #2398
2017-05-31 13:16:04 +02:00
Emery Hemingway
01e8f7ea3d libc: do not open stdio descriptors unless configured to do so
Fix #2396
2017-05-31 13:16:01 +02:00
Christian Helmuth
9802ae83e0 libc: rework socket fs for O_NONBLOCK 2017-05-31 13:15:58 +02:00
Christian Helmuth
1d99e7ede9 base: classify signals as I/O and application level
Fixes #2363
2017-05-31 13:15:58 +02:00
Christian Helmuth
b3819f30dc libc: support for O_NONBLOCK in read() 2017-05-31 13:15:57 +02:00
Christian Prochaska
58f2088d3e gcc: update to version 6.3.0
Issue #2372
2017-05-31 13:15:49 +02:00
Christian Helmuth
cb43e04691 ldso: defer execution of static constructors
Ldso now does not automatically execute static constructors of the
binary and shared libraries the binary depends on. If static
construction is required (e.g., if a shared library with constructor is
used or a compilation unit contains global statics) the component needs
to execute the constructors explicitly in Component::construct() via
Genode::Env::exec_static_constructors().

In the case of libc components this is done by the libc startup code
(i.e., the Component::construct() implementation in the libc).

The loading of shared objects at runtime is not affected by this change
and constructors of those objects are executed immediately.

Fixes #2332
2017-03-24 16:20:04 +01:00
Christian Helmuth
67ac0dde6e libc: checks for initialization and user context
We check if the libc (kernel singleton, config) was initialized and also
if suspend() is called from the valid user context.

Issue #2332
2017-03-24 16:20:03 +01:00
Emery Hemingway
50ee91e738 libc: poll listening sockets during select
Open the accept file at the listen call and poll for read henceforce.

Fix #2319
2017-03-24 16:19:55 +01:00
Emery Hemingway
7ef8c81607 libc: socket fcntl flags inheritence
Set O_NONBLOCK on sockets from the fcntl syscall and propagate this flag
to socket_fs control files and sockets returned from accept.

Fix #2318
2017-03-24 16:19:55 +01:00
Christian Prochaska
137305d58a libc: add 'max_align_t' type
Fixes #2334
2017-03-15 13:12:26 +01:00
Emery Hemingway
10ed7b38d4 libc: initialize the environ pointer before Libc::construct
Setting the global environ pointer to NULL prevents getenv surprises
when using libc without the POSIX wrapper.

Fix #2312
2017-03-15 12:32:27 +01:00
Alexander Boettcher
1d36ecc13f libc: fix config parsing in vfs_plugin
The Xml_node contains already only the libc sub_node.

Issue #2306

Broken due to commit:

 libc: remove global config accessor

 Issue #2280.
2017-03-15 12:24:44 +01:00
Christian Helmuth
6bc3bc5881 libc: use proper fd sets in select-handler select 2017-03-15 12:24:44 +01:00
Norman Feske
29b8d609c9 Adjust file headers to refer to the AGPLv3 2017-02-28 12:59:29 +01:00
Josef Söntgen
9ec553474e libc: remove global config accessor
Issue #2280.
2017-02-28 12:59:27 +01:00
Josef Söntgen
b3af297058 libc: remove global env from sysctl
Issue #2280.
2017-02-28 12:59:27 +01:00
Josef Söntgen
b2dd0ab436 libc: remove global env from socket_fs_plugin
Issue #2280.
2017-02-28 12:59:27 +01:00
Josef Söntgen
5ec7a0e2f8 libc: remove global env from mmap registry
Issue #2280.
2017-02-28 12:59:27 +01:00
Josef Söntgen
a79f7d234b libc: remove global env from fd_alloc
Issue #2280.
2017-02-28 12:59:27 +01:00
Christian Prochaska
c4eea920a4 libc: fix resume mechanism
Fixes #2287
2017-02-28 12:59:25 +01:00
Josef Söntgen
76cb06794a libports: Libc::with_libc nested
Fixes #2286.
2017-02-28 12:59:25 +01:00
Martin Stein
d61cb2714c libc/socket_fs: unlink during close
If 'close' does not call 'unlink' like 'shutdown', the Lxip_socket_dir
never gets destroyed and thus the socket server leaks resources like
RAM and ports.

Ref #2285
2017-02-28 12:59:25 +01:00
Martin Stein
43fcdc43e6 libc/socket_fs: warn on unexpected arg in shutdown
Our 'shutdown' implementation handles only the case that 'how' is 'RDWR'.
Thus, print an error and continue if a user calls it with another value.

Fixes #2285
2017-02-28 12:59:24 +01:00
Alexander Boettcher
1a6963813c libc: avoid race using Libc::suspend with pthreads
TOCTTOU bug, in our case time of check to time of sleep bug
2017-02-28 12:59:24 +01:00
Christian Prochaska
db0dc0d97c libc: unblock main thread in 'Kernel::resume_all()'
If 'Libc::Kernel::resume:all()' is called from a non-main thread, send a
signal to unblock the main thread from 'wait_and_dispatch_one_signal()'.

Fixes #2283
2017-02-28 12:59:24 +01:00
Josef Söntgen
69c48a3626 os: refactor Global_file_system_factory
The global file system factory is now created explicitly and the
global singleton accessor function was removed.

Fixes #2281.
2017-02-28 12:59:23 +01:00
Martin Stein
06e605defa LibC VFS: Warn on possible FD path leaks 2017-02-28 12:59:19 +01:00
Martin Stein
222a789fef LibC socket FS: Fix leak of remote and local files 2017-02-28 12:59:19 +01:00
Christian Helmuth
eab477370f libc: select support for components
Libc components cannot use regular calls to select() as this may suspend
their execution. In this case incoming RPCs will be deferred until
select() returns and the component returns to the entrypoint dispatch
loop. The Libc::Signal_handler solves this problem with a its select()
that either returns the currently ready file descriptors immediately or
calls the registered handler function during libc resume.
2017-02-28 12:59:17 +01:00
Christian Helmuth
f7f18710de libc: tests for components using RPC and select() 2017-02-28 12:59:16 +01:00
Christian Helmuth
0aac473229 libc: component-compatible execution semantics
Now, the libc kernel supports to execute application code from all RPC
functions not only Component::construct(). This is enabled by the
Libc::with_libc() scope function.
2017-02-28 12:59:16 +01:00
Norman Feske
3a65f0bba3 libc: 'with_libc' mechanism to enter libc runtime
This commit extends an easy-to-use mechanism to allow Genode component
code to enter/leave the libc application context. This is needed
whenever low-level component code (like signal handlers or RPC
functions) need to interact with potentially blocking libc I/O
functions.

Please note that this commit contains the API-level design only. The
actual context switching code 'execute_in_application_context' is
missing.
2017-02-28 12:59:16 +01:00
Christian Helmuth
fdad5116dd libc: support for socket file system
The socket file system can be configured in the "socket" attribute of
the libc config node like follows.

  <vfs> <dir name="socket"> <fs/> </dir> </vfs>
  <libc ... socket="/socket"/>

This configures the socket file system libc backend to access files in
"/socket" for socket operations.
2017-02-28 12:59:16 +01:00
Christian Helmuth
61b6dccf13 Queued read/write/read_ready in VFS and servers 2017-02-23 15:03:28 +01:00
Christian Helmuth
8185a49b4c libc: replace Timed_semaphore by suspend with timeout 2017-02-23 14:54:50 +01:00
Christian Helmuth
957653d4b9 libc: separate unit for freeaddrinfo/getaddrinfo
Preperation for merge of libc_resolv into libc.
2017-02-23 14:54:50 +01:00
Sebastian Sumpf
643a09b518 libc: late intialization of plugins
- for-each plugin iterator
* Call 'init(Genode::env &)' for each plugin bofore 'Libc::construct' or
'main' is called
2017-02-23 14:54:46 +01:00
Norman Feske
a4e2999e7d libc: warn but don't stop on too early allocations 2017-02-07 19:20:29 +01:00
Christian Helmuth
f9389109bf Support select in libc VFS plugin by read_ready() 2017-02-07 11:12:29 +01:00
Christian Helmuth
c0d61858c3 Support for suspendable read in VFS and libC
The support has two parts. First, a VFS plugin now gets passed an
I/O-response handler callback on construction, which informs users of the
VFS that an I/O event occurred. This enables, for example, the libC to
check if blocking read can be completed. Further, the VFS file I/O
interface provides now functions for suspendable reads, i.e.,
queue_read() and complete_read().
2017-02-07 11:12:27 +01:00
Norman Feske
d1df1dbd87 libc: API transition (fix deprecated warnings)
Issue #1987
2017-02-07 11:12:24 +01:00
Christian Helmuth
0f6800b20f libc: use task switch in select() 2017-02-07 11:12:23 +01:00
Christian Helmuth
e93fe55e54 libc: clear frame pointer on user-context entry
If built with frame-pointer support the backtrace now stops at the user
entry code. Before, the libc kernel stack was trced back too.
2017-01-31 14:58:36 +01:00
Emery Hemingway
745eb89237 lib/component: pass extended Libc::Env
Libc::Env is the Genode::Env interface extended to cover access
to the XML content of the 'config' ROM and a VFS instance. This
deduplicates the burden of components to attain and manage
these resources.

Fix #2217
Ref #1987
2017-01-13 13:07:01 +01:00
Norman Feske
4da52517c1 Simpify startup of dynamically linked binaries
This patch removes the component_entry_point library, which used to
proved a hook for the libc to intercept the call of the
'Component::construct' function. The mechansim has several shortcomings
(see the discussion in the associated issue) and was complex. So we
eventually discarded the approach in favor of the explicit handling of
the startup.

A regular Genode component provides a 'Component::construct' function,
which is determined by the dynamic linker via a symbol lookup.
For the time being, the dynamic linker falls back to looking up a 'main'
function if no 'Component::construct' function could be found.

The libc provides an implementation of 'Component::construct', which
sets up the libc's task handling and finally call the function
'Libc::Component::construct' from the context of the appllication task.
This function is expected to be provided by the libc-using application.
Consequently, Genode components that use the libc have to implement the
'Libc::Component::construct' function.

The new 'posix' library provides an implementation of
'Libc::Component::construct' that calls a main function. Hence, POSIX
programs that merely use the POSIX API merely have to add 'posix' to the
'LIBS' declaration in their 'target.mk' file. Their execution starts at
'main'.

Issue #2199
2017-01-13 13:06:52 +01:00
Norman Feske
784e728727 Clean ldso from using deprecated APIs
Issue #1987
2016-11-08 15:26:32 +01:00
Emery Hemingway
ddf3716cff vfs: pass Env and allocator when creating file-systems
Fix #1891
2016-11-08 15:26:31 +01:00
Norman Feske
e370e08e01 Define Genode::size_t as unsigned long
Fixes #2105
2016-10-21 12:39:29 +02:00
Menno Valkema
ff06361c71 libc: memset valid allocations only in calloc()
Fixes #2097
2016-09-14 11:53:04 +02:00
Norman Feske
17c79a9e23 base: avoid use of deprecated base/printf.h
Besides adapting the components to the use of base/log.h, the patch
cleans up a few base headers, i.e., it removes unused includes from
root/component.h, specifically base/heap.h and
ram_session/ram_session.h. Hence, components that relied on the implicit
inclusion of those headers have to manually include those headers now.

While adjusting the log messages, I repeatedly stumbled over the problem
that printing char * arguments is ambiguous. It is unclear whether to
print the argument as pointer or null-terminated string. To overcome
this problem, the patch introduces a new type 'Cstring' that allows the
caller to express that the argument should be handled as null-terminated
string. As a nice side effect, with this type in place, the optional len
argument of the 'String' class could be removed. Instead of supplying a
pair of (char const *, size_t), the constructor accepts a 'Cstring'.
This, in turn, clears the way let the 'String' constructor use the new
output mechanism to assemble a string from multiple arguments (and
thereby getting rid of snprintf within Genode in the near future).

To enforce the explicit resolution of the char * ambiguity, the 'char *'
overload of the 'print' function is marked as deleted.

Issue #1987
2016-08-29 17:27:10 +02:00
Christian Helmuth
3b9f022f1c libc: some symbol cleanups 2016-08-29 17:23:20 +02:00
Emery Hemingway
0a01edded2 Path::strip_last_element removes path delimiter
Remove the trailing slash of a path where the path is not "/".
New Path::append_element convenience function.

Fixes #1744
2016-06-28 11:09:27 +02:00
Emery Hemingway
ca4f956f21 lib/libc: remove builtin sysctl release information
Fixes #2003
2016-06-28 11:09:25 +02:00
Norman Feske
2030ae678e Supplement base/log.h with raw output function
This patch introduces the Genode::raw function that prints output
directly via a low-level kernel mechanism, if available.

On base-linux, it replaces the former 'raw_write_str' function.
On base-hw, it replaces the former kernel/log.h interface.

Fixes #2012
2016-06-22 12:21:42 +02:00
Alexander Boettcher
db1d6568fb libc: vfs_plugin - initialize fstatfs members
Issue #1873
2016-06-22 12:17:17 +02:00
Emery Hemingway
d9c48847db lib/libc: set initial directory if VFS initialized
Fixes #1984
2016-06-07 08:06:59 +02:00
Emery Hemingway
930e2638b2 lib/libc: remove internal use of getcwd at fstatat
The implementation and behaviour of 'getcwd' is externally defined.

Add move operators to Genode::Path.

Issue: #1984
2016-06-07 08:06:35 +02:00
Norman Feske
807be83b1b Remove inconsistent use of 'is_' prefix
Fixes #1963
2016-05-23 15:52:39 +02:00
Norman Feske
f6dec901bb base: remove Component::name from API
It turns out that the name function does not have much use in practice
except for naming the thread of the component's initial entrypoint. For
dynamically linked components, this thread is created by the dynamic
linker. It is named "ep" in these cases. Considering that we will
eventually turn all regular components into dynamically linked
executables, the additional information provided by the
Component::name() function remains unused. So it is better to not bother
the component developers with adding boilerplate code.
2016-05-23 15:49:56 +02:00
Norman Feske
fd401bdf53 Thread API cleanup
This patch cleans up the thread API and comes with the following
noteworthy changes:

- Introduced Cpu_session::Weight type that replaces a formerly used
  plain integer value to prevent the accidental mix-up of
  arguments.
- The enum definition of Cpu_session::DEFAULT_WEIGHT moved to
  Cpu_session::Weight::DEFAULT_WEIGHT
- New Thread constructor that takes a 'Env &' as first argument.
  The original constructors are now marked as deprecated. For the
  common use case where the default 'Weight' and 'Affinity' are
  used, a shortcut is provided. In the long term, those two
  constructors should be the only ones to remain.
- The former 'Thread<>' class template has been renamed to
  'Thread_deprecated'.
- The former 'Thread_base' class is now called 'Thread'.
- The new 'name()' accessor returns the thread's name as 'Name'
  object as centrally defined via 'Cpu_session::Name'. It is meant to
  replace the old-fashioned 'name' method that takes a buffer and size
  as arguments.
- Adaptation of the thread test to the new API

Issue #1954
2016-05-23 15:49:55 +02:00
Norman Feske
40a5af42eb Clean up base-library structure
This patch moves the base library from src/base to src/lib/base,
flattens the library-internal directory structure, and moves the common
parts of the library-description files to base/lib/mk/base.inc and
base/lib/mk/base-common.inc.

Furthermore, the patch fixes a few cosmetic issues (whitespace and
comments only) that I encountered while browsing the result.

Fixes #1952
2016-05-09 13:24:11 +02:00
Norman Feske
4f69772ecc Replace 'Env' interface with modern one
The original 'Env' interface as returned by 'Genode::env()' has been
renamed to 'Env_deprecated' and moved to deprecated/env.h. The new version
of base/env.h contains the interface passed to modern components that
use the component API via base/component.h.

Issue #1832
2016-05-09 13:10:52 +02:00
Norman Feske
511acad507 Consolidate RM service into PD session
This patch integrates three region maps into each PD session to
reduce the session overhead and to simplify the PD creation procedure.
Please refer to the issue cited below for an elaborative discussion.

Note the API change:

With this patch, the semantics of core's RM service have changed. Now,
the service is merely a tool for creating and destroying managed
dataspaces, which are rarely needed. Regular components no longer need a
RM session. For this reason, the corresponding argument for the
'Process' and 'Child' constructors has been removed.

The former interface of the 'Rm_session' is not named 'Region_map'. As a
minor refinement, the 'Fault_type' enum values are now part of the
'Region_map::State' struct.

Issue #1938
2016-05-09 13:10:51 +02:00
Emery Hemingway
93b82c14ac libc: read sysctl info from /.sysctl/...
Fixes #1931
2016-05-09 13:09:56 +02:00
Martin Stein
d5d891a227 libports: raise stack size of libc apps
Triggered by cc1plus in noux_tool_chain_auto on hw_arndale that caused
an overflow on its 64K stack.

Ref #1941
2016-04-25 10:48:01 +02:00
Norman Feske
fbc35cb796 base: hide slab implementation details from API
Issue #1908
2016-04-25 10:47:56 +02:00
Norman Feske
329ab80d1d libc: never destruct the file-descriptor allocator
This patch prevents the destruction of the fd allocator when the program
exists. Otherwise, the meta data for file descriptors that were not
manually closed would vanish, which may cause problems in subsequent
destructors.
2016-04-25 10:47:55 +02:00
Emery Hemingway
b8e52189d5 lib/vfs: new permissions errors
New errors STAT_ERR_NO_PERM, DIRENT_ERR_NO_PERM, and READLINK_NO_PERM to
distinguish lookup errors from permissions or other errors.

Issue #1751
2016-04-25 10:47:54 +02:00
Emery Hemingway
82a7799638 lib/vfs: pass handle allocator to open(...)
Opening a VFS handle previously involved allocating from the global heap
at each VFS file system. By amending open with an allocator argument,
dynamic allocation can be partitioned.

A new close method is used to deallocate open handles.

Issue #1751
Issue #1891
2016-04-11 12:56:54 +02:00
Norman Feske
051e84c4b4 Move server API concept to base framework
This commit introduces the new `Component` interface in the form of the
headers base/component.h and base/entrypoint.h. The os/server.h API
has become merely a compatibilty wrapper and will eventually be removed.
The same holds true for os/signal_rpc_dispatcher.h. The mechanism has
moved to base/signal.h and is now called 'Signal_handler'.

Since the patch shuffles headers around, please do a 'make clean' in the
build directory.

Issue #1832
2016-04-11 11:51:46 +02:00
Emery Hemingway
da16ecc002 libc: remove trailing slash during file operations
POSIX stipulates that a trailing '/' on a path is valid for any
operation where the final path element is a directory.

Fixes #1330
2016-03-17 17:15:32 +01:00
Emery Hemingway
23c1d4c66d libc, vfs: rename improvements
Perform POSIX rename checks at the libc VFS plugin.
Clarify rename at VFS fs, ram, single, and tar file systems.

Issue #1900
Fixes #1782
2016-03-07 12:40:04 +01:00
Emery Hemingway
9f9510ddb1 libc: implement fstatat by wrapping stat and lstat
Fixes #403
2016-01-13 14:49:11 +01:00
Emery Hemingway
b9c234a341 Libc: sigprocmask reports all signals blocked
Fixes #1756
2016-01-13 11:13:52 +01:00
Emery Hemingway
976833f171 libc: getdtablesize support
Issue #1847
2016-01-08 15:07:57 +01:00
Emery Hemingway
1d92631ef0 VFS, File_system: Not_empty
Unlink returns an error for non-empty directories when the backend does
not support recursive unlinking.

Fixes #1750
2015-11-29 18:17:05 +01:00
Emery Hemingway
2da239d0c8 void sync(char const *path)
Sync now takes a path argument at VFS and File system interfaces.

Issue #1648
2015-11-04 14:09:23 +01:00
Emery Hemingway
1779a0511b vfs: add new error codes
The codes are OPEN_ERR_NAME_TOO_LONG, OPEN_ERR_NO_SPACE, and
FTRUNCATE_ERR_NO_SPACE.

Issue #1693
2015-10-06 12:18:51 +02:00
Emery Hemingway
45bcb7f48f Override libc access in Noux plugin
Fixes #1706
2015-09-30 12:20:39 +02:00
Emery Hemingway
5d434944eb libc: support access() in plugins
Fixes #1703
2015-09-30 12:20:38 +02:00
Christian Helmuth
32da844f01 libc: refactor socket operations 2015-08-21 11:00:57 +02:00
Emery Hemingway
f996697fd5 VFS: local ram_fs instances
Move FS Node implementations from server/ram_fs to include/ram_fs.
Support embedded ram_fs instances in VFS configurations using <ram/>.
Add 'no space' handling to VFS symlink ops.

Fixes #1635
2015-08-21 10:58:40 +02:00
Norman Feske
e3be65833f vfs: decouple file-system factory from libc
This patch moves the VFS file-system factory to a separate vfs library
that is independent from libc. This enables libc-less Genode programs to
easily use the VFS infrastructure.

Fixes #1561
2015-06-09 11:00:10 +02:00
Christian Helmuth
c934ee1650 libc: remove debugging artifact from exit() 2015-05-26 09:39:53 +02:00
Christian Prochaska
526d6eed1c libc: fix compiler warning
Fixes #1523
2015-05-26 09:39:51 +02:00
Norman Feske
eaab23c012 base: const-correctness of Allocator interface
This patch adds const qualifiers to the functions Allocator::consumed,
Allocator::overhead, Allocator::avail, and Range_allocator::valid_addr.

Fixes #1481
2015-04-17 16:13:22 +02:00
Alexander Boettcher
97758f8468 libc: use correct type for dummy libc functions
as far as possible. Some functions are internal to libc and no public
header are available.

Fixes #1466
2015-03-27 11:53:16 +01:00
Christian Helmuth
d6f9725548 libc: fix compiler warning (issue #1434) 2015-03-13 12:17:24 +01:00
Christian Helmuth
2cd902f09f libc: warn on configuration errors in rtc wrapper
Fixes #1336.
2015-01-06 12:39:11 +01:00
Christian Helmuth
77410a08a8 libc: remove debug messages from vfs plugin 2015-01-06 12:39:10 +01:00
Alexander Boettcher
f970e4a71b libc: support F_SETFD && FD_CLOEXEC ioctl
Issue #1308
2014-12-01 17:29:17 +01:00
Christian Helmuth
e708bbe2c6 libc: do not zero errno on success in vfs plugin
The manpage to errno tells the following story:

The <errno.h> header file defines the integer variable errno, which is
set by system calls and some library functions in the event of an error
to indicate what went wrong. Its value is significant only when the
return value of the call indicated an error (i.e., -1 from most system
calls; -1 or NULL from most library functions); a function that
succeeds is allowed to change errno.

Valid error numbers are all nonzero; errno is never set to zero by any
system call or library function.
2014-11-12 14:44:16 +01:00
Sebastian Sumpf
5a821d4c92 base: Genode's dynamic linker
Issue #1280
2014-11-12 14:44:15 +01:00
Alexander Boettcher
8b8c2713ae vfs: use 64bit for file offset and size
Fixes #1246
2014-10-10 13:02:28 +02:00
Josef Söntgen
2bf67136c6 libc: add support for external vfs file systems
These file systems are provided on-demand by loading a shared library
when the fstab node is traversed. By convention this library is named
after the file system it provides. For example a file system that
provides a 'random' file system node is called 'vfs_random.lib.so'. It
is still possible to give the the node another name in the vfs. The
following code snippts illustrates this matter:

! [...]
! <config>
!   <libc>
!     <vfs>
!       <dir name="dev"> <jitterentropy name="random"/> </dir>
!     </vfs>
!   </libc>
! </config>
! [...]

Here the jitterentropy file system, implemented in
'vfs_jitterentropy.lib.so' provides a file system node named 'random'
in the 'dev' directory. When traversing the vfs section the libc will
try to load 'vfs_jitterentropy.lib.so' but programs may access the
file system only via '/dev/random'.

Fixes #1240.
2014-08-22 16:16:41 +02:00
Josef Söntgen
c745aa4454 libc: utilize Rtc_file_system in time functions
Fixes #1241.
2014-08-22 16:16:41 +02:00
Josef Söntgen
ebc07949ff libc: add support for Rtc_file_system
Fixes #1241.
2014-08-22 16:16:41 +02:00
Norman Feske
85a2ebc1c4 libports: migrate to new ports mechanism
Issue #1082
2014-05-27 11:14:42 +02:00
Norman Feske
ca971bbfd8 Move repositories to 'repos/' subdirectory
This patch changes the top-level directory layout as a preparatory
step for improving the tools for managing 3rd-party source codes.
The rationale is described in the issue referenced below.

Issue #1082
2014-05-14 16:08:00 +02:00