Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

need help for operating systems linux project The main() function of your program presents the command line prompt myshell: and then invokes setup() function which

image text in transcribed need help for operating systems linux project

The main() function of your program presents the command line prompt myshell: and then invokes setup() function which waits for the user to enter a command. The setup function (given as an attachment to your project) reads the user's next command and parses it into separate tokens that are used to fill the argument vector for the command to be executed. It can also detect background processes. This program is terminated when the user enters 1D (); and setup function then invokes exit. The contents of the command entered by the user is loaded into the args array. You may assume that a line of input will contain no more than 128 characters or more than 32 distinct arguments. Necessary functionalities and components of your shell is listed below: A. It will take the command as input and will execute that in a new process. When your program gets the program name, it will create a new process using fork() system call, and the new process (child) will execute the program. The child will use the execv() function in the below to execute a new program. Use execv() instead of execup(), which means that you will have to read the PATH environment variable, then search each directory in the PATH for the command file name that appears on the command line. Important Notes: 1. Using the system() function is not allowed for part A! 2. In the project, you need to handle foreground and background processes. When a process run in foreground, your shell should wait for the task to complete, then immediately prompt the user for another command. myshell: gedit A background process is indicated by placing an ampersand ('&') character at the end of an input line. When a process run in background, your shell should not wait for the task to complete, but immediately prompt the user for another command. myshell: gedit & With background processes, you will need to modify your use of the wait() system call so that you check the process id that it returns

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Influences on Nonverbal Communication?

Answered: 1 week ago