core/sys/darwin
darwin
Types
53Offset_From
Offset_From :: enum c.int {
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.
}SourceOpen_Flags
Open_Flags :: bit_set[Open_Flags_Enum; u16]SourceOpen_Flags_Enum
Open_Flags_Enum :: enum u8 {
RDONLY = 0, // open for reading only
WRONLY = 1, // open for writing only
RDWR = 2, // open for reading and writing
NONBLOCK = 3, // no delay
APPEND = 4, // set append mode
CREAT = 5, // create if nonexistant
TRUNC = 6, // truncate to zero length
EXCL = 7, // error if already exists
SHLOCK = 8, // open with shared file lock
EXLOCK = 9, // open with exclusive file lock
DIRECTORY = 10, // restrict open to only directories
NOFOLLOW = 11, // don't follow symlinks
SYMLINK = 12, // allow open of a symlink
EVTONLY = 13, // descriptor requested for event notifications only
CLOEXEC = 14, // causes the descriptor to be closed if you use any of the exec like functions
NOFOLLOW_ANY = 15, // no symlinks allowed in path
}SourcePBI_Flag_Bits
PBI_Flag_Bits :: enum u32 {
SYSTEM = intrinsics.constant_log2(0x0001),
TRACED = intrinsics.constant_log2(0x0002),
INEXIT = intrinsics.constant_log2(0x0004),
PWAIT = intrinsics.constant_log2(0x0008),
LP64 = intrinsics.constant_log2(0x0010),
SLEADER = intrinsics.constant_log2(0x0020),
CTTY = intrinsics.constant_log2(0x0040),
CONTROLT = intrinsics.constant_log2(0x0080),
THCWD = intrinsics.constant_log2(0x0100),
PC_THROTTLE = intrinsics.constant_log2(0x0200),
PC_SUSP = intrinsics.constant_log2(0x0400),
PC_KILL = intrinsics.constant_log2(0x0600),
PA_THROTTLE = intrinsics.constant_log2(0x0800),
PA_SUSP = intrinsics.constant_log2(0x1000),
PA_PSUGID = intrinsics.constant_log2(0x2000),
EXEC = intrinsics.constant_log2(0x4000),
}SourcePBI_Flags
PBI_Flags :: bit_set[PBI_Flag_Bits; u32]SourcePID_Info_Flavor
PID_Info_Flavor :: enum i32 {
LISTFDS = 1,
TASKALLINFO = 2,
BSDINFO = 3,
TASKINFO = 4,
THREADINFO = 5,
LISTTHREADS = 6,
REGIONINFO = 7,
REGIONPATHINFO = 8,
VNODEPATHINFO = 9,
THREADPATHINFO = 10,
PATHINFO = 11,
WORKQUEUEINFO = 12,
SHORTBSDINFO = 13,
LISTFILEPORTS = 14,
THREADID64INFO = 15,
RUSAGE = 16,
}SourcePermission
Permission :: bit_set[Permission_Enum; u16]SourcePermission_Enum
Permission_Enum :: enum u8 {
// For owner
PERMISSION_OWNER_READ = 0, // R for owner
PERMISSION_OWNER_WRITE = 1, // W for owner
PERMISSION_OWNER_EXECUTE = 2, // X for owner
// IRWXU, /* RWX mask for owner */
// For group
PERMISSION_GROUP_READ = 3, // R for group
PERMISSION_GROUP_WRITE = 4, // W for group
PERMISSION_GROUP_EXECUTE = 5, // X for group
// IRWXG, /* RWX mask for group */
// For other
PERMISSION_OTHER_READ = 6, // R for other
PERMISSION_OTHER_WRITE = 7, // W for other
PERMISSION_OTHER_EXECUTE = 8, // X for other
// IRWXO, /* RWX mask for other */
// Special
PERMISSION_SET_USER_ON_EXECUTION = 9, // set user id on execution
PERMISSION_SET_GROUP_ON_EXECUTION = 10, // set group id on execution
// ??
PERMISSION_ISVTX = 11, // save swapped text even after use
}SourcePid_Rusage_Flavor
Pid_Rusage_Flavor :: enum i32 {
V0 = 0,
V1 = 1,
V2 = 2,
V3 = 3,
V4 = 4,
V5 = 5,
}SourceSystem_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 =Source_Password_Entry
_Password_Entry :: struct {
pw_name: cstring,
pw_passwd: cstring,
pw_uid: i32,
pw_gid: i32,
pw_change: u64,
pw_class: cstring,
pw_gecos: cstring,
pw_dir: cstring,
pw_shell: cstring,
pw_expire: u64,
pw_fields: i32,
}Sourcepwd.h
_Proc_Bsdinfo
_Proc_Bsdinfo :: struct {
pbi_flags: u32,
pbi_status: u32,
pbi_xstatus: u32,
pbi_pid: u32,
pbi_ppid: u32,
pbi_uid: u32,
pbi_gid: u32,
pbi_ruid: u32,
pbi_rgid: u32,
pbi_svuid: u32,
pbi_svgid: u32,
res: u32,
pbi_comm: [16]u8,
pbi_name: [32]u8,
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,
}Sourceprocessinfo.h
_STRUCT_TIMEVAL
_STRUCT_TIMEVAL :: struct {
tv_sec: __darwin_time_t,
tv_usec: __darwin_suseconds_t,
}Sourcesys/_types/_timeval.h
__DARWIN_STRUCT_STAT64
__DARWIN_STRUCT_STAT64 :: struct {
st_dev: dev_t,
st_mode: mode_t,
st_nlink: nlink_t,
st_ino: __darwin_ino64_t,
st_uid_t: uid_t,
st_gid_t: gid_t,
st_rdev: dev_t,
// __DARWIN_STRUCT_STAT64_TIMES
st_atime: time_t,
st_atimensec: i32,
st_mtime: time_t,
st_mtimensec: i32,
st_ctime: time_t,
st_ctimensec: u32,
st_birthtime: time_t,
st_birthtimensec: i32,
// end __DARWIN_STRUCT_STAT64_TIMES
st_size: off_t,
st_blocks: blkcnt_t,
st_blksize: blksize_t,
st_flags: u32,
st_gen: u32,
st_lspare: i32,
st_qspare: [2]i64,
}Source--==========================================================================-- sys/stat.h
__darwin_blkcnt_t
__darwin_blkcnt_t :: i64Source__darwin_blksize_t
__darwin_blksize_t :: i32Source__darwin_dev_t
__darwin_dev_t :: i32Source__darwin_ino64_t
__darwin_ino64_t :: u64Source--==========================================================================--
__darwin_mode_t
__darwin_mode_t :: u16Source__darwin_off_t
__darwin_off_t :: i64Source__darwin_pid_t
__darwin_pid_t :: i32Source__darwin_suseconds_t
__darwin_suseconds_t :: i32Source__darwin_time_t
__darwin_time_t :: longSourceblkcnt_t
blkcnt_t :: __darwin_blkcnt_tSourceblksize_t
blksize_t :: __darwin_blksize_tSourcecopyfile_flags
copyfile_flags :: bit_set[enum; u32]Sourcecopyfile_state_flag
copyfile_state_flag :: enum u32 {
SRC_FD = 1,
SRC_FILENAME = 2,
DST_FD = 3,
DST_FILENAME = 4,
QUARANTINE = 5,
STATUS_CB = 6,
STATUS_CTX = 7,
COPIED = 8,
XATTRNAME = 9,
WAS_CLONED = 10,
SRC_BSIZE = 11,
DST_BSIZE = 12,
BSIZE = 13,
FORBID_CROSS_MOUNT = 14,
NOCPROTECT = 15,
PRESERVE_SUID = 16,
RECURSIVE_SRC_FTSENT = 17,
FORBID_DST_EXISTING_SYMLINKS = 18,
}Sourcecopyfile_state_t
copyfile_state_t :: rawptrSourcedev_t
dev_t :: __darwin_dev_tSourcefsid_t
fsid_t :: [2]i32Sourcegid_t
gid_t :: u16Sourcemode_t
mode_t :: u16Sourcenlink_t
nlink_t :: u16Sourceoff_t
off_t :: __darwin_off_tSourceos_clockid
os_clockid :: enum u32 {
MACH_ABSOLUTE_TIME = 32,
}Sourceos_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,
}Sourceos_sync_wait_on_address_flags
os_sync_wait_on_address_flags :: bit_set[os_sync_wait_on_address_flag; u32]Sourceos_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,
}Sourceos_sync_wake_by_address_flags
os_sync_wake_by_address_flags :: bit_set[os_sync_wake_by_address_flag; u32]Sourcepid_t
pid_t :: __darwin_pid_tSourceproc_bsdinfo
proc_bsdinfo :: struct {
pbi_flags: PBI_Flags,
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,
pbi_name: [32]u8,
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,
}Sourceproc_bsdshortinfo
proc_bsdshortinfo :: struct {
pbsi_pid: u32,
pbsi_ppid: u32,
pbsi_pgid: u32,
pbsi_status: u32,
pbsi_comm: [16]u8,
pbsi_flags: PBI_Flags,
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,
}Sourceproc_taskallinfo
proc_taskallinfo :: struct {
pbsd: proc(),
}Sourceproc_taskinfo
proc_taskinfo :: struct {
pti_virtual_size: u64,
pti_resident_size: u64,
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,
}Sourceproc_vnodepathinfo
proc_vnodepathinfo :: struct {
pvi_cdir: vnode_info_path,
pvi_rdir: vnode_info_path,
}Sourcerusage_info_v0
rusage_info_v0 :: struct {
ri_uuid: [16]u8,
ri_user_time: u64,
ri_system_time: u64,
ri_pkg_idle_wkups: u64,
ri_interrupt_wkups: u64,
ri_pageins: u64,
ri_wired_size: u64,
ri_resident_size: u64,
ri_phys_footprint: u64,
ri_proc_start_abstime: u64,
ri_proc_exit_abstime: u64,
}Sourcestat
stat :: __DARWIN_STRUCT_STAT64Sourcetime_t
time_t :: __darwin_time_tSourcetimeval
timeval :: _STRUCT_TIMEVALSourceuid_t
uid_t :: u16Sourcevinfo_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,
}Sourcevnode_info
vnode_info :: struct {
vi_stat: vinfo_stat,
vi_type: i32,
vi_pad: i32,
vi_fsid: fsid_t,
}Sourcevnode_info_path
vnode_info_path :: struct {
vip_vi: vnode_info,
vip_path: [posix.PATH_MAX]u8,
}SourceConstants
93COPYFILE_ALL
COPYFILE_ALL :: COPYFILE_METADATA = COPYFILE_METADATA + copyfile_flags{.DATA}SourceCOPYFILE_METADATA
COPYFILE_METADATA :: COPYFILE_SECURITY = COPYFILE_SECURITY + copyfile_flags{.XATTR}SourceCOPYFILE_NOFOLLOW
COPYFILE_NOFOLLOW :: copyfile_flags = copyfile_flags{.NOFOLLOW_SRC, .NOFOLLOW_DST}SourceCOPYFILE_SECURITY
COPYFILE_SECURITY :: copyfile_flags = copyfile_flags{.STAT, .ACL}SourceDARWIN_MAXCOMLEN
DARWIN_MAXCOMLEN :: 16Sourcebsd/sys/param.h
DARWIN_PROC_ALL_PIDS
DARWIN_PROC_ALL_PIDS :: _ = c.int(1)SourceDARWIN_PROC_INFO_CALL_CANUSEFGHW
DARWIN_PROC_INFO_CALL_CANUSEFGHW :: _ = c.int(0xc)SourceDARWIN_PROC_INFO_CALL_DIRTYCONTROL
DARWIN_PROC_INFO_CALL_DIRTYCONTROL :: _ = c.int(0x8)SourceDARWIN_PROC_INFO_CALL_KERNMSGBUF
DARWIN_PROC_INFO_CALL_KERNMSGBUF :: _ = c.int(0x4)SourceDARWIN_PROC_INFO_CALL_LISTCOALITIONS
DARWIN_PROC_INFO_CALL_LISTCOALITIONS :: _ = c.int(0xb)SourceDARWIN_PROC_INFO_CALL_LISTPIDS
DARWIN_PROC_INFO_CALL_LISTPIDS :: _ = c.int(0x1)SourceDARWIN_PROC_INFO_CALL_PIDDYNKQUEUEINFO
DARWIN_PROC_INFO_CALL_PIDDYNKQUEUEINFO :: _ = c.int(0xd)SourceDARWIN_PROC_INFO_CALL_PIDFDINFO
DARWIN_PROC_INFO_CALL_PIDFDINFO :: _ = c.int(0x3)SourceDARWIN_PROC_INFO_CALL_PIDFILEPORTINFO
DARWIN_PROC_INFO_CALL_PIDFILEPORTINFO :: _ = c.int(0x6)SourceDARWIN_PROC_INFO_CALL_PIDINFO
DARWIN_PROC_INFO_CALL_PIDINFO :: _ = c.int(0x2)SourceDARWIN_PROC_INFO_CALL_PIDORIGINATORINFO
DARWIN_PROC_INFO_CALL_PIDORIGINATORINFO :: _ = c.int(0xa)SourceDARWIN_PROC_INFO_CALL_PIDRUSAGE
DARWIN_PROC_INFO_CALL_PIDRUSAGE :: _ = c.int(0x9)SourceDARWIN_PROC_INFO_CALL_SETCONTROL
DARWIN_PROC_INFO_CALL_SETCONTROL :: _ = c.int(0x5)SourceDARWIN_PROC_INFO_CALL_TERMINATE
DARWIN_PROC_INFO_CALL_TERMINATE :: _ = c.int(0x7)SourceDARWIN_PROC_INFO_CALL_UDATA_INFO
DARWIN_PROC_INFO_CALL_UDATA_INFO :: _ = c.int(0xe)SourceDARWIN_PROC_KDBG_ONLY
DARWIN_PROC_KDBG_ONLY :: _ = c.int(7)SourceDARWIN_PROC_PGRP_ONLY
DARWIN_PROC_PGRP_ONLY :: _ = c.int(2)SourceDARWIN_PROC_PIDPATHINFO
DARWIN_PROC_PIDPATHINFO :: 11SourceDARWIN_PROC_PIDPATHINFO_SIZE
DARWIN_PROC_PIDPATHINFO_SIZE :: MAXPATHLENSourceproc_info.h
DARWIN_PROC_PPID_ONLY
DARWIN_PROC_PPID_ONLY :: _ = c.int(6)SourceDARWIN_PROC_RUID_ONLY
DARWIN_PROC_RUID_ONLY :: _ = c.int(5)SourceDARWIN_PROC_TTY_ONLY
DARWIN_PROC_TTY_ONLY :: _ = c.int(3)SourceDARWIN_PROC_UID_ONLY
DARWIN_PROC_UID_ONLY :: _ = c.int(4)SourceF_OK
F_OK :: _ = c.int(0)Sourcesys/unistd.h for access
LOCK_EX
LOCK_EX :: 2SourceLOCK_NB
LOCK_NB :: 4SourceLOCK_SH
LOCK_SH :: 1SourceIMPORTANT NOTE: direct syscall usage is not allowed by Apple's review process of apps and should be entirely avoided in the builtin Odin collections, these are here for users if they don't care about the Apple review process. flock
LOCK_UN
LOCK_UN :: 8SourceMAP_32BIT
MAP_32BIT :: 0x8000SourceMAP_ANONYMOUS
MAP_ANONYMOUS :: 0x1000Sourcemmap flags
MAP_FILE
MAP_FILE :: 0x0000SourceMAP_FIXED
MAP_FIXED :: 0x0010SourceMAP_HASSEMAPHORE
MAP_HASSEMAPHORE :: 0x0200SourceMAP_JIT
MAP_JIT :: 0x0800SourceMAP_NOCACHE
MAP_NOCACHE :: 0x0400SourceMAP_PRIVATE
MAP_PRIVATE :: 0x0002SourceMAP_SHARED
MAP_SHARED :: 0x0001SourceMASK_ACCMODE
MASK_ACCMODE :: 0x0003Sourcemask for above rd/wr/rdwr flags
MAXCOMLEN
MAXCOMLEN :: 16SourceMAXPATHLEN
MAXPATHLEN :: PATH_MAXSourceparam.h
OPEN_FLAG_APPEND
OPEN_FLAG_APPEND :: 0x00000008SourceOPEN_FLAG_CLOEXEC
OPEN_FLAG_CLOEXEC :: 0x01000000SourceOPEN_FLAG_CREAT
OPEN_FLAG_CREAT :: 0x00000200SourceOPEN_FLAG_DIRECTORY
OPEN_FLAG_DIRECTORY :: 0x00100000SourceOPEN_FLAG_EVTONLY
OPEN_FLAG_EVTONLY :: 0x00008000SourceOPEN_FLAG_EXCL
OPEN_FLAG_EXCL :: 0x00000800SourceOPEN_FLAG_EXLOCK
OPEN_FLAG_EXLOCK :: 0x00000020SourceOPEN_FLAG_NOFOLLOW
OPEN_FLAG_NOFOLLOW :: 0x00000100SourceOPEN_FLAG_NOFOLLOW_ANY
OPEN_FLAG_NOFOLLOW_ANY :: 0x20000000SourceOPEN_FLAG_NONBLOCK
OPEN_FLAG_NONBLOCK :: 0x00000004SourceOPEN_FLAG_RDONLY
OPEN_FLAG_RDONLY :: 0x0000SourceOPEN_FLAG_RDWR
OPEN_FLAG_RDWR :: 0x0002SourceOPEN_FLAG_SHLOCK
OPEN_FLAG_SHLOCK :: 0x00000010SourceOPEN_FLAG_SYMLINK
OPEN_FLAG_SYMLINK :: 0x00200000SourceOPEN_FLAG_TRUNC
OPEN_FLAG_TRUNC :: 0x00000400SourceOPEN_FLAG_WRONLY
OPEN_FLAG_WRONLY :: 0x0001SourcePATH_MAX
PATH_MAX :: 1024Sourcesyslimits.h
PERMISSION_ALL_ALL
PERMISSION_ALL_ALL :: _ = PERMISSION_OWNER_ALL | PERMISSION_GROUP_ALL | PERMISSION_OTHER_ALLSourcePERMISSION_GROUP_ALL
PERMISSION_GROUP_ALL :: Permission = Permission{.PERMISSION_GROUP_READ, .PERMISSION_GROUP_WRITE, .PERMISSION_GROUP_EXECUTE}SourcePERMISSION_MASK_IRGRP
PERMISSION_MASK_IRGRP :: 0o000040SourcePERMISSION_MASK_IROTH
PERMISSION_MASK_IROTH :: 0o000004SourcePERMISSION_MASK_IRUSR
PERMISSION_MASK_IRUSR :: 0o000400SourcePERMISSION_MASK_IRWXG
PERMISSION_MASK_IRWXG :: 0o000070SourceFor group Mode/Permission Flags for Open etc.
PERMISSION_MASK_IRWXO
PERMISSION_MASK_IRWXO :: 0o000007SourceFor other Mode/Permission Flags for Open etc.
PERMISSION_MASK_IRWXU
PERMISSION_MASK_IRWXU :: 0o000700SourceFor owner Mode/Permission Flags for Open etc.
PERMISSION_MASK_ISGID
PERMISSION_MASK_ISGID :: 0o002000SourcePERMISSION_MASK_ISUID
PERMISSION_MASK_ISUID :: 0o004000SourceSpecial Mode/Permission Flags for Open etc.
PERMISSION_MASK_ISVTX
PERMISSION_MASK_ISVTX :: 0o001000SourcePERMISSION_MASK_IWGRP
PERMISSION_MASK_IWGRP :: 0o000020SourcePERMISSION_MASK_IWOTH
PERMISSION_MASK_IWOTH :: 0o000002SourcePERMISSION_MASK_IWUSR
PERMISSION_MASK_IWUSR :: 0o000200SourcePERMISSION_MASK_IXGRP
PERMISSION_MASK_IXGRP :: 0o000010SourcePERMISSION_MASK_IXOTH
PERMISSION_MASK_IXOTH :: 0o000001SourcePERMISSION_MASK_IXUSR
PERMISSION_MASK_IXUSR :: 0o000100SourcePERMISSION_NONE_NONE
PERMISSION_NONE_NONE :: Permission = Permission{}SourcePERMISSION_OTHER_ALL
PERMISSION_OTHER_ALL :: Permission = Permission{.PERMISSION_OTHER_READ, .PERMISSION_OTHER_WRITE, .PERMISSION_OTHER_EXECUTE}SourcePERMISSION_OWNER_ALL
PERMISSION_OWNER_ALL :: Permission = Permission{.PERMISSION_OWNER_READ, .PERMISSION_OWNER_WRITE, .PERMISSION_OWNER_EXECUTE}SourcePIDPATHINFO_MAXSIZE
PIDPATHINFO_MAXSIZE :: _ = 4*posix.PATH_MAXSourcePROT_EXEC
PROT_EXEC :: 0x04SourcePROT_NONE
PROT_NONE :: 0x00Sourcemmap prot flags
PROT_READ
PROT_READ :: 0x01SourcePROT_WRITE
PROT_WRITE :: 0x02SourceR_OK
R_OK :: _ = c.int((1 << 2))SourceTIOCGWINSZ
TIOCGWINSZ :: 0x40087468Source--==========================================================================-- Get window size
ULOCK_WAIT_2_AVAILABLE
ULOCK_WAIT_2_AVAILABLE :: falseSourceWAIT_ON_ADDRESS_AVAILABLE
WAIT_ON_ADDRESS_AVAILABLE :: falseSourceW_OK
W_OK :: _ = c.int((1 << 1))SourceX_OK
X_OK :: _ = c.int((1 << 0))SourceProcedures
65_sys_open_mode
_sys_open_mode :: proc(mode: Open_Flags) -> (u32)Source_sys_permission_mode
_sys_permission_mode :: proc(mode: Permission) -> (u32)Sourcesys_chmod
sys_chmod :: proc(path: string, mode: Permission) -> (bool)Sourcesys_lseek
sys_lseek :: proc(fd: c.int, offset: i64, whence: Offset_From) -> (i64)Sourcesys_lstat
sys_lstat :: proc(path: string, status: ^stat) -> (bool)Sourcesys_mkdir
sys_mkdir :: proc(path: string, mode: Permission) -> (bool)Sourcesys_mkdir_at
sys_mkdir_at :: proc(fd: c.int, path: string, mode: Permission) -> (bool)Sourcesys_open
sys_open :: proc(path: string, oflag: Open_Flags, mode: Permission) -> (c.int, bool)Sourcesys_rename
sys_rename :: proc(path: string, new_path: string) -> (bool)Sourcesys_rename_at
sys_rename_at :: proc(fd: c.int, path: string, to_fd: c.int, new_path: string) -> (bool)Sourcesys_rmdir
sys_rmdir :: proc(path: string, mode: Permission) -> (bool)Sourcesys_shm_open
sys_shm_open :: proc(name: string, oflag: Open_Flags, mode: Permission) -> (c.int, bool)Sourcesys_write_string
sys_write_string :: proc(fd: c.int, message: string) -> (bool)SourceIMPORTANT NOTE: direct syscall usage is not allowed by Apple's review process of apps and should be entirely avoided in the builtin Odin collections, these are here for users if they don't care about the Apple review process. this package uses the sys prefix for the proc names to indicate that these aren't native syscalls but directly call such
syscall_access
syscall_access :: proc(path: cstring, mode: c.int) -> (c.int)Sourcesyscall_adjtime
syscall_adjtime :: proc(delta: ^timeval, old_delta: ^timeval) -> (c.int)Sourcesyscall_chdir
syscall_chdir :: proc(path: cstring) -> (c.int)Sourcesyscall_chmod
syscall_chmod :: proc(path: cstring, mode: u32) -> (c.int)Sourcesyscall_close
syscall_close :: proc(fd: c.int) -> (bool)Sourcesyscall_copyfile
syscall_copyfile :: proc(from: cstring, to: cstring, state: rawptr, flags: u32) -> (c.int)Sourcesyscall_dup
syscall_dup :: proc(fd: c.int) -> (c.int)Sourcesyscall_execve
syscall_execve :: proc(path: cstring, argv: [^]cstring, env: [^]cstring) -> (c.int)Sourcesyscall_exit
syscall_exit :: proc(code: c.int)Sourcesyscall_faccessat
syscall_faccessat :: proc(fd: c.int, path: cstring, mode: c.int, flag: c.int) -> (c.int)Sourcesyscall_fchdir
syscall_fchdir :: proc(fd: c.int, path: cstring) -> (c.int)Sourcesyscall_fchmod
syscall_fchmod :: proc(fildes: c.int, mode: u32) -> (c.int)Sourcesyscall_fcntl
syscall_fcntl :: proc(fd: c.int, cmd: c.int, other: rawptr) -> (c.int)Sourcethink about this? last arg should be more than one
syscall_flock
syscall_flock :: proc(fd: c.int, operation: c.int) -> (c.int)Sourcesyscall_fstat
syscall_fstat :: proc(fd: c.int, status: ^stat) -> (c.int)Sourcesyscall_fstatat
syscall_fstatat :: proc(fd: c.int, path: cstring, status: ^stat) -> (c.int)Sourcesyscall_fsync
syscall_fsync :: proc(fildes: c.int) -> (bool)Source--==========================================================================--
syscall_ftruncate
syscall_ftruncate :: proc(fd: c.int, length: off_t) -> (c.int)Sourcesyscall_futimes
syscall_futimes :: proc(fd: c.int, times: ^timeval) -> (c.int)Sourcesyscall_getdirentries
syscall_getdirentries :: proc(fd: c.int, buf: ^u8, nbytes: c.int, base_pointer: ^u32) -> (c.int)Sourcesyscall_getentropy
syscall_getentropy :: proc(buf: [^]u8, buflen: u64) -> (c.int)Sourcesyscall_getrusage
syscall_getrusage :: proc(who: c.int, rusage: ^RUsage) -> (c.int)Sourcesyscall_gettid
syscall_gettid :: proc() -> (u64)Sourcesyscall_ioctl
syscall_ioctl :: proc(fd: c.int, request: u32, arg: rawptr) -> (c.int)Sourcesyscall_kill
syscall_kill :: proc(pid: pid_t, sig: c.int) -> (c.int)Sourcesyscall_link
syscall_link :: proc(path: cstring, to_link: cstring) -> (c.int)Sourcesyscall_linkat
syscall_linkat :: proc(fd: c.int, path: cstring, fd2: c.int, to_link: cstring) -> (c.int)Sourcesyscall_lseek
syscall_lseek :: proc(fd: c.int, offset: i64, whence: c.int) -> (i64)Sourcesyscall_lstat
syscall_lstat :: proc(path: cstring, status: ^stat) -> (c.int)Sourcesyscall_mkdir
syscall_mkdir :: proc(path: cstring, mode: u32) -> (c.int)Sourcesyscall_mkdir_at
syscall_mkdir_at :: proc(fd: c.int, path: cstring, mode: u32) -> (c.int)Sourcesyscall_mmap
syscall_mmap :: proc(
addr: ^u8,
len: u64,
port: c.int,
flags: c.int,
fd: int,
offset: off_t,
) -> (^u8)Sourcesyscall_munmap
syscall_munmap :: proc(addr: rawptr, len: u64) -> (c.int)Sourcesyscall_open
syscall_open :: proc(path: cstring, oflag: u32, mode: u32) -> (c.int)Sourcesyscall_openat
syscall_openat :: proc(fd: int, path: cstring, oflag: u32, mode: u32) -> (c.int)Sourcesyscall_pipe
syscall_pipe :: proc(fds: [^]c.int) -> (c.int)Sourcesyscall_proc_info
syscall_proc_info :: proc(
num: c.int,
pid: u32,
flavor: c.int,
arg: u64,
buffer: rawptr,
buffer_size: c.int,
) -> (c.int)Sourcesyscall_read
syscall_read :: proc(fildes: c.int, buf: ^u8, nbyte: u64) -> (i64)Sourcesyscall_readlink
syscall_readlink :: proc(path: cstring, buf: ^u8, buf_size: u64) -> (i64)Sourcesyscall_readlinkat
syscall_readlinkat :: proc(fd: c.int, path: cstring, buf: ^u8, buf_size: u64) -> (i64)Sourcesyscall_rename
syscall_rename :: proc(path_old: cstring, path_new: cstring) -> (c.int)Sourcesyscall_rename_at
syscall_rename_at :: proc(from_fd: c.int, from: cstring, to_fd: c.int, to: cstring) -> (c.int)Sourcesyscall_rmdir
syscall_rmdir :: proc(path: cstring, mode: u32) -> (c.int)Sourcesyscall_shm_open
syscall_shm_open :: proc(name: cstring, oflag: u32, mode: u32) -> (c.int)Sourcesyscall_shm_unlink
syscall_shm_unlink :: proc(name: cstring) -> (c.int)Sourcesyscall_stat
syscall_stat :: proc(path: cstring, status: ^stat) -> (c.int)Sourcesyscall_sysctl
syscall_sysctl :: proc(
name: [^]c.int,
namelen: c.size_t,
oldp: rawptr,
oldlenp: ^c.size_t,
newp: rawptr,
newlen: c.size_t,
) -> (c.int)Sourcesyscall_sysctlbyname
syscall_sysctlbyname :: proc(name: string, oldp: rawptr, oldlenp: ^c.size_t, newp: rawptr, newlen: c.size_t) -> (c.int)Sourcesyscall_truncate
syscall_truncate :: proc(path: cstring, length: off_t) -> (c.int)Sourcesyscall_utimes
syscall_utimes :: proc(path: cstring, times: ^timeval) -> (c.int)Sourcesyscall_write
syscall_write :: proc(fildes: c.int, buf: ^u8, nbyte: u64) -> (bool)Sourceunix_offset_syscall
unix_offset_syscall :: proc(number: System_Call_Number) -> (uintptr)SourceIMPORTANT NOTE: direct syscall usage is not allowed by Apple's review process of apps and should be entirely avoided in the builtin Odin collections, these are here for users if they don't care about the Apple review process.