why are some stat.h "S_*" perm macros not exported via uapi?
valdis.kletnieks at vt.edu
valdis.kletnieks at vt.edu
Mon Dec 31 19:44:47 EST 2018
On Mon, 31 Dec 2018 14:53:30 -0500, "Robert P. J. Day" said:
> #define S_IRWXUGO (S_IRWXU|S_IRWXG|S_IRWXO)
> #define S_IALLUGO (S_ISUID|S_ISGID|S_ISVTX|S_IRWXUGO)
> #define S_IRUGO (S_IRUSR|S_IRGRP|S_IROTH)
> #define S_IWUGO (S_IWUSR|S_IWGRP|S_IWOTH)
> #define S_IXUGO (S_IXUSR|S_IXGRP|S_IXOTH)
Can you give an actual non-contrived example of code where one of these would
be preferable to inline coding the mask? And do you plan to include all the
various combos? And why should that be done in the uapi headers, rather than
glibc/musl/other_c_lib providing it?
I'll go out on a limb and say that most programmers would have an easier time
mentally parsing the octal constant 0660 than
((S_IRUGO | S_IWUGO) & ~(S_IXUSR | S_IXGRP | S_IRWXO ))
(Damn, that's ugly. The sort of thing where I've been hacking C code since
1984, and I'm *still* looking at it and going "Did I get that right, or did I
just screw the pooch?"....
More information about the Kernelnewbies
mailing list