Userland: Add a dummy passthrough "flock" program
This allows you to run our build system's Makefiles inside SerenityOS itself (since they rely on "flock") Obviously it doesn't do any locking as we don't support that yet.
This commit is contained in:
parent
f4f958f99f
commit
e711936c78
Notes:
sideshowbarker
2024-07-19 09:56:11 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/e711936c781
1 changed files with 26 additions and 0 deletions
26
Userland/flock.cpp
Normal file
26
Userland/flock.cpp
Normal file
|
@ -0,0 +1,26 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
if (argc < 3) {
|
||||
printf("usage: flock <path> <command...>\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!fork()) {
|
||||
if (execvp(argv[2], &argv[2]) < 0) {
|
||||
perror("execvp");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
int status;
|
||||
if (waitpid(-1, &status, 0) < 0) {
|
||||
perror("waitpid");
|
||||
return 1;
|
||||
}
|
||||
return WEXITSTATUS(status);
|
||||
}
|
Loading…
Add table
Reference in a new issue