aboutsummaryrefslogtreecommitdiff
path: root/lib/std/os
AgeCommit message (Collapse)Author
2022-10-13std.c: fix incorrect return typesAli Chraghi
Closes #12964
2022-10-12Merge pull request #12897 from r00ster91/uefiAndrew Kelley
std.os.uefi: fix some mistakes
2022-10-11io_uring: allow for nullable argumentsmllken
2022-10-11std: add linux support for packet sockaddrEric Milliken
2022-10-07fix: wrong amount of arguments passed to functionr00ster91
I don't know why that one argument was discarded. Is there a reason? It failed to compile.
2022-10-07fix: wrong return type for _pollr00ster91
See page 1055 of <https://uefi.org/sites/default/files/resources/UEFI_Spec_2_3_1.pdf>.
2022-10-07fix: wrap function pointers in std.meta.FnPtrr00ster91
2022-10-03std: WASI - update to latest snapshot preview 1Luuk de Gram
This implements the new addition to the API: `sock_accept`. Reference commit of WASI spec: 0ba0c5e2e37625ca5a6d3e4255a998dfaa3efc52 For full details: https://github.com/WebAssembly/WASI/commit/0ba0c5e2e37625ca5a6d3e4255a998dfaa3efc52 For entire spec at this commit: https://github.com/WebAssembly/WASI/blob/0ba0c5e2e37625ca5a6d3e4255a998dfaa3efc52/phases/snapshot/docs.md
2022-10-03std.os.windows: fix HANDLER_ROUTINE callconvzooster
2022-09-29std: Replace use of stage1 function pointersominitay
2022-09-20Merge pull request #12904 from Vexu/ptrcastAndrew Kelley
stage2: pointer casting fixes and improvements
2022-09-20std: fix os.linux.S function signatures to use mode_tMeghan
2022-09-20Sema: check pointer qualifiers before implicit castVeikka Tuominen
Closes #12881
2022-09-09std.os.uefi: mark BlockIoProtocol and EfiBlockMedia as publicYusuf Bham
2022-09-07x86_64: implement Windows x64 calling conventionJakub Konka
2022-08-22stage2+stage1: remove type parameter from bit builtinsVeikka Tuominen
Closes #12529 Closes #12511 Closes #6835
2022-08-19std.os.linux.bpf: fix compile errorAndrew Kelley
2022-08-19fix std.os.windows.PathSpace.spanAndrew Kelley
it was returning a pointer to a parameter.
2022-08-11Merge pull request #12410 from ifreund/sig-err-dfl-ign-fixAndrew Kelley
std: fix definition of SIG_IGN, SIG_DFL, etc.
2022-08-11std: add missing error to windows.WriteFileAndrew Kelley
I encountered this error today when testing the self-hosted compiler on Windows.
2022-08-11std: fix definition of SIG_IGN, SIG_DFL, etc.Isaac Freund
POSIX specifies that the sa_handler field of the sigaction struct may be set to SIG_IGN or SIG_DFL. However, the current constants in the standard library use the function pointer signature corresponding to the sa_sigaction field instead. This may not cause issues in practice because the fields usually occupy the same memory in a union, but this isn't required by POSIX and there may be systems we do not yet support that do this differently. Fixing this also makes the Zig interface less confusing to use after reading the man page.
2022-08-07remove 'builtin.stage2_arch', Sema is smart enough nowMeghan Denny
2022-08-05Update Linux syscall list for 5.19Stephen Gregoratto
New changes: memfd_secret implemented for RISC-V.
2022-07-31Linux: Add IN_MASK_CREATE and corresponding error handling in inotify_add_watchRyan Liptak
From https://man7.org/linux/man-pages/man7/inotify.7.html > **IN_MASK_CREATE** (since Linux 4.18) > > Watch pathname only if it does not already have a watch associated with it; the error EEXIST results if pathname is already being watched.
2022-07-23io_uring: add new flags and opcodesVincent Rischmann
2022-07-21LLVM: fix lowering of structs with underaligned fieldsAndrew Kelley
When lowering a struct type to an LLVM struct type, keep track of whether there are any underaligned fields. If so, then make it a packed llvm struct. This works because we already insert manual padding bytes regardless. We could unconditionally use an LLVM packed struct; the reason we bother checking for underaligned fields is that it is a conservative choice, in case LLVM handles packed structs less optimally. A future improvement could simplify this code by unconditionally using packed LLVM structs and then make sure measure perf is unaffected. closes #12190
2022-07-16Fix io_uring tests (#12134)Vincent Rischmann
* io_uring: fix the timeout_remove test The test does a IORING_OP_TIMEOUT followed with a IORING_OP_TIMEOUT_REMOVE and assumed we would get the CQEs in the same order. Linux v5.18 changed how this works and we now get them in the reverse order. The documentation doesn't explicitly say which CQE we should get first so just make the test work with both cases. * io_uring: fix the remove_buffers test The original test was buggy but accidentally worked with kernels < 5.18 The test assumed that IORING_OP_REMOVE_BUFFERS removed from the start of but in fact the documentation doesn't specify which buffer is removed, only that a certain number of buffers are removed. Starting with the kernel 5.18 the check for the `used_buffer_id` fails. Turns out that previous kernels removed buffers in such a way that the remaining buffer for this read would always be 0, however this isn't true anymore. Instead of checking a specific value just check that the `used_buffer_id` corresponds to a valid ID.
2022-07-05std.os.linux.io_uring: work around LLVM bugAndrew Kelley
See #12014
2022-07-05Mark fstype argument to mount as optionalJonathan Marler
The fstype argument to the mount system call can be null. To see an example run "strace -e trace=mount unshare -m": ``` mount("none", "/", NULL, MS_REC|MS_PRIVATE, NULL) = 0 ... ```
2022-07-03std: better definition for std.os.linux.epoll_eventAndrew Kelley
The previous definition depends on a non-lang-spec-compliant memory layout for packed structs, which happens to trigger #11989 in stage2. This commit changes the struct to be an extern struct with an align(4) field. However, stage1 cannot handle this, so conditional compilation logic is used to select different struct definitions depending on stage1 vs stage2. This works around #11989 but does not solve the underlying problem - putting an extern union inside a packed struct will still trigger the assert. After this, both stage1 and stage2 std lib tests run assertion-clean with a debug LLVM 13.
2022-06-28zig fmt: fix idempotency with newlines surrounding doc commentPhilipp Lühmann
Fixes: https://github.com/ziglang/zig/issues/11802
2022-06-27std.os.linux.clone: upgrade to stage2 fn ptr semanticsAndrew Kelley
2022-06-07add const to msghdr_const iov and control pointersJonathan Marler
alongside the typical msghdr struct, Zig has added a msghdr_const type that can be used with sendmsg which allows const data to be provided. I believe that data pointed to by the iov and control fields in msghdr are also left unmodified, in which case they can be marked const as well.
2022-06-06std: handle stage2 function pointer semantics in testVeikka Tuominen
2022-06-06std: fix ambiguous referencesVeikka Tuominen
2022-05-27math: make `cast` return optional instead of an errorAli Chraghi
2022-05-26fix semantic error with std.os.linux.all_maskJonathan Marler
all_mask is a value of type sigset_t, which is defined as an array type [N]u32. However, all_mask references sigset_t.len, but, the array type does not have a len field. Fix is to use @typeInfo(sigset_t).Array.len instead.
2022-05-25io_uring: replace the readv method with a read on a new ReadBuffer typeVincent Rischmann
readv() is essentially identical to read() except for the buffer type, this simplifies the API for the caller at the cost of not clearly mapping to the liburing C API.
2022-05-25io_uring: add tests for automatic buffer selectionVincent Rischmann
2022-05-25io_uring: use the socket test harnessVincent Rischmann
2022-05-25io_uring: add a test harness for server/client TCP socket testsVincent Rischmann
2022-05-25io_uring: change recv() to use a RecvBuffer insteadVincent Rischmann
RecvBuffer is equivalent to ReadBuffer but tailored for recv only.
2022-05-25io_uring: change read() to use a ReadBuffer insteadVincent Rischmann
Reads can be done in two ways with io_uring: * using a simple buffer * using a automatic buffer selection which requires the user to have provided a number of buffers before ReadBuffer let's the caller choose where the data should be read.
2022-05-25io_uring: add provide_buffers and remove_buffersVincent Rischmann
These functions are needed to implement automatic buffer selection. This maps to the IORING_OP_PROVIDE_BUFFERS and IORING_OP_PROVIDE_BUFFERS ops.
2022-05-16Generate linux syscalls via. the linux source treeStephen Gregoratto
Previously, updating the `SYS` enum for each architecture required manually looking at the syscall tables and inserting any new additions. This commit adds a tool, `generate_linux_syscalls.zig`, that automates this process using the syscall tables in the Linux source tree. On architectures without a table, it runs `zig cc` as a pre-processor to extract the system-call numbers from the Linux headers.
2022-05-17std.os: add timerfd_create, timerfd_settime and timerfd_gettimeThiago Teodoro Pereira Silva
2022-05-16std.os: Add memfd_create for FreeBSDIsaac Freund
This is minorly breaking as e.g. std.os.linux.MFD_CLOEXEC is now std.os.linux.MFD.CLOEXEC.
2022-05-13target: Rename sparcv9 -> sparc64Koakuma
Rename all references of sparcv9 to sparc64, to make Zig align more with other projects. Also, added new function to convert glibc arch name to Zig arch name, since it refers to the architecture as sparcv9. This is based on the suggestion by @kubkon in PR 11847. (https://github.com/ziglang/zig/pull/11487#pullrequestreview-963761757)
2022-05-13std.os.linux: fix signature of setgroupsJonathan Marler
the list parameter should be a multi-item pointer rather than a single-item pointer. see: https://linux.die.net/man/2/setgroups > setgroups() sets the supplementary group IDs for the calling process... > the size argument specifies the number of supplementary group IDs in the buffer pointed to by list.
2022-05-11remove RtlUpcaseUnicodeString, no longer neededJonathan Marler