aboutsummaryrefslogtreecommitdiff
path: root/lib/std/os
AgeCommit message (Collapse)Author
2022-05-11fix ntdll extern casingJonathan Marler
Co-authored-by: Veikka Tuominen <git@vexu.eu>
2022-05-11add unicode supportJonathan Marler
2022-05-11Add `process.EnvMap`, a platform-independent environment variable mapRyan Liptak
EnvMap provides the same API as the previously used BufMap (besides `putMove` and `getPtr`), so usage sites of `getEnvMap` can usually remain unchanged. For non-Windows, EnvMap is a wrapper around BufMap. On Windows, it uses a new EnvMapWindows to handle some Windows-specific behavior: - Lookups use Unicode-aware case insensitivity (but `get` cannot return an error because EnvMapWindows has an internal buffer to use for lookup conversions) - Canonical names are returned when iterating the EnvMap Fixes #10561, closes #4603
2022-05-11Merge pull request #10595 from squeek502/getenvW-caseAndrew Kelley
os.getenvW: Fix case-insensitivity for Unicode env var names
2022-05-10io_uring cancel test must tolerate CQ reorderingBrian Gold
Fixes #11382. Tested on ArchLinux 5.17.5-arch1-1.
2022-05-05std.os.linux.arm-eabi: upgrade to new fn ptr semanticsAndrew Kelley
2022-05-02std.os.windows: upgrade to new function pointer semanticsAndrew Kelley
2022-05-02Avoid some unnecessary underscores in constant namesr00ster91
2022-04-28Seccomp fixups re: #10717Stephen Gregoratto
- Add type annotation for AUDIT.current. - Make unsupported archs a compile error.
2022-04-28Merge pull request #10717 from gh-fork-dump/seccomp-bitsVeikka Tuominen
Add Seccomp bits for linux
2022-04-23std.Thread: Mutex and Condition improvements (#11497)protty
* Thread: minor cleanups * Thread: rewrite Mutex * Thread: introduce Futex.Deadline * Thread: Condition rewrite + cleanup * Mutex: optimize lock fast path * Condition: more docs * Thread: more mutex + condition docs * Thread: remove broken Condition test * Thread: zig fmt * address review comments + fix Thread.DummyMutex in GPA * Atomic: disable bitRmw x86 inline asm for stage2 * GPA: typo mutex_init * Thread: remove noalias on stuff * Thread: comment typos + clarifications
2022-04-23add GetProcessTimes binding to the kernel32.zig (#11488)Morritz
2022-04-19std.os.uefi: Add `BlockIoProtocol`Yusuf Bham
2022-04-17std.os.uefi: fix GUID formatting (#11452)Yusuf Bham
2022-04-16stdlib std.os: Improve wasi-libc parity for WASI CWD emulationCody Tapscott
Two major changes here: 1. We store the CWD as a simple `[]const u8` and lookup Preopens for every absolute or CWD-referenced file operation, based on the Preopen with the longest match (i.e. most specific path) 2. Preorders are normalized to POSIX absolute paths at init time. Behavior depends on the "cwd_root" parameter of `initPreopensWasi`: `cwd_root` is used for any Preopens that start with "." For example: "./foo/bar" - inits to -> "{cwd_root}/foo/bar" "foo/bar" - inits to -> "/foo/bar" "/foo/bar" - inits to -> "/foo/bar" `cwd_root` must be an absolute path. Using "/" as `cwd_root` gives behavior similar to wasi-libc.
2022-04-15update self hosted sources to language changesVeikka Tuominen
2022-04-05zig fmt: remove trailing whitespace on doc commentsDamien Firmenich
Fixes #11353 The renderer treats comments and doc comments differently since doc comments are parsed into the Ast. This commit adds a check after getting the text for the doc comment and trims whitespace at the end before rendering. The `a = 0,` in the test is here to avoid a ParseError while parsing the test.
2022-04-04Pull elf magic string out to re-used constantTom Read Cutting
2022-03-23std.os: disable failing fnctl file locking testAndrew Kelley
See #11074
2022-03-22Fix ucontext_tLocria Cyber
2022-03-21stage2 llvm: fix lowerDeclRefValue for function aliasesVeikka Tuominen
2022-03-19Merge pull request #11228 from Vexu/panicAndrew Kelley
enable default panic handler for stage2 LLVM
2022-03-19fix sigaction double paniczseri
Fixes #8357
2022-03-19std: enable default panic handler for stage2 LLVM on LinuxVeikka Tuominen
2022-03-17macos: update Mach routines for accessing page infoJakub Konka
2022-03-16std: introduce posix_spawn as an alt to fork-execJakub Konka
Currently, the new API will only be available on macOS with the intention of adding more POSIX systems to it incrementally (such as Linux, etc.). Changes: * add `posix_spawn` wrappers in a separate container in `os/posix_spawn.zig` * rewrite `ChildProcess.spawnPosix` using `posix_spawn` targeting macOS as `ChildProcess.spawnMacos` * introduce a `posix_spawn` specific `std.c.waitpid` wrapper which does return an error in case the child process failed to exec - this is required for any process that was spawned using `posix_spawn` mechanism as, by definition, the errors returned by `posix_spawn` routine cover only the `fork`-equivalent; `pre-exec()` and `exec()` steps are covered by a catch-all error `ECHILD` returned by `waitpid` on unsuccessful execution, e.g., no such file error, etc.
2022-03-13std+macho: revert and fix exposing Mach wrappers in std.os and std.cJakub Konka
2022-03-13std: fix imports for darwin specific flags and funcsJakub Konka
2022-03-13macos: add Mach task abstractionJakub Konka
`std.os.darwin.MachTask` wraps `mach_port_t` and can be used to issue kernel calls tied to the wrapped Mach kernel port/task.
2022-03-11std.os: disable failing fnctl file locking testAndrew Kelley
See #11074
2022-03-09Add bits for the Linux Secure Computing facilityStephen Gregoratto
2022-03-06std: disable flaky os.fcntl testAndrew Kelley
See tracking issue #11074
2022-03-03stdlib WASI: Add realpath() support for non-absolute PreopensCody Tapscott
2022-03-03stdlib: Add emulated CWD to std.os for WASI targetsCody Tapscott
This adds a special CWD file descriptor, AT.FDCWD (-2), to refer to the current working directory. The `*at(...)` functions look for this and resolve relative paths against the stored CWD. Absolute paths are dynamically matched against the stored Preopens. "os.initPreopensWasi()" must be called before std.os functions will resolve relative or absolute paths correctly. This is asserted at runtime. Support has been added for: `open`, `rename`, `mkdir`, `rmdir`, `chdir`, `fchdir`, `link`, `symlink`, `unlink`, `readlink`, `fstatat`, `access`, and `faccessat`. This also includes limited support for `getcwd()` and `realpath()`. These return an error if the CWD does not correspond to a Preopen with an absolute path. They also do not currently expand symlinks.
2022-03-03os/linux/io_uring: add recvmsg and sendmsg (#10212)Hiroaki Nakamura
* os/linux/io_uring: add recvmsg and sendmsg * Use std.os.iovec and std.os.iovec_const * Remove msg_ prefix in msghdr and msghdr_const in arm64 etc * Strip msg_ prefix in msghdr and msghdr_const for linux arm-eabi * Copy msghdr and msghdr_const from i386 to mips * Add sockaddr to lib/std/os/linux/mips.zig * Copy msghdr and msghdr_const from x86_64 to riscv64
2022-02-27stage2: fix bitcast to optional ptr in llvm backend; omit safety check for ↵Veikka Tuominen
intToPtr on optional ptr
2022-02-27stage2: use stage1 test runner for stage2Veikka Tuominen
2022-02-24std: work around current packed struct situationIsaac Freund
As of 6249a24, align() is not allowed on packed struct fields and as such the align(4) was removed from the first field of EdidOverrideProtocolAttributes. The endgame here is packed struct backed by explicit integers, in this case a u32, but until that is implemented put the align(4) on the pointer to avoid breaking someone's UEFI code in a hard to debug way.
2022-02-23stage2: integer-backed packed structsAndrew Kelley
This implements #10113 for the self-hosted compiler only. It removes the ability to override alignment of packed struct fields, and removes the ability to put pointers and arrays inside packed structs. After this commit, nearly all the behavior tests pass for the stage2 llvm backend that involve packed structs. I didn't implement the compile errors or compile error tests yet. I'm waiting until we have stage2 building itself and then I want to rework the compile error test harness with inspiration from Vexu's arocc test harness. At that point it should be a much nicer dev experience to work on compile errors.
2022-02-23std.os.linux.socketpair: fd is an out parameterFelix Queißner
2022-02-19os.getenvW: Fix case-insensitivity for Unicode env var namesRyan Liptak
Windows does Unicode-aware case-insensitivity comparisons for environment variable names. Before, os.getenvW was only doing ASCII case-insensitivity. We can take advantage of RtlEqualUnicodeString in NtDll to get the proper Unicode case insensitivity.
2022-02-18Merge pull request #10604 from fifty-six/masterAndrew Kelley
std/os/uefi: additional improvements/fixes
2022-02-15Merge pull request #10003 from viriuwu/nt-thread-nameVeikka Tuominen
std.Thread.getName/setName: rework windows implementation
2022-02-15Adds Linux support for POSIX file locking with fcntlAnthony Carrico
On Linux, locking fails with EAGAIN (vs. EACCES on other systems). This commit also adds FcntlErrors for EDEADLK and ENOLCK.
2022-02-15std.Thread(windows): use NT internals for name fnsviri
2022-02-14Merge pull request #10486 from ominitay/metadataVeikka Tuominen
std: Implement cross-platform metadata API
2022-02-13Merge pull request #10863 from m-radomski/fixAndrew Kelley
std: validate frame-pointer address in stack walking
2022-02-13std.c.Wasi.Stat: use timespecominitay
2022-02-13Fix preadv/pwritev bug on 64bit platformTw
Signed-off-by: Tw <wei.tan@intel.com>
2022-02-11validate in Windows using VirtualQuerym