[libc] Add a minimal implementation of the POSIX fork function.
authorSiva Chandra Reddy <sivachandra@google.com>
Tue, 4 Oct 2022 06:43:59 +0000 (06:43 +0000)
committerSiva Chandra Reddy <sivachandra@google.com>
Tue, 4 Oct 2022 19:12:08 +0000 (19:12 +0000)
commite3638e83db086e77243d0673a4ce8a0b4b330d42
tree8b24d0e259f9af3d6563304cad1b4d05a7262ca7
parentb39b805ad52ca5a843412f2b1ecf11989cddff90
[libc] Add a minimal implementation of the POSIX fork function.

A very simple and minimal implementation of fork is added. Future
changes will add more functionality to satisfy POSIX and Linux
requirements.

An implementation of wait and a few support macros in sys/wait.h
have also been added to help with testing the fork function.

Reviewed By: lntue, michaelrj

Differential Revision: https://reviews.llvm.org/D135131
21 files changed:
libc/config/linux/api.td
libc/config/linux/x86_64/entrypoints.txt
libc/include/CMakeLists.txt
libc/include/llvm-libc-macros/CMakeLists.txt
libc/include/llvm-libc-macros/linux/CMakeLists.txt
libc/include/llvm-libc-macros/linux/sys-wait-macros.h [new file with mode: 0644]
libc/include/llvm-libc-macros/sys-wait-macros.h [new file with mode: 0644]
libc/include/sys/wait.h.def [new file with mode: 0644]
libc/spec/posix.td
libc/src/sys/CMakeLists.txt
libc/src/sys/wait/CMakeLists.txt [new file with mode: 0644]
libc/src/sys/wait/linux/CMakeLists.txt [new file with mode: 0644]
libc/src/sys/wait/linux/wait.cpp [new file with mode: 0644]
libc/src/sys/wait/wait.h [new file with mode: 0644]
libc/src/unistd/CMakeLists.txt
libc/src/unistd/fork.h [new file with mode: 0644]
libc/src/unistd/linux/CMakeLists.txt
libc/src/unistd/linux/fork.cpp [new file with mode: 0644]
libc/test/integration/src/CMakeLists.txt
libc/test/integration/src/unistd/CMakeLists.txt [new file with mode: 0644]
libc/test/integration/src/unistd/fork_test.cpp [new file with mode: 0644]