Re: Linux API developer documentation

From: Peter T. Breuer (ptb_at_lab.it.uc3m.es)
Date: 04/08/05


Date: Fri, 8 Apr 2005 21:43:44 +0200

Edward Diener <eldiener_no_spam_here@earthlink.net> wrote:
> John Hasler wrote:
> > Edward Diener writes:
> >> Where does one normally find the documentation to the core functions
> >> of the Linux API ?
> >
> > Libc. On Debian you would install libc6-dev, glibc-doc, and
> > manpages-dev. 'info libc' will then tell you everything could could
> > possibly want to know. There is also a man page for each function.
> > The 'apropos' command will help you find it. I also suggest that you
> > Google 'POSIX'.
>
> Thanks ! I am a C++ programmer so I will not have problems with that. I am
> intirigued however by how other languages, such as Python and Java access
> the Linux kernel.

Java has its own API. In each native archtecture the java support has to
supply the standard java interface to the programmer. It's likely
written in C, so all it has to do is hook into libc.

Python has its own API ...

(I hope you get the idea).

> Is there no shared library with exported functions under
> Linux which can be accessed by other languages ?

Sure - any one. All you need is that your language has a way of calling
C library functions. C does. Fortran does. I even seem to recall that
java does! (though I'm not going to look it up).

> If there is, is there no
> general documentation other than the libc documentation about the kernel

What "kernel functionality"? It's none of your business what the kernel
is, or how it works! It doesn't even have to be a linux kernel.
Libraries and applications will be built against libc. It's libc's (and
maybe some few other libraries) job to interface with the kernel, and it
provides the standard posix interface to applications.

> functionality ? Sorry to be comparing the Linux core functionality to
> Windows, which is what I have largely worked with, but in that OS there is
> an API of base services which serves as the documentation for Windows core

You are confusing libraries and kernel.

> functionality ( implemented in Windows shared libraries ). Does Linux have

Then talk about libraries, not "windows". Linux distributions generally
also have a library that implements a winodws API.

> such documentation or is it encompassed completely in the documentation for
> libc. Maybe the POSIX documentation is the equivalent to what I am thinking.

If you are looking for the standard posix API, then yes, you would be
looking for the posix documentation on the standard posix API. But
what's wrong with the man pages? Posix is only a formalization and
standardisation of the common unix practices and functions as developed
over thirty plus years. They won't say anything different. You will
always see in a man page something like:

  
  CONFORMING TO
         ... POSIX, ...

You are free to implement or use any other API, however! Whatever you
like. However, that would mean you having to maintain a library that
interfaces with and tracks kernel syscalls, which is a big job. It's
the thankless task done by libc.

Choose an API. Then use it.

Peter



Relevant Pages