Commit Graph

8005 Commits (bfc569bc9877a4f305080bc6cde0e42fed7433e0)

Author SHA1 Message Date
daurnimator bfc569bc98
std: add os.fstatat 2020-03-03 13:25:43 -05:00
daurnimator 627618a38d
std: add Dir.changeDir as wrapper around fchdir 2020-03-03 13:25:43 -05:00
daurnimator dfb420e6d7
std: add fs.Dir.makeDir 2020-03-03 13:25:43 -05:00
daurnimator 88e27f01c8
std: add mkdirat 2020-03-03 13:25:40 -05:00
Andrew Kelley 582db68a15
remove superfluous comptime keyword 2020-03-03 12:01:17 -05:00
LemonBoy a6fb6dcfc9 linux: Correct pread64 syscall for ARM/MIPS
Closes #4615
2020-03-03 11:59:16 -05:00
Andrew Kelley 226b801830
Merge pull request #4612 from ziglang/os-read-write-sendfile
std.os read/write functions + sendfile
2020-03-03 10:15:37 -05:00
Andrew Kelley 9d6cc75ce3
disable sendfile test on mips 2020-03-03 09:49:46 -05:00
Andrew Kelley 387418277a
Merge pull request #4601 from alexnask/fix_3997
Allow wrapping in VDSO lookup
2020-03-03 09:15:40 -05:00
Alexandros Naskos 7559418305 Added comment justifying wrapping operations 2020-03-03 12:41:11 +02:00
Andrew Kelley a66c72749a more macos fixes 2020-03-03 03:10:56 -05:00
Ryan Liptak d7579a2fcb Fix std.os.unlinkatW for absolute paths
RootDirectory can't be set in ObjectAttributes if ObjectName is an absolute path.

Fixes #4606
2020-03-03 03:07:12 -05:00
Andrew Kelley 859fc856d3
fix macosx and freebsd build failures 2020-03-03 02:57:11 -05: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
Terin Stock bd287dd194
std: implement sendfile on linux
This changset adds a `sendfile(2)` syscall bindings to the linux bits
component. Where available, the `sendfile64(2)` syscall will be
transparently called.

A wrapping function has also been added to the std.os to transform
errno returns to Zig errors.

Change-Id: I86769fc4382c0771e3656e7b21137bafd99a4411
2020-03-02 12:54:50 -05:00
Alexandros Naskos a48cd1cf58 Allow wrapping in VDSO lookup 2020-03-02 11:44:21 +02:00
xackus 00be934569 short std.builtin enum literals in std lib 2020-03-01 13:57:41 -05:00
Andrew Kelley 3c14327011
Merge branch 'daurnimator-fmt-sentinel-pointers'
closes #3972
2020-03-01 13:53:13 -05:00
Andrew Kelley ef3d761da5
breaking: std.mem.len no longer takes a type argument
also update fmt code to use std.mem.span.
2020-03-01 13:21:39 -05:00
Andrew Kelley 5b26128bac
add new functions to std.mem and deprecate others
add std.mem.Span
add std.mem.span
add std.mem.length
add std.mem.indexOfSentinel

