From 1c8d4bbe1849bcdcc2f85e7f4f049e8077209ac5 Mon Sep 17 00:00:00 2001 From: peter Date: Wed, 4 Jul 2007 23:27:38 +0000 Subject: Change the C wrappers for mmap/lseek/pread/pwrite/truncate/ftruncate to call the pad-less versions of the corresponding syscalls if the running kernel supports it. Check kern.osreldate once per program and cache the result to select the appropriate syscall. This maintains userland compatability with kernel.old's from quite a while back. Approved by: re (kensmith) --- lib/libc/include/libc_private.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'lib/libc/include') diff --git a/lib/libc/include/libc_private.h b/lib/libc/include/libc_private.h index a8b53fe..de4bbe4 100644 --- a/lib/libc/include/libc_private.h +++ b/lib/libc/include/libc_private.h @@ -169,4 +169,27 @@ void _malloc_postfork(void); */ extern void (*__cleanup)(void); +/* + * Get kern.osreldate to detect ABI revisions. Explicitly + * ignores value of $OSVERSION and caches result. Prototypes + * for the wrapped "new" pad-less syscalls are here for now. + */ +extern int __getosreldate(void); +#include +/* Without pad */ +extern __off_t __sys_lseek(int, __off_t, int); +extern int __sys_ftruncate(int, __off_t); +extern int __sys_truncate(const char *, __off_t); +extern __ssize_t __sys_pread(int, void *, __size_t, __off_t); +extern __ssize_t __sys_pwrite(int, const void *, __size_t, __off_t); +extern void * __sys_mmap(void *, __size_t, int, int, int, __off_t); + +/* With pad */ +extern __off_t __sys_freebsd6_lseek(int, int, __off_t, int); +extern int __sys_freebsd6_ftruncate(int, int, __off_t); +extern int __sys_freebsd6_truncate(const char *, int, __off_t); +extern __ssize_t __sys_freebsd6_pread(int, void *, __size_t, int, __off_t); +extern __ssize_t __sys_freebsd6_pwrite(int, const void *, __size_t, int, __off_t); +extern void * __sys_freebsd6_mmap(void *, __size_t, int, int, int, int, __off_t); + #endif /* _LIBC_PRIVATE_H_ */ -- cgit v1.1