@@ -79,6 +79,12 @@ pub fn get_uptime(_boot_time: Option<time_t>) -> UResult<i64> {
7979 }
8080}
8181
82+ // TODO implement functionality
83+ #[ cfg( any( target_os = "android" , target_os = "redox" ) ) ]
84+ pub fn get_uptime ( _boot_time : Option < time_t > ) -> UResult < i64 > {
85+ Err ( UptimeError :: SystemUptime ) ?
86+ }
87+
8288/// Get the system uptime
8389///
8490/// # Arguments
@@ -89,7 +95,7 @@ pub fn get_uptime(_boot_time: Option<time_t>) -> UResult<i64> {
8995///
9096/// Returns a UResult with the uptime in seconds if successful, otherwise an UptimeError.
9197#[ cfg( unix) ]
92- #[ cfg( not( target_os = "openbsd" ) ) ]
98+ #[ cfg( not( any ( target_os = "openbsd" , target_os = "android" , target_os = "redox" ) ) ) ]
9399pub fn get_uptime ( boot_time : Option < time_t > ) -> UResult < i64 > {
94100 use crate :: utmpx:: Utmpx ;
95101 use libc:: BOOT_TIME ;
@@ -189,7 +195,7 @@ pub fn get_formatted_uptime(boot_time: Option<time_t>) -> UResult<String> {
189195///
190196/// Returns the number of users currently logged in if successful, otherwise 0.
191197#[ cfg( unix) ]
192- #[ cfg( not( target_os = "openbsd" ) ) ]
198+ #[ cfg( not( any ( target_os = "openbsd" , target_os = "android" , target_os = "redox" ) ) ) ]
193199// see: https://gitlab.com/procps-ng/procps/-/blob/4740a0efa79cade867cfc7b32955fe0f75bf5173/library/uptime.c#L63-L115
194200pub fn get_nusers ( ) -> usize {
195201 use crate :: utmpx:: Utmpx ;
@@ -236,6 +242,12 @@ pub fn get_nusers(file: &str) -> usize {
236242 nusers
237243}
238244
245+ // TODO implement functionality
246+ #[ cfg( any( target_os = "android" , target_os = "redox" ) ) ]
247+ pub fn get_nusers ( ) -> usize {
248+ 0
249+ }
250+
239251/// Get the number of users currently logged in
240252///
241253/// # Returns
@@ -334,6 +346,7 @@ pub fn get_formatted_nusers() -> String {
334346/// Returns a UResult with the load average if successful, otherwise an UptimeError.
335347/// The load average is a tuple of three floating point numbers representing the 1-minute, 5-minute, and 15-minute load averages.
336348#[ cfg( unix) ]
349+ #[ cfg( not( any( target_os = "android" , target_os = "redox" ) ) ) ]
337350pub fn get_loadavg ( ) -> UResult < ( f64 , f64 , f64 ) > {
338351 use crate :: libc:: c_double;
339352 use libc:: getloadavg;
@@ -349,6 +362,12 @@ pub fn get_loadavg() -> UResult<(f64, f64, f64)> {
349362 }
350363}
351364
365+ // TODO implement functionality
366+ #[ cfg( any( target_os = "android" , target_os = "redox" ) ) ]
367+ pub fn get_loadavg ( ) -> UResult < ( f64 , f64 , f64 ) > {
368+ Err ( UptimeError :: SystemLoadavg ) ?
369+ }
370+
352371/// Get the system load average
353372/// Windows does not have an equivalent to the load average on Unix-like systems.
354373///
0 commit comments