| 1 | //===-- Linux implementation of wait --------------------------------------===// |
| 2 | // |
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #include "src/__support/common.h" |
| 10 | #include "src/__support/libc_assert.h" |
| 11 | |
| 12 | #include "src/__support/macros/config.h" |
| 13 | #include "src/sys/wait/wait.h" |
| 14 | #include "src/sys/wait/wait4Impl.h" |
| 15 | |
| 16 | namespace LIBC_NAMESPACE_DECL { |
| 17 | |
| 18 | LLVM_LIBC_FUNCTION(pid_t, wait, (int *wait_status)) { |
| 19 | auto result = internal::wait4impl(-1, wait_status, 0, 0); |
| 20 | if (!result.has_value()) { |
| 21 | libc_errno = result.error(); |
| 22 | return -1; |
| 23 | } |
| 24 | return result.value(); |
| 25 | } |
| 26 | |
| 27 | } // namespace LIBC_NAMESPACE_DECL |
| 28 | |