aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/sys/lseek.c
diff options
context:
space:
mode:
authorPeter Wemm <peter@FreeBSD.org>2007-07-04 23:27:38 +0000
committerPeter Wemm <peter@FreeBSD.org>2007-07-04 23:27:38 +0000
commit4dd719bd7f6491cea2f15846bf5ebcfd3d5e862f (patch)
treec6557e22092cc28b77304e9185ac106ae162a5ca /lib/libc/sys/lseek.c
parent65a6d893baa4ff43995d874bdaf3119266533e84 (diff)
downloadsrc-4dd719bd7f6491cea2f15846bf5ebcfd3d5e862f.tar.gz
src-4dd719bd7f6491cea2f15846bf5ebcfd3d5e862f.zip
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)
Notes
Notes: svn path=/head/; revision=171219
Diffstat (limited to 'lib/libc/sys/lseek.c')
-rw-r--r--lib/libc/sys/lseek.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/libc/sys/lseek.c b/lib/libc/sys/lseek.c
index 86136785f053..a086be18e537 100644
--- a/lib/libc/sys/lseek.c
+++ b/lib/libc/sys/lseek.c
@@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$");
#include <sys/types.h>
#include <sys/syscall.h>
#include <unistd.h>
+#include "libc_private.h"
/*
* This function provides 64-bit offset padding that
@@ -47,5 +48,9 @@ lseek(fd, offset, whence)
off_t offset;
int whence;
{
- return(__syscall((quad_t)SYS_lseek, fd, 0, offset, whence));
+
+ if (__getosreldate() >= 700051)
+ return(__sys_lseek(fd, offset, whence));
+ else
+ return(__sys_freebsd6_lseek(fd, 0, offset, whence));
}