Week 4 - Processes and Low Level I/O Flashcards
What library is syscall in?
unistd.h
What library is fopen in?
stdio.h
What library is fork in?
unistd.h
What library is exit in?
stdlib.h
What library is printf in?
stdio.h
What library is get_pid in?
unistd.h
What library is sleep in?
unistd.h
What library is wait in?
sys/wait.h
What is SYSNO?
the system call number
How do you make a direct syscall?
long int syscall( long int SYSNO, …)
How do you create a new child?
pid_t fork();
What number is the standard input?
0
What number is the standard output?
1
What number is the standard error?
2
How does the parent wait for the child to terminate?
pid_t wait(int *status);
How do you suspend a process?
unsigned in sleep( unsigned int secs);
What are the steps to opening a file?
- kernel checks you have the right
- kernel returns the file descriptor
- kernel keeps track of open file info
How do you open a file?
FILE *fopen( char *name, char *mode);
What does a file handler contain?
- pointer to a buffer
- number of characters left in the buffer
- pointer to next position in the buffer
- the file descriptor
- various flags