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 {...@@ -537,6 +537,7 @@ pub const KERN = struct {
537};537};
538538
539pub const PATH_MAX = 1024;539pub const PATH_MAX = 1024;
540pub const NAME_MAX = 255;
540pub const IOV_MAX = KERN.IOV_MAX;541pub const IOV_MAX = KERN.IOV_MAX;
541542
542pub const STDIN_FILENO = 0;543pub const STDIN_FILENO = 0;
lib/std/c/openbsd.zig+1
...@@ -417,6 +417,7 @@ pub const AI = struct {...@@ -417,6 +417,7 @@ pub const AI = struct {
417};417};
418418
419pub const PATH_MAX = 1024;419pub const PATH_MAX = 1024;
420pub const NAME_MAX = 255;
420pub const IOV_MAX = 1024;421pub const IOV_MAX = 1024;
421422
422pub const STDIN_FILENO = 0;423pub const STDIN_FILENO = 0;
lib/std/fs.zig+3-3
...@@ -34,7 +34,7 @@ pub const Watch = @import("fs/watch.zig").Watch;...@@ -34,7 +34,7 @@ pub const Watch = @import("fs/watch.zig").Watch;
34/// fit into a UTF-8 encoded array of this length.34/// fit into a UTF-8 encoded array of this length.
35/// The byte count includes room for a null sentinel byte.35/// The byte count includes room for a null sentinel byte.
36pub const MAX_PATH_BYTES = switch (builtin.os.tag) {36pub 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,
38 // Each UTF-16LE character may be expanded to 3 UTF-8 bytes.38 // Each UTF-16LE character may be expanded to 3 UTF-8 bytes.
39 // If it would require 4 UTF-8 bytes, then there would be a surrogate39 // If it would require 4 UTF-8 bytes, then there would be a surrogate
40 // pair in the UTF-16LE, and we (over)account 3 bytes for it that way.40 // 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) {...@@ -54,10 +54,10 @@ pub const MAX_PATH_BYTES = switch (builtin.os.tag) {
54/// (depending on the platform) this assumption may not hold for every configuration.54/// (depending on the platform) this assumption may not hold for every configuration.
55/// The byte count does not include a null sentinel byte.55/// The byte count does not include a null sentinel byte.
56pub const MAX_NAME_BYTES = switch (builtin.os.tag) {56pub 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,
58 // Haiku's NAME_MAX includes the null terminator, so subtract one.58 // Haiku's NAME_MAX includes the null terminator, so subtract one.
59 .haiku => os.NAME_MAX - 1,59 .haiku => os.NAME_MAX - 1,
60 .netbsd, .openbsd, .solaris => os.MAXNAMLEN,60 .solaris => os.system.MAXNAMLEN,
61 // Each UTF-16LE character may be expanded to 3 UTF-8 bytes.61 // Each UTF-16LE character may be expanded to 3 UTF-8 bytes.
62 // If it would require 4 UTF-8 bytes, then there would be a surrogate62 // If it would require 4 UTF-8 bytes, then there would be a surrogate
63 // pair in the UTF-16LE, and we (over)account 3 bytes for it that way.63 // pair in the UTF-16LE, and we (over)account 3 bytes for it that way.