Return ID of new session in setsid.

This commit is contained in:
4lDO2
2025-04-20 17:10:51 +02:00
parent 696ae4eca1
commit 32c5e89c82
5 changed files with 8 additions and 9 deletions
+1 -1
View File
@@ -895,7 +895,7 @@ pub extern "C" fn setreuid(ruid: uid_t, euid: uid_t) -> c_int {
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/setsid.html>.
#[no_mangle]
pub extern "C" fn setsid() -> pid_t {
Sys::setsid().map(|()| 0).or_minus_one_errno()
Sys::setsid().or_minus_one_errno()
}
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/setuid.html>.
+2 -2
View File
@@ -612,8 +612,8 @@ impl Pal for Sys {
e_raw(unsafe { syscall!(SETRESUID, ruid, euid, suid) }).map(|_| ())
}
fn setsid() -> Result<()> {
e_raw(unsafe { syscall!(SETSID) }).map(|_| ())
fn setsid() -> Result<c_int> {
e_raw(unsafe { syscall!(SETSID) }).map(|s| s as c_int)
}
fn symlink(path1: CStr, path2: CStr) -> Result<()> {
+1 -1
View File
@@ -237,7 +237,7 @@ pub trait Pal {
fn setresuid(ruid: uid_t, euid: uid_t, suid: uid_t) -> Result<()>;
fn setsid() -> Result<()>;
fn setsid() -> Result<c_int>;
fn symlink(path1: CStr, path2: CStr) -> Result<()>;
+2 -3
View File
@@ -890,9 +890,8 @@ impl Pal for Sys {
Err(Errno(ENOSYS))
}
fn setsid() -> Result<()> {
redox_rt::sys::posix_setsid()?;
Ok(())
fn setsid() -> Result<c_int> {
Ok(redox_rt::sys::posix_setsid()? as c_int)
}
fn setresgid(rgid: gid_t, egid: gid_t, sgid: gid_t) -> Result<()> {