53 Commits

Author SHA1 Message Date
Isaac Freund
58365c4e79 std/os: fix prctl constants 2020-11-25 15:45:55 -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
Andrew Kelley
c9551652b0
Merge pull request #6978 from LemonBoy/statshit
Decouple kernel and libc stat definitions
2020-11-05 17:27:22 -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
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
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
ab1ed93ad9 Add close_range, faccessat2 and process_madvise 2020-10-30 12:39:01 +02:00
Joran Dirk Greef
9423ed1671 Add more mips syscall numbers
As per: lib/libc/musl/arch/mips/bits/syscall.h.in

...and as promised: https://github.com/ziglang/zig/pull/6356#issuecomment-696023349

Thanks @daurnimator again for the help with #6356.
2020-10-30 11:53:45 +02:00
Koakuma
891c6ddd5f Select stat struct type based on whether we are linking with libc 2020-10-30 11:46:33 +07: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
Koakuma
5125eb77bd Use the *_stat type as self 2020-10-29 21:37:45 +07:00
Frank Denis
74a1175d9d std/*: add missing MIT license headers 2020-10-26 17:41:29 +01:00
Koakuma
cbc8750502 Separate libc stat and kernel stat definitions 2020-10-25 23:52:08 +07:00
Koakuma
1a362ea5b0 Fix sparc64 bits definitions 2020-10-25 21:38:39 +07:00
Koakuma
268516d5d9 Fix constants 2020-10-24 20:04:18 +07:00
Koakuma
c29da84c0e Add sp loading 2020-10-24 20:01:29 +07:00
Koakuma
23433fb317 Fix register naming 2020-10-24 19:59:05 +07:00
Koakuma
de06b0a635 Add sparc64 linux bits 2020-10-24 19:59:04 +07:00
Joran Dirk Greef
843c104fc9 Add io_uring syscalls to os.bits.linux.mips.SYS
As per lib/libc/musl/arch/mips/bits/syscall.h.in:

```c
```
2020-09-21 10:39:58 +02:00
Isaac Freund
b6f4601545
std: add securebits definitions for linux 2020-09-11 22:32:23 +02:00
Isaac Freund
7b961a876b
std: add prctl definition for linux 2020-09-11 22:32:22 +02:00
Andrew Kelley
800c5de2ae update the stack trace test case for lines added to start.zig 2020-09-10 14:40:33 -07:00
Andrew Kelley
2315331d23
Merge pull request #5527 from shawnanastasio/ppc64le
Implement support for powerpc64{,le}
2020-09-10 15:56:27 -04:00
Isaac Freund
e8a2aecd2f
std: fix linux uid_t, use uid_t/gid_t in std.os
- correct uid_t from i32 to u32 on linux
- define uid_t and gid_t for OSes missing definitions
- use uid_t/gid_t instead of plain u32s throughout std.os
2020-09-03 15:08:37 +02:00
Matthew Knight
0fa3cfdb4a
Bpf: move under os/linux instead of bits (#6126)
* moved bpf syscall, added some bpf instructions and tests

* had to move bpf out of bits so that a freestanding target could import it

* removed line

* fixed imports
2020-08-22 15:08:01 -04:00
Matt Knight
bc1536f4bf decided to split up loading of 64-bit immediates 2020-08-21 11:40:35 -07:00
Matt Knight
7f1378909b moved bpf syscall, added some bpf instructions and tests 2020-08-21 11:40:35 -07:00
Andrew Kelley
4a69b11e74 add license header to all std lib files
add SPDX license identifier
copyright ownership is zig contributors
2020-08-20 16:07:04 -04:00
Matthew Knight
d605af511a
added bpf() syscall and some supporting structs (#6061)
* added bpf syscall and some supporting structs

* moved bpf to bits and added flags
2020-08-17 22:17:04 -04:00
Shawn Anastasio
ec0d775524 Implement std.os for powerpc64{,le} 2020-07-01 16:10:49 -05:00
Timon Kruiper
c829f2f7b7 Add mips support to standard library 2020-04-24 15:28:55 -04:00
Vexu
b6fe839248
update std lib to decls being disallowed between fields 2020-04-18 23:56:05 +03:00
LeRoyce Pearson
ea6525797d Use flock instead of fcntl to lock files
`flock` locks based on the file handle, instead of the process id.
This brings the file locking on unix based systems closer to file
locking on Windows.
2020-04-02 22:57:02 -06:00
LeRoyce Pearson
35c462caf0 Merge branch 'master' into feature-file-locks 2020-04-02 21:46:48 -06:00
daurnimator
63409cf422 std: linux syscall numbers are now an extensible enum 2020-03-31 10:16:20 -04:00
daurnimator
9bc8a1e1d0 std: add some missing errnos on linux 2020-03-30 10:55:18 -04:00
daurnimator
356ef3840f std: update for linux 5.6 release 2020-03-30 10:55:18 -04:00
LeRoyce Pearson
f66a607607 Define Flock for all posix systems 2020-03-14 10:12:46 -06:00
LeRoyce Pearson
e1868029e9 Implement blocking file locking API for windows 2020-03-14 10:12:46 -06:00
LeRoyce Pearson
9af0590a28 Add fnctlFlock system call, use it to lock files 2020-03-14 10:12:46 -06:00
daurnimator
648f94c027 std: add some definitions for netlink sockets 2020-03-09 13:02:38 -04:00
LeRoyce Pearson
cb84875eed Define ino_t for systems not yet defining it
Also, use ino_t instead of u64 in fs.File.INode
2020-03-08 18:31:18 -06:00
Andrew Kelley
c81345c8ae
breaking: std.os read/write functions + sendfile
* rework os.sendfile and add macosx support, and a fallback
   implementation for any OS.
 * fix sendto compile error
 * std.os write functions support partial writes. closes #3443.
 * std.os pread / pwrite functions can now return `error.Unseekable`.
 * std.fs.File read/write functions now have readAll/writeAll variants
   which loop to complete operations even when partial reads/writes
   happen.
 * Audit std.os read/write functions with respect to Linux returning
   EINVAL for lengths greater than 0x7fff0000.
 * std.os read/write shim functions do not unnecessarily loop. Since
   partial reads/writes are part of the API, the caller will be forced
   to loop anyway, and so that would just be code bloat.
 * Improve doc comments
 * Add a non-trivial test for std.os.sendfile
 * Fix std.os.pread on 32 bit Linux
 * Add missing SYS_sendfile bit on aarch64
2020-03-03 02:25:26 -05:00
Andrew Kelley
0b5bcd2f56
more std lib async I/O integration
* `zig test` gainst `--test-evented-io` parameter and gains the ability
   to seamlessly run async tests.
 * `std.ChildProcess` opens its child process pipe with O_NONBLOCK when
   using evented I/O
 * `std.io.getStdErr()` gives a File that is blocking even in evented
   I/O mode.
 * Delete `std.event.fs`. The functionality is now merged into `std.fs`
   and async file system access (using a dedicated thread) is
   automatically handled.
 * `std.fs.File` can be configured to specify whether its handle is
   expected to block, and whether that is OK to block even when in
   async I/O mode. This makes async I/O work correctly for e.g. the
   file system as well as network.
 * `std.fs.File` has some deprecated functions removed.
 * Missing readv,writev,pread,pwrite,preadv,pwritev functions are added
   to `std.os` and `std.fs.File`. They are all integrated with async
   I/O.
 * `std.fs.Watch` is still bit rotted and needs to be audited in light
   of the new async/await syntax.
 * `std.io.OutStream` integrates with async I/O
 * linked list nodes in the std lib have default `null` values for
   `prev` and `next`.
 * Windows async I/O integration is enabled for reading/writing file
   handles.
 * Added `std.os.mode_t`. Integer sizes need to be audited.
 * Fixed #4403 which was causing compiler to crash.

This is working towards:

./zig test ../test/stage1/behavior.zig --test-evented-io

Which does not successfully build yet. I'd like to enable behavioral
tests and std lib tests with --test-evented-io in the test matrix in the
future, to prevent regressions.
2020-02-06 18:05:50 -05:00
LemonBoy
e1e06e6766 linux-i386 support 2019-11-30 16:13:33 +01:00
Andrew Kelley
2aec35525d
mipsel: fix padding on stat struct 2019-10-17 13:20:30 -04:00
LemonBoy
ead9630c13 Fix signedness for some fields in ARM stat definition 2019-10-12 20:52:10 +02:00
LemonBoy
17f2af10b5 Correct signal bits for MIPS
Also enable the segfault handler for all the supported architectures
beside MIPS.
2019-10-01 13:58:58 -04:00