Reduce compiler/libraries/headers cases to only two

1. ack, a.out, minix headers (moved to /usr/include.ack),
	   minix libc
	2. gcc/clang, elf, netbsd headers (moved to /usr/include),
	   netbsd libc (moved to /usr/lib)

So this obsoletes the /usr/netbsd hierarchy.

No special invocation for netbsd libc necessary - it's always used
for gcc/clang.
This commit is contained in:
Ben Gras 2011-07-01 15:57:43 +02:00
parent a0e986b1f9
commit f3d5a9dc61
50 changed files with 355 additions and 178 deletions

View file

@ -98,6 +98,7 @@ clean:
$(MAKE) -C test clean $(MAKE) -C test clean
cleandepend: cleandepend:
$(MAKE) -C lib cleandepend_all
$(MAKE) -C boot cleandepend $(MAKE) -C boot cleandepend
$(MAKE) -C commands cleandepend $(MAKE) -C commands cleandepend
$(MAKE) -C bin cleandepend $(MAKE) -C bin cleandepend

View file

@ -5,9 +5,6 @@
PROG= acd PROG= acd
CPPFLAGS+= -DARCH=\"`arch`\" -DDESCR=\"/usr/lib/descr\" CPPFLAGS+= -DARCH=\"`arch`\" -DDESCR=\"/usr/lib/descr\"
LINKS+= ${BINDIR}/acd ${BINDIR}/cc LINKS+= ${BINDIR}/acd ${BINDIR}/cc
FILESDIR= /usr/lib
FILES= acd.descr
FILESNAME= descr
MAN= MAN=
.include <bsd.prog.mk> .include <bsd.prog.mk>

View file

@ -2,7 +2,7 @@
.PATH: ${MINIXSRCDIR}/common/include/arch/i386 .PATH: ${MINIXSRCDIR}/common/include/arch/i386
INCS+= archtypes.h bios.h cmos.h cpu.h diskparm.h fpu.h int86.h \ INCS+= archtypes.h bios.h cmos.h cpu.h diskparm.h fpu.h int86.h \
interrupt.h memory.h partition.h \ interrupt.h memory.h multiboot.h partition.h \
pci.h pci_amd.h pci_intel.h pci_sis.h pci_via.h \ pci.h pci_amd.h pci_intel.h pci_sis.h pci_via.h \
ports.h stackframe.h vm.h elf.h ports.h stackframe.h vm.h elf.h

View file

@ -1,3 +1,34 @@
20110701:
# rm -rf /usr/include /usr/netbsd
# make etcfiles includes cleandepend depend gnu-includes
DOWNGRADING:
Important: this automatically updates your /usr/lib/descr,
something you will have to revert manually if you
want to go back a revision! Previous to this
revision, you do this by:
# cp commands/acd/acd.descr /usr/lib/descr
Repeating the above commands to make sure your /usr/include
is re-acked is probably a good idea too for going back revisions.
This change moves
1. /usr/include to /usr/include.ack
2. /usr/netbsd/include to /usr/include
Reduce compiler cases to only two:
1. ack, a.out, minix headers (moved to /usr/include.ack),
minix libc
2. gcc/clang, elf, netbsd headers (moved to /usr/include),
netbsd libc (moved to /usr/lib)
So this obsoletes the /usr/netbsd hierarchy.
There are no specific UPDATING instructions, but you should know
that starting with this version, gcc/clang use the netbsd libc and
headers system exclusively, and those files are in the standard
locations now. It's the first step to switching completely and
simplifying building.
20110629: 20110629:
Rebuild m4: Rebuild m4:
make -C usr.bin/m4 install make -C usr.bin/m4 install

View file

