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/sys/pwrite.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/libc/sys/pwrite.c') diff --git a/lib/libc/sys/pwrite.c b/lib/libc/sys/pwrite.c index ebbb1ec..d17ed29 100644 --- a/lib/libc/sys/pwrite.c +++ b/lib/libc/sys/pwrite.c @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include "libc_private.h" /* * This function provides 64-bit offset padding that @@ -48,5 +49,8 @@ pwrite(fd, buf, nbyte, offset) size_t nbyte; off_t offset; { - return ((ssize_t)__syscall((quad_t)SYS_pwrite, fd, buf, nbyte, 0, offset)); + if (__getosreldate() >= 700051) + return (__sys_pwrite(fd, buf, nbyte, offset)); + else + return (__sys_freebsd6_pwrite(fd, buf, nbyte, 0, offset)); } -- cgit v1.1