Fix no_std on redox

Apparently a root-level cfg does not go well with a root-level no_std
This commit is contained in:
jD91mZM2
2018-07-02 08:52:27 +02:00
parent 17778ba1b4
commit 07dbc6bd76
3 changed files with 26 additions and 24 deletions
+24 -20
View File
@@ -1,28 +1,32 @@
//! sys/utsname implementation for Redox, following http://pubs.opengroup.org/onlinepubs/7908799/xsh/sysutsname.h.html
#![no_std]
#![cfg(target_os = "linux")]
extern crate platform;
#[cfg(target_os = "linux")]
mod inner {
extern crate platform;
use core::ptr;
use platform::types::*;
use core::ptr;
use self::platform::types::*;
const LENGTH: usize = 65;
const LENGTH: usize = 65;
#[allow(non_camel_case)]
#[no_mangle]
#[repr(C)]
pub struct utsname {
pub sysname: [c_char; LENGTH],
pub nodename: [c_char; LENGTH],
pub release: [c_char; LENGTH],
pub version: [c_char; LENGTH],
pub machine: [c_char; LENGTH],
pub domainname: [c_char; LENGTH]
}
#[no_mangle]
pub unsafe extern "C" fn uname(uts: *mut utsname) -> c_int {
platform::uname(uts as usize)
#[allow(non_camel_case)]
#[no_mangle]
#[repr(C)]
pub struct utsname {
pub sysname: [c_char; LENGTH],
pub nodename: [c_char; LENGTH],
pub release: [c_char; LENGTH],
pub version: [c_char; LENGTH],
pub machine: [c_char; LENGTH],
pub domainname: [c_char; LENGTH]
}
#[no_mangle]
pub unsafe extern "C" fn uname(uts: *mut utsname) -> c_int {
platform::uname(uts as usize)
}
}
#[cfg(target_os = "linux")]
pub use inner::*;