1. 31 8月, 2020 1 次提交
  2. 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
  3. 29 8月, 2018 1 次提交
    • R
      fix return value of system on failure to spawn child process · 1d297a28
      Rich Felker 提交于
      the value 0x7f00 (as if by _exit(127)) is specified only for the case
      where the child is created but then fails to exec the shell, since
      traditional fork+exec implementations do not admit reporting an error
      via errno in this case without additional machinery. it's unclear
      whether an implementation not subject to this failure mode needs to
      emulate it; one could read the standard as requiring that. if so,
      additional code will need to be added to map posix_spawn errors into
      the form system is expected to return. but for now, returning -1 to
      indicate an error is significantly better behavior than always
      reporting failures as if the shell failed to exec after fork.
      1d297a28
  4. 12 12月, 2013 1 次提交
  5. 25 3月, 2013 1 次提交
  6. 18 2月, 2013 1 次提交
    • R
      consistently use the internal name __environ for environ · 23ccb80f
      Rich Felker 提交于
      patch by Jens Gustedt.
      previously, the intended policy was to use __environ in code that must
      conform to the ISO C namespace requirements, and environ elsewhere.
      this policy was not followed in practice anyway, making things
      confusing. on top of that, Jens reported that certain combinations of
      link-time optimization options were breaking with the inconsistent
      references; this seems to be a compiler or linker bug, but having it
      go away is a nice side effect of the changes made here.
      23ccb80f
  7. 04 2月, 2013 1 次提交
  8. 29 10月, 2012 1 次提交
    • R
      system is a cancellation point · 76f28cfc
      Rich Felker 提交于
      ideally, system would also be cancellable while running the external
      command, but I cannot find any way to make that work without either
      leaking zombie processes or introducing behavior that is far outside
      what the standard specifies. glibc handles cancellation by killing the
      child process with SIGKILL, but this could be unsafe in that it could
      leave the data being manipulated by the command in an inconsistent
      state.
      76f28cfc
  9. 20 10月, 2012 1 次提交
    • R
      fix usage of locks with vfork · 599f9736
      Rich Felker 提交于
      __release_ptc() is only valid in the parent; if it's performed in the
      child, the lock will be unlocked early then double-unlocked later,
      corrupting the lock state.
      599f9736
  10. 19 10月, 2012 1 次提交
    • R
      overhaul system() and popen() to use vfork; fix various related bugs · 44eb4d8b
      Rich Felker 提交于
      since we target systems without overcommit, special care should be
      taken that system() and popen(), like posix_spawn(), do not fail in
      processes whose commit charges are too high to allow ordinary forking.
      
      this in turn requires special precautions to ensure that the parent
      process's signal handlers do not end up running in the shared-memory
      child, where they could corrupt the state of the parent process.
      
      popen has also been updated to use pipe2, so it does not have a
      fd-leak race in multi-threaded programs. since pipe2 is missing on
      older kernels, (non-atomic) emulation has been added.
      
      some silly bugs in the old code should be gone too.
      44eb4d8b
  11. 12 2月, 2011 1 次提交