Annotation of Gnu-Mach/include/mach/mach_port.defs, revision 1.1.1.2

1.1       root        1: /*
                      2:  * Mach Operating System
                      3:  * Copyright (c) 1991,1990,1989 Carnegie Mellon University.
                      4:  * Copyright (c) 1993,1994 The University of Utah and
                      5:  * the Computer Systems Laboratory (CSL).
                      6:  * All rights reserved.
                      7:  *
                      8:  * Permission to use, copy, modify and distribute this software and its
                      9:  * documentation is hereby granted, provided that both the copyright
                     10:  * notice and this permission notice appear in all copies of the
                     11:  * software, derivative works or modified versions, and any portions
                     12:  * thereof, and that both notices appear in supporting documentation.
                     13:  *
                     14:  * CARNEGIE MELLON, THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF
                     15:  * THIS SOFTWARE IN ITS "AS IS" CONDITION, AND DISCLAIM ANY LIABILITY
                     16:  * OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF
                     17:  * THIS SOFTWARE.
                     18:  *
                     19:  * Carnegie Mellon requests users of this software to return to
                     20:  *
                     21:  *  Software Distribution Coordinator  or  [email protected]
                     22:  *  School of Computer Science
                     23:  *  Carnegie Mellon University
                     24:  *  Pittsburgh PA 15213-3890
                     25:  *
                     26:  * any improvements or extensions that they make and grant Carnegie Mellon
                     27:  * the rights to redistribute these changes.
                     28:  */
                     29: /*
                     30:  *     File:   mach/mach_port.defs
                     31:  *     Author: Rich Draves
                     32:  *
                     33:  *     Copyright (c) 1989 Richard P. Draves, Jr.
                     34:  *
                     35:  *     Exported kernel calls.
                     36:  */
                     37: 
                     38: subsystem
                     39: #if    KERNEL_SERVER
                     40:          KernelServer
                     41: #endif
                     42:                       mach_port 3200;
                     43: 
                     44: #include <mach/std_types.defs>
                     45: #include <mach/mach_types.defs>
                     46: 
                     47: /*
                     48:  *     Returns the set of port and port set names
                     49:  *     to which the target task has access, along with
                     50:  *     the type (set or port) for each name.
                     51:  */
                     52: 
                     53: routine mach_port_names(
                     54:                task            : ipc_space_t;
                     55:        out     names           : mach_port_name_array_t =
                     56:                                        ^array[] of mach_port_name_t
                     57:                                        ctype: mach_port_array_t;
                     58:        out     types           : mach_port_type_array_t =
                     59:                                        ^array[] of mach_port_type_t);
                     60: 
                     61: /*
                     62:  *     Returns the type (set or port) for the port name
                     63:  *     within the target task.  Also indicates whether
                     64:  *     there is a dead-name request for the name.
                     65:  */
                     66: 
                     67: routine mach_port_type(
                     68:                task            : ipc_space_t;
                     69:                name            : mach_port_name_t;
                     70:        out     ptype           : mach_port_type_t);
                     71: 
                     72: /*
                     73:  *     Changes the name by which a port (or port set) is known to
                     74:  *     the target task.  The new name can't be in use.  The
                     75:  *     old name becomes available for recycling.
                     76:  */
                     77: 
                     78: routine mach_port_rename(
                     79:                task            : ipc_space_t;
                     80:                old_name        : mach_port_name_t;
                     81:                new_name        : mach_port_name_t);
                     82: 
                     83: /*
                     84:  *     Allocates the specified kind of object, with the given name.
                     85:  *     The right must be one of
                     86:  *             MACH_PORT_RIGHT_RECEIVE
                     87:  *             MACH_PORT_RIGHT_PORT_SET
                     88:  *             MACH_PORT_RIGHT_DEAD_NAME
                     89:  *     New port sets are empty.  New ports don't have any
                     90:  *     send/send-once rights or queued messages.  The make-send
                     91:  *     count is zero and their queue limit is MACH_PORT_QLIMIT_DEFAULT.
                     92:  *     New sets, ports, and dead names have one user reference.
                     93:  */
                     94: 
                     95: routine mach_port_allocate_name(
                     96:                task            : ipc_space_t;
                     97:                right           : mach_port_right_t;
                     98:                name            : mach_port_name_t);
                     99: 
                    100: /*
                    101:  *     Allocates the specified kind of object.
                    102:  *     The right must be one of
                    103:  *             MACH_PORT_RIGHT_RECEIVE
                    104:  *             MACH_PORT_RIGHT_PORT_SET
                    105:  *             MACH_PORT_RIGHT_DEAD_NAME
                    106:  *     Like port_allocate_name, but the kernel picks a name.
                    107:  *     It can use any name not associated with a right.
                    108:  */
                    109: 
                    110: routine mach_port_allocate(
                    111:                task            : ipc_space_t;
                    112:                right           : mach_port_right_t;
                    113:        out     name            : mach_port_name_t);
                    114: 
                    115: /*
                    116:  *     Destroys all rights associated with the name and makes it
                    117:  *     available for recycling immediately.  The name can be a
                    118:  *     port (possibly with multiple user refs), a port set, or
                    119:  *     a dead name (again, with multiple user refs).
                    120:  */
                    121: 
                    122: routine mach_port_destroy(
                    123:                task            : ipc_space_t;
                    124:                name            : mach_port_name_t);
                    125: 
                    126: /*
                    127:  *     Releases one send/send-once/dead-name user ref.
                    128:  *     Just like mach_port_mod_refs -1, but deduces the
                    129:  *     correct type of right.  This allows a user task
                    130:  *     to release a ref for a port without worrying
                    131:  *     about whether the port has died or not.
                    132:  */
                    133: 
                    134: routine mach_port_deallocate(
                    135:                task            : ipc_space_t;
                    136:                name            : mach_port_name_t);
                    137: 
                    138: /*
                    139:  *     A port set always has one user ref.
                    140:  *     A send-once right always has one user ref.
                    141:  *     A dead name always has one or more user refs.
                    142:  *     A send right always has one or more user refs.
                    143:  *     A receive right always has one user ref.
                    144:  *     The right must be one of
                    145:  *             MACH_PORT_RIGHT_RECEIVE
                    146:  *             MACH_PORT_RIGHT_PORT_SET
                    147:  *             MACH_PORT_RIGHT_DEAD_NAME
                    148:  *             MACH_PORT_RIGHT_SEND
                    149:  *             MACH_PORT_RIGHT_SEND_ONCE
                    150:  */
                    151: 
                    152: routine mach_port_get_refs(
                    153:                task            : ipc_space_t;
                    154:                name            : mach_port_name_t;
                    155:                right           : mach_port_right_t;
                    156:        out     refs            : mach_port_urefs_t);
                    157: 
                    158: /*
                    159:  *     The delta is a signed change to the task's
                    160:  *     user ref count for the right.  Only dead names
                    161:  *     and send rights can have a positive delta.
                    162:  *     The resulting user ref count can't be negative.
                    163:  *     If it is zero, the right is deallocated.
                    164:  *     If the name isn't a composite right, it becomes
                    165:  *     available for recycling.  The right must be one of
                    166:  *             MACH_PORT_RIGHT_RECEIVE
                    167:  *             MACH_PORT_RIGHT_PORT_SET
                    168:  *             MACH_PORT_RIGHT_DEAD_NAME
                    169:  *             MACH_PORT_RIGHT_SEND
                    170:  *             MACH_PORT_RIGHT_SEND_ONCE
                    171:  */
                    172: 
                    173: routine mach_port_mod_refs(
                    174:                task            : ipc_space_t;
                    175:                name            : mach_port_name_t;
                    176:                right           : mach_port_right_t;
                    177:                delta           : mach_port_delta_t);
                    178: 
