30#ifndef NATIVE_INTERNAL_H
31#define NATIVE_INTERNAL_H
49#elif defined(__linux__)
80void native_cpu_init(
void);
81void native_interrupt_init(
void);
83void native_irq_handler(
void);
84extern void _native_sig_leave_tramp(
void);
85extern void _native_sig_leave_handler(
void);
87void _native_syscall_leave(
void);
88void _native_syscall_enter(
void);
89void _native_init_syscalls(
void);
94extern ssize_t (*real_read)(
int fd,
void *buf,
size_t count);
95extern ssize_t (*real_write)(
int fd,
const void *buf,
size_t count);
96extern off_t (*real_lseek)(
int fd, off_t offset,
int whence);
97extern off_t (*real_fstat)(
int fd,
struct stat *statbuf);
98extern int (*real_statvfs)(
const char *restrict path,
struct statvfs *restrict buf);
99extern int (*real_fsync)(
int fd);
100extern size_t (*real_fread)(
void *ptr,
size_t size,
size_t nmemb, FILE *stream);
101extern void (*real_clearerr)(FILE *stream);
102extern __attribute__((noreturn)) void (*real_exit)(
int status);
103extern void (*real_free)(
void *ptr);
104extern void* (*real_calloc)(
size_t nmemb,
size_t size);
105extern void* (*real_malloc)(
size_t size);
106extern void* (*real_realloc)(
void *ptr,
size_t size);
107extern void (*real_freeaddrinfo)(
struct addrinfo *res);
108extern void (*real_freeifaddrs)(
struct ifaddrs *ifa);
109extern void (*real_srandom)(
unsigned int seed);
111extern int (*real_accept)(
int socket, ...);
113extern int (*real_bind)(
int socket, ...);
114extern int (*real_connect)(
int socket, ...);
115extern ssize_t (*real_recv)(
int sockfd,
void *buf,
size_t len,
int flags);
116extern int (*real_chdir)(
const char *path);
117extern int (*real_close)(int);
118extern int (*real_fcntl)(int, int, ...);
120extern int (*real_creat)(
const char *path, ...);
121extern int (*real_dup2)(int, int);
122extern int (*real_execve)(
const char *,
char *
const[],
char *
const[]);
123extern int (*real_feof)(FILE *stream);
124extern int (*real_ferror)(FILE *stream);
125extern int (*real_fork)(void);
127extern int (*real_getaddrinfo)(
const char *node, ...);
128extern int (*real_getifaddrs)(
struct ifaddrs **ifap);
129extern int (*real_getpid)(void);
130extern int (*real_gettimeofday)(
struct timeval *t, ...);
131extern int (*real_ioctl)(
int fildes,
unsigned long request, ...);
132extern int (*real_listen)(
int socket,
int backlog);
133extern int (*real_open)(
const char *path,
int oflag, ...);
134extern int (*real_mkdir)(
const char *pathname, mode_t mode);
135extern int (*real_rmdir)(
const char *pathname);
136extern DIR *(*real_opendir)(
const char *name);
137extern struct dirent *(*real_readdir)(DIR *dirp);
138extern int (*real_closedir)(DIR *dirp);
139extern int (*real_pause)(void);
140extern int (*real_pipe)(
int[2]);
142extern int (*real_select)(
int nfds, ...);
143extern int (*real_poll)(
struct pollfd *nfds, ...);
144extern int (*real_setitimer)(
int which,
const struct itimerval
145 *__restrict value,
struct itimerval *__restrict ovalue);
146extern int (*real_setsid)(void);
147extern int (*real_setsockopt)(
int socket, ...);
148extern int (*real_socket)(
int domain,
int type,
int protocol);
149extern int (*real_printf)(
const char *format, ...);
150extern int (*real_unlink)(
const char *);
151extern int (*real_rename)(
const char *,
const char *);
152extern long int (*real_random)(void);
153extern const char* (*real_gai_strerror)(
int errcode);
154extern FILE* (*real_fopen)(
const char *path,
const char *mode);
155extern int (*real_fclose)(FILE *stream);
156extern int (*real_fseek)(FILE *stream,
long offset,
int whence);
157extern long (*real_ftell)(FILE *stream);
158extern int (*real_fputc)(
int c, FILE *stream);
159extern int (*real_fgetc)(FILE *stream);
160extern mode_t (*real_umask)(mode_t cmask);
161extern ssize_t (*real_writev)(
int fildes,
const struct iovec *iov,
int iovcnt);
162extern ssize_t (*real_send)(
int sockfd,
const void *buf,
size_t len,
int flags);
167extern volatile int native_interrupts_enabled;
168extern volatile uintptr_t _native_saved_eip;
169extern int _sig_pipefd[2];
170extern volatile int _native_sigpend;
171extern volatile int _native_in_isr;
172extern volatile int _native_in_syscall;
174extern char __isr_stack[];
175extern const size_t __isr_stack_size;
176extern ucontext_t native_isr_context;
177extern ucontext_t end_context;
178extern ucontext_t *_native_cur_ctx, *_native_isr_ctx;
180extern const char *_progname;
181extern char **_native_argv;
182extern pid_t _native_pid;
183extern pid_t _native_id;
184extern unsigned _native_rng_seed;
185extern int _native_rng_mode;
186extern const char *_native_unix_socket_path;
188ssize_t _native_read(
int fd,
void *buf,
size_t count);
189ssize_t _native_write(
int fd,
const void *buf,
size_t count);
190ssize_t _native_writev(
int fildes,
const struct iovec *iov,
int iovcnt);
int unregister_interrupt(int sig)
unregister interrupt handler for interrupt sig
int register_interrupt(int sig, _native_callback_t handler)
register interrupt handler handler for interrupt sig
void(* _native_callback_t)(void)
Prototype for native's internal callbacks.
int socket(int domain, int type, int protocol)
Create an endpoint for communication.
Scheduler API definition.
POSIX compatible sys/statvfs.h definitions.
stdio wrapper to extend the C libs stdio
Structure for scatter/gather I/O.
Definition of struct timeval for the atmega.
libc header for scatter/gather I/O