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)
- Let a and b denote object modules or static libraries in thecurrent directory, and let a→b denote that a depends on b, inthe sense that b defines a symbol that is referenced by a. Foreach of the following scenarios, show the minimal commandline (i.e., one with the least number of object file and libraryarguments) that will allow the static linker to resolve all symbolreferences.A. p.o → libx.aB. p.o → libx.a → liby.aC. p.o → libx.a → liby.a and liby.a → libx.a → p.oarrow_forwardThe following Python code returns this error, and I have no idea how to fix it. Any and all help would be appreciated Traceback (most recent call last): File "D:\Grand Canyon University\CST_580\Topic 4\project 6a.py", line 40, in <module> agent.move() File "D:\Grand Canyon University\CST_580\Topic 4\project 6a.py", line 13, in move new_location = self.current_location + direction ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~TypeError: unsupported operand type(s) for +: 'int' and 'str' <start of Python code> import random class Agent: def __init__(self, start_location, destination_location): self.current_location = start_location self.destination_location = destination_location def move(self): # Randomly choose a direction to move in direction = random.choice(['up', 'down', 'left', 'right']) # Move in the chosen direction new_location = self.current_location + direction # Calculate the distance to the…arrow_forwardBy using Linux (Centos 7 or 8) develop a C program to apply the memory times and times, run with this shellprogram, then show the MemToal,MemFree,Active with excel file. Here are the codes for reference. Code no.1: #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> main(int argc, char *argv[]) { void * p[100]; int i,times,msize; if(argc!=3) { times=20; msize=1024; } else { sscanf(argv[1],"%d",×); sscanf(argv[2],"%d",&msize); if(msize>10240) msize=10240; msize=1024*msize; if(times>100) times=100; } for( i=0; i<times; i++) {…arrow_forward
- a) Distinguish between a stub and skeleton in Remote Method Invocation (RMI) implementation, outlining at least three functionalities that each partakes when invoked. b) Exception handling is a requirement that any developer needs to put into consideration whenever there is any code he/she writes bound to throw an exception. Describe the four components that could be used to catch and handle an exception, and using Java code snippets, write code that will show all the four components and three exception objects relevant to the chosen scenario caught in practice.arrow_forwardQuestion 3 Explain the difference between a script file and a function file i) Write a program using MATLAB that calculates the average, å = 1 N x x1 N i =1 and the standard deviation for a set of values (X), S = Make a script file ‘date.m’ with which the user can call up de desired date. How to solve the problem Ask the user (with the command >> input if he/she wants to know the date (1=yes, 2=no). - If the answer is ‘yes’ the date must be displayed (>> date). If the answer is ‘no’ display on the screen that the user does not want to know the date (>> disp) Write the m-file in MATLAB. Given the function prototype, Function [out] = examfcn (in) Write four (4) different calls to the function, each of…arrow_forwardUSE PYTHON Before there were emoji, there were emoticonsLinks to an external site., whereby text like :) was a happy face and text like :( was a sad face. Nowadays, programs tend to convert emoticons to emoji automatically! In a file called faces.py, implement a function called convert that accepts a str as input and returns that same input with any :) converted to ? (otherwise known as a slightly smiling faceLinks to an external site.) and any :( converted to ? (otherwise known as a slightly frowning faceLinks to an external site.). All other text should be returned unchanged. Then, in that same file, implement a function called main that prompts the user for input, calls convert on that input, and prints the result. You’re welcome, but not required, to prompt the user explicitly, as by passing a str of your own as an argument to input. Be sure to call main at the bottom of your file. ( Please see attached file for Demo) use PYTHONarrow_forward
- Consider the following C fragment. The program is stopped immediately after the assignment to point.y and we know that &point is 0x0804A010. What would gdb print in response to x/8bx 0x0804A010? (Note: The /8bx means print eight bytes and I did this linux.cs.wwu.edu.) re struct point_st { int x; int y; }; void function() { struct point_st point; point.x = 0x01234567; point.y = 0x89ABCDEF; ... } a. 08040A010: 01 23 45 67 89 AB CD EF b. 08040A010: 67 45 23 01 EF CD AB 89 c. 08040A010: 89 AB CD EF 01 23 45 67 d. 08040A010: EF CD AB 89 67 45 23 01arrow_forwardWrite a C program, called reverse, using standard I/O functions, to take a file as inputthen copies it to another file in reverse order. That is, the last byte becomes the first,the byte just before the last one becomes the second, etc.The program call should look like:reverse fileIn fileOutarrow_forwardDuring the sockets lab we cast the second parameter from a struct sockaddr_in to a struct sockaddr. struct sockaddr_in address; /* ... */ bind(server_fd, (struct sockaddr*)&address, sizeof(address)) This provides a limited form of polymorphism: bind only needs the first few fields of its struct, and both struct sockaddr_in and struct sockaddr have the same fields at those addresses. Consider the following example: typedef struct { float x; float y; float z; } point3D; typedef struct { float x; float y; } point2D; float distance(point2D *a1, point2D *a2) { /* ... */ } int main() { point2D a = { .x = 2.1, .y = 3.0 }; point3D b = { .x = 4.1, .y = 4.3, .z = 4.0 }; // Call distance function with a and b } How would you pass a and b to the distance function? If several work, pick one that will not create warnings. A. distance(a, b); B. distance(a, (point2D)b); C. distance(&a, &b); D. distance(&a, &(point2D)b); E. distance(&a, (point2D*)&b); F. none of…arrow_forward
- with java lambda functions with these operations. And efficient programming. This assignment is not meant to be exhausting, in the ideal situation, you will only have to write 25 lines of code to complete this entire assignment. You are to fill in the code in the StreamsHomeWork.java file. You may find a description of what is to be performed for each function below or in that java file provided. Please keep in mind that all the functions have a timelimit in the milliseconds, the exact time for each function is documented below. Please fill in the functional code in the StreamsHomeWork.java file and submit the StreamsHomeWork.java file to Grader Than. Note: The last two functions of the assignment can be used to help you select winning words in the Ghost Project. The last function named "filterLosers" is not required. I added it as extra credit. If you can solve it with an algorithm that does not work in less than O(n^2) time then your Ghost application will be nearly unstoppable.…arrow_forwardwrite a program to encrypt outgoing messages and decrypt incoming messages using a Vigenere Cypher. Parse a string of words from a file into tokens using the strtok_s command with pointers. In your “client” code, you will need to declare a character array that will hold 1000 characters. Using the character array, your client should call the function strtok_s() to tokenize the character array into separate words. There should be two classes: Vigenere and Message. Vigenere Class: Data Member: string key Functions: Vigenere() ßconstructor void setKey(string k) string getKey() string toUpperCase(string k) string encrypt(string word) string decrypt(string word) The class should have a one-argument constructor. The encryption key must be in all capital letters. Use the following code for the encrypt and decrypt functions in your Vigenere class. string Vigenere::encrypt(string word){ string output; for (int i = 0, j = 0; i < word.length(); ++i)…arrow_forwardComputer Science For each of the code snippet given below, identify the error and then write code after fixing the error. Given code is the simulation of grep -v command. -v prints all lines that do not match a specific pattern. void grep_inverse(char *filename, char *str) { FILE *fp; char buf[buff_size]; fp = fopen(filename, "r"); if(!fp) { perror(filename); } else { while (fgets(buf, buff_size, fp) != NULL) { if ((strstr (buf, str)) != NULL) printf("%s", buf); } } fclose(fp); }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