summaryrefslogtreecommitdiffstats
path: root/lib/libc/sys/truncate.c
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2007-07-04 23:27:38 +0000
committerpeter <peter@FreeBSD.org>2007-07-04 23:27:38 +0000
commit1c8d4bbe1849bcdcc2f85e7f4f049e8077209ac5 (patch)
treec6557e22092cc28b77304e9185ac106ae162a5ca /lib/libc/sys/truncate.c
parent6f011a901238459d7c02187fc3effe7157c3aeb7 (diff)
downloadFreeBSD-src-1c8d4bbe1849bcdcc2f85e7f4f049e8077209ac5.zip
FreeBSD-src-1c8d4bbe1849bcdcc2f85e7f4f049e8077209ac5.tar.gz
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)
Diffstat (limited to 'lib/libc/sys/truncate.c')
-rw-r--r--lib/libc/sys/truncate.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/libc/sys/truncate.c b/lib/libc/sys/truncate.c
index e26f3f5..375c9d9 100644
--- a/lib/libc/sys/truncate.c
+++ b/lib/libc/sys/truncate.c
@@ -35,8 +35,8 @@ __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
@@ -48,5 +48,8 @@ truncate(path, length)
off_t length;
{
- return(__syscall((quad_t)SYS_truncate, path, 0, length));
+ if (__getosreldate() >= 700051)
+ return(__sys_truncate(path, length));
+ else
+ return(__sys_freebsd6_truncate(path, 0, length));
}
OpenPOWER on IntegriCloud