From 1c9db9a173eb2859df457050c43bc491c1e7c955 Mon Sep 17 00:00:00 2001 From: bde Date: Sun, 13 Apr 1997 15:38:10 +0000 Subject: #ifdef'ed the declaration of lseek() so that -Wredundant-decls doesn't cause noise. Duplicated the lseek() redeclaration hack for all functions involving off_t's (ftruncate(), mmap() and truncate()) to help broken programs work. --- include/unistd.h | 10 ++++++++++ sys/sys/mman.h | 5 ++++- sys/sys/types.h | 40 ++++++++++++++++++++++++++++------------ 3 files changed, 42 insertions(+), 13 deletions(-) diff --git a/include/unistd.h b/include/unistd.h index e0b9bba..ae11e40 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -77,7 +77,10 @@ pid_t getppid __P((void)); uid_t getuid __P((void)); int isatty __P((int)); int link __P((const char *, const char *)); +#ifndef _LSEEK_DECLARED +#define _LSEEK_DECLARED off_t lseek __P((int, off_t, int)); +#endif long pathconf __P((const char *, int)); int pause __P((void)); int pipe __P((int *)); @@ -117,7 +120,10 @@ int exect __P((const char *, char * const *, char * const *)); int fchdir __P((int)); int fchown __P((int, uid_t, gid_t)); int fsync __P((int)); +#ifndef _FTRUNCATE_DECLARED +#define _FTRUNCATE_DECLARED int ftruncate __P((int, off_t)); +#endif int getdomainname __P((char *, int)); int getdtablesize __P((void)); int getgrouplist __P((const char *, int, int *, int *)); @@ -172,9 +178,13 @@ int symlink __P((const char *, const char *)); void sync __P((void)); int syscall __P((int, ...)); off_t __syscall __P((quad_t, ...)); +#ifndef _TRUNCATE_DECLARED +#define _TRUNCATE_DECLARED int truncate __P((const char *, off_t)); +#endif int ttyslot __P((void)); unsigned int ualarm __P((unsigned int, unsigned int)); +int undelete __P((const char *)); int unwhiteout __P((const char *)); void usleep __P((unsigned int)); void *valloc __P((size_t)); /* obsoleted by malloc() */ diff --git a/sys/sys/mman.h b/sys/sys/mman.h index ba1b9b2..f8d9a04 100644 --- a/sys/sys/mman.h +++ b/sys/sys/mman.h @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)mman.h 8.2 (Berkeley) 1/9/95 - * $Id$ + * $Id: mman.h,v 1.17 1997/02/22 09:45:34 peter Exp $ */ #ifndef _SYS_MMAN_H_ @@ -104,7 +104,10 @@ #include __BEGIN_DECLS +#ifndef _MMAP_DECLARED +#define _MMAP_DECLARED caddr_t mmap __P((caddr_t, size_t, int, int, int, off_t)); +#endif int mprotect __P((caddr_t, size_t, int)); int munmap __P((caddr_t, size_t)); int msync __P((caddr_t, size_t, int)); diff --git a/sys/sys/types.h b/sys/sys/types.h index dd9e4df..7469a96 100644 --- a/sys/sys/types.h +++ b/sys/sys/types.h @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)types.h 8.6 (Berkeley) 2/19/95 - * $Id: types.h,v 1.18 1997/02/22 09:46:18 peter Exp $ + * $Id: types.h,v 1.19 1997/04/13 15:27:12 bde Exp $ */ #ifndef _SYS_TYPES_H_ @@ -81,17 +81,6 @@ typedef int boolean_t; typedef struct vm_page *vm_page_t; #endif -/* - * This belongs in unistd.h, but is placed here to ensure that programs - * casting the second parameter of lseek to off_t will get the correct - * version of lseek. - */ -#ifndef KERNEL -__BEGIN_DECLS -off_t lseek __P((int, off_t, int)); -__END_DECLS -#endif - #ifndef _POSIX_SOURCE /* * minor() gives a cookie instead of an index since we don't want to @@ -155,6 +144,33 @@ typedef struct fd_set { #define FD_COPY(f, t) bcopy(f, t, sizeof(*(f))) #define FD_ZERO(p) bzero(p, sizeof(*(p))) +/* + * 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 +#include +__BEGIN_DECLS +#ifndef _FTRUNCATE_DECLARED +#define _FTRUNCATE_DECLARED +int ftruncate __P((int, off_t)); +#endif +#ifndef _LSEEK_DECLARED +#define _LSEEK_DECLARED +off_t lseek __P((int, off_t, int)); +#endif +#ifndef _MMAP_DECLARED +#define _MMAP_DECLARED +caddr_t mmap __P((caddr_t, size_t, int, int, int, off_t)); +#endif +#ifndef _TRUNCATE_DECLARED +#define _TRUNCATE_DECLARED +int truncate __P((const char *, off_t)); +#endif +__END_DECLS +#endif /* !KERNEL */ + #if defined(__STDC__) && defined(KERNEL) /* * Forward structure declarations for function prototypes. We include the -- cgit v1.1