aboutsummaryrefslogtreecommitdiff
path: root/lib/std/os
AgeCommit message (Collapse)Author
2021-06-06std: Fix some BPF fn definitionsLemonBoy
Cros-checked with bpf.h of kernel 5.12.9.
2021-06-01os/bits: remove duplicate `sockaddr_storage` for dragonflyKenta Iwasaki
2021-06-01os: make msghdr, msghdr_const, and sockaddr_storage backwards-compatibleKenta Iwasaki
`msghdr` and `msghdr_const` definitions have been added back the way they were in std.os. std.os.sendmsg has also been modified to accept a msghdr_const again to ensure backwards-compatibility with this PR. Underneath the hood, std.os.sendmsg will @ptrCast the provided msghdr_const into a std.x.os.Socket.Message. `sockaddr_storage` definitions have been added back the way they were in std.os, except that it now simply aliases std.x.os.Socket.Address.Native.Storage as all of std.x.os.Socket.Address.Native.Storage's fields are equivalent to the fields that were previously defined for std.x.os.bits.sockaddr_storage. std.x.os.Socket.sendMessage now no longer is a stub that aliases std.os.sendmsg, but instead calls and handles errors from std.os.system.sendmsg directly. Addresses feedback to urge backwards compatibility from @andrewrk.
2021-06-01x/os/net: remove unnecessary comptime prefix in resolveScopeID()Kenta Iwasaki
2021-06-01x: replace std.builtin with std.Target.currentKenta Iwasaki
2021-06-01os: `sockaddr_storage` -> `std.x.os.Socket.Address.Native.Storage`Kenta Iwasaki
2021-06-01os: have sendmsg, recvmsg flags be c_intlithdew
2021-06-01x/io, x/os: async i/o reactor, cross-platform socket syscalls and bitslithdew
Cross-platform versions of msghdr, sendmsg, recvmsg, linger, and iovec were provided based on findings from glibc, musl, and Microsoft's documentation. Implemented initial Reactor interface for epoll (linux) which wraps around I/O reactor subsystems such as epoll, kqueue, select, etc. across different platforms. The Reactor interface allows for driving async I/O in Zig applications. A test was added for the Reactor interface to drive a TCP client/listener socket pair. A greatest-common-subset of possible socket initialization flags (close socket on exec syscalls, initialize socket to be non-blocking) were implemented. A test was added for using sendmsg/recvmsg syscalls across different platforms for a TCP client/listener socket pair.
2021-05-24Fix socklen_t cast in win32 recvfromJens Goldberg
All other uses of `ws2_32.socklen_t` in windows.zig casts the value to an i32. `recvfrom` should do so as well; it currently errors out with `expected type '?*i32', found '?*u32'`.
2021-05-24housekeeping: builtin.arch → builtin.cpu.archMichael Dusan
2021-05-24dragonfly: pass `zig build test`Michael Dusan
2021-05-23overhaul elf csu (c-runtime startup) logicMichael Dusan
- more support for linux, android, freebsd, netbsd, openbsd, dragonfly - centralize musl utils; musl logic is no longer intertwined with csu - fix musl compilation to build crti/crtn for full archs list - fix openbsd to support `zig build-lib -dynamic` - initial dragonfly linking success (with a warning) ancillary: - fix emutls (openbsd) tests to use `try`
2021-05-22Merge pull request #8844 from ifreund/inlineAndrew Kelley
Support inline keyword as well as callconv(.Inline)
2021-05-22openbsd: complete kqueue(2) constant definitionsSébastien Marie
2021-05-22Merge pull request #7664 from marler8997/fixWindowsPathsAndrew Kelley
implement nt path conversion for windows
2021-05-21handle relative paths with too many ".."Jonathan Marler
2021-05-20Const correct GUID parameter of getInfo and setInfomason1920
2021-05-20Merge pull request #8776 from notviri/windows-wm-constantsAndrew Kelley
fix & add some Win32 window message constants
2021-05-20have collapseRepeats return slice intead of just lenJonathan Marler
2021-05-20implement nt path conversion for windowsJonathan Marler
2021-05-20std: Windows: WSASocketW ensures WSAStartupAndrew Kelley
When WSASocketW gets WSANOTINITIALISED, now it will lock a mutex to safely call WSAStartup and then try again one time. This implementation: * Does not use recursion * Contains a detailed doc comment explaining why things are how they are * Is careful about which errors are surfaced in the respective error sets. `std.os.socket` intentionally does not have "not initialised" as one of the possible errors.
2021-05-20std.os: WSAStartup is now called upon socket creation when neededBxil
2021-05-20Run `zig fmt` on src/ and lib/std/Isaac Freund
This replaces callconv(.Inline) with the more idiomatic inline keyword.
2021-05-19openbsd: convert builtin.arch to builtin.target.cpu.archSébastien Marie
2021-05-18std: update freebsd bits to new builtinAndrew Kelley
2021-05-17std: update regarding std.builtin reorganizationAndrew Kelley
There are also some regressed std.fmt tests here and I haven't figured out what's wrong yet.
2021-05-15Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgenAndrew Kelley
Conflicts: * build.zig * src/Compilation.zig * src/codegen/spirv/spec.zig * src/link/SpirV.zig * test/stage2/darwin.zig - this one might be problematic; start.zig looks for `main` in the root source file, not `_main`. Not sure why there is an underscore there in master branch.
2021-05-15remove range constantsviri
2021-05-14std: dragonfly: fix duplicate definition of sockaddr_storageAndrew Kelley
2021-05-14std: re-add weird undocumented Win32 constantsviri
Got deleted. Not documented but sure.
2021-05-14std: fix & add os.windows.user32 WM constantsviri
2021-05-14Merge pull request #8746 from koachan/sparc64-fixesAndrew Kelley
Various Linux/SPARCv9 fixes
2021-05-13std: dragonfly: fix duplicate definition of sockaddr_storageAndrew Kelley
2021-05-12Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgenAndrew Kelley
Conflicts: * lib/std/os/linux.zig * lib/std/os/windows/bits.zig * src/Module.zig * src/Sema.zig * test/stage2/test.zig Mainly I wanted Jakub's new macOS code for respecting stack size, since we now depend on it for debug builds able to pass one of the test cases for recursive comptime function calls with `@setEvalBranchQuota`. The conflicts were all trivial.
2021-05-12stage2: Add CPU feature detection for macosLemonBoy
This is mostly meant to detect the current and future AArch64 core types as the x86 part is already taken care of with OS-independent machinery.
2021-05-12Define ENOTSUP for SPARCKoakuma
2021-05-11bsd: detect os versionMichael Dusan
- netbsd, dragonly: use sysctlbyname - openbsd: use sysctl - updated default semver ranges
2021-05-11std: Fix offset param splitting for preadv/pwritevLemonBoy
The kernel interface expects the offset as a low+high pair even on BE systems.
2021-05-11std: Fix fallocate offset typeLemonBoy
2021-05-11std: Harmonize use of off_t between libc and Zig implsLemonBoy
Let's follow the libc/kernel convention and use an i64 for offsets, we bitcast as needed and avoid the useless conditional casts.
2021-05-10std/os: add missing sockaddr_storage defslithdew
2021-05-10std/os: fix sockaddr_storage padding sizelithdew
2021-05-10std/os/windows/ws2_32: add missing FIONBIO constantlithdew
2021-05-10x/os/socket, std/os/windows: implement loading winsock extensionslithdew
Implement loading Winsock extensions. Add missing Winsock extension GUID's. Implement readVectorized() for POSIX sockets and readVectorized() / writeVectorized() for Windows sockets. Inverse how mixins are used to implement platform-independent syscalls for the std.x.os.Socket abstraction. This cleans up the API as suggested by @komuw.
2021-05-10x/os, x/net, os:, fix typos/errors, add missing constants/docslithdew
Add missing constants to ws2_32 such as SIO_BASE_HANDLE. Made all declared constants in ws2_32 comptime_int, and fixed a few broken constants (i.e. GUID's). Fixed a few syscalls not having callconv(WINAPI) in ws2_32. Fixed a typo in std.x.net.tcp.Client. Removed unnecessary @alignCast's for socket addresses in std.x.net.Socket. Added a warning on using timeout methods for std.x.net.Socket. Fixed compilation error spotted by CI in std.os that references std.os.windows.ws2_32.SD_RECEIVE. Renamed std.x.os.Socket.setOption()'s parameter `name: u32` to `code: u32`.
2021-05-10std/os, x/os/socket: windows support, socket helpers, getpeername()lithdew
Socket I/O methods such as read, readv, write, writev, send, recv, sendmsg, recvmsg have been generalized to read(buf, flags), write(buf, flags), readVectorized(vectors, flags), and writeVectorized(vectors, flags). There is still some work left to be done abstracting both readVectorized and writeVectorized properly across platforms, which is work to be done in a future PR. Support for setting the linger timeout of a socket, querying the remote address of a socket, setting whether or not keep-alive messages are to be sent through a connection-oriented socket periodically depending on host operating system settings has been added. `std.io.Reader` and `std.io.Writer` wrappers around `Socket` has been implemented, which wrap around Socket.read(buf, flags) and Socket.write(buf, flags). Both wrappers may be provided flags which are passed to Socket.read / Socket.write accordingly. Cross-platform support for `getpeername()` has been implemented. Windows support for the new `std.x.os.Socket` has been implemented. To accomplish this, a full refactor of `std.os.windows.ws2_32` has been done to supply any missing definitions and constants based on auto-generated Windows syscall bindings by @marler8997. `std.x.net.TCP.Listener.setQuickACK` has been moved to `std.x.net.TCP.Client.setQuickACK`. Windows support for resolving the scope ID of an interface name specified in an IPv6 address has been provided. `sockaddr_storage` definitions have been provided for Windows, Linux, and Darwin. `sockaddr_storage` is used to allocate space before any socket addresses are queried via. calls such as accept(), getsockname(), and getpeername(). Zig-friendly wrappers for GetQueuedCompletionStatusEx(), getpeername(), SetConsoleCtrlHandler(), SetFileCompletionNotificationModes() syscalls on Windows have been provided. Socket.setOption() was provided to set the value of a socket option in place of os.setsockopt. Socket.getOption() will be provided in a future PR. There is still further work to be done regarding querying socket option values on Windows, which is to be done in a subsequent PR.
2021-05-09Initialize the Stat structureFrank Denis
The system `stat` structure includes padding, and, on some operating systems such as all BSDs, "spare" bytes at the end. We can't reliably compare two `Stat` values if these are uninitialized, while being later compared. This is what was causing the `fstatat` test to fail on FreeBSD since the update to LLVM 12. It was previously only passing by accident.
2021-05-08Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgenAndrew Kelley
Conflicts: * doc/langref.html.in * lib/std/enums.zig * lib/std/fmt.zig * lib/std/hash/auto_hash.zig * lib/std/math.zig * lib/std/mem.zig * lib/std/meta.zig * test/behavior/alignof.zig * test/behavior/bitcast.zig * test/behavior/bugs/1421.zig * test/behavior/cast.zig * test/behavior/ptrcast.zig * test/behavior/type_info.zig * test/behavior/vector.zig Master branch added `try` to a bunch of testing function calls, and some lines also had changed how to refer to the native architecture and other `@import("builtin")` stuff.
2021-05-08Merge pull request #8686 from Vexu/tryAndrew Kelley
Allow tests to fail
2021-05-08Merge remote-tracking branch 'origin/master' into stage2-whole-file-astgenAndrew Kelley
Conflicts: * lib/std/os/linux/tls.zig * test/behavior/align.zig * test/behavior/atomics.zig * test/behavior/vector.zig