darwin-xnu/osfmk/ipc/ipc_right.h
<<
>>
Prefs
   1/*
   2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
   3 *
   4 * @APPLE_LICENSE_HEADER_START@
   5 * 
   6 * The contents of this file constitute Original Code as defined in and
   7 * are subject to the Apple Public Source License Version 1.1 (the
   8 * "License").  You may not use this file except in compliance with the
   9 * License.  Please obtain a copy of the License at
  10 * http://www.apple.com/publicsource and read it before using this file.
  11 * 
  12 * This Original Code and all software distributed under the License are
  13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
  14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
  15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
  16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
  17 * License for the specific language governing rights and limitations
  18 * under the License.
  19 * 
  20 * @APPLE_LICENSE_HEADER_END@
  21 */
  22/*
  23 * @OSF_COPYRIGHT@
  24 */
  25/* 
  26 * Mach Operating System
  27 * Copyright (c) 1991,1990,1989 Carnegie Mellon University
  28 * All Rights Reserved.
  29 * 
  30 * Permission to use, copy, modify and distribute this software and its
  31 * documentation is hereby granted, provided that both the copyright
  32 * notice and this permission notice appear in all copies of the
  33 * software, derivative works or modified versions, and any portions
  34 * thereof, and that both notices appear in supporting documentation.
  35 * 
  36 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
  37 * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
  38 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
  39 * 
  40 * Carnegie Mellon requests users of this software to return to
  41 * 
  42 *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
  43 *  School of Computer Science
  44 *  Carnegie Mellon University
  45 *  Pittsburgh PA 15213-3890
  46 * 
  47 * any improvements or extensions that they make and grant Carnegie Mellon
  48 * the rights to redistribute these changes.
  49 */
  50/*
  51 */
  52/*
  53 *      File:   ipc/ipc_right.h
  54 *      Author: Rich Draves
  55 *      Date:   1989
  56 *
  57 *      Declarations of functions to manipulate IPC capabilities.
  58 */
  59
  60#ifndef _IPC_IPC_RIGHT_H_
  61#define _IPC_IPC_RIGHT_H_
  62
  63#include <mach/boolean.h>
  64#include <mach/kern_return.h>
  65#include <ipc/ipc_port.h>
  66#include <ipc/ipc_entry.h>
  67
  68#define ipc_right_lookup_read           ipc_right_lookup_write
  69#define ipc_right_lookup_two_read       ipc_right_lookup_two_write
  70
  71/* Find an entry in a space, given the name */
  72extern kern_return_t ipc_right_lookup_write(
  73        ipc_space_t             space,
  74        mach_port_name_t        name,
  75        ipc_entry_t             *entryp);
  76
  77/* Find two entries in a space, given two names */
  78extern kern_return_t ipc_right_lookup_two_write(
  79        ipc_space_t             space,
  80        mach_port_name_t        name1,
  81        ipc_entry_t             *entryp1,
  82        mach_port_name_t        name2,
  83        ipc_entry_t             *entryp2);
  84
  85/* Translate (space, object) -> (name, entry) */
  86extern boolean_t ipc_right_reverse(
  87        ipc_space_t             space,
  88        ipc_object_t            object,
  89        mach_port_name_t        *namep,
  90        ipc_entry_t             *entryp);
  91
  92/* Make a dead-name request, returning the registered send-once right */
  93extern kern_return_t ipc_right_dnrequest(
  94        ipc_space_t             space,
  95        mach_port_name_t        name,
  96        boolean_t               immediate,
  97        ipc_port_t              notify,
  98        ipc_port_t              *previousp);
  99
 100/* Cancel a dead-name request and return the send-once right */
 101extern ipc_port_t ipc_right_dncancel(
 102        ipc_space_t             space,
 103        ipc_port_t              port,
 104        mach_port_name_t        name,
 105        ipc_entry_t             entry);
 106
 107#define ipc_right_dncancel_macro(space, port, name, entry)              \
 108                 ((entry->ie_request == 0) ? IP_NULL :                  \
 109                 ipc_right_dncancel((space), (port), (name), (entry)))
 110
 111/* Check if an entry is being used */
 112extern boolean_t ipc_right_inuse(
 113        ipc_space_t             space,
 114        mach_port_name_t        name,
 115        ipc_entry_t             entry);
 116
 117/* Check if the port has died */
 118extern boolean_t ipc_right_check(
 119        ipc_space_t             space,
 120        ipc_port_t              port,
 121        mach_port_name_t        name,
 122        ipc_entry_t             entry);
 123
 124/* Clean up an entry in a dead space */
 125extern void ipc_right_clean(
 126        ipc_space_t             space,
 127        mach_port_name_t        name,
 128        ipc_entry_t             entry);
 129
 130/* Destroy an entry in a space */
 131extern kern_return_t ipc_right_destroy(
 132        ipc_space_t             space,
 133        mach_port_name_t        name,
 134        ipc_entry_t             entry);
 135
 136/* Release a send/send-once/dead-name user reference */
 137extern kern_return_t ipc_right_dealloc(
 138        ipc_space_t             space,
 139        mach_port_name_t        name,
 140        ipc_entry_t             entry);
 141
 142/* Modify the user-reference count for a right */
 143extern kern_return_t ipc_right_delta(
 144        ipc_space_t             space,
 145        mach_port_name_t        name,
 146        ipc_entry_t             entry,
 147        mach_port_right_t       right,
 148        mach_port_delta_t       delta);
 149
 150/* Retrieve information about a right */
 151extern kern_return_t ipc_right_info(
 152        ipc_space_t             space,
 153        mach_port_name_t        name,
 154        ipc_entry_t             entry,
 155        mach_port_type_t        *typep,
 156        mach_port_urefs_t       *urefsp);
 157
 158/* Check if a subsequent ipc_right_copyin would succeed */
 159extern boolean_t ipc_right_copyin_check(
 160        ipc_space_t             space,
 161        mach_port_name_t        name,
 162        ipc_entry_t             entry,
 163        mach_msg_type_name_t    msgt_name);
 164
 165/* Copyin a capability from a space */
 166extern kern_return_t ipc_right_copyin(
 167        ipc_space_t             space,
 168        mach_port_name_t        name,
 169        ipc_entry_t             entry,
 170        mach_msg_type_name_t    msgt_name,
 171        boolean_t               deadok,
 172        ipc_object_t            *objectp,
 173        ipc_port_t              *sorightp);
 174
 175/* Undo the effects of an ipc_right_copyin */
 176extern void ipc_right_copyin_undo(
 177        ipc_space_t             space,
 178        mach_port_name_t        name,
 179        ipc_entry_t             entry,
 180        mach_msg_type_name_t    msgt_name,
 181        ipc_object_t            object,
 182        ipc_port_t              soright);
 183
 184/* Copyin two send rights from a space */
 185extern kern_return_t ipc_right_copyin_two(
 186        ipc_space_t             space,
 187        mach_port_name_t        name,
 188        ipc_entry_t             entry,
 189        ipc_object_t            *objectp,
 190        ipc_port_t              *sorightp);
 191
 192/* Copyout a capability to a space */
 193extern kern_return_t ipc_right_copyout(
 194        ipc_space_t             space,
 195        mach_port_name_t        name,
 196        ipc_entry_t             entry,
 197        mach_msg_type_name_t    msgt_name,
 198        boolean_t               overflow,
 199        ipc_object_t            object);
 200
 201/* Reanme a capability */
 202extern kern_return_t ipc_right_rename(
 203        ipc_space_t             space,
 204        mach_port_name_t        oname,
 205        ipc_entry_t             oentry,
 206        mach_port_name_t        nname,
 207        ipc_entry_t             nentry);
 208
 209#endif  /* _IPC_IPC_RIGHT_H_ */
 210
lxr.linux.no kindly hosted by Redpill Linpro AS, provider of Linux consulting and operations services since 1995.