platform/upstream/glib.git
8 years ago[kdbus] Do not set body message if signature field is empty
Lukasz Skalski [Tue, 5 May 2015 14:44:09 +0000 (14:44 +0000)]
[kdbus] Do not set body message if signature field is empty

8 years ago[kdbus] More detailed description for ENOBUFS errno
Lukasz Skalski [Tue, 5 May 2015 11:48:01 +0000 (11:48 +0000)]
[kdbus] More detailed description for ENOBUFS errno

8 years ago[kdbus] Check max message size before appending bloom item
Lukasz Skalski [Tue, 5 May 2015 11:38:18 +0000 (11:38 +0000)]
[kdbus] Check max message size before appending bloom item

8 years ago[kdbus] Set error when we can't read filter parameters
Lukasz Skalski [Tue, 5 May 2015 10:42:57 +0000 (10:42 +0000)]
[kdbus] Set error when we can't read filter parameters

8 years ago[kdbus] Enable adding bloom filters items. Signals subscription refactoring.
Lukasz Skalski [Thu, 30 Apr 2015 18:35:29 +0000 (18:35 +0000)]
[kdbus] Enable adding bloom filters items. Signals subscription refactoring.

8 years ago[kdbus] Remove unused 'request_name_cb' callback
Lukasz Skalski [Thu, 30 Apr 2015 10:57:58 +0000 (10:57 +0000)]
[kdbus] Remove unused 'request_name_cb' callback

8 years ago[kdbus] fix problems with 'NameAqcuired' and 'NameLost' signals
Lukasz Skalski [Mon, 27 Apr 2015 13:07:28 +0000 (13:07 +0000)]
[kdbus] fix problems with 'NameAqcuired' and 'NameLost' signals

8 years ago[kdbus] Set error when the memory pool of the receiver is full.
Lukasz Skalski [Fri, 24 Apr 2015 10:08:08 +0000 (10:08 +0000)]
[kdbus] Set error when the memory pool of the receiver is full.

8 years ago[kdbus] Fix problem with releasing name
Lukasz Skalski [Thu, 23 Apr 2015 15:35:33 +0000 (15:35 +0000)]
[kdbus] Fix problem with releasing name

8 years ago[kdbus] Remove some debug. Set proper error code when service is not known.
Lukasz Skalski [Thu, 23 Apr 2015 14:20:31 +0000 (14:20 +0000)]
[kdbus] Remove some debug. Set proper error code when service is not known.

8 years ago[kdbus] Don't serialize message to a blob when we use kdbus transport
Lukasz Skalski [Thu, 23 Apr 2015 13:53:20 +0000 (13:53 +0000)]
[kdbus] Don't serialize message to a blob when we use kdbus transport

8 years ago[kdbus] Fix problem with receiving async messages
Lukasz Skalski [Thu, 23 Apr 2015 13:32:23 +0000 (13:32 +0000)]
[kdbus] Fix problem with receiving async messages

8 years ago[kdbus] sync with kdbus (commit: 17fc796582d3) 15/03/05
Lukasz Skalski [Thu, 5 Mar 2015 10:21:56 +0000 (10:21 +0000)]
[kdbus] sync with kdbus (commit: 17fc796582d3) 15/03/05

8 years ago[kdbus] sync with kdbus (commit: 614493bfe286) 15/02/24
Lukasz Skalski [Tue, 24 Feb 2015 12:17:08 +0000 (12:17 +0000)]
[kdbus] sync with kdbus (commit: 614493bfe286) 15/02/24

8 years ago[kdbus] Make SipHash function as a private utility function to kdbus
Lukasz Skalski [Tue, 24 Feb 2015 11:20:02 +0000 (11:20 +0000)]
[kdbus] Make SipHash function as a private utility function to kdbus

8 years agoSilent some warnings
Lukasz Skalski [Tue, 24 Feb 2015 10:14:30 +0000 (10:14 +0000)]
Silent some warnings

8 years ago[kdbus] sync with kdbus (commit: b078c757a3f9) 15/02/20
Lukasz Skalski [Fri, 20 Feb 2015 13:22:53 +0000 (13:22 +0000)]
[kdbus] sync with kdbus (commit: b078c757a3f9) 15/02/20

