1
// Copyright (c) 2011 The LevelDB Authors. All rights reserved.
2
// Use of this source code is governed by a BSD-style license that can be
3
// found in the LICENSE file. See the AUTHORS file for names of contributors.
5
// See port_example.h for documentation for the following types/functions.
7
#ifndef STORAGE_LEVELDB_PORT_PORT_POSIX_H_
8
#define STORAGE_LEVELDB_PORT_PORT_POSIX_H_
10
#if defined(OS_MACOSX) || defined(OS_FREEBSD)
11
#include <machine/endian.h>
12
#elif defined(OS_SOLARIS)
13
#include <sys/isa_defs.h>
28
#include "port/atomic_pointer.h"
31
#define IS_LITTLE_ENDIAN true
33
#define IS_LITTLE_ENDIAN (__BYTE_ORDER == __LITTLE_ENDIAN)
36
#if defined(OS_MACOSX) || defined(OS_SOLARIS) || defined(OS_FREEBSD)
37
#define fread_unlocked fread
38
#define fwrite_unlocked fwrite
39
#define fflush_unlocked fflush
42
#if defined(OS_MACOSX) || defined(OS_FREEBSD)
43
#define fdatasync fsync
49
static const bool kLittleEndian = IS_LITTLE_ENDIAN;
68
void operator=(const Mutex&);
73
explicit CondVar(Mutex* mu);
83
inline bool Snappy_Compress(const char* input, size_t length,
84
::std::string* output) {
86
output->resize(snappy::MaxCompressedLength(length));
88
snappy::RawCompress(input, length, &(*output)[0], &outlen);
89
output->resize(outlen);
96
inline bool Snappy_GetUncompressedLength(const char* input, size_t length,
99
return snappy::GetUncompressedLength(input, length, result);
105
inline bool Snappy_Uncompress(const char* input, size_t length,
108
return snappy::RawUncompress(input, length, output);
114
inline bool GetHeapProfile(void (*func)(void*, const char*, int), void* arg) {
119
} // namespace leveldb
121
#endif // STORAGE_LEVELDB_PORT_PORT_POSIX_H_