/[anubis]/anubis/src/daemon.c
ViewVC logotype

Diff of /anubis/src/daemon.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.8 by polak, Fri May 30 20:17:20 2003 UTC revision 1.9 by gray, Sat Jun 21 09:24:27 2003 UTC
# Line 388  _stdio_read(void *sd, char *data, size_t Line 388  _stdio_read(void *sd, char *data, size_t
388          FD_SET(fd, &rds);          FD_SET(fd, &rds);
389          do          do
390                  n = select(fd + 1, &rds, NULL, NULL, NULL);                  n = select(fd + 1, &rds, NULL, NULL, NULL);
391          while (errno == EINTR);          while (n < 0 && errno == EINTR);
392          if (n > 0) {          if (n > 0) {
393                  n = read(fd, data, size);                  n = read(fd, data, size);
394                  if (n >= 0)                  if (n >= 0)
# Line 403  _stdio_strerror(int rc) Line 403  _stdio_strerror(int rc)
403          return strerror(rc);          return strerror(rc);
404  }  }
405    
 #if defined(O_NONBLOCK)  
 # define FCNTL_NONBLOCK O_NONBLOCK  
 #elif defined(O_NDELAY)  
 # define FCNTL_NONBLOCK O_NDELAY  
 #else  
 # error "Neither O_NONBLOCK nor O_NDELAY are defined"  
 #endif  
   
 int  
 set_nonblocking(int fd)  
 {  
         int flags;  
           
         if ((flags = fcntl(fd, F_GETFL, 0)) < 0) {  
                 perror("F_GETFL");  
                 return -1;  
         }  
         if (fcntl(fd, F_SETFL, flags | FCNTL_NONBLOCK) < 0) {  
                 perror("F_GETFL");  
                 return -1;  
         }  
         return 0;  
 }  
   
406  void  void
407  stdinout(void)  stdinout(void)
408  {  {
# Line 456  stdinout(void) Line 432  stdinout(void)
432                  free_mem();                  free_mem();
433                  return;                  return;
434          }          }
         set_nonblocking(sd_client);  
         set_nonblocking(sd_server);  
435          remote_client = (void *)sd_client;          remote_client = (void *)sd_client;
436          remote_server = (void *)sd_server;          remote_server = (void *)sd_server;
437          net_set_io(CLIENT, _stdio_read, _stdio_write, NULL, _stdio_strerror);          net_set_io(CLIENT, _stdio_read, _stdio_write, NULL, _stdio_strerror);

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.9

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26