Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 09-29-2014, 11:21 AM   #1
LQ Newbie
Registered: Sep 2014
Posts: 2

Rep: Reputation: Disabled
Linux System Calls

I want to learn about programming a linux system call using C language. I want to know a good source which teaches both code and theory in detail and explanatory manner
Old 09-29-2014, 11:27 AM   #2
LQ Guru
Registered: Dec 2008
Location: Westgate-on-Sea, Kent, UK
Distribution: Debian Testing Amd64
Posts: 5,465

Rep: Reputation: Disabled
This link should get you started. After that you can have a look at this document.
Old 09-29-2014, 12:48 PM   #3
LQ Newbie
Registered: Sep 2014
Posts: 2

Original Poster
Rep: Reputation: Disabled
Here he/she just includes libraries/API and calls function access() rather than showing the function(System cAll) defintion. Refer to code if you need

#include <errno.h>
#include <stdio.h>
#include <unistd.h>
int main (int argc, char* argv[])
char* path = argv[1];
int rval;
/* Check file existence. */
rval = access (path, F_OK);
if (rval == 0)
printf (%s exists\n, path);
else {
if (errno == ENOENT)
printf (%s does not exist\n, path);
else if (errno == EACCES)
printf (%s is not accessible\n, path);
return 0;
/* Check read access. */
rval = access (path, R_OK);
if (rval == 0)
printf (%s is readable\n, path);
printf (%s is not readable (access denied)\n, path);
/* Check write access. */
rval = access (path, W_OK);
if (rval == 0)
printf (%s is writable\n, path);
else if (errno == EACCES)
printf (%s is not writable (access denied)\n, path);
else if (errno == EROFS)
printf (%s is not writable (read-only filesystem)\n, path);
return 0;


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Linux System Calls mopinion Programming 17 12-05-2011 06:56 AM
how does java calls the system calls which are written in c babu198649 Linux - General 3 12-05-2011 04:40 AM
linux system calls rblampain Programming 3 02-25-2010 12:06 AM
LINUX System calls Jitin Programming 1 08-02-2006 09:47 PM
linux system calls blanny Programming 4 03-04-2006 01:15 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:55 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration