a1a9dac2714fc97d0c75418bfa3035cb1ba339df
6 #include <sys/syscall.h>
10 //#error UST_COMPONENT is undefined
11 #define UST_COMPONENT libust
14 /* To stringify the expansion of a define */
15 #define XSTR(d) STR(d)
18 #define UST_STR_COMPONENT XSTR(UST_COMPONENT)
20 #define ERRMSG(fmt, args...) do { fprintf(stderr, UST_STR_COMPONENT "[%ld/%ld]: " fmt " (" __FILE__ ":" XSTR(__LINE__) ")\n", (long) getpid(), (long) syscall(SYS_gettid), ## args); fflush(stderr); } while(0)
24 # define DBG(fmt, args...) ERRMSG(fmt, ## args)
26 # define DBG(fmt, args...) do {} while(0)
28 #define WARN(fmt, args...) ERRMSG("Warning: " fmt, ## args)
29 #define ERR(fmt, args...) ERRMSG("Error: " fmt, ## args)
30 #define BUG(fmt, args...) ERRMSG("BUG: " fmt, ## args)
32 #if (_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && !defined(_GNU_SOURCE)
33 #define PERROR(call, args...)\
35 char buf[200] = "Error in strerror_r()"; \
36 strerror_r(errno, buf, sizeof(buf)); \
37 ERRMSG("Error: " call ": %s", ## args, buf); \
40 #define PERROR(call, args...)\
44 buf = strerror_r(errno, tmp, sizeof(tmp)); \
45 ERRMSG("Error: " call ": %s", ## args, buf); \
49 #define BUG_ON(condition) do { if (unlikely(condition)) ERR("condition not respected (BUG)"); } while(0)
50 #define WARN_ON(condition) do { if (unlikely(condition)) WARN("condition not respected on line %s:%d", __FILE__, __LINE__); } while(0)
This page took 0.032427 seconds and 4 git commands to generate.