Added argument parser and set all logs to STDERR
This commit is contained in:
@@ -23,7 +23,7 @@ static struct epoll_event _evs[MAX_EPOLL_EVENTS];
|
||||
bool loop_init(loop_cb_t callback) {
|
||||
_efd = epoll_create1(0);
|
||||
if (_efd == -1) {
|
||||
printf("[!] epoll_create1 failed: %d\n", errno);
|
||||
fprintf(stderr, "[!] epoll_create1 failed: %d\n", errno);
|
||||
return false;
|
||||
}
|
||||
_cb = callback;
|
||||
@@ -36,7 +36,7 @@ void loop_deinit() {
|
||||
|
||||
bool loop_ctl(int op, int fd, struct epoll_event *event) {
|
||||
if (epoll_ctl(_efd, op, fd, event) == -1) {
|
||||
printf("[!] epoll_ctl failed: %d\n", errno);
|
||||
fprintf(stderr, "[!] epoll_ctl failed: %d\n", errno);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -50,7 +50,7 @@ bool loop_wait() {
|
||||
-1
|
||||
);
|
||||
if (result < 0) {
|
||||
printf("[!] epoll_wait failed: %d\n", errno);
|
||||
fprintf(stderr, "[!] epoll_wait failed: %d\n", errno);
|
||||
return false;
|
||||
}
|
||||
if (!result) {
|
||||
|
||||
Reference in New Issue
Block a user