]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: buffers: buf.h requires unistd to get ssize_t on libmusl
authorWilly Tarreau <w@1wt.eu>
Mon, 26 Nov 2018 18:41:40 +0000 (19:41 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 26 Nov 2018 18:49:21 +0000 (19:49 +0100)
Building with musl and gcc-5.3 for MIPS returns this :

include/common/buf.h: In function 'b_dist':
include/common/buf.h:252:2: error: unknown type name 'ssize_t'
  ssize_t dist = to - from;
  ^
Including stdint or stddef is not sufficient there to get ssize_t,
unistd is needed as well. It's likely that other platforms will have
the same issue. This patch also addresses it in ist.h and memory.h.

include/common/buf.h
include/common/ist.h
include/common/memory.h
include/proto/htx.h

index d39de7112a1380c43d853dd1b6a3c9d0872eae34..cc670bf38c91ebf6ec28a58e2fcb7cdaec592513 100644 (file)
@@ -30,6 +30,7 @@
 
 #include <stdint.h>
 #include <string.h>
+#include <unistd.h>
 
 /* Structure defining a buffer's head */
 struct buffer {
index 7c60c68f3c20ce8ab398c039df77d5a33af4a9e5..cfab1e32cc4b7f29ee716172b585a98aed5c934f 100644 (file)
@@ -30,6 +30,7 @@
 
 #include <ctype.h>
 #include <string.h>
+#include <unistd.h>
 
 #include <common/config.h>
 
index b854ebb0b28c42cda8a429ac439662da82207d9b..57d6ba63e69f20f76a293fa48a1d5e8ca61a8343 100644 (file)
@@ -27,6 +27,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <stdint.h>
+#include <unistd.h>
 
 #include <common/config.h>
 #include <common/mini-clist.h>
index dd525fed3e2460a89337baa312b9a89b0730d0a5..779aab6d57055e0a29aa52aa39fc785f7f983d02 100644 (file)
@@ -440,10 +440,10 @@ static inline void htx_dump(struct htx *htx)
 {
         int32_t pos;
 
-        fprintf(stderr, "htx:%p [ size=%u - data=%u - used=%u - wrap=%s - extra=%lu]\n",
+        fprintf(stderr, "htx:%p [ size=%u - data=%u - used=%u - wrap=%s - extra=%llu]\n",
                 htx, htx->size, htx->data, htx->used,
                 (!htx->used || htx->tail+1 == htx->wrap) ? "NO" : "YES",
-               (unsigned long)htx->extra);
+               (unsigned long long)htx->extra);
         fprintf(stderr, "\thead=%d - tail=%u - front=%u - wrap=%u\n",
                 htx_get_head(htx), htx->tail, htx->front, htx->wrap);