search instagram arrow-down




System Programming

System Call

System programming starts and ends with the system call. Syscalls are function invocation made from user space (Eg. your text editor, favorite game etc) into the kernel space (The core internal of the system) in order to request some service or resource from the operating system.
Linux implements far fewer system call than any other operating system. X86_64 Linux uses around 350 syscalls, while Microsoft Windows uses thousands of syscalls.

Kernel provides its services to the user space programs with a set of tightly defined entry points know as system calls. Program don’t make system call directly, they do so by thin wrapper routines in the standard library called Glibc.

#include <fcntl.h>
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
int main()
	int fd=open("/tmp/foo.txt",O_CREAT | O_WRONLY, 0600);
	if (fd<0){
		printf("There is error code: %d",errno);
	write(fd,"My First System Program\n",24);
Leave a Reply
Your email address will not be published. Required fields are marked *

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: