replace EWOULDBLOCK with EAGAIN default tip

Wed, 05 Jun 2024 22:42:52 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Wed, 05 Jun 2024 22:42:52 +0200
changeset 538
f9a7b5c76208
parent 537
ad44e72fbf50

replace EWOULDBLOCK with EAGAIN

src/server/daemon/event_bsd.c file | annotate | diff | comparison | revisions
src/server/safs/cgi.c file | annotate | diff | comparison | revisions
--- a/src/server/daemon/event_bsd.c	Wed Jun 05 19:50:44 2024 +0200
+++ b/src/server/daemon/event_bsd.c	Wed Jun 05 22:42:52 2024 +0200
@@ -124,7 +124,7 @@
                             // add
                             EV_SET(&changes[numchanges++], e_fd, EVFILT_READ, EV_ADD, 0, 0, event);
                         } else {
-                            // delete
+                            // deleteh
                             EV_SET(&changes[numchanges++], e_fd, EVFILT_READ, EV_DELETE, 0, 0, NULL);
                         }
                     }
--- a/src/server/safs/cgi.c	Wed Jun 05 19:50:44 2024 +0200
+++ b/src/server/safs/cgi.c	Wed Jun 05 22:42:52 2024 +0200
@@ -225,7 +225,7 @@
  * When successful, cgi_try_write_flush() returns 0. If an error occurs,
  * 1 is returned.
  * 
- * If the error is not EWOULDBLOCK, handler->result is set to REQ_ABORTED.
+ * If the error is not EAGAIN, handler->result is set to REQ_ABORTED.
  */
 static int cgi_try_write_flush(CGIHandler *handler, Session *sn) {
     ssize_t wr = 0;
@@ -241,7 +241,7 @@
         handler->count_write += wr;
     }
     if(handler->writebuf_size - handler->writebuf_pos > 0) {
-        if(net_errno(sn->csd) != EWOULDBLOCK) {
+        if(net_errno(sn->csd) != EAGAIN) {
             handler->result = REQ_ABORTED;
             log_ereport(
                     LOG_FAILURE,
@@ -261,7 +261,7 @@
  * In case the socket is non-blocking and not all bytes could be written,
  * the remaining bytes are copied to the CGIHandler write buffer.
  * 
- * If an error occurs that is not EWOULDBLOCK, handler->result is set to
+ * If an error occurs that is not EAGAIN, handler->result is set to
  * REQ_ABORTED.
  * 
  * Returns 0 if all bytes are successfully written, otherwise 1
@@ -276,7 +276,7 @@
     }
     
     if(pos < size) {
-        if(net_errno(sn->csd) == EWOULDBLOCK) {
+        if(net_errno(sn->csd) == EAGAIN) {
             // copy remaining bytes to the write buffer
             // we assume there are no remaining bytes in writebuf
             size_t remaining = size-pos;
@@ -449,7 +449,7 @@
                     ret = CGI_IO_ERROR;
                     break;
                 } else if(send_response == 1) {
-                    // EWOULDBLOCK
+                    // EAGAIN
                     if(!handler->poll_out) {
                         if(event_pollout(ev, sn->csd, handler->writeev)) {
                             handler->result = REQ_ABORTED;
@@ -475,7 +475,7 @@
             }
         }
     }
-    if(r < 0 && errno == EWOULDBLOCK) {
+    if(r < 0 && errno == EAGAIN) {
         return CGI_IO_NEED_READ;
     }
     handler->cgi_eof = TRUE; 
@@ -561,7 +561,7 @@
     }
     
     
-    if(r < 0 && errno == EWOULDBLOCK) {
+    if(r < 0 && errno == EAGAIN) {
         return 1;
     }
 

mercurial