Re: why are some stat.h "S_*" perm macros not exported via uapi?
On Mon, 31 Dec 2018, valdis.kletni...@vt.edu wrote: > 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? ... snip ... i am not *defending* the above macros, simply pointing out that, unlike all the other simpler macros that *are* exported via uapi, these are left all by their lonesome in kernel space. i'm just wondering if there's a reason for that. rday -- Robert P. J. Day Ottawa, Ontario, CANADA http://crashcourse.ca/dokuwiki Twitter: http://twitter.com/rpjday LinkedIn: http://ca.linkedin.com/in/rpjday ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: why are some stat.h "S_*" perm macros not exported via uapi?
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?" ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
why are some stat.h "S_*" perm macros not exported via uapi?
more pedantry ... just noticed this snippet in include/linux/stat.h: ... #include #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) ... given that all of the other S_ perm macros are exported in include/uapi/linux/stat.h, as in: #define S_IRWXU 00700 #define S_IRUSR 00400 #define S_IWUSR 00200 #define S_IXUSR 00100 #define S_IRWXG 00070 #define S_IRGRP 00040 #define S_IWGRP 00020 #define S_IXGRP 00010 and so on, is there a reason those few combination perm macros are not exported as well? or is the userspace stat.h so well-defined at this point that cosmetic changes like this are frowned upon? rday -- Robert P. J. Day Ottawa, Ontario, CANADA http://crashcourse.ca/dokuwiki Twitter: http://twitter.com/rpjday LinkedIn: http://ca.linkedin.com/in/rpjday ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies