module

Krikri::PluginHelpers::StatFields

StatFields - pure logic for turning a raw POSIX stat/lstat result into the stat-shaped JSON hash both the stat and find plugins return (find's per-match dicts are documented as "see stat module for full output of each dictionary", verified against real ansible-playbook). No I/O here - the plugin itself calls LibC.stat/LibC.lstat, resolves pw_name/gr_name via System::User/System::Group, and merges in readable/writeable/ executable/checksum/lnk_* (each needs its own syscall/read the plugin makes itself).

Class methods

perm_octal(mode : Int32) : String

Matches GNU stat -c '%a': the type bits are stripped and the special (setuid/setgid/sticky) digit is only included when non-zero (e.g. 0o100644 -> "644", 0o104755 -> "4755"). Also used by file.cr to compare a freshly-lstat'd mode against a requested numeric mode: parameter without shelling to stat.

Source
regular_file?(mode : Int32) : Bool
Source