ECS150 TA Website

last updated
General Resources

Remote Access

All homework must be submitted through the CS accounts. More information on remote login into the CSIF computers can be found in the CSIF FAQ.

Account Access (SSH)

You may access your CS account via SSH. The hostname you want to connect to is:

pc<#>.cs.ucdavis.edu

where <#> is a number between 1 and 60. The CSIF FAQ has information on SSH clients for Windows. You can also find SSH and SFTP clients for Windows here.

Transferring Files (SFTP)

To transfer files to your CS account, you must use SFTP. The hostname is the same as above. For SFTP commands, see the CSIF FAQ. A command-line SFTP client for Windows can be found here.

Using Minix Manual Pages (man)

One of your first resources for finding information on Minix system calls should be the man pages (manual pages). You can find more information on how to use man by typing the following:

man man

There are also a few good man resources on the web. Here are just a couple:

Makefiles

All of the program assignments require you to turn in a Makefile. If you have not had experience creating makefiles before, you can find a tutorial at http://www.eng.hawaii.edu/Tutor/Make/. A simple makefile looks similar to:

all:
	cc -g program1.c -o program1

clean:
	rm -f program1

Using the makefile above, we would compile program1.c by the following command:

make all     (or by typing make)

To clean up the object files, we could run the command:

make clean

This illustrates the basic functionality required for all makefiles in this class.

Using errno

One way to debug your programs is to make use of the errno variable in errno.h. Whenever a system call results in an error, the value of errno is set. To use errno in your Minix C programs, do the following:

  1. Add library errno.h to your code.
  2. Check the return value of a system call.
  3. If the return value indicates an error occured, print out errno.
  4. Open /usr/include/errno.h and check what message the value of errno corresponds to.

    -or-

    Type man errno and check what message the value of errno corresponds to.

Take for example the following code snippet:

rval = chdir( path );

if( rval == -1 )
	printf( "chdir( %s ) failed... errno: %i\n", path, errno );

If we got the following output:

chdir( nowhere ) failed... errno: 2

We could then look in /usr/include/errno.h to see that an errno value of 2 corresponds to the message "no such file or directory".

You can always find more information from the man pages. You can also download errno_example.c for another example Minix C code snippet using errno.