package core:sys/darwin
Warning: This was generated for -target:darwin_arm64
and might not represent every target this package supports.
Index
Types (62)
- Bool
- Kern_Return
- Offset_From
- Open_Flags
- Open_Flags_Enum
- PBI_Flag_Bits
- PBI_Flags
- PID_Info_Flavor
- Permission
- Permission_Enum
- Pid_Rusage_Flavor
- RUsage
- Sync_Policy
- System_Call_Number
- VM_Flag
- VM_Flags
- VM_Inherit
- VM_Prot
- VM_Prot_Flags
- blkcnt_t
- blksize_t
- boolean_t
- dev_t
- fsid_t
- gid_t
- ipc_space_t
- kern_return_t
- mach_port_name_t
- mach_port_t
- mem_entry_name_port_t
- mode_t
- nlink_t
- off_t
- os_clockid
- os_sync_wait_on_address_flag
- os_sync_wait_on_address_flags
- os_sync_wake_by_address_flag
- os_sync_wake_by_address_flags
- pid_t
- proc_bsdinfo
- proc_bsdshortinfo
- proc_taskallinfo
- proc_taskinfo
- proc_vnodepathinfo
- rusage_info_v0
- semaphore_t
- stat
- sync_policy_t
- task_t
- thread_t
- time_t
- timeval
- uid_t
- vinfo_stat
- vm_address_t
- vm_inherit_t
- vm_map_t
- vm_offset_t
- vm_prot_t
- vm_size_t
- vnode_info
- vnode_info_path
Constants (105)
- COPYFILE_ACL
- COPYFILE_ALL
- COPYFILE_DATA
- COPYFILE_METADATA
- COPYFILE_SECURITY
- COPYFILE_STAT
- COPYFILE_XATTR
- DARWIN_MAXCOMLEN
- DARWIN_PROC_ALL_PIDS
- DARWIN_PROC_INFO_CALL_CANUSEFGHW
- DARWIN_PROC_INFO_CALL_DIRTYCONTROL
- DARWIN_PROC_INFO_CALL_KERNMSGBUF
- DARWIN_PROC_INFO_CALL_LISTCOALITIONS
- DARWIN_PROC_INFO_CALL_LISTPIDS
- DARWIN_PROC_INFO_CALL_PIDDYNKQUEUEINFO
- DARWIN_PROC_INFO_CALL_PIDFDINFO
- DARWIN_PROC_INFO_CALL_PIDFILEPORTINFO
- DARWIN_PROC_INFO_CALL_PIDINFO
- DARWIN_PROC_INFO_CALL_PIDORIGINATORINFO
- DARWIN_PROC_INFO_CALL_PIDRUSAGE
- DARWIN_PROC_INFO_CALL_SETCONTROL
- DARWIN_PROC_INFO_CALL_TERMINATE
- DARWIN_PROC_INFO_CALL_UDATA_INFO
- DARWIN_PROC_KDBG_ONLY
- DARWIN_PROC_PGRP_ONLY
- DARWIN_PROC_PIDPATHINFO
- DARWIN_PROC_PIDPATHINFO_SIZE
- DARWIN_PROC_PPID_ONLY
- DARWIN_PROC_RUID_ONLY
- DARWIN_PROC_TTY_ONLY
- DARWIN_PROC_UID_ONLY
- F_OK
- LOCK_EX
- LOCK_NB
- LOCK_SH
- LOCK_UN
- MAP_32BIT
- MAP_ANONYMOUS
- MAP_FILE
- MAP_FIXED
- MAP_HASSEMAPHORE
- MAP_JIT
- MAP_NOCACHE
- MAP_PRIVATE
- MAP_SHARED
- MASK_ACCMODE
- MAXCOMLEN
- MAXPATHLEN
- OPEN_FLAG_APPEND
- OPEN_FLAG_CLOEXEC
- OPEN_FLAG_CREAT
- OPEN_FLAG_DIRECTORY
- OPEN_FLAG_EVTONLY
- OPEN_FLAG_EXCL
- OPEN_FLAG_EXLOCK
- OPEN_FLAG_NOFOLLOW
- OPEN_FLAG_NOFOLLOW_ANY
- OPEN_FLAG_NONBLOCK
- OPEN_FLAG_RDONLY
- OPEN_FLAG_RDWR
- OPEN_FLAG_SHLOCK
- OPEN_FLAG_SYMLINK
- OPEN_FLAG_TRUNC
- OPEN_FLAG_WRONLY
- PATH_MAX
- PERMISSION_ALL_ALL
- PERMISSION_GROUP_ALL
- PERMISSION_MASK_IRGRP
- PERMISSION_MASK_IROTH
- PERMISSION_MASK_IRUSR
- PERMISSION_MASK_IRWXG
- PERMISSION_MASK_IRWXO
- PERMISSION_MASK_IRWXU
- PERMISSION_MASK_ISGID
- PERMISSION_MASK_ISUID
- PERMISSION_MASK_ISVTX
- PERMISSION_MASK_IWGRP
- PERMISSION_MASK_IWOTH
- PERMISSION_MASK_IWUSR
- PERMISSION_MASK_IXGRP
- PERMISSION_MASK_IXOTH
- PERMISSION_MASK_IXUSR
- PERMISSION_NONE_NONE
- PERMISSION_OTHER_ALL
- PERMISSION_OWNER_ALL
- PIDPATHINFO_MAXSIZE
- PROT_EXEC
- PROT_NONE
- PROT_READ
- PROT_WRITE
- R_OK
- ULOCK_WAIT_2_AVAILABLE
- VM_FLAGS_ALIAS_MASK
- VM_FLAGS_FIXED
- VM_FLAGS_SUPERPAGE_MASK
- VM_FLAGS_SUPERPAGE_NONE
- VM_FLAGS_USER_ALLOCATE
- VM_FLAGS_USER_MAP
- VM_FLAGS_USER_REMAP
- VM_PROT_ALL
- VM_PROT_DEFAULT
- VM_PROT_NONE
- WAIT_ON_ADDRESS_AVAILABLE
- W_OK
- X_OK
Variables (1)
Procedures (85)
- VM_GET_FLAGS_ALIAS
- errno
- mach_make_memory_entry
- mach_port_deallocate
- mach_task_self
- os_sync_wait_on_address
- os_sync_wait_on_address_with_deadline
- os_sync_wait_on_address_with_timeout
- os_sync_wake_by_address_all
- os_sync_wake_by_address_any
- proc_listallpids
- proc_pid_rusage
- proc_pidinfo
- proc_pidpath
- semaphore_create
- semaphore_destroy
- semaphore_signal
- semaphore_signal_all
- semaphore_signal_thread
- semaphore_wait
- sys_chmod
- sys_lseek
- sys_lstat
- sys_mkdir
- sys_mkdir_at
- sys_open
- sys_rename
- sys_rename_at
- sys_rmdir
- sys_shm_open
- sys_write_string
- syscall_access
- syscall_adjtime
- syscall_chdir
- syscall_chmod
- syscall_close
- syscall_copyfile
- syscall_dup
- syscall_execve
- syscall_exit
- syscall_faccessat
- syscall_fchdir
- syscall_fchmod
- syscall_fcntl
- syscall_flock
- syscall_fstat
- syscall_fstatat
- syscall_fsync
- syscall_ftruncate
- syscall_futimes
- syscall_getdirentries
- syscall_getentropy
- syscall_getrusage
- syscall_gettid
- syscall_kill
- syscall_link
- syscall_linkat
- syscall_lseek
- syscall_lstat
- syscall_mkdir
- syscall_mkdir_at
- syscall_mmap
- syscall_munmap
- syscall_open
- syscall_openat
- syscall_pipe
- syscall_proc_info
- syscall_read
- syscall_readlink
- syscall_readlinkat
- syscall_rename
- syscall_rename_at
- syscall_rmdir
- syscall_shm_open
- syscall_shm_unlink
- syscall_stat
- syscall_sysctl
- syscall_sysctlbyname
- syscall_truncate
- syscall_utimes
- syscall_write
- unix_offset_syscall
- vm_allocate
- vm_deallocate
- vm_map
Procedure Groups (0)
This section is empty.
Types
Kern_Return ¶
Kern_Return :: enum kern_return_t { Success, // Specified address is not currently valid. Invalid_Address, // Specified memory is valid, but does not permit the // * required forms of access. Protection_Failure, // The address range specified is already in use, or // * no address range of the size specified could be // * found. No_Space, // The function requested was not applicable to this // * type of argument, or an argument is invalid Invalid_Argument, // The function could not be performed. A catch-all. Failure, // A system resource could not be allocated to fulfill // * this request. This failure may not be permanent. Resource_Shortage, // The task in question does not hold receive rights // * for the port argument. Not_Receiver, // Bogus access restriction. No_Access, // During a page fault, the target address refers to a // * memory object that has been destroyed. This // * failure is permanent. Memory_Failure, // During a page fault, the memory object indicated // * that the data could not be returned. This failure // * may be temporary; future attempts to access this // * same data may succeed, as defined by the memory // * object. Memory_Error, // The receive right is already a member of the portset. Already_In_Set, // The receive right is not a member of a port set. Not_In_Set, // The name already denotes a right in the task. Name_Exists, // The operation was aborted. Ipc code will // * catch this and reflect it as a message error. Aborted, // The name doesn't denote a right in the task. Invalid_Name, // Target task isn't an active task. Invalid_Task, // The name denotes a right, but not an appropriate right. Invalid_Right, // A blatant range error. Invalid_Value, // Operation would overflow limit on user-references. URefs_Overflow, // The supplied (port) capability is improper. Invalid_Capability, // The task already has send or receive rights // * for the port under another name. Right_Exists, // Target host isn't actually a host. Invalid_Host, // An attempt was made to supply "precious" data // * for memory that is already present in a // * memory object. Memory_Present, // A page was requested of a memory manager via // * memory_object_data_request for an object using // * a MEMORY_OBJECT_COPY_CALL strategy, with the // * VM_PROT_WANTS_COPY flag being used to specify // * that the page desired is for a copy of the // * object, and the memory manager has detected // * the page was pushed into a copy of the object // * while the kernel was walking the shadow chain // * from the copy to the object. This error code // * is delivered via memory_object_data_error // * and is handled by the kernel (it forces the // * kernel to restart the fault). It will not be // * seen by users. Memory_Data_Moved, // A strategic copy was attempted of an object // * upon which a quicker copy is now possible. // * The caller should retry the copy using // * vm_object_copy_quickly. This error code // * is seen only by the kernel. Memory_Restart_Copy, // An argument applied to assert processor set privilege // * was not a processor set control port. Invalid_Processor_Set, // The specified scheduling attributes exceed the thread's // * limits. Policy_Limit, // The specified scheduling policy is not currently // * enabled for the processor set. Invalid_Policy, // The external memory manager failed to initialize the // * memory object. Invalid_Object, // A thread is attempting to wait for an event for which // * there is already a waiting thread. Already_Waiting, // An attempt was made to destroy the default processor // * set. Default_Set, // An attempt was made to fetch an exception port that is // * protected, or to abort a thread while processing a // * protected exception. Exception_Protected, // A ledger was required but not supplied. Invalid_Ledger, // The port was not a memory cache control port. Invalid_Memory_Control, // An argument supplied to assert security privilege // * was not a host security port. Invalid_Security, // thread_depress_abort was called on a thread which // * was not currently depressed. Not_Depressed, // Object has been terminated and is no longer available Terminated, // Lock set has been destroyed and is no longer available. Lock_Set_Destroyed, // The thread holding the lock terminated before releasing // * the lock Lock_Unstable, // The lock is already owned by another thread Lock_Owned, // The lock is already owned by the calling thread Lock_Owned_Self, // Semaphore has been destroyed and is no longer available. Semaphore_Destroyed, // Return from RPC indicating the target server was // * terminated before it successfully replied Rpc_Server_Terminated, // Terminate an orphaned activation. RPC_Terminate_Orphan, // Allow an orphaned activation to continue executing. RPC_Continue_Orphan, // Empty thread activation (No thread linked to it) Not_Supported, // Remote node down or inaccessible. Node_Down, // A signalled thread was not actually waiting. Not_Waiting, // Some thread-oriented operation (semaphore_wait) timed out Operation_Timed_Out, // During a page fault, indicates that the page was rejected // * as a result of a signature check. Codesign_Error, // The requested property cannot be changed at this time. Policy_Static, // The provided buffer is of insufficient size for the requested data. Insufficient_Buffer_Size, // Denied by security policy Denied, // The KC on which the function is operating is missing Missing_KC, // The KC on which the function is operating is invalid Invalid_KC, // A search or query operation did not return a result Not_Found, // Maximum return value allowable Return_Max = 256, }
Related Procedures With Returns
Offset_From ¶
Offset_From :: enum i32 { SEEK_SET = 0, // the offset is set to offset bytes. SEEK_CUR = 1, // the offset is set to its current location plus offset bytes. SEEK_END = 2, // the offset is set to the size of the file plus offset bytes. SEEK_HOLE = 3, // the offset is set to the start of the next hole greater than or equal to the supplied offset. SEEK_DATA = 4, // the offset is set to the start of the next non-hole file region greater than or equal to the supplied offset. }
Related Procedures With Parameters
Open_Flags ¶
Open_Flags :: bit_set[Open_Flags_Enum; u16]
Open_Flags_Enum ¶
Open_Flags_Enum :: enum u8 { RDONLY, // open for reading only WRONLY, // open for writing only RDWR, // open for reading and writing NONBLOCK, // no delay APPEND, // set append mode CREAT, // create if nonexistant TRUNC, // truncate to zero length EXCL, // error if already exists SHLOCK, // open with shared file lock EXLOCK, // open with exclusive file lock DIRECTORY, // restrict open to only directories NOFOLLOW, // don't follow symlinks SYMLINK, // allow open of a symlink EVTONLY, // descriptor requested for event notifications only CLOEXEC, // causes the descriptor to be closed if you use any of the exec like functions NOFOLLOW_ANY, // no symlinks allowed in path }
PBI_Flag_Bits ¶
PBI_Flag_Bits :: enum u32 { SYSTEM = 0, TRACED = 1, INEXIT = 2, PWAIT = 3, LP64 = 4, SLEADER = 5, CTTY = 6, CONTROLT = 7, THCWD = 8, PC_THROTTLE = 9, PC_SUSP = 10, PC_KILL = 10, PA_THROTTLE = 11, PA_SUSP = 12, PA_PSUGID = 13, EXEC = 14, }
PBI_Flags ¶
PBI_Flags :: bit_set[PBI_Flag_Bits; u32]
PID_Info_Flavor ¶
PID_Info_Flavor :: enum i32 { LISTFDS = 1, TASKALLINFO, BSDINFO, TASKINFO, THREADINFO, LISTTHREADS, REGIONINFO, REGIONPATHINFO, VNODEPATHINFO, THREADPATHINFO, PATHINFO, WORKQUEUEINFO, SHORTBSDINFO, LISTFILEPORTS, THREADID64INFO, RUSAGE, }
Related Procedures With Parameters
Permission_Enum ¶
Permission_Enum :: enum u8 { // For owner PERMISSION_OWNER_READ, // R for owner PERMISSION_OWNER_WRITE, // W for owner PERMISSION_OWNER_EXECUTE, // X for owner // For group PERMISSION_GROUP_READ, // R for group PERMISSION_GROUP_WRITE, // W for group PERMISSION_GROUP_EXECUTE, // X for group // For other PERMISSION_OTHER_READ, // R for other PERMISSION_OTHER_WRITE, // W for other PERMISSION_OTHER_EXECUTE, // X for other // Special PERMISSION_SET_USER_ON_EXECUTION, // set user id on execution PERMISSION_SET_GROUP_ON_EXECUTION, // set group id on execution // ?? PERMISSION_ISVTX, // save swapped text even after use }
Pid_Rusage_Flavor ¶
Pid_Rusage_Flavor :: enum i32 { V0, V1, V2, V3, V4, V5, }
Related Procedures With Parameters
RUsage ¶
RUsage :: struct { ru_utime: _STRUCT_TIMEVAL, ru_stime: _STRUCT_TIMEVAL, ru_maxrss: i64, ru_ixrss: i64, ru_idrss: i64, ru_isrss: i64, ru_minflt: i64, ru_majflt: i64, ru_nswap: i64, ru_inblock: i64, ru_oublock: i64, ru_msgsnd: i64, ru_msgrcv: i64, ru_nsignals: i64, ru_nvcsw: i64, ru_nivcsw: i64, }
Related Procedures With Parameters
Sync_Policy ¶
Sync_Policy :: enum sync_policy_t { Fifo, Fixed_Priority, Reversed, Order_Mask, Lifo = 2, }
Related Procedures With Parameters
System_Call_Number ¶
System_Call_Number :: enum uintptr { // 0 syscall exit = 1, fork = 2, read = 3, write = 4, open = 5, close = 6, wait4 = 7, // 8 old creat link = 9, unlink = 10, // 11 old execv chdir = 12, fchdir = 13, mknod = 14, chmod = 15, chown = 16, // 17 old break getfsstat = 18, // 19 old lseek getpid = 20, // 21 old mount // 22 old umount setuid = 23, getuid = 24, geteuid = 25, ptrace = 26, recvmsg = 27, sendmsg = 28, recvfrom = 29, accept = 30, getpeername = 31, getsockname = 32, access = 33, chflags = 34, fchflags = 35, sync = 36, kill = 37, // 38 old stat getppid = 39, // 40 old lstat dup = 41, pipe = 42, getegid = 43, // 44 old profil // 45 old ktrace sigaction = 46, getgid = 47, sigprocmask = 48, getlogin = 49, setlogin = 50, acct = 51, sigpending = 52, sigaltstack = 53, ioctl = 54, reboot = 55, revoke = 56, symlink = 57, readlink = 58, execve = 59, umask = 60, chroot = 61, // 62 old fstat // 63 used internally and reserved // getpagesize = 64, invalid msync = 65, vfork = 66, // 67 old vread // 68 old vwrite // 69 old sbrk // 70 old sstk // 71 old mmap // 72 old vadvise munmap = 73, mprotect = 74, madvise = 75, // 76 old vhangup // 77 old vlimit mincore = 78, getgroups = 79, setgroups = 80, getpgrp = 81, setpgid = 82, setitimer = 83, // 84 old wait swapon = 85, getitimer = 86, // 87 old gethostname // 88 old sethostname getdtablesize = 89, dup2 = 90, // 91 old getdopt fcntl = 92, select = 93, // 94 old setdopt fsync = 95, setpriority = 96, socket = 97, connect = 98, // 99 old accept getpriority = 100, // 101 old send // 102 old recv // 103 old sigreturn bind = 104, setsockopt = 105, listen = 106, // 107 old vtimes // 108 old sigvec // 109 old sigblock // 110 old sigsetmask sigsuspend = 111, // 112 old sigstack // 113 old recvmsg // 114 old sendmsg // 115 old vtrace gettimeofday = 116, getrusage = 117, getsockopt = 118, // 119 old resuba readv = 120, writev = 121, settimeofday = 122, fchown = 123, fchmod = 124, // 125 old recvfrom setreuid = 126, setregid = 127, rename = 128, // 129 old truncate // 130 old ftruncate flock = 131, mkfifo = 132, sendto = 133, shutdown = 134, socketpair = 135, mkdir = 136, rmdir = 137, utimes = 138, futimes = 139, adjtime = 140, // 141 old getpeername gethostuuid = 142, // 143 old sethostid // 144 old getrlimit // 145 old setrlimit // 146 old killpg setsid = 147, // 148 old setquota // 149 old qquota // 150 old getsockname getpgid = 151, setprivexec = 152, pread = 153, pwrite = 154, nfssvc = 155, // 156 old getdirentries statfs = 157, fstatfs = 158, unmount = 159, // 160 old async_daemon getfh = 161, // 162 old getdomainname // 163 old setdomainname // 164 quotactl = 165, // 166 old exportfs mount = 167, // 168 old ustat csops = 169, csops_audittoken = 170, // 171 old wait3 // 172 old rpause waitid = 173, // 174 old getdents // 175 old gc_control // 176 old add_profil kdebug_typefilter = 177, kdebug_trace_string = 178, kdebug_trace64 = 179, kdebug_trace = 180, setgid = 181, setegid = 182, seteuid = 183, sigreturn = 184, // 185 old chud thread_selfcounts = 186, fdatasync = 187, stat = 188, fstat = 189, lstat = 190, pathconf = 191, fpathconf = 192, // 193 old getfsstat getrlimit = 194, setrlimit = 195, getdirentries = 196, mmap = 197, // 198 old __syscall lseek = 199, truncate = 200, ftruncate = 201, sysctl = 202, mlock = 203, munlock = 204, undelete = 205, // 206 old ATsocket // 207 old ATgetmsg // 208 old ATputmsg // 209 old ATsndreq // 210 old ATsndrsp // 211 old ATgetreq // 212 old ATgetrsp // 213 Reserved for AppleTalk // 214 // 215 open_dprotected_np = 216, fsgetpath_ext = 217, // 218 old lstatv // 219 old fstatv getattrlist = 220, setattrlist = 221, getdirentriesattr = 222, exchangedata = 223, // 224 old checkuseraccess or fsgetpath searchfs = 225, delete = 226, copyfile = 227, fgetattrlist = 228, fsetattrlist = 229, poll = 230, // 231 old watchevent // 232 old waitevent // 233 old modwatch getxattr = 234, fgetxattr = 235, setxattr = 236, fsetxattr = 237, removexattr = 238, fremovexattr = 239, listxattr = 240, flistxattr = 241, fsctl = 242, initgroups = 243, posix_spawn = 244, ffsctl = 245, // 246 nfsclnt = 247, fhopen = 248, // 249 minherit = 250, semsys = 251, msgsys = 252, shmsys = 253, semctl = 254, semget = 255, semop = 256, // 257 old semconfig msgctl = 258, msgget = 259, msgsnd = 260, msgrcv = 261, shmat = 262, shmctl = 263, shmdt = 264, shmget = 265, shm_open = 266, shm_unlink = 267, sem_open = 268, sem_close = 269, sem_unlink = 270, sem_wait = 271, sem_trywait = 272, sem_post = 273, sysctlbyname = 274, // 275 old sem_init // 276 old sem_destroy open_extended = 277, umask_extended = 278, stat_extended = 279, lstat_extended = 280, fstat_extended = 281, chmod_extended = 282, fchmod_extended = 283, access_extended = 284, settid = 285, gettid = 286, setsgroups = 287, getsgroups = 288, setwgroups = 289, getwgroups = 290, mkfifo_extended = 291, mkdir_extended = 292, identitysvc = 293, shared_region_check_np = 294, // 295 old shared_region_map_np vm_pressure_monitor = 296, psynch_rw_longrdlock = 297, psynch_rw_yieldwrlock = 298, psynch_rw_downgrade = 299, psynch_rw_upgrade = 300, psynch_mutexwait = 301, psynch_mutexdrop = 302, psynch_cvbroad = 303, psynch_cvsignal = 304, psynch_cvwait = 305, psynch_rw_rdlock = 306, psynch_rw_wrlock = 307, psynch_rw_unlock = 308, psynch_rw_unlock2 = 309, getsid = 310, settid_with_pid = 311, psynch_cvclrprepost = 312, aio_fsync = 313, aio_return = 314, aio_suspend = 315, aio_cancel = 316, aio_error = 317, aio_read = 318, aio_write = 319, lio_listio = 320, // 321 old __pthread_cond_wait iopolicysys = 322, process_policy = 323, mlockall = 324, munlockall = 325, // 326 issetugid = 327, __pthread_kill = 328, __pthread_sigmask = 329, __sigwait = 330, __disable_threadsignal = 331, __pthread_markcancel = 332, __pthread_canceled = 333, __semwait_signal = 334, // 335 old utrace proc_info = 336, sendfile = 337, stat64 = 338, fstat64 = 339, lstat64 = 340, stat64_extended = 341, lstat64_extended = 342, fstat64_extended = 343, getdirentries64 = 344, statfs64 = 345, fstatfs64 = 346, getfsstat64 = 347, __pthread_chdir = 348, __pthread_fchdir = 349, audit = 350, auditon = 351, // 352 getauid = 353, setauid = 354, // 355 old getaudit // 356 old setaudit getaudit_addr = 357, setaudit_addr = 358, auditctl = 359, bsdthread_create = 360, bsdthread_terminate = 361, kqueue = 362, kevent = 363, lchown = 364, // 365 old stack_snapshot bsdthread_register = 366, workq_open = 367, workq_kernreturn = 368, kevent64 = 369, __old_semwait_signal = 370, __old_semwait_signal_nocancel = 371, thread_selfid = 372, ledger = 373, kevent_qos = 374, kevent_id = 375, // 376 // 377 // 378 // 379 __mac_execve = 380, __mac_syscall = 381, __mac_get_file = 382, __mac_set_file = 383, __mac_get_link = 384, __mac_set_link = 385, __mac_get_proc = 386, __mac_set_proc = 387, __mac_get_fd = 388, __mac_set_fd = 389, __mac_get_pid = 390, // 391 // 392 // 393 pselect = 394, pselect_nocancel = 395, read_nocancel = 396, write_nocancel = 397, open_nocancel = 398, close_nocancel = 399, wait4_nocancel = 400, recvmsg_nocancel = 401, sendmsg_nocancel = 402, recvfrom_nocancel = 403, accept_nocancel = 404, msync_nocancel = 405, fcntl_nocancel = 406, select_nocancel = 407, fsync_nocancel = 408, connect_nocancel = 409, sigsuspend_nocancel = 410, readv_nocancel = 411, writev_nocancel = 412, sendto_nocancel = 413, pread_nocancel = 414, pwrite_nocancel = 415, waitid_nocancel = 416, poll_nocancel = 417, msgsnd_nocancel = 418, msgrcv_nocancel = 419, sem_wait_nocancel = 420, aio_suspend_nocancel = 421, __sigwait_nocancel = 422, __semwait_signal_nocancel = 423, __mac_mount = 424, __mac_get_mount = 425, __mac_getfsstat = 426, fsgetpath = 427, audit_session_self = 428, audit_session_join = 429, fileport_makeport = 430, fileport_makefd = 431, audit_session_port = 432, pid_suspend = 433, pid_resume = 434, pid_hibernate = 435, pid_shutdown_sockets = 436, // 437 old shared_region_slide_np shared_region_map_and_slide_np = 438, kas_info = 439, memorystatus_control = 440, guarded_open_np = 441, guarded_close_np = 442, guarded_kqueue_np = 443, change_fdguard_np = 444, usrctl = 445, proc_rlimit_control = 446, connectx = 447, disconnectx = 448, peeloff = 449, socket_delegate = 450, telemetry = 451, proc_uuid_policy = 452, memorystatus_get_level = 453, system_override = 454, vfs_purge = 455, sfi_ctl = 456, sfi_pidctl = 457, coalition = 458, coalition_info = 459, necp_match_policy = 460, getattrlistbulk = 461, clonefileat = 462, openat = 463, openat_nocancel = 464, renameat = 465, faccessat = 466, fchmodat = 467, fchownat = 468, fstatat = 469, fstatat64 = 470, linkat = 471, unlinkat = 472, readlinkat = 473, symlinkat = 474, mkdirat = 475, getattrlistat = 476, proc_trace_log = 477, bsdthread_ctl = 478, openbyid_np = 479, recvmsg_x = 480, sendmsg_x = 481, thread_selfusage = 482, csrctl = 483, guarded_open_dprotected_np = 484, guarded_write_np = 485, guarded_pwrite_np = 486, guarded_writev_np = 487, renameatx_np = 488, mremap_encrypted = 489, netagent_trigger = 490, stack_snapshot_with_config = 491, microstackshot = 492, grab_pgo_data = 493, persona = 494, // 495 mach_eventlink_signal = 496, mach_eventlink_wait_until = 497, mach_eventlink_signal_wait_until = 498, work_interval_ctl = 499, getentropy = 500, necp_open = 501, necp_client_action = 502, nexus_open = 503, // for those who are intressted http://newosxbook.com/bonus/vol1ch16.html nexus_register = 504, nexus_deregister = 505, nexus_create = 506, nexus_destroy = 507, nexus_get_opt = 508, nexus_set_opt = 509, channel_open = 510, channel_get_info = 511, channel_sync = 512, channel_get_opt = 513, channel_set_opt = 514, ulock_wait = 515, ulock_wake = 516, fclonefileat = 517, fs_snapshot = 518, register_uexc_handler = 519, terminate_with_payload = 520, abort_with_payload = 521, necp_session_open = 522, necp_session_action = 523, setattrlistat = 524, net_qos_guideline = 525, fmount = 526, ntp_adjtime = 527, ntp_gettime = 528, os_fault_with_payload = 529, kqueue_workloop_ctl = 530, mach_bridge_remote_time = 531, coalition_ledger = 532, log_data = 533, memorystatus_available_memory = 534, objc_bp_assist_cfg_np = 535, shared_region_map_and_slide_2_np = 536, pivot_root = 537, task_inspect_for_pid = 538, task_read_for_pid = 539, preadv = 540, pwritev = 541, preadv_nocancel = 542, pwritev_nocancel = 543, ulock_wait2 = 544, proc_info_extended_id = 545, tracker_action = 546, debug_syscall_reject = 547, MAXSYSCALL = 548, }
Related Procedures With Parameters
VM_Flag ¶
VM_Flag :: enum i32 { Anywhere, Purgable, _4GB_Chunk, Random_Addr, No_Cache, Resilient_Codesign, Resilient_Media, Permanent, TPRO = 12, Overwrite = 14, // delete any existing mappings first Superpage_Size_Any = 16, Superpage_Size_2MB = 17, __Superpage3 = 18, Return_Data_Addr = 20, Return_4K_Data_Addr = 23, Alias_Mask1 = 24, Alias_Mask2, Alias_Mask3, Alias_Mask4, Alias_Mask5, Alias_Mask6, Alias_Mask7, Alias_Mask8, HW = 12, }
VM_Inherit ¶
VM_Inherit :: enum vm_inherit_t { Share, Copy, None, Donate_Copy, Default = 1, Last_Valid = 2, }
Related Procedures With Parameters
blkcnt_t ¶
blkcnt_t :: i64
blksize_t ¶
blksize_t :: i32
ipc_space_t ¶
ipc_space_t :: mach_port_t
kern_return_t ¶
kern_return_t :: distinct i32
mach_port_t ¶
mach_port_t :: distinct u32
Related Procedures With Parameters
- mach_make_memory_entry
- mach_port_deallocate
- semaphore_create
- semaphore_destroy
- semaphore_signal
- semaphore_signal_all
- semaphore_signal_thread
- semaphore_wait
- vm_allocate
- vm_deallocate
- vm_map
Related Procedures With Returns
mem_entry_name_port_t ¶
mem_entry_name_port_t :: mach_port_t
os_sync_wait_on_address_flag ¶
os_sync_wait_on_address_flag :: enum u32 { // This flag should be used when synchronizing among multiple processes by // placing the @addr passed to os_sync_wait_on_address and its variants // in a shared memory region. // // When using this flag, it is important to pass OS_SYNC_WAKE_BY_ADDRESS_SHARED // flag along with the exact same @addr to os_sync_wake_by_address_any and // its variants to correctly find and wake up blocked waiters on the @addr. // // This flag should not be used when synchronizing among multiple threads of // a single process. It allows the kernel to perform performance optimizations // as the @addr is local to the calling process. SHARED = 0, }
os_sync_wait_on_address_flags ¶
os_sync_wait_on_address_flags :: distinct bit_set[os_sync_wait_on_address_flag; u32]
Related Procedures With Parameters
os_sync_wake_by_address_flag ¶
os_sync_wake_by_address_flag :: enum u32 { // This flag should be used when synchronizing among multiple processes by // placing the @addr passed to os_sync_wake_by_address_any and its variants // in a shared memory region. // // When using this flag, it is important to pass OS_SYNC_WAIT_ON_ADDRESS_SHARED // flag along with the exact same @addr to os_sync_wait_on_address and // its variants to correctly find and wake up blocked waiters on the @addr. // // This flag should not be used when synchronizing among multiple threads of // a single process. It allows the kernel to perform performance optimizations // as the @addr is local the calling process. SHARED = 0, }
os_sync_wake_by_address_flags ¶
os_sync_wake_by_address_flags :: distinct bit_set[os_sync_wake_by_address_flag; u32]
Related Procedures With Parameters
proc_bsdinfo ¶
proc_bsdinfo :: struct { pbi_flags: bit_set[PBI_Flag_Bits; u32], pbi_status: u32, pbi_xstatus: u32, pbi_pid: u32, pbi_ppid: u32, pbi_uid: posix.uid_t, pbi_gid: posix.gid_t, pbi_ruid: posix.uid_t, pbi_rgid: posix.gid_t, pbi_svuid: posix.uid_t, pbi_svgid: posix.gid_t, rfu_1: u32, pbi_comm: [16]u8 `fmt:"s,0"`, pbi_name: [32]u8 `fmt:"s,0"`, pbi_nfiles: u32, pbi_pgid: u32, pbi_pjobc: u32, e_tdev: u32, e_tpgid: u32, pbi_nice: i32, pbi_start_tvsec: u64, pbi_start_tvusec: u64, }
proc_bsdshortinfo ¶
proc_bsdshortinfo :: struct { pbsi_pid: u32, pbsi_ppid: u32, pbsi_pgid: u32, pbsi_status: u32, pbsi_comm: [16]u8 `fmt:"s,0"`, pbsi_flags: bit_set[PBI_Flag_Bits; u32], pbsi_uid: posix.uid_t, pbsi_gid: posix.gid_t, pbsi_ruid: posix.uid_t, pbsi_rgid: posix.gid_t, pbsi_svuid: posix.uid_t, pbsi_svgid: posix.gid_t, pbsi_rfu: u32, }
proc_taskallinfo ¶
proc_taskallinfo :: struct { pbsd: proc_bsdinfo, ptinfo: proc_taskinfo, }
proc_taskinfo ¶
proc_taskinfo :: struct { pti_virtual_size: u64 `fmt:"M"`, pti_resident_size: u64 `fmt:"M"`, pti_total_user: u64, pti_total_system: u64, pti_threads_user: u64, pti_threads_system: u64, pti_policy: i32, pti_faults: i32, pti_pageins: i32, pti_cow_faults: i32, pti_messages_sent: i32, pti_messages_received: i32, pti_syscalls_mach: i32, pti_syscalls_unix: i32, pti_csw: i32, pti_threadnum: i32, pti_numrunning: i32, pti_priority: i32, }
proc_vnodepathinfo ¶
proc_vnodepathinfo :: struct { pvi_cdir: vnode_info_path, pvi_rdir: vnode_info_path, }
semaphore_t ¶
semaphore_t :: mach_port_t
stat ¶
stat :: __DARWIN_STRUCT_STAT64
sync_policy_t ¶
sync_policy_t :: distinct i32
task_t ¶
task_t :: mach_port_t
thread_t ¶
thread_t :: mach_port_t
timeval ¶
timeval :: _STRUCT_TIMEVAL
vinfo_stat ¶
vinfo_stat :: struct { vst_dev: u32, vst_mode: u16, vst_nlink: u16, vst_ino: u64, vst_uid: posix.uid_t, vst_gid: posix.gid_t, vst_atime: i64, vst_atimensec: i64, vst_mtime: i64, vst_mtimensec: i64, vst_ctime: i64, vst_ctimensec: i64, vst_birthtime: i64, vst_birthtimensec: i64, vst_size: posix.off_t, vst_blocks: i64, vst_blksize: i32, vst_flags: u32, vst_gen: u32, vst_rdev: u32, vst_qspare: [2]i64, }
vm_address_t ¶
vm_address_t :: vm_offset_t
vm_inherit_t ¶
vm_inherit_t :: distinct u32
vm_map_t ¶
vm_map_t :: mach_port_t
vm_prot_t ¶
vm_prot_t :: distinct i32
vnode_info ¶
vnode_info :: struct { vi_stat: vinfo_stat, vi_type: i32, vi_pad: i32, vi_fsid: fsid_t, }
vnode_info_path ¶
vnode_info_path :: struct { vip_vi: vnode_info, vip_path: [1024]u8, }
Constants
COPYFILE_ALL ¶
COPYFILE_ALL :: COPYFILE_METADATA | COPYFILE_DATA
COPYFILE_DATA ¶
COPYFILE_DATA :: 1 << 3
COPYFILE_METADATA ¶
COPYFILE_METADATA :: COPYFILE_SECURITY | COPYFILE_XATTR
COPYFILE_SECURITY ¶
COPYFILE_SECURITY :: COPYFILE_STAT | COPYFILE_ACL
COPYFILE_STAT ¶
COPYFILE_STAT :: 1 << 1
COPYFILE_XATTR ¶
COPYFILE_XATTR :: 1 << 2
DARWIN_PROC_ALL_PIDS ¶
DARWIN_PROC_ALL_PIDS: i32 : c.int(1)
DARWIN_PROC_INFO_CALL_CANUSEFGHW ¶
DARWIN_PROC_INFO_CALL_CANUSEFGHW: i32 : c.int(0xc)
DARWIN_PROC_INFO_CALL_DIRTYCONTROL ¶
DARWIN_PROC_INFO_CALL_DIRTYCONTROL: i32 : c.int(0x8)
DARWIN_PROC_INFO_CALL_KERNMSGBUF ¶
DARWIN_PROC_INFO_CALL_KERNMSGBUF: i32 : c.int(0x4)
DARWIN_PROC_INFO_CALL_LISTCOALITIONS ¶
DARWIN_PROC_INFO_CALL_LISTCOALITIONS: i32 : c.int(0xb)
DARWIN_PROC_INFO_CALL_LISTPIDS ¶
DARWIN_PROC_INFO_CALL_LISTPIDS: i32 : c.int(0x1)
DARWIN_PROC_INFO_CALL_PIDDYNKQUEUEINFO ¶
DARWIN_PROC_INFO_CALL_PIDDYNKQUEUEINFO: i32 : c.int(0xd)
DARWIN_PROC_INFO_CALL_PIDFDINFO ¶
DARWIN_PROC_INFO_CALL_PIDFDINFO: i32 : c.int(0x3)
DARWIN_PROC_INFO_CALL_PIDFILEPORTINFO ¶
DARWIN_PROC_INFO_CALL_PIDFILEPORTINFO: i32 : c.int(0x6)
DARWIN_PROC_INFO_CALL_PIDINFO ¶
DARWIN_PROC_INFO_CALL_PIDINFO: i32 : c.int(0x2)
DARWIN_PROC_INFO_CALL_PIDORIGINATORINFO ¶
DARWIN_PROC_INFO_CALL_PIDORIGINATORINFO: i32 : c.int(0xa)
DARWIN_PROC_INFO_CALL_PIDRUSAGE ¶
DARWIN_PROC_INFO_CALL_PIDRUSAGE: i32 : c.int(0x9)
DARWIN_PROC_INFO_CALL_SETCONTROL ¶
DARWIN_PROC_INFO_CALL_SETCONTROL: i32 : c.int(0x5)
DARWIN_PROC_INFO_CALL_TERMINATE ¶
DARWIN_PROC_INFO_CALL_TERMINATE: i32 : c.int(0x7)
DARWIN_PROC_INFO_CALL_UDATA_INFO ¶
DARWIN_PROC_INFO_CALL_UDATA_INFO: i32 : c.int(0xe)
DARWIN_PROC_KDBG_ONLY ¶
DARWIN_PROC_KDBG_ONLY: i32 : c.int(7)
DARWIN_PROC_PGRP_ONLY ¶
DARWIN_PROC_PGRP_ONLY: i32 : c.int(2)
DARWIN_PROC_PIDPATHINFO ¶
DARWIN_PROC_PIDPATHINFO :: 11
DARWIN_PROC_PPID_ONLY ¶
DARWIN_PROC_PPID_ONLY: i32 : c.int(6)
DARWIN_PROC_RUID_ONLY ¶
DARWIN_PROC_RUID_ONLY: i32 : c.int(5)
DARWIN_PROC_TTY_ONLY ¶
DARWIN_PROC_TTY_ONLY: i32 : c.int(3)
DARWIN_PROC_UID_ONLY ¶
DARWIN_PROC_UID_ONLY: i32 : c.int(4)
MAXCOMLEN ¶
MAXCOMLEN :: 16
OPEN_FLAG_CLOEXEC ¶
OPEN_FLAG_CLOEXEC :: 0x01000000
causes the descriptor to be closed if you use any of the exec like functions
OPEN_FLAG_EVTONLY ¶
OPEN_FLAG_EVTONLY :: 0x00008000
descriptor requested for event notifications only
PERMISSION_ALL_ALL ¶
PERMISSION_ALL_ALL: bit_set[Permission_Enum; u16] : PERMISSION_OWNER_ALL | PERMISSION_GROUP_ALL | PERMISSION_OTHER_ALL
PERMISSION_GROUP_ALL ¶
PERMISSION_GROUP_ALL: bit_set[Permission_Enum; u16] : Permission{.PERMISSION_GROUP_READ, .PERMISSION_GROUP_WRITE, .PERMISSION_GROUP_EXECUTE}
PERMISSION_MASK_IRWXG ¶
PERMISSION_MASK_IRWXG :: 0o000070
For group Mode/Permission Flags for Open etc.
PERMISSION_MASK_IRWXO ¶
PERMISSION_MASK_IRWXO :: 0o000007
For other Mode/Permission Flags for Open etc.
PERMISSION_MASK_IRWXU ¶
PERMISSION_MASK_IRWXU :: 0o000700
For owner Mode/Permission Flags for Open etc.
PERMISSION_MASK_ISUID ¶
PERMISSION_MASK_ISUID :: 0o004000
Special Mode/Permission Flags for Open etc.
PERMISSION_NONE_NONE ¶
PERMISSION_NONE_NONE: bit_set[Permission_Enum; u16] : Permission{}
PERMISSION_OTHER_ALL ¶
PERMISSION_OTHER_ALL: bit_set[Permission_Enum; u16] : Permission{.PERMISSION_OTHER_READ, .PERMISSION_OTHER_WRITE, .PERMISSION_OTHER_EXECUTE}
PERMISSION_OWNER_ALL ¶
PERMISSION_OWNER_ALL: bit_set[Permission_Enum; u16] : Permission{.PERMISSION_OWNER_READ, .PERMISSION_OWNER_WRITE, .PERMISSION_OWNER_EXECUTE}
PIDPATHINFO_MAXSIZE ¶
PIDPATHINFO_MAXSIZE :: 4 * posix.PATH_MAX
ULOCK_WAIT_2_AVAILABLE ¶
ULOCK_WAIT_2_AVAILABLE :: true
VM_FLAGS_ALIAS_MASK ¶
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_FIXED ¶
VM_FLAGS_FIXED :: VM_Flags{}
VM_FLAGS_SUPERPAGE_MASK ¶
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_USER_ALLOCATE ¶
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 ¶
VM_FLAGS_USER_MAP :: VM_Flags{.Return_4K_Data_Addr, .Return_Data_Addr} | VM_FLAGS_USER_ALLOCATE
VM_FLAGS_USER_REMAP ¶
VM_FLAGS_USER_REMAP :: VM_Flags{.Anywhere, .Random_Addr, .Overwrite, .Return_Data_Addr, .Resilient_Codesign, .Resilient_Media} | VM_FLAGS_FIXED
VM_PROT_ALL ¶
VM_PROT_ALL :: VM_Prot_Flags{.Read, .Write, .Execute}
VM_PROT_DEFAULT ¶
VM_PROT_DEFAULT :: VM_Prot_Flags{.Read, .Write}
VM_PROT_NONE ¶
VM_PROT_NONE :: VM_Prot_Flags{}
WAIT_ON_ADDRESS_AVAILABLE ¶
WAIT_ON_ADDRESS_AVAILABLE :: false
Variables
vm_page_size ¶
vm_page_size: vm_size_t
Procedures
mach_make_memory_entry ¶
mach_make_memory_entry :: proc "c" ( target_task: mach_port_t, size: ^vm_size_t, offset: vm_offset_t, permission: VM_Prot_Flags, object_handle: ^mach_port_t, parent_entry: mach_port_t, ) -> Kern_Return ---
mach_port_deallocate ¶
mach_port_deallocate :: proc "c" (task: mach_port_t, name: mach_port_name_t) -> Kern_Return ---
mach_task_self ¶
mach_task_self :: proc "c" () -> mach_port_t ---
os_sync_wait_on_address ¶
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 ¶
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 ¶
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 ¶
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 ¶
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.
proc_pid_rusage ¶
proc_pid_rusage :: proc "c" (pid: posix.pid_t, flavor: Pid_Rusage_Flavor, buffer: rawptr) -> i32 ---
semaphore_create ¶
semaphore_create :: proc "c" (task: mach_port_t, semaphore: ^mach_port_t, policy: Sync_Policy, value: i32) -> Kern_Return ---
semaphore_destroy ¶
semaphore_destroy :: proc "c" (task: mach_port_t, semaphore: mach_port_t) -> Kern_Return ---
semaphore_signal ¶
semaphore_signal :: proc "c" (semaphore: mach_port_t) -> Kern_Return ---
semaphore_signal_all ¶
semaphore_signal_all :: proc "c" (semaphore: mach_port_t) -> Kern_Return ---
semaphore_signal_thread ¶
semaphore_signal_thread :: proc "c" (semaphore: mach_port_t, thread: mach_port_t) -> Kern_Return ---
semaphore_wait ¶
semaphore_wait :: proc "c" (semaphore: mach_port_t) -> Kern_Return ---
sys_chmod ¶
sys_chmod :: proc(path: string, mode: bit_set[Permission_Enum; u16]) -> bool {…}
sys_lseek ¶
sys_lseek :: proc(fd: i32, offset: i64, whence: Offset_From) -> i64 {…}
sys_lstat ¶
sys_lstat :: proc(path: string, status: ^__DARWIN_STRUCT_STAT64) -> bool {…}
sys_mkdir ¶
sys_mkdir :: proc(path: string, mode: bit_set[Permission_Enum; u16]) -> bool {…}
sys_mkdir_at ¶
sys_mkdir_at :: proc(fd: i32, path: string, mode: bit_set[Permission_Enum; u16]) -> bool {…}
sys_open ¶
sys_open :: proc(path: string, oflag: bit_set[Open_Flags_Enum; u16], mode: bit_set[Permission_Enum; u16]) -> (i32, bool) {…}
sys_rmdir ¶
sys_rmdir :: proc(path: string, mode: bit_set[Permission_Enum; u16]) -> bool {…}
sys_shm_open ¶
sys_shm_open :: proc(name: string, oflag: bit_set[Open_Flags_Enum; u16], mode: bit_set[Permission_Enum; u16]) -> (i32, bool) {…}
sys_write_string ¶
this package uses the sys prefix for the proc names to indicate that these aren't native syscalls but directly call such
syscall_adjtime ¶
syscall_adjtime :: proc "contextless" (delta: ^_STRUCT_TIMEVAL, old_delta: ^_STRUCT_TIMEVAL) -> i32 {…}
syscall_exit ¶
syscall_exit :: proc "contextless" (code: i32) {…}
syscall_fcntl ¶
think about this? last arg should be more than one
syscall_fstat ¶
syscall_fstat :: proc "contextless" (fd: i32, status: ^__DARWIN_STRUCT_STAT64) -> i32 {…}
syscall_fstatat ¶
syscall_fstatat :: proc "contextless" (fd: i32, path: cstring, status: ^__DARWIN_STRUCT_STAT64) -> i32 {…}
syscall_futimes ¶
syscall_futimes :: proc "contextless" (fd: i32, times: ^_STRUCT_TIMEVAL) -> i32 {…}
syscall_gettid ¶
syscall_gettid :: proc "contextless" () -> u64 {…}
syscall_lstat ¶
syscall_lstat :: proc "contextless" (path: cstring, status: ^__DARWIN_STRUCT_STAT64) -> i32 {…}
syscall_stat ¶
syscall_stat :: proc "contextless" (path: cstring, status: ^__DARWIN_STRUCT_STAT64) -> i32 {…}
syscall_utimes ¶
syscall_utimes :: proc "contextless" (path: cstring, times: ^_STRUCT_TIMEVAL) -> i32 {…}
unix_offset_syscall ¶
unix_offset_syscall :: proc "contextless" (number: System_Call_Number) -> uintptr {…}
vm_allocate ¶
vm_allocate :: proc "c" (target_task: mach_port_t, address: ^vm_offset_t, size: vm_size_t, flags: VM_Flags) -> Kern_Return ---
vm_deallocate ¶
vm_deallocate :: proc "c" (target_task: mach_port_t, address: vm_offset_t, size: vm_size_t) -> Kern_Return ---
vm_map ¶
vm_map :: proc "c" ( target_task: mach_port_t, address: ^vm_offset_t, size: vm_size_t, mask: vm_offset_t, flags: VM_Flags, object: mach_port_t, offset: vm_offset_t, copy: b32, cur_protection, max_protection: VM_Prot_Flags, inheritance: VM_Inherit, ) -> Kern_Return ---
Procedure Groups
This section is empty.
Source Files
- darwin.odin
- proc.odin
- sync.odin
- xnu_system_call_helpers.odin
- xnu_system_call_numbers.odin
- xnu_system_call_wrappers.odin
- (hidden platform specific files)
Generation Information
Generated with odin version dev-2024-11 (vendor "odin") Windows_amd64 @ 2024-11-16 21:10:10.106952500 +0000 UTC