Skip to content

Commit 583376b

Browse files
committed
std.fs: assign os.NAME_MAX to fs.MAX_NAME_BYTES
- openbsd, netbsd
1 parent 31af4b7 commit 583376b

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

lib/std/c/netbsd.zig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,7 @@ pub const KERN = struct {
537537
};
538538

539539
pub const PATH_MAX = 1024;
540+
pub const NAME_MAX = 255;
540541
pub const IOV_MAX = KERN.IOV_MAX;
541542

542543
pub const STDIN_FILENO = 0;

lib/std/c/openbsd.zig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,7 @@ pub const AI = struct {
417417
};
418418

419419
pub const PATH_MAX = 1024;
420+
pub const NAME_MAX = 255;
420421
pub const IOV_MAX = 1024;
421422

422423
pub const STDIN_FILENO = 0;

lib/std/fs.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ pub const MAX_PATH_BYTES = switch (builtin.os.tag) {
5454
/// (depending on the platform) this assumption may not hold for every configuration.
5555
/// The byte count does not include a null sentinel byte.
5656
pub const MAX_NAME_BYTES = switch (builtin.os.tag) {
57-
.linux, .macos, .ios, .freebsd, .dragonfly => os.NAME_MAX,
57+
.linux, .macos, .ios, .freebsd, .openbsd, .netbsd, .dragonfly => os.NAME_MAX,
5858
// Haiku's NAME_MAX includes the null terminator, so subtract one.
5959
.haiku => os.NAME_MAX - 1,
60-
.netbsd, .openbsd, .solaris => os.system.MAXNAMLEN,
60+
.solaris => os.system.MAXNAMLEN,
6161
// Each UTF-16LE character may be expanded to 3 UTF-8 bytes.
6262
// If it would require 4 UTF-8 bytes, then there would be a surrogate
6363
// pair in the UTF-16LE, and we (over)account 3 bytes for it that way.

0 commit comments

Comments
 (0)