update spec links and imports for assert and fcntl headers

This commit is contained in:
auronandace
2025-10-12 17:25:03 +01:00
parent d50ce16e0f
commit e4eada2e52
2 changed files with 20 additions and 4 deletions
+7 -2
View File
@@ -1,9 +1,14 @@
//! assert implementation for Redox, following http://pubs.opengroup.org/onlinepubs/7908799/xsh/assert.h.html
//! `assert.h` implementation.
//!
//! See <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/assert.h.html>.
// TODO: set this for entire crate when possible
#![deny(unsafe_op_in_unsafe_fn)]
use crate::{c_str::CStr, platform::types::*};
use crate::{
c_str::CStr,
platform::types::{c_char, c_int},
};
#[unsafe(no_mangle)]
pub unsafe extern "C" fn __assert_fail(
+13 -2
View File
@@ -1,11 +1,16 @@
//! fcntl implementation for Redox, following http://pubs.opengroup.org/onlinepubs/7908799/xsh/fcntl.h.html
//! `fcntl.h` implementation.
//!
//! See <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/fcntl.h.html>.
#![deny(unsafe_op_in_unsafe_fn)]
use crate::{
c_str::CStr,
error::ResultExt,
platform::{Pal, Sys, types::*},
platform::{
Pal, Sys,
types::{c_char, c_int, c_short, c_ulonglong, mode_t, off_t, pid_t},
},
};
pub use self::sys::*;
@@ -36,10 +41,13 @@ pub const F_LOCK: c_int = 1;
pub const F_TLOCK: c_int = 2;
pub const F_TEST: c_int = 3;
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/creat.html>.
#[unsafe(no_mangle)]
pub unsafe extern "C" fn creat(path: *const c_char, mode: mode_t) -> c_int {
unsafe { open(path, O_WRONLY | O_CREAT | O_TRUNC, mode) }
}
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/fcntl.h.html>.
#[repr(C)]
#[derive(Clone, Copy, Default)]
pub struct flock {
@@ -49,6 +57,8 @@ pub struct flock {
pub l_len: off_t,
pub l_pid: pid_t,
}
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/fcntl.html>.
#[unsafe(no_mangle)]
pub unsafe extern "C" fn fcntl(fildes: c_int, cmd: c_int, mut __valist: ...) -> c_int {
// c_ulonglong
@@ -62,6 +72,7 @@ pub unsafe extern "C" fn fcntl(fildes: c_int, cmd: c_int, mut __valist: ...) ->
Sys::fcntl(fildes, cmd, arg).or_minus_one_errno()
}
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/open.html>.
#[unsafe(no_mangle)]
pub unsafe extern "C" fn open(path: *const c_char, oflag: c_int, mut __valist: ...) -> c_int {
let mode = if oflag & O_CREAT == O_CREAT