From 426c13dddfa9e19cf505fc26561d2a8637165d64 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Thu, 2 Mar 2023 18:56:43 -0700 Subject: [PATCH] add doc comments to std.fs.File.default_mode --- lib/std/fs/file.zig | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/std/fs/file.zig b/lib/std/fs/file.zig index 1ba4bc18fd..bf93a61239 100644 --- a/lib/std/fs/file.zig +++ b/lib/std/fs/file.zig @@ -48,6 +48,12 @@ pub const File = struct { Unknown, }; + /// This is the default mode given to POSIX operating systems for creating + /// files. `0o666` is "-rw-rw-rw-" which is counter-intuitive at first, + /// since most people would expect "-rw-r--r--", for example, when using + /// the `touch` command, which would correspond to `0o644`. However, POSIX + /// libc implementations use `0o666` inside `fopen` and then rely on the + /// process-scoped "umask" setting to adjust this number for file creation. pub const default_mode = switch (builtin.os.tag) { .windows => 0, .wasi => 0,