authorgravatar for mneumann@ntecs.deMichael Neumann <mneumann@ntecs.de> 2025-09-27 09:53:47+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-09-28 08:18:31+02:00
log8b5e4e032be23c945fb8d96e15249b3b29b51de1
tree0d700b1473b538ac9ffb417e14e84a0256370488
parent6b1d94c5394e7e41389cb1cfef4f915965be1cb3
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

lib/std/c: sync "struct stat" for DragonFly

* Add missing functions like ISDIR() or ISREG(). This is required to build the zig compiler * Use octal notation for the S_ constants. This is how it is done for ".freebsd" and it is also the notation used by DragonFly in "sys/stat.h" * Reorder S_ constants in the same order as ".freebsd" does. Again, this follows the ordering within "sys/stat.h"

1 files changed, 55 insertions(+), 25 deletions(-)

lib/std/c.zig+55-25
...@@ -2235,40 +2235,70 @@ pub const S = switch (native_os) {...@@ -2235,40 +2235,70 @@ pub const S = switch (native_os) {
2235 }2235 }
2236 },2236 },
2237 .dragonfly => struct {2237 .dragonfly => struct {
2238 pub const IFMT = 0o170000;
2239
2240 pub const IFIFO = 0o010000;
2241 pub const IFCHR = 0o020000;
2242 pub const IFDIR = 0o040000;
2243 pub const IFBLK = 0o060000;
2244 pub const IFREG = 0o100000;
2245 pub const IFLNK = 0o120000;
2246 pub const IFSOCK = 0o140000;
2247 pub const IFWHT = 0o160000;
2248
2249 pub const ISUID = 0o4000;
2250 pub const ISGID = 0o2000;
2251 pub const ISVTX = 0o1000;
2252 pub const IRWXU = 0o700;
2253 pub const IRUSR = 0o400;
2254 pub const IWUSR = 0o200;
2255 pub const IXUSR = 0o100;
2256 pub const IRWXG = 0o070;
2257 pub const IRGRP = 0o040;
2258 pub const IWGRP = 0o020;
2259 pub const IXGRP = 0o010;
2260 pub const IRWXO = 0o007;
2261 pub const IROTH = 0o004;
2262 pub const IWOTH = 0o002;
2263 pub const IXOTH = 0o001;
2264
2238 pub const IREAD = IRUSR;2265 pub const IREAD = IRUSR;
2239 pub const IEXEC = IXUSR;2266 pub const IEXEC = IXUSR;
2240 pub const IWRITE = IWUSR;2267 pub const IWRITE = IWUSR;
2241 pub const IXOTH = 1;
2242 pub const IWOTH = 2;
2243 pub const IROTH = 4;
2244 pub const IRWXO = 7;
2245 pub const IXGRP = 8;
2246 pub const IWGRP = 16;
2247 pub const IRGRP = 32;
2248 pub const IRWXG = 56;
2249 pub const IXUSR = 64;
2250 pub const IWUSR = 128;
2251 pub const IRUSR = 256;
2252 pub const IRWXU = 448;
2253 pub const ISTXT = 512;2268 pub const ISTXT = 512;
2254 pub const BLKSIZE = 512;2269 pub const BLKSIZE = 512;
2255 pub const ISVTX = 512;2270
2256 pub const ISGID = 1024;2271 pub fn ISFIFO(m: u32) bool {
2257 pub const ISUID = 2048;2272 return m & IFMT == IFIFO;
2258 pub const IFIFO = 4096;2273 }
2259 pub const IFCHR = 8192;
2260 pub const IFDIR = 16384;
2261 pub const IFBLK = 24576;
2262 pub const IFREG = 32768;
2263 pub const IFDB = 36864;
2264 pub const IFLNK = 40960;
2265 pub const IFSOCK = 49152;
2266 pub const IFWHT = 57344;
2267 pub const IFMT = 61440;
22682274
2269 pub fn ISCHR(m: u32) bool {2275 pub fn ISCHR(m: u32) bool {
2270 return m & IFMT == IFCHR;2276 return m & IFMT == IFCHR;
2271 }2277 }
2278
2279 pub fn ISDIR(m: u32) bool {
2280 return m & IFMT == IFDIR;
2281 }
2282
2283 pub fn ISBLK(m: u32) bool {
2284 return m & IFMT == IFBLK;
2285 }
2286
2287 pub fn ISREG(m: u32) bool {
2288 return m & IFMT == IFREG;
2289 }
2290
2291 pub fn ISLNK(m: u32) bool {
2292 return m & IFMT == IFLNK;
2293 }
2294
2295 pub fn ISSOCK(m: u32) bool {
2296 return m & IFMT == IFSOCK;
2297 }
2298
2299 pub fn IWHT(m: u32) bool {
2300 return m & IFMT == IFWHT;
2301 }
2272 },2302 },
2273 .haiku => struct {2303 .haiku => struct {
2274 pub const IFMT = 0o170000;2304 pub const IFMT = 0o170000;