1 //===-- LibcGlue.cpp --------------------------------------------*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 // This file adds functions missing from libc on older versions of linux 11 12 #include <cerrno> 13 #include <lldb/Host/linux/Uio.h> 14 #include <sys/syscall.h> 15 #include <unistd.h> 16 17 #ifndef HAVE_PROCESS_VM_READV // If the syscall wrapper is not available, 18 // provide one. 19 ssize_t process_vm_readv(::pid_t pid, const struct iovec *local_iov, 20 unsigned long liovcnt, const struct iovec *remote_iov, 21 unsigned long riovcnt, unsigned long flags) { 22 #ifdef HAVE_NR_PROCESS_VM_READV // If we have the syscall number, we can issue 23 // the syscall ourselves. 24 return syscall(__NR_process_vm_readv, pid, local_iov, liovcnt, remote_iov, 25 riovcnt, flags); 26 #else // If not, let's pretend the syscall is not present. 27 errno = ENOSYS; 28 return -1; 29 #endif 30 } 31 #endif 32