-
Notifications
You must be signed in to change notification settings - Fork 259
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add stats support for host process containers
* Add PropertiesV2 and Properties calls for host process containers. The only supported queries for them are PropertiesV2: Statistics Properties: ProcessList * Add NtQuerySystemInformation and SYSTEM_PROCESS_INFORMATION binds. This work will be utilized in the containerd shim just as the PropertiesV2 and Properties calls are today for process and hv isolated containers. Signed-off-by: Daniel Canter <[email protected]>
- Loading branch information
Showing
6 changed files
with
221 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package jobcontainers | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func TestSystemInfo(t *testing.T) { | ||
_, err := systemProcessInformation() | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package winapi | ||
|
||
import "golang.org/x/sys/windows" | ||
|
||
const SystemProcessInformation = 5 | ||
|
||
const STATUS_INFO_LENGTH_MISMATCH = 0xC0000004 | ||
|
||
// __kernel_entry NTSTATUS NtQuerySystemInformation( | ||
// SYSTEM_INFORMATION_CLASS SystemInformationClass, | ||
// PVOID SystemInformation, | ||
// ULONG SystemInformationLength, | ||
// PULONG ReturnLength | ||
// ); | ||
//sys NtQuerySystemInformation(systemInfoClass int, systemInformation uintptr, systemInfoLength uint32, returnLength *uint32) (status uint32) = ntdll.NtQuerySystemInformation | ||
|
||
type SYSTEM_PROCESS_INFORMATION struct { | ||
NextEntryOffset uint32 // ULONG | ||
NumberOfThreads uint32 // ULONG | ||
WorkingSetPrivateSize int64 // LARGE_INTEGER | ||
HardFaultCount uint32 // ULONG | ||
NumberOfThreadsHighWatermark uint32 // ULONG | ||
CycleTime uint64 // ULONGLONG | ||
CreateTime int64 // LARGE_INTEGER | ||
UserTime int64 // LARGE_INTEGER | ||
KernelTime int64 // LARGE_INTEGER | ||
ImageName UnicodeString // UNICODE_STRING | ||
BasePriority int32 // KPRIORITY | ||
UniqueProcessID windows.Handle // HANDLE | ||
InheritedFromUniqueProcessID windows.Handle // HANDLE | ||
HandleCount uint32 // ULONG | ||
SessionID uint32 // ULONG | ||
UniqueProcessKey *uint32 // ULONG_PTR | ||
PeakVirtualSize uintptr // SIZE_T | ||
VirtualSize uintptr // SIZE_T | ||
PageFaultCount uint32 // ULONG | ||
PeakWorkingSetSize uintptr // SIZE_T | ||
WorkingSetSize uintptr // SIZE_T | ||
QuotaPeakPagedPoolUsage uintptr // SIZE_T | ||
QuotaPagedPoolUsage uintptr // SIZE_T | ||
QuotaPeakNonPagedPoolUsage uintptr // SIZE_T | ||
QuotaNonPagedPoolUsage uintptr // SIZE_T | ||
PagefileUsage uintptr // SIZE_T | ||
PeakPagefileUsage uintptr // SIZE_T | ||
PrivatePageCount uintptr // SIZE_T | ||
ReadOperationCount int64 // LARGE_INTEGER | ||
WriteOperationCount int64 // LARGE_INTEGER | ||
OtherOperationCount int64 // LARGE_INTEGER | ||
ReadTransferCount int64 // LARGE_INTEGER | ||
WriteTransferCount int64 // LARGE_INTEGER | ||
OtherTransferCount int64 // LARGE_INTEGER | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,12 @@ | ||
package winapi | ||
|
||
// HANDLE CreateRemoteThread( | ||
// HANDLE hProcess, | ||
// LPSECURITY_ATTRIBUTES lpThreadAttributes, | ||
// SIZE_T dwStackSize, | ||
// LPTHREAD_START_ROUTINE lpStartAddress, | ||
// LPVOID lpParameter, | ||
// DWORD dwCreationFlags, | ||
// LPDWORD lpThreadId | ||
// ); | ||
//sys CreateRemoteThread(process windows.Handle, sa *windows.SecurityAttributes, stackSize uint32, startAddr uintptr, parameter uintptr, creationFlags uint32, threadID *uint32) (handle windows.Handle, err error) = kernel32.CreateRemoteThread |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.