xref: /aosp_15_r20/external/ltp/testcases/kernel/syscalls/signalfd/signalfd01.c (revision 49cdfc7efb34551c7342be41a7384b9c40d7cab7)
1*49cdfc7eSAndroid Build Coastguard Worker /*
2*49cdfc7eSAndroid Build Coastguard Worker  *
3*49cdfc7eSAndroid Build Coastguard Worker  *   Copyright (c) Red Hat Inc., 2008
4*49cdfc7eSAndroid Build Coastguard Worker  *
5*49cdfc7eSAndroid Build Coastguard Worker  *   This program is free software;  you can redistribute it and/or modify
6*49cdfc7eSAndroid Build Coastguard Worker  *   it under the terms of the GNU General Public License as published by
7*49cdfc7eSAndroid Build Coastguard Worker  *   the Free Software Foundation; either version 2 of the License, or
8*49cdfc7eSAndroid Build Coastguard Worker  *   (at your option) any later version.
9*49cdfc7eSAndroid Build Coastguard Worker  *
10*49cdfc7eSAndroid Build Coastguard Worker  *   This program is distributed in the hope that it will be useful,
11*49cdfc7eSAndroid Build Coastguard Worker  *   but WITHOUT ANY WARRANTY;  without even the implied warranty of
12*49cdfc7eSAndroid Build Coastguard Worker  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
13*49cdfc7eSAndroid Build Coastguard Worker  *   the GNU General Public License for more details.
14*49cdfc7eSAndroid Build Coastguard Worker  *
15*49cdfc7eSAndroid Build Coastguard Worker  *   You should have received a copy of the GNU General Public License
16*49cdfc7eSAndroid Build Coastguard Worker  *   along with this program;  if not, write to the Free Software
17*49cdfc7eSAndroid Build Coastguard Worker  *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18*49cdfc7eSAndroid Build Coastguard Worker  */
19*49cdfc7eSAndroid Build Coastguard Worker 
20*49cdfc7eSAndroid Build Coastguard Worker /*
21*49cdfc7eSAndroid Build Coastguard Worker  * NAME
22*49cdfc7eSAndroid Build Coastguard Worker  *	signalfd01.c
23*49cdfc7eSAndroid Build Coastguard Worker  *
24*49cdfc7eSAndroid Build Coastguard Worker  * DESCRIPTION
25*49cdfc7eSAndroid Build Coastguard Worker  *	Check signalfd can receive signals
26*49cdfc7eSAndroid Build Coastguard Worker  *
27*49cdfc7eSAndroid Build Coastguard Worker  * USAGE
28*49cdfc7eSAndroid Build Coastguard Worker  * 	signalfd01
29*49cdfc7eSAndroid Build Coastguard Worker  *
30*49cdfc7eSAndroid Build Coastguard Worker  * HISTORY
31*49cdfc7eSAndroid Build Coastguard Worker  *	9/2008 Initial version by Masatake YAMATO <[email protected]>
32*49cdfc7eSAndroid Build Coastguard Worker  *
33*49cdfc7eSAndroid Build Coastguard Worker  * RESTRICTIONS
34*49cdfc7eSAndroid Build Coastguard Worker  * 	None
35*49cdfc7eSAndroid Build Coastguard Worker  */
36*49cdfc7eSAndroid Build Coastguard Worker #define _GNU_SOURCE
37*49cdfc7eSAndroid Build Coastguard Worker 
38*49cdfc7eSAndroid Build Coastguard Worker #include "config.h"
39*49cdfc7eSAndroid Build Coastguard Worker 
40*49cdfc7eSAndroid Build Coastguard Worker #include "test.h"
41*49cdfc7eSAndroid Build Coastguard Worker 
42*49cdfc7eSAndroid Build Coastguard Worker #include <errno.h>
43*49cdfc7eSAndroid Build Coastguard Worker #include <signal.h>
44*49cdfc7eSAndroid Build Coastguard Worker #include <unistd.h>
45*49cdfc7eSAndroid Build Coastguard Worker #include <fcntl.h>
46*49cdfc7eSAndroid Build Coastguard Worker #include <inttypes.h>
47*49cdfc7eSAndroid Build Coastguard Worker #include "ltp_signal.h"
48*49cdfc7eSAndroid Build Coastguard Worker 
49*49cdfc7eSAndroid Build Coastguard Worker TCID_DEFINE(signalfd01);
50*49cdfc7eSAndroid Build Coastguard Worker int TST_TOTAL = 1;
51*49cdfc7eSAndroid Build Coastguard Worker 
52*49cdfc7eSAndroid Build Coastguard Worker #ifndef HAVE_SIGNALFD
53*49cdfc7eSAndroid Build Coastguard Worker #define  USE_STUB
54*49cdfc7eSAndroid Build Coastguard Worker #endif
55*49cdfc7eSAndroid Build Coastguard Worker 
56*49cdfc7eSAndroid Build Coastguard Worker #if defined HAVE_SYS_SIGNALFD_H
57*49cdfc7eSAndroid Build Coastguard Worker #include <sys/signalfd.h>
58*49cdfc7eSAndroid Build Coastguard Worker #elif defined HAVE_LINUX_SIGNALFD_H
59*49cdfc7eSAndroid Build Coastguard Worker #include <linux/signalfd.h>
60*49cdfc7eSAndroid Build Coastguard Worker #define USE_OWNIMPL
61*49cdfc7eSAndroid Build Coastguard Worker #else
62*49cdfc7eSAndroid Build Coastguard Worker #define  USE_STUB
63*49cdfc7eSAndroid Build Coastguard Worker #endif
64*49cdfc7eSAndroid Build Coastguard Worker 
65*49cdfc7eSAndroid Build Coastguard Worker #ifndef HAVE_STRUCT_SIGNALFD_SIGINFO_SSI_SIGNO
66*49cdfc7eSAndroid Build Coastguard Worker #define USE_STUB
67*49cdfc7eSAndroid Build Coastguard Worker #endif
68*49cdfc7eSAndroid Build Coastguard Worker 
69*49cdfc7eSAndroid Build Coastguard Worker #ifdef USE_STUB
main(void)70*49cdfc7eSAndroid Build Coastguard Worker int main(void)
71*49cdfc7eSAndroid Build Coastguard Worker {
72*49cdfc7eSAndroid Build Coastguard Worker 	tst_brkm(TCONF, NULL, "System doesn't support execution of the test");
73*49cdfc7eSAndroid Build Coastguard Worker }
74*49cdfc7eSAndroid Build Coastguard Worker 
75*49cdfc7eSAndroid Build Coastguard Worker #else
76*49cdfc7eSAndroid Build Coastguard Worker #if defined USE_OWNIMPL
77*49cdfc7eSAndroid Build Coastguard Worker #include "lapi/syscalls.h"
signalfd(int fd,const sigset_t * mask,int flags)78*49cdfc7eSAndroid Build Coastguard Worker int signalfd(int fd, const sigset_t * mask, int flags)
79*49cdfc7eSAndroid Build Coastguard Worker {
80*49cdfc7eSAndroid Build Coastguard Worker 	/* Taken from GLIBC. */
81*49cdfc7eSAndroid Build Coastguard Worker 	return tst_syscall(__NR_signalfd, fd, mask, SIGSETSIZE);
82*49cdfc7eSAndroid Build Coastguard Worker }
83*49cdfc7eSAndroid Build Coastguard Worker #endif
84*49cdfc7eSAndroid Build Coastguard Worker 
85*49cdfc7eSAndroid Build Coastguard Worker void cleanup(void);
86*49cdfc7eSAndroid Build Coastguard Worker void setup(void);
87*49cdfc7eSAndroid Build Coastguard Worker 
do_test1(uint32_t sig)88*49cdfc7eSAndroid Build Coastguard Worker int do_test1(uint32_t sig)
89*49cdfc7eSAndroid Build Coastguard Worker {
90*49cdfc7eSAndroid Build Coastguard Worker 	int sfd_for_next;
91*49cdfc7eSAndroid Build Coastguard Worker 	int sfd;
92*49cdfc7eSAndroid Build Coastguard Worker 	sigset_t mask;
93*49cdfc7eSAndroid Build Coastguard Worker 	pid_t pid;
94*49cdfc7eSAndroid Build Coastguard Worker 	struct signalfd_siginfo fdsi;
95*49cdfc7eSAndroid Build Coastguard Worker 	ssize_t s;
96*49cdfc7eSAndroid Build Coastguard Worker 
97*49cdfc7eSAndroid Build Coastguard Worker 	sigemptyset(&mask);
98*49cdfc7eSAndroid Build Coastguard Worker 	sigaddset(&mask, sig);
99*49cdfc7eSAndroid Build Coastguard Worker 	if (sigprocmask(SIG_BLOCK, &mask, NULL) < 0) {
100*49cdfc7eSAndroid Build Coastguard Worker 		tst_brkm(TBROK, cleanup,
101*49cdfc7eSAndroid Build Coastguard Worker 			 "sigprocmask() Failed: errno=%d : %s",
102*49cdfc7eSAndroid Build Coastguard Worker 			 errno, strerror(errno));
103*49cdfc7eSAndroid Build Coastguard Worker 	}
104*49cdfc7eSAndroid Build Coastguard Worker 
105*49cdfc7eSAndroid Build Coastguard Worker 	TEST(signalfd(-1, &mask, 0));
106*49cdfc7eSAndroid Build Coastguard Worker 
107*49cdfc7eSAndroid Build Coastguard Worker 	if ((sfd = TEST_RETURN) == -1) {
108*49cdfc7eSAndroid Build Coastguard Worker 		tst_resm(TFAIL,
109*49cdfc7eSAndroid Build Coastguard Worker 			 "signalfd() Failed, errno=%d : %s",
110*49cdfc7eSAndroid Build Coastguard Worker 			 TEST_ERRNO, strerror(TEST_ERRNO));
111*49cdfc7eSAndroid Build Coastguard Worker 		sfd_for_next = -1;
112*49cdfc7eSAndroid Build Coastguard Worker 		return sfd_for_next;
113*49cdfc7eSAndroid Build Coastguard Worker 
114*49cdfc7eSAndroid Build Coastguard Worker 	} else {
115*49cdfc7eSAndroid Build Coastguard Worker 		tst_resm(TPASS, "signalfd is created successfully");
116*49cdfc7eSAndroid Build Coastguard Worker 		sfd_for_next = sfd;
117*49cdfc7eSAndroid Build Coastguard Worker 		goto out;
118*49cdfc7eSAndroid Build Coastguard Worker 	}
119*49cdfc7eSAndroid Build Coastguard Worker 
120*49cdfc7eSAndroid Build Coastguard Worker 	if (fcntl(sfd, F_SETFL, O_NONBLOCK) == -1) {
121*49cdfc7eSAndroid Build Coastguard Worker 		close(sfd);
122*49cdfc7eSAndroid Build Coastguard Worker 		tst_brkm(TBROK, cleanup,
123*49cdfc7eSAndroid Build Coastguard Worker 			 "setting signalfd nonblocking mode failed: errno=%d : %s",
124*49cdfc7eSAndroid Build Coastguard Worker 			 errno, strerror(errno));
125*49cdfc7eSAndroid Build Coastguard Worker 	}
126*49cdfc7eSAndroid Build Coastguard Worker 
127*49cdfc7eSAndroid Build Coastguard Worker 	pid = getpid();
128*49cdfc7eSAndroid Build Coastguard Worker 	if (kill(pid, sig) == -1) {
129*49cdfc7eSAndroid Build Coastguard Worker 		close(sfd);
130*49cdfc7eSAndroid Build Coastguard Worker 		tst_brkm(TBROK, cleanup,
131*49cdfc7eSAndroid Build Coastguard Worker 			 "kill(self, %s) failed: errno=%d : %s",
132*49cdfc7eSAndroid Build Coastguard Worker 			 strsignal(sig), errno, strerror(errno));
133*49cdfc7eSAndroid Build Coastguard Worker 	}
134*49cdfc7eSAndroid Build Coastguard Worker 
135*49cdfc7eSAndroid Build Coastguard Worker 	s = read(sfd, &fdsi, sizeof(struct signalfd_siginfo));
136*49cdfc7eSAndroid Build Coastguard Worker 	if ((s > 0) && (s != sizeof(struct signalfd_siginfo))) {
137*49cdfc7eSAndroid Build Coastguard Worker 		tst_resm(TFAIL,
138*49cdfc7eSAndroid Build Coastguard Worker 			 "getting incomplete signalfd_siginfo data: "
139*49cdfc7eSAndroid Build Coastguard Worker 			 "actual-size=%zd, expected-size=%zu",
140*49cdfc7eSAndroid Build Coastguard Worker 			 s, sizeof(struct signalfd_siginfo));
141*49cdfc7eSAndroid Build Coastguard Worker 		sfd_for_next = -1;
142*49cdfc7eSAndroid Build Coastguard Worker 		close(sfd);
143*49cdfc7eSAndroid Build Coastguard Worker 		goto out;
144*49cdfc7eSAndroid Build Coastguard Worker 	} else if (s < 0) {
145*49cdfc7eSAndroid Build Coastguard Worker 		if (errno == EAGAIN) {
146*49cdfc7eSAndroid Build Coastguard Worker 			tst_resm(TFAIL,
147*49cdfc7eSAndroid Build Coastguard Worker 				 "signalfd_siginfo data is not delivered yet");
148*49cdfc7eSAndroid Build Coastguard Worker 			sfd_for_next = -1;
149*49cdfc7eSAndroid Build Coastguard Worker 			close(sfd);
150*49cdfc7eSAndroid Build Coastguard Worker 			goto out;
151*49cdfc7eSAndroid Build Coastguard Worker 		} else {
152*49cdfc7eSAndroid Build Coastguard Worker 			close(sfd);
153*49cdfc7eSAndroid Build Coastguard Worker 			tst_brkm(TBROK, cleanup,
154*49cdfc7eSAndroid Build Coastguard Worker 				 "read signalfd_siginfo data failed: errno=%d : %s",
155*49cdfc7eSAndroid Build Coastguard Worker 				 errno, strerror(errno));
156*49cdfc7eSAndroid Build Coastguard Worker 		}
157*49cdfc7eSAndroid Build Coastguard Worker 	} else if (s == 0) {
158*49cdfc7eSAndroid Build Coastguard Worker 		tst_resm(TFAIL, "got EOF unexpectedly");
159*49cdfc7eSAndroid Build Coastguard Worker 		sfd_for_next = -1;
160*49cdfc7eSAndroid Build Coastguard Worker 		close(sfd);
161*49cdfc7eSAndroid Build Coastguard Worker 		goto out;
162*49cdfc7eSAndroid Build Coastguard Worker 	}
163*49cdfc7eSAndroid Build Coastguard Worker 
164*49cdfc7eSAndroid Build Coastguard Worker 	if (fdsi.ssi_signo == sig) {
165*49cdfc7eSAndroid Build Coastguard Worker 		tst_resm(TPASS, "got expected signal");
166*49cdfc7eSAndroid Build Coastguard Worker 		sfd_for_next = sfd;
167*49cdfc7eSAndroid Build Coastguard Worker 		goto out;
168*49cdfc7eSAndroid Build Coastguard Worker 	} else {
169*49cdfc7eSAndroid Build Coastguard Worker 		tst_resm(TFAIL, "got unexpected signal: signal=%d : %s",
170*49cdfc7eSAndroid Build Coastguard Worker 			 fdsi.ssi_signo, strsignal(fdsi.ssi_signo));
171*49cdfc7eSAndroid Build Coastguard Worker 		sfd_for_next = -1;
172*49cdfc7eSAndroid Build Coastguard Worker 		close(sfd);
173*49cdfc7eSAndroid Build Coastguard Worker 		goto out;
174*49cdfc7eSAndroid Build Coastguard Worker 	}
175*49cdfc7eSAndroid Build Coastguard Worker 
176*49cdfc7eSAndroid Build Coastguard Worker out:
177*49cdfc7eSAndroid Build Coastguard Worker 	return sfd_for_next;
178*49cdfc7eSAndroid Build Coastguard Worker }
179*49cdfc7eSAndroid Build Coastguard Worker 
do_test2(int fd,uint32_t sig)180*49cdfc7eSAndroid Build Coastguard Worker void do_test2(int fd, uint32_t sig)
181*49cdfc7eSAndroid Build Coastguard Worker {
182*49cdfc7eSAndroid Build Coastguard Worker 	int sfd;
183*49cdfc7eSAndroid Build Coastguard Worker 	sigset_t mask;
184*49cdfc7eSAndroid Build Coastguard Worker 	pid_t pid;
185*49cdfc7eSAndroid Build Coastguard Worker 	struct signalfd_siginfo fdsi;
186*49cdfc7eSAndroid Build Coastguard Worker 	ssize_t s;
187*49cdfc7eSAndroid Build Coastguard Worker 
188*49cdfc7eSAndroid Build Coastguard Worker 	sigemptyset(&mask);
189*49cdfc7eSAndroid Build Coastguard Worker 	sigaddset(&mask, sig);
190*49cdfc7eSAndroid Build Coastguard Worker 	if (sigprocmask(SIG_BLOCK, &mask, NULL) < 0) {
191*49cdfc7eSAndroid Build Coastguard Worker 		close(fd);
192*49cdfc7eSAndroid Build Coastguard Worker 		tst_brkm(TBROK, cleanup,
193*49cdfc7eSAndroid Build Coastguard Worker 			 "sigprocmask() Failed: errno=%d : %s",
194*49cdfc7eSAndroid Build Coastguard Worker 			 errno, strerror(errno));
195*49cdfc7eSAndroid Build Coastguard Worker 	}
196*49cdfc7eSAndroid Build Coastguard Worker 
197*49cdfc7eSAndroid Build Coastguard Worker 	TEST(signalfd(fd, &mask, 0));
198*49cdfc7eSAndroid Build Coastguard Worker 
199*49cdfc7eSAndroid Build Coastguard Worker 	if ((sfd = TEST_RETURN) == -1) {
200*49cdfc7eSAndroid Build Coastguard Worker 		tst_resm(TFAIL,
201*49cdfc7eSAndroid Build Coastguard Worker 			 "reassignment the file descriptor by signalfd() failed, errno=%d : %s",
202*49cdfc7eSAndroid Build Coastguard Worker 			 TEST_ERRNO, strerror(TEST_ERRNO));
203*49cdfc7eSAndroid Build Coastguard Worker 		return;
204*49cdfc7eSAndroid Build Coastguard Worker 	} else if (sfd != fd) {
205*49cdfc7eSAndroid Build Coastguard Worker 		tst_resm(TFAIL,
206*49cdfc7eSAndroid Build Coastguard Worker 			 "different fd is returned in reassignment: expected-fd=%d, actual-fd=%d",
207*49cdfc7eSAndroid Build Coastguard Worker 			 fd, sfd);
208*49cdfc7eSAndroid Build Coastguard Worker 		close(sfd);
209*49cdfc7eSAndroid Build Coastguard Worker 		return;
210*49cdfc7eSAndroid Build Coastguard Worker 
211*49cdfc7eSAndroid Build Coastguard Worker 	} else {
212*49cdfc7eSAndroid Build Coastguard Worker 		tst_resm(TPASS, "signalfd is successfully reassigned");
213*49cdfc7eSAndroid Build Coastguard Worker 		goto out;
214*49cdfc7eSAndroid Build Coastguard Worker 	}
215*49cdfc7eSAndroid Build Coastguard Worker 
216*49cdfc7eSAndroid Build Coastguard Worker 	pid = getpid();
217*49cdfc7eSAndroid Build Coastguard Worker 	if (kill(pid, sig) == -1) {
218*49cdfc7eSAndroid Build Coastguard Worker 		close(sfd);
219*49cdfc7eSAndroid Build Coastguard Worker 		tst_brkm(TBROK, cleanup,
220*49cdfc7eSAndroid Build Coastguard Worker 			 "kill(self, %s) failed: errno=%d : %s",
221*49cdfc7eSAndroid Build Coastguard Worker 			 strsignal(sig), errno, strerror(errno));
222*49cdfc7eSAndroid Build Coastguard Worker 	}
223*49cdfc7eSAndroid Build Coastguard Worker 
224*49cdfc7eSAndroid Build Coastguard Worker 	s = read(sfd, &fdsi, sizeof(struct signalfd_siginfo));
225*49cdfc7eSAndroid Build Coastguard Worker 	if ((s > 0) && (s != sizeof(struct signalfd_siginfo))) {
226*49cdfc7eSAndroid Build Coastguard Worker 		tst_resm(TFAIL,
227*49cdfc7eSAndroid Build Coastguard Worker 			 "getting incomplete signalfd_siginfo data: "
228*49cdfc7eSAndroid Build Coastguard Worker 			 "actual-size=%zd, expected-size= %zu",
229*49cdfc7eSAndroid Build Coastguard Worker 			 s, sizeof(struct signalfd_siginfo));
230*49cdfc7eSAndroid Build Coastguard Worker 		goto out;
231*49cdfc7eSAndroid Build Coastguard Worker 	} else if (s < 0) {
232*49cdfc7eSAndroid Build Coastguard Worker 		if (errno == EAGAIN) {
233*49cdfc7eSAndroid Build Coastguard Worker 			tst_resm(TFAIL,
234*49cdfc7eSAndroid Build Coastguard Worker 				 "signalfd_siginfo data is not delivered yet");
235*49cdfc7eSAndroid Build Coastguard Worker 			goto out;
236*49cdfc7eSAndroid Build Coastguard Worker 		} else {
237*49cdfc7eSAndroid Build Coastguard Worker 			close(sfd);
238*49cdfc7eSAndroid Build Coastguard Worker 			tst_brkm(TBROK, cleanup,
239*49cdfc7eSAndroid Build Coastguard Worker 				 "read signalfd_siginfo data failed: errno=%d : %s",
240*49cdfc7eSAndroid Build Coastguard Worker 				 errno, strerror(errno));
241*49cdfc7eSAndroid Build Coastguard Worker 		}
242*49cdfc7eSAndroid Build Coastguard Worker 	} else if (s == 0) {
243*49cdfc7eSAndroid Build Coastguard Worker 		tst_resm(TFAIL, "got EOF unexpectedly");
244*49cdfc7eSAndroid Build Coastguard Worker 		goto out;
245*49cdfc7eSAndroid Build Coastguard Worker 	}
246*49cdfc7eSAndroid Build Coastguard Worker 
247*49cdfc7eSAndroid Build Coastguard Worker 	if (fdsi.ssi_signo == sig) {
248*49cdfc7eSAndroid Build Coastguard Worker 		tst_resm(TPASS, "got expected signal");
249*49cdfc7eSAndroid Build Coastguard Worker 		goto out;
250*49cdfc7eSAndroid Build Coastguard Worker 	} else {
251*49cdfc7eSAndroid Build Coastguard Worker 		tst_resm(TFAIL, "got unexpected signal: signal=%d : %s",
252*49cdfc7eSAndroid Build Coastguard Worker 			 fdsi.ssi_signo, strsignal(fdsi.ssi_signo));
253*49cdfc7eSAndroid Build Coastguard Worker 		goto out;
254*49cdfc7eSAndroid Build Coastguard Worker 	}
255*49cdfc7eSAndroid Build Coastguard Worker 
256*49cdfc7eSAndroid Build Coastguard Worker out:
257*49cdfc7eSAndroid Build Coastguard Worker 	return;
258*49cdfc7eSAndroid Build Coastguard Worker }
259*49cdfc7eSAndroid Build Coastguard Worker 
main(int argc,char ** argv)260*49cdfc7eSAndroid Build Coastguard Worker int main(int argc, char **argv)
261*49cdfc7eSAndroid Build Coastguard Worker {
262*49cdfc7eSAndroid Build Coastguard Worker 	int lc;
263*49cdfc7eSAndroid Build Coastguard Worker 	int sfd;
264*49cdfc7eSAndroid Build Coastguard Worker 
265*49cdfc7eSAndroid Build Coastguard Worker 	tst_parse_opts(argc, argv, NULL, NULL);
266*49cdfc7eSAndroid Build Coastguard Worker 
267*49cdfc7eSAndroid Build Coastguard Worker 	setup();
268*49cdfc7eSAndroid Build Coastguard Worker 	for (lc = 0; TEST_LOOPING(lc); lc++) {
269*49cdfc7eSAndroid Build Coastguard Worker 		tst_count = 0;
270*49cdfc7eSAndroid Build Coastguard Worker 
271*49cdfc7eSAndroid Build Coastguard Worker 		sfd = do_test1(SIGUSR1);
272*49cdfc7eSAndroid Build Coastguard Worker 		if (sfd < 0)
273*49cdfc7eSAndroid Build Coastguard Worker 			continue;
274*49cdfc7eSAndroid Build Coastguard Worker 
275*49cdfc7eSAndroid Build Coastguard Worker 		do_test2(sfd, SIGUSR2);
276*49cdfc7eSAndroid Build Coastguard Worker 		close(sfd);
277*49cdfc7eSAndroid Build Coastguard Worker 	}
278*49cdfc7eSAndroid Build Coastguard Worker 
279*49cdfc7eSAndroid Build Coastguard Worker 	cleanup();
280*49cdfc7eSAndroid Build Coastguard Worker 
281*49cdfc7eSAndroid Build Coastguard Worker 	tst_exit();
282*49cdfc7eSAndroid Build Coastguard Worker }
283*49cdfc7eSAndroid Build Coastguard Worker 
284*49cdfc7eSAndroid Build Coastguard Worker /*
285*49cdfc7eSAndroid Build Coastguard Worker  * setup() - performs all the ONE TIME setup for this test.
286*49cdfc7eSAndroid Build Coastguard Worker  */
setup(void)287*49cdfc7eSAndroid Build Coastguard Worker void setup(void)
288*49cdfc7eSAndroid Build Coastguard Worker {
289*49cdfc7eSAndroid Build Coastguard Worker 
290*49cdfc7eSAndroid Build Coastguard Worker 	TEST_PAUSE;
291*49cdfc7eSAndroid Build Coastguard Worker }
292*49cdfc7eSAndroid Build Coastguard Worker 
293*49cdfc7eSAndroid Build Coastguard Worker /*
294*49cdfc7eSAndroid Build Coastguard Worker  * cleanup() - performs all the ONE TIME cleanup for this test at completion
295*49cdfc7eSAndroid Build Coastguard Worker  * 	       or premature exit.
296*49cdfc7eSAndroid Build Coastguard Worker  */
cleanup(void)297*49cdfc7eSAndroid Build Coastguard Worker void cleanup(void)
298*49cdfc7eSAndroid Build Coastguard Worker {
299*49cdfc7eSAndroid Build Coastguard Worker 
300*49cdfc7eSAndroid Build Coastguard Worker }
301*49cdfc7eSAndroid Build Coastguard Worker 
302*49cdfc7eSAndroid Build Coastguard Worker #endif
303