mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-29 15:44:02 +00:00
Allow for overriding time-related libc functions
If using the libc for Noux programs, the default implementation of these functions cannot be used because they rely on a dedicated timeout-scheduler thread. Noux programs, however, are expected to contain only the main thread. By turning the functions into weak symbols, the noux libc-plugin can provide custom implementations.
This commit is contained in:
parent
fe2addf5b0
commit
1a833ebd30
@ -16,7 +16,8 @@
|
||||
|
||||
#include <sys/time.h>
|
||||
|
||||
extern "C" int clock_gettime(clockid_t clk_id, struct timespec *tp)
|
||||
extern "C" __attribute__((weak))
|
||||
int clock_gettime(clockid_t clk_id, struct timespec *tp)
|
||||
{
|
||||
if (clk_id != CLOCK_MONOTONIC)
|
||||
PWRN("Unsupported clk_id, using CLOCK_MONOTONIC instead.");
|
||||
|
@ -15,7 +15,8 @@
|
||||
|
||||
#include <sys/time.h>
|
||||
|
||||
extern "C" int gettimeofday(struct timeval *tv, struct timezone *tz)
|
||||
extern "C" __attribute__((weak))
|
||||
int gettimeofday(struct timeval *tv, struct timezone *tz)
|
||||
{
|
||||
Genode::Alarm::Time time = Genode::Timeout_thread::alarm_timer()->time();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user