git://scm.lunaixsky.com
/
lunaix-os.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' into prog-loader
[lunaix-os.git]
/
lunaix-os
/
uprog
/
init.c
diff --git
a/lunaix-os/uprog/init.c
b/lunaix-os/uprog/init.c
index a1972452ebf614e287556a9596d205664813b9b9..dd083add12be17fe2f84968ee6b83809bfd57290 100644
(file)
--- a/
lunaix-os/uprog/init.c
+++ b/
lunaix-os/uprog/init.c
@@
-1,4
+1,5
@@
#include <fcntl.h>
#include <fcntl.h>
+#include <stdio.h>
#include <sys/lunaix.h>
#include <unistd.h>
#include <sys/lunaix.h>
#include <unistd.h>
@@
-7,17
+8,26
@@
main(int argc, const char** argv)
{
int errno = 0;
{
int errno = 0;
- if ((errno = open("/dev/tty", 0))) {
+ if ((errno = open("/dev/tty", 0))
< 0
) {
syslog(2, "fail to open tty (%d)\n", errno);
return 0;
}
syslog(2, "fail to open tty (%d)\n", errno);
return 0;
}
- if ((errno = dup(errno))) {
+ if ((errno = dup(errno))
< 0
) {
syslog(2, "fail to setup tty i/o (%d)\n", errno);
return 0;
}
syslog(2, "fail to setup tty i/o (%d)\n", errno);
return 0;
}
- syslog(0, "user space!\n");
+ printf("(%p) user space!\n", (void*)main);
+
+ pid_t pid;
+ if (!(pid = fork())) {
+ int err = execve("/mnt/lunaix-os/usr/ls", NULL, NULL);
+ printf("fail to execute (%d)\n", err);
+ _exit(err);
+ }
+
+ waitpid(pid, NULL, 0);
return 0;
}
\ No newline at end of file
return 0;
}
\ No newline at end of file