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
1443c0e7
Unverified
Commit
1443c0e7
authored
Apr 28, 2020
by
Luca Boccassi
Committed by
GitHub
Apr 28, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3887 from gummif/gfa/unify-fd
Problem: Multiple fd_t definitions
parents
5867d7cf
d426f2ab
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
20 deletions
+22
-20
fd.hpp
src/fd.hpp
+2
-6
test_poller.cpp
tests/test_poller.cpp
+3
-3
test_system.cpp
tests/test_system.cpp
+1
-1
testutil.hpp
tests/testutil.hpp
+16
-10
No files found.
src/fd.hpp
View file @
1443c0e7
...
@@ -36,18 +36,15 @@
...
@@ -36,18 +36,15 @@
namespace
zmq
namespace
zmq
{
{
typedef
zmq_fd_t
fd_t
;
#ifdef ZMQ_HAVE_WINDOWS
#ifdef ZMQ_HAVE_WINDOWS
#if defined _MSC_VER && _MSC_VER <= 1400
#if defined _MSC_VER && _MSC_VER <= 1400
///< \todo zmq.h uses SOCKET unconditionally, so probably VS versions before
/// VS2008 are unsupported anyway. Apart from that, this seems to depend on
/// the Windows SDK version rather than the VS version.
typedef
UINT_PTR
fd_t
;
enum
enum
{
{
retired_fd
=
(
fd_t
)
(
~
0
)
retired_fd
=
(
fd_t
)
(
~
0
)
};
};
#else
#else
typedef
SOCKET
fd_t
;
enum
enum
#if _MSC_VER >= 1800
#if _MSC_VER >= 1800
:
fd_t
:
fd_t
...
@@ -57,7 +54,6 @@ enum
...
@@ -57,7 +54,6 @@ enum
};
};
#endif
#endif
#else
#else
typedef
int
fd_t
;
enum
enum
{
{
retired_fd
=
-
1
retired_fd
=
-
1
...
...
tests/test_poller.cpp
View file @
1443c0e7
...
@@ -209,7 +209,7 @@ void test_null_poller_pointers_wait_all_indirect ()
...
@@ -209,7 +209,7 @@ void test_null_poller_pointers_wait_all_indirect ()
void
test_null_poller_pointer_poller_fd
()
void
test_null_poller_pointer_poller_fd
()
{
{
void
*
null_poller
=
NULL
;
void
*
null_poller
=
NULL
;
zmq_
fd_t
fd
;
fd_t
fd
;
TEST_ASSERT_FAILURE_ERRNO
(
EFAULT
,
zmq_poller_fd
(
&
null_poller
,
&
fd
));
TEST_ASSERT_FAILURE_ERRNO
(
EFAULT
,
zmq_poller_fd
(
&
null_poller
,
&
fd
));
}
}
...
@@ -285,7 +285,7 @@ void test_call_poller_fd_no_signaler ()
...
@@ -285,7 +285,7 @@ void test_call_poller_fd_no_signaler ()
TEST_ASSERT_SUCCESS_ERRNO
(
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_poller_add
(
poller
,
socket
,
NULL
,
ZMQ_POLLIN
));
zmq_poller_add
(
poller
,
socket
,
NULL
,
ZMQ_POLLIN
));
zmq_
fd_t
fd
;
fd_t
fd
;
TEST_ASSERT_FAILURE_ERRNO
(
EINVAL
,
zmq_poller_fd
(
poller
,
&
fd
));
TEST_ASSERT_FAILURE_ERRNO
(
EINVAL
,
zmq_poller_fd
(
poller
,
&
fd
));
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_poller_destroy
(
&
poller
));
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_poller_destroy
(
&
poller
));
...
@@ -303,7 +303,7 @@ void test_call_poller_fd ()
...
@@ -303,7 +303,7 @@ void test_call_poller_fd ()
TEST_ASSERT_SUCCESS_ERRNO
(
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_poller_add
(
poller
,
socket
,
NULL
,
ZMQ_POLLIN
));
zmq_poller_add
(
poller
,
socket
,
NULL
,
ZMQ_POLLIN
));
zmq_
fd_t
fd
;
fd_t
fd
;
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_poller_fd
(
poller
,
&
fd
));
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_poller_fd
(
poller
,
&
fd
));
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_poller_destroy
(
&
poller
));
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_poller_destroy
(
&
poller
));
...
...
tests/test_system.cpp
View file @
1443c0e7
...
@@ -85,7 +85,7 @@ void test_max_sockets ()
...
@@ -85,7 +85,7 @@ void test_max_sockets ()
int
count
;
int
count
;
for
(
count
=
0
;
count
<
MAX_SOCKETS
;
count
++
)
{
for
(
count
=
0
;
count
<
MAX_SOCKETS
;
count
++
)
{
handle
[
count
]
=
socket
(
AF_INET
,
SOCK_STREAM
,
IPPROTO_TCP
);
handle
[
count
]
=
socket
(
AF_INET
,
SOCK_STREAM
,
IPPROTO_TCP
);
if
(
handle
[
count
]
==
-
1
)
{
if
(
handle
[
count
]
==
retired_fd
)
{
printf
(
"W: Only able to create %d sockets on this box
\n
"
,
count
);
printf
(
"W: Only able to create %d sockets on this box
\n
"
,
count
);
const
char
msg
[]
=
const
char
msg
[]
=
"I: Tune your system to increase maximum allowed file handles
\n
"
"I: Tune your system to increase maximum allowed file handles
\n
"
...
...
tests/testutil.hpp
View file @
1443c0e7
...
@@ -107,26 +107,32 @@ inline const char *as_setsockopt_opt_t (const void *opt)
...
@@ -107,26 +107,32 @@ inline const char *as_setsockopt_opt_t (const void *opt)
{
{
return
static_cast
<
const
char
*>
(
opt
);
return
static_cast
<
const
char
*>
(
opt
);
}
}
#else
typedef
size_t
socket_size_t
;
inline
const
void
*
as_setsockopt_opt_t
(
const
void
*
opt_
)
{
return
opt_
;
}
#endif
// duplicated from fd.hpp
typedef
zmq_fd_t
fd_t
;
#ifdef ZMQ_HAVE_WINDOWS
#if defined _MSC_VER && _MSC_VER <= 1400
#if defined _MSC_VER && _MSC_VER <= 1400
typedef
UINT_PTR
fd_t
;
enum
enum
{
{
retired_fd
=
(
fd_t
)
(
~
0
)
retired_fd
=
(
zmq_
fd_t
)
(
~
0
)
};
};
#else
#else
typedef
SOCKET
fd_t
;
enum
enum
#if _MSC_VER >= 1800
:
zmq_fd_t
#endif
{
{
retired_fd
=
(
fd_t
)
INVALID_SOCKET
retired_fd
=
INVALID_SOCKET
};
};
#endif
#endif
#else
#else
typedef
size_t
socket_size_t
;
inline
const
void
*
as_setsockopt_opt_t
(
const
void
*
opt_
)
{
return
opt_
;
}
typedef
int
fd_t
;
enum
enum
{
{
retired_fd
=
-
1
retired_fd
=
-
1
...
...
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