1.1.1.2 ! root      179: skip;  /* old old_mach_port_get_receive_status */
1.1       root      180: 
                    181: /*
                    182:  *     Only valid for receive rights.
                    183:  *     Sets the queue-limit for the port.
                    184:  *     The limit must be
                    185:  *             1 <= qlimit <= MACH_PORT_QLIMIT_MAX
                    186:  */
                    187: 
                    188: routine mach_port_set_qlimit(
                    189:                task            : ipc_space_t;
                    190:                name            : mach_port_name_t;
                    191:                qlimit          : mach_port_msgcount_t);
                    192: 
                    193: /*
                    194:  *     Only valid for receive rights.
                    195:  *     Sets the make-send count for the port.
                    196:  */
                    197: 
                    198: routine mach_port_set_mscount(
                    199:                task            : ipc_space_t;
                    200:                name            : mach_port_name_t;
                    201:                mscount         : mach_port_mscount_t);
                    202: 
                    203: /*
                    204:  *     Only valid for port sets.  Returns a list of
                    205:  *     the members.
                    206:  */
                    207: 
                    208: routine mach_port_get_set_status(
                    209:                task            : ipc_space_t;
                    210:                name            : mach_port_name_t;
                    211:        out     members         : mach_port_name_array_t =
                    212:                                        ^array[] of mach_port_name_t
                    213:                                        ctype: mach_port_array_t);
                    214: 
                    215: /*
                    216:  *     Puts the member port (the task must have receive rights)
                    217:  *     into the after port set.  (Or removes it from any port set
                    218:  *     if after is MACH_PORT_NULL.)  If the port is already in
                    219:  *     a set, does an atomic move.
                    220:  */
                    221: 
                    222: routine mach_port_move_member(
                    223:                task            : ipc_space_t;
                    224:                member          : mach_port_name_t;
                    225:                after           : mach_port_name_t);
                    226: 
                    227: /*
                    228:  *     Requests a notification from the kernel.  The request
                    229:  *     must supply the send-once right which is used for
                    230:  *     the notification.  If a send-once right was previously
                    231:  *     registered, it is returned.  The msg_id must be one of
                    232:  *             MACH_NOTIFY_PORT_DESTROYED (receive rights)
                    233:  *             MACH_NOTIFY_DEAD_NAME (send/receive/send-once rights)
                    234:  *             MACH_NOTIFY_NO_SENDERS (receive rights)
                    235:  *
                    236:  *     The sync value specifies whether a notification should
                    237:  *     get sent immediately, if appropriate.  The exact meaning
                    238:  *     depends on the notification:
                    239:  *             MACH_NOTIFY_PORT_DESTROYED: must be zero.
                    240:  *             MACH_NOTIFY_DEAD_NAME: if non-zero, then name can be dead,
                    241:  *                     and the notification gets sent immediately.
                    242:  *                     If zero, then name can't be dead.
                    243:  *             MACH_NOTIFY_NO_SENDERS: the notification gets sent
                    244:  *                     immediately if the current mscount is greater
                    245:  *                     than or equal to the sync value and there are no
                    246:  *                     extant send rights.
                    247:  */
                    248: 
                    249: routine mach_port_request_notification(
                    250:                task            : ipc_space_t;
                    251:                name            : mach_port_name_t;
                    252:                id              : mach_msg_id_t;
                    253:                sync            : mach_port_mscount_t;
                    254:                notify          : mach_port_send_once_t;
                    255:        out     previous        : mach_port_send_once_t);
                    256: 
                    257: /*
                    258:  *     Inserts the specified rights into the target task,
                    259:  *     using the specified name.  If inserting send/receive
                    260:  *     rights and the task already has send/receive rights
                    261:  *     for the port, then the names must agree.  In any case,
                    262:  *     the task gains a user ref for the port.
                    263:  */
                    264: 
                    265: routine mach_port_insert_right(
                    266:                task            : ipc_space_t;
                    267:                name            : mach_port_name_t;
                    268:                poly            : mach_port_poly_t);
                    269: 
                    270: /*
                    271:  *     Returns the specified right for the named port
                    272:  *     in the target task, extracting that right from
                    273:  *     the target task.  The target task loses a user
                    274:  *     ref and the name may be available for recycling.
                    275:  *     msgt_name must be one of
                    276:  *             MACH_MSG_TYPE_MOVE_RECEIVE
                    277:  *             MACH_MSG_TYPE_COPY_SEND
                    278:  *             MACH_MSG_TYPE_MAKE_SEND
                    279:  *             MACH_MSG_TYPE_MOVE_SEND
                    280:  *             MACH_MSG_TYPE_MAKE_SEND_ONCE
                    281:  *             MACH_MSG_TYPE_MOVE_SEND_ONCE
                    282:  */
                    283: 
                    284: routine mach_port_extract_right(
                    285:                task            : ipc_space_t;
                    286:                name            : mach_port_name_t;
                    287:                msgt_name       : mach_msg_type_name_t;
                    288:        out     poly            : mach_port_poly_t);
                    289: 
                    290: /*
                    291:  *     The task must have receive rights for the named port.
                    292:  *     Returns a status structure (see mach/port.h).
                    293:  */
                    294: 
                    295: routine mach_port_get_receive_status(
                    296:                task            : ipc_space_t;
                    297:                name            : mach_port_name_t;
                    298:        out     status          : mach_port_status_t);
                    299: 
                    300: /*
                    301:  *     Only valid for receive rights.
                    302:  *     Sets the sequence number for the port.
                    303:  */
                    304: 
                    305: routine mach_port_set_seqno(
                    306:                task            : ipc_space_t;
                    307:                name            : mach_port_name_t;
                    308:                seqno           : mach_port_seqno_t);
                    309: 
                    310: #ifdef MIGRATING_THREADS
                    311: /*
                    312:  *     Only valid for receive rights.
                    313:  *     Set the user-mode entry info for RPCs coming through this port.
                    314:  *     Do this BEFORE attaching an ActPool to this port,
                    315:  *     unless you can be sure no RPCs will be coming through it yet.
                    316:  */
                    317: 
                    318: routine mach_port_set_rpcinfo(
                    319:                task            : ipc_space_t;
                    320:                name            : mach_port_name_t;
                    321:                rpc_info        : thread_info_t);       /* XXX */
                    322: 
                    323: /*
                    324:  *     Only valid for receive rights.
                    325:  *     Create a new activation for migrating RPC, and attach it to the port's ActPool.
                    326:  *     Create an ActPool for the port if it doesn't already have one.
                    327:  *     Supply a stack and receive memory buffer.
                    328:  */
                    329: 
                    330: routine mach_port_create_act(
                    331:                task            : task_t;
                    332:                name            : mach_port_name_t;
                    333:                user_stack      : vm_offset_t;
                    334:                user_rbuf       : vm_offset_t;
                    335:                user_rbuf_size  : vm_size_t;
                    336:        out     new_act         : thread_t);
                    337: 
1.1.1.2 ! root      338: #else  /* MIGRATING_THREADS */
        !           339: 
        !           340: skip; /* mach_port_set_rpcinfo */
        !           341: skip; /* mach_port_create_act */
        !           342: 
1.1       root      343: #endif /* MIGRATING_THREADS */
                    344: 
1.1.1.2 ! root      345: /*
        !           346:  *     Only valid for receive rights.
        !           347:  *     Set the protected payload for this right to the given value.
        !           348:  */
        !           349: 
        !           350: routine mach_port_set_protected_payload(
        !           351:                task            : ipc_space_t;
        !           352:                name            : mach_port_name_t;
        !           353:                payload         : natural_t);
        !           354: 
        !           355: /*
        !           356:  *     Only valid for receive rights.
        !           357:  *     Clear the protected payload for this right.
        !           358:  */
        !           359: 
        !           360: routine mach_port_clear_protected_payload(
        !           361:                task            : ipc_space_t;
        !           362:                name            : mach_port_name_t);

unix.superglobalmegacorp.com

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