CS 3733 Operating Systems


FAQ Fall 1997


9/27/97 QUESTION
In your specifications for assignment 3, isn't the prototype for prusage_t supposed to be int output_prusage(FILE *fp, prusage_t s) instead of int output_prusage(FILE *fp, prstatus_t s)

ANSWER
Yes.


9/22/97 QUESTION
What fields can be omitted from output_prstatus?

ANSWER

       sigset_t           pr_sigpend;   /* Set of process pending signals */
       sigset_t           pr_lwppend;   /* Set of lwp pending signals */
       sigset_t           pr_sighold;   /* Set of lwp held signals */
       struct siginfo     pr_info;      /* Info associated with signal or fault */
       struct sigaltstack pr_altstack;  /* Alternate signal stack info */
       struct sigaction   pr_action;    /* Signal action for current signal */


9/12/97 QUESTION
> Should we check for errors in the wait/waitpid system calls?

ANSWER
Yes


QUESTION
> If we should, I'm not clear if (errno == EINTR) is an actual error or > if I should just wait for the signal to finish.

ANSWER
You must execute the wait again to continue waiting after wait has returned because of a signal.

QUESTION
> Also if the wait return is a -1 and *stat_loc == WIFSIGNALED, is this a > true error.

ANSWER
The WIFSIGNALED refers to detection that the child received a signal. This is not the same as the EINTR which tells whether the parent received a signal while blocked in the wait system call.


9/11/97 QUESTION
> I was doing some additional reading, and it appears that you can also come > back from a wait if a process has been stopped. Does runsim need to take > this case into account? If so, does the stopped process count as one of > the active ones? Looks like it would be possible to fork a bunch of > processes, have them all stop (intentionally or otherwise) and be stuck.

ANSWER
You don't have to detect stopped processes for this assignment. I am thinking about an extension after we cover Chapter 5.


9/7/97 QUESTION Here are the warning you asked for and the code for makeargv, I placed the line numbers on the right. The lint gave me the same warnings. Other than the warnings, makeargv seems to be working fine

"try.c", line 102: warning: improper pointer/integer combination: op "="
"try.c", line 114: warning: improper pointer/integer combination: op "="
"try.c", line 120: warning: improper pointer/integer combination: op "="
"try.c", line 122: warning: improper pointer/integer combination: op "="

ANSWER You have to include the appropriate header files for calloc and strtok. When you lint you will get messages that these functions are assumed to return int. For example, line 102 is

if ((t = calloc(strlen(snew) + 1, sizeof(char))) == NULL) {


9/6/97 QUESTION > What's the MAX_CANON?

ANSWER MAX_CANON is a system-wide constant that is defined in limits.h specifying how big the canonical input buffer is (for terminal I/O).


9/5/97 QUESTION > I have some questions about this first assignment: > > 1. Could we use perror instead of fprintf

ANSWER Yes, this would be better in some cases. The main point is that error messages should go to stderr rather than stdout.

QUESTION > 2. Did you say in class we should not exit in the middle of the program > if we get an error. For example, if I get a fork error or a makeargv > error should I wait until the program finishes instead of exiting

ANSWER You should not exit for a function, but rather return an error code to the calling program. You may exit from the main program at any time (after printing an appropriate error message, or course).

QUESTION
> 3. The way I'm implementing my program is I read one line from testing.data > and if I have more processes allowed I fork. I keep repeating this until > end of file. Is this correct or should I strcpy all the fgets together > and fork the max number of children allowed each time.

ANSWER No you definitely want to read one line and fork a process. If you have the max allowed children currently running then you have to wait.

QUESTION
> 4. I believe you also said we are not using news groups so I guess we mail > you directly our questions?

ANSWER Yes. I am planning to use the FAQ and mailing lists this semester.



Revision Date: 9/12/97