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:
+24
-20
@@ -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::*;
|
||||
|
||||
Reference in New Issue
Block a user