aboutsummaryrefslogtreecommitdiff
path: root/lib/std/os
AgeCommit message (Collapse)Author
2021-11-16os/linux: fix rlimit_resource for mips/sparcv9Vincent Rischmann
On MIPS and SPARC the RLIMIT kinds have different numbers than the other architectures.
2021-11-15Add `chmod` and `chown`Ominitay
2021-11-14Merge pull request #10081 from hnakamur/lib_std_os_linux_io_uring_cancelAndrew Kelley
std.os.linux: Add cancel and io_uring_prep_cancel
2021-11-14io_uring: add poll_updateKenta Iwasaki
Add method from liburing to queue (but not submit) a SQE to update the user data of an existing poll operation.
2021-11-12Use io_uring_prep_rw in io_uring_prep_cancelHiroaki Nakamura
follow liburing's API as closely as possible. Signed-off-by: Hiroaki Nakamura <hnakamur@gmail.com>
2021-11-12std.os.linux: Add cancel and io_uring_prep_cancelHiroaki Nakamura
Signed-off-by: Hiroaki Nakamura <hnakamur@gmail.com>
2021-11-11Merge pull request #9935 from g-w1/plan9-stdJakub Konka
add plan9 support to std
2021-11-10Merge pull request #9853 from koachan/sparc64-unittestsAndrew Kelley
SPARCv9: make more tests pass
2021-11-09std.Thread.Mutex: change API to lock() and unlock()Andrew Kelley
This is a breaking change. Before, usage looked like this: ```zig const held = mutex.acquire(); defer held.release(); ``` Now it looks like this: ```zig mutex.lock(); defer mutex.unlock(); ``` The `Held` type was an idea to make mutexes slightly safer by making it more difficult to forget to release an aquired lock. However, this ultimately caused more problems than it solved, when any data structures needed to store a held mutex. Simplify everything by reducing the API down to the primitives: lock() and unlock(). Closes #8051 Closes #8246 Closes #10105
2021-11-09io_uring: skip statx test failure on older kernelsAndrew Kelley
2021-11-09os/linux/io_uring: implement statxVincent Rischmann
2021-11-09plan9: more syscallsJacob G-W
2021-11-09fix outputs in inline assemblyJacob G-W
2021-11-09add initial plan9 support to stdJacob G-W
2021-11-01std: expose rusage constants under rusage namespaceAndrew Kelley
2021-11-01std: add Linux perf syscall bitsAndrew Kelley
Example usage: ```zig const std = @import("std"); const PERF = std.os.linux.PERF; const assert = std.debug.assert; test "perf" { var attr: std.os.linux.perf_event_attr = .{ .type = PERF.TYPE.HARDWARE, .config = @enumToInt(PERF.COUNT.HW.INSTRUCTIONS), .flags = .{ .disabled = true, .exclude_kernel = true, .exclude_hv = true, }, }; const fd = try std.os.perf_event_open(&attr, 0, -1, -1, PERF.FLAG.FD_CLOEXEC); defer std.os.close(fd); _ = std.os.linux.ioctl(fd, PERF.EVENT_IOC.RESET, 0); _ = std.os.linux.ioctl(fd, PERF.EVENT_IOC.ENABLE, 0); long(); _ = std.os.linux.ioctl(fd, PERF.EVENT_IOC.DISABLE, 0); var result: usize = 0; assert((try std.os.read(fd, std.mem.asBytes(&result))) == @sizeOf(usize)); std.debug.print("instruction count: {d}\n", .{result}); } fn long() void { var i: usize = 0; while (i < 100000) : (i += 1) {} } ```
2021-10-25fix(uefi MemoryDescriptor): padding after memory typeStephen von Takach
not 100% certain, just noticed that this is implemented slightly differently in rust https://docs.rs/uefi/0.11.0/src/uefi/table/boot.rs.html#715
2021-10-23std: Fix edge case in TLS tp calculationLemonBoy
The TLS area may be located in the upper part of the address space and, if the platform expects a constant offset to be applied, may make the tp register calculation overflow. Use +% instead of +, the overflow is harmless.
2021-10-17Linux: Update syscall numbers for 5.14Stephen Gregoratto
2021-10-15std.os.windows: Fix typo (#9951)Sizhe Zhao
2021-10-10SPARCv9: fix timeval definitionKoakuma
2021-10-10Linux: fix socket constants for SPARCv9Koakuma
2021-10-04migrate from `std.Target.current` to `@import("builtin").target`Andrew Kelley
closes #9388 closes #9321
2021-10-04FileProtocol: add Reader, Writer, SeekableStreamSreehari Sreedev
2021-09-24Initial bringup of the Solaris/Illumos portStephen Gregoratto
2021-09-23Linux/sparc64 bits: Add missing C type definitionsKoakuma
2021-09-22io_uring: implement read_fixed/write_fixedVincent Rischmann
2021-09-20adding support for UTF-8 outputHugoFlorentino
2021-09-18Add Linux ioctl creation utilities (#9748)Jens Goldberg
* Add Linux ioctl creation utilities * Apply suggestions from code review Co-authored-by: Veikka Tuominen <git@vexu.eu> * Update lib/std/os/linux.zig Co-authored-by: zigazeljko <ziga.zeljko@gmail.com> Co-authored-by: Veikka Tuominen <git@vexu.eu> Co-authored-by: zigazeljko <ziga.zeljko@gmail.com>
2021-09-16Set the Storage socket sizes to be system definedStephen Gregoratto
Some systems (Solaris, OpenBSD, AIX) change their definitions of sockaddr_storage to be larger than 128 bytes. This comment adds a new constant in the `sockaddr` that defines the size for every system. Fixes #9759
2021-09-14Remove WIN16 version of WSAOVERLAPPED. Use LPWSAOVERLAPPED_COMPLETION_ROUTINETravis Martin
2021-09-12os: usingnamespace fixes for std.x.os.Socket and std.os.TCPKenta Iwasaki
Extract existing constants to do with TCP socket options into a 'TCP' namespace. Export 'MSG' and 'TCP' from std.os.{linux, windows} into std.c. Fix compile errors to do with std.x.os.Socket methods related to setting TCP socket options. Handle errors in the case that an interface could not be resolved in an IPv6 address on Windows. Tested using Wine with the loopback interface disabled. Have all instantiations of std.x.os.Socket on Windows instantiate an overlapped socket descriptor. Fixes the '1ms read timeout' test in std.x.net.tcp.Client. The test would previously deadlock, as read timeouts only apply to overlapped sockets. Windows documentation by default recommends that most instantiations of sockets on Windows be overlapped sockets (s.t. they may operate in both blocking or nonblocking mode when operated with WSA* syscalls). Refer to the documentation for WSASocketA for more info.
2021-09-01fix regression on linux with kernel_timespecAndrew Kelley
I incorrectly assumed that __kernel_timespec was used when not linking libc, however that is not the case. `std.os.timespec` is used both for libc and non-libc cases. `__kernel_timespec` is a special struct that is used only for io_uring.
2021-09-01std.os reorg: regression fixes to stack_t, and std.ThreadAndrew Kelley
2021-09-01re-apply a commit dropped in this branch due to conflictsAndrew Kelley
This commit reapplies 4f0aa7d639e099b18df583cb984412037fbb1dbe.
2021-09-01std.os fixes to get the test suite passing againAndrew Kelley
2021-09-01std: fix regressions from this branchAndrew Kelley
Also move some usingnamespace test cases from compare_output to behavior.
2021-09-01std, compiler-rt: remove test names where applicableAndrew Kelley
Tests with no names are executed when using `zig test` regardless of the `--test-filter` used. Non-named tests should be used when simply importing unit tests from another file. This allows `zig test` to find all the appropriate tests, even when using `--test-filter`.
2021-09-01std: reorganization that allows new usingnamespace semanticsAndrew Kelley
The proposal #9629 is now accepted, usingnamespace stays but no longer puts identifiers in scope.
2021-09-01std.os.windows: reorg to avoid `usingnamespace`Andrew Kelley
Down to 19 uses of `usingnamespace`.
2021-09-01std.os: more reorganization effortsAndrew Kelley
* std lib tests are passing on x86_64-linux with and without -lc * stage2 is building from source on x86_64-linux * down to 38 remaining uses of `usingnamespace`
2021-09-01std.os.linux: remove the "bits" namespace altogetherAndrew Kelley
Now there is only 1 architecture-specific file for Linux kernel bits.
2021-09-01std: reorganize std.c to eliminate `usingnamespace`Andrew Kelley
Behavior tests pass on x86_64-linux with -lc
2021-09-01std.os reorganization, avoiding `usingnamespace`Andrew Kelley
The main purpose of this branch is to explore avoiding the `usingnamespace` feature of the zig language, specifically with regards to `std.os` and related functionality. If this experiment is successful, it will provide a data point on whether or not it would be practical to entirely remove `usingnamespace` from the language. In this commit, `usingnamespace` has been completely eliminated from the Linux x86_64 compilation path, aside from io_uring. The behavior tests pass, however that's as far as this branch goes. It is very breaking, and a lot more work is needed before it could be considered mergeable. I wanted to put a pull requset up early so that zig programmers have time to provide feedback. This is progress towards closing #6600 since it clarifies where the actual "owner" of each declaration is, and reduces the number of different ways to import the same declarations. One of the main organizational strategies used here is to do namespacing with real namespaces (e.g. structs) rather than by having declarations share a common prefix (the C strategy). It's no coincidence that `usingnamespace` has similar semantics to `#include` and becomes much less necessary when using proper namespaces.
2021-08-31std: Use truncating cast in WIFSTOPPED for Linux, FreeBSD and DragonFlyPhilip Ã…kesson
The intermediate value can be larger than an u16, so @truncate is needed to match the behavior of musl.
2021-08-29zig fmt: respect trailing commas in inline assemblyjdmichaud
2021-08-24remove redundant license headers from zig standard libraryAndrew Kelley
We already have a LICENSE file that covers the Zig Standard Library. We no longer need to remind everyone that the license is MIT in every single file. Previously this was introduced to clarify the situation for a fork of Zig that made Zig's LICENSE file harder to find, and replaced it with their own license that required annual payments to their company. However that fork now appears to be dead. So there is no need to reinforce the copyright notice in every single file.
2021-08-24Linux/SPARCv9: use C calling convention for restore_rtKoakuma
This is needed to prevent infinite loop when calling rt_sigreturn.
2021-08-24std: [breaking] move errno to become an nonexhaustive enumAndrew Kelley
The primary purpose of this change is to eliminate one usage of `usingnamespace` in the standard library - specifically the usage for errno values in `std.os.linux`. This is accomplished by truncating the `E` prefix from error values, and making errno a proper enum. A similar strategy can be used to eliminate some other `usingnamespace` sites in the std lib.
2021-08-22std.os: (p)writev should perform partial writes if iov.len > IOV_MAXdaurnimator
Co-authored-by: Veikka Tuominen <git@vexu.eu>