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
fb09b03a
Verified
Commit
fb09b03a
authored
6 years ago
by
jD91mZM2
Browse files
Options
Downloads
Patches
Plain Diff
Fix compilation on redox
parent
396a6dbb
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Makefile
+2
-2
2 additions, 2 deletions
Makefile
src/lib.rs
+2
-2
2 additions, 2 deletions
src/lib.rs
src/unistd/src/lib.rs
+14
-8
14 additions, 8 deletions
src/unistd/src/lib.rs
with
18 additions
and
12 deletions
Makefile
+
2
−
2
View file @
fb09b03a
...
...
@@ -7,11 +7,11 @@ ifneq ($(TARGET),)
endif
ifeq
($(TARGET),aarch64-unknown-linux-gnu)
CC
=
"
aarch64-linux-gnu-gcc
"
CC
=
aarch64-linux-gnu-gcc
endif
ifeq
($(TARGET),x86_64-unknown-redox)
CC
=
"
x86_64-unknown-redox-gcc
"
CC
=
x86_64-unknown-redox-gcc
endif
SRC
=
\
...
...
This diff is collapsed.
Click to expand it.
src/lib.rs
+
2
−
2
View file @
fb09b03a
...
...
@@ -31,7 +31,7 @@ pub extern crate time;
pub
extern
crate
unistd
;
pub
extern
crate
wctype
;
#[cfg(not(
test
))]
#[cfg(not(
any(test,
target_os
=
"redox"
)
))]
#[panic_implementation]
#[linkage
=
"weak"
]
#[no_mangle]
...
...
@@ -50,7 +50,7 @@ pub extern "C" fn rust_begin_unwind(pi: &::core::panic::PanicInfo) -> ! {
#[linkage
=
"weak"
]
pub
extern
"C"
fn
rust_eh_personality
()
{}
#[cfg(not(
test
))]
#[cfg(not(
any(test,
target_os
=
"redox"
)
))]
#[lang
=
"oom"
]
#[linkage
=
"weak"
]
#[no_mangle]
...
...
This diff is collapsed.
Click to expand it.
src/unistd/src/lib.rs
+
14
−
8
View file @
fb09b03a
//! unistd implementation for Redox, following http://pubs.opengroup.org/onlinepubs/7908799/xsh/unistd.h.html
#![no_std]
#![cfg_attr(target_os
=
"redox"
,
feature(alloc))]
#[cfg(target_os
=
"redox"
)]
extern
crate
alloc
;
extern
crate
platform
;
extern
crate
stdio
;
extern
crate
string
;
...
...
@@ -134,6 +136,10 @@ pub unsafe extern "C" fn execve(
platform
::
execve
(
path
,
argv
,
envp
)
}
#[cfg(target_os
=
"redox"
)]
{
use
alloc
::
Vec
;
use
platform
::{
c_str
,
e
};
use
platform
::
syscall
::
flag
::
*
;
let
mut
env
=
envp
;
while
!
(
*
env
)
.is_null
()
{
let
slice
=
c_str
(
*
env
);
...
...
@@ -149,7 +155,7 @@ pub unsafe extern "C" fn execve(
// If the environment variable has no value, there
// is no need to write anything to the env scheme.
if
sep
+
1
<
slice
.len
()
{
let
n
=
match
syscall
::
write
(
fd
,
&
slice
[
sep
+
1
..
])
{
let
n
=
match
platform
::
syscall
::
write
(
fd
,
&
slice
[
sep
+
1
..
])
{
Ok
(
n
)
=>
n
,
err
=>
{
return
e
(
err
)
as
c_int
;
...
...
@@ -175,13 +181,13 @@ pub unsafe extern "C" fn execve(
let
mut
len
=
0
;
for
i
in
0
..
{
if
(
*
arg
.offset
(
i
))
.is_null
()
{
if
(
*
arg
v
.offset
(
i
))
.is_null
()
{
len
=
i
;
break
;
}
}
let
mut
args
:
Vec
<
[
usize
;
2
]
>
=
Vec
::
with_capacity
(
len
);
let
mut
args
:
Vec
<
[
usize
;
2
]
>
=
Vec
::
with_capacity
(
len
as
usize
);
let
mut
arg
=
argv
;
while
!
(
*
arg
)
.is_null
()
{
args
.push
([
*
arg
as
usize
,
c_str
(
*
arg
)
.len
()]);
...
...
@@ -294,25 +300,25 @@ pub unsafe extern "C" fn gethostname(mut name: *mut c_char, len: size_t) -> c_in
name
=
name
.offset
(
1
);
}
0
}
#[cfg(target_os
=
"redox"
)]
{
use
platform
::{
FileReader
,
Read
};
use
platform
::{
e
,
FileReader
,
Read
};
use
platform
::
syscall
::
flag
::
*
;
let
fd
=
platform
::
open
(
"/etc/hostname
\0
"
,
as_ptr
(),
0
,
O_RDONLY
);
let
fd
=
e
(
platform
::
syscall
::
open
(
"/etc/hostname
"
,
O_RDONLY
)
)
as
i32
;
if
fd
<
0
{
return
fd
;
}
let
reader
=
FileReader
(
fd
);
let
mut
reader
=
FileReader
(
fd
);
for
_
in
0
..
len
{
if
!
reader
.read_u8
(
&
mut
*
name
)
{
if
!
reader
.read_u8
(
&
mut
*
(
name
as
*
mut
u8
)
)
{
*
name
=
0
;
break
;
}
name
=
name
.offset
(
1
);
}
}
0
}
#[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