1/*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 * 
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 * 
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 * 
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 * 
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/*
29 * @OSF_COPYRIGHT@
30 * 
31 */
32/*
33 *	File: mach/sync.defs
34 *	Author: Joseph CaraDonna
35 *
36 *	Exported kernel calls	
37 *
38 */
39
40subsystem
41#if	KERNEL_SERVER
42	KernelServer
43#endif	/* KERNEL_SERVER */
44			sync 617000;
45
46#include <mach/std_types.defs>
47#include <mach/mach_types.defs>
48#include <mach/clock_types.defs>
49
50#if	KERNEL_SERVER
51import <kern/sync_lock.h>;
52import <kern/sync_sema.h>;
53import <kern/ipc_sync.h>;
54#endif	/* KERNEL_SERVER */
55
56
57type semaphore_t = mach_port_t
58		ctype: mach_port_t
59#if	KERNEL_SERVER
60		intran: semaphore_t convert_port_to_semaphore(mach_port_t)
61		outtran: mach_port_t convert_semaphore_to_port(semaphore_t)
62		destructor: semaphore_dereference(semaphore_t)
63#endif	/* KERNEL_SERVER */
64		;
65
66type semaphore_consume_ref_t = mach_port_move_send_t
67		ctype: mach_port_t
68#if	KERNEL_SERVER
69		intran: semaphore_t convert_port_to_semaphore(mach_port_t)
70		destructor: semaphore_dereference(semaphore_t)
71#endif	/* KERNEL_SERVER */
72		;
73
74type lock_set_t = mach_port_t
75		ctype: mach_port_t
76#if	KERNEL_SERVER
77		intran: lock_set_t convert_port_to_lock_set(mach_port_t)
78		outtran: mach_port_t convert_lock_set_to_port(lock_set_t)
79		destructor: lock_set_dereference(lock_set_t)
80#endif	/* KERNEL_SERVER */
81		;
82
83
84routine semaphore_create(
85		task		: task_t;
86	out	semaphore	: semaphore_t;
87		policy		: int;
88		value		: int);
89
90routine semaphore_destroy(
91		task		: task_t;
92		semaphore	: semaphore_consume_ref_t);
93
94routine semaphore_signal(
95		semaphore	: semaphore_t);
96
97routine semaphore_signal_all(
98		semaphore	: semaphore_t);
99
100routine semaphore_wait(
101		semaphore	: semaphore_t);
102
103routine lock_set_create(
104		task		: task_t;
105	out	new_lock_set	: lock_set_t;
106		n_ulocks	: int;
107		policy		: int);
108
109routine lock_set_destroy(
110		task		: task_t;
111		lock_set	: lock_set_t);
112
113routine lock_acquire(
114		lock_set	: lock_set_t;
115		lock_id		: int);
116
117routine lock_release(
118		lock_set	: lock_set_t;
119		lock_id		: int);
120
121routine lock_try(
122		lock_set	: lock_set_t;
123		lock_id		: int);
124
125routine lock_make_stable(
126		lock_set	: lock_set_t;
127		lock_id		: int);
128
129routine lock_handoff(
130		lock_set	: lock_set_t;
131		lock_id		: int);
132
133routine lock_handoff_accept(
134		lock_set	: lock_set_t;
135		lock_id		: int);
136
137routine semaphore_signal_thread(
138		semaphore	: semaphore_t;
139		thread		: thread_act_t);
140
141routine semaphore_timedwait(
142		semaphore	: semaphore_t;
143		wait_time	: mach_timespec_t);
144
145/* vim: set ft=c : */
146