[BACK]Return to kern_ipc_10.c CVS log [TXT][DIR] Up to [local] / sys / compat / common

Annotation of sys/compat/common/kern_ipc_10.c, Revision 1.1.1.1

1.1       nbrk        1: /*     $OpenBSD: kern_ipc_10.c,v 1.8 2004/05/05 05:18:17 mickey Exp $  */
                      2: /*     $NetBSD: kern_ipc_10.c,v 1.4 1995/10/07 06:26:25 mycroft Exp $  */
                      3:
                      4: /*
                      5:  * Copyright (c) 1994 Adam Glass and Charles Hannum.  All rights reserved.
                      6:  *
                      7:  * Redistribution and use in source and binary forms, with or without
                      8:  * modification, are permitted provided that the following conditions
                      9:  * are met:
                     10:  * 1. Redistributions of source code must retain the above copyright
                     11:  *    notice, this list of conditions and the following disclaimer.
                     12:  * 2. Redistributions in binary form must reproduce the above copyright
                     13:  *    notice, this list of conditions and the following disclaimer in the
                     14:  *    documentation and/or other materials provided with the distribution.
                     15:  * 3. All advertising materials mentioning features or use of this software
                     16:  *    must display the following acknowledgement:
                     17:  *     This product includes software developed by Adam Glass and Charles
                     18:  *     Hannum.
                     19:  * 4. The names of the authors may not be used to endorse or promote products
                     20:  *    derived from this software without specific prior written permission.
                     21:  *
                     22:  * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
                     23:  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
                     24:  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
                     25:  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
                     26:  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
                     27:  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
                     28:  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
                     29:  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
                     30:  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
                     31:  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
                     32:  */
                     33:
                     34: #include <sys/param.h>
                     35: #include <sys/systm.h>
                     36: #include <sys/kernel.h>
                     37: #include <sys/proc.h>
                     38: #include <sys/sem.h>
                     39: #include <sys/malloc.h>
                     40:
                     41: #include <sys/mount.h>
                     42: #include <sys/syscallargs.h>
                     43:
                     44: #include <uvm/uvm_extern.h>
                     45:
                     46: /*
                     47:  * Note that while we no longer have a COMPAT_10 kernel option,
                     48:  * there are other COMPAT_* options that need these old functions.
                     49:  */
                     50:
                     51: #if defined(SYSVSEM) && !defined(__LP64__)
                     52: int
                     53: compat_10_sys_semsys(p, v, retval)
                     54:        struct proc *p;
                     55:        void *v;
                     56:        register_t *retval;
                     57: {
                     58:        struct compat_10_sys_semsys_args /* {
                     59:                syscallarg(int) which;
                     60:                syscallarg(int) a2;
                     61:                syscallarg(int) a3;
                     62:                syscallarg(int) a4;
                     63:                syscallarg(int) a5;
                     64:        } */ *uap = v;
                     65:        struct sys___semctl_args /* {
                     66:                syscallarg(int) semid;
                     67:                syscallarg(int) semnum;
                     68:                syscallarg(int) cmd;
                     69:                syscallarg(union semun *) arg;
                     70:        } */ __semctl_args;
                     71:        struct sys_semget_args /* {
                     72:                syscallarg(key_t) key;
                     73:                syscallarg(int) nsems;
                     74:                syscallarg(int) semflg;
                     75:        } */ semget_args;
                     76:        struct sys_semop_args /* {
                     77:                syscallarg(int) semid;
                     78:                syscallarg(struct sembuf *) sops;
                     79:                syscallarg(u_int) nsops;
                     80:        } */ semop_args;
                     81:
                     82:        switch (SCARG(uap, which)) {
                     83:        case 0:                                         /* __semctl() */
                     84:                SCARG(&__semctl_args, semid) = SCARG(uap, a2);
                     85:                SCARG(&__semctl_args, semnum) = SCARG(uap, a3);
                     86:                SCARG(&__semctl_args, cmd) = SCARG(uap, a4);
                     87:                SCARG(&__semctl_args, arg) = (union semun *)SCARG(uap, a5);
                     88:                return (sys___semctl(p, &__semctl_args, retval));
                     89:
                     90:        case 1:                                         /* semget() */
                     91:                SCARG(&semget_args, key) = SCARG(uap, a2);
                     92:                SCARG(&semget_args, nsems) = SCARG(uap, a3);
                     93:                SCARG(&semget_args, semflg) = SCARG(uap, a4);
                     94:                return (sys_semget(p, &semget_args, retval));
                     95:
                     96:        case 2:                                         /* semop() */
                     97:                SCARG(&semop_args, semid) = SCARG(uap, a2);
                     98:                SCARG(&semop_args, sops) = (struct sembuf *)SCARG(uap, a3);
                     99:                SCARG(&semop_args, nsops) = SCARG(uap, a4);
                    100:                return (sys_semop(p, &semop_args, retval));
                    101:
                    102:        default:
                    103:                return (EINVAL);
                    104:        }
                    105: }
                    106:
                    107: int
                    108: compat_10_sys_shmsys(p, v, retval)
                    109:        struct proc *p;
                    110:        void *v;
                    111:        register_t *retval;
                    112: {
                    113:        struct compat_10_sys_shmsys_args /* {
                    114:                syscallarg(int) which;
                    115:                syscallarg(int) a2;
                    116:                syscallarg(int) a3;
                    117:                syscallarg(int) a4;
                    118:        } */ *uap = v;
                    119:        struct sys_shmat_args /* {
                    120:                syscallarg(int) shmid;
                    121:                syscallarg(void *) shmaddr;
                    122:                syscallarg(int) shmflg;
                    123:        } */ shmat_args;
                    124:        struct sys_shmctl_args /* {
                    125:                syscallarg(int) shmid;
                    126:                syscallarg(int) cmd;
                    127:                syscallarg(struct shmid_ds *) buf;
                    128:        } */ shmctl_args;
                    129:        struct sys_shmdt_args /* {
                    130:                syscallarg(void *) shmaddr;
                    131:        } */ shmdt_args;
                    132:        struct sys_shmget_args /* {
                    133:                syscallarg(key_t) key;
                    134:                syscallarg(int) size;
                    135:                syscallarg(int) shmflg;
                    136:        } */ shmget_args;
                    137:
                    138:        switch (SCARG(uap, which)) {
                    139:        case 0:                                         /* shmat() */
                    140:                SCARG(&shmat_args, shmid) = SCARG(uap, a2);
                    141:                SCARG(&shmat_args, shmaddr) = (void *)SCARG(uap, a3);
                    142:                SCARG(&shmat_args, shmflg) = SCARG(uap, a4);
                    143:                return (sys_shmat(p, &shmat_args, retval));
                    144:
                    145:        case 1:                                         /* shmctl() */
                    146:                SCARG(&shmctl_args, shmid) = SCARG(uap, a2);
                    147:                SCARG(&shmctl_args, cmd) = SCARG(uap, a3);
                    148:                SCARG(&shmctl_args, buf) = (struct shmid_ds *)SCARG(uap, a4);
                    149:                return (sys_shmctl(p, &shmctl_args, retval));
                    150:
                    151:        case 2:                                         /* shmdt() */
                    152:                SCARG(&shmdt_args, shmaddr) = (void *)SCARG(uap, a2);
                    153:                return (sys_shmdt(p, &shmdt_args, retval));
                    154:
                    155:        case 3:                                         /* shmget() */
                    156:                SCARG(&shmget_args, key) = SCARG(uap, a2);
                    157:                SCARG(&shmget_args, size) = SCARG(uap, a3);
                    158:                SCARG(&shmget_args, shmflg) = SCARG(uap, a4);
                    159:                return (sys_shmget(p, &shmget_args, retval));
                    160:
                    161:        default:
                    162:                return (EINVAL);
                    163:        }
                    164: }
                    165:
                    166: int
                    167: compat_10_sys_msgsys(p, v, retval)
                    168:        struct proc *p;
                    169:        void *v;
                    170:        register_t *retval;
                    171: {
                    172:        struct compat_10_sys_msgsys_args /* {
                    173:                syscallarg(int) which;
                    174:                syscallarg(int) a2;
                    175:                syscallarg(int) a3;
                    176:                syscallarg(int) a4;
                    177:                syscallarg(int) a5;
                    178:                syscallarg(int) a6;
                    179:        } */ *uap = v;
                    180:        struct sys_msgctl_args /* {
                    181:                syscallarg(int) msqid;
                    182:                syscallarg(int) cmd;
                    183:                syscallarg(struct msqid_ds *) buf;
                    184:        } */ msgctl_args;
                    185:        struct sys_msgget_args /* {
                    186:                syscallarg(key_t) key;
                    187:                syscallarg(int) msgflg;
                    188:        } */ msgget_args;
                    189:        struct sys_msgsnd_args /* {
                    190:                syscallarg(int) msqid;
                    191:                syscallarg(void *) msgp;
                    192:                syscallarg(size_t) msgsz;
                    193:                syscallarg(int) msgflg;
                    194:        } */ msgsnd_args;
                    195:        struct sys_msgrcv_args /* {
                    196:                syscallarg(int) msqid;
                    197:                syscallarg(void *) msgp;
                    198:                syscallarg(size_t) msgsz;
                    199:                syscallarg(long) msgtyp;
                    200:                syscallarg(int) msgflg;
                    201:        } */ msgrcv_args;
                    202:
                    203:        switch (SCARG(uap, which)) {
                    204:        case 0:                                 /* msgctl()*/
                    205:                SCARG(&msgctl_args, msqid) = SCARG(uap, a2);
                    206:                SCARG(&msgctl_args, cmd) = SCARG(uap, a3);
                    207:                SCARG(&msgctl_args, buf) =
                    208:                    (struct msqid_ds *)SCARG(uap, a4);
                    209:                return (sys_msgctl(p, &msgctl_args, retval));
                    210:
                    211:        case 1:                                 /* msgget() */
                    212:                SCARG(&msgget_args, key) = SCARG(uap, a2);
                    213:                SCARG(&msgget_args, msgflg) = SCARG(uap, a3);
                    214:                return (sys_msgget(p, &msgget_args, retval));
                    215:
                    216:        case 2:                                 /* msgsnd() */
                    217:                SCARG(&msgsnd_args, msqid) = SCARG(uap, a2);
                    218:                SCARG(&msgsnd_args, msgp) = (void *)SCARG(uap, a3);
                    219:                SCARG(&msgsnd_args, msgsz) = SCARG(uap, a4);
                    220:                SCARG(&msgsnd_args, msgflg) = SCARG(uap, a5);
                    221:                return (sys_msgsnd(p, &msgsnd_args, retval));
                    222:
                    223:        case 3:                                 /* msgrcv() */
                    224:                SCARG(&msgrcv_args, msqid) = SCARG(uap, a2);
                    225:                SCARG(&msgrcv_args, msgp) = (void *)SCARG(uap, a3);
                    226:                SCARG(&msgrcv_args, msgsz) = SCARG(uap, a4);
                    227:                SCARG(&msgrcv_args, msgtyp) = SCARG(uap, a5);
                    228:                SCARG(&msgrcv_args, msgflg) = SCARG(uap, a6);
                    229:                return (sys_msgrcv(p, &msgrcv_args, retval));
                    230:
                    231:        default:
                    232:                return (EINVAL);
                    233:        }
                    234: }
                    235: #endif

CVSweb