1. 07 Feb, 2019 2 commits
  2. 24 Nov, 2018 1 commit
    • Peter Wu's avatar
      gspawn: Fix g_spawn deadlock in a multi-threaded program on Linux · f2917459
      Peter Wu authored
      opendir and closedir are not async-signal-safe, these may call malloc
      under the hood and cause a deadlock in a multi-threaded program.
      This only affected Linux when /proc is mounted, other systems use a
      slower path that iterates through all potential file descriptors.
      Fixes a long-standing problem (since GLib 2.14.2).
      Closes #945 and #1014
  3. 29 Sep, 2018 1 commit
  4. 30 Aug, 2018 1 commit
  5. 11 Aug, 2018 1 commit
  6. 13 Jul, 2018 1 commit
  7. 29 Jun, 2018 1 commit
  8. 25 Jun, 2018 1 commit
  9. 23 Jun, 2018 1 commit
    • Ting-Wei Lan's avatar
      gspawn: Declare environ · e14c853d
      Ting-Wei Lan authored
      Function do_posix_spawn uses environ, but gspawn.c doesn't declare it.
      Since there is no system header declaring this global variable, this
      causes compilation error on FreeBSD.
      Code added in this commit is copied from genviron.c.
  10. 21 Jun, 2018 4 commits
    • Daniel Drake's avatar
      gspawn: use sane_open() for stdin · 2b560457
      Daniel Drake authored
      sane_open() is used for stdout and stderr, but regular open() was being
      used for stdin. Spotted by Philip Withnall.
    • Daniel Drake's avatar
      gspawn: document FD_CLOEXEC behaviour · 86e2b8d4
      Daniel Drake authored
      G_SPAWN_LEAVE_DESCRIPTORS_OPEN must be set to enable the optimized
      posix_spawn codepath, so this flag is likely to see more usage now.
      Document that FD_CLOEXEC can be used to cause file descriptors to be
      automatically closed while this flag is used.
    • Daniel Drake's avatar
      gspawn: Optimize with posix_spawn codepath · 61f54591
      Daniel Drake authored
      When the amount of free memory on the system is somewhat low, gnome-shell
      will sometimes fail to launch apps, reporting the error:
        fork(): Cannot allocate memory
      fork() is failing here because while cloning the process virtual address
      space, Linux worries that the thread being forked may end up COWing the
      entire address space of the parent process (gnome-shell, which is
      memory-hungry), and there is not enough free memory to permit that to
      In this case we are simply calling fork() in order to quickly call exec(),
      which will throw away the entirity of the duplicated VM, so we should
      look for ways to avoid the overcommit check.
      The well known solution to this is to use clone(CLONE_VM) or vfork(), which
      completely avoids creating a new memory address space for the child.
      However, that comes with a bunch of caveats and complications:
      In 2016, glibc's posix_spawn() was rewritten to use this approach
      while also resolving the concerns.
      I experimented with a similar approach in glib, but it was not practical
      because glibc has several items of important internal knowledge (such as
      knowing which signals should be given special treatment because they are
      NPTL implementation details) that are not cleanly exposed elsewhere.
      Instead, this patch adapts the gspawn code to use posix_spawn() where
      possible, which will reap the benefits of that implementation.
      The posix_spawn API is more limited than the gspawn API though,
      partly due to natural limitations of using CLONE_VM, so the posix_spawn
      path is added as a separate codepath which is only executed when the
      conditions are right. Callers such as gnome-shell will have to be modified
      to meet these conditions, such as not having a child_setup function.
      In addition to allowing for the gnome-shell "Cannot allocate memory"
      failure to be avoided, this should result in a general speedup in this
      area, because fork()'s behaviour of cloning the entire VM space
      has a cost which is now avoided. posix_spawn() has also recently
      been optimized on OpenSolaris as the most performant way to spawn
      a child process.
    • Daniel Drake's avatar
      gspawn: Add g_spawn_async_with_fds variant · 3524de16
      Daniel Drake authored
      Add a new process spawning function variant which allows the caller
      to pass specific file descriptors for stdin, stdout and stderr.
      It is otherwise identical to g_spawn_async_with_pipes.
      Allow the same fd to be passed in multiple parameters. To make this
      workable, the child process logic that closes the fd after the first time
      it has been dup2'ed needed tweaking; we now just set those fds to be
      closed upon exec using the CLOEXEC flag. Add a test for this case.
      This will be used by gnome-shell to avoid performing equivalent
      dup2 actions in a child_setup function. Dropping use of child_setup will
      enable use of an upcoming optimized process spawning codepath.
  11. 12 Jun, 2018 1 commit
  12. 08 Feb, 2018 1 commit
  13. 07 Nov, 2017 1 commit
  14. 26 Oct, 2017 1 commit
  15. 12 Oct, 2017 1 commit
  16. 03 Aug, 2017 1 commit
  17. 24 May, 2017 1 commit
    • Sébastien Wilmet's avatar
      glib/: LGPLv2+ -> LGPLv2.1+ · f9faac76
      Sébastien Wilmet authored
      All glib/*.{c,h} files have been processed, as well as gtester-report.
      12 of those files are not licensed under LGPL:
      Some of them are generated files, some are licensed under a BSD-style
      license and win_iconv.c is in the public domain.
      Sub-directories inside glib/:
      	deprecated/: processed in a previous commit
      	glib-mirroring-tab/: already LGPLv2.1+
      	gnulib/: not modified, the code is copied from gnulib
      	libcharset/: a copy
      	pcre/: a copy
      	tests/: processed in a previous commit
  18. 30 Apr, 2017 1 commit
  19. 04 Jan, 2017 1 commit
  20. 22 Nov, 2016 1 commit
  21. 12 Oct, 2016 1 commit
  22. 07 Jun, 2016 1 commit
  23. 04 Jun, 2016 1 commit
  24. 23 Jul, 2015 1 commit
  25. 31 May, 2014 1 commit
  26. 20 Feb, 2014 1 commit
  27. 06 Feb, 2014 2 commits
  28. 31 Jan, 2014 1 commit
  29. 17 Oct, 2013 1 commit
  30. 01 Jul, 2013 2 commits
  31. 21 May, 2013 1 commit
    • Dan Winship's avatar
      Use 'dumb quotes' rather than `really dumb quotes' · 4b94c083
      Dan Winship authored
      Back in the far-off twentieth century, it was normal on unix
      workstations for U+0060 GRAVE ACCENT to be drawn as "‛" and for U+0027
      APOSTROPHE to be drawn as "’". This led to the convention of using
      them as poor-man's ‛smart quotes’ in ASCII-only text.
      However, "'" is now universally drawn as a vertical line, and "`" at a
      45-degree angle, making them an `odd couple' when used together.
      Unfortunately, there are lots of very old strings in glib, and also
      lots of new strings in which people have kept up the old tradition,
      perhaps entirely unaware that it used to not look stupid.
      Fix this by just using 'dumb quotes' everywhere.
  32. 23 Apr, 2013 1 commit
  33. 29 Jan, 2013 1 commit
    • Colin Walters's avatar
      Add g_close(), use it · f398bec5
      Colin Walters authored
      There are two benefits to this:
      1) We can centralize any operating system specific knowledge of
         close-vs-EINTR handling.  For example, while on Linux we should never
         retry, if someone cared enough later about HP-UX, they could come by
         and change this one spot.
      2) For places that do care about the return value and want to provide
         the caller with a GError, this function makes it convenient to do so.
      Note that gspawn.c had an incorrect EINTR loop-retry around close().
  34. 15 Nov, 2012 1 commit