Linux系统调用之sysinfo函数解析

【sysinfo系统调用】
 
功能描述:
获取系统总体统计信息。
 
用法:
#include <sys/sysinfo.h>

int sysinfo(struct sysinfo *info); 
 


参数:
info:指向sysinfo结构的指针,原型如下,Linux版本必须>=2.3.23(i386),或者>=2.3.48(其它平台)。

struct sysinfo {
    long uptime;             /* Seconds since boot */
    unsigned long loads[3];  /* 1, 5, and 15 minute load averages */
    unsigned long totalram;  /* Total usable main memory size */
    unsigned long freeram;   /* Available memory size */
    unsigned long sharedram; /* Amount of shared memory */
    unsigned long bufferram; /* Memory used by buffers */
    unsigned long totalswap; /* Total swap space size */
    unsigned long freeswap;  /* swap space still available */
    unsigned short procs;    /* Number of current processes */
    unsigned long totalhigh; /* Total high memory size */
    unsigned long freehigh;  /* Available high memory size */
    unsigned int mem_unit;   /* Memory unit size in bytes */
    char _f[20-2*sizeof(long)-sizeof(int)]; /* Padding for libc5 */
};


返回说明:
成功执行时,返回0。失败返回-1,errno被设为EFAULT。

linux

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wzwwpd.html