From 364953ad407f18a533467508d1d7051ba9b5e985 Mon Sep 17 00:00:00 2001 From: Ben Gras Date: Fri, 22 Nov 2013 16:24:28 +0100 Subject: [PATCH] current version of from netbsd repo is older than the minix one; will be corrected on next netbsd re-import. Change-Id: Ifc696581ef476cfecd9695a9f6e74b844131e584 --- lib/libc/db/btree/bt_open.c | 8 ---- lib/libc/db/hash/hash.c | 8 ---- lib/libc/stdio/fseeko.c | 8 ---- lib/libc/stdio/makebuf.c | 8 ---- lib/libc/stdlib/malloc.c | 1 + sys/sys/stat.h | 76 +++++++------------------------------ test/testcache.h | 1 + 7 files changed, 16 insertions(+), 94 deletions(-) diff --git a/lib/libc/db/btree/bt_open.c b/lib/libc/db/btree/bt_open.c index 2553f16c7..c028258c2 100644 --- a/lib/libc/db/btree/bt_open.c +++ b/lib/libc/db/btree/bt_open.c @@ -262,14 +262,6 @@ __bt_open(const char *fname, int flags, mode_t mode, const BTREEINFO *openinfo, * Don't overflow the page offset type. */ if (b.psize == 0) { -#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; diff --git a/lib/libc/db/hash/hash.c b/lib/libc/db/hash/hash.c index 79cb812d5..ef3237a51 100644 --- a/lib/libc/db/hash/hash.c +++ b/lib/libc/db/hash/hash.c @@ -301,14 +301,6 @@ init_hash(HTAB *hashp, const char *file, const HASHINFO *info) if (file != NULL) { if (stat(file, &statbuf)) return (NULL); -#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 --git a/lib/libc/stdio/fseeko.c b/lib/libc/stdio/fseeko.c index 1973a23b9..eaf2c29e6 100644 --- a/lib/libc/stdio/fseeko.c +++ b/lib/libc/stdio/fseeko.c @@ -150,14 +150,6 @@ fseeko(FILE *fp, off_t offset, int whence) fp->_flags |= __SNPT; goto dumb; } -#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 --git a/lib/libc/stdio/makebuf.c b/lib/libc/stdio/makebuf.c index cd0a5bf2b..db70ea601 100644 --- a/lib/libc/stdio/makebuf.c +++ b/lib/libc/stdio/makebuf.c @@ -121,14 +121,6 @@ __swhatbuf(FILE *fp, size_t *bufsize, int *couldbetty) * __sseek is mainly paranoia.) It is safe to set _blksize * unconditionally; it will only be used if __SOPT is also set. */ -#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 --git a/lib/libc/stdlib/malloc.c b/lib/libc/stdlib/malloc.c index 71052948f..943a1c617 100644 --- a/lib/libc/stdlib/malloc.c +++ b/lib/libc/stdlib/malloc.c @@ -13,6 +13,7 @@ */ #ifdef __minix +#include #define mmap minix_mmap #define munmap minix_munmap #ifdef _LIBSYS diff --git a/sys/sys/stat.h b/sys/sys/stat.h index b3b536e80..7bd0087ff 100644 --- a/sys/sys/stat.h +++ b/sys/sys/stat.h @@ -1,4 +1,4 @@ -/* $NetBSD: stat.h,v 1.65 2012/12/01 08:20:55 skrll Exp $ */ +/* $NetBSD: stat.h,v 1.63 2011/09/04 10:02:33 christos Exp $ */ /*- * Copyright (c) 1982, 1986, 1989, 1993 @@ -44,17 +44,6 @@ #if defined(_NETBSD_SOURCE) #include -#elif (_POSIX_C_SOURCE - 0) >= 200809L || (_XOPEN_SOURCE - 0) >= 700 -/* - * POSIX:2008 / XPG7 requires struct timespec to be declared in - * this header, but does not provide the usual exemption - * "inclusion of this header may make visible symbols defined in ". - * - * This is a Standard omission, acknowledged by the committee and - * scheduled to be corrected in Technical Corrigendum 2, according to - * http://austingroupbugs.net/view.php?id=531 - */ -#include #endif struct stat { @@ -65,12 +54,11 @@ struct stat { uid_t st_uid; /* user ID of the file's owner */ gid_t st_gid; /* group ID of the file's group */ dev_t st_rdev; /* device type */ -#if (_POSIX_C_SOURCE - 0) >= 200809L || (_XOPEN_SOURCE - 0) >= 700 || \ - defined(_NETBSD_SOURCE) - struct timespec st_atim; /* time of last access */ - struct timespec st_mtim; /* time of last data modification */ - struct timespec st_ctim; /* time of last file status change */ - struct timespec st_birthtim; /* time of creation */ +#if defined(_NETBSD_SOURCE) + struct timespec st_atimespec;/* time of last access */ + struct timespec st_mtimespec;/* time of last data modification */ + struct timespec st_ctimespec;/* time of last file status change */ + struct timespec st_birthtimespec; /* time of creation */ #else time_t st_atime; /* time of last access */ long st_atimensec; /* nsec of last access */ @@ -81,12 +69,7 @@ struct stat { time_t st_birthtime; /* time of creation */ long st_birthtimensec; /* nsec of time of creation */ #endif -#ifdef ST_SIZE_OFF_T - off_t st_size; /* file size, in off_t bytes */ - off_t st_size_rest; -#else off_t st_size; /* file size, in bytes */ -#endif blkcnt_t st_blocks; /* blocks allocated for file */ blksize_t st_blksize; /* optimal blocksize for I/O */ uint32_t st_flags; /* user defined flags for file */ @@ -94,23 +77,14 @@ struct stat { uint32_t st_spare[2]; }; -#if (_POSIX_C_SOURCE - 0) >= 200809L || (_XOPEN_SOURCE - 0) >= 700 || \ - defined(_NETBSD_SOURCE) -/* Standard-mandated compatibility */ -#define st_atime st_atim.tv_sec -#define st_mtime st_mtim.tv_sec -#define st_ctime st_ctim.tv_sec -#define st_birthtime st_birthtim.tv_sec -#endif - #if defined(_NETBSD_SOURCE) -#define st_atimespec st_atim +#define st_atime st_atimespec.tv_sec #define st_atimensec st_atimespec.tv_nsec -#define st_mtimespec st_mtim +#define st_mtime st_mtimespec.tv_sec #define st_mtimensec st_mtimespec.tv_nsec -#define st_ctimespec st_ctim +#define st_ctime st_ctimespec.tv_sec #define st_ctimensec st_ctimespec.tv_nsec -#define st_birthtimespec st_birthtim +#define st_birthtime st_birthtimespec.tv_sec #define st_birthtimensec st_birthtimespec.tv_nsec #endif @@ -233,20 +207,11 @@ struct stat { #endif /* _KERNEL */ #endif /* _NETBSD_SOURCE */ -#if (_POSIX_C_SOURCE - 0) >= 200809L || (_XOPEN_SOURCE - 0) >= 700 || \ - defined(_NETBSD_SOURCE) /* * Special values for utimensat and futimens */ #define UTIME_NOW ((1 << 30) - 1) #define UTIME_OMIT ((1 << 30) - 2) -#endif - -#if defined(__minix) -#include -/* Convenient constant to use when st_blocksize field is required. */ -#define MINIX_ST_BLKSIZE PAGE_SIZE -#endif #if !defined(_KERNEL) && !defined(_STANDALONE) #include @@ -260,45 +225,32 @@ int stat(const char *, struct stat *) __RENAME(__stat50); int fstat(int, struct stat *) __RENAME(__fstat50); #endif mode_t umask(mode_t); -#if (_POSIX_C_SOURCE - 0) >= 200112L || defined(_XOPEN_SOURCE) || \ - defined(_NETBSD_SOURCE) -#ifndef __LIBC12_SOURCE__ -int lstat(const char *, struct stat *) __RENAME(__lstat50); -#endif -#endif /* _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE || _NETBSD_SOURCE */ #if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE) int fchmod(int, mode_t); #ifndef __LIBC12_SOURCE__ +int lstat(const char *, struct stat *) __RENAME(__lstat50); int mknod(const char *, mode_t, dev_t) __RENAME(__mknod50); #endif #endif /* defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE) */ -#if defined(_NETBSD_SOURCE) && !defined(__minix) +#if defined(_NETBSD_SOURCE) int chflags(const char *, unsigned long); int fchflags(int, unsigned long); int lchflags(const char *, unsigned long); int lchmod(const char *, mode_t); -#endif /* defined(_NETBSD_SOURCE) && !defined(__minix) */ +#endif /* defined(_NETBSD_SOURCE) */ #ifndef __LIBC12_SOURCE__ /* * X/Open Extended API set 2 (a.k.a. C063) */ -#if (_POSIX_C_SOURCE - 0) >= 200809L || (_XOPEN_SOURCE - 0) >= 700 || \ - defined(_INCOMPLETE_XOPEN_C063) || defined(_NETBSD_SOURCE) +#if defined(_INCOMPLETE_XOPEN_C063) || defined(__minix) int fstatat(int, const char *, struct stat *, int); int utimensat(int, const char *, const struct timespec *, int); #endif -#ifdef _NETBSD_SOURCE -int utimens(const char *, const struct timespec *); -int lutimens(const char *, const struct timespec *); -#endif -#if (_POSIX_C_SOURCE - 0) >= 200809L || (_XOPEN_SOURCE - 0) >= 700 || \ - defined(_NETBSD_SOURCE) int futimens(int, const struct timespec *); #endif -#endif __END_DECLS diff --git a/test/testcache.h b/test/testcache.h index 01ad939db..a0fc958af 100644 --- a/test/testcache.h +++ b/test/testcache.h @@ -4,6 +4,7 @@ */ #include +#include #define MAXBLOCKS 1500000 -- 2.44.0