190 Commits

Author SHA1 Message Date
Andrew Kelley
774df26835 WIP: hack at std.Io on a plane 2025-10-29 06:20:48 -07:00
Andrew Kelley
00f26cb0a4 WIP land the std.Io interface
fix std lib compilation errors caused by introducing std.Io
2025-10-29 06:20:48 -07:00
Andrew Kelley
5469db66e4 std.Thread.ResetEvent: make it more reusable 2025-10-29 06:20:48 -07:00
Andrew Kelley
f762597724 std.Io: add asyncConcurrent and asyncParallel 2025-10-29 06:20:48 -07:00
Alex Rønne Petersen
dba1bf9353 remove all Oracle Solaris support
There is no straightforward way for the Zig team to access the Solaris system
headers; to do this, one has to create an Oracle account, accept their EULA to
download the installer ISO, and finally install it on a machine or VM. We do not
have to jump through hoops like this for any other OS that we support, and no
one on the team has expressed willingness to do it.

As a result, we cannot audit any Solaris contributions to std.c or other
similarly sensitive parts of the standard library. The best we would be able to
do is assume that Solaris and illumos are 100% compatible with no way to verify
that assumption. But at that point, the solaris and illumos OS tags would be
functionally identical anyway.

For Solaris especially, any contributions that involve APIs introduced after the
OS was made closed-source would also be inherently more risky than equivalent
contributions for other proprietary OSs due to the case of Google LLC v. Oracle
America, Inc., wherein Oracle clearly demonstrated its willingness to pursue
legal action against entities that merely copy API declarations.

Finally, Oracle laid off most of the Solaris team in 2017; the OS has been in
maintenance mode since, presumably to be retired completely sometime in the 2030s.

For these reasons, this commit removes all Oracle Solaris support.

Anyone who still wishes to use Zig on Solaris can try their luck by simply using
illumos instead of solaris in target triples - chances are it'll work. But there
will be no effort from the Zig team to support this use case; we recommend that
people move to illumos instead.
2025-10-27 07:35:38 -07:00
Alex Rønne Petersen
493889d5eb
std.Thread: implement freeAndExit() for sh-linux 2025-10-23 09:27:17 +02:00
Alex Rønne Petersen
3777d3c25b
std.Thread: implement freeAndExit() for microblaze-linux 2025-10-23 09:27:17 +02:00
Alex Rønne Petersen
f6c06d7069
std.Thread: implement freeAndExit() for hppa-linux 2025-10-23 09:27:17 +02:00
Alex Rønne Petersen
de87c856e7
std.Thread: implement freeAndExit() for alpha-linux 2025-10-23 09:27:17 +02:00
Alex Rønne Petersen
3d1b7811d4
std.Thread: implement freeAndExit() for m68k-linux 2025-10-23 09:27:17 +02:00
Alex Rønne Petersen
328b121240
Merge pull request #25627 from alexrp/qemu-10.1.1-patched
`ci`: switch to patched QEMU 10.1.1.1
2025-10-19 11:50:23 +02:00
Alex Rønne Petersen
5e57ed9fda
std.Thread: implement freeAndExit() for or1k 2025-10-18 22:27:35 +02:00
Alex Rønne Petersen
653a191965
Revert "std.Thread: disable test on armeb in addition to thumbeb"
This reverts commit a73f246b2963de0024b9b7070448862e855d5a04.
2025-10-18 20:50:19 +02:00
Alex Rønne Petersen
adcfdce6be
std.Thread: fix some issues in x86_64/x32 inline asm
Wrong syscall on x32; return exit code 0 instead of 1 on both.

ref https://github.com/ziglang/zig/issues/22189
2025-10-18 11:36:26 +02:00
Alex Rønne Petersen
e59f2995a5
std.Thread: fix inline asm for mipsn32
This was using the mips64 syscalls.

