memfd_create
Function parameters
Parameters
- name:[*:0]const u8
- flags:c_uint
Type definitions in this namespace
Types
- LC
- These are implementation defined but share identical values in at least musl and glibc:
* If not linking libc, returns `false`.
Functions
- versionCheck
- * If not linking libc, returns `false`.
- getauxval
- See std.elf for constants for this
- sigrtmin
- Zig's version of SIGRTMIN.
- sigrtmax
- Zig's version of SIGRTMAX.
The value of the link editor defined symbol _MH_EXECUTE_SYM is the address
Values
- _mh_execute_header
- The value of the link editor defined symbol _MH_EXECUTE_SYM is the address
- FD_CLOEXEC
- = switch (native_os) { .linux => linux.FD_CLOEXEC, .emscripten => emscripten.FD_CLOEXEC, else => 1, }
- F_OK
- Test for existence of file.
- X_OK
- Test for execute or search permission.
- W_OK
- Test for write permission.
- R_OK
- Test for read permission.
- HOST_NAME_MAX
- = switch (native_os) { .linux => linux.HOST_NAME_MAX, .macos, .ios, .tvos, .watchos, .visionos => 72, .openbsd, .haiku, .dragonfly, .netbsd, .solaris, .illumos, .freebsd => 255, // https://github.com/SerenityOS/serenity/blob/c87557e9c1865fa1a6440de34ff6ce6fc858a2b7/Kernel/API/POSIX/sys/limits.h#L22 .serenity => 64, else => {}, }
- IOV_MAX
- = switch (native_os) { .linux => linux.IOV_MAX, .emscripten => emscripten.IOV_MAX, // https://github.com/SerenityOS/serenity/blob/098af0f846a87b651731780ff48420205fd33754/Kernel/API/POSIX/sys/uio.h#L16 .openbsd, .haiku, .solaris, .illumos, .wasi, .serenity => 1024, .macos, .ios, .tvos, .watchos, .visionos => 16, .dragonfly, .netbsd, .freebsd => KERN.IOV_MAX, else => {}, }
- NAME_MAX
- = switch (native_os) { .linux => linux.NAME_MAX, .emscripten => emscripten.NAME_MAX, // Haiku's headers make this 256, to contain room for the terminating null // character, but POSIX definition says that NAME_MAX does not include the // terminating null. // https://github.com/SerenityOS/serenity/blob/c87557e9c1865fa1a6440de34ff6ce6fc858a2b7/Kernel/API/POSIX/sys/limits.h#L20 .haiku, .openbsd, .dragonfly, .netbsd, .solaris, .illumos, .freebsd, .macos, .ios, .tvos, .watchos, .visionos, .serenity => 255, else => {}, }
- PATH_MAX
- = switch (native_os) { .linux => linux.PATH_MAX, .emscripten => emscripten.PATH_MAX, .wasi => 4096, .windows => 260, .openbsd, .haiku, .dragonfly, .netbsd, .solaris, .illumos, .freebsd, .macos, .ios, .tvos, .watchos, .visionos, .serenity => 1024, else => {}, }
- STDIN_FILENO
- = switch (native_os) { .linux => linux.STDIN_FILENO, .emscripten => emscripten.STDIN_FILENO, else => 0, }
- STDOUT_FILENO
- = switch (native_os) { .linux => linux.STDOUT_FILENO, .emscripten => emscripten.STDOUT_FILENO, else => 1, }
- STDERR_FILENO
- = switch (native_os) { .linux => linux.STDERR_FILENO, .emscripten => emscripten.STDERR_FILENO, else => 2, }
- _errno
- = switch (native_os) { .linux => switch (native_abi) { .android, .androideabi => private.__errno, else => private.__errno_location, }, .emscripten => private.__errno_location, .wasi, .dragonfly => private.errnoFromThreadLocal, .windows => private._errno, .macos, .ios, .tvos, .watchos, .visionos, .freebsd => private.__error, .solaris, .illumos => private.___errno, .openbsd, .netbsd => private.__errno, .haiku => haiku._errnop, // https://github.com/SerenityOS/serenity/blob/a353ceecf13b6f156a078e32f1ddf1d21366934c/Userland/Libraries/LibC/errno.h#L33 .serenity => private.__errno_location, else => {}, }
- MAXNAMLEN
- = switch (native_os) { .netbsd, .solaris, .illumos => 511, // https://github.com/SerenityOS/serenity/blob/1262a7d1424d0d2e89d80644409721cbf056ab17/Kernel/API/POSIX/dirent.h#L37 .haiku, .serenity => NAME_MAX, .openbsd => 255, else => {}, }
- MAP_FAILED
- Used by libc to communicate failure.
- NSIG
- maximum signal number + 1
- MINSIGSTKSZ
- = switch (native_os) { .macos, .ios, .tvos, .watchos, .visionos => 32768, .freebsd => switch (builtin.cpu.arch) { .x86, .x86_64 => 2048, .arm, .aarch64 => 4096, else => @compileError("unsupported arch"), }, .solaris, .illumos => 2048, .haiku, .netbsd => 8192, .openbsd => 1 << openbsd.MAX_PAGE_SHIFT, // https://github.com/SerenityOS/serenity/blob/ec492a1a0819e6239ea44156825c4ee7234ca3db/Kernel/API/POSIX/signal.h#L58 .serenity => 4096, else => {}, }
- SIGSTKSZ
- = switch (native_os) { .macos, .ios, .tvos, .watchos, .visionos => 131072, .netbsd, .freebsd => MINSIGSTKSZ + 32768, .solaris, .illumos => 8192, .haiku => 16384, .openbsd => MINSIGSTKSZ + (1 << openbsd.MAX_PAGE_SHIFT) * 4, // https://github.com/SerenityOS/serenity/blob/ec492a1a0819e6239ea44156825c4ee7234ca3db/Kernel/API/POSIX/signal.h#L59 .serenity => 32768, else => {}, }
- close
- = switch (native_os) { .macos, .ios, .tvos, .watchos, .visionos => darwin.@"close$NOCANCEL", else => private.close, }
- clock_getres
- = switch (native_os) { .netbsd => private.__clock_getres50, else => private.clock_getres, }
- clock_gettime
- = switch (native_os) { .netbsd => private.__clock_gettime50, else => private.clock_gettime, }
- fstat
- = switch (native_os) { .macos => switch (native_arch) { .x86_64 => private.@"fstat$INODE64", else => private.fstat, }, .netbsd => private.__fstat50, else => private.fstat, }
- fstatat
- = switch (native_os) { .macos => switch (native_arch) { .x86_64 => private.@"fstatat$INODE64", else => private.fstatat, }, else => private.fstatat, }
- arc4random_buf
- = switch (native_os) { .linux => if (builtin.abi.isAndroid()) private.arc4random_buf else {}, .dragonfly, .netbsd, .freebsd, .solaris, .openbsd, .macos, .ios, .tvos, .watchos, .visionos => private.arc4random_buf, else => {}, }
- getentropy
- = switch (native_os) { .linux => if (builtin.abi.isAndroid() and versionCheck(.{ .major = 28, .minor = 0, .patch = 0 })) private.getentropy else {}, .emscripten => private.getentropy, else => {}, }
- getrandom
- = switch (native_os) { .freebsd => private.getrandom, .linux => if (builtin.abi.isMusl() or (builtin.abi.isGnu() and versionCheck(.{ .major = 2, .minor = 25, .patch = 0 })) or (builtin.abi.isAndroid() and versionCheck(.{ .major = 28, .minor = 0, .patch = 0 }))) private.getrandom else {}, else => {}, }
- sendfile
- = switch (native_os) { .freebsd => freebsd.sendfile, .macos, .ios, .tvos, .watchos, .visionos => darwin.sendfile, .linux => private.sendfile, else => {}, }
- sigaltstack
- = switch (native_os) { .netbsd => private.__sigaltstack14, else => private.sigaltstack, }
- pipe2
- = switch (native_os) { .dragonfly, .emscripten, .netbsd, .freebsd, .solaris, .illumos, .openbsd, .linux, .serenity => private.pipe2, else => {}, }
- copy_file_range
- = switch (native_os) { .linux => private.copy_file_range, .freebsd => freebsd.copy_file_range, else => {}, }
- getdirentries
- = switch (native_os) { .macos, .ios, .tvos, .watchos, .visionos => private.__getdirentries64, else => private.getdirentries, }
- getdents
- = switch (native_os) { .netbsd => private.__getdents30, else => private.getdents, }
- getrusage
- = switch (native_os) { .netbsd => private.__getrusage50, else => private.getrusage, }
- gettimeofday
- = switch (native_os) { .netbsd => private.__gettimeofday50, else => private.gettimeofday, }
- msync
- = switch (native_os) { .netbsd => private.__msync13, else => private.msync, }
- nanosleep
- = switch (native_os) { .netbsd => private.__nanosleep50, else => private.nanosleep, }
- readdir
- = switch (native_os) { .macos => switch (native_arch) { .x86_64 => private.@"readdir$INODE64", else => private.readdir, }, .windows => {}, else => private.readdir, }
- realpath
- = switch (native_os) { .macos, .ios, .tvos, .watchos, .visionos => private.@"realpath$DARWIN_EXTSN", else => private.realpath, }
- sched_yield
- = switch (native_os) { .netbsd => private.__libc_thr_yield, else => private.sched_yield, }
- sigaction
- = switch (native_os) { .netbsd => private.__sigaction14, else => private.sigaction, }
- sigfillset
- = switch (native_os) { .netbsd => private.__sigfillset14, else => private.sigfillset, }
- sigemptyset
- = switch (native_os) { .netbsd => private.__sigemptyset14, else => private.sigemptyset, }
- sigprocmask
- = switch (native_os) { .netbsd => private.__sigprocmask14, else => private.sigprocmask, }
- socket
- = switch (native_os) { .netbsd => private.__socket30, else => private.socket, }
- stat
- = switch (native_os) { .macos => switch (native_arch) { .x86_64 => private.@"stat$INODE64", else => private.stat, }, else => private.stat, }
- _msize
- = switch (native_os) { .windows => private._msize, else => {}, }
- malloc_size
- = switch (native_os) { .macos, .ios, .tvos, .watchos, .visionos, .serenity => private.malloc_size, else => {}, }
- malloc_usable_size
- = switch (native_os) { .freebsd, .linux, .serenity => private.malloc_usable_size, else => {}, }
- posix_memalign
- = switch (native_os) { .dragonfly, .netbsd, .freebsd, .solaris, .openbsd, .linux, .macos, .ios, .tvos, .watchos, .visionos, .serenity => private.posix_memalign, else => {}, }
- sysconf
- = switch (native_os) { .solaris => solaris.sysconf, else => private.sysconf, }
- flock
- = switch (native_os) { .windows, .wasi => {}, else => private.flock, }
- futex
- = switch (native_os) { .openbsd => openbsd.futex, .serenity => serenity.futex, else => {}, }
- fork
- = switch (native_os) { .dragonfly, .freebsd, .ios, .linux, .macos, .netbsd, .openbsd, .solaris, .illumos, .tvos, .watchos, .visionos, .haiku, .serenity, => private.fork, else => {}, }
- pthread_setname_np
- = switch (native_os) { .macos, .ios, .tvos, .watchos, .visionos => darwin.pthread_setname_np, .solaris, .illumos => solaris.pthread_setname_np, .netbsd => netbsd.pthread_setname_np, else => private.pthread_setname_np, }
- pthread_threadid_np
- = switch (native_os) { .macos, .ios, .tvos, .watchos, .visionos => private.pthread_threadid_np, else => {}, }
- PTHREAD_MUTEX_INITIALIZER
- = pthread_mutex_t{}
- PTHREAD_COND_INITIALIZER
- = pthread_cond_t{}
- getcontext
- = if (builtin.target.abi.isAndroid() or builtin.target.os.tag == .openbsd or builtin.target.os.tag == .haiku) {} // libc does not implement getcontext else if (native_os == .linux and builtin.target.abi.isMusl()) linux.getcontext else private.getcontext
- GETCONTEXT
- = solaris.GETCONTEXT
- GETUSTACK
- = solaris.GETUSTACK
- SETCONTEXT
- = solaris.SETCONTEXT
- SETUSTACK
- = solaris.GETUSTACK
- PTHREAD_STACK_MIN
- = openbsd.PTHREAD_STACK_MIN
- CAP_RIGHTS_VERSION
- = freebsd.CAP_RIGHTS_VERSION
- KINFO_FILE_SIZE
- = freebsd.KINFO_FILE_SIZE
- UMTX_ABSTIME
- = freebsd.UMTX_ABSTIME
- MACH_TASK_BASIC_INFO
- = darwin.MACH_TASK_BASIC_INFO
- MACH_TASK_BASIC_INFO_COUNT
- = darwin.MACH_TASK_BASIC_INFO_COUNT
- OPEN_MAX
- = darwin.OPEN_MAX
- TASK_NULL
- = darwin.TASK_NULL
- TASK_VM_INFO
- = darwin.TASK_VM_INFO
- TASK_VM_INFO_COUNT
- = darwin.TASK_VM_INFO_COUNT
- THREAD_BASIC_INFO
- = darwin.THREAD_BASIC_INFO
- THREAD_BASIC_INFO_COUNT
- = darwin.THREAD_BASIC_INFO_COUNT
- THREAD_IDENTIFIER_INFO_COUNT
- = darwin.THREAD_IDENTIFIER_INFO_COUNT
- THREAD_NULL
- = darwin.THREAD_NULL
- THREAD_STATE_NONE
- = darwin.THREAD_STATE_NONE
- mach_hdr
- = darwin.mach_hdr
Source
Implementation
pub extern "c" fn memfd_create(name: [*:0]const u8, flags: c_uint) c_int