8 years ago[kdbus] Update kdbus interface header (commit: 92ee1030ea46) 15/02/18
Lukasz Skalski [Wed, 18 Feb 2015 14:31:18 +0000 (14:31 +0000)]
[kdbus] Update kdbus interface header (commit: 92ee1030ea46) 15/02/18

8 years ago[kdbus] KDBUS_ITEM_PAYLOAD_OFF items are (once again) relative to msg header
Lukasz Skalski [Fri, 13 Feb 2015 15:37:15 +0000 (15:37 +0000)]
[kdbus] KDBUS_ITEM_PAYLOAD_OFF items are (once again) relative to msg header

8 years ago[kdbus] Code cleanup
Lukasz Skalski [Fri, 13 Feb 2015 13:53:07 +0000 (13:53 +0000)]
[kdbus] Code cleanup

8 years ago[kdbus] Fix freeing allocated memory
Lukasz Skalski [Tue, 10 Feb 2015 12:40:15 +0000 (12:40 +0000)]
[kdbus] Fix freeing allocated memory

8 years ago[kdbus] Fix compilation errors
Lukasz Skalski [Fri, 6 Feb 2015 13:40:33 +0000 (13:40 +0000)]
[kdbus] Fix compilation errors

8 years ago[kdbus] Update kdbus interface header (commit: 0d8a559b20f) 15/02/06
Lukasz Skalski [Fri, 6 Feb 2015 12:40:07 +0000 (12:40 +0000)]
[kdbus] Update kdbus interface header (commit: 0d8a559b20f) 15/02/06

8 years agosetup proper bloom filters for AddMatch
Lukasz Skalski [Tue, 16 Dec 2014 14:52:33 +0000 (14:52 +0000)]
setup proper bloom filters for AddMatch

Change-Id: I836f7dbe96bde91492615b886ef34e7154502b8a

8 years agosome sort of actual progress here...
Ryan Lortie [Mon, 15 Dec 2014 13:00:56 +0000 (08:00 -0500)]
some sort of actual progress here...

8 years agoimprove bloom filter on send
Ryan Lortie [Fri, 12 Dec 2014 14:48:34 +0000 (09:48 -0500)]
improve bloom filter on send

Avoid creating GVariant instances that we don't need (non-strings) and
remove some bits from the filter (signatures and non-path-matches on
object paths, as per the dbus spec).

8 years agokdbus: use an absolute value for kmsg->timeout_ns
Lukasz Skalski [Thu, 11 Dec 2014 13:05:53 +0000 (13:05 +0000)]
kdbus: use an absolute value for kmsg->timeout_ns

Solution with KDBUS_TIMEOUT_NS macro is temporary - for test purposes.
We have to find better solution for setting timeout value

Conflicts:
gio/gkdbus.c

8 years agonow come the big changes...
Ryan Lortie [Fri, 12 Dec 2014 13:19:23 +0000 (08:19 -0500)]
now come the big changes...

also: update kdbus.h with nice new ABI breaks

8 years agowip junk
Ryan Lortie [Wed, 10 Dec 2014 15:56:38 +0000 (10:56 -0500)]
wip junk

8 years agohook gvariant vectors up to kdbus
Ryan Lortie [Sat, 6 Dec 2014 05:43:15 +0000 (00:43 -0500)]
hook gvariant vectors up to kdbus

8 years agooops
Ryan Lortie [Sat, 6 Dec 2014 05:30:57 +0000 (00:30 -0500)]
oops

8 years agochange user bus file locations
Ryan Lortie [Tue, 2 Dec 2014 20:16:46 +0000 (15:16 -0500)]
change user bus file locations

8 years agogdbus-tool: add support for new bus types
Ryan Lortie [Tue, 2 Dec 2014 19:45:30 +0000 (14:45 -0500)]
gdbus-tool: add support for new bus types

Add support for 'machine' and 'user' busses to the commandline tool.

