Skip to content

disk.IOCounters() fails in virtual windows #1094

@sskserk

Description

@sskserk

Describe the bug
Executing of disk.IOCounters() in Virtual Windows (WEMU or VMWare) player results in error:
"The system cannot find the path specified"

To Reproduce
Compile the following code with the CLI: GOOS=windows go build -tags windows -o file.exe file.go

	_, err := disk.IOCounters()
	if err != nil {
		panic(err)
	}

Expected behavior
Returned disk io counters

Additional context

  • The code is compiled on Ubuntu 20.04 and executed on virtual Windows Server 2019 running in VMWare Player. Host is Ubuntu 20.04
  • Debugging of the source revealed that the path "\.\c:" cannot be found. The failure is observed in this piece of code
    err = windows.DeviceIoControl(h, IOCTL_DISK_PERFORMANCE, nil, 0, (*byte)(unsafe.Pointer(&diskPerformance)), uint32(unsafe.Sizeof(diskPerformance)), &diskPerformanceSize, nil)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions