OLD | NEW |
1 // Copyright (c) 2011 The LevelDB Authors. All rights reserved. | 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 | 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. | 3 // found in the LICENSE file. See the AUTHORS file for names of contributors. |
4 | 4 |
5 #include <deque> | 5 #include <deque> |
6 #include <errno.h> | 6 #include <errno.h> |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 #include "base/at_exit.h" | 8 #include "base/at_exit.h" |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "leveldb/env.h" | 23 #include "leveldb/env.h" |
24 #include "leveldb/slice.h" | 24 #include "leveldb/slice.h" |
25 #include "port/port.h" | 25 #include "port/port.h" |
26 #include "util/logging.h" | 26 #include "util/logging.h" |
27 | 27 |
28 #if defined(OS_WIN) | 28 #if defined(OS_WIN) |
29 #include <io.h> | 29 #include <io.h> |
30 #include "base/win/win_util.h" | 30 #include "base/win/win_util.h" |
31 #endif | 31 #endif |
32 | 32 |
33 #if defined(OS_MACOSX) || defined(OS_WIN) | 33 #if defined(OS_MACOSX) || defined(OS_WIN) || defined(OS_ANDROID) |
34 // The following are glibc-specific | 34 // The following are glibc-specific |
35 namespace { | 35 namespace { |
36 | 36 |
37 size_t fread_unlocked(void *ptr, size_t size, size_t n, FILE *file) { | 37 size_t fread_unlocked(void *ptr, size_t size, size_t n, FILE *file) { |
38 return fread(ptr, size, n, file); | 38 return fread(ptr, size, n, file); |
39 } | 39 } |
40 | 40 |
41 size_t fwrite_unlocked(const void *ptr, size_t size, size_t n, FILE *file) { | 41 size_t fwrite_unlocked(const void *ptr, size_t size, size_t n, FILE *file) { |
42 return fwrite(ptr, size, n, file); | 42 return fwrite(ptr, size, n, file); |
43 } | 43 } |
44 | 44 |
45 int fflush_unlocked(FILE *file) { | 45 int fflush_unlocked(FILE *file) { |
46 return fflush(file); | 46 return fflush(file); |
47 } | 47 } |
48 | 48 |
| 49 #if !defined(OS_ANDROID) |
49 int fdatasync(int fildes) { | 50 int fdatasync(int fildes) { |
50 #if defined(OS_WIN) | 51 #if defined(OS_WIN) |
51 return _commit(fildes); | 52 return _commit(fildes); |
52 #else | 53 #else |
53 return fsync(fildes); | 54 return fsync(fildes); |
54 #endif | 55 #endif |
55 } | 56 } |
| 57 #endif |
56 | 58 |
57 } | 59 } |
58 #endif | 60 #endif |
59 | 61 |
60 namespace leveldb { | 62 namespace leveldb { |
61 | 63 |
62 namespace { | 64 namespace { |
63 | 65 |
64 class Thread; | 66 class Thread; |
65 | 67 |
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 ::base::LazyInstance<ChromiumEnv, ::base::LeakyLazyInstanceTraits<ChromiumEnv> > | 536 ::base::LazyInstance<ChromiumEnv, ::base::LeakyLazyInstanceTraits<ChromiumEnv> > |
535 default_env(::base::LINKER_INITIALIZED); | 537 default_env(::base::LINKER_INITIALIZED); |
536 | 538 |
537 } | 539 } |
538 | 540 |
539 Env* Env::Default() { | 541 Env* Env::Default() { |
540 return default_env.Pointer(); | 542 return default_env.Pointer(); |
541 } | 543 } |
542 | 544 |
543 } | 545 } |
OLD | NEW |