7 #ifndef STORAGE_LEVELDB_PORT_PORT_POSIX_H_ 8 #define STORAGE_LEVELDB_PORT_PORT_POSIX_H_ 10 #undef PLATFORM_IS_LITTLE_ENDIAN 11 #if defined(OS_MACOSX) 12 #include <machine/endian.h> 13 #if defined(__DARWIN_LITTLE_ENDIAN) && defined(__DARWIN_BYTE_ORDER) 14 #define PLATFORM_IS_LITTLE_ENDIAN \ 15 (__DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN) 17 #elif defined(OS_SOLARIS) 18 #include <sys/isa_defs.h> 20 #define PLATFORM_IS_LITTLE_ENDIAN true 22 #define PLATFORM_IS_LITTLE_ENDIAN false 24 #elif defined(OS_FREEBSD) || defined(OS_OPENBSD) ||\ 25 defined(OS_NETBSD) || defined(OS_DRAGONFLYBSD) 26 #include <sys/types.h> 27 #include <sys/endian.h> 28 #define PLATFORM_IS_LITTLE_ENDIAN (_BYTE_ORDER == _LITTLE_ENDIAN) 29 #elif defined(OS_HPUX) 30 #define PLATFORM_IS_LITTLE_ENDIAN false 31 #elif defined(OS_ANDROID) 36 #define PLATFORM_IS_LITTLE_ENDIAN (_BYTE_ORDER == _LITTLE_ENDIAN) 49 #ifndef PLATFORM_IS_LITTLE_ENDIAN 50 #define PLATFORM_IS_LITTLE_ENDIAN (__BYTE_ORDER == __LITTLE_ENDIAN) 53 #if defined(OS_MACOSX) || defined(OS_SOLARIS) || defined(OS_FREEBSD) ||\ 54 defined(OS_NETBSD) || defined(OS_OPENBSD) || defined(OS_DRAGONFLYBSD) ||\ 55 defined(OS_ANDROID) || defined(OS_HPUX) || defined(CYGWIN) 57 #define fread_unlocked fread 58 #define fwrite_unlocked fwrite 59 #define fflush_unlocked fflush 62 #if defined(OS_FREEBSD) ||\ 63 defined(OS_OPENBSD) || defined(OS_DRAGONFLYBSD) 65 #define fdatasync fsync 68 #if defined(OS_MACOSX) 69 #define fdatasync(fd) fcntl(fd, F_FULLFSYNC, 0) 72 #if defined(OS_ANDROID) && __ANDROID_API__ < 9 75 #define fdatasync fsync 82 #undef PLATFORM_IS_LITTLE_ENDIAN 117 #define LEVELDB_ONCE_INIT PTHREAD_ONCE_INIT 121 ::std::string* output) {
123 output->resize(snappy::MaxCompressedLength(length));
125 snappy::RawCompress(input, length, &(*output)[0], &outlen);
126 output->resize(outlen);
136 return snappy::GetUncompressedLength(input, length, result);
145 return snappy::RawUncompress(input, length, output);
161 #endif // STORAGE_LEVELDB_PORT_PORT_POSIX_H_ pthread_mutex_t mu_
Definition: port_posix.h:97
Definition: autocompact_test.cc:11
void AssertHeld()
Definition: port_posix.h:93
bool Snappy_Uncompress(const char *input_data, size_t input_length, char *output)
Definition: port_posix.h:142
#define PLATFORM_IS_LITTLE_ENDIAN
Definition: port_posix.h:50
CondVar(Mutex *mu)
Definition: port_posix.cc:33
void Unlock()
Definition: port_posix.cc:31
static port::OnceType once
Definition: comparator.cc:69
~Mutex()
Definition: port_posix.cc:27
Mutex()
Definition: port_posix.cc:25
bool Snappy_GetUncompressedLength(const char *input, size_t length, size_t *result)
Definition: port_posix.h:133
bool HasAcceleratedCRC32C()
Definition: port_posix.cc:56
void Signal()
Definition: port_posix.cc:44
void Wait()
Definition: port_posix.cc:40
static const bool kLittleEndian
Definition: port_example.h:21
void Lock()
Definition: port_posix.cc:29
pthread_cond_t cv_
Definition: port_posix.h:112
unsigned int uint32_t
Definition: stdint.h:21
bool Snappy_Compress(const char *input, size_t input_length, std::string *output)
void InitOnce(port::OnceType *, void(*initializer)())
Definition: port_posix.cc:52
bool GetHeapProfile(void(*func)(void *, const char *, int), void *arg)
Definition: port_posix.h:151
uint32_t AcceleratedCRC32C(uint32_t crc, const char *buf, size_t size)
Definition: port_posix_sse.cc:54
intptr_t OnceType
Definition: port_example.h:69
void SignalAll()
Definition: port_posix.cc:48
Mutex * mu_
Definition: port_posix.h:113
Definition: port_example.h:45
~CondVar()
Definition: port_posix.cc:38
void operator=(const Mutex &)
int port
Definition: zmq_sub.py:37
Definition: port_example.h:26