Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Jan 2014 08:50:06 +0000
From:      Anna Garcia <annawgarcia11@gmail.com>
To:        freebsd-standards@freebsd.org
Subject:   www.freebsd.org
Message-ID:  <047d7b10ce85575ec104f0771849@google.com>

next in thread | raw e-mail | index | archive | help
SGksDQoNCkkganVzdCB3YW50ZWQgdG8gc2VuZCB5b3UgYSBxdWljayBub3RlLiBXaXRoIGEgZmV3
IHNpbXBsZSBjaGFuZ2VzIHRvIG1ha2UNCnlvdXIgc2l0ZSBtb3JlIFNFTy1mcmllbmRseSBJkm0g
c3VyZSB5b3UgY2FuIGNvbnZlcnQgbW9yZSB2aXNpdG9ycyBpbnRvDQpsZWFkcyBhbmQgZ2V0IGl0
IHBsYWNlZCBoaWdoZXIgaW4gdGhlIG9yZ2FuaWMgc2VhcmNoIHJlc3VsdHMsIGZvciBrZXl3b3Jk
cw0KdGhhdCBtYXR0ZXIgdG8geW91IHRoZSBtb3N0Lg0KDQpXZSBhcmUgYW4gQXVzdHJhbGlhbiBi
YXNlZCBjb21wYW55IHdpdGggYSBncmVhdCBpbi1ob3VzZSB0ZWNobmljYWwgdGVhbSB3aG8NCnJl
YWxseSBrbm93IHRoZWlyIHN0dWZmIGFib3V0IHNlYXJjaCBlbmdpbmUgb3B0aW1pemF0aW9uLg0K
DQpXb3VsZCB5b3UgbGlrZSBhIGJpdCBtb3JlIGluZm9ybWF0aW9uIGFib3V0IGhvdyB0byBnaXZl
IHlvdXIgd2Vic2l0ZSBhDQpib29zdCB3aXRoIGJldHRlciBTRU8/DQoNCkJlc3QgcmVnYXJkcywN
Cg0KQW5uYSBHYXJjaWENClNFTy9XRUIgU3BlY2lhbGlzdA0KDQpbaW1hZ2U6IExpbmtlZEluXSBb
aW1hZ2U6IEZhY2Vib29rXSBbaW1hZ2U6IFR3aXR0ZXJdIFtpbWFnZTogU2t5cGVdDQogICAgICAg
ICAgICAgUyAgIEUgIE8gICAgICAgICAgICAqU2VhcmNoIEVuZ2luZSBPcHRpbWl6YXRpb24qDQoN
CldlIHJlc3BlY3QgeW91ciBwcml2YWN5IGFuZCB3YW50IHRvIG1ha2Ugc3VyZSB5b3UgYXJlIGF3
YXJlIG9mIGEgZmV3DQp0aGluZ3MuIEJ5IHJlcGx5aW5nIHRvIHRoaXMgZW1haWwsIHlvdSBhdXRo
b3JpemUgb3VyIEF1c3RyYWxpYW4gYWZmaWxpYXRlcw0KdGhhdCBjYW4gaGVscCB3aXRoIHlvdXIg
cHJvamVjdCB0byBjYWxsIHlvdSBhdCB0aGUgbnVtYmVyIHlvdSBwcm92aWRlZCwgYW5kDQp5b3Ug
dW5kZXJzdGFuZCB0aGF0IHRoZXkgbWF5IHVzZSBhdXRvbWF0ZWQgcGhvbmUgdGVjaG5vbG9neSB0
byBjYWxsIHlvdS4gQXQNCm5vIHRpbWUgYXJlIHlvdSByZXF1aXJlZCB0byBtYWtlIGEgcHVyY2hh
c2UuDQo=
From owner-freebsd-standards@FreeBSD.ORG  Thu Jan 23 09:00:00 2014
Return-Path: <owner-freebsd-standards@FreeBSD.ORG>
Delivered-To: freebsd-standards@smarthost.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id C9BD02CA
 for <freebsd-standards@smarthost.ysv.freebsd.org>;
 Thu, 23 Jan 2014 09:00:00 +0000 (UTC)
Received: from freefall.freebsd.org (freefall.freebsd.org
 [IPv6:2001:1900:2254:206c::16:87])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (No client certificate requested)
 by mx1.freebsd.org (Postfix) with ESMTPS id A48C3145B
 for <freebsd-standards@smarthost.ysv.freebsd.org>;
 Thu, 23 Jan 2014 09:00:00 +0000 (UTC)
