Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Add syscall type NOERR which signals that a system ...



details:   https://anonhg.NetBSD.org/src/rev/44885b3e811a
branches:  trunk
changeset: 762491:44885b3e811a
user:      pooka <pooka%NetBSD.org@localhost>
date:      Mon Feb 21 23:20:19 2011 +0000

description:
Add syscall type NOERR which signals that a system call is STD but
does not return an errno the usual way.  The main use case is to
fix the posix_fadvise() rump stub (yes, posix_fadvise is a bit
special... bologna).

The list of NOERR syscalls currently matches the libc NOERR list
(and the libc Makefile can in the future be autogenerated from this
info).

Problem spotted by, *shocker*, the automated test runs, specifically
the posix_fadvise test.

diffstat:

 sys/kern/makesyscalls.sh |  29 ++++++++++++++++++++---------
 sys/kern/syscalls.master |  23 ++++++++++++-----------
 2 files changed, 32 insertions(+), 20 deletions(-)

diffs (157 lines):

diff -r 7f351ad6c44d -r 44885b3e811a sys/kern/makesyscalls.sh
--- a/sys/kern/makesyscalls.sh  Mon Feb 21 22:54:45 2011 +0000
+++ b/sys/kern/makesyscalls.sh  Mon Feb 21 23:20:19 2011 +0000
@@ -1,5 +1,5 @@
 #! /bin/sh -
-#      $NetBSD: makesyscalls.sh,v 1.110 2011/02/21 11:29:53 pooka Exp $
+#      $NetBSD: makesyscalls.sh,v 1.111 2011/02/21 23:20:19 pooka Exp $
 #
 # Copyright (c) 1994, 1996, 2000 Christopher G. Demetriou
 # All rights reserved.
@@ -717,7 +717,8 @@
            > sysnamesbottom
 
        # output syscall number of header, if appropriate
-       if (type == "STD" || type == "NOARGS" || type == "INDIR") {
+       if (type == "STD" || type == "NOARGS" || type == "INDIR" || \
+           type == "NOERR") {
                # output a prototype, to be used to generate lint stubs in
                # libc.
                printproto("")
@@ -776,8 +777,9 @@
        }
        printf("%s %s)\n", uncompattype(argtype[argc]), argname[argc]) \
            > rumpcalls
-       printf("{\n\tregister_t rval[2] = {0, 0};\n\tint error = 0;\n") \
-           > rumpcalls
+       printf("{\n\tregister_t rval[2] = {0, 0};\n") > rumpcalls
+       if (returntype != "void")
+               printf("\tint error = 0;\n") > rumpcalls
 
        argarg = "NULL"
        argsize = 0;
@@ -805,20 +807,29 @@
        } else {
                printf("\n") > rumpcalls
        }
-       printf("\terror = rsys_syscall(%s%s%s, " \
+       printf("\t") > rumpcalls
+       if (returntype != "void")
+               printf("error = ") > rumpcalls
+       printf("rsys_syscall(%s%s%s, " \
            "%s, %s, rval);\n", constprefix, compatwrap_, funcalias, \
            argarg, argsize) > rumpcalls
-       printf("\trsys_seterrno(error);\n") > rumpcalls
-       printf("\tif (error) {\n\t\trval[0] = -1;\n\t}\n") > rumpcalls
+       if (type != "NOERR") {
+               printf("\trsys_seterrno(error);\n") > rumpcalls
+               printf("\tif (error) {\n\t\trval[0] = -1;\n\t}\n") > rumpcalls
+               rvariable = "rval[0]";
+       } else {
+               rvariable = "error";
+       }
        if (returntype != "void") {
-               printf("\treturn rval[0];\n") > rumpcalls
+               printf("\treturn %s;\n", rvariable) > rumpcalls
        }
        printf("}\n") > rumpcalls
        printf("rsys_alias(%s%s,rump_enosys)\n", \
            compatwrap_, funcname) > rumpcalls
 
 }
