Platform-specific package target: darwin_arm64

Collection Info

View Source
Collection
core
Path
sys/darwin
Entries
323

Source Files

(hidden platform specific files)

Constants

117

ARM_THREAD_STATE64_COUNT #

Source
ARM_THREAD_STATE64_COUNT :: size_of(arm_thread_state64_t) / size_of(u32)

COPYFILE_ALL #

Source
COPYFILE_ALL :: COPYFILE_METADATA + copyfile_flags{.DATA}

COPYFILE_METADATA #

Source
COPYFILE_METADATA :: COPYFILE_SECURITY + copyfile_flags{.XATTR}

COPYFILE_NOFOLLOW #

Source
COPYFILE_NOFOLLOW :: copyfile_flags{.NOFOLLOW_SRC, .NOFOLLOW_DST}

COPYFILE_SECURITY #

Source
COPYFILE_SECURITY :: copyfile_flags{.STAT, .ACL}

DARWIN_PROC_INFO_CALL_CANUSEFGHW #

Source
DARWIN_PROC_INFO_CALL_CANUSEFGHW :: c.int(0xc)

DARWIN_PROC_INFO_CALL_DIRTYCONTROL #

Source
DARWIN_PROC_INFO_CALL_DIRTYCONTROL :: c.int(0x8)

DARWIN_PROC_INFO_CALL_KERNMSGBUF #

Source
DARWIN_PROC_INFO_CALL_KERNMSGBUF :: c.int(0x4)

DARWIN_PROC_INFO_CALL_LISTCOALITIONS #

Source
DARWIN_PROC_INFO_CALL_LISTCOALITIONS :: c.int(0xb)

DARWIN_PROC_INFO_CALL_LISTPIDS #

Source
DARWIN_PROC_INFO_CALL_LISTPIDS :: c.int(0x1)

DARWIN_PROC_INFO_CALL_PIDDYNKQUEUEINFO #

Source
DARWIN_PROC_INFO_CALL_PIDDYNKQUEUEINFO :: c.int(0xd)

DARWIN_PROC_INFO_CALL_PIDFDINFO #

Source
DARWIN_PROC_INFO_CALL_PIDFDINFO :: c.int(0x3)

DARWIN_PROC_INFO_CALL_PIDFILEPORTINFO #

Source
DARWIN_PROC_INFO_CALL_PIDFILEPORTINFO :: c.int(0x6)

DARWIN_PROC_INFO_CALL_PIDINFO #

Source
DARWIN_PROC_INFO_CALL_PIDINFO :: c.int(0x2)

DARWIN_PROC_INFO_CALL_PIDORIGINATORINFO #

Source
DARWIN_PROC_INFO_CALL_PIDORIGINATORINFO :: c.int(0xa)

DARWIN_PROC_INFO_CALL_PIDRUSAGE #

Source
DARWIN_PROC_INFO_CALL_PIDRUSAGE :: c.int(0x9)

DARWIN_PROC_INFO_CALL_SETCONTROL #

Source
DARWIN_PROC_INFO_CALL_SETCONTROL :: c.int(0x5)

DARWIN_PROC_INFO_CALL_TERMINATE #

Source
DARWIN_PROC_INFO_CALL_TERMINATE :: c.int(0x7)

DARWIN_PROC_INFO_CALL_UDATA_INFO #

Source
DARWIN_PROC_INFO_CALL_UDATA_INFO :: c.int(0xe)

DARWIN_PROC_PIDPATHINFO_SIZE #

Source
DARWIN_PROC_PIDPATHINFO_SIZE :: MAXPATHLEN

proc_info.h

MAP_32BIT #

Source
MAP_32BIT :: 0x8000

Return virtual addresses <4G only

MAP_FIXED #

Source
MAP_FIXED :: 0x0010

[MF|SHM] interpret addr exactly

MAP_HASSEMAPHORE #

Source
MAP_HASSEMAPHORE :: 0x0200

region may contain semaphores

MAP_JIT #

Source
MAP_JIT :: 0x0800