Received: from freefall.freebsd.org (localhost [127.0.0.1])
 by freefall.freebsd.org (8.14.7/8.14.7) with ESMTP id s0N900BL056088
 for <freebsd-standards@freefall.freebsd.org>; Thu, 23 Jan 2014 09:00:00 GMT
 (envelope-from gnats@freefall.freebsd.org)
Received: (from gnats@localhost)
 by freefall.freebsd.org (8.14.7/8.14.7/Submit) id s0N900TN056087;
 Thu, 23 Jan 2014 09:00:00 GMT (envelope-from gnats)
Resent-Date: Thu, 23 Jan 2014 09:00:00 GMT
Resent-Message-Id: <201401230900.s0N900TN056087@freefall.freebsd.org>
Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer)
Resent-To: freebsd-standards@FreeBSD.org
Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org,
 Gennady Proskurin <gpr@mail.ru>
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id B4F4A1B5
 for <freebsd-gnats-submit@FreeBSD.org>; Thu, 23 Jan 2014 08:58:59 +0000 (UTC)
Received: from oldred.freebsd.org (oldred.freebsd.org
 [IPv6:2001:1900:2254:206a::50:4])
 (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by mx1.freebsd.org (Postfix) with ESMTPS id A0F6D1448
 for <freebsd-gnats-submit@FreeBSD.org>; Thu, 23 Jan 2014 08:58:59 +0000 (UTC)
Received: from oldred.freebsd.org ([127.0.1.6])
 by oldred.freebsd.org (8.14.5/8.14.7) with ESMTP id s0N8wwAw039916
 for <freebsd-gnats-submit@FreeBSD.org>; Thu, 23 Jan 2014 08:58:58 GMT
 (envelope-from nobody@oldred.freebsd.org)
Received: (from nobody@localhost)
 by oldred.freebsd.org (8.14.5/8.14.5/Submit) id s0N8wwQB039907;
 Thu, 23 Jan 2014 08:58:58 GMT (envelope-from nobody)
Message-Id: <201401230858.s0N8wwQB039907@oldred.freebsd.org>
Date: Thu, 23 Jan 2014 08:58:58 GMT
From: Gennady Proskurin <gpr@mail.ru>
To: freebsd-gnats-submit@FreeBSD.org
X-Send-Pr-Version: www-3.1
Subject: standards/186028: incorrect return values for posix_fallocate()
X-BeenThere: freebsd-standards@freebsd.org
X-Mailman-Version: 2.1.17
Precedence: list
List-Id: Standards compliance <freebsd-standards.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/options/freebsd-standards>, 
 <mailto:freebsd-standards-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-standards/>;
List-Post: <mailto:freebsd-standards@freebsd.org>
List-Help: <mailto:freebsd-standards-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-standards>, 
 <mailto:freebsd-standards-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 23 Jan 2014 09:00:01 -0000


>Number:         186028
>Category:       standards
>Synopsis:       incorrect return values for posix_fallocate()
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-standards
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jan 23 09:00:00 UTC 2014
>Closed-Date:
>Last-Modified:
>Originator:     Gennady Proskurin
>Release:        FreeBSD 11.0-CURRENT
>Organization:
>Environment:
FreeBSD gpr.nnz-home.ru 11.0-CURRENT FreeBSD 11.0-CURRENT #0 r260472+743aa78(svn_head): Fri Jan 10 05:28:05 MSK 2014     gpr@gpr.nnz-home.ru:/usr/obj/usr/src/freebsd-head/sys/GPR  amd64
>Description:
In case of error, posix_fallocate() should return error code itself, but in FreeBSD it returns -1 and sets errno.

Quote from standard:
http://pubs.opengroup.org/onlinepubs/009695399/functions/posix_fallocate.html
RETURN VALUE
    Upon successful completion, posix_fallocate() shall return zero; otherwise, an error number shall be returned to indicate the error.


Quote from freebsd man:
RETURN VALUES
     If successful, posix_fallocate() returns zero.  It returns -1 on failure,
     and sets errno to indicate the error.

>How-To-Repeat:
test program attached
>Fix:


Patch attached with submission follows:

#include <fcntl.h>
#include <errno.h>
#include <string.h>
#include <stdio.h>

int main()
{
	int ret;
	int err;

	errno = 0;
	ret = posix_fallocate(-1 /* emulate EBADF error */, 0, 1);
	err = errno;
	printf("return value : %i   strerror: %s\n", ret, strerror(ret));
	printf("errno        : %i   strerror: %s\n", err, strerror(err));
}


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?047d7b10ce85575ec104f0771849>