xref: /minix/tests/lib/semaphore/sem.c (revision 11be35a1)
1*11be35a1SLionel Sambuc /*	$NetBSD: sem.c,v 1.10 2012/03/09 14:25:34 joerg Exp $	*/
2*11be35a1SLionel Sambuc 
3*11be35a1SLionel Sambuc /*
4*11be35a1SLionel Sambuc  * Common code for semaphore tests.  This can be included both into
5*11be35a1SLionel Sambuc  * programs using librt and libpthread.
6*11be35a1SLionel Sambuc  */
7*11be35a1SLionel Sambuc 
8*11be35a1SLionel Sambuc #include <sys/types.h>
9*11be35a1SLionel Sambuc 
10*11be35a1SLionel Sambuc #include <rump/rump.h>
11*11be35a1SLionel Sambuc #include <rump/rump_syscalls.h>
12*11be35a1SLionel Sambuc 
13*11be35a1SLionel Sambuc #include <atf-c.h>
14*11be35a1SLionel Sambuc #include <errno.h>
15*11be35a1SLionel Sambuc #include <fcntl.h>
16*11be35a1SLionel Sambuc #include <pthread.h>
17*11be35a1SLionel Sambuc #include <semaphore.h>
18*11be35a1SLionel Sambuc #include <sched.h>
19*11be35a1SLionel Sambuc #include <stdint.h>
20*11be35a1SLionel Sambuc #include <stdio.h>
21*11be35a1SLionel Sambuc #include <stdlib.h>
22*11be35a1SLionel Sambuc #include <unistd.h>
23*11be35a1SLionel Sambuc 
24*11be35a1SLionel Sambuc #include "../../h_macros.h"
25*11be35a1SLionel Sambuc 
26*11be35a1SLionel Sambuc ATF_TC(postwait);
ATF_TC_HEAD(postwait,tc)27*11be35a1SLionel Sambuc ATF_TC_HEAD(postwait, tc)
28*11be35a1SLionel Sambuc {
29*11be35a1SLionel Sambuc 
30*11be35a1SLionel Sambuc 	atf_tc_set_md_var(tc, "descr", "tests post and wait from a "
31*11be35a1SLionel Sambuc 	    "single thread (%s)", LIBNAME);
32*11be35a1SLionel Sambuc }
33*11be35a1SLionel Sambuc 
ATF_TC_BODY(postwait,tc)34*11be35a1SLionel Sambuc ATF_TC_BODY(postwait, tc)
35*11be35a1SLionel Sambuc {
36*11be35a1SLionel Sambuc 	sem_t sem;
37*11be35a1SLionel Sambuc 	int rv;
38*11be35a1SLionel Sambuc 
39*11be35a1SLionel Sambuc 	rump_init();
40*11be35a1SLionel Sambuc 
41*11be35a1SLionel Sambuc 	ATF_REQUIRE_EQ(sem_init(&sem, 1, 0), 0);
42*11be35a1SLionel Sambuc 
43*11be35a1SLionel Sambuc 	sem_post(&sem);
44*11be35a1SLionel Sambuc 	sem_post(&sem);
45*11be35a1SLionel Sambuc 
46*11be35a1SLionel Sambuc 	sem_wait(&sem);
47*11be35a1SLionel Sambuc 	sem_wait(&sem);
48*11be35a1SLionel Sambuc 	rv = sem_trywait(&sem);
49*11be35a1SLionel Sambuc 	ATF_REQUIRE(errno == EAGAIN);
50*11be35a1SLionel Sambuc 	ATF_REQUIRE(rv == -1);
51*11be35a1SLionel Sambuc }
52*11be35a1SLionel Sambuc 
53*11be35a1SLionel Sambuc ATF_TC(initvalue);
ATF_TC_HEAD(initvalue,tc)54*11be35a1SLionel Sambuc ATF_TC_HEAD(initvalue, tc)
55*11be35a1SLionel Sambuc {
56*11be35a1SLionel Sambuc 
57*11be35a1SLionel Sambuc 	atf_tc_set_md_var(tc, "descr", "tests initialization with a non-zero "
58*11be35a1SLionel Sambuc 	    "value (%s)", LIBNAME);
59*11be35a1SLionel Sambuc }
60*11be35a1SLionel Sambuc 
ATF_TC_BODY(initvalue,tc)61*11be35a1SLionel Sambuc ATF_TC_BODY(initvalue, tc)
62*11be35a1SLionel Sambuc {
63*11be35a1SLionel Sambuc 	sem_t sem;
64*11be35a1SLionel Sambuc 
65*11be35a1SLionel Sambuc 	rump_init();
66*11be35a1SLionel Sambuc 	sem_init(&sem, 1, 4);
67*11be35a1SLionel Sambuc 
68*11be35a1SLionel Sambuc 	ATF_REQUIRE_EQ(sem_trywait(&sem), 0);
69*11be35a1SLionel Sambuc 	ATF_REQUIRE_EQ(sem_trywait(&sem), 0);
70*11be35a1SLionel Sambuc 	ATF_REQUIRE_EQ(sem_trywait(&sem), 0);
71*11be35a1SLionel Sambuc 	ATF_REQUIRE_EQ(sem_trywait(&sem), 0);
72*11be35a1SLionel Sambuc 	ATF_REQUIRE_EQ(sem_trywait(&sem), -1);
73*11be35a1SLionel Sambuc }
74*11be35a1SLionel Sambuc 
75*11be35a1SLionel Sambuc ATF_TC(destroy);
ATF_TC_HEAD(destroy,tc)76*11be35a1SLionel Sambuc ATF_TC_HEAD(destroy, tc)
77*11be35a1SLionel Sambuc {
78*11be35a1SLionel Sambuc 
79*11be35a1SLionel Sambuc 	atf_tc_set_md_var(tc, "descr", "tests sem_destroy works (%s)", LIBNAME);
80*11be35a1SLionel Sambuc }
81*11be35a1SLionel Sambuc 
ATF_TC_BODY(destroy,tc)82*11be35a1SLionel Sambuc ATF_TC_BODY(destroy, tc)
83*11be35a1SLionel Sambuc {
84*11be35a1SLionel Sambuc 	sem_t sem;
85*11be35a1SLionel Sambuc 	int rv, i;
86*11be35a1SLionel Sambuc 
87*11be35a1SLionel Sambuc 	rump_init();
88*11be35a1SLionel Sambuc 	for (i = 0; i < 2; i++) {
89*11be35a1SLionel Sambuc 		sem_init(&sem, 1, 1);
90*11be35a1SLionel Sambuc 
91*11be35a1SLionel Sambuc 		ATF_REQUIRE_EQ(sem_trywait(&sem), 0);
92*11be35a1SLionel Sambuc 		ATF_REQUIRE_EQ(sem_trywait(&sem), -1);
93*11be35a1SLionel Sambuc 		ATF_REQUIRE_EQ(sem_destroy(&sem), 0);
94*11be35a1SLionel Sambuc 		rv = sem_trywait(&sem);
95*11be35a1SLionel Sambuc 		ATF_REQUIRE_EQ(errno, EINVAL);
96*11be35a1SLionel Sambuc 		ATF_REQUIRE_EQ(rv, -1);
97*11be35a1SLionel Sambuc 	}
98*11be35a1SLionel Sambuc }
99*11be35a1SLionel Sambuc 
100*11be35a1SLionel Sambuc ATF_TC(busydestroy);
ATF_TC_HEAD(busydestroy,tc)101*11be35a1SLionel Sambuc ATF_TC_HEAD(busydestroy, tc)
102*11be35a1SLionel Sambuc {
103*11be35a1SLionel Sambuc 
104*11be35a1SLionel Sambuc 	atf_tc_set_md_var(tc, "descr", "tests sem_destroy report EBUSY for "
105*11be35a1SLionel Sambuc 	    "a busy semaphore (%s)", LIBNAME);
106*11be35a1SLionel Sambuc }
107*11be35a1SLionel Sambuc 
108*11be35a1SLionel Sambuc static void *
hthread(void * arg)109*11be35a1SLionel Sambuc hthread(void *arg)
110*11be35a1SLionel Sambuc {
111*11be35a1SLionel Sambuc 	sem_t *semmarit = arg;
112*11be35a1SLionel Sambuc 
113*11be35a1SLionel Sambuc 	for (;;) {
114*11be35a1SLionel Sambuc 		sem_post(&semmarit[2]);
115*11be35a1SLionel Sambuc 		sem_wait(&semmarit[1]);
116*11be35a1SLionel Sambuc 		sem_wait(&semmarit[0]);
117*11be35a1SLionel Sambuc 	}
118*11be35a1SLionel Sambuc 
119*11be35a1SLionel Sambuc 	return NULL;
120*11be35a1SLionel Sambuc }
121*11be35a1SLionel Sambuc 
ATF_TC_BODY(busydestroy,tc)122*11be35a1SLionel Sambuc ATF_TC_BODY(busydestroy, tc)
123*11be35a1SLionel Sambuc {
124*11be35a1SLionel Sambuc 	sem_t semmarit[3];
125*11be35a1SLionel Sambuc 	pthread_t pt;
126*11be35a1SLionel Sambuc 	int i;
127*11be35a1SLionel Sambuc 
128*11be35a1SLionel Sambuc 	/* use a unicpu rump kernel.  this means less chance for race */
129*11be35a1SLionel Sambuc 	setenv("RUMP_NCPU", "1", 1);
130*11be35a1SLionel Sambuc 
131*11be35a1SLionel Sambuc 	rump_init();
132*11be35a1SLionel Sambuc 	sem_init(&semmarit[0], 1, 0);
133*11be35a1SLionel Sambuc 	sem_init(&semmarit[1], 1, 0);
134*11be35a1SLionel Sambuc 	sem_init(&semmarit[2], 1, 0);
135*11be35a1SLionel Sambuc 
136*11be35a1SLionel Sambuc 	pthread_create(&pt, NULL, hthread, semmarit);
137*11be35a1SLionel Sambuc 
138*11be35a1SLionel Sambuc 	/*
139*11be35a1SLionel Sambuc 	 * Make a best-effort to catch the other thread with its pants down.
140*11be35a1SLionel Sambuc 	 * We can't do this for sure, can we?  Although, we could reach
141*11be35a1SLionel Sambuc 	 * inside the rump kernel and inquire about the thread's sleep
142*11be35a1SLionel Sambuc 	 * status.
143*11be35a1SLionel Sambuc 	 */
144*11be35a1SLionel Sambuc 	for (i = 0; i < 1000; i++) {
145*11be35a1SLionel Sambuc 		sem_wait(&semmarit[2]);
146*11be35a1SLionel Sambuc 		usleep(1);
147*11be35a1SLionel Sambuc 		if (sem_destroy(&semmarit[1]) == -1)
148*11be35a1SLionel Sambuc 			if (errno == EBUSY)
149*11be35a1SLionel Sambuc 				break;
150*11be35a1SLionel Sambuc 
151*11be35a1SLionel Sambuc 		/*
152*11be35a1SLionel Sambuc 		 * Didn't catch it?  ok, recreate and post to make the
153*11be35a1SLionel Sambuc 		 * other thread run
154*11be35a1SLionel Sambuc 		 */
155*11be35a1SLionel Sambuc 		sem_init(&semmarit[1], 1, 0);
156*11be35a1SLionel Sambuc 		sem_post(&semmarit[0]);
157*11be35a1SLionel Sambuc 		sem_post(&semmarit[1]);
158*11be35a1SLionel Sambuc 
159*11be35a1SLionel Sambuc 	}
160*11be35a1SLionel Sambuc 	if (i == 1000)
161*11be35a1SLionel Sambuc 		atf_tc_fail("sem destroy not reporting EBUSY");
162*11be35a1SLionel Sambuc 
163*11be35a1SLionel Sambuc 	pthread_cancel(pt);
164*11be35a1SLionel Sambuc 	pthread_join(pt, NULL);
165*11be35a1SLionel Sambuc }
166*11be35a1SLionel Sambuc 
167*11be35a1SLionel Sambuc ATF_TC(blockwait);
ATF_TC_HEAD(blockwait,tc)168*11be35a1SLionel Sambuc ATF_TC_HEAD(blockwait, tc)
169*11be35a1SLionel Sambuc {
170*11be35a1SLionel Sambuc 
171*11be35a1SLionel Sambuc 	atf_tc_set_md_var(tc, "descr", "tests sem_wait can handle blocking "
172*11be35a1SLionel Sambuc 	    "(%s)", LIBNAME);
173*11be35a1SLionel Sambuc 	atf_tc_set_md_var(tc, "timeout", "2");
174*11be35a1SLionel Sambuc }
175*11be35a1SLionel Sambuc 
ATF_TC_BODY(blockwait,tc)176*11be35a1SLionel Sambuc ATF_TC_BODY(blockwait, tc)
177*11be35a1SLionel Sambuc {
178*11be35a1SLionel Sambuc 	sem_t semmarit[3];
179*11be35a1SLionel Sambuc 	pthread_t pt;
180*11be35a1SLionel Sambuc 	int i;
181*11be35a1SLionel Sambuc 
182*11be35a1SLionel Sambuc 	rump_init();
183*11be35a1SLionel Sambuc 	sem_init(&semmarit[0], 1, 0);
184*11be35a1SLionel Sambuc 	sem_init(&semmarit[1], 1, 0);
185*11be35a1SLionel Sambuc 	sem_init(&semmarit[2], 1, 0);
186*11be35a1SLionel Sambuc 
187*11be35a1SLionel Sambuc 	pthread_create(&pt, NULL, hthread, semmarit);
188*11be35a1SLionel Sambuc 
189*11be35a1SLionel Sambuc 	/*
190*11be35a1SLionel Sambuc 	 * Make a best-effort.  Unless we're extremely unlucky, we should
191*11be35a1SLionel Sambuc 	 * at least one blocking wait.
192*11be35a1SLionel Sambuc 	 */
193*11be35a1SLionel Sambuc 	for (i = 0; i < 10; i++) {
194*11be35a1SLionel Sambuc 		sem_wait(&semmarit[2]);
195*11be35a1SLionel Sambuc 		usleep(1);
196*11be35a1SLionel Sambuc 		sem_post(&semmarit[0]);
197*11be35a1SLionel Sambuc 		sem_post(&semmarit[1]);
198*11be35a1SLionel Sambuc 
199*11be35a1SLionel Sambuc 	}
200*11be35a1SLionel Sambuc 
201*11be35a1SLionel Sambuc 	pthread_cancel(pt);
202*11be35a1SLionel Sambuc 	pthread_join(pt, NULL);
203*11be35a1SLionel Sambuc }
204*11be35a1SLionel Sambuc 
205*11be35a1SLionel Sambuc ATF_TC(blocktimedwait);
ATF_TC_HEAD(blocktimedwait,tc)206*11be35a1SLionel Sambuc ATF_TC_HEAD(blocktimedwait, tc)
207*11be35a1SLionel Sambuc {
208*11be35a1SLionel Sambuc 
209*11be35a1SLionel Sambuc 	atf_tc_set_md_var(tc, "descr", "tests sem_timedwait can handle blocking"
210*11be35a1SLionel Sambuc 	    " (%s)", LIBNAME);
211*11be35a1SLionel Sambuc 	atf_tc_set_md_var(tc, "timeout", "2");
212*11be35a1SLionel Sambuc }
213*11be35a1SLionel Sambuc 
ATF_TC_BODY(blocktimedwait,tc)214*11be35a1SLionel Sambuc ATF_TC_BODY(blocktimedwait, tc)
215*11be35a1SLionel Sambuc {
216*11be35a1SLionel Sambuc 	sem_t semid;
217*11be35a1SLionel Sambuc 	struct timespec tp;
218*11be35a1SLionel Sambuc 
219*11be35a1SLionel Sambuc 	rump_init();
220*11be35a1SLionel Sambuc 
221*11be35a1SLionel Sambuc 	clock_gettime(CLOCK_REALTIME, &tp);
222*11be35a1SLionel Sambuc 	tp.tv_nsec += 50000000;
223*11be35a1SLionel Sambuc 	tp.tv_sec += tp.tv_nsec / 1000000000;
224*11be35a1SLionel Sambuc 	tp.tv_nsec %= 1000000000;
225*11be35a1SLionel Sambuc 
226*11be35a1SLionel Sambuc 	ATF_REQUIRE_EQ(sem_init(&semid, 1, 0), 0);
227*11be35a1SLionel Sambuc 	ATF_REQUIRE_ERRNO(ETIMEDOUT, sem_timedwait(&semid, &tp) == -1);
228*11be35a1SLionel Sambuc }
229*11be35a1SLionel Sambuc 
230*11be35a1SLionel Sambuc ATF_TC(named);
ATF_TC_HEAD(named,tc)231*11be35a1SLionel Sambuc ATF_TC_HEAD(named, tc)
232*11be35a1SLionel Sambuc {
233*11be35a1SLionel Sambuc 
234*11be35a1SLionel Sambuc 	atf_tc_set_md_var(tc, "descr", "tests named semaphores (%s)", LIBNAME);
235*11be35a1SLionel Sambuc }
236*11be35a1SLionel Sambuc 
237*11be35a1SLionel Sambuc /*
238*11be35a1SLionel Sambuc  * Wow, easy naming rules.  it's these times i'm really happy i can
239*11be35a1SLionel Sambuc  * single-step into the kernel.
240*11be35a1SLionel Sambuc  */
241*11be35a1SLionel Sambuc #define SEM1 "/precious_sem"
242*11be35a1SLionel Sambuc #define SEM2 "/justsem"
ATF_TC_BODY(named,tc)243*11be35a1SLionel Sambuc ATF_TC_BODY(named, tc)
244*11be35a1SLionel Sambuc {
245*11be35a1SLionel Sambuc 	sem_t *sem1, *sem2;
246*11be35a1SLionel Sambuc 	void *rv;
247*11be35a1SLionel Sambuc 
248*11be35a1SLionel Sambuc 	rump_init();
249*11be35a1SLionel Sambuc 	sem1 = sem_open(SEM1, 0);
250*11be35a1SLionel Sambuc 	ATF_REQUIRE_EQ(errno, ENOENT);
251*11be35a1SLionel Sambuc 	ATF_REQUIRE_EQ(sem1, NULL);
252*11be35a1SLionel Sambuc 
253*11be35a1SLionel Sambuc 	sem1 = sem_open(SEM1, O_CREAT, 0444, 1);
254*11be35a1SLionel Sambuc 	if (sem1 == NULL)
255*11be35a1SLionel Sambuc 		atf_tc_fail_errno("sem_open O_CREAT");
256*11be35a1SLionel Sambuc 
257*11be35a1SLionel Sambuc 	rv = sem_open(SEM1, O_CREAT | O_EXCL);
258*11be35a1SLionel Sambuc 	ATF_REQUIRE_EQ(errno, EEXIST);
259*11be35a1SLionel Sambuc 	ATF_REQUIRE_EQ(rv, NULL);
260*11be35a1SLionel Sambuc 
261*11be35a1SLionel Sambuc 	sem2 = sem_open(SEM2, O_CREAT, 0444, 0);
262*11be35a1SLionel Sambuc 	if (sem2 == NULL)
263*11be35a1SLionel Sambuc 		atf_tc_fail_errno("sem_open O_CREAT");
264*11be35a1SLionel Sambuc 
265*11be35a1SLionel Sambuc 	/* check that semaphores are independent */
266*11be35a1SLionel Sambuc 	ATF_REQUIRE_EQ(sem_trywait(sem2), -1);
267*11be35a1SLionel Sambuc 	ATF_REQUIRE_EQ(sem_trywait(sem1), 0);
268*11be35a1SLionel Sambuc 	ATF_REQUIRE_EQ(sem_trywait(sem1), -1);
269*11be35a1SLionel Sambuc 
270*11be35a1SLionel Sambuc 	/* check that unlinked remains valid */
271*11be35a1SLionel Sambuc 	sem_unlink(SEM2);
272*11be35a1SLionel Sambuc 	ATF_REQUIRE_EQ(sem_post(sem2), 0);
273*11be35a1SLionel Sambuc 	ATF_REQUIRE_EQ(sem_trywait(sem2), 0);
274*11be35a1SLionel Sambuc 	ATF_REQUIRE_EQ(sem_trywait(sem2), -1);
275*11be35a1SLionel Sambuc 	ATF_REQUIRE_EQ(errno, EAGAIN);
276*11be35a1SLionel Sambuc 
277*11be35a1SLionel Sambuc #if 0 /* see unlink */
278*11be35a1SLionel Sambuc 	/* close it and check that it's gone */
279*11be35a1SLionel Sambuc 	if (sem_close(sem2) != 0)
280*11be35a1SLionel Sambuc 		atf_tc_fail_errno("sem close");
281*11be35a1SLionel Sambuc 	ATF_REQUIRE_EQ(sem_trywait(sem2), -1);
282*11be35a1SLionel Sambuc 	ATF_REQUIRE_EQ(errno, EINVAL);
283*11be35a1SLionel Sambuc #endif
284*11be35a1SLionel Sambuc 
285*11be35a1SLionel Sambuc 	/* check that we still have sem1 */
286*11be35a1SLionel Sambuc 	sem_post(sem1);
287*11be35a1SLionel Sambuc 	ATF_REQUIRE_EQ(sem_trywait(sem1), 0);
288*11be35a1SLionel Sambuc 	ATF_REQUIRE_EQ(sem_trywait(sem1), -1);
289*11be35a1SLionel Sambuc 	ATF_REQUIRE_EQ(errno, EAGAIN);
290*11be35a1SLionel Sambuc }
291*11be35a1SLionel Sambuc 
292*11be35a1SLionel Sambuc ATF_TC(unlink);
ATF_TC_HEAD(unlink,tc)293*11be35a1SLionel Sambuc ATF_TC_HEAD(unlink, tc)
294*11be35a1SLionel Sambuc {
295*11be35a1SLionel Sambuc 
296*11be35a1SLionel Sambuc 	/* this is currently broken.  i'll append the PR number soon */
297*11be35a1SLionel Sambuc 	atf_tc_set_md_var(tc, "descr", "tests unlinked semaphores can be "
298*11be35a1SLionel Sambuc 	    "closed (%s)", LIBNAME);
299*11be35a1SLionel Sambuc }
300*11be35a1SLionel Sambuc 
301*11be35a1SLionel Sambuc #define SEM "/thesem"
ATF_TC_BODY(unlink,tc)302*11be35a1SLionel Sambuc ATF_TC_BODY(unlink, tc)
303*11be35a1SLionel Sambuc {
304*11be35a1SLionel Sambuc 	sem_t *sem;
305*11be35a1SLionel Sambuc 
306*11be35a1SLionel Sambuc 	rump_init();
307*11be35a1SLionel Sambuc 	sem = sem_open(SEM, O_CREAT, 0444, 0);
308*11be35a1SLionel Sambuc 	ATF_REQUIRE(sem);
309*11be35a1SLionel Sambuc 
310*11be35a1SLionel Sambuc 	if (sem_unlink(SEM) == -1)
311*11be35a1SLionel Sambuc 		atf_tc_fail_errno("unlink");
312*11be35a1SLionel Sambuc 	if (sem_close(sem) == -1)
313*11be35a1SLionel Sambuc 		atf_tc_fail_errno("close unlinked semaphore");
314*11be35a1SLionel Sambuc }
315*11be35a1SLionel Sambuc 
316*11be35a1SLionel Sambuc /* use rump calls for libpthread _ksem_foo() calls */
317*11be35a1SLionel Sambuc #define F1(name, a) int _ksem_##name(a); \
318*11be35a1SLionel Sambuc int _ksem_##name(a v1) {return rump_sys__ksem_##name(v1);}
319*11be35a1SLionel Sambuc #define F2(name, a, b) int _ksem_##name(a, b); \
320*11be35a1SLionel Sambuc int _ksem_##name(a v1, b v2) {return rump_sys__ksem_##name(v1, v2);}
321*11be35a1SLionel Sambuc F2(init, unsigned int, intptr_t *);
322*11be35a1SLionel Sambuc F1(close, intptr_t);
323*11be35a1SLionel Sambuc F1(destroy, intptr_t);
324*11be35a1SLionel Sambuc F1(post, intptr_t);
325*11be35a1SLionel Sambuc F1(unlink, const char *);
326*11be35a1SLionel Sambuc F1(trywait, intptr_t);
327*11be35a1SLionel Sambuc F1(wait, intptr_t);
328*11be35a1SLionel Sambuc F2(getvalue, intptr_t, unsigned int *);
329*11be35a1SLionel Sambuc F2(timedwait, intptr_t, const struct timespec *);
330*11be35a1SLionel Sambuc int _ksem_open(const char *, int, mode_t, unsigned int, intptr_t *);
_ksem_open(const char * a,int b,mode_t c,unsigned int d,intptr_t * e)331*11be35a1SLionel Sambuc int _ksem_open(const char *a, int b, mode_t c, unsigned int d, intptr_t *e)
332*11be35a1SLionel Sambuc     {return rump_sys__ksem_open(a,b,c,d,e);}
333