36 #if defined(HAVE_SYSINFO)
37 #include <sys/sysinfo.h>
95 char *buf,
size_t len)
97 #if defined(HAVE_SYSINFO)
98 struct sysinfo sys_info;
99 if (sysinfo(&sys_info)) {
107 }
else if (!strcasecmp(
"loadavg", data)) {
110 snprintf(buf, len,
"%f", curloadavg);
111 }
else if (!strcasecmp(
"numcalls", data)) {
114 #if defined(HAVE_SYSINFO)
115 else if (!strcasecmp(
"uptime", data)) {
116 snprintf(buf, len,
"%ld", sys_info.uptime/3600);
117 }
else if (!strcasecmp(
"totalram", data)) {
118 snprintf(buf, len,
"%lu",(sys_info.totalram * sys_info.mem_unit)/1024);
119 }
else if (!strcasecmp(
"freeram", data)) {
120 snprintf(buf, len,
"%lu",(sys_info.freeram * sys_info.mem_unit)/1024);
121 }
else if (!strcasecmp(
"bufferram", data)) {
122 snprintf(buf, len,
"%lu",(sys_info.bufferram * sys_info.mem_unit)/1024);
123 }
else if (!strcasecmp(
"totalswap", data)) {
124 snprintf(buf, len,
"%lu",(sys_info.totalswap * sys_info.mem_unit)/1024);
125 }
else if (!strcasecmp(
"freeswap", data)) {
126 snprintf(buf, len,
"%lu",(sys_info.freeswap * sys_info.mem_unit)/1024);
127 }
else if (!strcasecmp(
"numprocs", data)) {
128 snprintf(buf, len,
"%d", sys_info.procs);
Main Channel structure associated with a channel.
#define AST_MODULE_INFO_STANDARD(keystr, desc)
Asterisk main include file. File version handling, generic pbx functions.
int ast_active_calls(void)
Retrieve the number of active calls.
int ast_custom_function_unregister(struct ast_custom_function *acf)
Unregister a custom function.
static int unload_module(void)
static int load_module(void)
static int sysinfo_helper(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
static force_inline int attribute_pure ast_strlen_zero(const char *s)
Data structure associated with a custom dialplan function.
Core PBX routines and definitions.
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
void ast_log(int level, const char *file, int line, const char *function, const char *fmt,...)
Used for sending a log message This is the standard logger function. Probably the only way you will i...
static struct ast_custom_function sysinfo_function
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.
int getloadavg(double *list, int nelem)
#define ast_custom_function_register(acf)
Register a custom function.
#define ASTERISK_FILE_VERSION(file, version)
Register/unregister a source code file with the core.