version 1.1.1.1, 2013/10/14 10:32:48
|
version 1.1.1.2, 2016/11/02 10:35:00
|
Line 1
|
Line 1
|
|
#include "first.h" |
|
|
#include "fdevent.h" |
#include "fdevent.h" |
#include "buffer.h" |
#include "buffer.h" |
#include "log.h" |
#include "log.h" |
Line 44 static int fdevent_poll_event_del(fdevents *ev, int fd
|
Line 46 static int fdevent_poll_event_del(fdevents *ev, int fd
|
if (ev->unused.size == 0) { |
if (ev->unused.size == 0) { |
ev->unused.size = 16; |
ev->unused.size = 16; |
ev->unused.ptr = malloc(sizeof(*(ev->unused.ptr)) * ev->unused.size); |
ev->unused.ptr = malloc(sizeof(*(ev->unused.ptr)) * ev->unused.size); |
|
force_assert(NULL != ev->unused.ptr); |
} else if (ev->unused.size == ev->unused.used) { |
} else if (ev->unused.size == ev->unused.used) { |
ev->unused.size += 16; |
ev->unused.size += 16; |
ev->unused.ptr = realloc(ev->unused.ptr, sizeof(*(ev->unused.ptr)) * ev->unused.size); |
ev->unused.ptr = realloc(ev->unused.ptr, sizeof(*(ev->unused.ptr)) * ev->unused.size); |
|
force_assert(NULL != ev->unused.ptr); |
} |
} |
|
|
ev->unused.ptr[ev->unused.used++] = k; |
ev->unused.ptr[ev->unused.used++] = k; |
Line 102 static int fdevent_poll_event_set(fdevents *ev, int fd
|
Line 106 static int fdevent_poll_event_set(fdevents *ev, int fd
|
if (ev->size == 0) { |
if (ev->size == 0) { |
ev->size = 16; |
ev->size = 16; |
ev->pollfds = malloc(sizeof(*ev->pollfds) * ev->size); |
ev->pollfds = malloc(sizeof(*ev->pollfds) * ev->size); |
|
force_assert(NULL != ev->pollfds); |
} else if (ev->size == ev->used) { |
} else if (ev->size == ev->used) { |
ev->size += 16; |
ev->size += 16; |
ev->pollfds = realloc(ev->pollfds, sizeof(*ev->pollfds) * ev->size); |
ev->pollfds = realloc(ev->pollfds, sizeof(*ev->pollfds) * ev->size); |
|
force_assert(NULL != ev->pollfds); |
} |
} |
|
|
ev->pollfds[ev->used].fd = fd; |
ev->pollfds[ev->used].fd = fd; |
Line 193 int fdevent_poll_init(fdevents *ev) {
|
Line 199 int fdevent_poll_init(fdevents *ev) {
|
int fdevent_poll_init(fdevents *ev) { |
int fdevent_poll_init(fdevents *ev) { |
UNUSED(ev); |
UNUSED(ev); |
|
|
log_error_write(srv, __FILE__, __LINE__, | log_error_write(ev->srv, __FILE__, __LINE__, |
"s", "poll is not supported, try to set server.event-handler = \"select\""); |
"s", "poll is not supported, try to set server.event-handler = \"select\""); |
|
|
return -1; |
return -1; |