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)
- Can someone help me with this question?? It will be highly appreciatedtedarrow_forwardWrite 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_forwardWrite a Java function that computes the square root of a double number using the Newton-Raphson method. Your function should throw an exception of your own creation if the supplied double is negative.arrow_forward
- Implement the following functions. Each function deals with null terminated C-Style strings. You can assume that any char array passed into the functions will contain null terminated data. Place all of the functions in a single file and then (in the same file) create a main() function that tests the functions thoroughly. You will lose points if you don't show enough examples to convince me that your function works in all cases. Please note the following: You may not use any variables of type string. This means that you should not #include <string>. Also, you may not use any c-string functions other than strlen(). If you use any other c-string functions, you will not get credit. Note, however, that functions such as toupper(), tolower(), isalpha(), isspace(), and swap() are NOT c-string functions, so you can use them. Also note that this prohibition is only for the functions that you are assigned to write. You can use whatever you want in your main() function that tests the…arrow_forwardImplement the following functions. Each function deals with null terminated C-Style strings. You can assume that any char array passed into the functions will contain null terminated data. Place all of the functions in a single file and then (in the same file) create a main() function that tests the functions thoroughly. You will lose points if you don't show enough examples to convince me that your function works in all cases. Please note the following: You may not use any variables of type string. This means that you should not #include <string>. Also, you may not use any c-string functions other than strlen(). If you use any other c-string functions, you will not get credit. Note, however, that functions such as toupper(), tolower(), isalpha(), isspace(), and swap() are NOT c-string functions, so you can use them. Also note that this prohibition is only for the functions that you are assigned to write. You can use whatever you want in your main() function that tests the…arrow_forwardIN JAVA, DO THESE INTERFACES IN POINT AND LINE CLASSESarrow_forward
- Once the modelling has been run, the user should have the option to rerun it. Each time it is run, the output should be saved to disk with the following filename: report_s.txt, where s is a number returned by int(time. time() ) (time. time() is a function from the time module, which you will need to import). This returns the number of seconds since 1/1/70 so that each value of s will be a unique timestamp. For example, the file may look like this: report_1586386072.txt. Part 2: In addition, your program must be able to visualise the information. The user should be able to choose the year and see two-liner graphs based on monthly averages of trade volume and monthly averages of the closing valuearrow_forwardPlease write a full code in JAVA for this: A function foo has k integers as input arguments, i.e., foo(int n1, int n2, ..., int nk). Each argument may belong to a different equivalence class, which are stored in an Eq.txt file. In the file, the nth row describes the nth input. Take the second row for example. The data 1, 10; 11, 20; 21, 30 indicates that n2 has three equivalence classes separated by the semi-colons. There is an internal method “int check(int n)” that returns the equivalence class n is in. The result of check(n2 = 3) will be 1 and check(n2 = 25) will be 3. Regarding the function foo, it computes the sum of the returned values by the check function for all input arguments.Follow the Eq.txt file to automatically create test cases for Strong Normal Equivalence class testing. The input argument values are randomly generated. Store your prepared test cases to a test.txt file. Each test case comes with an expected output at the end. All values are delimited by a comma.…arrow_forwardRock-paper-scissors is a game for two players. Each player chooses an action without knowledge ofthe other’s choice. If the players choose the same action then there is a draw. Otherwise the winneris determined by the following rules: paper beats rock, rock beats scissors, and scissors beats paper. you are going to make a playable Rock-Paper-Scissors game and consider multiplayer tournaments. • Please make it a single Haskell file • Please put comments in your code to show which question you are answering with each piece ofcode. • You may create auxiliary functions if you like. You may use library functions from Haskell’sstandard library.• Please limit your line lengths to 100 characters max.Please use the following two data types which you can copy-and-paste into your code.data Action = Rock | Paper | Scissors deriving (Eq, Show)data Outcome = Player1Win | Player2Win | Draw deriving ShowAction represents a player’s chosen action and Outcome represents the outcome of playing a gamearrow_forward
- Note: You must use proper naming convention for the Java code and you need to briefly elaborate keywords, concept, and logic in your own words. Task 2.2. Using the same scenario, implement (in Java) a console application for writing data to a sequential text file with a formatter class in Java. Implement createFile() method - To open/create a new file named as 'mec.txť with explanations of the methods involved. Implement writeRecord() method – User enter the employee name, employee id, gross salary, tax rate, income tax and net salary from the keyboard and write/add these values to the file 'mec.txt' with explanations of the methods involved. The input fields must be validated as necessary. Implement closeFile() method – Close the file with explanations of the methods involved. Note: You must use proper naming convention for the Java code and you need to briefly elaborate keywords, concept, and logic in your own words. Task 3 Dranare a ranort to nrocent the work done from taek 2 The…arrow_forwardIn this assignment, you will write a program that readsa list of people from a file, create a HashSet of the people, and print the people in the HashSet.The input filename ispassed in as a command line argument.•The program must implement a main class, and a Person class.•A template for the Person class is provided.A Person has a name and an address, both Strings.•If the input file name is not provided, your program should an error message and exit, e.g., Usage: java FuAssignment10/FuMain inputfile•If the specified input file does not exist or cannot be opened, your program should an error message and exit, e.g.,File abc.txt does not existor cannot be opened!•The input file lists one person per line. Each line contains aname and an address, separated by a comma, “,”.For example, the following are in a sample file students.txt:James Bond, 111 Main StTayer Smoke, 2334 Murry LnDavid Jones, 302 Toast AveAbby Wasch, 84 Sunny PlJames Bond, 111 Main St•Yourprogram should read each line,…arrow_forwardWrite a function that accepts an integer parameter and returns its integer square root. The function should throw an exception if it is passed an integer that is not a perfect square. Demonstrate the function with a suitable driver program.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