comparison src/process.c @ 175:2d532a89d707 r20-3b14

Import from CVS: tag r20-3b14
author cvs
date Mon, 13 Aug 2007 09:50:14 +0200
parents 8eaf7971accc
children 3d6bfa290dbd
comparison
equal deleted inserted replaced
174:bb3568571b84 175:2d532a89d707
1507 Lisp_Object tail; 1507 Lisp_Object tail;
1508 1508
1509 for (tail = network_stream_blocking_port_list; CONSP (tail); tail = XCDR (tail)) 1509 for (tail = network_stream_blocking_port_list; CONSP (tail); tail = XCDR (tail))
1510 { 1510 {
1511 Lisp_Object tail_port = XCAR (tail); 1511 Lisp_Object tail_port = XCAR (tail);
1512 int block_port;
1513 1512
1514 if (STRINGP (tail_port)) 1513 if (STRINGP (tail_port))
1515 { 1514 {
1516 struct servent *svc_info; 1515 struct servent *svc_info;
1517 CHECK_STRING (tail_port); 1516 CHECK_STRING (tail_port);
2083 Return a pair of coding-system for decoding and encoding of PROCESS. 2082 Return a pair of coding-system for decoding and encoding of PROCESS.
2084 */ 2083 */
2085 (process)) 2084 (process))
2086 { 2085 {
2087 process = get_process (process); 2086 process = get_process (process);
2088 return Fcons(decoding_stream_coding_system 2087 return Fcons (decoding_stream_coding_system
2089 (XLSTREAM (XPROCESS (process)->instream)), 2088 (XLSTREAM (XPROCESS (process)->instream)),
2090 encoding_stream_coding_system 2089 encoding_stream_coding_system
2091 (XLSTREAM (XPROCESS (process)->outstream)) ); 2090 (XLSTREAM (XPROCESS (process)->outstream)));
2092 } 2091 }
2093 2092
2094 DEFUN ("set-process-input-coding-system", 2093 DEFUN ("set-process-input-coding-system",
2095 Fset_process_input_coding_system, 2, 2, 0, /* 2094 Fset_process_input_coding_system, 2, 2, 0, /*
2096 Set PROCESS's input coding system to CODESYS. 2095 Set PROCESS's input coding system to CODESYS.
2152 2151
2153 static void 2152 static void
2154 exec_sentinel (Lisp_Object proc, Lisp_Object reason) 2153 exec_sentinel (Lisp_Object proc, Lisp_Object reason)
2155 { 2154 {
2156 /* This function can GC */ 2155 /* This function can GC */
2157 Lisp_Object sentinel; 2156 int speccount = specpdl_depth ();
2158 struct Lisp_Process *p = XPROCESS (proc); 2157 struct Lisp_Process *p = XPROCESS (proc);
2159 int speccount = specpdl_depth (); 2158 Lisp_Object sentinel = p->sentinel;
2160 2159
2161 sentinel = p->sentinel;
2162 if (NILP (sentinel)) 2160 if (NILP (sentinel))
2163 return; 2161 return;
2164 2162
2165 /* Some weird FSFmacs crap here with 2163 /* Some weird FSFmacs crap here with
2166 Vdeactivate_mark and current_buffer->keymap */ 2164 Vdeactivate_mark and current_buffer->keymap */
2170 p->sentinel = Qnil; 2168 p->sentinel = Qnil;
2171 record_unwind_protect (exec_sentinel_unwind, noseeum_cons (proc, sentinel)); 2169 record_unwind_protect (exec_sentinel_unwind, noseeum_cons (proc, sentinel));
2172 /* We used to bind inhibit-quit to t here, but call2_trapping_errors() 2170 /* We used to bind inhibit-quit to t here, but call2_trapping_errors()
2173 does that for us. */ 2171 does that for us. */
2174 running_asynch_code = 1; 2172 running_asynch_code = 1;
2175 call2_trapping_errors ("Error in process sentinel", 2173 call2_trapping_errors ("Error in process sentinel", sentinel, proc, reason);
2176 sentinel, proc, reason);
2177 running_asynch_code = 0; 2174 running_asynch_code = 0;
2178 restore_match_data (); 2175 restore_match_data ();
2179 unbind_to (speccount, Qnil); 2176 unbind_to (speccount, Qnil);
2180 } 2177 }
2181 2178
2668 2665
2669 DEFUN ("process-status", Fprocess_status, 1, 1, 0, /* 2666 DEFUN ("process-status", Fprocess_status, 1, 1, 0, /*
2670 Return the status of PROCESS. 2667 Return the status of PROCESS.
2671 This is a symbol, one of these: 2668 This is a symbol, one of these:
2672 2669
2673 run -- for a process that is running. 2670 run -- for a process that is running.
2674 stop -- for a process stopped but continuable. 2671 stop -- for a process stopped but continuable.
2675 exit -- for a process that has exited. 2672 exit -- for a process that has exited.
2676 signal -- for a process that has got a fatal signal. 2673 signal -- for a process that has got a fatal signal.
2677 open -- for a network stream connection that is open. 2674 open -- for a network stream connection that is open.
2678 closed -- for a network stream connection that is closed. 2675 closed -- for a network stream connection that is closed.
2679 nil -- if arg is a process name and no such process exists. 2676 nil -- if arg is a process name and no such process exists.
2677
2680 PROCESS may be a process, a buffer, the name of a process or buffer, or 2678 PROCESS may be a process, a buffer, the name of a process or buffer, or
2681 nil, indicating the current buffer's process. 2679 nil, indicating the current buffer's process.
2682 */ 2680 */
2683 (proc)) 2681 (proc))
2684 { 2682 {
2685 Lisp_Object status; 2683 Lisp_Object status_symbol;
2686 2684
2687 if (STRINGP (proc)) 2685 if (STRINGP (proc))
2688 proc = Fget_process (proc); 2686 proc = Fget_process (proc);
2689 else 2687 else
2690 proc = get_process (proc); 2688 proc = get_process (proc);
2691 2689
2692 if (NILP (proc)) 2690 if (NILP (proc))
2693 return proc; 2691 return Qnil;
2694 2692
2695 status = XPROCESS (proc)->status_symbol; 2693 status_symbol = XPROCESS (proc)->status_symbol;
2696 if (network_connection_p (proc)) 2694 if (network_connection_p (proc))
2697 { 2695 {
2698 if (EQ (status, Qrun)) 2696 if (EQ (status_symbol, Qrun))
2699 status = Qopen; 2697 status_symbol = Qopen;
2700 else if (EQ (status, Qexit)) 2698 else if (EQ (status_symbol, Qexit))
2701 status = Qclosed; 2699 status_symbol = Qclosed;
2702 } 2700 }
2703 return status; 2701 return status_symbol;
2704 } 2702 }
2705 2703
2706 DEFUN ("process-exit-status", Fprocess_exit_status, 1, 1, 0, /* 2704 DEFUN ("process-exit-status", Fprocess_exit_status, 1, 1, 0, /*
2707 Return the exit status of PROCESS or the signal number that killed it. 2705 Return the exit status of PROCESS or the signal number that killed it.
2708 If PROCESS has not yet exited or died, return 0. 2706 If PROCESS has not yet exited or died, return 0.
2780 case SIGTSTP: return t.c_cc[VSWTCH]; 2778 case SIGTSTP: return t.c_cc[VSWTCH];
2781 # endif /* SIGTSTP */ 2779 # endif /* SIGTSTP */
2782 } 2780 }
2783 } 2781 }
2784 # else /* ! defined (TCGETA) */ 2782 # else /* ! defined (TCGETA) */
2785 #error ERROR! Using SIGNALS_VIA_CHARACTERS, but not (TIOCGLTC && TIOCGETC) || TCGETA 2783 #error ERROR! Using SIGNALS_VIA_CHARACTERS, but not HAVE_TERMIOS || (TIOCGLTC && TIOCGETC) || TCGETA
2786 /* If your system configuration files define SIGNALS_VIA_CHARACTERS, 2784 /* If your system configuration files define SIGNALS_VIA_CHARACTERS,
2787 you'd better be using one of the alternatives above! */ 2785 you'd better be using one of the alternatives above! */
2788 # endif /* ! defined (TCGETA) */ 2786 # endif /* ! defined (TCGETA) */
2789 return '\0'; 2787 return '\0';
2790 } 2788 }