1 | //===-- Linux implementation of wait4 -------------------------------------===// |
---|---|
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/sys/wait/wait4.h" |
13 | #include "src/sys/wait/wait4Impl.h" |
14 | |
15 | namespace LIBC_NAMESPACE { |
16 | |
17 | LLVM_LIBC_FUNCTION(pid_t, wait4, |
18 | (pid_t pid, int *wait_status, int options, |
19 | struct rusage *usage)) { |
20 | auto result = internal::wait4impl(pid, wait_status, options, usage); |
21 | if (!result.has_value()) { |
22 | libc_errno = result.error(); |
23 | return -1; |
24 | } |
25 | return result.value(); |
26 | } |
27 | |
28 | } // namespace LIBC_NAMESPACE |
29 |