tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Inconsistency with COMPAT_10
Le 18/04/2014 10:30, Maxime Villard a écrit :
> Hi all,
> I think there's an inconsistency with COMPAT_10 in the open() syscall:
>
> ----------------- kern/vfs_syscalls.c - l.1631 ------------------
>
> #ifdef COMPAT_10 /* XXX: and perhaps later */
> if (path == NULL) {
> pb = pathbuf_create(".");
> if (pb == NULL)
> return ENOMEM;
> } else
> #endif
> {
> error = pathbuf_copyin(path, &pb);
> if (error)
> return error;
> }
>
> -----------------------------------------------------------------
>
> ------------ compat/netbsd32/netbsd32_netbsd.c - l.240 ----------
>
> if (SCARG(&ua, path) != NULL) {
> error = pathbuf_copyin(SCARG(&ua, path), &pb);
> if (error)
> return error;
> } else {
> pb = pathbuf_create(".");
> if (pb == NULL)
> return ENOMEM;
> }
>
> -----------------------------------------------------------------
>
> COMPAT_10 should be added in netbsd32, or removed from the native
> syscall. But I'm not sure which fix should be applied.
>
> I guess there's someone around here who knows how to fix that.
>
> Thanks!
> Maxime
>
I've kept this issue in my TODO list until now - I told myself I would fix it
after
investigating a bit. But now I figure out that I don't have to:
Index: netbsd32_netbsd.c
===================================================================
RCS file: /cvsroot/src/sys/compat/netbsd32/netbsd32_netbsd.c,v
retrieving revision 1.192
diff -u -r1.192 netbsd32_netbsd.c
--- netbsd32_netbsd.c 28 Jun 2014 22:27:50 -0000 1.192
+++ netbsd32_netbsd.c 18 Jul 2014 18:01:38 -0000
@@ -230,28 +230,12 @@
syscallarg(mode_t) mode;
} */
struct sys_open_args ua;
- struct pathbuf *pb;
- int error, fd;
NETBSD32TOP_UAP(path, const char);
NETBSD32TO64_UAP(flags);
NETBSD32TO64_UAP(mode);
-
- if (SCARG(&ua, path) != NULL) {
- error = pathbuf_copyin(SCARG(&ua, path), &pb);
- if (error)
- return error;
- } else {
- pb = pathbuf_create(".");
- if (pb == NULL)
- return ENOMEM;
- }
-
- error = do_open(l, NULL, pb, SCARG(&ua, flags), SCARG(&ua, mode), &fd);
- pathbuf_destroy(pb);
- if (error == 0)
- *retval = fd;
- return error;
+
+ return sys_open(l, &ua, retval);
}
int
Just redirect to sys_open(), which will handle the rest. Copied from
linux_file.c.
Ok?
Home |
Main Index |
Thread Index |
Old Index