abla/runtime/platform/darwin

Generated from source.

Import with import "abla/runtime/platform/darwin".

Source: abla/runtime/platform/darwin/entry.ab

__ablaRuntimeDarwinErrno (fun)

trusted fun __ablaRuntimeDarwinErrno(value: int): int

A Darwin errno as the Linux number the portable code expects (the same table as the C adapter's linux_errno; the numbers not listed are equal).

__ablaRuntimeDarwinResult (fun)

trusted fun __ablaRuntimeDarwinResult(raw: int): int

A BSD call's result as the Linux-style result: -errno (Linux numbering) on failure.

__ablaRuntimeDarwinOpenFlags (fun)

trusted fun __ablaRuntimeDarwinOpenFlags(flags: int): int

Linux open flags as Darwin's (the C adapter's darwin_open_flags).

__ablaRuntimeLinuxOpenFlags (fun)

trusted fun __ablaRuntimeLinuxOpenFlags(flags: int): int

Darwin open flags (F_GETFL's result) as Linux's (the adapter's linux_open_flags).

__ablaRuntimeDarwinDirectory (fun)

trusted fun __ablaRuntimeDarwinDirectory(descriptor: int): int

AT_FDCWD is -100 on Linux and -2 on Darwin; other descriptors are the same.

__ablaRuntimeDarwinNamesImage (fun)

trusted fun __ablaRuntimeDarwinNamesImage(path: int): bool

True when the C string at path is "/proc/self/exe": the running image, which the C adapter still resolves (it records the image's identity before main).

__ablaRuntimeDarwinStat (fun)

trusted fun __ablaRuntimeDarwinStat(native: int, output: int): void

A Darwin struct stat (144 bytes, 64-bit inode: dev 0 int32, mode 4 and nlink 6 uint16, ino 8, uid 16, gid 20, rdev 24 int32, atime 32, mtime 48, ctime 64 (timespecs), size 96, blocks 104, blksize 112 int32) as the Linux x86-64 record the portable code reads (dev 0, ino 8, nlink 16, mode 24, uid 28, gid 32, rdev 40, size 48, blksize 56, blocks 64, atime 72, mtime 88, ctime 104, each time seconds then nanoseconds), in place: every field is read before any is written. Only the mode, size and mtime were carried before, the rest zero: a file's identity (device, inode) and change time, which a cache key or a watch compares to see a file replaced with the same size and a forged modification time, were 0 for every file on macOS.

__ablaRuntimeDarwinGetdents (fun)

trusted fun __ablaRuntimeDarwinGetdents(descriptor: int, output: int, capacity: int): int

getdents64 over getdirentries64 (344): Darwin's records (inode, seek offset, length, name length, type, name) as Linux's (inode, offset, length, type, name, 8-aligned).

__ablaRuntimeDarwinGetcwd (fun)

trusted fun __ablaRuntimeDarwinGetcwd(output: int, size: int): int

getcwd has no system call: open "." and ask for the path of the descriptor (fcntl F_GETPATH, 50, into a PATH_MAX buffer), as libSystem does. Returns the length including the terminator, like the Linux system call.

__ablaRuntimeDarwinScratch (fun)

trusted fun __ablaRuntimeDarwinScratch(size: int): int

A scratch mapping (anonymous, read-write); negative (-errno) when none could be made.

__ablaRuntimeDarwinScratchFailed (fun)

trusted fun __ablaRuntimeDarwinScratchFailed(address: int): bool

Reports whether a scratch mapping result encodes a negative errno.

__ablaRuntimeDarwinScratchFree (fun)

trusted fun __ablaRuntimeDarwinScratchFree(address: int, size: int): void

Unmaps a previously allocated scratch region.

__ablaRuntimeDarwinSocketDomain (fun)

trusted fun __ablaRuntimeDarwinSocketDomain(domain: int): int

Linux's address family as Darwin's: AF_UNIX 1 and AF_INET 2 agree, AF_INET6 is 10 and 30.

__ablaRuntimeDarwinSocketType (fun)

trusted fun __ablaRuntimeDarwinSocketType(type: int): int

The socket type without Linux's SOCK_NONBLOCK (2048) and SOCK_CLOEXEC (524288): stream 1, datagram 2 and raw 3 agree.

__ablaRuntimeDarwinMessageFlags (fun)

trusted fun __ablaRuntimeDarwinMessageFlags(flags: int): int

Linux message flags as Darwin's, bit by bit: MSG_OOB 1, MSG_PEEK 2 and MSG_DONTROUTE 4 agree; MSG_TRUNC 0x20 is 0x10, MSG_DONTWAIT 0x40 is 0x80, MSG_EOR 0x80 is 0x8 and MSG_WAITALL 0x100 is 0x40. MSG_NOSIGNAL (0x4000) has no Darwin bit (SO_NOSIGPIPE takes its place) and neither has MSG_MORE (0x8000): they and any other bit are dropped. Passed through as they were, Linux's MSG_DONTWAIT became Darwin's MSG_WAITALL: a send or receive meant never to block waited, and a write's deadline (TcpConnection.sendWithoutBlocking, a TLS session's send) did not hold against a peer that read nothing.

__ablaRuntimeDarwinConfigureDescriptor (fun)

trusted fun __ablaRuntimeDarwinConfigureDescriptor(descriptor: int, flags: int): void

A new socket (or kqueue): SO_NOSIGPIPE (0x1022 at SOL_SOCKET 0xffff), then the close-on-exec and nonblocking flags the Linux call took (the adapter's configure_descriptor).

__ablaRuntimeDarwinPipe (fun)

trusted fun __ablaRuntimeDarwinPipe(descriptors: int, flags: int): int

pipe2 293 (descriptors, flags): BSD pipe 42 returns the read end and, in the second result register (x1 / rdx), the write end; both ends are written as Linux's two 32-bit ints. The flags apply as the adapter's configure_descriptor did.

__ablaRuntimeDarwinSockaddrLength (fun)

trusted fun __ablaRuntimeDarwinSockaddrLength(address: int, size: int): int

The Darwin length of the Linux sockaddr at address (size bytes): AF_UNIX (a leading NUL, an abstract name, has no Darwin form) is the size itself, AF_INET 16, AF_INET6 28; or -errno (EINVAL 22, ENAMETOOLONG 36, EAFNOSUPPORT 97). Nothing is written.

__ablaRuntimeDarwinSockaddrMark (fun)

trusted fun __ablaRuntimeDarwinSockaddrMark(address: int, length: int): int

The Linux sockaddr at address as Darwin's in place, for length bytes: a length byte, then the family byte (AF_INET6 is 30) where Linux has a 16-bit family; every other byte is the same. The two bytes it overwrote, as a word, for __ablaRuntimeDarwinSockaddrRestore.

__ablaRuntimeDarwinSockaddrRestore (fun)

trusted fun __ablaRuntimeDarwinSockaddrRestore(address: int, saved: int): void

Restores the first two bytes of a socket address from the saved packed value.

__ablaRuntimeLinuxSockaddr (fun)

trusted fun __ablaRuntimeLinuxSockaddr(address: int, room: int): void

A Darwin sockaddr the kernel wrote at address (into room bytes) as Linux's, in place: the family byte becomes a 16-bit family (AF_INET6 is 10); a family it does not know stays as it is.

__ablaRuntimeDarwinSocketOption (fun)

trusted fun __ablaRuntimeDarwinSocketOption(level: int, option: int): int

Linux socket option numbers as Darwin's (the adapter's darwin_socket_option), by Darwin level: SOL_SOCKET 0xffff, IPPROTO_TCP 6, IPPROTO_IP 0, IPPROTO_IPV6 41. One that has no Darwin counterpart passes through and fails there.

__ablaRuntimeDarwinSocket (fun)

trusted fun __ablaRuntimeDarwinSocket(domain: int, type: int, protocol: int): int

socket 41.

__ablaRuntimeDarwinAddressCall (fun)

trusted fun __ablaRuntimeDarwinAddressCall(number: int, descriptor: int, address: int,
    size: int): int

connect 42 and bind 49.

__ablaRuntimeDarwinSendNonblockBegin (fun)

trusted fun __ablaRuntimeDarwinSendNonblockBegin(descriptor: int, flags: int): int

sendto 44: the destination address (argument4, length argument5) is optional. Darwin's send ignores MSG_DONTWAIT: send(2) takes only MSG_OOB and MSG_DONTROUTE (recv(2) honours MSG_DONTWAIT, which is why a nonblocking receive worked and a nonblocking send to a peer that read nothing waited out SO_SNDTIMEO on the macOS Intel runner, master CI 45468121280). A send with Linux's MSG_DONTWAIT (64) on a blocking socket makes the socket nonblocking for that one call (fcntl 92: F_GETFL 3, F_SETFL 4, Darwin's O_NONBLOCK 4), as the Windows runtime does, and __ablaRuntimeDarwinSendNonblockEnd puts its mode back. The socket's previous flags + 1 when they were changed, else 0.

__ablaRuntimeDarwinSendNonblockEnd (fun)

trusted fun __ablaRuntimeDarwinSendNonblockEnd(descriptor: int, saved: int): void

Restores the file status flags __ablaRuntimeDarwinSendNonblockBegin changed for one send.

__ablaRuntimeDarwinSendto (fun)

trusted fun __ablaRuntimeDarwinSendto(
    descriptor: int,
    buffer: int,
    length: int,
    flags: int,
    address: int,
    size: int
): int

sendto for the Linux-numbered call: Linux message flags become Darwin's, and MSG_DONTWAIT makes a blocking socket nonblocking for this one send.

__ablaRuntimeDarwinRecvfrom (fun)

trusted fun __ablaRuntimeDarwinRecvfrom(
    descriptor: int,
    buffer: int,
    length: int,
    flags: int,
    address: int,
    lengthAddress: int
): int

recvfrom 45: the kernel writes the source address into the caller's buffer (length word lengthAddress), which then becomes Linux's layout.

__ablaRuntimeDarwinSendmsg (fun)

trusted fun __ablaRuntimeDarwinSendmsg(descriptor: int, header: int, flags: int): int

sendmsg 46: Linux's msghdr (name 0, namelen 8, iov 16, iovlen 24, control 32, controllen 40) is Darwin's for a send in everything but the name: iovlen and controllen are 64-bit words whose low halves sit where Darwin's 32-bit fields do, and msg_flags is not read. The name is a Linux sockaddr: rewritten in place for the call (with its length) and put back.

__ablaRuntimeDarwinSocketName (fun)

trusted fun __ablaRuntimeDarwinSocketName(
    number: int,
    descriptor: int,
    address: int,
    lengthAddress: int
): int

getsockname 51 (BSD 32) and getpeername 52 (BSD 31): the kernel fills the caller's buffer.

__ablaRuntimeDarwinSocketOptionCall (fun)

trusted fun __ablaRuntimeDarwinSocketOptionCall(
    number: int,
    descriptor: int,
    level: int,
    option: int,
    value: int,
    length: int
): int

setsockopt 54 and getsockopt 55. SO_ERROR comes back as a Linux errno; a timeval's 4 bytes of padding after Darwin's 32-bit tv_usec are cleared (Linux reads a 64-bit one).

__ablaRuntimeDarwinAccept (fun)

trusted fun __ablaRuntimeDarwinAccept(
    descriptor: int,
    address: int,
    lengthAddress: int,
    flags: int
): int

accept4 288 over accept (30): the flags set up the new descriptor; the peer address, if asked for, is written by the kernel into the caller's buffer and becomes Linux's.

__ablaRuntimeDarwinPoll (fun)

trusted fun __ablaRuntimeDarwinPoll(fds: int, count: int, timeout: int): int

poll 7 -> BSD poll 230 (struct pollfd and its event bits agree). Darwin's poll rejects character devices (POLLNVAL): for a single such descriptor wait with select 93 as the adapter does (a descriptor below 1024: a 128-byte mask per direction).

__ablaRuntimeDarwinKevent (fun)

trusted fun __ablaRuntimeDarwinKevent(
    address: int,
    ident: int,
    filter: int,
    flags: int,
    udata: int
): void

A Darwin struct kevent (32 bytes: ident 0, filter 8 as an int16, flags 10 as a uint16, fflags 12, data 16, udata 24).

__ablaRuntimeDarwinEpollControl (fun)

trusted fun __ablaRuntimeDarwinEpollControl(
    queue: int,
    operation: int,
    target: int,
    encoded: int
): int

epoll_ctl 233 over a kqueue (BSD kevent 363, EVFILT_READ -1, EVFILT_WRITE -2, EV_ADD 1, EV_DELETE 2, EV_ENABLE 4): operation 1 adds, 2 deletes, 3 modifies (delete both filters, add). The event word is Linux's (EPOLLIN 1, EPOLLOUT 4); the descriptor is the user data.

__ablaRuntimeDarwinEpollRecords (fun)

trusted fun __ablaRuntimeDarwinEpollRecords(events: int, measured: int, output: int): int

The kevents a kevent call returned (32 bytes each at events) as Linux's packed 12-byte epoll records (event bits, the descriptor, zero) at output: a descriptor with both filters registered shows up twice and is reported once, with both bits; EV_EOF (0x8000) is EPOLLHUP, EV_ERROR (0x4000) EPOLLERR. The number of records.

__ablaRuntimeDarwinEpollWait (fun)

trusted fun __ablaRuntimeDarwinEpollWait(queue: int, output: int, maximum: int, timeout: int): int

epoll_wait 232 over kevent: at most 64 events per call (a caller asking for more gets fewer, as epoll allows), written as Linux's packed 12-byte records (events, the descriptor, zero).

__ablaRuntimeDarwinSignalState (fun)

trusted fun __ablaRuntimeDarwinSignalState(): int

---- macOS signalfd, read and close (#811) ---- A signalfd is a kqueue watching its signals with EVFILT_SIGNAL (-6), which sees a signal sent to the process even while it is blocked; poll and the epoll shim see the kqueue readable once one arrives. A read takes the signals as Linux's 128-byte signalfd_siginfo records and, as reading a signalfd does, accepts the pending signal (sigpending 52, __sigwait 330: UNVERIFIED, from memory of xnu's syscalls.master). The descriptors (with whether they are nonblocking, which a read must honour itself) are the ones read and close look for: a table of 16 slots, each a descriptor + 1 (0 free) and a nonblocking flag, and the number in use at +256 (what the adapter's static tables were). BSD numbers: read 3, close 6, kqueue 362, kevent 363.

__ablaRuntimeDarwinSignalSlot (fun)

trusted fun __ablaRuntimeDarwinSignalSlot(descriptor: int): int

Returns the signal tracking slot for the descriptor, or -1 when it is untracked.

__ablaRuntimeDarwinClose (fun)

trusted fun __ablaRuntimeDarwinClose(descriptor: int): int

close 3: a signalfd leaves the table first. The slot is claimed by a compare-and-swap: two threads closing the same descriptor take it out once, and the count of slots in use goes down once (it went down twice, and a negative count hid every later signalfd from read and close).

__ablaRuntimeLinuxSignalOf (fun)

trusted fun __ablaRuntimeLinuxSignalOf(darwin: int): int

The Linux number of a Darwin signal (the inverse of __ablaRuntimeDarwinSignal's table).

__ablaRuntimeDarwinSignalfd (fun)

trusted fun __ablaRuntimeDarwinSignalfd(descriptor: int, mask: int, size: int, flags: int): int

signalfd4 289 (descriptor or -1, mask, size 8, flags SFD_NONBLOCK 2048 | SFD_CLOEXEC 524288): a new kqueue, or the one of descriptor, watching exactly the mask's signals.

__ablaRuntimeDarwinSignalfdRead (fun)

trusted fun __ablaRuntimeDarwinSignalfdRead(slot: int, descriptor: int, output: int,
    length: int): int

read 0 of a signalfd: up to 16 records of 128 bytes (ssi_signo at 0, the rest zero); EAGAIN 11 when a nonblocking one has none. A mapping holds the kevents (512 bytes), a zero timespec (16) and the pending set and the signal sigwait takes (8 each).

__ablaRuntimeDarwinSignal (fun)

trusted fun __ablaRuntimeDarwinSignal(signal: int): int

A Linux signal number as Darwin's, 0 where Darwin has none: the adapter's darwin_signals table.

__ablaRuntimeDarwinKill (fun)

trusted fun __ablaRuntimeDarwinKill(process: int, signal: int): int

kill 62: signal 0 only probes; a signal Darwin does not have is refused (EINVAL 22).

__ablaRuntimeDarwinSignalMask (fun)

trusted fun __ablaRuntimeDarwinSignalMask(linux: int): int

A Linux signal mask (64 bits, bit n-1 for signal n) as Darwin's 32-bit set: the signals both have, by __ablaRuntimeDarwinSignal's table; the others are dropped.

__ablaRuntimeLinuxSignalMask (fun)

trusted fun __ablaRuntimeLinuxSignalMask(darwin: int): int

A Darwin signal set as Linux's 64-bit mask (the inverse, for the old mask).

__ablaRuntimeDarwinSigprocmask (fun)

trusted fun __ablaRuntimeDarwinSigprocmask(how: int, set: int, old: int, size: int): int

rt_sigprocmask 14: Linux's how is 0/1/2 (block, unblock, set), its sets 8 bytes; the thread's mask changes (the adapter used pthread_sigmask, which is this system call).

__ablaRuntimeDarwinNanosleep (fun)

trusted fun __ablaRuntimeDarwinNanosleep(request: int): int

nanosleep (35) over select (93) with no descriptor sets, as the poll fallback sleeps: a timeval of seconds and microseconds (rounded up) in a mapping of its own. select returns 0 when the time has elapsed and EINTR (4) when a signal came; the remaining time is not reported (the caller gets -4 and retries with the same request). (__semwait_signal, which libSystem's nanosleep calls, needs a Mach semaphore port as its first argument: EINVAL with 0.)

abla_darwin_fork (extern)

trusted noescape extern:"c" fun abla_darwin_fork(): int

fork 57 is libSystem's fork (#811): libSystem is loaded in every macOS program, and its fork handlers bring its state over to the child (its Mach ports, malloc, locks a thread held). Without them, the BSD fork call (2) on its own, a child that went on to run C code failed: an OpenSSL handshake in a forked child (tools/test-tls-unix.sh) exited 1 on both Macs (master a010f88a). A child that only execs was fine, but the dispatcher cannot tell which. The call goes through the C adapter's abla_darwin_fork (runtime/abla_darwin_compat.c), which an iOS build, whose runtime is emitted whole, can name: no process API appears in its code (iOS refuses process creation).

__ablaRuntimeDarwinFork (fun)

trusted fun __ablaRuntimeDarwinFork(): int

Forks on macOS, returning the child PID in the parent, zero in the child, or a negative error code.

__ablaRuntimeDarwinTicksPerSecond (var)

var __ablaRuntimeDarwinTicksPerSecond: int

Ticks of mach_absolute_time a second: on Apple Silicon hw.tbfrequency (24 MHz), read once by sysctlbyname 274; 0 until then (a racing first read writes the same value). An x86-64 process's ticks are nanoseconds, on Intel and under Rosetta alike, where hw.tbfrequency still says 24 MHz (the CI probe on 6409ecd4).

__ablaRuntimeDarwinTimebase (fun)

trusted fun __ablaRuntimeDarwinTimebase(scratch: int): int

The timebase, scratch (16 bytes) holding the sysctl's value and its length for the call.

__ablaRuntimeDarwinClockGettime (fun)

trusted fun __ablaRuntimeDarwinClockGettime(clock: int, timespec: int): int

clock_gettime 228 (#811 G1) by gettimeofday 116, no libSystem: CLOCK_MONOTONIC 1 is the mach_absolute_time the call writes at its third argument (time since boot, not counting sleep, as Linux's CLOCK_MONOTONIC; libSystem's counts sleep) in nanoseconds by the timebase; any other clock is the wall clock (CLOCK_REALTIME 0), the timeval the call writes at its first, as the C adapter mapped them.

__ablaRuntimeDarwinStoreTicks (fun)

trusted fun __ablaRuntimeDarwinStoreTicks(timespec: int, ticks: int, frequency: int): void

ticks of mach_absolute_time as a timespec at timespec: whole seconds, then the rest (below frequency, so its product with 10^9 fits) in nanoseconds.

__ablaRuntimeDarwinMonotonicMapped (fun)

trusted fun __ablaRuntimeDarwinMonotonicMapped(timespec: int, frequency: int): int

Writes the monotonic time as seconds and nanoseconds, returning zero or a negative error code.

__ablaRuntimeDarwinRealtimeInRegisters (fun)

trusted fun __ablaRuntimeDarwinRealtimeInRegisters(timespec: int): int

Reads Darwin realtime from the syscall result registers into the timespec, returning zero or a negative error code.

__ablaRuntimeDarwinGetrandom (fun)

trusted fun __ablaRuntimeDarwinGetrandom(buffer: int, length: int): int

getrandom (278, 318) over getentropy (500), which takes at most 256 bytes a call.

__ablaRuntimeDarwinRlimit (fun)

trusted fun __ablaRuntimeDarwinRlimit(number: int, which: int, limits: int): int

getrlimit 97 / setrlimit 160 of RLIMIT_STACK (3 on both systems) over BSD getrlimit 194 and setrlimit 195. The two 8-byte limits have the same layout; an unlimited value is all ones on Linux and 0x7fffffffffffffff (RLIM_INFINITY) on Darwin. Other resources are refused (EINVAL), as the C adapter did. The Linux buffer is rewritten in place for a get; a set converts a copy.

__ablaRuntimeDarwinImageState (fun)

trusted fun __ablaRuntimeDarwinImageState(): int

---- the running image's path, "/proc/self/exe" (#811) ---- A macOS program's image is known by the path the kernel passed in apple[0] ("executable_path=..."), and by the (device, inode) the file had when the program started (recorded first thing in main by __ablaRuntimeDarwinRecordImage; a program built by a compiler without that hook records at its first use). A path that no longer names that file (an install renamed another over it) does not resolve: the caller sees ENOENT, never another program's bytes. State words: +0 0 not recorded yet, 1 recorded, 2 unknown (no path or no stat); +8 device, +16 inode, +24 path address (a mapping), +32 path length.

__ablaRuntimeDarwinStatPath (fun)

trusted fun __ablaRuntimeDarwinStatPath(path: int, block: int): int

The Darwin struct stat64 of path into the 144-byte block at block: 0 or a negative errno.

__ablaRuntimeDarwinImageFromApple (fun)

trusted fun __ablaRuntimeDarwinImageFromApple(memory: int): int

The image's path from the kernel's apple[0] string ("executable_path=...", after the environment's terminator), copied NUL-terminated into memory: its length, or 0 where the environment is not known (the compile-time JIT's is the compiler's only under the environment grant).

__ablaRuntimeDarwinImageFromKernel (fun)

trusted fun __ablaRuntimeDarwinImageFromKernel(memory: int): int

The same path from the kernel's process information (proc_info 336: call 2 PIDINFO, flavor 11 PIDPATHINFO, what libproc's proc_pidpath asks), for a module without the environment.

__ablaRuntimeDarwinRecordImage (fun)

trusted fun __ablaRuntimeDarwinRecordImage(): void

Records the running executable's path and identity once when available on macOS.

__ablaRuntimeDarwinImagePath (fun)

trusted fun __ablaRuntimeDarwinImagePath(): int

The recorded path of the running image (a NUL-terminated address) while it still names the recorded file, 0 otherwise.

__ablaRuntimeDarwinDescriptorIsImage (fun)

trusted fun __ablaRuntimeDarwinDescriptorIsImage(descriptor: int): bool

True when the descriptor's file is the recorded image.

__ablaRuntimeDarwinImageOpen (fun)

trusted fun __ablaRuntimeDarwinImageOpen(directory: int, flags: int, mode: int): int

Opens the recorded executable, returning a descriptor or a negative error if the image is unavailable or changed.

trusted fun __ablaRuntimeDarwinImageReadlink(buffer: int, capacity: int): int

Copies up to the buffer capacity from the recorded executable path, returning the byte count or a negative error code.

__ablaRuntimeDarwinTermiosPair (fun)

trusted fun __ablaRuntimeDarwinTermiosPair(): int

A zeroed 256-byte mapping (two termios blocks), or a negative errno.

__ablaRuntimeDarwinMakeRaw (fun)

trusted fun __ablaRuntimeDarwinMakeRaw(block: int): void

cfmakeraw on the termios block at block, as libSystem's does.

__ablaRuntimeDarwinSerial (fun)

trusted fun __ablaRuntimeDarwinSerial(descriptor: int, settings: int): int

The serial request of abla/serial (0x41424c53): six integer settings (baud, data bits, parity 0/1/2, stop bits, raw, hardware flow) applied to the terminal and read back; ENOTSUP when the device did not take them.

__ablaRuntimeDarwinIoctl (fun)

trusted fun __ablaRuntimeDarwinIoctl(descriptor: int, request: int, argument: int): int

ioctl 16: the serial request and Linux's TCGETS/TCSETS (21505/21506: only the local flags, a 32-bit word at offset 12 of Linux's struct termios), any other request unchanged.

__ablaRuntimeDarwinCpuScratch (fun)

trusted fun __ablaRuntimeDarwinCpuScratch(): int

The 16 bytes sysctlbyname("hw.activecpu") answers into: the value and its length.

__ablaRuntimeDarwinAffinity (fun)

trusted fun __ablaRuntimeDarwinAffinity(size: int, mask: int): int

sched_getaffinity 204 (the runtime's CPU count: how many threads the collector's mark and sweep may use). Darwin has no affinity mask: every CPU hw.activecpu counts (sysctlbyname 274, an int) is in it, the lowest bits of mask set, as Linux writes it, in whole 8-byte words; the bytes written, or EINVAL (22) when size cannot hold them. Without it the call answered ENOSYS and every Mac's collector ran on one thread.

__ablaRuntimeDarwinSyscall (fun)

trusted fun __ablaRuntimeDarwinSyscall(
    number: int,
    argument0: int,
    argument1: int,
    argument2: int,
    argument3: int,
    argument4: int,
    argument5: int
): int

Translates a Linux-style syscall to Darwin and returns its result or a negative errno.

Built from Abla v0.2.79 source ba5d6b7d. Examples and generated signatures follow that source revision.