jehanne: siglongjmp

This commit is contained in:
2017-09-24 16:35:57 +02:00
parent 9369c56b97
commit d094dcaecf
4 changed files with 40 additions and 6 deletions

View File

@ -7,7 +7,7 @@ noinst_LIBRARIES = lib.a
if MAY_SUPPLY_SYSCALLS if MAY_SUPPLY_SYSCALLS
extra_objs = syscalls.o libposix_conf.o chown.o getrusage.o ids.o \ extra_objs = syscalls.o libposix_conf.o chown.o getrusage.o ids.o \
chmod.o sigsets.o sigaction.o sigsuspend.o sigwaitinfo.o \ chmod.o sigsets.o sigaction.o sigsuspend.o sigwaitinfo.o \
sigtimedwait.o sigwait.o alarm.o sigqueue.o sigtimedwait.o sigwait.o alarm.o sigqueue.o siglongjmp.o
else else
extra_objs = extra_objs =
endif endif
@ -18,7 +18,7 @@ lib_a_SOURCES = getenv_r.c getenv.c malloc.c mallocr.c free.c freer.c \
lib_a_LIBADD = $(extra_objs) lib_a_LIBADD = $(extra_objs)
EXTRA_lib_a_SOURCES = libposix_conf.c syscalls.c chown.c getrusage.c \ EXTRA_lib_a_SOURCES = libposix_conf.c syscalls.c chown.c getrusage.c \
ids.c chmod.c sigsets.c sigaction.c sigsuspend.c sigwaitinfo.c \ ids.c chmod.c sigsets.c sigaction.c sigsuspend.c sigwaitinfo.c \
sigtimedwait.c sigwait.c alarm.c sigqueue.c sigtimedwait.c sigwait.c alarm.c sigqueue.c siglongjmp.c
lib_a_DEPENDENCIES = $(extra_objs) lib_a_DEPENDENCIES = $(extra_objs)
lib_a_CCASFLAGS = $(AM_CCASFLAGS) lib_a_CCASFLAGS = $(AM_CCASFLAGS)
lib_a_CFLAGS = $(AM_CFLAGS) lib_a_CFLAGS = $(AM_CFLAGS)

View File

@ -56,7 +56,7 @@ lib_a_AR = $(AR) $(ARFLAGS)
@MAY_SUPPLY_SYSCALLS_TRUE@ ids.o chmod.o sigsets.o sigaction.o \ @MAY_SUPPLY_SYSCALLS_TRUE@ ids.o chmod.o sigsets.o sigaction.o \
@MAY_SUPPLY_SYSCALLS_TRUE@ sigsuspend.o sigwaitinfo.o \ @MAY_SUPPLY_SYSCALLS_TRUE@ sigsuspend.o sigwaitinfo.o \
@MAY_SUPPLY_SYSCALLS_TRUE@ sigtimedwait.o sigwait.o alarm.o \ @MAY_SUPPLY_SYSCALLS_TRUE@ sigtimedwait.o sigwait.o alarm.o \
@MAY_SUPPLY_SYSCALLS_TRUE@ sigqueue.o @MAY_SUPPLY_SYSCALLS_TRUE@ sigqueue.o siglongjmp.o
am_lib_a_OBJECTS = lib_a-getenv_r.$(OBJEXT) lib_a-getenv.$(OBJEXT) \ am_lib_a_OBJECTS = lib_a-getenv_r.$(OBJEXT) lib_a-getenv.$(OBJEXT) \
lib_a-malloc.$(OBJEXT) lib_a-mallocr.$(OBJEXT) \ lib_a-malloc.$(OBJEXT) lib_a-mallocr.$(OBJEXT) \
lib_a-free.$(OBJEXT) lib_a-freer.$(OBJEXT) \ lib_a-free.$(OBJEXT) lib_a-freer.$(OBJEXT) \
@ -184,7 +184,7 @@ noinst_LIBRARIES = lib.a
@MAY_SUPPLY_SYSCALLS_FALSE@extra_objs = @MAY_SUPPLY_SYSCALLS_FALSE@extra_objs =
@MAY_SUPPLY_SYSCALLS_TRUE@extra_objs = syscalls.o libposix_conf.o chown.o getrusage.o ids.o \ @MAY_SUPPLY_SYSCALLS_TRUE@extra_objs = syscalls.o libposix_conf.o chown.o getrusage.o ids.o \
@MAY_SUPPLY_SYSCALLS_TRUE@ chmod.o sigsets.o sigaction.o sigsuspend.o sigwaitinfo.o \ @MAY_SUPPLY_SYSCALLS_TRUE@ chmod.o sigsets.o sigaction.o sigsuspend.o sigwaitinfo.o \
@MAY_SUPPLY_SYSCALLS_TRUE@ sigtimedwait.o sigwait.o alarm.o sigqueue.o @MAY_SUPPLY_SYSCALLS_TRUE@ sigtimedwait.o sigwait.o alarm.o sigqueue.o siglongjmp.o
lib_a_SOURCES = getenv_r.c getenv.c malloc.c mallocr.c free.c freer.c \ lib_a_SOURCES = getenv_r.c getenv.c malloc.c mallocr.c free.c freer.c \
calloc.c callocr.c realloc.c reallocr.c environ.c signal.c calloc.c callocr.c realloc.c reallocr.c environ.c signal.c
@ -192,7 +192,7 @@ lib_a_SOURCES = getenv_r.c getenv.c malloc.c mallocr.c free.c freer.c \
lib_a_LIBADD = $(extra_objs) lib_a_LIBADD = $(extra_objs)
EXTRA_lib_a_SOURCES = libposix_conf.c syscalls.c chown.c getrusage.c \ EXTRA_lib_a_SOURCES = libposix_conf.c syscalls.c chown.c getrusage.c \
ids.c chmod.c sigsets.c sigaction.c sigsuspend.c sigwaitinfo.c \ ids.c chmod.c sigsets.c sigaction.c sigsuspend.c sigwaitinfo.c \
sigtimedwait.c sigwait.c alarm.c sigqueue.c sigtimedwait.c sigwait.c alarm.c sigqueue.c siglongjmp.c
lib_a_DEPENDENCIES = $(extra_objs) lib_a_DEPENDENCIES = $(extra_objs)
lib_a_CCASFLAGS = $(AM_CCASFLAGS) lib_a_CCASFLAGS = $(AM_CCASFLAGS)
@ -417,6 +417,12 @@ lib_a-sigqueue.o: sigqueue.c
lib_a-sigqueue.obj: sigqueue.c lib_a-sigqueue.obj: sigqueue.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sigqueue.obj `if test -f 'sigqueue.c'; then $(CYGPATH_W) 'sigqueue.c'; else $(CYGPATH_W) '$(srcdir)/sigqueue.c'; fi` $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sigqueue.obj `if test -f 'sigqueue.c'; then $(CYGPATH_W) 'sigqueue.c'; else $(CYGPATH_W) '$(srcdir)/sigqueue.c'; fi`
lib_a-siglongjmp.o: siglongjmp.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-siglongjmp.o `test -f 'siglongjmp.c' || echo '$(srcdir)/'`siglongjmp.c
lib_a-siglongjmp.obj: siglongjmp.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-siglongjmp.obj `if test -f 'siglongjmp.c'; then $(CYGPATH_W) 'siglongjmp.c'; else $(CYGPATH_W) '$(srcdir)/siglongjmp.c'; fi`
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \ unique=`for i in $$list; do \

View File

@ -22,7 +22,7 @@ extern "C" {
#endif #endif
#define _SETJMP_H_ #define _SETJMP_H_
typedef uintptr_t jmp_buf[8]; /* we use newlib's x86_64 functions */ typedef unsigned long jmp_buf[8]; /* we use newlib's x86_64 functions */
#include <signal.h> /* for sigset_t and sigprocmask */ #include <signal.h> /* for sigset_t and sigprocmask */

View File

@ -0,0 +1,28 @@
/*
* This file is part of Jehanne.
*
* Copyright (C) 2017 Giacomo Tesio <giacomo@tesio.it>
*
* This is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, version 3 of the License.
*
* Jehanne is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Jehanne. If not, see <http://www.gnu.org/licenses/>.
*/
#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);
}