aboutsummaryrefslogtreecommitdiffstats
path: root/src/process.c
diff options
context:
space:
mode:
authorPaul Eggert2012-09-15 00:06:56 -0700
committerPaul Eggert2012-09-15 00:06:56 -0700
commit0328b6de4a92676b4ad4616095ce19a4f51d1c4d (patch)
treefba6da827e1383b3ff6ee4b738d2ac74a5956dde /src/process.c
parent823751606a90e3850551b43e707d58bbf58033dc (diff)
downloademacs-0328b6de4a92676b4ad4616095ce19a4f51d1c4d.tar.gz
emacs-0328b6de4a92676b4ad4616095ce19a4f51d1c4d.zip
Port better to POSIX hosts lacking _setjmp.
* configure.ac (HAVE__SETJMP, HAVE_SIGSETJMP): New symbols. (_setjmp, _longjmp): Remove. * src/lisp.h: Include <setjmp.h> here, since we use its symbols here. All instances of '#include <setjmp.h>' removed, if the only reason for the instance was because "lisp.h" was included. (sys_jmp_buf, sys_setjmp, sys_longjmp): New symbols. Unless otherwise specified, replace all uses of jmp_buf, _setjmp, and _longjmp with the new symbols. Emacs already uses _setjmp if available, so this change affects only POSIXish hosts that have sigsetjmp but not _setjmp, such as some versions of Solaris and Unixware. (Also, POSIX-2008 marks _setjmp as obsolescent.) * src/image.c (_setjmp, _longjmp) [HAVE_PNG && !HAVE__SETJMP]: New macros. (png_load_body) [HAVE_PNG]: (PNG_LONGJMP) [HAVE_PNG && PNG_LIBPNG_VER < 10500]: (PNG_JMPBUF) [HAVE_PNG && PNG_LIBPNG_VER >= 10500]: Use _setjmp and _longjmp rather than sys_setjmp and sys_longjmp, since PNG requires jmp_buf. This is the only exception to the general rule that we now use sys_setjmp and sys_longjmp. This exception is OK since this code does not change the signal mask or longjmp out of a signal handler. Fixes: debbugs:12446
Diffstat (limited to 'src/process.c')
-rw-r--r--src/process.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/process.c b/src/process.c
index b4b05a4b2e2..6dbff6f4b16 100644
--- a/src/process.c
+++ b/src/process.c
@@ -25,12 +25,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
25 25
26#include <stdio.h> 26#include <stdio.h>
27#include <errno.h> 27#include <errno.h>
28#include <setjmp.h>
29#include <sys/types.h> /* Some typedefs are used in sys/file.h. */ 28#include <sys/types.h> /* Some typedefs are used in sys/file.h. */
30#include <sys/file.h> 29#include <sys/file.h>
31#include <sys/stat.h> 30#include <sys/stat.h>
32#include <setjmp.h>
33
34#include <unistd.h> 31#include <unistd.h>
35#include <fcntl.h> 32#include <fcntl.h>
36 33
@@ -5421,7 +5418,7 @@ read_process_output (Lisp_Object proc, register int channel)
5421 5418
5422/* Sending data to subprocess */ 5419/* Sending data to subprocess */
5423 5420
5424static jmp_buf send_process_frame; 5421static sys_jmp_buf send_process_frame;
5425static Lisp_Object process_sent_to; 5422static Lisp_Object process_sent_to;
5426 5423
5427static _Noreturn void 5424static _Noreturn void
@@ -5431,7 +5428,7 @@ handle_pipe_signal (int sig)
5431 sigemptyset (&unblocked); 5428 sigemptyset (&unblocked);
5432 sigaddset (&unblocked, SIGPIPE); 5429 sigaddset (&unblocked, SIGPIPE);
5433 pthread_sigmask (SIG_UNBLOCK, &unblocked, 0); 5430 pthread_sigmask (SIG_UNBLOCK, &unblocked, 0);
5434 _longjmp (send_process_frame, 1); 5431 sys_longjmp (send_process_frame, 1);
5435} 5432}
5436 5433
5437static void 5434static void
@@ -5640,7 +5637,7 @@ send_process (volatile Lisp_Object proc, const char *volatile buf,
5640 /* 2000-09-21: Emacs 20.7, sparc-sun-solaris-2.6, GCC 2.95.2, 5637 /* 2000-09-21: Emacs 20.7, sparc-sun-solaris-2.6, GCC 2.95.2,
5641 CFLAGS="-g -O": The value of the parameter `proc' is clobbered 5638 CFLAGS="-g -O": The value of the parameter `proc' is clobbered
5642 when returning with longjmp despite being declared volatile. */ 5639 when returning with longjmp despite being declared volatile. */
5643 if (!_setjmp (send_process_frame)) 5640 if (!sys_setjmp (send_process_frame))
5644 { 5641 {
5645 p = XPROCESS (proc); /* Repair any setjmp clobbering. */ 5642 p = XPROCESS (proc); /* Repair any setjmp clobbering. */
5646 process_sent_to = proc; 5643 process_sent_to = proc;