[cs631apue] Several Questions
bzhang41
bzhang41 at stevens.edu
Thu Sep 15 17:12:01 EDT 2016
Hi all, I have several questions:
1. On the textbook, section 3.14, I don’t understand the test cases:
$ ./a.out 2 2>>temp.foo
write only, append
$ ./a.out 5 5<>temp.foo
read write
What does 2>>temp.foo and 5<>temp.foo mean here ?
2. When I test the hole.c on the lab, the result I got is
bzhang41 at smurf:~/ReadAndTest$ cc -Wall hole.c
bzhang41 at smurf:~/ReadAndTest$ ./a.out
bzhang41 at smurf:~/ReadAndTest$ ls -l file.hole
-rw-------+ 1 bzhang41 student 10240020 Sep 15 11:15 file.hole
bzhang41 at smurf:~/ReadAndTest$ hexdump -c file.hole
0000000 a b c d e f g h i j \0 \0 \0 \0 \0 \0
0000010 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0
*
09c4000 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 A B C D E F
09c4010 G H I J
09c4014
bzhang41 at smurf:~/ReadAndTest$ cat file.hole > file.nohole
bzhang41 at smurf:~/ReadAndTest$ ls -ls file.*
259 -rw-------+ 1 bzhang41 student 10240020 Sep 15 11:15 file.hole
1 -rw-r--r--+ 1 bzhang41 student 10240020 Sep 15 11:18 file.nohole
why the file.nohole has large block size than the file.hole ? When Prof
shows the result, it also happened. It’s the problem of different OS ?
3. How can I run the I/O efficiency example in the slides ?
I can not "make tempfiles" shows in the slides. Can Prof. send us the
makefile ? so we can try the example.
Actually, I also don’t understand
what does "dd if=/dev/urandom of=tmp/file$n count=204800" mean ? I know
the purpose is creating several files. I don’t understand the grammar
here.
Is there any material I can catch up to understand this grammar ?
And `cc -Wall -DBUFFSIZE=$n simple-cat.c` I know this is compile the
program, but what does the "-DBUFFSIZE=$n" do here ?
Finally, `stat -f "%k" tmp/file1 # stat -c "%o" tmp/file1`, I checked
the stat in man, but I didn’t find %k option, and I also don’t
understand what the symbol `#` does here ?
More information about the cs631apue
mailing list