From 566bd9b5045c9685ef7f953eba2d1cb96cf9665d Mon Sep 17 00:00:00 2001 From: pt3oyfief <1324428257@qq.com> Date: Thu, 23 Jun 2022 18:38:45 +0800 Subject: [PATCH] Update sys.c_1.1 --- sys.c_1.1 | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sys.c_1.1 b/sys.c_1.1 index ee46e6a..1a700ba 100644 --- a/sys.c_1.1 +++ b/sys.c_1.1 @@ -326,7 +326,9 @@ int sys_sleep(unsigned int seconds){ -#define NAME_MAX 255 +#define NAME_MAX 14 + +/////////////////////////sys_getdents////////////////////////// struct linux_dirent { //专为输出的目录项结构 long d_ino; off_t d_off; @@ -366,7 +368,7 @@ int sys_getdents(unsigned int fd, struct dirent *dirp, unsigned int count) for( ; d < inode->i_size ; d += dir_entry_size) { //printk("***\n"); - if(l >= count - linux_dirent_size) break;//dirp已经满了,返回读取的字节数 //buggy + if (l >= count - linux_dirent_size) break;//dirp已经满了,返回读取的字节数 //buggy //bufhd->b_data 是char*类型的指针(char为一字节),因此+d可以到这个目录项 d_entry = (struct dir_entry *)(bufhd->b_data + d); @@ -394,8 +396,8 @@ int sys_getdents(unsigned int fd, struct dirent *dirp, unsigned int count) + char * sys_getcwd(char * buf, size_t size){ - }