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 #if __ANDROID_API__ < 21
15 
16 #include <sys/types.h>
17 #include <sys/stat.h>
18 #include <fcntl.h>
19 #include <sys/syscall.h>
20 #include <signal.h>
21 
22 #include "lldb/Host/Time.h"
23 
24 time_t timegm(struct tm* t)
25 {
26     return (time_t) timegm64(t);
27 }
28 
29 int signalfd (int fd, const sigset_t *mask, int flags)
30 {
31     return syscall(__NR_signalfd4, fd, mask, _NSIG / 8, flags);
32 }
33 
34 int posix_openpt(int flags)
35 {
36     return open("/dev/ptmx", flags);
37 }
38 
39 #endif
40