473,761 Members | 10,365 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3546
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***********@p hysik.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
3451
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++ compiler. I need to compile it under UNIX platform. correct? any other alternatives?? Please advise. Thanks!!
4
3434
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" system call. string buf(1024); int fd; write(fd,(void *)(&buf),buf.size());
0
9345
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9957
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9905
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9775
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6609
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5229
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5373
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3881
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2752
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.