Questions tagged [libc]

The C standard library consists of a set of sections of the ISO C standard which describe a collection of headers and library routines used to implement common operations, such as input/output and string handling, in the C programming language.

The C standard library consists of a set of sections of the ISO C standard which describe a collection of headers and library routines used to implement common operations, such as input/output and string handling, in the C programming language.

There are many implementations of libc with different resource requirements, security goals, etc. With a typical tool chain the libc, compiler and OS work together to achieve some ISO, Posix or custom features/standards. Some libc implementation are only a subset of the ISO standard, but still full featured enough to be used in many applications.

Specific libc tags:

  • - the full Gnu Libc found on most GCC installs.
  • - a smaller micro-controller libc for resource constrained devices
  • - Android libc
  • - unhosted libc
  • - more modern lighter foot print libc

Websites

See also:

Do not confuse with , which is for the C++ programming language.

1076 questions
11
votes
5 answers

Missing inotify events (in .git directory)

I'm watching files for changes using inotify events (as it happens, from Python, calling into libc). For some files during a git clone, I see something odd: I see an IN_CREATE event, and I see via ls that the file has content, however, I never see…
Michal Charemza
  • 25,940
  • 14
  • 98
  • 165
11
votes
4 answers

Is the term "libc" equivalent to "C standard library"?

I sometimes hear people using the terms "libc" and "C standard library" interchangeably. I understand that "libc" is the name (or part of the names) of many popular C standard library implementations. My guess is that because of the widespread use…
pepsi
  • 6,785
  • 6
  • 42
  • 74
11
votes
1 answer

What functions is the libm intended for?

As far as I know some math functions are contained in libc, while others are in libm. I've discovered that experimentally: $ nm --dynamic --defined-only /lib/x86_64-linux-gnu/libm.so.6 | grep -w abs $ nm --dynamic --defined-only…
Alexey
  • 710
  • 3
  • 7
  • 19
11
votes
1 answer

Why gdb cannot find ../sysdeps/unix/sysv/linux/ifaddrs.c

I have libc6 & libc6-dbg installed. (gdb) b reak freeifaddrs (gdb) run Breakpoint 1, __freeifaddrs (ifa=0xa822e0) at ../sysdeps/unix/sysv/linux/ifaddrs.c:840 840 ../sysdeps/unix/sysv/linux/ifaddrs.c: No such file or directory. (gdb) list 835 in…
colinfang
  • 20,909
  • 19
  • 90
  • 173
11
votes
2 answers

Are dev_t and ino_t required to be integer types?

The documentation for glibc stays they are integer types (no narrower than unsigned int), but I'm not finding a standards reference that says they have to be an integer type (see also time_t). So in the end, the question becomes: Is #include…
John Hascall
  • 9,176
  • 6
  • 48
  • 72
11
votes
2 answers

Are posix regcomp and regexec threadsafe? In specific, on GNU libc?

Two separate questions here really: Can I use regexes in a multithreaded program without locking and, if so, can I use the same regex_t at the same time in multiple threads? I can't find an answer on Google or the manpages.
Alex
  • 111
  • 3
11
votes
1 answer

getline() with a file descriptor instead of a file pointer

To my knowledge, there is no libc equivalent to getline() that works with a file descriptor instead of working with a FILE *. Is there a (technical) reason for that?
yoones
  • 2,394
  • 1
  • 16
  • 20
11
votes
9 answers

Is stdlib's qsort recursive?

I've read that qsort is just a generic sort, with no promises about implementation. I don't know about how libraries vary from platform to plaform, but assuming the Mac OS X and Linux implementations are broadly similar, are the qsort…
Joe
  • 46,419
  • 33
  • 155
  • 245
11
votes
1 answer

Need to load debugging symbols for shared library in GDB

I am using GDB to debug a program that uses libpthread. There is an error happening in pthread_create and need to step into that function. Unfortunately when I am debugging my program, it does not load the shared library symbols properly so I can't…
YardGlassOfCode
  • 316
  • 1
  • 2
  • 8
11
votes
1 answer

Are classes truly a current proposal for the next C standard?

I found a mismatch between dates on a posting and the dates in the documents at this page: http://www.open-std.org/jtc1/sc22/wg14/www/documents I downloaded the most recent tarball and was reading about a class implementation for C. It was authored…
John Holly
  • 391
  • 1
  • 2
  • 12
11
votes
2 answers

How to link to a different libc file?

I want to supply the shared libraries along with my program rather than using the target system's due to version differences. ldd says my program uses these shared libs: linux-gate.so.1 => (0xf7ef0000)**(made by kernel)** libc.so.6 =>…
Neeladri Vishweswaran
  • 1,695
  • 5
  • 22
  • 40
11
votes
5 answers

vectorized strlen getting away with reading unallocated memory

While studying OSX 10.9.4's implementation of strlen, I notice that it always compares a chunk of 16-bytes and skips ahead to the following 16-bytes until it encounters a '\0'. The relevant part: 3de0: 48 83 c7 10 add …
Aktau
  • 1,847
  • 21
  • 30
11
votes
1 answer

When is FILE flushed?

I have a good old C FILE file descriptor under Windows that is used by an output stream to write data to. My question is simple and yet I could not find the answer: When is the content flushed to disc assuming I don't call fflush? The stream…
anhoppe
  • 4,287
  • 3
  • 46
  • 58
10
votes
1 answer

Portable way to load the C standard library in Python ctypes

Is there a portable way to load the C standard library (libc.so, libc.dylib) in Python ctypes? Should I just use if/elif statements about the result of platform.system() function?
minhee
  • 5,688
  • 5
  • 43
  • 81
10
votes
1 answer

libc's system() when the stack pointer is not 16-padded causes segmentation fault

I've noticed a really weird behavior when I was playing with libc's system() function on x86-64 linux, sometimes the call to system() fails with a segmentation fault, here's what I got after debugging it with gdb. I've noticed that the segmentation…
shaqed
  • 342
  • 3
  • 17