mirror of
https://github.com/zeromq/libzmq.git
synced 2024-12-12 18:40:27 +01:00
Don't use RLIMIT_NOFILES in devpoll_t.
The patch allows for running 0MQ on Solaris and HP-UX even though ulimit for max number of file descriptors is set to unlimited. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
This commit is contained in:
parent
ca1acc340c
commit
3f758ab2f4
@ -23,7 +23,6 @@
|
|||||||
|
|
||||||
#include <sys/devpoll.h>
|
#include <sys/devpoll.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/resource.h>
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
@ -40,15 +39,6 @@
|
|||||||
zmq::devpoll_t::devpoll_t () :
|
zmq::devpoll_t::devpoll_t () :
|
||||||
stopping (false)
|
stopping (false)
|
||||||
{
|
{
|
||||||
// Get limit on open files
|
|
||||||
struct rlimit rl;
|
|
||||||
int rc = getrlimit (RLIMIT_NOFILE, &rl);
|
|
||||||
errno_assert (rc != -1);
|
|
||||||
fd_table.resize (rl.rlim_cur);
|
|
||||||
|
|
||||||
for (rlim_t i = 0; i < rl.rlim_cur; i ++)
|
|
||||||
fd_table [i].valid = false;
|
|
||||||
|
|
||||||
devpoll_fd = open ("/dev/poll", O_RDWR);
|
devpoll_fd = open ("/dev/poll", O_RDWR);
|
||||||
errno_assert (devpoll_fd != -1);
|
errno_assert (devpoll_fd != -1);
|
||||||
}
|
}
|
||||||
@ -69,6 +59,16 @@ void zmq::devpoll_t::devpoll_ctl (fd_t fd_, short events_)
|
|||||||
zmq::devpoll_t::handle_t zmq::devpoll_t::add_fd (fd_t fd_,
|
zmq::devpoll_t::handle_t zmq::devpoll_t::add_fd (fd_t fd_,
|
||||||
i_poll_events *reactor_)
|
i_poll_events *reactor_)
|
||||||
{
|
{
|
||||||
|
// If the file descriptor table is too small expand it.
|
||||||
|
fd_table_t::size_type sz = fd_table.size ();
|
||||||
|
if (sz <= (fd_table_t::size_type) fd_) {
|
||||||
|
fd_table.resize (fd_ + 1);
|
||||||
|
while (sz != (fd_table_t::size_type) (fd_ + 1)) {
|
||||||
|
fd_table [sz].valid = false;
|
||||||
|
++sz;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
assert (!fd_table [fd_].valid);
|
assert (!fd_table [fd_].valid);
|
||||||
|
|
||||||
fd_table [fd_].events = 0;
|
fd_table [fd_].events = 0;
|
||||||
|
@ -73,7 +73,8 @@ namespace zmq
|
|||||||
bool accepted;
|
bool accepted;
|
||||||
};
|
};
|
||||||
|
|
||||||
std::vector <fd_entry_t> fd_table;
|
typedef std::vector <fd_entry_t> fd_table_t;
|
||||||
|
fd_table_t fd_table;
|
||||||
|
|
||||||
typedef std::vector <fd_t> pending_list_t;
|
typedef std::vector <fd_t> pending_list_t;
|
||||||
pending_list_t pending_list;
|
pending_list_t pending_list;
|
||||||
|
Loading…
Reference in New Issue
Block a user