@@ -120,6 +120,12 @@ pub fn get_uptime(_boot_time: Option<time_t>) -> UResult<i64> {
120120 }
121121}
122122
123+ // TODO implement functionality
124+ #[ cfg( any( target_os = "android" , target_os = "redox" ) ) ]
125+ pub fn get_uptime ( _boot_time : Option < time_t > ) -> UResult < i64 > {
126+ Err ( UptimeError :: SystemUptime ) ?
127+ }
128+
123129/// Get the system uptime
124130///
125131/// # Arguments
@@ -130,7 +136,7 @@ pub fn get_uptime(_boot_time: Option<time_t>) -> UResult<i64> {
130136///
131137/// Returns a UResult with the uptime in seconds if successful, otherwise an UptimeError.
132138#[ cfg( unix) ]
133- #[ cfg( not( target_os = "openbsd" ) ) ]
139+ #[ cfg( not( any ( target_os = "openbsd" , target_os = "android" , target_os = "redox" ) ) ) ]
134140pub fn get_uptime ( boot_time : Option < time_t > ) -> UResult < i64 > {
135141 use crate :: utmpx:: Utmpx ;
136142 use libc:: BOOT_TIME ;
@@ -251,7 +257,7 @@ pub fn get_formatted_uptime(boot_time: Option<time_t>) -> UResult<String> {
251257///
252258/// Returns the number of users currently logged in if successful, otherwise 0.
253259#[ cfg( unix) ]
254- #[ cfg( not( target_os = "openbsd" ) ) ]
260+ #[ cfg( not( any ( target_os = "openbsd" , target_os = "android" , target_os = "redox" ) ) ) ]
255261// see: https://gitlab.com/procps-ng/procps/-/blob/4740a0efa79cade867cfc7b32955fe0f75bf5173/library/uptime.c#L63-L115
256262pub fn get_nusers ( ) -> usize {
257263 use crate :: utmpx:: Utmpx ;
@@ -293,6 +299,12 @@ pub fn get_nusers(file: &str) -> usize {
293299 . count ( )
294300}
295301
302+ // TODO implement functionality
303+ #[ cfg( any( target_os = "android" , target_os = "redox" ) ) ]
304+ pub fn get_nusers ( ) -> usize {
305+ 0
306+ }
307+
296308/// Get the number of users currently logged in
297309///
298310/// # Returns
@@ -391,6 +403,7 @@ pub fn get_formatted_nusers() -> String {
391403/// Returns a UResult with the load average if successful, otherwise an UptimeError.
392404/// The load average is a tuple of three floating point numbers representing the 1-minute, 5-minute, and 15-minute load averages.
393405#[ cfg( unix) ]
406+ #[ cfg( not( any( target_os = "android" , target_os = "redox" ) ) ) ]
394407pub fn get_loadavg ( ) -> UResult < ( f64 , f64 , f64 ) > {
395408 use crate :: libc:: c_double;
396409 use libc:: getloadavg;
@@ -406,6 +419,12 @@ pub fn get_loadavg() -> UResult<(f64, f64, f64)> {
406419 }
407420}
408421
422+ // TODO implement functionality
423+ #[ cfg( any( target_os = "android" , target_os = "redox" ) ) ]
424+ pub fn get_loadavg ( ) -> UResult < ( f64 , f64 , f64 ) > {
425+ Err ( UptimeError :: SystemLoadavg ) ?
426+ }
427+
409428/// Get the system load average
410429/// Windows does not have an equivalent to the load average on Unix-like systems.
411430///
0 commit comments