Fix FP updating logic to ensure FP SSATmp dominates block
[hiphop-php.git] / hphp / util / compatibility.h
bloba145c4759d5e9b476360ab117f26481715cca2b5
1 /*
2 +----------------------------------------------------------------------+
3 | HipHop for PHP |
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_
19 #include <cstdint>
20 #include <string>
21 #include <time.h>
23 #include <folly/Singleton.h>
24 #include <folly/portability/Unistd.h>
26 #include "hphp/util/portability.h"
28 namespace HPHP {
30 //////////////////////////////////////////////////////////////////////
31 template <typename T>
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);
44 #endif
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);
55 #ifdef _MSC_VER
56 typedef struct {
57 const char *dli_fname;
58 void *dli_fbase;
59 const char *dli_sname;
60 void *dli_saddr;
61 } Dl_info;
63 int dladdr(const void *addr, Dl_info *info);
64 int backtrace(void **buffer, int size);
65 #endif
67 //////////////////////////////////////////////////////////////////////
71 #endif