new: mstat()函数,查询内存信息

This commit is contained in:
fslongjin
2022-08-06 23:31:25 +08:00
parent fdd5d3cf66
commit fb51b0dd6f
8 changed files with 270 additions and 7 deletions

View File

@ -1,4 +1,27 @@
#pragma once
#include <libc/sys/types.h>
int mkdir(const char *path, mode_t mode);
/**
* @brief 系统内存信息结构体(单位:字节)
*
*/
struct mstat_t
{
uint64_t total; // 计算机的总内存数量大小
uint64_t used; // 已使用的内存大小
uint64_t free; // 空闲物理页所占的内存大小
uint64_t shared; // 共享的内存大小
uint64_t cache_used; // 位于slab缓冲区中的已使用的内存大小
uint64_t cache_free; // 位于slab缓冲区中的空闲的内存大小
uint64_t available; // 系统总空闲内存大小包括kmalloc缓冲区
};
int mkdir(const char *path, mode_t mode);
/**
* @brief 获取系统的内存信息
*
* @param stat 传入的内存信息结构体
* @return int 错误码
*/
int mstat(struct mstat_t* stat);