[PATCH 34/42] tools/nolibc/types: define PATH_MAX and MAXPATHLEN

From: Willy Tarreau
Date: Mon Feb 07 2022 - 11:45:11 EST


These ones are often used and commonly set by applications to fallback
values. Let's fix them both to agree on PATH_MAX=4096 by default, as is
already present in linux/limits.h.

Signed-off-by: Willy Tarreau <w@xxxxxx>
---
tools/include/nolibc/types.h | 11 +++++++++++
1 file changed, 11 insertions(+)

diff --git a/tools/include/nolibc/types.h b/tools/include/nolibc/types.h
index dac1cc186dab..9ab922bc2f09 100644
--- a/tools/include/nolibc/types.h
+++ b/tools/include/nolibc/types.h
@@ -49,6 +49,17 @@
#define FD_SETSIZE 256
#endif

+/* PATH_MAX and MAXPATHLEN are often used and found with plenty of different
+ * values.
+ */
+#ifndef PATH_MAX
+#define PATH_MAX 4096
+#endif
+
+#ifndef MAXPATHLEN
+#define MAXPATHLEN (PATH_MAX)
+#endif
+
/* Special FD used by all the *at functions */
#ifndef AT_FDCWD
#define AT_FDCWD (-100)
--
2.35.1