aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--newlib/ChangeLog8
-rw-r--r--newlib/libc/sys/linux/Makefile.am3
-rw-r--r--newlib/libc/sys/linux/Makefile.in13
-rw-r--r--newlib/libc/sys/linux/include/setjmp.h39
-rw-r--r--newlib/libc/sys/linux/siglongjmp.c16
5 files changed, 72 insertions, 7 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog
index 2ad6147..69123c8 100644
--- a/newlib/ChangeLog
+++ b/newlib/ChangeLog
@@ -1,3 +1,11 @@
+2002-04-08 Jeff Johnston <jjohnstn@redhat.com>
+
+ * libc/sys/linux/include/setjmp.h: Add sigjmp_buf type,
+ siglongjmp prototype, and sigsetjmp macro definition.
+ * libc/sys/linux/siglongjmp.c: New file.
+ * libc/sys/linux/Makefile.am: Add support for siglongjmp.
+ * libc/sys/linux/Makefile.in: Regenerated.
+
2002-04-04 Jeff Johnston <jjohnstn@redhat.com>
* Makefile.am: Add support for installing crt1.o if one exists.
diff --git a/newlib/libc/sys/linux/Makefile.am b/newlib/libc/sys/linux/Makefile.am
index a3a0bbe..aa020f0 100644
--- a/newlib/libc/sys/linux/Makefile.am
+++ b/newlib/libc/sys/linux/Makefile.am
@@ -9,7 +9,8 @@ SUBLIBS = $(LINUX_MACH_LIB)
LIB_SOURCES = \
brk.c getoptlong.c ids.c inode.c io.c linux.c process.c realpath.c \
- select.c signal.c socket.c sleep.c stack.c sysconf.c systat.c termios.c time.c \
+ select.c signal.c siglongjmp.c socket.c sleep.c stack.c \
+ sysconf.c systat.c termios.c time.c \
usleep.c wait.c
# This will handle both /usr/src/linux-2.4/include/asm/signal.h (in Red Hat Linux 7.1)
diff --git a/newlib/libc/sys/linux/Makefile.in b/newlib/libc/sys/linux/Makefile.in
index 56efb7c..22600b6 100644
--- a/newlib/libc/sys/linux/Makefile.in
+++ b/newlib/libc/sys/linux/Makefile.in
@@ -94,7 +94,8 @@ SUBLIBS = $(LINUX_MACH_LIB)
LIB_SOURCES = \
brk.c getoptlong.c ids.c inode.c io.c linux.c process.c realpath.c \
- select.c signal.c socket.c sleep.c stack.c sysconf.c systat.c termios.c time.c \
+ select.c signal.c siglongjmp.c socket.c sleep.c stack.c \
+ sysconf.c systat.c termios.c time.c \
usleep.c wait.c
@@ -127,16 +128,16 @@ CPPFLAGS = @CPPFLAGS@
LIBS = @LIBS@
@USE_LIBTOOL_FALSE@lib_a_OBJECTS = brk.o getoptlong.o ids.o inode.o \
@USE_LIBTOOL_FALSE@io.o linux.o process.o realpath.o select.o signal.o \
-@USE_LIBTOOL_FALSE@socket.o sleep.o stack.o sysconf.o systat.o \
-@USE_LIBTOOL_FALSE@termios.o time.o usleep.o wait.o
+@USE_LIBTOOL_FALSE@siglongjmp.o socket.o sleep.o stack.o sysconf.o \
+@USE_LIBTOOL_FALSE@systat.o termios.o time.o usleep.o wait.o
LTLIBRARIES = $(noinst_LTLIBRARIES)
@USE_LIBTOOL_TRUE@liblinux_la_DEPENDENCIES =
@USE_LIBTOOL_TRUE@liblinux_la_OBJECTS = brk.lo getoptlong.lo ids.lo \
@USE_LIBTOOL_TRUE@inode.lo io.lo linux.lo process.lo realpath.lo \
-@USE_LIBTOOL_TRUE@select.lo signal.lo socket.lo sleep.lo stack.lo \
-@USE_LIBTOOL_TRUE@sysconf.lo systat.lo termios.lo time.lo usleep.lo \
-@USE_LIBTOOL_TRUE@wait.lo
+@USE_LIBTOOL_TRUE@select.lo signal.lo siglongjmp.lo socket.lo sleep.lo \
+@USE_LIBTOOL_TRUE@stack.lo sysconf.lo systat.lo termios.lo time.lo \
+@USE_LIBTOOL_TRUE@usleep.lo wait.lo
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
diff --git a/newlib/libc/sys/linux/include/setjmp.h b/newlib/libc/sys/linux/include/setjmp.h
new file mode 100644
index 0000000..04a9536
--- /dev/null
+++ b/newlib/libc/sys/linux/include/setjmp.h
@@ -0,0 +1,39 @@
+/*
+ setjmp.h
+ stubs for future use.
+*/
+
+#ifndef _SETJMP_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+#define _SETJMP_H_
+
+#include "_ansi.h"
+#include <machine/setjmp.h>
+#include <signal.h> /* for sigset_t and sigprocmask */
+
+typedef struct __sigjmpbuf
+{
+ jmp_buf __buf;
+ int __is_mask_saved;
+ sigset_t __saved_mask;
+} sigjmp_buf;
+
+void _EXFUN(longjmp,(jmp_buf __jmpb, int __retval));
+int _EXFUN(setjmp,(jmp_buf __jmpb));
+void _EXFUN(siglongjmp,(sigjmp_buf __jmpb, int __retval));
+int _EXFUN(sigsetjmp,(sigjmp_buf __jmpb, int __savemask));
+
+/* sigsetjmp is implemented as macro using setjmp */
+
+#define sigsetjmp(__jmpb, __savemask) \
+ ( __jmpb.__is_mask_saved = __savemask && \
+ (sigprocmask (SIG_BLOCK, NULL, &__jmpb.__saved_mask) == 0), \
+ setjmp (__jmpb.__buf) )
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* _SETJMP_H_ */
+
diff --git a/newlib/libc/sys/linux/siglongjmp.c b/newlib/libc/sys/linux/siglongjmp.c
new file mode 100644
index 0000000..075ed44
--- /dev/null
+++ b/newlib/libc/sys/linux/siglongjmp.c
@@ -0,0 +1,16 @@
+/* libc/sys/linux/siglongjmp.c - siglongjmp function */
+
+/* Copyright 2002, Red Hat Inc. */
+
+
+#include <setjmp.h>
+#include <signal.h>
+
+void
+siglongjmp (sigjmp_buf env, int val)
+{
+ if (env.__is_mask_saved)
+ sigprocmask (SIG_SETMASK, &env.__saved_mask, NULL);
+
+ longjmp (env.__buf, val);
+}