| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| /** | ||
| * D header file for Darwin. | ||
| * | ||
| * Copyright: Copyright Martin Nowak 2012. | ||
| * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) | ||
| * Authors: Martin Nowak | ||
| */ | ||
| module core.sys.darwin.execinfo; | ||
|
|
||
| version (OSX) | ||
| version = Darwin; | ||
| else version (iOS) | ||
| version = Darwin; | ||
| else version (TVOS) | ||
| version = Darwin; | ||
| else version (WatchOS) | ||
| version = Darwin; | ||
|
|
||
| version (Darwin): | ||
| extern (C): | ||
| nothrow: | ||
| @nogc: | ||
|
|
||
| int backtrace(void** buffer, int size); | ||
| char** backtrace_symbols(const(void*)* buffer, int size); | ||
| void backtrace_symbols_fd(const(void*)* buffer, int size, int fd); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| /** | ||
| * Copyright: Copyright Digital Mars 2010. | ||
| * License: $(WEB www.boost.org/LICENSE_1_0.txt, Boost License 1.0). | ||
| * Authors: Jacob Carlborg | ||
| * Version: Initial created: Feb 20, 2010 | ||
| */ | ||
|
|
||
| /* Copyright Digital Mars 2010. | ||
| * Distributed under the Boost Software License, Version 1.0. | ||
| * (See accompanying file LICENSE or copy at | ||
| * http://www.boost.org/LICENSE_1_0.txt) | ||
| */ | ||
| module core.sys.darwin.mach.dyld; | ||
|
|
||
| version (OSX) | ||
| version = Darwin; | ||
| else version (iOS) | ||
| version = Darwin; | ||
| else version (TVOS) | ||
| version = Darwin; | ||
| else version (WatchOS) | ||
| version = Darwin; | ||
|
|
||
| version (Darwin): | ||
| extern (C): | ||
| nothrow: | ||
| @nogc: | ||
|
|
||
| public import core.stdc.stdint; // for intptr_t | ||
| public import core.sys.darwin.mach.loader; | ||
|
|
||
| uint _dyld_image_count(); | ||
| const(char)* _dyld_get_image_name(uint image_index); | ||
| mach_header* _dyld_get_image_header(uint image_index); | ||
| void _dyld_register_func_for_add_image(void function(in mach_header* mh, intptr_t vmaddr_slide)); | ||
| void _dyld_register_func_for_remove_image(void function(in mach_header* mh, intptr_t vmaddr_slide)); | ||
|
|
||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| /** | ||
| * Copyright: Copyright Digital Mars 2010. | ||
| * License: $(WEB www.boost.org/LICENSE_1_0.txt, Boost License 1.0). | ||
| * Authors: Jacob Carlborg | ||
| * Version: Initial created: Mar 16, 2010 | ||
| */ | ||
|
|
||
| /* Copyright Digital Mars 2010. | ||
| * Distributed under the Boost Software License, Version 1.0. | ||
| * (See accompanying file LICENSE or copy at | ||
| * http://www.boost.org/LICENSE_1_0.txt) | ||
| */ | ||
| module core.sys.darwin.mach.getsect; | ||
|
|
||
| version (OSX) | ||
| version = Darwin; | ||
| else version (iOS) | ||
| version = Darwin; | ||
| else version (TVOS) | ||
| version = Darwin; | ||
| else version (WatchOS) | ||
| version = Darwin; | ||
|
|
||
| version (Darwin): | ||
| extern (C): | ||
| nothrow: | ||
| @nogc: | ||
|
|
||
| public import core.sys.darwin.mach.loader; | ||
|
|
||
| const(section)* getsectbynamefromheader(in mach_header* mhp, in char* segname, in char* sectname); | ||
| const(section_64)* getsectbynamefromheader_64(in mach_header_64* mhp, in char* segname, in char* sectname); | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| /** | ||
| * D header file for Darwin. | ||
| * | ||
| * Copyright: Copyright Sean Kelly 2008 - 2009. | ||
| * License: $(WEB www.boost.org/LICENSE_1_0.txt, Boost License 1.0). | ||
| * Authors: Sean Kelly | ||
| */ | ||
|
|
||
| /* Copyright Sean Kelly 2008 - 2009. | ||
| * Distributed under the Boost Software License, Version 1.0. | ||
| * (See accompanying file LICENSE or copy at | ||
| * http://www.boost.org/LICENSE_1_0.txt) | ||
| */ | ||
| module core.sys.darwin.mach.kern_return; | ||
|
|
||
| version (OSX) | ||
| version = Darwin; | ||
| else version (iOS) | ||
| version = Darwin; | ||
| else version (TVOS) | ||
| version = Darwin; | ||
| else version (WatchOS) | ||
| version = Darwin; | ||
|
|
||
| version (Darwin): | ||
| extern (C): | ||
|
|
||
| alias int kern_return_t; | ||
|
|
||
| enum : kern_return_t | ||
| { | ||
| KERN_SUCCESS = 0, | ||
| KERN_INVALID_ADDRESS = 1, | ||
| KERN_PROTECTION_FAILURE = 2, | ||
| KERN_NO_SPACE = 3, | ||
| KERN_INVALID_ARGUMENT = 4, | ||
| KERN_FAILURE = 5, | ||
| KERN_RESOURCE_SHORTAGE = 6, | ||
| KERN_NOT_RECEIVER = 7, | ||
| KERN_NO_ACCESS = 8, | ||
| KERN_MEMORY_FAILURE = 9, | ||
| KERN_MEMORY_ERROR = 10, | ||
| KERN_ALREADY_IN_SET = 11, | ||
| KERN_NOT_IN_SET = 12, | ||
| KERN_NAME_EXISTS = 13, | ||
| KERN_ABORTED = 14, | ||
| KERN_INVALID_NAME = 15, | ||
| KERN_INVALID_TASK = 16, | ||
| KERN_INVALID_RIGHT = 17, | ||
| KERN_INVALID_VALUE = 18, | ||
| KERN_UREFS_OVERFLOW = 19, | ||
| KERN_INVALID_CAPABILITY = 20, | ||
| KERN_RIGHT_EXISTS = 21, | ||
| KERN_INVALID_HOST = 22, | ||
| KERN_MEMORY_PRESENT = 23, | ||
| KERN_MEMORY_DATA_MOVED = 24, | ||
| KERN_MEMORY_RESTART_COPY = 25, | ||
| KERN_INVALID_PROCESSOR_SET = 26, | ||
| KERN_POLICY_LIMIT = 27, | ||
| KERN_INVALID_POLICY = 28, | ||
| KERN_INVALID_OBJECT = 29, | ||
| KERN_ALREADY_WAITING = 30, | ||
| KERN_DEFAULT_SET = 31, | ||
| KERN_EXCEPTION_PROTECTED = 32, | ||
| KERN_INVALID_LEDGER = 33, | ||
| KERN_INVALID_MEMORY_CONTROL = 34, | ||
| KERN_INVALID_SECURITY = 35, | ||
| KERN_NOT_DEPRESSED = 36, | ||
| KERN_TERMINATED = 37, | ||
| KERN_LOCK_SET_DESTROYED = 38, | ||
| KERN_LOCK_UNSTABLE = 39, | ||
| KERN_LOCK_OWNED = 40, | ||
| KERN_LOCK_OWNED_SELF = 41, | ||
| KERN_SEMAPHORE_DESTROYED = 42, | ||
| KERN_RPC_SERVER_TERMINATED = 43, | ||
| KERN_RPC_TERMINATE_ORPHAN = 44, | ||
| KERN_RPC_CONTINUE_ORPHAN = 45, | ||
| KERN_NOT_SUPPORTED = 46, | ||
| KERN_NODE_DOWN = 47, | ||
| KERN_OPERATION_TIMED_OUT = 49, | ||
| KERN_RETURN_MAX = 0x100, | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,106 @@ | ||
| /** | ||
| * Copyright: Copyright Digital Mars 2010. | ||
| * License: $(WEB www.boost.org/LICENSE_1_0.txt, Boost License 1.0). | ||
| * Authors: Jacob Carlborg | ||
| * Version: Initial created: Feb 20, 2010 | ||
| */ | ||
|
|
||
| /* Copyright Digital Mars 2010. | ||
| * Distributed under the Boost Software License, Version 1.0. | ||
| * (See accompanying file LICENSE or copy at | ||
| * http://www.boost.org/LICENSE_1_0.txt) | ||
| */ | ||
| module core.sys.darwin.mach.loader; | ||
|
|
||
| version (OSX) | ||
| version = Darwin; | ||
| else version (iOS) | ||
| version = Darwin; | ||
| else version (TVOS) | ||
| version = Darwin; | ||
| else version (WatchOS) | ||
| version = Darwin; | ||
|
|
||
| version (Darwin): | ||
| extern (C): | ||
|
|
||
| struct mach_header | ||
| { | ||
| uint magic; | ||
| int cputype; | ||
| int cpusubtype; | ||
| uint filetype; | ||
| uint ncmds; | ||
| uint sizeofcmds; | ||
| uint flags; | ||
| } | ||
|
|
||
| struct mach_header_64 | ||
| { | ||
| uint magic; | ||
| int cputype; | ||
| int cpusubtype; | ||
| uint filetype; | ||
| uint ncmds; | ||
| uint sizeofcmds; | ||
| uint flags; | ||
| uint reserved; | ||
| } | ||
|
|
||
| enum uint MH_MAGIC = 0xfeedface; | ||
| enum uint MH_CIGAM = 0xcefaedfe; | ||
| enum uint MH_MAGIC_64 = 0xfeedfacf; | ||
| enum uint MH_CIGAM_64 = 0xcffaedfe; | ||
|
|
||
| enum SEG_PAGEZERO = "__PAGEZERO"; | ||
| enum SEG_TEXT = "__TEXT"; | ||
| enum SECT_TEXT = "__text"; | ||
| enum SECT_FVMLIB_INIT0 = "__fvmlib_init0"; | ||
| enum SECT_FVMLIB_INIT1 = "__fvmlib_init1"; | ||
| enum SEG_DATA = "__DATA"; | ||
| enum SECT_DATA = "__data"; | ||
| enum SECT_BSS = "__bss"; | ||
| enum SECT_COMMON = "__common"; | ||
| enum SEG_OBJC = "__OBJC"; | ||
| enum SECT_OBJC_SYMBOLS = "__symbol_table"; | ||
| enum SECT_OBJC_MODULES = "__module_info"; | ||
| enum SECT_OBJC_STRINGS = "__selector_strs"; | ||
| enum SECT_OBJC_REFS = "__selector_refs"; | ||
| enum SEG_ICON = "__ICON"; | ||
| enum SECT_ICON_HEADER = "__header"; | ||
| enum SECT_ICON_TIFF = "__tiff"; | ||
| enum SEG_LINKEDIT = "__LINKEDIT"; | ||
| enum SEG_UNIXSTACK = "__UNIXSTACK"; | ||
| enum SEG_IMPORT = "__IMPORT"; | ||
|
|
||
| struct section | ||
| { | ||
| char[16] sectname; | ||
| char[16] segname; | ||
| uint addr; | ||
| uint size; | ||
| uint offset; | ||
| uint align_; | ||
| uint reloff; | ||
| uint nreloc; | ||
| uint flags; | ||
| uint reserved1; | ||
| uint reserved2; | ||
| } | ||
|
|
||
| struct section_64 | ||
| { | ||
| char[16] sectname; | ||
| char[16] segname; | ||
| ulong addr; | ||
| ulong size; | ||
| uint offset; | ||
| uint align_; | ||
| uint reloff; | ||
| uint nreloc; | ||
| uint flags; | ||
| uint reserved1; | ||
| uint reserved2; | ||
| uint reserved3; | ||
| } | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| /** | ||
| * D header file for Darwin. | ||
| * | ||
| * Copyright: Copyright Sean Kelly 2008 - 2009. | ||
| * License: $(WEB www.boost.org/LICENSE_1_0.txt, Boost License 1.0). | ||
| * Authors: Sean Kelly | ||
| */ | ||
|
|
||
| /* Copyright Sean Kelly 2008 - 2009. | ||
| * Distributed under the Boost Software License, Version 1.0. | ||
| * (See accompanying file LICENSE or copy at | ||
| * http://www.boost.org/LICENSE_1_0.txt) | ||
| */ | ||
| module core.sys.darwin.mach.port; | ||
|
|
||
| version (OSX) | ||
| version = Darwin; | ||
| else version (iOS) | ||
| version = Darwin; | ||
| else version (TVOS) | ||
| version = Darwin; | ||
| else version (WatchOS) | ||
| version = Darwin; | ||
|
|
||
| version (Darwin): | ||
| extern (C): | ||
|
|
||
| version( X86 ) | ||
| version = i386; | ||
| version( X86_64 ) | ||
| version = i386; | ||
| version( i386 ) | ||
| { | ||
| alias uint natural_t; | ||
| alias natural_t mach_port_t; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| /** | ||
| * D header file for Darwin. | ||
| * | ||
| * Copyright: Copyright Sean Kelly 2008 - 2009. | ||
| * License: $(WEB www.boost.org/LICENSE_1_0.txt, Boost License 1.0). | ||
| * Authors: Sean Kelly | ||
| */ | ||
|
|
||
| /* Copyright Sean Kelly 2008 - 2009. | ||
| * Distributed under the Boost Software License, Version 1.0. | ||
| * (See accompanying file LICENSE or copy at | ||
| * http://www.boost.org/LICENSE_1_0.txt) | ||
| */ | ||
| module core.sys.darwin.mach.semaphore; | ||
|
|
||
| version (OSX) | ||
| version = Darwin; | ||
| else version (iOS) | ||
| version = Darwin; | ||
| else version (TVOS) | ||
| version = Darwin; | ||
| else version (WatchOS) | ||
| version = Darwin; | ||
|
|
||
| version (Darwin): | ||
| extern (C): | ||
| nothrow: | ||
| @nogc: | ||
|
|
||
| public import core.sys.darwin.mach.kern_return; | ||
| public import core.sys.darwin.mach.port; | ||
|
|
||
| alias mach_port_t task_t; | ||
| alias mach_port_t thread_t; | ||
| alias mach_port_t semaphore_t; | ||
| alias int sync_policy_t; | ||
|
|
||
| alias int clock_res_t; | ||
| struct mach_timespec_t | ||
| { | ||
| uint tv_sec; | ||
| clock_res_t tv_nsec; | ||
| } | ||
|
|
||
| enum | ||
| { | ||
| SYNC_POLICY_FIFO = 0x0, | ||
| SYNC_POLICY_FIXED_PRIORITY = 0x1, | ||
| SYNC_POLICY_REVERSED = 0x2, | ||
| SYNC_POLICY_ORDER_MASK = 0x3, | ||
| SYNC_POLICY_LIFO = (SYNC_POLICY_FIFO | SYNC_POLICY_REVERSED), | ||
| SYNC_POLICY_MAX = 0x7, | ||
| } | ||
|
|
||
| task_t mach_task_self(); | ||
| kern_return_t semaphore_create(task_t, semaphore_t*, int, int); | ||
| kern_return_t semaphore_destroy(task_t, semaphore_t); | ||
|
|
||
| kern_return_t semaphore_signal(semaphore_t); | ||
| kern_return_t semaphore_signal_all(semaphore_t); | ||
| kern_return_t semaphore_signal_thread(semaphore_t, thread_t); | ||
|
|
||
| kern_return_t semaphore_wait(semaphore_t); | ||
| kern_return_t semaphore_wait_signal(semaphore_t, semaphore_t); | ||
|
|
||
| kern_return_t semaphore_timedwait(semaphore_t, mach_timespec_t); | ||
| kern_return_t semaphore_timedwait_signal(semaphore_t, semaphore_t, mach_timespec_t); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,137 @@ | ||
| /** | ||
| * D header file for Darwin. | ||
| * | ||
| * Copyright: Copyright Sean Kelly 2008 - 2009. | ||
| * License: $(WEB www.boost.org/LICENSE_1_0.txt, Boost License 1.0). | ||
| * Authors: Sean Kelly | ||
| */ | ||
|
|
||
| /* Copyright Sean Kelly 2008 - 2009. | ||
| * Distributed under the Boost Software License, Version 1.0. | ||
| * (See accompanying file LICENSE or copy at | ||
| * http://www.boost.org/LICENSE_1_0.txt) | ||
| */ | ||
| module core.sys.darwin.mach.thread_act; | ||
|
|
||
| version (OSX) | ||
| version = Darwin; | ||
| else version (iOS) | ||
| version = Darwin; | ||
| else version (TVOS) | ||
| version = Darwin; | ||
| else version (WatchOS) | ||
| version = Darwin; | ||
|
|
||
| version (Darwin): | ||
| extern (C): | ||
| nothrow: | ||
| @nogc: | ||
|
|
||
| public import core.sys.darwin.mach.kern_return; | ||
| public import core.sys.darwin.mach.port; | ||
|
|
||
| version( X86 ) | ||
| version = i386; | ||
| version( X86_64 ) | ||
| version = i386; | ||
| version( i386 ) | ||
| { | ||
| alias mach_port_t thread_act_t; | ||
| alias void thread_state_t; | ||
| alias int thread_state_flavor_t; | ||
| alias natural_t mach_msg_type_number_t; | ||
|
|
||
| enum | ||
| { | ||
| x86_THREAD_STATE32 = 1, | ||
| x86_FLOAT_STATE32 = 2, | ||
| x86_EXCEPTION_STATE32 = 3, | ||
| x86_THREAD_STATE64 = 4, | ||
| x86_FLOAT_STATE64 = 5, | ||
| x86_EXCEPTION_STATE64 = 6, | ||
| x86_THREAD_STATE = 7, | ||
| x86_FLOAT_STATE = 8, | ||
| x86_EXCEPTION_STATE = 9, | ||
| x86_DEBUG_STATE32 = 10, | ||
| x86_DEBUG_STATE64 = 11, | ||
| x86_DEBUG_STATE = 12, | ||
| THREAD_STATE_NONE = 13, | ||
| } | ||
|
|
||
| struct x86_thread_state32_t | ||
| { | ||
| uint eax; | ||
| uint ebx; | ||
| uint ecx; | ||
| uint edx; | ||
| uint edi; | ||
| uint esi; | ||
| uint ebp; | ||
| uint esp; | ||
| uint ss; | ||
| uint eflags; | ||
| uint eip; | ||
| uint cs; | ||
| uint ds; | ||
| uint es; | ||
| uint fs; | ||
| uint gs; | ||
| } | ||
|
|
||
| struct x86_thread_state64_t | ||
| { | ||
| ulong rax; | ||
| ulong rbx; | ||
| ulong rcx; | ||
| ulong rdx; | ||
| ulong rdi; | ||
| ulong rsi; | ||
| ulong rbp; | ||
| ulong rsp; | ||
| ulong r8; | ||
| ulong r9; | ||
| ulong r10; | ||
| ulong r11; | ||
| ulong r12; | ||
| ulong r13; | ||
| ulong r14; | ||
| ulong r15; | ||
| ulong rip; | ||
| ulong rflags; | ||
| ulong cs; | ||
| ulong fs; | ||
| ulong gs; | ||
| } | ||
|
|
||
| struct x86_state_hdr_t | ||
| { | ||
| int flavor; | ||
| int count; | ||
| } | ||
|
|
||
| struct x86_thread_state_t | ||
| { | ||
| x86_state_hdr_t tsh; | ||
| union _uts | ||
| { | ||
| x86_thread_state32_t ts32; | ||
| x86_thread_state64_t ts64; | ||
| } | ||
| _uts uts; | ||
| } | ||
|
|
||
| enum : mach_msg_type_number_t | ||
| { | ||
| x86_THREAD_STATE32_COUNT = cast(mach_msg_type_number_t)( x86_thread_state32_t.sizeof / int.sizeof ), | ||
| x86_THREAD_STATE64_COUNT = cast(mach_msg_type_number_t)( x86_thread_state64_t.sizeof / int.sizeof ), | ||
| x86_THREAD_STATE_COUNT = cast(mach_msg_type_number_t)( x86_thread_state_t.sizeof / int.sizeof ), | ||
| } | ||
|
|
||
| alias x86_THREAD_STATE MACHINE_THREAD_STATE; | ||
| alias x86_THREAD_STATE_COUNT MACHINE_THREAD_STATE_COUNT; | ||
|
|
||
| mach_port_t mach_thread_self(); | ||
| kern_return_t thread_suspend(thread_act_t); | ||
| kern_return_t thread_resume(thread_act_t); | ||
| kern_return_t thread_get_state(thread_act_t, thread_state_flavor_t, thread_state_t*, mach_msg_type_number_t*); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| /** | ||
| * D header file for Darwin. | ||
| * | ||
| * Copyright: Copyright Sean Kelly 2008 - 2009. | ||
| * License: $(WEB www.boost.org/LICENSE_1_0.txt, Boost License 1.0). | ||
| * Authors: Sean Kelly | ||
| */ | ||
|
|
||
| /* Copyright Sean Kelly 2008 - 2009. | ||
| * Distributed under the Boost Software License, Version 1.0. | ||
| * (See accompanying file LICENSE or copy at | ||
| * http://www.boost.org/LICENSE_1_0.txt) | ||
| */ | ||
| module core.sys.darwin.pthread; | ||
|
|
||
| version (OSX) | ||
| version = Darwin; | ||
| else version (iOS) | ||
| version = Darwin; | ||
| else version (TVOS) | ||
| version = Darwin; | ||
| else version (WatchOS) | ||
| version = Darwin; | ||
|
|
||
| version (Darwin): | ||
| extern (C): | ||
| nothrow: | ||
| @nogc: | ||
|
|
||
| public import core.sys.posix.pthread; | ||
| public import core.sys.darwin.mach.port; | ||
|
|
||
| int pthread_is_threaded_np(); | ||
| int pthread_threadid_np(pthread_t, ulong*); | ||
| // ^ __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2) | ||
| int pthread_rwlock_longrdlock_np(pthread_rwlock_t*); | ||
| int pthread_rwlock_yieldwrlock_np(pthread_rwlock_t*); | ||
| // ^ __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_NA); | ||
| int pthread_rwlock_downgrade_np(pthread_rwlock_t*); | ||
| int pthread_rwlock_upgrade_np(pthread_rwlock_t*); | ||
| int pthread_rwlock_tryupgrade_np(pthread_rwlock_t*); | ||
| int pthread_rwlock_held_np(pthread_rwlock_t*); | ||
| int pthread_rwlock_rdheld_np(pthread_rwlock_t*); | ||
| int pthread_rwlock_wrheld_np(pthread_rwlock_t*); | ||
| int pthread_getname_np(pthread_t, char*, size_t); | ||
| int pthread_setname_np(in char*); | ||
| // ^ __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2) | ||
| int pthread_main_np(); | ||
| mach_port_t pthread_mach_thread_np(pthread_t); | ||
| size_t pthread_get_stacksize_np(pthread_t); | ||
| void* pthread_get_stackaddr_np(pthread_t); | ||
| int pthread_cond_signal_thread_np(pthread_cond_t*, pthread_t); | ||
| int pthread_cond_timedwait_relative_np(pthread_cond_t*, pthread_mutex_t*, in timespec*); | ||
| int pthread_create_suspended_np(pthread_t*, in pthread_attr_t*, void* function(void*), void*); | ||
| int pthread_kill(pthread_t, int); | ||
| pthread_t pthread_from_mach_thread_np(mach_port_t); | ||
| // ^ __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0) | ||
| int pthread_sigmask(int, in sigset_t*, sigset_t*); | ||
| // ^ __DARWIN_ALIAS(pthread_sigmask) | ||
| void pthread_yield_np(); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| /** | ||
| * D header file for Darwin | ||
| * | ||
| * Authors: Martin Nowak | ||
| */ | ||
| module core.sys.darwin.sys.cdefs; | ||
|
|
||
| version (OSX) | ||
| version = Darwin; | ||
| else version (iOS) | ||
| version = Darwin; | ||
| else version (TVOS) | ||
| version = Darwin; | ||
| else version (WatchOS) | ||
| version = Darwin; | ||
|
|
||
| version (Darwin): | ||
|
|
||
| public import core.sys.posix.config; | ||
|
|
||
| // http://www.opensource.apple.com/source/xnu/xnu-2422.115.4/bsd/sys/cdefs.h | ||
| enum _DARWIN_C_SOURCE = true; | ||
|
|
||
| enum __DARWIN_C_FULL = 900_000L; | ||
| enum __DARWIN_C_LEVEL = __DARWIN_C_FULL; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,141 @@ | ||
| /** | ||
| * D header file for Darwin. | ||
| * | ||
| * Copyright: Copyright Martin Nowak 2012. Etienne Cimon 2015. | ||
| * License: $(WEB www.boost.org/LICENSE_1_0.txt, Boost License 1.0). | ||
| * Authors: Martin Nowak | ||
| */ | ||
|
|
||
| /* Copyright Martin Nowak 2012. Etienne Cimon 2015. | ||
| * Distributed under the Boost Software License, Version 1.0. | ||
| * (See accompanying file LICENSE or copy at | ||
| * http://www.boost.org/LICENSE_1_0.txt) | ||
| */ | ||
| module core.sys.darwin.sys.event; | ||
|
|
||
| version (OSX) | ||
| version = Darwin; | ||
| else version (iOS) | ||
| version = Darwin; | ||
| else version (TVOS) | ||
| version = Darwin; | ||
| else version (WatchOS) | ||
| version = Darwin; | ||
|
|
||
| version (Darwin): | ||
| extern (C): | ||
| nothrow: | ||
| @nogc: | ||
|
|
||
| import core.stdc.stdint; // intptr_t, uintptr_t | ||
| import core.sys.posix.time; // timespec | ||
|
|
||
| enum : short | ||
| { | ||
| EVFILT_READ = -1, | ||
| EVFILT_WRITE = -2, | ||
| EVFILT_AIO = -3, /* attached to aio requests */ | ||
| EVFILT_VNODE = -4, /* attached to vnodes */ | ||
| EVFILT_PROC = -5, /* attached to struct proc */ | ||
| EVFILT_SIGNAL = -6, /* attached to struct proc */ | ||
| EVFILT_TIMER = -7, /* timers */ | ||
| EVFILT_MACHPORT = -8, /* Mach portsets */ | ||
| EVFILT_FS = -9, /* filesystem events */ | ||
| EVFILT_USER = -10, /* User events */ | ||
| EVFILT_VM = -12, /* virtual memory events */ | ||
| EVFILT_SYSCOUNT = 11 | ||
| } | ||
|
|
||
| extern(D) void EV_SET(kevent_t* kevp, typeof(kevent_t.tupleof) args) | ||
| { | ||
| *kevp = kevent_t(args); | ||
| } | ||
|
|
||
| struct kevent_t | ||
| { | ||
| uintptr_t ident; /* identifier for this event */ | ||
| short filter; /* filter for event */ | ||
| ushort flags; | ||
| uint fflags; | ||
| intptr_t data; | ||
| void *udata; /* opaque user data identifier */ | ||
| } | ||
|
|
||
| enum | ||
| { | ||
| /* actions */ | ||
| EV_ADD = 0x0001, /* add event to kq (implies enable) */ | ||
| EV_DELETE = 0x0002, /* delete event from kq */ | ||
| EV_ENABLE = 0x0004, /* enable event */ | ||
| EV_DISABLE = 0x0008, /* disable event (not reported) */ | ||
|
|
||
| /* flags */ | ||
| EV_ONESHOT = 0x0010, /* only report one occurrence */ | ||
| EV_CLEAR = 0x0020, /* clear event state after reporting */ | ||
| EV_RECEIPT = 0x0040, /* force EV_ERROR on success, data=0 */ | ||
| EV_DISPATCH = 0x0080, /* disable event after reporting */ | ||
|
|
||
| EV_SYSFLAGS = 0xF000, /* reserved by system */ | ||
| EV_FLAG1 = 0x2000, /* filter-specific flag */ | ||
|
|
||
| /* returned values */ | ||
| EV_EOF = 0x8000, /* EOF detected */ | ||
| EV_ERROR = 0x4000, /* error, data contains errno */ | ||
| } | ||
|
|
||
| enum | ||
| { | ||
| /* | ||
| * data/hint flags/masks for EVFILT_USER, shared with userspace | ||
| * | ||
| * On input, the top two bits of fflags specifies how the lower twenty four | ||
| * bits should be applied to the stored value of fflags. | ||
| * | ||
| * On output, the top two bits will always be set to NOTE_FFNOP and the | ||
| * remaining twenty four bits will contain the stored fflags value. | ||
| */ | ||
| NOTE_FFNOP = 0x00000000, /* ignore input fflags */ | ||
| NOTE_FFAND = 0x40000000, /* AND fflags */ | ||
| NOTE_FFOR = 0x80000000, /* OR fflags */ | ||
| NOTE_FFCOPY = 0xc0000000, /* copy fflags */ | ||
| NOTE_FFCTRLMASK = 0xc0000000, /* masks for operations */ | ||
| NOTE_FFLAGSMASK = 0x00ffffff, | ||
|
|
||
| NOTE_TRIGGER = 0x01000000, /* Cause the event to be | ||
| triggered for output. */ | ||
|
|
||
| /* | ||
| * data/hint flags for EVFILT_{READ|WRITE}, shared with userspace | ||
| */ | ||
| NOTE_LOWAT = 0x0001, /* low water mark */ | ||
|
|
||
| /* | ||
| * data/hint flags for EVFILT_VNODE, shared with userspace | ||
| */ | ||
| NOTE_DELETE = 0x0001, /* vnode was removed */ | ||
| NOTE_WRITE = 0x0002, /* data contents changed */ | ||
| NOTE_EXTEND = 0x0004, /* size increased */ | ||
| NOTE_ATTRIB = 0x0008, /* attributes changed */ | ||
| NOTE_LINK = 0x0010, /* link count changed */ | ||
| NOTE_RENAME = 0x0020, /* vnode was renamed */ | ||
| NOTE_REVOKE = 0x0040, /* vnode access was revoked */ | ||
|
|
||
| /* | ||
| * data/hint flags for EVFILT_PROC, shared with userspace | ||
| */ | ||
| NOTE_EXIT = 0x80000000, /* process exited */ | ||
| NOTE_FORK = 0x40000000, /* process forked */ | ||
| NOTE_EXEC = 0x20000000, /* process exec'd */ | ||
| NOTE_PCTRLMASK = 0xf0000000, /* mask for hint bits */ | ||
| NOTE_PDATAMASK = 0x000fffff, /* mask for pid */ | ||
|
|
||
| /* additional flags for EVFILT_PROC */ | ||
| NOTE_TRACK = 0x00000001, /* follow across forks */ | ||
| NOTE_TRACKERR = 0x00000002, /* could not track child */ | ||
| NOTE_CHILD = 0x00000004, /* am a child process */ | ||
| } | ||
|
|
||
| int kqueue(); | ||
| int kevent(int kq, const kevent_t *changelist, int nchanges, | ||
| kevent_t *eventlist, int nevents, | ||
| const timespec *timeout); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,112 @@ | ||
| /** | ||
| * D header file for Darwin | ||
| * | ||
| * Authors: Martin Nowak | ||
| */ | ||
| module core.sys.darwin.sys.mman; | ||
|
|
||
| version (OSX) | ||
| version = Darwin; | ||
| else version (iOS) | ||
| version = Darwin; | ||
| else version (TVOS) | ||
| version = Darwin; | ||
| else version (WatchOS) | ||
| version = Darwin; | ||
|
|
||
| version (Darwin): | ||
| extern (C): | ||
| nothrow: | ||
| @nogc: | ||
|
|
||
| public import core.sys.posix.sys.mman; | ||
| import core.sys.darwin.sys.cdefs; | ||
| import core.sys.posix.sys.types; | ||
|
|
||
| // already in core.sys.posix.sys.mman | ||
| // enum PROT_NONE = 0x00; | ||
| // enum PROT_READ = 0x01; | ||
| // enum PROT_WRITE = 0x02; | ||
| // enum PROT_EXEC = 0x04; | ||
|
|
||
| // already in core.sys.posix.sys.mman | ||
| // enum MAP_SHARED = 0x0001; | ||
| // enum MAP_PRIVATE = 0x0002; | ||
| static if (_DARWIN_C_SOURCE) | ||
| alias MAP_COPY = MAP_PRIVATE; | ||
| // enum MAP_FIXED = 0x0010; | ||
|
|
||
| static if (_DARWIN_C_SOURCE) | ||
| { | ||
| enum MAP_RENAME = 0x0020; | ||
| enum MAP_NORESERVE = 0x0040; | ||
| enum MAP_RESERVED0080 = 0x0080; | ||
| enum MAP_NOEXTEND = 0x0100; | ||
| enum MAP_HASSEMAPHORE = 0x0200; | ||
| enum MAP_NOCACHE = 0x0400; | ||
| enum MAP_JIT = 0x0800; | ||
| } | ||
|
|
||
| // already in core.sys.posix.sys.mman | ||
| // enum MCL_CURRENT = 0x0001; | ||
| // enum MCL_FUTURE = 0x0002; | ||
|
|
||
| // enum MAP_FAILED = cast(void*)-1; | ||
|
|
||
| // enum MS_ASYNC = 0x0001; | ||
| // enum MS_INVALIDATE = 0x0002; | ||
| // enum MS_SYNC = 0x0010; | ||
|
|
||
| static if (_DARWIN_C_SOURCE) | ||
| { | ||
| enum MS_KILLPAGES = 0x0004; | ||
| enum MS_DEACTIVATE = 0x0008; | ||
|
|
||
| enum MAP_FILE = 0x0000; | ||
|
|
||
| // already in core.sys.posix.sys.mman | ||
| // enum MAP_ANON = 0x1000; | ||
|
|
||
| // enum POSIX_MADV_NORMAL = 0; | ||
| // enum POSIX_MADV_RANDOM = 1; | ||
| // enum POSIX_MADV_SEQUENTIAL = 2; | ||
| // enum POSIX_MADV_WILLNEED = 3; | ||
| // enum POSIX_MADV_DONTNEED = 4; | ||
|
|
||
| alias MADV_NORMAL = POSIX_MADV_NORMAL; | ||
| alias MADV_RANDOM = POSIX_MADV_RANDOM; | ||
| alias MADV_SEQUENTIAL = POSIX_MADV_SEQUENTIAL; | ||
| alias MADV_WILLNEED = POSIX_MADV_WILLNEED; | ||
| alias MADV_DONTNEED = POSIX_MADV_DONTNEED; | ||
| enum MADV_FREE = 5; | ||
| enum MADV_ZERO_WIRED_PAGES = 6; | ||
| enum MADV_FREE_REUSABLE = 7; | ||
| enum MADV_FREE_REUSE = 8; | ||
| enum MADV_CAN_REUSE = 9; | ||
|
|
||
| enum MINCORE_INCORE = 0x1; | ||
| enum MINCORE_REFERENCED = 0x2; | ||
| enum MINCORE_MODIFIED = 0x4; | ||
| enum MINCORE_REFERENCED_OTHER = 0x8; | ||
| enum MINCORE_MODIFIED_OTHER = 0x10; | ||
| } | ||
|
|
||
| // already in core.sys.posix.sys.mman | ||
| // int mlockall(int); | ||
| // int munlockall(void); | ||
| // int mlock(const void *, size_t); | ||
| // void * mmap(void *, size_t, int, int, int, off_t); | ||
| // int mprotect(void *, size_t, int); | ||
| // int msync(void *, size_t, int); | ||
| // int munlock(const void *, size_t); | ||
| // int munmap(void *, size_t); | ||
| // int shm_open(const char *, int, ...); | ||
| // int shm_unlink(const char *); | ||
| // int posix_madvise(void *, size_t, int); | ||
|
|
||
| static if (_DARWIN_C_SOURCE) | ||
| { | ||
| int madvise(void *, size_t, int); | ||
| int mincore(const(void)*, size_t, char *); | ||
| int minherit(void *, size_t, int); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,11 @@ | ||
| /** | ||
| * $(RED Deprecated. Use $(D core.sys.darwin.sys.cdefs) instead. This module | ||
| * will be removed in June 2018.) | ||
| * | ||
| * D header file for OSX | ||
| * | ||
| * Authors: Martin Nowak | ||
| */ | ||
| module core.sys.osx.sys.cdefs; | ||
|
|
||
| public import core.sys.darwin.sys.cdefs; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,102 +1,11 @@ | ||
| /** | ||
| * $(RED Deprecated. Use $(D core.sys.darwin.sys.mman) instead. This module | ||
| * will be removed in June 2018.) | ||
| * | ||
| * D header file for FreeBSD | ||
| * | ||
| * Authors: Martin Nowak | ||
| */ | ||
| module core.sys.osx.sys.mman; | ||
|
|
||
| public import core.sys.darwin.sys.mman; |