public inbox for linux-man@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] io_setup.2: SYNOPSIS: return long
@ 2020-11-01 13:59 Alejandro Colomar
  2020-11-02  7:37 ` Michael Kerrisk (man-pages)
  2020-11-13  9:24 ` Michael Kerrisk (man-pages)
  0 siblings, 2 replies; 8+ messages in thread
From: Alejandro Colomar @ 2020-11-01 13:59 UTC (permalink / raw)
  To: mtk.manpages; +Cc: Alejandro Colomar, linux-man

The Linux kernel uses a long as the return type for this syscall.
As glibc provides no wrapper, use the same types the kernel uses.

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
---

Hi Michael,

Please apply this patch after "s/io_contexxt_t/aio_context_t/".

Cheers,

Alex

 man2/io_setup.2 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/man2/io_setup.2 b/man2/io_setup.2
index f9860fda5..1a89de220 100644
--- a/man2/io_setup.2
+++ b/man2/io_setup.2
@@ -11,7 +11,7 @@ io_setup \- create an asynchronous I/O context
 .nf
 .BR "#include <linux/aio_abi.h>" "          /* Defines needed types */"
 .PP
-.BI "int io_setup(unsigned " nr_events ", aio_context_t *" ctx_idp );
+.BI "long io_setup(unsigned " nr_events ", aio_context_t *" ctx_idp );
 .fi
 .PP
 .IR Note :
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] io_setup.2: SYNOPSIS: return long
  2020-11-01 13:59 [PATCH] io_setup.2: SYNOPSIS: return long Alejandro Colomar
@ 2020-11-02  7:37 ` Michael Kerrisk (man-pages)
  2020-11-02 12:20   ` Alejandro Colomar
  2020-11-13  9:24 ` Michael Kerrisk (man-pages)
  1 sibling, 1 reply; 8+ messages in thread
From: Michael Kerrisk (man-pages) @ 2020-11-02  7:37 UTC (permalink / raw)
  To: Alejandro Colomar; +Cc: mtk.manpages, linux-man

Hi Alex,



On 11/1/20 2:59 PM, Alejandro Colomar wrote:
> The Linux kernel uses a long as the return type for this syscall.
> As glibc provides no wrapper, use the same types the kernel uses.

I think we need this patch for all of the io* pages, right?

Thanks,

Michael

> Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
> ---
> 
> Hi Michael,
> 
> Please apply this patch after "s/io_contexxt_t/aio_context_t/".
> 
> Cheers,
> 
> Alex
> 
>  man2/io_setup.2 | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/man2/io_setup.2 b/man2/io_setup.2
> index f9860fda5..1a89de220 100644
> --- a/man2/io_setup.2
> +++ b/man2/io_setup.2
> @@ -11,7 +11,7 @@ io_setup \- create an asynchronous I/O context
>  .nf
>  .BR "#include <linux/aio_abi.h>" "          /* Defines needed types */"
>  .PP
> -.BI "int io_setup(unsigned " nr_events ", aio_context_t *" ctx_idp );
> +.BI "long io_setup(unsigned " nr_events ", aio_context_t *" ctx_idp );
>  .fi
>  .PP
>  .IR Note :
> 


-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] io_setup.2: SYNOPSIS: return long
  2020-11-02  7:37 ` Michael Kerrisk (man-pages)
@ 2020-11-02 12:20   ` Alejandro Colomar
  2020-11-02 13:09     ` Michael Kerrisk (man-pages)
  0 siblings, 1 reply; 8+ messages in thread
From: Alejandro Colomar @ 2020-11-02 12:20 UTC (permalink / raw)
  To: Michael Kerrisk (man-pages); +Cc: linux-man

On 2020-11-02 08:37, Michael Kerrisk (man-pages) wrote:
 > Hi Alex,
 >
 > On 11/1/20 2:59 PM, Alejandro Colomar wrote:
 >> The Linux kernel uses a long as the return type for this syscall.
 >> As glibc provides no wrapper, use the same types the kernel uses.
 >
 > I think we need this patch for all of the io* pages, right?

