Skip to content
Snippets Groups Projects
Commit 4531bc57 authored by Divyam Khandelwal's avatar Divyam Khandelwal
Browse files

fd_check updated

parent 30f193b5
No related branches found
No related tags found
No related merge requests found
......@@ -19,7 +19,7 @@ void i8253_init(void){
void pit_handler(){
//printf("[PIT] Interrupt Test");
scheduler();
//scheduler();
send_eoi(0);
//todo
......
......@@ -24,17 +24,19 @@ void control_initilization(void)
control.running_terminal = 0;
}
//checking is fd is valid
/* Checks if FD is valid
* Returns -1 for invalid FD
* Returns 0 for valid FD */
int32_t fd_check(int32_t fd)
{
if( fd >= MIN_FILE_NUM &&
fd < MAX_FILE_NUM ){ return -1; }
// file not present
if (control.terminal[control.cur_terminal].pcb->fd[fd].flags == 0)
return -1;
else return 0;
/* First check for valid index */
if (fd >= MIN_FILE_NUM && fd < MAX_FILE_NUM )
{
/* Now check if file is present */
if (control.terminal[control.cur_terminal].pcb->fd[fd].flags != 0)
return 0;
}
return -1;
}
//clearing fd
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment