Linux-man Archive mirror
 help / color / mirror / Atom feed
From: Mark Wielaard <mark@klomp.org>
To: Alejandro Colomar <alx@kernel.org>
Cc: linux-man@vger.kernel.org, "Alexandra Hájková" <ahajkova@redhat.com>
Subject: Re: [PATCH] close_range.2: Add _GNU_SOURCE and unistd.h to SYNOPSIS
Date: Sun, 11 Feb 2024 22:24:50 +0100	[thread overview]
Message-ID: <20240211212450.GE21691@gnu.wildebeest.org> (raw)
In-Reply-To: <ZckW2Kpxove_AcyG@debian>

Hi Alejandro,

On Sun, Feb 11, 2024 at 07:49:53PM +0100, Alejandro Colomar wrote:
> It seems this page was written when there was still no wrapper in libc.
> 
> But I see that Michael and I did mention there's now a wrapper in glibc:
> [...] 
> Both of those commits forgot to update the SYNOPSIS.  So, please add the
> following tags to your commit message:
> 
> Fixes: 71a62d6c3c56 ("close_range.2: Glibc added a wrapper recently")
> Fixes: c2356ba085ed ("close_range.2: Glibc 2.34 has added a close_range() wrapper")

I missed thos, will add the Fixes: to v2.

> >  .P
> >  .BI "int close_range(unsigned int " first ", unsigned int " last ,
> >  .BI "                unsigned int " flags );
> 
> And I notice the glibc wrapper is slightly different from the Linux
> kernel system call:
> 
> 	$ grepc close_range /usr/include/
> 	/usr/include/unistd.h:extern int close_range (unsigned int __fd, unsigned int __max_fd,
> 				int __flags) __THROW;
> 
> 
> 	$ grepc -tfl close_range ~/src/linux/linux/master/
> 	/home/alx/src/linux/linux/master/include/linux/syscalls.h:asmlinkage long sys_close_range(unsigned int fd, unsigned int max_fd,
> 					unsigned int flags);
> 	/home/alx/src/linux/linux/master/fs/open.c:SYSCALL_DEFINE3(close_range, unsigned int, fd, unsigned int, max_fd,
> 			unsigned int, flags)
> 	{
> 		return __close_range(fd, max_fd, flags);
> 	}
> 
> The third parameter is an 'int' in glibc.  Please also update that.

Will do. I see freebsd also uses int for flags.

I also noted just now that the example code still uses
syscall(SYS_close_range, 3, ~0U, 0)
even though it defines _GNU_SOURCE and includes unistd.h.
Will also fix that for v2.

Cheers,

Mark

      reply	other threads:[~2024-02-11 21:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-07 10:17 [PATCH] close_range.2: Add _GNU_SOURCE and unistd.h to SYNOPSIS Mark Wielaard
2024-02-11 18:49 ` Alejandro Colomar
2024-02-11 21:24   ` Mark Wielaard [this message]

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=20240211212450.GE21691@gnu.wildebeest.org \
    --to=mark@klomp.org \
    --cc=ahajkova@redhat.com \
    --cc=alx@kernel.org \
    --cc=linux-man@vger.kernel.org \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).