473,385 Members | 1,185 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

C library VS (Unix) System calls ?

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
5 3495
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
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
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

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
[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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: jrefactors | last post by:
If the C programs have UNIX system calls such as fork(), alarm(), etc.., we should call it UNIX programs, not traditional C programs? We couldn't compile the programs with system calls using VC++...
4
by: christopherlmarshall | last post by:
I have gotten in the habit of using strings to manage character buffers that I pass in to unix system calls. For example, suppose I want to create a character buffer to use with the "write"...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.