From 3fa945c034193a5897c9d948ce651136606f239b Mon Sep 17 00:00:00 2001 From: njoly Date: Sat, 14 Dec 2013 10:29:45 +0000 Subject: [PATCH] Add syscall wrapper for mknodat(2) to deal with PAD argument difference between rump and linux versions. --- sys/rump/kern/lib/libsys_linux/Makefile | 4 +- sys/rump/kern/lib/libsys_linux/linux_rump.c | 45 +++++++++++++++++++ .../kern/lib/libsys_linux/syscalls.master | 6 +-- 3 files changed, 50 insertions(+), 5 deletions(-) create mode 100644 sys/rump/kern/lib/libsys_linux/linux_rump.c diff --git a/sys/rump/kern/lib/libsys_linux/Makefile b/sys/rump/kern/lib/libsys_linux/Makefile index 8db4d51d8465..ca5d3799a7c3 100644 --- a/sys/rump/kern/lib/libsys_linux/Makefile +++ b/sys/rump/kern/lib/libsys_linux/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.2 2013/03/07 18:53:39 pooka Exp $ +# $NetBSD: Makefile,v 1.3 2013/12/14 10:29:45 njoly Exp $ # .PATH: ${.CURDIR}/../../../../compat/linux/common @@ -10,7 +10,7 @@ SRCS= linux_blkio.c linux_cdrom.c linux_errno.c linux_fdio.c \ linux_mtio.c linux_signal.c linux_signo.c linux_socket.c \ linux_sysctl.c linux_termios.c linux_time.c linux_file64.c -SRCS+= rump_linux_sysent.c component.c +SRCS+= rump_linux_sysent.c component.c linux_rump.c # XXX CPPFLAGS+= -I${.CURDIR} -I${RUMPTOP}/librump/rumpkern diff --git a/sys/rump/kern/lib/libsys_linux/linux_rump.c b/sys/rump/kern/lib/libsys_linux/linux_rump.c new file mode 100644 index 000000000000..69168f4de7c7 --- /dev/null +++ b/sys/rump/kern/lib/libsys_linux/linux_rump.c @@ -0,0 +1,45 @@ +/* $NetBSD: linux_rump.c,v 1.1 2013/12/14 10:29:45 njoly Exp $ */ + +#include + +#include +#include + +#include "rump_linux_syscallargs.h" + +/* + compat/linux/arch/.../syscallargs.h and rump_linux_syscallargs.h + define the same syscall arguments and prototypes, thus cannot be + both used. Just copy needed linux stuff for now to avoid conflicts. +*/ + +struct linux_sys_mknodat_args { + syscallarg(int) fd; + syscallarg(const char *) path; + syscallarg(mode_t) mode; + syscallarg(unsigned) dev; +}; +check_syscall_args(linux_sys_mknodat) + +int linux_sys_mknodat(struct lwp *, const struct linux_sys_mknodat_args *, register_t *); + +int +rump_linux_sys_mknodat(struct lwp *l, + const struct rump_linux_sys_mknodat_args *uap, register_t *retval) +{ + /* { + syscallarg(int) fd; + syscallarg(const char *) path; + syscallarg(mode_t) mode; + syscallarg(int) PAD; + syscallarg(dev_t) dev; + } */ + struct linux_sys_mknodat_args ua; + + SCARG(&ua, fd) = SCARG(uap, fd); + SCARG(&ua, path) = SCARG(uap, path); + SCARG(&ua, mode) = SCARG(uap, mode); + SCARG(&ua, dev) = SCARG(uap, dev); + + return linux_sys_mknodat(l, &ua, retval); +} diff --git a/sys/rump/kern/lib/libsys_linux/syscalls.master b/sys/rump/kern/lib/libsys_linux/syscalls.master index 8053ffd59938..5f5c288e3f31 100644 --- a/sys/rump/kern/lib/libsys_linux/syscalls.master +++ b/sys/rump/kern/lib/libsys_linux/syscalls.master @@ -1,4 +1,4 @@ - $NetBSD: syscalls.master,v 1.8 2013/12/08 08:54:48 njoly Exp $ + $NetBSD: syscalls.master,v 1.9 2013/12/14 10:29:45 njoly Exp $ ; @(#)syscalls.master 8.2 (Berkeley) 1/13/94 @@ -589,8 +589,8 @@ 458 NOARGS { int|sys||renameat(int fromfd, const char *from, \ int tofd, const char *to); } 459 UNIMPL mkfifoat -460 NODEF { int|linux_sys||mknodat(int fd, const char *path, \ - mode_t mode, unsigned dev); } +460 STD { int|rump_linux_sys||mknodat(int fd, const char *path, \ + mode_t mode, int PAD, unsigned dev); } 461 NOARGS { int|sys||mkdirat(int fd, const char *path, \ mode_t mode); } 462 NODEF { int|linux_sys||faccessat(int fd, const char *path, \