Module: xenomai-forge Branch: next Commit: 3ad06859e45dc7f0b2e634a46cb3a2500957ddc9 URL: http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=3ad06859e45dc7f0b2e634a46cb3a2500957ddc9
Author: Philippe Gerum <r...@xenomai.org> Date: Thu Jul 3 18:06:14 2014 +0200 lib/cobalt: export low level Cobalt core interface Some inner Cobalt services may be useful for building Cobalt-specific portions of out-of-tree APIs. We expose them in sys/cobalt.h, with NO guarantee whatsoever on the stability of such interface in future releases. --- include/cobalt/Makefile.am | 1 - include/cobalt/Makefile.in | 1 - include/cobalt/cobalt.h | 43 ------------- include/cobalt/sys/Makefile.am | 1 + include/cobalt/sys/Makefile.in | 1 + include/cobalt/sys/cobalt.h | 137 ++++++++++++++++++++++++++++++++++++++++ lib/cobalt/internal.h | 97 +--------------------------- 7 files changed, 140 insertions(+), 141 deletions(-) diff --git a/include/cobalt/Makefile.am b/include/cobalt/Makefile.am index f2e5e17..e2d7f87 100644 --- a/include/cobalt/Makefile.am +++ b/include/cobalt/Makefile.am @@ -1,7 +1,6 @@ includesubdir = $(includedir)/cobalt includesub_HEADERS = \ - cobalt.h \ fcntl.h \ mqueue.h \ pthread.h \ diff --git a/include/cobalt/Makefile.in b/include/cobalt/Makefile.in index 3507802..c4edf30 100644 --- a/include/cobalt/Makefile.in +++ b/include/cobalt/Makefile.in @@ -372,7 +372,6 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ includesubdir = $(includedir)/cobalt includesub_HEADERS = \ - cobalt.h \ fcntl.h \ mqueue.h \ pthread.h \ diff --git a/include/cobalt/cobalt.h b/include/cobalt/cobalt.h deleted file mode 100644 index 63a9771..0000000 --- a/include/cobalt/cobalt.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2014 Philippe Gerum <r...@xenomai.org>. - * - * 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. - */ -#ifndef _COBALT_COBALT_H -#define _COBALT_COBALT_H - -#include <sys/types.h> -#include <cobalt/uapi/thread.h> - -#define cobalt_commit_memory(p) __cobalt_commit_memory(p, sizeof(*p)) - -#ifdef __cplusplus -extern "C" { -#endif - -int cobalt_thread_stat(pid_t pid, - struct cobalt_threadstat *stat); - -int cobalt_serial_debug(const char *fmt, ...); - -size_t cobalt_get_stacksize(size_t size); - -void __cobalt_commit_memory(void *p, size_t len); - -#ifdef __cplusplus -} -#endif - -#endif /* !_COBALT_COBALT_H */ diff --git a/include/cobalt/sys/Makefile.am b/include/cobalt/sys/Makefile.am index 6923b35..12e4205 100644 --- a/include/cobalt/sys/Makefile.am +++ b/include/cobalt/sys/Makefile.am @@ -1,6 +1,7 @@ includesubdir = $(includedir)/cobalt/sys includesub_HEADERS = \ + cobalt.h \ ioctl.h \ select.h \ socket.h \ diff --git a/include/cobalt/sys/Makefile.in b/include/cobalt/sys/Makefile.in index 999fa28..043649b 100644 --- a/include/cobalt/sys/Makefile.in +++ b/include/cobalt/sys/Makefile.in @@ -330,6 +330,7 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ includesubdir = $(includedir)/cobalt/sys includesub_HEADERS = \ + cobalt.h \ ioctl.h \ select.h \ socket.h \ diff --git a/include/cobalt/sys/cobalt.h b/include/cobalt/sys/cobalt.h new file mode 100644 index 0000000..19b7549 --- /dev/null +++ b/include/cobalt/sys/cobalt.h @@ -0,0 +1,137 @@ +/* + * Copyright (C) 2014 Philippe Gerum <r...@xenomai.org>. + * + * 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. + */ +#ifndef _COBALT_SYS_COBALT_H +#define _COBALT_SYS_COBALT_H + +#include <sys/types.h> +#include <signal.h> +#include <pthread.h> +#include <sched.h> +#include <semaphore.h> +#include <errno.h> +#include <stdio.h> +#include <time.h> +#include <nocore/atomic.h> +#include <cobalt/uapi/kernel/synch.h> +#include <cobalt/uapi/kernel/vdso.h> +#include <cobalt/uapi/mutex.h> +#include <cobalt/uapi/event.h> +#include <cobalt/uapi/monitor.h> +#include <cobalt/uapi/thread.h> +#include <cobalt/uapi/cond.h> +#include <cobalt/uapi/sem.h> +#include <boilerplate/list.h> + +#define report_error(fmt, args...) \ + __STD(fprintf(stderr, "Xenomai/cobalt: %s(): " fmt "\n", __func__, ##args)) + +#define report_error_cont(fmt, args...) \ + __STD(fprintf(stderr, " " fmt "\n", ##args)) + +#define cobalt_commit_memory(p) __cobalt_commit_memory(p, sizeof(*p)) + +struct cobalt_tsd_hook { + void (*create_tsd)(void); + void (*delete_tsd)(void); + struct pvholder next; +}; + +#ifdef __cplusplus +extern "C" { +#endif + +int cobalt_thread_stat(pid_t pid, + struct cobalt_threadstat *stat); + +int cobalt_serial_debug(const char *fmt, ...); + +size_t cobalt_get_stacksize(size_t size); + +void __cobalt_commit_memory(void *p, size_t len); + +void cobalt_thread_harden(void); + +int cobalt_thread_join(pthread_t thread); + +pid_t cobalt_thread_pid(pthread_t thread); + +int cobalt_monitor_init(cobalt_monitor_t *mon, + clockid_t clk_id, int flags); + +int cobalt_monitor_destroy(cobalt_monitor_t *mon); + +int cobalt_monitor_enter(cobalt_monitor_t *mon); + +int cobalt_monitor_exit(cobalt_monitor_t *mon); + +int cobalt_monitor_wait(cobalt_monitor_t *mon, int event, + const struct timespec *ts); + +void cobalt_monitor_grant(cobalt_monitor_t *mon, + struct xnthread_user_window *u_window); + +int cobalt_monitor_grant_sync(cobalt_monitor_t *mon, + struct xnthread_user_window *u_window); + +void cobalt_monitor_grant_all(cobalt_monitor_t *mon); + +int cobalt_monitor_grant_all_sync(cobalt_monitor_t *mon); + +void cobalt_monitor_drain(cobalt_monitor_t *mon); + +int cobalt_monitor_drain_sync(cobalt_monitor_t *mon); + +void cobalt_monitor_drain_all(cobalt_monitor_t *mon); + +int cobalt_monitor_drain_all_sync(cobalt_monitor_t *mon); + +int cobalt_event_init(cobalt_event_t *event, + unsigned long value, + int flags); + +int cobalt_event_post(cobalt_event_t *event, + unsigned long bits); + +int cobalt_event_wait(cobalt_event_t *event, + unsigned long bits, + unsigned long *bits_r, + int mode, + const struct timespec *timeout); + +unsigned long cobalt_event_clear(cobalt_event_t *event, + unsigned long bits); + +int cobalt_event_inquire(cobalt_event_t *event, + struct cobalt_event_info *info, + pid_t *waitlist, size_t waitsz); + +int cobalt_event_destroy(cobalt_event_t *event); + +int cobalt_sem_inquire(sem_t *sem, struct cobalt_sem_info *info, + pid_t *waitlist, size_t waitsz); + +int cobalt_sched_weighted_prio(int policy, + const struct sched_param_ex *param_ex); + +void cobalt_register_tsd_hook(struct cobalt_tsd_hook *th); + +#ifdef __cplusplus +} +#endif + +#endif /* !_COBALT_SYS_COBALT_H */ diff --git a/lib/cobalt/internal.h b/lib/cobalt/internal.h index 02af018..ba55033 100644 --- a/lib/cobalt/internal.h +++ b/lib/cobalt/internal.h @@ -18,38 +18,9 @@ #ifndef _LIB_COBALT_INTERNAL_H #define _LIB_COBALT_INTERNAL_H -#include <signal.h> -#include <pthread.h> -#include <sched.h> -#include <semaphore.h> -#include <errno.h> -#include <time.h> -#include <nocore/atomic.h> -#include <cobalt/uapi/kernel/synch.h> -#include <cobalt/uapi/kernel/vdso.h> -#include <cobalt/uapi/mutex.h> -#include <cobalt/uapi/event.h> -#include <cobalt/uapi/monitor.h> -#include <cobalt/uapi/thread.h> -#include <cobalt/uapi/cond.h> -#include <cobalt/uapi/sem.h> -#include <cobalt/cobalt.h> -#include <xeno_config.h> -#include <boilerplate/list.h> +#include <cobalt/sys/cobalt.h> #include "current.h" -#define report_error(fmt, args...) \ - __STD(fprintf(stderr, "Xenomai/cobalt: %s(): " fmt "\n", __func__, ##args)) - -#define report_error_cont(fmt, args...) \ - __STD(fprintf(stderr, " " fmt "\n", ##args)) - -struct cobalt_tsd_hook { - void (*create_tsd)(void); - void (*delete_tsd)(void); - struct pvholder next; -}; - extern unsigned long cobalt_sem_heap[2]; void cobalt_sigshadow_install_once(void); @@ -67,70 +38,6 @@ static inline atomic_long_t *mutex_get_ownerp(struct cobalt_mutex_shadow *shadow return &mutex_get_datp(shadow)->owner; } -void cobalt_thread_harden(void); - -int cobalt_thread_join(pthread_t thread); - -pid_t cobalt_thread_pid(pthread_t thread); - -int cobalt_monitor_init(cobalt_monitor_t *mon, - clockid_t clk_id, int flags); - -int cobalt_monitor_destroy(cobalt_monitor_t *mon); - -int cobalt_monitor_enter(cobalt_monitor_t *mon); - -int cobalt_monitor_exit(cobalt_monitor_t *mon); - -int cobalt_monitor_wait(cobalt_monitor_t *mon, int event, - const struct timespec *ts); - -void cobalt_monitor_grant(cobalt_monitor_t *mon, - struct xnthread_user_window *u_window); - -int cobalt_monitor_grant_sync(cobalt_monitor_t *mon, - struct xnthread_user_window *u_window); - -void cobalt_monitor_grant_all(cobalt_monitor_t *mon); - -int cobalt_monitor_grant_all_sync(cobalt_monitor_t *mon); - -void cobalt_monitor_drain(cobalt_monitor_t *mon); - -int cobalt_monitor_drain_sync(cobalt_monitor_t *mon); - -void cobalt_monitor_drain_all(cobalt_monitor_t *mon); - -int cobalt_monitor_drain_all_sync(cobalt_monitor_t *mon); - -int cobalt_event_init(cobalt_event_t *event, - unsigned long value, - int flags); - -int cobalt_event_post(cobalt_event_t *event, - unsigned long bits); - -int cobalt_event_wait(cobalt_event_t *event, - unsigned long bits, - unsigned long *bits_r, - int mode, - const struct timespec *timeout); - -unsigned long cobalt_event_clear(cobalt_event_t *event, - unsigned long bits); - -int cobalt_event_inquire(cobalt_event_t *event, - struct cobalt_event_info *info, - pid_t *waitlist, size_t waitsz); - -int cobalt_event_destroy(cobalt_event_t *event); - -int cobalt_sem_inquire(sem_t *sem, struct cobalt_sem_info *info, - pid_t *waitlist, size_t waitsz); - -int cobalt_sched_weighted_prio(int policy, - const struct sched_param_ex *param_ex); - void cobalt_thread_init(void); void cobalt_print_init(void); @@ -143,8 +50,6 @@ void cobalt_default_mutexattr_init(void); void cobalt_default_condattr_init(void); -void cobalt_register_tsd_hook(struct cobalt_tsd_hook *th); - struct xnfeatinfo; void cobalt_check_features(struct xnfeatinfo *finfo); _______________________________________________ Xenomai-git mailing list Xenomai-git@xenomai.org http://www.xenomai.org/mailman/listinfo/xenomai-git