haiku/headers/private/system/thread_defs.h
Ingo Weinhold 57f2b5a013 * Changed the meaning of the {KERNEL,USER}_STACK_SIZE macros to not
include the guard pages. Adjusted the kernel and boot loader code
  accordingly -- the guard pages size is added/not removed respectively.
  The stack size passed to _kern_spawn_thread() is now the actually usable
  size, and it is no longer possible to specify a size smaller than or
  equal to the guard pages size.
* vm_create_anonymous_area(): Precommit two pages maximum -- a stack with
  only one page usable size obviously doesn't need two pages.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26819 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-08-05 17:19:46 +00:00

42 lines
1.1 KiB
C

/*
* Copyright 2008, Ingo Weinhold, ingo_weinhold@gmx.de.
* Distributed under the terms of the MIT License.
*/
#ifndef _SYSTEM_THREAD_DEFS_H
#define _SYSTEM_THREAD_DEFS_H
#include <OS.h>
#define THREAD_RETURN_EXIT 0x1
#define THREAD_RETURN_INTERRUPTED 0x2
#define THREAD_STOPPED 0x3
#define THREAD_CONTINUED 0x4
/** Size of the stack given to teams in user space */
#define USER_STACK_GUARD_PAGES 4 // 16 kB
#define USER_MAIN_THREAD_STACK_SIZE (16 * 1024 * 1024 \
- USER_STACK_GUARD_PAGES * B_PAGE_SIZE) // 16 MB
#define USER_STACK_SIZE (256 * 1024 \
- USER_STACK_GUARD_PAGES * B_PAGE_SIZE) // 256 kB
#define MIN_USER_STACK_SIZE (4 * 1024) // 4 KB
#define MAX_USER_STACK_SIZE (16 * 1024 * 1024 \
- USER_STACK_GUARD_PAGES * B_PAGE_SIZE) // 16 MB
struct thread_creation_attributes {
int32 (*entry)(thread_func, void *);
const char* name;
int32 priority;
void* args1;
void* args2;
void* stack_address;
size_t stack_size;
// when calling from kernel only
team_id team;
thread_id thread;
};
#endif /* _SYSTEM_THREAD_DEFS_H */