UNIX System Programming Project 2
1. (5 points) There is a limit to the size of the per-process file table, i.e., there is a maximum number of files that any single process may have open.
Determine this limit by writing a C/C++ program count-opens (note that the name of the program has a hyphen, not an underscore) that repeatedly callstheopenroutine,withoutaccompanyingcallstoclose,untilacalltoopenfails. Itissuggest having the program repeatedly open itself (argv), since that file should always exist. Answer the following question in a comment at the beginning of the program file: How many file descriptors may a process have open? (Don’t forget the three that are opened automatically for the process by the OS.)
2. (10 points) Write a C/C++ program lslthat outputs the same information (and in the same format) as the “ls -l” command. It should take either zero or one directory names as arguments. If no argument is given the program should do a long directory listing on the current directory.
3. (10points)WriteaC/C++programkittenthatisareplacementforthecatprogram.Onlythe-E, -n, and -s options are to be supported. Any other command arguments should be treated as input file names. The program must use getopt() to process the command line options. If no input file names are supplied as arguments on the command line, then the program should read from standard input.
4. (5 points) Provide a makefile named Makefilethat will make all three programs for this assignment as the default target (typically called all). Each program must be a separate target.
What to submit
Create a tarfile or zipfile containing your three program source files (count-opens, lsl, and kitten
) and makefile.
Last Updated on September 19, 2018 by EssayPro