Changeset cf0cc64


Ignore:
Timestamp:
Dec 17, 2008, 5:13:47 PM (12 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, debian, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
40c6657
Parents:
1895c29
git-author:
Nelson Elhage <nelhage@mit.edu> (12/17/08 12:46:37)
git-committer:
Nelson Elhage <nelhage@mit.edu> (12/17/08 17:13:47)
Message:
Use owl_select instead of owl_muxevents for stderr redirection.

owl_muxevents appears to be a partial select() event loop that we
didn't know about it. Since we have a full event loop now, this commit
and the next few will remove muxevents and move their users over to
owl_select.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • owl.c

    rf36cd97 rcf0cc64  
    5454  struct termios tio;
    5555  owl_message *m;
    56 #if OWL_STDERR_REDIR
    57   int newstderr;
    58 #endif
    59  
     56
    6057  if (!GLIB_CHECK_VERSION (2, 12, 0))
    6158    g_error ("GLib version 2.12.0 or above is needed.");
     
    210207#if OWL_STDERR_REDIR
    211208  /* Do this only after we've started curses up... */
    212   owl_function_debugmsg("startup: doing stderr redirection");
    213   newstderr = stderr_replace();
    214   owl_muxevents_add(owl_global_get_muxevents(&g), newstderr, OWL_MUX_READ,
    215                     stderr_redirect_handler, NULL);
    216 #endif   
     209  {
     210    owl_dispatch *d = owl_malloc(sizeof(owl_dispatch));
     211    owl_function_debugmsg("startup: doing stderr redirection");
     212    d->fd = stderr_replace();
     213    d->cfunc = stderr_redirect_handler;
     214    d->destroy = NULL;
     215    owl_select_add_dispatch(d);
     216  }
     217#endif
    217218
    218219  /* create the owl directory, in case it does not exist */
     
    440441        newmsgs = 1;
    441442    }
    442 
    443     /* dispatch any muxevents */
    444     owl_muxevents_dispatch(owl_global_get_muxevents(&g), 0);
    445443
    446444    /* follow the last message if we're supposed to */
     
    749747
    750748/* Sends stderr (read from rfd) messages to the error console */
    751 void stderr_redirect_handler(int handle, int rfd, int eventmask, void *data)
     749void stderr_redirect_handler(owl_dispatch *d)
    752750{
    753751  int navail, bread;
    754752  char *buf;
    755   /*owl_function_debugmsg("stderr_redirect: called with rfd=%d\n", rfd);*/
     753  int rfd = d->fd;
    756754  if (rfd<0) return;
    757755  if (-1 == ioctl(rfd, FIONREAD, (void*)&navail)) {
Note: See TracChangeset for help on using the changeset viewer.