1414
1515// Xcode's Archive builds with Xcode's Package support struggle with empty .c files
1616// (https://bugs.swift.org/browse/SR-12939).
17- void CNIOBSD_i_do_nothing_just_working_around_a_darwin_toolchain_bug (void ) {}
17+ void CNIOOpenBSD_i_do_nothing_just_working_around_a_darwin_toolchain_bug (void ) {}
1818
1919#if defined(__OpenBSD__ )
2020
21- #include <CNIOBSD .h>
21+ #include <CNIOOpenBSD .h>
2222#include <pthread.h>
2323#include <assert.h>
2424#include <unistd.h>
2525
26- int CNIOBSD_pthread_set_name_np (pthread_t thread , const char * name ) {
26+ int CNIOOpenBSD_pthread_set_name_np (pthread_t thread , const char * name ) {
2727 pthread_set_name_np (thread , name );
2828 return 0 ;
2929}
3030
31- int CNIOBSD_pthread_get_name_np (pthread_t thread , char * name , size_t len ) {
31+ int CNIOOpenBSD_pthread_get_name_np (pthread_t thread , char * name , size_t len ) {
3232 pthread_get_name_np (thread , name , len );
3333 return 0 ;
3434}
3535
36- int CNIOBSD_sendmmsg (int sockfd , CNIOBSD_mmsghdr * msgvec , unsigned int vlen , int flags ) {
36+ int CNIOOpenBSD_sendmmsg (int sockfd , CNIOOpenBSD_mmsghdr * msgvec , unsigned int vlen , int flags ) {
3737 // This is technically undefined behaviour, but it's basically fine because these types are the same size, and we
3838 // don't think the compiler is inclined to blow anything up here.
3939 // This comment is from CNIOLinux, but I haven't reverified this applies for OpenBSD.
4040 return sendmmsg (sockfd , (struct mmsghdr * )msgvec , vlen , flags );
4141}
4242
43- int CNIOBSD_recvmmsg (int sockfd , CNIOBSD_mmsghdr * msgvec , unsigned int vlen , int flags , struct timespec * timeout ) {
43+ int CNIOOpenBSD_recvmmsg (int sockfd , CNIOOpenBSD_mmsghdr * msgvec , unsigned int vlen , int flags , struct timespec * timeout ) {
4444 // This is technically undefined behaviour, but it's basically fine because these types are the same size, and we
4545 // don't think the compiler is inclined to blow anything up here.
4646 // This comment is from CNIOLinux, but I haven't reverified this applies for OpenBSD.
4747 return recvmmsg (sockfd , (struct mmsghdr * )msgvec , vlen , flags , timeout );
4848}
4949
50- int CNIOBSD_accept4 (int sockfd , struct sockaddr * addr , socklen_t * addrlen , int flags ) {
50+ int CNIOOpenBSD_accept4 (int sockfd , struct sockaddr * addr , socklen_t * addrlen , int flags ) {
5151 return accept4 (sockfd , addr , addrlen , flags );
5252}
5353
54- struct cmsghdr * CNIOBSD_CMSG_FIRSTHDR (const struct msghdr * mhdr ) {
54+ struct cmsghdr * CNIOOpenBSD_CMSG_FIRSTHDR (const struct msghdr * mhdr ) {
5555 assert (mhdr != NULL );
5656 return CMSG_FIRSTHDR (mhdr );
5757}
5858
59- struct cmsghdr * CNIOBSD_CMSG_NXTHDR (struct msghdr * mhdr , struct cmsghdr * cmsg ) {
59+ struct cmsghdr * CNIOOpenBSD_CMSG_NXTHDR (struct msghdr * mhdr , struct cmsghdr * cmsg ) {
6060 assert (mhdr != NULL );
6161 assert (cmsg != NULL );
6262 return CMSG_NXTHDR (mhdr , cmsg );
6363}
6464
65- const void * CNIOBSD_CMSG_DATA (const struct cmsghdr * cmsg ) {
65+ const void * CNIOOpenBSD_CMSG_DATA (const struct cmsghdr * cmsg ) {
6666 assert (cmsg != NULL );
6767 return CMSG_DATA (cmsg );
6868}
6969
70- void * CNIOBSD_CMSG_DATA_MUTABLE (struct cmsghdr * cmsg ) {
70+ void * CNIOOpenBSD_CMSG_DATA_MUTABLE (struct cmsghdr * cmsg ) {
7171 assert (cmsg != NULL );
7272 return CMSG_DATA (cmsg );
7373}
7474
75- size_t CNIOBSD_CMSG_LEN (size_t payloadSizeBytes ) {
75+ size_t CNIOOpenBSD_CMSG_LEN (size_t payloadSizeBytes ) {
7676 return CMSG_LEN (payloadSizeBytes );
7777}
7878
79- size_t CNIOBSD_CMSG_SPACE (size_t payloadSizeBytes ) {
79+ size_t CNIOOpenBSD_CMSG_SPACE (size_t payloadSizeBytes ) {
8080 return CMSG_SPACE (payloadSizeBytes );
8181}
8282
83- const int CNIOBSD_SO_TIMESTAMP = SO_TIMESTAMP ;
84- const int CNIOBSD_SO_RCVTIMEO = SO_RCVTIMEO ;
83+ const int CNIOOpenBSD_SO_TIMESTAMP = SO_TIMESTAMP ;
84+ const int CNIOOpenBSD_SO_RCVTIMEO = SO_RCVTIMEO ;
8585
8686bool supports_udp_sockopt (int opt , int value ) {
8787 int fd = socket (AF_INET , SOCK_DGRAM , 0 );
@@ -93,39 +93,39 @@ bool supports_udp_sockopt(int opt, int value) {
9393 return rc == 0 ;
9494}
9595
96- bool CNIOBSD_supports_udp_segment () {
96+ bool CNIOOpenBSD_supports_udp_segment () {
9797 #ifndef UDP_SEGMENT
9898 return false;
9999 #else
100100 return supports_udp_sockopt (UDP_SEGMENT , 512 );
101101 #endif
102102}
103103
104- bool CNIOBSD_supports_udp_gro () {
104+ bool CNIOOpenBSD_supports_udp_gro () {
105105 #ifndef UDP_GRO
106106 return false;
107107 #else
108108 return supports_udp_sockopt (UDP_GRO , 1 );
109109 #endif
110110}
111111
112- int CNIOBSD_system_info (struct utsname * uname_data ) {
112+ int CNIOOpenBSD_system_info (struct utsname * uname_data ) {
113113 return uname (uname_data );
114114}
115115
116- const char * CNIOBSD_dirent_dname (struct dirent * ent ) {
116+ const char * CNIOOpenBSD_dirent_dname (struct dirent * ent ) {
117117 return ent -> d_name ;
118118}
119119
120- const unsigned long CNIOBSD_UTIME_OMIT = UTIME_OMIT ;
121- const unsigned long CNIOBSD_UTIME_NOW = UTIME_NOW ;
120+ const unsigned long CNIOOpenBSD_UTIME_OMIT = UTIME_OMIT ;
121+ const unsigned long CNIOOpenBSD_UTIME_NOW = UTIME_NOW ;
122122
123123#ifdef UDP_MAX_SEGMENTS
124- const long CNIOBSD_UDP_MAX_SEGMENTS = UDP_MAX_SEGMENTS ;
124+ const long CNIOOpenBSD_UDP_MAX_SEGMENTS = UDP_MAX_SEGMENTS ;
125125#endif
126- const long CNIOBSD_UDP_MAX_SEGMENTS = -1 ;
126+ const long CNIOOpenBSD_UDP_MAX_SEGMENTS = -1 ;
127127
128- FTS * CNIOBSD_fts_open (char * const * path_argv , int options , int (* compar )(const FTSENT * * , const FTSENT * * )) {
128+ FTS * CNIOOpenBSD_fts_open (char * const * path_argv , int options , int (* compar )(const FTSENT * * , const FTSENT * * )) {
129129 return fts_open (path_argv , options , compar );
130130}
131131#endif
0 commit comments