Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ body:
id: dumps
attributes:
label: "WSL dumps:"
description: "Attach any dump files from `/mnt/wslg/dumps`, such as core.weston, if exists."
description: "Attach any dump files from `%tmp%\wsl-crashes`, such as core.weston, if exists. If running an older version, the dump files can be found in `/mnt/wslg/dumps`"
validations:
required: false
- type: textarea
Expand Down
32 changes: 0 additions & 32 deletions WSLGd/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@ constexpr auto c_x11RuntimeDir = SHARE_PATH "/.X11-unix";
constexpr auto c_xdgRuntimeDir = SHARE_PATH "/runtime-dir";
constexpr auto c_stdErrLogFile = SHARE_PATH "/stderr.log";

constexpr auto c_coreDir = SHARE_PATH "/dumps";
constexpr auto c_corePatternDefault = "core.%e";
constexpr auto c_corePatternFile = "/proc/sys/kernel/core_pattern";
constexpr auto c_corePatternEnv = "WSL2_WSLG_CORE_PATTERN";

constexpr auto c_sharedMemoryMountPoint = "/mnt/shared_memory";
constexpr auto c_sharedMemoryMountPointEnv = "WSL2_SHARED_MEMORY_MOUNT_POINT";
constexpr auto c_sharedMemoryObDirectoryPathEnv = "WSL2_SHARED_MEMORY_OB_DIRECTORY";
Expand Down Expand Up @@ -346,38 +341,11 @@ try {
std::string serviceIdEnvString("WSLG_SERVICE_ID=");
serviceIdEnvString += ToServiceId(address.svm_port);

// "ulimits -c unlimited" for core dumps.
struct rlimit limit;
limit.rlim_cur = RLIM_INFINITY;
limit.rlim_max = RLIM_INFINITY;
THROW_LAST_ERROR_IF(setrlimit(RLIMIT_CORE, &limit) < 0);

THROW_LAST_ERROR_IF(getrlimit(RLIMIT_NOFILE, &limit) < 0);
limit.rlim_cur = limit.rlim_max;
THROW_LAST_ERROR_IF(setrlimit(RLIMIT_NOFILE, &limit) < 0);

// create folder to store core files.
std::filesystem::create_directories(c_coreDir);
THROW_LAST_ERROR_IF(chmod(c_coreDir, 0777) < 0);

// update core_pattern.
{
wil::unique_file corePatternFile(fopen(c_corePatternFile, "w"));
if (corePatternFile.get()) {
// combine folder path and core pattern.
std::string corePatternFullPath(c_coreDir);
corePatternFullPath += "/";
auto corePattern = getenv(c_corePatternEnv);
if (corePattern) {
corePatternFullPath += corePattern;
} else {
corePatternFullPath += c_corePatternDefault; // set to default core_pattern.
}
// write to core_pattern file.
THROW_LAST_ERROR_IF(fprintf(corePatternFile.get(), "%s", corePatternFullPath.c_str()) < 0);
}
}

// Set shared memory mount point to env when available.
if (!isSharedMemoryMounted ||
(setenv(c_sharedMemoryMountPointEnv, c_sharedMemoryMountPoint, true) < 0)) {
Expand Down