8 years agogdbus-tool: simplify some logic
Ryan Lortie [Tue, 2 Dec 2014 19:42:55 +0000 (14:42 -0500)]
gdbus-tool: simplify some logic

This would have gotten pretty ugly with 5 possibilities...

8 years agoGDBus: add support for GVariant floats to helpers
Ryan Lortie [Tue, 2 Dec 2014 19:35:21 +0000 (14:35 -0500)]
GDBus: add support for GVariant floats to helpers

Add support for G_VARIANT_TYPE_FLOAT to some helper functions.

We don't add support to the core serialiser because the sending side
already has a catch-all case for unsupported types (because of maybe
types) and the receiving side will never see floats on the wire.

https://bugzilla.gnome.org/show_bug.cgi?id=740897

8 years ago[kdbus] sync with kdbus (kdbus.h - commit: b024fb43c66b)
Lukasz Skalski [Wed, 26 Nov 2014 15:06:15 +0000 (15:06 +0000)]
[kdbus] sync with kdbus (kdbus.h - commit: b024fb43c66b)

8 years ago[kdbus][wip] Import code from tizen.org repo
Lukasz Skalski [Fri, 21 Nov 2014 16:23:28 +0000 (17:23 +0100)]
[kdbus][wip] Import code from tizen.org repo

8 years ago[kdbus] Remove redundant g_dbus_name_has_owner() function from new API
Lukasz Skalski [Fri, 21 Nov 2014 14:50:20 +0000 (14:50 +0000)]
[kdbus] Remove redundant g_dbus_name_has_owner() function from new API

https://bugzilla.gnome.org/show_bug.cgi?id=721861#c38

8 years ago[kdbus] sync with kdbus (kdbus.h - commit: 5ae1ecac44cb)
Lukasz Skalski [Fri, 21 Nov 2014 11:44:01 +0000 (11:44 +0000)]
[kdbus] sync with kdbus (kdbus.h - commit: 5ae1ecac44cb)

8 years ago[kdbus] Add possibility to unsubscribe NameAcquired and NameLost signals
Lukasz Skalski [Wed, 29 Oct 2014 14:15:15 +0000 (14:15 +0000)]
[kdbus] Add possibility to unsubscribe NameAcquired and NameLost signals

8 years ago[kdbus] Add RequestName and ReleaseName to new API
Lukasz Skalski [Wed, 29 Oct 2014 12:36:35 +0000 (12:36 +0000)]
[kdbus] Add RequestName and ReleaseName to new API

8 years ago[kdbus] set const cookies for NameAcquired and NameLost subscriptions
Lukasz Skalski [Tue, 28 Oct 2014 15:37:49 +0000 (15:37 +0000)]
[kdbus] set const cookies for NameAcquired and NameLost subscriptions

8 years ago[kdbus][wip] Add matches for kernel notifications
Lukasz Skalski [Mon, 27 Oct 2014 13:05:08 +0000 (13:05 +0000)]
[kdbus][wip] Add matches for kernel notifications

8 years ago[kdbus] Initial support for decoding kernel messages
Lukasz Skalski [Thu, 23 Oct 2014 14:22:06 +0000 (14:22 +0000)]
[kdbus] Initial support for decoding kernel messages

8 years ago[kdbus] Enable 'initial_read()' - is no longer needed
Lukasz Skalski [Thu, 23 Oct 2014 13:40:19 +0000 (13:40 +0000)]
[kdbus] Enable 'initial_read()' - is no longer needed

8 years ago[kdbus] Add initial support for receiving messages
Lukasz Skalski [Thu, 23 Oct 2014 13:34:42 +0000 (13:34 +0000)]
[kdbus] Add initial support for receiving messages

8 years ago[kdbus] Integrate acquiring and releasing names on kdbus with GLib core
Lukasz Skalski [Thu, 23 Oct 2014 11:11:08 +0000 (11:11 +0000)]
[kdbus] Integrate acquiring and releasing names on kdbus with GLib core

Now it's possible to use GLib API for owning bus names, like:
g_bus_own_name() or g_bus_own_name_on_connection(). It is not yet
fully functional until I'll add 'Add Match' method on kdbus, so
g_bus_unown_name() still doesn't invoke proper handler, when 'name'
is lost - work in progress.

8 years ago[kdbus] Add support for 'ReleaseName' on kdbus
Lukasz Skalski [Wed, 22 Oct 2014 12:23:59 +0000 (12:23 +0000)]
[kdbus] Add support for 'ReleaseName' on kdbus

8 years ago[kdbus] Add support for 'RequestName' on kdbus
Lukasz Skalski [Wed, 22 Oct 2014 11:54:33 +0000 (11:54 +0000)]
[kdbus] Add support for 'RequestName' on kdbus

8 years ago[kdbus] Add G_BUS_NAME_OWNER_FLAGS_DO_NOT_QUEUE flag
Lukasz Skalski [Wed, 22 Oct 2014 10:40:55 +0000 (10:40 +0000)]
[kdbus] Add G_BUS_NAME_OWNER_FLAGS_DO_NOT_QUEUE flag

New flag is equivalent to DBUS_NAME_FLAG_DO_NOT_QUEUE flag from
dbus-1 specification [1].

[1] http://dbus.freedesktop.org/doc/dbus-specification.html

Change-Id: I8a50aa586abd5b0ffcbc0bdc41c2e98c18a2e18a

8 years ago[kdbus][TEMPORARY HACK] Disable 'initial read'
Lukasz Skalski [Mon, 20 Oct 2014 16:05:34 +0000 (16:05 +0000)]
[kdbus][TEMPORARY HACK] Disable 'initial read'

This patch allows perform new API test [1] without errors.
'initial_read' should be disabled till old patches from
Tizen repo [2] will be applied in this GitHub repository.

[1] https://github.com/lukasz-skalski/glib-kdbus-tests
[2] https://review.tizen.org/git/?p=platform/upstream/glib.git;a=shortlog;h=refs/heads/kdbus-integration

8 years ago[kdbus] Catch up with latest kdbus changes
Lukasz Skalski [Mon, 20 Oct 2014 10:49:04 +0000 (10:49 +0000)]
[kdbus] Catch up with latest kdbus changes

8 years ago[kdbus] Update kdbus interface header (commit: 017f56c7e53f) 14/10/20
Lukasz Skalski [Mon, 20 Oct 2014 10:44:40 +0000 (10:44 +0000)]
[kdbus] Update kdbus interface header (commit: 017f56c7e53f) 14/10/20

8 years ago[kdbus] Integrate kdbus core with new API.
Lukasz Skalski [Thu, 16 Oct 2014 14:25:01 +0000 (16:25 +0200)]
[kdbus] Integrate kdbus core with new API.

Change-Id: I4c9b3853af0f25123dc0cb1dfce6a86c102ee08f

8 years ago[kdbus] Update kdbus interface header (commit: b620b72c9127) 14/10/16
Lukasz Skalski [Thu, 16 Oct 2014 14:20:35 +0000 (16:20 +0200)]
[kdbus] Update kdbus interface header (commit: b620b72c9127) 14/10/16

Change-Id: I47d31f6cd810f452c31154f7aaff5903a5566ab3

8 years ago[kdbus] Rework kdbus core files
Lukasz Skalski [Thu, 16 Oct 2014 14:15:42 +0000 (16:15 +0200)]
[kdbus] Rework kdbus core files

Change-Id: I09fd49dcc5557b25c49752a45d150e69e2886d47

8 years ago[kdbus] Import gio/gkdbus* files from previous patchset.
Lukasz Skalski [Mon, 6 Oct 2014 13:41:17 +0000 (15:41 +0200)]
[kdbus] Import gio/gkdbus* files from previous patchset.

With new kdbus.h header, imported files are outdated and will be
reworked soon.

Change-Id: Idfe94c7f72e81cd9910fceb8ac0664140b5eba90

8 years ago[kdbus] Update kdbus interface header (commit: c34e65633b4e)
Lukasz Skalski [Mon, 6 Oct 2014 13:08:34 +0000 (15:08 +0200)]
[kdbus] Update kdbus interface header (commit: c34e65633b4e)

