static int eventer_ports_impl_init(void) { int rv; maxfds = eventer_impl_setrlimit(); master_fds = calloc(maxfds, sizeof(*master_fds)); /* super init */ if((rv = eventer_impl_init()) != 0) return rv; signal(SIGPIPE, SIG_IGN); return 0; }
static int eventer_ports_impl_init() { struct rlimit rlim; int rv; /* super init */ if((rv = eventer_impl_init()) != 0) return rv; signal(SIGPIPE, SIG_IGN); port_fd = port_create(); if(port_fd == -1) { return -1; } getrlimit(RLIMIT_NOFILE, &rlim); maxfds = rlim.rlim_cur; master_fds = calloc(maxfds, sizeof(*master_fds)); return 0; }
static int eventer_kqueue_impl_init() { struct rlimit rlim; int rv; /* super init */ if((rv = eventer_impl_init()) != 0) return rv; signal(SIGPIPE, SIG_IGN); kqueue_fd = kqueue(); if(kqueue_fd == -1) { return -1; } pthread_mutex_init(&kqs_lock, NULL); pthread_key_create(&kqueue_setup_key, NULL); master_kqs = calloc(1, sizeof(*master_kqs)); kqs_init(master_kqs); getrlimit(RLIMIT_NOFILE, &rlim); maxfds = rlim.rlim_cur; master_fds = calloc(maxfds, sizeof(*master_fds)); masks = calloc(maxfds, sizeof(*masks)); return 0; }