aboutsummaryrefslogtreecommitdiff
path: root/lib/std/os.zig
AgeCommit message (Collapse)Author
2020-06-22Enhance std.os.symlinkat coverageJakub Konka
Fixes `std.os.symlinkat` compile errors, adds Windows stub (still needs to be implemented), adds WASI implementation.
2020-06-04Windows: Fix std.fs.Dir.deleteDir() deleting filesRyan Liptak
Would previously delete files, now correctly returns error.NotDir. Fixes #5536
2020-06-02cleanupsAndrew Kelley
* improve docs * add TODO comments for things that don't have open issues * remove redundant namespacing of struct fields * guard against ioctl returning EINTR * remove the general std.os.ioctl function in favor of the specific ioctl_SIOCGIFINDEX function. This allows us to have a more precise error set, and more type-safe API.
2020-06-02Change ioctl's request type to i32Luna
2020-06-02Replace syscall3 to os.ioctlLuna
2020-06-02Add std.os.ioctlLuna
2020-06-01Merge pull request #5475 from marler8997/windowsDnsAndrew Kelley
support name resolution on windows
2020-05-31more windows network fixesJonathan Marler
* support posix SOCK_NONBLOCK and SOCK_CLOEXEC flags on windows * fix bugs in os.socket and os.connect to return at the correct place
2020-05-29more windows network support, including dnsJonathan Marler
2020-05-29Document and reduce usage of MAX_PATH_BYTES, lifting arbitrary buffer size ↵Jonathan S
requirements
2020-05-24(breaking) std.time fixups and API changesAndrew Kelley
Remove the constants that assume a base unit in favor of explicit x_per_y constants. nanosecond calendar timestamps now use i128 for the type. This affects fs.File.Stat, std.time.nanoTimestamp, and fs.File.updateTimes. calendar timestamps are now signed, because the value can be less than the epoch (the user can set their computer time to whatever they wish). implement std.os.clock_gettime for Windows when clock id is CLOCK_CALENDAR.
2020-05-18Make mode_t a 0-byte type in WASIJakub Konka
2020-05-18Add/fix missing WASI functionality to pass libstd testsJakub Konka
This rather large commit adds/fixes missing WASI functionality in `libstd` needed to pass the `libstd` tests. As such, now by default tests targeting `wasm32-wasi` target are enabled in `test/tests.zig` module. However, they can be disabled by passing the `-Dskip-wasi=true` flag when invoking the `zig build test` command. When the flag is set to `false`, i.e., when WASI tests are included, `wasmtime` with `--dir=.` is used as the default testing command. Since the majority of `libstd` tests were relying on `fs.cwd()` call to get current working directory handle wrapped in `Dir` struct, in order to make the tests WASI-friendly, `fs.cwd()` call was replaced with `testing.getTestDir()` function which resolved to either `fs.cwd()` for non-WASI targets, or tries to fetch the preopen list from the WASI runtime and extract a preopen for '.' path. The summary of changes introduced by this commit: * implement `Dir.makeDir` and `Dir.openDir` targeting WASI * implement `Dir.deleteFile` and `Dir.deleteDir` targeting WASI * fix `os.close` and map errors in `unlinkat` * move WASI-specific `mkdirat` and `unlinkat` from `std.fs.wasi` to `std.os` module * implement `lseek_{SET, CUR, END}` targeting WASI * implement `futimens` targeting WASI * implement `ftruncate` targeting WASI * implement `readv`, `writev`, `pread{v}`, `pwrite{v}` targeting WASI * make sure ANSI escape codes are _not_ used in stderr or stdout in WASI, as WASI always sanitizes stderr, and sanitizes stdout if fd is a TTY * fix specifying WASI rights when opening/creating files/dirs * tweak `AtomicFile` to be WASI-compatible * implement `os.renameatWasi` for WASI-compliant `os.renameat` function * implement sleep() targeting WASI * fix `process.getEnvMap` targeting WASI
2020-05-07remove readable check when opening a socket connectionLoris Cro
2020-05-05avoid unnecessary fcntl syscalls when setting socket flagsAndrew Kelley
2020-05-05fix incorrect flags being set in os.setSockFlagsAndrew Kelley
fixes networking stuff on darwin
2020-05-04os.zig: add ETIMEDOUT error case to read functionJonathan Marler
According to documentation ETIMEDOUT (110) is a valid error code for the read function. I just had my long-running (been running for about 7 weeks) network program crash because it did not handle the ETIMEDOUT error code from "read".
2020-05-03Pass filtered_sock_type to system.socket. Cover PermissionDenied errorCato
2020-05-02solve the problem with Darwin shims in std.os insteadAndrew Kelley
* implement SOCK_NONBLOCK and SOCK_CLOEXEC Darwin shims in std.os * revert changes to std.net * remove os.accept and rename os.accept4 to os.accept
2020-05-02Fixed Darwin-incompatible socket flags and unavailable system callsCato
2020-05-02Merge remote-tracking branch 'origin/master' into FireFox317-windows-evented-ioAndrew Kelley
2020-05-02Get evented io code paths to build on macOS (#5233)Chris Heyes
* Get evented io code paths to build on macOS * Use mode_t instead of usize where appropriate
2020-05-02fs.File: improve handling async I/O on WindowsAndrew Kelley
Before it was possible for .intended_io_mode = .blocking, .capable_io_mode = .evented, and then the implementation would put a request on the fs thread, which is the wrong behavior. Now it always calls the appropriate WriteFile/ReadFile function, passing the intended io mode directly as a parameter. This makes the behavior tests pass on Windows with --test-evented-io.
2020-05-02fix regressions in windows std lib testsAndrew Kelley
2020-05-02std.event.Loop: promote the fs thread to be available for all OS'sAndrew Kelley
2020-05-01cleanup and fixes. behavior tests passing with evented I/OAndrew Kelley
2020-05-01Merge branch 'windows-evented-io' of https://github.com/FireFox317/zig into ↵Andrew Kelley
FireFox317-windows-evented-io
2020-05-01Add arc4random_buf() in NetBSD libc, use it to implement getrandom()nia
2020-04-28std.meta.IntType -> std.meta.IntTadeo Kondrak
2020-04-18std.os.readv: Add missing iov_count declarationChristian Wesselhoeft
2020-04-15translate-c cleanup and zig fmtVexu
2020-04-13std: fix os.fstatat definition (#5016)daurnimator
2020-04-08Return error from `else`LeRoyce Pearson
That removes the other switch cases (`error.WouldBlock` here) from the error set, I think.
2020-04-08Catch error.WouldBlock as unreachableLeRoyce Pearson
2020-04-07Add `OpenFileW` `share_access_nonblocking` parameterLeRoyce Pearson
2020-04-06Remove return value from os.flock()LeRoyce Pearson
2020-04-03Fix compile errors about adding error.FileLocksNotSupportedLeRoyce Pearson
2020-04-02Fix compile errors in stage2LeRoyce Pearson
2020-04-02Use `flock` instead of `fcntl` to lock filesLeRoyce Pearson
`flock` locks based on the file handle, instead of the process id. This brings the file locking on unix based systems closer to file locking on Windows.
2020-04-02Add FileLocksNotSupported error to OpenErrorLeRoyce Pearson
2020-04-02Merge branch 'master' into feature-file-locksLeRoyce Pearson
2020-04-02slight modification of the semantics of std.os.getenvWAndrew Kelley
Now, this function first attempts a case-sensitive lookup. If no match is found, and `key` is ASCII, then it attempts a second case-insensitive lookup. It is not planned to support full Unicode case-insensitivity on Windows, and in fact relying on non-ASCII case-insensitive environment variables is fundamentally problematic.
2020-04-02make std.os.getenvW case insensitiveIlmari Autio
partially addresses #4603 Fixing std.process.getEnvMap is NOT included in this commit.
2020-04-01std: Use the versioned libc symbols if neededLemonBoy
Many symbols on NetBSD and some on OSX require the definition of an alias.
2020-04-01Tidy up some mem.spanZ use-sites now that null is accepteddaurnimator
2020-03-31std: linux syscall numbers are now an extensible enumdaurnimator
2020-03-30std lib API deprecations for the upcoming 0.6.0 releaseAndrew Kelley
See #3811
2020-03-27Merge branch 'master' into feature-file-locksLeRoyce Pearson
2020-03-27fix behavior test with --test-evented-io on windowsTimon Kruiper
also make simple file operations work asynchronously on windows
2020-03-24std: Slim duplicate logic for some callsLemonBoy