revert os2/process

This commit is contained in:
jason
2024-06-28 09:45:22 -04:00
parent dc954307d7
commit 6a894195cb
3 changed files with 35 additions and 548 deletions
+35 -53
View File
@@ -2,42 +2,36 @@ package os2
import "core:sync"
import "core:time"
import "core:c"
import "base:runtime"
args: []string = _alloc_command_line_arguments()
args: []string
exit :: proc "contextless" (code: int) -> ! {
_exit(code)
runtime.trap()
}
@(require_results)
get_uid :: proc() -> int {
return _get_uid()
return -1
}
@(require_results)
get_euid :: proc() -> int {
return _get_euid()
return -1
}
@(require_results)
get_gid :: proc() -> int {
return _get_gid()
return -1
}
@(require_results)
get_egid :: proc() -> int {
return _get_euid()
return -1
}
@(require_results)
get_pid :: proc() -> int {
return _get_pid()
return -1
}
@(require_results)
get_ppid :: proc() -> int {
return _get_ppid()
return -1
}
@@ -52,12 +46,16 @@ Process :: struct {
Process_Attributes :: struct {
dir: string,
env: []string,
stdin: ^File,
stdout: ^File,
stderr: ^File,
files: []^File,
sys: ^Process_Attributes_OS_Specific,
}
Process_Attributes_OS_Specific :: struct{}
Process_Error :: enum {
None,
}
Process_State :: struct {
pid: int,
exit_code: int,
@@ -68,53 +66,37 @@ Process_State :: struct {
sys: rawptr,
}
Signal :: enum {
Abort,
Floating_Point_Exception,
Illegal_Instruction,
Interrupt,
Segmentation_Fault,
Termination,
Signal :: #type proc()
Kill: Signal = nil
Interrupt: Signal = nil
find_process :: proc(pid: int) -> (^Process, Process_Error) {
return nil, .None
}
Signal_Handler_Proc :: #type proc "c" (c.int)
Signal_Handler_Special :: enum {
Default,
Ignore,
process_start :: proc(name: string, argv: []string, attr: ^Process_Attributes) -> (^Process, Process_Error) {
return nil, .None
}
Signal_Handler :: union {
Signal_Handler_Proc,
Signal_Handler_Special,
process_release :: proc(p: ^Process) -> Process_Error {
return .None
}
@(require_results)
process_find :: proc(pid: int) -> (Process, Error) {
return _process_find(pid)
process_kill :: proc(p: ^Process) -> Process_Error {
return .None
}
@(require_results)
process_get_state :: proc(p: Process) -> (Process_State, Error) {
return _process_get_state(p)
process_signal :: proc(p: ^Process, sig: Signal) -> Process_Error {
return .None
}
@(require_results)
process_start :: proc(name: string, argv: []string, attr: ^Process_Attributes = nil) -> (Process, Error) {
return _process_start(name, argv, attr)
process_wait :: proc(p: ^Process) -> (Process_State, Process_Error) {
return {}, .None
}
process_release :: proc(p: ^Process) -> Error {
return _process_release(p)
}
process_kill :: proc(p: ^Process) -> Error {
return _process_kill(p)
}
process_signal :: proc(sig: Signal, h: Signal_Handler) -> Error {
return _process_signal(sig, h)
}
process_wait :: proc(p: ^Process, t: time.Duration = time.MAX_DURATION) -> (Process_State, Error) {
return _process_wait(p, t)
}