clib/mktemp.c & shell/If: Fix checking for existing file.
[AROS.git] / arch / all-unix / kernel / kernel_intern.h
blob6dc226128931b25e8bcc233e8257af21825b9cf3
1 #include <sys/time.h>
2 #include <sys/types.h>
3 #include <signal.h>
5 /* Android is not a true Linux ;-) */
6 #ifdef HOST_OS_android
7 #undef HOST_OS_linux
8 #endif
10 #ifdef HOST_OS_linux
11 #define LIBC_NAME "libc.so.6"
12 #endif
14 #ifdef HOST_OS_darwin
15 #define LIBC_NAME "libSystem.dylib"
16 #endif
18 #ifndef LIBC_NAME
19 #define LIBC_NAME "libc.so"
20 #endif
22 /*
23 * On Darwin sigset manipulation functions are redefined as macros, so they are slightly renamed here.
24 * However they still present in libc as normal functions.
26 struct KernelInterface
28 int (*raise)(int sig);
29 int (*sigprocmask)(int how, const sigset_t *set, sigset_t *oldset);
30 int (*sigsuspend)(const sigset_t *mask);
31 int (*sigaction)(int signum, const struct sigaction *act, struct sigaction *oldact);
32 int (*mprotect)(const void *addr, size_t len, int prot);
33 ssize_t (*read)(int fd, void *buf, size_t count);
34 int (*fcntl)(int fd, int cmd, ...);
35 void * (*mmap)(void *addr, size_t length, int prot, int flags, int fd, off_t offset);
36 int (*munmap)(void *addr, size_t length);
37 int *(*__error)(void);
38 #ifdef HOST_OS_android
39 int (*sigwait)(const sigset_t *restrict set, int *restrict sig);
40 #else
41 int (*SigEmptySet)(sigset_t *set);
42 int (*SigFillSet)(sigset_t *set);
43 int (*SigAddSet)(sigset_t *set, int signum);
44 int (*SigDelSet)(sigset_t *set, int signum);
45 #endif
49 * Android's Bionic doesn't have these functions.
50 * They are simply inlined in headers.
52 #ifdef HOST_OS_android
53 #define SIGEMPTYSET sigemptyset
54 #define SIGFILLSET sigfillset
55 #define SIGADDSET sigaddset
56 #define SIGDELSET sigdelset
57 #else
58 #define SIGEMPTYSET(x) pd->iface->SigEmptySet(x); AROS_HOST_BARRIER
59 #define SIGFILLSET(x) pd->iface->SigFillSet(x); AROS_HOST_BARRIER
60 #define SIGADDSET(x,s) pd->iface->SigAddSet(x,s); AROS_HOST_BARRIER
61 #define SIGDELSET(x,s) pd->iface->SigDelSet(x,s); AROS_HOST_BARRIER
62 #endif
64 struct PlatformData
66 sigset_t sig_int_mask; /* Mask of signals that Disable() block */
67 int *errnoPtr;
68 struct KernelInterface *iface;
71 struct SignalTranslation
73 short sig;
74 short AmigaTrap;
75 short CPUTrap;
78 extern struct SignalTranslation const sigs[];
80 void cpu_DispatchContext(struct Task *task, regs_t *regs, struct PlatformData *pdata);