Hi Michael,

For some reason, no.  AFAICS, only io_setup() really uses 'long'.

Then there's io_submit(), which also declares a 'long', but gets that
value from io_submit_one(), which returns an 'int';
we could use either 'long' or 'int'
in the manual page too for this one.

And then there are the others, which use plain 'int'.

See at the end of this email the sources for this answer.

Cheers,

Alex

 >
 > Thanks,
 >
 > Michael

fs/aio.c:1312:
SYSCALL_DEFINE2(io_setup, unsigned, nr_events, aio_context_t __user *, ctxp)
{
	struct kioctx *ioctx = NULL;
	unsigned long ctx;
	long ret;
...
	return ret;
}

fs/aio.c:1381:
SYSCALL_DEFINE1(io_destroy, aio_context_t, ctx)
{
	struct kioctx *ioctx = lookup_ioctx(ctx);
	if (likely(NULL != ioctx)) {
		struct ctx_rq_wait wait;
		int ret;
...
		return ret;
	}
	pr_debug("EINVAL: invalid context id\n");
	return -EINVAL;
}

fs/aio.c:1855:
static int io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb,
			 bool compat)


fs/aio.c:1914:
SYSCALL_DEFINE3(io_submit, aio_context_t, ctx_id, long, nr,
		struct iocb __user * __user *, iocbpp)
{
	struct kioctx *ctx;
	long ret = 0;
	int i = 0;
	struct blk_plug plug;
...
		ret = io_submit_one(ctx, user_iocb, false);
...
	return i ? i : ret;
}

fs/aio.c:2008:
SYSCALL_DEFINE3(io_cancel, aio_context_t, ctx_id, struct iocb __user *, 
iocb,
		struct io_event __user *, result)
{
	struct kioctx *ctx;
	struct aio_kiocb *kiocb;
	int ret = -EINVAL;
...

	return ret;
}

fs/aio.c:2084:
SYSCALL_DEFINE5(io_getevents, aio_context_t, ctx_id,
		long, min_nr,
		long, nr,
		struct io_event __user *, events,
		struct __kernel_timespec __user *, timeout)
{
	struct timespec64	ts;
	int			ret;
...
	return ret;
}

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] io_setup.2: SYNOPSIS: return long
  2020-11-02 12:20   ` Alejandro Colomar
@ 2020-11-02 13:09     ` Michael Kerrisk (man-pages)
  2020-11-02 13:12       ` Alejandro Colomar
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Kerrisk (man-pages) @ 2020-11-02 13:09 UTC (permalink / raw)
  To: Alejandro Colomar; +Cc: linux-man

Hi Alex,

On Mon, 2 Nov 2020 at 13:20, Alejandro Colomar <colomar.6.4.3@gmail.com> wrote:
>
> On 2020-11-02 08:37, Michael Kerrisk (man-pages) wrote:
>  > Hi Alex,
>  >
>  > On 11/1/20 2:59 PM, Alejandro Colomar wrote:
>  >> The Linux kernel uses a long as the return type for this syscall.
>  >> As glibc provides no wrapper, use the same types the kernel uses.
>  >
>  > I think we need this patch for all of the io* pages, right?
>
> Hi Michael,
>
> For some reason, no.  AFAICS, only io_setup() really uses 'long'.

But is not SYSCALL_DEFINEX() producing a prototype with return value
'long' in all the cases? (I have not checked, I just presume so.)

Thanks,

Michael




-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] io_setup.2: SYNOPSIS: return long
  2020-11-02 13:09     ` Michael Kerrisk (man-pages)
