util-linux/sys-utils/lscpu.h
Stanislav Brabec 7572fb2b8c 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>
2017-01-31 12:28:32 +01:00

26 lines
409 B
C

#ifndef LSCPU_H
#define LSCPU_H
/* hypervisor vendors */
enum {
HYPER_NONE = 0,
HYPER_XEN,
HYPER_KVM,
HYPER_MSHV,
HYPER_VMWARE,
HYPER_IBM, /* sys-z powervm */
HYPER_VSERVER,
HYPER_UML,
HYPER_INNOTEK, /* VBOX */
HYPER_HITACHI,
HYPER_PARALLELS, /* OpenVZ/VIrtuozzo */
HYPER_VBOX,
HYPER_OS400,
HYPER_PHYP,
HYPER_SPAR,
HYPER_WSL,
};
extern int read_hypervisor_dmi(void);
#endif /* LSCPU_H */