unistd.h
Go to the documentation of this file.
1
6/*
7 * The contents of this file are subject to the Mozilla Public License
8 * Version 1.0 (the "License"); you may not use this file except in
9 * compliance with the License. You may obtain a copy of the License
10 * at http://www.mozilla.org/MPL/
11 *
12 * Software distributed under the License is distributed on an "AS IS"
13 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14 * the License for the specific language governing rights and
15 * limitations under the License.
16 *
17 * The Original Code is legOS code, released October 17, 1999.
18 *
19 * The Initial Developer of the Original Code is Markus L. Noga.
20 * Portions created by Markus L. Noga are Copyright (C) 1999
21 * Markus L. Noga. All Rights Reserved.
22 *
23 * Contributor(s): Markus L. Noga <markus@noga.de>
24 */
25
26#ifndef __unistd_h__
27#define __unistd_h__
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33#include <tm.h>
34#include <time.h>
35
37//
38// Functions
39//
41
42#ifdef CONF_TM
52extern tid_t execi(int (*code_start) (int, char **), int argc, char **argv,
53 priority_t priority, size_t stack_size);
54
58extern void shutdown_task(tid_t tid);
59
64extern void shutdown_tasks(tflags_t flags);
65
70extern void kill(tid_t tid);
71
76extern void killall(priority_t p);
77
81extern void exit(int code) __attribute__((noreturn));
82
83//
85//
86extern void yield(void);
87
94extern wakeup_t wait_event(wakeup_t(*wakeup) (wakeup_t), wakeup_t data);
95
96
98
102extern unsigned int sleep(unsigned int sec);
103
109extern unsigned int msleep(unsigned int msec);
110
111#else
112extern inline wakeup_t wait_event(wakeup_t(*wakeup) (wakeup_t), wakeup_t data)
113{
114 wakeup_t res;
115
116 while (!(res = wakeup(data)))
117 /* wait */;
118 return res;
119}
120
121// Replacement for sleep/msleep if no TM
122#define sleep(s) delay(1000*(s))
123#define msleep(s) delay(s)
124#endif
125
126#ifdef __cplusplus
127}
128#endif
129
130#endif // __unistd_h__
Interface: Time-related data and types.
Interface: task management.
volatile unsigned char tflags_t
task flags type
Definition: tm.h:46
signed int tid_t
task id type
Definition: tm.h:143
unsigned long wakeup_t
wakeup data area type
Definition: tm.h:57
unsigned char priority_t
task priority type
Definition: tm.h:48
unsigned int sleep(unsigned int sec)
delay execution allowing other tasks to run
void exit(int code) __attribute__((noreturn))
void shutdown_task(tid_t tid)
tid_t execi(int(*code_start)(int, char **), int argc, char **argv, priority_t priority, size_t stack_size)
void yield(void)
current task yields the rest of timeslice
unsigned int msleep(unsigned int msec)
wakeup_t wait_event(wakeup_t(*wakeup)(wakeup_t), wakeup_t data)
void killall(priority_t p)
void kill(tid_t tid)
void shutdown_tasks(tflags_t flags)

brickOS is released under the Mozilla Public License.
Original code copyright 1998-2005 by the authors.

Generated for brickOS C++ by doxygen 1.9.4