Documentation
¶
Index ¶
- Constants
- Variables
- func IsProcessInJob(process windows.Handle, job windows.Handle) (bool, error)
- func Load() error
- func LocalFileTimeToFileTime(localFileTime, utcFileTime *windows.Filetime) uint32
- func OpenJobObject(name string) (windows.Handle, error)
- func QueryJobObjectProcessIDs(job windows.Handle) ([]uint32, error)
- func QueryPerformanceFrequency() (int64, error)
- type DiskSpaceInformation
- type DynamicTimezoneInformation
- type JobObjectBasicAccountingInformation
- type JobObjectBasicAndIOAccountingInformation
- type JobObjectBasicProcessIDList
- type JobObjectMemoryUsageInformation
- type SYSTEMTIME
- type VM_COUNTERS_EX2
Constants ¶
const ( // JobObjectQuery is required to retrieve certain information about a job object, // such as attributes and accounting information (see QueryInformationJobObject and IsProcessInJob). // https://learn.microsoft.com/en-us/windows/win32/procthread/job-object-security-and-access-rights JobObjectQuery = 0x0004 )
Variables ¶
ErrDiskSpaceInformationUnavailable is returned by GetDiskSpaceInformation on Windows versions before Windows 10 1809 and Windows Server 2019, which lack GetDiskSpaceInformationW.
Functions ¶
func IsProcessInJob ¶ added in v0.31.0
func Load ¶ added in v0.32.0
func Load() error
Load checks that kernel32.dll exports every function this package calls without a check of its own. Call it in Build: a missing export panics on the first call otherwise.
func LocalFileTimeToFileTime ¶
func QueryJobObjectProcessIDs ¶ added in v0.32.0
QueryJobObjectProcessIDs returns the IDs of all processes assigned to the job.
func QueryPerformanceFrequency ¶ added in v0.32.0
QueryPerformanceFrequency returns the frequency of the performance counter in counts per second. 📑 https://learn.microsoft.com/en-us/windows/win32/api/profileapi/nf-profileapi-queryperformancefrequency
Types ¶
type DiskSpaceInformation ¶ added in v0.32.0
type DiskSpaceInformation struct {
ActualTotalAllocationUnits uint64
ActualAvailableAllocationUnits uint64
CallerTotalAllocationUnits uint64
CallerAvailableAllocationUnits uint64
UsedAllocationUnits uint64
TotalReservedAllocationUnits uint64
VolumeStorageReserveAllocationUnits uint64
AvailableCommittedAllocationUnits uint64
PoolAvailableAllocationUnits uint64
SectorsPerAllocationUnit uint32
BytesPerSector uint32
}
DiskSpaceInformation contains disk space information for a volume. 📑 https://learn.microsoft.com/en-us/windows/win32/api/fileapi/ns-fileapi-disk_space_information
func GetDiskSpaceInformation ¶ added in v0.32.0
func GetDiskSpaceInformation(rootPath *uint16) (DiskSpaceInformation, error)
GetDiskSpaceInformation returns the disk space information of the volume with the root path rootPath. Unlike GetDiskFreeSpaceEx, it reports the size of the volume regardless of disk quotas. 📑 https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getdiskspaceinformationw
func (DiskSpaceInformation) AllocationUnitSize ¶ added in v0.32.0
func (d DiskSpaceInformation) AllocationUnitSize() uint64
AllocationUnitSize returns the size of an allocation unit in bytes.
type DynamicTimezoneInformation ¶
type DynamicTimezoneInformation struct {
Bias int32
StandardDate SYSTEMTIME
StandardBias int32
DaylightName [32]uint16
DaylightDate SYSTEMTIME
DaylightBias int32
TimeZoneKeyName [128]uint16
DynamicDaylightTimeDisabled uint8 // BOOLEAN
// contains filtered or unexported fields
}
DynamicTimezoneInformation contains the current dynamic daylight time settings. 📑 https://docs.microsoft.com/en-us/windows/win32/api/timezoneapi/ns-timezoneapi-dynamic_time_zone_information
func GetDynamicTimeZoneInformation ¶
func GetDynamicTimeZoneInformation() (DynamicTimezoneInformation, error)
GetDynamicTimeZoneInformation retrieves the current dynamic daylight time settings. 📑 https://docs.microsoft.com/en-us/windows/win32/api/timezoneapi/nf-timezoneapi-getdynamictimezoneinformation
type JobObjectBasicAccountingInformation ¶ added in v0.31.0
type JobObjectBasicAndIOAccountingInformation ¶ added in v0.31.0
type JobObjectBasicAndIOAccountingInformation struct {
BasicInfo JobObjectBasicAccountingInformation
IoInfo windows.IO_COUNTERS
}
JobObjectBasicAndIOAccountingInformation is a structure that contains both basic accounting information and I/O accounting information for a job object. It is used with the QueryInformationJobObject function. The structure is defined in the Windows API documentation. https://learn.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-jobobject_basic_and_io_accounting_information
type JobObjectBasicProcessIDList ¶ added in v0.31.0
type JobObjectBasicProcessIDList struct {
NumberOfAssignedProcesses uint32
NumberOfProcessIdsInList uint32
ProcessIdList [1]uintptr
}
JobObjectBasicProcessIDList is the fixed-size head of JOBOBJECT_BASIC_PROCESS_ID_LIST. The ProcessIdList entries are ULONG_PTR and continue past the declared array; use QueryJobObjectProcessIDs to read them. https://learn.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-jobobject_basic_process_id_list
type JobObjectMemoryUsageInformation ¶ added in v0.31.0
type SYSTEMTIME ¶
type SYSTEMTIME struct {
WYear uint16
WMonth uint16
WDayOfWeek uint16
WDay uint16
WHour uint16
WMinute uint16
WSecond uint16
WMilliseconds uint16
}
SYSTEMTIME contains a date and time. 📑 https://docs.microsoft.com/en-us/windows/win32/api/minwinbase/ns-minwinbase-systemtime
type VM_COUNTERS_EX2 ¶ added in v0.32.0
type VM_COUNTERS_EX2 struct {
PeakVirtualSize uintptr
VirtualSize uintptr
PageFaultCount uint32
PeakWorkingSetSize uintptr
WorkingSetSize uintptr
QuotaPeakPagedPoolUsage uintptr
QuotaPagedPoolUsage uintptr
QuotaPeakNonPagedPoolUsage uintptr
QuotaNonPagedPoolUsage uintptr
PagefileUsage uintptr
PeakPagefileUsage uintptr
PrivateUsage uintptr
PrivateWorkingSetSize uintptr
}
VM_COUNTERS_EX2 is the ProcessVmCounters layout used by NtQueryInformationProcess. PrivateUsage is private commit; PrivateWorkingSetSize is resident private memory.