![]() |
ANU College of Engineering and Computer Science
School of Computer Science
|
|
|
Computer NetworksFun with RPCThis exercise is designed to introduce the student to the Sun Remote Procedure Call (RPC) facility, used by the Network File System (NFS) and other network enabled programs. The task is to write a program that will query an NFS server (actually, the mount daemon of the NFS server) and determine what file-systems are available for mounting. Calling RPC routines is somewhat more complex, mainly due to the use of eXternal Data Representation (XDR). To simplify it, Sun developed the rpcgen program compiler. In our case, we don't want to develop a new mountd (at this time), so we will use the source code of the showmount(1) command as a starting point and go from there. Save this tar file into your directory, then:
From here, start stripping out the excess from the showmount.c code until it only implements the -e option as the default. Once you have this part working, modify your code to perform a mount call (using the MOUNTPROC_MNT RPC procedure number) to the server at myserver for the /export directory. Part of the return structure (of type struct fhstatus, defined in mount.h) is the fhs_status. Print this value out. Your code should return the value 13 for fhs_status if you run it using your normal user account. This is because the mountd server on myserver will not let any user other than the super-user (root) perform mount requests. Become root in a terminal window on your machine using the "su" command (the root password is "comp3310"). Run your program again. What is the fhs_status code this time? Check this value in the mount.h file (in the tar file you downloaded). | |||||||||||||||||||||||||||||||||||||||||||
|
Please direct all enquiries to: bob@cs.anu.edu.au Page authorised by: Head of School, SoCS |
| The Australian National University — CRICOS Provider Number 00120C |