Source-Changes-HG archive

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

[src/trunk]: src/sys implement the *at() syscalls.



details:   https://anonhg.NetBSD.org/src/rev/fa2576adb8f4
branches:  trunk
changeset: 791431:fa2576adb8f4
user:      chs <chs%NetBSD.org@localhost>
date:      Mon Nov 18 01:32:52 2013 +0000

description:
implement the *at() syscalls.
bring the unimplemented syscall list up to date.

diffstat:

 sys/arch/amd64/include/linux32_machdep.h        |    3 +-
 sys/compat/linux/arch/amd64/syscalls.master     |   66 ++++--
 sys/compat/linux/arch/i386/syscalls.master      |   65 ++++--
 sys/compat/linux/common/linux_file.c            |  224 +++++++++++++++++++----
 sys/compat/linux/common/linux_file64.c          |   31 +++-
 sys/compat/linux/common/linux_misc.c            |   81 ++-----
 sys/compat/linux/common/linux_misc.h            |    4 +-
 sys/compat/linux/common/linux_types.h           |    3 +-
 sys/compat/linux32/arch/amd64/linux32_missing.c |    4 +-
 sys/compat/linux32/arch/amd64/syscalls.master   |   69 +++++--
 sys/compat/linux32/common/linux32_misc.c        |    7 +-
 sys/compat/linux32/common/linux32_signal.c      |    6 +-
 sys/compat/linux32/common/linux32_stat.c        |   32 +++-
 sys/compat/linux32/common/linux32_unistd.c      |  154 ++++++++++++++++-
 14 files changed, 579 insertions(+), 170 deletions(-)

diffs (truncated from 1255 to 300 lines):

diff -r 045d61e3f818 -r fa2576adb8f4 sys/arch/amd64/include/linux32_machdep.h
--- a/sys/arch/amd64/include/linux32_machdep.h  Mon Nov 18 01:32:32 2013 +0000
+++ b/sys/arch/amd64/include/linux32_machdep.h  Mon Nov 18 01:32:52 2013 +0000
@@ -1,10 +1,11 @@
-/*     $NetBSD: linux32_machdep.h,v 1.2 2011/11/18 04:09:17 christos Exp $ */
+/*     $NetBSD: linux32_machdep.h,v 1.3 2013/11/18 01:32:52 chs Exp $ */
 
 #ifndef _MACHINE_LINUX32_H_
 #define _MACHINE_LINUX32_H_
 
 #include <compat/netbsd32/netbsd32.h>
 
+#include <compat/linux/common/linux_types.h>
 #include <compat/linux32/common/linux32_types.h>
 
 #include <compat/linux32/arch/amd64/linux32_siginfo.h>
diff -r 045d61e3f818 -r fa2576adb8f4 sys/compat/linux/arch/amd64/syscalls.master
--- a/sys/compat/linux/arch/amd64/syscalls.master       Mon Nov 18 01:32:32 2013 +0000
+++ b/sys/compat/linux/arch/amd64/syscalls.master       Mon Nov 18 01:32:52 2013 +0000
@@ -1,4 +1,4 @@
-       $NetBSD: syscalls.master,v 1.44 2013/11/07 19:37:18 njoly Exp $
+       $NetBSD: syscalls.master,v 1.45 2013/11/18 01:32:52 chs Exp $
 
 ;      @(#)syscalls.master     8.1 (Berkeley) 7/19/93
 
@@ -67,7 +67,7 @@
 0      NOARGS          { int|sys||read(int fd, char *buf, u_int nbyte); }
 1      NOARGS          { int|sys||write(int fd, char *buf, u_int nbyte); }
 2      STD             { int|linux_sys||open(const char *path, int flags, \
-                           int mode); }
+                           linux_umode_t mode); }
 3      NOARGS          { int|sys||close(int fd); }
 4      STD             { int|linux_sys||stat64(const char *path, \
                            struct linux_stat64 *sp); }
@@ -228,7 +228,7 @@
 81     NOARGS          { int|sys||fchdir(int fd); }
 82     NOARGS          { int|sys||__posix_rename(const char *from, \
                            const char *to); }
-83     NOARGS          { int|sys||mkdir(const char *path, int mode); }
+83     NOARGS          { int|sys||mkdir(const char *path, linux_umode_t mode); }
 84     NOARGS          { int|sys||rmdir(const char *path); }
 85     STD             { int|linux_sys||creat(const char *path, int mode); }
 86     NOARGS          { int|sys||link(const char *path, const char *link); }
