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 files adds functions missing from libc on earlier versions of Android
11 
12 #include <android/api-level.h>
13 
14 #include <sys/syscall.h>
15 #include <lldb/Host/linux/Uio.h>
16 
17 #if __ANDROID_API__ < 21
18 
19 #include <sys/types.h>
20 #include <sys/stat.h>
21 #include <fcntl.h>
22 #include <signal.h>
23 
24 #include "lldb/Host/Time.h"
25 
26 time_t timegm(struct tm* t)
27 {
28     return (time_t) timegm64(t);
29 }
30 
31 int signalfd (int fd, const sigset_t *mask, int flags)
32 {
33     return syscall(__NR_signalfd4, fd, mask, _NSIG / 8, flags);
34 }
35 
36 int posix_openpt(int flags)
37 {
38     return open("/dev/ptmx", flags);
39 }
40 
41 #endif
42 
43 ssize_t process_vm_readv(::pid_t pid,
44 			 const struct iovec *local_iov, unsigned long liovcnt,
45 			 const struct iovec *remote_iov, unsigned long riovcnt,
46 			 unsigned long flags)
47 {
48     return syscall(__NR_process_vm_readv, pid, local_iov, liovcnt, remote_iov, riovcnt, flags);
49 }
50