summaryrefslogtreecommitdiff
path: root/src/common/fdset_kqueue.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/fdset_kqueue.c')
-rw-r--r--src/common/fdset_kqueue.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/common/fdset_kqueue.c b/src/common/fdset_kqueue.c
index a45da96..7c52f71 100644
--- a/src/common/fdset_kqueue.c
+++ b/src/common/fdset_kqueue.c
@@ -47,7 +47,7 @@ fdset_t *fdset_kqueue_new()
if (set) {
/* Blank memory. */
memset(set, 0, sizeof(fdset_t));
-
+
/* Create kqueue fd. */
set->kq = kqueue();
if (set->kq < 0) {
@@ -55,7 +55,7 @@ fdset_t *fdset_kqueue_new()
set = 0;
}
}
-
+
return set;
}
@@ -106,7 +106,7 @@ int fdset_kqueue_remove(fdset_t *fdset, int fd)
if (fdset == NULL || fd < 0) {
return -1;
}
-
+
/* Find in set. */
int pos = -1;
for (int i = 0; i < fdset->nfds; ++i) {
@@ -115,11 +115,11 @@ int fdset_kqueue_remove(fdset_t *fdset, int fd)
break;
}
}
-
+
if (pos < 0) {
return -1;
}
-
+
/* Remove filters. */
EV_SET(&fdset->events[pos], fd, EVFILT_READ,
EV_DISABLE|EV_DELETE, 0, 0, 0);
@@ -127,7 +127,7 @@ int fdset_kqueue_remove(fdset_t *fdset, int fd)
/* Attempt to remove from set. */
size_t remaining = ((fdset->nfds - pos) - 1) * sizeof(struct kevent);
memmove(fdset->events + pos, fdset->events + (pos + 1), remaining);
-
+
/* Attempt to remove from revents set. */
pos = -1;
for (int i = 0; i < fdset->nfds; ++i) {
@@ -141,7 +141,7 @@ int fdset_kqueue_remove(fdset_t *fdset, int fd)
memmove(fdset->revents + pos, fdset->revents + (pos + 1), remaining);
}
-
+
/* Overwrite current item. */
--fdset->nfds;