Exploring Basic Linux System Calls
Classified in Computers
Written on in
English with a size of 521.58 KB
Problem Statement
Explore the usage of basic Linux system calls.
Process Management System Calls
The system calls to manage processes are:
fork(): Used to create a new process.exec(): Executes a new program.wait(): Waits until the process finishes execution.exit(): Exits from the process.
System calls used to get process IDs are:
getpid(): Gets the unique process ID of the process.getppid(): Gets the parent process's unique ID.
Stat System Call
The stat system call retrieves information about files, specifically from their inodes. For instance, to get a file's size and name, you would typically use stat. Let's illustrate with a C code snippet (src/ls1.c):
#include<stdio.h>
#include<dirent.h>
#include<cstdlib>
struct dirent *dptr;... Continue reading "Exploring Basic Linux System Calls" »