authorgravatar for michael.dusan@gmail.comMichael Dusan <michael.dusan@gmail.com> 2023-01-02 19:18:32-05:00
committergravatar for michael.dusan@gmail.comMichael Dusan <michael.dusan@gmail.com> 2023-01-02 19:18:32-05:00
loge872c72c553992f07348a7000db821c553d267e5
treed64d2b2f7d19eb522e41893c1224fb124c500228
parent0cb8ed6b85048db849b80f8e03b5f21ed48f91ad
signaturelock-open Commit is signed but in an unrecognized format.

std.fs: add NAME_MAX for openbsd and netbsd


3 files changed, 5 insertions(+), 3 deletions(-)

lib/std/c/netbsd.zig+1
......@@ -537,6 +537,7 @@ pub const KERN = struct {
537537};
538538
539539pub const PATH_MAX = 1024;
540pub const NAME_MAX = 255;
540541pub const IOV_MAX = KERN.IOV_MAX;
541542
542543pub const STDIN_FILENO = 0;
lib/std/c/openbsd.zig+1
......@@ -417,6 +417,7 @@ pub const AI = struct {
417417};
418418
419419pub const PATH_MAX = 1024;
420pub const NAME_MAX = 255;
420421pub const IOV_MAX = 1024;
421422
422423pub const STDIN_FILENO = 0;
lib/std/fs.zig+3-3
......@@ -34,7 +34,7 @@ pub const Watch = @import("fs/watch.zig").Watch;
3434/// fit into a UTF-8 encoded array of this length.
3535/// The byte count includes room for a null sentinel byte.
3636pub const MAX_PATH_BYTES = switch (builtin.os.tag) {
37 .linux, .macos, .ios, .freebsd, .netbsd, .dragonfly, .openbsd, .haiku, .solaris => os.PATH_MAX,
37 .linux, .macos, .ios, .freebsd, .openbsd, .netbsd, .dragonfly, .haiku, .solaris => os.PATH_MAX,
3838 // Each UTF-16LE character may be expanded to 3 UTF-8 bytes.
3939 // If it would require 4 UTF-8 bytes, then there would be a surrogate
4040 // pair in the UTF-16LE, and we (over)account 3 bytes for it that way.
......@@ -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.
5656pub 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.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.