Skip to contentSkip to conversation

aio_return(3): misleading RETURN VALUE

PATCH In review Alexander Holler 3 participants 6 messages Mar 18, 2015 – Mar 22, 2015 4 messages not in the archive Man-pages: manual pages for Linux -- Sections 2, 3, 4, 5, and 7

lore
Share & tools
lore
#0 lore raw

Hello,

I've just typed in the following commit message:

--
The man page was misleading and I must have had a bad moment mechanically coding what the man page says without thinking about it.
So I seem to have assumed that aio_return() might return EINVAL which can't be the case. In fact the error is returned in errno which isn't mentioned by the Linux man page for aio_return. --

I suggest to use the same wording as in write(2) in the paragraph RETURN VALUE:

"On error, -1 is returned, and errno is set appropriately."

I've verified it by looking at the source for aio_return of glibc.

Regards,

Alexander Holler
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

Hello Alexander,

Quoted 5 lines · Alexander Holler

I suggest to use the same wording as in write(2) in the paragraph RETURN VALUE:

"On error, -1 is returned, and errno is set appropriately."

Like that ?

If the asynchronous I/O operation has completed, this function returns the value that would have been returned in case of a synchronous read(2), write(2), fsync(2) or fdatasync(2), call. On error, -1 is returned, and errno is set appropriately.

If the asynchronous I/O operation has not yet completed, the return value and effect of aio_return() are undefined.

I think that's what you meant. What will happen if the asynchronous I/O operation has not yet completed please ?

Regards,

Signature · 5 lines
Stéphane Aulery
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw

Am 18.03.2015 um 13:14 schrieb Stéphane Aulery:

Quoted 11 lines

Hello Alexander,

Quoted 5 lines · Alexander Holler

I suggest to use the same wording as in write(2) in the paragraph RETURN VALUE:

"On error, -1 is returned, and errno is set appropriately."

Like that ?

Quoted 7 lines

If the asynchronous I/O operation has completed, this function returns the value that would have been returned in case of a synchronous read(2), write(2), fsync(2) or fdatasync(2), call. On error, -1 is returned, and errno is set appropriately.

If the asynchronous I/O operation has not yet completed, the return value and effect of aio_return() are undefined.

Exactly. Thanks a lot if you change that.

Quoted 2 lines

I think that's what you meant. What will happen if the asynchronous I/O operation has not yet completed please ?

It is still undefined, but I haven't looked that up in the source of glibc.

The reason is that aio_return() should only be called if the operation before has completed, which must be checked with calling aio_error() before calling aio_return().

That's how I've understood all that and how it currently seems to work in the SW in question I've fixed a problem.

Regards,

Alexander Holler

--
To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw

Hello Alexander,

Quoted 15 lines · Alexander Holler

Am 18.03.2015 um 13:14 schrieb Stéphane Aulery:

Quoted 14 lines · Alexander Holler
Quoted 5 lines

I suggest to use the same wording as in write(2) in the paragraph RETURN VALUE:

"On error, -1 is returned, and errno is set appropriately."

Like that ?

If the asynchronous I/O operation has completed, this function returns the value that would have been returned in case of a synchronous read(2), write(2), fsync(2) or fdatasync(2), call. On error, -1 is returned, and errno is set appropriately.

Quoted 4 lines
Quoted 2 lines

If the asynchronous I/O operation has not yet completed, the return value and effect of aio_return() are undefined.

Exactly. Thanks a lot if you change that.

Patch is pending for review by Michael.

Quoted 11 lines
Quoted 2 lines

I think that's what you meant. What will happen if the asynchronous I/O operation has not yet completed please ?

It is still undefined, but I haven't looked that up in the source of glibc.

The reason is that aio_return() should only be called if the operation before has completed, which must be checked with calling aio_error() before calling aio_return().

That's how I've understood all that and how it currently seems to work in the SW in question I've fixed a problem.

Thank you for yours clarifications.

Regards,

Signature · 5 lines
Stéphane Aulery
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#7 lore raw

PATCH 1/1 aio_return.3: Specifies the return values for errors

In reply to a message not in the archive

Reported by Alexander Holler <[email protected]>

---
 man3/aio_return.3 | 1 +
 1 file changed, 1 insertion(+)
man3/aio_return.3 +1 -0
index 3e6f334..37d735c 100644
@@ -55,6 +55,7 @@ the value that would have been returned in case of a synchronous
 or
 .BR fdatasync (2),
 call.
+On error, \-1 is returned, and \fIerrno\fP is set appropriately.
 
 If the asynchronous I/O operation has not yet completed,
 the return value and effect of
Signature · 6 lines
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 1426708273-9475-1-git-send-email-saulery-GANU6spQydw@public.gmane.org

#9 lore raw

Re: [PATCH] aio_return.3: Specifies the return values for errors

Quoted 12 lines · Stéphane Aulery

Reported by Alexander Holler <[email protected]>

---
 man3/aio_return.3 | 1 +
 1 file changed, 1 insertion(+)
man3/aio_return.3 +0 -0
index 3e6f334..37d735c 100644

man3/aio_return.3 the value that would have been returned in case of a synchronous · line 61

Quoted 7 lines
man3/aio_return.3 +1 -0
@@ -55,6 +55,7 @@ the value that would have been returned in case of a synchronous
 or
 .BR fdatasync (2),
 call.
+On error, \-1 is returned, and \fIerrno\fP is set appropriately.
 
 If the asynchronous I/O operation has not yet completed,
 the return value and effect of

Hi Stéphane,

Thanks! Patch applied.

Cheers,

Michael

Signature · 7 lines
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html