8206145 : dbgsysSocketClose - do not restart close if errno is EINTR [linux] - was : RE: RFR : 8205959 : Do not restart close if errno is EINTR

David Holmes david.holmes at oracle.com
Tue Jul 3 04:28:43 UTC 2018


On 3/07/2018 1:41 AM, Thomas Stüfe wrote:
> Hi Alan,
> 
> Whether to repeat close() in case of EINTR seems to differ between
> platforms. POSIX leaves it open:
> 
> "If close() is interrupted by a signal that is to be caught, it shall
> return -1 with errno set to [EINTR] and the state of fildes is
> unspecified."
> 
> Linux recommends *not* repeating the call since the file descriptor is
> closed already and repeating the close may close a reopened fd
> belonging to someone else.
> 
> AIX, for instance, recommends to repeat the call:
> 
> "EINTR  The state of the FileDescriptor is undetermined. Retry the
> close routine to ensure that the FileDescriptor is closed."

As does HP-UX according to:

http://man7.org/linux/man-pages/man2/close.2.html

Solaris leaves things unspecified as per POSIX.

David

> Best Regards, Thomas
> 
> 
> 
> 
> 
> 
> 
> On Mon, Jul 2, 2018 at 4:09 PM, Alan Bateman <Alan.Bateman at oracle.com> wrote:
>> On 02/07/2018 14:44, Baesken, Matthias wrote:
>>>
>>> I created a bug  and a webrev  , please review .
>>>
>>>
>>> https://bugs.openjdk.java.net/browse/JDK-8206145
>>>
>>> http://cr.openjdk.java.net/~mbaesken/webrevs/8206145/
>>>
>> Why is this Linux only? I assume the do-while should be removed completely.
>>
>> -Alan.


More information about the serviceability-dev mailing list