Commit Graph

737 Commits

Author SHA1 Message Date
Ehmry - 26d95dc1d3 libc: add mlock and munlock dummies 2020-05-27 16:38:54 +05:30
Ehmry - 99f15358e2 libc: add siginterrupt dummy 2020-05-27 16:24:18 +05:30
Norman Feske b078224753 Replace Genode::strncpy by Genode::copy_cstring
- Since Genode::strncpy is not 100% compatible with the POSIX
  strncpy function, better use a distinct name.

- Remove bogus return value from the function, easing the potential
  enforcement of mandatory return-value checks later.

Fixes #3752
2020-05-27 11:56:45 +02:00
Ehmry - adb48b5c9e Libc: MSG_PEEK support
As discovered by Johannes Kliemann, peeking at buffered socket data
using 'recv' and 'MSG_PEEK' is not supported. Read a "peek" control file
from the socket directory to attempt to peek into buffers at the
socket_fs. Support for every feature of POSIX sockets cannot be
expected, but this one is trivial to implement.

Fix #2875
2020-05-18 10:16:15 +02:00
Norman Feske be65c4acd2 Avoid use of deprecated Xml_node methods
Issue #3755
2020-05-18 10:16:14 +02:00
Christian Helmuth c11d9b7b5c Remove false API dependencies from libc/posix components
Fixes #3720
2020-05-18 10:16:13 +02:00
Norman Feske c39a342fe5 Remove use of <configfile> feature of init
Issue #3753
2020-05-18 10:16:13 +02:00
Norman Feske 07502ce6bb Remove Python2
Fixes #3751
2020-05-18 10:16:13 +02:00
Norman Feske a9f0e47ea3 Remove return value of Log_session::write
Fixes #3749
2020-05-05 13:51:05 +02:00
Norman Feske eb0a33302a libc: strip trailing '/' for directory operations
Fixes #2686
2020-05-04 15:28:47 +02:00
Christian Prochaska 07b87f6f1f pthread: initialize static condition variables
Fixes #3741
2020-04-28 11:42:16 +02:00
Christian Prochaska 905b0c4aef libc: remove log2.patch
Fixes #3740
2020-04-28 11:41:38 +02:00
Christian Prochaska 6505ce47ae libc vfs plugin: report non-zero link count in 'stat()'
Fixes #3739
2020-04-28 11:40:58 +02:00
Christian Prochaska 31d7b3eb97 vfs_lwip: guard 'blocked_handles' Fifo
Fixes #3738
2020-04-28 11:37:56 +02:00
Norman Feske 1bf796d69a Remove Rust support
Fixes #3488
2020-04-24 14:37:57 +02:00
Christian Helmuth 4ab990ad5b libc: provide C++ runtime symbols in ABI
This commit puts all C++ runtime/support symbols of ld.lib.so in a
dedicated section of base/lib/symbols/ld and mirrors the section to
libports/lib/symbols/libc. So, the libc ABI resolves potential C++
runtime dependencies of base-ABI-agnostic components at link time. The
runtime resolution is done by the linker by symbol lookup in ld.lib.so.

Issue #3720
2020-04-17 12:40:13 +02:00
Norman Feske bb35b997b8 New stdin2out utility as replacement for tail -f
This little utility allows us to remove the noux instance for the log
view of Sculpt OS.

Issue #3696
2020-04-17 12:39:32 +02:00
Norman Feske e63195a940 e2fsprogs: disable HAVE_GETMNTINFO
This patch avoids calls of '__sys_getstatfs' (indirectly via
'getmntinfo'), which does not return any meaningful values in Genode's
libc. Otherwise, the libc's dummy implementation prompts resize2fs to
back out.

Issue #3696
2020-04-17 12:39:32 +02:00
Norman Feske 330672e030 libports: mke2fs and resize2fs as standalone apps
This patch makes the e2fsprogs 'mke2fs' and 'resize2fs' available as
standalone components that can be used by Sculpt OS directly without
a Unix emulation environment.
2020-04-17 12:39:32 +02:00
Norman Feske 923c38f7cd libc: allocate errno of main thread statically
The thread-local errno instance for the main thread must not be
allocated on the application heap because it must survive 'execve'.