Allocate a region that will be used for JIT purposes

MAP_NOCACHE #

Source
MAP_NOCACHE :: 0x0400

don't cache pages for this mapping

MAP_PRIVATE #

Source
MAP_PRIVATE :: 0x0002

[MF|SHM] changes are private

MASK_ACCMODE #

Source
MASK_ACCMODE :: 0x0003

mask for above rd/wr/rdwr flags

OPEN_FLAG_APPEND #

Source
OPEN_FLAG_APPEND :: 0x00000008

set append mode

OPEN_FLAG_CLOEXEC #

Source
OPEN_FLAG_CLOEXEC :: 0x01000000

causes the descriptor to be closed if you use any of the exec like functions

OPEN_FLAG_CREAT #

Source
OPEN_FLAG_CREAT :: 0x00000200

create if nonexistant

OPEN_FLAG_DIRECTORY #

Source
OPEN_FLAG_DIRECTORY :: 0x00100000

restrict open to only directories

OPEN_FLAG_EVTONLY #

Source
OPEN_FLAG_EVTONLY :: 0x00008000

descriptor requested for event notifications only

OPEN_FLAG_EXCL #

Source
OPEN_FLAG_EXCL :: 0x00000800

error if already exists

OPEN_FLAG_EXLOCK #

Source
OPEN_FLAG_EXLOCK :: 0x00000020

open with exclusive file lock

OPEN_FLAG_NOFOLLOW #

Source
OPEN_FLAG_NOFOLLOW :: 0x00000100

don't follow symlinks

OPEN_FLAG_NOFOLLOW_ANY #

Source
OPEN_FLAG_NOFOLLOW_ANY :: 0x20000000

no symlinks allowed in path

OPEN_FLAG_NONBLOCK #

Source
OPEN_FLAG_NONBLOCK :: 0x00000004

no delay

OPEN_FLAG_RDONLY #

Source
OPEN_FLAG_RDONLY :: 0x0000

open for reading only

OPEN_FLAG_RDWR #

Source
OPEN_FLAG_RDWR :: 0x0002

open for reading and writing

OPEN_FLAG_SHLOCK #

Source
OPEN_FLAG_SHLOCK :: 0x00000010

open with shared file lock

OPEN_FLAG_SYMLINK #

Source
OPEN_FLAG_SYMLINK :: 0x00200000

allow open of a symlink

OPEN_FLAG_TRUNC #

Source
OPEN_FLAG_TRUNC :: 0x00000400

truncate to zero length

OPEN_FLAG_WRONLY #

Source
OPEN_FLAG_WRONLY :: 0x0001

open for writing only

PERMISSION_ALL_ALL #

Source
PERMISSION_ALL_ALL :: PERMISSION_OWNER_ALL | PERMISSION_GROUP_ALL | PERMISSION_OTHER_ALL

PERMISSION_GROUP_ALL #

Source
PERMISSION_GROUP_ALL :: Permission{.PERMISSION_GROUP_READ, .PERMISSION_GROUP_WRITE, .PERMISSION_GROUP_EXECUTE}

PERMISSION_MASK_IRGRP #

Source
PERMISSION_MASK_IRGRP :: 0o000040

R for group

PERMISSION_MASK_IROTH #

Source
PERMISSION_MASK_IROTH :: 0o000004

R for other

PERMISSION_MASK_IRUSR #

Source
PERMISSION_MASK_IRUSR :: 0o000400

R for owner

PERMISSION_MASK_IRWXG #

Source
PERMISSION_MASK_IRWXG :: 0o000070

For group Mode/Permission Flags for Open etc.

PERMISSION_MASK_IRWXO #

Source
PERMISSION_MASK_IRWXO :: 0o000007

For other Mode/Permission Flags for Open etc.

PERMISSION_MASK_IRWXU #

Source
PERMISSION_MASK_IRWXU :: 0o000700

For owner Mode/Permission Flags for Open etc.

PERMISSION_MASK_ISGID #

Source
PERMISSION_MASK_ISGID :: 0o002000

