1/*
2 * Copyright 2010, The Android Open Source Project
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *  * Redistributions of source code must retain the above copyright
8 *    notice, this list of conditions and the following disclaimer.
9 *  * Redistributions in binary form must reproduce the above copyright
10 *    notice, this list of conditions and the following disclaimer in the
11 *    documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#ifndef ANDROID_CHROMIUM_PREFIX_H
27#define ANDROID_CHROMIUM_PREFIX_H
28
29// C++ specific changes
30#ifdef __cplusplus
31#include <unistd.h>
32#include <sys/prctl.h>
33// chromium refers to stl functions without std::
34#include <algorithm>
35using std::find;
36using std::reverse;
37using std::search;
38
39// Called by command_line.cc to shorten the process name. Not needed for
40// network stack.
41#define prctl() (0)
42
43namespace std {
44// our new does not trigger oom
45inline void set_new_handler(void (*p)()) {}
46}
47
48// Chromium expects size_t to be a signed int on linux but Android defines it
49// as unsigned.
50inline size_t abs(size_t x) { return x; }
51#endif
52
53// Needed by base_paths.cc for close() function.
54#include <unistd.h>
55// Need to define assert before logging.h undefines it.
56#include <assert.h>
57// logging.cc needs pthread_mutex_t
58#include <pthread.h>
59// needed for isalpha
60#include <ctype.h>
61// needed for sockaddr_in
62#include <netinet/in.h>
63
64// Implemented in bionic but not exposed.
65extern char* mkdtemp(char* path);
66
67#define FRIEND_TEST(test_case_name, test_name)\
68friend class test_case_name##_##test_name##_Test
69
70// This will probably need a real implementation.
71//#define F_ULOCK 0
72//#define F_LOCK 1
73//inline int lockf(int fd, int cmd, off_t len) { return -1; }
74
75// Disable langinfo in icu
76#define U_GAVE_NL_LANGINFO_CODESET 0
77
78// We use the C99 style, but this is not defined
79#define HAVE_UINT16_T 1
80
81#endif
82