deprecate std.mem.len
deprecate std.mem.toSlice
deprecate std.mem.toSliceConst
2020-03-01 13:07:55 -05:00
Andrew Kelley 4505857e30
revert changes outside std.fmt 2020-03-01 13:07:31 -05:00
daurnimator 0b0de22fd1
std: format contents of sentinel terminated many pointers
std: add std.meta.Sentinel to get sentinel of a type
2020-03-01 13:04:29 -05:00
Andrew Kelley b99c6d56da
stage1: fix compilation on 32-bit arm 2020-03-01 03:27:09 -05:00
Andrew Kelley ae99fabfe4
Merge pull request #4585 from LemonBoy/fix-4581
target: Implement OS version detection for Windows
2020-03-01 02:53:51 -05:00
Andrew Kelley f082e253b5 fix native OS version detection on macOS
closes #4583
2020-03-01 01:17:50 -05:00
Andrew Kelley 2246812184
use an explicit error set to fix a compilation error
this function has conditionally compiled out code in it about looking
for native glibc.
2020-02-29 22:20:44 -05:00
Andrew Kelley 6fcf6716be
std.Thread.cpuCount on Windows uses the PEB
rather than calling GetSystemInfo from kernel32.dll. Also remove
OutOfMemory from the error set.
2020-02-29 22:13:09 -05:00
Andrew Kelley d951e0402a
Merge pull request #4586 from daurnimator/windows-PEB
Fill out windows PEB definition
2020-02-29 22:05:56 -05:00
Andrew Kelley 48cef8d5be
refactor std.zig.system.NativeTargetInfo functions
to make them a bit easier to test.
2020-02-29 21:31:03 -05:00
Andrew Kelley c903b76010
Merge pull request #4589 from LemonBoy/fix-4583
target: Implement OS version detection for OSX
2020-02-29 20:39:29 -05:00
LemonBoy 845af5c552 Handle one more error 2020-02-29 23:11:36 +01:00
LemonBoy 3b29a72b3b Use .len instead of @sizeOf 2020-02-29 23:08:57 +01:00
LemonBoy 84549b3955 target: Implement OS version detection for OSX
Closes #4583
2020-02-29 21:46:07 +01:00
LemonBoy 278f0f8fa9 Change how the build-id is checked
Address review comment by @rocksnest
2020-02-29 18:31:03 +01:00
Andrew Kelley 3c7f030a60
add CrossTarget.getObjectFormat
closes #4588

thanks Michaël Larouche for the suggested fix
2020-02-29 12:27:13 -05:00
daurnimator d0c22619f5
Complete windows PEB_LDR_DATA definition 2020-03-01 02:10:29 +11:00
LemonBoy 5822220435 Address review comments 2020-02-29 14:19:13 +01:00
daurnimator 513076ee9c
Fill out PEB definition 2020-03-01 00:12:08 +11:00
LemonBoy f072b0c056 target: Implement OS version detection for Windows
Closes #4581
2020-02-29 12:02:40 +01:00
Andrew Kelley 7e6b68a534
std.Target.standardDynamicLinkerPath: delete bad doc comment 2020-02-29 02:08:26 -05:00
Andrew Kelley 7617610400
Merge pull request #4550 from ziglang/os-version-ranges
introduce operating system version ranges as part of the target; self-host native dynamic linker detection and native glibc version detection
2020-02-29 01:57:06 -05:00
Alexandros Naskos 1b41f2d77e
C pointer slices are no longer allowzero (#4462)
* Slices from C pointers are no longer allowzero but instead insert a runtime assertion.

* Added a test, fixed code for cases with non-allowzero C pointers

* Create new type when flipping allow_zero, sometimes we get a cached value back from adjust_ptr_len.

* Added comments, changed panic message

* Added runtime safety test.
2020-02-29 01:36:42 -05:00
Andrew Kelley 3cba603eae
fix crash when building docgen 2020-02-29 01:05:11 -05:00
Andrew Kelley 1aef0bef75
std.Target.Os.WindowsVersion: non-exhaustive enum 2020-02-28 19:24:52 -05:00
Andrew Kelley e683eee415
fix CrossTarget.isNative, setGnuLibCVersion, zigTriple 2020-02-28 19:18:27 -05:00
Andrew Kelley 4bc893c346
update test to newer API 2020-02-28 19:05:14 -05:00
Andrew Kelley 7e3bb00a0e
don't choose native ld path when os is non native 2020-02-28 18:48:19 -05:00
Andrew Kelley 4591236ae1
CrossTarget.cpu_model: communicate intent precisely 2020-02-28 18:31:46 -05:00
Andrew Kelley aa13f339d4
fix handling of CrossTarget.cpu_model 2020-02-28 18:09:33 -05:00
Andrew Kelley 8691d3c50d
improve std.zig.system.NativeTargetInfo.detect
It now takes a std.zig.CrossTarget parameter, and only resolves
native things, leaving explicitly overridden things alone.
2020-02-28 17:23:16 -05:00