]>
Commit | Line | Data |
---|---|---|
1c79356b A |
1 | /* |
2 | * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
ff6e181a A |
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. Please obtain a copy of the License at | |
10 | * http://www.opensource.apple.com/apsl/ and read it before using this | |
11 | * file. | |
1c79356b | 12 | * |
ff6e181a A |
13 | * The Original Code and all software distributed under the License are |
14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
1c79356b A |
15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
ff6e181a A |
17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. |
18 | * Please see the License for the specific language governing rights and | |
19 | * limitations under the License. | |
1c79356b A |
20 | * |
21 | * @APPLE_LICENSE_HEADER_END@ | |
22 | */ | |
23 | /* | |
24 | * @OSF_COPYRIGHT@ | |
25 | */ | |
26 | /* | |
27 | * HISTORY | |
28 | * | |
29 | * Revision 1.1.1.1 1998/09/22 21:05:33 wsanchez | |
30 | * Import of Mac OS X kernel (~semeria) | |
31 | * | |
32 | * Revision 1.1.1.1 1998/03/07 02:25:55 wsanchez | |
33 | * Import of OSF Mach kernel (~mburg) | |
34 | * | |
35 | * Revision 1.1.10.3 1995/03/15 17:21:19 bruel | |
36 | * compile only if !__GNUC__. | |
37 | * [95/03/09 bruel] | |
38 | * | |
39 | * Revision 1.1.10.2 1995/01/06 19:48:05 devrcs | |
40 | * mk6 CR668 - 1.3b26 merge | |
41 | * * Revision 1.1.3.5 1994/05/06 18:51:43 tmt | |
42 | * Merge in DEC Alpha changes to osc1.3b19. | |
43 | * Merge Alpha changes into osc1.312b source code. | |
44 | * Remove ifdef sun around insque and remque. | |
45 | * * End1.3merge | |
46 | * [1994/11/04 09:29:15 dwm] | |
47 | * | |
48 | * Revision 1.1.10.1 1994/09/23 02:25:00 ezf | |
49 | * change marker to not FREE | |
50 | * [1994/09/22 21:35:34 ezf] | |
51 | * | |
52 | * Revision 1.1.3.3 1993/07/28 17:16:26 bernard | |
53 | * CR9523 -- Prototypes. | |
54 | * [1993/07/21 17:00:38 bernard] | |
55 | * | |
56 | * Revision 1.1.3.2 1993/06/02 23:39:41 jeffc | |
57 | * Added to OSF/1 R1.3 from NMK15.0. | |
58 | * [1993/06/02 21:13:58 jeffc] | |
59 | * | |
60 | * Revision 1.1 1992/09/30 02:09:52 robert | |
61 | * Initial revision | |
62 | * | |
63 | * $EndLog$ | |
64 | */ | |
65 | /* CMU_HIST */ | |
66 | /* | |
67 | * Revision 2.4 91/05/14 16:45:45 mrt | |
68 | * Correcting copyright | |
69 | * | |
70 | * Revision 2.3 91/05/08 12:48:22 dbg | |
71 | * Compile queue routines on vax. | |
72 | * [91/03/26 dbg] | |
73 | * | |
74 | * Revision 2.2 91/02/05 17:28:38 mrt | |
75 | * Changed to new Mach copyright | |
76 | * [91/02/01 16:16:22 mrt] | |
77 | * | |
78 | * Revision 2.1 89/08/03 15:51:47 rwd | |
79 | * Created. | |
80 | * | |
81 | * 17-Mar-87 David Golub (dbg) at Carnegie-Mellon University | |
82 | * Created from routines written by David L. Black. | |
83 | * | |
84 | */ | |
85 | /* CMU_ENDHIST */ | |
86 | /* | |
87 | * Mach Operating System | |
88 | * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University | |
89 | * All Rights Reserved. | |
90 | * | |
91 | * Permission to use, copy, modify and distribute this software and its | |
92 | * documentation is hereby granted, provided that both the copyright | |
93 | * notice and this permission notice appear in all copies of the | |
94 | * software, derivative works or modified versions, and any portions | |
95 | * thereof, and that both notices appear in supporting documentation. | |
96 | * | |
97 | * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" | |
98 | * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR | |
99 | * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. | |
100 | * | |
101 | * Carnegie Mellon requests users of this software to return to | |
102 | * | |
103 | * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU | |
104 | * School of Computer Science | |
105 | * Carnegie Mellon University | |
106 | * Pittsburgh PA 15213-3890 | |
107 | * | |
108 | * any improvements or extensions that they make and grant Carnegie Mellon | |
109 | * the rights to redistribute these changes. | |
110 | */ | |
111 | /* | |
112 | */ | |
113 | ||
114 | /* | |
115 | * Routines to implement queue package. | |
116 | */ | |
117 | ||
118 | #include <kern/queue.h> | |
119 | ||
120 | #if !defined(__GNUC__) | |
121 | ||
122 | /* | |
123 | * Insert element at head of queue. | |
124 | */ | |
125 | void | |
126 | enqueue_head( | |
127 | register queue_t que, | |
128 | register queue_entry_t elt) | |
129 | { | |
130 | elt->next = que->next; | |
131 | elt->prev = que; | |
132 | elt->next->prev = elt; | |
133 | que->next = elt; | |
134 | } | |
135 | ||
136 | /* | |
137 | * Insert element at tail of queue. | |
138 | */ | |
139 | void | |
140 | enqueue_tail( | |
141 | register queue_t que, | |
142 | register queue_entry_t elt) | |
143 | { | |
144 | elt->next = que; | |
145 | elt->prev = que->prev; | |
146 | elt->prev->next = elt; | |
147 | que->prev = elt; | |
148 | } | |
149 | ||
150 | /* | |
151 | * Remove and return element at head of queue. | |
152 | */ | |
153 | queue_entry_t | |
154 | dequeue_head( | |
155 | register queue_t que) | |
156 | { | |
157 | register queue_entry_t elt; | |
158 | ||
159 | if (que->next == que) | |
160 | return((queue_entry_t)0); | |
161 | ||
162 | elt = que->next; | |
163 | elt->next->prev = que; | |
164 | que->next = elt->next; | |
165 | return(elt); | |
166 | } | |
167 | ||
168 | /* | |
169 | * Remove and return element at tail of queue. | |
170 | */ | |
171 | queue_entry_t | |
172 | dequeue_tail( | |
173 | register queue_t que) | |
174 | { | |
175 | register queue_entry_t elt; | |
176 | ||
177 | if (que->prev == que) | |
178 | return((queue_entry_t)0); | |
179 | ||
180 | elt = que->prev; | |
181 | elt->prev->next = que; | |
182 | que->prev = elt->prev; | |
183 | return(elt); | |
184 | } | |
185 | ||
186 | /* | |
187 | * Remove arbitrary element from queue. | |
188 | * Does not check whether element is on queue - the world | |
189 | * will go haywire if it isn't. | |
190 | */ | |
191 | ||
192 | /*ARGSUSED*/ | |
193 | void | |
194 | remqueue( | |
195 | queue_t que, | |
196 | register queue_entry_t elt) | |
197 | { | |
198 | elt->next->prev = elt->prev; | |
199 | elt->prev->next = elt->next; | |
200 | } | |
201 | ||
202 | /* | |
203 | * Routines to directly imitate the VAX hardware queue | |
204 | * package. | |
205 | */ | |
206 | void | |
207 | insque( | |
208 | register queue_entry_t entry, | |
209 | register queue_entry_t pred) | |
210 | { | |
211 | entry->next = pred->next; | |
212 | entry->prev = pred; | |
213 | (pred->next)->prev = entry; | |
214 | pred->next = entry; | |
215 | } | |
216 | ||
217 | int | |
218 | remque( | |
219 | register queue_entry_t elt) | |
220 | { | |
221 | (elt->next)->prev = elt->prev; | |
222 | (elt->prev)->next = elt->next; | |
223 | return((int)elt); | |
224 | } | |
225 | ||
226 | #endif |