Project

General

Profile

Bug #3150 » test.c

test case, broken in 32-bit kernel mode - Milan Jurik, 2012-09-29 06:30 PM

 
1
#include <sys/types.h>
2
#include <stdio.h>
3
#include <unistd.h>
4
#include <string.h>
5
#include <sys/time.h>
6

    
7
static int startup_daemonize_pipe[2];
8

    
9
int
10
main() {
11
	fd_set rfds;
12
	fd_set efds;
13
	struct timeval tv;
14
	int retval;
15

    
16
	(void) pipe (startup_daemonize_pipe);
17

    
18
	switch (fork()) {
19
	case 0:
20
		sleep(100000);
21
		break;
22
	default:
23
		FD_ZERO(&rfds);
24
		FD_SET(startup_daemonize_pipe[0], &rfds);
25
		FD_ZERO(&efds);
26
		FD_SET(startup_daemonize_pipe[0], &efds);
27
		tv.tv_sec = 25;
28
		tv.tv_usec = 0;
29
		retval = select (startup_daemonize_pipe[0] + 1, &rfds, NULL, &efds, &tv);
30
		fprintf(stderr, "retval = %d\n", retval);
31
	}
32
}
(3-3/3)