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