set group id on execution

PERMISSION_MASK_ISUID #

Source
PERMISSION_MASK_ISUID :: 0o004000

Special Mode/Permission Flags for Open etc.

PERMISSION_MASK_ISVTX #

Source
PERMISSION_MASK_ISVTX :: 0o001000

save swapped text even after use

PERMISSION_MASK_IWGRP #

Source
PERMISSION_MASK_IWGRP :: 0o000020

W for group

PERMISSION_MASK_IWOTH #

Source
PERMISSION_MASK_IWOTH :: 0o000002

W for other

PERMISSION_MASK_IWUSR #

Source
PERMISSION_MASK_IWUSR :: 0o000200

W for owner

PERMISSION_MASK_IXGRP #

Source
PERMISSION_MASK_IXGRP :: 0o000010

X for group

PERMISSION_MASK_IXOTH #

Source
PERMISSION_MASK_IXOTH :: 0o000001

X for other

PERMISSION_MASK_IXUSR #

Source
PERMISSION_MASK_IXUSR :: 0o000100

X for owner

PERMISSION_OTHER_ALL #

Source
PERMISSION_OTHER_ALL :: Permission{.PERMISSION_OTHER_READ, .PERMISSION_OTHER_WRITE, .PERMISSION_OTHER_EXECUTE}

PERMISSION_OWNER_ALL #

Source
PERMISSION_OWNER_ALL :: Permission{.PERMISSION_OWNER_READ, .PERMISSION_OWNER_WRITE, .PERMISSION_OWNER_EXECUTE}

PIDPATHINFO_MAXSIZE #

Source
PIDPATHINFO_MAXSIZE :: 4 * posix.PATH_MAX

TASK_DYLD_INFO_COUNT #

Source
TASK_DYLD_INFO_COUNT :: size_of(task_dyld_info) / size_of(u32)

THREAD_IDENTIFIER_INFO_COUNT #

Source
THREAD_IDENTIFIER_INFO_COUNT :: size_of(thread_identifier_info) / size_of(u32)

ULOCK_WAIT_2_AVAILABLE #

Source
ULOCK_WAIT_2_AVAILABLE :: ODIN_MINIMUM_OS_VERSION >= 11_00_00

VM_FLAGS_ALIAS_MASK #

Source
VM_FLAGS_ALIAS_MASK :: VM_Flags{.Alias_Mask1, .Alias_Mask2, .Alias_Mask3, .Alias_Mask4, .Alias_Mask5, .Alias_Mask6, .Alias_Mask7, .Alias_Mask8}

0xFF000000

VM_FLAGS_SUPERPAGE_MASK #

Source
VM_FLAGS_SUPERPAGE_MASK :: VM_Flags{.Superpage_Size_Any, .Superpage_Size_2MB, .__Superpage3}

* VM_FLAGS_SUPERPAGE_MASK * 3 bits that specify whether large pages should be used instead of * base pages (!=0), as well as the requested page size.

VM_FLAGS_SUPERPAGE_NONE #

Source
VM_FLAGS_SUPERPAGE_NONE :: VM_Flags{}

no superpages, if all bits are 0

VM_FLAGS_USER_ALLOCATE #

Source
VM_FLAGS_USER_ALLOCATE :: VM_Flags{.Anywhere, .Purgable, ._4GB_Chunk, .Random_Addr, .No_Cache, .Permanent, .Overwrite} | VM_FLAGS_FIXED | VM_FLAGS_SUPERPAGE_MASK | VM_FLAGS_ALIAS_MASK

These are the flags that we accept from user-space

VM_FLAGS_USER_MAP #

Source
VM_FLAGS_USER_MAP :: VM_Flags{.Return_4K_Data_Addr, .Return_Data_Addr} | VM_FLAGS_USER_ALLOCATE

VM_FLAGS_USER_REMAP #

Source
VM_FLAGS_USER_REMAP :: VM_Flags{.Anywhere, .Random_Addr, .Overwrite, .Return_Data_Addr, .Resilient_Codesign, .Resilient_Media} | VM_FLAGS_FIXED

