Changeset 4c963d7e24928576cb0e4a600c35e964b4ba5cca

Show
Ignore:
Timestamp:
06/22/08 04:18:11 (6 years ago)
Author:
Theo Schlossnagle <jesus@omniti.com>
git-committer:
Theo Schlossnagle <jesus@omniti.com> 1214108291 +0000
git-parent:

[327712134f74d1a3209f8beee3b0f593e721c8f6]

git-author:
Theo Schlossnagle <jesus@omniti.com> 1214108291 +0000
Message:

write the eventer... checks are working, but the telnet console is not, refs #32

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/eventer/eventer_impl.c

    re218b2e r4c963d7  
    1616extern struct _eventer_impl eventer_epoll_impl; 
    1717#endif 
     18#ifdef HAVE_PORTS 
     19extern struct _eventer_impl eventer_ports_impl; 
     20#endif 
    1821 
    1922eventer_impl_t registered_eventers[] = { 
     
    2326#ifdef HAVE_EPOLL 
    2427  &eventer_epoll_impl, 
     28#endif 
     29#ifdef HAVE_PORTS 
     30  &eventer_ports_impl, 
    2531#endif 
    2632  NULL 
  • src/noit_config.h.in

    r3277121 r4c963d7  
    6161#undef HAVE_SYS_PARAM_H 
    6262#undef HAVE_SEMAPHORE_H 
    63 #undef HAVE)ALLOA_H 
     63#undef HAVE_ALLOCA_H 
    6464#undef HAVE_TIME_H 
    6565#undef HAVE_SYS_STAT_H 
     
    107107/* Kernel epoll_create() support */ 
    108108#undef HAVE_EPOLL 
     109/* Kernel port_create() support */ 
     110#undef HAVE_PORTS 
    109111 
    110112/* The number of bytes in a char.  */ 
  • src/noit_console.c

    r3277121 r4c963d7  
    273273allocate_pty(int *master, int *slave) { 
    274274#ifdef HAVE_OPENPTY 
    275     return openpty(master, slave, NULL, NULL, NULL); 
     275  if(openpty(master, slave, NULL, NULL, NULL)) return -1; 
     276  if(ioctl(ncct->pty_master, FIONBIO, &on)) return -1; 
    276277#else 
    277     /* STREAMS... sigh */ 
    278     char   *slavename; 
    279     extern char *ptsname(); 
    280  
    281     *master = open("/dev/ptmx", O_RDWR);  /* open master */ 
    282     if(*master < 0) return -1; 
    283     grantpt(*master);                     /* change permission of   slave */ 
    284     unlockpt(*master);                    /* unlock slave */ 
    285     slavename = ptsname(*master);         /* get name of slave */ 
    286     *slave = open(slavename, O_RDWR);    /* open slave */ 
    287     if(*slave < 0) { 
    288       close(*master); 
    289       *master = -1; 
    290       return -1; 
    291    
    292     ioctl(*slave, I_PUSH, "ptem");       /* push ptem */ 
    293     ioctl(*slave, I_PUSH, "ldterm");     /* push ldterm*/ 
    294     return 0; 
     278  /* STREAMS... sigh */ 
     279  char   *slavename; 
     280  extern char *ptsname(); 
     281 
     282  *master = open("/dev/ptmx", O_RDWR);  /* open master */ 
     283  if(*master < 0) return -1; 
     284  grantpt(*master);                     /* change permission of   slave */ 
     285  unlockpt(*master);                    /* unlock slave */ 
     286  slavename = ptsname(*master);         /* get name of slave */ 
     287  *slave = open(slavename, O_RDWR);    /* open slave */ 
     288  if(*slave < 0) { 
     289    close(*master); 
     290    *master = -1; 
     291    return -1; 
     292 
     293  ioctl(*slave, I_PUSH, "ptem");       /* push ptem */ 
     294  ioctl(*slave, I_PUSH, "ldterm");     /* push ldterm*/ 
     295  return 0; 
    295296#endif 
    296297} 
     
    320321    int on = 1; 
    321322    ncct->e = e; 
    322     if(allocate_pty(&ncct->pty_master, &ncct->pty_slave) || 
    323        ioctl(ncct->pty_master, FIONBIO, &on)) { 
     323    if(allocate_pty(&ncct->pty_master, &ncct->pty_slave)) { 
    324324      nc_printf(ncct, "Failed to open pty: %s\n", strerror(errno)); 
    325325      ncct->wants_shutdown = 1; 
     
    399399      cmd_buffer[plen] = '\0'; 
    400400      if(cmd_buffer[plen-1] == '\n') cmd_buffer[plen-1] = '\0'; 
    401       noitL(noit_debug, "IN: '%s'\n", cmd_buffer); 
     401      noitL(noit_debug, "IN[%d]: '%s'\n", plen, cmd_buffer); 
    402402      noit_console_dispatch(e, cmd_buffer, ncct); 
    403403      free(cmd_buffer); 
  • src/noit_listener.c

    r1f7cb6f r4c963d7  
    8686  ac = malloc(sizeof(*ac)); 
    8787  memcpy(ac, listener_closure->dispatch_closure, sizeof(*ac)); 
     88  salen = sizeof(ac->remote); 
    8889  conn = e->opset->accept(e->fd, &ac->remote.remote_addr, &salen, &newmask, e); 
    8990  if(conn >= 0) { 
     
    146147  int8_t family; 
    147148  int sockaddr_len; 
    148   socklen_t on; 
    149   long reuse; 
     149  socklen_t on, reuse; 
    150150  listener_closure_t listener_closure; 
    151151  eventer_t event; 
     
    187187 
    188188  fd = socket(family, type, 0); 
    189   if(fd < 0) return -1; 
     189  if(fd < 0) { 
     190    noitL(noit_stderr, "Cannot create socket: %s\n", strerror(errno)); 
     191    return -1; 
     192  } 
    190193 
    191194  on = 1; 
    192195  if(ioctl(fd, FIONBIO, &on)) { 
    193196    close(fd); 
     197    noitL(noit_stderr, "Cannot make socket non-blocking: %s\n", 
     198          strerror(errno)); 
    194199    return -1; 
    195200  } 
     
    199204                 (void*)&reuse, sizeof(reuse)) != 0) { 
    200205    close(fd); 
     206    noitL(noit_stderr, "Cannot set SO_REUSEADDR: %s\n", strerror(errno)); 
    201207    return -1; 
    202208  } 
  • src/noitedit/readline.c

    re06b23e r4c963d7  
    5757#include <unistd.h> 
    5858#endif 
     59#if HAVE_ALLOCA_H 
     60#include <alloca.h> 
     61#endif 
    5962#include <limits.h> 
    6063#include "noitedit/histedit.h"