[RFC][BZ #14627] Make linux close errno to EINPROGRESS when interrupted in signal.

Mike Frysinger vapier@gentoo.org
Tue Dec 10 09:11:00 GMT 2013


On Thursday 05 December 2013 12:10:54 Ondřej Bílka wrote:
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/close.c
> @@ -0,0 +1,44 @@
> +/* Copyright (C) 2013 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +
> +   The GNU C Library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   The GNU C Library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with the GNU C Library; if not, see
> +   <http://www.gnu.org/licenses/>.  */
> +
> +#include <errno.h>
> +#include <fcntl.h>
> +#include <stdio.h>
> +#include <sysdep-cancel.h>
> +
> +int
> +__libc_close (int fd)
> +{
> +  if (SINGLE_THREAD_P)
> +    return INLINE_SYSCALL (close, 1, fd);
> +
> +  int oldtype = LIBC_CANCEL_ASYNC ();
> +
> +  int result = INLINE_SYSCALL (close, 1, fd);
> +
> +  if (errno == EINTR)
> +    errno = EINPROGRESS;
> +
> +  LIBC_CANCEL_RESET (oldtype);
> +
> +  return result;
> +}

there really needs to be a comment block in this file somewhere explaining why 
it's doing what it's doing
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20131210/c4b8320b/attachment.sig>


More information about the Libc-alpha mailing list