Source-Changes-HG archive

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

[src/trunk]: src/sys/kern __semctl13 -> ____semctl13 because this now is not ...



details:   https://anonhg.NetBSD.org/src/rev/2fcce4f64283
branches:  trunk
changeset: 481453:2fcce4f64283
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Jan 31 15:12:30 2000 +0000

description:
__semctl13 -> ____semctl13 because this now is not called directly.
The fourth argument to it is a pointer to union semun not union semun,
because passing structs and unions to syscalls cannot be handled portably.

diffstat:

 sys/kern/syscalls.master |   8 ++++----
 sys/kern/sysv_sem.c      |  29 +++++++++++++++++++----------
 2 files changed, 23 insertions(+), 14 deletions(-)

diffs (93 lines):

diff -r 7a6b4d7ed3b8 -r 2fcce4f64283 sys/kern/syscalls.master
--- a/sys/kern/syscalls.master  Mon Jan 31 15:10:34 2000 +0000
+++ b/sys/kern/syscalls.master  Mon Jan 31 15:12:30 2000 +0000
@@ -1,4 +1,4 @@
-       $NetBSD: syscalls.master,v 1.98 2000/01/23 01:01:30 mycroft Exp $
+       $NetBSD: syscalls.master,v 1.99 2000/01/31 15:12:30 christos Exp $
 
 ;      @(#)syscalls.master     8.2 (Berkeley) 1/13/94
 
@@ -566,10 +566,10 @@
 300    STD             { int sys_fhstatfs(const fhandle_t *fhp, \
                            struct statfs *buf); }
 #if defined(SYSVSEM) || !defined(_KERNEL)
-301    STD             { int sys___semctl13(int semid, int semnum, int cmd, \
-                           ... union __semun arg); }
+301    STD             { int sys_____semctl13(int semid, int semnum, int cmd, \
+                           ... union __semun *arg); }
 #else
-301    EXCL            __semctl13
+301    EXCL            ____semctl13
 #endif
 #if defined(SYSVMSG) || !defined(_KERNEL)
 302    STD             { int sys___msgctl13(int msqid, int cmd, \
diff -r 7a6b4d7ed3b8 -r 2fcce4f64283 sys/kern/sysv_sem.c
--- a/sys/kern/sysv_sem.c       Mon Jan 31 15:10:34 2000 +0000
+++ b/sys/kern/sysv_sem.c       Mon Jan 31 15:12:30 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sysv_sem.c,v 1.33 1999/08/25 05:05:49 thorpej Exp $    */
+/*     $NetBSD: sysv_sem.c,v 1.34 2000/01/31 15:12:30 christos Exp $   */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -322,20 +322,21 @@
 }
 
 int
-sys___semctl13(p, v, retval)
+sys_____semctl13(p, v, retval)
        struct proc *p;
        void *v;
        register_t *retval;
 {
-       struct sys___semctl13_args /* {
+       struct sys_____semctl13_args /* {
                syscallarg(int) semid;
                syscallarg(int) semnum;
                syscallarg(int) cmd;
-               syscallarg(union __semun) arg;
+               syscallarg(union __semun *) arg;
        } */ *uap = v;
        struct semid_ds sembuf;
        int cmd, error;
-       void *pass_arg = NULL;
+       void *pass_arg;
+       union __semun karg;
 
        cmd = SCARG(uap, cmd);
 
@@ -348,21 +349,29 @@
        case GETALL:
        case SETVAL:
        case SETALL:
-               pass_arg = &SCARG(uap, arg);
+               pass_arg = &karg;
+               break;
+       default:
+               pass_arg = NULL;
                break;
        }
 
-       if (cmd == IPC_SET) {
-               error = copyin(SCARG(uap, arg).buf, &sembuf, sizeof(sembuf));
+       if (pass_arg) {
+               error = copyin(SCARG(uap, arg), &karg, sizeof(karg));
                if (error)
-                       return (error);
+                       return error;
+               if (cmd == IPC_SET) {
+                       error = copyin(karg.buf, &sembuf, sizeof(sembuf));
+                       if (error)
+                               return (error);
+               }
        }
 
        error = semctl1(p, SCARG(uap, semid), SCARG(uap, semnum), cmd,
            pass_arg, retval);
 
        if (error == 0 && cmd == IPC_STAT)
-               error = copyout(&sembuf, SCARG(uap, arg).buf, sizeof(sembuf));
+               error = copyout(&sembuf, karg.buf, sizeof(sembuf));
 
        return (error);
 }



Home | Main Index | Thread Index | Old Index