tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: mknodat(2) device argument type change



On Sun, Oct 06, 2013 at 07:40:52PM +0200, Nicolas Joly wrote:
> 
> Checking syscalls.master mknodat(2) definition needs to be updated for
> correct device argument type. It currently use uint32_t where it
> should be dev_t ...

Here is the corresponding patch, for review. It changes the syscall
device argument type from uint32_t to dev_t, adds the needed PAD
argument and libc wrapper.

Thanks.

-- 
Nicolas Joly

Biology IT Center
Institut Pasteur, Paris.
Index: lib/libc/sys/Makefile.inc
===================================================================
RCS file: /cvsroot/src/lib/libc/sys/Makefile.inc,v
retrieving revision 1.219
diff -u -p -r1.219 Makefile.inc
--- lib/libc/sys/Makefile.inc   29 Mar 2013 02:10:53 -0000      1.219
+++ lib/libc/sys/Makefile.inc   10 Oct 2013 11:00:51 -0000
@@ -31,7 +31,7 @@ SRCS+=        posix_fadvise.c posix_madvise.c s
 # glue to provide compatibility between GCC 1.X and 2.X and for compat
 # with old syscall interfaces.
 GLUE+= ftruncate.c lseek.c mmap.c pread.c preadv.c pwrite.c \
-       pwritev.c truncate.c ntp_adjtime.c
+       pwritev.c truncate.c ntp_adjtime.c mknodat.c
 
 GLUE50+= adjtime.c clock_settime.c settimeofday.c
 
@@ -108,7 +108,7 @@ ASM=        access.S acct.S \
                _lwp_wakeup.S _lwp_detach.S _lwp_setprivate.S \
                _lwp_setname.S _lwp_getname.S _lwp_ctl.S \
        madvise.S mincore.S minherit.S mkdir.S mkdirat.S mkfifo.S mkfifoat.S \
-               __mknod50.S mknodat.S mlock.S mlockall.S modctl.S __mount50.S \
+               __mknod50.S mlock.S mlockall.S modctl.S __mount50.S \
                mprotect.S __msgctl50.S msgget.S munlock.S munlockall.S \
                munmap.S \
        nfssvc.S __ntp_gettime50.S \
Index: lib/libc/sys/mknodat.c
===================================================================
RCS file: lib/libc/sys/mknodat.c
diff -N lib/libc/sys/mknodat.c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ lib/libc/sys/mknodat.c      10 Oct 2013 11:00:51 -0000
@@ -0,0 +1,41 @@
+/* $NetBSD$ */
+
+/*-
+ * Copyright (c) 2013 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Nicolas Joly <njoly%NetBSD.org@localhost>.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/syscall.h>
+#include <sys/stat.h>
+
+int __mknodat(int, const char *, mode_t, int, dev_t);
+
+int
+mknodat(int fd, const char *path, mode_t mode, dev_t dev)
+{
+       return __mknodat(fd, path, mode, 0, dev);
+}
Index: sys/compat/netbsd32/netbsd32_fs.c
===================================================================
RCS file: /cvsroot/src/sys/compat/netbsd32/netbsd32_fs.c,v
retrieving revision 1.68
diff -u -p -r1.68 netbsd32_fs.c
--- sys/compat/netbsd32/netbsd32_fs.c   30 Jul 2013 17:22:31 -0000      1.68
+++ sys/compat/netbsd32/netbsd32_fs.c   10 Oct 2013 11:00:51 -0000
@@ -1063,13 +1063,15 @@ netbsd32_mknodat(struct lwp *l, const st
                syscallarg(int) fd;
                syscallarg(netbsd32_charp) path;
                syscallarg(mode_t) mode;
-               syscallarg(uint32_t) dev;
+               syscallarg(int) pad;
+               syscallarg(netbsd32_dev_t) dev;
        } */
        struct sys_mknodat_args ua;
 
        NETBSD32TO64_UAP(fd);
        NETBSD32TOP_UAP(path, const char);
        NETBSD32TO64_UAP(mode);
