[NFC][Py Reformat] Added more commits to .git-blame-ignore-revs
[llvm-project.git] / libc / src / unistd / linux / syscall.cpp
blobe7f5b1514b7f7b0c2546ed18f24f399b6cfb719b
1 //===-- Linux implementation of syscall -----------------------------------===//
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/unistd/syscall.h"
11 #include "src/__support/OSUtil/syscall.h" // For internal syscall function.
12 #include "src/__support/common.h"
14 #include "src/errno/libc_errno.h"
15 #include <stdarg.h>
17 namespace __llvm_libc {
19 LLVM_LIBC_FUNCTION(long, __llvm_libc_syscall,
20 (long number, long arg1, long arg2, long arg3, long arg4,
21 long arg5, long arg6)) {
22 long ret =
23 __llvm_libc::syscall_impl(number, arg1, arg2, arg3, arg4, arg5, arg6);
24 // Syscalls may return large positive values that overflow, but will never
25 // return values between -4096 and -1
26 if (static_cast<unsigned long>(ret) > -4096UL) {
27 libc_errno = -ret;
28 return -1;
30 return ret;
33 } // namespace __llvm_libc