Annotation of kernel/mach/mach_port.defs, 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:  * 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  [email protected]
        !            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:  * HISTORY
        !            52:  * $Log: mach_port.defs,v $
        !            53:  * Revision 1.1.1.1.666.4  1999/03/16 17:05:39  wsanchez
        !            54:  * Substitute License
        !            55:  *
        !            56:  * Revision 1.1.1.1.666.3  1999/03/16 15:28:03  wsanchez
        !            57:  * Substitute copyright
        !            58:  *
        !            59:  * Revision 1.1.1.1.666.2  1999/03/16 10:37:38  umeshv
        !            60:  * Fixed errors in previous commit.
        !            61:  *
        !            62:  * Revision 1.1.1.1.666.1  1999/03/11 09:52:49  umeshv
        !            63:  * Added copyrights.
        !            64:  *
        !            65:  * Revision 1.1.1.1  1997/09/30 02:44:50  wsanchez
        !            66:  * Import of kernel from umeshv/kernel
        !            67:  *
        !            68:  * Revision 2.6  92/01/14  16:45:25  rpd
        !            69:  *     Changed mach_port_{name,type}_array_t usages to remain compatible,
        !            70:  *     because the definition of the types changed incompatibly.
        !            71:  *     [92/01/13            rpd]
        !            72:  * 
        !            73:  * Revision 2.5  91/08/28  11:15:13  jsb
        !            74:  *     Added mach_port_set_seqno.  Moved mach_port_get_receive_status
        !            75:  *     to a new id, renaming the old call old_mach_port_get_receive_status.
        !            76:  *     [91/08/09            rpd]
        !            77:  * 
        !            78:  * Revision 2.4  91/05/14  16:54:47  mrt
        !            79:  *     Correcting copyright
        !            80:  * 
        !            81:  * Revision 2.3  91/02/05  17:33:31  mrt
        !            82:  *     Changed to new Mach copyright
        !            83:  *     [91/02/01  17:18:11  mrt]
        !            84:  * 
        !            85:  * Revision 2.2  90/06/02  14:58:25  rpd
        !            86:  *     Modified mach_port_get_receive_status to return
        !            87:  *     a status structure (mach_port_status_t).
        !            88:  *     Updated mach_port_set_qlimit comment.
        !            89:  *     [90/05/13            rpd]
        !            90:  *     Created for new IPC.
        !            91:  *     [90/03/26  23:45:32  rpd]
        !            92:  * 
        !            93:  */
        !            94: /*
        !            95:  *     File:   mach/mach_port.defs
        !            96:  *     Author: Rich Draves
        !            97:  *
        !            98:  *     Copyright (c) 1989 Richard P. Draves, Jr.
        !            99:  *
        !           100:  *     Exported kernel calls.
        !           101:  */
        !           102: 
        !           103: subsystem
        !           104: #if    KERNEL_SERVER
        !           105:          KernelServer
        !           106: #endif KERNEL_SERVER
        !           107:                       mach_port 3200;
        !           108: 
        !           109: #include <mach/std_types.defs>
        !           110: #include <mach/mach_types.defs>
        !           111: 
        !           112: /*
        !           113:  *     Returns the set of port and port set names
        !           114:  *     to which the target task has access, along with
        !           115:  *     the type (set or port) for each name.
        !           116:  */
        !           117: 
        !           118: routine mach_port_names(
        !           119:                task            : ipc_space_t;
        !           120:        out     names           : mach_port_name_array_t =
        !           121:                                        ^array[] of mach_port_name_t
        !           122:                                        ctype: mach_port_array_t;
        !           123:        out     types           : mach_port_type_array_t =
        !           124:                                        ^array[] of mach_port_type_t);
        !           125: 
        !           126: /*
        !           127:  *     Returns the type (set or port) for the port name
        !           128:  *     within the target task.  Also indicates whether
        !           129:  *     there is a dead-name request for the name.
        !           130:  */
        !           131: 
        !           132: routine mach_port_type(
        !           133:                task            : ipc_space_t;
        !           134:                name            : mach_port_name_t;
        !           135:        out     ptype           : mach_port_type_t);
        !           136: 
        !           137: /*
        !           138:  *     Changes the name by which a port (or port set) is known to
        !           139:  *     the target task.  The new name can't be in use.  The
        !           140:  *     old name becomes available for recycling.
        !           141:  */
        !           142: 
        !           143: routine mach_port_rename(
        !           144:                task            : ipc_space_t;
        !           145:                old_name        : mach_port_name_t;
        !           146:                new_name        : mach_port_name_t);
        !           147: 
        !           148: /*
        !           149:  *     Allocates the specified kind of object, with the given name.
        !           150:  *     The right must be one of
        !           151:  *             MACH_PORT_RIGHT_RECEIVE
        !           152:  *             MACH_PORT_RIGHT_PORT_SET
        !           153:  *             MACH_PORT_RIGHT_DEAD_NAME
        !           154:  *     New port sets are empty.  New ports don't have any
        !           155:  *     send/send-once rights or queued messages.  The make-send
        !           156:  *     count is zero and their queue limit is MACH_PORT_QLIMIT_DEFAULT.
        !           157:  *     New sets, ports, and dead names have one user reference.
        !           158:  */
        !           159: 
        !           160: routine mach_port_allocate_name(
        !           161:                task            : ipc_space_t;
        !           162:                right           : mach_port_right_t;
        !           163:                name            : mach_port_name_t);
        !           164: 
        !           165: /*
        !           166:  *     Allocates the specified kind of object.
        !           167:  *     The right must be one of
        !           168:  *             MACH_PORT_RIGHT_RECEIVE
        !           169:  *             MACH_PORT_RIGHT_PORT_SET
        !           170:  *             MACH_PORT_RIGHT_DEAD_NAME
        !           171:  *     Like port_allocate_name, but the kernel picks a name.
        !           172:  *     It can use any name not associated with a right.
        !           173:  */
        !           174: 
        !           175: routine mach_port_allocate(
        !           176:                task            : ipc_space_t;
        !           177:                right           : mach_port_right_t;
        !           178:        out     name            : mach_port_name_t);
        !           179: 
        !           180: /*
        !           181:  *     Destroys all rights associated with the name and makes it
        !           182:  *     available for recycling immediately.  The name can be a
        !           183:  *     port (possibly with multiple user refs), a port set, or
        !           184:  *     a dead name (again, with multiple user refs).
        !           185:  */
        !           186: 
        !           187: routine mach_port_destroy(
        !           188:                task            : ipc_space_t;
        !           189:                name            : mach_port_name_t);
        !           190: 
        !           191: /*
        !           192:  *     Releases one send/send-once/dead-name user ref.
        !           193:  *     Just like mach_port_mod_refs -1, but deduces the
        !           194:  *     correct type of right.  This allows a user task
        !           195:  *     to release a ref for a port without worrying
        !           196:  *     about whether the port has died or not.
        !           197:  */
        !           198: 
        !           199: routine mach_port_deallocate(
        !           200:                task            : ipc_space_t;
        !           201:                name            : mach_port_name_t);
        !           202: 
        !           203: /*
        !           204:  *     A port set always has one user ref.
        !           205:  *     A send-once right always has one user ref.
        !           206:  *     A dead name always has one or more user refs.
        !           207:  *     A send right always has one or more user refs.
        !           208:  *     A receive right always has one user ref.
        !           209:  *     The right must be one of
        !           210:  *             MACH_PORT_RIGHT_RECEIVE
        !           211:  *             MACH_PORT_RIGHT_PORT_SET
        !           212:  *             MACH_PORT_RIGHT_DEAD_NAME
        !           213:  *             MACH_PORT_RIGHT_SEND
        !           214:  *             MACH_PORT_RIGHT_SEND_ONCE
        !           215:  */
        !           216: 
        !           217: routine mach_port_get_refs(
        !           218:                task            : ipc_space_t;
        !           219:                name            : mach_port_name_t;
        !           220:                right           : mach_port_right_t;
        !           221:        out     refs            : mach_port_urefs_t);
        !           222: 
        !           223: /*
        !           224:  *     The delta is a signed change to the task's
        !           225:  *     user ref count for the right.  Only dead names
        !           226:  *     and send rights can have a positive delta.
        !           227:  *     The resulting user ref count can't be negative.
        !           228:  *     If it is zero, the right is deallocated.
        !           229:  *     If the name isn't a composite right, it becomes
        !           230:  *     available for recycling.  The right must be one of
        !           231:  *             MACH_PORT_RIGHT_RECEIVE
        !           232:  *             MACH_PORT_RIGHT_PORT_SET
        !           233:  *             MACH_PORT_RIGHT_DEAD_NAME
        !           234:  *             MACH_PORT_RIGHT_SEND
        !           235:  *             MACH_PORT_RIGHT_SEND_ONCE
        !           236:  */
        !           237: 
        !           238: routine mach_port_mod_refs(
        !           239:                task            : ipc_space_t;
        !           240:                name            : mach_port_name_t;
        !           241:                right           : mach_port_right_t;
        !           242:                delta           : mach_port_delta_t);
        !           243: 
        !           244: skip;  /* was old_mach_port_get_receive_status */
        !           245: 
        !           246: /*
        !           247:  *     Only valid for receive rights.
        !           248:  *     Sets the queue-limit for the port.
        !           249:  *     The limit must be
        !           250:  *             1 <= qlimit <= MACH_PORT_QLIMIT_MAX
        !           251:  */
        !           252: 
        !           253: routine mach_port_set_qlimit(
        !           254:                task            : ipc_space_t;
        !           255:                name            : mach_port_name_t;
        !           256:                qlimit          : mach_port_msgcount_t);
        !           257: 
        !           258: /*
        !           259:  *     Only valid for receive rights.
        !           260:  *     Sets the make-send count for the port.
        !           261:  */
        !           262: 
        !           263: routine mach_port_set_mscount(
        !           264:                task            : ipc_space_t;
        !           265:                name            : mach_port_name_t;
        !           266:                mscount         : mach_port_mscount_t);
        !           267: 
        !           268: /*
        !           269:  *     Only valid for port sets.  Returns a list of
        !           270:  *     the members.
        !           271:  */
        !           272: 
        !           273: routine mach_port_get_set_status(
        !           274:                task            : ipc_space_t;
        !           275:                name            : mach_port_name_t;
        !           276:        out     members         : mach_port_name_array_t =
        !           277:                                        ^array[] of mach_port_name_t
        !           278:                                        ctype: mach_port_array_t);
        !           279: 
        !           280: /*
        !           281:  *     Puts the member port (the task must have receive rights)
        !           282:  *     into the after port set.  (Or removes it from any port set
        !           283:  *     if after is MACH_PORT_NULL.)  If the port is already in
        !           284:  *     a set, does an atomic move.
        !           285:  */
        !           286: 
        !           287: routine mach_port_move_member(
        !           288:                task            : ipc_space_t;
        !           289:                member          : mach_port_name_t;
        !           290:                after           : mach_port_name_t);
        !           291: 
        !           292: /*
        !           293:  *     Requests a notification from the kernel.  The request
        !           294:  *     must supply the send-once right which is used for
        !           295:  *     the notification.  If a send-once right was previously
        !           296:  *     registered, it is returned.  The msg_id must be one of
        !           297:  *             MACH_NOTIFY_PORT_DESTROYED (receive rights)
        !           298:  *             MACH_NOTIFY_DEAD_NAME (send/receive/send-once rights)
        !           299:  *             MACH_NOTIFY_NO_SENDERS (receive rights)
        !           300:  *
        !           301:  *     The sync value specifies whether a notification should
        !           302:  *     get sent immediately, if appropriate.  The exact meaning
        !           303:  *     depends on the notification:
        !           304:  *             MACH_NOTIFY_PORT_DESTROYED: must be zero.
        !           305:  *             MACH_NOTIFY_DEAD_NAME: if non-zero, then name can be dead,
        !           306:  *                     and the notification gets sent immediately.
        !           307:  *                     If zero, then name can't be dead.
        !           308:  *             MACH_NOTIFY_NO_SENDERS: the notification gets sent
        !           309:  *                     immediately if the current mscount is greater
        !           310:  *                     than or equal to the sync value and there are no
        !           311:  *                     extant send rights.
        !           312:  */
        !           313: 
        !           314: routine mach_port_request_notification(
        !           315:                task            : ipc_space_t;
        !           316:                name            : mach_port_name_t;
        !           317:                id              : mach_msg_id_t;
        !           318:                sync            : mach_port_mscount_t;
        !           319:                notify          : mach_port_send_once_t;
        !           320:        out     previous        : mach_port_send_once_t);
        !           321: 
        !           322: /*
        !           323:  *     Inserts the specified rights into the target task,
        !           324:  *     using the specified name.  If inserting send/receive
        !           325:  *     rights and the task already has send/receive rights
        !           326:  *     for the port, then the names must agree.  In any case,
        !           327:  *     the task gains a user ref for the port.
        !           328:  */
        !           329: 
        !           330: routine mach_port_insert_right(
        !           331:                task            : ipc_space_t;
        !           332:                name            : mach_port_name_t;
        !           333:                poly            : mach_port_poly_t);
        !           334: 
        !           335: /*
        !           336:  *     Returns the specified right for the named port
        !           337:  *     in the target task, extracting that right from
        !           338:  *     the target task.  The target task loses a user
        !           339:  *     ref and the name may be available for recycling.
        !           340:  *     msgt_name must be one of
        !           341:  *             MACH_MSG_TYPE_MOVE_RECEIVE
        !           342:  *             MACH_MSG_TYPE_COPY_SEND
        !           343:  *             MACH_MSG_TYPE_MAKE_SEND
        !           344:  *             MACH_MSG_TYPE_MOVE_SEND
        !           345:  *             MACH_MSG_TYPE_MAKE_SEND_ONCE
        !           346:  *             MACH_MSG_TYPE_MOVE_SEND_ONCE
        !           347:  */
        !           348: 
        !           349: routine mach_port_extract_right(
        !           350:                task            : ipc_space_t;
        !           351:                name            : mach_port_name_t;
        !           352:                msgt_name       : mach_msg_type_name_t;
        !           353:        out     poly            : mach_port_poly_t);
        !           354: 
        !           355: /*
        !           356:  *     The task must have receive rights for the named port.
        !           357:  *     Returns a status structure (see mach/port.h).
        !           358:  */
        !           359: 
        !           360: routine mach_port_get_receive_status(
        !           361:                task            : ipc_space_t;
        !           362:                name            : mach_port_name_t;
        !           363:        out     status          : mach_port_status_t);
        !           364: 
        !           365: /*
        !           366:  *     Only valid for receive rights.
        !           367:  *     Sets the sequence number for the port.
        !           368:  */
        !           369: 
        !           370: routine mach_port_set_seqno(
        !           371:                task            : ipc_space_t;
        !           372:                name            : mach_port_name_t;
        !           373:                seqno           : mach_port_seqno_t);

unix.superglobalmegacorp.com

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