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
redox-os
relibc
Commits
35dbc8d3
Commit
35dbc8d3
authored
7 years ago
by
Paul Sajna
Browse files
Options
Downloads
Patches
Plain Diff
minor fixes
parent
304473b6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!110
Partial implementation of sys/stat.h
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/platform/src/redox/mod.rs
+22
-6
22 additions, 6 deletions
src/platform/src/redox/mod.rs
with
22 additions
and
6 deletions
src/platform/src/redox/mod.rs
+
22
−
6
View file @
35dbc8d3
...
@@ -35,7 +35,11 @@ pub fn chmod(path: *const c_char, mode: mode_t) -> c_int {
...
@@ -35,7 +35,11 @@ pub fn chmod(path: *const c_char, mode: mode_t) -> c_int {
let
path
=
unsafe
{
c_str
(
path
)
};
let
path
=
unsafe
{
c_str
(
path
)
};
match
syscall
::
open
(
path
,
O_WRONLY
)
{
match
syscall
::
open
(
path
,
O_WRONLY
)
{
Err
(
err
)
=>
e
(
Err
(
err
))
as
c_int
,
Err
(
err
)
=>
e
(
Err
(
err
))
as
c_int
,
Ok
(
fd
)
=>
e
(
syscall
::
fchmod
(
fd
as
usize
,
mode
))
as
c_int
,
Ok
(
fd
)
=>
{
let
res
=
syscall
::
fchmod
(
fd
as
usize
,
mode
);
let
_
=
syscall
::
close
(
fd
);
e
(
res
)
as
c_int
}
}
}
}
}
...
@@ -43,7 +47,11 @@ pub fn chown(path: *const c_char, owner: uid_t, group: gid_t) -> c_int {
...
@@ -43,7 +47,11 @@ pub fn chown(path: *const c_char, owner: uid_t, group: gid_t) -> c_int {
let
path
=
unsafe
{
c_str
(
path
)
};
let
path
=
unsafe
{
c_str
(
path
)
};
match
syscall
::
open
(
path
,
O_WRONLY
)
{
match
syscall
::
open
(
path
,
O_WRONLY
)
{
Err
(
err
)
=>
e
(
Err
(
err
))
as
c_int
,
Err
(
err
)
=>
e
(
Err
(
err
))
as
c_int
,
Ok
(
fd
)
=>
e
(
syscall
::
fchown
(
fd
as
usize
,
owner
as
u32
,
group
as
u32
))
as
c_int
,
Ok
(
fd
)
=>
{
let
res
=
syscall
::
fchown
(
fd
as
usize
,
owner
as
u32
,
group
as
u32
);
let
_
=
syscall
::
close
(
fd
);
e
(
res
)
as
c_int
}
}
}
}
}
...
@@ -60,7 +68,7 @@ pub fn dup2(fd1: c_int, fd2: c_int) -> c_int {
...
@@ -60,7 +68,7 @@ pub fn dup2(fd1: c_int, fd2: c_int) -> c_int {
}
}
pub
fn
exit
(
status
:
c_int
)
->
!
{
pub
fn
exit
(
status
:
c_int
)
->
!
{
syscall
::
exit
(
status
as
usize
);
let
_
=
syscall
::
exit
(
status
as
usize
);
loop
{}
loop
{}
}
}
...
@@ -171,7 +179,11 @@ pub fn lstat(path: *const c_char, buf: *mut stat) -> c_int {
...
@@ -171,7 +179,11 @@ pub fn lstat(path: *const c_char, buf: *mut stat) -> c_int {
let
path
=
unsafe
{
c_str
(
path
)
};
let
path
=
unsafe
{
c_str
(
path
)
};
match
syscall
::
open
(
path
,
O_RDONLY
|
O_NOFOLLOW
)
{
match
syscall
::
open
(
path
,
O_RDONLY
|
O_NOFOLLOW
)
{
Err
(
err
)
=>
e
(
Err
(
err
))
as
c_int
,
Err
(
err
)
=>
e
(
Err
(
err
))
as
c_int
,
Ok
(
fd
)
=>
fstat
(
fd
as
i32
,
buf
),
Ok
(
fd
)
=>
{
let
res
=
fstat
(
fd
as
i32
,
buf
);
let
_
=
syscall
::
close
(
fd
);
res
}
}
}
}
}
...
@@ -180,7 +192,7 @@ pub fn mkdir(path: *const c_char, mode: mode_t) -> c_int {
...
@@ -180,7 +192,7 @@ pub fn mkdir(path: *const c_char, mode: mode_t) -> c_int {
let
path
=
unsafe
{
c_str
(
path
)
};
let
path
=
unsafe
{
c_str
(
path
)
};
match
syscall
::
open
(
path
,
flags
)
{
match
syscall
::
open
(
path
,
flags
)
{
Ok
(
fd
)
=>
{
Ok
(
fd
)
=>
{
syscall
::
close
(
fd
);
let
_
=
syscall
::
close
(
fd
);
0
0
}
}
Err
(
err
)
=>
e
(
Err
(
err
))
as
c_int
,
Err
(
err
)
=>
e
(
Err
(
err
))
as
c_int
,
...
@@ -247,7 +259,11 @@ pub fn stat(path: *const c_char, buf: *mut stat) -> c_int {
...
@@ -247,7 +259,11 @@ pub fn stat(path: *const c_char, buf: *mut stat) -> c_int {
let
path
=
unsafe
{
c_str
(
path
)
};
let
path
=
unsafe
{
c_str
(
path
)
};
match
syscall
::
open
(
path
,
O_RDONLY
)
{
match
syscall
::
open
(
path
,
O_RDONLY
)
{
Err
(
err
)
=>
e
(
Err
(
err
))
as
c_int
,
Err
(
err
)
=>
e
(
Err
(
err
))
as
c_int
,
Ok
(
fd
)
=>
fstat
(
fd
as
i32
,
buf
),
Ok
(
fd
)
=>
{
let
res
=
fstat
(
fd
as
i32
,
buf
);
let
_
=
syscall
::
close
(
fd
);
res
}
}
}
}
}
...
...
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