libc

Is MSVCRT under Windows like glibc (libc) under *nix?

I frequently come across Windows programs that bundle in MSVCRT (or their more current equivalents) with the program executables. On a typical PC, I would find many copies of the same .DLL's. My understanding is that MSVCRT is the C runtime library, somewhat analogous to glibc/libc.so under *nix. Why do Windows programs have to bri...

What is the rationale for fread/fwrite taking size and count as arguments?

We had a discussion here at work regarding why fread and fwrite take a size per member and count and return the number of members read/written rather than just taking a buffer and size. The only use for it we could come up with is if you want to read/write an array of structs which aren't evenly divisible by the platform alignment and he...

How to tell which interface the socket received the message from?

If a socket is bound to IN6ADDR_ANY or INADDR_ANY and you use a call such as recvfrom() to receive messages on the socket, is there a way to find out which interface the message came from? In the case of IPv6 link-scope messages, I was hoping that the from argument of recvfrom() would have the scope_id field initialized to the interfac...

legacy linker (uses libc5) fails on linux kernel 2.6.25

We have a legacy linker that uses libc5, and due to several factors we only have the binary and not the source. Yes, version control would have saved us from our current problem... that is now in use for our full tool chain and product line, but this particular horse is long gone. This linker works on linux kernel 2.6.24, but on 2.6.25 ...

Installing a prebuilt binary on Android: "not found"

I'm trying to install a prebuilt binary in a custom Android image. For that I have copied it to a new directory in prebuilt/android-arm/ with an Android.mk file similar to this one: LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_SRC_FILES := binary_name LOCAL_MODULE := binary_name LOCAL_MODULE_CLASS := EXECUTABLES include $(B...

How is linux simultaneously 32bit and 64bit? Or is that something handled in glibc?

How is Linux simultaneously 32bit and 64bit? Or is that something handled in glibc? I run CentOS 5.3 and it is a "64 bit" version; although I build things for 64 bit and 32 bit. From what I think I know, Windows supposedly has a 32bit emulator. Does Linux do the same thing? Is it in userspace or kernel space? If libc handles it, is it ...

MSVC _open/_close/etc

Why are the API's _open, _close, and other standard file i/o functions prefixed with an underscore? Aren't these part of some standard? ...

Close a FILE pointer without closing the underlying file descriptor

By using fdopen(), fileno() it's possible to open streams with existing file descriptors. However the proper way to close a file, once you've opened it with a stream is to fclose() the FILE pointer. How can one close the stream, but retain the open file descriptor? This behaviour is akin to calling fflush() and then fileno(), and then n...

library interposition with dlsym

I'm writing an interposition library to track the usage of some library functions in libc, such as open(), close(), connect(), etc. It works generally well on most of the applications. However, when I try it with PHP, using PHP's MySQL module in particular, none of the function calls to libc inside this module is been tracked (so no conn...

On Mac OS X, how can you get a debug build of System/LibC for source level debugging?

I downloaded LibC source from opensource.apple.com, but since it's part of one monolithic library /usr/lib/libSystem.B.dylib would I have to somehow rebuild the entire thing? I have a BSD command line program, ported from Linux. I want to be able to set breakpoints in LibC functions and step through. I'm trying to close in on what seems...

linking mess with libc

I have a library compiled into a .a file, linked against my application. (iphone, developing with Xcode) Everything seems to be fine, linking seems to succeed, but when I run the program it crashes. The point of crash is at a memcmp() call in the statically linked library. The debugger shows all kind of stuff called with "dyld" in their...

Assembly Segmentation Fault

Hi, I encountered an Error during running of the following Assembly Code #cpuid using C library Functions .section .data output: .asciz "The Processor Vendor ID is '%s'\n" .section .bss .lcomm buffer, 12 .section .text .globl main main: movq $0, %rax cpuid movq $buffer, %rdi movq %rbx, (%rdi) movq %rdx, (%rdi) movq %rcx, (%rdi...

link with libc-dbg and libc-prof

I got multiple versions of libc installed, how do I choose which to link with at compile time? Right now i'm compiling like g++ prog.cpp ...

Where can I browse the sourcecode for libc online (like doxygen)

Sometimes I want to look up the implementations of functions in the stdlib, I've downloaded the sourcecode, but it's quite messy. Just greping is not really suitable because of the many hits. Does anyone know a webpage doxygen style that has the documentation. The same goes for the linux kernel. Thanks ...

I need a list of Async-Signal-Safe Functions from glibc.

Non syscall's wrappers but something like snprintf(), dprintf() ...

Relink a shared library to a different version of libc

I have a linux shared library (.so) compiled with a specific version of libc (GLIBC2.4) and I need to use it on a system with different version of libc. I do not have sources for the library in question so I cannot recompile for the new system. Is it somehow possible to change the dependencies in that library to a different libc? ...

Allocating a char buffer with JNA, Rhino, JavaScript

In Narwhal, we are using JNA to make libc calls like getcwd and chdir. I've only been able to use this with my limited knowledge of the JNA interface as it pertains to JavaScript in Rhino, dealing exclusively with primitives. I need to know how to allocate a char buffer so I can pass it to getcwd, retrieve a JavaScript String from that...

exception generated with qtconcurrent and calling QTime:currentTime

I seem to be getting an exception generated only with a thread created with Qtconcurrent::run I have a class named FPSengine which has a method named FPSengine::getData() that is called by the main thread and 3 other threads (2 QThreads and 1 made with QtConcurrent::run()). Inside FPSengine::getData() I call QTime::currentTime(). If I c...

Android libc version and malloc implementation

Hello. What libc implementation is used in Android platform? What malloc implementation is used (ptmalloc or tcmalloc or anything other)? ...

bionic (andorid libc) mutex variants

Hello Which types of mutex does bionic libc support? recursive timed adaptive errorchecking ...