From ad9df9a49001e944547590324a78d6d9a6269657 Mon Sep 17 00:00:00 2001 From: Ben Gras Date: Thu, 12 Dec 2013 14:27:56 +0100 Subject: [PATCH] reduces differences, raise NAME_MAX Change-Id: I2e5f6296e6539162c52fdf13fb1fd27a56587e0c --- commands/backup/backup.c | 1 + commands/cp/cp.c | 1 + commands/writeisofs/writeisofs.c | 2 +- lib/libc/sys-minix/m_closefrom.c | 2 +- sys/sys/fd_set.h | 2 +- sys/sys/syslimits.h | 30 +++++++++++++++++------------- test/common.c | 1 + test/t40c.c | 1 + test/test40.c | 1 + test/test41.c | 1 + test/test42.c | 1 + test/test58.c | 1 + test/test61.c | 1 + test/test67.c | 1 + test/test68.c | 1 + test/test76.c | 1 + test/test77.c | 1 + usr.sbin/installboot/minixfs3.c | 1 + 18 files changed, 34 insertions(+), 16 deletions(-) diff --git a/commands/backup/backup.c b/commands/backup/backup.c index 267d97b13..529608f9c 100644 --- a/commands/backup/backup.c +++ b/commands/backup/backup.c @@ -35,6 +35,7 @@ #include #include +#include #include #include #include diff --git a/commands/cp/cp.c b/commands/cp/cp.c index 75cf43107..470a94bd7 100644 --- a/commands/cp/cp.c +++ b/commands/cp/cp.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include diff --git a/commands/writeisofs/writeisofs.c b/commands/writeisofs/writeisofs.c index a5cefc557..9029f2efc 100644 --- a/commands/writeisofs/writeisofs.c +++ b/commands/writeisofs/writeisofs.c @@ -29,7 +29,7 @@ extern int optind; #include #include -#define NAMELEN (NAME_MAX+5) +#define NAMELEN 500 #define ISONAMELEN 12 /* XXX could easily be 31 */ #define PLATFORM_80X86 0 diff --git a/lib/libc/sys-minix/m_closefrom.c b/lib/libc/sys-minix/m_closefrom.c index eae7995c8..14db9f80f 100644 --- a/lib/libc/sys-minix/m_closefrom.c +++ b/lib/libc/sys-minix/m_closefrom.c @@ -7,7 +7,7 @@ int closefrom(int fd) { int f, ok = 0, e = 0; - for(f = fd; f < __MINIX_OPEN_MAX; f++) { + for(f = fd; f < OPEN_MAX; f++) { if(close(f) >= 0) ok = 1; else diff --git a/sys/sys/fd_set.h b/sys/sys/fd_set.h index 0fca18e88..a20fd515b 100644 --- a/sys/sys/fd_set.h +++ b/sys/sys/fd_set.h @@ -58,7 +58,7 @@ typedef __uint32_t __fd_mask; #ifndef FD_SETSIZE #ifdef __minix #include -#define FD_SETSIZE __MINIX_OPEN_MAX +#define FD_SETSIZE OPEN_MAX #else #define FD_SETSIZE 256 #endif diff --git a/sys/sys/syslimits.h b/sys/sys/syslimits.h index 5ae3be3e7..9c6976d64 100644 --- a/sys/sys/syslimits.h +++ b/sys/sys/syslimits.h @@ -34,16 +34,15 @@ #ifndef _SYS_SYSLIMITS_H_ #define _SYS_SYSLIMITS_H_ -#if defined(__minix) -#define __MINIX_OPEN_MAX 255 /* a process may have 255 files open */ -#define __MINIX_PATH_MAX 1024/* a pathname may contain 1023 chars (+ '\0')*/ - -#if defined(_STANDALONE) +#if defined(_STANDALONE) && defined(__minix) /* LSC: In NetBSD this gets pulled in through libkern.h */ #include uint32_t crc32(uint32_t, const uint8_t *, size_t); #endif /* defined(_STANDALONE) */ -#endif /* defined(__minix) */ + +#ifdef __minix +#define OPEN_MAX 255 +#endif #include @@ -53,19 +52,24 @@ uint32_t crc32(uint32_t, const uint8_t *, size_t); #ifndef CHILD_MAX #define CHILD_MAX 160 /* max simultaneous processes */ #endif -#define GID_MAX USHRT_MAX /* max value for a gid_t (2^31-2) */ +#define GID_MAX 2147483647U /* max value for a gid_t (2^31-2) */ #define LINK_MAX 32767 /* max file link count */ #define MAX_CANON 255 /* max bytes in term canon input line */ #define MAX_INPUT 255 /* max bytes in terminal input */ -#define NAME_MAX 255 /* max bytes in a file name, must be */ +#define NAME_MAX 511 /* max bytes in a file name, must be */ /* kept in sync with MAXPATHLEN */ -#define NGROUPS_MAX 8 /* max supplemental group id's */ -#define UID_MAX USHRT_MAX /* max value for a uid_t */ +#define NGROUPS_MAX 16 /* max supplemental group id's */ +#define UID_MAX 2147483647U /* max value for a uid_t (2^31-2) */ #ifndef OPEN_MAX -#define OPEN_MAX __MINIX_OPEN_MAX /* max open files per process */ +#define OPEN_MAX 128 /* max open files per process */ +#endif +#define PATH_MAX 1024 /* max bytes in pathname */ + +#ifdef __minix +#define PIPE_BUF 32768 /* max bytes for atomic pipe wri +#else +#define PIPE_BUF 512 /* max bytes for atomic pipe writes */ #endif -#define PATH_MAX __MINIX_PATH_MAX /* max bytes in pathname */ -#define PIPE_BUF 32768 /* max bytes for atomic pipe writes */ #define BC_BASE_MAX INT_MAX /* max ibase/obase values in bc(1) */ #define BC_DIM_MAX 65535 /* max array elements in bc(1) */ diff --git a/test/common.c b/test/common.c index d530d5559..a4e1fa032 100644 --- a/test/common.c +++ b/test/common.c @@ -9,6 +9,7 @@ #include #include #include +#include #include "common.h" diff --git a/test/t40c.c b/test/t40c.c index d78f981aa..54cc29f8c 100644 --- a/test/t40c.c +++ b/test/t40c.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include diff --git a/test/test40.c b/test/test40.c index 15a36e3ca..c4b84e8ed 100644 --- a/test/test40.c +++ b/test/test40.c @@ -6,6 +6,7 @@ #include #include +#include #include #include #include diff --git a/test/test41.c b/test/test41.c index 0cec41c9c..ee5ba6da4 100644 --- a/test/test41.c +++ b/test/test41.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include diff --git a/test/test42.c b/test/test42.c index c61ce0d6a..1b6f9c0e8 100644 --- a/test/test42.c +++ b/test/test42.c @@ -9,6 +9,7 @@ #include #include #include +#include #define ITERATIONS 3 int max_error = 4; diff --git a/test/test58.c b/test/test58.c index c327639eb..0988ab399 100644 --- a/test/test58.c +++ b/test/test58.c @@ -20,6 +20,7 @@ #include #include #include +#include int subtest = -1; int max_error = 999; /* Effectively no limit. This is necessary as this diff --git a/test/test61.c b/test/test61.c index 958dfedd9..e70605387 100644 --- a/test/test61.c +++ b/test/test61.c @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include diff --git a/test/test67.c b/test/test67.c index 64fdd92c4..68033a807 100644 --- a/test/test67.c +++ b/test/test67.c @@ -3,6 +3,7 @@ #include #include #include +#include #include #include #include diff --git a/test/test68.c b/test/test68.c index dd51d6b13..273117bce 100644 --- a/test/test68.c +++ b/test/test68.c @@ -1,5 +1,6 @@ #include #include +#include #include #include #include diff --git a/test/test76.c b/test/test76.c index 062ccf4ce..c7268329a 100644 --- a/test/test76.c +++ b/test/test76.c @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include diff --git a/test/test77.c b/test/test77.c index b634a0091..2b8c68d09 100644 --- a/test/test77.c +++ b/test/test77.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include diff --git a/usr.sbin/installboot/minixfs3.c b/usr.sbin/installboot/minixfs3.c index 8009e5a89..cf491b8b9 100644 --- a/usr.sbin/installboot/minixfs3.c +++ b/usr.sbin/installboot/minixfs3.c @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include -- 2.11.4.GIT