RFR: 8261966: macOS M1: report in hs_err log if we are running x86 code in emulation mode (Rosetta) [v4]

Gerard Ziemski gziemski at openjdk.java.net
Tue Mar 23 15:56:00 UTC 2021


On Mon, 22 Mar 2021 21:37:03 GMT, Mikael Vidstedt <mikael at openjdk.org> wrote:

>> src/hotspot/os/bsd/os_bsd.cpp line 1407:
>> 
>>> 1405: #ifdef __APPLE__
>>> 1406:   if (VM_Version::is_cpu_emulated()) {
>>> 1407:     strcpy(emulated, " (EMULATED)");
>> 
>> I think code checkers will complain about using `strcpy()` here.
>> I believe that `strncpy()` is preferred.
>
> Or perhaps:
> 
> const char* emulated = "";
> #ifdef __APPLE__
>     if (VM_Version::is_cpu_emulated()) {
>         emulated = " (EMULATED)";
>     }
> #endif
> ...
> 
> ?

That will work very nicely, thank you Mikael!

-------------

PR: https://git.openjdk.java.net/jdk/pull/3077


More information about the hotspot-runtime-dev mailing list