Re: statx manpage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Mar 08, 2017 at 10:26:14AM -0500, Jeff Layton wrote:
> On Wed, 2017-03-08 at 09:24 +0000, David Howells wrote:
> > Andreas Dilger <adilger@xxxxxxxxx> wrote:
> > >    To test whether a path is a regular file (for example), one could write:
> > >    .nf
> > >    .in +4n
> > >    rc = statx(AT_FDCWD, pathname, 0, STATX_TYPE, &stx);
> > >    if (stx.stx_mask & STATX_TYPE && S_ISREG(sb.stx_mode)) {
> > >       /* Handle regular file */
> > >    }
> > 
> > Good idea.
> 
> Note that & and && have similar precedence, IIRC, so you probably want
> to wrap that flag check in parenthesis.

They're actually pretty far apart.  & is priority 8 and && is priority 11.
But the fact that you thought they were similar shows that most of
us don't really know what C's operator precedence is (beyond + and *)
and we should err on the side of clarity by using the unnecessary parens.

> If the plan is to eventually (in some far away future) to deprecate
> stat(), then we probably don't want this manpage to refer to it as a
> canonical source of information. I say duplicate it here.

We haven't even deprecated select() in favour of poll() ... indeed,
pselect() was added.  I can't imagine stat() ever being deprecated.
--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux