• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
32 #define EPOLL_CTL_ADD             1
33 #define EPOLL_CTL_DEL             2
34 #define EPOLL_CTL_MOD             3
35 #define MAX_EPOLL_INSTANCES       256
36 #define MAX_ITEMS_PER_EPOLL       1024
37 
38 #define UV__O_CLOEXEC             0x80000
39 
40 struct epoll_event {
41   int events;
42   int fd;
43 };
44 
45 typedef struct {
46   QUEUE member;
47   struct pollfd* items;
48   unsigned long size;
49   int msg_queue;
50 } uv__os390_epoll;
51 
52 /* epoll api */
53 uv__os390_epoll* epoll_create1(int flags);
54 int epoll_ctl(uv__os390_epoll* ep, int op, int fd, struct epoll_event *event);
55 int epoll_wait(uv__os390_epoll* ep, struct epoll_event *events, int maxevents, int timeout);
56 int epoll_file_close(int fd);
57 
58 /* utility functions */
59 int nanosleep(const struct timespec* req, struct timespec* rem);
60 int scandir(const char* maindir, struct dirent*** namelist,
61             int (*filter)(const struct dirent *),
62             int (*compar)(const struct dirent **,
63             const struct dirent **));
64 char *mkdtemp(char* path);
65 ssize_t os390_readlink(const char* path, char* buf, size_t len);
66 size_t strnlen(const char* str, size_t maxlen);
67 
68 #endif /* UV_OS390_SYSCALL_H_ */
69