@@ -236,8 +236,8 @@
 88     NOARGS          { int|sys||symlink(const char *path, const char *to); }
 89     NOARGS          { int|sys||readlink(const char *name, char *buf, \
                            int count); }
-90     NOARGS          { int|sys||chmod(const char *path, int mode); }
-91     NOARGS          { int|sys||fchmod(int fd, int mode); }
+90     NOARGS          { int|sys||chmod(const char *path, linux_umode_t mode); }
+91     NOARGS          { int|sys||fchmod(int fd, linux_umode_t mode); }
 92     NOARGS          { int|sys||__posix_chown(const char *path, uid_t uid, \
                                gid_t gid); }
 93     NOARGS          { int|sys||__posix_fchown(int fd, uid_t uid, \
@@ -300,8 +300,8 @@
                            struct linux_sigaltstack *oss); }
 132    STD             { int|linux_sys||utime(const char *path, \
                            struct linux_utimbuf *times); }
-133    STD             { int|linux_sys||mknod(const char *path, int mode, \
-                           int dev); }
+133    STD             { int|linux_sys||mknod(const char *path, linux_umode_t mode, \
+                           unsigned dev); }
 #ifdef EXEC_AOUT
 134    STD             { int|linux_sys||uselib(const char *path); }
 #else
@@ -462,19 +462,31 @@
 254    UNIMPL          inotify_add_watch
 255    UNIMPL          inotify_rm_watch
 256    UNIMPL          migrate_pages
-257    UNIMPL          openat
-258    UNIMPL          mkdirat
-259    UNIMPL          mknodat
-260    UNIMPL          fchownat
+257    STD             { int|linux_sys||openat(int fd, const char *path, \
+                           int flags, ... linux_umode_t mode); }
+258    NOARGS          { int|sys||mkdirat(int fd, const char *path, \
+                           linux_umode_t mode); }
+259    STD             { int|linux_sys||mknodat(int fd, const char *path, \
+                           linux_umode_t mode, unsigned dev); }
+260    STD             { int|linux_sys||fchownat(int fd, const char *path, \
+                           uid_t owner, gid_t group, int flag); }
 261    UNIMPL          futimesat