Change-Id: Ib9bd554d3bf2d7dacc6c143038253fe2e7f177a8

8 years ago[kdbus] Initial support for two new bus types: 'user' and 'machine'
Lukasz Skalski [Mon, 29 Sep 2014 15:34:05 +0000 (17:34 +0200)]
[kdbus] Initial support for two new bus types: 'user' and 'machine'

Change-Id: I3976e3935a01ea8d67b9a41997d0be8a37765d00

8 years ago[kdbus] Add "--enable-kdbus" configure switch
Lukasz Skalski [Mon, 29 Sep 2014 15:01:06 +0000 (17:01 +0200)]
[kdbus] Add "--enable-kdbus" configure switch

Change-Id: Id22e381c0d9dd9cda194ac8a3a03a1d1362a13ca

8 years ago[kdbus] Import kdbus interface header (commit: 5df28e6dd30b)
Lukasz Skalski [Mon, 29 Sep 2014 10:37:10 +0000 (12:37 +0200)]
[kdbus] Import kdbus interface header (commit: 5df28e6dd30b)

Change-Id: Iec05e26a512c3e923442bd9d4fcc3e8ad94df36b

8 years ago[kdbus] Add new library API for common tasks on dbus/kdbus
Lukasz Skalski [Fri, 22 Aug 2014 13:53:59 +0000 (15:53 +0200)]
[kdbus] Add new library API for common tasks on dbus/kdbus

For kdbus purpose we need introduce two new bus types
called "user" and "machine". Will not be possible to
make calls to the 'org.freedesktop.DBus' destination on
the new bus types, thus this patch introduce new API
for tasks such as "get Unix user ID of the process connected
to the server", "returns a list of all currently-owned names
on the bus" and so on.

Change-Id: Ib9ba65346290d597341d4157b09cb45bd3d1151d

8 years ago[kdbus] Add SipHash algorithm
Lukasz Skalski [Fri, 22 Aug 2014 12:49:29 +0000 (14:49 +0200)]
[kdbus] Add SipHash algorithm

Change-Id: I83f28c2249efd6dc8cf78e0383916c46d71df075

8 years ago[kdbus] Add README.md file
Lukasz Skalski [Fri, 22 Aug 2014 12:48:53 +0000 (14:48 +0200)]
[kdbus] Add README.md file

Change-Id: I064de04278990abe97bea28d1b80ddc3f42a05e0

8 years agogrow our __NR_memfd_create collection
Ryan Lortie [Thu, 4 Dec 2014 15:51:30 +0000 (10:51 -0500)]
grow our __NR_memfd_create collection

Also add a fallback case in case we don't know the arch.

8 years agooops
Ryan Lortie [Thu, 4 Dec 2014 02:28:24 +0000 (21:28 -0500)]
oops

8 years agofurther cleanup
Ryan Lortie [Thu, 4 Dec 2014 02:20:32 +0000 (21:20 -0500)]
further cleanup

8 years agocleanup
Ryan Lortie [Thu, 4 Dec 2014 02:06:28 +0000 (21:06 -0500)]
cleanup

8 years agofinish up vector deserialiser
Ryan Lortie [Thu, 4 Dec 2014 01:35:18 +0000 (20:35 -0500)]
finish up vector deserialiser

seems to have stopped crashing now...

8 years agotests: add GBytes memfd testcase
Ryan Lortie [Wed, 3 Dec 2014 22:16:37 +0000 (17:16 -0500)]
tests: add GBytes memfd testcase

8 years agoAdd new internal header glib-linux.h
Ryan Lortie [Wed, 3 Dec 2014 22:15:31 +0000 (17:15 -0500)]
Add new internal header glib-linux.h

This defines some constants and syscall wrappers for features which may
not yet have appeared in the libc.

8 years agoGBytes: two memfd tweaks
Ryan Lortie [Wed, 3 Dec 2014 22:13:43 +0000 (17:13 -0500)]
GBytes: two memfd tweaks

 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

8 years agostart fleshing out guts of vector deserialiser
Ryan Lortie [Wed, 3 Dec 2014 08:12:06 +0000 (03:12 -0500)]
start fleshing out guts of vector deserialiser

