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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [uclinux/] [userland/] [init/] [simpleinit.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 851 simons
#include <stdlib.h>
2
#include <errno.h>
3
 
4
int main(void)
5
{
6
        int pid;
7
        int status;
8
        char *argv[3];
9
        char *envp[3];
10
 
11
        argv[0] = "/bin/sh";
12
        argv[1] = "/etc/rc";
13
        argv[2] = NULL;
14
 
15
        envp[0] = "HOME=/";
16
        envp[1] = "TERM=linux";
17
        envp[2] =  NULL;
18
 
19
        printf("Executing shell ... \n");
20
        if (!(pid = vfork())) {
21
                execve("/bin/sh", argv, envp);
22
        }
23
 
24
        for (;;) {
25
                pid = wait4(pid, &status, 0, 0);
26
                if ((pid < 0) && (errno == EINTR))
27
                        continue;
28
                if (pid < 0)
29
                        break;
30
        }
31
 
32
        _exit(0);
33
        return 0;
34
}
35
 

powered by: WebSVN 2.1.0

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