Commit Graph

6639 Commits

Author SHA1 Message Date
Jeroen van Rijn
1903d7211e Fix early join after start. 2025-06-21 11:47:00 +02:00
Laytan
7f648d11d6 Merge pull request #5329 from JackMordaunt/jfm-fix_chan_try_send
chan: fix try_send and send
2025-06-20 22:11:39 +02:00
Raph
a7e89e1324 Merge branch 'master' into tiocgwinsz_time 2025-06-20 16:50:00 -01:00
RaphGL
0b5be6ad6a added TIOCGWINSZ to darwin, linux and freebsd 2025-06-20 16:45:05 -01:00
Feoramund
b82753227d sys/posix: Correct reference to core:text/regex 2025-06-20 10:46:40 -04:00
Feoramund
09690691b6 text/regex: Remove old docmentation and unneeded flag
`Unsupported_Flag` was used back when the iterator did not handle
`.Multiline`.
2025-06-20 10:45:48 -04:00
Feoramund
4d4356e806 mem: Guard against Buddy_Allocator overwriting metadata 2025-06-20 06:44:44 -04:00
Feoramund
bfa0e1110a mem: Don't print Buddy_Allocator.tail
This is always a pointer past the end of the buffer given to
`buddy_allocator_init`, which could be an invalid address. Printing may
result in a segmentation violation.
2025-06-20 06:41:42 -04:00
Feoramund
c2f3d074e3 mem: Forbid construction of Buddy_Allocator with insufficient space
This takes into account eventual alignment.
2025-06-19 19:41:39 -04:00
Feoramund
57e2d8f1dd mem: Fix Buddy_Allocator size calculation to truly include alignment
This didn't take into account the size of the header plus the size of
the allocation itself by virtue of `align_forward_uint`; this could
result in no change if `size` was equal to `b.alignment` because the
number is aligned, and if `actual_size` and `size` ended up being equal,
no additional space would be requested.

This meant that a block would end up being allocated on top of its
buddy's head.