-$2 == "STD" || $2 == "NODEF" || $2 == "NOARGS" || $2 == "INDIR" {
+$2 == "STD" || $2 == "NODEF" || $2 == "NOARGS" || $2 == "INDIR" \
+    || $2 == "NOERR" {
        parseline()
        putent($2, "")
        syscall++
diff -r 7f351ad6c44d -r 44885b3e811a sys/kern/syscalls.master
--- a/sys/kern/syscalls.master  Mon Feb 21 22:54:45 2011 +0000
+++ b/sys/kern/syscalls.master  Mon Feb 21 23:20:19 2011 +0000
@@ -1,4 +1,4 @@
-       $NetBSD: syscalls.master,v 1.244 2011/02/21 12:49:06 pooka Exp $
+       $NetBSD: syscalls.master,v 1.245 2011/02/21 23:20:19 pooka Exp $
 
 ;      @(#)syscalls.master     8.2 (Berkeley) 1/13/94
 
@@ -13,7 +13,7 @@
 ; Optional fields are specified after the type field
 ; (NOTE! they *must* be specified in this order):
 ;      MODULAR:attempt to autoload system call if not present
-;      RUMP:   the system call can be called directly from rumps
+;      RUMP:   generate rump syscall entry point
 ;
 ; types:
 ;      STD     always included
@@ -25,6 +25,7 @@
 ;      NOARGS  included, but don't define the syscall args structure
 ;      INDIR   included, but don't define the syscall args structure,
 ;              and allow it to be "really" varargs.
+;      NOERR   included, syscall does not set errno
 ;
 ; arguments:
 ;      PAD     argument not part of the C interface, used only for padding
@@ -90,13 +91,13 @@
                            long bufsize, int flags); }
 19     COMPAT_43 MODULAR { long|sys||lseek(int fd, long offset, int whence); }\
                            olseek
-20     STD     RUMP    { pid_t|sys||getpid_with_ppid(void); } getpid
+20     NOERR   RUMP    { pid_t|sys||getpid_with_ppid(void); } getpid
 21     COMPAT_40 MODULAR { int|sys||mount(const char *type, const char *path, \
                            int flags, void *data); }
 22     STD      RUMP   { int|sys||unmount(const char *path, int flags); }
 23     STD     RUMP    { int|sys||setuid(uid_t uid); }
-24     STD     RUMP    { uid_t|sys||getuid_with_euid(void); } getuid
-25     STD     RUMP    { uid_t|sys||geteuid(void); }
+24     NOERR   RUMP    { uid_t|sys||getuid_with_euid(void); } getuid
+25     NOERR   RUMP    { uid_t|sys||geteuid(void); }
 26     STD             { int|sys||ptrace(int req, pid_t pid, void *addr, \
                            int data); }
 27     STD     RUMP    { ssize_t|sys||recvmsg(int s, struct msghdr *msg, \
@@ -115,16 +116,16 @@
 33     STD     RUMP    { int|sys||access(const char *path, int flags); }
 34     STD      RUMP   { int|sys||chflags(const char *path, u_long flags); }
 35     STD     RUMP    { int|sys||fchflags(int fd, u_long flags); }
-36     STD      RUMP   { void|sys||sync(void); }
+36     NOERR    RUMP   { void|sys||sync(void); }
 37     STD             { int|sys||kill(pid_t pid, int signum); }
 38     COMPAT_43 MODULAR { int|sys||stat(const char *path, struct stat43 *ub); } \
                            stat43
-39     STD     RUMP    { pid_t|sys||getppid(void); }
+39     NOERR   RUMP    { pid_t|sys||getppid(void); }
 40     COMPAT_43 MODULAR { int|sys||lstat(const char *path, \
                            struct stat43 *ub); } lstat43
 41     STD     RUMP    { int|sys||dup(int fd); }
 42     STD     RUMP    { int|sys||pipe(void); }
-43     STD     RUMP    { gid_t|sys||getegid(void); }
+43     NOERR   RUMP    { gid_t|sys||getegid(void); }
 44     STD             { int|sys||profil(char *samples, size_t size, \
                            u_long offset, u_int scale); }
 45     STD             { int|sys||ktrace(const char *fname, int ops, \
@@ -132,7 +133,7 @@
 46     COMPAT_13 MODULAR { int|sys||sigaction(int signum, \
                            const struct sigaction13 *nsa, \
                            struct sigaction13 *osa); } sigaction13
-47     STD     RUMP    { gid_t|sys||getgid_with_egid(void); } getgid
+47     NOERR   RUMP    { gid_t|sys||getgid_with_egid(void); } getgid
 48     COMPAT_13 MODULAR { int|sys||sigprocmask(int how, \
                            int mask); } sigprocmask13
 49     STD     RUMP    { int|sys||__getlogin(char *namebuf, size_t namelen); }
@@ -588,7 +589,7 @@
 303    EXCL            __shmctl13
 #endif
 304    STD      RUMP   { int|sys||lchflags(const char *path, u_long flags); }
-305    STD     RUMP    { int|sys||issetugid(void); }
+305    NOERR   RUMP    { int|sys||issetugid(void); }
 306    STD             { int|sys||utrace(const char *label, void *addr, \
                                size_t len); }
 307    STD             { int|sys||getcontext(struct __ucontext *ucp); }
@@ -789,7 +790,7 @@
                            psetid_t *opsid); }
 415    STD             { int|sys||_pset_bind(idtype_t idtype, id_t first_id, \
                            id_t second_id, psetid_t psid, psetid_t *opsid); }
-416    STD  RUMP       { int|sys|50|posix_fadvise(int fd, int PAD, \
+416    NOERR RUMP      { int|sys|50|posix_fadvise(int fd, int PAD, \
                            off_t offset, off_t len, int advice); }
 417    STD  RUMP       { int|sys|50|select(int nd, fd_set *in, fd_set *ou, \
                            fd_set *ex, struct timeval *tv); }



Home | Main Index | Thread Index | Old Index