VM_PROT_ALL #

Source
VM_PROT_ALL :: VM_Prot_Flags{.Read, .Write, .Execute}

VM_PROT_DEFAULT #

Source
VM_PROT_DEFAULT :: VM_Prot_Flags{.Read, .Write}

VM_REGION_SUBMAP_INFO_COUNT_64 #

Source
VM_REGION_SUBMAP_INFO_COUNT_64 :: size_of(vm_region_submap_info_64) / size_of(u32)

WAIT_ON_ADDRESS_AVAILABLE #

Source
WAIT_ON_ADDRESS_AVAILABLE :: ODIN_MINIMUM_OS_VERSION >= 14_04_00

X_OK #

Source
X_OK :: c.int((1 << 0))

test for execute or search permission

X86_THREAD_STATE32_COUNT #

Source
X86_THREAD_STATE32_COUNT :: size_of(x86_thread_state32_t) / size_of(u32)

X86_THREAD_STATE64_COUNT #

Source
X86_THREAD_STATE64_COUNT :: size_of(x86_thread_state64_t) / size_of(u32)

Types

94

boolean_t #

Source
boolean_t :: b32

NOTE(beau): typedefed to int in the original headers

copyfile_flags #

Source
copyfile_flags :: bit_set[enum int {
	ACL,
	STAT,
	XATTR,
	DATA,
	RECURSIVE = 15,
	CHECK,
	EXCL,
	NOFOLLOW_SRC,
	NOFOLLOW_DST,
	MOVE,
	UNLINK,
	PACK,
	UNPACK,
	CLONE,
	CLONE_FORCE,
	RUN_IN_PLACE,
	DATA_SPARSE,
	PRESERVE_DST_TRACKED,
	VERBOSE = 30,
}]

Procedures

109

copyfile #

Source
copyfile :: proc "c" (from, to: cstring, state: copyfile_state_t, flags: bit_set[enum int {
	ACL,
	STAT,
	XATTR,
	DATA,
	RECURSIVE = 15,
	CHECK,
	EXCL,
	NOFOLLOW_SRC,
	NOFOLLOW_DST,
	MOVE,
	UNLINK,
	PACK,
	UNPACK,
	CLONE,
	CLONE_FORCE,
	RUN_IN_PLACE,
	DATA_SPARSE,
	PRESERVE_DST_TRACKED,
	VERBOSE = 30,
}]) -> i32 ---

fcopyfile #

Source
fcopyfile :: proc "c" (from, to: FD, state: copyfile_state_t, flags: bit_set[enum int {
	ACL,
	STAT,
	XATTR,
	DATA,
	RECURSIVE = 15,
	CHECK,
	EXCL,
	NOFOLLOW_SRC,
	NOFOLLOW_DST,
	MOVE,
	UNLINK,
	PACK,
	UNPACK,
	CLONE,
	CLONE_FORCE,
	RUN_IN_PLACE,
	DATA_SPARSE,
	PRESERVE_DST_TRACKED,
	VERBOSE = 30,
}]) -> i32 ---

os_sync_wait_on_address #

Source
os_sync_wait_on_address :: proc "c" (addr: rawptr, value: u64, size: uint, flags: os_sync_wait_on_address_flags) -> i32 ---

