mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
std.fs: add NAME_MAX for openbsd and netbsd
This commit is contained in:
parent
0cb8ed6b85
commit
e872c72c55
@ -537,6 +537,7 @@ pub const KERN = struct {
|
||||
};
|
||||
|
||||
pub const PATH_MAX = 1024;
|
||||
pub const NAME_MAX = 255;
|
||||
pub const IOV_MAX = KERN.IOV_MAX;
|
||||
|
||||
pub const STDIN_FILENO = 0;
|
||||
|
||||
@ -417,6 +417,7 @@ pub const AI = struct {
|
||||
};
|
||||
|
||||
pub const PATH_MAX = 1024;
|
||||
pub const NAME_MAX = 255;
|
||||
pub const IOV_MAX = 1024;
|
||||
|
||||
pub const STDIN_FILENO = 0;
|
||||
|
||||
@ -34,7 +34,7 @@ pub const Watch = @import("fs/watch.zig").Watch;
|
||||
/// fit into a UTF-8 encoded array of this length.
|
||||
/// The byte count includes room for a null sentinel byte.
|
||||
pub const MAX_PATH_BYTES = switch (builtin.os.tag) {
|
||||
.linux, .macos, .ios, .freebsd, .netbsd, .dragonfly, .openbsd, .haiku, .solaris => os.PATH_MAX,
|
||||
.linux, .macos, .ios, .freebsd, .openbsd, .netbsd, .dragonfly, .haiku, .solaris => os.PATH_MAX,
|
||||
// Each UTF-16LE character may be expanded to 3 UTF-8 bytes.
|
||||
// If it would require 4 UTF-8 bytes, then there would be a surrogate
|
||||
// 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) {
|
||||
/// (depending on the platform) this assumption may not hold for every configuration.
|
||||
/// The byte count does not include a null sentinel byte.
|
||||
pub const MAX_NAME_BYTES = switch (builtin.os.tag) {
|
||||
.linux, .macos, .ios, .freebsd, .dragonfly => os.NAME_MAX,
|
||||
.linux, .macos, .ios, .freebsd, .openbsd, .netbsd, .dragonfly => os.NAME_MAX,
|
||||
// Haiku's NAME_MAX includes the null terminator, so subtract one.
|
||||
.haiku => os.NAME_MAX - 1,
|
||||
.netbsd, .openbsd, .solaris => os.MAXNAMLEN,
|
||||
.solaris => os.system.MAXNAMLEN,
|
||||
// Each UTF-16LE character may be expanded to 3 UTF-8 bytes.
|
||||
// If it would require 4 UTF-8 bytes, then there would be a surrogate
|
||||
// pair in the UTF-16LE, and we (over)account 3 bytes for it that way.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user