#include "config.h"
#endif
-#define _GNU_SOURCE
-
#include <sys/errno.h>
#include <sys/types.h>
#include <sys/time.h>
#define FLEX_ARRAY 1
#endif
-/* gcc has hew positive aspects too */
#ifdef __GNUC__
-#define unlikely(x) __builtin_expect(!!(x), 0)
-#define likely(x) __builtin_expect(!!(x), 1)
-
+/* gcc has hew positive aspects too */
#define _MUSTCHECK __attribute__((warn_unused_result))
#define _DEPRECATED __attribute__((deprecated))
#define _PRINTF(fmtpos, argpos) __attribute__((format(printf, fmtpos, argpos)))
#define _MALLOC __attribute__((malloc))
-#if 0
-#define _USED __attribute__((used))
-#define _UNUSED __attribute__((unused))
-#define _NONNULL(args...) __attribute__((nonnull(args)))
-#define _REGPARM(num) __attribute__((regparm(num)))
-#define _FASTCALL __attribute__((fastcall))
-#endif
+/* those do not seem to work well */
+#define unlikely(x) __builtin_expect(!!(x), 0)
+#define likely(x) __builtin_expect(!!(x), 1)
#else
-#define unlikely(x) x
-#define likely(x) x
-
#define _MUSTCHECK
#define _DEPRECATED
#define _PRINTF(x,y)
#define _MALLOC
+#define unlikely(x) x
+#define likely(x) x
#endif
#endif
#ifndef UNIX_PATH_MAX
-/* #define UNIX_PATH_MAX (sizeof(((struct sockaddr_un *)0)->sun_path)) */
#define UNIX_PATH_MAX 128 /* actual sizeof() will be applied later anyway */
#endif
typedef uint64_t usec_t;
-/* shortcut to simplify printf of u64 types */
-typedef unsigned long long ull_t;
-
/*
* bool type.
*/
*/
#ifndef HAVE_STRLCPY
-size_t strlcpy(char *dst, const char *src, size_t n);
+size_t strlcpy(char *dst, const char *src, size_t n) _MUSTCHECK;
#endif
#ifndef HAVE_STRLCAT
-size_t strlcat(char *dst, const char *src, size_t n);
+size_t strlcat(char *dst, const char *src, size_t n) _MUSTCHECK;
#endif
#ifndef HAVE_GETPEEREID
-int getpeereid(int fd, uid_t *uid_p, gid_t *gid_p);
+int getpeereid(int fd, uid_t *uid_p, gid_t *gid_p) _MUSTCHECK;
#endif
/*
#undef strcmp
#define strcmp(a, b) _inline_strcmp(a, b)
-
sprintf(tmp, "%d", va_arg(ap, int));
val = tmp;
} else if (tupdesc[i] == 'q') {
- sprintf(tmp, "%llu", (unsigned long long)va_arg(ap, uint64_t));
+ sprintf(tmp, "%" PRIu64, va_arg(ap, uint64_t));
val = tmp;
} else if (tupdesc[i] == 's') {
val = va_arg(ap, char *);
}
calc_average(&avg, &cur_total, &old_total);
/* send totals to logfile */
- log_info("Stats: %llu req/s, in %llu b/s, "
- "out %llu b/s, query %llu us",
- (ull_t)avg.request_count, (ull_t)avg.client_bytes,
- (ull_t)avg.server_bytes, (ull_t)avg.query_time);
+ log_info("Stats: %" PRIu64 " req/s,"
+ " in %" PRIu64 " b/s,"
+ " out %" PRIu64 " b/s,"
+ "query %" PRIu64 " us",
+ avg.request_count, avg.client_bytes,
+ avg.server_bytes, avg.query_time);
safe_evtimer_add(&ev_stats, &period);
}