ref https://github.com/ziglang/zig/issues/22189
2025-10-18 11:36:02 +02:00
usebeforefree
62e3d46287 replaced https://simonsapin.github.io/wtf-8/ with https://wtf-8.codeberg.page/ 2025-10-10 23:53:00 +02:00
mlugg
202aeacc05
std: fixes 2025-09-30 13:44:51 +01:00
Alex Rønne Petersen
a73f246b29
std.Thread: disable test on armeb in addition to thumbeb
Same falky failure on both. See ed7ff0b693037078f451a7c6c1124611060f4892.
2025-09-25 17:49:47 +02:00
Andrew Kelley
ed7ff0b693 allow some test cases to regress
tracked by #24061 - these should be re-enabled once that is solved.
2025-09-20 18:33:01 -07:00
Pat Tullmann
0edccc1079 Move some Thread tests out of posix/test.zig into Thread.zig
These tests aren't (directly) using Posix APIs, so they don't need to be
in posix/test.zig.  Put them over with the code and tests in Thread.zig.
Since the spawn/join test in the posix code was redundant, just dropped
that one.
2025-09-09 22:06:20 -07:00
Andrew Kelley
b7104231af
Merge pull request #25077 from ziglang/GenericReader
std.Io: delete GenericReader, AnyReader, FixedBufferStream; and related API breakage
2025-08-30 12:43:52 -07:00
Andrew Kelley
9a0970a12b rework std.Io.Writer.Allocating to support runtime-known alignment
Also, breaking API changes to:
* std.fs.Dir.readFileAlloc
* std.fs.Dir.readFileAllocOptions
2025-08-30 00:48:50 -07:00
Alex Rønne Petersen
367be3777c
std.Thread: make unreachable errors in sleep() clearer 2025-08-30 06:36:41 +02:00
Andrew Kelley
79f267f6b9 std.Io: delete GenericReader
and delete deprecated alias std.io
2025-08-29 17:14:26 -07:00
Andrew Kelley
9860dd475a std: delete most remaining uses of GenericWriter 2025-08-28 18:30:57 -07:00
Sardorbek Imomaliev
01b5023868
drop NameTooLong from sysctlbynameZ error set (#24909) 2025-08-21 12:36:57 +02:00
Andrew Kelley
f97c91ddb5 std.Thread: don't spin 2025-07-21 05:37:51 +02:00
Andrew Kelley
76d04c1662 zig fmt 2025-07-16 10:27:39 -07:00
Carmen
5b4e982169
std.os.uefi.tables: ziggify boot and runtime services (#23441)
* std.os.uefi.tables: ziggify boot and runtime services

* avoid T{} syntax

Co-authored-by: linusg <mail@linusgroh.de>

* misc fixes

* work

* self-review quickfixes

* dont make MemoryMapSlice generic

* more review fixes, work

* more work

* more work

* review fixes

* update boot/runtime services references throughout codebase

* self-review fixes

* couple of fixes i forgot to commit earlier

* fixes from integrating in my own project

* fixes from refAllDeclsRecursive

* Apply suggestions from code review

Co-authored-by: truemedian <truemedian@gmail.com>

* more fixes from review

* fixes from project integration

* make natural alignment of Guid align-8

* EventRegistration is a new opaque type

* fix getNextHighMonotonicCount

* fix locateProtocol

* fix exit

* partly revert 7372d65

* oops exit data_len is num of bytes

* fixes from project integration

* MapInfo consistency, MemoryType update per review

* turn EventRegistration back into a pointer

* forgot to finish updating MemoryType methods

* fix IntFittingRange calls

* set uefi.Page nat alignment

* Back out "set uefi.Page nat alignment"

This backs out commit cdd9bd6f7f5fb763f994b8fbe3e1a1c2996a2393.

* get rid of some error.NotFound-s

* fix .exit call in panic

* review comments, add format method

* fix resetSystem data alignment

* oops, didnt do a final refAllDeclsRecursive i guess

* review comments

* writergate update MemoryType.format

* fix rename

---------

Co-authored-by: linusg <mail@linusgroh.de>
Co-authored-by: truemedian <truemedian@gmail.com>
2025-07-12 17:18:53 +00:00
Andrew Kelley
0e37ff0d59 std.fmt: breaking API changes
added adapter to AnyWriter and GenericWriter to help bridge the gap
between old and new API

make std.testing.expectFmt work at compile-time

std.fmt no longer has a dependency on std.unicode. Formatted printing
was never properly unicode-aware. Now it no longer pretends to be.

Breakage/deprecations:
* std.fs.File.reader -> std.fs.File.deprecatedReader
* std.fs.File.writer -> std.fs.File.deprecatedWriter
* std.io.GenericReader -> std.io.Reader
* std.io.GenericWriter -> std.io.Writer
* std.io.AnyReader -> std.io.Reader
* std.io.AnyWriter -> std.io.Writer
* std.fmt.format -> std.fmt.deprecatedFormat
* std.fmt.fmtSliceEscapeLower -> std.ascii.hexEscape
* std.fmt.fmtSliceEscapeUpper -> std.ascii.hexEscape
* std.fmt.fmtSliceHexLower -> {x}
* std.fmt.fmtSliceHexUpper -> {X}
* std.fmt.fmtIntSizeDec -> {B}
* std.fmt.fmtIntSizeBin -> {Bi}
* std.fmt.fmtDuration -> {D}
* std.fmt.fmtDurationSigned -> {D}
* {} -> {f} when there is a format method
* format method signature
  - anytype -> *std.io.Writer
  - inferred error set -> error{WriteFailed}
  - options -> (deleted)
* std.fmt.Formatted
  - now takes context type explicitly
  - no fmt string
2025-07-07 22:43:51 -07:00
Pat Tullmann
cfe5defd02 linux: futex v1 API cleanup
* Use `packed struct` for flags arguments.  So, instead of
  `linux.FUTEX.WAIT` use `.{ .cmd = .WAIT, .private = true }`

* rename `futex_wait` and `futex_wake` which didn't actually specify
  wait/wake, as `futex_3arg` and `futex_4arg` (as its the number
  of parameters that is different, the `op` is whatever is specified.

* expose the full six-arg flavor of the syscall (for some of the advanced
  ops), and add packed structs for their arguments.

* Use a `packed union` to support the 4th parameter which is sometimes a
  `timespec` pointer, and sometimes a `u32`.

* Add tests that make sure the structure layout is correct and that the
  basic argument passing is working (no actual futexes are contended).
2025-06-17 22:06:39 -07:00
Linus Groh
f660675467 std: Add support for SerenityOS in various places
Not nearly the entire downstream patchset but these are completely
uncontroversial and known to work.
2025-03-11 14:59:42 +00:00
Alec Fessler
1cc388d526 stdlib: handle EEXIST in mmap with FIXED_NOREPLACE. Fixes #21475 2025-02-24 04:36:14 -05:00
Alex Rønne Petersen
481b7bf3f0
std.Target: Remove functions that just wrap component functions.
Functions like isMinGW() and isGnuLibC() have a good reason to exist: They look
at multiple components of the target. But functions like isWasm(), isDarwin(),
isGnu(), etc only exist to save 4-8 characters. I don't think this is a good
enough reason to keep them, especially given that:

* It's not immediately obvious to a reader whether target.isDarwin() means the
  same thing as target.os.tag.isDarwin() precisely because isMinGW() and similar
  functions *do* look at multiple components.
* It's not clear where we would draw the line. The logical conclusion before
  this commit would be to also wrap Arch.isX86(), Os.Tag.isSolarish(),
  Abi.isOpenHarmony(), etc... this obviously quickly gets out of hand.
* It's nice to just have a single correct way of doing something.
2025-02-17 19:18:19 +01:00
Andrew Kelley
284de7d957 adjust runtime page size APIs
* fix merge conflicts
* rename the declarations
* reword documentation
* extract FixedBufferAllocator to separate file
* take advantage of locals
* remove the assertion about max alignment in Allocator API, leaving it
  Allocator implementation defined
* fix non-inline function call in start logic

The GeneralPurposeAllocator implementation is totally broken because it
uses global state but I didn't address that in this commit.
2025-02-06 14:23:23 -08:00
Archbirdplus
439667be04 runtime page size detection
heap.zig: define new default page sizes
heap.zig: add min/max_page_size and their options
lib/std/c: add miscellaneous declarations
heap.zig: add pageSize() and its options
switch to new page sizes, especially in GPA/stdlib
mem.zig: remove page_size
2025-02-06 14:23:23 -08:00
Alex Rønne Petersen
db8ed730e7 std.Thread: Fix wasi_thread_start() export to use a pointer.
Closes #22518.
2025-01-19 03:23:00 +01:00
Jacob Young
8c8dfb35f3 x86_64: fix crashes compiling the compiler and tests 2025-01-16 20:47:30 -05:00
Andrew Kelley
70414c1f43 std.Thread: don't export wasi_thread_start in single-threaded mode 2025-01-15 15:11:35 -08:00
Alex Rønne Petersen
5a6cc552e3
std.os.windows: Fix some incorrect callconv specifiers.
Closes #21869.
2024-11-02 10:44:18 +01:00
JonathanHallstrom
5ce17ecfa7 remove unnecessary cast 2024-10-29 01:48:13 +01:00
Alex Rønne Petersen
95674fca0c
std.Thread: Use loongarch freeAndExit() implementation for loongarch32 too. 2024-10-16 01:10:36 +02:00
Andrew Kelley
04e694ad11 move std.time.sleep to std.Thread.sleep 2024-09-26 12:35:14 -07:00
Alex Rønne Petersen
af04404b49 std: Fix assembler comment syntax for sparc. 2024-09-07 13:16:22 -07:00
mlugg
0fe3fd01dd
std: update std.builtin.Type fields to follow naming conventions
The compiler actually doesn't need any functional changes for this: Sema
does reification based on the tag indices of `std.builtin.Type` already!
So, no zig1.wasm update is necessary.

This change is necessary to disallow name clashes between fields and
decls on a type, which is a prerequisite of #9938.
2024-08-28 08:39:59 +01:00
Alex Rønne Petersen
f0d6a211e0 std.Thread: Implement freeAndExit() for hexagon. 2024-08-19 08:38:05 +02:00
Alex Rønne Petersen
8e4feca8ab std.Thread: Implement freeAndExit() for s390x. 2024-08-19 08:38:05 +02:00
Alex Rønne Petersen
0f78f8244f std.Thread: Use zero exit code in freeAndExit() for sparc64. 2024-08-19 08:38:05 +02:00
Alex Rønne Petersen
d79e2822b0 std.Thread: Implement freeAndExit() for sparc32. 2024-08-19 08:38:05 +02:00
Alex Rønne Petersen
dc77d1b66d std.Thread: Merge riscv32/riscv64 assembly in freeAndExit(). 2024-08-13 23:53:57 -07:00