| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- #include <stdio.h>
- #include <stdlib.h>
- #include <unistd.h>
- #include <sys/mount.h>
- #include <sys/stat.h>
- #include <sys/wait.h>
- #include <fcntl.h>
- int main() {
- // Mount essential filesystems
- mkdir("/dev", 0755);
- mkdir("/proc", 0755);
- mkdir("/sys", 0755);
-
- mount("devtmpfs", "/dev", "devtmpfs", 0, NULL);
- mount("proc", "/proc", "proc", 0, NULL);
- mount("sysfs", "/sys", "sysfs", 0, NULL);
-
- // Set up standard file descriptors
- int fd = open("/dev/console", O_RDWR);
- if (fd >= 0) {
- dup2(fd, 0);
- dup2(fd, 1);
- dup2(fd, 2);
- if (fd > 2) close(fd);
- }
-
- printf("ArkOS C Init Wrapper: Environment mounted, launching Swift Splash...\n");
-
- // Launch the swift application
- pid_t pid = fork();
- if (pid == 0) {
- char *argv[] = { "/swift_splash", NULL };
- char *envp[] = { "PATH=/bin:/usr/bin:/sbin", NULL };
- execve("/swift_splash", argv, envp);
- printf("Execve failed!\n");
- exit(1);
- }
-
- // PID 1 must never exit
- int status;
- waitpid(pid, &status, 0);
-
- printf("Swift splash exited. Hanging system to prevent kernel panic...\n");
- while(1) sleep(1);
- return 0;
- }
|