Thursday, March 12, 2009

Engineering exer 3 - FAQ

Q: If either of the default files doesn't exists, what should be done?

A: The exercise clearly states: "In case either of the defult files doesn’t exist - exit(-1);", hence if either default-file or the fail-file doen't exist the entire program (i.e. also the parent process) should exit as niether child can carry out his job (by exercise defintion).
-----------------------------------------------------------------------------------------------------------------------------------
Q: If any system call fails what should be done?

A: The process who encountered the failed system call should exit(-1).
-----------------------------------------------------------------------------------------------------------------------------------
Q: Can I assume that the parameters given to the program have a correct syntax, e.g. a port number is a non-negative integer smaller than 65,535?

A: Yes.
-----------------------------------------------------------------------------------------------------------------------------------
Q: The web browser doesn't display the file I sent him until I kill the process, how can I change this?

A: There are a few ways of doing this, one of them is to close() the socket.
-----------------------------------------------------------------------------------------------------------------------------------
Q: Can I assume that the requested file is in the same directory as the processes' current working directory?

A: It can either be in the same directory or relative to it. E.g. a sub-directory inside the current working directory.

Monday, March 2, 2009

Exercise 3 for computational biology

Please read the lstat() man page throughly, including the SEE ALSO section. It contains most of the answers to the questions you have.

Usfull functions:
lstat()/stat()
opendir()
readdir()
closedir()
readlink()
major()/minor()