mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-18 08:06:32 +00:00
实现free指令+修复 mountfs的内存泄露问题(#394)
* 实现meminfo文件 * 成功实现free指令,添加了一些string有关函数,并进行一些无影响的小改动 * 解决内存泄露的问题:mountfs inode的wrap方法使用了Arc::into_raw而没有from_raw,导致inode始终无法释放 --------- Co-authored-by: LoGin <longjin@DragonOS.org> Co-authored-by: longjin <longjin@RinGoTek.cn>
This commit is contained in:
@ -320,7 +320,7 @@ int shell_cmd_cat(int argc, char **argv)
|
||||
char *file_path = get_target_filepath(argv[1], &path_len);
|
||||
|
||||
// 打开文件
|
||||
int fd = open(file_path, 0);
|
||||
int fd = open(file_path, O_RDONLY);
|
||||
if (fd <= 0)
|
||||
{
|
||||
printf("ERROR: Cannot open file: %s, fd=%d\n", file_path, fd);
|
||||
@ -593,13 +593,13 @@ int shell_cmd_free(int argc, char **argv)
|
||||
printf("Mem:\t");
|
||||
if (argc == 1) // 按照kb显示
|
||||
{
|
||||
printf("%ld\t%ld\t%ld\t%ld\t%ld\t%ld\t\n", mst.total >> 10, mst.used >> 10, mst.free >> 10, mst.shared >> 10,
|
||||
mst.cache_used >> 10, mst.available >> 10);
|
||||
printf("%ld\t%ld\t%ld\t%ld\t%ld\t%ld\t\n", mst.total, mst.used, mst.free, mst.shared,
|
||||
mst.cache_used, mst.available);
|
||||
}
|
||||
else // 按照MB显示
|
||||
{
|
||||
printf("%ld\t%ld\t%ld\t%ld\t%ld\t%ld\t\n", mst.total >> 20, mst.used >> 20, mst.free >> 20, mst.shared >> 20,
|
||||
mst.cache_used >> 20, mst.available >> 20);
|
||||
printf("%ld\t%ld\t%ld\t%ld\t%ld\t%ld\t\n", mst.total >> 10, mst.used >> 10, mst.free >> 10, mst.shared >> 10,
|
||||
mst.cache_used >> 10, mst.available >> 10);
|
||||
}
|
||||
|
||||
done:;
|
||||
|
Reference in New Issue
Block a user