1. 13 9月, 2018 1 次提交
    • R
      reduce spurious inclusion of libc.h · 5ce37379
      Rich Felker 提交于
      libc.h was intended to be a header for access to global libc state and
      related interfaces, but ended up included all over the place because
      it was the way to get the weak_alias macro. most of the inclusions
      removed here are places where weak_alias was needed. a few were
      recently introduced for hidden. some go all the way back to when
      libc.h defined CANCELPT_BEGIN and _END, and all (wrongly implemented)
      cancellation points had to include it.
      
      remaining spurious users are mostly callers of the LOCK/UNLOCK macros
      and files that use the LFS64 macro to define the awful *64 aliases.
      
      in a few places, new inclusion of libc.h is added because several
      internal headers no longer implicitly include libc.h.
      
      declarations for __lockfile and __unlockfile are moved from libc.h to
      stdio_impl.h so that the latter does not need libc.h. putting them in
      libc.h made no sense at all, since the macros in stdio_impl.h are
      needed to use them correctly anyway.
      5ce37379
  2. 21 2月, 2015 1 次提交
    • R
      map interruption of close by signal to success rather than EINPROGRESS · 6bea5dc6
      Rich Felker 提交于
      commit 82dc1e2e addressed the
      resolution of Austin Group issue 529, which requires close to leave
      the fd open when failing with EINTR, by returning the newly defined
      error code EINPROGRESS. this turns out to be a bad idea, though, since
      legacy applications not aware of the new specification are likely to
      interpret any error from close except EINTR as a hard failure.
      6bea5dc6
  3. 13 2月, 2015 1 次提交
    • R
      overhaul aio implementation for correctness · 4e8a3561
      Rich Felker 提交于
      previously, aio operations were not tracked by file descriptor; each
      operation was completely independent. this resulted in non-conforming
      behavior for non-seekable/append-mode writes (which are required to be
      ordered) and made it impossible to implement aio_cancel, which in turn
      made closing file descriptors with outstanding aio operations unsafe.
      
      the new implementation is significantly heavier (roughly twice the
      size, and seems to be slightly slower) and presently aims mainly at
      correctness, not performance.
      
      most of the public interfaces have been moved into a single file,
      aio.c, because there is little benefit to be had from splitting them.
      whenever any aio functions are used, aio_cancel and the internal
      queue lifetime management and fd-to-queue mapping code must be linked,
      and these functions make up the bulk of the code size.
      
      the close function's interaction with aio is implemented with weak
      alias magic, to avoid pulling in heavy aio cancellation code in
      programs that don't use aio, and the expensive cancellation path
      (which includes signal blocking) is optimized out when there are no
      active aio queues.
      4e8a3561
  4. 25 9月, 2012 1 次提交
    • R
      fix handling of EINTR during close() · 82dc1e2e
      Rich Felker 提交于
      austin group interpretation for defect #529
      (http://austingroupbugs.net/view.php?id=529) tightens the
      requirements on close such that, if it returns with EINTR, the file
      descriptor must not be closed. the linux kernel developers vehemently
      disagree with this, and will not change it. we catch and remap EINTR
      to EINPROGRESS, which the standard allows close() to return when the
      operation was not finished but the file descriptor has been closed.
      82dc1e2e
  5. 19 4月, 2011 1 次提交
    • R
      remove bogus extra logic for close cancellability · 61b56a8d
      Rich Felker 提交于
      like all other syscalls, close should return to the caller if and only
      if it successfully performed its action. it is necessary that the
      application be able to determine whether the close succeeded.
      61b56a8d
  6. 17 4月, 2011 1 次提交
    • R
      overhaul pthread cancellation · feee9890
      Rich Felker 提交于
      this patch improves the correctness, simplicity, and size of
      cancellation-related code. modulo any small errors, it should now be
      completely conformant, safe, and resource-leak free.
      
      the notion of entering and exiting cancellation-point context has been
      completely eliminated and replaced with alternative syscall assembly
      code for cancellable syscalls. the assembly is responsible for setting
      up execution context information (stack pointer and address of the
      syscall instruction) which the cancellation signal handler can use to
      determine whether the interrupted code was in a cancellable state.
      
      these changes eliminate race conditions in the previous generation of
      cancellation handling code (whereby a cancellation request received
      just prior to the syscall would not be processed, leaving the syscall
      to block, potentially indefinitely), and remedy an issue where
      non-cancellable syscalls made from signal handlers became cancellable
      if the signal handler interrupted a cancellation point.
      
      x86_64 asm is untested and may need a second try to get it right.
      feee9890
  7. 20 3月, 2011 1 次提交
  8. 12 2月, 2011 1 次提交