OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.c-torture/] [compile/] [991026-2.c] - Blame information for rev 859

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 297 jeremybenn
typedef int __pid_t;
2
extern __pid_t fork  (void)    ;
3
extern int printf  (__const char *__restrict __format, ...)    ;
4
extern char *strerror  (int __errnum)    ;
5
extern int errno;
6
extern int *__errno_location  (void)     __attribute__ ((__const__));
7
extern void _exit  (int __status)   __attribute__ ((__noreturn__));
8
extern void exit  (int __status)     __attribute__ ((__noreturn__));
9
extern int close  (int __fd)    ;
10
extern int dup  (int __fd)    ;
11
extern int open  (__const char *__file, int __oflag, ...)    ;
12
 
13
 
14
char    myname[]="foo";
15
 
16
detach()
17
{
18
        switch(fork()) {
19
            case -1:
20
                printf("%s: Error: fork - %s\n",myname, strerror((*__errno_location ()) ));
21
                exit(255);
22
            case 0:
23
 
24
                close(0);
25
                close(1);
26
                close(2);
27
                dup(dup(open("/dev/null", 02 )));
28
                return;
29
            default:
30
 
31
                _exit(0);
32
        }
33
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.