Annotation of kernel/ipc/ipc_mqueue.h, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
        !             3:  *
        !             4:  * @APPLE_LICENSE_HEADER_START@
        !             5:  * 
        !             6:  * Portions Copyright (c) 1999 Apple Computer, Inc.  All Rights
        !             7:  * Reserved.  This file contains Original Code and/or Modifications of
        !             8:  * Original Code as defined in and that are subject to the Apple Public
        !             9:  * Source License Version 1.1 (the "License").  You may not use this file
        !            10:  * except in compliance with the License.  Please obtain a copy of the
        !            11:  * License at http://www.apple.com/publicsource and read it before using
        !            12:  * this file.
        !            13:  * 
        !            14:  * The Original Code and all software distributed under the License are
        !            15:  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
        !            16:  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
        !            17:  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
        !            18:  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
        !            19:  * License for the specific language governing rights and limitations
        !            20:  * under the License.
        !            21:  * 
        !            22:  * @APPLE_LICENSE_HEADER_END@
        !            23:  */
        !            24: 
        !            25: /*
        !            26:  * Copyright (c) 1995, 1994, 1993, 1992, 1991, 1990  
        !            27:  * Open Software Foundation, Inc. 
        !            28:  *  
        !            29:  * Permission to use, copy, modify, and distribute this software and 
        !            30:  * its documentation for any purpose and without fee is hereby granted, 
        !            31:  * provided that the above copyright notice appears in all copies and 
        !            32:  * that both the copyright notice and this permission notice appear in 
        !            33:  * supporting documentation, and that the name of ("OSF") or Open Software 
        !            34:  * Foundation not be used in advertising or publicity pertaining to 
        !            35:  * distribution of the software without specific, written prior permission. 
        !            36:  *  
        !            37:  * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE 
        !            38:  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
        !            39:  * FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL OSF BE LIABLE FOR ANY 
        !            40:  * SPECIAL, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 
        !            41:  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN 
        !            42:  * ACTION OF CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING 
        !            43:  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE 
        !            44:  */
        !            45: /*
        !            46:  * OSF Research Institute MK6.1 (unencumbered) 1/31/1995
        !            47:  */
        !            48: /* 
        !            49:  * Mach Operating System
        !            50:  * Copyright (c) 1991,1990,1989 Carnegie Mellon University
        !            51:  * All Rights Reserved.
        !            52:  * 
        !            53:  * Permission to use, copy, modify and distribute this software and its
        !            54:  * documentation is hereby granted, provided that both the copyright
        !            55:  * notice and this permission notice appear in all copies of the
        !            56:  * software, derivative works or modified versions, and any portions
        !            57:  * thereof, and that both notices appear in supporting documentation.
        !            58:  * 
        !            59:  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
        !            60:  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
        !            61:  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
        !            62:  * 
        !            63:  * Carnegie Mellon requests users of this software to return to
        !            64:  * 
        !            65:  *  Software Distribution Coordinator  or  [email protected]
        !            66:  *  School of Computer Science
        !            67:  *  Carnegie Mellon University
        !            68:  *  Pittsburgh PA 15213-3890
        !            69:  * 
        !            70:  * any improvements or extensions that they make and grant Carnegie Mellon
        !            71:  * the rights to redistribute these changes.
        !            72:  */
        !            73: /*
        !            74:  *     File:   ipc/ipc_mqueue.h
        !            75:  *     Author: Rich Draves
        !            76:  *     Date:   1989
        !            77:  *
        !            78:  *     Definitions for message queues.
        !            79:  */
        !            80: 
        !            81: #ifndef        _IPC_IPC_MQUEUE_H_
        !            82: #define _IPC_IPC_MQUEUE_H_
        !            83: 
        !            84: #import <mach/features.h>
        !            85: 
        !            86: #include <mach/message.h>
        !            87: #include <kern/assert.h>
        !            88: #include <kern/lock.h>
        !            89: #include <kern/macro_help.h>
        !            90: #include <ipc/ipc_kmsg.h>
        !            91: #include <ipc/ipc_thread.h>
        !            92: #include <ipc/ipc_types.h>
        !            93: 
        !            94: typedef struct ipc_mqueue {
        !            95:        decl_simple_lock_data(, imq_lock_data)
        !            96:        struct ipc_kmsg_queue imq_messages;
        !            97:        struct ipc_thread_queue imq_threads;
        !            98: } *ipc_mqueue_t;
        !            99: 
        !           100: #define        IMQ_NULL                ((ipc_mqueue_t) 0)
        !           101: 
        !           102: #define        imq_lock_init(mq)       simple_lock_init(&(mq)->imq_lock_data)
        !           103: #define        imq_lock(mq)            simple_lock(&(mq)->imq_lock_data)
        !           104: #define        imq_lock_try(mq)        simple_lock_try(&(mq)->imq_lock_data)
        !           105: #define        imq_unlock(mq)          simple_unlock(&(mq)->imq_lock_data)
        !           106: 
        !           107: #define        IMQ_NULL_CONTINUE       ((void (*)(void)) 0)
        !           108: 
        !           109: /*
        !           110:  * Exported interfaces
        !           111:  */
        !           112: 
        !           113: /* Initialize a newly-allocated message queue */
        !           114: extern void ipc_mqueue_init(
        !           115:        ipc_mqueue_t    mqueue);
        !           116: 
        !           117: /* Move messages from one queue to another */
        !           118: extern void ipc_mqueue_move(
        !           119:        ipc_mqueue_t    dest,
        !           120:        ipc_mqueue_t    source,
        !           121:        ipc_port_t      port);
        !           122: 
        !           123: /* Wake up receivers waiting in a message queue */
        !           124: extern void ipc_mqueue_changed(
        !           125:        ipc_mqueue_t            mqueue,
        !           126:        mach_msg_return_t       mr);
        !           127: 
        !           128: /* Send a message to a port */
        !           129: extern mach_msg_return_t ipc_mqueue_send(
        !           130:        ipc_kmsg_t              kmsg,
        !           131:        mach_msg_option_t       option,
        !           132:        mach_msg_timeout_t      timeout,
        !           133:        void                    (*continuation)(void));
        !           134: 
        !           135: /* Convert a name in a space to a message queue */
        !           136: extern mach_msg_return_t ipc_mqueue_copyin(
        !           137:        ipc_space_t     space,
        !           138:        mach_port_t     name,
        !           139:        ipc_mqueue_t    *mqueuep,
        !           140:        ipc_object_t    *objectp);
        !           141: 
        !           142: /* Receive a message from a message queue */
        !           143: extern mach_msg_return_t ipc_mqueue_receive(
        !           144:        ipc_mqueue_t            mqueue,
        !           145:        mach_msg_option_t       option,
        !           146:        mach_msg_size_t         max_size,
        !           147:        mach_msg_timeout_t      timeout,
        !           148:        boolean_t               resume,
        !           149:        void                    (*continuation)(void),
        !           150:        ipc_kmsg_t              *kmsgp,
        !           151:        mach_port_seqno_t       *seqnop,
        !           152:        ipc_kmsg_t              *list);
        !           153: 
        !           154: /*
        !           155:  *     extern void
        !           156:  *     ipc_mqueue_send_always(ipc_kmsg_t);
        !           157:  *
        !           158:  *     Unfortunately, to avoid warnings/lint about unused variables
        !           159:  *     when assertions are turned off, we need two versions of this.
        !           160:  */
        !           161: 
        !           162: #if    MACH_ASSERT
        !           163: 
        !           164: #define        ipc_mqueue_send_always(kmsg)                                    \
        !           165: MACRO_BEGIN                                                            \
        !           166:        mach_msg_return_t mr;                                           \
        !           167:                                                                        \
        !           168:        mr = ipc_mqueue_send((kmsg), MACH_SEND_ALWAYS,                  \
        !           169:                             MACH_MSG_TIMEOUT_NONE,                     \
        !           170:                             IMQ_NULL_CONTINUE);                        \
        !           171:        assert(mr == MACH_MSG_SUCCESS);                                 \
        !           172: MACRO_END
        !           173: 
        !           174: #else  /* MACH_ASSERT */
        !           175: 
        !           176: #define        ipc_mqueue_send_always(kmsg)                                    \
        !           177: MACRO_BEGIN                                                            \
        !           178:        (void) ipc_mqueue_send((kmsg), MACH_SEND_ALWAYS,                \
        !           179:                               MACH_MSG_TIMEOUT_NONE,                   \
        !           180:                               IMQ_NULL_CONTINUE);                      \
        !           181: MACRO_END
        !           182: 
        !           183: #endif /* MACH_ASSERT */
        !           184: 
        !           185: #endif /* _IPC_IPC_MQUEUE_H_ */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.