From dd138a0c90eb3e782d9d5e6c5deb5d460e15d31e Mon Sep 17 00:00:00 2001 From: Sascha Wildner Date: Sat, 3 Mar 2018 16:52:10 +0100 Subject: [PATCH] Remove some really old portability hacks that should no longer be needed. This no longer declares ftruncate()/lseek()/mmap() and truncate() in either or . 20 years after FreeBSD added it (in r24896) we should be over it. What's left, we'll fix better. --- include/stdio.h | 20 -------------------- include/unistd.h | 9 --------- lib/libstand/stand.h | 1 + sys/sys/mman.h | 3 --- sys/sys/types.h | 25 ------------------------- test/sysmsg/syscall.h | 8 -------- 6 files changed, 1 insertion(+), 65 deletions(-) diff --git a/include/stdio.h b/include/stdio.h index 05bb31257f..25cf82428a 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -348,26 +348,6 @@ FILE *funopen(const void *, int (*)(void *, char *, int), fpos_t (*)(void *, fpos_t, int), int (*)(void *)); #define fropen(cookie, fn) funopen(cookie, fn, 0, 0, 0) #define fwopen(cookie, fn) funopen(cookie, 0, fn, 0, 0) - -/* - * Portability hacks. See . - */ -#ifndef _FTRUNCATE_DECLARED -#define _FTRUNCATE_DECLARED -int ftruncate(int, __off_t); -#endif -#ifndef _LSEEK_DECLARED -#define _LSEEK_DECLARED -__off_t lseek(int, __off_t, int); -#endif -#ifndef _MMAP_DECLARED -#define _MMAP_DECLARED -void *mmap(void *, size_t, int, int, int, __off_t); -#endif -#ifndef _TRUNCATE_DECLARED -#define _TRUNCATE_DECLARED -int truncate(const char *, __off_t); -#endif #endif /* __BSD_VISIBLE */ /* diff --git a/include/unistd.h b/include/unistd.h index 915ff3e4df..c7f5fe8093 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -386,10 +386,7 @@ pid_t getppid(void); uid_t getuid(void); int isatty(int); int link(const char *, const char *); -#ifndef _LSEEK_DECLARED -#define _LSEEK_DECLARED off_t lseek(int, off_t, int); -#endif long pathconf(const char *, int); int pause(void); int pipe(int *); @@ -429,11 +426,8 @@ int fsync(int); * ftruncate() was in the POSIX Realtime Extension (it's used for shared * memory), but truncate() was not. */ -#ifndef _FTRUNCATE_DECLARED -#define _FTRUNCATE_DECLARED int ftruncate(int, off_t); #endif -#endif #if __POSIX_VISIBLE >= 199506 int getlogin_r(char *, int); @@ -468,10 +462,7 @@ ssize_t pread(int, void *, size_t, off_t); ssize_t pwrite(int, const void *, size_t, off_t); /* See comment at ftruncate() above. */ -#ifndef _TRUNCATE_DECLARED -#define _TRUNCATE_DECLARED int truncate(const char *, off_t); -#endif #endif /* __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE */ #if __POSIX_VISIBLE >= 200809 diff --git a/lib/libstand/stand.h b/lib/libstand/stand.h index c2fd08cad3..126df34b1a 100644 --- a/lib/libstand/stand.h +++ b/lib/libstand/stand.h @@ -266,6 +266,7 @@ extern int open(const char *, int); #define O_RDWR 0x2 extern int close(int); extern void closeall(void); +extern off_t lseek(int, off_t, int); extern ssize_t read(int, void *, size_t); extern ssize_t write(int, void *, size_t); extern struct dirent *readdirfd(int); diff --git a/sys/sys/mman.h b/sys/sys/mman.h index fb94431da9..c2bacacdd8 100644 --- a/sys/sys/mman.h +++ b/sys/sys/mman.h @@ -188,10 +188,7 @@ int shm_open(const char *, int, mode_t); int shm_unlink(const char *); #endif /* __POSIX_VISIBLE >= 199309 */ int mlock(const void *, size_t); -#ifndef _MMAP_DECLARED -#define _MMAP_DECLARED void * mmap(void *, size_t, int, int, int, off_t); -#endif int mprotect(void *, size_t, int); int msync(void *, size_t, int); int munlock(const void *, size_t); diff --git a/sys/sys/types.h b/sys/sys/types.h index c8195ca7f0..70d5f0e830 100644 --- a/sys/sys/types.h +++ b/sys/sys/types.h @@ -249,31 +249,6 @@ typedef __timer_t timer_t; #include #define NBBY 8 /* number of bits in a byte */ -/* - * These declarations belong elsewhere, but are repeated here and in - * to give broken programs a better chance of working with - * 64-bit off_t's. - */ -#ifndef _KERNEL -__BEGIN_DECLS -#ifndef _FTRUNCATE_DECLARED -#define _FTRUNCATE_DECLARED -int ftruncate(int, off_t); -#endif -#ifndef _LSEEK_DECLARED -#define _LSEEK_DECLARED -off_t lseek(int, off_t, int); -#endif -#ifndef _MMAP_DECLARED -#define _MMAP_DECLARED -void * mmap(void *, size_t, int, int, int, off_t); -#endif -#ifndef _TRUNCATE_DECLARED -#define _TRUNCATE_DECLARED -int truncate(const char *, off_t); -#endif -__END_DECLS -#endif /* !_KERNEL */ #endif /* __BSD_VISIBLE */ diff --git a/test/sysmsg/syscall.h b/test/sysmsg/syscall.h index 5e1f28e70a..bac09b9e9c 100644 --- a/test/sysmsg/syscall.h +++ b/test/sysmsg/syscall.h @@ -25,16 +25,8 @@ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $DragonFly: src/test/sysmsg/syscall.h,v 1.1 2004/09/02 11:21:12 eirikn Exp $ */ -/* XXX: eirik */ -#define _MMAP_DECLARED -#define _LSEEK_DECLARED -#define _TRUNCATE_DECLARED -#define _FTRUNCATE_DECLARED - #define __syscall_args nosys_args #include -- 2.11.4.GIT