LLDB mainline
linux/LibcGlue.cpp
Go to the documentation of this file.
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//===----------------------------------------------------------------------===//
8
9// This file adds functions missing from libc on older versions of linux
10
11#include <cerrno>
12#include <lldb/Host/linux/Uio.h>
13#include <sys/syscall.h>
14#include <unistd.h>
15
16#if !HAVE_PROCESS_VM_READV
17// If the syscall wrapper is not available, provide one.
18ssize_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
29}
30#endif
ssize_t process_vm_readv(::pid_t pid, const struct iovec *local_iov, unsigned long liovcnt, const struct iovec *remote_iov, unsigned long riovcnt, unsigned long flags)