* Correctly determine argv[0]

- If the function called is `posix_spawnp`, and the passed program name **does not** contain a slash, the path is used unmodified, and the path to the directory containing the program on $PATH is prepended to the program's path and assigned to `argv[0]. If the program name **does** contain a slash, the path is absolutised relative to CWD, and assigned to argv[0]

    - If the function called is `posix_spawn`, the behaviour is as described above in the case where path contains a slash

* Add initial tests
This commit is contained in:
R Aadarsh
2026-06-07 10:10:02 +05:30
parent f59e292744
commit ad151e0de8
11 changed files with 106 additions and 104 deletions
+3 -1
View File
@@ -1,6 +1,8 @@
#[cfg(target_arch = "x86_64")]
use core::arch::asm;
use alloc::string::String;
use super::{Pal, types::*};
use crate::{
c_str::CStr,
@@ -800,7 +802,7 @@ impl Pal for Sys {
fat: Option<&crate::header::spawn::posix_spawnattr_t>,
argv: crate::iter::NulTerminated<*mut c_char>,
envp: Option<crate::iter::NulTerminated<*mut c_char>>,
use_path: bool,
dir_ent_name: Option<String>,
) -> Result<pid_t> {
todo!()
}