+       NETBSD32TO64_UAP(PAD);
        NETBSD32TO64_UAP(dev);
 
        return sys_mknodat(l, &ua, retval);
Index: sys/compat/netbsd32/syscalls.master
===================================================================
RCS file: /cvsroot/src/sys/compat/netbsd32/syscalls.master,v
retrieving revision 1.97
diff -u -p -r1.97 syscalls.master
--- sys/compat/netbsd32/syscalls.master 29 Mar 2013 01:04:30 -0000      1.97
+++ sys/compat/netbsd32/syscalls.master 10 Oct 2013 11:00:51 -0000
@@ -976,8 +976,8 @@
                            mode_t mode); }
 460    STD             { int|netbsd32||mknodat(int fd, \
                            const netbsd32_charp path, \
-                           mode_t mode, \
-                           uint32_t dev); }
+                           mode_t mode, int PAD, \
+                           netbsd32_dev_t dev); }
 461    STD             { int|netbsd32||mkdirat(int fd, \
                            const netbsd32_charp path, \
                            mode_t mode); }
Index: sys/kern/syscalls.master
===================================================================
RCS file: /cvsroot/src/sys/kern/syscalls.master,v
retrieving revision 1.263
diff -u -p -r1.263 syscalls.master
--- sys/kern/syscalls.master    30 Aug 2013 10:33:10 -0000      1.263
+++ sys/kern/syscalls.master    10 Oct 2013 11:00:51 -0000
@@ -902,7 +902,7 @@
 459    STD  RUMP       { int|sys||mkfifoat(int fd, const char *path, \
                            mode_t mode); }
 460    STD  RUMP       { int|sys||mknodat(int fd, const char *path, \
-                           mode_t mode, uint32_t dev); }
+                           mode_t mode, int PAD, dev_t dev); }
 461    STD  RUMP       { int|sys||mkdirat(int fd, const char *path, \
                            mode_t mode); }
 462    STD  RUMP       { int|sys||faccessat(int fd, const char *path, \
Index: sys/kern/vfs_syscalls.c
===================================================================
RCS file: /cvsroot/src/sys/kern/vfs_syscalls.c,v
retrieving revision 1.467
diff -u -p -r1.467 vfs_syscalls.c
--- sys/kern/vfs_syscalls.c     20 Jul 2013 15:55:57 -0000      1.467
+++ sys/kern/vfs_syscalls.c     10 Oct 2013 11:00:52 -0000
@@ -2162,7 +2162,8 @@ sys_mknodat(struct lwp *l, const struct 
                syscallarg(int) fd;
                syscallarg(const char *) path;
                syscallarg(mode_t) mode;
-               syscallarg(uint32_t) dev;
+               syscallarg(int) pad;
+               syscallarg(dev_t) dev;
        } */
 
        return do_sys_mknodat(l, SCARG(uap, fd), SCARG(uap, path), 
Index: sys/sys/stat.h
===================================================================
RCS file: /cvsroot/src/sys/sys/stat.h,v
retrieving revision 1.67
diff -u -p -r1.67 stat.h
--- sys/sys/stat.h      9 Oct 2013 09:38:21 -0000       1.67
+++ sys/sys/stat.h      10 Oct 2013 11:00:52 -0000
@@ -278,7 +278,7 @@ int     fchmodat(int, const char *, mode
 int     fstatat(int, const char *, struct stat *, int);
 int     mkdirat(int, const char *, mode_t);
 int     mkfifoat(int, const char *, mode_t);
-int     mknodat(int, const char *, mode_t, uint32_t);
+int     mknodat(int, const char *, mode_t, dev_t);
 int     utimensat(int, const char *, const struct timespec *, int);
 #endif
 


Home | Main Index | Thread Index | Old Index