[flang] Use object before converts in fir.dispatch (#68589)
[llvm-project.git] / libc / src / sys / wait / linux / waitpid.cpp
blobb2e8229a525832d251b278223d355e2604932521
1 //===-- Linux implementation of waitpid -----------------------------------===//
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 //===----------------------------------------------------------------------===//
9 #include "src/__support/common.h"
10 #include "src/__support/libc_assert.h"
12 #include "src/sys/wait/wait4Impl.h"
13 #include "src/sys/wait/waitpid.h"
15 namespace LIBC_NAMESPACE {
17 LLVM_LIBC_FUNCTION(pid_t, waitpid, (pid_t pid, int *wait_status, int options)) {
18 auto result = internal::wait4impl(pid, wait_status, options, 0);
19 if (!result.has_value()) {
20 libc_errno = result.error();
21 return -1;
23 return result.value();
26 } // namespace LIBC_NAMESPACE