Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
relibc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tornax O7
relibc
Commits
b4f36bce
Commit
b4f36bce
authored
6 years ago
by
Jeremy Soller
Browse files
Options
Downloads
Patches
Plain Diff
Add more stdio_ext functions
parent
632f9f18
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/header/stdio/ext.rs
+23
-0
23 additions, 0 deletions
src/header/stdio/ext.rs
src/header/stdio/mod.rs
+7
-14
7 additions, 14 deletions
src/header/stdio/mod.rs
with
30 additions
and
14 deletions
src/header/stdio/ext.rs
0 → 100644
+
23
−
0
View file @
b4f36bce
use
header
::
stdio
::{
FILE
,
F_NORD
,
F_NOWR
};
use
platform
::
types
::
*
;
#[no_mangle]
pub
extern
"C"
fn
__freadable
(
stream
:
*
mut
FILE
)
->
c_int
{
let
mut
stream
=
unsafe
{
&
mut
*
stream
}
.lock
();
(
stream
.flags
&
F_NORD
==
0
)
as
c_int
}
#[no_mangle]
pub
extern
"C"
fn
__fwritable
(
stream
:
*
mut
FILE
)
->
c_int
{
let
mut
stream
=
unsafe
{
&
mut
*
stream
}
.lock
();
(
stream
.flags
&
F_NOWR
==
0
)
as
c_int
}
#[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
}
This diff is collapsed.
Click to expand it.
src/header/stdio/mod.rs
+
7
−
14
View file @
b4f36bce
...
...
@@ -22,16 +22,16 @@ use platform::{Pal, Sys};
use
platform
::{
errno
,
WriteByte
};
use
platform
;
mod
printf
;
mod
scanf
;
pub
use
self
::
constants
::
*
;
mod
constants
;
pub
use
self
::
default
::
*
;
mod
default
;
pub
use
self
::
constants
::
*
;
mod
constants
;
mod
ext
;
mod
helpers
;
mod
printf
;
mod
scanf
;
enum
Buffer
<
'a
>
{
Borrowed
(
&
'a
mut
[
u8
]),
...
...
@@ -62,12 +62,12 @@ pub struct FILE {
lock
:
Mutex
<
()
>
,
file
:
File
,
flags
:
c_int
,
pub
(
crate
)
/* stdio_ext */
flags
:
c_int
,
read_buf
:
Buffer
<
'static
>
,
read_pos
:
usize
,
read_size
:
usize
,
unget
:
Option
<
u8
>
,
writer
:
LineWriter
<
File
>
pub
(
crate
)
/* stdio_ext */
writer
:
LineWriter
<
File
>
}
impl
Read
for
FILE
{
...
...
@@ -390,13 +390,6 @@ pub extern "C" fn fopen(filename: *const c_char, mode: *const c_char) -> *mut FI
}
}
#[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
}
/// Insert a character into the stream
#[no_mangle]
pub
extern
"C"
fn
fputc
(
c
:
c_int
,
stream
:
*
mut
FILE
)
->
c_int
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment