Mercurial > hg > xemacs-beta
comparison src/process-unix.c @ 613:023b83f4e54b
[xemacs-hg @ 2001-06-10 10:42:16 by ben]
------ signal-code changes ------
data.c, device-tty.c, emacs.c, floatfns.c, linuxplay.c, nas.c,
process-unix.c, signal.c, sunplay.c, sysdep.c, syssignal.h:
use EMACS_SIGNAL everywhere instead of playing preprocessing
games with signal().
s\windowsnt.h, s\mingw32.h, syssignal.h:
Remove mswindows signal code from s+m headers and move to
syssignal.h as one of the five ways of signal handling,
instead of playing preprocessing games.
fileio.c, sysdep.c:
Rename sys_do_signal to qxe_reliable_signal.
signal.c, process-unix.c, profile.c:
Create set_timeout_signal(); use instead of just EMACS_SIGNAL
to establish a signal handler on a timeout signal; this does
special things under Cygwin.
nt.c:
Eliminate term_ntproc(), which is blank; used as a SIGABRT
handler, which was wrong anyway.
nt.c, win32.c:
Move signal code from nt.c to win32.c, since Cygwin needs it
too when dealing with timeout signals.
s\cygwin32.h:
Define CYGWIN_BROKEN_SIGNALS.
------ other changes ------
s\mingw32.h:
Fix problems with NOT_C_CODE being in the wrong place and
excluding defines needed when building Makefile.in.in.
filelock.c, mule-canna.c, mule-ccl.c, mule-ccl.h, ralloc.c,
unexalpha.c, unexapollo.c, unexcw.c, unexelfsgi.c, unexnt.c,
unexsni.c, s\aix3-1.h, s\bsd4-1.h, s\bsd4-2.h, s\bsd4-3.h, s\cxux.h,
s\cygwin32.h, s\dgux.h, s\dgux5-4r2.h, s\dgux5-4r3.h, s\dgux5-4r4.h,
s\ewsux5r4.h, s\gnu.h, s\hpux.h, s\iris3-5.h, s\iris3-6.h,
s\irix3-3.h, s\linux.h, s\mingw32.h, s\newsos5.h, s\nextstep.h,
s\ptx.h, s\riscix1-1.h, s\riscix1-2.h, s\rtu.h, s\sco4.h, s\sco5.h,
s\template.h, s\ultrix.h, s\umax.h, s\umips.h, s\unipl5-0.h,
s\unipl5-2.h, s\usg5-0.h, s\usg5-2-2.h, s\usg5-2.h, s\usg5-3.h,
s\usg5-4.h, s\windowsnt.h, s\xenix.h:
Rename 'GNU Emacs' to XEmacs in the copyright and comments.
nas.c:
Stylistic cleanup. Avoid preprocessing games with names such
as play_sound_file.
------ signal-code changes ------
data.c, device-tty.c, emacs.c, floatfns.c, linuxplay.c, nas.c,
process-unix.c, signal.c, sunplay.c, sysdep.c, syssignal.h:
use EMACS_SIGNAL everywhere instead of playing preprocessing
games with signal().
s\windowsnt.h, s\mingw32.h, syssignal.h:
Remove mswindows signal code from s+m headers and move to
syssignal.h as one of the five ways of signal handling,
instead of playing preprocessing games.
fileio.c, sysdep.c:
Rename sys_do_signal to qxe_reliable_signal.
signal.c, process-unix.c, profile.c:
Create set_timeout_signal(); use instead of just EMACS_SIGNAL
to establish a signal handler on a timeout signal; this does
special things under Cygwin.
nt.c:
Eliminate term_ntproc(), which is blank; used as a SIGABRT
handler, which was wrong anyway.
nt.c, win32.c:
Move signal code from nt.c to win32.c, since Cygwin needs it
too when dealing with timeout signals.
s\cygwin32.h:
Define CYGWIN_BROKEN_SIGNALS.
------ other changes ------
s\mingw32.h:
Fix problems with NOT_C_CODE being in the wrong place and
excluding defines needed when building Makefile.in.in.
filelock.c, mule-canna.c, mule-ccl.c, mule-ccl.h, ralloc.c,
unexalpha.c, unexapollo.c, unexcw.c, unexelfsgi.c, unexnt.c,
unexsni.c, s\aix3-1.h, s\bsd4-1.h, s\bsd4-2.h, s\bsd4-3.h, s\cxux.h,
s\cygwin32.h, s\dgux.h, s\dgux5-4r2.h, s\dgux5-4r3.h, s\dgux5-4r4.h,
s\ewsux5r4.h, s\gnu.h, s\hpux.h, s\iris3-5.h, s\iris3-6.h,
s\irix3-3.h, s\linux.h, s\mingw32.h, s\newsos5.h, s\nextstep.h,
s\ptx.h, s\riscix1-1.h, s\riscix1-2.h, s\rtu.h, s\sco4.h, s\sco5.h,
s\template.h, s\ultrix.h, s\umax.h, s\umips.h, s\unipl5-0.h,
s\unipl5-2.h, s\usg5-0.h, s\usg5-2-2.h, s\usg5-2.h, s\usg5-3.h,
s\usg5-4.h, s\windowsnt.h, s\xenix.h:
Rename 'GNU Emacs' to XEmacs in the copyright and comments.
nas.c:
Stylistic cleanup. Avoid preprocessing games with names such
as play_sound_file.
xemacs-faq.texi:
Update sections on Windows and MacOS availability.
alist.el, apropos.el, autoload.el, bytecomp.el, cl-compat.el, cl-extra.el, cl-macs.el, cl-seq.el, cl.el, cmdloop.el, cus-edit.el, derived.el, gpm.el, itimer.el, lisp-mode.el, shadow.el, version.el, wid-browse.el:
Rename 'GNU Emacs' to XEmacs in the copyright. Fix other
references to GNU Emacs that should be XEmacs or just Emacs.
files.el:
Fix warning.
simple.el:
transpose-line-up/down will now move the region up or down by
a line if active.
cvtmail.c, fakemail.c, gnuserv.c, gnuserv.h, gnuslib.c, make-msgfile.c, make-path.c, pop.c, pop.h, profile.c, tcp.c:
Rename 'GNU Emacs' to XEmacs in the copyright.
Fix comments in similar ways.
digest-doc.c, sorted-doc.c:
Fix program and author name to reflect XEmacs.
author | ben |
---|---|
date | Sun, 10 Jun 2001 10:42:39 +0000 |
parents | 13e3d7ae7155 |
children | b39c14581166 |
comparison
equal
deleted
inserted
replaced
612:ff0d9e7facba | 613:023b83f4e54b |
---|---|
106 | 106 |
107 static void | 107 static void |
108 close_safely (int fd) | 108 close_safely (int fd) |
109 { | 109 { |
110 stop_interrupts (); | 110 stop_interrupts (); |
111 signal (SIGALRM, close_safely_handler); | 111 set_timeout_signal (SIGALRM, close_safely_handler); |
112 alarm (1); | 112 alarm (1); |
113 close (fd); | 113 close (fd); |
114 alarm (0); | 114 alarm (0); |
115 start_interrupts (); | 115 start_interrupts (); |
116 } | 116 } |
808 unix_init_process (void) | 808 unix_init_process (void) |
809 { | 809 { |
810 #ifndef CANNOT_DUMP | 810 #ifndef CANNOT_DUMP |
811 if (! noninteractive || initialized) | 811 if (! noninteractive || initialized) |
812 #endif | 812 #endif |
813 signal (SIGCHLD, sigchld_handler); | 813 EMACS_SIGNAL (SIGCHLD, sigchld_handler); |
814 } | 814 } |
815 #endif /* SIGCHLD */ | 815 #endif /* SIGCHLD */ |
816 | 816 |
817 /* | 817 /* |
818 * Initialize any process local data. This is called when newly | 818 * Initialize any process local data. This is called when newly |
1030 will die when we want it to. | 1030 will die when we want it to. |
1031 JV: This needs to be done ALWAYS as we might have inherited | 1031 JV: This needs to be done ALWAYS as we might have inherited |
1032 a SIG_IGN handling from our parent (nohup) and we are in new | 1032 a SIG_IGN handling from our parent (nohup) and we are in new |
1033 process group. | 1033 process group. |
1034 */ | 1034 */ |
1035 signal (SIGHUP, SIG_DFL); | 1035 EMACS_SIGNAL (SIGHUP, SIG_DFL); |
1036 | 1036 |
1037 /* Set up the terminal characteristics of the pty. */ | 1037 /* Set up the terminal characteristics of the pty. */ |
1038 child_setup_tty (xforkout); | 1038 child_setup_tty (xforkout); |
1039 } /* if (pty_flag) */ | 1039 } /* if (pty_flag) */ |
1040 | 1040 |
1041 | 1041 |
1042 signal (SIGINT, SIG_DFL); | 1042 EMACS_SIGNAL (SIGINT, SIG_DFL); |
1043 signal (SIGQUIT, SIG_DFL); | 1043 EMACS_SIGNAL (SIGQUIT, SIG_DFL); |
1044 | 1044 |
1045 { | 1045 { |
1046 char *current_dir; | 1046 char *current_dir; |
1047 char **new_argv = alloca_array (char *, nargv + 2); | 1047 char **new_argv = alloca_array (char *, nargv + 2); |
1048 int i; | 1048 int i; |
1285 chunklen = Lstream_read (lstream, chunkbuf, 512); | 1285 chunklen = Lstream_read (lstream, chunkbuf, 512); |
1286 if (chunklen <= 0) | 1286 if (chunklen <= 0) |
1287 break; /* perhaps should abort() if < 0? | 1287 break; /* perhaps should abort() if < 0? |
1288 This should never happen. */ | 1288 This should never happen. */ |
1289 old_sigpipe = | 1289 old_sigpipe = |
1290 (SIGTYPE (*) (int)) signal (SIGPIPE, send_process_trap); | 1290 (SIGTYPE (*) (int)) EMACS_SIGNAL (SIGPIPE, send_process_trap); |
1291 /* Lstream_write() will never successfully write less than | 1291 /* Lstream_write() will never successfully write less than |
1292 the amount sent in. In the worst case, it just buffers | 1292 the amount sent in. In the worst case, it just buffers |
1293 the unwritten data. */ | 1293 the unwritten data. */ |
1294 writeret = Lstream_write (XLSTREAM (DATA_OUTSTREAM(p)), chunkbuf, | 1294 writeret = Lstream_write (XLSTREAM (DATA_OUTSTREAM(p)), chunkbuf, |
1295 chunklen); | 1295 chunklen); |
1296 { | 1296 { |
1297 int save_errno = errno; | 1297 int save_errno = errno; |
1298 signal (SIGPIPE, old_sigpipe); | 1298 EMACS_SIGNAL (SIGPIPE, old_sigpipe); |
1299 errno = save_errno; | 1299 errno = save_errno; |
1300 if (writeret < 0) | 1300 if (writeret < 0) |
1301 /* This is a real error. Blocking errors are handled | 1301 /* This is a real error. Blocking errors are handled |
1302 specially inside of the filedesc stream. */ | 1302 specially inside of the filedesc stream. */ |
1303 report_process_error ("writing to process", proc); | 1303 report_process_error ("writing to process", proc); |
1310 Faccept_process_output (Qnil, make_int (1), Qnil); | 1310 Faccept_process_output (Qnil, make_int (1), Qnil); |
1311 /* It could have *really* finished, deleting the process */ | 1311 /* It could have *really* finished, deleting the process */ |
1312 if (NILP(p->pipe_outstream)) | 1312 if (NILP(p->pipe_outstream)) |
1313 return; | 1313 return; |
1314 old_sigpipe = | 1314 old_sigpipe = |
1315 (SIGTYPE (*) (int)) signal (SIGPIPE, send_process_trap); | 1315 (SIGTYPE (*) (int)) EMACS_SIGNAL (SIGPIPE, send_process_trap); |
1316 Lstream_flush (XLSTREAM (p->pipe_outstream)); | 1316 Lstream_flush (XLSTREAM (p->pipe_outstream)); |
1317 signal (SIGPIPE, old_sigpipe); | 1317 EMACS_SIGNAL (SIGPIPE, old_sigpipe); |
1318 } | 1318 } |
1319 } | 1319 } |
1320 } | 1320 } |
1321 else | 1321 else |
1322 { /* We got here from a longjmp() from the SIGPIPE handler */ | 1322 { /* We got here from a longjmp() from the SIGPIPE handler */ |
1323 signal (SIGPIPE, old_sigpipe); | 1323 EMACS_SIGNAL (SIGPIPE, old_sigpipe); |
1324 /* Close the file lstream so we don't attempt to write to it further */ | 1324 /* Close the file lstream so we don't attempt to write to it further */ |
1325 /* #### There is controversy over whether this might cause fd leakage */ | 1325 /* #### There is controversy over whether this might cause fd leakage */ |
1326 /* my tests say no. -slb */ | 1326 /* my tests say no. -slb */ |
1327 XLSTREAM (p->pipe_outstream)->flags &= ~LSTREAM_FL_IS_OPEN; | 1327 XLSTREAM (p->pipe_outstream)->flags &= ~LSTREAM_FL_IS_OPEN; |
1328 p->status_symbol = Qexit; | 1328 p->status_symbol = Qexit; |
1332 process_tick++; | 1332 process_tick++; |
1333 deactivate_process (*((Lisp_Object *) (&vol_proc))); | 1333 deactivate_process (*((Lisp_Object *) (&vol_proc))); |
1334 invalid_operation ("SIGPIPE raised on process; closed it", p->name); | 1334 invalid_operation ("SIGPIPE raised on process; closed it", p->name); |
1335 } | 1335 } |
1336 | 1336 |
1337 old_sigpipe = (SIGTYPE (*) (int)) signal (SIGPIPE, send_process_trap); | 1337 old_sigpipe = (SIGTYPE (*) (int)) EMACS_SIGNAL (SIGPIPE, send_process_trap); |
1338 Lstream_flush (XLSTREAM (DATA_OUTSTREAM(p))); | 1338 Lstream_flush (XLSTREAM (DATA_OUTSTREAM(p))); |
1339 signal (SIGPIPE, old_sigpipe); | 1339 EMACS_SIGNAL (SIGPIPE, old_sigpipe); |
1340 } | 1340 } |
1341 | 1341 |
1342 /* | 1342 /* |
1343 * Send EOF to the process. The default implementation simply | 1343 * Send EOF to the process. The default implementation simply |
1344 * closes the output stream. The method must return 0 to call | 1344 * closes the output stream. The method must return 0 to call |
1387 | 1387 |
1388 if (UNIX_DATA(p)->infd >= 0) | 1388 if (UNIX_DATA(p)->infd >= 0) |
1389 flush_pending_output (UNIX_DATA(p)->infd); | 1389 flush_pending_output (UNIX_DATA(p)->infd); |
1390 | 1390 |
1391 /* closing the outstream could result in SIGPIPE, so ignore it. */ | 1391 /* closing the outstream could result in SIGPIPE, so ignore it. */ |
1392 old_sigpipe = (SIGTYPE (*) (int)) signal (SIGPIPE, SIG_IGN); | 1392 old_sigpipe = (SIGTYPE (*) (int)) EMACS_SIGNAL (SIGPIPE, SIG_IGN); |
1393 usid = event_stream_delete_stream_pair (p->pipe_instream, p->pipe_outstream); | 1393 usid = event_stream_delete_stream_pair (p->pipe_instream, p->pipe_outstream); |
1394 signal (SIGPIPE, old_sigpipe); | 1394 EMACS_SIGNAL (SIGPIPE, old_sigpipe); |
1395 | 1395 |
1396 UNIX_DATA(p)->infd = -1; | 1396 UNIX_DATA(p)->infd = -1; |
1397 | 1397 |
1398 return usid; | 1398 return usid; |
1399 } | 1399 } |