modprobe.8: document "-b"
[mit.git] / logging.h
blobad53d403c78035a33cd39a71141cf7ad427c89f1
1 #ifndef MODINITTOOLS_LOGGING_H
2 #define MODINITTOOLS_LOGGING_H
4 /* Do we use syslog for messages or stderr? */
5 extern int logging;
7 /* Number of times warn() has been called */
8 extern int warned;
10 extern void fatal(const char *fmt, ...);
11 extern void warn(const char *fmt, ...);
13 #define NOFAIL(ptr) do_nofail((ptr), __FILE__, __LINE__, #ptr)
15 #define nofail_asprintf(ptr, ...) \
16 { if (asprintf((ptr), __VA_ARGS__) < 0) do_nofail(NULL, __FILE__, __LINE__, #ptr); }
18 static inline void *do_nofail(void *ptr, const char *file, int line, const char *expr)
20 if (!ptr) {
21 fatal("Memory allocation failure %s line %d: %s.\n",
22 file, line, expr);
24 return ptr;
27 #endif /* MODINITTOOLS_LOGGING_H */