summaryrefslogtreecommitdiffstats
path: root/lldb/source/Host/android/LibcGlue.cpp
blob: d127d6b01ad9b72ff273dd9867ca97711da3a116 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//===-- LibcGlue.cpp --------------------------------------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// This files adds functions missing from libc on earlier versions of Android

#include <android/api-level.h>

#include <sys/syscall.h>
#include <lldb/Host/linux/Uio.h>

#if __ANDROID_API__ < 21

#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <signal.h>

#include "lldb/Host/Time.h"

time_t timegm(struct tm* t)
{
    return (time_t) timegm64(t);
}

int signalfd (int fd, const sigset_t *mask, int flags)
{
    return syscall(__NR_signalfd4, fd, mask, _NSIG / 8, flags);
}

int posix_openpt(int flags)
{
    return open("/dev/ptmx", flags);
}

#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)
{
    return syscall(__NR_process_vm_readv, pid, local_iov, liovcnt, remote_iov, riovcnt, flags);
}
OpenPOWER on IntegriCloud