Where to look for answers to your questions:
- UNIX manual pages. eg., man man
- ask Google!
- newsgroup, office hours, (also during discussions and lectures)
Setting up an AFS filespace for your group directory, eg., alice, bob,
and charlie
1. Choose an AFS directory, eg., ~bob/eecs482group
2. Using fs command, add permissions for alice and charlie. Remove
permissions for system:anyuser
3. In ~bob/eecs482/groups, execute the following command: "fs la ."
(without the quotes). This command display current permissions for the
"." (current) directory. Likely, you will see the following entries:
system: administrators rlidwka
system:anyuser rl
bob rlidwka
4. To add necessary permissions, execute the following command: "fs sa
.
alice rlidwk". If now you execute "fs la .", you will see an extra
entry:
system: administrators rlidwka
system:anyuser rl
bob rlidwka
alice rlidwk
5. Execute the same for charlie.
6. Finally, to protect this directory, you need to remove rights give
to "system:anyuser". To do so,
execute the following command: "fs sa . system:anyuser none". The
output of "fs la ." will be:
system: administrators rlidwka
bob rlidwka
alice rlidwk
charlie rlidwk
7. Do not touch the permissions for the "system:administrators"!
8. Now you are ready to setup a CVS repository in the directory
~bob/eecs482group . Follow the instruction from the course web page,
under the link "Guide to CVS". This guide also describes how you would
use the "pts" command to create a group for you group members. Then,
instead of giving permissions to each individual member, you can give
the "rlidwk" permissions to the group.
AFS
administrative guide (it includes a comprehensive documentation on
fs
and pts commands). From this webpage (or from the AFS webpge), you
should click on links for "fs
listacl", "fs
setacl", also "pts
creategroup", "pts
adduser". There is a lot of other information present on the main
AFS page that you wouldn't ever need to know unless you are
administering an AFS system.
Basic programming documentation on C/C++ programming and shared
libraries on CAEN is available here.
This is also the place for information on how to use brightmail
filtering software available on CAEN machine that allows you to get rid
of SPAM mail! Checkout their technotes on Pine and search for
"brightmail"...
Use g++ -g (for debugging) -Wall (for extra warnings)
Use gdb to debug your
projects! To invoke gdb,
execute the following command: "gdb
disk", where "disk" is the name of your program. When you get a
gdb-prompt, you can:
- type "help" for more info.
- say "run disk 5 in1 in2 in3 in4 in5" to execute the program.
- set breakpoint by typing "b main", gdb will start your
application and will stop once it reaches a function called "main".
- after stopping at a breakpoint, you can set through you code by
using "s" (for step) and "n" (for next). "Step" will step into
functions, "next" will step over functions.
- to print a value of a variable, type "p i", where "p" stands for
print, and "i" is a variable
Using gdb to debug with a
core file: a file that is created when an
application terminates
abnormally or the system crashes. A core file is useful to debug a
problem with an application or system that crashed, but otherwise, core
files should be deleted because they consume a large amount of disk
space. A core file is created in the directory from which the
application was invoked. To generate a core file, (in
tcsh) execute "limit coredumpsize unlimited". To look at other OS
resource limits, just type "limit" at the prompt. An example
output (before unsetting the core file limit) might look like:
cputime
unlimited
filesize
unlimited
datasize
unlimited
stacksize
8192 kbytes
coredumpsize 0 kbytes
memoryuse
unlimited
vmemoryuse unlimited
descriptors 1024
memorylocked unlimited
maxproc
2036
When you enable the creation of the core file, re-run your faulty
application, say "disk", and the execute: "gdb disk core", where "core"
is the name of the core file. Note, a core file can frequently
have a process id in its filename. In bash shell, you can use command
call ulimit. Typing "ulimit -a" is the same the "limit" example above.
"limit" is a
built-in script in a tcsh and has no man pages. I'd recommend googling
for more info you are curious about the command.
Memory debugging tools:
1. Start by checking that every malloc/new has a corresponding
free/delete.
2. For memory errors such as (1) double calls to free or (2) off-by-one
memory access, you can
set an environment variable: "setenv MALLOC_CHECK_ 1" (0, will ignore
memory errors,
and 2, will make you program exit when the error occurs). Notice, (1)
"setenv" is a tcsh command (thus, if you use a different shell you
might need to change the format of how you set the env vars.) (2) the
name of the env variable ends on a "_" and there is a space between "_"
and "1".
Here is an example of using
MALLOC_CHECK_ (written in C). After you are done debugging
do: "unsetenv MALLOC_CHECK_". I have verified that it also works for
C++ (Here is a C++ example).
3. Use valgrind. It's an open source memory debugging tool.
Documentation is available on-line
from here. You can
execute valgrind by typing:
valgrind --tool=memcheck --leak-check=yes
--show-reachable=yes disk 5 in.1 in.2 in.3 in.4 in.5