提交 3aaaf904 编写于 作者: J jmelvin

7130404: [macosx] "os.arch" value should be "x86_64" for compatibility with Apple JDK6

Summary: On Mac OS X, align system property "os.arch" with Apple legacy JDKs.  Also, improve os.name string matching by using contains() method instead of .startsWith().
Reviewed-by: dcubed, phh, ohair, katleman
Contributed-by: james.melvin@oracle.com
上级 11ddab3b
/*
* Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -217,8 +217,8 @@ abstract class ConnectorImpl implements Connector {
}
protected void checkNativeLink(SecurityManager sm, String os) {
if (os.equals("SunOS") || os.equals("Linux")) {
// link "saproc" - SA native library on SunOS and Linux?
if (os.equals("SunOS") || os.equals("Linux") || os.contains("OS X")) {
// link "saproc" - SA native library on SunOS, Linux, and Mac OS X
sm.checkLink("saproc");
} else if (os.startsWith("Windows")) {
// link "sawindbg" - SA native library on Windows.
......
/*
* Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -43,7 +43,7 @@ public class PlatformInfo {
return "bsd";
} else if (os.equals("OpenBSD")) {
return "bsd";
} else if (os.equals("Darwin") || os.startsWith("Mac OS X")) {
} else if (os.equals("Darwin") || os.contains("OS X")) {
return "bsd";
} else if (os.startsWith("Windows")) {
return "win32";
......@@ -52,17 +52,17 @@ public class PlatformInfo {
}
}
/* Returns "sparc" if on SPARC, "x86" if on x86. */
/* Returns "sparc" for SPARC based platforms and "x86" for x86 based
platforms. Otherwise returns the value of os.arch. If the value
is not recognized as supported, an exception is thrown instead. */
public static String getCPU() throws UnsupportedPlatformException {
String cpu = System.getProperty("os.arch");
if (cpu.equals("i386")) {
if (cpu.equals("i386") || cpu.equals("x86")) {
return "x86";
} else if (cpu.equals("sparc") || cpu.equals("x86") || cpu.equals("ia64")) {
return cpu;
} else if (cpu.equals("sparcv9")) {
} else if (cpu.equals("sparc") || cpu.equals("sparcv9")) {
return "sparc";
} else if (cpu.equals("x86_64") || cpu.equals("amd64")) {
return "amd64";
} else if (cpu.equals("ia64") || cpu.equals("amd64") || cpu.equals("x86_64")) {
return cpu;
} else {
throw new UnsupportedPlatformException("CPU type " + cpu + " not yet supported");
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册