Re: [PATCH v2] close_range.2: Add _GNU_SOURCE and unistd.h to SYNOPSIS

Alejandro Colomar
2024-02-12T01:49:19Z

[-- Attachment #1: Type: text/plain, Size: 1451 bytes --]

Hi Mark,

On Mon, Feb 12, 2024 at 01:05:31AM +0100, Mark Wielaard wrote:
> > > .SH SYNOPSIS
> > > .nf
> > > -.B #include <linux/close_range.h>
> > > +.BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
> > > +.B #include <unistd.h>
> > > +.P
> > > +.BR "#include <linux/close_range.h>" " /* For the flags constants */"
> >
> > Could you please format the comment like other pages that do the same
> > thing? See for example membarrier(2).
>
> Sorry, you have to be more explicit what exactly you believe is not
> the same thing that other pages do. membarrier.2 doesn't need a
> _GNU_SOURCE define and I believe I used the comment as other pages
> that do.

Sure; no problem!

When we include a header not for a function but for constants, we
specify which are those constants. For example, membarrier(2) has

#include <linux/membarrier.h> /* Definition of MEMBARRIER_* constants */
#include <sys/syscall.h> /* Definition of SYS_* constants */

Here, I'd use
#include <linux/close_range.h> /* Definition of CLOSE_RANGE_* constants */

BTW, I notice that it's near the 80-column limit. We try to limit
ourselves to 79 columns, for an obscure reason. For that, we'll need to
use only 1 space before the comment (otherwise, I'd agree to use 2).

Have a lovely night!
Alex

--
<https://www.alejandro-colomar.es/>
Looking for a remote C programming job at the moment.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]