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
Container Registry
Model registry
Operate
Environments
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
Peter Limkilde Svendsen
relibc
Commits
3ad7c626
Commit
3ad7c626
authored
7 years ago
by
Paul Sajna
Browse files
Options
Downloads
Patches
Plain Diff
fsync and some tweaks
parent
9de89e03
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
platform/src/linux/mod.rs
+6
-0
6 additions, 0 deletions
platform/src/linux/mod.rs
platform/src/redox/mod.rs
+17
-11
17 additions, 11 deletions
platform/src/redox/mod.rs
src/unistd/src/lib.rs
+1
-1
1 addition, 1 deletion
src/unistd/src/lib.rs
with
24 additions
and
12 deletions
platform/src/linux/mod.rs
+
6
−
0
View file @
3ad7c626
...
...
@@ -57,6 +57,12 @@ pub fn fchdir(fildes: c_int) -> c_int {
}
}
pub
fn
fsync
(
fildes
:
c_int
)
->
c_int
{
unsafe
{
syscall!
(
FSYNC
,
fildes
)
as
c_int
}
}
#[cfg(target_arch
=
"x86_64"
)]
pub
fn
open
(
path
:
*
const
c_char
,
oflag
:
c_int
,
mode
:
mode_t
)
->
c_int
{
unsafe
{
...
...
This diff is collapsed.
Click to expand it.
platform/src/redox/mod.rs
+
17
−
11
View file @
3ad7c626
...
...
@@ -3,20 +3,18 @@ use syscall;
use
c_str
;
use
types
::
*
;
pub
unsafe
fn
cstr_to_slice
<
'a
>
(
buf
:
*
const
c_char
)
->
&
'a
[
u8
]
{
slice
::
from_raw_parts
(
buf
as
*
const
u8
,
::
strlen
(
buf
)
as
usize
)
}
pub
fn
brk
(
addr
:
*
const
c_void
)
->
{
syscall
::
brk
(
addr
as
usize
)
?
as
c_int
pub
fn
chdir
(
path
:
*
const
c_char
)
->
c_int
{
syscall
::
chdir
(
cstr_to_slice
(
path
))
?
as
c_int
}
pub
fn
chdir
(
path
:
*
const
c_char
)
->
c_int
{
let
path
=
unsafe
{
c_str
(
path
)
};
syscall
::
chdir
(
path
)
?
as
c_int
}
pub
fn
chown
(
path
:
*
const
c_char
,
owner
:
uid_t
,
group
:
gid_t
)
->
c_int
{
let
fd
=
syscall
::
open
(
cstr_to_slice
(
path
));
syscall
::
fchown
(
fd
,
owner
,
group
)
?
as
c_int
syscall
::
fchown
(
fd
as
usize
,
owner
as
usize
,
group
as
usize
)
?
as
c_int
pub
fn
close
(
fd
:
c_int
)
->
c_int
{
syscall
::
close
(
fd
as
usize
);
...
...
@@ -37,12 +35,20 @@ pub fn exit(status: c_int) -> ! {
}
pub
fn
fchown
(
fd
:
c_int
,
owner
:
uid_t
,
group
:
gid_t
)
->
c_int
{
syscall
::
fchown
(
owner
,
group
)
?
as
c_int
syscall
::
fchown
(
owner
as
usize
,
group
as
usize
)
?
as
c_int
}
pub
fn
fchdir
(
fd
:
c_int
)
->
c_int
{
let
path
=
fpath
(
fd
as
usize
,
&
[])
.unwrap
();
syscall
::
chdir
(
path
)
?
as
c_int
let
result
=
fpath
(
fd
as
usize
,
&
[]);
if
result
.is_ok
()
{
syscall
::
chdir
(
path
)
?
as
c_int
}
else
{
-
1
}
}
pub
fn
fsync
(
fd
:
c_int
)
->
c_int
{
syscall
::
fsync
(
fd
as
usize
)
?
as
c_int
}
pub
fn
open
(
path
:
*
const
c_char
,
oflag
:
c_int
,
mode
:
mode_t
)
->
c_int
{
...
...
This diff is collapsed.
Click to expand it.
src/unistd/src/lib.rs
+
1
−
1
View file @
3ad7c626
...
...
@@ -156,7 +156,7 @@ pub extern "C" fn fpathconf(fildes: c_int, name: c_int) -> c_long {
#[no_mangle]
pub
extern
"C"
fn
fsync
(
fildes
:
c_int
)
->
c_int
{
unimplemented!
();
platform
::
fsync
(
fildes
)
}
#[no_mangle]
...
...
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