]> git.saurik.com Git - apple/libc.git/blame - mach/port_obj.c
Libc-320.tar.gz
[apple/libc.git] / mach / port_obj.c
CommitLineData
9385eb3d
A
1/*
2 * Copyright (c) 2003 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
7 *
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * file.
14 *
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
22 *
23 * @APPLE_LICENSE_HEADER_END@
24 */
e9ce8d39
A
25/*
26 * @OSF_COPYRIGHT@
27 */
28
29/*
30 * Define a service to map from a kernel-generated port name
31 * to server-defined "type" and "value" data to be associated
32 * with the port.
33 */
34#include <mach/port_obj.h>
35#include <mach/mach.h>
36
37#define DEFAULT_TABLE_SIZE (64 * 1024)
38
39struct port_obj_tentry *port_obj_table;
40int port_obj_table_size = DEFAULT_TABLE_SIZE;
41
42void port_obj_init(
43 int maxsize)
44{
45 kern_return_t kr;
46
47 kr = vm_allocate(mach_task_self(),
48 (vm_offset_t *)&port_obj_table,
49 (vm_size_t)(maxsize * sizeof (*port_obj_table)),
50 TRUE);
51 if (kr != KERN_SUCCESS)
52 panic("port_obj_init: can't vm_allocate");
53}