aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe-php-shim/src/process.rs
blob: cb5aa5075f29bfbc24f8a174f8b7bd05a7e9ee5b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
use crate::{PhpMixed, PhpResource};
use indexmap::IndexMap;

pub const SIGINT: i64 = 2;
pub const SIGTERM: i64 = 15;
pub const SIGUSR1: i64 = 10;
pub const SIGUSR2: i64 = 12;

pub fn exec(
    _command: &str,
    _output: Option<&mut Vec<String>>,
    _exit_code: Option<&mut i64>,
) -> Option<String> {
    todo!()
}

pub fn shell_exec(_command: &str) -> Option<String> {
    todo!()
}

pub fn system(_command: &str, _result_code: Option<&mut i64>) -> Option<String> {
    todo!()
}

pub fn escapeshellcmd(_command: &str) -> String {
    todo!()
}

pub fn escapeshellarg(_arg: &str) -> String {
    todo!()
}

// TODO(phase-c): reports proc_open as unavailable (returns false), so callers fall back to
// their defaults. A real implementation requires holding the child process and its pipes; defer
// it to the broader process-subsystem work (ProcessExecutor).
pub fn proc_open(
    _command: &str,
    _descriptorspec: &[PhpMixed],
    _pipes: &mut PhpMixed,
    _cwd: Option<&str>,
    _env: Option<&[String]>,
    _options: Option<&IndexMap<String, PhpMixed>>,
) -> PhpMixed {
    PhpMixed::Bool(false)
}

pub fn proc_close(_process: PhpMixed) -> i64 {
    -1
}

pub fn proc_get_status(_process: &PhpMixed) -> IndexMap<String, PhpMixed> {
    todo!()
}

pub fn proc_terminate(_process: &PhpMixed, _signal: i64) -> bool {
    todo!()
}

pub fn getmypid() -> i64 {
    std::process::id() as i64
}

pub fn cli_set_process_title(_title: &str) -> bool {
    todo!()
}

pub fn setproctitle(_title: &str) {
    todo!()
}

// No-op until real signal handling is wired up; signal registration itself is
// deferred (see the TODO(plugin) notes in SignalRegistry::register).
pub fn pcntl_async_signals(_enable: bool) {}

pub fn pcntl_signal(_signal: i64, _handler: PhpMixed) -> bool {
    todo!()
}

pub fn pcntl_signal_get_handler(_signal: i64) -> PhpMixed {
    todo!()
}

pub fn posix_getuid() -> i64 {
    todo!()
}

pub fn posix_geteuid() -> i64 {
    todo!()
}

pub fn posix_getpwuid(_uid: i64) -> PhpMixed {
    todo!()
}

pub fn posix_isatty(_stream: PhpResource) -> bool {
    todo!()
}

pub fn posix_kill(_pid: i64, _signal: i64) -> bool {
    todo!()
}

pub fn get_current_user() -> String {
    todo!()
}