Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP2:Update
python-libmount.4767
util-linux-lscpu-wsl.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File util-linux-lscpu-wsl.patch of Package python-libmount.4767
From 7572fb2b8cb69512ca230b7fcfa11577526843f4 Mon Sep 17 00:00:00 2001 From: Stanislav Brabec <sbrabec@suse.cz> Date: Mon, 30 Jan 2017 17:01:50 +0100 Subject: [PATCH] lscpu: Detect Windows Subsystem for Linux Windows 10 implements Windows Subsystem for Linux (WSL). WSL does not implement support for SIGSEGV handler, which is used inside is_vmware_platform(). As a result, lscpu crashes there. Implement WSL detection, and as a side effect, work around the crash. Note that none of existing virtualization types exactly matches. But the the closest would be "container". References: Provide a way to positively detect WSL from an app compiled on Linux. https://github.com/Microsoft/BashOnWindows/issues/423 missing support for SIGSEGV handler https://github.com/Microsoft/BashOnWindows/issues/1637 Signed-off-by: Stanislav Brabec <sbrabec@suse.cz> --- sys-utils/lscpu.c | 20 +++++++++++++++++++- sys-utils/lscpu.h | 1 + 2 files changed, 20 insertions(+), 1 deletion(-) Index: util-linux-2.25/sys-utils/lscpu.c =================================================================== --- util-linux-2.25.orig/sys-utils/lscpu.c +++ util-linux-2.25/sys-utils/lscpu.c @@ -81,6 +81,7 @@ #define _PATH_PROC_BC "/proc/bc" #define _PATH_PROC_DEVICETREE "/proc/device-tree" #define _PATH_DEV_MEM "/dev/mem" +#define _PATH_PROC_OSRELEASE "/proc/sys/kernel/osrelease" /* virtualization types */ enum { @@ -111,7 +112,8 @@ const char *hv_vendors[] = { [HYPER_VBOX] = "Oracle", [HYPER_OS400] = "OS/400", [HYPER_PHYP] = "pHyp", - [HYPER_SPAR] = "Unisys s-Par" + [HYPER_SPAR] = "Unisys s-Par", + [HYPER_WSL] = "Windows Subsystem for Linux" }; const int hv_vendor_pci[] = { @@ -782,6 +784,22 @@ read_hypervisor(struct lscpu_desc *desc, { FILE *fd; + /* We have to detect WSL first. is_vmware_platform() crashes on Windows 10. */ + + if ((fd = path_fopen("r", 1, _PATH_PROC_OSRELEASE))) { + char buf[256]; + + if (fgets(buf, sizeof(buf), fd) != NULL) { + if (strstr(buf, "Microsoft")) { + desc->hyper = HYPER_WSL; + desc->virtype = VIRT_CONT; + } + } + fclose(fd); + if (desc->virtype) + return; + } + if (mod->system != SYSTEM_SNAPSHOT) { read_hypervisor_cpuid(desc); if (!desc->hyper) Index: util-linux-2.25/sys-utils/lscpu.h =================================================================== --- util-linux-2.25.orig/sys-utils/lscpu.h +++ util-linux-2.25/sys-utils/lscpu.h @@ -18,6 +18,7 @@ enum { HYPER_OS400, HYPER_PHYP, HYPER_SPAR, + HYPER_WSL, }; extern int read_hypervisor_dmi(void);
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor