forked from libos-nuse/linux-libos-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nuse.h
54 lines (46 loc) · 1.35 KB
/
nuse.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
/*
* Network stack in userspace (NUSE) for POSIX userspace backend
* Copyright (c) 2015 Hajime Tazaki
*
* Author: Hajime Tazaki <[email protected]>
*/
#ifndef NUSE_H
#define NUSE_H
struct pollfd;
struct SimDevice;
struct SimSocket;
/* nuse.c */
struct nuse_socket {
struct SimSocket *kern_sock;
int refcnt;
int flags;
};
struct nuse_fd {
int real_fd;
struct epoll_fd *epoll_fd;
struct nuse_socket *nuse_sock;
};
extern struct nuse_fd nuse_fd_table[1024];
void nuse_dev_rx(struct SimDevice *dev, char *buf, int size);
/* nuse-fiber.c */
void *nuse_fiber_new(void * (*callback)(void *),
void *context, uint32_t stackSize, const char *name);
void nuse_fiber_start(void *handler);
int nuse_fiber_isself(void *handler);
void nuse_fiber_wait(void *handler);
int nuse_fiber_wakeup(void *handler);
void nuse_fiber_free(void *handler);
void *nuse_fiber_new_from_caller(uint32_t stackSize, const char *name);
int nuse_fiber_is_stopped(void *handler);
void nuse_fiber_stop(void *handler);
void nuse_add_timer(unsigned long ns, void *(*func) (void *arg),
void *arg, void *handler);
void nuse_task_add(void *fiber);
void nuse_set_affinity(void);
/* nuse-poll.c */
int nuse_poll(struct pollfd *fds, unsigned int nfds,
struct timespec *end_time);
/* nuse-syscalls.c */
void nuse_syscall_proxy_init(void);
void nuse_syscall_proxy_exit(void);
#endif /* NUSE_H */