Add syscall wrapper for mknodat(2) to deal with PAD argument difference

between rump and linux versions.
This commit is contained in:
njoly 2013-12-14 10:29:45 +00:00
parent a07e26d1c4
commit 3fa945c034
3 changed files with 50 additions and 5 deletions

View File

@ -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

View File

@ -0,0 +1,45 @@
/* $NetBSD: linux_rump.c,v 1.1 2013/12/14 10:29:45 njoly Exp $ */
#include <sys/param.h>
#include <compat/linux/common/linux_types.h>
#include <compat/linux/common/linux_signal.h>
#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);
}

View File

@ -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, \