mirror of
https://github.com/EnderIce2/Fennix.git
synced 2025-05-28 15:34:31 +00:00
userspace/init: dummy code
Some checks failed
Build OS / Build Cross-Compiler & Toolchain (push) Successful in 1h46m32s
Build OS / Deploy Documentation to GitHub Pages (push) Failing after 4m27s
Build OS / Analyze (${{ matrix.language }}) (manual, c-cpp) (push) Failing after 6m13s
Build OS / Build amd64 (push) Failing after 14m44s
Build OS / Build i386 (push) Failing after 16m28s
Build OS / Build aarch64 (push) Failing after 11m17s
Build OS / Build arm (push) Failing after 15m17s
Some checks failed
Build OS / Build Cross-Compiler & Toolchain (push) Successful in 1h46m32s
Build OS / Deploy Documentation to GitHub Pages (push) Failing after 4m27s
Build OS / Analyze (${{ matrix.language }}) (manual, c-cpp) (push) Failing after 6m13s
Build OS / Build amd64 (push) Failing after 14m44s
Build OS / Build i386 (push) Failing after 16m28s
Build OS / Build aarch64 (push) Failing after 11m17s
Build OS / Build arm (push) Failing after 15m17s
Signed-off-by: EnderIce2 <enderice2@protonmail.com>
This commit is contained in:
parent
d7bccb6948
commit
23a17fae00
@ -19,9 +19,51 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <sys/wait.h>
|
||||||
|
|
||||||
int main(int, char *[], char *[])
|
void StartProcess(const char *program, char *const argv[])
|
||||||
{
|
{
|
||||||
printf("Hello, World!\n");
|
pid_t pid = fork();
|
||||||
|
if (pid == 0)
|
||||||
|
{
|
||||||
|
execvp(program, argv);
|
||||||
|
perror("execvp");
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
else if (pid < 0)
|
||||||
|
{
|
||||||
|
perror("fork");
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ReapZombies()
|
||||||
|
{
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
int status;
|
||||||
|
pid_t pid = waitpid(-1, &status, WNOHANG);
|
||||||
|
if (pid <= 0)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
printf("init starting...\n");
|
||||||
|
|
||||||
|
char *shellArgs[] = {"/bin/sh", NULL};
|
||||||
|
StartProcess("/bin/sh", shellArgs);
|
||||||
|
|
||||||
|
// char *dummyServiceArgs[] = {"/usr/bin/dummy_service", NULL};
|
||||||
|
// StartProcess("/usr/bin/dummy_service", dummyServiceArgs);
|
||||||
|
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
ReapZombies();
|
||||||
|
sleep(1);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user