summaryrefslogtreecommitdiffstats
path: root/extras/libmemif/src/memif_private.h
diff options
context:
space:
mode:
authorJakub Grajciar <jgrajcia@cisco.com>2018-03-13 13:57:50 +0100
committerJakub Grajciar <jgrajcia@cisco.com>2018-03-13 16:13:46 +0100
commit1941871e2622a17e84062c69c234414c4dc2bf4a (patch)
tree1743dcdc712f471839b096bf519173c55fb0a34d /extras/libmemif/src/memif_private.h
parent3464c860650c5d8cc8abf11c7d2faa074105b8d6 (diff)
libmemif: ubuntu 18.04 build fix
Change-Id: I6624cacd625eea6a9b8214f67d14ec162e2c0195 Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
Diffstat (limited to 'extras/libmemif/src/memif_private.h')
-rw-r--r--extras/libmemif/src/memif_private.h19
1 files changed, 16 insertions, 3 deletions
diff --git a/extras/libmemif/src/memif_private.h b/extras/libmemif/src/memif_private.h
index c213ee635aa..a512ed4eaaa 100644
--- a/extras/libmemif/src/memif_private.h
+++ b/extras/libmemif/src/memif_private.h
@@ -26,9 +26,14 @@
#include <inttypes.h>
#include <limits.h>
#include <sys/timerfd.h>
+#include <string.h>
#include <libmemif.h>
+#define MEMIF_NAME_LEN 32
+_Static_assert (strlen (MEMIF_DEFAULT_APP_NAME) <= MEMIF_NAME_LEN,
+ "MEMIF_DEFAULT_APP_NAME max length is 32");
+
#define MEMIF_DEFAULT_SOCKET_DIR "/run/vpp"
#define MEMIF_DEFAULT_SOCKET_FILENAME "memif.sock"
#define MEMIF_DEFAULT_RING_SIZE 1024
@@ -142,8 +147,8 @@ typedef struct memif_connection
/* connection message queue */
memif_msg_queue_elt_t *msg_queue;
- uint8_t remote_if_name[32];
- uint8_t remote_name[32];
+ uint8_t remote_if_name[MEMIF_NAME_LEN];
+ uint8_t remote_name[MEMIF_NAME_LEN];
uint8_t remote_disconnect_string[96];
memif_region_t *regions;
@@ -186,7 +191,7 @@ typedef struct
int timerfd;
struct itimerspec arm, disarm;
uint16_t disconn_slaves;
- uint8_t *app_name;
+ uint8_t app_name[MEMIF_NAME_LEN];
/* master implementation... */
memif_socket_t ms;
@@ -237,11 +242,13 @@ int free_list_elt (memif_list_elt_t * list, uint16_t len, int key);
#endif
#endif
+#ifndef HAVE_MEMFD_CREATE
static inline int
memfd_create (const char *name, unsigned int flags)
{
return syscall (__NR_memfd_create, name, flags);
}
+#endif
static inline void *
memif_get_buffer (memif_connection_t * conn, memif_ring_t * ring,
@@ -254,7 +261,12 @@ memif_get_buffer (memif_connection_t * conn, memif_ring_t * ring,
#ifndef F_LINUX_SPECIFIC_BASE
#define F_LINUX_SPECIFIC_BASE 1024
#endif
+
+#ifndef MFD_ALLOW_SEALING
#define MFD_ALLOW_SEALING 0x0002U
+#endif
+
+#ifndef F_ADD_SEALS
#define F_ADD_SEALS (F_LINUX_SPECIFIC_BASE + 9)
#define F_GET_SEALS (F_LINUX_SPECIFIC_BASE + 10)
@@ -262,5 +274,6 @@ memif_get_buffer (memif_connection_t * conn, memif_ring_t * ring,
#define F_SEAL_SHRINK 0x0002 /* prevent file from shrinking */
#define F_SEAL_GROW 0x0004 /* prevent file from growing */
#define F_SEAL_WRITE 0x0008 /* prevent writes */
+#endif
#endif /* _MEMIF_PRIVATE_H_ */