-262    UNIMPL          newfstatat
-263    UNIMPL          unlinkat
-264    UNIMPL          renameat
-265    UNIMPL          linkat
-266    UNIMPL          symlinkat
-267    UNIMPL          readlinkat
-268    UNIMPL          fchmodat
-269    UNIMPL          faccessat
+262    STD             { int|linux_sys||fstatat64(int fd, const char *path, \
+                           struct linux_stat *sp, int flag); }
+263    STD             { int|linux_sys||unlinkat(int fd, const char *path, \
+                           int flag); }
+264    NOARGS          { int|sys||renameat(int fromfd, const char *from, \
+                           int tofd, const char *to); }
+265    STD             { int|linux_sys||linkat(int fd1, const char *name1, \
+                           int fd2, const char *name2, int flags); }
+266    NOARGS          { int|sys||symlinkat(const char *path1, int fd, \
+                           const char *path2); }
+267    NOARGS          { int|sys||readlinkat(int fd, const char *path, \
+                           char *buf, size_t bufsize); }
+268    STD             { int|linux_sys||fchmodat(int fd, const char *path, \
+                           linux_umode_t mode); }
+269    STD             { int|linux_sys||faccessat(int fd, const char *path, \
+                           int amode); }
 270    UNIMPL          pselect6
 271    STD             { int|linux_sys||ppoll(struct pollfd *fds, int nfds, \
                            struct linux_timespec *timeout, \
@@ -511,6 +523,20 @@
 297    UNIMPL          rt_tgsigqueueinfo
 298    UNIMPL          perf_counter_open
 299    UNIMPL          recvmmsg
+300    UNIMPL          fanotify_init
+301    UNIMPL          fanotify_mark
+302    UNIMPL          prlimit64
+303    UNIMPL          name_to_handle_at
+304    UNIMPL          open_by_handle_at
+305    UNIMPL          clock_adjtime
+306    UNIMPL          syncfs
+307    UNIMPL          sendmmsg
+308    UNIMPL          setns
+309    UNIMPL          getcpu
+310    UNIMPL          process_vm_readv
+311    UNIMPL          process_vm_writev
+312    UNIMPL          kcmp
+313    UNIMPL          finit_module
 
 ; we want a "nosys" syscall, we'll just add an extra entry for it.
-300    STD             { int|linux_sys||nosys(void); }
+314    STD             { int|linux_sys||nosys(void); }
diff -r 045d61e3f818 -r fa2576adb8f4 sys/compat/linux/arch/i386/syscalls.master
--- a/sys/compat/linux/arch/i386/syscalls.master        Mon Nov 18 01:32:32 2013 +0000
+++ b/sys/compat/linux/arch/i386/syscalls.master        Mon Nov 18 01:32:52 2013 +0000
@@ -1,4 +1,4 @@
-       $NetBSD: syscalls.master,v 1.111 2013/11/07 19:37:18 njoly Exp $
+       $NetBSD: syscalls.master,v 1.112 2013/11/18 01:32:52 chs Exp $
 
 ;      @(#)syscalls.master     8.1 (Berkeley) 7/19/93
 
@@ -58,20 +58,20 @@
 3      NOARGS          { int|sys||read(int fd, char *buf, u_int nbyte); }
 4      NOARGS          { int|sys||write(int fd, char *buf, u_int nbyte); }
 5      STD             { int|linux_sys||open(const char *path, int flags, \
-                           int mode); }
+                           linux_umode_t mode); }
 6      NOARGS          { int|sys||close(int fd); }
 7      STD             { int|linux_sys||waitpid(int pid, int *status, \
                            int options);}
-8      STD             { int|linux_sys||creat(const char *path, int mode); }
+8      STD             { int|linux_sys||creat(const char *path, linux_umode_t mode); }
 9      NOARGS          { int|sys||link(const char *path, const char *link); }
 10     STD             { int|linux_sys||unlink(const char *path); }
 11     NOARGS          { int|sys||execve(const char *path, char **argp, \
                            char **envp); }
 12     NOARGS          { int|sys||chdir(const char *path); }
 13     STD             { int|linux_sys||time(linux_time_t *t); }
-14     STD             { int|linux_sys||mknod(const char *path, int mode, \
-                           int dev); }
-15     NOARGS          { int|sys||chmod(const char *path, int mode); }
+14     STD             { int|linux_sys||mknod(const char *path, linux_umode_t mode, \
+                           unsigned dev); }
+15     NOARGS          { int|sys||chmod(const char *path, linux_umode_t mode); }
 16     STD             { int|linux_sys||lchown16(const char *path, \
                            linux_uid16_t uid, linux_gid16_t gid); }
 ;17 - no longer in linux source.
@@ -101,7 +101,7 @@
 37     STD             { int|linux_sys||kill(int pid, int signum); }
 38     NOARGS          { int|sys||__posix_rename(const char *from, \
                            const char *to); }
-39     NOARGS          { int|sys||mkdir(const char *path, int mode); }
+39     NOARGS          { int|sys||mkdir(const char *path, linux_umode_t mode); }
 40     NOARGS          { int|sys||rmdir(const char *path); }
 41     NOARGS          { int|sys||dup(int fd); }
 42     STD             { int|linux_sys||pipe(int *pfds); }
@@ -181,7 +181,7 @@
 92     NOARGS          { int|compat_43_sys||truncate(const char *path, \
                            long length); }
 93     NOARGS          { int|compat_43_sys||ftruncate(int fd, long length); }
-94     NOARGS          { int|sys||fchmod(int fd, int mode); }
+94     NOARGS          { int|sys||fchmod(int fd, linux_umode_t mode); }
 95     STD             { int|linux_sys||fchown16(int fd, linux_uid16_t uid, \
                            linux_gid16_t gid); }
 96     STD             { int|linux_sys||getpriority(int which, int who); }
@@ -476,19 +476,31 @@
 292    UNIMPL          inotify_add_watch
 293    UNIMPL          inotify_rm_watch
 294    UNIMPL          migrate_pages
-295    UNIMPL          openat
-296    UNIMPL          mkdirat
-297    UNIMPL          mknodat
-298    UNIMPL          fchownat
+295    STD             { int|linux_sys||openat(int fd, const char *path, \
+                           int flags, ... linux_umode_t mode); }
+296    NOARGS          { int|sys||mkdirat(int fd, const char *path, \
+                           linux_umode_t mode); }
+297    STD             { int|linux_sys||mknodat(int fd, const char *path, \
+                           linux_umode_t mode, unsigned dev); }
+298    STD             { int|linux_sys||fchownat(int fd, const char *path, \
+                           uid_t owner, gid_t group, int flag); }
 299    UNIMPL          futimesat
-300    UNIMPL          fstatat64
-301    UNIMPL          unlinkat
-302    UNIMPL          renameat
-303    UNIMPL          linkat
-304    UNIMPL          symlinkat
-305    UNIMPL          readlinkat
-306    UNIMPL          fchmodat
-307    UNIMPL          faccessat
+300    STD             { int|linux_sys||fstatat64(int fd, const char *path, \
+                           struct linux_stat64 *sp, int flag); }
+301    STD             { int|linux_sys||unlinkat(int fd, const char *path, \
+                           int flag); }
+302    NOARGS          { int|sys||renameat(int fromfd, const char *from, \
+                           int tofd, const char *to); }
+303    STD             { int|linux_sys||linkat(int fd1, const char *name1, \
+                           int fd2, const char *name2, int flags); }
+304    NOARGS          { int|sys||symlinkat(const char *path1, int fd, \
+                           const char *path2); }
+305    NOARGS          { int|sys||readlinkat(int fd, const char *path, \
+                           char *buf, size_t bufsize); }
+306    STD             { int|linux_sys||fchmodat(int fd, const char *path, \
+                           linux_umode_t mode); }
+307    STD             { int|linux_sys||faccessat(int fd, const char *path, \
+                           int amode); }
 308    UNIMPL          pselect6
 309    STD             { int|linux_sys||ppoll(struct pollfd *fds, int nfds, \
                            struct linux_timespec *timeout, \
@@ -525,3 +537,16 @@
 335    UNIMPL          rt_tgsigqueueinfo
 336    UNIMPL          perf_counter_open
 337    UNIMPL          recvmmsg
+338    UNIMPL          fanotify_init
+339    UNIMPL          fanotify_mark
+340    UNIMPL          prlimit64
+341    UNIMPL          name_to_handle_at
+342    UNIMPL          open_by_handle_at
+343    UNIMPL          clock_adjtime
+344    UNIMPL          syncfs
+345    UNIMPL          sendmmsg
+346    UNIMPL          setns
+347    UNIMPL          process_vm_readv
+348    UNIMPL          process_vm_writev
+349    UNIMPL          kcmp
+350    UNIMPL          finit_module
diff -r 045d61e3f818 -r fa2576adb8f4 sys/compat/linux/common/linux_file.c
--- a/sys/compat/linux/common/linux_file.c      Mon Nov 18 01:32:32 2013 +0000
+++ b/sys/compat/linux/common/linux_file.c      Mon Nov 18 01:32:52 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_file.c,v 1.105 2013/09/24 13:27:50 njoly Exp $   */
+/*     $NetBSD: linux_file.c,v 1.106 2013/11/18 01:32:52 chs Exp $     */
 
 /*-
  * Copyright (c) 1995, 1998, 2008 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_file.c,v 1.105 2013/09/24 13:27:50 njoly Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_file.c,v 1.106 2013/11/18 01:32:52 chs Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -155,6 +155,32 @@
        return sys_open(l, &oa, retval);
 }
 
+static void
+linux_open_ctty(struct lwp *l, int flags, int fd)
+{
+       struct proc *p = l->l_proc;
+
+       /*
+        * this bit from sunos_misc.c (and svr4_fcntl.c).
+        * If we are a session leader, and we don't have a controlling
+        * terminal yet, and the O_NOCTTY flag is not set, try to make
+        * this the controlling terminal.
+        */
+        if (!(flags & O_NOCTTY) && SESS_LEADER(p) && !(p->p_lflag & PL_CONTROLT)) {
+                file_t *fp;
+
+               fp = fd_getfile(fd);
+
+                /* ignore any error, just give it a try */
+                if (fp != NULL) {
+                       if (fp->f_type == DTYPE_VNODE) {
+                               (fp->f_ops->fo_ioctl) (fp, TIOCSCTTY, NULL);
+                       }
+                       fd_putfile(fd);
+               }
+        }
+}
+
 /*
  * open(2). Take care of the different flag values, and let the
  * NetBSD syscall do the real work. See if this operation
@@ -169,7 +195,6 @@
                syscallarg(int) flags;
                syscallarg(int) mode;
        } */



Home | Main Index | Thread Index | Old Index