18 #ifndef _BOILERPLATE_ANCILLARIES_H 19 #define _BOILERPLATE_ANCILLARIES_H 26 #include <boilerplate/signal.h> 27 #include <boilerplate/compiler.h> 28 #include <boilerplate/atomic.h> 30 extern pthread_mutex_t __printlock;
35 struct name_generator {
41 #define DEFINE_NAME_GENERATOR(__name, __radix, __type, __member) \ 42 struct name_generator __name = { \ 44 .length = sizeof ((__type *)0)->__member, \ 45 .serial = ATOMIC_INIT(0), \ 48 #define ONE_BILLION 1000000000 50 void __namecpy_requires_character_array_as_destination(
void);
52 #define namecpy(__dst, __src) \ 54 if (!__builtin_types_compatible_p(typeof(__dst), char[])) \ 55 __namecpy_requires_character_array_as_destination(); \ 56 strncpy((__dst), __src, sizeof(__dst) - 1); \ 57 __dst[sizeof(__dst) - 1] = '\0'; \ 61 #define early_panic(__fmt, __args...) \ 62 __early_panic(__func__, __fmt, ##__args) 64 #define panic(__fmt, __args...) \ 65 __panic(__func__, __fmt, ##__args) 71 void __run_cleanup_block(
struct cleanup_block *cb);
73 void __printout(
const char *name,
75 const char *fmt, va_list ap);
77 void __noreturn __early_panic(
const char *fn,
78 const char *fmt, ...);
80 void __noreturn ___panic(
const char *fn,
82 const char *fmt, va_list ap);
84 void __noreturn __panic(
const char *fn,
85 const char *fmt, ...);
87 void __warning(
const char *name,
88 const char *fmt, va_list ap);
90 void early_warning(
const char *fmt, ...);
92 void warning(
const char *fmt, ...);
94 void __notice(
const char *name,
95 const char *fmt, va_list ap);
97 void early_notice(
const char *fmt, ...);
99 void notice(
const char *fmt, ...);
101 void __boilerplate_init(
void);
103 const char *symerror(
int errnum);
105 char *generate_name(
char *buf,
const char *radix,
106 struct name_generator *ngen);
108 void error_hook(
struct error_frame *ef);
110 int get_static_cpu_count(
void);
112 int get_online_cpu_set(cpu_set_t *cpuset);
114 int get_realtime_cpu_set(cpu_set_t *cpuset);
116 int get_current_cpu(
void);
118 pid_t get_thread_pid(
void);
120 char *lookup_command(
const char *cmd);
122 size_t get_mem_size(
const char *arg);
128 extern const char *config_strings[];
Copyright © 2011 Gilles Chanteperdrix gilles.chanteperdrix@xenomai.org.
Definition: atomic.h:24