22 #include "opal_config.h"
27 #ifdef HAVE_SYS_TYPES_H
28 #include <sys/types.h>
30 #ifdef HAVE_SYS_SOCKET_H
31 #include <sys/socket.h>
33 #ifdef HAVE_SYS_SELECT_H
34 #include <sys/select.h>
36 #ifdef HAVE_NETINET_IN_H
37 #include <netinet/in.h>
39 #ifdef HAVE_ARPA_INET_H
40 #include <arpa/inet.h>
66 #if defined(__APPLE__) || defined(__WINDOWS__)
67 typedef char* ompi_iov_base_ptr_t;
69 typedef void* ompi_iov_base_ptr_t;
76 #if defined(HAVE_SOCKLEN_T)
77 typedef socklen_t opal_socklen_t;
79 typedef int opal_socklen_t;
86 static inline uint64_t hton64(uint64_t val) __opal_attribute_const__;
87 static inline uint64_t hton64(uint64_t val)
89 #ifdef HAVE_UNIX_BYTESWAP
98 r.l[0] = htonl(w.l[1]);
99 r.l[1] = htonl(w.l[0]);
110 static inline uint64_t ntoh64(uint64_t val) __opal_attribute_const__;
111 static inline uint64_t ntoh64(uint64_t val)
113 #ifdef HAVE_UNIX_BYTESWAP
122 r.l[0] = ntohl(w.l[1]);
123 r.l[1] = ntohl(w.l[0]);
134 static inline uint64_t ompi_ptr_ptol(
void* ptr ) __opal_attribute_const__;
135 static inline uint64_t ompi_ptr_ptol(
void* ptr )
137 return (uint64_t)(uintptr_t) ptr;
140 static inline void* ompi_ptr_ltop( uint64_t value ) __opal_attribute_const__;
141 static inline void* ompi_ptr_ltop( uint64_t value )
143 #if SIZEOF_VOID_P == 4 && OPAL_ENABLE_DEBUG
144 if (value > ((1ULL << 32) - 1ULL)) {
145 opal_output(0,
"Warning: truncating value in ompi_ptr_ltop");
148 return (
void*)(uintptr_t) value;
151 #if defined(WORDS_BIGENDIAN) || !defined(HAVE_UNIX_BYTESWAP)
152 static inline uint16_t opal_swap_bytes2(uint16_t val) __opal_attribute_const__;
153 static inline uint16_t opal_swap_bytes2(uint16_t val)
155 union { uint16_t bigval;
160 r.arrayval[0] = w.arrayval[1];
161 r.arrayval[1] = w.arrayval[0];
166 static inline uint32_t opal_swap_bytes4(uint32_t val) __opal_attribute_const__;
167 static inline uint32_t opal_swap_bytes4(uint32_t val)
169 union { uint32_t bigval;
174 r.arrayval[0] = w.arrayval[3];
175 r.arrayval[1] = w.arrayval[2];
176 r.arrayval[2] = w.arrayval[1];
177 r.arrayval[3] = w.arrayval[0];
182 static inline uint64_t opal_swap_bytes8(uint64_t val) __opal_attribute_const__;
183 static inline uint64_t opal_swap_bytes8(uint64_t val)
185 union { uint64_t bigval;
190 r.arrayval[0] = w.arrayval[7];
191 r.arrayval[1] = w.arrayval[6];
192 r.arrayval[2] = w.arrayval[5];
193 r.arrayval[3] = w.arrayval[4];
194 r.arrayval[4] = w.arrayval[3];
195 r.arrayval[5] = w.arrayval[2];
196 r.arrayval[6] = w.arrayval[1];
197 r.arrayval[7] = w.arrayval[0];
203 #define opal_swap_bytes2 htons
204 #define opal_swap_bytes4 htonl
205 #define opal_swap_bytes8 hton64
OPAL output stream facility.
OPAL_DECLSPEC void opal_output(int output_id, const char *format,...) __opal_attribute_format__(__printf__
Main function to send output to a stream.