summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2018-10-25 16:29:02 -0700
committerElliott Hughes <enh@google.com>2018-10-25 16:29:02 -0700
commit46e0cc27ca3ed891c45373e2b9c086a8191666cd (patch)
tree13efde60e92707e5e414ba3c8570168e8c1e60ff /base
parentdd85c74655400347aee5f6bfecd827a311f16ca4 (diff)
downloadsystem_core-46e0cc27ca3ed891c45373e2b9c086a8191666cd.tar.gz
system_core-46e0cc27ca3ed891c45373e2b9c086a8191666cd.tar.bz2
system_core-46e0cc27ca3ed891c45373e2b9c086a8191666cd.zip
libbase: a slightly cleaner solution to libbase's `off64_t` problem.
Given that I can't actually go back in time and just make bionic's `off_t` be 64-bit. Bug: N/A Test: builds Change-Id: Ic93336b07bffc0977bd0e9caad6a22ce29ca06ed
Diffstat (limited to 'base')
-rw-r--r--base/include/android-base/file.h7
-rw-r--r--base/include/android-base/mapped_file.h6
-rw-r--r--base/include/android-base/off64_t.h22
3 files changed, 25 insertions, 10 deletions
diff --git a/base/include/android-base/file.h b/base/include/android-base/file.h
index 8f9bf80a0..86d537d76 100644
--- a/base/include/android-base/file.h
+++ b/base/include/android-base/file.h
@@ -20,6 +20,8 @@
#include <sys/types.h>
#include <string>
+#include "android-base/off64_t.h"
+
#if !defined(_WIN32) && !defined(O_BINARY)
/** Windows needs O_BINARY, but Unix never mangles line endings. */
#define O_BINARY 0
@@ -30,11 +32,6 @@
#define O_CLOEXEC O_NOINHERIT
#endif
-#if defined(__APPLE__)
-/** Mac OS has always had a 64-bit off_t, so it doesn't have off64_t. */
-typedef off_t off64_t;
-#endif
-
namespace android {
namespace base {
diff --git a/base/include/android-base/mapped_file.h b/base/include/android-base/mapped_file.h
index 667ba7eaf..80513b1fa 100644
--- a/base/include/android-base/mapped_file.h
+++ b/base/include/android-base/mapped_file.h
@@ -16,12 +16,8 @@
#pragma once
-#if __APPLE__
-/* Temporary Mac build fix for off64_t. TODO: refactor into `portability.h`. */
-#include "android-base/file.h"
-#endif
-
#include "android-base/macros.h"
+#include "android-base/off64_t.h"
#include <sys/types.h>
diff --git a/base/include/android-base/off64_t.h b/base/include/android-base/off64_t.h
new file mode 100644
index 000000000..e6b71b81e
--- /dev/null
+++ b/base/include/android-base/off64_t.h
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#if defined(__APPLE__)
+/** Mac OS has always had a 64-bit off_t, so it doesn't have off64_t. */
+typedef off_t off64_t;
+#endif