1 #define ERROR_LOG(fmt, args...) fprintf(stderr, "ERROR: %s (%d), %s: " fmt "\n", __FILE__, __LINE__, __func__, ##args)
3 #define INFO_LOG(debug, fmt, args...) if (debug) fprintf(stderr, "INFO: %s (%d), %s: " fmt "\n", __FILE__, __LINE__, __func__, ##args)
6 #define TEST_Z(x) do { int retval; if ( (retval=x)) { ERROR_LOG("error: " #x " failed (returned %d, errno %d).", retval, errno ); exit(retval); } } while (0)
7 #define TEST_NZ(x) do { if (!(x)) { ERROR_LOG("error: " #x " failed (returned zero/null. errno=%d).", errno); exit(-1); }} while (0)
11 #define set_size(val, unit) do { \
23 val *= 1024 * 1024 * 1024; \
26 ERROR_LOG("unknown unit '%c'", unit[0]); \
32 #define NSEC_IN_SEC 1000000000
34 static inline void sub_timespec(uint64_t *
new,
struct timespec *x,
struct timespec *y) {
35 if (y->tv_nsec < x->tv_nsec) {
40 y->tv_nsec - x->tv_nsec;
44 #define MSK_MAX_RESVPORT 1023
45 #define MSK_MIN_RESVPORT 512
#define NSEC_IN_SEC
Definition: utils.h:32