Advanced Computer Networks Lab

Course: MTech CSE

Lab Report : Lab -1

Submitted by :
Shantanu Gontia Roll no: 120913010 1st Year MTech CSE Date : 03rd August, 2012

Summary :
The two programs submitted, respectively demonstrates the use of unix system calls in C on Unix/Linux systems. First program fileCopy.c first creates a file and then copies it to another using file system calls and the second program, fork.c creates a child process to call fileCopy.c.

In the first program, fileCopy.c: 1. First the program creates a file usig creat() system call. 2. It then takes input the data from the user vai consol. 3. Then it opens the file and writes the data into it using write() system call. 4. After writing the data the file is read using read() system call. 5. The data read is finally is copied into another file. 6. Program terminates. In the second program, fork.c 1. The program first call the fork() ystem call to generate the child process\ 2. Then in the child process the execve() system call, calls the above program(fileCopy.c) 3. Program terminates.

The objective of the experiments was to write a program to copy the file and calling the program from child process of second one. The results of above programs are as per the expectations and the programs are executing successfully.

After the successful completion of the program i learned the implementation of the unix system calls using C programs. I leaned how to create a child process and calling other executable files from a program.

Sign up to vote on this title
UsefulNot useful