What's a system call ( Was: 'what' doesn't use perror...)

Andy Sherman andys at ulysses.homer.nj.att.com
Wed May 10 05:00:49 AEST 1989


In article <1350 at frog.UUCP> john at frog.UUCP (John Woods) writes:

   "system call" is not well enough defined to be the determinant of whether
   errno is usable or not (after all, why IS open() a system call, and why
   IS NOT fopen() a system call?).  What you ought to rely on is what a common
   manual documents.

A system call is a subroutine documented in Chapter 2. :-)

Actually, a system call is an entry point which is a one-for-one mapping to a
particular kernel service.  Open(2) is a system call which returns a file
descriptor, which is a kernel data structure.  Fopen(2) on the other hand
returns a non-kernel data structure called a stream, which is typedefed as
FILE in stdio.h.  One field in the structure is the file descriptor, and one
piece of fopen is a call to open to get that file descriptor.  System functions
are the primatives which are used either by themselves or implicitly by 
subroutines which add some value.  (For another example, compare the 
execve(2) system call with the various execxxx(3) subroutines.)
-- 
Andy Sherman/AT&T Bell Laboratories/Murray Hill, NJ           *NEW ADDRESS*
AUDIBLE:  (201) 582-5928                                      *NEW PHONE*
READABLE: andys at ulysses.ATT.COM  or att!ulysses!andys         *NEW EMAIL*
The views and opinions are my own.  Who else would want them? *OLD DISCLAIMER*



More information about the Comp.bugs.sys5 mailing list