xref: /llvm-project/libc/src/sched/linux/sched_getparam.cpp (revision 5ff3ff33ff930e4ec49da7910612d8a41eb068cb)
10432b85dSNoah Goldstein //===-- Implementation of sched_getparam ----------------------------------===//
20432b85dSNoah Goldstein //
30432b85dSNoah Goldstein // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40432b85dSNoah Goldstein // See https://llvm.org/LICENSE.txt for license information.
50432b85dSNoah Goldstein // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60432b85dSNoah Goldstein //
70432b85dSNoah Goldstein //===----------------------------------------------------------------------===//
80432b85dSNoah Goldstein 
90432b85dSNoah Goldstein #include "src/sched/sched_getparam.h"
100432b85dSNoah Goldstein 
110432b85dSNoah Goldstein #include "src/__support/OSUtil/syscall.h" // For internal syscall function.
120432b85dSNoah Goldstein #include "src/__support/common.h"
13*5ff3ff33SPetr Hosek #include "src/__support/macros/config.h"
140432b85dSNoah Goldstein #include "src/errno/libc_errno.h"
150432b85dSNoah Goldstein 
160432b85dSNoah Goldstein #include <sys/syscall.h> // For syscall numbers.
170432b85dSNoah Goldstein 
18*5ff3ff33SPetr Hosek namespace LIBC_NAMESPACE_DECL {
190432b85dSNoah Goldstein 
200432b85dSNoah Goldstein LLVM_LIBC_FUNCTION(int, sched_getparam,
210432b85dSNoah Goldstein                    (pid_t tid, struct sched_param *param)) {
22b6bc9d72SGuillaume Chatelet   int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_sched_getparam, tid, param);
230432b85dSNoah Goldstein   if (ret < 0) {
240432b85dSNoah Goldstein     libc_errno = -ret;
250432b85dSNoah Goldstein     return -1;
260432b85dSNoah Goldstein   }
270432b85dSNoah Goldstein   return 0;
280432b85dSNoah Goldstein }
290432b85dSNoah Goldstein 
30*5ff3ff33SPetr Hosek } // namespace LIBC_NAMESPACE_DECL
31