Linux.com

intro.2

INTRO

Section: Linux Programmer's Manual (2)
Updated: 2007-10-23
Index Return to Main Contents
 

NAME

intro - Introduction to system calls  

DESCRIPTION

Section 2 of the manual describes the Linux system calls. A system call is an entry point into the Linux kernel. Usually, system calls are not invoked directly: instead, most system calls have corresponding C library wrapper functions which perform the steps required (e.g., trapping to kernel mode) in order to invoke the system call. Thus, making a system call looks the same as invoking a normal library function.

For a list of the Linux system calls, see syscalls(2).  

RETURN VALUE

On error, most system calls return a negative error number (i.e., the negated value of one of the constants described in errno(3)). The C library wrapper hides this detail from the caller: when a system call returns a negative value, the wrapper copies the absolute value into the errno variable, and returns -1 as the return value of the wrapper.

The value returned by a successful system call depends on the call. Many system calls return 0 on success, but some can return non-zero values from a successful call. The details are described in the individual manual pages.

In some cases, the programmer must define a feature test macro in order to obtain the declaration of a system call from the header file specified in the man page SYNOPSIS section. In such cases, the required macro is described in the man page. For further information on feature test macros, see feature_test_macros(7).  

CONFORMING TO

Certain terms and abbreviations are used to indicate Unix variants and standards to which calls in this section conform. See standards(7).  

NOTES

 

Calling Directly

In most cases, it is unnecessary to invoke a system call directly, but there are times when the Standard C library does not implement a nice wrapper function for you. In this case, the programmer must manually invoke the system call using syscall(2). Historically, this was also possible using one of the _syscall macros described in _syscall(2).  

Authors and Copyright Terms

Look at the header of the manual page source for the author(s) and copyright conditions. Note that these can be different from page to page!  

SEE ALSO

_syscall(2), syscall(2), errno(3), feature_test_macros(7), standards(7)  

COLOPHON

This page is part of release 3.21 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/.


 

Index

NAME
DESCRIPTION
RETURN VALUE
CONFORMING TO
NOTES
Calling Directly
Authors and Copyright Terms
SEE ALSO
COLOPHON

 

Comments

Subscribe to Comments Feed

Upcoming Linux Foundation Courses

  1. LFS426 Linux Performance Tuning
    08 Sep » 11 Sep - New York
    Details
  2. LFS520 OpenStack Cloud Architecture and Deployment
    08 Sep » 11 Sep - Virtual
    Details
  3. LFD320 Linux Kernel Internals and Debugging
    15 Sep » 19 Sep - Virtual
    Details

View All Upcoming Courses

Become an Individual Member
Check out the Friday Funnies

Sign Up For the Linux.com Newsletter


Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board