Fixes #3701
2020-03-26 11:38:57 +01:00
Norman Feske ee6d38a770 libc: prune session labels of forked processes
This patch reduces the size of session labels for all services other
than LOG, keeping only the last element. This avoids exceeding the
maximum label length in the presence of deep fork hierarchies, e.g., for
running the tool chain.

Fixes #3700
2020-03-26 11:38:57 +01:00
Christian Helmuth dd524b56fa libc: propagate socket config to child processes
Fixes #3698
2020-03-26 11:38:57 +01:00
Norman Feske e67f389da1 Add fork test to depot autopilot 2020-03-26 11:38:56 +01:00
Norman Feske 4ebc164c11 Add execve test to depot autopilot 2020-03-26 11:38:56 +01:00
Christian Prochaska 8535688605 qt5: handle Genode signals as Qt signals in QPA plugin
Fixes #3688
2020-03-26 11:38:54 +01:00
Christian Helmuth e52802162c libc: reimplement synchronization primitives
The new implementation relieves the main entrypoint from monitor jobs
for contended lock primitives and is based on custom applicant data
structures, per-lock resp. per-semaphore applicant lists, and a
libc-internal blockade with timeouts based on libc kernel primitives.
2020-02-27 14:47:00 +01:00
Christian Prochaska 9bd3d2aa5c qt5: use main entrypoint in QPA plugin
Fixes #3644
2020-02-20 12:08:16 +01:00
Christian Prochaska 28e782dda5 qt5: use pthread backend for QThreads
Fixes #3643
2020-02-20 12:08:16 +01:00
Christian Prochaska 597098845c libc: support pthread cleanup handlers
Fixes #3642
2020-02-20 12:08:16 +01:00
Christian Helmuth 604f4c666b Remove Timed_semaphore from libc incl test package
Issue #3550
2020-02-10 14:21:47 +01:00
Christian Helmuth ff5175ec76 libc: synchronization primitives based on monitor
The libc monitor facility enables the execution of monitor jobs by the
main thread when the monitor pool was charged. In comparison to the
current suspend/resume_all mechanism the main thread iterates over all
job functions in contrast to waking up all threads to check their
conditions by themselves. Threads are only woken up if the completion
condition was met.

This commit is the result of a collaboration with Christian Prochaska.
Many thanks for your support, Christian.

Fixes #3550
2020-02-10 14:21:47 +01:00
Christian Helmuth 6aebd5dd95 libc: append serial number to pthread name
... in pthread_create()

Issue #3550
2020-02-10 14:21:47 +01:00
Christian Helmuth 3d4bed3374 libc: unify semantic of sleep functions
sleep(), usleep(), and nanosleep() now return immediately on
zero-timeout. Also, non-zero timeouts sleep at least 1 ms (the current
minimal timeout in libc), which compensates rounding errors.

Issue #3550
2020-02-10 14:21:47 +01:00
Christian Helmuth 43719b5fd1 libc: fix returned timeout-left value
If the suspend method for the main thread detects that the suspend
condition is false it must return the passed timeout value (not always
0). Otherwise, the caller may incorrectly assume the timeout expired.
2020-02-04 15:51:10 +01:00
Christian Helmuth 504539ad1e vfs/lwip: notify I/O progress on sent packets
Incoming ACK packets for sent data packets may be the only unblocker for
suspended write/send loops. This patch informs VFS users about I/O of
VFS handle on successfully sent packets.
2019-12-19 17:01:42 +01:00
Sebastian Sumpf 9c372c36c1 libc: thread local errno support
Store errno in pthread objects, return member upon call to '__error()'.
This became necessary in order to make errno thread-safe.

Note, any call to libc code from a non-pthread (beside the first
entrypoint) is not supported.

issue #3568
2019-12-19 17:01:42 +01:00
Sebastian Sumpf 9767c4db0e vfs_lwip/lwip: Lwip::lock for concurrent access
This is required in case the send and receive of IP packets is
performed by multiple thread because lwip is not thread safe.

issue #3568
2019-12-19 17:01:42 +01:00
Norman Feske cd92b32622 libc: close all open FDs on exit
This is important to issue sync requests for written-to files.

As the closing must be performed by an atexit handler, it happens at a
time _after_ libc plugins are destructed. Consequently an FD allocated
by such a plugin results in a close error, which in turn, does not
destruct the FD. We ultimatedly end up in an infinte loop of
re-attempting the close. For this reason, the patch changes 'close' to
be robust against this special case.

