Subject: Re: Linux emul problems
To: Arto Huusko <arto.huusko@pp2.inet.fi>
From: Nicolas Joly <njoly@pasteur.fr>
List: port-amd64
Date: 10/25/2007 23:08:55
--Kj7319i9nmIyA2yE
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
On Thu, Oct 25, 2007 at 09:02:02PM +0300, Arto Huusko wrote:
> Nicolas Joly wrote:
> > Could you try the attached patch, which adds missing syscalls from
> > chown's family under compat linux32.
>
> This works, thank you.
Thanks for testing. I'll do the commit, unless someone objects.
--
Nicolas Joly
Biological Software and Databanks.
Institut Pasteur, Paris.
--Kj7319i9nmIyA2yE
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="netbsd-linux32chown.diff"
Index: sys/compat/linux32/arch/amd64/syscalls.master
===================================================================
RCS file: /cvsroot/src/sys/compat/linux32/arch/amd64/syscalls.master,v
retrieving revision 1.15
diff -u -p -r1.15 syscalls.master
--- sys/compat/linux32/arch/amd64/syscalls.master 20 Apr 2007 13:37:05 -0000 1.15
+++ sys/compat/linux32/arch/amd64/syscalls.master 23 Oct 2007 13:49:20 -0000
@@ -303,7 +303,8 @@
netbsd32_size_t sigsetsize); }
180 UNIMPL pread
181 UNIMPL pwrite
-182 UNIMPL chown16
+182 STD { int linux32_sys_chown16(const netbsd32_charp path, \
+ int uid, int gid); }
183 NOARGS { int netbsd32___getcwd(netbsd32_charp bufp, \
netbsd32_size_t length); }
184 UNIMPL capget
@@ -326,7 +327,8 @@
linux32_stat64p sp); }
197 STD { int linux32_sys_fstat64(int fd, \
linux32_stat64p sp); }
-198 UNIMPL lchown
+198 NOARGS { int netbsd32___posix_lchown(const netbsd32_charp path, \
+ int uid, int gid); }
199 NOARGS { uid_t sys_getuid(void); }
200 NOARGS { gid_t sys_getgid(void); }
201 NOARGS { uid_t sys_geteuid(void); }
@@ -344,7 +346,8 @@
210 STD { int linux32_sys_setresgid(gid_t rgid, gid_t egid, \
gid_t sgid); }
211 UNIMPL getresgid
-212 UNIMPL chown
+212 NOARGS { int netbsd32___posix_chown(const netbsd32_charp path, \
+ int uid, int gid); }
213 NOARGS { int sys_setuid(uid_t uid); }
214 NOARGS { int sys_setgid(gid_t gid); }
215 NOARGS { int linux_sys_setfsuid(uid_t uid); }
Index: sys/compat/linux32/common/linux32_unistd.c
===================================================================
RCS file: /cvsroot/src/sys/compat/linux32/common/linux32_unistd.c,v
retrieving revision 1.10
diff -u -p -r1.10 linux32_unistd.c
--- sys/compat/linux32/common/linux32_unistd.c 16 Jun 2007 19:55:26 -0000 1.10
+++ sys/compat/linux32/common/linux32_unistd.c 23 Oct 2007 13:49:20 -0000
@@ -408,6 +408,34 @@ linux32_sys_chmod(l, v, retval)
}
int
+linux32_sys_chown16(l, v, retval)
+ struct lwp *l;
+ void *v;
+ register_t *retval;
+{
+ struct linux32_sys_chown16_args /* {
+ syscallarg(const netbsd32_charp) path;
+ syscallarg(int) uid;
+ syscallarg(int) gid;
+ } */ *uap = v;
+ struct sys___posix_chown_args ua;
+
+ NETBSD32TOP_UAP(path, const char);
+
+ if ((linux32_uid_t)SCARG(uap, uid) == (linux32_uid_t)-1)
+ SCARG(&ua, uid) = (uid_t)-1;
+ else
+ SCARG(&ua, uid) = SCARG(uap, uid);
+
+ if ((linux32_gid_t)SCARG(uap, gid) == (linux32_gid_t)-1)
+ SCARG(&ua, gid) = (gid_t)-1;
+ else
+ SCARG(&ua, gid) = SCARG(uap, gid);
+
+ return sys___posix_chown(l, &ua, retval);
+}
+
+int
linux32_sys_lchown16(l, v, retval)
struct lwp *l;
void *v;
--Kj7319i9nmIyA2yE--