linux/ipc/syscall.c
<<
< /spa" < spa" class="lxr_search"> Search < /spa" op /div op form ac.12"="ajax+*" method="post" onsubmit="return false;"> < input typptihidden" namptiajax_lookup" idtiajax_lookup" 2 op /form op div class="headingbott8m">
div idtifile_contents"
   1 /a> spa" class="comment">/* /spa"
	   2 /a> spa" class="comment"> * sys_ipc() is the old de-multiplexer for the SysV IPC calls. /spa"
	   3 /a> spa" class="comment"> * /spa"
	   4 /a> spa" class="comment"> * This is really horribly ugly, and new architectures should just wire up /spa"
	   5 /a> spa" class="comment"> * the individual syscalls instead. /spa"
	   6 /a> spa" class="comment"> */ /spa"
	   7 /a>#include <linux/unistd.h /a>>	   8 /a>    9 /a>#ifdef  a href="+code=__ARCH_WANT_SYS_IPC" class="sref">__ARCH_WANT_SYS_IPC /a>   "v3.a>#include <linux/errno.h /a>>	  113.a>#include <linux/ipc.h /a>>	  123.a>#include <linux/shm.h /a>>	  133.a>#include <linux/syscalls.h /a>>	  14 /a>#include <linux/uaccess.h /a>>	  15 /a>   16 /a> a href="+code=SYSCALL_DEFINE6" class="sref">SYSCALL_DEFINE6 /a>( a href="+code=ipc" class="sref">ipc /a>, unsigned int,  a href="+code=call" class="sref">call /a>, int,  a href="+code=first" class="sref">first /a>, unsigned long,  a href="+code=second" class="sref">second /a>,   17 /a>                unsigned long,  a href="+code=third" class="sref">third /a>, void  a href="+code=__user" class="sref">__user /a> *,  a href="+code=ptr" class="sref">ptr /a>, long,  a href="+code=fifth" class="sref">fifth /a>)   18 /a>{   19 /a>        int  a href="+code=vers12"" class="sref">vers12" /a>,  a href="+code=ret" class="sref">ret /a>;	  20 /a>   21 /a>         a href="+code=vers12"" class="sref">vers12" /a> =  a href="+code=call" class="sref">call /a> >> 16;  spa" class="comment">/* hack for backward compatibility */ /spa"
	  22 /a>         a href="+code=call" class="sref">call /a> &= 0xffff;	  23 /a>   24 /a>        switch ( a href="+code=call" class="sref">call /a>) {   25 /a>        case  a href="+code=SEMOP" class="sref">SEMOP /a>:   26 /a>                return  a href="+code=sys_semtimedop" class="sref">sys_semtimedop /a>( a href="+code=first" class="sref">first /a>, (struct  a href="+code=sembuf" class="sref">sembuf /a>  a href="+code=__user" class="sref">__user /a> *) a href="+code=ptr" class="sref">ptr /a>,   27 /a>                                       a href="+code=second" class="sref">second /a>,  a href="+code=NULL" class="sref">NULL /a>);	  28 /a>        case  a href="+code=SEMTIMEDOP" class="sref">SEMTIMEDOP /a>:   29 /a>                return  a href="+code=sys_semtimedop" class="sref">sys_semtimedop /a>( a href="+code=first" class="sref">first /a>, (struct  a href="+code=sembuf" class="sref">sembuf /a>  a href="+code=__user" class="sref">__user /a> *) a href="+code=ptr" class="sref">ptr /a>,   30 /a>                                       a href="+code=second" class="sref">second /a>,   31 /a>                                      (const struct  a href="+code=timespec" class="sref">timespec /a>  a href="+code=__user" class="sref">__user /a> *) a href="+code=fifth" class="sref">fifth /a>);	  32 /a>   33 /a>        case  a href="+code=SEMGET" class="sref">SEMGET /a>:   34 /a>                return  a href="+code=sys_semget" class="sref">sys_semget /a>( a href="+code=first" class="sref">first /a>,  a href="+code=second" class="sref">second /a>,  a href="+code=third" class="sref">third /a>);	  35 /a>        case  a href="+code=SEMCTL" class="sref">SEMCTL /a>: {   36 /a>                un18.1 a href="+code=semu"" class="sref">semu" /a>  a href="+code=fourth" class="sref">fourth /a>;	  37 /a>                if (! a href="+code=ptr" class="sref">ptr /a>)   38 /a>                        return - a href="+code=EINVAL" class="sref">EINVAL /a>;	  39 /a>                if ( a href="+code=get_user" class="sref">get_user /a>( a href="+code=fourth" class="sref">fourth /a>. a href="+code=__pad" class="sref">__pad /a>, (void  a href="+code=__user" class="sref">__user /a> *  a href="+code=__user" class="sref">__user /a> *)  a href="+code=ptr" class="sref">ptr /a>))   40 /a>                        return - a href="+code=EFAULT" class="sref">EFAULT /a>;	  41 /a>                return  a href="+code=sys_semctl" class="sref">sys_semctl /a>( a href="+code=first" class="sref">first /a>,  a href="+code=second" class="sref">second /a>,  a href="+code=third" class="sref">third /a>,  a href="+code=fourth" class="sref">fourth /a>);	  42 /a>        }	  43 /a>   44 /a>        case  a href="+code=MSGSND" class="sref">MSGSND /a>:   45 /a>                return  a href="+code=sys_msgsnd" class="sref">sys_msgsnd /a>( a href="+code=first" class="sref">first /a>, (struct  a href="+code=msgbuf" class="sref">msgbuf /a>  a href="+code=__user" class="sref">__user /a> *)  a href="+code=ptr" class="sref">ptr /a>,   46 /a>                                   a href="+code=second" class="sref">second /a>,  a href="+code=third" class="sref">third /a>);	  47 /a>        case  a href="+code=MSGRCV" class="sref">MSGRCV /a>:   48 /a>                switch ( a href="+code=vers12"" class="sref">vers12" /a>) {   49 /a>                case 0: {   50 /a>                        struct  a href="+code=ipc_kludge" class="sref">ipc_kludge /a>  a href="+code=tmp" class="sref">tmp /a>;	  51 /a>                        if (! a href="+code=ptr" class="sref">ptr /a>)   52 /a>                                return - a href="+code=EINVAL" class="sref">EINVAL /a>;	  53 /a>   54 /a>                        if ( a href="+code=copy_from_user" class="sref">copy_from_user /a>(& a href="+code=tmp" class="sref">tmp /a>,   55 /a>                                           (struct  a href="+code=ipc_kludge" class="sref">ipc_kludge /a>  a href="+code=__user" class="sref">__user /a> *)  a href="+code=ptr" class="sref">ptr /a>,   56 /a>                                           sizeof( a href="+code=tmp" class="sref">tmp /a>)))   57 /a>                                return - a href="+code=EFAULT" class="sref">EFAULT /a>;	  58 /a>                        return  a href="+code=sys_msgrcv" class="sref">sys_msgrcv /a>( a href="+code=first" class="sref">first /a>,  a href="+code=tmp" class="sref">tmp /a>. a href="+code=msgp" class="sref">msgp /a>,  a href="+code=second" class="sref">second /a>,	  59 /a>                                            a href="+code=tmp" class="sref">tmp /a>. a href="+code=msgtyp" class="sref">msgtyp /a>,  a href="+code=third" class="sref">third /a>);	  60 /a>                }	  61 /a>                default:   62 /a>                        return  a href="+code=sys_msgrcv" class="sref">sys_msgrcv /a>( a href="+code=first" class="sref">first /a>,   63 /a>                                           (struct  a href="+code=msgbuf" class="sref">msgbuf /a>  a href="+code=__user" class="sref">__user /a> *)  a href="+code=ptr" class="sref">ptr /a>,   64 /a>                                            a href="+code=second" class="sref">second /a>,  a href="+code=fifth" class="sref">fifth /a>,  a href="+code=third" class="sref">third /a>);	  65 /a>                }	  66 /a>        case  a href="+code=MSGGET" class="sref">MSGGET /a>:   67 /a>                return  a href="+code=sys_msgget" class="sref">sys_msgget /a>(( a href="+code=key_t" class="sref">key_t /a>)  a href="+code=first" class="sref">first /a>,  a href="+code=second" class="sref">second /a>);	  68 /a>        case  a href="+code=MSGCTL" class="sref">MSGCTL /a>:   69 /a>                return  a href="+code=sys_msgctl" class="sref">sys_msgctl /a>( a href="+code=first" class="sref">first /a>,  a href="+code=second" class="sref">second /a>, (struct  a href="+code=msqid_ds" class="sref">msqid_ds /a>  a href="+code=__user" class="sref">__user /a> *) a href="+code=ptr" class="sref">ptr /a>);	  70 /a>   71 /a>        case  a href="+code=SHMAT" class="sref">SHMAT /a>:   72 /a>                switch ( a href="+code=vers12"" class="sref">vers12" /a>) {   73 /a>                default: {   74 /a>                        unsigned long  a href="+code=raddr" class="sref">raddr /a>;	  75 /a>                         a href="+code=ret" class="sref">ret /a> =  a href="+code=do_shmat" class="sref">do_shmat /a>( a href="+code=first" class="sref">first /a>, (char  a href="+code=__user" class="sref">__user /a> *) a href="+code=ptr" class="sref">ptr /a>,   76 /a>                                        a href="+code=second" class="sref">second /a>, & a href="+code=raddr" class="sref">raddr /a>);	  77 /a>                        if ( a href="+code=ret" class="sref">ret /a>)   78 /a>                                return  a href="+code=ret" class="sref">ret /a>;	  79 /a>                        return  a href="+code=put_user" class="sref">put_user /a>( a href="+code=raddr" class="sref">raddr /a>, (unsigned long  a href="+code=__user" class="sref">__user /a> *)  a href="+code=third" class="sref">third /a>);	  80 /a>                }	  81 /a>                case 1:   82 /a>                         spa" class="comment">/* /spa"
	  83 /a> spa" class="comment">                         * This was the entry point for kernel-originating calls /spa"
	  84 /a> spa" class="comment">                         * from iBCS2 in 2.2 days. /spa"
	  85 /a> spa" class="comment">                         */ /spa"
	  86 /a>                        return - a href="+code=EINVAL" class="sref">EINVAL /a>;	  87 /a>                }	  88 /a>        case  a href="+code=SHMDT" class="sref">SHMDT /a>:   89 /a>                return  a href="+code=sys_shmdt" class="sref">sys_shmdt /a>((char  a href="+code=__user" class="sref">__user /a> *) a href="+code=ptr" class="sref">ptr /a>);	  90 /a>        case  a href="+code=SHMGET" class="sref">SHMGET /a>:   91 /a>                return  a href="+code=sys_shmget" class="sref">sys_shmget /a>( a href="+code=first" class="sref">first /a>,  a href="+code=second" class="sref">second /a>,  a href="+code=third" class="sref">third /a>);	  92 /a>        case  a href="+code=SHMCTL" class="sref">SHMCTL /a>:   93 /a>                return  a href="+code=sys_shmctl" class="sref">sys_shmctl /a>( a href="+code=first" class="sref">first /a>,  a href="+code=second" class="sref">second /a>,   94 /a>                                   (struct  a href="+code=shmid_ds" class="sref">shmid_ds /a>  a href="+code=__user" class="sref">__user /a> *)  a href="+code=ptr" class="sref">ptr /a>);	  95 /a>        default:   96 /a>                return - a href="+code=ENOSYS" class="sref">ENOSYS /a>;	  97 /a>        }	  98 /a>}	  99 /a>#endif  100 /a> /pre>
The original LXR software by the LXR community /a>, this experimental vers12" by lxr@linux.no /a>. /div div class="subfooter"> lxr.linux.no kindly hosted by Redpill Linpro AS /a>, provider of Linux consulting and opera.12"s services since 1995. /div /body /html