34#if defined(HAVE_SYSINFO) 
   35#include <sys/sysinfo.h> 
   98#if defined(HAVE_SYSINFO) 
   99    struct sysinfo sys_info;
 
  100    if (sysinfo(&sys_info)) {
 
  108    } 
else if (!strcasecmp(
"loadavg", data)) {
 
  111        snprintf(
buf, 
len, 
"%f", curloadavg);
 
  112    } 
else if (!strcasecmp(
"numcalls", data)) {
 
  115#if defined(HAVE_SYSINFO) 
  116    else if (!strcasecmp(
"uptime", data)) {             
 
  117        snprintf(
buf, 
len, 
"%ld", sys_info.uptime/3600);
 
  118    } 
else if (!strcasecmp(
"totalram", data)) {         
 
  119        snprintf(
buf, 
len, 
"%lu",(sys_info.totalram * sys_info.mem_unit)/1024);
 
  120    } 
else if (!strcasecmp(
"freeram", data)) {          
 
  121        snprintf(
buf, 
len, 
"%lu",(sys_info.freeram * sys_info.mem_unit)/1024);
 
  122    } 
else if (!strcasecmp(
"bufferram", data)) {        
 
  123        snprintf(
buf, 
len, 
"%lu",(sys_info.bufferram * sys_info.mem_unit)/1024);
 
  124    } 
else if (!strcasecmp(
"totalswap", data)) {        
 
  125        snprintf(
buf, 
len, 
"%lu",(sys_info.totalswap * sys_info.mem_unit)/1024);
 
  126    } 
else if (!strcasecmp(
"freeswap", data)) {         
 
  127        snprintf(
buf, 
len, 
"%lu",(sys_info.freeswap * sys_info.mem_unit)/1024);
 
  128    } 
else if (!strcasecmp(
"numprocs", data)) {
 
  129        snprintf(
buf, 
len, 
"%d", sys_info.procs);
 
 
int getloadavg(double *list, int nelem)
Asterisk main include file. File version handling, generic pbx functions.
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
static int sysinfo_helper(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
static int load_module(void)
static int unload_module(void)
static struct ast_custom_function sysinfo_function
Asterisk module definitions.
#define AST_MODULE_INFO_STANDARD(keystr, desc)
#define ASTERISK_GPL_KEY
The text the key() function should return.
Core PBX routines and definitions.
int ast_active_calls(void)
Retrieve the number of active calls.
#define ast_custom_function_register(acf)
Register a custom function.
int ast_custom_function_unregister(struct ast_custom_function *acf)
Unregister a custom function.
static force_inline int attribute_pure ast_strlen_zero(const char *s)
Main Channel structure associated with a channel.
Data structure associated with a custom dialplan function.