[V3,2/4] Android NDK: UNIX_PATH_MAX is defined in un.h

Submitted by Zhang, Ning A on April 4, 2019, 2:22 a.m.

Details

Message ID 20190404022232.17124-3-ning.a.zhang@intel.com
State New
Series "patches for build CRIU with Android NDK"
Headers show

Commit Message

Zhang, Ning A April 4, 2019, 2:22 a.m.
From: Zhang Ning <ning.a.zhang@intel.com>

in Android NDK, UNIX_PATH_MAX is already defined,
add ifndef to check.

linux/un.h:
22: #define UNIX_PATH_MAX 108

Cc: Chen Hu <hu1.chen@intel.com>
Signed-off-by: Zhang Ning <ning.a.zhang@intel.com>
---
 compel/src/lib/infect.c | 2 ++
 criu/include/util-pie.h | 2 ++
 2 files changed, 4 insertions(+)

Patch hide | download patch | download mbox

diff --git a/compel/src/lib/infect.c b/compel/src/lib/infect.c
index abf3a0ab..b7db6cf9 100644
--- a/compel/src/lib/infect.c
+++ b/compel/src/lib/infect.c
@@ -33,8 +33,10 @@ 
 #include "common/scm.h"
 #include "common/scm-code.c"
 
+#ifndef UNIX_PATH_MAX
 #define UNIX_PATH_MAX (sizeof(struct sockaddr_un) - \
 			(size_t)((struct sockaddr_un *) 0)->sun_path)
+#endif
 
 #define PARASITE_STACK_SIZE	(16 << 10)
 
diff --git a/criu/include/util-pie.h b/criu/include/util-pie.h
index 31975dda..ce78b0d1 100644
--- a/criu/include/util-pie.h
+++ b/criu/include/util-pie.h
@@ -4,8 +4,10 @@ 
 #include <sys/socket.h>
 #include <sys/un.h>
 
+#ifndef UNIX_PATH_MAX
 #define UNIX_PATH_MAX (sizeof(struct sockaddr_un) - \
 			(size_t)((struct sockaddr_un *) 0)->sun_path)
+#endif
 
 #ifndef SO_PEEK_OFF
 #define SO_PEEK_OFF            42