Skip to content
Snippets Groups Projects
Commit 3cc215ca authored by Jeremy Soller's avatar Jeremy Soller
Browse files

Add freading, fwriting, and stdio_ext.h header

parent b4f36bce
No related branches found
No related tags found
No related merge requests found
Pipeline #1869 passed with warnings
#ifndef _STDIO_EXT_H
#define _STDIO_EXT_H
#include <stdio.h>
#endif /* _STDIO_EXT_H */
use header::stdio::{FILE, F_NORD, F_NOWR};
use platform::types::*;
#[no_mangle]
pub extern "C" fn __fpending(stream: *mut FILE) -> size_t {
let mut stream = unsafe { &mut *stream }.lock();
stream.writer.inner.buf.len() as size_t
}
#[no_mangle]
pub extern "C" fn __freadable(stream: *mut FILE) -> c_int {
let mut stream = unsafe { &mut *stream }.lock();
......@@ -15,9 +22,18 @@ pub extern "C" fn __fwritable(stream: *mut FILE) -> c_int {
(stream.flags & F_NOWR == 0) as c_int
}
//TODO: Check last operation when read-write
#[no_mangle]
pub extern "C" fn __fpending(stream: *mut FILE) -> size_t {
pub extern "C" fn __freading(stream: *mut FILE) -> c_int {
let mut stream = unsafe { &mut *stream }.lock();
stream.writer.inner.buf.len() as size_t
(stream.flags & F_NORD == 0) as c_int
}
//TODO: Check last operation when read-write
#[no_mangle]
pub extern "C" fn __fwriting(stream: *mut FILE) -> c_int {
let mut stream = unsafe { &mut *stream }.lock();
(stream.flags & F_NOWR == 0) as c_int
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment