Skip to content
Snippets Groups Projects
  1. Nov 17, 2022
    • Simon McVittie's avatar
      log: Add file descriptor management in _srt_util_set_glib_log_handler() · 944a376f
      Simon McVittie authored
      
      This does a few closely related things.
      
      If standard input, standard output and standard error are closed, we
      open them to point to /dev/null, and if they are close-on-exec, we
      clear their close-on-exec flags. This is to avoid weird side effects:
      most APIs like open() that create new file descriptors guarantee to use
      the lowest-numbered fd that is not already in use, but users of those
      APIs do not expect to be overwriting stdin/stdout/stderr.
      
      Because that operation can involve changing the meaning of stdout and
      stderr, we now optionally save a duplicate of the original standard
      output and standard error, so they can be put back later.
      
      Because we're now saving a duplicate of the original standard output and
      standard error, it also makes sense to implement
      SRT_LOG_FLAGS_DIVERT_STDOUT here. This avoids needing to call
      _srt_divert_stdout_to_stderr() separately in most callers.
      
      Signed-off-by: default avatarSimon McVittie <smcv@collabora.com>
      944a376f
    • Simon McVittie's avatar
      log: Merge g_set_prgname() into _srt_util_set_glib_log_handler() · cad125f4
      Simon McVittie authored
      
      If we are going to write to the systemd Journal, we will want the
      program name to already be known, so that we can use it as the syslog
      identifier (first argument to sd_journal_stream_fd() and openlog()).
      
      This also reduces duplication a bit, and brings us one step closer to
      combining _srt_util_set_up_logging() with
      _srt_util_set_glib_log_handler().
      
      Signed-off-by: default avatarSimon McVittie <smcv@collabora.com>
      cad125f4
  2. Nov 16, 2022
  3. Nov 03, 2022
  4. Aug 19, 2022
  5. Jul 28, 2022
  6. Jul 21, 2022
  7. Jun 22, 2022
  8. Jun 15, 2022
  9. Jun 14, 2022
  10. Apr 07, 2022
  11. Mar 31, 2022
  12. Feb 22, 2022
  13. Jan 27, 2022
  14. Nov 08, 2021
  15. Aug 03, 2021
  16. Jun 10, 2021
  17. May 20, 2021
  18. Apr 14, 2021
  19. Apr 12, 2021
  20. Feb 26, 2021
    • Simon McVittie's avatar
      launch: Add --app-path, --usr-path · 7730a4cf
      Simon McVittie authored
      These are the client side for
      <https://github.com/flatpak/flatpak/pull/4018
      
      >. We'll use them to put
      the Steam Runtime on /usr and an empty directory on /app.
      
      Because the corresponding Flatpak change has not been merged, make it
      fail unless an undocumented environment variable has been set.
      
      Signed-off-by: default avatarSimon McVittie <smcv@collabora.com>
      7730a4cf
    • Simon McVittie's avatar
      pressure-vessel: Put apt-style severity prefixes on messages · dbf21961
      Simon McVittie authored
      
      These indicate which lines are harmless and which lines are really bad,
      without taking up too much space.
      
      The mapping from GLib log level to message is not 100% obvious, because
      G_LOG_LEVEL_ERROR is "worse than" an error. We diagnose "can't happen"
      situations (assertion failures, etc.) as "Internal error". Ideally,
      users should never see these: they indicate a bug.
      
      For situations that will cause pressure-vessel to exit with an error,
      introduce a new log level flag PV_LOG_LEVEL_FAILURE and map it to the
      apt-style "E:" prefix. pv_log_failure() is a convenience macro to log
      at level PV_LOG_LEVEL_FAILURE. Conceptually this is a fatal error, but
      it's a fatal error prompted by something external to pressure-vessel,
      for which we want pressure-vessel to clean up "nicely" and exit
      gracefully, even though it's going to fail - so we can't use g_error()
      for this.
      
      In the parts of main() that involve parsing command-line arguments,
      add usage_error() as syntactic sugar for pv_log_failure(). I might
      eventually turn these into G_OPTION_ERROR_FAILED as we factor out
      more of main() into helper functions, but for now they're handled
      separately.
      
      For less-severe log levels, use single-letter prefixes similar to apt's.
      
      Signed-off-by: default avatarSimon McVittie <smcv@collabora.com>
      dbf21961
  21. Feb 16, 2021
  22. Jan 05, 2021
Loading