decouple conservative file descriptor use from MKSH_SMALL, with the

new MKSH_CONSERVATIVE_FDS præprocessor flag, because Minix 3, for
example, needs it (otherwise “mksh Build.sh” fails)
This commit is contained in:
tg 2009-04-06 08:33:37 +00:00
parent b6dcee70fd
commit e88736b5ef
3 changed files with 15 additions and 8 deletions

View File

@ -1,9 +1,10 @@
#!/bin/sh #!/bin/sh
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.387 2009/04/06 08:29:21 tg Exp $' srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.388 2009/04/06 08:33:36 tg Exp $'
#- #-
# Environment used: CC CFLAGS CPPFLAGS LDFLAGS LIBS NOWARN NROFF TARGET_OS # Environment used: CC CFLAGS CPPFLAGS LDFLAGS LIBS NOWARN NROFF TARGET_OS
# CPPFLAGS recognised: MKSH_SMALL MKSH_ASSUME_UTF8 MKSH_NOPWNAM MKSH_NOVI # CPPFLAGS recognised: MKSH_SMALL MKSH_ASSUME_UTF8 MKSH_NOPWNAM MKSH_NOVI
# MKSH_CLS_STRING MKSH_BINSHREDUCED MKSH_UNEMPLOYED # MKSH_CLS_STRING MKSH_BINSHREDUCED MKSH_UNEMPLOYED
# MKSH_CONSERVATIVE_FDS
LC_ALL=C LC_ALL=C
export LC_ALL export LC_ALL
@ -322,8 +323,8 @@ Linux)
MidnightBSD) MidnightBSD)
;; ;;
Minix) Minix)
CPPFLAGS="$CPPFLAGS -D_POSIX_SOURCE -D_POSIX_1_SOURCE=2" CPPFLAGS="$CPPFLAGS -DMKSH_UNEMPLOYED -DMKSH_CONSERVATIVE_FDS"
CPPFLAGS="$CPPFLAGS -DMKSH_UNEMPLOYED -D_MINIX" CPPFLAGS="$CPPFLAGS -D_POSIX_SOURCE -D_POSIX_1_SOURCE=2 -D_MINIX"
warn=" but will probably work with GCC" warn=" but will probably work with GCC"
warn="$warn${nl}but not with ACK - /usr/bin/cc - yet)" warn="$warn${nl}but not with ACK - /usr/bin/cc - yet)"
oldish_ed=no-stderr-ed # /usr/bin/ed(!) is broken oldish_ed=no-stderr-ed # /usr/bin/ed(!) is broken
@ -388,6 +389,11 @@ case " $CPPFLAGS " in
: ${HAVE_SETLOCALE_CTYPE=0} : ${HAVE_SETLOCALE_CTYPE=0}
;; ;;
esac esac
case " $CPPFLAGS " in
*\ -DMKSH_CONSERVATIVE_FDS\ *|*\ -DMKSH_CONSERVATIVE_FDS=*)
check_categories=$check_categories,convfds
;;
esac
if test -n "$warn"; then if test -n "$warn"; then
echo "Warning: mksh has not yet been ported to or tested on your" >&2 echo "Warning: mksh has not yet been ported to or tested on your" >&2
@ -887,6 +893,7 @@ if test 0 = $HAVE_MKSH_FULL; then
: ${HAVE_MKNOD=0} : ${HAVE_MKNOD=0}
check_categories=$check_categories,smksh check_categories=$check_categories,smksh
check_categories=$check_categories,convfds
fi fi
if test 1 = $HAVE_MKSH_REDUCED; then if test 1 = $HAVE_MKSH_REDUCED; then
check_categories=$check_categories,binsh check_categories=$check_categories,binsh

View File

@ -1,4 +1,4 @@
# $MirOS: src/bin/mksh/check.t,v 1.268 2009/04/05 12:35:29 tg Exp $ # $MirOS: src/bin/mksh/check.t,v 1.269 2009/04/06 08:33:36 tg Exp $
# $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas Exp $ # $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas Exp $
# $OpenBSD: history.t,v 1.5 2001/01/28 23:04:56 niklas Exp $ # $OpenBSD: history.t,v 1.5 2001/01/28 23:04:56 niklas Exp $
# $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $ # $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $
@ -5420,7 +5420,7 @@ expected-stdout:
name: mkshiop-1 name: mkshiop-1
description: description:
Check for support of more than 9 file descriptors Check for support of more than 9 file descriptors
category: !smksh category: !convfds
stdin: stdin:
read -u10 foo 10<<< bar read -u10 foo 10<<< bar
print x$foo print x$foo
@ -5430,7 +5430,7 @@ expected-stdout:
name: mkshiop-2 name: mkshiop-2
description: description:
Check for support of more than 9 file descriptors Check for support of more than 9 file descriptors
category: !smksh category: !convfds
stdin: stdin:
exec 12>foo exec 12>foo
print -u12 bar print -u12 bar

4
sh.h
View File

@ -102,7 +102,7 @@
#define __SCCSID(x) __IDSTRING(sccsid,x) #define __SCCSID(x) __IDSTRING(sccsid,x)
#ifdef EXTERN #ifdef EXTERN
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.288 2009/04/05 12:35:32 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/sh.h,v 1.289 2009/04/06 08:33:37 tg Exp $");
#endif #endif
#define MKSH_VERSION "R37 2009/04/05" #define MKSH_VERSION "R37 2009/04/05"
@ -285,7 +285,7 @@ typedef int32_t mksh_ari_t;
typedef uint32_t mksh_uari_t; typedef uint32_t mksh_uari_t;
/* these shall be smaller than 100 */ /* these shall be smaller than 100 */
#ifdef MKSH_SMALL #if defined(MKSH_SMALL) || defined(MKSH_CONSERVATIVE_FDS)
#define NUFILE 32 /* Number of user-accessible files */ #define NUFILE 32 /* Number of user-accessible files */
#define FDBASE 10 /* First file usable by Shell */ #define FDBASE 10 /* First file usable by Shell */
#else #else