10432b85dSNoah Goldstein //===-- Implementation of sched_getscheduler ------------------------------===// 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_getscheduler.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_getscheduler, (pid_t tid)) { 21b6bc9d72SGuillaume Chatelet int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_sched_getscheduler, tid); 220432b85dSNoah Goldstein if (ret < 0) { 230432b85dSNoah Goldstein libc_errno = -ret; 240432b85dSNoah Goldstein return -1; 250432b85dSNoah Goldstein } 26943d194fSMikhail R. Gadelha return ret; 270432b85dSNoah Goldstein } 280432b85dSNoah Goldstein 29*5ff3ff33SPetr Hosek } // namespace LIBC_NAMESPACE_DECL 30