]> git.saurik.com Git - apple/xnu.git/blobdiff - osfmk/ipc/ipc_port.h
xnu-1228.tar.gz
[apple/xnu.git] / osfmk / ipc / ipc_port.h
index 2cf4e699c5d1df237525ac6ee1930887d0fe0d12..6b409dc2da22fb70b2b07d30366dbee7b495dbde 100644 (file)
@@ -1,16 +1,19 @@
 /*
- * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
  *
- * @APPLE_LICENSE_HEADER_START@
- * 
- * Copyright (c) 1999-2003 Apple Computer, Inc.  All Rights Reserved.
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
  * 
  * This file contains Original Code and/or Modifications of Original Code
  * as defined in and that are subject to the Apple Public Source License
  * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
+ * 
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
  * 
  * The Original Code and all software distributed under the License are
  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
@@ -20,7 +23,7 @@
  * Please see the License for the specific language governing rights and
  * limitations under the License.
  * 
- * @APPLE_LICENSE_HEADER_END@
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
  */
 /*
  * @OSF_COPYRIGHT@
  * any improvements or extensions that they make and grant Carnegie Mellon
  * the rights to redistribute these changes.
  */
+/*
+ * NOTICE: This file was modified by McAfee Research in 2004 to introduce
+ * support for mandatory and extensible security protections.  This notice
+ * is included in support of clause 2.2 (b) of the Apple Public License,
+ * Version 2.0.
+ */
 /*
  */
 /*
 #include <mach_assert.h>
 #include <mach_debug.h>
 
+#include <mach/mach_types.h>
 #include <mach/boolean.h>
 #include <mach/kern_return.h>
-#include <mach_debug.h>
 #include <mach/port.h>
-#include <kern/lock.h>
-#include <kern/ipc_kobject.h>
-#include <kern/wait_queue.h>
 
+#include <kern/kern_types.h>
+
+#include <ipc/ipc_types.h>
 #include <ipc/ipc_object.h>
 #include <ipc/ipc_mqueue.h>
-#include <ipc/ipc_table.h>
-#include <ipc/ipc_types.h>
-#include <ipc/ipc_entry.h>
 #include <ipc/ipc_space.h>
 
+#include <security/_label.h>
+
 /*
  *  A receive right (port) can be in four states:
  *     1) dead (not active, ip_timestamp has death time)
 
 typedef unsigned int ipc_port_timestamp_t;
 
-typedef unsigned int ipc_port_flags_t;
-
 struct ipc_port {
 
        /*
@@ -143,12 +149,16 @@ struct ipc_port {
 #define        IP_NSPARES              10
 #define        IP_CALLSTACK_MAX        10
        queue_chain_t   ip_port_links;  /* all allocated ports */
-       natural_t       ip_thread;      /* who made me?  thread context */
+       thread_t        ip_thread;      /* who made me?  thread context */
        unsigned long   ip_timetrack;   /* give an idea of "when" created */
        natural_t       ip_callstack[IP_CALLSTACK_MAX]; /* stack trace */
        unsigned long   ip_spares[IP_NSPARES]; /* for debugging */
 #endif /* MACH_ASSERT */
        int             alias;
+
+//#if MAC
+        struct label    ip_label;
+//#endif
 };
 
 
@@ -200,9 +210,8 @@ MACRO_BEGIN                                                         \
        (port)->ip_premsg = IKM_NULL;                                   \
 MACRO_END
 
-typedef ipc_table_index_t ipc_port_request_index_t;
 
-typedef struct ipc_port_request {
+struct ipc_port_request {
        union {
                struct ipc_port *port;
                ipc_port_request_index_t index;
@@ -212,7 +221,7 @@ typedef struct ipc_port_request {
                mach_port_name_t name;
                struct ipc_table_size *size;
        } name;
-} *ipc_port_request_t;
+};
 
 #define        ipr_next                notify.index
 #define        ipr_size                name.size
@@ -220,8 +229,6 @@ typedef struct ipc_port_request {
 #define        ipr_soright             notify.port
 #define        ipr_name                name.name
 
-#define        IPR_NULL                ((ipc_port_request_t) 0)
-
 /*
  *     Taking the ipc_port_multiple lock grants the privilege
  *     to lock multiple ports at once.  No ports must locked
@@ -231,7 +238,7 @@ typedef struct ipc_port_request {
 decl_mutex_data(extern,ipc_port_multiple_lock_data)
 
 #define        ipc_port_multiple_lock_init()                                   \
-               mutex_init(&ipc_port_multiple_lock_data, ETAP_IPC_PORT_MULT)
+               mutex_init(&ipc_port_multiple_lock_data, 0)
 
 #define        ipc_port_multiple_lock()                                        \
                mutex_lock(&ipc_port_multiple_lock_data)
@@ -249,7 +256,7 @@ decl_mutex_data(extern,ipc_port_timestamp_lock_data)
 extern ipc_port_timestamp_t ipc_port_timestamp_data;
 
 #define        ipc_port_timestamp_lock_init()                                  \
-               mutex_init(&ipc_port_timestamp_lock_data, ETAP_IPC_PORT_TIME)
+               mutex_init(&ipc_port_timestamp_lock_data, 0)
 
 #define        ipc_port_timestamp_lock()                                       \
                mutex_lock(&ipc_port_timestamp_lock_data)
@@ -289,8 +296,8 @@ ipc_port_dnrequest(
 
 /* Grow a port's table of dead-name requests */
 extern kern_return_t ipc_port_dngrow(
-       ipc_port_t      port,
-       int             target_size);
+       ipc_port_t                      port,
+       ipc_table_elems_t               target_size);
 
 /* Cancel a dead-name request and return the send-once right */
 extern ipc_port_t ipc_port_dncancel(