Unix system calls and library functions

Assignment Help Operating System
Reference no: EM1379829

Unix System Calls and Library Functions

The goal of this homework is to become familiar with the environment in hoare while practising system calls. 

Do Exercise 5.8:Traversing Directories (p. 179) in your text by Robbins/Robbins. You only need to do the Example 5.38, or

breadth-first traversal.

The programming task requires you to create a utility to traverse a specified directory in breadth-first order. Breadth-first search

explores all the nodes at a given level before descending lower in the tree. Breadth-first search is implemented with a queue.

As the program encounters each directory node at a particular level, it enqueues the pathname for later examination. You can

use the following pseudocode which makes use of queue ADT. You will have to provide the code for queue ADT operations

yourself.

breadthfirst ( root )

{

enqueue ( root );

while ( ! empty ( queue ) )

{

next = dequeue ( queue );

for each node directly below next

{

visit ( node );

if ( isa_directory ( node ) )

enqueue ( node );

}

}

}

The indentation of the filenames shows the level in the file system tree. Use the output format specified in Example 5.37, with

a default indentation of 4 spaces for each level in the directory. You should be able to change the indentation spaces by using

an option on command line followed by a number. The executable should be called bt. The program will be invoked by:

bt [-h] [-L -d -g -i -p -s -t -u -In | -l] [dirname]

The options are to be interpreted as follows:

h Print a help message and exit.

L Follow symbolic links, if any. Default will be to not follow symbolic links.

t Print information on file type.

p Print permission bits as rwxrwxrwx.

i Print the number of links to file in inode table.

I n Indent by n spaces.

Unix System Calls 2

u Print the UID associated with the file.

g Print the GID associated with the file.

s Print the size of file in bytes. If the size is larger than 1K, indicate the size in KB with a suffix K; if the size is larger than

1M, indicate the size in MB with a suffix M; if the size is larger than 1G, indicate the size in GB with a suffix G.

d Show the time of last modification.

l This option will be used to print information on the file as if the options tpiugs are all specified.

If the user does not specify dirname, run the command using current directory and print the tree accordingly. The output will

appear as follows:

$ ls -I 4 -l proj

proj drwx------ 10 sanjiv faculty 4K Nov 25, 2003

bi_scan drwx------ 3 sanjiv faculty 4K Jul 06, 2004

include drwx------ 3 sanjiv faculty 4K Nov 25, 2003

CVS drwx------ 2 sanjiv faculty 4K Nov 25, 2003

Makefile -rw------- 1 sanjiv faculty 712 Nov 25, 2003

Makefile.Linux -rw------- 1 sanjiv faculty 1K Nov 25, 2003

CVS drwx------ 2 sanjiv faculty 4K Nov 25, 2003

cluster.h -rw------- 1 sanjiv faculty 5K Nov 25, 2003

config.h -rw-r--r-- 1 sanjiv faculty 5K Jan 22, 2004

Entries -rw------- 1 sanjiv faculty 336 Nov 25, 2003

Repository -rw------- 1 sanjiv faculty 24 Nov 25, 2003

Root -rw------- 1 sanjiv faculty 15 Nov 25, 2003

Entries -rw------- 1 sanjiv faculty 650 Nov 25, 2003

Repository -rw------- 1 sanjiv faculty 24 Nov 25, 2003

Root -rw------- 1 sanjiv faculty 15 Nov 25, 2003

With the use of perror, I’ll like some meaningful error messages. The format for error messages should be:

bt: Error: Detailed error message

where bt is actually the name of the executable (argv[0]) and should be appropriately modified if the name of executable is

changed without recompilation.

What to handin

Create your programs in a directory called username.1 where username is your user name on hoare. Once you are done with

everything, remove the executables and object files, and issue the following commands:

% cd

% ˜sanjiv/bin/handin cs4760 1

Do not forget Makefile (with suffix or pattern rules), RCS and README for the assignment. If you do not use RCS, you will

lose 10 points. I want to see the log of how the program files are modified. Therefore, you should use keyword substitution

within RCS inside your source files. 

Reference no: EM1379829

Questions Cloud

Who knew that delilah was acting on behalf of someone : who knew that Delilah was acting on behalf of someone but not whom; also Giorgio, who did not know that Delilah was acting on anyone's behalf. For which contracts, if any, are you liable.
Perspective of provisions of ebusiness services : Discuss and explain the different roles you might think be fulfilled through Web Services and Web Portals. What do you see as main distinctions between two from the perspective of provisions of eBusiness services?
What is probability that delays will occur : Delays are expected if more than three customers arrive during any five-minute period. What is probability that delays will occur.
Discusses more recent implications of borrowing in a tight : As each of you may recall from your previous managerial finance courses, relationship. discusses more recent implications of borrowing in a tight credit market.
Unix system calls and library functions : CS4760 Operating Systems, Unix System Calls and Library Functions, The goal of this homework is to become familiar with the environment in hoare while practising system calls.
How transition from hundreds of independent mom : how such a transition from hundreds of independent mom also pop video stores to a few national chains could have taken place so quickly.
What will breakeven be at optimal price structure : Try a range of average check values from $ 1 to $20, compute corresponding demand also find revenue, costs, profits various prices. What is best price to charge. What will breakeven be at optimal price structure.
What decision should be made according to eol decision rule : What decision should be made according to EOL decision rule. How much should Philip be willing to pay to obtain a market forecast that is 100% accurate.
Designing phase of the project management life cycle : Discuss how does the design phase of the project management life cycle differ in content and importance from the other phases?

Reviews

Write a Review

Operating System Questions & Answers

  Network crashes are hypothesized

Assume we are using Lamport's hash, and Bob's system crashes before receiving Alice's reply to a message.

  Ddos attack on router

Recently had a DDoS attack on border router. Discuss how would you estimate where the attack came from and what would you put in place to save it from happening again?

  Productivity across an organization

Explain how does an company weigh the require to share data to the maximum extent to fully utilize this resource for productivity across an organization.

  Explanation of it networks

While there are difficult security concerns in any isolated computing environment, addition of a network in geographically distributed facilities.

  Election algorithm for bidirectional rings

The ring algorithm supposes that the links are unidirectional and that every procedure sends its message to the neighbor on the right. The main data structure used through the algorithm is the active list,

  Power management settings in bios

Every day at 2PM a client's computer at work reboots itself. You have made sure the power management settings in the BIOS and in the Windows Control Panel are not responsible.

  Question about sarbanes oxley act in the us

Sarbanes-Oxley Act in the United States has greatly increased the compliance obligations of publicly traded corporations.

  Determine the rang of usable ip addresses

Determine the rang of usable IP addresses for the following IP subnet also determine the bradcast address for the subnet?

  What would you do to influence procurement process-platform

What would you do to influence the procurement process for both platforms (hardware & OS, such as desktops, laptops, servers, etc.) and application software?

  Information-level design for college requirements

Database at college is needed to support following requirements. Complete information-level design for this set of requirements. Use your own experience to find out any constraints you require which are not stated in problem

  Ethical issues of web site design

Analyze the user interaction interface of a typical website that you might wish to improve and design in terms of any ethical considerations that might require to be addressed.

  Differentiating internal and external fragmentation

Explain the difference between internal fragmentation and external fragmentation. Which one occurs in paging system? Which one occurs in system using pure segmentation?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd