From: valdis.kletnieks@vt.edu
To: "Robert P. J. Day" <rpjday@crashcourse.ca>
Cc: Kernel Newbies <kernelnewbies@kernelnewbies.org>
Subject: Re: why are some stat.h "S_*" perm macros not exported via uapi?
Date: Mon, 31 Dec 2018 19:44:47 -0500 [thread overview]
Message-ID: <9205.1546303487@turing-police.cc.vt.edu> (raw)
In-Reply-To: <alpine.LFD.2.21.1812310748490.17667@localhost.localdomain>
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
next prev parent reply other threads:[~2019-01-01 0:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-31 19:53 why are some stat.h "S_*" perm macros not exported via uapi? Robert P. J. Day
2019-01-01 0:44 ` valdis.kletnieks [this message]
2019-01-01 9:41 ` Robert P. J. Day
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9205.1546303487@turing-police.cc.vt.edu \
--to=valdis.kletnieks@vt.edu \
--cc=kernelnewbies@kernelnewbies.org \
--cc=rpjday@crashcourse.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).