Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Jan 2019 11:58:25 +0100
From:      Polytropon <freebsd@edvax.de>
To:        iam@sdf.org
Cc:        freebsd-questions@freebsd.org
Subject:   Re: what is libc?
Message-ID:  <20190115115825.a040ceca.freebsd@edvax.de>
In-Reply-To: <201901151033.x0FAXCeg027256@sdf.org>
References:  <201901151033.x0FAXCeg027256@sdf.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 15 Jan 2019 10:33:12 GMT, iam@sdf.org wrote:
> what is libc exactly? is it the only interface between userland
> and the kernel? or does libc do something more? if yes, may i know
> what other functions does libc perform?

The libc, "C standard library", is the system's default C library.
It provides "wrappers" for kernel calls as well as extended
functions specified by the C standard. It serves as the common
programming interface for application development.

Among the "wrappers", it also contains standardized (!) functions
for string handling, error reporting, signal handling, or tools
to deal with date and time. The behaviour of those functions is
specified by the C language standard, which makes it a portable
thing.



> also, if suppose the userland were to be written in say "rust",
> would it theoretically be possible to write libc in "rust", and
> then would it have to be called "librust"?

That is probably possible. A "Rust standard library", if it wanted
to mimic what libc provides, would have to implement the content
and functionality of libc in Rust, providing the appropriate
interfaces for that particular language.



> if libc isn't only about "c", why isn't it called libsys?

Because it contains what the _C_ language standard specifies.
However, you _can_ interface it from a different language and
call its functions, but that doesn't change the fact of its
nature and heritage. :-)



> would
> appreciate pointers to material to read to understand the above
> in more depth than is possible via email.

You can find a general description here:

https://en.wikipedia.org/wiki/C_standard_library

https://en.wikibooks.org/wiki/C_Programming/Standard_libraries


-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20190115115825.a040ceca.freebsd>