| OLD | NEW |
| 1 // Copyright 2017 The Crashpad Authors. All rights reserved. | 1 // Copyright 2017 The Crashpad Authors. All rights reserved. |
| 2 // | 2 // |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
| 5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
| 6 // | 6 // |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 // | 8 // |
| 9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 utsname os; | 42 utsname os; |
| 43 if (uname(&os) != 0) { | 43 if (uname(&os) != 0) { |
| 44 PLOG(WARNING) << "uname"; | 44 PLOG(WARNING) << "uname"; |
| 45 } else { | 45 } else { |
| 46 // Match the architecture name that would be used by the kernel, so that the | 46 // Match the architecture name that would be used by the kernel, so that the |
| 47 // strcmp() below can omit the kernel’s architecture name if it’s the same | 47 // strcmp() below can omit the kernel’s architecture name if it’s the same |
| 48 // as the user process’ architecture. On Linux, these names are normally | 48 // as the user process’ architecture. On Linux, these names are normally |
| 49 // defined in each architecture’s Makefile as UTS_MACHINE, but can be | 49 // defined in each architecture’s Makefile as UTS_MACHINE, but can be |
| 50 // overridden in architecture-specific configuration as COMPAT_UTS_MACHINE. | 50 // overridden in architecture-specific configuration as COMPAT_UTS_MACHINE. |
| 51 // See linux-4.4.52/arch/*/Makefile and | 51 // See linux-4.9.17/arch/*/Makefile and |
| 52 // linux-4.4.52/arch/*/include/asm/compat.h. In turn, on some systems, these | 52 // linux-4.9.17/arch/*/include/asm/compat.h. In turn, on some systems, these |
| 53 // names are further overridden or refined in early kernel startup code by | 53 // names are further overridden or refined in early kernel startup code by |
| 54 // modifying the string returned by linux-4.4.52/include/linux/utsname.h | 54 // modifying the string returned by linux-4.9.17/include/linux/utsname.h |
| 55 // init_utsname() as noted. | 55 // init_utsname() as noted. |
| 56 #if defined(ARCH_CPU_X86) | 56 #if defined(ARCH_CPU_X86) |
| 57 // linux-4.4.52/arch/x86/kernel/cpu/bugs.c check_bugs() sets the first digit | 57 // linux-4.9.17/arch/x86/kernel/cpu/bugs.c check_bugs() sets the first digit |
| 58 // to 4, 5, or 6, but no higher. Assume 6. | 58 // to 4, 5, or 6, but no higher. |
| 59 #if defined(__i686__) |
| 59 const char arch[] = "i686"; | 60 const char arch[] = "i686"; |
| 61 #elif defined(__i586__) |
| 62 const char arch[] = "i586"; |
| 63 #elif defined(__i486__) |
| 64 const char arch[] = "i486"; |
| 65 #else |
| 66 const char arch[] = "i386"; |
| 67 #endif |
| 60 #elif defined(ARCH_CPU_X86_64) | 68 #elif defined(ARCH_CPU_X86_64) |
| 61 const char arch[] = "x86_64"; | 69 const char arch[] = "x86_64"; |
| 62 #elif defined(ARCH_CPU_ARMEL) | 70 #elif defined(ARCH_CPU_ARMEL) |
| 63 // linux-4.4.52/arch/arm/kernel/setup.c setup_processor() bases the string | 71 // linux-4.9.17/arch/arm/kernel/setup.c setup_processor() bases the string |
| 64 // on the ARM processor name and a character identifying little- or | 72 // on the ARM processor name and a character identifying little- or |
| 65 // big-endian. The processor name comes from a definition in | 73 // big-endian. The processor name comes from a definition in |
| 66 // arch/arm/mm/proc-*.S. Assume armv7, little-endian. | 74 // arch/arm/mm/proc-*.S. |
| 67 const char arch[] = "armv7l"; | 75 #if defined(__ARM_ARCH_4T__) |
| 76 const char arch[] = "armv4t" |
| 77 #elif defined(__ARM_ARCH_5TEJ__) |
| 78 const char arch[] = "armv5tej" |
| 79 #elif defined(__ARM_ARCH_5TE__) |
| 80 const char arch[] = "armv5te" |
| 81 #elif defined(__ARM_ARCH_5T__) |
| 82 const char arch[] = "armv5t" |
| 83 #elif defined(__ARM_ARCH_7M__) |
| 84 const char arch[] = "armv7m" |
| 85 #else |
| 86 // Most ARM architectures fall into here, including all profile variants of |
| 87 // armv6, armv7, armv8, with one exception, armv7m, handled above. |
| 88 // xstr(__ARM_ARCH) will be the architecture revision number, such as 6, 7, |
| 89 // or 8. |
| 90 #define xstr(s) str(s) |
| 91 #define str(s) #s |
| 92 const char arch[] = "armv" xstr(__ARM_ARCH) |
| 93 #undef str |
| 94 #undef xstr |
| 95 #endif |
| 96 #if defined(ARCH_CPU_LITTLE_ENDIAN) |
| 97 "l"; |
| 98 #elif defined(ARCH_CPU_BIG_ENDIAN) |
| 99 "b"; |
| 100 #endif |
| 68 #elif defined(ARCH_CPU_ARM64) | 101 #elif defined(ARCH_CPU_ARM64) |
| 69 // ARM64 uses aarch64 or aarch64_be as directed by ELF_PLATFORM. See | 102 // ARM64 uses aarch64 or aarch64_be as directed by ELF_PLATFORM. See |
| 70 // linux-4.4.52/arch/arm64/kernel/setup.c setup_arch(). Assume | 103 // linux-4.9.17/arch/arm64/kernel/setup.c setup_arch(). |
| 71 // little-endian. | 104 #if defined(ARCH_CPU_LITTLE_ENDIAN) |
| 72 const char arch[] = "aarch64"; | 105 const char arch[] = "aarch64"; |
| 106 #elif defined(ARCH_CPU_BIG_ENDIAN) |
| 107 const char arch[] = "aarch64_be"; |
| 108 #endif |
| 73 #elif defined(ARCH_CPU_MIPSEL) | 109 #elif defined(ARCH_CPU_MIPSEL) |
| 74 const char arch[] = "mips"; | 110 const char arch[] = "mips"; |
| 75 #elif defined(ARCH_CPU_MIPS64EL) | 111 #elif defined(ARCH_CPU_MIPS64EL) |
| 76 const char arch[] = "mips64"; | 112 const char arch[] = "mips64"; |
| 77 #else | 113 #else |
| 78 #error Port | 114 #error Port |
| 79 #endif | 115 #endif |
| 80 | 116 |
| 81 user_agent.append( | 117 user_agent.append( |
| 82 base::StringPrintf(" %s/%s (%s", os.sysname, os.release, arch)); | 118 base::StringPrintf(" %s/%s (%s", os.sysname, os.release, arch)); |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 } | 393 } |
| 358 | 394 |
| 359 } // namespace | 395 } // namespace |
| 360 | 396 |
| 361 // static | 397 // static |
| 362 std::unique_ptr<HTTPTransport> HTTPTransport::Create() { | 398 std::unique_ptr<HTTPTransport> HTTPTransport::Create() { |
| 363 return std::unique_ptr<HTTPTransport>(new HTTPTransportLibcurl()); | 399 return std::unique_ptr<HTTPTransport>(new HTTPTransportLibcurl()); |
| 364 } | 400 } |
| 365 | 401 |
| 366 } // namespace crashpad | 402 } // namespace crashpad |
| OLD | NEW |