]> git.proxmox.com Git - ceph.git/blob - ceph/src/jaegertracing/thrift/lib/c_glib/src/thrift/c_glib/transport/thrift_platform_socket.h
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / jaegertracing / thrift / lib / c_glib / src / thrift / c_glib / transport / thrift_platform_socket.h
1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
20 /* clang-format off */
21
22 #ifndef _THRIFT_TRANSPORT_PLATFORM_SOCKET_H_
23 # define _THRIFT_TRANSPORT_PLATFORM_SOCKET_H_
24
25 #ifdef _WIN32
26 # define THRIFT_GET_SOCKET_ERROR ::WSAGetLastError()
27 # define THRIFT_ERRNO (*_errno())
28 # define THRIFT_EINPROGRESS WSAEINPROGRESS
29 # define THRIFT_EAGAIN WSAEWOULDBLOCK
30 # define THRIFT_EINTR WSAEINTR
31 # define THRIFT_ECONNRESET WSAECONNRESET
32 # define THRIFT_ENOTCONN WSAENOTCONN
33 # define THRIFT_ETIMEDOUT WSAETIMEDOUT
34 # define THRIFT_EWOULDBLOCK WSAEWOULDBLOCK
35 # define THRIFT_EPIPE WSAECONNRESET
36 # define THRIFT_NO_SOCKET_CACHING SO_EXCLUSIVEADDRUSE
37 # define THRIFT_INVALID_SOCKET INVALID_SOCKET
38 # define THRIFT_SOCKETPAIR thrift_socketpair
39 # define THRIFT_FCNTL thrift_fcntl
40 # define THRIFT_O_NONBLOCK 1
41 # define THRIFT_F_GETFL 0
42 # define THRIFT_F_SETFL 1
43 # define THRIFT_GETTIMEOFDAY thrift_gettimeofday
44 # define THRIFT_CLOSESOCKET closesocket
45 # define THRIFT_CLOSE _close
46 # define THRIFT_OPEN _open
47 # define THRIFT_FTRUNCATE _chsize_s
48 # define THRIFT_FSYNC _commit
49 # define THRIFT_LSEEK _lseek
50 # define THRIFT_WRITE _write
51 # define THRIFT_READ _read
52 # define THRIFT_FSTAT _fstat
53 # define THRIFT_STAT _stat
54 # ifdef _WIN32_WCE
55 # define THRIFT_GAI_STRERROR(...) thrift_wstr2str(gai_strerrorW(__VA_ARGS__))
56 # else
57 # define THRIFT_GAI_STRERROR gai_strerrorA
58 # endif
59 # define THRIFT_SSIZET ptrdiff_t
60 # define THRIFT_SNPRINTF _snprintf
61 # define THRIFT_SLEEP_SEC thrift_sleep
62 # define THRIFT_SLEEP_USEC thrift_usleep
63 # define THRIFT_TIMESPEC thrift_timespec
64 # define THRIFT_CTIME_R thrift_ctime_r
65 # define THRIFT_POLL thrift_poll
66 # if WINVER <= 0x0502 /* XP, Server2003 */
67 # define THRIFT_POLLFD thrift_pollfd
68 # define THRIFT_POLLIN 0x0300
69 # define THRIFT_POLLOUT 0x0010
70 # else /* Vista, Win7... */
71 # define THRIFT_POLLFD pollfd
72 # define THRIFT_POLLIN POLLIN
73 # define THRIFT_POLLOUT POLLOUT
74 # endif /* WINVER */
75 # define THRIFT_SHUT_RDWR SD_BOTH
76 #else /* not _WIN32 */
77 # include <errno.h>
78 # define THRIFT_GET_SOCKET_ERROR errno
79 # define THRIFT_ERRNO errno
80 # define THRIFT_EINTR EINTR
81 # define THRIFT_EINPROGRESS EINPROGRESS
82 # define THRIFT_ECONNRESET ECONNRESET
83 # define THRIFT_ENOTCONN ENOTCONN
84 # define THRIFT_ETIMEDOUT ETIMEDOUT
85 # define THRIFT_EWOULDBLOCK EWOULDBLOCK
86 # define THRIFT_EAGAIN EAGAIN
87 # define THRIFT_EPIPE EPIPE
88 # define THRIFT_NO_SOCKET_CACHING SO_REUSEADDR
89 # define THRIFT_INVALID_SOCKET (-1)
90 # define THRIFT_SOCKETPAIR socketpair
91 # define THRIFT_FCNTL fcntl
92 # define THRIFT_O_NONBLOCK O_NONBLOCK
93 # define THRIFT_F_GETFL F_GETFL
94 # define THRIFT_F_SETFL F_SETFL
95 # define THRIFT_GETTIMEOFDAY gettimeofday
96 # define THRIFT_CLOSESOCKET close
97 # define THRIFT_CLOSE close
98 # define THRIFT_OPEN open
99 # define THRIFT_FTRUNCATE ftruncate
100 # define THRIFT_FSYNC fsync
101 # define THRIFT_LSEEK lseek
102 # define THRIFT_WRITE write
103 # define THRIFT_READ read
104 # define THRIFT_STAT stat
105 # define THRIFT_FSTAT fstat
106 # define THRIFT_GAI_STRERROR gai_strerror
107 # define THRIFT_SSIZET ssize_t
108 # define THRIFT_SNPRINTF snprintf
109 # define THRIFT_SLEEP_SEC sleep
110 # define THRIFT_SLEEP_USEC usleep
111 # define THRIFT_TIMESPEC timespec
112 # define THRIFT_CTIME_R ctime_r
113 # define THRIFT_POLL poll
114 # define THRIFT_POLLFD pollfd
115 # define THRIFT_POLLIN POLLIN
116 # define THRIFT_POLLOUT POLLOUT
117 # define THRIFT_SHUT_RDWR SHUT_RDWR
118 #endif
119
120 #endif /* _THRIFT_TRANSPORT_PLATFORM_SOCKET_H_ */