2014-09-29 23:13:05 +00:00
# include "defs.h"
2015-08-03 06:27:48 +03:00
# include DEF_MPERS_TYPE(sysinfo_t)
2014-09-29 23:13:05 +00:00
# include <sys/sysinfo.h>
2015-08-03 06:27:48 +03:00
typedef struct sysinfo sysinfo_t ;
# include MPERS_DEFS
2014-09-29 23:13:05 +00:00
2015-04-07 01:36:50 +00:00
SYS_FUNC ( sysinfo )
2014-09-29 23:13:05 +00:00
{
2015-08-03 06:27:48 +03:00
sysinfo_t si ;
2014-09-29 23:13:05 +00:00
2014-09-29 23:29:56 +00:00
if ( entering ( tcp ) )
return 0 ;
2015-07-16 22:08:02 +00:00
if ( ! umove_or_printaddr ( tcp , tcp - > u_arg [ 0 ] , & si ) ) {
2015-03-02 14:34:25 +00:00
tprintf ( " {uptime=%llu "
" , loads=[%llu, %llu, %llu] "
" , totalram=%llu "
" , freeram=%llu "
" , sharedram=%llu "
" , bufferram=%llu "
" , totalswap=%llu "
" , freeswap=%llu "
2014-09-29 23:29:56 +00:00
" , procs=%u "
2015-03-02 14:34:25 +00:00
" , totalhigh=%llu "
" , freehigh=%llu "
2014-09-29 23:29:56 +00:00
" , mem_unit=%u "
" } " ,
2015-03-02 14:34:25 +00:00
( unsigned long long ) si . uptime
, ( unsigned long long ) si . loads [ 0 ]
, ( unsigned long long ) si . loads [ 1 ]
, ( unsigned long long ) si . loads [ 2 ]
, ( unsigned long long ) si . totalram
, ( unsigned long long ) si . freeram
, ( unsigned long long ) si . sharedram
, ( unsigned long long ) si . bufferram
, ( unsigned long long ) si . totalswap
, ( unsigned long long ) si . freeswap
2014-09-29 23:29:56 +00:00
, ( unsigned ) si . procs
2015-03-02 14:34:25 +00:00
, ( unsigned long long ) si . totalhigh
, ( unsigned long long ) si . freehigh
2014-09-29 23:29:56 +00:00
, si . mem_unit
) ;
2014-09-29 23:13:05 +00:00
}
2014-09-29 23:29:56 +00:00
2014-09-29 23:13:05 +00:00
return 0 ;
}