From e711936c781b5941c323d8433ab5a141d0cccbd4 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 20 Jan 2020 20:44:29 +0100 Subject: [PATCH] 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. --- Userland/flock.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Userland/flock.cpp 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); +}