@ 2020-11-02 13:12       ` Alejandro Colomar
  2020-11-11 15:39         ` Ping: " Alejandro Colomar
  2020-11-13  9:23         ` Michael Kerrisk (man-pages)
  0 siblings, 2 replies; 8+ messages in thread
From: Alejandro Colomar @ 2020-11-02 13:12 UTC (permalink / raw)
  To: mtk.manpages; +Cc: linux-man



On 2020-11-02 14:09, Michael Kerrisk (man-pages) wrote:
> Hi Alex,
> 
> On Mon, 2 Nov 2020 at 13:20, Alejandro Colomar <colomar.6.4.3@gmail.com> wrote:
>>
>> On 2020-11-02 08:37, Michael Kerrisk (man-pages) wrote:
>>   > Hi Alex,
>>   >
>>   > On 11/1/20 2:59 PM, Alejandro Colomar wrote:
>>   >> The Linux kernel uses a long as the return type for this syscall.
>>   >> As glibc provides no wrapper, use the same types the kernel uses.
>>   >
>>   > I think we need this patch for all of the io* pages, right?
>>
>> Hi Michael,
>>
>> For some reason, no.  AFAICS, only io_setup() really uses 'long'.
> 
> But is not SYSCALL_DEFINEX() producing a prototype with return value
> 'long' in all the cases? (I have not checked, I just presume so.)

Hi Michael,

Well, yes.
SYSCALL_DEFINEx() produces a return type of long
for _all_ syscalls, AFAICS.
(as I said before, that macro is a bit obscure, but I can read that).

Would you like to change all syscall man pages (without a wrapper)
to use long as the return type?

Thanks.

Alex

> 
> Thanks,
> 
> Michael
> 
> 
> 
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Ping: Re: [PATCH] io_setup.2: SYNOPSIS: return long
  2020-11-02 13:12       ` Alejandro Colomar
@ 2020-11-11 15:39         ` Alejandro Colomar
  2020-11-13  9:23         ` Michael Kerrisk (man-pages)
  1 sibling, 0 replies; 8+ messages in thread
From: Alejandro Colomar @ 2020-11-11 15:39 UTC (permalink / raw)
  To: mtk.manpages; +Cc: linux-man

Ping.

On 11/2/20 2:12 PM, Alejandro Colomar wrote:
> 
> 
> On 2020-11-02 14:09, Michael Kerrisk (man-pages) wrote:
>> Hi Alex,
>>
>> On Mon, 2 Nov 2020 at 13:20, Alejandro Colomar
>> <colomar.6.4.3@gmail.com> wrote:
>>>
>>> On 2020-11-02 08:37, Michael Kerrisk (man-pages) wrote:
>>>   > Hi Alex,
>>>   >
>>>   > On 11/1/20 2:59 PM, Alejandro Colomar wrote:
>>>   >> The Linux kernel uses a long as the return type for this syscall.
>>>   >> As glibc provides no wrapper, use the same types the kernel uses.
>>>   >
>>>   > I think we need this patch for all of the io* pages, right?
>>>
>>> Hi Michael,
>>>
>>> For some reason, no.  AFAICS, only io_setup() really uses 'long'.
>>
>> But is not SYSCALL_DEFINEX() producing a prototype with return value
>> 'long' in all the cases? (I have not checked, I just presume so.)
> 
> Hi Michael,
> 
> Well, yes.
> SYSCALL_DEFINEx() produces a return type of long
> for _all_ syscalls, AFAICS.
> (as I said before, that macro is a bit obscure, but I can read that).
> 
> Would you like to change all syscall man pages (without a wrapper)
> to use long as the return type?
> 
> Thanks.
> 
> Alex
> 
>>
>> Thanks,
>>
>> Michael
>>
>>
>>
>>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] io_setup.2: SYNOPSIS: return long
  2020-11-02 13:12       ` Alejandro Colomar
  2020-11-11 15:39         ` Ping: " Alejandro Colomar