Fixes #3435
2025-06-19 19:41:38 -04:00
Feoramund
4e9f15965a mem: Fix inverted condition in buddy_allocator_alloc_bytes_non_zeroed
This was causing the procedure to find a block, then find one again,
or to not find a block and not try again.
2025-06-19 19:33:51 -04:00
Jeroen van Rijn
9c810e8340 Fix #5366 2025-06-19 22:46:51 +02:00
Jeroen van Rijn
69c0fe8305 Merge pull request #5344 from Feoramund/fix-2694
Review `core/mem/allocators.odin`
2025-06-19 18:35:17 +02:00
David Holland
0a45d4de0c Fix WAVEFORMATEX struct size (#5356)
* fix WAVEFORMATEX struct size
* fix size test for WAVEFORMATEX
* pack WAVEFORMATEXTENSIBLE
2025-06-18 12:25:09 +02:00
Jeroen van Rijn
a65ece4426 Allow core:net to be imported with -default-to-panic-allocator. 2025-06-17 15:36:17 +02:00
PePerRoNii
a0e2931dc2 Added GetThreadDescription kernal32.odin 2025-06-17 15:36:48 +07:00
Jeroen van Rijn
6d01aa9069 Appease -vet for haiku 2025-06-16 23:30:22 +02:00
Jeroen van Rijn
246deda2c5 Remove unneeded ; for essence 2025-06-16 23:03:07 +02:00
Jeroen van Rijn
c4fb5ebf9b Merge pull request #5348 from Kelimion/get_env_buffer
Get env buffer
2025-06-16 20:51:06 +02:00
Jeroen van Rijn
b9809e7aa4 OpenBSD 2025-06-16 20:39:19 +02:00
Jeroen van Rijn
73dcc39d98 Fix macOS 2025-06-16 20:22:15 +02:00
Jeroen van Rijn
6347c87b5b Add buffered get_env variants to os2 2025-06-16 20:12:27 +02:00
Jeroen van Rijn
eef07431ef Factor out buffered utf helper. 2025-06-16 20:12:27 +02:00
Jeroen van Rijn
1a2f83f123 Add bring-your-own-buffer versions of os.lookup_env and os.get_env
And make `core:terminal` use it so that `core:log` can be imported with `-default-to-nil-allocator`,
in which the actual allocator is set up in `main()`.

Windows was tricky because of the utf-8 <> utf-16 conversion, so we use some temporary stack buffers for that purpose,
limiting the non-allocating version there to 512 utf-16 characters each for the key and environment value.

In general the value is (obviously) limited to the size of the supplied buffer, and a `.Buffer_Full` error is returned
if that buffer is insufficient. If the key is not found, the procedure returns `.Env_Var_Not_Found`.

TODO:
- Factor out buffer-backed utf8 + utf16 conversion to `core:sys/util` to more easily apply this pattern.
- Add similar `lookup_env` and `get_env` procedures to `core:os/os2`.

Fixes #5336
2025-06-16 20:12:26 +02:00
Feoramund
71c6b0c8f0 testing: Add API to expect signals and assertion failures 2025-06-16 11:25:32 -04:00
Jeroen van Rijn
9c9380d158 Merge pull request #5315 from peperronii/master
Expose getpeername() in core:net package as "peer_endpoint"
2025-06-16 11:30:34 +02:00
PePerRoNii
acdab793d9 Added Socket_Info_Error to Network_Error union 2025-06-16 16:17:48 +07:00
Jeroen van Rijn
795ceec2cd Merge pull request #5327 from nubunto/fix/pool-join-hangs
fix: pool_join hangs if no threads are started
2025-06-16 10:50:35 +02:00
Bruno Panuto
6874a4cdb0 fix: make pool_finish not hang when pool_start is not called 2025-06-16 00:28:43 -03:00
Feoramund
7526549e51 Disable usage of AddressSanitizer (pt. 2) 2025-06-15 15:34:18 -04:00
Feoramund
5e929b596d Merge branch 'master' into fix-2694 2025-06-15 15:30:26 -04:00
Feoramund
efba9a1fb7 Disable usage of AddressSanitizer pending a per-allocator review
It has been discovered that AddressSanitizer does not keep a 1:1 mapping
of which bytes are poisoned and which are not. This can cause issues for
allocations less than 8 bytes and where addresses straddle 8-byte
boundaries.

See the following link for more information:

https://github.com/google/sanitizers/wiki/AddressSanitizerAlgorithm#mapping
2025-06-15 15:06:28 -04:00
Feoramund
134c39b58b mem: Standardize panic messages 2025-06-15 12:34:16 -04:00
Feoramund
e4258b151e mem: Review all documentation comments 2025-06-15 12:34:16 -04:00
Feoramund
7524762620 mem: Poison memory for Buddy_Allocator 2025-06-15 12:34:16 -04:00
Feoramund
7e77bd425f mem: Guard against size 0 in dynamic_arena_resize_* 2025-06-15 12:34:16 -04:00
Feoramund
78a10b462f mem: Poison memory for Dynamic_Arena 2025-06-15 12:34:16 -04:00
Feoramund
de3c322899 mem: Make dynamic_arena_alloc not private
None of the other `*_alloc` procs are private, and this proc is even
referenced in public documentation comments.
2025-06-15 12:34:16 -04:00
Feoramund
652c0c997d mem: Remove bogus comments
There is no `dynamic_arena_free`; the mode is not implemented
2025-06-15 12:34:15 -04:00
Feoramund
c1e3171178 mem: Remove comment about calling panic
The behavior is codified in the comment as returning `Invalid_Pointer`.
2025-06-15 12:34:15 -04:00
Feoramund
aaeae8bc7d mem: Remove trailing whitespace 2025-06-15 12:34:15 -04:00
Feoramund
47a54dd11a mem: Panic when passing invalid pointers to small stack free/resize
This is consistent with `Stack_Allocator`.
2025-06-15 12:34:15 -04:00
Feoramund
3261896790 mem: Correct wrong error message 2025-06-15 12:34:15 -04:00
Feoramund
aa41a77fc4 mem: Check if alignment matches on Small_Stack resize 2025-06-15 12:34:15 -04:00
Feoramund
3a02918efc mem: Make small_stack_resize* free if size is 0 2025-06-15 12:34:15 -04:00
Feoramund
a4771ce1b5 mem: Clarify what happens when you free out-of-order in a Small_Stack 2025-06-15 12:34:15 -04:00
Feoramund
21a17c1ae6 mem: Replace auto_cast 2025-06-15 12:34:15 -04:00
Feoramund
8f68c46467 mem: Don't unpoison the header of a Small_Stack allocation 2025-06-15 12:34:15 -04:00
PePerRoNii
c08d9c50c8 Changed TCP_Recv_Err to Socket_Info_Err and tested on darwin_arm64 2025-06-15 12:14:59 +07:00
PePerRoNii
42aa8ac383 Implemented _socket_info_error on peer_endpoint and bound_endpoint 2025-06-15 11:17:49 +07:00