Introduction
Introduction Statistics Contact Development Disclaimer Help
Return -1 in case of errors in queue event wrapper functions. - quark - quark w…
git clone git://git.suckless.org/quark
Log
Files
Refs
LICENSE
---
commit 3729e7222aafc4c4ca30351748a89e05f78e2230
parent 319ba7083fdde836d6614c6b8b228bf3a9849e95
Author: Rainer Holzner <[email protected]>
Date: Sat, 30 Jan 2021 13:54:58 +0100
Return -1 in case of errors in queue event wrapper functions.
Use same data type for nready (number of events) as returned by queue_wait().
Diffstat:
M main.c | 3 ++-
M queue.c | 14 +++++++-------
2 files changed, 9 insertions(+), 8 deletions(-)
---
diff --git a/main.c b/main.c
@@ -212,7 +212,8 @@ thread_method(void *data)
queue_event *event = NULL;
struct connection *connection, *c;
struct worker_data *d = (struct worker_data *)data;
- int qfd, nready, fd;
+ int qfd, fd;
+ ssize_t nready;
size_t i;
/* allocate connections */
diff --git a/queue.c b/queue.c
@@ -77,7 +77,7 @@ queue_add_fd(int qfd, int fd, enum queue_event_type t, int sh…
/* register fd in the interest list */
if (epoll_ctl(qfd, EPOLL_CTL_ADD, fd, &e) < 0) {
warn("epoll_ctl:");
- return 1;
+ return -1;
}
#else
struct kevent e;
@@ -99,7 +99,7 @@ queue_add_fd(int qfd, int fd, enum queue_event_type t, int sh…
if (kevent(qfd, &e, 1, NULL, 0, NULL) < 0) {
warn("kevent:");
- return 1;
+ return -1;
}
#endif
@@ -136,7 +136,7 @@ queue_mod_fd(int qfd, int fd, enum queue_event_type t, cons…
/* register fd in the interest list */
if (epoll_ctl(qfd, EPOLL_CTL_MOD, fd, &e) < 0) {
warn("epoll_ctl:");
- return 1;
+ return -1;
}
#else
struct kevent e;
@@ -157,7 +157,7 @@ queue_mod_fd(int qfd, int fd, enum queue_event_type t, cons…
if (kevent(qfd, &e, 1, NULL, 0, NULL) < 0) {
warn("kevent:");
- return 1;
+ return -1;
}
#endif
@@ -172,7 +172,7 @@ queue_rem_fd(int qfd, int fd)
if (epoll_ctl(qfd, EPOLL_CTL_DEL, fd, &e) < 0) {
warn("epoll_ctl:");
- return 1;
+ return -1;
}
#else
struct kevent e;
@@ -181,7 +181,7 @@ queue_rem_fd(int qfd, int fd)
if (kevent(qfd, &e, 1, NULL, 0, NULL) < 0) {
warn("kevent:");
- return 1;
+ return -1;
}
#endif
@@ -201,7 +201,7 @@ queue_wait(int qfd, queue_event *e, size_t elen)
#else
if ((nready = kevent(qfd, NULL, 0, e, elen, NULL)) < 0) {
warn("kevent:");
- return 1;
+ return -1;
}
#endif
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.