Darwin is the open-source core of macOS, iOS, tvOS and watchOS. It is derived from NeXTStep, Mach, and *BSD; the kernel is called XNU.
Questions tagged [darwin]
367 questions
8
votes
1 answer
How to know Darwin kernel scheduler time slice?
On Linux, sched.h contains the definition of
int sched_rr_get_interval(pid_t pid, struct timespec * tp);
to get the time slice of a process. However the file shipping with OS X El Capitan doesn't hold that definition.
Is there an alternative for…

Midiparse
- 4,701
- 7
- 28
- 48
8
votes
1 answer
How to build a cross-compiler for i386-apple-darwin target from x86_64-apple-darwin host?
Problem overview
I am trying to learn how to build a cross-compiler, specifically a version of GNU gcc 4.7.2 on a 64-bit Intel OS X host that targets i386-apple-darwin (32-bit Intel). However, I keep getting stuck on the same error:
...
checking for…

Alex Reynolds
- 95,983
- 54
- 240
- 345
6
votes
2 answers
Is there a cross-platform way to reliably find the stdout file descriptor with ctypes?
I have some code that uses ctypes to try to determine if the file pointed to by sys.stdout is actually stdout. I know that on any POSIX-compliant system, and even on Windows, it should be safe to assume this is true if sys.stdout.fileno() == 1, so…

Iguananaut
- 21,810
- 5
- 50
- 63
6
votes
2 answers
Porting a kernel to a different architecture?
I want to port the xnu kernel to the ARM architecture, with the ultimate goal of being able to run a full kernel inside Qemu. While I do realise that this is a very difficult task, I still want to have a go at it.
As far as I know, you're meant to…

Kristina
- 15,859
- 29
- 111
- 181
6
votes
1 answer
fexecve equivalent on macOS
I use fexecve(3) on Linux to execute a binary held in a memfd.
Is there an equivalent for macOS? I've tried execve("/dev/fd/%d", [], []), but it failed with EACCES. Copying the file from that path /dev/fd/%d to a new temporary file and exec'ing that…

Max
- 2,760
- 1
- 28
- 47
5
votes
1 answer
Why isn't Darwin's strtod thread safe?
The following test always produces failures or bus errors for me on my Intel Mac Mini.
Compiler:
uname -a:
Darwin vogon13 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_I386 i386
g++ -v:
Target:…

Matt Chambers
- 2,229
- 1
- 25
- 43
5
votes
2 answers
How to daemonise a shell-script in FreeBSD (and macOS)
The way I normally start a long-running shell script is
% (nohup ./script.sh script.log 2>&1 & )
The redirections close stdin, and reopen stdout and stderr; the nohup stops HUP reaching the process when the owning process exits (I…

Norman Gray
- 11,978
- 2
- 33
- 56
5
votes
1 answer
GDB frozen on macOS Catalina
I ran a 'helloworld' to try GDB on mac but after typing run it output
[New Thread 0x1903 of process 69034]
and then nothing.
I've waited an hour and still nothing. Having done certification and disable startup-with-shell.
system: MacOS Catalina…

Americanlasagna
- 63
- 3
5
votes
2 answers
Strange behavior of uniq on darwin shells
I've used 'uniq -d -c file' in many shell scripts on linux machines, and it works.
On my MAC (OS X 10.6.7 with developer tools installed) it doesn't seems to work:
$ uniq -d -c testfile.txt
usage: uniq [-c | -d | -u] [-i] [-f fields] [-s chars]…

chmoelders
- 18,584
- 6
- 22
- 24
5
votes
1 answer
PF header net/pfvar.h on OSX missing
PF (packet filter) is a kernel-level firewall, included in BSD-like kernels (Darwin kernel is basically BSD), and BSD man pages provide detailed documentation about these headers, letting control PF programmatically. PF is included in OSX kernel,…
user707779
5
votes
1 answer
How do I allocate memory buffers which may be reclaimed by the OS for caching in a Mac OS X kernel extension?
Based on documentation and xnu source I've read, I understand that Mac OS X caches file I/O using the Unified Buffer Cache (UBC). The UBC grows as big as it can based on available RAM, but UBC pages are some of the first to be sacrificed when memory…

pmdj
- 22,018
- 3
- 52
- 103
5
votes
2 answers
What type of threads does OS X have?
Kernel-level threads (like Linux and some *BSD systems) or something else? If there is any difference, I'm using pthreads.

Pyetras
- 1,492
- 16
- 21
5
votes
0 answers
where can I find the documentation for the apple's Darwin API
where can I find the documentation for the apple's Darwin API?
such as mach_task_basic_info mach_msg_type_number_tand so on.
I find many documentations of apple's Darwin API is empty on the developer.apple.com

SubCycle
- 463
- 2
- 6
- 16
5
votes
3 answers
os.platform() returns darwin instead of OSX
os.platform();
The above JS instruction returns the name of OS .
When it is runned on Ubuntu , it returns
'linux'
When it is runned on Macbook, it returns
'darwin'
I am wondered why does not return osx ,unix or bsd.. ?
Does darwinis a fork…

Abdennour TOUMI
- 87,526
- 38
- 249
- 254
5
votes
2 answers
iPhone Objective-c detect Screen Lock
I'm new to make iPhone App with Objective-c
I want to make the App which sends a notification when iPhone screen is locked(Pressed Lock button)
How can I make this app?
I'm trying to make it using "applicationWillSuspend",…

Issei
- 51
- 1
- 4