SP - Lab 3 Worksheet
SP - Lab 3 Worksheet
SP - Lab 3 Worksheet
1
new program (.out file) to be executed and the file whose permissions are to be
changed must be specified as a command line arguments.
Steps to be followed:
File Creation: Open a text editor and create a new file, for example, Lab3_BITS_ID.c.
Include Necessary Headers: Add the required header files for system calls and standard
functions.
Write the Main Function: Start by defining the main function using command line arguments.
Process Creation: Use the fork system call to create a child process.
Change File Permissions: In the child process, use the chmod system call to change the
permissions of a file.
Executing a New Program in the Child Process: Use an exec family function (e.g., execl)
to run a new program.
Process Synchronization: Wait for the Child Process in the Parent Process using the wait
system call to wait for the child process to complete.
Task to be performed:
Task 3: Save the program and quit from the vi or vim editor.
cc -o <Obj_Filename> <Src_Filename>
./<Obj_Filename> <filename whose permissions are to be changed > <Pathname of the file to be executed>
Task 6: Test the program for user executables and system command executables.
2
Submission guidelines:
The student should be instructed to take a snapshot of the screen to showcase their usage
of the Nuvepro lab portal along with the required codebase and other needed information.
A sample is shown below:
Table of Inspection Report:
******