7fd42181 |
1 | #include <stdio.h> |
2 | #include <stdlib.h> |
3 | #include <sys/types.h> |
4 | #include <sys/stat.h> |
5 | #include <fcntl.h> |
6 | #include <sys/mman.h> |
7 | #include <unistd.h> |
8 | #include <sys/ioctl.h> |
9 | #include <signal.h> |
10 | #include <termios.h> |
11 | |
12 | |
4d045184 |
13 | int real_open(const char *pathname, int flags, ...); |
7fd42181 |
14 | FILE *real_fopen(const char *path, const char *mode); |
15 | void *real_mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset); |
3ef07128 |
16 | int real_munmap(void *addr, size_t length); |
7fd42181 |
17 | int real_read(int fd, void *buf, size_t count); |
18 | int real_ioctl(int fd, int request, void *argp); |
19 | int real_sigaction(int signum, const struct sigaction *act, struct sigaction *oldact); |
20 | typedef struct sigaction sigaction_t; |
21 | int real_tcgetattr(int fd, struct termios *termios_p); |
22 | int real_tcsetattr(int fd, int optional_actions, const struct termios *termios_p); |
23 | int real_system(const char *command); |
db9191ed |
24 | // exec* - skipped |
25 | int real_execve(const char *filename, char *const argv[], char *const envp[]); |
26 | int real_chdir(const char *path); |
7fd42181 |
27 | |
28 | #define open real_open |
29 | #define fopen real_fopen |
30 | #define mmap real_mmap |
3ef07128 |
31 | #define munmap real_munmap |
7fd42181 |
32 | #define read real_read |
33 | #define ioctl real_ioctl |
34 | #define sigaction real_sigaction |
35 | #define tcgetattr real_tcgetattr |
36 | #define tcsetattr real_tcsetattr |
37 | #define system real_system |
db9191ed |
38 | #define execl real_execl |
39 | #define execlp real_execlp |
7000b522 |
40 | #define execle real_execle |
41 | #define execv real_execv |
42 | #define execvp real_execvp |
db9191ed |
43 | #define execve real_execve |
44 | #define chdir real_chdir |
7fd42181 |
45 | |