mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 23:28:48 +00:00
[os2/process]: Refactor process_info procs, add process_info_by_handle
This commit is contained in:
+39
-10
@@ -168,17 +168,37 @@ Process_Info :: struct {
|
||||
This procedure obtains an information, specified by `selection` parameter of
|
||||
a process given by `pid`.
|
||||
|
||||
Use `free_process_info` to free the memory allocated by this function. In
|
||||
Use `free_process_info` to free the memory allocated by this procedure. In
|
||||
case the function returns an error all temporary allocations would be freed
|
||||
and as such, calling `free_process_info()` is not needed.
|
||||
|
||||
**Note**: The resulting information may or may not contain the
|
||||
selected fields. Please check the `fields` field of the `Process_Info`
|
||||
struct to see if the struct contains the desired fields **before** checking
|
||||
the error code returned by this function.
|
||||
**Note**: The resulting information may or may contain the fields specified
|
||||
by the `selection` parameter. Always check whether the returned
|
||||
`Process_Info` struct has the required fields before checking the error code
|
||||
returned by this function.
|
||||
*/
|
||||
process_info :: proc(pid: int, selection: Process_Info_Fields, allocator: runtime.Allocator) -> (Process_Info, Error) {
|
||||
return _process_info(pid, selection, allocator)
|
||||
process_info_by_pid :: proc(pid: int, selection: Process_Info_Fields, allocator: runtime.Allocator) -> (Process_Info, Error) {
|
||||
return _process_info_by_pid(pid, selection, allocator)
|
||||
}
|
||||
|
||||
/*
|
||||
Obtain information about a process.
|
||||
|
||||
This procedure obtains information, specified by `selection` parameter
|
||||
about a process that has been opened by the application, specified in
|
||||
the `process` parameter.
|
||||
|
||||
Use `free_process_info` to free the memory allocated by this procedure. In
|
||||
case the function returns an error, all temporary allocations would be freed
|
||||
and as such, calling `free_process_info` is not needed.
|
||||
|
||||
**Note**: The resulting information may or may contain the fields specified
|
||||
by the `selection` parameter. Always check whether the returned
|
||||
`Process_Info` struct has the required fields before checking the error code
|
||||
returned by this function.
|
||||
*/
|
||||
process_info_by_handle :: proc(process: Process, selection: Process_Info_Fields, allocator: runtime.Allocator) -> (Process_Info, Error) {
|
||||
return _process_info_by_handle(process, selection, allocator)
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -191,15 +211,24 @@ process_info :: proc(pid: int, selection: Process_Info_Fields, allocator: runtim
|
||||
case this function returns an error, all temporary allocations would be
|
||||
freed and as such calling `free_process_info()` is not needed.
|
||||
|
||||
**Note**: The resulting `Process_Info` may or may not contain the selected
|
||||
fields. Check the `fields` field of the `Process_Info` struct to see, if the
|
||||
struct contains the selected fields **before** checking the error code
|
||||
**Note**: The resulting information may or may contain the fields specified
|
||||
by the `selection` parameter. Always check whether the returned
|
||||
`Process_Info` struct has the required fields before checking the error code
|
||||
returned by this function.
|
||||
*/
|
||||
current_process_info :: proc(selection: Process_Info_Fields, allocator: runtime.Allocator) -> (Process_Info, Error) {
|
||||
return _current_process_info(selection, allocator)
|
||||
}
|
||||
|
||||
/*
|
||||
Obtain information about the specified process.
|
||||
*/
|
||||
process_info :: proc {
|
||||
process_info_by_pid,
|
||||
process_info_by_handle,
|
||||
current_process_info,
|
||||
}
|
||||
|
||||
/*
|
||||
Free the information about the process.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user