Commit 510a42c3 authored by Luca Boccassi's avatar Luca Boccassi

Problem: test_system fails on Solaris due to lower file limit

Solution: use a different max socket value on Solaris, where the
default limit is 256 instead of 1024
parent b78cfb23
......@@ -38,6 +38,13 @@
#include <unistd.h>
#endif
// Solaris has a default of 256 max files per process
#ifdef ZMQ_HAVE_SOLARIS
#define MAX_SOCKETS 200
#else
#define MAX_SOCKETS 1000
#endif
#if defined(ZMQ_HAVE_WINDOWS)
void initialise_network (void)
......@@ -75,9 +82,9 @@ int main (void)
return -1;
}
// Check that we can create 1,000 sockets
int handle[1000];
int handle[MAX_SOCKETS];
int count;
for (count = 0; count < 1000; count++) {
for (count = 0; count < MAX_SOCKETS; count++) {
handle[count] = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (handle[count] == -1) {
printf ("W: Only able to create %d sockets on this box\n", count);
......@@ -92,7 +99,7 @@ int main (void)
}
}
// Release the socket handles
for (count = 0; count < 1000; count++) {
for (count = 0; count < MAX_SOCKETS; count++) {
close (handle[count]);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment