LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 09-14-2008, 01:41 AM   #1
goldeneagle1234
LQ Newbie
 
Registered: Sep 2008
Posts: 10

Rep: Reputation: 0
Unhappy Unix system calls and c library?


during file handling using c on red hat we need to include headers such as unistd.h,fcntl.h,sys/type.h etc ....then only we can use func like open,close,write,read....ARE THESE FUNC DIRECT SYSTEM CALLS OR ARE THEY DEFINED IN ABOVE LIBRARIES OF C IN WHICH ACTUAL SYSTEM CALLS ARE MADE ?????
for the later case if possible also give the probable system calls in the definition...
for former case if they r system calls why we need to include headers in c prog.

similarly....is pthread_create under pthread.h lib. system call or again a func defined in above lib????

and what about fork in c prog on red hat

Last edited by goldeneagle1234; 09-14-2008 at 01:57 AM.
 
Old 09-14-2008, 02:24 AM   #2
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,040

Rep: Reputation: 373Reputation: 373Reputation: 373Reputation: 373
Quote:
Originally Posted by goldeneagle1234 View Post
during file handling using c on red hat we need to include headers such as unistd.h,fcntl.h,sys/type.h etc ....then only we can use func like open,close,write,read....ARE THESE FUNC DIRECT SYSTEM CALLS OR ARE THEY DEFINED IN ABOVE LIBRARIES OF C IN WHICH ACTUAL SYSTEM CALLS ARE MADE ?????
for the later case if possible also give the probable system calls in the definition...
for former case if they r system calls why we need to include headers in c prog.

similarly....is pthread_create under pthread.h lib. system call or again a func defined in above lib????

and what about fork in c prog on red hat
I don't know what is it that you are exactly asking.

Every function that you use in a C program is defined elsewhere in a .h file, and present in a library which was compiled from a regular .c containing the source code, against which your program will link (might it be a standard C lib or a 3rd party library).

Whether this functions will be complicated C functions to do something, or wrappers to a more low level system thing is up to the concrete function and the implementation. You would need to look at the concrete piece of course code to know that.

Red Hat is out of the formula here. Gcc is the same under Red Hat or elsewhere.
 
Old 09-14-2008, 09:23 PM   #3
sundialsvcs
Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 5,377

Rep: Reputation: 1108Reputation: 1108Reputation: 1108Reputation: 1108Reputation: 1108Reputation: 1108Reputation: 1108Reputation: 1108Reputation: 1108
When software designers write software (for the Unix/Linux/OSX worlds), they want it to run in as many environments as possible, and with a minimum of fuss. (Read: expen$e!)

Their software might find itself running on a Windows machine, a Macintosh, a Linux computer, an IBM Mainframe, or a ##CLASSIFIED## (no kidding...), and the designers simply want it to "just work" in all cases.

So... the software development community builds libraries that "do all sorts of useful things," and they "port" those libraries to all the various environments (including ##CLASSIFIED##) where they need to be able to "do all of these sorts of useful things."

In all of these various environments, these libraries present exactly the same, consistent, "friendly face" to every application program that comes calling. Their implementation, from one particular set of hardware to another (and from one operating system to another!) will of-course "be totally different," but the very-essential point is: because of the library, the application program does not have to care!

Quote:
"Oh... 'this' library-function is implemented by 'that' system-call on 'that' particular piece of hardware? Uhh... cool!"
"And your point is???"
"Isn't the name of this game that I do not have to care about 'this' particular piece of hardware...?"
If the application directs all of its requests only to "the library," and is able to take for granted that "the library" exists, and that it is properly installed for whatever environment (including ##CLASSIFIED##) it happens to be running in, then ... "it 'just works.'"

And that, I assure you, saves many hair-follicles!

Remember: Linux, right out of the box, runs on more than twenty distinctly-different varieties of (non-##CLASSIFIED##...) hardware!

Last edited by sundialsvcs; 09-14-2008 at 09:25 PM.
 
  


Reply

Tags
calls, library, system, unix


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Unix system calls with c pengui Programming 13 07-29-2012 11:54 PM
how does java calls the system calls which are written in c babu198649 Linux - General 3 12-05-2011 03:40 AM
[B]Netware Directory Services Calls Library required for Linux/Solaris[/B] ravisankar_vulimiri Linux - Newbie 0 07-25-2008 02:23 PM
How to Write Own Shell in Unix using System Calls? indian Programming 2 08-05-2004 04:06 AM
tracking library / OS calls chakkerz Linux - General 1 09-01-2003 05:21 PM


All times are GMT -5. The time now is 03:20 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration