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/bsd/kern/sysv_ipc.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 /*
    2  * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
    3  *
    4  * @APPLE_LICENSE_HEADER_START@
    5  * 
    6  * Copyright (c) 1999-2003 Apple Computer, Inc.  All Rights Reserved.
    7  * 
    8  * This file contains Original Code and/or Modifications of Original Code
    9  * as defined in and that are subject to the Apple Public Source License
   10  * Version 2.0 (the 'License'). You may not use this file except in
   11  * compliance with the License. Please obtain a copy of the License at
   12  * http://www.opensource.apple.com/apsl/ and read it before using this
   13  * file.
   14  * 
   15  * The Original Code and all software distributed under the License are
   16  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
   17  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
   18  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
   19  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
   20  * Please see the License for the specific language governing rights and
   21  * limitations under the License.
   22  * 
   23  * @APPLE_LICENSE_HEADER_END@
   24  */
   25 /*      $NetBSD: sysv_ipc.c,v 1.7 1994/06/29 06:33:11 cgd Exp $ */
   26 
   27 /*
   28  * Copyright (c) 1994 Herb Peyerl <hpeyerl@novatel.ca>
   29  * All rights reserved.
   30  *
   31  * Redistribution and use in source and binary forms, with or without
   32  * modification, are permitted provided that the following conditions
   33  * are met:
   34  * 1. Redistributions of source code must retain the above copyright
   35  *    notice, this list of conditions and the following disclaimer.
   36  * 2. Redistributions in binary form must reproduce the above copyright
   37  *    notice, this list of conditions and the following disclaimer in the
   38  *    documentation and/or other materials provided with the distribution.
   39  * 3. All advertising materials mentioning features or use of this software
   40  *    must display the following acknowledgement:
   41  *      This product includes software developed by Herb Peyerl.
   42  * 4. The name of Herb Peyerl may not be used to endorse or promote products
   43  *    derived from this software without specific prior written permission.
   44  *
   45  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
   46  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   47  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   48  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
   49  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
   50  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   51  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   52  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   53  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   54  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   55  */
   56 
   57 
   58 #include <sys/param.h>
   59 #include <sys/ipc.h>
   60 #include <sys/ucred.h>
   61 
   62 
   63 /*
   64  * Check for ipc permission
   65  *
   66  * XXX: Should pass proc argument so that we can pass 
   67  * XXX: proc->p_acflag to suser()
   68  */
   69 
   70 int
   71 ipcperm(cred, perm, mode)
   72         struct ucred *cred;
   73         struct ipc_perm *perm;
   74         int mode;
   75 {
   76 
   77         if (!suser(cred, (u_short *)NULL))
   78                 return (0);
   79 
   80         /* Check for user match. */
   81         if (cred->cr_uid != perm->cuid && cred->cr_uid != perm->uid) {
   82                 if (mode & IPC_M)
   83                         return (EPERM);
   84                 /* Check for group match. */
   85                 mode >>= 3;
   86                 if (!groupmember(perm->gid, cred) &&
   87                     !groupmember(perm->cgid, cred))
   88                         /* Check for `other' match. */
   89                         mode >>= 3;
   90         }
   91 
   92         if (mode & IPC_M)
   93                 return (0);
   94         return ((mode & perm->mode) == mode ? 0 : EACCES);
   95 }
   96 
   97 
   98 
   99 /*
  100  * SYSVMSG stubs
  101  */
  102 
  103 int
  104 msgsys(p, uap)
  105         struct proc *p;
  106         /* XXX actually varargs. */
  107 #if 0
  108         struct msgsys_args *uap;
  109 #else
  110         void *uap;
  111 #endif
  112 {
  113         return(EOPNOTSUPP);
  114 };
  115 
  116 int
  117 msgctl(p, uap)
  118         struct proc *p;
  119 #if 0
  120         register struct msgctl_args *uap;
  121 #else
  122         void *uap;
  123 #endif
  124 {
  125         return(EOPNOTSUPP);
  126 };
  127 
  128 int
  129 msgget(p, uap)
  130         struct proc *p;
  131 #if 0
  132         register struct msgget_args *uap;
  133 #else
  134         void *uap;
  135 #endif
  136 {
  137         return(EOPNOTSUPP);
  138 };
  139 
  140 int
  141 msgsnd(p, uap)
  142         struct proc *p;
  143 #if 0
  144         register struct msgsnd_args *uap;
  145 #else
  146         void *uap;
  147 #endif
  148 {
  149         return(EOPNOTSUPP);
  150 };
  151 
  152 int
  153 msgrcv(p, uap)
  154         struct proc *p;
  155 #if 0
  156         register struct msgrcv_args *uap;
  157 #else
  158         void *uap;
  159 #endif
  160 {
  161         return(EOPNOTSUPP);
  162 };

Cache object: d8cbc171455f706390bb9a720abcaf64


[ 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.