Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
L
libzmq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
libzmq
Commits
b3bf5171
Unverified
Commit
b3bf5171
authored
Nov 18, 2017
by
Constantin Rack
Committed by
GitHub
Nov 18, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2842 from bluca/accept4
Problem: accept4 not available on all platforms
parents
0d0d72e8
ac552ba4
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
14 additions
and
5 deletions
+14
-5
CMakeLists.txt
CMakeLists.txt
+4
-0
NEWS
NEWS
+3
-0
platform.hpp.in
builds/cmake/platform.hpp.in
+1
-0
platform.hpp
builds/gyp/platform.hpp
+1
-0
configure.ac
configure.ac
+1
-1
ipc_listener.cpp
src/ipc_listener.cpp
+2
-2
tcp_listener.cpp
src/tcp_listener.cpp
+2
-2
No files found.
CMakeLists.txt
View file @
b3bf5171
...
...
@@ -236,6 +236,10 @@ set (CMAKE_REQUIRED_INCLUDES stdlib.h)
check_function_exists
(
mkdtemp HAVE_MKDTEMP
)
set
(
CMAKE_REQUIRED_INCLUDES
)
set
(
CMAKE_REQUIRED_INCLUDES sys/socket.h
)
check_function_exists
(
accept4 HAVE_ACCEPT4
)
set
(
CMAKE_REQUIRED_INCLUDES
)
add_definitions
(
-D_REENTRANT -D_THREAD_SAFE
)
add_definitions
(
-DZMQ_CUSTOM_PLATFORM_HPP
)
...
...
NEWS
View file @
b3bf5171
...
...
@@ -212,6 +212,9 @@
* Fixed #2809 - optimize select() usage on Windows
* Fixed #2816 - add CMake and autoconf check for accept4, as it is not
available on old Linux releases, and fallback to accept + FD_CLOEXEC
* Fixed #2824 - ZMQ_REQ socket does not report ZMQ_POLLOUT when ZMQ_REQ_RELAXED
is set
...
...
builds/cmake/platform.hpp.in
View file @
b3bf5171
...
...
@@ -36,6 +36,7 @@
#cmakedefine ZMQ_HAVE_PTHREAD_SETNAME_2
#cmakedefine ZMQ_HAVE_PTHREAD_SETNAME_3
#cmakedefine ZMQ_HAVE_PTHREAD_SET_NAME
#cmakedefine HAVE_ACCEPT4
#cmakedefine ZMQ_HAVE_OPENPGM
#cmakedefine ZMQ_MAKE_VALGRIND_HAPPY
...
...
builds/gyp/platform.hpp
View file @
b3bf5171
...
...
@@ -71,6 +71,7 @@
# define ZMQ_HAVE_UIO 1
# define HAVE_CLOCK_GETTIME 1
# define HAVE_FORK 1
# define HAVE_ACCEPT4 1
#else
# error "No platform defined, abandoning"
...
...
configure.ac
View file @
b3bf5171
...
...
@@ -621,7 +621,7 @@ AC_LANG_POP([C++])
# Checks for library functions.
AC_TYPE_SIGNAL
AC_CHECK_FUNCS(perror gettimeofday clock_gettime memset socket getifaddrs freeifaddrs fork posix_memalign mkdtemp)
AC_CHECK_FUNCS(perror gettimeofday clock_gettime memset socket getifaddrs freeifaddrs fork posix_memalign mkdtemp
accept4
)
AC_CHECK_HEADERS([alloca.h])
# pthread_setname is non-posix, and there are at least 4 different implementations
...
...
src/ipc_listener.cpp
View file @
b3bf5171
...
...
@@ -382,7 +382,7 @@ zmq::fd_t zmq::ipc_listener_t::accept ()
// The situation where connection cannot be accepted due to insufficient
// resources is considered valid and treated by ignoring the connection.
zmq_assert
(
s
!=
retired_fd
);
#if defined ZMQ_HAVE_SOCK_CLOEXEC
#if defined ZMQ_HAVE_SOCK_CLOEXEC
&& defined HAVE_ACCEPT4
fd_t
sock
=
::
accept4
(
s
,
NULL
,
NULL
,
SOCK_CLOEXEC
);
#else
fd_t
sock
=
::
accept
(
s
,
NULL
,
NULL
);
...
...
@@ -394,7 +394,7 @@ zmq::fd_t zmq::ipc_listener_t::accept ()
return
retired_fd
;
}
#if
!defined ZMQ_HAVE_SOCK_CLOEXEC
&& defined FD_CLOEXEC
#if
(!defined ZMQ_HAVE_SOCK_CLOEXEC || !defined HAVE_ACCEPT4)
&& defined FD_CLOEXEC
// Race condition can cause socket not to be closed (if fork happens
// between accept and this point).
int
rc
=
fcntl
(
sock
,
F_SETFD
,
FD_CLOEXEC
);
...
...
src/tcp_listener.cpp
View file @
b3bf5171
...
...
@@ -281,7 +281,7 @@ zmq::fd_t zmq::tcp_listener_t::accept ()
#else
socklen_t
ss_len
=
sizeof
(
ss
);
#endif
#if defined ZMQ_HAVE_SOCK_CLOEXEC
#if defined ZMQ_HAVE_SOCK_CLOEXEC
&& defined HAVE_ACCEPT4
fd_t
sock
=
::
accept4
(
s
,
(
struct
sockaddr
*
)
&
ss
,
&
ss_len
,
SOCK_CLOEXEC
);
#else
fd_t
sock
=
::
accept
(
s
,
(
struct
sockaddr
*
)
&
ss
,
&
ss_len
);
...
...
@@ -311,7 +311,7 @@ zmq::fd_t zmq::tcp_listener_t::accept ()
}
#endif
#if
!defined ZMQ_HAVE_SOCK_CLOEXEC
&& defined FD_CLOEXEC
#if
(!defined ZMQ_HAVE_SOCK_CLOEXEC || !defined HAVE_ACCEPT4)
&& defined FD_CLOEXEC
// Race condition can cause socket not to be closed (if fork happens
// between accept and this point).
int
rc
=
fcntl
(
sock
,
F_SETFD
,
FD_CLOEXEC
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment