Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/compat/linux/common Add support for more open flags that...
details: https://anonhg.NetBSD.org/src/rev/9b241d08fa1f
branches: trunk
changeset: 330164:9b241d08fa1f
user: njoly <njoly%NetBSD.org@localhost>
date: Wed Jun 25 16:38:53 2014 +0000
description:
Add support for more open flags that have a native equivalent
(O_NONBLOCK, O_DIRECT and O_NOFOLLOW).
Translate native EFTYPE error (missing on Linux) to expected ELOOP;
when opening symlinks with flag O_NOFOLLOW.
diffstat:
sys/compat/linux/common/linux_file.c | 20 ++++++++++++++------
1 files changed, 14 insertions(+), 6 deletions(-)
diffs (78 lines):
diff -r de90a3e94783 -r 9b241d08fa1f sys/compat/linux/common/linux_file.c
--- a/sys/compat/linux/common/linux_file.c Wed Jun 25 16:35:12 2014 +0000
+++ b/sys/compat/linux/common/linux_file.c Wed Jun 25 16:38:53 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_file.c,v 1.112 2014/06/01 13:42:12 njoly Exp $ */
+/* $NetBSD: linux_file.c,v 1.113 2014/06/25 16:38:53 njoly Exp $ */
/*-
* Copyright (c) 1995, 1998, 2008 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_file.c,v 1.112 2014/06/01 13:42:12 njoly Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_file.c,v 1.113 2014/06/25 16:38:53 njoly Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -93,15 +93,19 @@
res |= cvtto_bsd_mask(lflags, LINUX_O_WRONLY, O_WRONLY);
res |= cvtto_bsd_mask(lflags, LINUX_O_RDONLY, O_RDONLY);
res |= cvtto_bsd_mask(lflags, LINUX_O_RDWR, O_RDWR);
+
res |= cvtto_bsd_mask(lflags, LINUX_O_CREAT, O_CREAT);
res |= cvtto_bsd_mask(lflags, LINUX_O_EXCL, O_EXCL);
res |= cvtto_bsd_mask(lflags, LINUX_O_NOCTTY, O_NOCTTY);
res |= cvtto_bsd_mask(lflags, LINUX_O_TRUNC, O_TRUNC);
+ res |= cvtto_bsd_mask(lflags, LINUX_O_APPEND, O_APPEND);
+ res |= cvtto_bsd_mask(lflags, LINUX_O_NONBLOCK, O_NONBLOCK);
res |= cvtto_bsd_mask(lflags, LINUX_O_NDELAY, O_NDELAY);
res |= cvtto_bsd_mask(lflags, LINUX_O_SYNC, O_FSYNC);
res |= cvtto_bsd_mask(lflags, LINUX_FASYNC, O_ASYNC);
- res |= cvtto_bsd_mask(lflags, LINUX_O_APPEND, O_APPEND);
+ res |= cvtto_bsd_mask(lflags, LINUX_O_DIRECT, O_DIRECT);
res |= cvtto_bsd_mask(lflags, LINUX_O_DIRECTORY, O_DIRECTORY);
+ res |= cvtto_bsd_mask(lflags, LINUX_O_NOFOLLOW, O_NOFOLLOW);
res |= cvtto_bsd_mask(lflags, LINUX_O_CLOEXEC, O_CLOEXEC);
return res;
@@ -115,15 +119,19 @@
res |= cvtto_linux_mask(bflags, O_WRONLY, LINUX_O_WRONLY);
res |= cvtto_linux_mask(bflags, O_RDONLY, LINUX_O_RDONLY);
res |= cvtto_linux_mask(bflags, O_RDWR, LINUX_O_RDWR);
+
res |= cvtto_linux_mask(bflags, O_CREAT, LINUX_O_CREAT);
res |= cvtto_linux_mask(bflags, O_EXCL, LINUX_O_EXCL);
res |= cvtto_linux_mask(bflags, O_NOCTTY, LINUX_O_NOCTTY);
res |= cvtto_linux_mask(bflags, O_TRUNC, LINUX_O_TRUNC);
+ res |= cvtto_linux_mask(bflags, O_APPEND, LINUX_O_APPEND);
+ res |= cvtto_linux_mask(bflags, O_NONBLOCK, LINUX_O_NONBLOCK);
res |= cvtto_linux_mask(bflags, O_NDELAY, LINUX_O_NDELAY);
res |= cvtto_linux_mask(bflags, O_FSYNC, LINUX_O_SYNC);
res |= cvtto_linux_mask(bflags, O_ASYNC, LINUX_FASYNC);
- res |= cvtto_linux_mask(bflags, O_APPEND, LINUX_O_APPEND);
+ res |= cvtto_linux_mask(bflags, O_DIRECT, LINUX_O_DIRECT);
res |= cvtto_linux_mask(bflags, O_DIRECTORY, LINUX_O_DIRECTORY);
+ res |= cvtto_linux_mask(bflags, O_NOFOLLOW, LINUX_O_NOFOLLOW);
res |= cvtto_linux_mask(bflags, O_CLOEXEC, LINUX_O_CLOEXEC);
return res;
@@ -204,7 +212,7 @@
SCARG(&boa, mode) = SCARG(uap, mode);
if ((error = sys_open(l, &boa, retval)))
- return error;
+ return (error == EFTYPE) ? ELOOP : error;
linux_open_ctty(l, fl, *retval);
return 0;
@@ -230,7 +238,7 @@
SCARG(&boa, mode) = SCARG(uap, mode);
if ((error = sys_openat(l, &boa, retval)))
- return error;
+ return (error == EFTYPE) ? ELOOP : error;
linux_open_ctty(l, fl, *retval);
return 0;
Home |
Main Index |
Thread Index |
Old Index