18 #ifndef _COBALT_SYS_COBALT_H 19 #define _COBALT_SYS_COBALT_H 21 #include <sys/types.h> 25 #include <semaphore.h> 29 #include <boilerplate/atomic.h> 30 #include <boilerplate/list.h> 31 #include <cobalt/uapi/kernel/synch.h> 32 #include <cobalt/uapi/kernel/vdso.h> 33 #include <cobalt/uapi/corectl.h> 34 #include <cobalt/uapi/mutex.h> 35 #include <cobalt/uapi/event.h> 36 #include <cobalt/uapi/monitor.h> 37 #include <cobalt/uapi/thread.h> 38 #include <cobalt/uapi/cond.h> 39 #include <cobalt/uapi/sem.h> 40 #include <cobalt/ticks.h> 42 #define cobalt_commit_memory(p) __cobalt_commit_memory(p, sizeof(*p)) 44 struct cobalt_tsd_hook {
45 void (*create_tsd)(void);
46 void (*delete_tsd)(void);
54 int cobalt_extend(
unsigned int magic);
56 int cobalt_corectl(
int request,
void *buf,
size_t bufsz);
58 int cobalt_thread_stat(pid_t pid,
59 struct cobalt_threadstat *stat);
61 int cobalt_serial_debug(
const char *fmt, ...);
63 void __cobalt_commit_memory(
void *p,
size_t len);
65 void cobalt_thread_harden(
void);
67 void cobalt_thread_relax(
void);
69 int cobalt_thread_join(pthread_t thread);
71 pid_t cobalt_thread_pid(pthread_t thread);
73 int cobalt_thread_mode(
void);
75 int cobalt_monitor_init(cobalt_monitor_t *mon,
76 clockid_t clk_id,
int flags);
78 int cobalt_monitor_destroy(cobalt_monitor_t *mon);
80 int cobalt_monitor_enter(cobalt_monitor_t *mon);
82 int cobalt_monitor_exit(cobalt_monitor_t *mon);
84 int cobalt_monitor_wait(cobalt_monitor_t *mon,
int event,
85 const struct timespec *ts);
87 void cobalt_monitor_grant(cobalt_monitor_t *mon,
88 struct xnthread_user_window *u_window);
90 int cobalt_monitor_grant_sync(cobalt_monitor_t *mon,
91 struct xnthread_user_window *u_window);
93 void cobalt_monitor_grant_all(cobalt_monitor_t *mon);
95 int cobalt_monitor_grant_all_sync(cobalt_monitor_t *mon);
97 void cobalt_monitor_drain(cobalt_monitor_t *mon);
99 int cobalt_monitor_drain_sync(cobalt_monitor_t *mon);
101 void cobalt_monitor_drain_all(cobalt_monitor_t *mon);
103 int cobalt_monitor_drain_all_sync(cobalt_monitor_t *mon);
105 int cobalt_event_init(cobalt_event_t *event,
109 int cobalt_event_post(cobalt_event_t *event,
112 int cobalt_event_wait(cobalt_event_t *event,
114 unsigned int *bits_r,
116 const struct timespec *timeout);
118 unsigned long cobalt_event_clear(cobalt_event_t *event,
121 int cobalt_event_inquire(cobalt_event_t *event,
122 struct cobalt_event_info *info,
123 pid_t *waitlist,
size_t waitsz);
125 int cobalt_event_destroy(cobalt_event_t *event);
127 int cobalt_sem_inquire(sem_t *sem,
struct cobalt_sem_info *info,
128 pid_t *waitlist,
size_t waitsz);
130 int cobalt_sched_weighted_prio(
int policy,
131 const struct sched_param_ex *param_ex);
133 void cobalt_register_tsd_hook(
struct cobalt_tsd_hook *th);
135 void cobalt_assert_nrt(
void);
137 extern int __cobalt_control_bind;