darwin

Atomically get value on Mac OS

I need some function to atomically get int value. Something called OSAtomicGet(). Analog of g_atomic_int_get(). ...

Find the OS X kext library that contains a symbol

Hello, with Snow Leopard 10.6.4 I am obtaining an unresolved symbol: $ sudo kextutil KRPC.kext (kernel) kxld[com.machackershandbook.kext.KRPC]: The following symbols are unresolved for this kext: (kernel) kxld[com.machackershandbook.kext.KRPC]: _mig_buckets I cannot find this symbol using kextfind, however this symbol is exported in ...

Which mode is XNU (OS X kernel) K32 in?

I know XNU K32 is running in 32-bit. But which 32-bit mode is it in, protect-mode or IA32e-compatibility-mode? In the protect-mode, the MMU takes 32-bit cr3 and using two-level page directories. In the compatibilty-mode, MMU takes 64-bit cr3 and using four-level page directories. I know the kernel has its own cr3 setting separated from a...

An objcopy equivalent for Mac / iPhone?

Hello, I would like to rename symbols inside object files (.o) with something that would be the Mac equivalent of binutils' objcopy --redefine-syms tool. I found no arm-apple-darwin10-objcopy. I tried the MacPorts' arm-elf-binutils port and also tried to play a bit with otool and segedit without much success. Any idea please? ...

What is the deal with undefined symbols in a shared library or dylib?

I have a Makefile for linux that I am porting over to Darwin. The makefile takes a bunch of .o files and links them together into a .so shared object. Okay, so I figured (am I wrong about this?) that the best analog for this in Darwin is the dylib. So I changed the -shared flag to -dynamiclib. Now the code that I am linking together ...

Checking for the existence of externally defined identifiers in C

I ran into this problem while developing in Objective-C for iOS, but this should apply to any C/C++/Objective-C code using the Mac OS X/iOS linker. The solution is covered by another question, but I'm interested in the why. Let's say I'm using a linking to a library which defines a constant. In a header file there is a declaration like ...

How to enable large file support under Darwin?

I have a C application I am trying to compile for Mac OS X 10.6.4: $ uname -v Darwin Kernel Version 10.4.0: Fri Apr 23 18:28:53 PDT 2010; root:xnu-1504.7.4~1/RELEASE_I386 My gcc is as follows: $ gcc --version i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5664) My Makefile is as follows: CC=gcc CFLAGS=-D_FILE_OFFSET_B...