Add stubs for missing functions

This commit is contained in:
Peter Limkilde Svendsen
2025-02-01 18:36:07 +01:00
parent 26fdc200bf
commit 85f01e8412
+51
View File
@@ -31,6 +31,9 @@ pub use self::{brk::*, getopt::*, getpass::getpass, pathconf::*, sysconf::*};
// cuserid() marked legacy in Issue 5.
pub use crate::header::stdio::{ctermid, cuserid};
// TODO: implement and reexport fcntl functions:
//pub use crate::header::fcntl::{faccessat, fchownat, fexecve, linkat, readlinkat, symlinkat, unlinkat};
use super::errno::{E2BIG, ENOMEM};
mod brk;
@@ -71,6 +74,12 @@ unsafe fn init_fork_hooks<'a>() -> &'a mut [LinkedList<extern "C" fn()>; 3] {
)
}
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/fork.html>.
// #[no_mangle]
pub unsafe extern "C" fn _Fork() -> pid_t {
unimplemented!();
}
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/_Exit.html>.
#[no_mangle]
pub extern "C" fn _exit(status: c_int) -> ! {
@@ -204,6 +213,12 @@ pub extern "C" fn dup2(fildes: c_int, fildes2: c_int) -> c_int {
Sys::dup2(fildes, fildes2).or_minus_one_errno()
}
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/dup.html>.
// #[no_mangle]
pub extern "C" fn dup3(fildes: c_int, fildes2: c_int, flag: c_int) -> c_int {
unimplemented!();
}
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/encrypt.html>.
///
/// # Deprecation
@@ -436,6 +451,12 @@ pub extern "C" fn getegid() -> gid_t {
Sys::getegid()
}
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/getentropy.html>.
// #[no_mangle]
pub extern "C" fn getentropy(buffer: *mut c_void, length: size_t) -> c_int {
unimplemented!();
}
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/geteuid.html>.
#[no_mangle]
pub extern "C" fn geteuid() -> uid_t {
@@ -547,6 +568,18 @@ pub extern "C" fn getppid() -> pid_t {
Sys::getppid()
}
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/getresgid.html>.
// #[no_mangle]
pub extern "C" fn getresgid(rgid: *mut gid_t, egid: *mut gid_t, sgid: *mut gid_t) -> c_int {
unimplemented!();
}
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/getresuid.html>.
// #[no_mangle]
pub extern "C" fn getresuid(ruid: *mut uid_t, euid: *mut uid_t, suid: *mut uid_t) -> c_int {
unimplemented!();
}
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/getsid.html>.
#[no_mangle]
pub extern "C" fn getsid(pid: pid_t) -> pid_t {
@@ -670,6 +703,12 @@ pub unsafe extern "C" fn pipe2(fildes: *mut c_int, flags: c_int) -> c_int {
.or_minus_one_errno()
}
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/close.html>.
// #[no_mangle]
pub extern "C" fn posix_close(fildes: c_int, flag: c_int) -> c_int {
unimplemented!();
}
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/read.html>.
#[no_mangle]
pub unsafe extern "C" fn pread(
@@ -770,6 +809,18 @@ pub unsafe extern "C" fn set_default_scheme(scheme: *const c_char) -> c_int {
.or_minus_one_errno()
}
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/setegid.html>.
// #[no_mangle]
pub extern "C" fn setegid(gid: gid_t) -> c_int {
unimplemented!();
}
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/seteuid.html>.
// #[no_mangle]
pub extern "C" fn seteuid(uid: uid_t) -> c_int {
unimplemented!();
}
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/setgid.html>.
#[no_mangle]
pub extern "C" fn setgid(gid: gid_t) -> c_int {