By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,589 Members | 1,114 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,589 IT Pros & Developers. It's quick & easy.

C library VS (Unix) System calls ?

P: n/a
Hi,

I have a question that deals with the standard c library VS (Unix)
system calls.

The question is: which header files (and functions) are part of the C
library and which header files (and function calls) are part of the
(Unix) system calls.

The cause of my confusion is that for example stdio.h is considered
both as a header file of the C library, as well as a header file of
the (Unix) system calls?

Indeed, all of the following 18 standard C headers are part of the
(Unix) system call headers as well.

The full set of 18 Standard C headers:
<assert.h>, <ctype.h>, <errno.h>, <float.h>, <iso646.h>, <limits.h>,
<locale.h>, <math.h>, <setjmp.h>, <signal.h>, <stdarg.h>, <stddef.h>,
<stdio.h>, <stdlib.h>, <string.h>, <time.h>, <wchar.h>, and
<wctype.h>.

The same headerfiles appear at the definition of the system call
headers:
http://www.unix.org/version3/apis/headers.html

So, which header files (and functions) are part of the C library and
which headers files (and functions) are part of the system calls?

I know that the C library make use of the system calls.

Best regards
Nov 14 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
ds****@hotmail.com (markus) wrote:
I have a question that deals with the standard c library VS (Unix)
system calls.
If you do this, you probably want a copy of the Standard. Order from ISO
or ANSI, or in book from from Wiley & Sons:
<http://www.wiley.com/WileyCDA/WileyTitle/productCd-0470845732.html>.
The question is: which header files (and functions) are part of the C
library and which header files (and function calls) are part of the
(Unix) system calls.
Yup, definitely a job for the Standard.

As a first approximation, you can use the last public draft, found here:
<http://www.open-std.org/jtc1/sc22/wg14/www/docs/n869/>.
I know that the C library make use of the system calls.


Correction: you know that it _usually_ does so. Nothing in the Standard
requires this, though.

Richard
Nov 14 '05 #2

P: n/a
Richard Bos <rl*@hoekstra-uitgeverij.nl> wrote:
ds****@hotmail.com (markus) wrote:
I have a question that deals with the standard c library VS (Unix)
system calls. If you do this, you probably want a copy of the Standard. Order from ISO
or ANSI, or in book from from Wiley & Sons:
<http://www.wiley.com/WileyCDA/WileyTitle/productCd-0470845732.html>. The question is: which header files (and functions) are part of the C
library and which header files (and function calls) are part of the
(Unix) system calls.

Yup, definitely a job for the Standard. As a first approximation, you can use the last public draft, found here:
<http://www.open-std.org/jtc1/sc22/wg14/www/docs/n869/>.


And the UNIX (SUSv3) standard you can get (for free, registration
required) from

http://www.unix.org/version3/online.html

A table of headers, including the C89 and C99 headers, is here:

http://www.unix.org/version3/apis/headers.html

Finally, the complete set of functions is listed on

http://www.unix.org/version3/apis/t_XXX.html

(replace XXX with the numbers between 1 and 11).

Regards, Jens
--
\ Jens Thoms Toerring ___ Je***********@physik.fu-berlin.de
\__________________________ http://www.toerring.de
Nov 14 '05 #3

P: n/a
On Thu, 2004-09-16 at 03:24 -0700, markus wrote:
Hi,

I have a question that deals with the standard c library VS (Unix)
system calls.

The question is: which header files (and functions) are part of the C
library and which header files (and function calls) are part of the
(Unix) system calls.
That seems like a strange question to me. No header files at all are
part of the UNIX system calls. The system calls are kernel traps, which
must be called through assembly language, and thus have nothing to do
with C to begin with.

There are a few functions in the C library that are system call
wrappers, such as read, write, fork, etc. They _are_ not system calls,
however - they _do_ system calls.

Thus, to answer the question: All header files are part of the C
library. Not necessarily the C standard, however (many, such as
unistd.h, are UNIX extensions).
The cause of my confusion is that for example stdio.h is considered
both as a header file of the C library, as well as a header file of
the (Unix) system calls?
Why do you think that stdio.h is "a header file of the UNIX system
calls"? Again, since the syscalls have no header files at all, that's
more or less an oxymoron.
The same headerfiles appear at the definition of the system call
headers:
http://www.unix.org/version3/apis/headers.html


The headers listed there do not have anything at all to do with
syscalls. They only describe which headers are required in a UNIX C
implementation.

Fredrik Tolf
Nov 14 '05 #4

P: n/a

In article <bc**************************@posting.google.com >, ds****@hotmail.com (markus) writes:

I have a question that deals with the standard c library VS (Unix)
system calls.

The question is: which header files (and functions) are part of the C
library and which header files (and function calls) are part of the
(Unix) system calls.
The headers and functions defined by the C standard as part of the C
library are part of the C library.

Unix headers and functions, including system calls, are specified by
the Unix standard - which is currently any of the "Austin Group"
standards: POSIX, SUS, and ISO/IEC 9945, which have been combined
into one document.[1]

However, these two documents overlap, because the Unix standard
includes much of the C standard. Note, though, that the Unix
standard defers to the C standard where they overlap, and claims that
any discrepancies are errors in the Unix standard.

So you should treat any headers and functions defined in the C
standard (of whatever version is appropriate for your purposes) as
part of C, because they are. For other headers and functions, check
the Unix standard: if they appear there, then they're part of Unix;
otherwise, they're implementation-defined.
The cause of my confusion is that for example stdio.h is considered
both as a header file of the C library, as well as a header file of
the (Unix) system calls?


That's because the Unix standard explicitly includes the C library.
The front matter to the Unix standard explains this in more detail.

In general, one standard can incorporate another; they needn't be
mutually exclusive.
1. http://www.opengroup.org/onlinepubs/009695399/
--
Michael Wojcik mi************@microfocus.com

Push up the bottom with your finger, it will puffy and makes stand up.
-- instructions for "swan" from an origami kit
Nov 14 '05 #5

P: n/a
[snips]

On Thu, 16 Sep 2004 17:16:51 +0200, Fredrik Tolf wrote:

There are a few functions in the C library that are system call
wrappers, such as read, write, fork, etc. They _are_ not system calls,
Nor are they C. :)
Thus, to answer the question: All header files are part of the C
library. Not necessarily the C standard, however (many, such as
unistd.h, are UNIX extensions).


Then they'd be third-party extension libraries, rather than the C library,
right?
Nov 14 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.