aboutsummaryrefslogtreecommitdiff
path: root/lib/std/os.zig
AgeCommit message (Collapse)Author
2019-10-29std.net: port the RFC 3484/6724 destination...Andrew Kelley
...address selection from musl libc
2019-10-29implement CNAME expansionAndrew Kelley
2019-10-29basic DNS address resolution for linux without libcAndrew Kelley
2019-10-26std: make addr_size parameter be a pointer to socklen_tLuna
removes ptrCast
2019-10-26fix std.os.accept4Luna
- add WouldBlock to list of errors in AcceptError - ptrCast addr_size to the system's socklen_t, instead of assuming it's usize
2019-10-24os.dup2: handle EBAFAndrew Kelley
2019-10-24get rid of std.os.foo.is_the_targetAndrew Kelley
It had the downside of running all the comptime blocks and resolving all the usingnamespaces of each system, when just trying to discover if the current system is a particular one. For Darwin, where it's nice to use `std.Target.current.isDarwin()`, this demonstrates the utility that #425 would provide.
2019-10-24refAllDecls in a test block to limit when it gets runAndrew Kelley
2019-10-23move types from builtin to stdAndrew Kelley
* All the data types from `@import("builtin")` are moved to `@import("std").builtin`. The target-related types are moved to `std.Target`. This allows the data types to have methods, such as `std.Target.current.isDarwin()`. * `std.os.windows.subsystem` is moved to `std.Target.current.subsystem`. * Remove the concept of the panic package from the compiler implementation. Instead, `std.builtin.panic` is always the panic function. It checks for `@hasDecl(@import("root"), "panic")`, or else provides a default implementation. This is an important step for multibuilds (#3028). Without this change, the types inside the builtin namespace look like different types, when trying to merge builds with different target settings. With this change, Zig can figure out that, e.g., `std.builtin.Os` (the enum type) from one compilation and `std.builtin.Os` from another compilation are the same type, even if the target OS value differs.
2019-10-21Merge branch 'stratact-no-dir-allocators'Andrew Kelley
closes #2885 closes #2886 closes #2888 closes #3249
2019-10-21std.os.accept4: improve docs and integrate with evented I/OAndrew Kelley
2019-10-21Fix accept function APIJonathan Marler
The sockaddr pointer and size of the accept function points to a data structure that can only be determined at runtime. The only requirement is that it must be large enough to hold 2 bytes for the address family value. Typeical usage of the socket API is for UDP/TCP IPv4 and IPv6 sockets, which use sockaddr_in and sockaddr_in6. And some sockets can actually support both simultaneously in which case the app may want to have access to the size of the returned sockaddr. Operating systems can even support custom protocols where they use custom sockaddr data structures. In this case the standard library would have no knowledge of the actual size of the sockaddr being passed into the accept function. In this case the standard library should defer to the app to pass in the size of their structure.
2019-10-21fix os.unlinkatW implementationAndrew Kelley
2019-10-21[wip] use NtDll APIs on Windows to implement std.fs.DirAndrew Kelley
2019-10-20breaking: improve std.fs directory handling APIAndrew Kelley
* Added `std.c.unlinkat` and `std.os.unlinkat`. * Removed `std.fs.MAX_BUF_BYTES` (this declaration never made it to master branch) * Added `std.fs.Dir.deleteTree` to be used on an open directory handle. * `std.fs.deleteTree` has better behavior for both relative and absolute paths. For absolute paths, it opens the base directory and uses that handle for subsequent operations. For relative paths, it does a similar strategy, using the cwd handle. * The error set of `std.fs.deleteTree` is improved to no longer have these possible errors: - OutOfMemory - FileTooBig - IsDir - DirNotEmpty - PathAlreadyExists - NoSpaceLeft * Added `std.fs.Dir.posix_cwd` which is a statically initialized directory representing the current working directory. * The error set of `std.Dir.open` is improved to no longer have these possible errors: - FileTooBig - IsDir - NoSpaceLeft - PathAlreadyExists - OutOfMemory * Added more alternative functions to `std.fs` for when the path parameter is a null terminated string. This can sometimes be more effecient on systems which have an ABI based on null terminated strings. * Added `std.fs.Dir.openDir`, `std.fs.Dir.deleteFile`, and `std.fs.Dir.deleteDir` which all operate on an open directory handle. * `std.fs.Walker.Entry` now has a `dir` field, which can be used to do operations directly on `std.fs.Walker.Entry.basename`, avoiding `error.NameTooLong` for deeply nested paths. * Added more docs to `std.os.OpenError` This commit does the POSIX components for these changes. I plan to follow up shortly with a commit for Windows.
2019-10-16[breaking] standardize std.os execve functionsAndrew Kelley
* `std.os.execve` had the wrong name; it should have been `std.os.execvpe`. This is now corrected. * introduce `std.os.execveC` which does not look at PATH, and uses null terminated parameters, matching POSIX ABIs. It does not require an allocator. * fix typo nonsense doc comment in `std.fs.MAX_PATH_BYTES`. * introduce `std.os.execvpeC`, which is like `execvpe` except it uses null terminated parameters, matching POSIX ABIs, and thus does not require an allocator. * `std.os.execvpe` implementation is reworked to only convert parameters and then delegate to `std.os.execvpeC`. * `std.os.execvpeC` improved to handle `ENOTDIR`. See #3415
2019-10-10generated docs: add optional type supportAndrew Kelley
2019-10-09Correct std.os.connect_async docsAlva
2019-10-08generated docs: error sets in fn docsAndrew Kelley
2019-10-01Replace code occurences of --override-std-dir with --override-lib-dirSamTebbs33
2019-09-27std.os.fstat: EINVAL => unreachableAndrew Kelley
Related: #3291
2019-09-25mv std/ lib/Andrew Kelley
that's all this commit does. further commits will fix cli flags and such. see #2221