8 years agoGVariant vector deserialiser WIP
Ryan Lortie [Wed, 3 Dec 2014 07:14:19 +0000 (02:14 -0500)]
GVariant vector deserialiser WIP

8 years agoGVariant: clean up g_variant_get_child_value()
Ryan Lortie [Wed, 3 Dec 2014 07:10:24 +0000 (02:10 -0500)]
GVariant: clean up g_variant_get_child_value()

Remove this one outstanding case of direct construction of GVariant
instances and port it to use g_variant_alloc() like everyone else.

8 years agoGVariant: use GVariantTypeInfo on internal constructors
Ryan Lortie [Wed, 3 Dec 2014 07:04:33 +0000 (02:04 -0500)]
GVariant: use GVariantTypeInfo on internal constructors

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.

8 years agoGVariant: clean up serialised data handling API
Ryan Lortie [Sat, 29 Nov 2014 20:58:49 +0000 (15:58 -0500)]
GVariant: clean up serialised data handling API

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.

8 years agoGVariant: fix a trivial typo in a comment
Ryan Lortie [Sat, 29 Nov 2014 20:57:06 +0000 (15:57 -0500)]
GVariant: fix a trivial typo in a comment

8 years agoGVariant: add support for single precision floats
Ryan Lortie [Sat, 29 Nov 2014 19:07:46 +0000 (14:07 -0500)]
GVariant: add support for single precision floats

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

8 years agoGVariant test: add a new vector serialisation test
Ryan Lortie [Fri, 28 Nov 2014 22:56:01 +0000 (17:56 -0500)]
GVariant test: add a new vector serialisation test

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).

8 years agoGVariant: support serialising to GVariantVectors
Ryan Lortie [Fri, 28 Nov 2014 22:57:30 +0000 (17:57 -0500)]
GVariant: support serialising to GVariantVectors

Add code for serialising GVariant to GVariantVectors.

Export that internally via the glib-private machanism so that we can use
it from GDBus.

8 years agoGVariant: add GVariantVectors utility struct
Ryan Lortie [Fri, 28 Nov 2014 19:23:20 +0000 (14:23 -0500)]
GVariant: add GVariantVectors utility struct

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.

8 years agoGVariant: refactor locking a bit more
Ryan Lortie [Sat, 29 Nov 2014 20:04:45 +0000 (15:04 -0500)]
GVariant: refactor locking a bit more

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.

8 years agoGVariant: add internal tree-form locking helper
Ryan Lortie [Fri, 28 Nov 2014 20:42:34 +0000 (15:42 -0500)]
GVariant: add internal tree-form locking helper

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.

8 years agoGVariant: calculate size at construction
Ryan Lortie [Thu, 27 Nov 2014 21:37:13 +0000 (16:37 -0500)]
GVariant: calculate size at construction

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.

8 years agoGBytes: add g_bytes_get_zero_copy_fd()
Ryan Lortie [Tue, 2 Dec 2014 19:29:04 +0000 (14:29 -0500)]
GBytes: add g_bytes_get_zero_copy_fd()

Add a way to get the zero-copy fd back out of a GBytes that was created
from one.

8 years agoGBytes: add new g_bytes_take_zero_copy_fd() function
Ryan Lortie [Tue, 2 Dec 2014 18:17:35 +0000 (13:17 -0500)]
GBytes: add new g_bytes_take_zero_copy_fd() function

This function takes a memfd, seals it, and creates a GBytes based on it.

8 years agoglib-unix: add function to ensure an fd is sealed
David King [Tue, 2 Dec 2014 18:16:47 +0000 (13:16 -0500)]
glib-unix: add function to ensure an fd is sealed

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.

8 years agoGBytes: substantial internal rework
Ryan Lortie [Tue, 2 Dec 2014 18:16:25 +0000 (13:16 -0500)]
GBytes: substantial internal rework

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.

8 years agomacros: add side-effecting variants of asserts
Ryan Lortie [Mon, 1 Dec 2014 21:33:32 +0000 (16:33 -0500)]
macros: add side-effecting variants of asserts

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

