summaryrefslogtreecommitdiff
path: root/util.h
diff options
context:
space:
mode:
authorDustin Sallings <dustin@spy.net>2009-07-14 23:02:14 -0700
committerTrond Norbye <Trond.Norbye@sun.com>2009-08-19 21:28:34 +0200
commit891082f349304fb802c3df7491e337b47771eab1 (patch)
treed67385101a9157a5aaa355b86b1111d60e350bfd /util.h
parent7db0d07c754d1a54116aa2b424b35b429073b15e (diff)
downloadmemcached-891082f349304fb802c3df7491e337b47771eab1.tar.gz
vperror implementation
This allows us to provide much more useful error messages for syscalls.
Diffstat (limited to 'util.h')
-rw-r--r--util.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/util.h b/util.h
index 9af886d..b89d15e 100644
--- a/util.h
+++ b/util.h
@@ -11,3 +11,18 @@ bool safe_strtoull(const char *str, uint64_t *out);
bool safe_strtoll(const char *str, int64_t *out);
bool safe_strtoul(const char *str, uint32_t *out);
bool safe_strtol(const char *str, int32_t *out);
+
+#ifdef __GCC
+# define __gcc_attribute__ __attribute__
+#else
+# define __gcc_attribute__(x)
+#endif
+
+/**
+ * Vararg variant of perror that makes for more useful error messages
+ * when reporting with parameters.
+ *
+ * @param fmt a printf format
+ */
+void vperror(const char *fmt, ...)
+ __gcc_attribute__ ((format (printf, 1, 2)));