study 2 - 2nd set of study questions ------------------------------------------------------------------------ Vi: [[ and ]] for "scrolling" between functions ctags/vi cntrl-] - jumping to a tagged function cntrl-t - popping out of a tagged function cscope tab to move from the results section to the question section arrow keys (other keys do this too) for moving around in the sections cntrl-d to quit strace - app for tracing system calls and showing errors gdb - magic using perror() function call to see errno result - there may be other ways to do this. study questions 1. explain what system calls would be needed (and why they are needed) for shell redirection of stdout; e.g., ls > file here's the start: fork() == 0 -- make a child which inherited an open stdout from the parent 2. if you have two processes A and B and they behave as follows process A open file X write 100 bytes to X fork B write 100 bytes to X now ... when we reach "now", what is the value of the file table seek pointer for the file X from process A's point of view what is it for process B 3. what does mmap do. why is it a problem if you have not done munmap yet (e.g., your program crashes). why is this more efficient possibly than straight file i/o? 4. what is the function of the stat call. how does fstat differ from stat?