From e4eada2e52546749ffe14427b633d5992ff63158 Mon Sep 17 00:00:00 2001 From: auronandace Date: Sun, 12 Oct 2025 17:25:03 +0100 Subject: [PATCH] update spec links and imports for assert and fcntl headers --- src/header/assert/mod.rs | 9 +++++++-- src/header/fcntl/mod.rs | 15 +++++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/header/assert/mod.rs b/src/header/assert/mod.rs index 6bf1831a47..068daf4c8d 100644 --- a/src/header/assert/mod.rs +++ b/src/header/assert/mod.rs @@ -1,9 +1,14 @@ -//! assert implementation for Redox, following http://pubs.opengroup.org/onlinepubs/7908799/xsh/assert.h.html +//! `assert.h` implementation. +//! +//! See . // 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( diff --git a/src/header/fcntl/mod.rs b/src/header/fcntl/mod.rs index 251dde2cf1..b2de869619 100644 --- a/src/header/fcntl/mod.rs +++ b/src/header/fcntl/mod.rs @@ -1,11 +1,16 @@ -//! fcntl implementation for Redox, following http://pubs.opengroup.org/onlinepubs/7908799/xsh/fcntl.h.html +//! `fcntl.h` implementation. +//! +//! See . #![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 . #[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 . #[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 . #[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 . #[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