murgatroid99 | 79b3227 | 2016-08-08 13:38:30 -0700 | [diff] [blame] | 1 | /* |
| 2 | * |
Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame] | 3 | * Copyright 2016 gRPC authors. |
murgatroid99 | 79b3227 | 2016-08-08 13:38:30 -0700 | [diff] [blame] | 4 | * |
Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame] | 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | * you may not use this file except in compliance with the License. |
| 7 | * You may obtain a copy of the License at |
murgatroid99 | 79b3227 | 2016-08-08 13:38:30 -0700 | [diff] [blame] | 8 | * |
Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame] | 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
murgatroid99 | 79b3227 | 2016-08-08 13:38:30 -0700 | [diff] [blame] | 10 | * |
Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame] | 11 | * Unless required by applicable law or agreed to in writing, software |
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | * See the License for the specific language governing permissions and |
| 15 | * limitations under the License. |
murgatroid99 | 79b3227 | 2016-08-08 13:38:30 -0700 | [diff] [blame] | 16 | * |
| 17 | */ |
| 18 | |
| 19 | #include <grpc/support/port_platform.h> |
| 20 | |
| 21 | #ifndef GRPC_CORE_LIB_IOMGR_PORT_H |
| 22 | #define GRPC_CORE_LIB_IOMGR_PORT_H |
| 23 | |
murgatroid99 | 9030c81 | 2016-09-16 13:25:08 -0700 | [diff] [blame] | 24 | #if defined(GRPC_UV) |
murgatroid99 | 7871f73 | 2016-09-23 13:49:05 -0700 | [diff] [blame] | 25 | // Do nothing |
murgatroid99 | 9030c81 | 2016-09-16 13:25:08 -0700 | [diff] [blame] | 26 | #elif defined(GPR_MANYLINUX1) |
Yuchen Zeng | bc66377 | 2017-07-24 22:23:12 -0700 | [diff] [blame] | 27 | #define GRPC_HAVE_ARPA_NAMESER 1 |
Yuchen Zeng | f134206 | 2017-03-12 22:39:11 -0700 | [diff] [blame] | 28 | #define GRPC_HAVE_IFADDRS 1 |
murgatroid99 | 623dd4f | 2016-08-08 17:31:27 -0700 | [diff] [blame] | 29 | #define GRPC_HAVE_IPV6_RECVPKTINFO 1 |
| 30 | #define GRPC_HAVE_IP_PKTINFO 1 |
| 31 | #define GRPC_HAVE_MSG_NOSIGNAL 1 |
| 32 | #define GRPC_HAVE_UNIX_SOCKET 1 |
Ken Payson | c573132 | 2017-10-16 13:17:02 -0700 | [diff] [blame] | 33 | #define GRPC_POSIX_FORK 1 |
murgatroid99 | 623dd4f | 2016-08-08 17:31:27 -0700 | [diff] [blame] | 34 | #define GRPC_POSIX_NO_SPECIAL_WAKEUP_FD 1 |
| 35 | #define GRPC_POSIX_SOCKET 1 |
| 36 | #define GRPC_POSIX_SOCKETADDR 1 |
| 37 | #define GRPC_POSIX_SOCKETUTILS 1 |
| 38 | #define GRPC_POSIX_WAKEUP_FD 1 |
murgatroid99 | 9030c81 | 2016-09-16 13:25:08 -0700 | [diff] [blame] | 39 | #define GRPC_TIMER_USE_GENERIC 1 |
murgatroid99 | 192293d | 2016-08-09 10:24:22 -0700 | [diff] [blame] | 40 | #elif defined(GPR_WINDOWS) |
murgatroid99 | 9030c81 | 2016-09-16 13:25:08 -0700 | [diff] [blame] | 41 | #define GRPC_TIMER_USE_GENERIC 1 |
murgatroid99 | 192293d | 2016-08-09 10:24:22 -0700 | [diff] [blame] | 42 | #define GRPC_WINSOCK_SOCKET 1 |
| 43 | #define GRPC_WINDOWS_SOCKETUTILS 1 |
murgatroid99 | 5407089 | 2016-08-08 17:01:18 -0700 | [diff] [blame] | 44 | #elif defined(GPR_ANDROID) |
murgatroid99 | 623dd4f | 2016-08-08 17:31:27 -0700 | [diff] [blame] | 45 | #define GRPC_HAVE_IPV6_RECVPKTINFO 1 |
| 46 | #define GRPC_HAVE_IP_PKTINFO 1 |
| 47 | #define GRPC_HAVE_MSG_NOSIGNAL 1 |
| 48 | #define GRPC_HAVE_UNIX_SOCKET 1 |
| 49 | #define GRPC_LINUX_EVENTFD 1 |
| 50 | #define GRPC_POSIX_SOCKET 1 |
| 51 | #define GRPC_POSIX_SOCKETADDR 1 |
| 52 | #define GRPC_POSIX_SOCKETUTILS 1 |
| 53 | #define GRPC_POSIX_WAKEUP_FD 1 |
murgatroid99 | 9030c81 | 2016-09-16 13:25:08 -0700 | [diff] [blame] | 54 | #define GRPC_TIMER_USE_GENERIC 1 |
murgatroid99 | 5407089 | 2016-08-08 17:01:18 -0700 | [diff] [blame] | 55 | #elif defined(GPR_LINUX) |
Yuchen Zeng | bc66377 | 2017-07-24 22:23:12 -0700 | [diff] [blame] | 56 | #define GRPC_HAVE_ARPA_NAMESER 1 |
Yuchen Zeng | f134206 | 2017-03-12 22:39:11 -0700 | [diff] [blame] | 57 | #define GRPC_HAVE_IFADDRS 1 |
murgatroid99 | 623dd4f | 2016-08-08 17:31:27 -0700 | [diff] [blame] | 58 | #define GRPC_HAVE_IPV6_RECVPKTINFO 1 |
| 59 | #define GRPC_HAVE_IP_PKTINFO 1 |
| 60 | #define GRPC_HAVE_MSG_NOSIGNAL 1 |
| 61 | #define GRPC_HAVE_UNIX_SOCKET 1 |
| 62 | #define GRPC_LINUX_MULTIPOLL_WITH_EPOLL 1 |
Ken Payson | c573132 | 2017-10-16 13:17:02 -0700 | [diff] [blame] | 63 | #define GRPC_POSIX_FORK 1 |
Mark D. Roth | f9bf428 | 2017-08-03 14:47:23 -0700 | [diff] [blame] | 64 | #define GRPC_POSIX_HOST_NAME_MAX 1 |
murgatroid99 | 623dd4f | 2016-08-08 17:31:27 -0700 | [diff] [blame] | 65 | #define GRPC_POSIX_SOCKET 1 |
| 66 | #define GRPC_POSIX_SOCKETADDR 1 |
| 67 | #define GRPC_POSIX_WAKEUP_FD 1 |
murgatroid99 | 9030c81 | 2016-09-16 13:25:08 -0700 | [diff] [blame] | 68 | #define GRPC_TIMER_USE_GENERIC 1 |
murgatroid99 | 5407089 | 2016-08-08 17:01:18 -0700 | [diff] [blame] | 69 | #ifdef __GLIBC_PREREQ |
Mehrdad Afshari | 1957fd0 | 2018-01-16 17:22:01 -0800 | [diff] [blame^] | 70 | #if __GLIBC_PREREQ(2, 4) |
murgatroid99 | 623dd4f | 2016-08-08 17:31:27 -0700 | [diff] [blame] | 71 | #define GRPC_LINUX_EPOLL 1 |
Mehrdad Afshari | 1957fd0 | 2018-01-16 17:22:01 -0800 | [diff] [blame^] | 72 | #endif |
| 73 | #if __GLIBC_PREREQ(2, 9) |
| 74 | #define GRPC_LINUX_EPOLL_CREATE1 1 |
murgatroid99 | 623dd4f | 2016-08-08 17:31:27 -0700 | [diff] [blame] | 75 | #define GRPC_LINUX_EVENTFD 1 |
murgatroid99 | 5407089 | 2016-08-08 17:01:18 -0700 | [diff] [blame] | 76 | #endif |
| 77 | #if __GLIBC_PREREQ(2, 10) |
murgatroid99 | 623dd4f | 2016-08-08 17:31:27 -0700 | [diff] [blame] | 78 | #define GRPC_LINUX_SOCKETUTILS 1 |
murgatroid99 | 5407089 | 2016-08-08 17:01:18 -0700 | [diff] [blame] | 79 | #endif |
| 80 | #endif |
Ken Payson | 975b510 | 2017-03-30 17:38:40 -0700 | [diff] [blame] | 81 | #ifndef __GLIBC__ |
| 82 | #define GRPC_LINUX_EPOLL 1 |
| 83 | #define GRPC_LINUX_EVENTFD 1 |
murgatroid99 | 9805833 | 2017-04-19 10:25:34 -0700 | [diff] [blame] | 84 | #define GRPC_MSG_IOVLEN_TYPE int |
Ken Payson | 975b510 | 2017-03-30 17:38:40 -0700 | [diff] [blame] | 85 | #endif |
murgatroid99 | 623dd4f | 2016-08-08 17:31:27 -0700 | [diff] [blame] | 86 | #ifndef GRPC_LINUX_EVENTFD |
| 87 | #define GRPC_POSIX_NO_SPECIAL_WAKEUP_FD 1 |
murgatroid99 | 5407089 | 2016-08-08 17:01:18 -0700 | [diff] [blame] | 88 | #endif |
murgatroid99 | 623dd4f | 2016-08-08 17:31:27 -0700 | [diff] [blame] | 89 | #ifndef GRPC_LINUX_SOCKETUTILS |
| 90 | #define GRPC_POSIX_SOCKETUTILS |
murgatroid99 | 5407089 | 2016-08-08 17:01:18 -0700 | [diff] [blame] | 91 | #endif |
| 92 | #elif defined(GPR_APPLE) |
Yuchen Zeng | bc66377 | 2017-07-24 22:23:12 -0700 | [diff] [blame] | 93 | #define GRPC_HAVE_ARPA_NAMESER 1 |
Yuchen Zeng | f134206 | 2017-03-12 22:39:11 -0700 | [diff] [blame] | 94 | #define GRPC_HAVE_IFADDRS 1 |
murgatroid99 | 623dd4f | 2016-08-08 17:31:27 -0700 | [diff] [blame] | 95 | #define GRPC_HAVE_SO_NOSIGPIPE 1 |
| 96 | #define GRPC_HAVE_UNIX_SOCKET 1 |
| 97 | #define GRPC_MSG_IOVLEN_TYPE int |
Ken Payson | c573132 | 2017-10-16 13:17:02 -0700 | [diff] [blame] | 98 | #define GRPC_POSIX_FORK 1 |
murgatroid99 | 623dd4f | 2016-08-08 17:31:27 -0700 | [diff] [blame] | 99 | #define GRPC_POSIX_NO_SPECIAL_WAKEUP_FD 1 |
| 100 | #define GRPC_POSIX_SOCKET 1 |
| 101 | #define GRPC_POSIX_SOCKETADDR 1 |
| 102 | #define GRPC_POSIX_SOCKETUTILS 1 |
Mark D. Roth | f9bf428 | 2017-08-03 14:47:23 -0700 | [diff] [blame] | 103 | #define GRPC_POSIX_SYSCONF 1 |
murgatroid99 | 623dd4f | 2016-08-08 17:31:27 -0700 | [diff] [blame] | 104 | #define GRPC_POSIX_WAKEUP_FD 1 |
murgatroid99 | 9030c81 | 2016-09-16 13:25:08 -0700 | [diff] [blame] | 105 | #define GRPC_TIMER_USE_GENERIC 1 |
murgatroid99 | 5407089 | 2016-08-08 17:01:18 -0700 | [diff] [blame] | 106 | #elif defined(GPR_FREEBSD) |
Yuchen Zeng | bc66377 | 2017-07-24 22:23:12 -0700 | [diff] [blame] | 107 | #define GRPC_HAVE_ARPA_NAMESER 1 |
Yuchen Zeng | f134206 | 2017-03-12 22:39:11 -0700 | [diff] [blame] | 108 | #define GRPC_HAVE_IFADDRS 1 |
murgatroid99 | 623dd4f | 2016-08-08 17:31:27 -0700 | [diff] [blame] | 109 | #define GRPC_HAVE_IPV6_RECVPKTINFO 1 |
murgatroid99 | 623dd4f | 2016-08-08 17:31:27 -0700 | [diff] [blame] | 110 | #define GRPC_HAVE_SO_NOSIGPIPE 1 |
| 111 | #define GRPC_HAVE_UNIX_SOCKET 1 |
Ken Payson | c573132 | 2017-10-16 13:17:02 -0700 | [diff] [blame] | 112 | #define GRPC_POSIX_FORK 1 |
murgatroid99 | 623dd4f | 2016-08-08 17:31:27 -0700 | [diff] [blame] | 113 | #define GRPC_POSIX_NO_SPECIAL_WAKEUP_FD 1 |
| 114 | #define GRPC_POSIX_SOCKET 1 |
| 115 | #define GRPC_POSIX_SOCKETADDR 1 |
| 116 | #define GRPC_POSIX_SOCKETUTILS 1 |
| 117 | #define GRPC_POSIX_WAKEUP_FD 1 |
murgatroid99 | 9030c81 | 2016-09-16 13:25:08 -0700 | [diff] [blame] | 118 | #define GRPC_TIMER_USE_GENERIC 1 |
Frank Groeneveld | fbf8128 | 2017-10-12 08:27:14 +0200 | [diff] [blame] | 119 | #elif defined(GPR_OPENBSD) |
| 120 | #define GRPC_HAVE_IFADDRS 1 |
| 121 | #define GRPC_HAVE_IPV6_RECVPKTINFO 1 |
| 122 | #define GRPC_HAVE_UNIX_SOCKET 1 |
| 123 | #define GRPC_POSIX_NO_SPECIAL_WAKEUP_FD 1 |
| 124 | #define GRPC_POSIX_SOCKET 1 |
| 125 | #define GRPC_POSIX_SOCKETADDR 1 |
| 126 | #define GRPC_POSIX_SOCKETUTILS 1 |
| 127 | #define GRPC_POSIX_WAKEUP_FD 1 |
| 128 | #define GRPC_TIMER_USE_GENERIC 1 |
murgatroid99 | 5407089 | 2016-08-08 17:01:18 -0700 | [diff] [blame] | 129 | #elif defined(GPR_NACL) |
Yuchen Zeng | bc66377 | 2017-07-24 22:23:12 -0700 | [diff] [blame] | 130 | #define GRPC_HAVE_ARPA_NAMESER 1 |
murgatroid99 | 623dd4f | 2016-08-08 17:31:27 -0700 | [diff] [blame] | 131 | #define GRPC_POSIX_NO_SPECIAL_WAKEUP_FD 1 |
| 132 | #define GRPC_POSIX_SOCKET 1 |
| 133 | #define GRPC_POSIX_SOCKETADDR 1 |
| 134 | #define GRPC_POSIX_SOCKETUTILS 1 |
| 135 | #define GRPC_POSIX_WAKEUP_FD 1 |
murgatroid99 | 9030c81 | 2016-09-16 13:25:08 -0700 | [diff] [blame] | 136 | #define GRPC_TIMER_USE_GENERIC 1 |
murgatroid99 | 5407089 | 2016-08-08 17:01:18 -0700 | [diff] [blame] | 137 | #elif !defined(GPR_NO_AUTODETECT_PLATFORM) |
| 138 | #error "Platform not recognized" |
| 139 | #endif |
murgatroid99 | 79b3227 | 2016-08-08 13:38:30 -0700 | [diff] [blame] | 140 | |
murgatroid99 | 623dd4f | 2016-08-08 17:31:27 -0700 | [diff] [blame] | 141 | #if defined(GRPC_POSIX_SOCKET) + defined(GRPC_WINSOCK_SOCKET) + \ |
murgatroid99 | dedb923 | 2016-09-26 13:54:04 -0700 | [diff] [blame] | 142 | defined(GRPC_CUSTOM_SOCKET) + defined(GRPC_UV) != \ |
murgatroid99 | 5407089 | 2016-08-08 17:01:18 -0700 | [diff] [blame] | 143 | 1 |
murgatroid99 | 623dd4f | 2016-08-08 17:31:27 -0700 | [diff] [blame] | 144 | #error Must define exactly one of GRPC_POSIX_SOCKET, GRPC_WINSOCK_SOCKET, GPR_CUSTOM_SOCKET |
murgatroid99 | 5407089 | 2016-08-08 17:01:18 -0700 | [diff] [blame] | 145 | #endif |
murgatroid99 | 79b3227 | 2016-08-08 13:38:30 -0700 | [diff] [blame] | 146 | |
Mark D. Roth | f9bf428 | 2017-08-03 14:47:23 -0700 | [diff] [blame] | 147 | #if defined(GRPC_POSIX_HOST_NAME_MAX) && defined(GRPC_POSIX_SYSCONF) |
| 148 | #error "Cannot define both GRPC_POSIX_HOST_NAME_MAX and GRPC_POSIX_SYSCONF" |
| 149 | #endif |
| 150 | #if !defined(GRPC_POSIX_HOST_NAME_MAX) && !defined(GRPC_POSIX_SYSCONF) |
| 151 | #define GRPC_GETHOSTNAME_FALLBACK 1 |
| 152 | #endif |
| 153 | |
murgatroid99 | 7e924a0 | 2016-08-10 10:06:43 -0700 | [diff] [blame] | 154 | #endif /* GRPC_CORE_LIB_IOMGR_PORT_H */ |