89 Commits

Author SHA1 Message Date
LemonBoy
e374ae3598 std: Use newfstatat on PPC64
One more variation in the syscall table, hooray!
2020-11-20 08:38:10 +01:00
Tadeo Kondrak
25ec2dbc1e Add builtin.Signedness, use it instead of is_signed 2020-11-19 18:59:21 +02: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
Joran Dirk Greef
8193f55820 Support 32-bit big-endian targets 2020-11-03 06:03:38 +02:00
LemonBoy
dc872a221d std: Fix syscall stubs passing 64bit offsets for BE targets 2020-11-02 12:11:07 +01: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
c910f03a7b Swap endianness 2020-11-01 13:14:32 +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
8fd88fdb31 linux: add fallocate() 2020-10-31 13:39:33 +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
johnLate
23c28c72b7 std.os.linux.accept/accept4: allow null for addr and len
std.os.accept already wants to allow null, which matches `man 3p accept`:

>  address     Either a null pointer, or a pointer to a sockaddr structure
>              where the address of the connecting  socket  shall  be  re‐
>              turned.
>
>  address_len Either  a  null pointer, if address is a null pointer, or a
>              pointer to a socklen_t object which on input specifies  the
>              length  of  the  supplied sockaddr structure, and on output
>              specifies the length of the stored address.

Fixes ziglang#6832.
2020-10-27 21:52:47 +01:00
LemonBoy
8044ed4c66 std: Add basic smoke test for net functionality 2020-10-27 21:52:47 +01:00
Koakuma
3ce9428e3d Various formatting fixes 2020-10-25 21:53:16 +07:00
Koakuma
1d3abb761d "zig fmt" on lib/std/os/linux.zig 2020-10-25 13:38:08 +07:00
Koakuma
e7369ada93 Fix boolean operator in if clause 2020-10-24 21:33:40 +07:00
Koakuma
73e62f22ec Fix sigaction(2) call on sparc64 2020-10-24 20:05:37 +07:00
Koakuma
238f253de9 Move comptime out 2020-10-24 20:03:41 +07:00
Koakuma
6146f81c6e Add pipe(2) support 2020-10-24 20:03:37 +07:00
Koakuma
e5a11020cc Add sparc64 syscall interface 2020-10-24 19:59:04 +07:00
xackus
4ec26be424 implement {get, set}rlimit for linux 2020-10-04 23:56:10 +02:00
Joran Dirk Greef
31533eb743 Move to std/os/linux 2020-09-19 16:18:04 +02:00
Isaac Freund
7b961a876b
std: add prctl definition for linux 2020-09-11 22:32:22 +02:00
Andrew Kelley
2315331d23
Merge pull request #5527 from shawnanastasio/ppc64le
Implement support for powerpc64{,le}
2020-09-10 15:56:27 -04:00
Veikka Tuominen
41bbadbb9a
Merge pull request #6246 from Vexu/field
Remove deprecated fields on `type`
2020-09-05 13:58:02 +03:00
Andrew Kelley
1034459170
Merge pull request #6243 from ifreund/uid-gid-cleanup
std: clean up usage of uid_t/gid_t, add seteuid/setegid to std.os
2020-09-03 18:05:59 -04:00
Vexu
1df0f3ac24
update uses of deprecated type field access 2020-09-03 18:10:40 +03:00
Isaac Freund
01a365f1b0
std: ensure seteuid/setegid do not change saved id 2020-09-03 15:16:26 +02: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
Aransentin
25f6663304 Add the sync functions 2020-09-02 22:16:40 +00: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
80fabe1850 fixed bpf namespace 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
Andrew Kelley
ae2c88754d std: signalfd: fix the types of things; add test 2020-08-17 16:19:57 -07:00
Luna
2deb07a001 rename signalfd4 to signalfd 2020-08-17 16:05:35 -07:00
Maciej Walczak
6febe7e977
copy_file_range linux syscall (#6010) 2020-08-11 15:49:43 -04:00
luna
a6626802f9
Add signalfd support (#5322)
* add signalfd_siginfo to linux bits

* Cast sigaddset's shift value to u5

* linux: add signalfd4

* os: add signalfd
2020-07-22 17:26:27 -04:00
Shawn Anastasio
ec0d775524 Implement std.os for powerpc64{,le} 2020-07-01 16:10:49 -05:00
Andrew Kelley
7fd937fef4 cleanups
* improve docs
 * add TODO comments for things that don't have open issues
 * remove redundant namespacing of struct fields
 * guard against ioctl returning EINTR
 * remove the general std.os.ioctl function in favor of the specific
   ioctl_SIOCGIFINDEX function. This allows us to have a more precise
   error set, and more type-safe API.
2020-06-02 15:28:46 -04:00
Luna
6623efd7d4 Change ioctl's request type to i32 2020-06-02 14:56:19 -04:00
Luna
7c71054286 Replace syscall3 to os.ioctl 2020-06-02 14:56:19 -04:00
Luna
c8468bed42 Add std.os.ioctl 2020-06-02 14:56:19 -04:00
Andrew Kelley
7c8d0cc678 fix pwrite on 32-bit linux 2020-05-25 19:59:39 -04:00
Tadeo Kondrak
6745a6f6f6
zig fmt 2020-05-05 09:38:02 -06:00
Chris Heyes
8ebcca6734
Get evented io code paths to build on macOS (#5233)
* Get evented io code paths to build on macOS
* Use mode_t instead of usize where appropriate
2020-05-02 14:14:46 -04:00
Timon Kruiper
c829f2f7b7 Add mips support to standard library 2020-04-24 15:28:55 -04: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
daurnimator
63409cf422 std: linux syscall numbers are now an extensible enum 2020-03-31 10:16:20 -04:00