18#ifndef _COBALT_SYS_COBALT_H
19#define _COBALT_SYS_COBALT_H
29#include <boilerplate/atomic.h>
30#include <boilerplate/list.h>
31#include <cobalt/uapi/kernel/synch.h>
32#include <cobalt/uapi/corectl.h>
33#include <cobalt/uapi/mutex.h>
34#include <cobalt/uapi/event.h>
35#include <cobalt/uapi/monitor.h>
36#include <cobalt/uapi/thread.h>
37#include <cobalt/uapi/cond.h>
38#include <cobalt/uapi/sem.h>
39#include <cobalt/ticks.h>
41#define cobalt_commit_memory(p) __cobalt_commit_memory(p, sizeof(*p))
43struct cobalt_tsd_hook {
44 void (*create_tsd)(void);
45 void (*delete_tsd)(void);
53int cobalt_extend(
unsigned int magic);
55int cobalt_corectl(
int request,
void *buf,
size_t bufsz);
57int cobalt_thread_stat(pid_t pid,
58 struct cobalt_threadstat *stat);
60int cobalt_serial_debug(
const char *fmt, ...);
62void __cobalt_commit_memory(
void *p,
size_t len);
64void cobalt_thread_harden(
void);
66void cobalt_thread_relax(
void);
68int cobalt_thread_join(pthread_t thread);
70pid_t cobalt_thread_pid(pthread_t thread);
72int cobalt_thread_mode(
void);
74int cobalt_monitor_init(cobalt_monitor_t *mon,
75 clockid_t clk_id,
int flags);
77int cobalt_monitor_destroy(cobalt_monitor_t *mon);
79int cobalt_monitor_enter(cobalt_monitor_t *mon);
81int cobalt_monitor_exit(cobalt_monitor_t *mon);
83int cobalt_monitor_wait(cobalt_monitor_t *mon,
int event,
84 const struct timespec *ts);
86void cobalt_monitor_grant(cobalt_monitor_t *mon,
87 struct xnthread_user_window *u_window);
89int cobalt_monitor_grant_sync(cobalt_monitor_t *mon,
90 struct xnthread_user_window *u_window);
92void cobalt_monitor_grant_all(cobalt_monitor_t *mon);
94int cobalt_monitor_grant_all_sync(cobalt_monitor_t *mon);
96void cobalt_monitor_drain(cobalt_monitor_t *mon);
98int cobalt_monitor_drain_sync(cobalt_monitor_t *mon);
100void cobalt_monitor_drain_all(cobalt_monitor_t *mon);
102int cobalt_monitor_drain_all_sync(cobalt_monitor_t *mon);
104int cobalt_event_init(cobalt_event_t *event,
108int cobalt_event_post(cobalt_event_t *event,
111int cobalt_event_wait(cobalt_event_t *event,
113 unsigned int *bits_r,
115 const struct timespec *timeout);
117unsigned long cobalt_event_clear(cobalt_event_t *event,
120int cobalt_event_inquire(cobalt_event_t *event,
121 struct cobalt_event_info *info,
122 pid_t *waitlist,
size_t waitsz);
124int cobalt_event_destroy(cobalt_event_t *event);
126int cobalt_sem_inquire(sem_t *sem,
struct cobalt_sem_info *info,
127 pid_t *waitlist,
size_t waitsz);
129int cobalt_sched_weighted_prio(
int policy,
130 const struct sched_param_ex *param_ex);
132void cobalt_register_tsd_hook(
struct cobalt_tsd_hook *th);
134void cobalt_assert_nrt(
void);
136unsigned long long cobalt_read_ns(
void);
138extern int __cobalt_control_bind;