xref: /minix3/tests/lib/libc/sys/t_msgsnd.c (revision 11be35a165022172ed3cea20f2b5df0307540b0e)
1*11be35a1SLionel Sambuc /* $NetBSD: t_msgsnd.c,v 1.2 2011/11/05 08:47:54 jruoho Exp $ */
2*11be35a1SLionel Sambuc 
3*11be35a1SLionel Sambuc /*-
4*11be35a1SLionel Sambuc  * Copyright (c) 2011 The NetBSD Foundation, Inc.
5*11be35a1SLionel Sambuc  * All rights reserved.
6*11be35a1SLionel Sambuc  *
7*11be35a1SLionel Sambuc  * This code is derived from software contributed to The NetBSD Foundation
8*11be35a1SLionel Sambuc  * by Jukka Ruohonen.
9*11be35a1SLionel Sambuc  *
10*11be35a1SLionel Sambuc  * Redistribution and use in source and binary forms, with or without
11*11be35a1SLionel Sambuc  * modification, are permitted provided that the following conditions
12*11be35a1SLionel Sambuc  * are met:
13*11be35a1SLionel Sambuc  * 1. Redistributions of source code must retain the above copyright
14*11be35a1SLionel Sambuc  *    notice, this list of conditions and the following disclaimer.
15*11be35a1SLionel Sambuc  * 2. Redistributions in binary form must reproduce the above copyright
16*11be35a1SLionel Sambuc  *    notice, this list of conditions and the following disclaimer in the
17*11be35a1SLionel Sambuc  *    documentation and/or other materials provided with the distribution.
18*11be35a1SLionel Sambuc  *
19*11be35a1SLionel Sambuc  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20*11be35a1SLionel Sambuc  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21*11be35a1SLionel Sambuc  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22*11be35a1SLionel Sambuc  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23*11be35a1SLionel Sambuc  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24*11be35a1SLionel Sambuc  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25*11be35a1SLionel Sambuc  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26*11be35a1SLionel Sambuc  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27*11be35a1SLionel Sambuc  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28*11be35a1SLionel Sambuc  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29*11be35a1SLionel Sambuc  * POSSIBILITY OF SUCH DAMAGE.
30*11be35a1SLionel Sambuc  */
31*11be35a1SLionel Sambuc #include <sys/cdefs.h>
32*11be35a1SLionel Sambuc __RCSID("$NetBSD: t_msgsnd.c,v 1.2 2011/11/05 08:47:54 jruoho Exp $");
33*11be35a1SLionel Sambuc 
34*11be35a1SLionel Sambuc #include <sys/msg.h>
35*11be35a1SLionel Sambuc #include <sys/stat.h>
36*11be35a1SLionel Sambuc #include <sys/sysctl.h>
37*11be35a1SLionel Sambuc #include <sys/wait.h>
38*11be35a1SLionel Sambuc 
39*11be35a1SLionel Sambuc #include <atf-c.h>
40*11be35a1SLionel Sambuc #include <errno.h>
41*11be35a1SLionel Sambuc #include <pwd.h>
42*11be35a1SLionel Sambuc #include <signal.h>
43*11be35a1SLionel Sambuc #include <stdio.h>
44*11be35a1SLionel Sambuc #include <stdlib.h>
45*11be35a1SLionel Sambuc #include <string.h>
46*11be35a1SLionel Sambuc #include <sysexits.h>
47*11be35a1SLionel Sambuc #include <time.h>
48*11be35a1SLionel Sambuc #include <unistd.h>
49*11be35a1SLionel Sambuc 
50*11be35a1SLionel Sambuc #define MSG_KEY		1234
51*11be35a1SLionel Sambuc #define MSG_MTYPE_1	0x41
52*11be35a1SLionel Sambuc #define	MSG_MTYPE_2	0x42
53*11be35a1SLionel Sambuc #define MSG_MTYPE_3	0x43
54*11be35a1SLionel Sambuc 
55*11be35a1SLionel Sambuc struct msg {
56*11be35a1SLionel Sambuc 	long		 mtype;
57*11be35a1SLionel Sambuc 	char		 buf[3];
58*11be35a1SLionel Sambuc };
59*11be35a1SLionel Sambuc 
60*11be35a1SLionel Sambuc static void		clean(void);
61*11be35a1SLionel Sambuc 
62*11be35a1SLionel Sambuc static void
clean(void)63*11be35a1SLionel Sambuc clean(void)
64*11be35a1SLionel Sambuc {
65*11be35a1SLionel Sambuc 	int id;
66*11be35a1SLionel Sambuc 
67*11be35a1SLionel Sambuc 	if ((id = msgget(MSG_KEY, 0)) != -1)
68*11be35a1SLionel Sambuc 		(void)msgctl(id, IPC_RMID, 0);
69*11be35a1SLionel Sambuc }
70*11be35a1SLionel Sambuc 
71*11be35a1SLionel Sambuc ATF_TC_WITH_CLEANUP(msgsnd_block);
ATF_TC_HEAD(msgsnd_block,tc)72*11be35a1SLionel Sambuc ATF_TC_HEAD(msgsnd_block, tc)
73*11be35a1SLionel Sambuc {
74*11be35a1SLionel Sambuc 	atf_tc_set_md_var(tc, "descr", "Test that msgsnd(2) blocks");
75*11be35a1SLionel Sambuc 	atf_tc_set_md_var(tc, "timeout", "10");
76*11be35a1SLionel Sambuc }
77*11be35a1SLionel Sambuc 
ATF_TC_BODY(msgsnd_block,tc)78*11be35a1SLionel Sambuc ATF_TC_BODY(msgsnd_block, tc)
79*11be35a1SLionel Sambuc {
80*11be35a1SLionel Sambuc 	struct msg msg = { MSG_MTYPE_1, { 'a', 'b', 'c' } };
81*11be35a1SLionel Sambuc 	int id, sta;
82*11be35a1SLionel Sambuc 	pid_t pid;
83*11be35a1SLionel Sambuc 
84*11be35a1SLionel Sambuc 	id = msgget(MSG_KEY, IPC_CREAT | 0600);
85*11be35a1SLionel Sambuc 	ATF_REQUIRE(id != -1);
86*11be35a1SLionel Sambuc 
87*11be35a1SLionel Sambuc 	pid = fork();
88*11be35a1SLionel Sambuc 	ATF_REQUIRE(pid >= 0);
89*11be35a1SLionel Sambuc 
90*11be35a1SLionel Sambuc 	if (pid == 0) {
91*11be35a1SLionel Sambuc 
92*11be35a1SLionel Sambuc 		/*
93*11be35a1SLionel Sambuc 		 * Enqueue messages until some limit (e.g. the maximum
94*11be35a1SLionel Sambuc 		 * number of messages in the queue or the maximum number
95*11be35a1SLionel Sambuc 		 * of bytes in the queue) is reached. After this the call
96*11be35a1SLionel Sambuc 		 * should block when the IPC_NOWAIT is not set.
97*11be35a1SLionel Sambuc 		 */
98*11be35a1SLionel Sambuc 		for (;;) {
99*11be35a1SLionel Sambuc 
100*11be35a1SLionel Sambuc 			if (msgsnd(id, &msg, sizeof(struct msg), 0) < 0)
101*11be35a1SLionel Sambuc 				_exit(EXIT_FAILURE);
102*11be35a1SLionel Sambuc 		}
103*11be35a1SLionel Sambuc 	}
104*11be35a1SLionel Sambuc 
105*11be35a1SLionel Sambuc 	(void)sleep(2);
106*11be35a1SLionel Sambuc 	(void)kill(pid, SIGKILL);
107*11be35a1SLionel Sambuc 	(void)wait(&sta);
108*11be35a1SLionel Sambuc 
109*11be35a1SLionel Sambuc 	if (WIFEXITED(sta) != 0 || WIFSIGNALED(sta) == 0)
110*11be35a1SLionel Sambuc 		atf_tc_fail("msgsnd(2) did not block");
111*11be35a1SLionel Sambuc 
112*11be35a1SLionel Sambuc 	ATF_REQUIRE(msgctl(id, IPC_RMID, 0) == 0);
113*11be35a1SLionel Sambuc }
114*11be35a1SLionel Sambuc 
ATF_TC_CLEANUP(msgsnd_block,tc)115*11be35a1SLionel Sambuc ATF_TC_CLEANUP(msgsnd_block, tc)
116*11be35a1SLionel Sambuc {
117*11be35a1SLionel Sambuc 	clean();
118*11be35a1SLionel Sambuc }
119*11be35a1SLionel Sambuc 
120*11be35a1SLionel Sambuc ATF_TC_WITH_CLEANUP(msgsnd_count);
ATF_TC_HEAD(msgsnd_count,tc)121*11be35a1SLionel Sambuc ATF_TC_HEAD(msgsnd_count, tc)
122*11be35a1SLionel Sambuc {
123*11be35a1SLionel Sambuc 	atf_tc_set_md_var(tc, "descr",
124*11be35a1SLionel Sambuc 	    "Test that msgsnd(2) increments the amount of "
125*11be35a1SLionel Sambuc 	    "message in the queue, as given by msgctl(2)");
126*11be35a1SLionel Sambuc 	atf_tc_set_md_var(tc, "timeout", "10");
127*11be35a1SLionel Sambuc }
128*11be35a1SLionel Sambuc 
ATF_TC_BODY(msgsnd_count,tc)129*11be35a1SLionel Sambuc ATF_TC_BODY(msgsnd_count, tc)
130*11be35a1SLionel Sambuc {
131*11be35a1SLionel Sambuc 	struct msg msg = { MSG_MTYPE_1, { 'a', 'b', 'c' } };
132*11be35a1SLionel Sambuc 	struct msqid_ds ds;
133*11be35a1SLionel Sambuc 	size_t i = 0;
134*11be35a1SLionel Sambuc 	int id, rv;
135*11be35a1SLionel Sambuc 
136*11be35a1SLionel Sambuc 	id = msgget(MSG_KEY, IPC_CREAT | 0600);
137*11be35a1SLionel Sambuc 	ATF_REQUIRE(id != -1);
138*11be35a1SLionel Sambuc 
139*11be35a1SLionel Sambuc 	for (;;) {
140*11be35a1SLionel Sambuc 
141*11be35a1SLionel Sambuc 		errno = 0;
142*11be35a1SLionel Sambuc 		rv = msgsnd(id, &msg, sizeof(struct msg), IPC_NOWAIT);
143*11be35a1SLionel Sambuc 
144*11be35a1SLionel Sambuc 		if (rv == 0) {
145*11be35a1SLionel Sambuc 			i++;
146*11be35a1SLionel Sambuc 			continue;
147*11be35a1SLionel Sambuc 		}
148*11be35a1SLionel Sambuc 
149*11be35a1SLionel Sambuc 		if (rv == -1 && errno == EAGAIN)
150*11be35a1SLionel Sambuc 			break;
151*11be35a1SLionel Sambuc 
152*11be35a1SLionel Sambuc 		atf_tc_fail("failed to enqueue a message");
153*11be35a1SLionel Sambuc 	}
154*11be35a1SLionel Sambuc 
155*11be35a1SLionel Sambuc 	(void)memset(&ds, 0, sizeof(struct msqid_ds));
156*11be35a1SLionel Sambuc 	(void)msgctl(id, IPC_STAT, &ds);
157*11be35a1SLionel Sambuc 
158*11be35a1SLionel Sambuc 	if (ds.msg_qnum != i)
159*11be35a1SLionel Sambuc 		atf_tc_fail("incorrect message count");
160*11be35a1SLionel Sambuc 
161*11be35a1SLionel Sambuc 	ATF_REQUIRE(msgctl(id, IPC_RMID, 0) == 0);
162*11be35a1SLionel Sambuc }
163*11be35a1SLionel Sambuc 
ATF_TC_CLEANUP(msgsnd_count,tc)164*11be35a1SLionel Sambuc ATF_TC_CLEANUP(msgsnd_count, tc)
165*11be35a1SLionel Sambuc {
166*11be35a1SLionel Sambuc 	clean();
167*11be35a1SLionel Sambuc }
168*11be35a1SLionel Sambuc 
169*11be35a1SLionel Sambuc ATF_TC_WITH_CLEANUP(msgsnd_err);
ATF_TC_HEAD(msgsnd_err,tc)170*11be35a1SLionel Sambuc ATF_TC_HEAD(msgsnd_err, tc)
171*11be35a1SLionel Sambuc {
172*11be35a1SLionel Sambuc 	atf_tc_set_md_var(tc, "descr", "Test errors from msgsnd(2)");
173*11be35a1SLionel Sambuc }
174*11be35a1SLionel Sambuc 
ATF_TC_BODY(msgsnd_err,tc)175*11be35a1SLionel Sambuc ATF_TC_BODY(msgsnd_err, tc)
176*11be35a1SLionel Sambuc {
177*11be35a1SLionel Sambuc 	struct msg msg = { MSG_MTYPE_1, { 'a', 'b', 'c' } };
178*11be35a1SLionel Sambuc 	int id;
179*11be35a1SLionel Sambuc 
180*11be35a1SLionel Sambuc 	id = msgget(MSG_KEY, IPC_CREAT | 0600);
181*11be35a1SLionel Sambuc 	ATF_REQUIRE(id != -1);
182*11be35a1SLionel Sambuc 
183*11be35a1SLionel Sambuc 	errno = 0;
184*11be35a1SLionel Sambuc 
185*11be35a1SLionel Sambuc 	ATF_REQUIRE_ERRNO(EFAULT, msgsnd(id, (void *)-1,
186*11be35a1SLionel Sambuc 		sizeof(struct msg), IPC_NOWAIT) == -1);
187*11be35a1SLionel Sambuc 
188*11be35a1SLionel Sambuc 	errno = 0;
189*11be35a1SLionel Sambuc 
190*11be35a1SLionel Sambuc 	ATF_REQUIRE_ERRNO(EINVAL, msgsnd(-1, &msg,
191*11be35a1SLionel Sambuc 		sizeof(struct msg), IPC_NOWAIT) == -1);
192*11be35a1SLionel Sambuc 
193*11be35a1SLionel Sambuc 	errno = 0;
194*11be35a1SLionel Sambuc 
195*11be35a1SLionel Sambuc 	ATF_REQUIRE_ERRNO(EINVAL, msgsnd(-1, &msg,
196*11be35a1SLionel Sambuc 		SSIZE_MAX, IPC_NOWAIT) == -1);
197*11be35a1SLionel Sambuc 
198*11be35a1SLionel Sambuc 	errno = 0;
199*11be35a1SLionel Sambuc 	msg.mtype = 0;
200*11be35a1SLionel Sambuc 
201*11be35a1SLionel Sambuc 	ATF_REQUIRE_ERRNO(EINVAL, msgsnd(id, &msg,
202*11be35a1SLionel Sambuc 		sizeof(struct msg), IPC_NOWAIT) == -1);
203*11be35a1SLionel Sambuc 
204*11be35a1SLionel Sambuc 	ATF_REQUIRE(msgctl(id, IPC_RMID, 0) == 0);
205*11be35a1SLionel Sambuc }
206*11be35a1SLionel Sambuc 
ATF_TC_CLEANUP(msgsnd_err,tc)207*11be35a1SLionel Sambuc ATF_TC_CLEANUP(msgsnd_err, tc)
208*11be35a1SLionel Sambuc {
209*11be35a1SLionel Sambuc 	clean();
210*11be35a1SLionel Sambuc }
211*11be35a1SLionel Sambuc 
212*11be35a1SLionel Sambuc ATF_TC_WITH_CLEANUP(msgsnd_nonblock);
ATF_TC_HEAD(msgsnd_nonblock,tc)213*11be35a1SLionel Sambuc ATF_TC_HEAD(msgsnd_nonblock, tc)
214*11be35a1SLionel Sambuc {
215*11be35a1SLionel Sambuc 	atf_tc_set_md_var(tc, "descr", "Test msgsnd(2) with IPC_NOWAIT");
216*11be35a1SLionel Sambuc 	atf_tc_set_md_var(tc, "timeout", "10");
217*11be35a1SLionel Sambuc }
218*11be35a1SLionel Sambuc 
ATF_TC_BODY(msgsnd_nonblock,tc)219*11be35a1SLionel Sambuc ATF_TC_BODY(msgsnd_nonblock, tc)
220*11be35a1SLionel Sambuc {
221*11be35a1SLionel Sambuc 	struct msg msg = { MSG_MTYPE_1, { 'a', 'b', 'c' } };
222*11be35a1SLionel Sambuc 	int id, rv, sta;
223*11be35a1SLionel Sambuc 	pid_t pid;
224*11be35a1SLionel Sambuc 
225*11be35a1SLionel Sambuc 	id = msgget(MSG_KEY, IPC_CREAT | 0600);
226*11be35a1SLionel Sambuc 	ATF_REQUIRE(id != -1);
227*11be35a1SLionel Sambuc 
228*11be35a1SLionel Sambuc 	pid = fork();
229*11be35a1SLionel Sambuc 	ATF_REQUIRE(pid >= 0);
230*11be35a1SLionel Sambuc 
231*11be35a1SLionel Sambuc 	if (pid == 0) {
232*11be35a1SLionel Sambuc 
233*11be35a1SLionel Sambuc 		for (;;) {
234*11be35a1SLionel Sambuc 
235*11be35a1SLionel Sambuc 			errno = 0;
236*11be35a1SLionel Sambuc 			rv = msgsnd(id, &msg, sizeof(struct msg), IPC_NOWAIT);
237*11be35a1SLionel Sambuc 
238*11be35a1SLionel Sambuc 			if (rv == -1 && errno == EAGAIN)
239*11be35a1SLionel Sambuc 				_exit(EXIT_SUCCESS);
240*11be35a1SLionel Sambuc 		}
241*11be35a1SLionel Sambuc 	}
242*11be35a1SLionel Sambuc 
243*11be35a1SLionel Sambuc 	(void)sleep(2);
244*11be35a1SLionel Sambuc 	(void)kill(pid, SIGKILL);
245*11be35a1SLionel Sambuc 	(void)wait(&sta);
246*11be35a1SLionel Sambuc 
247*11be35a1SLionel Sambuc 	if (WIFEXITED(sta) == 0 || WIFSIGNALED(sta) != 0)
248*11be35a1SLionel Sambuc 		atf_tc_fail("msgsnd(2) blocked with IPC_NOWAIT");
249*11be35a1SLionel Sambuc 
250*11be35a1SLionel Sambuc 	ATF_REQUIRE(msgctl(id, IPC_RMID, 0) == 0);
251*11be35a1SLionel Sambuc }
252*11be35a1SLionel Sambuc 
ATF_TC_CLEANUP(msgsnd_nonblock,tc)253*11be35a1SLionel Sambuc ATF_TC_CLEANUP(msgsnd_nonblock, tc)
254*11be35a1SLionel Sambuc {
255*11be35a1SLionel Sambuc 	clean();
256*11be35a1SLionel Sambuc }
257*11be35a1SLionel Sambuc 
258*11be35a1SLionel Sambuc ATF_TC_WITH_CLEANUP(msgsnd_perm);
ATF_TC_HEAD(msgsnd_perm,tc)259*11be35a1SLionel Sambuc ATF_TC_HEAD(msgsnd_perm, tc)
260*11be35a1SLionel Sambuc {
261*11be35a1SLionel Sambuc 	atf_tc_set_md_var(tc, "descr", "Test permissions with msgsnd(2)");
262*11be35a1SLionel Sambuc 	atf_tc_set_md_var(tc, "require.user", "root");
263*11be35a1SLionel Sambuc }
264*11be35a1SLionel Sambuc 
ATF_TC_BODY(msgsnd_perm,tc)265*11be35a1SLionel Sambuc ATF_TC_BODY(msgsnd_perm, tc)
266*11be35a1SLionel Sambuc {
267*11be35a1SLionel Sambuc 	struct msg msg = { MSG_MTYPE_1, { 'a', 'b', 'c' } };
268*11be35a1SLionel Sambuc 	struct passwd *pw;
269*11be35a1SLionel Sambuc 	int id, sta;
270*11be35a1SLionel Sambuc 	pid_t pid;
271*11be35a1SLionel Sambuc 	uid_t uid;
272*11be35a1SLionel Sambuc 
273*11be35a1SLionel Sambuc 	pw = getpwnam("nobody");
274*11be35a1SLionel Sambuc 	id = msgget(MSG_KEY, IPC_CREAT | 0600);
275*11be35a1SLionel Sambuc 
276*11be35a1SLionel Sambuc 	ATF_REQUIRE(id != -1);
277*11be35a1SLionel Sambuc 	ATF_REQUIRE(pw != NULL);
278*11be35a1SLionel Sambuc 
279*11be35a1SLionel Sambuc 	uid = pw->pw_uid;
280*11be35a1SLionel Sambuc 	ATF_REQUIRE(uid != 0);
281*11be35a1SLionel Sambuc 
282*11be35a1SLionel Sambuc 	pid = fork();
283*11be35a1SLionel Sambuc 	ATF_REQUIRE(pid >= 0);
284*11be35a1SLionel Sambuc 
285*11be35a1SLionel Sambuc 	if (pid == 0) {
286*11be35a1SLionel Sambuc 
287*11be35a1SLionel Sambuc 		/*
288*11be35a1SLionel Sambuc 		 * Try to enqueue a message to the queue
289*11be35a1SLionel Sambuc 		 * created by root as RW for owner only.
290*11be35a1SLionel Sambuc 		 */
291*11be35a1SLionel Sambuc 		if (setuid(uid) != 0)
292*11be35a1SLionel Sambuc 			_exit(EX_OSERR);
293*11be35a1SLionel Sambuc 
294*11be35a1SLionel Sambuc 		id = msgget(MSG_KEY, 0);
295*11be35a1SLionel Sambuc 
296*11be35a1SLionel Sambuc 		if (id == -1)
297*11be35a1SLionel Sambuc 			_exit(EX_OSERR);
298*11be35a1SLionel Sambuc 
299*11be35a1SLionel Sambuc 		errno = 0;
300*11be35a1SLionel Sambuc 
301*11be35a1SLionel Sambuc 		if (msgsnd(id, &msg, sizeof(struct msg), IPC_NOWAIT) == 0)
302*11be35a1SLionel Sambuc 			_exit(EXIT_FAILURE);
303*11be35a1SLionel Sambuc 
304*11be35a1SLionel Sambuc 		if (errno != EACCES)
305*11be35a1SLionel Sambuc 			_exit(EXIT_FAILURE);
306*11be35a1SLionel Sambuc 
307*11be35a1SLionel Sambuc 		_exit(EXIT_SUCCESS);
308*11be35a1SLionel Sambuc 	}
309*11be35a1SLionel Sambuc 
310*11be35a1SLionel Sambuc 	(void)wait(&sta);
311*11be35a1SLionel Sambuc 
312*11be35a1SLionel Sambuc 	if (WIFEXITED(sta) == 0 || WEXITSTATUS(sta) != EXIT_SUCCESS) {
313*11be35a1SLionel Sambuc 
314*11be35a1SLionel Sambuc 		if (errno == EX_OSERR)
315*11be35a1SLionel Sambuc 			atf_tc_fail("system call failed");
316*11be35a1SLionel Sambuc 
317*11be35a1SLionel Sambuc 		atf_tc_fail("UID %u enqueued message to root's queue", uid);
318*11be35a1SLionel Sambuc 	}
319*11be35a1SLionel Sambuc 
320*11be35a1SLionel Sambuc 	ATF_REQUIRE(msgctl(id, IPC_RMID, 0) == 0);
321*11be35a1SLionel Sambuc }
322*11be35a1SLionel Sambuc 
ATF_TC_CLEANUP(msgsnd_perm,tc)323*11be35a1SLionel Sambuc ATF_TC_CLEANUP(msgsnd_perm, tc)
324*11be35a1SLionel Sambuc {
325*11be35a1SLionel Sambuc 	clean();
326*11be35a1SLionel Sambuc }
327*11be35a1SLionel Sambuc 
ATF_TP_ADD_TCS(tp)328*11be35a1SLionel Sambuc ATF_TP_ADD_TCS(tp)
329*11be35a1SLionel Sambuc {
330*11be35a1SLionel Sambuc 
331*11be35a1SLionel Sambuc 	ATF_TP_ADD_TC(tp, msgsnd_block);
332*11be35a1SLionel Sambuc 	ATF_TP_ADD_TC(tp, msgsnd_count);
333*11be35a1SLionel Sambuc 	ATF_TP_ADD_TC(tp, msgsnd_err);
334*11be35a1SLionel Sambuc 	ATF_TP_ADD_TC(tp, msgsnd_nonblock);
335*11be35a1SLionel Sambuc 	ATF_TP_ADD_TC(tp, msgsnd_perm);
336*11be35a1SLionel Sambuc 
337*11be35a1SLionel Sambuc 	return atf_no_error();
338*11be35a1SLionel Sambuc }
339