@ -13,8 +13,8 @@ USRFILES=Makefile
clean:: clean::
install:: install::
@echo "Installing /etc and /usr/etc.." @echo "Installing /etc, /usr/etc and /usr/lib.."
mkdir -p $(ETC) mkdir -p $(ETC) $(USRLIB)
@for f in $(FILES1); do if [ -f $(ETC)/$$f ]; then :; else cp $$f $(ETC)/$$f; chmod 755 $(ETC)/$$f; fi; done @for f in $(FILES1); do if [ -f $(ETC)/$$f ]; then :; else cp $$f $(ETC)/$$f; chmod 755 $(ETC)/$$f; fi; done
@for f in $(FILES2); do if [ -f $(ETC)/$$f ]; then :; else cp $$f $(ETC)/$$f; chmod 600 $(ETC)/$$f; fi; done @for f in $(FILES2); do if [ -f $(ETC)/$$f ]; then :; else cp $$f $(ETC)/$$f; chmod 600 $(ETC)/$$f; fi; done
@for f in $(USRFILES); do cp usr/$$f $(USR)/$$f; chmod 644 $(USR)/$$f; done @for f in $(USRFILES); do cp usr/$$f $(USR)/$$f; chmod 644 $(USR)/$$f; done
@ -29,6 +29,8 @@ install::
for u in /usr/ast ~root; do cp ast/.[aepv]* $$u ; done for u in /usr/ast ~root; do cp ast/.[aepv]* $$u ; done
@echo "Installing fonts.." @echo "Installing fonts.."
install -m 644 -o root -g operator fonts/*.fnt /usr/lib/fonts/ install -m 644 -o root -g operator fonts/*.fnt /usr/lib/fonts/
@echo "Installing /usr/lib/descr.."
install -m 644 -o root -g operator descr /usr/lib/
installforce:: $(ETC)/rc $(ETC)/rs.inet $(ETC)/rs.single $(ETC)/system.conf $(USRETC)/rc $(USR)/Makefile installforce:: $(ETC)/rc $(ETC)/rs.inet $(ETC)/rs.single $(ETC)/system.conf $(USRETC)/rc $(USR)/Makefile

View file

@ -18,7 +18,7 @@ ifndef ARCH
import ARCH import ARCH
# Compiler passes. # Compiler passes.
ACK_CPP = $A/cpp.ansi $CPP_F $PREDEF $NOLINENO ACK_CPP = $A/cpp.ansi $CPP_F $PREDEF $NOLINENO -I/usr/include.ack
ACK_CEM = $A/em_cemcom.ansi -L $CPP_F $PREDEF \ ACK_CEM = $A/em_cemcom.ansi -L $CPP_F $PREDEF \
-Vw${W}.${W}i${W}.${W}p${P}.${W}f4.${W}s2.2l4.${W}d8.${W} -Vw${W}.${W}i${W}.${W}p${P}.${W}f4.${W}s2.2l4.${W}d8.${W}
ACK_M2 = $A/em_m2 -I$MOD_INCL -WR \ ACK_M2 = $A/em_m2 -I$MOD_INCL -WR \
@ -298,7 +298,7 @@ transform "" .E
# Compile C source to EM-code. # Compile C source to EM-code.
transform .c .k transform .c .k
transform .i .k transform .i .k
$ACK_CEM $* $> $ACK_CEM -I/usr/include.ack $* $>
ifndef RTSO ifndef RTSO
RTSO = -.c RTSO = -.c
LIBS = $LIBS + -.c LIBS = $LIBS + -.c

View file

@ -21,16 +21,16 @@
755 root operator /usr/pkg/etc 755 root operator /usr/pkg/etc
755 root operator /usr/pkg/etc/rc.d 755 root operator /usr/pkg/etc/rc.d
755 root operator /home 755 root operator /home
755 root operator /usr/include 755 root operator /usr/include.ack
755 root operator /usr/include/i386 755 root operator /usr/include.ack/i386
755 root operator /usr/include/arpa 755 root operator /usr/include.ack/arpa
755 root operator /usr/include/minix 755 root operator /usr/include.ack/minix
755 root operator /usr/include/net 755 root operator /usr/include.ack/net
755 root operator /usr/include/net/gen 755 root operator /usr/include.ack/net/gen
755 root operator /usr/include/netinet 755 root operator /usr/include.ack/netinet
755 root operator /usr/include/sys 755 root operator /usr/include.ack/sys
755 root operator /usr/include/ddekit 755 root operator /usr/include.ack/ddekit
755 root operator /usr/include/ddekit/minix 755 root operator /usr/include.ack/ddekit/minix
755 root operator /usr/lib 755 root operator /usr/lib
755 root operator /usr/lib/advent 755 root operator /usr/lib/advent
755 root operator /usr/lib/cawf 755 root operator /usr/lib/cawf
@ -55,22 +55,20 @@
755 root operator /usr/man/man8 755 root operator /usr/man/man8
755 root operator /usr/man/man9 755 root operator /usr/man/man9
755 root operator /usr/mdec 755 root operator /usr/mdec
755 root operator /usr/netbsd 755 root operator /usr/include
755 root operator /usr/netbsd/include 755 root operator /usr/include/i386
755 root operator /usr/netbsd/include/i386 755 root operator /usr/include/arpa
755 root operator /usr/netbsd/include/arpa 755 root operator /usr/include/compat
755 root operator /usr/netbsd/include/compat 755 root operator /usr/include/compat/machine
755 root operator /usr/netbsd/include/compat/machine 755 root operator /usr/include/ddekit
755 root operator /usr/netbsd/include/ddekit 755 root operator /usr/include/ddekit/minix
755 root operator /usr/netbsd/include/ddekit/minix 755 root operator /usr/include/minix
755 root operator /usr/netbsd/include/minix 755 root operator /usr/include/net
755 root operator /usr/netbsd/include/net 755 root operator /usr/include/net/gen
755 root operator /usr/netbsd/include/net/gen 755 root operator /usr/include/protocols
755 root operator /usr/netbsd/include/protocols 755 root operator /usr/include/rpcsvc
755 root operator /usr/netbsd/include/rpcsvc 755 root operator /usr/include/ssp
755 root operator /usr/netbsd/include/ssp 755 root operator /usr/include/sys
755 root operator /usr/netbsd/include/sys
755 root operator /usr/netbsd/lib
700 root operator /usr/preserve 700 root operator /usr/preserve
755 root operator /usr/run 755 root operator /usr/run
755 root operator /usr/share 755 root operator /usr/share

View file

@ -21,7 +21,7 @@ INCS+= netinet/if_ether.h netinet/in.h netinet/tcp.h
.include <bsd.own.mk> .include <bsd.own.mk>
INCSDIR= /usr/include INCSDIR= /usr/include.ack
.include "${MINIXSRCDIR}/common/include/Makefile.inc" .include "${MINIXSRCDIR}/common/include/Makefile.inc"
.include "${MINIXSRCDIR}/common/include/Makefile.termios.inc" .include "${MINIXSRCDIR}/common/include/Makefile.termios.inc"

View file

@ -2,6 +2,6 @@
SUBDIR= ${ARCH} SUBDIR= ${ARCH}
INCSYMLINKS= ${MACHINE} /usr/include/machine INCSYMLINKS= ${MACHINE} /usr/include.ack/machine
.include <bsd.kinc.mk> .include <bsd.kinc.mk>

View file

@ -1,4 +1,4 @@
INCSDIR= /usr/include/i386 INCSDIR= /usr/include.ack/i386
INCS+= _align.h asm.h mcontext.h multiboot.h param.h INCS+= _align.h asm.h mcontext.h multiboot.h param.h

View file

@ -1,6 +1,6 @@
.include <bsd.sys.mk> .include <bsd.sys.mk>
INCSDIR= /usr/include/sys INCSDIR= /usr/include.ack/sys
INCS= asynchio.h dir.h file.h \ INCS= asynchio.h dir.h file.h \
ioctl.h ipc.h jmp_buf.h kbdio.h mman.h \ ioctl.h ipc.h jmp_buf.h kbdio.h mman.h \

View file

@ -44,3 +44,6 @@ clean_all:
sh ack_build.sh clean sh ack_build.sh clean
sh elf_build.sh clean sh elf_build.sh clean
cleandepend_all:
sh ack_build.sh cleandepend
sh elf_build.sh cleandepend

View file

@ -6,7 +6,5 @@ export CC=${CC:-clang}
export COMPILER_TYPE=gnu export COMPILER_TYPE=gnu
export PATH=$PATH:/usr/pkg/bin export PATH=$PATH:/usr/pkg/bin
export MAKEOBJDIR=obj-elfbase-nbsd export MAKEOBJDIR=obj-elfbase-nbsd NBSD_LIBC=yes
make $@ NBSD_LIBC=yes make $@
export MAKEOBJDIR=obj-elfbase
make $@ NBSD_LIBC=no

View file

@ -65,10 +65,10 @@ SRCS+= minix_utils.c
.endif .endif
CPPFLAGS+= -DHAVE_CONFIG_H CPPFLAGS+= -DHAVE_CONFIG_H
.if (${NBSD_LIBC} != "no") .if ${NBSD_LIBC} == "yes"
INCSDIR= /usr/netbsd/include
.else
INCSDIR= /usr/include INCSDIR= /usr/include
.else
INCSDIR= /usr/include.ack
.endif .endif
INCS= archive.h \ INCS= archive.h \
archive_entry.h archive_entry.h

View file

@ -8,10 +8,11 @@ SRCS= bzlib.c blocksort.c compress.c crctable.c decompress.c \
huffman.c randtable.c huffman.c randtable.c
CPPFLAGS+= -I ${BZ2DIR} CPPFLAGS+= -I ${BZ2DIR}
INCS= bzlib.h INCS= bzlib.h
.if (${NBSD_LIBC} != "no") .if (${NBSD_LIBC} != "no")
INCSDIR= /usr/netbsd/include
.else
INCSDIR= /usr/include INCSDIR= /usr/include
.else
INCSDIR= /usr/include.ack
.endif .endif
.include <bsd.lib.mk> .include <bsd.lib.mk>

View file

@ -1,10 +1,5 @@
# $Id$ # $Id$
# Requires NBSD_LIBC and clang/gcc (we default to using clang)
NBSD_LIBC:= yes
CC:=${CC:C/^cc/clang/}
COMPILER_TYPE:= gnu
LIB= elf LIB= elf
SRCS= elf.c \ SRCS= elf.c \
@ -163,11 +158,7 @@ libelf_convert.c: elf_types.m4 libelf_convert.m4
libelf_fsize.c: elf_types.m4 libelf_fsize.m4 libelf_fsize.c: elf_types.m4 libelf_fsize.m4
libelf_msize.c: elf_types.m4 libelf_msize.m4 libelf_msize.c: elf_types.m4 libelf_msize.m4
.if (${NBSD_LIBC} != "no")
INCSDIR= /usr/netbsd/include
.else
INCSDIR= /usr/include INCSDIR= /usr/include
.endif
.include <bsd.lib.mk> .include <bsd.lib.mk>

View file

@ -5,8 +5,9 @@ INCS= libexec.h
SRCS= exec_aout.c exec_elf.c SRCS= exec_aout.c exec_elf.c
.if (${NBSD_LIBC} != "no") .if (${NBSD_LIBC} != "no")
INCSDIR= /usr/netbsd/include
.else
INCSDIR= /usr/include INCSDIR= /usr/include
.else
INCSDIR= /usr/include.ack
.endif .endif
.include <bsd.lib.mk> .include <bsd.lib.mk>

View file

@ -6,9 +6,9 @@ SRCS= adler32.c compress.c crc32.c deflate.c gzclose.c gzlib.c gzread.c \
gzwrite.c infback.c inffast.c inflate.c inftrees.c trees.c uncompr.c zutil.c gzwrite.c infback.c inffast.c inflate.c inftrees.c trees.c uncompr.c zutil.c
.if (${NBSD_LIBC} != "no") .if (${NBSD_LIBC} != "no")
INCSDIR= /usr/netbsd/include
.else
INCSDIR= /usr/include INCSDIR= /usr/include
.else
INCSDIR= /usr/include.ack
.endif .endif
INCS= zconf.h zlib.h INCS= zconf.h zlib.h

View file

@ -2,8 +2,7 @@
.PATH: ${MINIXSRCDIR}/lib/libc/asyn .PATH: ${MINIXSRCDIR}/lib/libc/asyn
LIB= asyn LIB= asyn
INCS= asynchio.h INCS= asynchio.h
INCSDIR= /usr/netbsd/include/sys INCSDIR= /usr/include/sys
SRCS+= asyn_cancel.c asyn_close.c asyn_init.c asyn_pending.c asyn_read.c \ SRCS+= asyn_cancel.c asyn_close.c asyn_init.c asyn_pending.c asyn_read.c \
asyn_special.c asyn_synch.c asyn_wait.c asyn_write.c asyn_special.c asyn_synch.c asyn_wait.c asyn_write.c

View file

@ -1,5 +1,5 @@
NETBSDSRCDIR= ${MINIXSRCDIR} NETBSDSRCDIR= ${MINIXSRCDIR}
NETBSDINCLUDES= /usr/netbsd/include/ NETBSDINCLUDES= /usr/include/
MACHINE_ARCH?= i386 MACHINE_ARCH?= i386
CITRUS=yes CITRUS=yes

View file

@ -365,6 +365,24 @@ diff -ru nbsdsrc/src/lib/libc/gdtoa/gdtoa_locks.c lib/nbsd_libc/gdtoa/gdtoa_lock
+#ifdef _REENTRANT /* !__minix */ +#ifdef _REENTRANT /* !__minix */
mutex_t __gdtoa_locks[2] = { MUTEX_INITIALIZER, MUTEX_INITIALIZER }; mutex_t __gdtoa_locks[2] = { MUTEX_INITIALIZER, MUTEX_INITIALIZER };
+#endif /* _REENTRANT */ +#endif /* _REENTRANT */
diff -ru nbsdsrc/src/lib/libc/gdtoa/gdtoaimp.h lib/nbsd_libc/gdtoa/gdtoaimp.h
--- nbsdsrc/src/lib/libc/gdtoa/gdtoaimp.h
+++ lib/nbsd_libc/gdtoa/gdtoaimp.h
@@ -1,4 +1,4 @@
-/* $NetBSD: gdtoaimp.h,v 1.7 2009/05/07 20:31:44 christos Exp $ */
+/* $NetBSD: gdtoaimp.h,v 1.8 2011/01/21 23:36:49 christos Exp $ */
/****************************************************************
@@ -276,7 +276,7 @@
Exactly one of IEEE_LITTLE_ENDIAN, IEEE_BIG_ENDIAN, VAX, or IBM should be defined.
#endif
-typedef union { double d; ULong L[2]; } U;
+typedef union { double d; ULong L[2]; } __attribute__((__may_alias__)) U;
#ifdef YES_ALIAS
#define dval(x) x
diff -ru nbsdsrc/src/lib/libc/gen/Makefile.inc lib/nbsd_libc/gen/Makefile.inc diff -ru nbsdsrc/src/lib/libc/gen/Makefile.inc lib/nbsd_libc/gen/Makefile.inc
--- nbsdsrc/src/lib/libc/gen/Makefile.inc --- nbsdsrc/src/lib/libc/gen/Makefile.inc
+++ lib/nbsd_libc/gen/Makefile.inc +++ lib/nbsd_libc/gen/Makefile.inc
@ -953,6 +971,231 @@ diff -ru nbsdsrc/src/lib/libc/gen/getpwent.c lib/nbsd_libc/gen/getpwent.c
mutex_unlock(&_pwmutex); mutex_unlock(&_pwmutex);
switch (r) { switch (r) {
case NS_SUCCESS: case NS_SUCCESS:
diff -ru nbsdsrc/src/lib/libc/gen/glob.c lib/nbsd_libc/gen/glob.c
--- nbsdsrc/src/lib/libc/gen/glob.c
+++ lib/nbsd_libc/gen/glob.c
@@ -1,4 +1,4 @@
-/* $NetBSD: glob.c,v 1.27 2010/09/06 14:40:25 christos Exp $ */
+/* $NetBSD: glob.c,v 1.28 2011/01/21 23:30:31 christos Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)glob.c 8.3 (Berkeley) 10/13/93";
#else
-__RCSID("$NetBSD: glob.c,v 1.27 2010/09/06 14:40:25 christos Exp $");
+__RCSID("$NetBSD: glob.c,v 1.28 2011/01/21 23:30:31 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -87,13 +87,18 @@
#define NO_GETPW_R
#endif
-#define GLOB_LIMIT_MALLOC 65536
-#define GLOB_LIMIT_STAT 128
-#define GLOB_LIMIT_READDIR 16384
+#define GLOB_LIMIT_STRING 65536 /* number of readdirs */
+#define GLOB_LIMIT_STAT 128 /* number of stat system calls */
+#define GLOB_LIMIT_READDIR 16384 /* total buffer size of path strings */
+#define GLOB_LIMIT_PATH 1024 /* number of path elements */
+#define GLOB_LIMIT_BRACE 128 /* Number of brace calls */
-#define GLOB_INDEX_MALLOC 0
-#define GLOB_INDEX_STAT 1
-#define GLOB_INDEX_READDIR 2
+struct glob_limit {
+ size_t l_string;
+ size_t l_stat;
+ size_t l_readdir;
+ size_t l_brace;
+};
/*
* XXX: For NetBSD 1.4.x compatibility. (kill me l8r)
@@ -158,17 +163,17 @@
static DIR *g_opendir(Char *, glob_t *);
static Char *g_strchr(const Char *, int);
static int g_stat(Char *, __gl_stat_t *, glob_t *);
-static int glob0(const Char *, glob_t *, size_t *);
-static int glob1(Char *, glob_t *, size_t *);
+static int glob0(const Char *, glob_t *, struct glob_limit *);
+static int glob1(Char *, glob_t *, struct glob_limit *);
static int glob2(Char *, Char *, Char *, const Char *, glob_t *,
- size_t *);
+ struct glob_limit *);
static int glob3(Char *, Char *, Char *, const Char *, const Char *,
- const Char *, glob_t *, size_t *);
-static int globextend(const Char *, glob_t *, size_t *);
+ const Char *, glob_t *, struct glob_limit *);
+static int globextend(const Char *, glob_t *, struct glob_limit *);
static const Char *globtilde(const Char *, Char *, size_t, glob_t *);
-static int globexp1(const Char *, glob_t *, size_t *);
+static int globexp1(const Char *, glob_t *, struct glob_limit *);
static int globexp2(const Char *, const Char *, glob_t *, int *,
- size_t *);
+ struct glob_limit *);
static int match(const Char *, const Char *, const Char *);
#ifdef DEBUG
static void qprintf(const char *, Char *);
@@ -181,8 +186,7 @@
const u_char *patnext;
int c;
Char *bufnext, *bufend, patbuf[MAXPATHLEN+1];
- /* 0 = malloc(), 1 = stat(), 2 = readdir() */
- size_t limit[] = { 0, 0, 0 };
+ struct glob_limit limit = { 0, 0, 0, 0 };
_DIAGASSERT(pattern != NULL);
@@ -218,9 +222,9 @@
*bufnext = EOS;
if (flags & GLOB_BRACE)
- return globexp1(patbuf, pglob, limit);
+ return globexp1(patbuf, pglob, &limit);
else
- return glob0(patbuf, pglob, limit);
+ return glob0(patbuf, pglob, &limit);
}
/*
@@ -229,7 +233,7 @@
* characters
*/
static int
-globexp1(const Char *pattern, glob_t *pglob, size_t *limit)
+globexp1(const Char *pattern, glob_t *pglob, struct glob_limit *limit)
{
const Char* ptr = pattern;
int rv;
@@ -237,6 +241,12 @@
_DIAGASSERT(pattern != NULL);
_DIAGASSERT(pglob != NULL);
+ if ((pglob->gl_flags & GLOB_LIMIT) &&
+ limit->l_brace++ >= GLOB_LIMIT_BRACE) {
+ errno = 0;
+ return GLOB_NOSPACE;
+ }
+
/* Protect a single {}, for find(1), like csh */
if (pattern[0] == LBRACE && pattern[1] == RBRACE && pattern[2] == EOS)
return glob0(pattern, pglob, limit);
@@ -256,7 +266,7 @@
*/
static int
globexp2(const Char *ptr, const Char *pattern, glob_t *pglob, int *rv,
- size_t *limit)
+ struct glob_limit *limit)
{
int i;
Char *lm, *ls;
@@ -461,7 +471,7 @@
* to find no matches.
*/
static int
-glob0(const Char *pattern, glob_t *pglob, size_t *limit)
+glob0(const Char *pattern, glob_t *pglob, struct glob_limit *limit)
{
const Char *qpatnext;
int c, error;
@@ -570,7 +580,7 @@
}
static int
-glob1(Char *pattern, glob_t *pglob, size_t *limit)
+glob1(Char *pattern, glob_t *pglob, struct glob_limit *limit)
{
Char pathbuf[MAXPATHLEN+1];
@@ -596,7 +606,7 @@
*/
static int
glob2(Char *pathbuf, Char *pathend, Char *pathlim, const Char *pattern,
- glob_t *pglob, size_t *limit)
+ glob_t *pglob, struct glob_limit *limit)
{
__gl_stat_t sb;
const Char *p;
@@ -624,10 +634,11 @@
return 0;
if ((pglob->gl_flags & GLOB_LIMIT) &&
- limit[GLOB_INDEX_STAT]++ >= GLOB_LIMIT_STAT) {
+ limit->l_stat++ >= GLOB_LIMIT_STAT) {
errno = 0;
*pathend++ = SEP;
*pathend = EOS;
+printf("stat limit\n");
return GLOB_NOSPACE;
}
if (((pglob->gl_flags & GLOB_MARK) &&
@@ -692,7 +703,7 @@
static int
glob3(Char *pathbuf, Char *pathend, Char *pathlim, const Char *pattern,
const Char *restpattern, const Char *pglobstar, glob_t *pglob,
- size_t *limit)
+ struct glob_limit *limit)
{
struct dirent *dp;
DIR *dirp;
@@ -785,7 +796,7 @@
Char *dc;
if ((pglob->gl_flags & GLOB_LIMIT) &&
- limit[GLOB_INDEX_READDIR]++ >= GLOB_LIMIT_READDIR) {
+ limit->l_readdir++ >= GLOB_LIMIT_READDIR) {
errno = 0;
*pathend++ = SEP;
*pathend = EOS;
@@ -894,7 +905,7 @@
* gl_pathv points to (gl_offs + gl_pathc + 1) items.
*/
static int
-globextend(const Char *path, glob_t *pglob, size_t *limit)
+globextend(const Char *path, glob_t *pglob, struct glob_limit *limit)
{
char **pathv;
size_t i, newsize, len;
@@ -905,6 +916,9 @@
_DIAGASSERT(pglob != NULL);
newsize = sizeof(*pathv) * (2 + pglob->gl_pathc + pglob->gl_offs);
+ if ((pglob->gl_flags & GLOB_LIMIT) &&
+ newsize > GLOB_LIMIT_PATH * sizeof(*pathv))
+ goto nospace;
pathv = pglob->gl_pathv ? realloc(pglob->gl_pathv, newsize) :
malloc(newsize);
if (pathv == NULL)
@@ -921,7 +935,7 @@
for (p = path; *p++;)
continue;
len = (size_t)(p - path);
- limit[GLOB_INDEX_MALLOC] += len;
+ limit->l_string += len;
if ((copy = malloc(len)) != NULL) {
if (g_Ctoc(path, copy, len)) {
free(copy);
@@ -932,12 +946,13 @@
pathv[pglob->gl_offs + pglob->gl_pathc] = NULL;
if ((pglob->gl_flags & GLOB_LIMIT) &&
- (newsize + limit[GLOB_INDEX_MALLOC]) >= GLOB_LIMIT_MALLOC) {
- errno = 0;
- return GLOB_NOSPACE;
- }
+ (newsize + limit->l_string) >= GLOB_LIMIT_STRING)
+ goto nospace;
return copy == NULL ? GLOB_NOSPACE : 0;
+nospace:
+ errno = 0;
+ return GLOB_NOSPACE;
}
diff -ru nbsdsrc/src/lib/libc/gen/gr_private.h lib/nbsd_libc/gen/gr_private.h diff -ru nbsdsrc/src/lib/libc/gen/gr_private.h lib/nbsd_libc/gen/gr_private.h
--- nbsdsrc/src/lib/libc/gen/gr_private.h --- nbsdsrc/src/lib/libc/gen/gr_private.h
+++ lib/nbsd_libc/gen/gr_private.h +++ lib/nbsd_libc/gen/gr_private.h

View file

@ -3,7 +3,7 @@ NOOBJ= # defined
.include <bsd.own.mk> .include <bsd.own.mk>
FILES=libc.pc FILES=libc.pc
FILESDIR=/usr/netbsd/lib FILESDIR=/usr/lib
FILESMODE=444 FILESMODE=444
.include <bsd.prog.mk> .include <bsd.prog.mk>

View file

@ -1,5 +1,4 @@
Name: c Name: c
Description: NetBSD C Library Description: NetBSD C Library
Version: 1.0 Version: 1.0
Libs: -nostdlib /usr/netbsd/lib/crt1.o /usr/netbsd/lib/crti.o /usr/netbsd/lib/crtn.o -L/usr/netbsd/lib -lc -L/usr/pkg/lib -lgcc -L/usr/netbsd/lib -lminlib -lcompat_minix Libs: -lc -lminlib -lcompat_minix
Cflags: -nostdinc -D__NBSD_LIBC -isystem /usr/netbsd/include

View file

@ -1,6 +1,6 @@
.PATH: ${MINIXSRCDIR}/lib/nbsd_libcompat_minix/include .PATH: ${MINIXSRCDIR}/lib/nbsd_libcompat_minix/include
INCSDIR= /usr/netbsd/include INCSDIR= /usr/include
INCS+= configfile.h termcap.h INCS+= configfile.h termcap.h
INCS+= compat/a.out.h compat/regexp.h compat/syslog.h \ INCS+= compat/a.out.h compat/regexp.h compat/syslog.h \

View file

@ -3,7 +3,7 @@ NOOBJ= # defined
.include <bsd.own.mk> .include <bsd.own.mk>
FILES=compat_minix.pc FILES=compat_minix.pc
FILESDIR=/usr/netbsd/lib FILESDIR=/usr/lib
FILESMODE=444 FILESMODE=444
.include <bsd.prog.mk> .include <bsd.prog.mk>

View file

@ -1,5 +1,4 @@
Name: compat_minix Name: compat_minix
Description: Minix Compatibility Library Description: Minix Compatibility Library
Version: 1.0 Version: 1.0
Libs: -L/usr/netbsd/lib -lcompat_minix Libs: -lcompat_minix
Cflags: -I/usr/netbsd/include

View file

@ -1,6 +1,6 @@
.include <bsd.own.mk> .include <bsd.own.mk>
.PATH: ${.CURDIR} ${.CURDIR}/${MACHINE} .PATH: ${.CURDIR} ${.CURDIR}/${MACHINE}
INCSDIR= /usr/netbsd/include INCSDIR= /usr/include
LIB= minlib LIB= minlib
CPPFLAGS.fslib.c+= -I${MINIXSRCDIR}/servers CPPFLAGS.fslib.c+= -I${MINIXSRCDIR}/servers

View file

@ -3,7 +3,7 @@ NOOBJ= # defined
.include <bsd.own.mk> .include <bsd.own.mk>
FILES=minlib.pc FILES=minlib.pc
FILESDIR=/usr/netbsd/lib FILESDIR=/usr/lib
FILESMODE=444 FILESMODE=444
.include <bsd.prog.mk> .include <bsd.prog.mk>

View file

@ -1,6 +1,6 @@
Name: minlib Name: minlib
Description: Minix Compatibility Library Description: Minix Compatibility Library
Version: 1.0 Version: 1.0
Libs: -L/usr/netbsd/lib -lminlib Libs: -lminlib
Cflags: -I/usr/netbsd/include Cflags:

View file

@ -59,11 +59,7 @@ INCS+= ieeefp.h
.include <bsd.own.mk> .include <bsd.own.mk>
.if defined(__MINIX)
INCSDIR= /usr/netbsd/include
.else
INCSDIR= /usr/include INCSDIR= /usr/include
.endif
.if defined(__MINIX) .if defined(__MINIX)
# RPC is not compiled in the libc. This include also needs # RPC is not compiled in the libc. This include also needs

View file

@ -53,10 +53,10 @@ SUBDIR+= xen
# x68k x86_64 xen \ # x68k x86_64 xen \
# zaurus # zaurus
INCSYMLINKS= ${MACHINE} /usr/netbsd/include/machine INCSYMLINKS= ${MACHINE} /usr/include/machine
INCSYMLINKS+= machine/float.h /usr/netbsd/include/float.h \ INCSYMLINKS+= machine/float.h /usr/include/float.h \
machine/stdarg.h /usr/netbsd/include/stdarg.h machine/stdarg.h /usr/include/stdarg.h
.include <bsd.inc.mk> .include <bsd.inc.mk>

View file

@ -1,7 +1,7 @@
# $NetBSD: Makefile,v 1.36 2007/12/20 23:46:12 ad Exp $ # $NetBSD: Makefile,v 1.36 2007/12/20 23:46:12 ad Exp $
.include <bsd.own.mk> .include <bsd.own.mk>
INCSDIR= /usr/netbsd/include/i386 INCSDIR= /usr/include/i386
INCS= ansi.h asm.h bswap.h byte_swap.h cdefs.h \ INCS= ansi.h asm.h bswap.h byte_swap.h cdefs.h \
endian.h endian_machdep.h fenv.h float.h ieee.h \ endian.h endian_machdep.h fenv.h float.h ieee.h \

View file

@ -1,6 +1,6 @@
# $NetBSD: Makefile,v 1.13 2008/05/11 15:32:20 ad Exp $ # $NetBSD: Makefile,v 1.13 2008/05/11 15:32:20 ad Exp $
INCSDIR=/usr/netbsd/include/x86 INCSDIR=/usr/include/x86
INCS= float.h \ INCS= float.h \
ieee.h \ ieee.h \

View file

@ -38,15 +38,9 @@ diff -ru nbsdsrc/src/include/Makefile nbsd_include/Makefile
INCS+= arpa/ftp.h arpa/inet.h arpa/nameser.h arpa/nameser_compat.h \ INCS+= arpa/ftp.h arpa/inet.h arpa/nameser.h arpa/nameser_compat.h \
arpa/telnet.h arpa/tftp.h arpa/telnet.h arpa/tftp.h
INCS+= protocols/dumprestore.h protocols/routed.h protocols/rwhod.h \ INCS+= protocols/dumprestore.h protocols/routed.h protocols/rwhod.h \
@@ -40,10 +59,28 @@ @@ -42,8 +61,22 @@
.include <bsd.own.mk>
+.if defined(__MINIX)
+INCSDIR= /usr/netbsd/include
+.else
INCSDIR= /usr/include INCSDIR= /usr/include
+.endif
+.if defined(__MINIX) +.if defined(__MINIX)
+# RPC is not compiled in the libc. This include also needs +# RPC is not compiled in the libc. This include also needs
@ -197,21 +191,6 @@ diff -ru nbsdsrc/src/include/pwd.h nbsd_include/pwd.h
#ifndef _PWD_H_ #ifndef _PWD_H_
#define _PWD_H_ #define _PWD_H_
diff -ru nbsdsrc/src/include/rpc/Makefile nbsd_include/rpc/Makefile
--- nbsdsrc/src/include/rpc/Makefile
+++ nbsd_include/rpc/Makefile
@@ -7,7 +7,11 @@
svc.h svc_auth.h svc_soc.h types.h xdr.h
RPC_INCS= rpcb_prot.h
+.if defined(__MINIX)
+INCSDIR= /usr/netbsd/include/rpc
+.else
INCSDIR= /usr/include/rpc
+.endif
.include <bsd.rpc.mk>
.include <bsd.prog.mk>
diff -ru nbsdsrc/src/include/sched.h nbsd_include/sched.h diff -ru nbsdsrc/src/include/sched.h nbsd_include/sched.h
--- nbsdsrc/src/include/sched.h --- nbsdsrc/src/include/sched.h
+++ nbsd_include/sched.h +++ nbsd_include/sched.h

View file

@ -2,7 +2,7 @@ NOOBJ= # defined
.include <bsd.own.mk> .include <bsd.own.mk>
INCSDIR= /usr/netbsd/include/minix INCSDIR= /usr/include/minix
INCS+= dirent.h paths.h types.h INCS+= dirent.h paths.h types.h

View file

@ -1,4 +1,4 @@
INCSDIR= /usr/netbsd/include/net INCSDIR= /usr/include/net
INCS+= hton.h ethertypes.h if.h if_ether.h netlib.h INCS+= hton.h ethertypes.h if.h if_ether.h netlib.h

View file

@ -1,4 +1,4 @@
INCSDIR= /usr/netbsd/include/netinet INCSDIR= /usr/include/netinet
INCS+= in.h tcp.h INCS+= in.h tcp.h

View file

@ -1,4 +1,4 @@
INCSDIR= /usr/netbsd/include/netinet6 INCSDIR= /usr/include/netinet6
INCS+= in6.h INCS+= in6.h

View file

@ -7,11 +7,7 @@ INCS= auth.h auth_unix.h clnt.h clnt_soc.h nettype.h \
svc.h svc_auth.h svc_soc.h types.h xdr.h svc.h svc_auth.h svc_soc.h types.h xdr.h
RPC_INCS= rpcb_prot.h RPC_INCS= rpcb_prot.h
.if defined(__MINIX)
INCSDIR= /usr/netbsd/include/rpc
.else
INCSDIR= /usr/include/rpc INCSDIR= /usr/include/rpc
.endif
.include <bsd.rpc.mk> .include <bsd.rpc.mk>
.include <bsd.prog.mk> .include <bsd.prog.mk>

View file

@ -1,7 +1,7 @@
# $NetBSD: Makefile,v 1.126 2010/03/01 21:10:13 darran Exp $ # $NetBSD: Makefile,v 1.126 2010/03/01 21:10:13 darran Exp $
NETBSDINCSDIR= /usr/netbsd/include NETBSDINCSDIR= /usr/include
INCSDIR= /usr/netbsd/include/sys INCSDIR= /usr/include/sys
.include <bsd.sys.mk> .include <bsd.sys.mk>

View file

@ -1,8 +1,5 @@
.include <bsd.own.mk> .include <bsd.own.mk>
SUBDIR= mk SUBDIR= mk zoneinfo
.if (${NBSD_LIBC} == "no")
SUBDIR+= zoneinfo
.endif
.include <bsd.subdir.mk> .include <bsd.subdir.mk>

View file

@ -8,7 +8,7 @@ FILES= bsd.ack.mk bsd.dep.mk bsd.files.mk \
bsd.init.mk bsd.kinc.mk bsd.klinks.mk bsd.lib.mk \ bsd.init.mk bsd.kinc.mk bsd.klinks.mk bsd.lib.mk \
bsd.links.mk bsd.man.mk bsd.obj.mk bsd.own.mk \ bsd.links.mk bsd.man.mk bsd.obj.mk bsd.own.mk \
bsd.prog.mk bsd.subdir.mk bsd.sys.mk bsd.gcov.mk \ bsd.prog.mk bsd.subdir.mk bsd.sys.mk bsd.gcov.mk \
minix.libc.mk pkgsrchooks.mk sys.mk pkgsrchooks.mk sys.mk
# MINIX-specific files # MINIX-specific files
FILES+= minix.bootprog.mk FILES+= minix.bootprog.mk

View file

@ -541,12 +541,6 @@ OBJECT_FMT= ELF
OBJECT_FMT= a.out OBJECT_FMT= a.out
.endif .endif
.if ${COMPILER_TYPE} == "gnu"
.if defined(NBSD_LIBC) && (${NBSD_LIBC} != "no")
LIBDIR= /usr/netbsd/lib
.endif
.endif
# #
# If this platform's toolchain is missing, we obviously cannot build it. # If this platform's toolchain is missing, we obviously cannot build it.
# #

View file

@ -28,12 +28,8 @@ cleanprog: .PHONY cleanobjs cleanextra
##### Default values ##### Default values
.if empty(CPPFLAGS:M-nostdinc) .if empty(CPPFLAGS:M-nostdinc)
.if (${NBSD_LIBC} == "yes")
CPPFLAGS+= ${DESTDIR:D-nostdinc ${CPPFLAG_ISYSTEM} ${DESTDIR}/usr/netbsd/include}
.else
CPPFLAGS+= ${DESTDIR:D-nostdinc ${CPPFLAG_ISYSTEM} ${DESTDIR}/usr/include} CPPFLAGS+= ${DESTDIR:D-nostdinc ${CPPFLAG_ISYSTEM} ${DESTDIR}/usr/include}
.endif .endif
.endif
.if empty(CXXFLAGS:M-nostdinc++) .if empty(CXXFLAGS:M-nostdinc++)
CXXFLAGS+= ${DESTDIR:D-nostdinc++ ${CPPFLAG_ISYSTEMXX} ${DESTDIR}/usr/include/g++} CXXFLAGS+= ${DESTDIR:D-nostdinc++ ${CPPFLAG_ISYSTEMXX} ${DESTDIR}/usr/include/g++}
.endif .endif
@ -69,12 +65,8 @@ LIB${_lib:tu}= ${DESTDIR}/usr/lib/lib${_lib}.a
.if ${COMPILER_TYPE} == "ack" .if ${COMPILER_TYPE} == "ack"
LIB${_lib:tu}= ${DESTDIR}/usr/lib/i386/lib${_lib}.a LIB${_lib:tu}= ${DESTDIR}/usr/lib/i386/lib${_lib}.a
.elif ${COMPILER_TYPE} == "gnu" .elif ${COMPILER_TYPE} == "gnu"
.if defined(NBSD_LIBC) && (${NBSD_LIBC} != "no")
LIB${_lib:tu}= ${DESTDIR}/usr/netbsd/lib/lib${_lib}.a
.else
LIB${_lib:tu}= ${DESTDIR}/usr/lib/lib${_lib}.a LIB${_lib:tu}= ${DESTDIR}/usr/lib/lib${_lib}.a
.endif .endif
.endif
.MADE: ${LIB${_lib:tu}} # Note: ${DESTDIR} will be expanded .MADE: ${LIB${_lib:tu}} # Note: ${DESTDIR} will be expanded
.endif .endif
.endfor .endfor

View file

@ -66,8 +66,7 @@ HAS_SSP= yes
.endif .endif
.if defined(NBSD_LIBC) && (${NBSD_LIBC} != "no") .if defined(NBSD_LIBC) && (${NBSD_LIBC} != "no")
CPPFLAGS+= -nostdinc -D__NBSD_LIBC -isystem /usr/netbsd/include CPPFLAGS+= -D__NBSD_LIBC
LDFLAGS+= -L /usr/netbsd/lib
.endif .endif
.if defined(USE_FORT) && (${USE_FORT} != "no") .if defined(USE_FORT) && (${USE_FORT} != "no")

View file

@ -1,6 +0,0 @@
# NetBSD libc flags go here
NETBSD_LIBC_CPPFLAGS=-B/usr/netbsd -D__NBSD_LIBC
NETBSD_LIBC_LDFLAGS=-B/usr/netbsd:/usr/netbsd/lib -lminlib -lcompat_minix
# Minix libc flags go here
MINIX_LIBC_CPPFLAGS=
MINIX_LIBC_LDFLAGS=

View file

@ -2,35 +2,4 @@
.if !defined(_MINIX_PKGSRC_HOOKS_) .if !defined(_MINIX_PKGSRC_HOOKS_)
_MINIX_PKGSRC_HOOKS_=1 _MINIX_PKGSRC_HOOKS_=1
# Get PKGS_REQUIRING_MINIX_LIBC
.include "/usr/pkgsrc/minix/pkgs_requiring_minix_libc.mk"
# Get MINIX_LIBC_* and NETBSD_LIBC_*
.include "/usr/share/mk/minix.libc.mk"
# Build everything not in PKGS_REQUIRING_MINIX_LIBC with NetBSD libc
PKG_REQUIRES_MINIX_LIBC=no
# Search PKGS_REQUIRING_MINIX_LIBC to see if it needs Minix libc
.for PKG_REQUIRING_MINIX_LIBC in ${PKGS_REQUIRING_MINIX_LIBC}
.if "${PKG_REQUIRING_MINIX_LIBC}" == "${PKGPATH}"
PKG_REQUIRES_MINIX_LIBC=yes
.endif
.endfor
# Set the proper compilation flags
.if ${PKG_REQUIRES_MINIX_LIBC} == yes
CPPFLAGS+= ${MINIX_LIBC_CPPFLAGS}
LDFLAGS+= ${MINIX_LIBC_LDFLAGS}
.else
SED=/bin/sed
.include "/usr/pkgsrc/mk/nbsd_libc.buildlink3.mk"
PREFER_NATIVE+=minlib
PREFER_NATIVE+=compat_minix
PREFER_NATIVE+=nbsd_libc
CPPFLAGS+= ${NETBSD_LIBC_CPPFLAGS}
LDFLAGS+= ${NETBSD_LIBC_LDFLAGS}
.endif
.endif # !defined(_MINIX_PKGSRC_HOOKS_) .endif # !defined(_MINIX_PKGSRC_HOOKS_)

View file

@ -239,8 +239,7 @@ AR?= ar
.endif .endif
# Set NBSD_LIBC to either "yes" or "no". # Set NBSD_LIBC to either "yes" or "no".
.if !defined(NBSD) || (${NBSD} == "no") \ .if ${COMPILER_TYPE} == "ack"
|| !defined(COMPILER_TYPE) || (${COMPILER_TYPE} == "ack")
NBSD_LIBC= no NBSD_LIBC= no
.else .else
NBSD_LIBC= yes NBSD_LIBC= yes

View file

@ -1,5 +1,4 @@
# Requires NBSD_LIBC and clang/gcc (we default to using clang) # Requires clang/gcc for NetBSD libc
NBSD_LIBC:= yes
CC:=${CC:C/^cc/clang/} CC:=${CC:C/^cc/clang/}
COMPILER_TYPE:= gnu COMPILER_TYPE:= gnu