|
160
|
1 /* Copyright libuv project contributors. All rights reserved.
|
|
|
2 *
|
|
|
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
4 * of this software and associated documentation files (the "Software"), to
|
|
|
5 * deal in the Software without restriction, including without limitation the
|
|
|
6 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
|
7 * sell copies of the Software, and to permit persons to whom the Software is
|
|
|
8 * furnished to do so, subject to the following conditions:
|
|
|
9 *
|
|
|
10 * The above copyright notice and this permission notice shall be included in
|
|
|
11 * all copies or substantial portions of the Software.
|
|
|
12 *
|
|
|
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
18 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
|
19 * IN THE SOFTWARE.
|
|
|
20 */
|
|
|
21
|
|
|
22
|
|
|
23 #ifndef UV_OS390_SYSCALL_H_
|
|
|
24 #define UV_OS390_SYSCALL_H_
|
|
|
25
|
|
|
26 #include "uv.h"
|
|
|
27 #include "internal.h"
|
|
|
28 #include <dirent.h>
|
|
|
29 #include <poll.h>
|
|
|
30 #include <pthread.h>
|
|
|
31 #include "zos-base.h"
|
|
|
32
|
|
|
33 #define EPOLL_CTL_ADD 1
|
|
|
34 #define EPOLL_CTL_DEL 2
|
|
|
35 #define EPOLL_CTL_MOD 3
|
|
|
36 #define MAX_EPOLL_INSTANCES 256
|
|
|
37 #define MAX_ITEMS_PER_EPOLL 1024
|
|
|
38
|
|
|
39 #define UV__O_CLOEXEC 0x80000
|
|
|
40
|
|
|
41 struct epoll_event {
|
|
|
42 int events;
|
|
|
43 int fd;
|
|
|
44 int is_msg;
|
|
|
45 };
|
|
|
46
|
|
|
47 typedef struct {
|
|
|
48 struct uv__queue member;
|
|
|
49 struct pollfd* items;
|
|
|
50 unsigned long size;
|
|
|
51 int msg_queue;
|
|
|
52 } uv__os390_epoll;
|
|
|
53
|
|
|
54 /* epoll api */
|
|
|
55 uv__os390_epoll* epoll_create1(int flags);
|
|
|
56 int epoll_ctl(uv__os390_epoll* ep, int op, int fd, struct epoll_event *event);
|
|
|
57 int epoll_wait(uv__os390_epoll* ep, struct epoll_event *events, int maxevents, int timeout);
|
|
|
58 int epoll_file_close(int fd);
|
|
|
59
|
|
|
60 /* utility functions */
|
|
|
61 int scandir(const char* maindir, struct dirent*** namelist,
|
|
|
62 int (*filter)(const struct dirent *),
|
|
|
63 int (*compar)(const struct dirent **,
|
|
|
64 const struct dirent **));
|
|
|
65 char *mkdtemp(char* path);
|
|
|
66 ssize_t os390_readlink(const char* path, char* buf, size_t len);
|
|
|
67 size_t strnlen(const char* str, size_t maxlen);
|
|
|
68 int sem_init(UV_PLATFORM_SEM_T* semid, int pshared, unsigned int value);
|
|
|
69 int sem_destroy(UV_PLATFORM_SEM_T* semid);
|
|
|
70 int sem_post(UV_PLATFORM_SEM_T* semid);
|
|
|
71 int sem_trywait(UV_PLATFORM_SEM_T* semid);
|
|
|
72 int sem_wait(UV_PLATFORM_SEM_T* semid);
|
|
|
73 void uv__os390_cleanup(void);
|
|
|
74
|
|
|
75 #endif /* UV_OS390_SYSCALL_H_ */
|