d245445fdfcd781f06ec96afa7b886dcc245d088
[platform/core/uifw/libtdm.git] / ut / stubs / stub_unistd.h
1 #ifndef STUB_UNISTD_H
2 #define STUB_UNISTD_H
3
4 #include <unistd.h>
5 #include <sys/poll.h>
6
7 #define STUB_UNISTD_SIZE_FDS 32
8
9 extern int stub_pipe_error;
10 extern int stub_syscall_return_value;
11 extern int stub_syscall_reset;
12 extern int stub_write_error;
13 extern short stub_unistd_closed_fds[STUB_UNISTD_SIZE_FDS];
14 extern void *stub_read_buf;
15 extern int stub_read_returned_size;
16 extern int stub_dub_error;
17 extern int stub_poll_error;
18 extern int stub_poll_eagain;
19
20 void stub_unistd_init();
21
22 int stub_pipe(int pipedes[2]);
23
24 long int stub_syscall (long int sysno, ...);
25
26 int stub_close(int fd);
27
28 ssize_t stub_write(int fd, const void *buf, size_t n);
29
30 ssize_t stub_read(int fd, void *buf, size_t nbytes);
31
32 int stub_dup(int fd);
33 int stub_dup2(int __fd, int __fd2);
34
35 int stub_poll(struct pollfd *fds, nfds_t nfds, int timeout);
36
37 #define pipe(p) stub_pipe(p)
38 #define syscall(sysno, args...) stub_syscall(sysno, ##args)
39 #define close(fd) stub_close(fd)
40 #define write(fd, buf, n) stub_write(fd, buf, n)
41 #define read(fd, buf, nbytes) stub_read(fd, buf, nbytes)
42 #define dup(fd) stub_dup(fd)
43 #define poll(fds, nfds, timeout) stub_poll(fds, nfds, timeout)
44
45 #endif // STUB_UNISTD_H