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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [uclinux/] [userland/] [init/] [simpleinit.c] - Rev 1765

Compare with Previous | Blame | View Log

#include <stdlib.h>
#include <errno.h>
 
int main(void)
{
	int pid;
	int status;
	char *argv[3];
	char *envp[3];
 
	argv[0] = "/bin/sh";
	argv[1] = "/etc/rc";
	argv[2] = NULL;
 
        envp[0] = "HOME=/";
        envp[1] = "TERM=linux";
        envp[2] =  NULL;
 
        printf("Executing shell ... \n");
	if (!(pid = vfork())) {
                execve("/bin/sh", argv, envp);
        }
 
        for (;;) {
                pid = wait4(pid, &status, 0, 0);
                if ((pid < 0) && (errno == EINTR))
                        continue;
		if (pid < 0)
			break;
        }
 
	_exit(0);
        return 0;
}
 
 

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

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