Skip to content
  1. Dec 04, 2014
  2. Dec 03, 2014
    • Allison Karlitskaya's avatar
      tests: add GBytes memfd testcase · e3df37be
      Allison Karlitskaya authored
      e3df37be
    • Allison Karlitskaya's avatar
      Add new internal header glib-linux.h · c123516f
      Allison Karlitskaya authored
      This defines some constants and syscall wrappers for features which may
      not yet have appeared in the libc.
      c123516f
    • Allison Karlitskaya's avatar
      GBytes: two memfd tweaks · 98f14376
      Allison Karlitskaya authored
       1) mmap() of a 0-sized region is EINVAL, so don't try that
      
       2) MAP_SHARED on a sealed memfd fails for some reason, so use
          MAP_PRIVATE instead
      98f14376
    • Allison Karlitskaya's avatar
      185449c5
    • Allison Karlitskaya's avatar
      GVariant vector deserialiser WIP · 3468ab84
      Allison Karlitskaya authored
      3468ab84
    • Allison Karlitskaya's avatar
      GVariant: clean up g_variant_get_child_value() · a169f1d1
      Allison Karlitskaya authored
      Remove this one outstanding case of direct construction of GVariant
      instances and port it to use g_variant_alloc() like everyone else.
      a169f1d1
    • Allison Karlitskaya's avatar
      GVariant: use GVariantTypeInfo on internal constructors · fd40045e
      Allison Karlitskaya authored
      Take GVariantTypeInfo instead of a GVariantType on the internal
      constructors for GVariant.
      
      Although this results in a bit more code for almost every call, it turns
      out that it makes most uses more convenient -- that fact that we consume
      the GVariantInfo means that we don't have to go back to free the type
      when we're done.
      
      This change will allow us to port g_variant_get_child() over to using
      g_variant_alloc().  It was the one outstanding place where we
      constructed GVariant instances that was not yet using it.
      fd40045e
    • Allison Karlitskaya's avatar
      GVariant: clean up serialised data handling API · 127fc045
      Allison Karlitskaya authored
      Add a new pair of internal helpers to gvariant-core.c to provide a
      unified way to construct and query the content of serialised GVariant
      instances.
      
      Rewrite g_variant_new_from_data() to use this.
      
      Move g_variant_new_from_bytes() and g_variant_get_data_as_bytes() out of
      -core and into gvariant.c, also rewriting them to use the same.
      
      Take the time to do some cleanup and make some general improvements in
      consistency:
      
       - move the checks for improperly sized fixed-sized data out of
         _new_from_bytes() and into the common code so that we do this check
         on _new_from_data() as well
      
       - correctly deal with the case of NULL data in _get_data_as_bytes().
         This would have crashed before.  Add a test for that.
      
       - if the user hands us data with a size of zero then unref and/or
         destroy-notify things immediately.
      
      The idea that every GVariant must have an associated GBytes remains.
      This could potentially be optimsed a bit further in the future, but the
      cases where it could be avoided are only a few (errors, zero-size,
      static stoarge) so let's not pursue that now.
      127fc045
    • Allison Karlitskaya's avatar
      bae9239d
    • Allison Karlitskaya's avatar
      GVariant: add support for single precision floats · 37a2fdf1
      Allison Karlitskaya authored
      Add a new type 'f' to correspond to single precision floating point
      values.
      
      This type was never added to D-Bus for two reasons:
      
       1) there is no benefit to using float rather than doubles as parameters
          for RPC
      
       2) classically, you shouldn't move bulk data over D-Bus
      
      Now that we've decided that we want to use D-Bus for bulk data
      transfers, it makes a good deal of sense to want to send an array of
      floats or an array of fixed-sized tuples containing floats.
      
      https://bugzilla.gnome.org/show_bug.cgi?id=740897
      37a2fdf1
  3. Dec 02, 2014
    • Allison Karlitskaya's avatar
      GVariant test: add a new vector serialisation test · 04240e41
      Allison Karlitskaya authored
      Generate a random value and make sure we get the same result as doing it
      the 'usual' way (which is already subject to a whole lot of testing).
      04240e41
    • Allison Karlitskaya's avatar
      GVariant: support serialising to GVariantVectors · 8209b340
      Allison Karlitskaya authored
      Add code for serialising GVariant to GVariantVectors.
      
      Export that internally via the glib-private machanism so that we can use
      it from GDBus.
      8209b340
    • Allison Karlitskaya's avatar
      GVariant: add GVariantVectors utility struct · 025e6708
      Allison Karlitskaya authored
      This structure (and its associated functions) will be used as an
      intermediate step for serialising GVariant instance onto kdbus without
      copying large amounts of data.
      025e6708
    • Allison Karlitskaya's avatar
      GVariant: refactor locking a bit more · 87226d3b
      Allison Karlitskaya authored
      Change the internal g_variant_ensure_serialised() helper over to working
      on unlocked instances and have it conditionally acquire the lock using
      the utility function added in the last commit.
      87226d3b
    • Allison Karlitskaya's avatar
      GVariant: add internal tree-form locking helper · 2c1fb291
      Allison Karlitskaya authored
      Many of the core GVariant operations have two modes: one for tree-form
      and one for serialised.
      
      Once a GVariant is in serialised form it will always be serialised, so
      it is safe to simply check for that and proceed with the operation in
      that case.
      
      A tree-form GVariant instance always has a chance of being implicitly
      serialised, however, so we have to take locks when performing operations
      on these.
      
      Write a helper function that reliably checks if the instance is in
      tree-form, locking it if it is.  Rewrite some of the other functions to
      use this helper.  In some cases this simplifies the code and in others
      it reduces locking.
      2c1fb291
    • Allison Karlitskaya's avatar
      GVariant: calculate size at construction · 67520c60
      Allison Karlitskaya authored
      It's always possible to determine the serialised size of a GVariant
      instance, even in the case that it is not yet serialised.  This can be
      done by calling g_variant_get_size() which will base its answer on the
      size of each child (which must be recursively determined).
      
      We must perform this process before we can allocate the buffer to
      serialise a GVariant into (since we must know the size of the buffer).
      This means that serialising a GVariant involves two steps that recurse
      through the entire tree of values.  We must take locks twice.
      
      Simplify this by always determining the size when the instance is first
      created, from the sizes of its children (which now will always be known
      as well).  We can do this without taking any locks because the
      newly-created instance has never been exposed and because the size on
      the children is now a constant that can be directly accessed without a
      lock.
      
      This is a reduction in complexity and will also be a performance
      improvement in all cases where a GVariant is serialised.  It will be a
      slight performance hit in the case that we construct tree-form instances
      and never serialise them.
      67520c60
    • Allison Karlitskaya's avatar
      GBytes: add g_bytes_get_zero_copy_fd() · f2437b7f
      Allison Karlitskaya authored
      Add a way to get the zero-copy fd back out of a GBytes that was created
      from one.
      f2437b7f
    • Allison Karlitskaya's avatar
      GBytes: add new g_bytes_take_zero_copy_fd() function · 0da5aef9
      Allison Karlitskaya authored
      This function takes a memfd, seals it, and creates a GBytes based on it.
      0da5aef9
    • David King's avatar
      glib-unix: add function to ensure an fd is sealed · e1734aa7
      David King authored and Allison Karlitskaya's avatar Allison Karlitskaya committed
      Add a function that checks if a fd is sealed and, if it's not, seals it.
      
      On Linux this is more or less an operation on memfd.  On other systems,
      it currently always returns FALSE.
      e1734aa7
    • Allison Karlitskaya's avatar
      GBytes: substantial internal rework · dccedf88
      Allison Karlitskaya authored
      We have a wide variety of different sources of data for GBytes.
      
      Instead of having all possibilities inside of a single structure type,
      add a 'type' field and a couple of subtypes.
      
      This also forces us to clean up our access to the ->data pointer from
      all over the code which may become a problem in the future if we want to
      lazy-map memfd GBytes instances by keeping the data pointer as NULL
      until we are ready to use it.
      
      We also introduce a new type of GBytes: 'inline'.  This allows us to
      make a single allocation instead of two in the g_bytes_new() case.
      dccedf88
    • Allison Karlitskaya's avatar
      macros: add side-effecting variants of asserts · 39ca9d33
      Allison Karlitskaya authored
      Add g_assert_se(), g_return_if_fail_se() and g_return_val_if_fail_se()
      as variants of the existing macros that are guaranteed to evaluate side
      effects in their expression argument.  Inspired by similar macros in
      systemd.
      
      These are just macros, so they come at no extra cost.
      
      https://bugzilla.gnome.org/show_bug.cgi?id=741026
      39ca9d33
    • Ignacio Casal Quinteiro's avatar
    • Ignacio Casal Quinteiro's avatar
      gio: fix build · 22ab2273
      Ignacio Casal Quinteiro authored
      next time I should definitely try to compile after a rebase conflict...
      22ab2273
    • Ignacio Casal Quinteiro's avatar
      gio: add G_IO_ERROR_NOT_CONNECTED · fbfc2345
      Ignacio Casal Quinteiro authored
      It adds a new error G_IO_ERROR_NOT_CONNECTED
      and makes the win32 error ERROR_PIPE_LISTENING
      to be translated to it.
      
      https://bugzilla.gnome.org/show_bug.cgi?id=741016
      fbfc2345
  4. Dec 01, 2014
  5. Nov 29, 2014
  6. Nov 28, 2014
  7. Nov 27, 2014
  8. Nov 25, 2014
  9. Nov 24, 2014
  10. Nov 23, 2014
    • Dan Winship's avatar
      gio/tests: add a socket-listener test · e784a4ba
      Dan Winship authored
      Add a GSocketListener test program. Currently the only test is a
      regression test for bug 712570 (based on a standalone bug reproducer
      provided by Ross Lagerwall).
      e784a4ba