Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Jan 2014 07:36:20 -0800
From:      Matthew Fleming <mdf@FreeBSD.org>
To:        Bruce Evans <brde@optusnet.com.au>
Cc:        Gennady Proskurin <gpr@mail.ru>, standards@freebsd.org
Subject:   Re: standards/186028: incorrect return values for posix_fallocate()
Message-ID:  <CAMBSHm9exNcU7jGhvQ2dQtZrqF4UG=82kU8w2xb%2BZ7SY3-eXaQ@mail.gmail.com>
In-Reply-To: <20140124014043.T879@besplex.bde.org>
References:  <201401230858.s0N8wwQB039907@oldred.freebsd.org> <20140123094017.GH24664@kib.kiev.ua> <20140124014043.T879@besplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Jan 23, 2014 at 7:08 AM, Bruce Evans <brde@optusnet.com.au> wrote:

> On Thu, 23 Jan 2014, Konstantin Belousov wrote:
>
>  Indeed.  Linux also seems to have the conforming behaviour, according
>> to their man page, which also explicitely states that errno is not set.
>>
>> Try this.
>>
>> diff --git a/lib/libc/sys/posix_fallocate.2 b/lib/libc/sys/posix_
>> fallocate.2
>> index 087c68c..ee6fcc4 100644
>> --- a/lib/libc/sys/posix_fallocate.2
>> +++ b/lib/libc/sys/posix_fallocate.2
>> @@ -83,9 +83,9 @@ that reduces the file size to a size smaller than
>> If successful,
>> .Fn posix_fallocate
>> returns zero.
>> -It returns -1 on failure, and sets
>> +It returns error on failure, without setting
>> .Va errno
>> -to indicate the error.
>> +variable.
>>
>
> "returns error" is hard to parse.  Only values can be returned.
>
> The old text would have had a style bug if it had been correct.  Normal
> man pages use the mdoc markup ".Rv -std" instead of repeating the above
> boilerplate ad nauseum to describe standard error handling.  In libc/sys,
> the macro is used in 106 man pages and the style bug is used in about
> 50 man pages.


Oops!  I guess I didn't read the POSIX spec very carefully; my mental model
is that only the pthread_* functions directly return the error, and others
follow the old UNIX behaviour of returning -1 and setting errno.

Anyways, the patch looks fine to me.  Sorry for any errors in the man page
as well; I never was able to find a guide to all the various mdoc macros so
I had to work from examples.

Cheers,
matthew



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAMBSHm9exNcU7jGhvQ2dQtZrqF4UG=82kU8w2xb%2BZ7SY3-eXaQ>