Skip to content

Commit 8b789d8

Browse files
committed
Merge #9921: build: Probe MSG_DONTWAIT in the same way as MSG_NOSIGNAL
a4d1c9f compat: use `unsigned int` instead of `u_int` (Wladimir J. van der Laan) 25da1ee build: cleanup: define MSG_DONTWAIT/MSG_NO_SIGNAL locally (Wladimir J. van der Laan) c459d50 build: Probe MSG_DONTWAIT in the same way as MSG_NOSIGNAL (Wladimir J. van der Laan) Tree-SHA512: 60d79d69439bb181465e4244aa5ddc28bbd84f69c0ca0c753956b3798c9022394e29d791bc085fe7ffb1268c64c789a57e24797daad63525bb776088188ff9ae
2 parents 598ef9c + a4d1c9f commit 8b789d8

File tree

4 files changed

+18
-11
lines changed

4 files changed

+18
-11
lines changed

configure.ac

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,15 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/socket.h>]],
558558
[ AC_MSG_RESULT(no)]
559559
)
560560

561+
dnl Check for MSG_DONTWAIT
562+
AC_MSG_CHECKING(for MSG_DONTWAIT)
563+
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/socket.h>]],
564+
[[ int f = MSG_DONTWAIT; ]])],
565+
[ AC_MSG_RESULT(yes); AC_DEFINE(HAVE_DONTWAIT, 1,[Define this symbol if you have MSG_DONTWAIT]) ],
566+
[ AC_MSG_RESULT(no)]
567+
)
568+
569+
561570
AC_MSG_CHECKING([for visibility attribute])
562571
AC_LINK_IFELSE([AC_LANG_SOURCE([
563572
int foo_def( void ) __attribute__((visibility("default")));

src/compat.h

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,8 @@
4747
#include <unistd.h>
4848
#endif
4949

50-
#ifdef WIN32
51-
#define MSG_DONTWAIT 0
52-
#else
53-
typedef u_int SOCKET;
50+
#ifndef WIN32
51+
typedef unsigned int SOCKET;
5452
#include "errno.h"
5553
#define WSAGetLastError() errno
5654
#define WSAEINVAL EINVAL
@@ -74,11 +72,6 @@ typedef u_int SOCKET;
7472
#define MAX_PATH 1024
7573
#endif
7674

77-
// As Solaris does not have the MSG_NOSIGNAL flag for send(2) syscall, it is defined as 0
78-
#if !defined(HAVE_MSG_NOSIGNAL) && !defined(MSG_NOSIGNAL)
79-
#define MSG_NOSIGNAL 0
80-
#endif
81-
8275
#if HAVE_DECL_STRNLEN == 0
8376
size_t strnlen( const char *start, size_t max_len);
8477
#endif // HAVE_DECL_STRNLEN

src/net.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,15 @@
4444
// We add a random period time (0 to 1 seconds) to feeler connections to prevent synchronization.
4545
#define FEELER_SLEEP_WINDOW 1
4646

47-
#if !defined(HAVE_MSG_NOSIGNAL) && !defined(MSG_NOSIGNAL)
47+
#if !defined(HAVE_MSG_NOSIGNAL)
4848
#define MSG_NOSIGNAL 0
4949
#endif
5050

51+
// MSG_DONTWAIT is not available on some platforms, if it doesn't exist define it as 0
52+
#if !defined(HAVE_MSG_DONTWAIT)
53+
#define MSG_DONTWAIT 0
54+
#endif
55+
5156
// Fix for ancient MinGW versions, that don't have defined these in ws2tcpip.h.
5257
// Todo: Can be removed when our pull-tester is upgraded to a modern MinGW version.
5358
#ifdef WIN32

src/netbase.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#include <boost/algorithm/string/case_conv.hpp> // for to_lower()
2626
#include <boost/algorithm/string/predicate.hpp> // for startswith() and endswith()
2727

28-
#if !defined(HAVE_MSG_NOSIGNAL) && !defined(MSG_NOSIGNAL)
28+
#if !defined(HAVE_MSG_NOSIGNAL)
2929
#define MSG_NOSIGNAL 0
3030
#endif
3131

0 commit comments

Comments
 (0)