jehanne: add alarm, sigwait, sigtimedwait and sigwaitinfo

This commit is contained in:
2017-09-22 00:31:20 +02:00
parent b52a46870f
commit cbfbffac50
6 changed files with 148 additions and 5 deletions

View File

@ -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)

View File

@ -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 \

View File

@ -0,0 +1,27 @@
/*
* 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 <reent.h>
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);
}

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 <u.h>
#include <libc.h>
#include <posix.h>
#include <reent.h>
int
sigtimedwait(const PosixSignalMask *set, PosixSignalInfo *info, const struct timespec *timeout)
{
int *errnop = &_REENT->_errno;
return POSIX_sigtimedwait(errnop, set, info, timeout);
}

View File

@ -0,0 +1,31 @@
/*
* 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 <u.h>
#include <libc.h>
#include <posix.h>
#include <reent.h>
int
sigtimedwait(const PosixSignalMask *set, int *sig)
{
int err;
PosixSignalInfo info;
if(POSIX_sigtimedwait(&err, set, &info, nil) > 0)
return 0;
return err;
}

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 <u.h>
#include <libc.h>
#include <posix.h>
#include <reent.h>
int
sigwaitinfo(const PosixSignalMask *set, PosixSignalInfo *info)
{
int *errnop = &_REENT->_errno;
return POSIX_sigtimedwait(errnop, set, info, nil);
}