mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
cpu/native: wire up more fs related syscalls
This commit is contained in:
parent
8ec1934226
commit
006ad81c0c
@ -59,7 +59,9 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#include <sys/statvfs.h>
|
||||||
#include <sys/uio.h>
|
#include <sys/uio.h>
|
||||||
|
#include <dirent.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -90,6 +92,10 @@ void _native_init_syscalls(void);
|
|||||||
*/
|
*/
|
||||||
extern ssize_t (*real_read)(int fd, void *buf, size_t count);
|
extern ssize_t (*real_read)(int fd, void *buf, size_t count);
|
||||||
extern ssize_t (*real_write)(int fd, const void *buf, size_t count);
|
extern ssize_t (*real_write)(int fd, const void *buf, size_t count);
|
||||||
|
extern off_t (*real_lseek)(int fd, off_t offset, int whence);
|
||||||
|
extern off_t (*real_fstat)(int fd, struct stat *statbuf);
|
||||||
|
extern int (*real_statvfs)(const char *restrict path, struct statvfs *restrict buf);
|
||||||
|
extern int (*real_fsync)(int fd);
|
||||||
extern size_t (*real_fread)(void *ptr, size_t size, size_t nmemb, FILE *stream);
|
extern size_t (*real_fread)(void *ptr, size_t size, size_t nmemb, FILE *stream);
|
||||||
extern void (*real_clearerr)(FILE *stream);
|
extern void (*real_clearerr)(FILE *stream);
|
||||||
extern __attribute__((noreturn)) void (*real_exit)(int status);
|
extern __attribute__((noreturn)) void (*real_exit)(int status);
|
||||||
@ -124,6 +130,11 @@ extern int (*real_gettimeofday)(struct timeval *t, ...);
|
|||||||
extern int (*real_ioctl)(int fildes, int request, ...);
|
extern int (*real_ioctl)(int fildes, int request, ...);
|
||||||
extern int (*real_listen)(int socket, int backlog);
|
extern int (*real_listen)(int socket, int backlog);
|
||||||
extern int (*real_open)(const char *path, int oflag, ...);
|
extern int (*real_open)(const char *path, int oflag, ...);
|
||||||
|
extern int (*real_mkdir)(const char *pathname, mode_t mode);
|
||||||
|
extern int (*real_rmdir)(const char *pathname);
|
||||||
|
extern DIR *(*real_opendir)(const char *name);
|
||||||
|
extern struct dirent *(*real_readdir)(DIR *dirp);
|
||||||
|
extern int (*real_closedir)(DIR *dirp);
|
||||||
extern int (*real_pause)(void);
|
extern int (*real_pause)(void);
|
||||||
extern int (*real_pipe)(int[2]);
|
extern int (*real_pipe)(int[2]);
|
||||||
/* The ... is a hack to save includes: */
|
/* The ... is a hack to save includes: */
|
||||||
@ -136,6 +147,7 @@ extern int (*real_setsockopt)(int socket, ...);
|
|||||||
extern int (*real_socket)(int domain, int type, int protocol);
|
extern int (*real_socket)(int domain, int type, int protocol);
|
||||||
extern int (*real_printf)(const char *format, ...);
|
extern int (*real_printf)(const char *format, ...);
|
||||||
extern int (*real_unlink)(const char *);
|
extern int (*real_unlink)(const char *);
|
||||||
|
extern int (*real_rename)(const char *, const char *);
|
||||||
extern long int (*real_random)(void);
|
extern long int (*real_random)(void);
|
||||||
extern const char* (*real_gai_strerror)(int errcode);
|
extern const char* (*real_gai_strerror)(int errcode);
|
||||||
extern FILE* (*real_fopen)(const char *path, const char *mode);
|
extern FILE* (*real_fopen)(const char *path, const char *mode);
|
||||||
|
@ -105,6 +105,16 @@ int (*real_fgetc)(FILE *stream);
|
|||||||
mode_t (*real_umask)(mode_t cmask);
|
mode_t (*real_umask)(mode_t cmask);
|
||||||
ssize_t (*real_writev)(int fildes, const struct iovec *iov, int iovcnt);
|
ssize_t (*real_writev)(int fildes, const struct iovec *iov, int iovcnt);
|
||||||
ssize_t (*real_send)(int sockfd, const void *buf, size_t len, int flags);
|
ssize_t (*real_send)(int sockfd, const void *buf, size_t len, int flags);
|
||||||
|
off_t (*real_lseek)(int fd, off_t offset, int whence);
|
||||||
|
off_t (*real_fstat)(int fd, struct stat *statbuf);
|
||||||
|
int (*real_fsync)(int fd);
|
||||||
|
int (*real_mkdir)(const char *pathname, mode_t mode);
|
||||||
|
int (*real_rmdir)(const char *pathname);
|
||||||
|
DIR *(*real_opendir)(const char *name);
|
||||||
|
struct dirent *(*real_readdir)(DIR *dirp);
|
||||||
|
int (*real_closedir)(DIR *dirp);
|
||||||
|
int (*real_rename)(const char *, const char *);
|
||||||
|
int (*real_statvfs)(const char *restrict path, struct statvfs *restrict buf);
|
||||||
|
|
||||||
void _native_syscall_enter(void)
|
void _native_syscall_enter(void)
|
||||||
{
|
{
|
||||||
@ -549,4 +559,14 @@ void _native_init_syscalls(void)
|
|||||||
*(void **)(&real_ftell) = dlsym(RTLD_NEXT, "ftell");
|
*(void **)(&real_ftell) = dlsym(RTLD_NEXT, "ftell");
|
||||||
*(void **)(&real_fputc) = dlsym(RTLD_NEXT, "fputc");
|
*(void **)(&real_fputc) = dlsym(RTLD_NEXT, "fputc");
|
||||||
*(void **)(&real_fgetc) = dlsym(RTLD_NEXT, "fgetc");
|
*(void **)(&real_fgetc) = dlsym(RTLD_NEXT, "fgetc");
|
||||||
|
*(void **)(&real_mkdir) = dlsym(RTLD_NEXT, "mkdir");
|
||||||
|
*(void **)(&real_rmdir) = dlsym(RTLD_NEXT, "rmdir");
|
||||||
|
*(void **)(&real_lseek) = dlsym(RTLD_NEXT, "lseek");
|
||||||
|
*(void **)(&real_fstat) = dlsym(RTLD_NEXT, "fstat");
|
||||||
|
*(void **)(&real_fsync) = dlsym(RTLD_NEXT, "fsync");
|
||||||
|
*(void **)(&real_rename) = dlsym(RTLD_NEXT, "rename");
|
||||||
|
*(void **)(&real_opendir) = dlsym(RTLD_NEXT, "opendir");
|
||||||
|
*(void **)(&real_readdir) = dlsym(RTLD_NEXT, "readdir");
|
||||||
|
*(void **)(&real_closedir) = dlsym(RTLD_NEXT, "closedir");
|
||||||
|
*(void **)(&real_statvfs) = dlsym(RTLD_NEXT, "statvfs");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user