OpSys Spring 2005 - HW2 FAQ

Click on a question to expand it (for the details).
Click on the question title again to hide the details.

+ Calling stat()

Question:

Is there any sample code that shows how to call stat?


Answer:

Yes - there is a sample program here

+ Sample Windows code?

Question:

Is there any sample Windows code that might be worth looking at?


Answer:

Yes, here is some code that lists the files in a directory: Sample Windows code

+ stat() vs. lstat()

Question:

Should we be using stat or lstat, and what is the difference?


Answer:

For a symbolic link (which is like a "shortcut" for Windows folks), lstat() reports on the actual symbolic link, and stat will report on the file the link refers to. You are probably better off using lstat for the homework. (We won't test on any directories that include symbolic links, so it won't matter to us).

+ BSD du command and "-B 1"

Question:

The command line shown in the assignment that we can use to find the "right" diskusage using the du doesn't work on the CS BSD machines!


Answer:

No, it doesn't... (The command line in the assignment works under Linux, but BSD does not support the "-B" flag to du.). So - you need to multiply the output of du (which tells about the number of 512 byte blocks), by 512 to get the numbers you should be generating.