Mercurial > emacs
comparison src/process.c @ 11926:40d7e6f04ebe
(create_process, send_process): Add volatile qualifiers.
(wait_reading_process_input) [both versions]: Cast args of select.
| author | Karl Heuer <kwzh@gnu.org> |
|---|---|
| date | Fri, 26 May 1995 03:21:30 +0000 |
| parents | c2179a288898 |
| children | 017f32786ed3 |
comparison
equal
deleted
inserted
replaced
| 11925:73f8dc6f0622 | 11926:40d7e6f04ebe |
|---|---|
| 1184 create_process (process, new_argv, current_dir) | 1184 create_process (process, new_argv, current_dir) |
| 1185 Lisp_Object process; | 1185 Lisp_Object process; |
| 1186 char **new_argv; | 1186 char **new_argv; |
| 1187 Lisp_Object current_dir; | 1187 Lisp_Object current_dir; |
| 1188 { | 1188 { |
| 1189 int pid, inchannel, outchannel, forkin, forkout; | 1189 int pid, inchannel, outchannel; |
| 1190 int sv[2]; | 1190 int sv[2]; |
| 1191 #ifdef SIGCHLD | 1191 #ifdef SIGCHLD |
| 1192 SIGTYPE (*sigchld)(); | 1192 SIGTYPE (*sigchld)(); |
| 1193 #endif | 1193 #endif |
| 1194 int pty_flag = 0; | 1194 /* Use volatile to protect variables from being clobbered by longjmp. */ |
| 1195 volatile int forkin, forkout; | |
| 1196 volatile int pty_flag = 0; | |
| 1195 extern char **environ; | 1197 extern char **environ; |
| 1196 | 1198 |
| 1197 inchannel = outchannel = -1; | 1199 inchannel = outchannel = -1; |
| 1198 | 1200 |
| 1199 #ifdef HAVE_PTYS | 1201 #ifdef HAVE_PTYS |
| 1996 timeout to get our attention. */ | 1998 timeout to get our attention. */ |
| 1997 if (update_tick != process_tick && do_display) | 1999 if (update_tick != process_tick && do_display) |
| 1998 { | 2000 { |
| 1999 Atemp = input_wait_mask; | 2001 Atemp = input_wait_mask; |
| 2000 EMACS_SET_SECS_USECS (timeout, 0, 0); | 2002 EMACS_SET_SECS_USECS (timeout, 0, 0); |
| 2001 if (select (MAXDESC, &Atemp, 0, 0, &timeout) <= 0) | 2003 if ((select (MAXDESC, &Atemp, (SELECT_TYPE *)0, (SELECT_TYPE *)0, |
| 2004 &timeout) | |
| 2005 <= 0)) | |
| 2002 { | 2006 { |
| 2003 /* It's okay for us to do this and then continue with | 2007 /* It's okay for us to do this and then continue with |
| 2004 the loop, since timeout has already been zeroed out. */ | 2008 the loop, since timeout has already been zeroed out. */ |
| 2005 clear_waiting_for_input (); | 2009 clear_waiting_for_input (); |
| 2006 status_notify (); | 2010 status_notify (); |
| 2041 { | 2045 { |
| 2042 nfds = 0; | 2046 nfds = 0; |
| 2043 FD_ZERO (&Available); | 2047 FD_ZERO (&Available); |
| 2044 } | 2048 } |
| 2045 else | 2049 else |
| 2046 nfds = select (MAXDESC, &Available, 0, 0, &timeout); | 2050 nfds = select (MAXDESC, &Available, (SELECT_TYPE *)0, (SELECT_TYPE *)0, |
| 2051 &timeout); | |
| 2047 | 2052 |
| 2048 xerrno = errno; | 2053 xerrno = errno; |
| 2049 | 2054 |
| 2050 /* Make C-g and alarm signals set flags again */ | 2055 /* Make C-g and alarm signals set flags again */ |
| 2051 clear_waiting_for_input (); | 2056 clear_waiting_for_input (); |
| 2474 /* Send some data to process PROC. | 2479 /* Send some data to process PROC. |
| 2475 BUF is the beginning of the data; LEN is the number of characters. | 2480 BUF is the beginning of the data; LEN is the number of characters. |
| 2476 OBJECT is the Lisp object that the data comes from. */ | 2481 OBJECT is the Lisp object that the data comes from. */ |
| 2477 | 2482 |
| 2478 send_process (proc, buf, len, object) | 2483 send_process (proc, buf, len, object) |
| 2479 Lisp_Object proc; | 2484 volatile Lisp_Object proc; |
| 2480 char *buf; | 2485 char *buf; |
| 2481 int len; | 2486 int len; |
| 2482 Lisp_Object object; | 2487 Lisp_Object object; |
| 2483 { | 2488 { |
| 2484 /* Don't use register vars; longjmp can lose them. */ | 2489 /* Use volatile to protect variables from being clobbered by longjmp. */ |
| 2485 int rv; | 2490 int rv; |
| 2486 unsigned char *procname = XSTRING (XPROCESS (proc)->name)->data; | 2491 volatile unsigned char *procname = XSTRING (XPROCESS (proc)->name)->data; |
| 2487 | 2492 |
| 2488 #ifdef VMS | 2493 #ifdef VMS |
| 2489 struct Lisp_Process *p = XPROCESS (proc); | 2494 struct Lisp_Process *p = XPROCESS (proc); |
| 2490 VMS_PROC_STUFF *vs, *get_vms_process_pointer(); | 2495 VMS_PROC_STUFF *vs, *get_vms_process_pointer(); |
| 2491 #endif /* VMS */ | 2496 #endif /* VMS */ |
| 3754 redisplay_preserve_echo_area (); | 3759 redisplay_preserve_echo_area (); |
| 3755 | 3760 |
| 3756 if (XINT (read_kbd) && detect_input_pending ()) | 3761 if (XINT (read_kbd) && detect_input_pending ()) |
| 3757 nfds = 0; | 3762 nfds = 0; |
| 3758 else | 3763 else |
| 3759 nfds = select (1, &waitchannels, 0, 0, timeout_p); | 3764 nfds = select (1, &waitchannels, (SELECT_TYPE *)0, (SELECT_TYPE *)0, |
| 3765 timeout_p); | |
| 3760 | 3766 |
| 3761 /* Make C-g and alarm signals set flags again */ | 3767 /* Make C-g and alarm signals set flags again */ |
| 3762 clear_waiting_for_input (); | 3768 clear_waiting_for_input (); |
| 3763 | 3769 |
| 3764 /* If we woke up due to SIGWINCH, actually change size now. */ | 3770 /* If we woke up due to SIGWINCH, actually change size now. */ |