This function provides an atomic compare-and-wait functionality that can be used to implement other higher level synchronization primitives. It reads a value from @addr, compares it to expected @value and blocks the calling thread if they are equal. This sequence of operations is done atomically with respect to other concurrent operations that can be performed on this @addr by other threads using this same function or os_sync_wake_by_addr variants. At this point, the blocked calling thread is considered to be a waiter on this @addr, waiting to be woken up by a call to os_sync_wake_by_addr variants. If the value at @addr turns out to be different than expected, the calling thread returns immediately without blocking. This function is expected to be used for implementing synchronization primitives that do not have a sense of ownership (e.g. condition variables, semaphores) as it does not provide priority inversion avoidance. For locking primitives, it is recommended that you use existing OS primitives such as os_unfair_lock API family / pthread mutex or std::mutex. @param addr The userspace address to be used for atomic compare-and-wait. This address must be aligned to @size. @param value The value expected at @addr. @param size The size of @value, in bytes. This can be either 4 or 8 today. For @value of @size 4 bytes, the upper 4 bytes of @value are ignored. @param flags Flags to alter behavior of os_sync_wait_on_address. See os_sync_wait_on_address_flags_t. @return If the calling thread is woken up by a call to os_sync_wake_by_addr variants or the value at @addr is different than expected, this function returns successfully and the return value indicates the number of outstanding waiters blocked on this address. In the event of an error, returns -1 with errno set to indicate the error. EINVAL : Invalid flags or size. EINVAL : The @addr passed is NULL or misaligned. EINVAL : The operation associated with existing kernel state at this @addr is inconsistent with what the caller has requested. It is important to make sure consistent values are passed across wait and wake APIs for @addr, @size and the shared memory specification (See os_sync_wait_on_address_flags_t). It is possible for the os_sync_wait_on_address and its variants to perform an early return in the event of following errors where user may want to re-try the wait operation. E.g. low memory conditions could cause such early return. It is important to read the current value at the @addr before re-trying to ensure that the new value still requires waiting on @addr. ENOMEM : Unable to allocate memory for kernel internal data structures. EINTR : The syscall was interrupted / spurious wake up. EFAULT : Unable to read value from the @addr. Kernel copyin failed. It is possible to receive EFAULT error in following cases: 1. The @addr is an invalid address. This is a programmer error. 2. The @addr is valid; but, this is a transient error such as due to low memory conditions. User may want to re-try the wait operation. Following code snippet illustrates a possible re-try loop. <code> retry: current = atomic_load_explicit(addr, memory_order_relaxed); if (current != expected) { int ret = os_sync_wait_on_address(addr, current, size, flags); if ((ret < 0) && ((errno == EINTR) || (errno == EFAULT))) { goto retry; } } </code>

os_sync_wait_on_address_with_deadline #

Source
os_sync_wait_on_address_with_deadline :: proc "c" (
	addr:     rawptr, 
	value:    u64, 
	size:     uint, 
	flags:    os_sync_wait_on_address_flags, 
	clockid:  os_clockid, 
	deadline: u64, 
) -> i32 ---

This function is a variant of os_sync_wait_on_address that allows the calling thread to specify a deadline until which it is willing to block. @param addr The userspace address to be used for atomic compare-and-wait. This address must be aligned to @size. @param value The value expected at @addr. @param size The size of @value, in bytes. This can be either 4 or 8 today. For @value of @size 4 bytes, the upper 4 bytes of @value are ignored. @param flags Flags to alter behavior of os_sync_wait_on_address_with_deadline. See os_sync_wait_on_address_flags_t. @param clockid This value anchors @deadline argument to a specific clock id. See os_clockid_t. @param deadline This value is used to specify a deadline until which the calling thread is willing to block. Passing zero for the @deadline results in an error being returned. It is recommended to use os_sync_wait_on_address API to block indefinitely until woken up by a call to os_sync_wake_by_address_any or os_sync_wake_by_address_all APIs. @return If the calling thread is woken up by a call to os_sync_wake_by_addr variants or the value at @addr is different than expected, this function returns successfully and the return value indicates the number of outstanding waiters blocked on this address. In the event of an error, returns -1 with errno set to indicate the error. In addition to errors returned by os_sync_wait_on_address, this function can return the following additional error codes. EINVAL : Invalid clock id. EINVAL : The @deadline passed is 0. ETIMEDOUT : Deadline expired.

os_sync_wait_on_address_with_timeout #

Source
os_sync_wait_on_address_with_timeout :: proc "c" (
	addr:       rawptr, 
	value:      u64, 
	size:       uint, 
	flags:      os_sync_wait_on_address_flags, 
	clockid:    os_clockid, 
	timeout_ns: u64, 
) -> i32 ---

