student-distrib/system_call.c
int32_t fda_init() {

	//get current file descriptor array from pcb
	pcb_t* pcb = get_pcb(tasks_running);
	file_descriptor_t* fd_array = pcb->fd;

	//initialize all 8 "files"
	int i = 0;
	for(i = 0; i < 8; i++){
		fd_array[i].fops_table = NULL;
		fd_array[i].inode = 0;
		fd_array[i].file_position = 0;
		fd_array[i].flags = 0;
	}

	//set fops table for stdin and stdout which are fd_array[0] and [1]
	fd_array[0].fops_table = &stdin_fops;
	fd_array[1].fops_table = &stdout_fops;
	fd_array[0].flags = 1;
	fd_array[1].flags = 1;

	return 0;
}
/* fda_init()
 * Input: none
 * Return: success or failure
 * Effect: fda initialization function, stdin and stdout is allocated
 */
fda_init()
Input: none
Return: success or failure
Effect: fda initialization function, stdin and stdout is allocated
fda_init () Input : none Return : success or failure Effect : fda initialization function stdin and stdout is allocated
int32_t fda_init() {
	pcb_t* pcb = get_pcb(tasks_running);
	file_descriptor_t* fd_array = pcb->fd;
	int i = 0;
	for(i = 0; i < 8; i++){
		fd_array[i].fops_table = NULL;
		fd_array[i].inode = 0;
		fd_array[i].file_position = 0;
		fd_array[i].flags = 0;
	}
	fd_array[0].fops_table = &stdin_fops;
	fd_array[1].fops_table = &stdout_fops;
	fd_array[0].flags = 1;
	fd_array[1].flags = 1;
	return 0;
}
int32_t fda_init ( ) { pcb_t * pcb = get_pcb ( tasks_running ) ; file_descriptor_t * fd_array = pcb -> fd ; int i = 0 ; for ( i = 0 ; i < 8 ; i ++ ) { fd_array [ i ] . fops_table = NULL ; fd_array [ i ] . inode = 0 ; fd_array [ i ] . file_position = 0 ; fd_array [ i ] . flags = 0 ; } fd_array [ 0 ] . fops_table = & stdin_fops ; fd_array [ 1 ] . fops_table = & stdout_fops ; fd_array [ 0 ] . flags = 1 ; fd_array [ 1 ] . flags = 1 ; return 0 ; }
fda_init()
 Input: none
 Return: success or failure
 Effect: fda initialization function, stdin and stdout is allocated
fda_init () Input : none Return : success or failure Effect : fda initialization function stdin and stdout is allocated
//get current file descriptor array from pcb //initialize all 8 "files" //set fops table for stdin and stdout which are fd_array[0] and [1]