From cbfbffac50184091173ee2ac2d1114053532eef8 Mon Sep 17 00:00:00 2001 From: Giacomo Tesio Date: Fri, 22 Sep 2017 00:31:20 +0200 Subject: [PATCH] jehanne: add alarm, sigwait, sigtimedwait and sigwaitinfo --- newlib/libc/sys/jehanne/Makefile.am | 6 +++-- newlib/libc/sys/jehanne/Makefile.in | 33 +++++++++++++++++++++++--- newlib/libc/sys/jehanne/alarm.c | 27 +++++++++++++++++++++ newlib/libc/sys/jehanne/sigtimedwait.c | 28 ++++++++++++++++++++++ newlib/libc/sys/jehanne/sigwait.c | 31 ++++++++++++++++++++++++ newlib/libc/sys/jehanne/sigwaitinfo.c | 28 ++++++++++++++++++++++ 6 files changed, 148 insertions(+), 5 deletions(-) create mode 100644 newlib/libc/sys/jehanne/alarm.c create mode 100644 newlib/libc/sys/jehanne/sigtimedwait.c create mode 100644 newlib/libc/sys/jehanne/sigwait.c create mode 100644 newlib/libc/sys/jehanne/sigwaitinfo.c diff --git a/newlib/libc/sys/jehanne/Makefile.am b/newlib/libc/sys/jehanne/Makefile.am index ed1c68777..44332f44f 100644 --- a/newlib/libc/sys/jehanne/Makefile.am +++ b/newlib/libc/sys/jehanne/Makefile.am @@ -6,7 +6,8 @@ noinst_LIBRARIES = lib.a if MAY_SUPPLY_SYSCALLS extra_objs = syscalls.o libposix_conf.o chown.o getrusage.o ids.o \ - chmod.o sigsets.o sigaction.o sigsuspend.o + chmod.o sigsets.o sigaction.o sigsuspend.o sigwaitinfo.o \ + sigtimedwait.o sigwait.o alarm.o else extra_objs = endif @@ -16,7 +17,8 @@ lib_a_SOURCES = getenv_r.c getenv.c malloc.c mallocr.c free.c freer.c \ lib_a_LIBADD = $(extra_objs) EXTRA_lib_a_SOURCES = libposix_conf.c syscalls.c chown.c getrusage.c \ - ids.c chmod.c sigsets.c sigaction.c sigsuspend.c + ids.c chmod.c sigsets.c sigaction.c sigsuspend.c sigwaitinfo.c \ + sigtimedwait.c sigwait.c alarm.c lib_a_DEPENDENCIES = $(extra_objs) lib_a_CCASFLAGS = $(AM_CCASFLAGS) lib_a_CFLAGS = $(AM_CFLAGS) diff --git a/newlib/libc/sys/jehanne/Makefile.in b/newlib/libc/sys/jehanne/Makefile.in index 197245ebe..af5809513 100644 --- a/newlib/libc/sys/jehanne/Makefile.in +++ b/newlib/libc/sys/jehanne/Makefile.in @@ -54,7 +54,8 @@ lib_a_AR = $(AR) $(ARFLAGS) @MAY_SUPPLY_SYSCALLS_TRUE@am__DEPENDENCIES_1 = syscalls.o \ @MAY_SUPPLY_SYSCALLS_TRUE@ libposix_conf.o chown.o getrusage.o \ @MAY_SUPPLY_SYSCALLS_TRUE@ ids.o chmod.o sigsets.o sigaction.o \ -@MAY_SUPPLY_SYSCALLS_TRUE@ sigsuspend.o +@MAY_SUPPLY_SYSCALLS_TRUE@ sigsuspend.o sigwaitinfo.o \ +@MAY_SUPPLY_SYSCALLS_TRUE@ sigtimedwait.o sigwait.o alarm.o am_lib_a_OBJECTS = lib_a-getenv_r.$(OBJEXT) lib_a-getenv.$(OBJEXT) \ lib_a-malloc.$(OBJEXT) lib_a-mallocr.$(OBJEXT) \ lib_a-free.$(OBJEXT) lib_a-freer.$(OBJEXT) \ @@ -181,14 +182,16 @@ AM_CCASFLAGS = $(INCLUDES) noinst_LIBRARIES = lib.a @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@ chmod.o sigsets.o sigaction.o sigsuspend.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 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 lib_a_LIBADD = $(extra_objs) EXTRA_lib_a_SOURCES = libposix_conf.c syscalls.c chown.c getrusage.c \ - ids.c chmod.c sigsets.c sigaction.c sigsuspend.c + ids.c chmod.c sigsets.c sigaction.c sigsuspend.c sigwaitinfo.c \ + sigtimedwait.c sigwait.c alarm.c lib_a_DEPENDENCIES = $(extra_objs) lib_a_CCASFLAGS = $(AM_CCASFLAGS) @@ -383,6 +386,30 @@ lib_a-sigsuspend.o: sigsuspend.c lib_a-sigsuspend.obj: sigsuspend.c $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sigsuspend.obj `if test -f 'sigsuspend.c'; then $(CYGPATH_W) 'sigsuspend.c'; else $(CYGPATH_W) '$(srcdir)/sigsuspend.c'; fi` +lib_a-sigwaitinfo.o: sigwaitinfo.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sigwaitinfo.o `test -f 'sigwaitinfo.c' || echo '$(srcdir)/'`sigwaitinfo.c + +lib_a-sigwaitinfo.obj: sigwaitinfo.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sigwaitinfo.obj `if test -f 'sigwaitinfo.c'; then $(CYGPATH_W) 'sigwaitinfo.c'; else $(CYGPATH_W) '$(srcdir)/sigwaitinfo.c'; fi` + +lib_a-sigtimedwait.o: sigtimedwait.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sigtimedwait.o `test -f 'sigtimedwait.c' || echo '$(srcdir)/'`sigtimedwait.c + +lib_a-sigtimedwait.obj: sigtimedwait.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sigtimedwait.obj `if test -f 'sigtimedwait.c'; then $(CYGPATH_W) 'sigtimedwait.c'; else $(CYGPATH_W) '$(srcdir)/sigtimedwait.c'; fi` + +lib_a-sigwait.o: sigwait.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sigwait.o `test -f 'sigwait.c' || echo '$(srcdir)/'`sigwait.c + +lib_a-sigwait.obj: sigwait.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sigwait.obj `if test -f 'sigwait.c'; then $(CYGPATH_W) 'sigwait.c'; else $(CYGPATH_W) '$(srcdir)/sigwait.c'; fi` + +lib_a-alarm.o: alarm.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-alarm.o `test -f 'alarm.c' || echo '$(srcdir)/'`alarm.c + +lib_a-alarm.obj: alarm.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-alarm.obj `if test -f 'alarm.c'; then $(CYGPATH_W) 'alarm.c'; else $(CYGPATH_W) '$(srcdir)/alarm.c'; fi` + ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ diff --git a/newlib/libc/sys/jehanne/alarm.c b/newlib/libc/sys/jehanne/alarm.c new file mode 100644 index 000000000..84ee3334d --- /dev/null +++ b/newlib/libc/sys/jehanne/alarm.c @@ -0,0 +1,27 @@ +/* + * This file is part of Jehanne. + * + * Copyright (C) 2017 Giacomo Tesio + * + * 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 . + */ +#include + +unsigned int +alarm(unsigned int sec) +{ + extern unsigned int POSIX_alarm(int *errnop, unsigned int sec); + + int *errnop = &_REENT->_errno; + return POSIX_alarm(errnop, sec); +} diff --git a/newlib/libc/sys/jehanne/sigtimedwait.c b/newlib/libc/sys/jehanne/sigtimedwait.c new file mode 100644 index 000000000..50b104bf3 --- /dev/null +++ b/newlib/libc/sys/jehanne/sigtimedwait.c @@ -0,0 +1,28 @@ +/* + * This file is part of Jehanne. + * + * Copyright (C) 2017 Giacomo Tesio + * + * 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 . + */ +#include +#include +#include +#include + +int +sigtimedwait(const PosixSignalMask *set, PosixSignalInfo *info, const struct timespec *timeout) +{ + int *errnop = &_REENT->_errno; + return POSIX_sigtimedwait(errnop, set, info, timeout); +} diff --git a/newlib/libc/sys/jehanne/sigwait.c b/newlib/libc/sys/jehanne/sigwait.c new file mode 100644 index 000000000..da4c69c97 --- /dev/null +++ b/newlib/libc/sys/jehanne/sigwait.c @@ -0,0 +1,31 @@ +/* + * This file is part of Jehanne. + * + * Copyright (C) 2017 Giacomo Tesio + * + * 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 . + */ +#include +#include +#include +#include + +int +sigtimedwait(const PosixSignalMask *set, int *sig) +{ + int err; + PosixSignalInfo info; + if(POSIX_sigtimedwait(&err, set, &info, nil) > 0) + return 0; + return err; +} diff --git a/newlib/libc/sys/jehanne/sigwaitinfo.c b/newlib/libc/sys/jehanne/sigwaitinfo.c new file mode 100644 index 000000000..13f70057f --- /dev/null +++ b/newlib/libc/sys/jehanne/sigwaitinfo.c @@ -0,0 +1,28 @@ +/* + * This file is part of Jehanne. + * + * Copyright (C) 2017 Giacomo Tesio + * + * 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 . + */ +#include +#include +#include +#include + +int +sigwaitinfo(const PosixSignalMask *set, PosixSignalInfo *info) +{ + int *errnop = &_REENT->_errno; + return POSIX_sigtimedwait(errnop, set, info, nil); +}