stuff.c
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include <l4/sys/syscalls.h>
00015 #include <l4/sys/ipc.h>
00016 #include <l4/util/thread.h>
00017 #include <l4/log/l4log.h>
00018 #include <l4/names/libnames.h>
00019 #include <stdio.h>
00020 #include "stuff.h"
00021 #include "flusher.h"
00022 #include "config.h"
00023
00024 #if CONFIG_USE_TCPIP
00025
00026
00027 oskit_addr_t l4libc_heapsize = 1024*512;
00028 #endif
00029
00030 #define STACKSIZE 16384
00031
00032 static char stacks[MAXTHREADS][STACKSIZE];
00033
00034 int thread_create(void(*func)(void), l4_threadid_t *id, const char*name){
00035 static int next_thread = 1;
00036 l4_threadid_t thread;
00037
00038 if(next_thread>MAXTHREADS){
00039 LOG_Error("No more space to create a thread");
00040 return -1;
00041 }
00042
00043 thread = l4util_create_thread(next_thread, func,
00044 (l4_umword_t*)&stacks[next_thread][0]);
00045 names_register_thread_weak(name, thread);
00046 next_thread++;
00047 if(id) *id = thread;
00048
00049 return 0;
00050 }