Jonathan Marler
48660371a2
std.meta: add assumeSentinel
2020-11-29 10:36:02 -08:00
Koakuma
f10bff9ffb
Add a comment to explain the fork return values on sparc64
2020-11-28 13:24:24 +07:00
Koakuma
41c40f4bbe
Fix fork() on Linux/sparc64
...
fork() on Linux/sparc64 seems to return its result in two registers,
with %o0 always holding the current process' PID, and the parent/child
status returned in %o1. Add some glue code to convert those into
the libc-style return value.
2020-11-27 23:02:22 +07:00
LemonBoy
0a84f85945
Minor code cleanup in start_pie.zig
...
Thanks @daurnimator for catching this.
2020-11-23 12:36:40 +01:00
Andrew Kelley
abc717f203
modernize the PIE patch for the latest master branch
...
This is the part of #3960 that has to be rewritten to apply to latest
master branch code.
2020-11-22 17:28:11 -07:00
Andrew Kelley
55ab50efbd
Merge branch 'piepiepie' of https://github.com/LemonBoy/zig into pie
...
Conflicts:
lib/std/dynamic_library.zig (fixed in this commit)
src/all_types.hpp
src/codegen.cpp
src/link.cpp
src/main.cpp
Will manually apply the diffs to these deleted files to the new zig
code in a followup commit.
2020-11-22 12:39:44 -07:00
Andrew Kelley
c9551652b0
Merge pull request #6978 from LemonBoy/statshit
...
Decouple kernel and libc stat definitions
2020-11-05 17:27:22 -05:00
Andrew Kelley
f85d719952
Merge pull request #6895 from jorangreef/fallocate
...
linux: add fallocate()
2020-11-05 17:23:00 -05:00
LemonBoy
0e95fa455c
std: Split kernel&libc definitions of stat struct
...
There's no guarantee for the kernel definition to be ABI compatible with
the libc one (and vice versa).
There's also no guarantee of ABI compatibility between musl/glibc.
Fun, isn't it?
2020-11-05 09:38:50 +01:00
LemonBoy
f313c88428
std: Fix pipe syscall stub for sparc64
2020-11-04 15:54:38 +01:00
Joran Dirk Greef
8193f55820
Support 32-bit big-endian targets
2020-11-03 06:03:38 +02:00
Joran Dirk Greef
78e9e131e0
Pending #5127
2020-11-02 12:37:55 +02:00
Joran Dirk Greef
067bd7e424
Switch back to writing Zig
2020-11-02 09:55:25 +02:00
Joran Dirk Greef
9dec310826
Debug unhandled errno
2020-11-02 09:52:42 +02:00
Andrew Kelley
909aae8153
Merge pull request #6792 from koachan/sparc64-linux
...
Initial sparc64-linux bringup
2020-11-01 22:14:56 -05:00
Joran Dirk Greef
a67f140d2f
Add test
2020-11-01 11:55:27 +02:00
Andrew Kelley
a41c0b63bb
Merge pull request #6356 from jorangreef/io_uring
...
std: add io_uring library
2020-10-29 18:20:38 -04:00
Frank Denis
74a1175d9d
std/*: add missing MIT license headers
2020-10-26 17:41:29 +01:00
Koakuma
f018201009
Predict error-less path on syscalls
2020-10-25 20:07:18 +07:00
Koakuma
2e7a4758b3
Add back ppc input/output/clobber definitions
...
Accidentally removed when rebasing, this adds it back.
2020-10-25 13:39:22 +07:00
Koakuma
300cfbf252
Add TLS implementation for sparc64
2020-10-24 20:03:40 +07:00
Koakuma
6146f81c6e
Add pipe(2) support
2020-10-24 20:03:37 +07:00
Koakuma
dba009fd21
Account for the delay slot
2020-10-24 20:01:32 +07:00
Koakuma
23433fb317
Fix register naming
2020-10-24 19:59:05 +07:00
Koakuma
e5a11020cc
Add sparc64 syscall interface
2020-10-24 19:59:04 +07:00
LemonBoy
0c355bef9e
std: Slim down the error code path in initStaticTLS
...
Calling @panic made the executable ~30x times bigger, use a simple
`abort()` and let the user figure out what went wrong.
Supporting ARMv6 (and earlier?) platforms is not a priority.
Closes #6676
2020-10-21 23:35:06 -04:00
Tadeo Kondrak
2b4b03d301
Update zig files for opaque type syntax
2020-10-06 22:08:25 -06:00
Joran Dirk Greef
e9ba12f456
Test the range of user_data bits
2020-10-05 09:36:07 +02:00
Joran Dirk Greef
9be2941091
Split openat/close test into two separate tests
...
If an older kernel fails the `openat` test because of `AT_FDCWD`
then we don't want to skip the `close` test.
2020-10-04 17:48:05 +02:00
Joran Dirk Greef
958ff087f2
Use const wherever possible
2020-10-04 16:57:04 +02:00
Joran Dirk Greef
72bdfa5bdd
Skip openat test only for older kernels that do not fully support AT_FDCWD
2020-10-04 16:05:52 +02:00
Joran Dirk Greef
9091fcbe9d
Improve openat/accept test debugging
2020-10-04 15:11:09 +02:00
Joran Dirk Greef
6a53f4be4b
Add openat(), close(), connect(), send(), recv(), as well as tests
...
Removes non-essential .hardlink_with_next_sqe() and .drain_previous_sqes().
2020-10-04 13:15:39 +02:00
Joran Dirk Greef
3d2de6cfba
Use load relaxed semantics when reading the SQPOLL wakeup flag
2020-10-04 13:14:57 +02:00
Joran Dirk Greef
69a55fc560
Allow for advanced non-sequential SQE allocation schemes
...
Decouples SQE queueing and SQE prepping methods to allow for non-sequential
SQE allocation schemes as suggested by @daurnimator.
Adds essential SQE prepping methods from liburing to reduce boilerplate.
Removes non-essential .link_with_next_sqe() and .use_registered_fd().
2020-10-04 13:01:41 +02:00
Joran Dirk Greef
e32c7d06e5
Limit entries to u12, add errors for invalid entries, use mem.zeroInit
2020-10-04 12:49:48 +02:00
Joran Dirk Greef
61ec6cb6d3
Expose available kernel features
2020-10-04 12:48:08 +02:00
Joran Dirk Greef
a9b107045f
Use load acquire semantics when reading the SQPOLL wakeup flag
...
Ensures that the wakeup flag is read after the tail pointer has been
written. It's important to use memory load acquire semantics for the
flags read, otherwise the application and the kernel might not agree on
the consistency of the wakeup flag, leading to I/O starvation.
Refs: 6768ddcc56
Refs: https://github.com/axboe/liburing/issues/219
2020-10-03 14:34:42 +02:00
Joran Dirk Greef
95def89c23
Handle EBADFD (ring fd in bad state) in enter()
2020-10-03 14:34:01 +02:00
Joran Dirk Greef
2d8df2b745
Use @intCast instead of @truncate
2020-09-21 12:03:52 +02:00
Joran Dirk Greef
7719abbf54
Add flags to queue_fsync() signature as per liburing
2020-09-21 11:09:37 +02:00
Joran Dirk Greef
57603fd26d
Use @intCast instead of @truncate on io_uring_enter() result
2020-09-21 11:09:09 +02:00
Joran Dirk Greef
575ed941d7
Cache mask instead of dereferencing mask pointer
2020-09-21 11:07:11 +02:00
Joran Dirk Greef
77903f8d4e
Test structs and offsets
2020-09-20 18:45:44 +02:00
Joran Dirk Greef
e51728a1b4
Make enter(), flush_sq(), sq_ring_needs_enter(), cq_ring_needs_flush() public
...
These will also be needed by any custom helpers
2020-09-20 15:54:31 +02:00
Joran Dirk Greef
40293a0643
Add safety checks
2020-09-20 15:41:22 +02:00
Joran Dirk Greef
f22eea82c4
Fix opcode support detection for read/write test
2020-09-20 15:33:48 +02:00
Joran Dirk Greef
b672dc7abf
Use os.fd_t instead of i32 and assert against c_int for syscall safety
2020-09-20 14:59:40 +02:00
Joran Dirk Greef
abebacda32
Handle all possible syscall errors and bring errors in line with os.zig
2020-09-20 14:21:44 +02:00
Joran Dirk Greef
4bc1b7a7ac
Fix io_uring_sqe to use the names of the first member of each union
...
Now we're really future-proof... no more `opflags` creeping in.
When anonymous unions land, we can start using `accept_flags` etc.
Until then, code using this struct won't break when the kernel adds features.
Refs: https://github.com/ziglang/zig/issues/6349
Refs: https://github.com/ziglang/zig/issues/985
2020-09-19 18:50:24 +02:00