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
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
Jay Petacat
1595ce273e
Remove deprecated stream aliases
2021-01-08 16:54:56 -05:00
Julius Putra Tanu Setiaji
2b3b355a23
Add compileError message for StringHashMap in AutoHashMap
2021-01-07 23:51:53 -08:00
Andrew Kelley
3fdffe85c0
Merge pull request #7720 from Snektron/sockopt
...
Some sockopt stuff
2021-01-07 23:50:34 -08:00
Jonathan Marler
31802c6c68
remove z/Z format specifiers
...
Zig's format system is flexible enough to add custom formatters. This PR removes the new z/Z format specifiers that were added for printing Zig identifiers and replaces them with custom formatters.
2021-01-07 23:49:22 -08:00
Jay Petacat
a9b505fa77
Reduce use of deprecated IO types
...
Related: #4917
2021-01-07 23:48:58 -08:00
Michael Dusan
8e9a1ac364
builder: propagate env_map for child processes
2021-01-07 23:48:24 -08:00
Robin Voetter
ec7adeda2b
Add EPERM to std.os.setsockopt
2021-01-08 02:34:42 +01:00
Robin Voetter
83fad7d4f7
Add IP_ constants
2021-01-08 01:35:52 +01:00
Jonathan Marler
f1ef0a80f1
fix LRESULT and LPARAM typedefs
...
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-06 16:41:40 -08:00
Andrew Kelley
2f58efcc1f
std.SpinLock: flatten and remove init/deinit
...
structs which are intended to be directly initialized and support static
initialization should not have init/deinit methods.
2021-01-06 17:36:06 -07:00
Andrew Kelley
d7d905696c
Merge pull request #7622 from tetsuo-cpp/array-hash-map-improvements
...
std: Support equivalent ArrayList operations in ArrayHashMap
2021-01-06 16:32:23 -08:00
BinaryWarlock
148c887ace
spinlock: Default SpinLock.state to .Unlocked to allow default struct initialization
...
std.Mutex, which is struct initialized, is possibly defined to be std.SpinLock.
2021-01-06 15:54:30 -08:00