• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef ANDROID_CHROMIUM_PREFIX_H
2 #define ANDROID_CHROMIUM_PREFIX_H
3 
4 // C++ specific changes
5 #ifdef __cplusplus
6 // chromium refers to stl functions without std::
7 #include <algorithm>
8 using std::find;
9 using std::reverse;
10 using std::search;
11 
12 // Our pwrite has buf declared void*.
pwrite(int fd,const void * buf,size_t count,off_t offset)13 ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset) {
14     return pwrite(fd, const_cast<void*>(buf), count, offset);
15 }
16 
17 // Called by command_line.cc to shorten the process name. Not needed for
18 // network stack.
prctl(int option,...)19 inline int prctl(int option, ...) { return 0; }
20 
21 namespace std {
22 // our new does not trigger oom
set_new_handler(void (* p)())23 inline void set_new_handler(void (*p)()) {}
24 }
25 
26 // Chromium expects size_t to be a signed int on linux but Android defines it
27 // as unsigned.
abs(size_t x)28 inline size_t abs(size_t x) { return x; }
29 #endif
30 
31 // Needed by base_paths.cc for close() function.
32 #include <unistd.h>
33 // Need to define assert before logging.h undefines it.
34 #include <assert.h>
35 // logging.cc needs pthread_mutex_t
36 #include <pthread.h>
37 // needed for isalpha
38 #include <ctype.h>
39 // needed for sockaddr_in
40 #include <netinet/in.h>
41 
42 // Implemented in bionic but not exposed.
43 extern char* mkdtemp(char* path);
44 extern time_t timegm(struct tm* const tmp);
45 
46 // This will probably need a real implementation.
47 #define F_ULOCK 0
48 #define F_LOCK 1
lockf(int fd,int cmd,off_t len)49 inline int lockf(int fd, int cmd, off_t len) { return -1; }
50 
51 // We have posix monotonic clocks but don't define this...
52 #define _POSIX_MONOTONIC_CLOCK 1
53 
54 // Disable langinfo in icu
55 #define U_GAVE_NL_LANGINFO_CODESET 0
56 
57 #endif
58