aboutsummaryrefslogtreecommitdiff
path: root/lib/std/os
AgeCommit message (Collapse)Author
2021-01-14organize std lib concurrency primitives and add RwLockAndrew Kelley
* move concurrency primitives that always operate on kernel threads to the std.Thread namespace * remove std.SpinLock. Nobody should use this in a non-freestanding environment; the other primitives are always preferable. In freestanding, it will be necessary to put custom spin logic in there, so there are no use cases for a std lib version. * move some std lib files to the top level fields convention * add std.Thread.spinLoopHint * add std.Thread.Condition * add std.Thread.Semaphore * new implementation of std.Thread.Mutex for Windows and non-pthreads Linux * add std.Thread.RwLock Implementations provided by @kprotty
2021-01-13std.os.uefi.protocols.FileProtocol: fix and expose get_position, ↵Asherah Connor
set_position (#7762)
2021-01-12define nfds_t for windowsBill Nagel
2021-01-11std.os.windows.GetFinalPathNameByHandle: remove intermediate buffersRohlem
... and mem.copy operations. Requires slightly larger input buffers than result length. Add helper functions std.mem.alignInBytes and std.mem.alignInSlice.
2021-01-11std.os.windows.GetFinalPathNameByHandle: remove QueryInformationFile code pathRohlem
2021-01-11std.os.windows.GetFinalPathNameByHandle: address non-structural review commentsRohlem
2021-01-11std.os.windows.GetFinalPathNameByHandle: replace kernel32 by ntdll callRohlem
Removes the call to kernel32.GetFinalPathNameByHandleW in favor of NtQueryObject, which means we can reuse the other codepath's logic for DOS naming.
2021-01-11introduce std.os.windows.QueryObjectNameRohlem
2021-01-11std.os.windows.GetFinalPathNameByHandle: add testRohlem
2021-01-11std.os.windows.GetFinalPathNameByHandle: reintroduce kernel32 for compatibilityRohlem
The NtQueryInformationFile with .FileNormalizedNameInformation is only available in Windows 10 1803 (rs4) and later, however there is probably still another route we can go via ntdll.
2021-01-11Merge pull request #7195 from Aransentin/masterAndrew Kelley
A win32-api proposal, implemented for user32.zig
2021-01-11os/bits/linux: add the termios cc bitsVincent Rischmann
2021-01-11Merge pull request #7134 from alexnask/fix_std_fs_watchAndrew Kelley
The std.fs.Watch rewrite PR
2021-01-07Merge pull request #7720 from Snektron/sockoptAndrew Kelley
Some sockopt stuff
2021-01-07Reduce use of deprecated IO typesJay Petacat
Related: #4917
2021-01-08Add IP_ constantsRobin Voetter
2021-01-06fix LRESULT and LPARAM typedefsJonathan Marler
LRESULT and LPARAM are currently typedef'd as ?*c_void, however, they are supposed to be typedef'd as LONG_PTR which is equivalent to isize in Zig.
2021-01-05std.c add syslogxackus
2021-01-05freebsd, netbsd, dragonfly: add struct timevalxackus
2021-01-03Improve uring definitionsdaurnimator
2021-01-02std: Use {s} instead of {} when printing stringsLemonBoy
2021-01-01openbsd: add pollfd interfaceSébastien Marie
2020-12-31Year++Frank Denis
2020-12-30std: Add more standard type definitions for FreeBSDLemonBoy
Closes #7550
2020-12-29std.ChildProcess: improvements to collectOutputPosixAndrew Kelley
* read directly into the ArrayList buffers. * respect max_output_bytes * std.ArrayList: - make `allocatedSlice` public. - add `unusedCapacitySlice`. I removed the Windows implementation of this stuff; I am doing a partial merge of LemonBoy's patch with the understanding that a later patch can add the Windows implementation after it is vetted.
2020-12-29std: Use WINAPI instead of .StdcallLemonBoy
2020-12-29std: Fix compilation on FreeBSD/DarwinLemonBoy
2020-12-29std: Fix poll definitions for FreeBSD/DarwinLemonBoy
2020-12-29std: Avoid deadlocking in ChildProcess.execLemonBoy
Reading stdin&stderr at different times may lead to nasty deadlocks (eg. when stdout is read before stderr and the child process doesn't write anything onto stdout). Implement a polling mechanism to make sure this won't happen: we read data from stderr/stdout as it becomes ready and then it's copied into an ArrayList provided by the user, avoiding any kind of blocking read.
2020-12-26Merge pull request #7449 from kristoff-it/macos-termiosAndrew Kelley
add termios bits for darwin
2020-12-24Merge pull request #7531 from Vexu/orphanageVeikka Tuominen
Move ArrayListSentineled to std lib orphanage
2020-12-24std: clenup, fixes, fmtVeikka Tuominen
2020-12-23openbsd: implement segfault handling on openbsd x86_64Sébastien Marie
2020-12-23added comments, removed useless comptime keywordsLoris Cro
2020-12-23add termios bits for darwinLoris Cro
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-23openbsd: fix siginfo_t struct definitionSébastien Marie
`_proc` struct part contains an union for kill/cld parts. see [siginfo_t](https://github.com/openbsd/src/blob/77c6c13150aaa9f0a29fe29b233c4436d1da01c0/sys/sys/siginfo.h#L132)
2020-12-23Enable segfault handling on FreeBSD.Alex Cameron
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-18std: Properly fix the TLS alignment problemLemonBoy
ad05509 introduced a fix for the wrong problem, the logic to align the start of main_thread_tls_buffer was already there but was flawed. Fix it for good and avoid wasting too many bytes for alignment purposes.
2020-12-17std: align(16) main_thread_tls_bufferAndrew Kelley
Before this change, thread local variables were landmines if LLVM decided to optimize any writes to them using vector instructions.
2020-12-17Add EV_ERROR to FreeBSD bitsAlexandros Naskos
2020-12-17Add baudrate constantsTau
This adds the missing baudrate constants for linux where I've used them directly.
2020-12-17Add process_madvise to Linux syscalls (#7450)Dmitry Atamanov
2020-12-17Only check for evented mode in windows.OpenFile when in async modeAlexandros Naskos
2020-12-15openbsd: correct few structsSébastien Marie
- addrinfo: addr and canonname are switched (wrong layout) - addrinfo, Flock, msghdr struct: use proper c_xxx type instead of fixed size. it should help using struct on all architectures supported by openbsd
2020-12-14Implement std.fs.Watch on WindowsAlexandros Naskos
Use unmanaged containers in std.fs.Watch
2020-12-14Add missed Linux syscallsdata-man
2020-12-13Fix compilation error on OpenBSDLemonBoy
2020-12-13Fix compilation error on FreeBSDLemonBoy