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