diff --git a/Userland/flock.cpp b/Userland/flock.cpp new file mode 100644 index 0000000000..d86adeb4fc --- /dev/null +++ b/Userland/flock.cpp @@ -0,0 +1,26 @@ +#include +#include +#include +#include + +int main(int argc, char** argv) +{ + if (argc < 3) { + printf("usage: flock \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); +}