aboutsummaryrefslogtreecommitdiff
path: root/lib/errmsg_put.c
diff options
context:
space:
mode:
authorKlaatu <[email protected]>2015-05-17 15:33:21 +1200
committerKlaatu <[email protected]>2015-05-17 15:33:21 +1200
commitb0de699679e8f1e39af847ed172d1ba605b4370c (patch)
tree01dac00471d61f727394e508c613b29cff0ceae5 /lib/errmsg_put.c
bulk upload of source
Diffstat (limited to 'lib/errmsg_put.c')
-rw-r--r--lib/errmsg_put.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/errmsg_put.c b/lib/errmsg_put.c
new file mode 100644
index 0000000..9afe0ce
--- /dev/null
+++ b/lib/errmsg_put.c
@@ -0,0 +1,20 @@
+#include <sys/uio.h>
+#include "../ninitfeatures.h"
+
+#ifndef ERRMSG_PUTS_LEN
+#define ERRMSG_PUTS_LEN 15
+#endif
+
+void errmsg_put(int fd, const char *buf, unsigned int len) /*EXTRACT_INCL*/ {
+ static struct iovec errmsg_iov[ERRMSG_PUTS_LEN];
+ static int k;
+ if (buf==0 || k==ERRMSG_PUTS_LEN) {
+ if (fd>=0) writev(fd,errmsg_iov,k);
+ k = 0;
+ }
+ if (buf && len) {
+ errmsg_iov[k].iov_base = (char *)buf;
+ errmsg_iov[k].iov_len = len;
+ k++;
+ }
+}