# HG changeset patch # User mbaesken # Date 1574688471 -3600 # Mon Nov 25 14:27:51 2019 +0100 # Node ID d2f206c3439715d5cc4c13bc9147f24c071df5db # Parent b24f4caa1411a225ffc4601a3b02c5f87d11cc14 8234741: enhance os::get_core_path on macOS diff --git a/src/hotspot/os/bsd/os_bsd.cpp b/src/hotspot/os/bsd/os_bsd.cpp --- a/src/hotspot/os/bsd/os_bsd.cpp +++ b/src/hotspot/os/bsd/os_bsd.cpp @@ -3762,11 +3762,30 @@ } } -// Get the default path to the core file +// Get the kern.corefile setting, or otherwise the default path to the core file // Returns the length of the string int os::get_core_path(char* buffer, size_t bufferSize) { - int n = jio_snprintf(buffer, bufferSize, "/cores/core.%d", current_process_id()); - + int n = 0; +#ifdef __APPLE__ + char coreinfo[MAX_PATH]; + size_t sz = sizeof(coreinfo); + int ret = sysctlbyname("kern.corefile", coreinfo, &sz, NULL, 0); + if (ret == 0) { + char *pid_pos = strstr(coreinfo, "%P"); + const char* tail = (pid_pos != NULL) ? (pid_pos + 2) : ""; // skip over the "%P" + int mypid = current_process_id(); + + if (pid_pos != NULL) { + *pid_pos = '\0'; + n = jio_snprintf(buffer, bufferSize, "%s%d%s", coreinfo, mypid, tail); + } else { + n = jio_snprintf(buffer, bufferSize, "%s", coreinfo); + } + } else +#endif + { + n = jio_snprintf(buffer, bufferSize, "/cores/core.%d", current_process_id()); + } // Truncate if theoretical string was longer than bufferSize n = MIN2(n, (int)bufferSize); diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.h b/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.h --- a/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.h +++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.h @@ -38,7 +38,8 @@ // TODO: NSMenu *contextualMenu; // Keyboard layout - NSTextInputSourceIdentifier kbdLayout; + // this requires 10.13: NSTextInputSourceIdentifier kbdLayout; + NSString* kbdLayout; // dnd support (see AppKit/NSDragging.h, NSDraggingSource/Destination): CDragSource *_dragSource;