18 #ifndef _BOILERPLATE_ANCILLARIES_H
19 #define _BOILERPLATE_ANCILLARIES_H
25 #include <boilerplate/signal.h>
26 #include <boilerplate/compiler.h>
27 #include <boilerplate/atomic.h>
29 extern pthread_mutex_t __printlock;
34 struct name_generator {
40 #define DEFINE_NAME_GENERATOR(__name, __radix, __type, __member) \
41 struct name_generator __name = { \
43 .length = sizeof ((__type *)0)->__member, \
44 .serial = ATOMIC_INIT(0), \
47 #define ONE_BILLION 1000000000
49 void __namecpy_requires_character_array_as_destination(
void);
51 #define namecpy(__dst, __src) \
53 if (!__builtin_types_compatible_p(typeof(__dst), char[])) \
54 __namecpy_requires_character_array_as_destination(); \
55 strncpy((__dst), __src, sizeof(__dst) - 1); \
56 __dst[sizeof(__dst) - 1] = '\0'; \
60 #define early_panic(__fmt, __args...) \
61 __early_panic(__func__, __fmt, ##__args)
63 #define panic(__fmt, __args...) \
64 __panic(__func__, __fmt, ##__args)
70 void __run_cleanup_block(
struct cleanup_block *cb);
72 void __printout(
const char *name,
74 const char *fmt, va_list ap);
76 void __noreturn __early_panic(
const char *fn,
77 const char *fmt, ...);
79 void __noreturn ___panic(
const char *fn,
81 const char *fmt, va_list ap);
83 void __noreturn __panic(
const char *fn,
84 const char *fmt, ...);
86 void __warning(
const char *name,
87 const char *fmt, va_list ap);
89 void early_warning(
const char *fmt, ...);
91 void warning(
const char *fmt, ...);
93 void __notice(
const char *name,
94 const char *fmt, va_list ap);
96 void early_notice(
const char *fmt, ...);
98 void notice(
const char *fmt, ...);
100 void __boilerplate_init(
void);
102 const char *symerror(
int errnum);
104 char *generate_name(
char *buf,
const char *radix,
105 struct name_generator *ngen);
107 void error_hook(
struct error_frame *ef);
109 int get_static_cpu_count(
void);
111 pid_t get_thread_pid(
void);
113 char *lookup_command(
const char *cmd);
115 size_t get_mem_size(
const char *arg);
121 extern const char *config_strings[];
Copyright © 2011 Gilles Chanteperdrix gilles.chanteperdrix@xenomai.org.
Definition: atomic.h:24