aboutsummaryrefslogtreecommitdiff
path: root/lib/std/os/linux.zig
AgeCommit message (Collapse)Author
2020-12-31Year++Frank Denis
2020-12-23Truncate user and group ids for 64 bit Linux systems (#7466)Andreas Linz
* Truncate user and group ids Calls to `getuid`, `getgid` and their `eid` variants fail to compile on 64bit Linux systems because the return value of the syscall is of `usize` and needs to be truncated to fit the size of `uid_t` that is 32 bit. Thanks to @FireFox317 for figuring this out in Zig's Discord channel! * Add a regression test for user and group ids * Replace @truncate with @intCast This should be safe because `uid_t` will be 32-bit. * Add missing import for getauxval * Add missing package names * Revert "Add missing import for getauxval" This reverts commit 38f93dc89effdf657f2b81a56b96527ce4083f52. * Skip user and group test if builtin.link_libc
2020-12-18std.crypto.random: introduce fork safetyAndrew Kelley
Everybody gets what they want! * AT_RANDOM is completely ignored. * On Linux, MADV_WIPEONFORK is used to provide fork safety. * On pthread systems, `pthread_atfork` is used to provide fork safety. * For systems that do not have the capability to provide fork safety, the implementation falls back to calling getrandom() every time. * If madvise is unavailable or returns an error, or pthread_atfork fails for whatever reason, it falls back to calling getrandom() every time. * Applications may choose to opt-out of fork safety. * Applications may choose to opt-in to unconditionally calling getrandom() for every call to std.crypto.random.fillFn. * Added `std.meta.globalOption`. * Added `std.os.madvise` and related bits. * Bumped up the size of the main thread TLS buffer. See the comment there for justification. * Simpler hot path in TLS initialization.
2020-12-12std: Further siginfo refinementsLemonBoy
* Define siginfo and sigaction for Darwin * Define sigaction/handler union for maximum libc compatibility * Minor correction to some type definitions
2020-12-12std: Improve sigaction interfaceLemonBoy
Add a smoke test to prevent regressions.
2020-12-09small fixes and zig fmtVexu
2020-11-27Fix fork() on Linux/sparc64Koakuma
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-21std: add support for ppollŽiga Željko
2020-11-20std: Use newfstatat on PPC64LemonBoy
One more variation in the syscall table, hooray!
2020-11-19Add builtin.Signedness, use it instead of is_signedTadeo Kondrak
2020-11-05Merge pull request #6978 from LemonBoy/statshitAndrew Kelley
Decouple kernel and libc stat definitions
2020-11-05Merge pull request #6895 from jorangreef/fallocateAndrew Kelley
linux: add fallocate()
2020-11-05std: Split kernel&libc definitions of stat structLemonBoy
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-03Support 32-bit big-endian targetsJoran Dirk Greef
2020-11-02std: Fix syscall stubs passing 64bit offsets for BE targetsLemonBoy
2020-11-01Merge pull request #6792 from koachan/sparc64-linuxAndrew Kelley
Initial sparc64-linux bringup
2020-11-01Swap endiannessJoran Dirk Greef
2020-11-01"The Traveling Wilburys' - Handle With Care"Joran Dirk Greef
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-10-31linux: add fallocate()Joran Dirk Greef
2020-10-29Merge pull request #6356 from jorangreef/io_uringAndrew Kelley
std: add io_uring library
2020-10-27std.os.linux.accept/accept4: allow null for addr and lenjohnLate
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-27std: Add basic smoke test for net functionalityLemonBoy
2020-10-25Various formatting fixesKoakuma
2020-10-25"zig fmt" on lib/std/os/linux.zigKoakuma
2020-10-24Fix boolean operator in if clauseKoakuma
2020-10-24Fix sigaction(2) call on sparc64Koakuma
2020-10-24Move comptime outKoakuma
2020-10-24Add pipe(2) supportKoakuma
2020-10-24Add sparc64 syscall interfaceKoakuma
2020-10-04implement {get, set}rlimit for linuxxackus
2020-09-19Move to std/os/linuxJoran Dirk Greef
2020-09-11std: add prctl definition for linuxIsaac Freund
2020-09-10Merge pull request #5527 from shawnanastasio/ppc64leAndrew Kelley
Implement support for powerpc64{,le}
2020-09-05Merge pull request #6246 from Vexu/fieldVeikka Tuominen
Remove deprecated fields on `type`
2020-09-03Merge pull request #6243 from ifreund/uid-gid-cleanupAndrew Kelley
std: clean up usage of uid_t/gid_t, add seteuid/setegid to std.os
2020-09-03update uses of deprecated type field accessVexu
2020-09-03std: ensure seteuid/setegid do not change saved idIsaac Freund
2020-09-03std: fix linux uid_t, use uid_t/gid_t in std.osIsaac Freund
- 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-02Add the sync functionsAransentin
2020-08-22Bpf: move under os/linux instead of bits (#6126)Matthew Knight
* 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-21fixed bpf namespaceMatt Knight
2020-08-21moved bpf syscall, added some bpf instructions and testsMatt Knight
2020-08-20add license header to all std lib filesAndrew Kelley
add SPDX license identifier copyright ownership is zig contributors
2020-08-17std: signalfd: fix the types of things; add testAndrew Kelley
2020-08-17rename signalfd4 to signalfdLuna
2020-08-11copy_file_range linux syscall (#6010)Maciej Walczak
2020-07-22Add signalfd support (#5322)luna
* add signalfd_siginfo to linux bits * Cast sigaddset's shift value to u5 * linux: add signalfd4 * os: add signalfd
2020-07-01Implement std.os for powerpc64{,le}Shawn Anastasio
2020-06-02cleanupsAndrew Kelley
* 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-02Change ioctl's request type to i32Luna