8 years agogio: provide G_IO_ERROR_NOT_CONNECTED translation for ENOTCONN
Ignacio Casal Quinteiro [Tue, 2 Dec 2014 13:25:56 +0000 (14:25 +0100)]
gio: provide G_IO_ERROR_NOT_CONNECTED translation for ENOTCONN

https://bugzilla.gnome.org/show_bug.cgi?id=741016

8 years agogio: fix build
Ignacio Casal Quinteiro [Tue, 2 Dec 2014 13:29:11 +0000 (14:29 +0100)]
gio: fix build

next time I should definitely try to compile after a rebase conflict...

8 years agogio: add G_IO_ERROR_NOT_CONNECTED
Ignacio Casal Quinteiro [Tue, 2 Dec 2014 12:50:51 +0000 (13:50 +0100)]
gio: add G_IO_ERROR_NOT_CONNECTED

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

8 years agodocs: Add index for 2.44 api
Rico Tzschichholz [Mon, 1 Dec 2014 13:16:54 +0000 (14:16 +0100)]
docs: Add index for 2.44 api

8 years agoUpdated Vietnamese translation
Trần Ngọc Quân [Mon, 1 Dec 2014 02:07:13 +0000 (09:07 +0700)]
Updated Vietnamese translation

Signed-off-by: Trần Ngọc Quân <vnwildman@gmail.com>
8 years agogsocket: add G_IO_ERROR_CONNECTION_CLOSED
Dan Winship [Fri, 19 Aug 2011 14:23:12 +0000 (10:23 -0400)]
gsocket: add G_IO_ERROR_CONNECTION_CLOSED

Add G_IO_ERROR_CONNECTION_CLOSED as an alias for
G_IO_ERROR_BROKEN_PIPE, and also return it on ECONNRESET.

It doesn't really make sense to try to distinguish EPIPE and
ECONNRESET at the GLib level, since the exact choice of which error
gets returned in what conditions depends on the OS. Given that, we
ought to map the two errors to the same value, and since we're already
mapping EPIPE to G_IO_ERROR_BROKEN_PIPE, we need to map ECONNRESET to
that too. But the existing name doesn't really make sense for sockets,
so we add a new name.

https://bugzilla.gnome.org/show_bug.cgi?id=728928

8 years agognetworkaddress: Add g_network_address_new_loopback() constructor
Dan Winship [Sun, 23 Nov 2014 17:53:03 +0000 (12:53 -0500)]
gnetworkaddress: Add g_network_address_new_loopback() constructor

This is a convenience method for creating a GNetworkAddress which is
guaranteed to return IPv4 and IPv6 loopback addresses. The program
cannot guarantee that 'localhost' will resolve to both types of
address, so programs which wish to connect to a local service over
either IPv4 or IPv6 must currently manually create an IPv4 and another
IPv6 socket, and detect which of the two are working. This new API
allows the existing GSocketConnectable machinery to be used to
automate that.

Based on a patch from Philip Withnall.

https://bugzilla.gnome.org/show_bug.cgi?id=732317

8 years agoGVariant tests: test with larger strings
Ryan Lortie [Fri, 28 Nov 2014 22:55:28 +0000 (17:55 -0500)]
GVariant tests: test with larger strings

Allocate some larger strings in the testcase to make sure we handle them
correctly as well.

8 years agogmain: fix poll record comparison
Ryan Lortie [Fri, 28 Nov 2014 17:43:03 +0000 (12:43 -0500)]
gmain: fix poll record comparison

We intend to keep the list of poll records sorted by (integer) file
descriptor, but due to a typo we are actually keeping it sorted by
pointer address of the GPollFD.

Fix that.

https://bugzilla.gnome.org/show_bug.cgi?id=11059

8 years agogsignal: add a clarification to the docs
Ryan Lortie [Fri, 28 Nov 2014 21:20:40 +0000 (16:20 -0500)]
gsignal: add a clarification to the docs

As evidenced by a mistake that I made recently, this documentation could
use a little bit of clarification.