submit doc and some small changes to getdents

master
forever-learner 3 years ago
parent 8e2f60b4e7
commit a6cbdfd4d7

@ -108,7 +108,6 @@ int sys_getdents(unsigned int fd,struct linux_dirent *dirp,unsigned int count)
struct buffer_head * bh;
struct dir_entry * de;
struct linux_dirent *initmp,*temp;
char *foruse;
if(!(temp=(struct linux_dirent *)malloc(count+64)))
return -1;
initmp=temp;
@ -140,9 +139,7 @@ int sys_getdents(unsigned int fd,struct linux_dirent *dirp,unsigned int count)
strcpy(temp->d_name,de->name);
temp->d_reclen=size+strlen(de->name)+1;
nread+=temp->d_reclen;
foruse=(char*)temp;
foruse+=temp->d_reclen;
temp=(struct linux_dirent*)foruse;
temp=(struct linux_dirent*)((char*)temp+temp->d_reclen);
de++;
pos+=sizdir;
i++;
@ -157,19 +154,21 @@ int sys_getdents(unsigned int fd,struct linux_dirent *dirp,unsigned int count)
char *p2=initmp;
while(i--)
put_fs_byte(*(p2++),p1++);
free(initmp);
return nread;
}
void pri(struct linux_dirent * dir)
{
printk("[%d %d %d %s] ",dir->d_ino,dir->d_off,dir->d_reclen,dir->d_name);
}
int sys_pipe2()
{
return -1;
}
unsigned int sys_sleep(unsigned int seconds)
{
sys_signal(SIGALRM,SIG_IGN,NULL);
struct sigaction tmp;
tmp.sa_handler = (void (*)(int)) SIG_IGN;
tmp.sa_mask = 0;
tmp.sa_flags = SA_ONESHOT | SA_NOMASK;
tmp.sa_restorer = (void (*)(void)) NULL;
current->sigaction[SIGALRM-1] = tmp;
current->alarm=(seconds>0)?(jiffies+HZ*seconds):0;
current->state=TASK_INTERRUPTIBLE;
current->counter=(current->counter>>1)+current->priority;

Binary file not shown.

Binary file not shown.
Loading…
Cancel
Save