From 10375d2629e15e3efcbe2894785df308e47b7778 Mon Sep 17 00:00:00 2001 From: Ben Gras Date: Wed, 10 Aug 2011 13:37:20 +0000 Subject: [PATCH] don't keep minix-port.patch files in repo . causes git noise, and unnecessary conflicts . are easily generated with 'make nbsd_diff' in tools/ --- .gitignore | 1 + common/lib/libc/minix-port.patch | 51 - lib/libcrypt/minix-port.patch | 0 lib/libterminfo/minix-port.patch | 25 - lib/nbsd_libc/minix-port.patch | 2675 ------------------------------ lib/nbsd_libm/minix-port.patch | 28 - nbsd_include/minix-port.patch | 608 ------- share/terminfo/minix-port.patch | 20 - usr.bin/indent/minix-port.patch | 0 usr.bin/stat/minix-port.patch | 31 - usr.bin/tic/minix-port.patch | 0 11 files changed, 1 insertion(+), 3438 deletions(-) delete mode 100644 common/lib/libc/minix-port.patch delete mode 100644 lib/libcrypt/minix-port.patch delete mode 100644 lib/libterminfo/minix-port.patch delete mode 100644 lib/nbsd_libc/minix-port.patch delete mode 100644 lib/nbsd_libm/minix-port.patch delete mode 100644 nbsd_include/minix-port.patch delete mode 100644 share/terminfo/minix-port.patch delete mode 100644 usr.bin/indent/minix-port.patch delete mode 100644 usr.bin/stat/minix-port.patch delete mode 100644 usr.bin/tic/minix-port.patch diff --git a/.gitignore b/.gitignore index 75b18792d..fa82f95d8 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,4 @@ CVS !/.gitignore .gitignore .svn +minix-port.patch diff --git a/common/lib/libc/minix-port.patch b/common/lib/libc/minix-port.patch deleted file mode 100644 index 71b1d5037..000000000 --- a/common/lib/libc/minix-port.patch +++ /dev/null @@ -1,51 +0,0 @@ -diff -ru nbsdsrc/src/common/lib/libc/Makefile.inc common/lib/libc/Makefile.inc ---- nbsdsrc/src/common/lib/libc/Makefile.inc -+++ common/lib/libc/Makefile.inc -@@ -1,7 +1,11 @@ - # $NetBSD: Makefile.inc,v 1.10 2008/10/26 07:22:50 mrg Exp $ - - COMMON_DIR:=${.PARSEDIR} -+.if defined(__MINIX) -+COMMON_CODEDIRS=atomic gen inet md net quad stdlib string -+.else - COMMON_CODEDIRS=atomic gen gmon inet md net quad stdlib string sys -+.endif - COMMON_CODEDIRS+=hash/sha1 hash/sha2 hash/rmd160 - - .if defined(COMMON_MACHINE_ARCH) && !empty(COMMON_MACHINE_ARCH) && \ -diff -ru nbsdsrc/src/common/lib/libc/arch/i386/atomic/Makefile.inc common/lib/libc/arch/i386/atomic/Makefile.inc ---- nbsdsrc/src/common/lib/libc/arch/i386/atomic/Makefile.inc -+++ common/lib/libc/arch/i386/atomic/Makefile.inc -@@ -1,7 +1,7 @@ - # $NetBSD: Makefile.inc,v 1.7 2009/01/04 17:54:29 pooka Exp $ - - .if defined(LIB) && (${LIB} == "kern" || ${LIB} == "c" || ${LIB} == "pthread" \ -- || ${LIB} == "rump") -+ || ${LIB} == "rump" || (defined(__MINIX) && ${LIB} == "sys")) - - SRCS+= atomic_add_64_cas.c atomic_add_64_nv_cas.c atomic_and_64_cas.c \ - atomic_and_64_nv_cas.c atomic_dec_64_cas.c atomic_dec_64_nv_cas.c \ -diff -ru nbsdsrc/src/common/lib/libc/arch/i386/string/strchr.S common/lib/libc/arch/i386/string/strchr.S ---- nbsdsrc/src/common/lib/libc/arch/i386/string/strchr.S -+++ common/lib/libc/arch/i386/string/strchr.S -@@ -100,4 +100,8 @@ - popl %esi - ret - -+#ifdef __minix -+STRONG_ALIAS(_C_LABEL(index),_C_LABEL(strchr)) -+#else - STRONG_ALIAS(index,strchr) -+#endif -diff -ru nbsdsrc/src/common/lib/libc/arch/i386/string/strrchr.S common/lib/libc/arch/i386/string/strrchr.S ---- nbsdsrc/src/common/lib/libc/arch/i386/string/strrchr.S -+++ common/lib/libc/arch/i386/string/strrchr.S -@@ -93,4 +93,8 @@ - popl %esi - ret - -+#ifdef __minix -+STRONG_ALIAS(_C_LABEL(rindex),_C_LABEL(strrchr)) -+#else - STRONG_ALIAS(rindex,strrchr) -+#endif diff --git a/lib/libcrypt/minix-port.patch b/lib/libcrypt/minix-port.patch deleted file mode 100644 index e69de29bb..000000000 diff --git a/lib/libterminfo/minix-port.patch b/lib/libterminfo/minix-port.patch deleted file mode 100644 index 59e457073..000000000 --- a/lib/libterminfo/minix-port.patch +++ /dev/null @@ -1,25 +0,0 @@ -diff -ru nbsdsrc/src/lib/libterminfo/Makefile lib/libterminfo/Makefile ---- nbsdsrc/src/lib/libterminfo/Makefile -+++ lib/libterminfo/Makefile -@@ -1,6 +1,11 @@ - # $NetBSD: Makefile,v 1.12 2010/07/06 05:59:53 mrg Exp $ - -+.if defined(__MINIX) -+.include "minix-config.inc" -+USE_SHLIBDIR= no -+.else - USE_SHLIBDIR= yes -+.endif - - LIB= terminfo - WARNS= 4 -@@ -54,7 +59,9 @@ - gen: hash compiled_terms man - - .include -+.if !defined(__MINIX) - .include -+.endif - - .if ${MKLINKLIB} != "no" - SYMLINKS+= libterminfo.a ${LIBDIR}/libtermcap.a diff --git a/lib/nbsd_libc/minix-port.patch b/lib/nbsd_libc/minix-port.patch deleted file mode 100644 index 70d3642ea..000000000 --- a/lib/nbsd_libc/minix-port.patch +++ /dev/null @@ -1,2675 +0,0 @@ -diff -ru nbsdsrc/src/lib/libc/Makefile lib/nbsd_libc/Makefile ---- nbsdsrc/src/lib/libc/Makefile -+++ lib/nbsd_libc/Makefile -@@ -17,6 +17,9 @@ - # The Hesiod functions are always in libc. To choose that getpwent() and friends - # actually call the Hesiod functions, put -DHESIOD on the CPPFLAGS line below. - -+.if defined(__MINIX) -+.include "minix-config.inc" -+.endif - .include "Makefile.inc" - - LIB= c -@@ -41,6 +44,7 @@ - mv -f assym.h.tmp assym.h - .endif - -+.if !defined(__MINIX) - # The following controls how to build compatibility code for old NetBSD - # binaries. If BUILDCOLD is yes, then we build a separate library; otherwise - # we include the code in libc. -@@ -52,6 +56,9 @@ - COMPATDIR=${.CURDIR}/compat - .include "${.CURDIR}/compat/Makefile.inc" - .endif -+.else -+BUILDCOLD= no -+.endif - - .include "${.CURDIR}/../../common/lib/libc/Makefile.inc" - .include "${.CURDIR}/atomic/Makefile.inc" -@@ -64,7 +71,11 @@ - .include "${.CURDIR}/dlfcn/Makefile.inc" - .include "${.CURDIR}/gdtoa/Makefile.inc" - .include "${.CURDIR}/gen/Makefile.inc" -+.if defined(__MINIX) -+# gmon needs profil() -+.else - .include "${.CURDIR}/gmon/Makefile.inc" -+.endif - .include "${.CURDIR}/hash/Makefile.inc" - .include "${.CURDIR}/iconv/Makefile.inc" - .include "${.CURDIR}/inet/Makefile.inc" -@@ -84,7 +95,11 @@ - .include "${.CURDIR}/regex/Makefile.inc" - .endif - .include "${.CURDIR}/resolv/Makefile.inc" -+.if defined(__MINIX) -+# RPC needs pollts() and a reserved port allocator. -+.else - .include "${.CURDIR}/rpc/Makefile.inc" -+.endif - .include "${.CURDIR}/ssp/Makefile.inc" - .include "${.CURDIR}/stdio/Makefile.inc" - .include "${.CURDIR}/stdlib/Makefile.inc" -@@ -92,7 +107,11 @@ - .include "${.CURDIR}/termios/Makefile.inc" - .include "${.CURDIR}/thread-stub/Makefile.inc" - .include "${.CURDIR}/time/Makefile.inc" -+.if defined(__MINIX) -+.include "${.CURDIR}/sys-minix/Makefile.inc" -+.else - .include "${.CURDIR}/sys/Makefile.inc" -+.endif - .include "${.CURDIR}/uuid/Makefile.inc" - .if (${MKYP} != "no") - .include "${.CURDIR}/yp/Makefile.inc" -@@ -121,7 +140,11 @@ - NLS= C.msg Pig.msg ca.msg cs.msg de.msg es.msg fi.msg fr.msg nl.msg \ - no.msg pl.msg sk.msg sv.msg - -+.if defined(__MINIX) -+realall: -+.else - realall: tags -+.endif - tags: ${.OBJDIR}/tags - ${.OBJDIR}/tags: ${SRCS} - ${_MKTARGET_CREATE} -@@ -130,9 +153,11 @@ - sed "s;\([^:]*\):\([^(]*\)(\([^, )]*\)\(.*\);\3 \1 /^\2(\3\4$$/;" \ - >> ${.TARGET}; sort -o ${.TARGET} ${.TARGET} - -+.if !defined(__MINIX) - FILES= ${.OBJDIR}/tags - FILESNAME= libc.tags - FILESDIR= /var/db -+.endif - - - # workaround for I18N stuffs: build singlebyte setlocale() for libc.a, -@@ -146,4 +171,8 @@ - - # force the dynamic linker to initialize libc first - SHLIB_SHFLAGS+= -Wl,-z,initfirst -+ -+.include -+SUBDIR+= pkgconfig -+.include - -diff -ru nbsdsrc/src/lib/libc/Makefile.inc lib/nbsd_libc/Makefile.inc ---- nbsdsrc/src/lib/libc/Makefile.inc -+++ lib/nbsd_libc/Makefile.inc -@@ -19,14 +19,22 @@ - - USE_FORT?= yes - -+.if defined(__MINIX) -+USE_SHLIBDIR= no -+.else - USE_SHLIBDIR= yes -+.endif - - CITRUS?= yes - - .include - - WARNS=4 -+.if defined(__MINIX) -+CPPFLAGS+= -D_LIBC -+.else - CPPFLAGS+= -D_LIBC -DLIBC_SCCS -DSYSLIBC_SCCS -D_REENTRANT -+.endif - - .if (${USE_HESIOD} != "no") - CPPFLAGS+= -DHESIOD -diff -ru nbsdsrc/src/lib/libc/arch/i386/Makefile.inc lib/nbsd_libc/arch/i386/Makefile.inc ---- nbsdsrc/src/lib/libc/arch/i386/Makefile.inc -+++ lib/nbsd_libc/arch/i386/Makefile.inc -@@ -1,3 +1,5 @@ - # $NetBSD: Makefile.inc,v 1.20 2006/06/17 18:04:23 uwe Exp $ - -+.if !defined(__MINIX) - SRCS+= __sigaction14_sigtramp.c __sigtramp2.S -+.endif -diff -ru nbsdsrc/src/lib/libc/arch/i386/gen/Makefile.inc lib/nbsd_libc/arch/i386/gen/Makefile.inc ---- nbsdsrc/src/lib/libc/arch/i386/gen/Makefile.inc -+++ lib/nbsd_libc/arch/i386/gen/Makefile.inc -@@ -7,10 +7,18 @@ - - SRCS+= setjmp.S _setjmp.S sigsetjmp.S - -+.if defined(__MINIX) -+# Already defined in sys-minix -+.else - SRCS+= resumecontext.S swapcontext.S -+.endif - - # objects built from C sources -+.if defined(__MINIX) -+SRCS+= bswap64.c -+.else - SRCS+= bswap64.c _lwp.c makecontext.c -+.endif - - # Common ieee754 constants and functions - SRCS+= infinityf_ieee754.c infinity_ieee754.c -diff -ru nbsdsrc/src/lib/libc/arch/i386/gen/setjmp.S lib/nbsd_libc/arch/i386/gen/setjmp.S ---- nbsdsrc/src/lib/libc/arch/i386/gen/setjmp.S -+++ lib/nbsd_libc/arch/i386/gen/setjmp.S -@@ -85,7 +85,11 @@ - PIC_PROLOGUE - pushl $0 - pushl %edx -+#ifdef __minix -+ pushl $2 /* SIG_SETMASK */ -+#else - pushl $3 /* SIG_SETMASK */ -+#endif - #ifdef PIC - call PIC_PLT(_C_LABEL(__sigprocmask14)) - #else -diff -ru nbsdsrc/src/lib/libc/arch/i386/gen/sigsetjmp.S lib/nbsd_libc/arch/i386/gen/sigsetjmp.S ---- nbsdsrc/src/lib/libc/arch/i386/gen/sigsetjmp.S -+++ lib/nbsd_libc/arch/i386/gen/sigsetjmp.S -@@ -85,7 +85,11 @@ - PIC_PROLOGUE - pushl $0 - pushl %edx -+#ifdef __minix -+ pushl $2 /* SIG_SETMASK */ -+#else - pushl $3 /* SIG_SETMASK */ -+#endif - #ifdef PIC - call PIC_PLT(_C_LABEL(__sigprocmask14)) - #else -diff -ru nbsdsrc/src/lib/libc/cdb/cdbr.c lib/nbsd_libc/cdb/cdbr.c ---- nbsdsrc/src/lib/libc/cdb/cdbr.c -+++ lib/nbsd_libc/cdb/cdbr.c -@@ -122,7 +122,22 @@ - cdbr->index_size = 4; - - cdbr->mmap_size = (size_t)sb.st_size; -+#ifdef __minix -+ cdbr->mmap_base = mmap(NULL, cdbr->mmap_size, PROT_READ, MAP_ANON, -1, (off_t)0); -+ if (cdbr->mmap_base == MAP_FAILED) { -+ free(cdbr); -+ return NULL; -+ } -+ -+ if (read(fd, cdbr->mmap_base, cdbr->mmap_size) != cdbr->mmap_size) -+ { -+ munmap(cdbr->mmap_base, cdbr->mmap_size); -+ free(cdbr); -+ return NULL; -+ } -+#else /* !__minix */ - cdbr->mmap_base = mmap(NULL, cdbr->mmap_size, PROT_READ, MAP_FILE|MAP_SHARED, fd, 0); -+#endif /* __minix */ - close(fd); - - if (cdbr->mmap_base == MAP_FAILED) { -diff -ru nbsdsrc/src/lib/libc/citrus/Makefile.inc lib/nbsd_libc/citrus/Makefile.inc ---- nbsdsrc/src/lib/libc/citrus/Makefile.inc -+++ lib/nbsd_libc/citrus/Makefile.inc -@@ -3,8 +3,8 @@ - # sources - .PATH: ${ARCHDIR}/citrus ${.CURDIR}/citrus - --MODULE_SHLIB_MAJOR!= . ${NETBSDSRCDIR}/lib/i18n_module/shlib_version ; echo $$major --CPPFLAGS.citrus_module.c+=-DI18NMODULE_MAJOR=${MODULE_SHLIB_MAJOR} -+#MODULE_SHLIB_MAJOR!= . ${NETBSDSRCDIR}/lib/i18n_module/shlib_version ; echo $$major -+#CPPFLAGS.citrus_module.c+=-DI18NMODULE_MAJOR=${MODULE_SHLIB_MAJOR} - SRCS+= citrus_bcs.c citrus_bcs_strtol.c citrus_bcs_strtoul.c \ - citrus_csmapper.c citrus_ctype.c citrus_ctype_fallback.c \ - citrus_db.c citrus_db_hash.c citrus_esdb.c citrus_hash.c \ -diff -ru nbsdsrc/src/lib/libc/citrus/citrus_mmap.c lib/nbsd_libc/citrus/citrus_mmap.c ---- nbsdsrc/src/lib/libc/citrus/citrus_mmap.c -+++ lib/nbsd_libc/citrus/citrus_mmap.c -@@ -74,12 +74,25 @@ - goto error; - } - -+#ifdef __minix -+ head = mmap(NULL, (size_t)st.st_size, PROT_READ, MAP_ANON, -1, (off_t)0); -+ if (head == MAP_FAILED) { -+ ret = errno; -+ goto error; -+ } -+ -+ if (read(fd, head, st.st_size) != st.st_size) { -+ ret = errno; -+ goto error; -+ } -+#else /* !__minix */ - head = mmap(NULL, (size_t)st.st_size, PROT_READ, MAP_FILE|MAP_PRIVATE, - fd, (off_t)0); - if (head == MAP_FAILED) { - ret = errno; - goto error; - } -+#endif /* !__minix */ - _region_init(r, head, (size_t)st.st_size); - - error: -diff -ru nbsdsrc/src/lib/libc/compat-43/Makefile.inc lib/nbsd_libc/compat-43/Makefile.inc ---- nbsdsrc/src/lib/libc/compat-43/Makefile.inc -+++ lib/nbsd_libc/compat-43/Makefile.inc -@@ -4,11 +4,19 @@ - # compat-43 sources - .PATH: ${ARCHDIR}/compat-43 ${.CURDIR}/compat-43 - -+.if defined(__MINIX) -+# Unsupported by Minix -+# gethostid.c sethostid.c setpgrp.c setrgid.c setruid.c sigcompat.c -+ -+SRCS+= creat.c getdtablesize.c killpg.c -+ -+.else - SRCS+= creat.c getdtablesize.c gethostid.c \ - killpg.c sethostid.c setpgrp.c \ - setrgid.c setruid.c sigcompat.c - .if !defined(AUDIT) - SRCS+= getwd.c -+.endif - .endif - - # XXX this is to get -diff -ru nbsdsrc/src/lib/libc/db/btree/bt_open.c lib/nbsd_libc/db/btree/bt_open.c ---- nbsdsrc/src/lib/libc/db/btree/bt_open.c -+++ lib/nbsd_libc/db/btree/bt_open.c -@@ -262,7 +262,16 @@ - * Don't overflow the page offset type. - */ - if (b.psize == 0) { -- b.psize = sb.st_blksize; -+#ifdef __minix -+ if (sb.st_blksize == 0) { -+ /* 0 in 2 cases: upgrade from old to new struct stat or -+ * there is a bug in underlying fs. -+ */ -+ b.psize = MINIX_ST_BLKSIZE; -+ } else -+#endif -+ b.psize = sb.st_blksize; -+ - if (b.psize < MINPSIZE) - b.psize = MINPSIZE; - if (b.psize > MAX_PAGE_OFFSET + 1) -diff -ru nbsdsrc/src/lib/libc/db/db/db.c lib/nbsd_libc/db/db/db.c ---- nbsdsrc/src/lib/libc/db/db/db.c -+++ lib/nbsd_libc/db/db/db.c -@@ -57,9 +57,15 @@ - { - - #define DB_FLAGS (DB_LOCK | DB_SHMEM | DB_TXN) -+#ifdef __minix -+#define USE_OPEN_FLAGS \ -+ (O_CREAT | O_EXCL | O_NONBLOCK | O_RDONLY | \ -+ O_RDWR | O_TRUNC) -+#else /* !__minix */ - #define USE_OPEN_FLAGS \ - (O_CREAT | O_EXCL | O_EXLOCK | O_NONBLOCK | O_RDONLY | \ - O_RDWR | O_SHLOCK | O_TRUNC) -+#endif /* __minix */ - - if ((flags & ~(USE_OPEN_FLAGS | DB_FLAGS)) == 0) - switch (type) { -diff -ru nbsdsrc/src/lib/libc/db/hash/hash.c lib/nbsd_libc/db/hash/hash.c ---- nbsdsrc/src/lib/libc/db/hash/hash.c -+++ lib/nbsd_libc/db/hash/hash.c -@@ -301,7 +301,16 @@ - if (file != NULL) { - if (stat(file, &statbuf)) - return (NULL); -- hashp->BSIZE = MIN(statbuf.st_blksize, MAX_BSIZE); -+#ifdef __minix -+ if (statbuf.st_blksize == 0) { -+ /* 0 in 2 cases: upgrade from old to new struct stat or -+ * there is a bug in underlying fs. -+ */ -+ hashp->BSIZE = MIN(MINIX_ST_BLKSIZE, MAX_BSIZE); -+ } else -+#endif -+ hashp->BSIZE = MIN(statbuf.st_blksize, MAX_BSIZE); -+ - hashp->BSHIFT = __log2((uint32_t)hashp->BSIZE); - } - -diff -ru nbsdsrc/src/lib/libc/dlfcn/dlfcn_elf.c lib/nbsd_libc/dlfcn/dlfcn_elf.c ---- nbsdsrc/src/lib/libc/dlfcn/dlfcn_elf.c -+++ lib/nbsd_libc/dlfcn/dlfcn_elf.c -@@ -48,7 +48,12 @@ - #define dl_iterate_phdr ___dl_iterate_phdr - - #define ELFSIZE ARCH_ELFSIZE -+#ifdef __minix -+#include -+#include -+#else - #include "rtld.h" -+#endif - - #ifdef __weak_alias - __weak_alias(dlopen,___dlopen) -@@ -128,6 +133,7 @@ - return -1; - } - -+#ifndef __minix - /*ARGSUSED*/ - int - dl_iterate_phdr(int (*callback)(struct dl_phdr_info *, size_t, void *), -@@ -136,3 +142,4 @@ - - return 0; - } -+#endif -diff -ru nbsdsrc/src/lib/libc/gdtoa/gdtoa_locks.c lib/nbsd_libc/gdtoa/gdtoa_locks.c ---- nbsdsrc/src/lib/libc/gdtoa/gdtoa_locks.c -+++ lib/nbsd_libc/gdtoa/gdtoa_locks.c -@@ -7,4 +7,6 @@ - - #include "gdtoaimp.h" - -+#ifdef _REENTRANT /* !__minix */ - mutex_t __gdtoa_locks[2] = { MUTEX_INITIALIZER, MUTEX_INITIALIZER }; -+#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 ---- nbsdsrc/src/lib/libc/gen/Makefile.inc -+++ lib/nbsd_libc/gen/Makefile.inc -@@ -2,9 +2,57 @@ - # from: @(#)Makefile.inc 8.6 (Berkeley) 5/4/95 - - # gen sources -+.if defined(__MINIX) -+.PATH: ${.CURDIR}/gen/minix -+.endif - .PATH: ${ARCHDIR}/gen ${.CURDIR}/gen - -+.if defined(__MINIX) -+# Unsupported by Minix. -+# closefrom.c confstr.c extattr.c getdevmajor.c getmntinfo.c \ -+# pthread_atfork.c setdomainname.c sethostname.c setproctitle.c \ -+# sysctl.c sysctlbyname.c sysctlgetmibinfo.c sysctlnametomib.c \ -+# devname.c wait3.c -+ -+# To be ported -+# nlist.c nlist_aout.c nlist_coff.c nlist_ecoff.c nlist_elf32.c nlist_elf64.c -+# -+# Not useful but portable -+# disklabel.c -+# -+# Already in getprogname -+# setprogname.c -+ - SRCS+= _errno.c alarm.c alphasort.c arc4random.c assert.c basename.c clock.c \ -+ closedir.c ctermid.c ctype_.c daemon.c \ -+ dehumanize_number.c dirname.c err.c errx.c \ -+ errlist.c errno.c execl.c execle.c execlp.c execv.c execvp.c \ -+ fmtcheck.c fmtmsg.c fnmatch.c fstab.c ftok.c \ -+ fts.c ftw.c getbsize.c getcap.c getcwd.c \ -+ getdomainname.c getgrent.c \ -+ getgrouplist.c getgroupmembership.c gethostname.c \ -+ getloadavg.c getlogin.c \ -+ getnetgrent.c getpagesize.c \ -+ getpass.c getprogname.c getpwent.c getttyent.c \ -+ getusershell.c glob.c humanize_number.c initdir.c initgroups.c \ -+ isascii.c isatty.c isctype.c lockf.c nftw.c \ -+ nice.c \ -+ opendir.c \ -+ pause.c popen.c psignal.c ptree.c pwcache.c \ -+ pw_scan.c raise.c randomid.c rb.c readdir.c rewinddir.c \ -+ scandir.c seekdir.c \ -+ setjmperr.c setmode.c \ -+ shquote.c shquotev.c sighold.c sigignore.c siginterrupt.c \ -+ siglist.c signal.c signame.c sigrelse.c \ -+ sigset.c sigsetops.c sleep.c \ -+ stringlist.c sysconf.c \ -+ syslog.c telldir.c time.c \ -+ times.c toascii.c tolower_.c ttyname.c ttyslot.c \ -+ toupper_.c ualarm.c ulimit.c uname.c unvis.c usleep.c utime.c utmp.c \ -+ utmpx.c valloc.c vis.c warn.c warnx.c \ -+ vwarn.c vwarnx.c verr.c verrx.c wait.c waitpid.c wordexp.c -+.else -+SRCS+= _errno.c alarm.c alphasort.c arc4random.c assert.c basename.c clock.c \ - closedir.c closefrom.c confstr.c ctermid.c ctype_.c daemon.c \ - dehumanize_number.c devname.c dirname.c disklabel.c err.c errx.c \ - errlist.c errno.c execl.c execle.c execlp.c execv.c execvp.c \ -@@ -32,6 +80,7 @@ - toupper_.c ualarm.c ulimit.c uname.c unvis.c usleep.c utime.c utmp.c \ - utmpx.c valloc.c vis.c wait.c wait3.c waitpid.c warn.c warnx.c \ - vwarn.c vwarnx.c verr.c verrx.c wordexp.c -+.endif - - # indirect reference stubs, to be removed soon. - SRCS+= _err.c _errx.c \ -@@ -163,7 +212,12 @@ - CPPFLAGS.tolower_.c+= -I${LIBCDIR}/locale - CPPFLAGS.toupper_.c+= -I${LIBCDIR}/locale - -+.if defined(__MINIX) -+errlist.c: errlist.awk ${MINIXSRCDIR}/nbsd_include/sys/errno.h -+ cat ${MINIXSRCDIR}/nbsd_include/sys/errno.h | ${TOOL_SED} 's/(_SIGN//' | ${TOOL_AWK} -f ${MINIXSRCDIR}/lib/nbsd_libc/gen/errlist.awk > ${.TARGET} -+.else - errlist.c: errlist.awk ${NETBSDSRCDIR}/sys/sys/errno.h - ${TOOL_AWK} -f ${.ALLSRC} > ${.TARGET} -+.endif - - CLEANFILES+= errlist.c -diff -ru nbsdsrc/src/lib/libc/gen/_verr.c lib/nbsd_libc/gen/_verr.c ---- nbsdsrc/src/lib/libc/gen/_verr.c -+++ lib/nbsd_libc/gen/_verr.c -@@ -13,6 +13,9 @@ - #if defined(__indr_reference) - __indr_reference(_verr, verr) - #else -+#ifdef __minix -+#include -+#endif - - __dead void _verr(int, const char *, _BSD_VA_LIST_); - -diff -ru nbsdsrc/src/lib/libc/gen/_verrx.c lib/nbsd_libc/gen/_verrx.c ---- nbsdsrc/src/lib/libc/gen/_verrx.c -+++ lib/nbsd_libc/gen/_verrx.c -@@ -13,6 +13,9 @@ - #if defined(__indr_reference) - __indr_reference(_verrx, verrx) - #else -+#ifdef __minix -+#include -+#endif - - __dead void _verrx(int, const char *, _BSD_VA_LIST_); - -diff -ru nbsdsrc/src/lib/libc/gen/_vwarn.c lib/nbsd_libc/gen/_vwarn.c ---- nbsdsrc/src/lib/libc/gen/_vwarn.c -+++ lib/nbsd_libc/gen/_vwarn.c -@@ -13,6 +13,9 @@ - #if defined(__indr_reference) - __indr_reference(_vwarn, vwarn) - #else -+#ifdef __minix -+#include -+#endif - - void _vwarn(const char *, _BSD_VA_LIST_); - -diff -ru nbsdsrc/src/lib/libc/gen/_vwarnx.c lib/nbsd_libc/gen/_vwarnx.c ---- nbsdsrc/src/lib/libc/gen/_vwarnx.c -+++ lib/nbsd_libc/gen/_vwarnx.c -@@ -13,6 +13,9 @@ - #if defined(__indr_reference) - __indr_reference(_vwarnx, vwarnx) - #else -+#ifdef __minix -+#include -+#endif - - void _vwarnx(const char *, _BSD_VA_LIST_); - -diff -ru nbsdsrc/src/lib/libc/gen/_warn.c lib/nbsd_libc/gen/_warn.c ---- nbsdsrc/src/lib/libc/gen/_warn.c -+++ lib/nbsd_libc/gen/_warn.c -@@ -24,7 +24,11 @@ - va_list ap; - - va_start(ap, fmt); -+#ifdef __minix -+ _vwarn(fmt, ap); -+#else - _vwarn(eval, fmt, ap); -+#endif - va_end(ap); - } - #endif -diff -ru nbsdsrc/src/lib/libc/gen/_warnx.c lib/nbsd_libc/gen/_warnx.c ---- nbsdsrc/src/lib/libc/gen/_warnx.c -+++ lib/nbsd_libc/gen/_warnx.c -@@ -24,7 +24,11 @@ - va_list ap; - - va_start(ap, fmt); -+#ifdef __minix -+ _vwarnx(fmt, ap); -+#else - _vwarnx(eval, fmt, ap); -+#endif - va_end(ap); - } - -diff -ru nbsdsrc/src/lib/libc/gen/closedir.c lib/nbsd_libc/gen/closedir.c ---- nbsdsrc/src/lib/libc/gen/closedir.c -+++ lib/nbsd_libc/gen/closedir.c -@@ -38,6 +38,11 @@ - #endif - #endif /* LIBC_SCCS and not lint */ - -+#ifdef __minix -+/* NetBSD BUG: reentrant.h defines includes. */ -+#include -+#endif /* !__minix */ -+ - #include "namespace.h" - #include "reentrant.h" - #include "extern.h" -diff -ru nbsdsrc/src/lib/libc/gen/errlist.awk lib/nbsd_libc/gen/errlist.awk ---- nbsdsrc/src/lib/libc/gen/errlist.awk -+++ lib/nbsd_libc/gen/errlist.awk -@@ -85,9 +85,13 @@ - i1 = index(desc, "/*") + 3; - l = length(desc); - desc = substr(desc, i1, l - i1 - 2); -- if (number != errno) { -- printf("error number mismatch %d != %d\n", number, errno) > "/dev/stderr"; -+ if (number < errno) { -+ printf("%s\n error number mismatch %d != %d\n", $0, number, errno) > "/dev/stderr"; - exit(1); -+ } -+ while(errno < number) { -+ perror("UNDEFINED", errno, "Undefined error: " errno); -+ errno++; - } - perror(name, number, desc); - errno++; -diff -ru nbsdsrc/src/lib/libc/gen/execl.c lib/nbsd_libc/gen/execl.c ---- nbsdsrc/src/lib/libc/gen/execl.c -+++ lib/nbsd_libc/gen/execl.c -@@ -56,7 +56,7 @@ - execl(const char *name, const char *arg, ...) - { - int r; --#if defined(__i386__) || defined(__m68k__) -+#if (defined(__i386__) || defined(__m68k__)) && !defined(__minix) - r = execve(name, __UNCONST(&arg), environ); - return r; - #else -diff -ru nbsdsrc/src/lib/libc/gen/execle.c lib/nbsd_libc/gen/execle.c ---- nbsdsrc/src/lib/libc/gen/execle.c -+++ lib/nbsd_libc/gen/execle.c -@@ -50,7 +50,7 @@ - int - execle(const char *name, const char *arg, ...) - { --#if defined(__i386__) || defined(__m68k__) -+#if (defined(__i386__) || defined(__m68k__)) && !defined(__minix) - va_list ap; - char **envp; - -diff -ru nbsdsrc/src/lib/libc/gen/execlp.c lib/nbsd_libc/gen/execlp.c ---- nbsdsrc/src/lib/libc/gen/execlp.c -+++ lib/nbsd_libc/gen/execlp.c -@@ -50,7 +50,7 @@ - int - execlp(const char *name, const char *arg, ...) - { --#if defined(__i386__) || defined(__m68k__) -+#if (defined(__i386__) || defined(__m68k__)) && !defined(__minix) - return execvp(name, __UNCONST(&arg)); - #else - va_list ap; -diff -ru nbsdsrc/src/lib/libc/gen/fts.c lib/nbsd_libc/gen/fts.c ---- nbsdsrc/src/lib/libc/gen/fts.c -+++ lib/nbsd_libc/gen/fts.c -@@ -56,7 +56,9 @@ - #include - - #if ! HAVE_NBTOOL_CONFIG_H -+#ifndef __minix - #define HAVE_STRUCT_DIRENT_D_NAMLEN -+#endif - #endif - - static FTSENT *fts_alloc(FTS *, const char *, size_t); -diff -ru nbsdsrc/src/lib/libc/gen/getcwd.c lib/nbsd_libc/gen/getcwd.c ---- nbsdsrc/src/lib/libc/gen/getcwd.c -+++ lib/nbsd_libc/gen/getcwd.c -@@ -54,8 +54,12 @@ - #include "extern.h" - - #ifdef __weak_alias -+#ifdef __minix -+__weak_alias(getcwd,_getcwd) -+#else - __weak_alias(getcwd,_sys_getcwd) - __weak_alias(_getcwd,_sys_getcwd) -+#endif - __weak_alias(realpath,_realpath) - - #if defined(_FORTIFY_SOURCE) && !defined(__lint__) -diff -ru nbsdsrc/src/lib/libc/gen/getgrent.c lib/nbsd_libc/gen/getgrent.c ---- nbsdsrc/src/lib/libc/gen/getgrent.c -+++ lib/nbsd_libc/gen/getgrent.c -@@ -481,7 +481,11 @@ - _files_getgrgid(void *nsrv, void *nscb, va_list ap) - { - struct group **retval = va_arg(ap, struct group **); -+#ifdef __minix -+ gid_t gid = (gid_t)va_arg(ap, int); -+#else - gid_t gid = va_arg(ap, gid_t); -+#endif - - int rv, rerror; - -@@ -506,7 +510,11 @@ - _files_getgrgid_r(void *nsrv, void *nscb, va_list ap) - { - int *retval = va_arg(ap, int *); -+#ifdef __minix -+ gid_t gid = (gid_t)va_arg(ap, int); -+#else - gid_t gid = va_arg(ap, gid_t); -+#endif - struct group *grp = va_arg(ap, struct group *); - char *buffer = va_arg(ap, char *); - size_t buflen = va_arg(ap, size_t); -@@ -801,7 +809,11 @@ - _dns_getgrgid(void *nsrv, void *nscb, va_list ap) - { - struct group **retval = va_arg(ap, struct group **); -+#ifdef __minix -+ gid_t gid = (gid_t)va_arg(ap, int); -+#else - gid_t gid = va_arg(ap, gid_t); -+#endif - - int rv, rerror; - -@@ -825,7 +837,11 @@ - _dns_getgrgid_r(void *nsrv, void *nscb, va_list ap) - { - int *retval = va_arg(ap, int *); -+#ifdef __minix -+ gid_t gid = (gid_t)va_arg(ap, int); -+#else - gid_t gid = va_arg(ap, gid_t); -+#endif - struct group *grp = va_arg(ap, struct group *); - char *buffer = va_arg(ap, char *); - size_t buflen = va_arg(ap, size_t); -@@ -1148,7 +1164,11 @@ - _nis_getgrgid(void *nsrv, void *nscb, va_list ap) - { - struct group **retval = va_arg(ap, struct group **); -+#ifdef __minix -+ gid_t gid = (gid_t)va_arg(ap, int); -+#else - gid_t gid = va_arg(ap, gid_t); -+#endif - - int rv, rerror; - -@@ -1172,7 +1192,11 @@ - _nis_getgrgid_r(void *nsrv, void *nscb, va_list ap) - { - int *retval = va_arg(ap, int *); -+#ifdef __minix -+ gid_t gid = (gid_t)va_arg(ap, int); -+#else - gid_t gid = va_arg(ap, gid_t); -+#endif - struct group *grp = va_arg(ap, struct group *); - char *buffer = va_arg(ap, char *); - size_t buflen = va_arg(ap, size_t); -@@ -1408,7 +1432,11 @@ - crv = nsdispatch(NULL, compatgiddtab, - NSDB_GROUP_COMPAT, "getgrgid_r", - __nsdefaultnis, -+#ifdef __minix -+ &cretval, (int)gid, -+#else - &cretval, gid, -+#endif - &cgrp, filebuf, sizeof(filebuf), &cgrpres); - } - if (crv != NS_SUCCESS) { /* not found */ -@@ -1610,7 +1638,11 @@ - _compat_getgrgid(void *nsrv, void *nscb, va_list ap) - { - struct group **retval = va_arg(ap, struct group **); -+#ifdef __minix -+ gid_t gid = (gid_t)va_arg(ap, int); -+#else - gid_t gid = va_arg(ap, gid_t); -+#endif - - int rv, rerror; - -@@ -1635,7 +1667,11 @@ - _compat_getgrgid_r(void *nsrv, void *nscb, va_list ap) - { - int *retval = va_arg(ap, int *); -+#ifdef __minix -+ gid_t gid = (gid_t)va_arg(ap, int); -+#else - gid_t gid = va_arg(ap, gid_t); -+#endif - struct group *grp = va_arg(ap, struct group *); - char *buffer = va_arg(ap, char *); - size_t buflen = va_arg(ap, size_t); -@@ -1785,7 +1821,11 @@ - - mutex_lock(&__grmutex); - rv = nsdispatch(NULL, dtab, NSDB_GROUP, "getgrgid", __nsdefaultcompat, -+#ifdef __minix -+ &retval, (int)gid); -+#else - &retval, gid); -+#endif - mutex_unlock(&__grmutex); - return (rv == NS_SUCCESS) ? retval : NULL; - } -@@ -1812,7 +1852,11 @@ - retval = 0; - mutex_lock(&__grmutex); - rv = nsdispatch(NULL, dtab, NSDB_GROUP, "getgrgid_r", __nsdefaultcompat, -+#ifdef __minix -+ &retval, (int)gid, grp, buffer, buflen, result); -+#else - &retval, gid, grp, buffer, buflen, result); -+#endif - mutex_unlock(&__grmutex); - switch (rv) { - case NS_SUCCESS: -diff -ru nbsdsrc/src/lib/libc/gen/getgroupmembership.c lib/nbsd_libc/gen/getgroupmembership.c ---- nbsdsrc/src/lib/libc/gen/getgroupmembership.c -+++ lib/nbsd_libc/gen/getgroupmembership.c -@@ -101,7 +101,11 @@ - { - int *result = va_arg(ap, int *); - const char *uname = va_arg(ap, const char *); -+#ifdef __minix -+ gid_t agroup = (gid_t)va_arg(ap, int); -+#else - gid_t agroup = va_arg(ap, gid_t); -+#endif - gid_t *groups = va_arg(ap, gid_t *); - int maxgrp = va_arg(ap, int); - int *groupc = va_arg(ap, int *); -@@ -144,7 +148,11 @@ - { - int *result = va_arg(ap, int *); - const char *uname = va_arg(ap, const char *); -+#ifdef __minix -+ gid_t agroup = (gid_t)va_arg(ap, int); -+#else - gid_t agroup = va_arg(ap, gid_t); -+#endif - gid_t *groups = va_arg(ap, gid_t *); - int maxgrp = va_arg(ap, int); - int *groupc = va_arg(ap, int *); -@@ -237,7 +245,11 @@ - { - int *result = va_arg(ap, int *); - const char *uname = va_arg(ap, const char *); -+#ifdef __minix -+ gid_t agroup = (gid_t)va_arg(ap, int); -+#else - gid_t agroup = va_arg(ap, gid_t); -+#endif - gid_t *groups = va_arg(ap, gid_t *); - int maxgrp = va_arg(ap, int); - int *groupc = va_arg(ap, int *); -@@ -305,7 +317,11 @@ - crv = nsdispatch(NULL, dtab, - NSDB_GROUP_COMPAT, "getgroupmembership", - __nsdefaultnis, -+#ifdef __minix -+ &rerror, cp->uname, (int)cp->agroup, cp->groups, cp->maxgrp, cp->groupc); -+#else - &rerror, cp->uname, cp->agroup, cp->groups, cp->maxgrp, cp->groupc); -+#endif - - if (crv == NS_SUCCESS) - crv = NS_NOTFOUND; /* indicate "no more +: entries" */ -@@ -319,7 +335,11 @@ - { - int *result = va_arg(ap, int *); - const char *uname = va_arg(ap, const char *); -+#ifdef __minix -+ gid_t agroup = (gid_t)va_arg(ap, int); -+#else - gid_t agroup = va_arg(ap, gid_t); -+#endif - gid_t *groups = va_arg(ap, gid_t *); - int maxgrp = va_arg(ap, int); - int *groupc = va_arg(ap, int *); -@@ -395,7 +415,11 @@ - */ - (void) nsdispatch(NULL, dtab, NSDB_GROUP, "getgroupmembership", - __nsdefaultcompat, -+#ifdef __minix -+ &rerror, uname, (int)agroup, groups, maxgrp, groupc); -+#else - &rerror, uname, agroup, groups, maxgrp, groupc); -+#endif - mutex_unlock(&__grmutex); - - if (*groupc > maxgrp) /* too many groups found */ -diff -ru nbsdsrc/src/lib/libc/gen/getlogin.c lib/nbsd_libc/gen/getlogin.c ---- nbsdsrc/src/lib/libc/gen/getlogin.c -+++ lib/nbsd_libc/gen/getlogin.c -@@ -78,7 +78,9 @@ - #ifdef __weak_alias - __weak_alias(getlogin,_getlogin) - __weak_alias(getlogin_r,_getlogin_r) -+#ifndef __minix - __weak_alias(setlogin,_setlogin) -+#endif /* !__minix */ - #endif - - int __logname_valid; /* known to setlogin() */ -@@ -134,6 +136,7 @@ - return (rv); - } - -+#ifndef __minix - int - setlogin(const char *name) - { -@@ -144,3 +147,4 @@ - - return (retval); - } -+#endif -diff -ru nbsdsrc/src/lib/libc/gen/getpwent.c lib/nbsd_libc/gen/getpwent.c ---- nbsdsrc/src/lib/libc/gen/getpwent.c -+++ lib/nbsd_libc/gen/getpwent.c -@@ -671,7 +671,11 @@ - _files_getpwuid(void *nsrv, void *nscb, va_list ap) - { - struct passwd **retval = va_arg(ap, struct passwd **); -+#ifdef __minix -+ uid_t uid = (uid_t)va_arg(ap, int); -+#else - uid_t uid = va_arg(ap, uid_t); -+#endif - - int rv, rerror; - -@@ -696,7 +700,11 @@ - _files_getpwuid_r(void *nsrv, void *nscb, va_list ap) - { - int *retval = va_arg(ap, int *); -+#ifdef __minix -+ uid_t uid = (uid_t)va_arg(ap, int); -+#else - uid_t uid = va_arg(ap, uid_t); -+#endif - struct passwd *pw = va_arg(ap, struct passwd *); - char *buffer = va_arg(ap, char *); - size_t buflen = va_arg(ap, size_t); -@@ -992,7 +1000,11 @@ - _dns_getpwuid(void *nsrv, void *nscb, va_list ap) - { - struct passwd **retval = va_arg(ap, struct passwd **); -+#ifdef __minix -+ uid_t uid = (uid_t)va_arg(ap, int); -+#else - uid_t uid = va_arg(ap, uid_t); -+#endif - - int rv, rerror; - -@@ -1019,7 +1031,11 @@ - _dns_getpwuid_r(void *nsrv, void *nscb, va_list ap) - { - int *retval = va_arg(ap, int *); -+#ifdef __minix -+ uid_t uid = (uid_t)va_arg(ap, int); -+#else - uid_t uid = va_arg(ap, uid_t); -+#endif - struct passwd *pw = va_arg(ap, struct passwd *); - char *buffer = va_arg(ap, char *); - size_t buflen = va_arg(ap, size_t); -@@ -1508,7 +1524,11 @@ - _nis_getpwuid(void *nsrv, void *nscb, va_list ap) - { - struct passwd **retval = va_arg(ap, struct passwd **); -+#ifdef __minix -+ uid_t uid = (uid_t)va_arg(ap, int); -+#else - uid_t uid = va_arg(ap, uid_t); -+#endif - - int rv, rerror; - -@@ -1534,7 +1554,11 @@ - _nis_getpwuid_r(void *nsrv, void *nscb, va_list ap) - { - int *retval = va_arg(ap, int *); -+#ifdef __minix -+ uid_t uid = (uid_t)va_arg(ap, int); -+#else - uid_t uid = va_arg(ap, uid_t); -+#endif - struct passwd *pw = va_arg(ap, struct passwd *); - char *buffer = va_arg(ap, char *); - size_t buflen = va_arg(ap, size_t); -@@ -1896,9 +1920,15 @@ - &crv, name, pw, buffer, buflen, &cpw); - break; - case _PW_KEYBYUID: -+#ifdef __minix - rv = nsdispatch(NULL, compatuiddtab, - NSDB_PASSWD_COMPAT, "getpwuid_r", __nsdefaultnis, -+ &crv, (int)uid, pw, buffer, buflen, &cpw); -+#else -+ rv = nsdispatch(NULL, compatuiddtab, -+ NSDB_PASSWD_COMPAT, "getpwuid_r", __nsdefaultnis, - &crv, uid, pw, buffer, buflen, &cpw); -+#endif - break; - default: - abort(); -@@ -2301,7 +2331,11 @@ - _compat_getpwuid(void *nsrv, void *nscb, va_list ap) - { - struct passwd **retval = va_arg(ap, struct passwd **); -+#ifdef __minix -+ uid_t uid = (uid_t)va_arg(ap, int); -+#else - uid_t uid = va_arg(ap, uid_t); -+#endif - - int rv, rerror; - -@@ -2326,7 +2360,11 @@ - _compat_getpwuid_r(void *nsrv, void *nscb, va_list ap) - { - int *retval = va_arg(ap, int *); -+#ifdef __minix -+ uid_t uid = (uid_t)va_arg(ap, int); -+#else - uid_t uid = va_arg(ap, uid_t); -+#endif - struct passwd *pw = va_arg(ap, struct passwd *); - char *buffer = va_arg(ap, char *); - size_t buflen = va_arg(ap, size_t); -@@ -2482,8 +2520,13 @@ - }; - - mutex_lock(&_pwmutex); -+#ifdef __minix - rv = nsdispatch(NULL, dtab, NSDB_PASSWD, "getpwuid", __nsdefaultcompat, -+ &retval, (int)uid); -+#else -+ rv = nsdispatch(NULL, dtab, NSDB_PASSWD, "getpwuid", __nsdefaultcompat, - &retval, uid); -+#endif - mutex_unlock(&_pwmutex); - return (rv == NS_SUCCESS) ? retval : NULL; - } -@@ -2509,8 +2552,14 @@ - *result = NULL; - retval = 0; - mutex_lock(&_pwmutex); -+#ifdef __minix - r = nsdispatch(NULL, dtab, NSDB_PASSWD, "getpwuid_r", __nsdefaultcompat, -+ &retval, (int)uid, pwd, buffer, buflen, result); -+#else -+ r = nsdispatch(NULL, dtab, NSDB_PASSWD, "getpwuid_r", __nsdefaultcompat, - &retval, uid, pwd, buffer, buflen, result); -+#endif -+ - mutex_unlock(&_pwmutex); - switch (r) { - 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 ---- nbsdsrc/src/lib/libc/gen/gr_private.h -+++ lib/nbsd_libc/gen/gr_private.h -@@ -40,11 +40,13 @@ - #define _GROUP_COMPAT /* "group" defaults to compat, so always provide it */ - - -+#ifndef __minix /* should be _REENTRANT */ - /* - * mutex to serialize the public group(5) functions use of the - * back-end implementations, which may not be reentrant. - */ - extern mutex_t __grmutex; -+#endif - - /* - * files methods -diff -ru nbsdsrc/src/lib/libc/gen/initdir.c lib/nbsd_libc/gen/initdir.c ---- nbsdsrc/src/lib/libc/gen/initdir.c -+++ lib/nbsd_libc/gen/initdir.c -@@ -35,6 +35,14 @@ - #endif /* LIBC_SCCS and not lint */ - - #include "namespace.h" -+ -+#ifdef __minix -+/* NetBSD BUG on !_REENTRANT */ -+#include -+#include -+#include -+#endif -+ - #include "reentrant.h" - #include "extern.h" - -@@ -221,9 +229,11 @@ - xp = dp; - else - dp->d_fileno = 0; -+#ifndef __minix - if (dp->d_type == DT_WHT && - (flags & DTF_HIDEW)) - dp->d_fileno = 0; -+#endif - } - - free(dpv); -diff -ru nbsdsrc/src/lib/libc/gen/opendir.c lib/nbsd_libc/gen/opendir.c ---- nbsdsrc/src/lib/libc/gen/opendir.c -+++ lib/nbsd_libc/gen/opendir.c -@@ -40,6 +40,12 @@ - - #include "namespace.h" - #include "reentrant.h" -+ -+#ifdef __minix -+#include -+#include -+#endif -+ - #include "extern.h" - - #include -@@ -97,7 +103,9 @@ - DIR *dirp = NULL; - int serrno; - struct stat sb; -+#ifndef __minix - struct statvfs sfb; -+#endif - int error; - - if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1) -@@ -122,6 +130,10 @@ - * Tweak flags for the underlying filesystem. - */ - -+#ifdef __minix -+ /* MOUNT_UNION and MOUNT_NFS not supported */ -+ flags &= ~DTF_NODUP; -+#else - if (fstatvfs1(fd, &sfb, ST_NOWAIT) < 0) - goto error; - if ((flags & DTF_NODUP) != 0) { -@@ -136,6 +148,7 @@ - if (!strncmp(sfb.f_fstypename, MOUNT_NFS, sizeof(sfb.f_fstypename))) { - flags |= __DTF_READALL | __DTF_RETRY_ON_BADCOOKIE; - } -+#endif - - dirp->dd_flags = flags; - error = _initdir(dirp, fd, name); -diff -ru nbsdsrc/src/lib/libc/gen/readdir.c lib/nbsd_libc/gen/readdir.c ---- nbsdsrc/src/lib/libc/gen/readdir.c -+++ lib/nbsd_libc/gen/readdir.c -@@ -40,6 +40,12 @@ - - #include "namespace.h" - #include "reentrant.h" -+ -+#ifdef __minix -+#include -+#include -+#endif -+ - #include "extern.h" - #include - -@@ -81,8 +87,10 @@ - dirp->dd_loc += dp->d_reclen; - if (dp->d_ino == 0 && skipdeleted) - continue; -+#ifndef __minix - if (dp->d_type == DT_WHT && (dirp->dd_flags & DTF_HIDEW)) - continue; -+#endif - return (dp); - } - } -diff -ru nbsdsrc/src/lib/libc/gen/rewinddir.c lib/nbsd_libc/gen/rewinddir.c ---- nbsdsrc/src/lib/libc/gen/rewinddir.c -+++ lib/nbsd_libc/gen/rewinddir.c -@@ -40,6 +40,11 @@ - - #include "namespace.h" - #include "reentrant.h" -+ -+#ifdef __minix -+#include -+#endif -+ - #include "extern.h" - #include - -diff -ru nbsdsrc/src/lib/libc/gen/scandir.c lib/nbsd_libc/gen/scandir.c ---- nbsdsrc/src/lib/libc/gen/scandir.c -+++ lib/nbsd_libc/gen/scandir.c -@@ -130,9 +130,13 @@ - goto bad2; - p->d_fileno = d->d_fileno; - p->d_reclen = d->d_reclen; -+#ifndef __minix - p->d_type = d->d_type; - p->d_namlen = d->d_namlen; - (void)memmove(p->d_name, d->d_name, (size_t)(p->d_namlen + 1)); -+#else -+ (void)memmove(p->d_name, d->d_name, (size_t)(strlen(d->d_name) + 1)); -+#endif - names[nitems++] = p; - } - (void)closedir(dirp); -diff -ru nbsdsrc/src/lib/libc/gen/seekdir.c lib/nbsd_libc/gen/seekdir.c ---- nbsdsrc/src/lib/libc/gen/seekdir.c -+++ lib/nbsd_libc/gen/seekdir.c -@@ -40,6 +40,9 @@ - - #include "namespace.h" - #include "reentrant.h" -+#ifdef __minix -+#include -+#endif - #include "extern.h" - #include - -diff -ru nbsdsrc/src/lib/libc/gen/syslog.c lib/nbsd_libc/gen/syslog.c ---- nbsdsrc/src/lib/libc/gen/syslog.c -+++ lib/nbsd_libc/gen/syslog.c -@@ -492,7 +492,9 @@ - /* AF_UNIX address of local logger */ - static const struct sockaddr_un sun = { - .sun_family = AF_LOCAL, -+#ifndef __minix - .sun_len = sizeof(sun), -+#endif - .sun_path = _PATH_LOG, - }; - -diff -ru nbsdsrc/src/lib/libc/gen/telldir.c lib/nbsd_libc/gen/telldir.c ---- nbsdsrc/src/lib/libc/gen/telldir.c -+++ lib/nbsd_libc/gen/telldir.c -@@ -40,6 +40,11 @@ - - #include "namespace.h" - #include "reentrant.h" -+ -+#ifdef __minix -+#include -+#endif -+ - #include "extern.h" - #include - -diff -ru nbsdsrc/src/lib/libc/gen/ttyname.c lib/nbsd_libc/gen/ttyname.c ---- nbsdsrc/src/lib/libc/gen/ttyname.c -+++ lib/nbsd_libc/gen/ttyname.c -@@ -72,7 +72,9 @@ - mode_t type; - dev_t dev; - } bkey; -+#ifndef __minix - struct ptmget ptm; -+#endif - #define DEVSZ (sizeof(_PATH_DEV) - 1) - - _DIAGASSERT(fd != -1); -@@ -81,6 +83,7 @@ - return ERANGE; - } - -+#ifndef __minix - /* If it is a pty, deal with it quickly */ - if (ioctl(fd, TIOCPTSNAME, &ptm) != -1) { - if (strlcpy(buf, ptm.sn, len) >= len) { -@@ -88,6 +91,7 @@ - } - return 0; - } -+#endif - /* Must be a terminal. */ - if (tcgetattr(fd, &ttyb) == -1) - return errno; -@@ -136,7 +140,11 @@ - while ((dirp = readdir(dp)) != NULL) { - if (dirp->d_fileno != sb->st_ino) - continue; -+#ifdef __minix -+ dlen = strlen(dirp->d_name); -+#else - dlen = dirp->d_namlen + 1; -+#endif - if (len - DEVSZ <= dlen) { - /* - * XXX: we return an error if *any* entry does not -diff -ru nbsdsrc/src/lib/libc/gen/ttyslot.c lib/nbsd_libc/gen/ttyslot.c ---- nbsdsrc/src/lib/libc/gen/ttyslot.c -+++ lib/nbsd_libc/gen/ttyslot.c -@@ -59,14 +59,20 @@ - char *p; - int cnt; - char *name; -+#ifndef __minix - struct ptmget ptm; -+#endif - - setttyent(); - for (cnt = 0; cnt < 3; ++cnt) { -+#ifndef __minix - if (ioctl(cnt, TIOCPTSNAME, &ptm) != -1) { - ispty = 1; - name = ptm.sn; - } else if ((name = ttyname(cnt)) != NULL) { -+#else -+ if ((name = ttyname(cnt)) != NULL) { -+#endif - ispty = 0; - } else - continue; -diff -ru nbsdsrc/src/lib/libc/gen/ulimit.c lib/nbsd_libc/gen/ulimit.c ---- nbsdsrc/src/lib/libc/gen/ulimit.c -+++ lib/nbsd_libc/gen/ulimit.c -@@ -54,12 +54,14 @@ - if (getrlimit(RLIMIT_FSIZE, &rlimit) == 0) - result = (long int)(rlimit.rlim_cur / 512); - break; -+#ifndef __minix - case UL_SETFSIZE: - new_limit = va_arg(ap, long int); - rlimit.rlim_cur = rlimit.rlim_max = (rlim_t)new_limit * 512; - if (setrlimit(RLIMIT_FSIZE, &rlimit) == 0) - result = new_limit; - break; -+#endif - default: - errno = EINVAL; - } -diff -ru nbsdsrc/src/lib/libc/gen/utmpx.c lib/nbsd_libc/gen/utmpx.c ---- nbsdsrc/src/lib/libc/gen/utmpx.c -+++ lib/nbsd_libc/gen/utmpx.c -@@ -336,16 +336,32 @@ - _DIAGASSERT(file != NULL); - _DIAGASSERT(utx != NULL); - -+#ifndef __minix - fd = open(file, O_WRONLY|O_APPEND|O_SHLOCK); -+#else -+ fd = open(file, O_WRONLY|O_APPEND); -+#endif - - if (fd == -1) { -+#ifndef __minix - if ((fd = open(file, O_CREAT|O_WRONLY|O_EXLOCK, 0644)) == -1) - return -1; -+#else -+ if ((fd = open(file, O_CREAT|O_WRONLY, 0644)) < 0) -+ return -1; -+ if (flock(fd, LOCK_EX) < 0) -+ return -1; -+#endif - (void)memset(&ut, 0, sizeof(ut)); - ut.ut_type = SIGNATURE; - (void)memcpy(ut.ut_user, vers, sizeof(vers)); - if (write(fd, &ut, sizeof(ut)) == -1) - goto failed; -+ } else { -+#ifdef __minix -+ if (flock(fd, LOCK_SH) < 0 ) -+ return -1; -+#endif - } - if (write(fd, utx, sizeof(*utx)) == -1) - goto failed; -@@ -425,10 +441,18 @@ - _DIAGASSERT(fname != NULL); - _DIAGASSERT(ll != NULL); - -+#ifdef __minix -+ db = dbopen(fname, O_RDONLY, 0, DB_HASH, NULL); -+#else - db = dbopen(fname, O_RDONLY|O_SHLOCK, 0, DB_HASH, NULL); -+#endif - - if (db == NULL) - return NULL; -+#ifdef __minix -+ if (flock(db->fd(db), LOCK_SH) < 0) -+ return NULL; -+#endif - - key.data = &uid; - key.size = sizeof(uid); -@@ -464,11 +488,19 @@ - _DIAGASSERT(fname != NULL); - _DIAGASSERT(ll != NULL); - -+#ifndef __minix - db = dbopen(fname, O_RDWR|O_CREAT|O_EXLOCK, 0644, DB_HASH, NULL); -+#else -+ db = dbopen(fname, O_RDWR|O_CREAT, 0644, DB_HASH, NULL); -+#endif - - if (db == NULL) - return -1; - -+#ifdef __minix -+ if (flock(db->fd(db), LOCK_EX) < 0) -+ return -1; -+#endif - key.data = &uid; - key.size = sizeof(uid); - data.data = ll; -diff -ru nbsdsrc/src/lib/libc/gmon/gmon.c lib/nbsd_libc/gmon/gmon.c ---- nbsdsrc/src/lib/libc/gmon/gmon.c -+++ lib/nbsd_libc/gmon/gmon.c -@@ -373,8 +373,10 @@ - struct gmonparam *p = &_gmonparam; - struct gmonhdr gmonhdr, *hdr; - struct clockinfo clockinfo; -+#ifndef __minix - int mib[2]; - size_t size; -+#endif - char *profdir; - const char *proffile; - char buf[PATH_MAX]; -@@ -397,6 +399,9 @@ - if (p->state == GMON_PROF_ERROR) - warnx("%s: tos overflow", __func__); - -+#ifdef __minix -+ clockinfo.profhz = sysconf(_SC_CLK_TCK); -+#else /* !__minix */ - size = sizeof(clockinfo); - mib[0] = CTL_KERN; - mib[1] = KERN_CLOCKRATE; -@@ -411,6 +416,7 @@ - else - clockinfo.profhz = hertz(); - } -+#endif /* !__minix */ - - moncontrol(0); - -@@ -509,6 +515,7 @@ - } - } - -+#ifndef __minix - /* - * discover the tick frequency of the machine - * if something goes wrong, we return 0, an impossible hertz. -@@ -542,3 +549,4 @@ - (void)timer_delete(t); - return rv; - } -+#endif /* !__minix */ -diff -ru nbsdsrc/src/lib/libc/include/env.h lib/nbsd_libc/include/env.h ---- nbsdsrc/src/lib/libc/include/env.h -+++ lib/nbsd_libc/include/env.h -@@ -56,7 +56,11 @@ - } - - static __inline bool -+#ifdef __minix -+__unlockenv(void) -+#else /* Bug-to-bug compatibility? */ - __unlocklockenv(void) -+#endif - { - return true; - } -diff -ru nbsdsrc/src/lib/libc/include/namespace.h lib/nbsd_libc/include/namespace.h ---- nbsdsrc/src/lib/libc/include/namespace.h -+++ lib/nbsd_libc/include/namespace.h -@@ -47,7 +47,9 @@ - #define fork _fork - #define fseeko _fseeko - #define ftello _ftello -+#ifndef __minix - #define getcontext _getcontext -+#endif /* !__minix */ - #define getenv_r _getenv_r - #define imaxabs _imaxabs - #define imaxdiv _imaxdiv -@@ -530,7 +532,13 @@ - #define seed48 _seed48 - #define seekdir _seekdir - #define select _select -+#ifdef __minix -+/* '_send' unfortunately collides with Minix IPC's _send function. -+ * This solution is fragile, a proper renaming of Minix IPCs should -+ * be done insted. */ -+#else /* !__minix */ - #define send _send -+#endif /* !__minix */ - #define setdomainname _setdomainname - #define setenv _setenv - #define setfsent _setfsent -@@ -845,6 +853,79 @@ - #define xprtlist_lock __rpc_xprtlist_lock - - #define __learn_tree ___learn_tree -+ -+#ifdef __minix -+#define _exit __exit -+#define access _access -+#define bind _bind -+#define chdir _chdir -+#define chmod _chmod -+#define chown _chown -+#define chroot _chroot -+#define close _close -+#define dup _dup -+#define dup2 _dup2 -+#define execve _execve -+#define fchdir _fchdir -+#define fchmod _fchmod -+#define fchown _fchown -+#define fcntl _fcntl -+#define flock _flock -+#define fstatfs _fstatfs -+#define fsync _fsync -+#define fpathconf _fpathconf -+#define getegid _getegid -+#define geteuid _geteuid -+#define getgroups _getgroups -+#define getpid _getpid -+#define getpgrp _getpgrp -+#define getppid _getppid -+#define gettimeofday _gettimeofday -+#define getgid _getgid -+#define getuid _getuid -+#define ioctl _ioctl -+#define link _link -+#define mount _mount -+#define mkdir _mkdir -+#define mkfifo _mkfifo -+#define mknod _mknod -+#define munmap _munmap -+#define munmap_text _munmap_text -+#define open _open -+#define pathconf _pathconf -+#define ptrace _ptrace -+#define readv _readv -+#define rmdir _rmdir -+#define setegid _setegid -+#define seteuid _seteuid -+#define setgid _setgid -+#define setgroups _setgroups -+#define setprogname _setprogname -+#define setsid _setsid -+#define setuid _setuid -+#define shmat _shmat -+#define shmdt _shmdt -+#define shmget _shmget -+#define shutdown _shutdown -+#define sigreturn _sigreturn -+#define socket _socket -+#define socketpair _socketpair -+#define symlink _symlink -+#define sync _sync -+#define stime _stime -+#define umask _umask -+#define umount _umount -+#define umount2 _umount2 -+#define unlink _unlink -+#define vm_remap _vm_remap -+#define vm_unmap _vm_unmap -+#define vm_getphys _vm_getphys -+#define vm_getrefcount _vm_getrefcount -+#define truncate _truncate -+#define write _write -+#define writev _writev -+#endif /* __minix */ -+ - #endif /* __weak_alias */ - #endif /* !__lint__ */ - -diff -ru nbsdsrc/src/lib/libc/libcincludes.mk lib/nbsd_libc/libcincludes.mk ---- nbsdsrc/src/lib/libc/libcincludes.mk -+++ lib/nbsd_libc/libcincludes.mk -@@ -3,7 +3,25 @@ - # Makefile fragment shared across several parts that want to look - # inside libc's include tree. - -+.if defined(__MINIX) -+MACHINE_ARCH= ${MACHINE} -+MACHINE_CPU= ${MACHINE} - .if defined(LIBC_MACHINE_ARCH) && \ -+ exists(${MINIXSRCDIR}/lib/nbsd_libc/arch/${LIBC_MACHINE_ARCH}/SYS.h) -+ARCHSUBDIR= ${LIBC_MACHINE_ARCH} -+.elif exists(${MINIXSRCDIR}/lib/nbsd_libc/arch/${MACHINE_ARCH}/SYS.h) -+ARCHSUBDIR= ${MACHINE_ARCH} -+.elif exists(${MINIXSRCDIR}/lib/nbsd_libc/arch/${MACHINE_CPU}/SYS.h) -+ARCHSUBDIR= ${MACHINE_CPU} -+.else -+.BEGIN: -+ @echo no ARCHDIR for ${MACHINE_ARCH} nor ${MACHINE_CPU} -+ @false -+.endif -+ -+ARCHDIR= ${MINIXSRCCDIR}/lib/nbsd_libc/arch/${ARCHSUBDIR} -+.else -+.if defined(LIBC_MACHINE_ARCH) && \ - exists(${NETBSDSRCDIR}/lib/libc/arch/${LIBC_MACHINE_ARCH}/SYS.h) - ARCHSUBDIR= ${LIBC_MACHINE_ARCH} - .elif exists(${NETBSDSRCDIR}/lib/libc/arch/${MACHINE_ARCH}/SYS.h) -@@ -17,3 +35,4 @@ - .endif - - ARCHDIR= ${NETBSDSRCDIR}/lib/libc/arch/${ARCHSUBDIR} -+.endif -diff -ru nbsdsrc/src/lib/libc/locale/setlocale.c lib/nbsd_libc/locale/setlocale.c ---- nbsdsrc/src/lib/libc/locale/setlocale.c -+++ lib/nbsd_libc/locale/setlocale.c -@@ -61,6 +61,38 @@ - extern const _locale_category_t _localeio_LC_MESSAGES_desc; - #endif - -+#ifdef __minix -+/* GNU binutils 2.x a.out support is rotten and link sets are not -+ supported. Workaround this by explicitely creating the structure -+ the linker was supposed to create. */ -+ -+struct { -+ int __ls_length; -+ _locale_category_t *__ls_items[7]; -+} __link_set_all_categories = { -+ .__ls_length = 7, -+ .__ls_items = { -+ [0] = &_generic_LC_ALL_desc, -+ [1] = &_dummy_LC_COLLATE_desc, -+#ifdef WITH_RUNE -+ [2] = &_citrus_LC_CTYPE_desc, -+ [3] = &_citrus_LC_MONETARY_desc, -+ [4] = &_citrus_LC_NUMERIC_desc, -+ [5] = &_citrus_LC_TIME_desc, -+ [6] = &_citrus_LC_MESSAGES_desc, -+#else -+ [2] = &_localeio_LC_CTYPE_desc, -+ [3] = &_localeio_LC_MONETARY_desc, -+ [4] = &_localeio_LC_NUMERIC_desc, -+ [5] = &_localeio_LC_TIME_desc, -+ [6] = &_localeio_LC_MESSAGES_desc, -+#endif -+ }, -+}; -+ -+#endif /* __minix */ -+ -+ - __link_set_add_data(all_categories, _generic_LC_ALL_desc); - __link_set_add_data(all_categories, _dummy_LC_COLLATE_desc); - #ifdef WITH_RUNE -diff -ru nbsdsrc/src/lib/libc/misc/initfini.c lib/nbsd_libc/misc/initfini.c ---- nbsdsrc/src/lib/libc/misc/initfini.c -+++ lib/nbsd_libc/misc/initfini.c -@@ -55,8 +55,10 @@ - /* Atomic operations */ - __libc_atomic_init(); - -+#ifdef _REENTRANT - /* Threads */ - __libc_thr_init(); -+#endif - - /* Initialize the atexit mutexes */ - __libc_atexit_init(); -diff -ru nbsdsrc/src/lib/libc/misc/stack_protector.c lib/nbsd_libc/misc/stack_protector.c ---- nbsdsrc/src/lib/libc/misc/stack_protector.c -+++ lib/nbsd_libc/misc/stack_protector.c -@@ -56,24 +56,30 @@ - void - __guard_setup(void) - { -+#ifndef __minix - int mib[2]; -+#endif - size_t len; - - if (__stack_chk_guard[0] != 0) - return; - -+#ifndef __minix - mib[0] = CTL_KERN; - mib[1] = KERN_ARND; - - len = sizeof(__stack_chk_guard); - if (__sysctl(mib, 2, __stack_chk_guard, &len, NULL, 0) == -1 || - len != sizeof(__stack_chk_guard)) { -+#endif - /* If sysctl was unsuccessful, use the "terminator canary". */ - ((unsigned char *)(void *)__stack_chk_guard)[0] = 0; - ((unsigned char *)(void *)__stack_chk_guard)[1] = 0; - ((unsigned char *)(void *)__stack_chk_guard)[2] = '\n'; - ((unsigned char *)(void *)__stack_chk_guard)[3] = 255; -+#ifndef __minix - } -+#endif - } - - /*ARGSUSED*/ -diff -ru nbsdsrc/src/lib/libc/net/Makefile.inc lib/nbsd_libc/net/Makefile.inc ---- nbsdsrc/src/lib/libc/net/Makefile.inc -+++ lib/nbsd_libc/net/Makefile.inc -@@ -2,18 +2,33 @@ - # @(#)Makefile.inc 8.2 (Berkeley) 9/5/93 - - # net sources -+.if defined(__MINIX) -+.PATH: ${.CURDIR}/net/minix -+.endif - .PATH: ${ARCHDIR}/net ${.CURDIR}/net - -+.if defined(__MINIX) -+# Not supported by minix: iso_addr.c link_addr.c sockatmark.c - SRCS+= __cmsg_alignbytes.c base64.c ethers.c gethnamaddr.c getifaddrs.c \ - getnetnamadr.c getnetent.c getpeereid.c \ - getprotobyname.c getprotobynumber.c getprotoent.c \ - getprotobyname_r.c getprotobynumber_r.c getprotoent_r.c \ - getservbyname.c getservbyport.c getservent.c \ - getservbyname_r.c getservbyport_r.c getservent_r.c \ -+ nsdispatch.c nslexer.l nsparser.y nsap_addr.c \ -+ rcmd.c recv.c send.c sethostent.c -+.else -+SRCS+= __cmsg_alignbytes.c base64.c ethers.c gethnamaddr.c getifaddrs.c \ -+ getnetnamadr.c getnetent.c getpeereid.c \ -+ getprotobyname.c getprotobynumber.c getprotoent.c \ -+ getprotobyname_r.c getprotobynumber_r.c getprotoent_r.c \ -+ getservbyname.c getservbyport.c getservent.c \ -+ getservbyname_r.c getservbyport_r.c getservent_r.c \ - iso_addr.c linkaddr.c \ - nsdispatch.c nslexer.l nsparser.y nsap_addr.c \ - rcmd.c recv.c send.c sethostent.c \ - sockatmark.c -+.endif - - .if (${MKHESIOD} != "no") - SRCS+= hesiod.c -@@ -23,7 +38,9 @@ - .if (${USE_INET6} != "no") - SRCS+= ip6opt.c rthdr.c vars6.c - .endif -+.if !defined(__MINIX) - SRCS+= if_indextoname.c if_nameindex.c if_nametoindex.c -+.endif - - LPREFIX=_nsyy - YPREFIX=_nsyy -diff -ru nbsdsrc/src/lib/libc/net/getaddrinfo.c lib/nbsd_libc/net/getaddrinfo.c ---- nbsdsrc/src/lib/libc/net/getaddrinfo.c -+++ lib/nbsd_libc/net/getaddrinfo.c -@@ -855,7 +855,12 @@ - ai = calloc(sizeof(struct addrinfo) + addrlen, 1); - if (ai) { - ai->ai_addr = (void *)(ai+1); -+#ifndef __minix - ai->ai_addrlen = ai->ai_addr->sa_len = addrlen; -+#else /* __minix */ -+ ai->ai_addrlen = addrlen; -+#endif -+ - } - - return ai; -diff -ru nbsdsrc/src/lib/libc/net/getnameinfo.c lib/nbsd_libc/net/getnameinfo.c ---- nbsdsrc/src/lib/libc/net/getnameinfo.c -+++ lib/nbsd_libc/net/getnameinfo.c -@@ -54,10 +54,12 @@ - #include - #include - #include -+#ifndef __minix - #include - #include - #include - #include -+#endif /* !__minix */ - #include - #include - #include -@@ -103,11 +105,13 @@ - static int ip6_sa2str __P((const struct sockaddr_in6 *, char *, size_t, - int)); - #endif -+#ifndef __minix - static int getnameinfo_atalk __P((const struct sockaddr *, socklen_t, char *, - socklen_t, char *, socklen_t, int)); - - static int getnameinfo_link __P((const struct sockaddr *, socklen_t, char *, - socklen_t, char *, socklen_t, int)); -+#endif /* __minix */ - static int hexname __P((const u_int8_t *, size_t, char *, socklen_t)); - - /* -@@ -124,21 +128,26 @@ - { - - switch (sa->sa_family) { -+#ifndef __minix - case AF_APPLETALK: - return getnameinfo_atalk(sa, salen, host, hostlen, - serv, servlen, flags); -+#endif /* !__minix */ - case AF_INET: - case AF_INET6: - return getnameinfo_inet(sa, salen, host, hostlen, - serv, servlen, flags); -+#ifndef __minix - case AF_LINK: - return getnameinfo_link(sa, salen, host, hostlen, - serv, servlen, flags); -+#endif /* !__minix */ - default: - return EAI_FAMILY; - } - } - -+#ifndef __minix - /* - * getnameinfo_atalk(): - * Format an AppleTalk address into a printable format. -@@ -198,6 +207,7 @@ - - return EAI_MEMORY; - } -+#endif /* !__minix */ - - /* - * getnameinfo_inet(): -@@ -491,6 +501,7 @@ - #endif /* INET6 */ - - -+#ifndef __minix - /* - * getnameinfo_link(): - * Format a link-layer address into a printable format, paying attention to -@@ -568,6 +579,7 @@ - (size_t)sdl->sdl_alen, host, hostlen); - } - } -+#endif /* !__minix */ - - static int - hexname(cp, len, host, hostlen) -diff -ru nbsdsrc/src/lib/libc/net/rcmd.c lib/nbsd_libc/net/rcmd.c ---- nbsdsrc/src/lib/libc/net/rcmd.c -+++ lib/nbsd_libc/net/rcmd.c -@@ -48,7 +48,9 @@ - #include - - #include -+#ifndef __minix - #include -+#endif - #include - #include - -@@ -213,7 +215,11 @@ - struct addrinfo *r; - struct sockaddr_storage from; - struct pollfd reads[2]; -+#ifdef __minix -+ /* No support for OOB data in Minix. */ -+#else - sigset_t nmask, omask; -+#endif /* !__minix */ - pid_t pid; - int s, lport, timo; - int pollr; -@@ -230,10 +236,14 @@ - r = res; - refused = 0; - pid = getpid(); -+#ifndef __minix -+ /* Minix has no support for OOB data, -+ no need to block SIGURG. */ - sigemptyset(&nmask); - sigaddset(&nmask, SIGURG); - if (sigprocmask(SIG_BLOCK, &nmask, &omask) == -1) - return -1; -+#endif /* !__minix */ - for (timo = 1, lport = IPPORT_RESERVED - 1;;) { - s = rresvport_af(&lport, r->ai_family); - if (s < 0) { -@@ -245,11 +255,16 @@ - r = r->ai_next; - continue; - } else { -+#ifndef __minix - (void)sigprocmask(SIG_SETMASK, &omask, NULL); -+#endif /* !__minix */ - return (-1); - } - } -+#ifndef __minix -+ /* No OOB support in Minix. */ - fcntl(s, F_SETOWN, pid); -+#endif /* !__minix */ - if (connect(s, r->ai_addr, r->ai_addrlen) >= 0) - break; - (void)close(s); -@@ -286,7 +301,10 @@ - } - (void)fprintf(stderr, "%s: %s\n", res->ai_canonname, - strerror(errno)); -+#ifndef __minix -+ /* No OOB support in Minix. */ - (void)sigprocmask(SIG_SETMASK, &omask, NULL); -+#endif /* !__minix */ - return (-1); - } - lport--; -@@ -363,14 +381,18 @@ - } - goto bad2; - } -+#ifndef __minix - (void)sigprocmask(SIG_SETMASK, &omask, NULL); -+#endif /* __minix */ - return (s); - bad2: - if (lport) - (void)close(*fd2p); - bad: - (void)close(s); -+#ifndef __minix - (void)sigprocmask(SIG_SETMASK, &omask, NULL); -+#endif /* __minix */ - return (-1); - } - -diff -ru nbsdsrc/src/lib/libc/net/send.c lib/nbsd_libc/net/send.c ---- nbsdsrc/src/lib/libc/net/send.c -+++ lib/nbsd_libc/net/send.c -@@ -44,9 +44,15 @@ - - #include - -+#ifdef __minix -+/* UGLY: name clash with minix ipc. -+ * Better solution: redefine minix ipc. -+ */ -+#else /* !__minix */ - #ifdef __weak_alias - __weak_alias(send, _send) - #endif -+#endif /* !__minix */ - - ssize_t - send(s, msg, len, flags) -diff -ru nbsdsrc/src/lib/libc/nls/catopen.c lib/nbsd_libc/nls/catopen.c ---- nbsdsrc/src/lib/libc/nls/catopen.c -+++ lib/nbsd_libc/nls/catopen.c -@@ -169,6 +169,19 @@ - return (nl_catd)-1; - } - -+#ifdef __minix -+ data = mmap(0, (size_t)st.st_size, PROT_READ, MAP_ANON, -1, (off_t)0); -+ if (data == MAP_FAILED) { -+ return (nl_catd)-1; -+ } -+ -+ if (read(fd, data, st.st_size) != st.st_size) -+ { -+ munmap(data, (size_t)st.st_size); -+ return (nl_catd)-1; -+ } -+ close (fd); -+#else /* !__minix */ - data = mmap(0, (size_t)st.st_size, PROT_READ, MAP_FILE|MAP_SHARED, fd, - (off_t)0); - close (fd); -@@ -176,6 +189,7 @@ - if (data == MAP_FAILED) { - return (nl_catd)-1; - } -+#endif /* __minix */ - - if (ntohl((u_int32_t)((struct _nls_cat_hdr *)data)->__magic) != - _NLS_MAGIC) { -diff -ru nbsdsrc/src/lib/libc/resolv/Makefile.inc lib/nbsd_libc/resolv/Makefile.inc ---- nbsdsrc/src/lib/libc/resolv/Makefile.inc -+++ lib/nbsd_libc/resolv/Makefile.inc -@@ -2,7 +2,11 @@ - - # net sources - .PATH: ${.CURDIR}/resolv -+.if defined(__MINIX) -+CPPFLAGS+=-DCOMPAT__RES -DNEED_PSELECT -+.else - CPPFLAGS+=-DCOMPAT__RES -DUSE_POLL -+.endif - - SRCS+= __dn_comp.c __res_close.c __res_send.c h_errno.c \ - herror.c res_comp.c res_data.c res_debug.c \ -diff -ru nbsdsrc/src/lib/libc/resolv/res_comp.c lib/nbsd_libc/resolv/res_comp.c ---- nbsdsrc/src/lib/libc/resolv/res_comp.c -+++ lib/nbsd_libc/resolv/res_comp.c -@@ -96,7 +96,7 @@ - #ifdef __weak_alias - __weak_alias(dn_expand,_dn_expand) - __weak_alias(dn_comp,__dn_comp) --#if 0 -+#ifdef __minix - __weak_alias(dn_skipname,__dn_skipname) - __weak_alias(res_hnok,__res_hnok) - __weak_alias(res_ownok,__res_ownok) -diff -ru nbsdsrc/src/lib/libc/resolv/res_init.c lib/nbsd_libc/resolv/res_init.c ---- nbsdsrc/src/lib/libc/resolv/res_init.c -+++ lib/nbsd_libc/resolv/res_init.c -@@ -88,7 +88,9 @@ - #include - #include - #include -+#ifndef __minix - #include -+#endif /* !__minix */ - - #include - #include -@@ -348,7 +350,9 @@ - nserv = 0; - if ((fp = fopen(_PATH_RESCONF, "r")) != NULL) { - struct stat st; -+#ifndef __minix - struct kevent kc; -+#endif /* !__minix */ - - /* read the config file */ - while (fgets(buf, sizeof(buf), fp) != NULL) { -@@ -502,6 +506,7 @@ - if (fstat(statp->_u._ext.ext->resfd, &st) != -1) - __res_conf_time = statp->_u._ext.ext->res_conf_time = - st.st_mtimespec; -+#ifndef __minix - statp->_u._ext.ext->kq = kqueue(); - (void)fcntl(statp->_u._ext.ext->kq, F_SETFD, FD_CLOEXEC); - (void)fcntl(statp->_u._ext.ext->resfd, F_SETFD, FD_CLOEXEC); -@@ -509,6 +514,9 @@ - EV_ADD|EV_ENABLE|EV_CLEAR, NOTE_DELETE|NOTE_WRITE| NOTE_EXTEND| - NOTE_ATTRIB|NOTE_LINK|NOTE_RENAME|NOTE_REVOKE, 0, 0); - (void)kevent(statp->_u._ext.ext->kq, &kc, 1, NULL, 0, &ts); -+#else /* __minix */ -+ statp->_u._ext.ext->kq = -1; -+#endif /* !__minix */ - } else { - statp->_u._ext.ext->kq = -1; - statp->_u._ext.ext->resfd = -1; -@@ -565,7 +573,13 @@ - int - res_check(res_state statp, struct timespec *mtime) - { -+#ifdef __minix - /* -+ * XXX: No update on change. -+ */ -+ return 0; -+#else /* !__minix */ -+ /* - * If the times are equal, then we check if there - * was a kevent related to resolv.conf and reload. - * If the times are not equal, then we don't bother -@@ -593,6 +607,7 @@ - if (mtime) - *mtime = __res_conf_time; - return 1; -+#endif /* !__minix */ - } - - static void -diff -ru nbsdsrc/src/lib/libc/stdio/fseeko.c lib/nbsd_libc/stdio/fseeko.c ---- nbsdsrc/src/lib/libc/stdio/fseeko.c -+++ lib/nbsd_libc/stdio/fseeko.c -@@ -150,7 +150,16 @@ - fp->_flags |= __SNPT; - goto dumb; - } -- fp->_blksize = st.st_blksize; -+#ifdef __minix -+ if (st.st_blksize == 0) { -+ /* 0 in 2 cases: upgrade from old to new struct stat or -+ * there is a bug in underlying fs. -+ */ -+ fp->_blksize = MINIX_ST_BLKSIZE; -+ } else -+#endif -+ fp->_blksize = st.st_blksize; -+ - fp->_flags |= __SOPT; - } - -diff -ru nbsdsrc/src/lib/libc/stdio/makebuf.c lib/nbsd_libc/stdio/makebuf.c ---- nbsdsrc/src/lib/libc/stdio/makebuf.c -+++ lib/nbsd_libc/stdio/makebuf.c -@@ -114,18 +114,22 @@ - - /* could be a tty iff it is a character device */ - *couldbetty = S_ISCHR(st.st_mode); -- if (st.st_blksize == 0) { -- *bufsize = BUFSIZ; -- return (__SNPT); -- } - - /* - * Optimise fseek() only if it is a regular file. (The test for - * __sseek is mainly paranoia.) It is safe to set _blksize - * unconditionally; it will only be used if __SOPT is also set. - */ -- *bufsize = st.st_blksize; -- fp->_blksize = st.st_blksize; -+#ifdef __minix -+ if (st.st_blksize == 0) { -+ /* 0 in 2 cases: upgrade from old to new struct stat or -+ * there is a bug in underlying fs. -+ */ -+ *bufsize = fp->_blksize = MINIX_ST_BLKSIZE; -+ } else -+#endif -+ *bufsize = fp->_blksize = st.st_blksize; -+ - return ((st.st_mode & S_IFMT) == S_IFREG && fp->_seek == __sseek ? - __SOPT : __SNPT); - } -diff -ru nbsdsrc/src/lib/libc/stdlib/Makefile.inc lib/nbsd_libc/stdlib/Makefile.inc ---- nbsdsrc/src/lib/libc/stdlib/Makefile.inc -+++ lib/nbsd_libc/stdlib/Makefile.inc -@@ -4,18 +4,34 @@ - # stdlib sources - .PATH: ${ARCHDIR}/stdlib ${.CURDIR}/stdlib - -+.if defined(__MINIX) -+# pty.c not compiled - SRCS+= _env.c _rand48.c \ - a64l.c abort.c atexit.c atof.c atoi.c atol.c atoll.c \ - bsearch.c drand48.c exit.c \ - getenv.c getopt.c getopt_long.c getsubopt.c \ - hcreate.c heapsort.c imaxdiv.c insque.c jrand48.c l64a.c lldiv.c \ - lcong48.c lrand48.c lsearch.c merge.c mi_vector_hash.c mrand48.c \ -+ nrand48.c putenv.c qabs.c qdiv.c qsort.c posix_openpt.c \ -+ radixsort.c rand.c rand_r.c random.c remque.c \ -+ seed48.c setenv.c srand48.c strsuftoll.c \ -+ strtoimax.c strtol.c strtoll.c strtoq.c strtoul.c strtoull.c \ -+ strtoumax.c strtouq.c system.c tdelete.c tfind.c tsearch.c twalk.c \ -+ unsetenv.c strfmon.c -+.else -+SRCS+= _env.c _rand48.c \ -+ a64l.c abort.c atexit.c atof.c atoi.c atol.c atoll.c \ -+ bsearch.c drand48.c exit.c \ -+ getenv.c getopt.c getopt_long.c getsubopt.c \ -+ hcreate.c heapsort.c imaxdiv.c insque.c jrand48.c l64a.c lldiv.c \ -+ lcong48.c lrand48.c lsearch.c merge.c mi_vector_hash.c mrand48.c \ - nrand48.c putenv.c qabs.c qdiv.c qsort.c posix_openpt.c pty.c \ - radixsort.c rand.c rand_r.c random.c remque.c \ - seed48.c setenv.c srand48.c strsuftoll.c \ - strtoimax.c strtol.c strtoll.c strtoq.c strtoul.c strtoull.c \ - strtoumax.c strtouq.c system.c tdelete.c tfind.c tsearch.c twalk.c \ - unsetenv.c strfmon.c -+.endif - - # These are often replaced by MD .S versions - SRCS+= abs.c labs.c llabs.c imaxabs.c -diff -ru nbsdsrc/src/lib/libc/stdlib/_env.c lib/nbsd_libc/stdlib/_env.c ---- nbsdsrc/src/lib/libc/stdlib/_env.c -+++ lib/nbsd_libc/stdlib/_env.c -@@ -29,6 +29,8 @@ - * POSSIBILITY OF SUCH DAMAGE. - */ - -+static int inited = 0; -+ - #include - #if defined(LIBC_SCCS) && !defined(lint) - __RCSID("$NetBSD: _env.c,v 1.5 2010/11/17 13:25:53 tron Exp $"); -@@ -157,6 +159,7 @@ - env_node_t *node; - - _DIAGASSERT(envvar != NULL); -+ assert(inited); - node = rb_tree_find_node(&env_tree, envvar); - if (node != NULL) { - rb_tree_remove_node(&env_tree, node); -@@ -173,6 +176,7 @@ - { - env_node_t *node; - -+ assert(inited); - node = malloc(sizeof(*node) + length); - if (node != NULL) { - node->length = length; -@@ -194,6 +198,8 @@ - { - env_node_t *node; - -+ assert(inited); -+ - _DIAGASSERT(envvar != NULL); - - node = rb_tree_find_node(&env_tree, envvar); -@@ -208,6 +214,7 @@ - size_t num_entries; - env_node_t *node, *next; - -+ assert(inited); - while (++marker == 0); - - /* Mark all nodes which are currently used. */ -@@ -401,5 +408,7 @@ - void - __libc_env_init(void) - { -+ assert(!inited); - rb_tree_init(&env_tree, &env_tree_ops); -+ inited = 1; - } -diff -ru nbsdsrc/src/lib/libc/stdlib/atexit.c lib/nbsd_libc/stdlib/atexit.c ---- nbsdsrc/src/lib/libc/stdlib/atexit.c -+++ lib/nbsd_libc/stdlib/atexit.c -@@ -120,10 +120,12 @@ - void - __libc_atexit_init(void) - { -+#ifdef _REENTRANT /* !__minix */ - mutexattr_t atexit_mutex_attr; - mutexattr_init(&atexit_mutex_attr); - mutexattr_settype(&atexit_mutex_attr, PTHREAD_MUTEX_RECURSIVE); - mutex_init(&atexit_mutex, &atexit_mutex_attr); -+#endif /* _REENTRANT */ - } - - /* -diff -ru nbsdsrc/src/lib/libc/stdlib/malloc.c lib/nbsd_libc/stdlib/malloc.c ---- nbsdsrc/src/lib/libc/stdlib/malloc.c -+++ lib/nbsd_libc/stdlib/malloc.c -@@ -65,8 +65,10 @@ - # define malloc_pageshift 12U - # define malloc_minsize 16U - # endif -+#ifndef __minix - # define HAS_UTRACE - # define UTRACE_LABEL -+#endif /* __minix */ - - #include - void utrace(struct ut *, int); -@@ -210,9 +212,11 @@ - #define INIT_MMAP() - #endif - -+#ifndef __minix - #ifndef MADV_FREE - #define MADV_FREE MADV_DONTNEED - #endif -+#endif /* !__minix */ - - /* Number of free pages we cache */ - static size_t malloc_cache = 16; -@@ -485,8 +489,10 @@ - case '<': malloc_cache >>= 1; break; - case 'a': malloc_abort = 0; break; - case 'A': malloc_abort = 1; break; -+#ifndef __minix - case 'h': malloc_hint = 0; break; - case 'H': malloc_hint = 1; break; -+#endif /* !__minix */ - case 'r': malloc_realloc = 0; break; - case 'R': malloc_realloc = 1; break; - case 'j': malloc_junk = 0; break; -@@ -932,8 +938,10 @@ - if (malloc_junk) - memset(ptr, SOME_JUNK, l); - -+#ifndef __minix - if (malloc_hint) - madvise(ptr, l, MADV_FREE); -+#endif /* !__minix */ - - tail = (char *)ptr+l; - -diff -ru nbsdsrc/src/lib/libc/stdlib/system.c lib/nbsd_libc/stdlib/system.c ---- nbsdsrc/src/lib/libc/stdlib/system.c -+++ lib/nbsd_libc/stdlib/system.c -@@ -91,7 +91,11 @@ - } - - (void)__readlockenv(); -+#ifdef __minix -+ switch(pid = fork() ) { -+#else /* !__minix */ - switch(pid = vfork()) { -+#endif /* !__minix */ - case -1: /* error */ - (void)__unlockenv(); - sigaction(SIGINT, &intsa, NULL); -diff -ru nbsdsrc/src/lib/libc/termios/Makefile.inc lib/nbsd_libc/termios/Makefile.inc ---- nbsdsrc/src/lib/libc/termios/Makefile.inc -+++ lib/nbsd_libc/termios/Makefile.inc -@@ -2,9 +2,18 @@ - - .PATH: ${.CURDIR}/termios - -+.if defined(__MINIX) -+# Not supported by Minix: tcgetsid.c - SRCS+= cfgetispeed.c cfgetospeed.c cfmakeraw.c cfsetispeed.c cfsetospeed.c \ - cfsetspeed.c tcdrain.c tcflow.c tcflush.c tcgetattr.c tcgetpgrp.c \ -+ tcsendbreak.c tcsetattr.c tcsetpgrp.c -+.else -+SRCS+= cfgetispeed.c cfgetospeed.c cfmakeraw.c cfsetispeed.c cfsetospeed.c \ -+ cfsetspeed.c tcdrain.c tcflow.c tcflush.c tcgetattr.c tcgetpgrp.c \ - tcgetsid.c tcsendbreak.c tcsetattr.c tcsetpgrp.c -+.endif -+ -+ - - MAN+= tcgetpgrp.3 tcgetsid.3 tcsendbreak.3 tcsetattr.3 tcsetpgrp.3 - -diff -ru nbsdsrc/src/lib/libc/termios/cfmakeraw.c lib/nbsd_libc/termios/cfmakeraw.c ---- nbsdsrc/src/lib/libc/termios/cfmakeraw.c -+++ lib/nbsd_libc/termios/cfmakeraw.c -@@ -59,7 +59,11 @@ - - _DIAGASSERT(t != NULL); - -+#ifdef __minix -+ t->c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON); -+#else /* !__minix */ - t->c_iflag &= ~(IMAXBEL|IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON); -+#endif /* !__minix */ - t->c_oflag &= ~OPOST; - t->c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN); - t->c_cflag &= ~(CSIZE|PARENB); -diff -ru nbsdsrc/src/lib/libc/termios/tcflow.c lib/nbsd_libc/termios/tcflow.c ---- nbsdsrc/src/lib/libc/termios/tcflow.c -+++ lib/nbsd_libc/termios/tcflow.c -@@ -54,6 +54,10 @@ - tcflow(fd, action) - int fd, action; - { -+#ifdef __minix -+ _DIAGASSERT(fd != -1); -+ return ioctl(fd, TCFLOW, &action); -+#else /* !__minix */ - struct termios term; - u_char c; - -@@ -77,4 +81,5 @@ - return (-1); - } - /* NOTREACHED */ -+#endif /* !__minix */ - } -diff -ru nbsdsrc/src/lib/libc/termios/tcflush.c lib/nbsd_libc/termios/tcflush.c ---- nbsdsrc/src/lib/libc/termios/tcflush.c -+++ lib/nbsd_libc/termios/tcflush.c -@@ -54,6 +54,10 @@ - tcflush(fd, which) - int fd, which; - { -+#ifdef __minix -+ _DIAGASSERT(fd != -1); -+ return ioctl(fd, TCFLSH, &which); -+#else /* !__minix */ - int com; - - _DIAGASSERT(fd != -1); -@@ -73,4 +77,5 @@ - return (-1); - } - return (ioctl(fd, TIOCFLUSH, &com)); -+#endif /* !__minix */ - } -diff -ru nbsdsrc/src/lib/libc/termios/tcsendbreak.c lib/nbsd_libc/termios/tcsendbreak.c ---- nbsdsrc/src/lib/libc/termios/tcsendbreak.c -+++ lib/nbsd_libc/termios/tcsendbreak.c -@@ -41,7 +41,9 @@ - #include "namespace.h" - #include - #include -+#ifndef __minix - #include -+#endif /* !__minix */ - - #include - #include -@@ -57,6 +59,10 @@ - tcsendbreak(fd, len) - int fd, len; - { -+#ifdef __minix -+ _DIAGASSERT(fd != -1); -+ return ioctl(fd, TCSBRK, &len); -+#else /* !__minix */ - static const struct timespec sleepytime = { 0, 400000000 }; - - _DIAGASSERT(fd != -1); -@@ -67,4 +73,5 @@ - if (ioctl(fd, TIOCCBRK, 0) == -1) - return (-1); - return (0); -+#endif /* !__minix */ - } -diff -ru nbsdsrc/src/lib/libc/termios/tcsetattr.c lib/nbsd_libc/termios/tcsetattr.c ---- nbsdsrc/src/lib/libc/termios/tcsetattr.c -+++ lib/nbsd_libc/termios/tcsetattr.c -@@ -60,11 +60,15 @@ - _DIAGASSERT(fd != -1); - _DIAGASSERT(t != NULL); - -+#ifndef __minix - if (opt & TCSASOFT) { - localterm = *t; - localterm.c_cflag |= CIGNORE; - t = &localterm; - } -+#else /* __minix */ -+#define TCSASOFT 0 -+#endif /* __minix */ - switch (opt & ~TCSASOFT) { - case TCSANOW: - return (ioctl(fd, TIOCSETA, t)); -diff -ru nbsdsrc/src/lib/libc/time/strftime.c lib/nbsd_libc/time/strftime.c ---- nbsdsrc/src/lib/libc/time/strftime.c -+++ lib/nbsd_libc/time/strftime.c -@@ -553,6 +553,11 @@ - pt = _conv(diff, "%04d", pt, ptlim); - } - continue; -+#ifdef __minix -+ case '+': -+ pt = _fmt(sp, Locale->c_fmt, t, pt, ptlim, warnp); -+ continue; -+#endif /* !__minix */ - #if 0 - case '+': - pt = _fmt(sp, Locale->date_fmt, t, pt, ptlim, -diff -ru nbsdsrc/src/lib/libc/yp/yplib.c lib/nbsd_libc/yp/yplib.c ---- nbsdsrc/src/lib/libc/yp/yplib.c -+++ lib/nbsd_libc/yp/yplib.c -@@ -172,8 +172,10 @@ - } - (void)memset(&ysd->dom_server_addr, 0, - sizeof ysd->dom_server_addr); -+#ifndef __minix - ysd->dom_server_addr.sin_len = - sizeof(struct sockaddr_in); -+#endif /* !__minix */ - ysd->dom_server_addr.sin_family = AF_INET; - bn = &ybr.ypbind_respbody.ypbind_bindinfo; - ysd->dom_server_addr.sin_port = -@@ -197,7 +199,9 @@ - if (ysd->dom_vers == -1 || ysd->dom_vers == 0) { - struct ypbind_binding *bn; - (void)memset(&clnt_sin, 0, sizeof clnt_sin); -+#ifndef __minix - clnt_sin.sin_len = sizeof(struct sockaddr_in); -+#endif /* !__minix */ - clnt_sin.sin_family = AF_INET; - clnt_sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK); - -@@ -228,7 +232,9 @@ - - (void)memset(&ysd->dom_server_addr, 0, - sizeof ysd->dom_server_addr); -+#ifndef __minix - ysd->dom_server_addr.sin_len = sizeof(struct sockaddr_in); -+#endif /* !__minix */ - ysd->dom_server_addr.sin_family = AF_INET; - bn = &ypbr.ypbind_respbody.ypbind_bindinfo; - ysd->dom_server_addr.sin_port = diff --git a/lib/nbsd_libm/minix-port.patch b/lib/nbsd_libm/minix-port.patch deleted file mode 100644 index ebe0d4cd9..000000000 --- a/lib/nbsd_libm/minix-port.patch +++ /dev/null @@ -1,28 +0,0 @@ -diff -ru nbsdsrc/src/lib/libm/Makefile lib/nbsd_libm/Makefile ---- nbsdsrc/src/lib/libm/Makefile -+++ lib/nbsd_libm/Makefile -@@ -13,6 +13,10 @@ - # - # - -+.if ${MACHINE_ARCH} == "unknown" -+MACHINE_ARCH:= ${MACHINE} -+.endif -+ - # - # There are two options in making libm at fdlibm compile time: - # _IEEE_LIBM --- IEEE libm; smaller, and somewhat faster -diff -ru nbsdsrc/src/lib/libm/arch/i387/fenv.c lib/nbsd_libm/arch/i387/fenv.c ---- nbsdsrc/src/lib/libm/arch/i387/fenv.c -+++ lib/nbsd_libm/arch/i387/fenv.c -@@ -122,8 +122,10 @@ - size_t oldlen = sizeof(__HAS_SSE); - int rv; - -+#ifndef __minix - rv = sysctlbyname("machdep.sse", &__HAS_SSE, &oldlen, NULL, 0); - if (rv == -1) -+#endif - __HAS_SSE = 0; - } - diff --git a/nbsd_include/minix-port.patch b/nbsd_include/minix-port.patch deleted file mode 100644 index 0c77f7d38..000000000 --- a/nbsd_include/minix-port.patch +++ /dev/null @@ -1,608 +0,0 @@ -diff -ru nbsdsrc/src/include/Makefile nbsd_include/Makefile ---- nbsdsrc/src/include/Makefile -+++ nbsd_include/Makefile -@@ -7,10 +7,28 @@ - - # Missing: mp.h - -+.if defined(__MINIX) -+# Avoid installing: kvm.h lwp.h sa.h (latter not installed anyway) - INCS= a.out.h aio.h ar.h assert.h atomic.h \ - bitstring.h bm.h cdbr.h cdbw.h complex.h cpio.h ctype.h \ - db.h dirent.h disktab.h dlfcn.h err.h errno.h fenv.h fmtmsg.h fnmatch.h \ - fstab.h fts.h ftw.h getopt.h glob.h grp.h ifaddrs.h iconv.h \ -+ inttypes.h iso646.h langinfo.h libgen.h \ -+ limits.h link.h link_aout.h link_elf.h locale.h \ -+ login_cap.h malloc.h math.h md2.h \ -+ memory.h mntopts.h monetary.h mpool.h mqueue.h \ -+ ndbm.h netconfig.h netdb.h netgroup.h nlist.h nl_types.h nsswitch.h \ -+ paths.h pwd.h randomid.h ranlib.h re_comp.h regex.h regexp.h \ -+ resolv.h res_update.h rmt.h sched.h search.h semaphore.h setjmp.h \ -+ sgtty.h signal.h stab.h stdbool.h stddef.h stdio.h stdlib.h string.h \ -+ strings.h stringlist.h struct.h sysexits.h tar.h time.h \ -+ ttyent.h tzfile.h ucontext.h ulimit.h unistd.h util.h utime.h utmp.h \ -+ utmpx.h uuid.h varargs.h vis.h wchar.h wctype.h wordexp.h -+.else -+INCS= a.out.h aio.h ar.h assert.h atomic.h \ -+ bitstring.h bm.h cdbr.h cdbw.h complex.h cpio.h ctype.h \ -+ db.h dirent.h disktab.h dlfcn.h err.h errno.h fenv.h fmtmsg.h fnmatch.h \ -+ fstab.h fts.h ftw.h getopt.h glob.h grp.h ifaddrs.h iconv.h \ - inttypes.h iso646.h kvm.h langinfo.h libgen.h \ - limits.h link.h link_aout.h link_elf.h locale.h \ - login_cap.h lwp.h malloc.h math.h md2.h \ -@@ -22,6 +40,7 @@ - strings.h stringlist.h struct.h sysexits.h tar.h time.h \ - ttyent.h tzfile.h ucontext.h ulimit.h unistd.h util.h utime.h utmp.h \ - utmpx.h uuid.h varargs.h vis.h wchar.h wctype.h wordexp.h -+.endif - INCS+= arpa/ftp.h arpa/inet.h arpa/nameser.h arpa/nameser_compat.h \ - arpa/telnet.h arpa/tftp.h - INCS+= protocols/dumprestore.h protocols/routed.h protocols/rwhod.h \ -@@ -42,8 +61,22 @@ - - INCSDIR= /usr/include - -+.if defined(__MINIX) -+# RPC is not compiled in the libc. This include also needs -+# rpcgen, which can be compiled if needed. -+.else - SUBDIR= rpc -+.endif -+.if !defined(__MINIX) - SUBDIR+= ../common/include/prop -+.endif -+ -+.if defined(__MINIX) -+.include "${MINIXSRCDIR}/common/include/Makefile.inc" -+SUBDIR+= arch/${MACHINE} -+SUBDIR+= arch sys minix -+SUBDIR+= net netinet netinet6 -+.endif - - .include - .include -diff -ru nbsdsrc/src/include/a.out.h nbsd_include/a.out.h ---- nbsdsrc/src/include/a.out.h -+++ nbsd_include/a.out.h -@@ -60,9 +60,14 @@ - #ifndef _AOUT_H_ - #define _AOUT_H_ - -+#ifdef __minix -+#include -+#else /* !__minix */ -+ - #include - - #define _AOUT_INCLUDE_ - #include - -+#endif /* !__minix */ - #endif /* !_AOUT_H_ */ -diff -ru nbsdsrc/src/include/arpa/nameser_compat.h nbsd_include/arpa/nameser_compat.h ---- nbsdsrc/src/include/arpa/nameser_compat.h -+++ nbsd_include/arpa/nameser_compat.h -@@ -133,6 +133,14 @@ - unsigned arcount :16; /*%< number of resource entries */ - } HEADER; - -+#ifdef _MINIX -+#define dh_id id -+#define dh_qdcount qdcount -+#define dh_ancount ancount -+#define dh_nscount nscount -+#define dh_arcount arcount -+#endif -+ - #define PACKETSZ NS_PACKETSZ - #define MAXDNAME NS_MAXDNAME - #define MAXCDNAME NS_MAXCDNAME -diff -ru nbsdsrc/src/include/dirent.h nbsd_include/dirent.h ---- nbsdsrc/src/include/dirent.h -+++ nbsd_include/dirent.h -@@ -43,16 +43,20 @@ - */ - #include - -+#ifndef __minix - #if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE) - #define d_ino d_fileno /* backward compatibility */ - #endif -+#endif /* !__minix */ - - typedef struct _dirdesc DIR; - - #if defined(_NETBSD_SOURCE) - -+#ifndef __minix - /* definitions for library routines operating on directories. */ - #define DIRBLKSIZ 1024 -+#endif - - /* structure describing an open directory. */ - struct _dirdesc { -diff -ru nbsdsrc/src/include/fts.h nbsd_include/fts.h ---- nbsdsrc/src/include/fts.h -+++ nbsd_include/fts.h -@@ -75,7 +75,9 @@ - #define FTS_PHYSICAL 0x010 /* physical walk */ - #define FTS_SEEDOT 0x020 /* return dot and dot-dot */ - #define FTS_XDEV 0x040 /* don't cross devices */ -+#ifndef __minix - #define FTS_WHITEOUT 0x080 /* return whiteout information */ -+#endif - #define FTS_OPTIONMASK 0x0ff /* valid user option mask */ - - #define FTS_NAMEONLY 0x100 /* (private) child names only */ -diff -ru nbsdsrc/src/include/limits.h nbsd_include/limits.h ---- nbsdsrc/src/include/limits.h -+++ nbsd_include/limits.h -@@ -113,4 +113,9 @@ - #include - #include - -+#ifdef __minix -+#define SYMLOOP_MAX 16 -+#define SYMLINK_MAX 1024 -+#endif -+ - #endif /* !_LIMITS_H_ */ -diff -ru nbsdsrc/src/include/netdb.h nbsd_include/netdb.h ---- nbsdsrc/src/include/netdb.h -+++ nbsd_include/netdb.h -@@ -131,6 +131,9 @@ - #ifndef _PATH_SERVICES_DB - #define _PATH_SERVICES_DB "/var/db/services.db" - #endif -+#ifdef __minix -+#define _PATH_SERVACCES "/etc/serv.access" -+#endif - #endif - - __BEGIN_DECLS -diff -ru nbsdsrc/src/include/paths.h nbsd_include/paths.h ---- nbsdsrc/src/include/paths.h -+++ nbsd_include/paths.h -@@ -124,5 +124,9 @@ - #define _PATH_VI "/usr/bin/vi" - #endif - -+#ifdef __minix -+#include -+#endif /* !__minix */ -+ - #endif /* !_PATHS_H_ */ - -diff -ru nbsdsrc/src/include/pwd.h nbsd_include/pwd.h ---- nbsdsrc/src/include/pwd.h -+++ nbsd_include/pwd.h -@@ -61,6 +61,14 @@ - * SUCH DAMAGE. - */ - -+#if defined(__minix) && defined(_MINIX_COMPAT) -+#include -+/* Avoid inclusion of the rest of the header. */ -+#ifndef _PWD_H_ -+#define _PWD_H_ -+#endif -+#endif /* __minix && _MINIX_COMPAT */ -+ - #ifndef _PWD_H_ - #define _PWD_H_ - -diff -ru nbsdsrc/src/include/sched.h nbsd_include/sched.h ---- nbsdsrc/src/include/sched.h -+++ nbsd_include/sched.h -@@ -29,6 +29,9 @@ - * POSSIBILITY OF SUCH DAMAGE. - */ - -+#ifdef __minix -+#define _SCHED_H_ -+#endif /* !__minix */ - #ifndef _SCHED_H_ - #define _SCHED_H_ - -diff -ru nbsdsrc/src/include/signal.h nbsd_include/signal.h ---- nbsdsrc/src/include/signal.h -+++ nbsd_include/signal.h -@@ -62,6 +62,7 @@ - int __libc_sigaction14(int, const struct sigaction * __restrict, - struct sigaction * __restrict); - -+#ifndef __minix - #if (_POSIX_C_SOURCE - 0L) >= 199506L || (_XOPEN_SOURCE - 0) >= 500 || \ - defined(_NETBSD_SOURCE) - int pthread_sigmask(int, const sigset_t * __restrict, -@@ -73,6 +74,7 @@ - #define pthread_sigmask __libc_thr_sigsetmask - #endif /* __LIBPTHREAD_SOURCE__ */ - #endif -+#endif /* __minix */ - - #ifndef __LIBC12_SOURCE__ - int sigaction(int, const struct sigaction * __restrict, -@@ -160,11 +162,13 @@ - (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE) - int killpg(pid_t, int); - int siginterrupt(int, int); -+#ifndef __minix - int sigstack(const struct sigstack *, struct sigstack *); - #ifndef __LIBC12_SOURCE__ - int sigaltstack(const stack_t * __restrict, stack_t * __restrict) - __RENAME(__sigaltstack14); - #endif -+#endif /* !__minix */ - int sighold(int); - int sigignore(int); - int sigpause(int); -@@ -178,10 +182,13 @@ - */ - #if (_POSIX_C_SOURCE - 0) >= 199309L || (_XOPEN_SOURCE - 0) >= 500 || \ - defined(_NETBSD_SOURCE) -+#ifndef __minix - int sigwait (const sigset_t * __restrict, int * __restrict); - int sigwaitinfo(const sigset_t * __restrict, siginfo_t * __restrict); -+#endif /* !__minix */ - void psiginfo(const siginfo_t *, const char *); - -+#ifndef __minix - #ifndef __LIBC12_SOURCE__ - struct timespec; - int sigtimedwait(const sigset_t * __restrict, -@@ -191,15 +198,18 @@ - siginfo_t * __restrict, struct timespec * __restrict) - __RENAME(____sigtimedwait50); - #endif -+#endif /* !__minix */ - #endif /* _POSIX_C_SOURCE >= 200112 || _XOPEN_SOURCE_EXTENDED || ... */ - - - #if defined(_NETBSD_SOURCE) -+#ifndef __minix - #ifndef __PSIGNAL_DECLARED - #define __PSIGNAL_DECLARED - /* also in unistd.h */ - void psignal(int, const char *); - #endif /* __PSIGNAL_DECLARED */ -+#endif /* !__minix */ - int sigblock(int); - int sigsetmask(int); - #endif /* _NETBSD_SOURCE */ -diff -ru nbsdsrc/src/include/stdio.h nbsd_include/stdio.h ---- nbsdsrc/src/include/stdio.h -+++ nbsd_include/stdio.h -@@ -274,7 +274,7 @@ - __printflike(2, 0); - #endif - --#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) -+#if !defined(__minix) && (defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)) - int rename (const char *, const char *) __RENAME(__posix_rename); - #else - int rename (const char *, const char *); -diff -ru nbsdsrc/src/include/stdlib.h nbsd_include/stdlib.h ---- nbsdsrc/src/include/stdlib.h -+++ nbsd_include/stdlib.h -@@ -244,6 +244,8 @@ - void *alloca(int); /* built-in for gcc */ - #elif defined(__PCC__) && !defined(__GNUC__) - #define alloca(size) __builtin_alloca(size) -+#elif (__GNUC__ >= 2) -+#define alloca(size) __builtin_alloca(size) - #else - void *alloca(size_t); - #endif /* __GNUC__ */ -@@ -265,9 +267,11 @@ - void csetexpandtc(int); - - int daemon(int, int); -+#ifndef __minix - #ifndef __LIBC12_SOURCE__ - __aconst char *devname(dev_t, mode_t) __RENAME(__devname50); - #endif -+#endif /* !__minix */ - - #define HN_DECIMAL 0x01 - #define HN_NOSPACE 0x02 -@@ -280,7 +284,9 @@ - int humanize_number(char *, size_t, int64_t, const char *, int, int); - int dehumanize_number(const char *, int64_t *); - -+#ifndef __minix - devmajor_t getdevmajor(const char *, mode_t); -+#endif /* !__minix */ - int getloadavg(double [], int); - - int getenv_r(const char *, char *, size_t); -diff -ru nbsdsrc/src/include/time.h nbsd_include/time.h ---- nbsdsrc/src/include/time.h -+++ nbsd_include/time.h -@@ -65,12 +65,18 @@ - #undef _BSD_CLOCKID_T_ - #endif - -+#ifndef __minix - #ifdef _BSD_TIMER_T_ - typedef _BSD_TIMER_T_ timer_t; - #undef _BSD_TIMER_T_ - #endif -+#endif /* !__minix */ - -+#ifdef __minix -+#define CLOCKS_PER_SEC 60 -+#else - #define CLOCKS_PER_SEC 100 -+#endif - - struct tm { - int tm_sec; /* seconds after the minute [0-61] */ -@@ -110,7 +116,11 @@ - * need to include unistd.h - */ - long __sysconf(int); -+#ifdef __minix -+#define CLK_TCK (__sysconf(3)) -+#else - #define CLK_TCK (__sysconf(39)) -+#endif /* !__minix */ - #endif - #endif - -@@ -143,22 +153,28 @@ - struct sigevent; - struct itimerspec; - #ifndef __LIBC12_SOURCE__ -+#ifndef __minix - int clock_getres(clockid_t, struct timespec *) - __RENAME(__clock_getres50); - int clock_gettime(clockid_t, struct timespec *) - __RENAME(__clock_gettime50); - int clock_settime(clockid_t, const struct timespec *) - __RENAME(__clock_settime50); -+#endif /* !__minix */ - int nanosleep(const struct timespec *, struct timespec *) - __RENAME(__nanosleep50); -+#ifndef __minix - int timer_gettime(timer_t, struct itimerspec *) __RENAME(__timer_gettime50); - int timer_settime(timer_t, int, const struct itimerspec * __restrict, - struct itimerspec * __restrict) __RENAME(__timer_settime50); -+#endif /* !__minix */ - #endif -+#ifndef __minix - int timer_create(clockid_t, struct sigevent * __restrict, - timer_t * __restrict); - int timer_delete(timer_t); - int timer_getoverrun(timer_t); -+#endif /* __minix */ - #endif /* _POSIX_C_SOURCE >= 199309 || _XOPEN_SOURCE >= 500 || ... */ - - #if (_POSIX_C_SOURCE - 0) >= 199506L || (_XOPEN_SOURCE - 0) >= 500 || \ -@@ -204,6 +220,10 @@ - __attribute__((__format__(__strftime__, 4, 0))); - - #endif /* _NETBSD_SOURCE */ -+ -+#ifdef _MINIX -+int stime(time_t *_top); -+#endif /* _MINIX */ - - __END_DECLS - -diff -ru nbsdsrc/src/include/unistd.h nbsd_include/unistd.h ---- nbsdsrc/src/include/unistd.h -+++ nbsd_include/unistd.h -@@ -88,7 +88,7 @@ - int access(const char *, int); - unsigned int alarm(unsigned int); - int chdir(const char *); --#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) -+#if !defined(__minix) && (defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)) - int chown(const char *, uid_t, gid_t) __RENAME(__posix_chown); - #else - int chown(const char *, uid_t, gid_t); -@@ -133,7 +133,9 @@ - #endif - int rmdir(const char *); - int setgid(gid_t); -+#ifndef __minix - int setpgid(pid_t, pid_t); -+#endif /* !__minix */ - pid_t setsid(void); - int setuid(uid_t); - unsigned int sleep(unsigned int); -@@ -192,7 +194,9 @@ - */ - #if (_POSIX_C_SOURCE - 0) >= 199309L || (_XOPEN_SOURCE - 0) >= 500 || \ - defined(_NETBSD_SOURCE) -+#ifndef __minix - int fdatasync(int); -+#endif /* !__minix */ - int fsync(int); - #endif - -@@ -222,7 +226,9 @@ - __aconst char *crypt(const char *, const char *); - int encrypt(char *, int); - char *getpass(const char *); -+#ifndef __minix - pid_t getsid(pid_t); -+#endif /* !__minix */ - #endif - - -@@ -243,7 +249,7 @@ - - int brk(void *); - int fchdir(int); --#if defined(_XOPEN_SOURCE) -+#if !defined(__minix) && defined(_XOPEN_SOURCE) - int fchown(int, uid_t, gid_t) __RENAME(__posix_fchown); - #else - int fchown(int, uid_t, gid_t); -@@ -253,29 +259,37 @@ - int gethostname(char *, size_t); - __pure int - getpagesize(void); /* legacy */ -+#ifndef __minix - pid_t getpgid(pid_t); -+#endif /* !__minix */ -+#ifndef __minix - #if defined(_XOPEN_SOURCE) - int lchown(const char *, uid_t, gid_t) __RENAME(__posix_lchown); - #else - int lchown(const char *, uid_t, gid_t); - #endif -+#endif /* !__minix */ - int lockf(int, int, off_t); - #if __SSP_FORTIFY_LEVEL == 0 - ssize_t readlink(const char * __restrict, char * __restrict, size_t); - #endif - void *sbrk(intptr_t); -+#ifndef __minix - /* XXX prototype wrong! */ - int setpgrp(pid_t, pid_t); /* obsoleted by setpgid() */ - int setregid(gid_t, gid_t); - int setreuid(uid_t, uid_t); -+#endif /* !__minix */ - void swab(const void * __restrict, void * __restrict, ssize_t); - int symlink(const char *, const char *); - void sync(void); - useconds_t ualarm(useconds_t, useconds_t); - int usleep(useconds_t); -+#ifndef __minix - #ifndef __LIBC12_SOURCE__ - pid_t vfork(void) __RENAME(__vfork14); - #endif -+#endif /* !__minix */ - - #ifndef __AUDIT__ - char *getwd(char *); /* obsoleted by getcwd() */ -@@ -295,9 +309,15 @@ - /* - * Implementation-defined extensions - */ -+#if defined(__minix) -+int lseek64(int fd, u64_t _offset, int _whence, u64_t *_newpos); -+#endif /* !__minix */ -+ - #if defined(_NETBSD_SOURCE) -+#ifndef __minix - int acct(const char *); - int closefrom(int); -+#endif /* !__minix */ - int des_cipher(const char *, char *, long, int); - int des_setkey(const char *); - void endusershell(void); -@@ -315,15 +335,23 @@ - int iruserok(uint32_t, int, const char *, const char *); - int issetugid(void); - int nfssvc(int, void *); -+#ifndef __minix - int profil(char *, size_t, u_long, u_int); - #ifndef __PSIGNAL_DECLARED - #define __PSIGNAL_DECLARED - /* also in signal.h */ - void psignal(int, const char *); - #endif /* __PSIGNAL_DECLARED */ -+#endif /* !__minix */ - int rcmd(char **, int, const char *, const char *, const char *, int *); -+#ifdef __minix -+int reboot(int, ...); -+#else - int reboot(int, char *); -+#endif -+#ifndef __minix - int revoke(const char *); -+#endif - int rresvport(int *); - int ruserok(const char *, int, const char *, const char *); - int setdomainname(const char *, size_t); -@@ -341,8 +369,10 @@ - /* backwards-compatibility; also in string.h */ - __aconst char *strsignal(int); - #endif /* __STRSIGNAL_DECLARED */ -+#ifndef __minix - int swapctl(int, void *, int); - int swapon(const char *); /* obsoleted by swapctl() */ -+#endif /* !__minix */ - int syscall(int, ...); - quad_t __syscall(quad_t, ...); - int undelete(const char *); -@@ -364,4 +394,10 @@ - #endif - - __END_DECLS -+ -+#ifdef __minix -+/* Minix expects RBT_* flags to be included with */ -+#include -+#endif -+ - #endif /* !_UNISTD_H_ */ -diff -ru nbsdsrc/src/include/utmp.h nbsd_include/utmp.h ---- nbsdsrc/src/include/utmp.h -+++ nbsd_include/utmp.h -@@ -39,12 +39,26 @@ - #ifndef _UTMP_H_ - #define _UTMP_H_ - -+#ifdef __minix -+#define _PATH_UTMP "/etc/utmp" -+#define _PATH_WTMP "/usr/adm/wtmp" -+#define _PATH_BTMP "/usr/adm/btmp" -+#define _PATH_LASTLOG "/usr/adm/lastlog" -+#define UTMP _PATH_UTMP -+#define WTMP _PATH_WTMP -+#define BTMP _PATH_BTMP -+#else - #define _PATH_UTMP "/var/run/utmp" - #define _PATH_WTMP "/var/log/wtmp" - #define _PATH_LASTLOG "/var/log/lastlog" -+#endif - - #define UT_NAMESIZE 8 -+#ifdef __minix -+#define UT_LINESIZE 12 -+#else - #define UT_LINESIZE 8 -+#endif - #define UT_HOSTSIZE 16 - - struct lastlog { -@@ -53,12 +67,34 @@ - char ll_host[UT_HOSTSIZE]; - }; - -+#ifdef __minix - struct utmp { -+ char ut_name[UT_NAMESIZE]; /* user name */ -+ char ut_id[4]; /* /etc/inittab ID */ -+ char ut_line[UT_LINESIZE]; /* terminal name */ -+ char ut_host[UT_HOSTSIZE]; /* host name, when remote */ -+ short ut_pid; /* process id */ -+ short int ut_type; /* type of entry */ -+ long ut_time; /* login/logout time */ -+}; -+ -+/* Definitions for ut_type. */ -+#define RUN_LVL 1 /* this is a RUN_LEVEL record */ -+#define BOOT_TIME 2 /* this is a REBOOT record */ -+#define INIT_PROCESS 5 /* this process was spawned by INIT */ -+#define LOGIN_PROCESS 6 /* this is a 'getty' process waiting */ -+#define USER_PROCESS 7 /* any other user process */ -+#define DEAD_PROCESS 8 /* this process has died (wtmp only) */ -+ -+#else /* !__minix */ -+ -+struct utmp { - char ut_line[UT_LINESIZE]; - char ut_name[UT_NAMESIZE]; - char ut_host[UT_HOSTSIZE]; - time_t ut_time; - }; -+#endif /* __minix */ - - __BEGIN_DECLS - int utmpname(const char *); diff --git a/share/terminfo/minix-port.patch b/share/terminfo/minix-port.patch deleted file mode 100644 index 125d70617..000000000 --- a/share/terminfo/minix-port.patch +++ /dev/null @@ -1,20 +0,0 @@ -diff -ru nbsdsrc/src/share/terminfo/Makefile share/terminfo/Makefile ---- nbsdsrc/src/share/terminfo/Makefile -+++ share/terminfo/Makefile -@@ -1,10 +1,16 @@ - # $NetBSD: Makefile,v 1.2 2010/02/05 16:34:04 roy Exp $ - # from: @(#)Makefile 8.1 (Berkeley) 6/8/93 - -+ - CLEANFILES= terminfo.db - realall: terminfo.db - FILES=terminfo.db terminfo -+.if defined(__MINIX) -+FILESDIR=/usr/share/terminfo -+TOOL_TIC=/usr/bin/tic -+.else - FILESDIR=${BINDIR}/misc -+.endif - - terminfo.db: terminfo - ${_MKTARGET_CREATE} diff --git a/usr.bin/indent/minix-port.patch b/usr.bin/indent/minix-port.patch deleted file mode 100644 index e69de29bb..000000000 diff --git a/usr.bin/stat/minix-port.patch b/usr.bin/stat/minix-port.patch deleted file mode 100644 index bb5dfec52..000000000 --- a/usr.bin/stat/minix-port.patch +++ /dev/null @@ -1,31 +0,0 @@ -diff -ru nbsdsrc/src/usr.bin/stat/Makefile usr.bin/stat/Makefile ---- nbsdsrc/src/usr.bin/stat/Makefile -+++ usr.bin/stat/Makefile -@@ -4,6 +4,11 @@ - - .if !defined(HOSTPROG) - LINKS= ${BINDIR}/stat ${BINDIR}/readlink -+.if defined(__MINIX) -+# To prevent breaking of existing utilities in commands/ -+LINKS+= ${BINDIR}/stat ${BINDIR}/fstat -+LINKS+= ${BINDIR}/stat ${BINDIR}/lstat -+.endif - MLINKS= stat.1 readlink.1 - .endif - -diff -ru nbsdsrc/src/usr.bin/stat/stat.c usr.bin/stat/stat.c ---- nbsdsrc/src/usr.bin/stat/stat.c -+++ usr.bin/stat/stat.c -@@ -44,7 +44,12 @@ - #define HAVE_STRUCT_STAT_ST_BIRTHTIME 1 - #define HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC 1 - #define HAVE_STRUCT_STAT_ST_MTIMENSEC 1 -+#ifdef __minix -+/* Not supported in Minix. */ -+#define HAVE_DEVNAME 0 -+#else /* __minix */ - #define HAVE_DEVNAME 1 -+#endif /* __minx */ - #endif /* HAVE_NBTOOL_CONFIG_H */ - - #include diff --git a/usr.bin/tic/minix-port.patch b/usr.bin/tic/minix-port.patch deleted file mode 100644 index e69de29bb..000000000 -- 2.44.0