Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tools/compat tools/compat/compat_defs.h: improve NAME_MAX co...



details:   https://anonhg.NetBSD.org/src/rev/0b76cc6f0765
branches:  trunk
changeset: 378134:0b76cc6f0765
user:      lukem <lukem%NetBSD.org@localhost>
date:      Fri Jul 21 22:05:04 2023 +0000

description:
tools/compat/compat_defs.h: improve NAME_MAX compat

Move the NAME_MAX workaround to the <limits.h> section,
and don't assume that _XOPEN_NAME_MAX is available.

diffstat:

 tools/compat/compat_defs.h |  22 ++++++++++------------
 1 files changed, 10 insertions(+), 12 deletions(-)

diffs (43 lines):

diff -r 99f8623f3cc7 -r 0b76cc6f0765 tools/compat/compat_defs.h
--- a/tools/compat/compat_defs.h        Fri Jul 21 20:03:13 2023 +0000
+++ b/tools/compat/compat_defs.h        Fri Jul 21 22:05:04 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat_defs.h,v 1.121 2023/07/08 19:10:00 palle Exp $  */
+/*     $NetBSD: compat_defs.h,v 1.122 2023/07/21 22:05:04 lukem Exp $  */
 
 #ifndef        __NETBSD_COMPAT_DEFS_H__
 #define        __NETBSD_COMPAT_DEFS_H__
@@ -31,17 +31,6 @@
 #endif /* __linux__ && HAVE_FEATURES_H */
 
 /*
- * Solaris:
- * No NAME_MAX define is available (as documented in the Solaris
- * limits.h file), so use the XOPEN defined constant.
- */
-
-#if defined(__sun__)
-#define NAME_MAX _XOPEN_NAME_MAX
-#endif
-
-
-/*
  * Type substitutes.
  * These are controlled via HAVE_TYPE protections and some of them are needed
  * in other header files (in the build tree not in the host). This is because
@@ -1007,6 +996,15 @@ void *setmode(const char *);
 #ifndef MAXPATHLEN
 #define MAXPATHLEN     4096
 #endif
+
+#ifndef NAME_MAX
+#ifdef _XOPEN_NAME_MAX
+#define NAME_MAX _XOPEN_NAME_MAX
+#else
+#error "Both NAME_MAX and _XOPEN_NAME_MAX are not defined"
+#endif
+#endif
+
 #ifndef PATH_MAX
 #define PATH_MAX       MAXPATHLEN
 #endif



Home | Main Index | Thread Index | Old Index