| author | |
| committer | |
| log | 33fdc43714e34f5c4bc02c416ef4c6534acc56ca |
| tree | 9bf688f5a789727ddc8c29ec6280e0fd3f5abe96 |
| parent | e036cc48d59e5f7c025df7bbd9923a13e30c6ec9 |
Also add some NAME_MAX or equivalent definitions where necessary5 files changed, 27 insertions(+), 0 deletions(-)
lib/std/c/darwin.zig+1| ... | ... | @@ -1014,6 +1014,7 @@ pub const vm_machine_attribute_val_t = isize; |
| 1014 | 1014 | pub const CALENDAR_CLOCK = 1; |
| 1015 | 1015 | |
| 1016 | 1016 | pub const PATH_MAX = 1024; |
| 1017 | pub const NAME_MAX = 255; | |
| 1017 | 1018 | pub const IOV_MAX = 16; |
| 1018 | 1019 | |
| 1019 | 1020 | pub const STDIN_FILENO = 0; |
lib/std/c/dragonfly.zig+1| ... | ... | @@ -234,6 +234,7 @@ pub const SA = struct { |
| 234 | 234 | }; |
| 235 | 235 | |
| 236 | 236 | pub const PATH_MAX = 1024; |
| 237 | pub const NAME_MAX = 255; | |
| 237 | 238 | pub const IOV_MAX = KERN.IOV_MAX; |
| 238 | 239 | |
| 239 | 240 | pub const ino_t = c_ulong; |
lib/std/c/haiku.zig+2| ... | ... | @@ -266,6 +266,7 @@ pub const area_info = extern struct { |
| 266 | 266 | }; |
| 267 | 267 | |
| 268 | 268 | pub const MAXPATHLEN = PATH_MAX; |
| 269 | pub const MAXNAMLEN = NAME_MAX; | |
| 269 | 270 | |
| 270 | 271 | pub const image_info = extern struct { |
| 271 | 272 | id: u32, |
| ... | ... | @@ -371,6 +372,7 @@ pub const KERN = struct {}; |
| 371 | 372 | pub const IOV_MAX = 1024; |
| 372 | 373 | |
| 373 | 374 | pub const PATH_MAX = 1024; |
| 375 | pub const NAME_MAX = 256; | |
| 374 | 376 | |
| 375 | 377 | pub const STDIN_FILENO = 0; |
| 376 | 378 | pub const STDOUT_FILENO = 1; |
lib/std/fs.zig+17| ... | ... | @@ -48,6 +48,23 @@ pub const MAX_PATH_BYTES = switch (builtin.os.tag) { |
| 48 | 48 | @compileError("PATH_MAX not implemented for " ++ @tagName(builtin.os.tag)), |
| 49 | 49 | }; |
| 50 | 50 | |
| 51 | /// This represents the maximum size of a UTF-8 encoded file name component that the | |
| 52 | /// operating system will accept. All file name components returned by file system | |
| 53 | /// operations are assumed to fit into a UTF-8 encoded array of this length. | |
| 54 | /// The byte count does not include a null sentinel byte. | |
| 55 | pub const MAX_NAME_BYTES = switch (builtin.os.tag) { | |
| 56 | .linux, .macos, .ios, .freebsd, .dragonfly, .haiku => os.NAME_MAX, | |
| 57 | .netbsd, .openbsd, .solaris => os.MAXNAMLEN, | |
| 58 | // Each UTF-16LE character may be expanded to 3 UTF-8 bytes. | |
| 59 | // If it would require 4 UTF-8 bytes, then there would be a surrogate | |
| 60 | // pair in the UTF-16LE, and we (over)account 3 bytes for it that way. | |
| 61 | .windows => os.NAME_MAX * 3, | |
| 62 | else => if (@hasDecl(root, "os") and @hasDecl(root.os, "NAME_MAX")) | |
| 63 | root.os.NAME_MAX | |
| 64 | else | |
| 65 | @compileError("NAME_MAX not implemented for " ++ @tagName(builtin.os.tag)), | |
| 66 | }; | |
| 67 | ||
| 51 | 68 | pub const base64_alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".*; |
| 52 | 69 | |
| 53 | 70 | /// Base64 encoder, replacing the standard `+/` with `-_` so that it can be used in a file name on any filesystem. |
lib/std/os/windows.zig+6| ... | ... | @@ -2977,6 +2977,12 @@ pub const PMEMORY_BASIC_INFORMATION = *MEMORY_BASIC_INFORMATION; |
| 2977 | 2977 | /// from https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file#maximum-path-length-limitation |
| 2978 | 2978 | pub const PATH_MAX_WIDE = 32767; |
| 2979 | 2979 | |
| 2980 | /// > [Each file name component can be] up to the value returned in the | |
| 2981 | /// > lpMaximumComponentLength parameter of the GetVolumeInformation function | |
| 2982 | /// > (this value is commonly 255 characters) | |
| 2983 | /// from https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation | |
| 2984 | pub const NAME_MAX = 255; | |
| 2985 | ||
| 2980 | 2986 | pub const FORMAT_MESSAGE_ALLOCATE_BUFFER = 0x00000100; |
| 2981 | 2987 | pub const FORMAT_MESSAGE_ARGUMENT_ARRAY = 0x00002000; |
| 2982 | 2988 | pub const FORMAT_MESSAGE_FROM_HMODULE = 0x00000800; |