@@ -80,6 +80,12 @@ pub fn get_uptime(_boot_time: Option<time_t>) -> UResult<i64> {
8080 }
8181}
8282
83+ // TODO implement functionality
84+ #[ cfg( any( target_os = "android" , target_os = "redox" ) ) ]
85+ pub fn get_uptime ( _boot_time : Option < time_t > ) -> UResult < i64 > {
86+ Err ( UptimeError :: SystemUptime ) ?
87+ }
88+
8389/// Get the system uptime
8490///
8591/// # Arguments
@@ -90,7 +96,7 @@ pub fn get_uptime(_boot_time: Option<time_t>) -> UResult<i64> {
9096///
9197/// Returns a UResult with the uptime in seconds if successful, otherwise an UptimeError.
9298#[ cfg( unix) ]
93- #[ cfg( not( target_os = "openbsd" ) ) ]
99+ #[ cfg( not( any ( target_os = "openbsd" , target_os = "android" , target_os = "redox" ) ) ) ]
94100pub fn get_uptime ( boot_time : Option < time_t > ) -> UResult < i64 > {
95101 use crate :: utmpx:: Utmpx ;
96102 use libc:: BOOT_TIME ;
@@ -192,7 +198,7 @@ pub fn get_formatted_uptime(boot_time: Option<time_t>) -> UResult<String> {
192198///
193199/// Returns the number of users currently logged in if successful, otherwise 0.
194200#[ cfg( unix) ]
195- #[ cfg( not( target_os = "openbsd" ) ) ]
201+ #[ cfg( not( any ( target_os = "openbsd" , target_os = "android" , target_os = "redox" ) ) ) ]
196202// see: https://gitlab.com/procps-ng/procps/-/blob/4740a0efa79cade867cfc7b32955fe0f75bf5173/library/uptime.c#L63-L115
197203pub fn get_nusers ( ) -> usize {
198204 use crate :: utmpx:: Utmpx ;
@@ -239,6 +245,12 @@ pub fn get_nusers(file: &str) -> usize {
239245 nusers
240246}
241247
248+ // TODO implement functionality
249+ #[ cfg( any( target_os = "android" , target_os = "redox" ) ) ]
250+ pub fn get_nusers ( ) -> usize {
251+ 0
252+ }
253+
242254/// Get the number of users currently logged in
243255///
244256/// # Returns
@@ -337,6 +349,7 @@ pub fn get_formatted_nusers() -> String {
337349/// Returns a UResult with the load average if successful, otherwise an UptimeError.
338350/// The load average is a tuple of three floating point numbers representing the 1-minute, 5-minute, and 15-minute load averages.
339351#[ cfg( unix) ]
352+ #[ cfg( not( any( target_os = "android" , target_os = "redox" ) ) ) ]
340353pub fn get_loadavg ( ) -> UResult < ( f64 , f64 , f64 ) > {
341354 use crate :: libc:: c_double;
342355 use libc:: getloadavg;
@@ -352,6 +365,12 @@ pub fn get_loadavg() -> UResult<(f64, f64, f64)> {
352365 }
353366}
354367
368+ // TODO implement functionality
369+ #[ cfg( any( target_os = "android" , target_os = "redox" ) ) ]
370+ pub fn get_loadavg ( ) -> UResult < ( f64 , f64 , f64 ) > {
371+ Err ( UptimeError :: SystemLoadavg ) ?
372+ }
373+
355374/// Get the system load average
356375/// Windows does not have an equivalent to the load average on Unix-like systems.
357376///
0 commit comments