commit 2037dba90f5815f6fc3137c2485e908700c009e5 (tree)
parent fdf19984b8af9781cd68dda3fcbcc44ac8ade80e
Author: Nathan Bourgeois <iridescentrosesfall@gmail.com>
Date: Sat, 21 Mar 2026 03:23:11 -0400
std.posix: Minimal set to build an Io on PSP
Diffstat:
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/lib/std/Io/Dir.zig b/lib/std/Io/Dir.zig
@@ -52,7 +52,7 @@ pub const max_path_bytes = switch (native_os) {
/// On WASI, file name components are encoded as valid UTF-8.
/// On other platforms, `[]u8` components are an opaque sequence of bytes with no particular encoding.
pub const max_name_bytes = switch (native_os) {
- .linux, .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos, .freebsd, .openbsd, .netbsd, .dragonfly, .illumos, .serenity => std.posix.NAME_MAX,
+ .linux, .driverkit, .ios, .maccatalyst, .macos, .tvos, .visionos, .watchos, .freebsd, .openbsd, .netbsd, .dragonfly, .illumos, .serenity, .psp => std.posix.NAME_MAX,
// Haiku's NAME_MAX includes the null terminator, so subtract one.
.haiku => std.posix.NAME_MAX - 1,
// Each WTF-16LE character may be expanded to 3 WTF-8 bytes.
diff --git a/lib/std/posix.zig b/lib/std/posix.zig
@@ -38,6 +38,22 @@ pub const system = if (use_libc)
else switch (native_os) {
.linux => linux,
.plan9 => std.os.plan9,
+ .psp => struct {
+ pub const fd_t = i32;
+ pub const pid_t = void;
+ pub const pollfd = void;
+ pub const uid_t = void;
+ pub const gid_t = void;
+ pub const mode_t = u32;
+ pub const nlink_t = u32;
+ pub const blksize_t = u32;
+ pub const ino_t = u64;
+ pub const IFNAMESIZE = {};
+ pub const SIG = void;
+
+ // https://github.com/pspdev/newlib/blob/9e0a073634ad73e8e088f2e071c55a9fe5d39709/newlib/libc/sys/psp/sys/dirent.h#L19
+ pub const NAME_MAX = 255;
+ },
else => struct {
pub const pid_t = void;
pub const pollfd = void;