use the -newos toolchain even if -elf is present.
[newos.git] / include / kernel / sem.h
blob00e02a21acc9f63f94dc311eb49814fbba6b8be1
1 /*
2 ** Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
3 ** Distributed under the terms of the NewOS License.
4 */
5 #ifndef _KERNEL_SEM_H
6 #define _KERNEL_SEM_H
8 #include <kernel/thread.h>
9 #include <boot/stage2.h>
11 #define SEM_FLAG_NO_RESCHED 1
12 #define SEM_FLAG_TIMEOUT 2
13 #define SEM_FLAG_INTERRUPTABLE 4
15 struct sem_info {
16 sem_id sem;
17 proc_id proc;
18 char name[SYS_MAX_OS_NAME_LEN];
19 int32 count;
20 thread_id latest_holder;
23 int sem_init(kernel_args *ka);
24 sem_id sem_create_etc(int count, const char *name, proc_id owner);
25 sem_id sem_create(int count, const char *name);
26 int sem_delete(sem_id id);
27 int sem_delete_etc(sem_id id, int return_code);
28 int sem_acquire(sem_id id, int count);
29 int sem_acquire_etc(sem_id id, int count, int flags, bigtime_t timeout, int *deleted_retcode);
30 int sem_release(sem_id id, int count);
31 int sem_release_etc(sem_id id, int count, int flags);
32 int sem_get_count(sem_id id, int32* thread_count);
33 int sem_get_sem_info(sem_id id, struct sem_info *info);
34 int sem_get_next_sem_info(proc_id proc, uint32 *cookie, struct sem_info *info);
35 int set_sem_owner(sem_id id, proc_id proc);
37 sem_id user_sem_create(int count, const char *name);
38 int user_sem_delete(sem_id id);
39 int user_sem_delete_etc(sem_id id, int return_code);
40 int user_sem_acquire(sem_id id, int count);
41 int user_sem_acquire_etc(sem_id id, int count, int flags, bigtime_t timeout, int *deleted_retcode);
42 int user_sem_release(sem_id id, int count);
43 int user_sem_release_etc(sem_id id, int count, int flags);
44 int user_sem_get_count(sem_id id, int32* thread_count);
45 int user_sem_get_sem_info(sem_id id, struct sem_info *info);
46 int user_sem_get_next_sem_info(proc_id proc, uint32 *cookie, struct sem_info *info);
47 int user_set_sem_owner(sem_id id, proc_id proc);
49 int sem_delete_owned_sems(proc_id owner);
50 int sem_interrupt_thread(struct thread *t);
52 #endif