Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please do this task correctly do not copy from other chegg answers Thank you Task 3: Environment Variables and execve() In this task,

"Please do this task correctly "

"do not copy from other chegg answers "

Thank you

image text in transcribed

Task 3: Environment Variables and execve() In this task, we study how environment variables are affected when a new program is executed via execve ( ). The function execve ( ) calls a system call to load a new command and execute it; this function never returns. No new process is created; instead, the calling process's text, data, bss, and stack are overwritten by that of the program loaded. Essentially, execve () runs the new program inside the calling process. We are interested in what happens to the environment variables; are they automatically inherited by the new program? - Step 1. Please compile and run the myenv. c program, and describe your observation. This program simply executes a program called /usr/bin/env, which prints out the environment variables of the current process. \#include extern char **environ; int main() char argv [2]; argv 0]= "/usr/bin/env"; argv[1] = NULL; execve("/usr/bin/env", argv, NULL); // Line 1 return 0; \} - Step 2. Change the invocation of execve( ) in Line 1 to the following; describe your observation: execve("/usr/bin/env", argv, environ); - Step 3. Please draw your conclusion regarding how the new program gets its environment variables

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

5. Identify the logical fallacies, deceptive forms of reasoning

Answered: 1 week ago

Question

6. Choose an appropriate organizational strategy for your speech

Answered: 1 week ago