00001 00006 /* 00007 * The contents of this file are subject to the Mozilla Public License 00008 * Version 1.0 (the "License"); you may not use this file except in 00009 * compliance with the License. You may obtain a copy of the License 00010 * at http://www.mozilla.org/MPL/ 00011 * 00012 * Software distributed under the License is distributed on an "AS IS" 00013 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 00014 * the License for the specific language governing rights and 00015 * limitations under the License. 00016 * 00017 * The Original Code is legOS code, released October 17, 1999. 00018 * 00019 * The Initial Developer of the Original Code is Markus L. Noga. 00020 * Portions created by Markus L. Noga are Copyright (C) 1999 00021 * Markus L. Noga. All Rights Reserved. 00022 * 00023 * Contributor(s): Markus L. Noga <markus@noga.de> 00024 */ 00025 00026 #ifndef __unistd_h__ 00027 #define __unistd_h__ 00028 00029 #ifdef __cplusplus 00030 extern "C" { 00031 #endif 00032 00033 #include <tm.h> 00034 #include <time.h> 00035 00037 // 00038 // Functions 00039 // 00041 00042 #ifdef CONF_TM 00043 00052 extern tid_t execi(int (*code_start) (int, char **), int argc, char **argv, 00053 priority_t priority, size_t stack_size); 00054 00058 extern void shutdown_task(tid_t tid); 00059 00064 extern void shutdown_tasks(tflags_t flags); 00065 00070 extern void kill(tid_t tid); 00071 00076 extern void killall(priority_t p); 00077 00081 extern void exit(int code) __attribute__((noreturn)); 00082 00083 // 00085 // 00086 extern void yield(void); 00087 00094 extern wakeup_t wait_event(wakeup_t(*wakeup) (wakeup_t), wakeup_t data); 00095 00096 00098 00102 extern unsigned int sleep(unsigned int sec); 00103 00109 extern unsigned int msleep(unsigned int msec); 00110 00111 #else 00112 extern inline wakeup_t wait_event(wakeup_t(*wakeup) (wakeup_t), wakeup_t data) 00113 { 00114 wakeup_t res; 00115 00116 while (!(res = wakeup(data))) 00117 /* wait */; 00118 return res; 00119 } 00120 00121 // Replacement for sleep/msleep if no TM 00122 #define sleep(s) delay(1000*(s)) 00123 #define msleep(s) delay(s) 00124 #endif 00125 00126 #ifdef __cplusplus 00127 } 00128 #endif 00129 00130 #endif // __unistd_h__
brickOS is released under the
Mozilla Public License.
Original code copyright 1998-2002 by the authors. |