This function is a variant of os_sync_wait_on_address that allows the calling thread to specify a timeout until which it is willing to block. @param addr The userspace address to be used for atomic compare-and-wait. This address must be aligned to @size. @param value The value expected at @addr. @param size The size of @value, in bytes. This can be either 4 or 8 today. For @value of @size 4 bytes, the upper 4 bytes of @value are ignored. @param flags Flags to alter behavior of os_sync_wait_on_address_with_timeout. See os_sync_wait_on_address_flags_t. @param clockid This value anchors @timeout_ns argument to a specific clock id. See os_clockid_t. @param timeout_ns This value is used to specify a timeout in nanoseconds until which the calling thread is willing to block. Passing zero for the @timeout_ns results in an error being returned. It is recommended to use os_sync_wait_on_address API to block indefinitely until woken up by a call to os_sync_wake_by_address_any or os_sync_wake_by_address_all APIs. @return If the calling thread is woken up by a call to os_sync_wake_by_address variants or the value at @addr is different than expected, this function returns successfully and the return value indicates the number of outstanding waiters blocked on this address. In the event of an error, returns -1 with errno set to indicate the error. In addition to errors returned by os_sync_wait_on_address, this function can return the following additional error codes. EINVAL : Invalid clock id. EINVAL : The @timeout_ns passed is 0. ETIMEDOUT : Timeout expired.

os_sync_wake_by_address_all #

Source
os_sync_wake_by_address_all :: proc "c" (addr: rawptr, size: uint, flags: os_sync_wake_by_address_flags) -> i32 ---

This function is a variant of os_sync_wake_by_address_any that wakes up all waiters blocked in os_sync_wait_on_address or its variants. @param addr The userspace address to be used for waking up the blocked waiters. It should be same as what is passed to os_sync_wait_on_address or its variants. @param size The size of lock value, in bytes. This can be either 4 or 8 today. It should be same as what is passed to os_sync_wait_on_address or its variants. @param flags Flags to alter behavior of os_sync_wake_by_address_all. See os_sync_wake_by_address_flags_t. @return Returns 0 on success. In the event of an error, returns -1 with errno set to indicate the error. This function returns same error codes as returned by os_sync_wait_on_address.

os_sync_wake_by_address_any #

Source
os_sync_wake_by_address_any :: proc "c" (addr: rawptr, size: uint, flags: os_sync_wake_by_address_flags) -> i32 ---

This function wakes up one waiter out of all those blocked in os_sync_wait_on_address or its variants on the @addr. No guarantee is provided about which specific waiter is woken up. @param addr The userspace address to be used for waking up the blocked waiter. It should be same as what is passed to os_sync_wait_on_address or its variants. @param size The size of lock value, in bytes. This can be either 4 or 8 today. It should be same as what is passed to os_sync_wait_on_address or its variants. @param flags Flags to alter behavior of os_sync_wake_by_address_any. See os_sync_wake_by_address_flags_t. @return Returns 0 on success. In the event of an error, returns -1 with errno set to indicate the error. EINVAL : Invalid flags or size. EINVAL : The @addr passed is NULL. EINVAL : The operation associated with existing kernel state at this @addr is inconsistent with what caller has requested. It is important to make sure consistent values are passed across wait and wake APIs for @addr, @size and the shared memory specification (See os_sync_wake_by_address_flags_t). ENOENT : No waiter(s) found waiting on the @addr.

sys_write_string #

Source
sys_write_string :: proc(fd: i32, message: string) -> bool {…}

this package uses the sys prefix for the proc names to indicate that these aren't native syscalls but directly call such

syscall_fcntl #

Source
syscall_fcntl :: proc "contextless" (fd: i32, cmd: i32, other: rawptr) -> i32 {…}

think about this? last arg should be more than one

syscall_getdirentries #

Source
syscall_getdirentries :: proc "contextless" (fd: i32, buf: ^u8, nbytes: i32, base_pointer: ^u32) -> i32 {…}

Variables

3