This is generally not a problem because libc plugins are phased out.
However, at present, the libc_noux plugin is still important. With the
changed 'close' in place, there occurred an error message "Error: close:
close not implemented" at the exit of each noux program. This patch
removes the error printing from the libc plugin mechansim to avoid this
noise. The error messages are not important anyway because the
deprecation of the libc plugin interface.

Issue #3578
2019-12-19 17:00:48 +01:00
Norman Feske 5853a68904 libc: silence calls of getpeername w/o socket fs
The getpeername function is provided only by the socket fs.
In the case where the socket fs is not configured, return an appropriate
errno instead probing for a libc plugin (there is none).

Issue #3578
2019-12-19 17:00:48 +01:00
Norman Feske ae64830bd5 libc: silence get(e)gid, get(e)uid, getppid
These dummies spam the log when running bash + make, like in the
genodians.org scenario.

Issue #3578
2019-12-19 17:00:48 +01:00
Norman Feske b7fbe65ff2 libc: fork/execve improvements
- Close FDs marked with the close-on-execve flag
  (needed for 'make', which sets the flag for the pipe-in
  FD of forked children)
- Update binary name on execve to use as ROM for subsequent fork
- Enable vfork as an alias for fork (needed by make)
- Purge line buffers for output streams during execve because they
  may be allocated at the allocation heap, which does not survive
  the execve call.
- Consider short-lived processes that may exit while the parent still
  blocks in the fork call.

With these changes, the website generator of genodians.org works without
the need for the Noux runtime.

Issue #3578
2019-12-19 17:00:47 +01:00
Norman Feske d1cf216384 libc: propagate pipe config to child processes
Issue #3578
2019-12-19 17:00:47 +01:00
Sebastian Sumpf 6dae147785 libc: limit fd id allocations to FD_SETSIZE
fd > FD_SETSIZE cannot use 'select' or 'poll' within our libc.
Therefore, we added a bit allocator in order to allocate fd < FD_SETSIZE
(1024).

fixes #3568
2019-12-19 17:00:47 +01:00
Stefan Kalkowski 9814fc5447 libports: enable arm_64 libssl, libcrypto variant
Fix #3563
2019-12-19 16:59:02 +01:00
Sebastian Sumpf f7509a5b78 libports: libc: extract file name from path in dlopen
'dlopen' causes the ldso to open ROM connections, right now we only
support single file names for these ROM not paths. Therefore, we extract
the file name from path within libc's 'dlopen'

fixes #3551
2019-11-19 14:54:14 +01:00
Christian Helmuth a54c04d247 libc: return EPIPE on send to shut down sockets
This intermediate fix still lacks the generation of SIGPIPE and return
of EINTR if the MSG_NOSIGNAL flag is not set in the call to send().
2019-11-19 14:54:14 +01:00
Christian Helmuth e70c04ef86 lwip: shut down TCP sockets return WRITE_ERR_IO on write 2019-11-19 14:54:13 +01:00
Ehmry - c51b4b5742 New VFS plugin for emulating POSIX pipes
Add a new plugin for creating pipes between pairs of VFS handles. It is
intended to replace the libc_pipe plugin, one of the last remaining libc
plugins.

In contrast to the libc_pipe plugin, this plugin defers cross-handle
notification until I/O signal handling rather than block and unblock
readers using a semaphore. This is a performance regression in the case
of multiple threads blocking on a pipe, but shall be an intermediate
mechanism pending renovations within the libc VFS and threading layers.
As a side effect, threads blocked on a pipe might not be resumed until
the main thread suspends and dispatches I/O signals.

The "test-libc_pipe" test has been adjusted to use the VFS pipe plugin
and tests both local pipes and pipes hosted remotely in the VFS server.

Merge adaptations (such as EOF handling, adjustment to VFS/libc
interface changes) by Norman Feske.

Fix #2303
2019-11-19 14:54:13 +01:00
Norman Feske f0de187bbb libc: increase default quota of forked processes
This patch reduces the debug noise for the prominent case of executing
bash with coreutils. Without it, the forked process will always ask for
more RAM immediately when starting up.
2019-11-19 14:54:13 +01:00
Christian Helmuth c50252fb35 libc: suspend/resume in pthread mutex lock/unlock
Issue #3550
2019-11-19 14:54:13 +01:00