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
6c1b50cf
Commit
6c1b50cf
authored
Oct 26, 2011
by
Mikko Koppanen
Committed by
Martin Sustrik
Oct 26, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added compile-time test for SOCK_CLOEXEC
Signed-off-by:
Mikko Koppanen
<
mkoppanen@php.net
>
parent
d31792e6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
2 deletions
+29
-2
acinclude.m4
acinclude.m4
+22
-0
configure.in
configure.in
+5
-0
ip.cpp
src/ip.cpp
+2
-2
No files found.
acinclude.m4
View file @
6c1b50cf
...
...
@@ -581,6 +581,28 @@ AC_DEFUN([LIBZMQ_CHECK_LANG_VISIBILITY], [{
[AC_MSG_RESULT(yes) ; $1], [AC_MSG_RESULT(no) ; $2])
}])
dnl ################################################################################
dnl # LIBZMQ_CHECK_SOCK_CLOEXEC([action-if-found], [action-if-not-found]) #
dnl # Check if SOCK_CLOEXEC is supported #
dnl ################################################################################
AC_DEFUN([LIBZMQ_CHECK_SOCK_CLOEXEC], [{
AC_MSG_CHECKING(whether SOCK_CLOEXEC is supported)
AC_TRY_RUN([/* SOCK_CLOEXEC test */
#include <sys/types.h>
#include <sys/socket.h>
int main (int argc, char *argv [])
{
int s = socket (PF_INET, SOCK_STREAM | SOCK_CLOEXEC, 0);
return (s == -1);
}
],
[AC_MSG_RESULT(yes) ; libzmq_cv_sock_cloexec="yes" ; $1],
[AC_MSG_RESULT(no) ; libzmq_cv_sock_cloexec="no" ; $2],
[AC_MSG_RESULT(not during cross-compile) ; libzmq_cv_sock_cloexec="no"]
)
}])
dnl ################################################################################
dnl # LIBZMQ_CHECK_POLLER_KQUEUE([action-if-found], [action-if-not-found]) #
dnl # Checks kqueue polling system #
...
...
configure.in
View file @
6c1b50cf
...
...
@@ -383,6 +383,11 @@ AM_CONDITIONAL(ON_MINGW, test "x$libzmq_on_mingw32" = "xyes")
AC_TYPE_SIGNAL
AC_CHECK_FUNCS(perror gettimeofday memset socket getifaddrs freeifaddrs)
AC_CHECK_HEADERS([alloca.h])
LIBZMQ_CHECK_SOCK_CLOEXEC([AC_DEFINE(
[ZMQ_HAVE_SOCK_CLOEXEC],
[1],
[Whether SOCK_CLOEXEC is defined and functioning.])
])
# Subst LIBZMQ_EXTRA_CFLAGS & CXXFLAGS & LDFLAGS
AC_SUBST(LIBZMQ_EXTRA_CFLAGS)
...
...
src/ip.cpp
View file @
6c1b50cf
...
...
@@ -40,7 +40,7 @@ zmq::fd_t zmq::open_socket (int domain_, int type_, int protocol_)
{
// Setting this option result in sane behaviour when exec() functions
// are used. Old sockets are closed and don't block TCP ports etc.
#if defined SOCK_CLOEXEC
#if defined
ZMQ_HAVE_
SOCK_CLOEXEC
type_
|=
SOCK_CLOEXEC
;
#endif
...
...
@@ -51,7 +51,7 @@ zmq::fd_t zmq::open_socket (int domain_, int type_, int protocol_)
// If there's no SOCK_CLOEXEC, let's try the second best option. Note that
// race condition can cause socket not to be closed (if fork happens
// between socket creation and this point).
#if !defined SOCK_CLOEXEC && defined FD_CLOEXEC
#if !defined
ZMQ_HAVE_
SOCK_CLOEXEC && defined FD_CLOEXEC
int
rc
=
fcntl
(
s
,
F_SETFD
,
FD_CLOEXEC
);
errno_assert
(
rc
!=
-
1
);
#endif
...
...
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