xref: /haiku/src/system/libroot/os/sem.c (revision 3cb015b1ee509d69c643506e8ff573808c86dcfc)
1 /*
2  * Copyright 2002-2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 
6 
7 #include <OS.h>
8 #include <syscalls.h>
9 
10 
11 sem_id
12 create_sem(int32 count, const char *name)
13 {
14 	return _kern_create_sem(count, name);
15 }
16 
17 
18 status_t
19 delete_sem(sem_id id)
20 {
21 	return _kern_delete_sem(id);
22 }
23 
24 
25 status_t
26 acquire_sem(sem_id id)
27 {
28 	return _kern_acquire_sem(id);
29 }
30 
31 
32 status_t
33 acquire_sem_etc(sem_id id, int32 count, uint32 flags, bigtime_t timeout)
34 {
35 	return _kern_acquire_sem_etc(id, count, flags, timeout);
36 }
37 
38 
39 // ToDo: the next two calls (switch_sem()) are not yet public API; no decision
40 //	has been made yet, so they may get changed or removed until R1
41 
42 status_t
43 switch_sem(sem_id releaseSem, sem_id id)
44 {
45 	return _kern_switch_sem(releaseSem, id);
46 }
47 
48 
49 status_t
50 switch_sem_etc(sem_id releaseSem, sem_id id, int32 count, uint32 flags, bigtime_t timeout)
51 {
52 	return _kern_switch_sem_etc(releaseSem, id, count, flags, timeout);
53 }
54 
55 
56 status_t
57 release_sem(sem_id id)
58 {
59 	return _kern_release_sem(id);
60 }
61 
62 
63 status_t
64 release_sem_etc(sem_id id, int32 count, uint32 flags)
65 {
66 	return _kern_release_sem_etc(id, count, flags);
67 }
68 
69 
70 status_t
71 get_sem_count(sem_id sem, int32 *count)
72 {
73 	return _kern_get_sem_count(sem, count);
74 }
75 
76 
77 status_t
78 set_sem_owner(sem_id sem, team_id team)
79 {
80 	return _kern_set_sem_owner(sem, team);
81 }
82 
83 
84 status_t
85 _get_sem_info(sem_id sem, sem_info *info, size_t size)
86 {
87 	return _kern_get_sem_info(sem, info, size);
88 }
89 
90 
91 status_t
92 _get_next_sem_info(team_id team, int32 *cookie, sem_info *info, size_t size)
93 {
94 	return _kern_get_next_sem_info(team, cookie, info, size);
95 }
96 
97