kern/159179: [libc] close(2) emitting ECONNRESET is not POSIX compliant
Jilles Tjoelker
jilles at stack.nl
Sun Apr 13 21:20:01 UTC 2014
The following reply was made to PR kern/159179; it has been noted by GNATS.
From: Jilles Tjoelker <jilles at stack.nl>
To: bug-followup at FreeBSD.org, freebsd at grem.de
Cc:
Subject: Re: kern/159179: [libc] close(2) emitting ECONNRESET is not POSIX
compliant
Date: Sun, 13 Apr 2014 23:14:27 +0200
In FreeBSD PR kern/159179, you wrote:
> With the advent of FreeBSD 6.3 the close(2) call was changed to return
> errno ECONNRESET under certain circumstances. The man page was changed
> accordingly, but in my understanding errno = ECONNRESET is not covered
> by POSIX.1-2008 (see
> http://pubs.opengroup.org/onlinepubs/9699919799/functions/close.html).
> Also all other implementations of close I've seen in the past do not
> behave like this, which leads to actual problems in reality.
> In practice this means that all projects ported to FreeBSD would need
> to get reviewed if they can handle these situations gracefully, which
> usually doesn't happen.
POSIX permits additional errors. XSH 2.3 Error Numbers says:
] Implementations may generate error numbers listed here under
] circumstances other than those described, if and only if all those
] error conditions can always be treated identically to the error
] conditions as described in this volume of POSIX.1-2008.
] Implementations shall not generate a different error number from one
] required by this volume of POSIX.1-2008 for an error condition
] described in this volume of POSIX.1-2008, but may generate additional
] errors unless explicitly disallowed for a particular function.
The page for close() does not exclude [ECONNRESET] or any other error.
One problem with close() errors is that there may be confusion about
whether the file descriptor is still valid. In FreeBSD (and also Linux),
close() on a valid file descriptor always deallocates it, even if there
is an error while closing.
The problem reported in kern/146845 may cause [ECONNRESET] errors even
when no data was lost. This may have been fixed.
--
Jilles Tjoelker
More information about the freebsd-bugs
mailing list