Permalink
Browse files

Remove a workaround for sysconf w/ _SC_PHYS_PAGES

sysconf with _SC_PHYS_PAGES did not work on Android 2.2 and prior due to a bug in bionic. That bug in question was fixed in Android 2.3 as follows.
https://android.googlesource.com/platform/bionic/+/038fbae518e904c7aba64779714a22dbeeb90887

Mozc has worked around this issue by emulating sysconf with _SC_PHYS_PAGES in android/jni/sysconf.cc.  However, we no longer have to do that because Mozc don’t support those legacy platforms anymore.

This CL is just a removal of redundant historical code.  No behavior change is intended.

BUG=none
TEST=none

git-svn-id: https://mozc.googlecode.com/svn/trunk@540 a6090854-d499-a067-5803-1114d4e51264
  • Loading branch information...
1 parent d2e7239 commit 46440f371dda6a16e3e69b2be6df2fe6391c5464 @yukawa yukawa committed Feb 8, 2015
@@ -532,7 +532,6 @@
'target_name': 'subset_font',
'type': 'none',
'dependencies': [
- # TODO(komatsu): Is it better to move android_base.gyp?
'resources/resources.gyp:copy_asis_svg',
'resources/resources.gyp:transform_template_svg',
],
@@ -1,47 +0,0 @@
-# Copyright 2010-2015, Google Inc.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following disclaimer
-# in the documentation and/or other materials provided with the
-# distribution.
-# * Neither the name of Google Inc. nor the names of its
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-# android_base.gyp defines targets for lower layers to link to the android
-# modules, so modules in lower layers do not depend on ones in higher layers,
-# avoiding circular dependencies.
-{
- 'variables': {
- 'relative_dir': 'android',
- 'gen_out_dir': '<(SHARED_INTERMEDIATE_DIR)/<(relative_dir)',
- },
- 'targets': [
- {
- 'target_name': 'android_sysconf',
- 'type': 'static_library',
- 'sources': [
- 'jni/sysconf.cc',
- ],
- },
- ],
-}
@@ -1,59 +0,0 @@
-// Copyright 2010-2015, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-#include "android/jni/sysconf.h"
-
-#include <cstdlib>
-#include <fstream>
-#include <string>
-#include <unistd.h>
-
-extern "C" {
-
-int mysysconf(int name) {
- if (name == _SC_PHYS_PAGES) {
- std::ifstream ifs("/proc/meminfo");
- if (!ifs) {
- return -2;
- }
-
- long size = -3;
- std::string line;
- while (std::getline(ifs, line)) {
- if (std::sscanf(line.c_str(), "MemTotal: %ld kB", &size) == 1) {
- break;
- }
- }
- ifs.close();
- return size;
- }
- return sysconf(name);
-}
-
-} // extern "C"
@@ -1,43 +0,0 @@
-// Copyright 2010-2015, Google Inc.
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Thin wrapper of sysconf. Because sysconf in android has a bug, we need to
-// avoid it. Mozc uses only _SC_PHYS_PAGES, so this fixes just it.
-// To apply this fix, put
-// #define sysconf mysysconf.
-// just after including the header.
-
-#ifndef MOZC_ANDROID_JNI_SYSCONF_H_
-#define MOZC_ANDROID_JNI_SYSCONF_H_
-
-extern "C" {
- int mysysconf(int name);
-}
-
-#endif // MOZC_ANDROID_JNI_SYSCONF_H_
View
@@ -164,9 +164,6 @@
'sources': [
'android_util.cc',
],
- 'dependencies': [
- '../android/android_base.gyp:android_sysconf',
- ],
}],
['target_platform=="NaCl" and _toolset=="target"', {
'sources': [
@@ -66,9 +66,6 @@
#include "base/win_util.h"
#ifdef OS_ANDROID
-// HACK to avoid a bug in sysconf in android.
-#include "android/jni/sysconf.h"
-#define sysconf mysysconf
#include "base/android_util.h"
#endif // OS_ANDROID
@@ -1,6 +1,6 @@
MAJOR=2
MINOR=16
-BUILD=2056
+BUILD=2057
REVISION=102
# NACL_DICTIONARY_VERSION is the target version of the system dictionary to be
# downloaded by NaCl Mozc.

0 comments on commit 46440f3

Please sign in to comment.