forked from libos-nuse/linux-libos-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nuse-hostcalls.h
57 lines (51 loc) · 2.15 KB
/
nuse-hostcalls.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
* host system/library calls for NUSE
* Copyright (c) 2015 Hajime Tazaki
*
* Author: Hajime Tazaki <[email protected]>
*/
#ifndef NUSE_HOSTCALLS_H
#define NUSE_HOSTCALLS_H
struct pollfd;
struct pthread;
struct pthread_attr;
typedef unsigned long int pthread_t;
#ifndef errno
//#include <errno.h>
extern int *__errno_location (void);
#define errno (*__errno_location())
#endif /* errno */
/* nuse-hostcalls.c */
void nuse_hostcall_init(void);
extern int (*host_socket)(int fd, int type, int proto);
extern int (*host_close)(int fd);
extern int (*host_bind)(int, const struct sockaddr *, int);
extern ssize_t (*host_read)(int fd, void *buf, size_t count);
extern ssize_t (*host_send)(int sockfd, const void *buf, size_t len, int flags);
extern ssize_t (*host_sendmsg)(int sockfd, const struct msghdr *msg, int flags);
extern ssize_t (*host_write)(int fd, const void *buf, size_t count);
extern ssize_t (*host_writev)(int fd, const struct iovec *iovec, size_t count);
extern int (*host_open)(const char *pathname, int flags,...);
extern int (*host_open64)(const char *pathname, int flags,...);
extern int (*host_ioctl)(int d, int request, ...);
extern int (*host_pipe)(int pipefd[2]);
extern int (*host_poll)(struct pollfd *, int, int);
extern int (*host_pthread_create)(pthread_t *, const struct pthread_attr *,
void *(*)(void *), void *);
extern int (*host_pthread_join)(pthread_t thread, void **retval);
extern char *(*host_getenv)(const char *name);
extern FILE *(*host_fdopen)(int fd, const char *mode);
extern int (*host_fcntl)(int fd, int cmd, ... /* arg */ );
extern int (*host_fclose)(FILE *fp);
extern size_t (*host_fwrite)(const void *ptr, size_t size, size_t nmemb,
FILE *stream);
extern int (*host_access)(const char *pathname, int mode);
extern int (*host_listen)(int sockfd, int backlog);
extern int (*host_accept)(int sockfd, struct sockaddr *addr,
socklen_t *addrlen);
extern int (*host_getsockopt)(int sockfd, int level, int optname,
void *optval, int *optlen);
extern int (*host_setsockopt)(int sockfd, int level, int optname,
const void *optval, int optlen);
extern pid_t (*host_getpid)(void);
#endif /* NUSE_HOSTCALLS_H */