summaryrefslogtreecommitdiffstats
path: root/lib/libc/sys/fcntl.c
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2015-04-18 21:50:13 +0000
committerkib <kib@FreeBSD.org>2015-04-18 21:50:13 +0000
commit2254748ed0eebd8391a1bc331f3d54d0ddb1f69d (patch)
tree5939add2a0816746476989dd37677ad0fb0428ac /lib/libc/sys/fcntl.c
parent2b1ec4f62f3bd13a47fea3a9c366c9a7a0ac35e0 (diff)
downloadFreeBSD-src-2254748ed0eebd8391a1bc331f3d54d0ddb1f69d.zip
FreeBSD-src-2254748ed0eebd8391a1bc331f3d54d0ddb1f69d.tar.gz
The lseek(2), mmap(2), truncate(2), ftruncate(2), pread(2), and
pwrite(2) syscalls are wrapped to provide compatibility with pre-7.x kernels which required padding before the off_t parameter. The fcntl(2) contains compatibility code to handle kernels before the struct flock was changed during the 8.x CURRENT development. The shims were reasonable to allow easier revert to the older kernel at that time. Now, two or three major releases later, shims do not serve any purpose. Such old kernels cannot handle current libc, so revert the compatibility code. Make padded syscalls support conditional under the COMPAT6 config option. For COMPAT32, the syscalls were under COMPAT6 already. Remove WITHOUT_SYSCALL_COMPAT build option, which only purpose was to (partially) disable the removed shims. Reviewed by: jhb, imp (previous versions) Discussed with: peter Sponsored by: The FreeBSD Foundation MFC after: 1 week
Diffstat (limited to 'lib/libc/sys/fcntl.c')
-rw-r--r--lib/libc/sys/fcntl.c62
1 files changed, 6 insertions, 56 deletions
diff --git a/lib/libc/sys/fcntl.c b/lib/libc/sys/fcntl.c
index 7af617e..e85574a 100644
--- a/lib/libc/sys/fcntl.c
+++ b/lib/libc/sys/fcntl.c
@@ -3,6 +3,12 @@
* Authors: Doug Rabson <dfr@rabson.org>
* Developed with Red Inc: Alfred Perlstein <alfred@freebsd.org>
*
+ * Copyright (c) 2014-2015 The FreeBSD Foundation.
+ * All rights reserved.
+ *
+ * Portions of this software were developed by Konstantin Belousov
+ * under sponsorship from the FreeBSD Foundation.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -48,59 +54,3 @@ fcntl(int fd, int cmd, ...)
return (((int (*)(int, int, ...))
__libc_interposing[INTERPOS_fcntl])(fd, cmd, arg));
}
-
-#ifdef SYSCALL_COMPAT
-__weak_reference(__fcntl_compat, __fcntl);
-
-int
-__fcntl_compat(int fd, int cmd, ...)
-{
- va_list args;
- long arg;
- struct __oflock ofl;
- struct flock *flp;
- int res;
-
- va_start(args, cmd);
- arg = va_arg(args, long);
- va_end(args);
-
- if (__getosreldate() >= 800028) {
- return (__sys_fcntl(fd, cmd, arg));
- } else {
- if (cmd == F_GETLK || cmd == F_SETLK || cmd == F_SETLKW) {
- /*
- * Convert new-style struct flock (which
- * includes l_sysid) to old-style.
- */
- flp = (struct flock *) (uintptr_t) arg;
- ofl.l_start = flp->l_start;
- ofl.l_len = flp->l_len;
- ofl.l_pid = flp->l_pid;
- ofl.l_type = flp->l_type;
- ofl.l_whence = flp->l_whence;
-
- switch (cmd) {
- case F_GETLK:
- res = __sys_fcntl(fd, F_OGETLK, &ofl);
- if (res >= 0) {
- flp->l_start = ofl.l_start;
- flp->l_len = ofl.l_len;
- flp->l_pid = ofl.l_pid;
- flp->l_type = ofl.l_type;
- flp->l_whence = ofl.l_whence;
- flp->l_sysid = 0;
- }
- return (res);
-
- case F_SETLK:
- return (__sys_fcntl(fd, F_OSETLK, &ofl));
-
- case F_SETLKW:
- return (__sys_fcntl(fd, F_OSETLKW, &ofl));
- }
- }
- return (__sys_fcntl(fd, cmd, arg));
- }
-}
-#endif
OpenPOWER on IntegriCloud