diff options
Diffstat (limited to 'newlib/libc')
-rw-r--r-- | newlib/libc/sys/linux/Makefile.am | 3 | ||||
-rw-r--r-- | newlib/libc/sys/linux/Makefile.in | 13 | ||||
-rw-r--r-- | newlib/libc/sys/linux/include/setjmp.h | 39 | ||||
-rw-r--r-- | newlib/libc/sys/linux/siglongjmp.c | 16 |
4 files changed, 64 insertions, 7 deletions
diff --git a/newlib/libc/sys/linux/Makefile.am b/newlib/libc/sys/linux/Makefile.am index a3a0bbe89..aa020f0e2 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 56efb7cd2..22600b64b 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 000000000..04a9536ee --- /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 000000000..075ed4421 --- /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); +} |