summaryrefslogtreecommitdiff
path: root/libgcompat
diff options
context:
space:
mode:
authorSamuel Holland <samuel@sholland.org>2018-01-14 23:39:30 -0600
committerSamuel Holland <samuel@sholland.org>2018-01-15 00:43:49 -0600
commitd5183702e36eb43bbb0fa24e31048ca10553d3e9 (patch)
tree50b776aa46ee991047784fe83a453aedaabdf265 /libgcompat
parenta6ab56ce62bc3c9fa4c63f2f13a3d5f3ea403f19 (diff)
downloadgcompat-d5183702e36eb43bbb0fa24e31048ca10553d3e9.tar.gz
gcompat-d5183702e36eb43bbb0fa24e31048ca10553d3e9.tar.bz2
gcompat-d5183702e36eb43bbb0fa24e31048ca10553d3e9.tar.xz
gcompat-d5183702e36eb43bbb0fa24e31048ca10553d3e9.zip
syslog: Implement checked syslog functions from LSB
Signed-off-by: Samuel Holland <samuel@sholland.org>
Diffstat (limited to 'libgcompat')
-rw-r--r--libgcompat/syslog.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/libgcompat/syslog.c b/libgcompat/syslog.c
new file mode 100644
index 0000000..5409eba
--- /dev/null
+++ b/libgcompat/syslog.c
@@ -0,0 +1,32 @@
+#include <assert.h> /* assert */
+#include <stdarg.h> /* va_list, va_start, va_end */
+#include <stddef.h> /* NULL */
+#include <syslog.h> /* vsyslog */
+
+void __vsyslog_chk(int priority, int flag, const char *format, va_list ap);
+
+/**
+ * Log a message, with stack checking.
+ *
+ * LSB 5.0: LSB-Core-generic/baselib---syslog-chk-1.html
+ */
+void __syslog_chk(int priority, int flag, const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+ __vsyslog_chk(priority, flag, format, ap);
+ va_end(ap);
+}
+
+/**
+ * Log a message, with stack checking.
+ *
+ * LSB 5.0: LSB-Core-generic/baselib---vsyslog-chk-1.html
+ */
+void __vsyslog_chk(int priority, int flag, const char *format, va_list ap)
+{
+ assert(format != NULL);
+
+ vsyslog(priority, format, ap);
+}