All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Loading...
Searching...
No Matches
syscalls.h
1/*
2 * Copyright (C) 2013 Ludwig Knüpfer <ludwig.knuepfer@fu-berlin.de>
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser
5 * General Public License v2.1. See the file LICENSE in the top level
6 * directory for more details.
7 */
8
9#ifndef SYSCALLS_H
10#define SYSCALLS_H
11
12#include <sys/time.h>
13#include <stdint.h>
14#include <ifaddrs.h>
15#include <stdio.h>
16
22#ifndef DOXYGEN
23# if NATIVE_SYSCALLS_DEFINITION
24# define __SPECIFIER
25# else
26# define __SPECIFIER extern
27# endif
28#endif
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/* MARK: - System call wrappers */
43__SPECIFIER ssize_t (*real_read)(int fd, void *buf, size_t count);
44__SPECIFIER ssize_t (*real_write)(int fd, const void *buf, size_t count);
45__SPECIFIER size_t (*real_fread)(void *ptr, size_t size, size_t nmemb, FILE *stream);
46__SPECIFIER ssize_t (*real_recv)(int sockfd, void *buf, size_t len, int flags);
47__SPECIFIER void (*real_clearerr)(FILE *stream);
48__SPECIFIER __attribute__((noreturn)) void (*real_exit)(int status);
49__SPECIFIER void (*real_free)(void *ptr);
50__SPECIFIER void* (*real_malloc)(size_t size);
51__SPECIFIER void* (*real_calloc)(size_t nmemb, size_t size);
52__SPECIFIER void* (*real_realloc)(void *ptr, size_t size);
53__SPECIFIER void (*real_freeaddrinfo)(struct addrinfo *res);
54__SPECIFIER void (*real_freeifaddrs)(struct ifaddrs *ifa);
55__SPECIFIER void (*real_srandom)(unsigned int seed);
56__SPECIFIER int (*real_accept)(int socket, ...);
57__SPECIFIER int (*real_bind)(int socket, ...);
58__SPECIFIER int (*real_connect)(int socket, ...);
59__SPECIFIER int (*real_printf)(const char *format, ...);
60__SPECIFIER int (*real_getaddrinfo)(const char *node, ...);
61__SPECIFIER int (*real_getifaddrs)(struct ifaddrs **ifap);
62__SPECIFIER int (*real_gettimeofday)(struct timeval *t, ...);
63__SPECIFIER int (*real_getpid)(void);
64__SPECIFIER int (*real_chdir)(const char *path);
65__SPECIFIER int (*real_close)(int);
66__SPECIFIER int (*real_fcntl)(int, int, ...);
67__SPECIFIER int (*real_creat)(const char *path, ...);
68__SPECIFIER int (*real_dup2)(int, int);
69__SPECIFIER int (*real_execve)(const char *, char *const[], char *const[]);
70__SPECIFIER int (*real_fork)(void);
71__SPECIFIER int (*real_feof)(FILE *stream);
72__SPECIFIER int (*real_ferror)(FILE *stream);
73__SPECIFIER int (*real_listen)(int socket, int backlog);
74__SPECIFIER int (*real_ioctl)(int fildes, unsigned long request, ...);
75__SPECIFIER int (*real_open)(const char *path, int oflag, ...);
76__SPECIFIER int (*real_pause)(void);
77__SPECIFIER int (*real_pipe)(int[2]);
78__SPECIFIER int (*real_select)(int nfds, ...);
79__SPECIFIER int (*real_poll)(struct pollfd *fds, ...);
80__SPECIFIER int (*real_setsid)(void);
81__SPECIFIER int (*real_setsockopt)(int socket, ...);
82__SPECIFIER int (*real_socket)(int domain, int type, int protocol);
83__SPECIFIER int (*real_unlink)(const char *);
84__SPECIFIER long int (*real_random)(void);
85__SPECIFIER const char* (*real_gai_strerror)(int errcode);
86__SPECIFIER FILE* (*real_fopen)(const char *path, const char *mode);
87__SPECIFIER int (*real_fclose)(FILE *stream);
88__SPECIFIER int (*real_fseek)(FILE *stream, long offset, int whence);
89__SPECIFIER long (*real_ftell)(FILE *stream);
90__SPECIFIER int (*real_fputc)(int c, FILE *stream);
91__SPECIFIER int (*real_fgetc)(FILE *stream);
92__SPECIFIER mode_t (*real_umask)(mode_t cmask);
93__SPECIFIER ssize_t (*real_writev)(int fildes, const struct iovec *iov, int iovcnt);
94__SPECIFIER ssize_t (*real_send)(int sockfd, const void *buf, size_t len, int flags);
95__SPECIFIER off_t (*real_lseek)(int fd, off_t offset, int whence);
96__SPECIFIER off_t (*real_fstat)(int fd, struct stat *statbuf);
97__SPECIFIER int (*real_fsync)(int fd);
98__SPECIFIER int (*real_mkdir)(const char *pathname, mode_t mode);
99__SPECIFIER int (*real_rmdir)(const char *pathname);
100__SPECIFIER DIR *(*real_opendir)(const char *name);
101__SPECIFIER struct dirent *(*real_readdir)(DIR *dirp);
102__SPECIFIER int (*real_closedir)(DIR *dirp);
103__SPECIFIER int (*real_rename)(const char *, const char *);
104__SPECIFIER int (*real_statvfs)(const char *restrict path, struct statvfs *restrict buf);
108#ifdef __cplusplus
109}
110#endif
111
112#if !defined(DOXYGEN)
113# undef __SPECIFIER
114#endif
115
118#endif /* SYSCALLS_H */
int socket(int domain, int type, int protocol)
Create an endpoint for communication.
Structure for scatter/gather I/O.
Definition uio.h:33
File system information.
Definition statvfs.h:46
Definition of struct timeval for the atmega.
Definition time.h:23