Consider the following invocation of the fstatcheck program, from Problem 10.8:
linux> fstatcheck 3 < foo.txt
You might expect that this invocation of fstatcheck would fetch and display metadata for file foo.txt. However, when we run it on our system, it fails with a "bad file descriptor." Given this behavior, fill in the pseudocode that the·shell must·be executing between the fork and execve calls:
if (Fork() == 0) { /* child */
/* What code is the shell executing right here? */
Execve(“fstatcheck”, argv, envp);
}
Trending nowThis is a popular solution!
Learn your wayIncludes step-by-step video
Chapter 10 Solutions
Computer Systems: A Programmer's Perspective (3rd Edition)
Additional Engineering Textbook Solutions
C How to Program (8th Edition)
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
C Programming Language
Web Development and Design Foundations with HTML5 (9th Edition) (What's New in Computer Science)
C++ How to Program (10th Edition)
- Use the Bash shell for the completion of this project.Develop a shell scripting application that allows the user to perform some advanced mathematicaloperations. Task 2: Find the terms of any linear sequence given by the rule Term = a*n + b, where a and b are integers specified by the user and n is a positive integer and print them in order (for example if the user inputs a=3, b=-4, the first few terms that should be printed are -1, 2, 5, 8, 11…). The user also will specify how many terms the program should print. In addition, the program should print the sum of terms found and a count of how many odd terms were found.arrow_forwardThe block is practically a square-size placeholder for the Tile objects. But not all the spots are necessarily occupied. When the block is generated, we randomly pick the spots that will be filled in with tiles. All the tiles of a block must have the same color. write the code for these functions below private DynamicArray<DynamicArray<Tile>> block; // the internal storage of the block data public Block(int y, int x, int size) // this contructor creates a 2D placeholder of null value; //these values will be populated later with calls to setTile() public Block(int y, int x, int size, byte color) // overloaded constuctor that creates a 2D matrix with actual tile objects; //no need to call setTile afterwardsarrow_forwardWrite a C/C++ program that: Writes a function, readFile(), that reads the content of the provided text file “stnumbers.txt” and stores it in an array of Student structs. The function receives as parameter an array of type Student structs. The number of lines that was read from the text file must be returned to the calling statement. If the file cannot be read, an error message should be displayed. stnumbers.txt textfile is given below Peterson20570856Johnson12345678Suku87654321Westley12345678Venter87654321Mokoena79012400Makubela29813360Botha30489059Bradley30350069arrow_forward
- Write a program that reads movie data from a CSV (comma separated values) file and output the data in a formatted table. The program first reads the name of the CSV file from the user. The program then reads the CSV file and outputs the contents according to the following requirements: • Each row contains the title, rating, and all showtimes of a unique movie. • A space is placed before and after each vertical separator (I) in each row. • Column 1 displays the movie titles and is left justified with a minimum of 44 characters. . If the movie title has more than 44 characters, output the first 44 characters only. • Column 2 displays the movie ratings and is right justified with a minimum of 5 characters. • Column 3 displays all the showtimes of the same movie, separated by a space. Each row of the CSV file contains the showtime, title, and rating of a movie. Assume data of the same movie are grouped in consecutive rows. Ex: If the input of the program is: movies.csv and the contents of…arrow_forwardPlease help me with the assignment below The assignment: Make a telephone lookup program. Read a data set of 1,000 names and telephone numbers from a file that contains the numbers in random order. Handle lookups by name and also reverse lookups by phone number. Use a binary search for both lookups. This assignment needs a resource class and a driver class. The resource class and the driver class will be in two separate files. The driver class needs to have only 5 or 7 lines of code. The code needs to be written in Java. Please help me with exactly what I asked for help.arrow_forwardWrite a function getQuestions that accepts a single parameter: filename, which is the name of a txt file. Your function should assume that the text file is formatted in the following way, as a series of questions and answers, with a question on one line, and the answer to the question on the following line, as below ---Sample File--- Why is the sky blue? Because air is blue. How long does it take light to reach Earth from the Sun? About eight minutes. What is the dumbest question you've ever been asked? That one. ---End Sample File--- Your function should create and return a dictionary where the keys are the questions and the values are respective answers (so the above sample file would result in a dictionary with three key-value pairs, one per question).arrow_forward
- Write a PYTHON code with at least 2 functions (one should call the other). The function which is called by the first function should also be able to be called directly. Execute these functions with various parameters such that you can demonstrate the following: Each function should have some debug code so you can trace calls to the functions and activity within the functions. Each should handle at least 2 types of exceptions (both shouldn't handle the same exceptions). The function called by the first one should, at some point, generate a division by zero error, but should NOT handle this error. The function that calls the division by zero function should handle a division by zero error. Catch one error and raise a different one. Have some finally code (perhaps with some debugging output) Demonstrate & explain: call the division by zero function both from your main program and from the other function. show that the exception isn't handled by the function itself but by the other…arrow_forwardImplement a function writeEmpToFile that takes two arguments: a struct Employee pointer and a FILE *. It should write each field in order as an appropriate type. Note that you will probably want to write a length of the name before you write the characters of the name. By doing this, when you write the load function below, you can read the length of the string and use it to malloc a buffer of the proper size to hold the name. Because of the embedded name pointer, you CAN NOT write the Employee struct as a single struct. You will need to write it out field by field. You will want to write this as a binary file, not as a text file. Implement a SAVE command in your main loop that will save all the employees out to a file. The SAVE command should ask for a file name, similar to the way your FIND command asked for a name. Below is the work I have done so far that is required from the image but I have not been able to finish it and I need assistance with making the final changes that…arrow_forwardMy Question starts here In the code linked Implement a function readEmpFromFile that takes a FILE * as the only argument and returns a pointer to a struct employee. This function should read the information from the file (reversing what writeEmpToFile does), create a new employee and fill in the data. If the FILE has no more info (is at end of file), this function should return NULL. This function must also ensure any employee actually created (not the NULL) is added to the array (as is done in createEmployee). Change main to load employees from a file if a command line argument is given to the program (using your readEmpFromFile function you just wrote). Question ends here To make it easier so that you do not have to go through the entire code I'm going to put writeEmpToFile function right here after the question but if you still need to look at the full code to get an understanding of what you are working with its linked at the bottom void writeEmpToFile(Employee *emp, FILE…arrow_forward
- Write a function in python named "read_words" that declares a parameter for a filename and returns a collection of unique words in the file. Even though words.txt contains a single word per line, you should not assume that this is true of every file. For example, if the line is a sentence, you should split the line into individual words before storing each word in your collection. Handle any errors that occur by printing a detailed error message. Hint: the Python set works like Java's HashSet.arrow_forwardConsider this scenario: An exception is thrown when a function is called. What are the three things that the function can do?arrow_forwardConsider the following fictitious scenario: A function throws an exception. What are the three possible functions of the function?.arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education