unistd.h File Reference

Interface: reduced UNIX standard library. More...

#include <tm.h>
#include <time.h>
Include dependency graph for unistd.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

tid_t execi (int(*code_start)(int, char **), int argc, char **argv, priority_t priority, size_t stack_size)
 
void shutdown_task (tid_t tid)
 
void shutdown_tasks (tflags_t flags)
 
void kill (tid_t tid)
 
void killall (priority_t p)
 
void exit (int code) __attribute__((noreturn))
 
void yield (void)
 current task yields the rest of timeslice More...
 
wakeup_t wait_event (wakeup_t(*wakeup)(wakeup_t), wakeup_t data)
 
unsigned int sleep (unsigned int sec)
 delay execution allowing other tasks to run More...
 
unsigned int msleep (unsigned int msec)
 

Detailed Description

Interface: reduced UNIX standard library.

Author
Markus L. Noga marku.nosp@m.s@no.nosp@m.ga.de

Definition in file unistd.h.

Function Documentation

§ execi()

tid_t execi ( int(*)(int, char **)  code_start,
int  argc,
char **  argv,
priority_t  priority,
size_t  stack_size 
)

start task executing (with passed paramters) called from user code

Parameters
code_startthe entry-point of the new task
argcthe count of arguments passed (0 if none)
argvan array of pointers each pointing to an argument (NULL if none)
prioritythe priority at which to run this task
stack_sizethe amount of memory in bytes to allocate to this task for its call stack
Returns
-1 if failed to start, else tid (task-id)

§ exit()

void exit ( int  code)

exit task, returning code

Parameters
codethe exit code to return to the caller

§ kill()

void kill ( tid_t  tid)

kill specified (tid) task

Parameters
tidTaskId of task to be killed
Todo:
FIXME: this belongs in a different header

§ killall()

void killall ( priority_t  p)

kill all tasks with priority less than or equal equal to p, excluding self.

Parameters
ppriority of tasks at which or below we kill tasks
Side Effects:
All tasks meeting this criteria are killed

§ msleep()

unsigned int msleep ( unsigned int  msec)

delay execution allowing other tasks to run

Parameters
msecsleep duration in milliSeconds
Returns
number of milliSeconds left if interrupted, else 0
Bug:
interruptions not implemented

§ shutdown_task()

void shutdown_task ( tid_t  tid)

signal shutdown for a task

Parameters
tidTaskId of task to be notified

§ shutdown_tasks()

void shutdown_tasks ( tflags_t  flags)

signal shutdown for many tasks

Parameters
flagsindicating...
Todo:
research {flags}, then fix this documentation

§ sleep()

unsigned int sleep ( unsigned int  sec)

delay execution allowing other tasks to run

Parameters
secsleep duration in seconds
Returns
number of seconds left if interrupted, else 0
Bug:
interruptions not implemented

§ wait_event()

wakeup_t wait_event ( wakeup_t(*)(wakeup_t wakeup,
wakeup_t  data 
)

suspend task until wakeup function returns non-null

Parameters
wakeupthe function to be called when woken up
datathe wakeup_t structure to be passed to the called function
Returns
wakeup() return value
Note
wakeup function is called in task scheduler context

Referenced by get_msg().

§ yield()

void yield ( void  )

current task yields the rest of timeslice


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

Generated for brickOS C++ by doxygen 1.8.12