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 <unistd.h> 13 #include <sys/syscall.h> 14 #include <lldb/Host/linux/Uio.h> 15 #include <cerrno> 16 17 #ifndef HAVE_PROCESS_VM_READV // If the syscall wrapper is not available, provide one. 18 ssize_t process_vm_readv(::pid_t pid, 19 const struct iovec *local_iov, unsigned long liovcnt, 20 const struct iovec *remote_iov, unsigned long riovcnt, 21 unsigned long flags) 22 { 23 #ifdef HAVE_NR_PROCESS_VM_READV // If we have the syscall number, we can issue the syscall ourselves. 24 return syscall(__NR_process_vm_readv, pid, local_iov, liovcnt, remote_iov, 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 31