1. 18 10月, 2019 1 次提交
  2. 16 10月, 2019 2 次提交
  3. 15 10月, 2019 6 次提交
  4. 14 10月, 2019 1 次提交
    • D
      build: link to glib library · cfbe9f12
      Daniel P. Berrangé 提交于
      Add the main glib.h to internal.h so that all common code can use it.
      
      Historically glib allowed applications to register an alternative
      memory allocator, so mixing g_malloc/g_free with malloc/free was not
      safe.
      
      This was feature was dropped in 2.46.0 with:
      
            commit 3be6ed60aa58095691bd697344765e715a327fc1
            Author: Alexander Larsson <alexl@redhat.com>
            Date:   Sat Jun 27 18:38:42 2015 +0200
      
              Deprecate and drop support for memory vtables
      
      Applications are still encourged to match g_malloc/g_free, but it is no
      longer a mandatory requirement for correctness, just stylistic. This is
      explicitly clarified in
      
          commit 1f24b36607bf708f037396014b2cdbc08d67b275
          Author: Daniel P. Berrangé <berrange@redhat.com>
          Date:   Thu Sep 5 14:37:54 2019 +0100
      
              gmem: clarify that g_malloc always uses the system allocator
      
      Applications can still use custom allocators in general, but they must
      do this by linking to a library that replaces the core malloc/free
      implemenentation entirely, instead of via a glib specific call.
      
      This means that libvirt does not need to be concerned about use of
      g_malloc/g_free causing an ABI change in the public libary, and can
      avoid memory copying when talking to external libraries.
      
      This patch probes for glib, which provides the foundation layer with
      a collection of data structures, helper APIs, and platform portability
      logic.
      
      Later patches will introduce linkage to gobject which provides the
      object type system, built on glib, and gio which providing objects
      for various interesting tasks, most notably including DBus client
      and server support and portable sockets APIs, but much more too.
      Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
      cfbe9f12
  5. 07 10月, 2019 2 次提交
  6. 07 8月, 2019 1 次提交
  7. 13 6月, 2019 1 次提交
  8. 10 4月, 2019 1 次提交
    • P
      internal: Introduce VIR_RETURN_PTR · 267f1e6d
      Peter Krempa 提交于
      With the introduction of more and more internal data types which support
      VIR_AUTOPTR it's becoming common to see the following pattern:
      
        VIR_AUTOPTR(virSomething) some = NULL
        virSomethingPtr ret = NULL;
      
        ... (ret is not touched ) ...
      
        VIR_STEAL_PTR(ret, some);
        return ret;
      
      This patch introduces a macro named VIR_RETURN_PTR which returns the
      pointer directly without the need for an explicitly defined return
      variable and use of VIR_STEAL_PTR. Internally obviously a temporary
      pointer is created to allow setting the original pointer to NULL so that
      the VIR_AUTOPTR function does not free the memory which we want to
      actually return.
      
      The name of the temporary variable is deliberately long and complex to
      minimize the possibility of collision.
      Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
      Reviewed-by: NJán Tomko <jtomko@redhat.com>
      267f1e6d
  9. 14 2月, 2019 2 次提交
  10. 14 12月, 2018 2 次提交
  11. 20 9月, 2018 1 次提交
  12. 19 4月, 2018 1 次提交
  13. 01 4月, 2018 1 次提交
  14. 03 11月, 2017 1 次提交
    • A
      Remove backslash alignment attempts · 3e7db8d3
      Andrea Bolognani 提交于
      Right-aligning backslashes when defining macros or using complex
      commands in Makefiles looks cute, but as soon as any changes is
      required to the code you end up with either distractingly broken
      alignment or unnecessarily big diffs where most of the changes
      are just pushing all backslashes a few characters to one side.
      
      Generated using
      
        $ git grep -El '[[:blank:]][[:blank:]]\\$' | \
          grep -E '*\.([chx]|am|mk)$$' | \
          while read f; do \
            sed -Ei 's/[[:blank:]]*[[:blank:]]\\$/ \\/g' "$f"; \
          done
      Signed-off-by: NAndrea Bolognani <abologna@redhat.com>
      3e7db8d3
  15. 13 7月, 2017 2 次提交
    • D
      Revert "Prevent more compiler optimization of mockable functions" · 407a281a
      Daniel P. Berrange 提交于
      This reverts commit e4b980c8.
      
      When a binary links against a .a archive (as opposed to a shared library),
      any symbols which are marked as 'weak' get silently dropped. As a result
      when the binary later runs, those 'weak' functions have an address of
      0x0 and thus crash when run.
      
      This happened with virtlogd and virtlockd because they don't link to
      libvirt.so, but instead just libvirt_util.a and libvirt_rpc.a. The
      virRandomBits symbols was weak and so left out of the virtlogd &
      virtlockd binaries, despite being required by virHashTable functions.
      
      Various other binaries like libvirt_lxc, libvirt_iohelper, etc also
      link directly to .a files instead of libvirt.so, so are potentially
      at risk of dropping symbols leading to a later runtime crash.
      
      This is normal linker behaviour because a weak symbol is not treated
      as undefined, so nothing forces it to be pulled in from the .a You
      have to force the linker to pull in weak symbols using -u$SYMNAME
      which is not a practical approach.
      
      This risk is silent bad linkage that affects runtime behaviour is
      not acceptable for a fix that was merely trying to fix the test
      suite. So stop using __weak__ again.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      407a281a
    • D
      Revert "internal: don't use weak symbols for Win32 platform" · 8ba33d5e
      Daniel P. Berrange 提交于
      This reverts commit b9473d8b.
      8ba33d5e
  16. 11 7月, 2017 6 次提交
    • D
      internal: don't use weak symbols for Win32 platform · b9473d8b
      Daniel P. Berrange 提交于
      The Win32 platform will fail to link if you use weak symbols
      because it is incompatible with exporting symbols in a DLL:
      
      Cannot export virRandomGenerateWWN: symbol wrong type (2 vs 3)
      
      We only need weak symbols for our test suite to do LD_PRELOAD
      and this doesn't work on Win32, so we can just drop the hack
      for Win32
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      b9473d8b
    • D
      Prevent more compiler optimization of mockable functions · e4b980c8
      Daniel P. Berrange 提交于
      Currently all mockable functions are annotated with the 'noinline'
      attribute. This is insufficient to guarantee that a function can
      be reliably mocked with an LD_PRELOAD. The C language spec allows
      the compiler to assume there is only a single implementation of
      each function. It can thus do things like propagating constant
      return values into the caller at compile time, or creating
      multiple specialized copies of the function body each optimized
      for a different caller. To prevent these optimizations we must
      also set the 'noclone' and 'weak' attributes.
      
      This fixes the test suite when libvirt.so is built with CLang
      with optimization enabled.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      e4b980c8
    • D
      Remove incorrectly used TODO macro · 1dbbcb62
      Daniel P. Berrange 提交于
      The TODO macro expands to an fprintf() call and is used in several
      places in the Xen driver. Anything that wishes to print such debug
      messages should use the logging macros. In this case though, all the
      places in the Xen driver should have been raising a formal libvirt
      error instead. Add proper error handling and delete the TODO macro
      to prevent future misuse.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      1dbbcb62
    • D
      Remove network constants out of internal.h · d8f8c7a8
      Daniel P. Berrange 提交于
      The HOST_NAME_MAX, INET_ADDRSTRLEN and VIR_LOOPBACK_IPV4_ADDR
      constants are only used by a handful of files, so are better
      kept in virsocketaddr.h or the source file that uses them.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      d8f8c7a8
    • D
      Require use of GCC 4.4 or CLang compilers · 24241c23
      Daniel P. Berrange 提交于
      We only ever test libvirt with GCC or CLang which provides a
      GCC compatible compilation environment. Between them, these
      compilers cover every important operating system platform,
      even Windows.
      
      Mandate their use to make it explicit that we don't care about
      compilers like Microsoft VCC or other UNIX vendor C compilers.
      
      GCC 4.4 was picked as the baseline, since RHEL-6 ships 4.4.7
      and that lets us remove a large set of checks. There is a slight
      issue that CLang reports itself as GCC 4.2, so we must also check
      if __clang__ is defined. We could check a particular CLang version
      too, but that would require someone to figure out a suitable min
      version which is fun because OS-X reports totally different CLang
      version numbers from CLang builds on Linux/BSD
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      24241c23
    • D
      Remove duplicate define of __GNUC_PREREQ · 83b98f19
      Daniel P. Berrange 提交于
      Back in this commit:
      
        commit b436a8ae
        Author: Fabian Freyer <fabian.freyer@physik.tu-berlin.de>
        Date:   Thu Jun 9 00:50:35 2016 +0000
      
          gnulib: add getopt module
      
      config-post.h was modified to define __GNUC_PREREQ, but the
      original definition was never removed from internal.h, and
      that is now dead code since config.h is always the first file
      included.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      83b98f19
  17. 23 5月, 2017 1 次提交
  18. 18 5月, 2017 1 次提交
  19. 16 5月, 2017 1 次提交
    • D
      remove hack for debian etch limits.h · 31020664
      Daniel P. Berrange 提交于
      The debian etch distro was end-of-life a long time ago so we no
      longer need the ULLONG_MAX hack. In any case gnulib now provides
      an equivalent fix by default, and so our definition now triggers
      syntax-check rule failure
      
      src/internal.h:#    define ULLONG_MAX   ULONG_LONG_MAX
      maint.mk: define the above via some gnulib .h file
      maint.mk:843: recipe for target 'sc_prohibit_always-defined_macros' failed
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      31020664
  20. 19 4月, 2017 2 次提交
    • D
      Ignore SASL deprecation warnings on OS-X · f7d7825d
      Daniel P. Berrange 提交于
      Apple have annotated all SASL functions as deprecated for
      unknown reasons. Since they still work, lets just ignore
      the warnings. If Apple finally delete the SASL functions
      our configure check should already catch that
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      f7d7825d
    • D
      annotate all mocked functions with noinline · 728cacc8
      Daniel P. Berrange 提交于
      CLang's optimizer is more aggressive at inlining functions than
      gcc and so will often inline functions that our tests want to
      mock-override. This causes the test to fail in bizarre ways.
      
      We don't want to disable inlining completely, but we must at
      least prevent inlining of mocked functions. Fortunately there
      is a 'noinline' attribute that lets us control this per function.
      
      A syntax check rule is added that parses tests/*mock.c to extract
      the list of functions that are mocked (restricted to names starting
      with 'vir' prefix). It then checks that src/*.h header file to
      ensure it has a 'ATTRIBUTE_NOINLINE' annotation. This should prevent
      use from bit-rotting in future.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      728cacc8
  21. 23 2月, 2017 1 次提交
    • D
      Add ATTRIBUTE_FALLTHROUGH for switch cases without break · 5d84f596
      Daniel P. Berrange 提交于
      In GCC 7 there is a new warning triggered when a switch
      case has a conditional statement (eg if ... else...) and
      some of the code paths fallthrough to the next switch
      statement. e.g.
      
      conf/domain_conf.c: In function 'virDomainChrEquals':
      conf/domain_conf.c:14926:12: error: this statement may fall through [-Werror=implicit-fallthrough=]
               if (src->targetTypeAttr != tgt->targetTypeAttr)
                  ^
      conf/domain_conf.c:14928:5: note: here
           case VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE:
           ^~~~
      conf/domain_conf.c: In function 'virDomainChrDefFormat':
      conf/domain_conf.c:22143:12: error: this statement may fall through [-Werror=implicit-fallthrough=]
               if (def->targetTypeAttr) {
                  ^
      conf/domain_conf.c:22151:5: note: here
           default:
           ^~~~~~~
      
      GCC introduced a __attribute__((fallthrough)) to let you
      indicate that this is intentionale behaviour rather than
      a bug.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      5d84f596
  22. 05 1月, 2017 1 次提交
  23. 05 8月, 2016 1 次提交
  24. 11 4月, 2016 1 次提交