aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/include
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/include
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/include')
-rw-r--r--lib/libc/include/libc_private.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/libc/include/libc_private.h b/lib/libc/include/libc_private.h
index a8b53fecabb3..de4bbe44151c 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 <sys/_types.h>
+/* 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_ */