/[emacs]/emacs/src/process.c
ViewVC logotype

Diff of /emacs/src/process.c

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

revision 1.396 by kfstorm, Thu Jan 16 12:59:18 2003 UTC revision 1.397 by lektu, Tue Feb 4 14:03:13 2003 UTC
# Line 101  Boston, MA 02111-1307, USA.  */ Line 101  Boston, MA 02111-1307, USA.  */
101  #ifdef IRIS  #ifdef IRIS
102  #include <sys/sysmacros.h>      /* for "minor" */  #include <sys/sysmacros.h>      /* for "minor" */
103  #endif /* not IRIS */  #endif /* not IRIS */
104      
105  #ifdef HAVE_SYS_WAIT  #ifdef HAVE_SYS_WAIT
106  #include <sys/wait.h>  #include <sys/wait.h>
107  #endif  #endif
# Line 357  update_status (p) Line 357  update_status (p)
357    p->raw_status_high = Qnil;    p->raw_status_high = Qnil;
358  }  }
359    
360  /*  Convert a process status word in Unix format to  /*  Convert a process status word in Unix format to
361      the list that we use internally.  */      the list that we use internally.  */
362    
363  Lisp_Object  Lisp_Object
# Line 406  decode_status (l, symbol, code, coredump Line 406  decode_status (l, symbol, code, coredump
406    
407  /* Return a string describing a process status list.  */  /* Return a string describing a process status list.  */
408    
409  Lisp_Object  Lisp_Object
410  status_message (status)  status_message (status)
411       Lisp_Object status;       Lisp_Object status;
412  {  {
# Line 685  nil, indicating the current buffer's pro Line 685  nil, indicating the current buffer's pro
685      {      {
686        Fkill_process (process, Qnil);        Fkill_process (process, Qnil);
687        /* Do this now, since remove_process will make sigchld_handler do nothing.  */        /* Do this now, since remove_process will make sigchld_handler do nothing.  */
688        XPROCESS (process)->status        XPROCESS (process)->status
689          = Fcons (Qsignal, Fcons (make_number (SIGKILL), Qnil));          = Fcons (Qsignal, Fcons (make_number (SIGKILL), Qnil));
690        XSETINT (XPROCESS (process)->tick, ++process_tick);        XSETINT (XPROCESS (process)->tick, ++process_tick);
691        status_notify ();        status_notify ();
# Line 847  t means stop accepting output from the p Line 847  t means stop accepting output from the p
847    
848  When a process has a filter, its buffer is not used for output.  When a process has a filter, its buffer is not used for output.
849  Instead, each time it does output, the entire string of output is  Instead, each time it does output, the entire string of output is
850  passed to the filter.    passed to the filter.
851    
852  The filter gets two arguments: the process and the string of output.  The filter gets two arguments: the process and the string of output.
853  The string argument is normally a multibyte string, except:  The string argument is normally a multibyte string, except:
# Line 860  The string argument is normally a multib Line 860  The string argument is normally a multib
860       register Lisp_Object process, filter;       register Lisp_Object process, filter;
861  {  {
862    struct Lisp_Process *p;    struct Lisp_Process *p;
863      
864    CHECK_PROCESS (process);    CHECK_PROCESS (process);
865    p = XPROCESS (process);    p = XPROCESS (process);
866    
# Line 871  The string argument is normally a multib Line 871  The string argument is normally a multib
871       (setq process (start-process ...))       (setq process (start-process ...))
872       (debug)       (debug)
873       (set-process-filter process ...)  */       (set-process-filter process ...)  */
874      
875    if (XINT (p->infd) >= 0)    if (XINT (p->infd) >= 0)
876      {      {
877        if (EQ (filter, Qt) && !EQ (p->status, Qlisten))        if (EQ (filter, Qt) && !EQ (p->status, Qlisten))
# Line 886  The string argument is normally a multib Line 886  The string argument is normally a multib
886            FD_SET (XINT (p->infd), &non_keyboard_wait_mask);            FD_SET (XINT (p->infd), &non_keyboard_wait_mask);
887          }          }
888      }      }
889      
890    p->filter = filter;    p->filter = filter;
891    if (NETCONN1_P (p))    if (NETCONN1_P (p))
892      p->childp = Fplist_put (p->childp, QCfilter, filter);      p->childp = Fplist_put (p->childp, QCfilter, filter);
# Line 937  DEFUN ("set-process-window-size", Fset_p Line 937  DEFUN ("set-process-window-size", Fset_p
937    CHECK_PROCESS (process);    CHECK_PROCESS (process);
938    CHECK_NATNUM (height);    CHECK_NATNUM (height);
939    CHECK_NATNUM (width);    CHECK_NATNUM (width);
940      
941    if (XINT (XPROCESS (process)->infd) < 0    if (XINT (XPROCESS (process)->infd) < 0
942        || set_window_size (XINT (XPROCESS (process)->infd),        || set_window_size (XINT (XPROCESS (process)->infd),
943                            XINT (height), XINT (width)) <= 0)                            XINT (height), XINT (width)) <= 0)
# Line 1033  See `make-network-process' for a list of Line 1033  See `make-network-process' for a list of
1033  #ifdef DATAGRAM_SOCKETS  #ifdef DATAGRAM_SOCKETS
1034    if (DATAGRAM_CONN_P (process)    if (DATAGRAM_CONN_P (process)
1035        && (EQ (key, Qt) || EQ (key, QCremote)))        && (EQ (key, Qt) || EQ (key, QCremote)))
1036      contact = Fplist_put (contact, QCremote,      contact = Fplist_put (contact, QCremote,
1037                            Fprocess_datagram_address (process));                            Fprocess_datagram_address (process));
1038  #endif  #endif
1039    
# Line 1127  IP address.  Returns nil if format of AD Line 1127  IP address.  Returns nil if format of AD
1127        args[0] = build_string ("<Family %d>");        args[0] = build_string ("<Family %d>");
1128        args[1] = Fcar (address);        args[1] = Fcar (address);
1129        return Fformat (2, args);        return Fformat (2, args);
1130          
1131      }      }
1132    
1133    return Qnil;    return Qnil;
# Line 1232  list_processes_1 (query_only) Line 1232  list_processes_1 (query_only)
1232        if (CONSP (p->status))        if (CONSP (p->status))
1233          symbol = XCAR (p->status);          symbol = XCAR (p->status);
1234    
1235          
1236        if (EQ (symbol, Qsignal))        if (EQ (symbol, Qsignal))
1237          {          {
1238            Lisp_Object tem;            Lisp_Object tem;
# Line 1319  list_processes_1 (query_only) Line 1319  list_processes_1 (query_only)
1319                     (STRINGP (host) ? (char *)SDATA (host) : "?"));                     (STRINGP (host) ? (char *)SDATA (host) : "?"));
1320            insert_string (tembuf);            insert_string (tembuf);
1321          }          }
1322        else        else
1323          {          {
1324            tem = p->command;            tem = p->command;
1325            while (1)            while (1)
# Line 1408  usage: (start-process NAME BUFFER PROGRA Line 1408  usage: (start-process NAME BUFFER PROGRA
1408    
1409      GCPRO2 (buffer, current_dir);      GCPRO2 (buffer, current_dir);
1410    
1411      current_dir      current_dir
1412        = expand_and_dir_to_file (Funhandled_file_name_directory (current_dir),        = expand_and_dir_to_file (Funhandled_file_name_directory (current_dir),
1413                                  Qnil);                                  Qnil);
1414      if (NILP (Ffile_accessible_directory_p (current_dir)))      if (NILP (Ffile_accessible_directory_p (current_dir)))
# Line 1512  usage: (start-process NAME BUFFER PROGRA Line 1512  usage: (start-process NAME BUFFER PROGRA
1512        strcat (new_argv, SDATA (tem));        strcat (new_argv, SDATA (tem));
1513      }      }
1514    /* Need to add code here to check for program existence on VMS */    /* Need to add code here to check for program existence on VMS */
1515      
1516  #else /* not VMS */  #else /* not VMS */
1517    new_argv = (unsigned char **) alloca ((nargs - 1) * sizeof (char *));    new_argv = (unsigned char **) alloca ((nargs - 1) * sizeof (char *));
1518    
# Line 1809  create_process (process, new_argv, curre Line 1809  create_process (process, new_argv, curre
1809    XSETINT (XPROCESS (process)->pid, -1);    XSETINT (XPROCESS (process)->pid, -1);
1810    
1811    BLOCK_INPUT;    BLOCK_INPUT;
1812      
1813    {    {
1814      /* child_setup must clobber environ on systems with true vfork.      /* child_setup must clobber environ on systems with true vfork.
1815         Protect it from permanent change.  */         Protect it from permanent change.  */
# Line 1874  create_process (process, new_argv, curre Line 1874  create_process (process, new_argv, curre
1874            }            }
1875  #endif  #endif
1876  #endif  #endif
1877  #ifdef TIOCNOTTY  #ifdef TIOCNOTTY
1878          /* In 4.3BSD, the TIOCSPGRP bug has been fixed, and now you          /* In 4.3BSD, the TIOCSPGRP bug has been fixed, and now you
1879             can do TIOCSPGRP only to the process's controlling tty.  */             can do TIOCSPGRP only to the process's controlling tty.  */
1880          if (pty_flag)          if (pty_flag)
1881            {            {
1882              /* I wonder: would just ioctl (0, TIOCNOTTY, 0) work here?              /* I wonder: would just ioctl (0, TIOCNOTTY, 0) work here?
1883                 I can't test it since I don't have 4.3.  */                 I can't test it since I don't have 4.3.  */
1884              int j = emacs_open ("/dev/tty", O_RDWR, 0);              int j = emacs_open ("/dev/tty", O_RDWR, 0);
1885              ioctl (j, TIOCNOTTY, 0);              ioctl (j, TIOCNOTTY, 0);
# Line 1974  create_process (process, new_argv, curre Line 1974  create_process (process, new_argv, curre
1974  #ifdef WINDOWSNT  #ifdef WINDOWSNT
1975          pid = child_setup (xforkin, xforkout, xforkout,          pid = child_setup (xforkin, xforkout, xforkout,
1976                             new_argv, 1, current_dir);                             new_argv, 1, current_dir);
1977  #else  /* not WINDOWSNT */        #else  /* not WINDOWSNT */
1978          child_setup (xforkin, xforkout, xforkout,          child_setup (xforkin, xforkout, xforkout,
1979                       new_argv, 1, current_dir);                       new_argv, 1, current_dir);
1980  #endif /* not WINDOWSNT */  #endif /* not WINDOWSNT */
# Line 2007  create_process (process, new_argv, curre Line 2007  create_process (process, new_argv, curre
2007        {        {
2008          struct atimer *timer;          struct atimer *timer;
2009          EMACS_TIME offset;          EMACS_TIME offset;
2010            
2011          stop_polling ();          stop_polling ();
2012          EMACS_SET_SECS_USECS (offset, 1, 0);          EMACS_SET_SECS_USECS (offset, 1, 0);
2013          timer = start_atimer (ATIMER_RELATIVE, offset, create_process_1, 0);          timer = start_atimer (ATIMER_RELATIVE, offset, create_process_1, 0);
2014            
2015          XPROCESS (process)->subtty = Qnil;          XPROCESS (process)->subtty = Qnil;
2016          if (forkin >= 0)          if (forkin >= 0)
2017            emacs_close (forkin);            emacs_close (forkin);
# Line 2019  create_process (process, new_argv, curre Line 2019  create_process (process, new_argv, curre
2019          cancel_atimer (timer);          cancel_atimer (timer);
2020          start_polling ();          start_polling ();
2021        }        }
2022          
2023        if (forkin != forkout && forkout >= 0)        if (forkin != forkout && forkout >= 0)
2024          emacs_close (forkout);          emacs_close (forkout);
2025    
# Line 2260  Returns nil upon error setting address, Line 2260  Returns nil upon error setting address,
2260    
2261  static struct socket_options {  static struct socket_options {
2262    /* The name of this option.  Should be lowercase version of option    /* The name of this option.  Should be lowercase version of option
2263       name without SO_ prefix. */       name without SO_ prefix. */
2264    char *name;    char *name;
2265    /* Length of name.  */    /* Length of name.  */
2266    int nlen;    int nlen;
# Line 2406  set_socket_options (s, opts, no_error) Line 2406  set_socket_options (s, opts, no_error)
2406                    arg = (char *) SDATA (val);                    arg = (char *) SDATA (val);
2407                  else if (XSYMBOL (val))                  else if (XSYMBOL (val))
2408                    arg = (char *) SDATA (SYMBOL_NAME (val));                    arg = (char *) SDATA (SYMBOL_NAME (val));
2409                  else                  else
2410                    error ("Invalid argument to %s option", name);                    error ("Invalid argument to %s option", name);
2411                }                }
2412              ret = setsockopt (s, sopt->optlevel, sopt->optnum,              ret = setsockopt (s, sopt->optlevel, sopt->optnum,
2413                                arg, strlen (arg));                                arg, strlen (arg));
2414            }            }
2415    
2416  #ifdef SO_LINGER              #ifdef SO_LINGER
2417          case SOPT_LINGER:          case SOPT_LINGER:
2418            {            {
2419              struct linger linger;              struct linger linger;
# Line 2455  set_socket_options (s, opts, no_error) Line 2455  set_socket_options (s, opts, no_error)
2455    
2456  DEFUN ("set-network-process-options",  DEFUN ("set-network-process-options",
2457         Fset_network_process_options, Sset_network_process_options,         Fset_network_process_options, Sset_network_process_options,
2458         1, MANY, 0,         1, MANY, 0,
2459         doc: /* Set one or more options for network process PROCESS.         doc: /* Set one or more options for network process PROCESS.
2460  Each option is either a string "OPT=VALUE" or a cons (OPT . VALUE).  Each option is either a string "OPT=VALUE" or a cons (OPT . VALUE).
2461  A boolean value is false if it either zero or nil, true otherwise.  A boolean value is false if it either zero or nil, true otherwise.
# Line 2466  pages for more information. Line 2466  pages for more information.
2466  bindtodevice=NAME -- bind to interface NAME, or remove binding if nil.  bindtodevice=NAME -- bind to interface NAME, or remove binding if nil.
2467  broadcast=BOOL -- Allow send and receive of datagram broadcasts.  broadcast=BOOL -- Allow send and receive of datagram broadcasts.
2468  dontroute=BOOL -- Only send to directly connected hosts.  dontroute=BOOL -- Only send to directly connected hosts.
2469  keepalive=BOOL -- Send keep-alive messages on network stream.  keepalive=BOOL -- Send keep-alive messages on network stream.
2470  linger=BOOL or TIMEOUT -- Send queued messages before closing.  linger=BOOL or TIMEOUT -- Send queued messages before closing.
2471  oobinline=BOOL -- Place out-of-band data in receive data stream.  oobinline=BOOL -- Place out-of-band data in receive data stream.
2472  priority=INT -- Set protocol defined priority for sent packets.  priority=INT -- Set protocol defined priority for sent packets.
2473  reuseaddr=BOOL -- Allow reusing a recently used address.  reuseaddr=BOOL -- Allow reusing a recently used address.
2474    
# Line 2507  unwind_request_sigio (dummy) Line 2507  unwind_request_sigio (dummy)
2507     connection has no PID; you cannot signal it.  All you can do is     connection has no PID; you cannot signal it.  All you can do is
2508     stop/continue it and deactivate/close it via delete-process */     stop/continue it and deactivate/close it via delete-process */
2509    
2510  DEFUN ("make-network-process", Fmake_network_process, Smake_network_process,  DEFUN ("make-network-process", Fmake_network_process, Smake_network_process,
2511         0, MANY, 0,         0, MANY, 0,
2512         doc: /* Create and return a network server or client process.         doc: /* Create and return a network server or client process.
2513    
2514  In Emacs, network connections are represented by process objects, so  In Emacs, network connections are represented by process objects, so
# Line 2599  is the server process, CLIENT is the new Line 2599  is the server process, CLIENT is the new
2599  and MESSAGE is a string.  and MESSAGE is a string.
2600    
2601  :plist PLIST -- Install PLIST as the new process' initial plist.  :plist PLIST -- Install PLIST as the new process' initial plist.
2602    
2603  :server BOOL -- if BOOL is non-nil, create a server process for the  :server BOOL -- if BOOL is non-nil, create a server process for the
2604  specified FAMILY, SERVICE, and connection type (stream or datagram).  specified FAMILY, SERVICE, and connection type (stream or datagram).
2605  Default is a client process.  Default is a client process.
2606    
2607  A server process will listen for and accept connections from  A server process will listen for and accept connections from
2608  clients.  When a client connection is accepted, a new network process  clients.  When a client connection is accepted, a new network process
2609  is created for the connection with the following parameters:  is created for the connection with the following parameters:
2610  - The client's process name is constructed by concatenating the server  - The client's process name is constructed by concatenating the server
2611  process' NAME and a client identification string.  process' NAME and a client identification string.
2612  - If the FILTER argument is non-nil, the client process will not get a  - If the FILTER argument is non-nil, the client process will not get a
2613  separate process buffer; otherwise, the client's process buffer is a newly  separate process buffer; otherwise, the client's process buffer is a newly
2614  created buffer named after the server process' BUFFER name or process  created buffer named after the server process' BUFFER name or process
2615  NAME concatenated with the client identification string.    NAME concatenated with the client identification string.
2616  - The connection type and the process filter and sentinel parameters are  - The connection type and the process filter and sentinel parameters are
2617  inherited from the server process' TYPE, FILTER and SENTINEL.  inherited from the server process' TYPE, FILTER and SENTINEL.
2618  - The client process' contact info is set according to the client's  - The client process' contact info is set according to the client's
# Line 2732  usage: (make-network-process &rest ARGS) Line 2732  usage: (make-network-process &rest ARGS)
2732    /* Let's handle TERM before things get complicated ...   */    /* Let's handle TERM before things get complicated ...   */
2733    host = Fplist_get (contact, QChost);    host = Fplist_get (contact, QChost);
2734    CHECK_STRING (host);    CHECK_STRING (host);
2735      
2736    service = Fplist_get (contact, QCservice);    service = Fplist_get (contact, QCservice);
2737    if (INTEGERP (service))    if (INTEGERP (service))
2738      port = htons ((unsigned short) XINT (service));      port = htons ((unsigned short) XINT (service));
# Line 2881  usage: (make-network-process &rest ARGS) Line 2881  usage: (make-network-process &rest ARGS)
2881      {      {
2882        struct servent *svc_info;        struct servent *svc_info;
2883        CHECK_STRING (service);        CHECK_STRING (service);
2884        svc_info = getservbyname (SDATA (service),        svc_info = getservbyname (SDATA (service),
2885                                  (socktype == SOCK_DGRAM ? "udp" : "tcp"));                                  (socktype == SOCK_DGRAM ? "udp" : "tcp"));
2886        if (svc_info == 0)        if (svc_info == 0)
2887          error ("Unknown service: %s", SDATA (service));          error ("Unknown service: %s", SDATA (service));
# Line 2904  usage: (make-network-process &rest ARGS) Line 2904  usage: (make-network-process &rest ARGS)
2904        QUIT;        QUIT;
2905        host_info_ptr = gethostbyname (SDATA (host));        host_info_ptr = gethostbyname (SDATA (host));
2906        immediate_quit = 0;        immediate_quit = 0;
2907      
2908        if (host_info_ptr)        if (host_info_ptr)
2909          {          {
2910            bcopy (host_info_ptr->h_addr, (char *) &address_in.sin_addr,            bcopy (host_info_ptr->h_addr, (char *) &address_in.sin_addr,
# Line 2985  usage: (make-network-process &rest ARGS) Line 2985  usage: (make-network-process &rest ARGS)
2985              }              }
2986          }          }
2987  #endif  #endif
2988          
2989        /* Make us close S if quit.  */        /* Make us close S if quit.  */
2990        record_unwind_protect (close_file_unwind, make_number (s));        record_unwind_protect (close_file_unwind, make_number (s));
2991    
# Line 3000  usage: (make-network-process &rest ARGS) Line 3000  usage: (make-network-process &rest ARGS)
3000                if (setsockopt (s, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof optval))                if (setsockopt (s, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof optval))
3001                  report_file_error ("Cannot set reuse option on server socket.", Qnil);                  report_file_error ("Cannot set reuse option on server socket.", Qnil);
3002              }              }
3003          
3004            if (bind (s, lres->ai_addr, lres->ai_addrlen))            if (bind (s, lres->ai_addr, lres->ai_addrlen))
3005              report_file_error ("Cannot bind server socket", Qnil);              report_file_error ("Cannot bind server socket", Qnil);
3006    
# Line 3035  usage: (make-network-process &rest ARGS) Line 3035  usage: (make-network-process &rest ARGS)
3035           set.           set.
3036    
3037           It'd be nice to be able to control the connect timeout           It'd be nice to be able to control the connect timeout
3038           though.  Would non-blocking connect calls be portable?           though.  Would non-blocking connect calls be portable?
3039    
3040           This used to be conditioned by HAVE_GETADDRINFO.  Why?  */           This used to be conditioned by HAVE_GETADDRINFO.  Why?  */
3041    
# Line 3111  usage: (make-network-process &rest ARGS) Line 3111  usage: (make-network-process &rest ARGS)
3111              bcopy (lres->ai_addr, datagram_address[s].sa, lres->ai_addrlen);              bcopy (lres->ai_addr, datagram_address[s].sa, lres->ai_addrlen);
3112          }          }
3113  #endif  #endif
3114        contact = Fplist_put (contact, QCaddress,        contact = Fplist_put (contact, QCaddress,
3115                              conv_sockaddr_to_lisp (lres->ai_addr, lres->ai_addrlen));                              conv_sockaddr_to_lisp (lres->ai_addr, lres->ai_addrlen));
3116  #ifdef HAVE_GETSOCKNAME  #ifdef HAVE_GETSOCKNAME
3117        if (!is_server)        if (!is_server)
# Line 3181  usage: (make-network-process &rest ARGS) Line 3181  usage: (make-network-process &rest ARGS)
3181    
3182    p->childp = contact;    p->childp = contact;
3183    p->plist = Fcopy_sequence (Fplist_get (contact, QCplist));    p->plist = Fcopy_sequence (Fplist_get (contact, QCplist));
3184      
3185    p->buffer = buffer;    p->buffer = buffer;
3186    p->sentinel = sentinel;    p->sentinel = sentinel;
3187    p->filter = filter;    p->filter = filter;
# Line 3603  server_accept_connection (server, channe Line 3603  server_accept_connection (server, channe
3603    contact = Fplist_put (contact, QChost, host);    contact = Fplist_put (contact, QChost, host);
3604    if (!NILP (service))    if (!NILP (service))
3605      contact = Fplist_put (contact, QCservice, service);      contact = Fplist_put (contact, QCservice, service);
3606    contact = Fplist_put (contact, QCremote,    contact = Fplist_put (contact, QCremote,
3607                          conv_sockaddr_to_lisp (&saddr.sa, len));                          conv_sockaddr_to_lisp (&saddr.sa, len));
3608  #ifdef HAVE_GETSOCKNAME  #ifdef HAVE_GETSOCKNAME
3609    len = sizeof saddr;    len = sizeof saddr;
3610    if (getsockname (s, &saddr.sa, &len) == 0)    if (getsockname (s, &saddr.sa, &len) == 0)
3611      contact = Fplist_put (contact, QClocal,      contact = Fplist_put (contact, QClocal,
3612                            conv_sockaddr_to_lisp (&saddr.sa, len));                            conv_sockaddr_to_lisp (&saddr.sa, len));
3613  #endif  #endif
3614    
# Line 3634  server_accept_connection (server, channe Line 3634  server_accept_connection (server, channe
3634    if (s > max_process_desc)    if (s > max_process_desc)
3635      max_process_desc = s;      max_process_desc = s;
3636    
3637    /* Setup coding system for new process based on server process.      /* Setup coding system for new process based on server process.
3638       This seems to be the proper thing to do, as the coding system       This seems to be the proper thing to do, as the coding system
3639       of the new process should reflect the settings at the time the       of the new process should reflect the settings at the time the
3640       server socket was opened; not the current settings. */       server socket was opened; not the current settings. */
# Line 3668  server_accept_connection (server, channe Line 3668  server_accept_connection (server, channe
3668                        build_string ("\n")));                        build_string ("\n")));
3669    
3670    if (!NILP (p->sentinel))    if (!NILP (p->sentinel))
3671      exec_sentinel (proc,      exec_sentinel (proc,
3672                     concat3 (build_string ("open from "),                     concat3 (build_string ("open from "),
3673                              (STRINGP (host) ? host : build_string ("-")),                              (STRINGP (host) ? host : build_string ("-")),
3674                              build_string ("\n")));                              build_string ("\n")));
# Line 3831  wait_reading_process_input (time_limit, Line 3831  wait_reading_process_input (time_limit,
3831              {              {
3832                int old_timers_run = timers_run;                int old_timers_run = timers_run;
3833                struct buffer *old_buffer = current_buffer;                struct buffer *old_buffer = current_buffer;
3834                  
3835                timer_delay = timer_check (1);                timer_delay = timer_check (1);
3836    
3837                /* If a timer has run, this might have changed buffers                /* If a timer has run, this might have changed buffers
# Line 3840  wait_reading_process_input (time_limit, Line 3840  wait_reading_process_input (time_limit,
3840                    && old_buffer != current_buffer                    && old_buffer != current_buffer
3841                    && waiting_for_user_input_p == -1)                    && waiting_for_user_input_p == -1)
3842                  record_asynch_buffer_change ();                  record_asynch_buffer_change ();
3843                  
3844                if (timers_run != old_timers_run && do_display)                if (timers_run != old_timers_run && do_display)
3845                  /* We must retry, since a timer may have requeued itself                  /* We must retry, since a timer may have requeued itself
3846                     and that could alter the time_delay.  */                     and that could alter the time_delay.  */
# Line 3902  wait_reading_process_input (time_limit, Line 3902  wait_reading_process_input (time_limit,
3902            Ctemp = connect_wait_mask;            Ctemp = connect_wait_mask;
3903            EMACS_SET_SECS_USECS (timeout, 0, 0);            EMACS_SET_SECS_USECS (timeout, 0, 0);
3904            if ((select (max (max_process_desc, max_keyboard_desc) + 1,            if ((select (max (max_process_desc, max_keyboard_desc) + 1,
3905                         &Atemp,                         &Atemp,
3906                         (num_pending_connects > 0 ? &Ctemp : (SELECT_TYPE *)0),                         (num_pending_connects > 0 ? &Ctemp : (SELECT_TYPE *)0),
3907                         (SELECT_TYPE *)0, &timeout)                         (SELECT_TYPE *)0, &timeout)
3908                 <= 0))                 <= 0))
# Line 3935  wait_reading_process_input (time_limit, Line 3935  wait_reading_process_input (time_limit,
3935                if (nread == 0)                if (nread == 0)
3936                  break;                  break;
3937    
3938                if (0 < nread)                if (0 < nread)
3939                  total_nread += nread;                  total_nread += nread;
3940  #ifdef EIO  #ifdef EIO
3941                else if (nread == -1 && EIO == errno)                else if (nread == -1 && EIO == errno)
# Line 3996  wait_reading_process_input (time_limit, Line 3996  wait_reading_process_input (time_limit,
3996            if (check_connect)            if (check_connect)
3997              Connecting = connect_wait_mask;              Connecting = connect_wait_mask;
3998            nfds = select (max (max_process_desc, max_keyboard_desc) + 1,            nfds = select (max (max_process_desc, max_keyboard_desc) + 1,
3999                           &Available,                           &Available,
4000                           (check_connect ? &Connecting : (SELECT_TYPE *)0),                           (check_connect ? &Connecting : (SELECT_TYPE *)0),
4001                           (SELECT_TYPE *)0, &timeout);                           (SELECT_TYPE *)0, &timeout);
4002          }          }
# Line 4093  wait_reading_process_input (time_limit, Line 4093  wait_reading_process_input (time_limit,
4093            int old_timers_run = timers_run;            int old_timers_run = timers_run;
4094            struct buffer *old_buffer = current_buffer;            struct buffer *old_buffer = current_buffer;
4095            int leave = 0;            int leave = 0;
4096            
4097            if (detect_input_pending_run_timers (do_display))            if (detect_input_pending_run_timers (do_display))
4098              {              {
4099                swallow_events (do_display);                swallow_events (do_display);
# Line 4110  wait_reading_process_input (time_limit, Line 4110  wait_reading_process_input (time_limit,
4110    
4111            if (leave)            if (leave)
4112              break;              break;
4113          }              }
4114          
4115        /* If there is unread keyboard input, also return.  */        /* If there is unread keyboard input, also return.  */
4116        if (XINT (read_kbd) != 0        if (XINT (read_kbd) != 0
4117            && requeued_events_pending_p ())            && requeued_events_pending_p ())
# Line 4258  wait_reading_process_input (time_limit, Line 4258  wait_reading_process_input (time_limit,
4258                        = Fcons (Qexit, Fcons (make_number (256), Qnil));                        = Fcons (Qexit, Fcons (make_number (256), Qnil));
4259                  }                  }
4260              }              }
4261  #ifdef NON_BLOCKING_CONNECT        #ifdef NON_BLOCKING_CONNECT
4262            if (check_connect && FD_ISSET (channel, &Connecting))            if (check_connect && FD_ISSET (channel, &Connecting))
4263              {              {
4264                struct Lisp_Process *p;                struct Lisp_Process *p;
# Line 4479  read_process_output (proc, channel) Line 4479  read_process_output (proc, channel)
4479    outstream = p->filter;    outstream = p->filter;
4480    if (!NILP (outstream))    if (!NILP (outstream))
4481      {      {
4482        /* We inhibit quit here instead of just catching it so that        /* We inhibit quit here instead of just catching it so that
4483           hitting ^G when a filter happens to be running won't screw           hitting ^G when a filter happens to be running won't screw
4484           it up.  */           it up.  */
4485        int count = SPECPDL_INDEX ();        int count = SPECPDL_INDEX ();
# Line 4945  send_process (proc, buf, len, object) Line 4945  send_process (proc, buf, len, object)
4945                        || errno == EAGAIN                        || errno == EAGAIN
4946  #endif  #endif
4947                        )                        )
4948                      /* Buffer is full.  Wait, accepting input;                      /* Buffer is full.  Wait, accepting input;
4949                         that may allow the program                         that may allow the program
4950                         to finish doing output and read more.  */                         to finish doing output and read more.  */
4951                      {                      {
# Line 4969  send_process (proc, buf, len, object) Line 4969  send_process (proc, buf, len, object)
4969                           the terminal is set up that way which it is                           the terminal is set up that way which it is
4970                           here).  The same bytes will be seen again in a                           here).  The same bytes will be seen again in a
4971                           later read(2), without the CRs.  */                           later read(2), without the CRs.  */
4972                        
4973                        if (errno == EAGAIN)                        if (errno == EAGAIN)
4974                          {                          {
4975                            int flags = FWRITE;                            int flags = FWRITE;
# Line 4977  send_process (proc, buf, len, object) Line 4977  send_process (proc, buf, len, object)
4977                                   &flags);                                   &flags);
4978                          }                          }
4979  #endif /* BROKEN_PTY_READ_AFTER_EAGAIN */  #endif /* BROKEN_PTY_READ_AFTER_EAGAIN */
4980                        
4981                        /* Running filters might relocate buffers or strings.                        /* Running filters might relocate buffers or strings.
4982                           Arrange to relocate BUF.  */                           Arrange to relocate BUF.  */
4983                        if (BUFFERP (object))                        if (BUFFERP (object))
# Line 5026  send_process (proc, buf, len, object) Line 5026  send_process (proc, buf, len, object)
5026        XSETINT (XPROCESS (proc)->tick, ++process_tick);        XSETINT (XPROCESS (proc)->tick, ++process_tick);
5027        deactivate_process (proc);        deactivate_process (proc);
5028  #ifdef VMS  #ifdef VMS
5029        error ("Error writing to process %s; closed it",        error ("Error writing to process %s; closed it",
5030               SDATA (XPROCESS (proc)->name));               SDATA (XPROCESS (proc)->name));
5031  #else  #else
5032        error ("SIGPIPE raised on process %s; closed it",        error ("SIGPIPE raised on process %s; closed it",
# Line 5109  return t unconditionally.  */) Line 5109  return t unconditionally.  */)
5109      error ("Process %s is not active",      error ("Process %s is not active",
5110             SDATA (p->name));             SDATA (p->name));
5111    
5112  #ifdef TIOCGPGRP  #ifdef TIOCGPGRP
5113    if (!NILP (p->subtty))    if (!NILP (p->subtty))
5114      ioctl (XFASTINT (p->subtty), TIOCGPGRP, &gid);      ioctl (XFASTINT (p->subtty), TIOCGPGRP, &gid);
5115    else    else
# Line 5258  process_send_signal (process, signo, cur Line 5258  process_send_signal (process, signo, cur
5258        /* The code above always returns from the function.  */        /* The code above always returns from the function.  */
5259  #endif /* defined (SIGNALS_VIA_CHARACTERS) */  #endif /* defined (SIGNALS_VIA_CHARACTERS) */
5260    
5261  #ifdef TIOCGPGRP  #ifdef TIOCGPGRP
5262        /* Get the current pgrp using the tty itself, if we have that.        /* Get the current pgrp using the tty itself, if we have that.
5263           Otherwise, use the pty to get the pgrp.           Otherwise, use the pty to get the pgrp.
5264           On pfa systems, saka@pfu.fujitsu.co.JP writes:           On pfa systems, saka@pfu.fujitsu.co.JP writes:
# Line 5392  See function `interrupt-process' for mor Line 5392  See function `interrupt-process' for mor
5392    
5393  DEFUN ("stop-process", Fstop_process, Sstop_process, 0, 2, 0,  DEFUN ("stop-process", Fstop_process, Sstop_process, 0, 2, 0,
5394         doc: /* Stop process PROCESS.  May be process or name of one.         doc: /* Stop process PROCESS.  May be process or name of one.
5395  See function `interrupt-process' for more details on usage.    See function `interrupt-process' for more details on usage.
5396  If PROCESS is a network process, inhibit handling of incoming traffic.  */)  If PROCESS is a network process, inhibit handling of incoming traffic.  */)
5397       (process, current_group)       (process, current_group)
5398       Lisp_Object process, current_group;       Lisp_Object process, current_group;
# Line 5401  If PROCESS is a network process, inhibit Line 5401  If PROCESS is a network process, inhibit
5401    if (PROCESSP (process) && NETCONN_P (process))    if (PROCESSP (process) && NETCONN_P (process))
5402      {      {
5403        struct Lisp_Process *p;        struct Lisp_Process *p;
5404      
5405        p = XPROCESS (process);        p = XPROCESS (process);
5406        if (NILP (p->command)        if (NILP (p->command)
5407            && XINT (p->infd) >= 0)            && XINT (p->infd) >= 0)
# Line 5423  If PROCESS is a network process, inhibit Line 5423  If PROCESS is a network process, inhibit
5423    
5424  DEFUN ("continue-process", Fcontinue_process, Scontinue_process, 0, 2, 0,  DEFUN ("continue-process", Fcontinue_process, Scontinue_process, 0, 2, 0,
5425         doc: /* Continue process PROCESS.  May be process or name of one.         doc: /* Continue process PROCESS.  May be process or name of one.
5426  See function `interrupt-process' for more details on usage.    See function `interrupt-process' for more details on usage.
5427  If PROCESS is a network process, resume handling of incoming traffic.  */)  If PROCESS is a network process, resume handling of incoming traffic.  */)
5428       (process, current_group)       (process, current_group)
5429       Lisp_Object process, current_group;       Lisp_Object process, current_group;
# Line 5484  SIGCODE may be an integer, or a symbol w Line 5484  SIGCODE may be an integer, or a symbol w
5484      }      }
5485    else    else
5486      process = get_process (process);      process = get_process (process);
5487          
5488    if (NILP (process))    if (NILP (process))
5489      return process;      return process;
5490    
# Line 5708  kill_buffer_processes (buffer) Line 5708  kill_buffer_processes (buffer)
5708  /* On receipt of a signal that a child status has changed, loop asking  /* On receipt of a signal that a child status has changed, loop asking
5709     about children with changed statuses until the system says there     about children with changed statuses until the system says there
5710     are no more.     are no more.
5711      
5712     All we do is change the status; we do not run sentinels or print     All we do is change the status; we do not run sentinels or print
5713     notifications.  That is saved for the next time keyboard input is     notifications.  That is saved for the next time keyboard input is
5714     done, in order to avoid timing errors.     done, in order to avoid timing errors.
# Line 5752  sigchld_handler (signo) Line 5752  sigchld_handler (signo)
5752  #define WUNTRACED 0  #define WUNTRACED 0
5753  #endif /* no WUNTRACED */  #endif /* no WUNTRACED */
5754        /* Keep trying to get a status until we get a definitive result.  */        /* Keep trying to get a status until we get a definitive result.  */
5755        do        do
5756          {          {
5757            errno = 0;            errno = 0;
5758            pid = wait3 (&w, WNOHANG | WUNTRACED, 0);            pid = wait3 (&w, WNOHANG | WUNTRACED, 0);
# Line 5803  sigchld_handler (signo) Line 5803  sigchld_handler (signo)
5803                break;                break;
5804              p = 0;              p = 0;
5805            }            }
5806          
5807        /* Change the status of the process that was found.  */        /* Change the status of the process that was found.  */
5808        if (p != 0)        if (p != 0)
5809          {          {
5810            union { int i; WAITTYPE wt; } u;            union { int i; WAITTYPE wt; } u;
5811            int clear_desc_flag = 0;            int clear_desc_flag = 0;
5812              
5813            XSETINT (p->tick, ++process_tick);            XSETINT (p->tick, ++process_tick);
5814            u.wt = w;            u.wt = w;
5815            XSETINT (p->raw_status_low, u.i & 0xffff);            XSETINT (p->raw_status_low, u.i & 0xffff);
5816            XSETINT (p->raw_status_high, u.i >> 16);            XSETINT (p->raw_status_high, u.i >> 16);
5817              
5818            /* If process has terminated, stop waiting for its output.  */            /* If process has terminated, stop waiting for its output.  */
5819            if ((WIFSIGNALED (w) || WIFEXITED (w))            if ((WIFSIGNALED (w) || WIFEXITED (w))
5820                && XINT (p->infd) >= 0)                && XINT (p->infd) >= 0)
# Line 6342  syms_of_process () Line 6342  syms_of_process ()
6342    staticpro (&QCoptions);    staticpro (&QCoptions);
6343    QCplist = intern (":plist");    QCplist = intern (":plist");
6344    staticpro (&QCplist);    staticpro (&QCplist);
6345        
6346    Qlast_nonmenu_event = intern ("last-nonmenu-event");    Qlast_nonmenu_event = intern ("last-nonmenu-event");
6347    staticpro (&Qlast_nonmenu_event);    staticpro (&Qlast_nonmenu_event);
6348    
# Line 6472  wait_reading_process_input (time_limit, Line 6472  wait_reading_process_input (time_limit,
6472    int xerrno;    int xerrno;
6473    /* Either nil or a cons cell, the car of which is of interest and    /* Either nil or a cons cell, the car of which is of interest and
6474       may be changed outside of this routine.  */       may be changed outside of this routine.  */
6475    Lisp_Object wait_for_cell;    Lisp_Object wait_for_cell;
6476    
6477    wait_for_cell = Qnil;    wait_for_cell = Qnil;
6478    

Legend:
Removed from v.1.396  
changed lines
  Added in v.1.397

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