10614 Commits

Author SHA1 Message Date
Alex Rønne Petersen
cc9634a2d3
Merge pull request #23373 from alexrp/get-base-address
`std.process`: Some minor fixes for `getBaseAddress()`
2025-03-27 15:39:24 +01:00
GalaxyShard
b5a5260546 std.Build: implement addEmbedPath for adding C #embed search directories 2025-03-27 09:47:42 +01:00
blurrycat
fb188c3d18
std.posix: add getuid()/geteuid() 2025-03-27 07:58:27 +00:00
Андрей Краевский
aac800ec65
std.meta.FieldType -> @FieldType 2025-03-27 03:49:38 +00:00
Alex Rønne Petersen
db7db48028
Merge pull request #23339 from Iced-Sun/master
std.posix: update LFS64 interfaces for android bionic C
2025-03-26 23:25:08 +01:00
Felix "xq" Queißner
0ed905b9c6 Enables parsing for '-Wl,-rpath,' in pkg-config output, allows better support for NixOS linking. 2025-03-26 22:55:18 +01:00
Pratham
5bb9963bbb
abiAndDynamicLinkerFromFile: return an error when the file is not actually dynamic (#19928) 2025-03-26 19:54:10 +00:00
Alex Rønne Petersen
b9efdbb412
std.process: Fix getBaseAddress() to handle all Darwin OSs. 2025-03-26 20:39:07 +01:00
Alex Rønne Petersen
d56a99442b
std.process: Don't use _mh_execute_header in getBaseAddress() on BSDs.
Only the Mach-O format has this symbol.
2025-03-26 20:39:07 +01:00
Alex Rønne Petersen
0cf5f0d0b0
std.process: Fix getBaseAddress() for linux + libc.
In this case we should use the getauxval() from libc, not our own.
2025-03-26 20:39:07 +01:00
wooster0
263ba34619 linux: don't export getauxval when not required 2025-03-26 20:37:35 +01:00
Kendall Condon
b4b1daf001
Allocator.create: properly handle alignment for zero-sized types (#21864) 2025-03-26 15:31:57 +00:00
dweiller
b84db311d9 zig build: add env_map entries to hash for Step.Run
This change fixes false-positive cache hits for run steps that get run
with different sets of environment variables due the the environment map
being excluded from the cache hash.
2025-03-26 14:48:04 +01:00
孙冰
0118912e2d
std.posix: update LFS64 interfaces for android bionic C 2025-03-26 20:00:05 +08:00
孙冰
d7e944a628
std.Target: Update default Android API level to 24
API level 24 completes _FILE_OFFSET_BITS=64 support in bionic, c.f.
https://android.googlesource.com/platform/bionic/+/HEAD/docs/status.md.

According to https://apilevels.com, API level 24 (Android 7 released in 2017)
has 97% cumulative usage.
2025-03-26 19:48:21 +08:00
Alex Rønne Petersen
b350049f51
Merge pull request #23062 from ianic/io_uring_bind
io_uring: Update to kernel changes in 6.11 and 6.12
2025-03-26 11:39:56 +01:00
Pat Tullmann
2210c4c360 lib/std/posix: test ftruncate via std.fs.File.setEndPos()
Add a test for std.fs.File's `setEndPos` (which is a simple wrapper around
`std.posix.ftruncate`) to exercise some success and failure paths.

Explicitly check that the `ftruncate` length isn't negative when
interpreted as a signed value.  This avoids having to decode overloaded
`EINVAL` errors.

Add errno handling to Windows path to map INVALID_PARAMETER to FileTooBig.

Fixes #22960
2025-03-26 02:57:23 +01:00
Jonathan Marler
1408288b95 support more process creation options on Windows
Adds a CreateProcessFlags packed struct for all the possible flags to
CreateProcessW on windows.  In addition, propagates the existing
`start_suspended` option in std.process.Child which was previously only
used on Darwin.  Also adds a `create_no_window` option to std.process.Child
which is a commonly used flag for launching console executables on
windows without causing a new console window to "pop up".
2025-03-25 23:48:27 +01:00
Arnau Camprubí
8a8b3019f3
Fix std.debug.dumpHex address offsets 2025-03-25 23:20:56 +01:00
Alex Rønne Petersen
cb8d7a8110
Merge pull request #23310 from Rexicon226/fix-23309
big.int: return normalized results from `{add,sub}Carry`
2025-03-25 18:44:35 +01:00
Kuwazy
6b6dc1cd3a
Added check for HTTP version and GET method when upgrading WebSocket to comply with RFC 6455. (#23332) 2025-03-25 15:00:50 +01:00
Alex Rønne Petersen
e1c6af2840
Merge pull request #23220 from samy-00007/bytesAsSlice-fix
Minor fix for `Allocator.remap` and `mem.bytesAsSlice` for zero-sized types
2025-03-25 13:45:10 +01:00
孙冰
fbbdde41b4 std.c: android bionic C supports arc4random_buf and getentropy
1. https://android.googlesource.com/platform/bionic/+/refs/heads/main/libc/include/bits/getentropy.h
2. https://android.googlesource.com/platform/bionic/+/refs/heads/main/libc/include/stdlib.h
2025-03-25 13:17:45 +01:00
Alex Rønne Petersen
c94d926bba
Merge pull request #23007 from rootbeer/posix-eaccess-eperm
lib/std: Make usage of PermissionDenied & AccessDenied consistent
2025-03-25 11:21:05 +01:00
godalming123
5bb4fef30a
Update the documentation comment in arena_allocator.zig to be more accurate
Update the documentation comment in arena_allocator.zig to specify that free() is a no-op unless the item is the most recent allocation.
2025-03-25 06:19:28 +00:00
samy007
4595b1ee06 std.mem.bytesAsSlice: fix to support zero-bytes sized types
also added a test for json parsing of zero sized type
2025-03-24 22:08:05 +01:00
samy007
be483dabc8 fix: Allocator.remap now handles zero-bytes sized types 2025-03-24 22:05:57 +01:00
Chris Clark
525466b49d
std.zig.Ast: Fix error case memory leak in parse() 2025-03-24 20:14:01 +01:00
Pat Tullmann
14c046fc07 lib/std: PermissionDenied/AccessDenied cleanup and fallout
This PR consistently maps .ACCES into AccessDenied and .PERM into
PermissionDenied.  AccessDenied is returned if the file mode bit
(user/group/other rwx bits) disallow access (errno was `EACCES`).
PermissionDenied is returned if something else denies access (errno was
`EPERM`) (immutable bit, SELinux, capabilities, etc).  This somewhat
subtle distinction is a POSIX thing.

Most of the change is updating std.posix Error Sets to contain both
errors, and then propagating the pair up through caller Error Sets.

Fixes #16782
2025-03-24 16:20:45 +01:00
Pat Tullmann
02373eb2a5 lib/std/: WASI code should follow POSIX semantics for AccessDenied/PermissionDenied
Use error.AccessDenied for permissions (rights) failures on Wasi
(`EACCES`) and error.PermissionDenied (`EPERM`) for systemic failures.
And pass-through underlying Wasi errors (PermissionDenied or AccessDenied)
without mapping.
2025-03-24 16:20:45 +01:00
Pat Tullmann
f304d8e50a windows: Use AccessDenied for ACCESS_DENIED on Windows
Windows defines an `ACCESS_DENIED` error code.  There is no
PERMISSION_DENIED (or its equivalent) which seems to only exist on POSIX
systems.  Fix a couple Windows calls code to return `error.AccessDenied`
for `ACCESS_DENIED` and to stop mapping AccessDenied into
PermissionDenied.
2025-03-24 16:20:45 +01:00
Meghan Denny
972cab5bb0
std: add bit_set.findLastSet() (#22411) 2025-03-24 16:12:23 +01:00
oittaa
c1db72cdbc
std.math: Add least common multiple (lcm) 2025-03-24 16:07:40 +01:00
rpkak
9f8d938d38 DepTokenizer: allow space between target and colon 2025-03-24 15:31:03 +01:00
David Rubin
ae442e2c29
big.int: return normalized results from {add,sub}Carry 2025-03-24 06:58:01 -07:00
Shun Sakai
677b2d62e5 docs(std.base64): Add references to RFC 4648
There are multiple implementations of Base64, but `std.base64` appears
to be based on RFC 4648, so we clarify that it is based on RFC 4648.
2025-03-24 11:42:28 +00:00
GasInfinity
dfe0fb675d fix(std/fmt.zig): fix overflow in fmtDurationSigned
fixes #23315
2025-03-24 11:40:19 +00:00
Carter Snook
149eace5d5 deprecate O(n) union field type helpers in std.meta
Users should be using @FieldType() instead.
2025-03-24 11:13:58 +00:00
sdzx-1
adee3ee9a2 typo: block_two_semicolon -> block_two 2025-03-24 07:05:17 +01:00
Jacob Young
98640cbeb8
Merge pull request #23209 from jacobly0/x86_64-rewrite
x86_64: rewrite wrapping multiplication
2025-03-23 21:56:58 -04:00
Carl Åstholm
f45f9649e3 Lower @returnAddress to a constant 0 in Emscripten release builds
Emscripten currently implements `emscripten_return_address()` by calling
out into JavaScript and parsing a stack trace, which introduces
significant overhead that we would prefer to avoid in release builds.

This is especially problematic for allocators because the generic parts
of `std.mem.Allocator` make frequent use of `@returnAddress`, even
though very few allocator implementations even observe the return
address, which makes allocators nigh unusable for performance-critical
applications like games if the compiler is unable to devirtualize the
allocator calls.
2025-03-23 17:13:19 -04:00
Jacob Young
aff2be01c9 big.int: fix negative multi-limb shift right adjust crash 2025-03-21 21:51:08 -04:00
Jacob Young
c5c1c8538d x86_64: rewrite wrapping multiplication 2025-03-21 21:51:08 -04:00
Jacob Young
ed284c1f98 big.int: fix yet another truncate bug
Too many bugs have been found with `truncate` at this point, so it was
rewritten from scratch.

Based on the doc comment, the utility of `convertToTwosComplement` over
`r.truncate(a, .unsigned, bit_count)` is unclear and it has a subtle
behavior difference that is almost certainly a bug, so it was deleted.
2025-03-21 21:51:08 -04:00
Alex Rønne Petersen
03123916e5 compiler: Support more GCC code models and fix the mapping to LLVM code models.
Closes #22517.
2025-03-19 03:15:16 +01:00
Ali Cheraghi
ee06b2ce76 spirv: require int8/int16 capabilities 2025-03-18 07:05:50 +03:30
Ali Cheraghi
50539a2447 spirv/target: arbitrary_precision_integers feature support 2025-03-17 21:56:17 +03:30
Ali Cheraghi
e2e7577474 spirv: lower more types in assembler 2025-03-17 21:56:17 +03:30
Ali Cheraghi
78ad866dd1 target: split addresses and physical_storage_buffer features 2025-03-17 21:56:17 +03:30
Jonathan Gautheron
ea57fb55ea std.zig.c_translation: fix function pointer casting 2025-03-15 16:21:55 +02:00