Module: xenomai-3 Branch: wip/modechk Commit: 8535143c109b453d9021dd9626867388ad488801 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=8535143c109b453d9021dd9626867388ad488801
Author: Philippe Gerum <r...@xenomai.org> Date: Mon Mar 13 15:51:31 2017 +0100 lib/cobalt: modechk: rename assertion helper, fix header --- include/cobalt/stdio.h | 4 ---- include/cobalt/sys/cobalt.h | 6 ++++++ lib/cobalt/Makefile.am | 1 - lib/cobalt/assert_context.c | 40 ---------------------------------------- lib/cobalt/cxaguard.c | 9 ++++----- lib/cobalt/internal.c | 19 ++++++++++++++++++- lib/cobalt/malloc.c | 7 +++---- lib/cobalt/printf.c | 6 +++--- 8 files changed, 34 insertions(+), 58 deletions(-) diff --git a/include/cobalt/stdio.h b/include/cobalt/stdio.h index 81486d5..c915e6d 100644 --- a/include/cobalt/stdio.h +++ b/include/cobalt/stdio.h @@ -112,10 +112,6 @@ const char *rt_print_buffer_name(void); void rt_print_flush_buffers(void); -void assert_nrt(void); - -__deprecated void assert_nrt_fast(void); - #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/include/cobalt/sys/cobalt.h b/include/cobalt/sys/cobalt.h index e7c58d7..1da8a46 100644 --- a/include/cobalt/sys/cobalt.h +++ b/include/cobalt/sys/cobalt.h @@ -132,6 +132,12 @@ int cobalt_sched_weighted_prio(int policy, void cobalt_register_tsd_hook(struct cobalt_tsd_hook *th); +void cobalt_assert_nrt(void); + +/* Use cobalt_assert_nrt() instead of: */ +__deprecated void assert_nrt(void); +__deprecated void assert_nrt_fast(void); + extern int __cobalt_control_bind; #ifdef __cplusplus diff --git a/lib/cobalt/Makefile.am b/lib/cobalt/Makefile.am index 6275eb4..c2d5956 100644 --- a/lib/cobalt/Makefile.am +++ b/lib/cobalt/Makefile.am @@ -14,7 +14,6 @@ libcobalt_la_LIBADD = \ ../boilerplate/libboilerplate.la libcobalt_la_SOURCES = \ - assert_context.c \ attr.c \ clock.c \ cond.c \ diff --git a/lib/cobalt/assert_context.c b/lib/cobalt/assert_context.c deleted file mode 100644 index 11739db..0000000 --- a/lib/cobalt/assert_context.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2008, 2009 Jan Kiszka <jan.kis...@siemens.com>. - * - * 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; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ - -#include <sys/time.h> -#include <signal.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> -#include <stdio.h> -#include <errno.h> -#include <cobalt/uapi/thread.h> -#include <asm/xenomai/syscall.h> -#include "current.h" -#include "internal.h" - -void assert_nrt(void) -{ - if (cobalt_should_warn()) - pthread_kill(pthread_self(), SIGDEBUG); -} - -void assert_nrt_fast(void) /* OBSOLETE */ -{ - assert_nrt(); -} diff --git a/lib/cobalt/cxaguard.c b/lib/cobalt/cxaguard.c index 13432af..6df471a 100644 --- a/lib/cobalt/cxaguard.c +++ b/lib/cobalt/cxaguard.c @@ -16,10 +16,9 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ #include <stdint.h> +#include <cobalt/sys/cobalt.h> #include <cobalt/wrappers.h> -void assert_nrt(void); - #ifdef __ARM_EABI__ typedef uint32_t __cxa_guard_type; #else @@ -32,7 +31,7 @@ int __real_cxa_guard_acquire(__cxa_guard_type *g); /* CXXABI 3.3.2 One-time Construction API */ COBALT_IMPL(int, __cxa_guard_acquire, (__cxa_guard_type *g)) { - assert_nrt(); + cobalt_assert_nrt(); return __STD(__cxa_guard_acquire(g)); } @@ -41,7 +40,7 @@ void __real_cxa_guard_release(__cxa_guard_type *g); COBALT_IMPL(void, __cxa_guard_release, (__cxa_guard_type *g)) { - assert_nrt(); + cobalt_assert_nrt(); __STD(__cxa_guard_release(g)); } @@ -50,6 +49,6 @@ void __real_cxa_guard_abort(__cxa_guard_type *g); COBALT_IMPL(void, __cxa_guard_abort, (__cxa_guard_type *g)) { - assert_nrt(); + cobalt_assert_nrt(); __STD(__cxa_guard_abort(g)); } diff --git a/lib/cobalt/internal.c b/lib/cobalt/internal.c index 5b89db5..49744c4 100644 --- a/lib/cobalt/internal.c +++ b/lib/cobalt/internal.c @@ -1,5 +1,6 @@ /* * Copyright (C) 2011 Philippe Gerum <r...@xenomai.org>. + * Copyright (C) 2008, 2009 Jan Kiszka <jan.kis...@siemens.com>. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -30,7 +31,7 @@ #include <stdarg.h> #include <pthread.h> #include <asm/xenomai/syscall.h> -#include "current.h" +#include <cobalt/sys/cobalt.h> #include "internal.h" int cobalt_extend(unsigned int magic) @@ -514,3 +515,19 @@ int cobalt_sched_weighted_prio(int policy, { return XENOMAI_SYSCALL2(sc_cobalt_sched_weightprio, policy, param_ex); } + + +/* + * Temporary compatibility aliases which should be phased out at next + * API revision. + */ +void assert_nrt(void) +__attribute__((alias("cobalt_assert_nrt"))); +void assert_nrt_fast(void) +__attribute__((alias("cobalt_assert_nrt"))); + +void cobalt_assert_nrt(void) +{ + if (cobalt_should_warn()) + pthread_kill(pthread_self(), SIGDEBUG); +} diff --git a/lib/cobalt/malloc.c b/lib/cobalt/malloc.c index 3f39d06..82f89fd 100644 --- a/lib/cobalt/malloc.c +++ b/lib/cobalt/malloc.c @@ -16,18 +16,17 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ #include <stdlib.h> - -void assert_nrt(void); +#include <cobalt/sys/cobalt.h> /* Memory allocation services */ COBALT_IMPL(void *, malloc, (size_t size)) { - assert_nrt(); + cobalt_assert_nrt(); return __STD(malloc(size)); } COBALT_IMPL(void, free, (void *ptr)) { - assert_nrt(); + cobalt_assert_nrt(); __STD(free(ptr)); } diff --git a/lib/cobalt/printf.c b/lib/cobalt/printf.c index 87cd5e2..330c964 100644 --- a/lib/cobalt/printf.c +++ b/lib/cobalt/printf.c @@ -29,7 +29,7 @@ #include <boilerplate/atomic.h> #include <boilerplate/compiler.h> #include <cobalt/tunables.h> -#include "current.h" +#include <cobalt/sys/cobalt.h> #include "internal.h" #define RT_PRINT_DEFAULT_BUFFER 16*1024 @@ -442,7 +442,7 @@ int rt_print_init(size_t buffer_size, const char *buffer_name) not_found: if (!buffer) { - assert_nrt(); + cobalt_assert_nrt(); buffer = malloc(sizeof(*buffer)); if (!buffer) @@ -493,7 +493,7 @@ static void release_buffer(struct print_buffer *buffer) unsigned long old_bitmap, bitmap; unsigned int i, j; - assert_nrt(); + cobalt_assert_nrt(); pthread_setspecific(buffer_key, NULL); _______________________________________________ Xenomai-git mailing list Xenomai-git@xenomai.org https://xenomai.org/mailman/listinfo/xenomai-git