btrfs: [] on the end of a struct field is a variable length array.
[haiku.git] / headers / private / kernel / sem.h
blob180876406061b38785dc45f2588861a70f84c303
1 /*
2 * Copyright 2002-2009, Axel Dörfler, axeld@pinc-software.de.
3 * Distributed under the terms of the MIT License.
5 * Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
6 * Distributed under the terms of the NewOS License.
7 */
8 #ifndef KERNEL_SEM_H
9 #define KERNEL_SEM_H
12 #include <OS.h>
13 #include <thread.h>
16 struct kernel_args;
17 struct select_info;
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
24 extern status_t haiku_sem_init(struct kernel_args *args);
25 extern void sem_delete_owned_sems(Team* team);
26 extern int32 sem_used_sems(void);
27 extern int32 sem_max_sems(void);
29 extern status_t select_sem(int32 object, struct select_info *info, bool kernel);
30 extern status_t deselect_sem(int32 object, struct select_info *info,
31 bool kernel);
33 extern sem_id create_sem_etc(int32 count, const char *name, team_id owner);
35 extern const char* sem_get_name_unsafe(sem_id id);
37 /* user calls */
38 sem_id _user_create_sem(int32 count, const char *name);
39 status_t _user_delete_sem(sem_id id);
40 status_t _user_acquire_sem(sem_id id);
41 status_t _user_acquire_sem_etc(sem_id id, int32 count, uint32 flags, bigtime_t timeout);
42 status_t _user_switch_sem(sem_id releaseSem, sem_id id);
43 status_t _user_switch_sem_etc(sem_id releaseSem, sem_id id, int32 count, uint32 flags, bigtime_t timeout);
44 status_t _user_release_sem(sem_id id);
45 status_t _user_release_sem_etc(sem_id id, int32 count, uint32 flags);
46 status_t _user_get_sem_count(sem_id id, int32* thread_count);
47 status_t _user_get_sem_info(sem_id, struct sem_info *, size_t);
48 status_t _user_get_next_sem_info(team_id, int32 *, struct sem_info *, size_t);
49 status_t _user_set_sem_owner(sem_id id, team_id team);
51 #ifdef __cplusplus
53 #endif
55 #endif /* KERNEL_SEM_H */