2011-12-22 16:19:25 +01:00
|
|
|
/*
|
|
|
|
* \brief Dummy implementations
|
|
|
|
* \author Norman Feske
|
|
|
|
* \date 2008-10-10
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2019-04-26 12:47:33 +02:00
|
|
|
* Copyright (C) 2008-2019 Genode Labs GmbH
|
2011-12-22 16:19:25 +01:00
|
|
|
*
|
|
|
|
* This file is part of the Genode OS framework, which is distributed
|
2017-02-20 13:23:52 +01:00
|
|
|
* under the terms of the GNU Affero General Public License version 3.
|
2011-12-22 16:19:25 +01:00
|
|
|
*/
|
|
|
|
|
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-07-13 19:07:09 +02:00
|
|
|
#include <base/log.h>
|
2011-12-22 16:19:25 +01:00
|
|
|
#include <stddef.h>
|
2012-02-08 23:37:54 +01:00
|
|
|
#include <errno.h>
|
2011-12-22 16:19:25 +01:00
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
|
2015-03-24 14:45:55 +01:00
|
|
|
#include <sys/file.h>
|
|
|
|
#include <sys/mman.h>
|
|
|
|
#include <sys/mount.h>
|
|
|
|
#include <sys/resource.h>
|
|
|
|
#include <sys/socket.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <sys/time.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/ucontext.h>
|
|
|
|
#include <sys/wait.h>
|
2011-12-22 16:19:25 +01:00
|
|
|
|
2015-03-24 14:45:55 +01:00
|
|
|
#include <db.h>
|
|
|
|
#include <netdb.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <pthread.h>
|
|
|
|
#include <pwd.h>
|
2019-04-26 12:47:33 +02:00
|
|
|
#include <netinet/in.h>
|
|
|
|
#include <resolv.h>
|
|
|
|
#include <spinlock.h>
|
|
|
|
#include <ucontext.h>
|
|
|
|
|
2015-03-24 14:45:55 +01:00
|
|
|
|
|
|
|
#define DUMMY(ret_type, ret_val, name, args) __attribute__((weak)) \
|
|
|
|
ret_type name args \
|
|
|
|
{ \
|
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-07-13 19:07:09 +02:00
|
|
|
Genode::warning(__func__, ": " #name " not implemented"); \
|
2012-02-08 23:37:54 +01:00
|
|
|
errno = ENOSYS; \
|
2015-03-24 14:45:55 +01:00
|
|
|
return ret_val; \
|
2012-02-08 23:37:54 +01:00
|
|
|
}
|
2011-12-22 16:19:25 +01:00
|
|
|
|
2018-02-15 11:16:52 +01:00
|
|
|
|
|
|
|
#define DUMMY_SILENT(ret_type, ret_val, name, args) __attribute__((weak)) \
|
|
|
|
ret_type name args \
|
|
|
|
{ \
|
|
|
|
errno = ENOSYS; \
|
|
|
|
return ret_val; \
|
|
|
|
}
|
|
|
|
|
2019-05-29 11:15:54 +02:00
|
|
|
|
2019-04-26 12:47:33 +02:00
|
|
|
#define __SYS_DUMMY(ret_type, ret_val, name, args)\
|
|
|
|
extern "C" __attribute__((weak)) \
|
|
|
|
ret_type __sys_##name args \
|
|
|
|
{ \
|
|
|
|
Genode::warning(__func__, ": " #name " not implemented"); \
|
|
|
|
errno = ENOSYS; \
|
|
|
|
return ret_val; \
|
|
|
|
} \
|
|
|
|
extern "C" __attribute__((weak)) \
|
|
|
|
ret_type __libc_##name args \
|
|
|
|
{ \
|
|
|
|
Genode::warning(__func__, ": " #name " not implemented"); \
|
|
|
|
errno = ENOSYS; \
|
|
|
|
return ret_val; \
|
|
|
|
} \
|
|
|
|
ret_type _##name args __attribute__((weak, alias("__sys_" #name))); \
|
|
|
|
ret_type name args __attribute__((weak, alias("__sys_" #name))); \
|
|
|
|
|
2018-02-15 11:16:52 +01:00
|
|
|
|
2019-05-29 11:15:54 +02:00
|
|
|
#define __SYS_DUMMY_SILENT(ret_type, ret_val, name, args)\
|
|
|
|
extern "C" __attribute__((weak)) \
|
|
|
|
ret_type __sys_##name args \
|
|
|
|
{ \
|
|
|
|
errno = ENOSYS; \
|
|
|
|
return ret_val; \
|
|
|
|
} \
|
|
|
|
extern "C" __attribute__((weak)) \
|
|
|
|
ret_type __libc_##name args \
|
|
|
|
{ \
|
|
|
|
errno = ENOSYS; \
|
|
|
|
return ret_val; \
|
|
|
|
} \
|
|
|
|
ret_type _##name args __attribute__((weak, alias("__sys_" #name))); \
|
|
|
|
ret_type name args __attribute__((weak, alias("__sys_" #name))); \
|
|
|
|
|
|
|
|
|
2015-03-24 14:45:55 +01:00
|
|
|
DUMMY(int , -1, chroot, (const char *))
|
|
|
|
DUMMY(char *, 0, crypt, (const char *, const char *))
|
|
|
|
DUMMY(DB * , 0, dbopen, (const char *, int, int, DBTYPE, const void *))
|
|
|
|
DUMMY(u_int32_t, 0, __default_hash, (const void *, size_t));
|
2018-02-15 11:16:52 +01:00
|
|
|
DUMMY_SILENT(long , -1, _fpathconf, (int, int))
|
2015-03-24 14:45:55 +01:00
|
|
|
DUMMY(long , -1, fpathconf, (int, int))
|
|
|
|
DUMMY(int , -1, freebsd7___semctl, (void))
|
|
|
|
DUMMY(int , -1, getcontext, (ucontext_t *))
|
2019-12-04 16:30:50 +01:00
|
|
|
DUMMY_SILENT(gid_t , 0, getegid, (void))
|
|
|
|
DUMMY_SILENT(uid_t , 0, geteuid, (void))
|
|
|
|
DUMMY_SILENT(gid_t , 0, getgid, (void))
|
2015-03-24 14:45:55 +01:00
|
|
|
DUMMY(int , -1, getgroups, (int, gid_t *))
|
|
|
|
DUMMY(struct hostent *, 0, gethostbyname, (const char *))
|
|
|
|
DUMMY(char *, 0, _getlogin, (void))
|
|
|
|
DUMMY(int , -1, getnameinfo, (const sockaddr *, socklen_t, char *, size_t, char *, size_t, int))
|
|
|
|
DUMMY(struct servent *, 0, getservbyname, (const char *, const char *))
|
|
|
|
DUMMY(int , -1, getsid, (pid_t))
|
2019-12-04 16:30:50 +01:00
|
|
|
DUMMY_SILENT(pid_t , -1, getppid, (void))
|
2015-03-24 14:45:55 +01:00
|
|
|
DUMMY(pid_t , -1, getpgrp, (void))
|
|
|
|
DUMMY(int , -1, getpriority, (int, int))
|
|
|
|
DUMMY(int , -1, getrusage, (int, rusage *))
|
2019-12-04 16:30:50 +01:00
|
|
|
DUMMY_SILENT(uid_t , 0, getuid, (void))
|
2019-05-29 11:15:54 +02:00
|
|
|
DUMMY_SILENT(int , 1, isatty, (int))
|
2015-03-24 14:45:55 +01:00
|
|
|
DUMMY(int , -1, link, (const char *, const char *))
|
2019-04-26 12:47:33 +02:00
|
|
|
DUMMY(int , 0, minherit, (void *, size_t, int))
|
2015-03-24 14:45:55 +01:00
|
|
|
DUMMY(int , -1, mknod, (const char *, mode_t, dev_t))
|
2019-04-26 12:47:33 +02:00
|
|
|
DUMMY(int , -1, mprotect, (void *, size_t, int))
|
2015-03-24 14:45:55 +01:00
|
|
|
DUMMY(void *, 0, ___mtctxres, (void))
|
|
|
|
DUMMY(void *, 0, __nsdefaultsrc, (void))
|
|
|
|
DUMMY(int , -1, _nsdispatch, (void))
|
|
|
|
DUMMY(long , -1, pathconf, (const char *, int))
|
2019-04-26 12:47:33 +02:00
|
|
|
DUMMY(int , -1, raise, (int))
|
2015-03-24 14:45:55 +01:00
|
|
|
DUMMY(int , -1, rmdir, (const char *))
|
|
|
|
DUMMY(void *, 0, sbrk, (intptr_t))
|
|
|
|
DUMMY(int , -1, sched_setparam, (pid_t, const sched_param *))
|
|
|
|
DUMMY(int , -1, sched_setscheduler, (pid_t, int, const sched_param *))
|
|
|
|
DUMMY(int , -1, sched_yield, (void))
|
|
|
|
DUMMY(int , -1, __semctl, (void))
|
2019-05-29 11:15:54 +02:00
|
|
|
DUMMY_SILENT(sig_t, SIG_ERR, signal, (int, sig_t));
|
2015-03-24 14:45:55 +01:00
|
|
|
DUMMY(int , -1, setegid, (uid_t))
|
|
|
|
DUMMY(int , -1, seteuid, (uid_t))
|
|
|
|
DUMMY(int , -1, setgid, (gid_t))
|
|
|
|
DUMMY(int , -1, setuid, (uid_t))
|
|
|
|
DUMMY(int , -1, setgroups, (int, const gid_t *))
|
|
|
|
DUMMY(int , -1, setitimer, (int, const itimerval *, itimerval *))
|
|
|
|
DUMMY(int , -1, setpgid, (pid_t, pid_t))
|
|
|
|
DUMMY(int , -1, setpriority, (int, int, int))
|
|
|
|
DUMMY(int , -1, setregid, (gid_t, gid_t))
|
|
|
|
DUMMY(int , -1, setreuid, (uid_t, uid_t))
|
|
|
|
DUMMY(int , -1, setrlimit, (int, const rlimit *))
|
|
|
|
DUMMY(pid_t , -1, setsid, (void))
|
|
|
|
DUMMY(int , -1, socketpair, (int, int, int, int *))
|
2018-02-15 11:16:52 +01:00
|
|
|
DUMMY_SILENT(mode_t, 0, umask, (mode_t))
|
2015-03-24 14:45:55 +01:00
|
|
|
DUMMY(int , 0, utimes, (const char *, const timeval *))
|
2017-07-26 01:53:01 +02:00
|
|
|
DUMMY(int, -1, semget, (key_t, int, int))
|
|
|
|
DUMMY(int, -1, semop, (key_t, int, int))
|
2019-04-26 12:47:33 +02:00
|
|
|
__SYS_DUMMY(int, -1, aio_suspend, (const struct aiocb * const[], int, const struct timespec *));
|
|
|
|
__SYS_DUMMY(int , -1, getfsstat, (struct statfs *, long, int))
|
|
|
|
__SYS_DUMMY(int, -1, kevent, (int, const struct kevent*, int, struct kevent *, int, const struct timespec*));
|
|
|
|
__SYS_DUMMY(void , , map_stacks_exec, (void));
|
|
|
|
__SYS_DUMMY(int , -1, ptrace, (int, pid_t, caddr_t, int));
|
|
|
|
__SYS_DUMMY(ssize_t, -1, sendmsg, (int s, const struct msghdr*, int));
|
|
|
|
__SYS_DUMMY(int , -1, setcontext, (const ucontext_t *ucp));
|
|
|
|
__SYS_DUMMY(void , , spinlock_stub, (spinlock_t *));
|
|
|
|
__SYS_DUMMY(void , , spinlock, (spinlock_t *));
|
|
|
|
__SYS_DUMMY(void , , spinunlock, (spinlock_t *));
|
|
|
|
__SYS_DUMMY(void , , spinunlock_stub, (spinlock_t *));
|
|
|
|
__SYS_DUMMY(int, -1, swapcontext, (ucontext_t *, const ucontext_t *));
|
|
|
|
__SYS_DUMMY(int, -1, system, (const char *string));
|
|
|
|
|
|
|
|
|
|
|
|
/*****************
|
|
|
|
** File-system **
|
|
|
|
*****************/
|
|
|
|
|
|
|
|
DUMMY(int, 0, fchmod, (int, mode_t))
|
|
|
|
DUMMY(int, -1, lockf, (int, int, off_t))
|
|
|
|
DUMMY_SILENT(int, 0, posix_fadvise, (int, off_t, off_t, int))
|
|
|
|
DUMMY(int, -1, chmod, (const char *, mode_t))
|
|
|
|
DUMMY(int, -1, chown, (const char *, uid_t, gid_t))
|
|
|
|
DUMMY(int, -1, fchown, (int, uid_t, gid_t))
|
|
|
|
DUMMY(int, -1, flock, (int, int))
|
|
|
|
DUMMY(int, -1, fstatat, (int, const char *, struct stat *, int))
|
|
|
|
DUMMY(int, -1, mkfifo, (const char *, mode_t))
|
|
|
|
DUMMY(int, -1, stat, (const char *, struct stat *))
|
|
|
|
DUMMY(void, , sync, (void))
|
|
|
|
__SYS_DUMMY(int, -11, utimensat, (int, const char *, const struct timespec[2], int));
|
|
|
|
__SYS_DUMMY(int, -1, futimens, (int, const struct timespec[2]));
|
|
|
|
__SYS_DUMMY(int, -1, statfs, (const char *, struct statfs *))
|
|
|
|
__SYS_DUMMY(int, -1, truncate, (const char *, off_t))
|
|
|
|
|
|
|
|
|
|
|
|
/***********
|
|
|
|
* Signals *
|
|
|
|
***********/
|
|
|
|
|
|
|
|
#include <signal.h>
|
|
|
|
#include <sys/thr.h>
|
|
|
|
DUMMY(int, -1, sigblock, (int))
|
|
|
|
DUMMY(int, -1, thr_kill2, (pid_t pid, long id, int sig));
|
|
|
|
|
|
|
|
__SYS_DUMMY(int, -1, sigsuspend, (const sigset_t *))
|
|
|
|
__SYS_DUMMY(int, -1, sigtimedwait, (const sigset_t *, siginfo_t *, const struct timespec *));
|
|
|
|
__SYS_DUMMY(int, -1, sigwaitinfo, (const sigset_t *, siginfo_t *));
|
|
|
|
__SYS_DUMMY(int, -1, sigwait, (const sigset_t *, int *));
|
|
|
|
__SYS_DUMMY(int, -1, thr_kill, (long id, int sig));
|
2015-03-24 14:45:55 +01:00
|
|
|
|
2011-12-22 16:19:25 +01:00
|
|
|
|
|
|
|
void ksem_init(void)
|
|
|
|
{
|
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-07-13 19:07:09 +02:00
|
|
|
Genode::warning(__func__, " called, not yet implemented!");
|
2011-12-22 16:19:25 +01:00
|
|
|
while (1);
|
|
|
|
}
|
|
|
|
|
2015-03-24 14:45:55 +01:00
|
|
|
|
|
|
|
int __attribute__((weak)) madvise(void *addr, size_t length, int advice)
|
|
|
|
{
|
|
|
|
if (advice == MADV_DONTNEED)
|
|
|
|
/* ignore hint */
|
|
|
|
return 0;
|
|
|
|
|
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-07-13 19:07:09 +02:00
|
|
|
Genode::warning(__func__, " called, not implemented - ", addr, "+",
|
|
|
|
Genode::Hex(length), " advice=", advice);
|
2015-03-24 14:45:55 +01:00
|
|
|
errno = ENOSYS;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2019-04-26 12:47:33 +02:00
|
|
|
const struct res_sym __p_type_syms[] = { };
|
|
|
|
|
2011-12-22 16:19:25 +01:00
|
|
|
} /* extern "C" */
|
|
|
|
|