The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/compat/netbsd32/netbsd32_compat_10.c

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

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

Cache object: 3b811830e248bea55981247c336ee265


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.