X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=extras%2Flibmemif%2Fsrc%2Fmemif_private.h;h=9542936983ec98cd0499d05a2545aa9542f1636f;hb=refs%2Fchanges%2F72%2F31472%2F3;hp=cf950ba0547cd40d8d4bee485443f943fe3827b0;hpb=6223766f96c469e42d6855c4b5933e7a9e06d621;p=vpp.git diff --git a/extras/libmemif/src/memif_private.h b/extras/libmemif/src/memif_private.h index cf950ba0547..9542936983e 100644 --- a/extras/libmemif/src/memif_private.h +++ b/extras/libmemif/src/memif_private.h @@ -66,6 +66,33 @@ _Static_assert (strlen (MEMIF_DEFAULT_APP_NAME) <= MEMIF_NAME_LEN, #define DBG(...) #endif /* MEMIF_DBG */ +#ifndef HAS_LIB_BSD +static inline size_t +strlcpy (char *dest, const char *src, size_t len) +{ + const char *s = src; + size_t n = len; + + while (--n > 0) + { + if ((*dest++ = *s++) == '\0') + break; + } + + if (n == 0) + { + if (len != 0) + *dest = '\0'; + while (*s++) + ; + } + + return (s - src - 1); +} +#else +#include +#endif + typedef enum { MEMIF_SOCKET_TYPE_NONE = 0, /* unassigned, not used by any interface */ @@ -95,7 +122,7 @@ typedef struct int int_fd; uint64_t int_count; - uint32_t alloc_bufs; + uint32_t next_buf; /* points to next free buffer */ } memif_queue_t; typedef struct memif_msg_queue_elt @@ -166,7 +193,7 @@ typedef struct int fd; uint16_t use_count; memif_socket_type_t type; - uint8_t *filename; + uint8_t filename[108]; /* unique database */ struct libmemif_main *lm; uint16_t interface_list_len;