Commit Graph

3424 Commits

Author SHA1 Message Date
Asherah Connor
e6cdf9cebf std.elf: make Header pub 2021-01-14 14:38:52 +11:00
Asherah Connor
23fb19fe41 std.elf: expose parsing decoupled from std.fs.File 2021-01-14 14:38:52 +11:00
Asherah Connor
2b0e3ee228
std.os.uefi.protocols.FileProtocol: fix and expose get_position, set_position (#7762) 2021-01-13 21:46:22 -05:00
Jay Petacat
a021c7b1b2 Move fmt.testFmt to testing.expectFmt 2021-01-12 18:13:29 -08:00
Bill Nagel
2c79d669a7 add missing ECONNRESET from getsockoptError 2021-01-12 18:11:58 -08:00
Andrew Kelley
70c608add8
Merge pull request #7577 from semarie/emutls
implement emutls inside compiler_rt.zig
2021-01-12 17:54:02 -08:00
Andrew Kelley
e564d2ca3c
Merge pull request #7714 from mikdusan/target-macos
macos: reimplement OS version detection
2021-01-12 16:45:50 -08:00
Bill Nagel
1e2be14b6b define nfds_t for windows 2021-01-12 16:37:58 -08:00
Sébastien Marie
d7aa7dbab2 implement emutls in compiler_rt 2021-01-12 05:39:46 +00:00
Sébastien Marie
ebf2a7e9b9 add pthread_key functions 2021-01-12 05:39:46 +00:00
Andrew Kelley
8ea2b40e5f std.event.Loop: fix race condition when starting the time wheel
closes #7572
2021-01-11 22:23:03 -07:00
Andrew Kelley
5b2a79848c stage2: cleanups regarding red zone CLI flags
* CLI: change to -mred-zone and -mno-red-zone to match gcc/clang.
 * build.zig: remove the double negative and make it an optional bool.
   This follows precedent from other flags, allowing the compiler CLI to
   be the decider of what is default instead of duplicating the default
   value into the build system code.
 * Compilation: make it an optional `want_red_zone` instead of a
   `no_red_zone` bool. The default is decided by a call to
   `target_util.hasRedZone`.
 * When creating a Clang command line, put -mred-zone on the command
   line if we are forcing it to be enabled.
 * Update update_clang_options.zig with respect to the recent {s}/{} format changes.
 * `zig cc` integration with red zone preference.
2021-01-11 22:07:21 -07:00
Lee Cannon
8932c2d745 Added support for no red zone 2021-01-11 22:07:14 -07:00
Michael Dusan
4c3de99253
more fixups
- clarify comments
- `NativeTargetInfo.detect()` propagate macOS errors
- `macos.detect()` drop `std.log` usage
2021-01-11 20:58:31 -05:00
Michael Dusan
f2be1fb23e
macos: reimplement OS version detection
The macOS version is now obtained by parsing `SystemVersion.plist`.

Test cases added for plist files that date back to '2005 Panther and up
to the recent '2020 Big Sur 11.1 release of macOS.

Thus we are now able to reliably identify 10.3...11.1 and higher.

- drop use of kern.osproductversion sysctl
- drop use of kern.osversion sysctl (fallback)
- drop kern.osversion tests
- add `lib.std.zig.system.detect()`
- add minimalistic parser for `SystemVersion.plist`
- add test cases for { 10.3, 10.3.9, 10.15.6, 11.0, 11.1 }

closes #7569
2021-01-11 19:54:56 -05:00
Rohlem
c96272f618 std.os.windows.GetFinalPathNameByHandle: remove intermediate buffers
... and mem.copy operations. Requires slightly larger input buffers than result length. Add helper functions std.mem.alignInBytes and std.mem.alignInSlice.
2021-01-11 17:48:19 -07:00
Rohlem
f301a8467c std.os.windows.GetFinalPathNameByHandle: remove QueryInformationFile code path 2021-01-11 17:48:18 -07:00
Rohlem
cb20503990 std.os.windows.GetFinalPathNameByHandle: address non-structural review comments 2021-01-11 17:48:18 -07:00
Rohlem
64c5f4979e std.os.windows.GetFinalPathNameByHandle: replace kernel32 by ntdll call
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-11 17:48:18 -07:00
Rohlem
964bbcd0b1 introduce std.os.windows.QueryObjectName 2021-01-11 17:48:18 -07:00
Rohlem
09dc651476 std.os.windows.GetFinalPathNameByHandle: add test 2021-01-11 17:48:18 -07:00
Rohlem
450e467201 std.os.windows.GetFinalPathNameByHandle: reintroduce kernel32 for compatibility
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-11 17:48:18 -07:00
Rohlem
4b280ac7e9 add std.zig.system.windows version check utility functions 2021-01-11 17:48:17 -07:00
Rohlem
2922a48309 move windows runtime version detection into std.zig.system.windows 2021-01-11 17:48:16 -07:00
Jonathan Knezek
fc10c9c4ce
Add std.fmt.formatDuration and std.fmt.duration (#7297)
`formatDuration` works on a writer, and `duration` wraps a u64 to allow pleasant injection into format strings.
2021-01-11 19:15:56 -05:00
Andrew Kelley
4f5fa90d6d
Merge pull request #7195 from Aransentin/master
A win32-api proposal, implemented for user32.zig
2021-01-11 16:02:40 -08:00
Andrew Kelley
d68adc5382 std.EarlyEOFReader: rename to LimitedReader 2021-01-11 16:51:56 -07:00
daurnimator
01d1a8a783 std: use fifo.pump in writeFileAllUnseekable 2021-01-11 16:48:56 -07:00
daurnimator
e873668d38 std: add LimitedReader: reader that returns EOF early 2021-01-11 16:48:30 -07:00
daurnimator
8695b9fbe7 std: use reader.skipBytes to avoid infinite loop in writeFileAllUnseekable
skipBytes correctly handles EOF for us
2021-01-11 16:47:48 -07:00
daurnimator
0ab8ae944c std: reader.skipBytes's num_bytes should be a u64 2021-01-11 16:47:48 -07:00
Vincent Rischmann
3468872d83 os/bits/linux: add the termios cc bits 2021-01-11 15:39:36 -08:00
Andrew Kelley
ec9158305d
Merge pull request #7124 from LemonBoy/netstuff1
std: Decouple network streams from fs.File
2021-01-11 15:35:00 -08:00
Andrew Kelley
0c8e2c987d std CityHash: disable memory-expensive tests for now 2021-01-11 13:58:06 -07:00
Martin Wickham
21213127ec Modify cityhash to work at comptime 2021-01-11 13:52:52 -07:00
Andrew Kelley
73b17474d7
Merge pull request #7134 from alexnask/fix_std_fs_watch
The std.fs.Watch rewrite PR
2021-01-11 12:45:36 -08:00
LemonBoy
34720da3d0 Apparently unix sockets are supported on Windows
Starting from Windows 10 build 17063.
2021-01-11 21:43:15 +01:00
LemonBoy
d0beb4badb Let the kernel pick a random port
Avoid errors if the socket enters the TIME_WAIT state and we need to
re-execute this test before the OS releases it.

This problem was not really a problem before since the accept()-ed
socket was never closed on the server-side.
2021-01-11 21:43:14 +01:00
LemonBoy
676d7fc63c std: Add a small test for i/o on unix sockets 2021-01-11 21:43:13 +01:00
LemonBoy
89d6317b93 std: Decouple network streams from fs.File
The overlap between files and sockets is minimal and lumping them
together means supporting only a small subset of the functionalities
provided by the OS.
Moreover the socket and file handles are not always interchangeable: on
Windows one should use Winsock's close() call rather than the one used
for common files.
2021-01-11 21:43:09 +01:00
Travis
cc2981edfc update path.join to recognize any separators that isSep does 2021-01-11 11:15:34 -08:00
Andrew Kelley
169810b20f zig fmt 2021-01-10 19:04:10 -07:00
Adam Goertz
0f32de77c9 impl lossyCast #5080 2021-01-10 19:02:41 -07:00
Vincent Rischmann
2117489e05 debug: don't fail printLineInfo if the source file is not readable
Without this dumping a stacktrace fails with this:

    Unable to dump stack trace: AccessDenied
2021-01-10 17:46:15 -08:00
Andrew Kelley
29928af600
Merge pull request #7729 from jayschwa/remove-deprecated-stream
Remove deprecated stream aliases
2021-01-09 13:04:08 -08:00
Jay Petacat
a0ad2dee6a builtin: Add zig_version
This will enable code to perform version checks and make it easier to
support multiple versions of Zig.

Within the SemVer implementation, an intermediate value needed to be
coerced to a slice to workaround a comptime bug.

Closes #6466
2021-01-09 12:50:39 -08:00
xackus
e4b8148e9c Fix system library path detection on linux
Uses the NativeTargetInfo results instead of std.Target.current.
2021-01-08 20:07:59 -07:00
Sobeston
95e66a915b added mem.containsAtLeast 2021-01-08 18:12:30 -08:00
Jakub Konka
7e0e27e738 libstd: add missing MachO rebase opcodes in macho.zig 2021-01-08 23:41:51 +01:00
Jay Petacat
e72472d953 io: FindByteOutStream to FindByteWriter
See #4917
2021-01-08 16:54:56 -05:00