This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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

Attachment: signature.asc
Description: This is a digitally signed message part.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]