c - What the role of libc(glibc) in our linux app? -
when debug program using gdb, see functions strange names defined in libc(glibc?). questions are:
- is libc/glibc standard implementation of standard c/c++ functions "strcpy","strlen","malloc"?
 - or, not of first usage described above, wrapper of unix/linux system calls "open","close","fctl"? if so, why can't issue syscalls directly, without libc?
 - does libc consist of 1 lib (.a or .so) file, or many lib files (in case, libc general name of set of lib)? these lib file(s) reside?
 - what difference between libc , glibc?
 
libc implements both standard c functions strcpy() , posix functions (which may system calls) getpid(). note not standard c functions in libc - math functions in libm.
you cannot directly make system calls in same way call normal functions because calls kernel aren't normal function calls, can't resolved linker. instead, architecture-specific assembly language thunks used call kernel - can of course write these directly in own program too, don't need because libc provides them you.
note in linux combination of kernel , libc provides posix api. libc adds decent amount of value - not every posix function system call, , ones are, kernel behaviour isn't posix conforming.
libc single library file (both .so , .a versions available) , in cases resides in /usr/lib. however, glibc (gnu libc) project provides more libc - provides libm mentioned earlier, , other core libraries libpthread. libc 1 of libraries provided glibc - , there other alternate implementations of libc other glibc.
Comments
Post a Comment