Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lldb / source / Host / linux / LibcGlue.cpp
blobfe61ac79cea373bee96fd8976b88bf5632a7bb27
1 //===-- LibcGlue.cpp ------------------------------------------------------===//
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 // This file adds functions missing from libc on older versions of linux
11 #include <cerrno>
12 #include <lldb/Host/linux/Uio.h>
13 #include <sys/syscall.h>
14 #include <unistd.h>
16 #if !HAVE_PROCESS_VM_READV
17 // If the syscall wrapper is not available, provide one.
18 ssize_t process_vm_readv(::pid_t pid, const struct iovec *local_iov,
19 unsigned long liovcnt, const struct iovec *remote_iov,
20 unsigned long riovcnt, unsigned long flags) {
21 #if HAVE_NR_PROCESS_VM_READV
22 // If we have the syscall number, we can issue the syscall ourselves.
23 return syscall(__NR_process_vm_readv, pid, local_iov, liovcnt, remote_iov,
24 riovcnt, flags);
25 #else // If not, let's pretend the syscall is not present.
26 errno = ENOSYS;
27 return -1;
28 #endif
30 #endif