From 2d654800fd6b7aaa57dbffc3a5881c31b6b2642b Mon Sep 17 00:00:00 2001 From: Costin Lupu Date: Fri, 6 Dec 2019 15:12:31 +0200 Subject: [PATCH] Add pthread_condattr_{get, set}clock() stubs Signed-off-by: Costin Lupu Reviewed-by: Vlad-Andrei Badoiu --- Makefile.uk | 1 + include/pthread.h | 4 ++++ pthread_condattr.c | 41 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+) create mode 100644 pthread_condattr.c diff --git a/Makefile.uk b/Makefile.uk index 90626e8..89eb345 100644 --- a/Makefile.uk +++ b/Makefile.uk @@ -68,6 +68,7 @@ LIBPTHREAD-EMBEDDED_SRCS-y += $(LIBPTHREAD-EMBEDDED_BASE)/pte_osal.c|glue LIBPTHREAD-EMBEDDED_SRCS-y += $(LIBPTHREAD-EMBEDDED_BASE)/attributes.c|glue LIBPTHREAD-EMBEDDED_SRCS-y += $(LIBPTHREAD-EMBEDDED_BASE)/pthread_atfork.c|glue LIBPTHREAD-EMBEDDED_SRCS-y += $(LIBPTHREAD-EMBEDDED_BASE)/pthread_sigmask.c|glue +LIBPTHREAD-EMBEDDED_SRCS-y += $(LIBPTHREAD-EMBEDDED_BASE)/pthread_condattr.c|glue ################################################################################ # pthread-embedded code diff --git a/include/pthread.h b/include/pthread.h index a71fe34..077017e 100644 --- a/include/pthread.h +++ b/include/pthread.h @@ -57,6 +57,10 @@ int pthread_setname_np(pthread_t thread, const char *name); int pthread_getname_np(pthread_t thread, char *name, size_t len); #endif /* _GNU_SOURCE */ +int pthread_condattr_getclock(const pthread_condattr_t *__restrict attr, + clockid_t *__restrict clock_id); +int pthread_condattr_setclock(pthread_condattr_t *attr, clockid_t clock_id); + #ifdef __cplusplus } #endif diff --git a/pthread_condattr.c b/pthread_condattr.c new file mode 100644 index 0000000..53dcc64 --- /dev/null +++ b/pthread_condattr.c @@ -0,0 +1,41 @@ +/* SPDX-License-Identifier: LGPL-2.0-or-later */ +/* + * Unikraft port of POSIX Threads Library for embedded systems + * Copyright(C) 2019 Costin Lupu, University Politehnica of Bucharest + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library in the file COPYING.LIB; + * if not, write to the Free Software Foundation, Inc., + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include +#include +#include +#include + + +int pthread_condattr_getclock(const pthread_condattr_t *__restrict attr, + clockid_t *__restrict clock_id) +{ + WARN_STUBBED(); + errno = ENOTSUP; + return -1; +} + +int pthread_condattr_setclock(pthread_condattr_t *attr, clockid_t clock_id) +{ + WARN_STUBBED(); + errno = ENOTSUP; + return -1; +} -- 2.39.5