578 Commits

Author SHA1 Message Date
Jonathan Marler
b587a42233 add std.os.shutdown function for sockets 2020-11-30 11:25:03 -08:00
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
Isaac Freund
58365c4e79 std/os: fix prctl constants 2020-11-25 15:45:55 -08:00
LemonBoy
3e22077d46 Fix the ELF base calculation
Find the effective ELF load address in dl_iterate_phdr by computing the
difference between the in-memory phdr and its p_vaddr specified in the
ELF file.

This makes the dl_iterate_phdr test pass and restores the stack traces.
2020-11-23 15:06:07 +01: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
Žiga Željko
2fbe9519ac std: add support for ppoll 2020-11-21 14:06:04 -08:00
Andrew Kelley
bf0cc32aa6
Merge pull request #7165 from LemonBoy/ppc64final
Make the PPC64 port usable
2020-11-20 17:40:17 -08:00
Isaac Freund
8cf319d206 std/os: define and use dev_t for linux x86_64 2020-11-20 17:35:52 -08:00
Isaac Freund
f473b3e87c std/os: add time_t definiton for x86_64 linux 2020-11-20 17:23:43 -08:00
LemonBoy
e374ae3598 std: Use newfstatat on PPC64
One more variation in the syscall table, hooray!
2020-11-20 08:38:10 +01:00
Veikka Tuominen
cf819b95fe
Merge pull request #6829 from tadeokondrak/error-unsupported-callconv
stage1: Compile error instead of falling back to C for unsupported cc
2020-11-19 19:03:08 +02:00
Tadeo Kondrak
25ec2dbc1e Add builtin.Signedness, use it instead of is_signed 2020-11-19 18:59:21 +02:00
Tadeo Kondrak
c002a5026a
Update code to not use unsupported calling conventions for target 2020-11-19 14:01:07 +02:00
Jakub Konka
663e112773 std: add chdir smoke test 2020-11-18 15:37:44 +01:00
Lee Cannon
64feae3ac3 Move utf8->utf16 up one level into os.zig 2020-11-18 15:37:44 +01:00
Lee Cannon
32c998e03c Switch to RtlSetCurrentDirectory_U 2020-11-18 15:37:44 +01:00
Lee Cannon
80b1e82b1b Implement chdir and chdirZ for Windows 2020-11-18 15:37:44 +01:00
LemonBoy
36c869dc14 std: Make windows.ReadFile allow short reads
Make it behave like the read() wrapper for unix systems.
Reading the whole buffer breaks some use-cases like buffered readers
over sockets.

Closes #7121
2020-11-16 13:35:06 -08:00
Sébastien Marie
8784c7b581 openbsd: proper implementation for Thread.cpuCount() 2020-11-10 05:25:59 +00:00
Sébastien Marie
20b19d0092 openbsd: add time definitions for gettimeofday() 2020-11-10 05:24:56 +00:00
Sébastien Marie
e4bc595bc6 openbsd: add sockets constants 2020-11-10 05:24:03 +00:00
Sébastien Marie
17276df488 openbsd: add dlfcn.h definitions for dlopen() 2020-11-10 05:23:13 +00: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
cf7505da1f
Merge pull request #6974 from daurnimator/prctl-cleanup
prctl improvements
2020-11-05 17:25:24 -05:00
Andrew Kelley
f85d719952
Merge pull request #6895 from jorangreef/fallocate
linux: add fallocate()
2020-11-05 17:23:00 -05:00
LemonBoy
cca6b11138 Label WASI stat as kernel_stat
We're using WASI syscalls, it makes sense to put the kernel_ prefix.
2020-11-05 12:44:43 +01: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
rageoholic
e5100605e9 Add missing LONG_PTR type 2020-11-04 18:30:48 -06:00
rageoholic
04267fb1ba Fix CoInitializeEx so it can take a null pointer 2020-11-04 16:53:05 -06:00
LemonBoy
346a686b9d std: Correct stack_t definition for mips 2020-11-04 15:55:06 +01:00
LemonBoy
f313c88428 std: Fix pipe syscall stub for sparc64 2020-11-04 15:54:38 +01:00
daurnimator
b42ffbe9e8
std: use PR enum as only location of opcode numbers 2020-11-04 22:39:35 +11:00
daurnimator
b90fb1e96b
std: add PR enum for the prctl opcode 2020-11-04 22:32:57 +11:00
Jakub Konka
5060497174
Merge pull request #6921 from xackus/gimmeMoreOfThoseSweetSweetFileDescriptors
stage2: ask for more file descriptors
2020-11-03 10:07:39 +01:00
Joran Dirk Greef
8193f55820 Support 32-bit big-endian targets 2020-11-03 06:03:38 +02:00
Jakub Konka
8dda64fa3e
Fix Darwin codepath
On Darwin, according to the man pages for setrlimit(), when adjusting
max number of open fds, the reported hard max by getrlimit() is only
theoretical, while the actual maximum, set in the kernel, is hardcoded
in the header file. Therefore, the reported max has to be adjusted
as `min(OPEN_MAX, lim.max)`.

Signed-off-by: Jakub Konka <kubkon@jakubkonka.com>
2020-11-03 00:38:43 +01:00
LemonBoy
dc872a221d std: Fix syscall stubs passing 64bit offsets for BE targets 2020-11-02 12:11:07 +01: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
xackus
6418284680 std: add {set,get}rlimit bits and improve test 2020-11-01 15:47:46 -05:00
Joran Dirk Greef
c910f03a7b Swap endianness 2020-11-01 13:14:32 +02:00
Joran Dirk Greef
a67f140d2f Add test 2020-11-01 11:55:27 +02:00
Joran Dirk Greef
2dd8613adc "The Traveling Wilburys' - Handle With Care"
Both `offset` and `len` are `off_t`.

Like the rest of the std lib we assume that `_FILE_OFFSET_BITS == 64`
is always true, so that `off_t` is a `u64`.

When passing to 32-bit kernels, we split these into two `u32`
parameters.
2020-11-01 11:49:08 +02:00
Joran Dirk Greef
2fdb30a571 Add definitions for FALLOC_FL_ mode flags 2020-11-01 11:47:09 +02:00