linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* kernel provided system call is an API?
@ 2007-10-26 16:25 Shriramana Sharma
  2007-10-26 21:05 ` Glynn Clements
  0 siblings, 1 reply; 7+ messages in thread
From: Shriramana Sharma @ 2007-10-26 16:25 UTC (permalink / raw)
  To: Linux C Programming List

Hello friends.

1. Can the system calls provided by the kernel be considered an API?

2. When an app using system calls is executed, would any code in the 
kernel be executed?

Shriramana Sharma.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: kernel provided system call is an API?
  2007-10-26 16:25 kernel provided system call is an API? Shriramana Sharma
@ 2007-10-26 21:05 ` Glynn Clements
  2007-10-27  0:42   ` Shriramana Sharma
  0 siblings, 1 reply; 7+ messages in thread
From: Glynn Clements @ 2007-10-26 21:05 UTC (permalink / raw)
  To: Shriramana Sharma; +Cc: Linux C Programming List


Shriramana Sharma wrote:

> 1. Can the system calls provided by the kernel be considered an API?

System calls aren't strictly an *application* programming interface.
Applications are supposed to use the libc functions.

OTOH, the term "system call" is often used to refer to both of the
actual system call and the corresponding libc function.

IOW, read() is an API, syscall(SYS_read, ...) isn't.

> 2. When an app using system calls is executed, would any code in the 
> kernel be executed?

Yes. That's the point of system calls.

-- 
Glynn Clements <glynn@gclements.plus.com>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: kernel provided system call is an API?
  2007-10-26 21:05 ` Glynn Clements
@ 2007-10-27  0:42   ` Shriramana Sharma
  2007-10-27  1:33     ` Glynn Clements
  0 siblings, 1 reply; 7+ messages in thread
From: Shriramana Sharma @ 2007-10-27  0:42 UTC (permalink / raw)
  To: Linux C Programming List

Glynn Clements wrote:
> Shriramana Sharma wrote:
> 
>> 1. Can the system calls provided by the kernel be considered an API?
> 
> System calls aren't strictly an *application* programming interface.
> Applications are supposed to use the libc functions.

OK so is it at least a "programming interface"?

Thanks.

Shriramana Sharma.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: kernel provided system call is an API?
  2007-10-27  0:42   ` Shriramana Sharma
@ 2007-10-27  1:33     ` Glynn Clements
  2007-10-29 20:17       ` Hendrik Visage
  0 siblings, 1 reply; 7+ messages in thread
From: Glynn Clements @ 2007-10-27  1:33 UTC (permalink / raw)
  To: Shriramana Sharma; +Cc: Linux C Programming List


Shriramana Sharma wrote:

> >> 1. Can the system calls provided by the kernel be considered an API?
> > 
> > System calls aren't strictly an *application* programming interface.
> > Applications are supposed to use the libc functions.
> 
> OK so is it at least a "programming interface"?

Yes, although it's intended to be used solely by libc.

-- 
Glynn Clements <glynn@gclements.plus.com>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: kernel provided system call is an API?
  2007-10-27  1:33     ` Glynn Clements
@ 2007-10-29 20:17       ` Hendrik Visage
  2007-10-29 20:36         ` Steve Graegert
  2007-10-29 22:11         ` Glynn Clements
  0 siblings, 2 replies; 7+ messages in thread
From: Hendrik Visage @ 2007-10-29 20:17 UTC (permalink / raw)
  To: Glynn Clements; +Cc: Shriramana Sharma, Linux C Programming List

On 10/27/07, Glynn Clements <glynn@gclements.plus.com> wrote:
>
> Shriramana Sharma wrote:
>
> > >> 1. Can the system calls provided by the kernel be considered an API?
> > >
> > > System calls aren't strictly an *application* programming interface.
> > > Applications are supposed to use the libc functions.
> >
> > OK so is it at least a "programming interface"?
>
> Yes, although it's intended to be used solely by libc.

I think the "more correct"(TM) explanation would be that:

 Each hardware architecture, and OS, will have different methods of
invoking the actual system call. So from memory Linux and FreeBSD uses
different methods to initiate a syscall. Althought
the man read(2) "api" from the libc "user"'s perspective are all the
same (specified by POSIX etc.) the nitty gritty of getting into the
kernel differs.


-- 
Hendrik Visage

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: kernel provided system call is an API?
  2007-10-29 20:17       ` Hendrik Visage
@ 2007-10-29 20:36         ` Steve Graegert
  2007-10-29 22:11         ` Glynn Clements
  1 sibling, 0 replies; 7+ messages in thread
From: Steve Graegert @ 2007-10-29 20:36 UTC (permalink / raw)
  To: Hendrik Visage
  Cc: Glynn Clements, Shriramana Sharma, Linux C Programming List

On 10/29/07, Hendrik Visage <hvjunk@gmail.com> wrote:
> On 10/27/07, Glynn Clements <glynn@gclements.plus.com> wrote:
> >
> > Shriramana Sharma wrote:
> >
> > > >> 1. Can the system calls provided by the kernel be considered an API?
> > > >
> > > > System calls aren't strictly an *application* programming interface.
> > > > Applications are supposed to use the libc functions.
> > >
> > > OK so is it at least a "programming interface"?
> >
> > Yes, although it's intended to be used solely by libc.
>
> I think the "more correct"(TM) explanation would be that:
>
>  Each hardware architecture, and OS, will have different methods of
> invoking the actual system call. So from memory Linux and FreeBSD uses
> different methods to initiate a syscall.

And so do Windows, VMS and HP-UX, and many others.

> Althought the man read(2) "api" from the libc "user"'s perspective are all
> the same (specified by POSIX etc.) the nitty gritty of getting into the
> kernel differs.

Right, but we are talking about the interfaces to the _Linux_ kernel
and already illustrated in earlier threads what system calls are and
how they are invoked by making use of system call wrappers.

Anyhow, Glynn put it straight and did so in a concise manner.

	\Steve

--

Steve Grägert
DigitalEther.de
-
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: kernel provided system call is an API?
  2007-10-29 20:17       ` Hendrik Visage
  2007-10-29 20:36         ` Steve Graegert
@ 2007-10-29 22:11         ` Glynn Clements
  1 sibling, 0 replies; 7+ messages in thread
From: Glynn Clements @ 2007-10-29 22:11 UTC (permalink / raw)
  To: Hendrik Visage; +Cc: Shriramana Sharma, Linux C Programming List


Hendrik Visage wrote:

> > > >> 1. Can the system calls provided by the kernel be considered an API?
> > > >
> > > > System calls aren't strictly an *application* programming interface.
> > > > Applications are supposed to use the libc functions.
> > >
> > > OK so is it at least a "programming interface"?
> >
> > Yes, although it's intended to be used solely by libc.
> 
> I think the "more correct"(TM) explanation would be that:
> 
>  Each hardware architecture, and OS, will have different methods of
> invoking the actual system call. So from memory Linux and FreeBSD uses
> different methods to initiate a syscall. Althought
> the man read(2) "api" from the libc "user"'s perspective are all the
> same (specified by POSIX etc.) the nitty gritty of getting into the
> kernel differs.

There's slightly more to it than that. Some of the library functions
which interface to system calls do more than just invoke the
corresponding system call. E.g. some functions are overriden in the
pthread library to add cancellation points.

Also, readdir() has historically been a system call. Linux has a
readdir system call, but the readdir() function is built atop the
getdents system call for efficiency (getdents returns multiple entries
at a time, which reduces the number of context switches required to
scan a directory).

-- 
Glynn Clements <glynn@gclements.plus.com>

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2007-10-29 22:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-26 16:25 kernel provided system call is an API? Shriramana Sharma
2007-10-26 21:05 ` Glynn Clements
2007-10-27  0:42   ` Shriramana Sharma
2007-10-27  1:33     ` Glynn Clements
2007-10-29 20:17       ` Hendrik Visage
2007-10-29 20:36         ` Steve Graegert
2007-10-29 22:11         ` Glynn Clements

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).