2 +----------------------------------------------------------------------+
4 +----------------------------------------------------------------------+
5 | Copyright (c) 2010-present Facebook, Inc. (http://www.facebook.com) |
6 +----------------------------------------------------------------------+
7 | This source file is subject to version 3.01 of the PHP license, |
8 | that is bundled with this package in the file LICENSE, and is |
9 | available through the world-wide-web at the following url: |
10 | http://www.php.net/license/3_01.txt |
11 | If you did not receive a copy of the PHP license and are unable to |
12 | obtain it through the world-wide-web, please send a note to |
13 | license@php.net so we can mail you a copy immediately. |
14 +----------------------------------------------------------------------+
16 #ifndef incl_HPHP_COMPATIBILITY_H_
17 #define incl_HPHP_COMPATIBILITY_H_
23 #include <folly/Singleton.h>
24 #include <folly/portability/Unistd.h>
26 #include "hphp/util/portability.h"
30 //////////////////////////////////////////////////////////////////////
32 std::shared_ptr
<T
> getSingleton() {
33 return folly::Singleton
<T
>::try_get();
36 #define PHP_DIR_SEPARATOR '/'
38 #if defined(__APPLE__) || defined(__FreeBSD__)
39 char *strndup(const char* str
, size_t len
);
40 int dprintf(int fd
, ATTRIBUTE_PRINTF_STRING
const char *format
, ...)
41 ATTRIBUTE_PRINTF(2,3);
43 int pipe2(int pipefd
[2], int flags
);
47 * Drop the cached pages associated with the file from the file system
48 * cache, if supported on our build target.
50 * Returns: -1 on error.
52 int fadvise_dontneed(int fd
, off_t len
);
53 int advise_out(const std::string
& fileName
);
57 const char *dli_fname
;
59 const char *dli_sname
;
63 int dladdr(const void *addr
, Dl_info
*info
);
64 int backtrace(void **buffer
, int size
);
67 //////////////////////////////////////////////////////////////////////