@ 2020-11-13  9:23         ` Michael Kerrisk (man-pages)
  1 sibling, 0 replies; 8+ messages in thread
From: Michael Kerrisk (man-pages) @ 2020-11-13  9:23 UTC (permalink / raw)
  To: Alejandro Colomar; +Cc: mtk.manpages, linux-man

On 11/2/20 2:12 PM, Alejandro Colomar wrote:
> 
> 
> On 2020-11-02 14:09, Michael Kerrisk (man-pages) wrote:
>> Hi Alex,
>>
>> On Mon, 2 Nov 2020 at 13:20, Alejandro Colomar <colomar.6.4.3@gmail.com> wrote:
>>>
>>> On 2020-11-02 08:37, Michael Kerrisk (man-pages) wrote:
>>>   > Hi Alex,
>>>   >
>>>   > On 11/1/20 2:59 PM, Alejandro Colomar wrote:
>>>   >> The Linux kernel uses a long as the return type for this syscall.
>>>   >> As glibc provides no wrapper, use the same types the kernel uses.
>>>   >
>>>   > I think we need this patch for all of the io* pages, right?
>>>
>>> Hi Michael,
>>>
>>> For some reason, no.  AFAICS, only io_setup() really uses 'long'.

Ahhh -- now I get what you mean.

>> But is not SYSCALL_DEFINEX() producing a prototype with return value
>> 'long' in all the cases? (I have not checked, I just presume so.)
> 
> Hi Michael,
> 
> Well, yes.
> SYSCALL_DEFINEx() produces a return type of long
> for _all_ syscalls, AFAICS.
> (as I said before, that macro is a bit obscure, but I can read that).
> 
> Would you like to change all syscall man pages (without a wrapper)
> to use long as the return type?

I guess not.

Thanks,

Michael


-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] io_setup.2: SYNOPSIS: return long
  2020-11-01 13:59 [PATCH] io_setup.2: SYNOPSIS: return long Alejandro Colomar
  2020-11-02  7:37 ` Michael Kerrisk (man-pages)
@ 2020-11-13  9:24 ` Michael Kerrisk (man-pages)
  1 sibling, 0 replies; 8+ messages in thread
From: Michael Kerrisk (man-pages) @ 2020-11-13  9:24 UTC (permalink / raw)
  To: Alejandro Colomar; +Cc: mtk.manpages, linux-man

Hi Alex,

On 11/1/20 2:59 PM, Alejandro Colomar wrote:
> The Linux kernel uses a long as the return type for this syscall.
> As glibc provides no wrapper, use the same types the kernel uses.
> 
> Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>

Thanks. Patch applied.

Cheers,

Michael

> ---
> 
> Hi Michael,
> 
> Please apply this patch after "s/io_contexxt_t/aio_context_t/".
> 
> Cheers,
> 
> Alex
> 
>  man2/io_setup.2 | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/man2/io_setup.2 b/man2/io_setup.2
> index f9860fda5..1a89de220 100644
> --- a/man2/io_setup.2
> +++ b/man2/io_setup.2
> @@ -11,7 +11,7 @@ io_setup \- create an asynchronous I/O context
>  .nf
>  .BR "#include <linux/aio_abi.h>" "          /* Defines needed types */"
>  .PP
> -.BI "int io_setup(unsigned " nr_events ", aio_context_t *" ctx_idp );
> +.BI "long io_setup(unsigned " nr_events ", aio_context_t *" ctx_idp );
>  .fi
>  .PP
>  .IR Note :
> 


-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-11-13  9:24 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-01 13:59 [PATCH] io_setup.2: SYNOPSIS: return long Alejandro Colomar
2020-11-02  7:37 ` Michael Kerrisk (man-pages)
2020-11-02 12:20   ` Alejandro Colomar
2020-11-02 13:09     ` Michael Kerrisk (man-pages)
2020-11-02 13:12       ` Alejandro Colomar
2020-11-11 15:39         ` Ping: " Alejandro Colomar
2020-11-13  9:23         ` Michael Kerrisk (man-pages)
2020-11-13  9:24 ` Michael Kerrisk (man-pages)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox