[-]
[+]
|
Changed |
_service:tar_git:libgbinder.changes
|
|
[-]
[+]
|
Changed |
_service:tar_git:libgbinder.spec
^
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -2,6 +2,6 @@
<service name="tar_git">
<param name="url">https://github.com/mer-hybris/libgbinder.git</param>
<param name="branch">master</param>
- <param name="revision">1.0.34</param>
+ <param name="revision">1.0.46</param>
</service>
</services>
\ No newline at end of file
|
[-]
[+]
|
Deleted |
_service:tar_git:libgbinder-1.0.34.tar.bz2/debian/libgbinder-dev.install
^
|
@@ -1,3 +0,0 @@
-debian/tmp/usr/lib/libgbinder.so usr/lib
-include/*.h usr/include/gbinder
-build/libgbinder.pc usr/lib/pkgconfig
|
[-]
[+]
|
Deleted |
_service:tar_git:libgbinder-1.0.34.tar.bz2/debian/libgbinder.install
^
|
@@ -1 +0,0 @@
-debian/tmp/usr/lib/libgbinder.so.* usr/lib
|
[-]
[+]
|
Changed |
_service:tar_git:libgbinder-1.0.46.tar.bz2/.gitignore
^
|
@@ -1,13 +1,13 @@
*~
debian/files
-debian/libgbinder-dev.debhelper.log
-debian/libgbinder-dev.substvars
-debian/libgbinder-dev
-debian/libgbinder.debhelper.log
-debian/libgbinder.postinst.debhelper
-debian/libgbinder.postrm.debhelper
-debian/libgbinder.substvars
debian/libgbinder
+debian/libgbinder-dev
+debian/libgbinder-tools
+debian/*.debhelper.log
+debian/*.debhelper
+debian/*.substvars
+debian/libgbinder.install
+debian/libgbinder-dev.install
debian/tmp
documentation.list
installroot
|
[-]
[+]
|
Changed |
_service:tar_git:libgbinder-1.0.46.tar.bz2/LICENSE
^
|
@@ -1,5 +1,5 @@
-Copyright (C) 2018-2019 Jolla Ltd.
-Copyright (C) 2018-2019 Slava Monich <slava.monich@jolla.com>
+Copyright (C) 2018-2020 Jolla Ltd.
+Copyright (C) 2018-2020 Slava Monich <slava.monich@jolla.com>
You may use this file under the terms of BSD license as follows:
|
[-]
[+]
|
Changed |
_service:tar_git:libgbinder-1.0.46.tar.bz2/Makefile
^
|
@@ -1,4 +1,8 @@
# -*- Mode: makefile-gmake -*-
+#
+# LIBGLIBUTIL_PATH can be defined to point to libglibutil root directory
+# for side-by-side build.
+#
.PHONY: clean all debug release test
.PHONY: print_debug_so print_release_so
@@ -7,10 +11,15 @@
.PHONY: print_debug_path print_release_path
#
-# Required packages
+# Library version
#
-PKGS = libglibutil glib-2.0 gobject-2.0
+VERSION_MAJOR = 1
+VERSION_MINOR = 0
+VERSION_RELEASE = 46
+
+# Version for pkg-config
+PCVERSION = $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_RELEASE)
#
# Default target
@@ -19,15 +28,34 @@
all: debug release pkgconfig
#
-# Library version
+# Required packages
#
-VERSION_MAJOR = 1
-VERSION_MINOR = 0
-VERSION_RELEASE = 34
+PKGS = glib-2.0 gobject-2.0
-# Version for pkg-config
-PCVERSION = $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_RELEASE)
+ifeq ($(LIBGLIBUTIL_PATH),)
+
+# Assume that libglibutil devel package is installed
+PKGS += libglibutil
+
+else
+
+# Side-by-side build
+INCLUDES += -I$(LIBGLIBUTIL_PATH)/include
+DEBUG_LIBS = -L$(LIBGLIBUTIL_PATH)/build/debug -lglibutil
+RELEASE_LIBS = -L$(LIBGLIBUTIL_PATH)/build/release -lglibutil
+DEBUG_DEPS = libglibutil_debug
+RELEASE_DEPS = libglibutil_release
+
+.PHONY: libglibutil_debug libglibutil_release
+
+libglibutil_debug:
+ make -C $(LIBGLIBUTIL_PATH) debug
+
+libglibutil_release:
+ make -C $(LIBGLIBUTIL_PATH) release
+
+endif
#
# Library name
@@ -51,12 +79,14 @@
gbinder_cleanup.c \
gbinder_client.c \
gbinder_driver.c \
+ gbinder_eventloop.c \
gbinder_io_32.c \
gbinder_io_64.c \
gbinder_ipc.c \
gbinder_local_object.c \
gbinder_local_reply.c \
gbinder_local_request.c \
+ gbinder_log.c \
gbinder_reader.c \
gbinder_remote_object.c \
gbinder_remote_reply.c \
@@ -89,10 +119,11 @@
# Tools and flags
#
-CC = $(CROSS_COMPILE)gcc
+CC ?= $(CROSS_COMPILE)gcc
+STRIP ?= strip
LD = $(CC)
WARNINGS = -Wall -Wstrict-aliasing -Wunused-result
-INCLUDES = -I$(INCLUDE_DIR)
+INCLUDES += -I$(INCLUDE_DIR)
BASE_FLAGS = -fPIC
FULL_CFLAGS = $(BASE_FLAGS) $(CFLAGS) $(DEFINES) $(WARNINGS) $(INCLUDES) \
-MMD -MP $(shell pkg-config --cflags $(PKGS))
@@ -102,16 +133,13 @@
RELEASE_FLAGS =
COVERAGE_FLAGS = -g
-ifndef KEEP_SYMBOLS
-KEEP_SYMBOLS = 0
-endif
-
+KEEP_SYMBOLS ?= 0
ifneq ($(KEEP_SYMBOLS),0)
RELEASE_FLAGS += -g
endif
-DEBUG_LDFLAGS = $(FULL_LDFLAGS) $(DEBUG_FLAGS)
-RELEASE_LDFLAGS = $(FULL_LDFLAGS) $(RELEASE_FLAGS)
+DEBUG_LDFLAGS = $(FULL_LDFLAGS) $(DEBUG_LIBS) $(DEBUG_FLAGS)
+RELEASE_LDFLAGS = $(FULL_LDFLAGS) $(RELEASE_LIBS) $(RELEASE_FLAGS)
DEBUG_CFLAGS = $(FULL_CFLAGS) $(DEBUG_FLAGS) -DDEBUG
RELEASE_CFLAGS = $(FULL_CFLAGS) $(RELEASE_FLAGS) -O2
COVERAGE_CFLAGS = $(FULL_CFLAGS) $(COVERAGE_FLAGS) --coverage
@@ -137,8 +165,8 @@
endif
$(PKGCONFIG): | $(BUILD_DIR)
-$(DEBUG_OBJS) $(DEBUG_SO): | $(DEBUG_BUILD_DIR)
-$(RELEASE_OBJS) $(RELEASE_SO): | $(RELEASE_BUILD_DIR)
+$(DEBUG_OBJS) $(DEBUG_SO): | $(DEBUG_BUILD_DIR) $(DEBUG_DEPS)
+$(RELEASE_OBJS) $(RELEASE_SO): | $(RELEASE_BUILD_DIR) $(RELEASE_DEPS)
$(COVERAGE_OBJS) $(COVERAGE_LIB): | $(COVERAGE_BUILD_DIR)
#
@@ -149,13 +177,15 @@
RELEASE_SO = $(RELEASE_BUILD_DIR)/$(LIB_SO)
DEBUG_LINK = $(DEBUG_BUILD_DIR)/$(LIB_SYMLINK1)
RELEASE_LINK = $(RELEASE_BUILD_DIR)/$(LIB_SYMLINK1)
+DEBUG_DEV_LINK = $(DEBUG_BUILD_DIR)/$(LIB_DEV_SYMLINK)
+RELEASE_DEV_LINK = $(RELEASE_BUILD_DIR)/$(LIB_DEV_SYMLINK)
DEBUG_LIB = $(DEBUG_BUILD_DIR)/$(LIB)
RELEASE_LIB = $(RELEASE_BUILD_DIR)/$(LIB)
COVERAGE_LIB = $(COVERAGE_BUILD_DIR)/$(LIB)
-debug: $(DEBUG_SO)
+debug: $(DEBUG_SO) $(DEBUG_LINK) $(DEBUG_DEV_LINK)
-release: $(RELEASE_SO)
+release: $(RELEASE_SO) $(RELEASE_LINK) $(RELEASE_DEV_LINK)
debug_lib: $(DEBUG_LIB)
@@ -201,6 +231,7 @@
rm -fr debian/tmp debian/libgbinder debian/libgbinder-dev
rm -f documentation.list debian/files debian/*.substvars
rm -f debian/*.debhelper.log debian/*.debhelper debian/*~
+ rm -f debian/libgbinder.install debian/libgbinder-dev.install
test:
make -C unit test
@@ -228,13 +259,11 @@
$(DEBUG_SO): $(DEBUG_OBJS)
$(LD) $(DEBUG_OBJS) $(DEBUG_LDFLAGS) -o $@
- ln -sf $(LIB_SO) $(DEBUG_LINK)
$(RELEASE_SO): $(RELEASE_OBJS)
$(LD) $(RELEASE_OBJS) $(RELEASE_LDFLAGS) -o $@
- ln -sf $(LIB_SO) $(RELEASE_LINK)
ifeq ($(KEEP_SYMBOLS),0)
- strip $@
+ $(STRIP) $@
endif
$(DEBUG_LIB): $(DEBUG_OBJS)
@@ -245,12 +274,35 @@
$(AR) rc $@ $?
ranlib $@
+$(DEBUG_LINK):
+ ln -sf $(LIB_SO) $@
+
+$(RELEASE_LINK):
+ ln -sf $(LIB_SO) $@
+
+$(DEBUG_DEV_LINK):
+ ln -sf $(LIB_SYMLINK1) $@
+
+$(RELEASE_DEV_LINK):
+ ln -sf $(LIB_SYMLINK1) $@
+
$(COVERAGE_LIB): $(COVERAGE_OBJS)
$(AR) rc $@ $?
ranlib $@
+#
+# LIBDIR usually gets substituted with arch specific dir.
+# It's relative in deb build and can be whatever in rpm build.
+#
+
+LIBDIR ?= usr/lib
+ABS_LIBDIR := $(shell echo /$(LIBDIR) | sed -r 's|/+|/|g')
+
$(PKGCONFIG): $(LIB_NAME).pc.in Makefile
- sed -e 's/\[version\]/'$(PCVERSION)/g $< > $@
+ sed -e 's|@version@|$(PCVERSION)|g' -e 's|@libdir@|$(ABS_LIBDIR)|g' $< > $@
|
[-]
[+]
|
Changed |
_service:tar_git:libgbinder-1.0.46.tar.bz2/debian/changelog
^
|
@@ -1,3 +1,80 @@
+libgbinder (1.0.46) unstable; urgency=low
+
+ * Make sure we drop fds that are going to be closed
+ * Better diagnostics for polling failures
+ * Package binder-list and binder-ping utilities
+
+ -- Slava Monich <slava.monich@jolla.com> Fri, 31 Jul 2020 02:04:38 +0300
+
+libgbinder (1.0.45) unstable; urgency=low
+
+ * Always provide data buffer for hidl vector
+
+ -- Slava Monich <slava.monich@jolla.com> Mon, 27 Jul 2020 23:19:25 +0300
+
+libgbinder (1.0.44) unstable; urgency=low
+
+ * Never drop valid incoming transactions
+
+ -- Slava Monich <slava.monich@jolla.com> Mon, 29 Jun 2020 17:05:22 +0300
+
+libgbinder (1.0.43) unstable; urgency=low
+
+ * Hide internal symbols
+ * Respect arch specific lib dir
+ * Allow strip command to be replaced via environment variable
+
+ -- Slava Monich <slava.monich@jolla.com> Wed, 03 Jun 2020 15:15:40 +0300
+
+libgbinder (1.0.42) unstable; urgency=low
+
+ * Allow GBinderClient to use multiple interfaces
+
+ -- Slava Monich <slava.monich@jolla.com> Tue, 05 May 2020 19:56:39 +0300
+
+libgbinder (1.0.41) unstable; urgency=low
+
+ * Stop using GUtilIdlePool
+
+ -- Slava Monich <slava.monich@jolla.com> Tue, 14 Apr 2020 12:36:54 +0300
+
+libgbinder (1.0.40) unstable; urgency=low
+
+ * Support integration with non-glib event loops
+
+ -- Slava Monich <slava.monich@jolla.com> Thu, 09 Apr 2020 17:22:12 +0300
+
+libgbinder (1.0.39) unstable; urgency=low
+
+ * Adapted to side-by-side linking
+
+ -- Slava Monich <slava.monich@jolla.com> Thu, 02 Apr 2020 18:07:16 +0300
+
+libgbinder (1.0.38) unstable; urgency=low
+
+ * Allow to configure log level via environment
+
+ -- Slava Monich <slava.monich@jolla.com> Thu, 02 Apr 2020 00:12:01 +0300
+
+libgbinder (1.0.37) unstable; urgency=low
+
+ * Allow side-by-side linking with libglibutil
+ * Fixed compilation warnings
+
+ -- Slava Monich <slava.monich@jolla.com> Tue, 17 Mar 2020 20:15:11 +0200
+
+libgbinder (1.0.36) unstable; urgency=low
+
+ * Allow overwriting CC
+
+ -- Slava Monich <slava.monich@jolla.com> Mon, 16 Mar 2020 16:15:24 +0200
+
+libgbinder (1.0.35) unstable; urgency=low
+
+ * Added binder-ping example
+
+ -- Slava Monich <slava.monich@jolla.com> Tue, 25 Feb 2020 13:58:19 +0200
+
libgbinder (1.0.34) unstable; urgency=low
* Better cleanup on unload to prevent crashes on exit
|
[-]
[+]
|
Changed |
_service:tar_git:libgbinder-1.0.46.tar.bz2/debian/control
^
|
@@ -2,7 +2,7 @@
Section: libs
Priority: optional
Maintainer: Slava Monich <slava.monich@jolla.com>
-Build-Depends: debhelper (>= 7), libglib2.0-dev (>= 2.0), libglibutil (>= 1.0.35)
+Build-Depends: debhelper (>= 8.1.3), libglib2.0-dev (>= 2.0), libglibutil (>= 1.0.35)
Standards-Version: 3.8.4
Package: libgbinder
@@ -16,3 +16,9 @@
Architecture: any
Depends: libgbinder (= ${binary:Version}), ${misc:Depends}
Description: Development files for libgbinder
+
+Package: libgbinder-tools
+Section: utils
+Architecture: any
+Depends: libgbinder, ${misc:Depends}
+Description: Binder command line utilities
|
[-]
[+]
|
Changed |
_service:tar_git:libgbinder-1.0.46.tar.bz2/debian/copyright
^
|
@@ -1,5 +1,5 @@
-Copyright (C) 2018 Jolla Ltd.
-Copyright (C) 2018 Slava Monich <slava.monich@jolla.com>
+Copyright (C) 2018-2020 Jolla Ltd.
+Copyright (C) 2018-2020 Slava Monich <slava.monich@jolla.com>
You may use this file under the terms of BSD license as follows:
@@ -12,9 +12,9 @@
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- 3. Neither the name of Jolla Ltd nor the names of its contributors may
- be used to endorse or promote products derived from this software
- without specific prior written permission.
+ 3. Neither the names of the copyright holders nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
[-]
[+]
|
Added |
_service:tar_git:libgbinder-1.0.46.tar.bz2/debian/libgbinder-dev.install.in
^
|
@@ -0,0 +1,3 @@
+debian/tmp/@LIBDIR@/libgbinder.so @LIBDIR@
+debian/tmp/@LIBDIR@/pkgconfig/libgbinder.pc @LIBDIR@/pkgconfig
+debian/tmp/usr/include/* usr/include
|
[-]
[+]
|
Added |
_service:tar_git:libgbinder-1.0.46.tar.bz2/debian/libgbinder-tools.install
^
|
@@ -0,0 +1 @@
+debian/tmp/usr/bin/* usr/bin
|
[-]
[+]
|
Added |
_service:tar_git:libgbinder-1.0.46.tar.bz2/debian/libgbinder.install.in
^
|
@@ -0,0 +1 @@
+debian/tmp/@LIBDIR@/libgbinder.so.* @LIBDIR@
|
[-]
[+]
|
Changed |
_service:tar_git:libgbinder-1.0.46.tar.bz2/debian/rules
^
|
@@ -4,8 +4,17 @@
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
+LIBDIR=usr/lib/$(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
+
+override_dh_auto_build:
+ dh_auto_build -- LIBDIR=$(LIBDIR) release pkgconfig debian/libgbinder.install debian/libgbinder-dev.install
+ dh_auto_build -- -C test/binder-list release
+ dh_auto_build -- -C test/binder-ping release
+
override_dh_auto_install:
- dh_auto_install -- install-dev
+ dh_auto_install -- LIBDIR=$(LIBDIR) install-dev
+ dh_auto_install -- -C test/binder-list
+ dh_auto_install -- -C test/binder-ping
%:
dh $@
|
[-]
[+]
|
Changed |
_service:tar_git:libgbinder-1.0.46.tar.bz2/include/gbinder_client.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2018-2019 Jolla Ltd.
- * Copyright (C) 2018-2019 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2018-2020 Jolla Ltd.
+ * Copyright (C) 2018-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -37,6 +37,11 @@
G_BEGIN_DECLS
+typedef struct gbinder_client_iface_info {
+ const char* iface;
+ guint32 last_code;
+} GBinderClientIfaceInfo;
+
typedef
void
(*GBinderClientReplyFunc)(
@@ -51,6 +56,12 @@
const char* iface);
GBinderClient*
+gbinder_client_new2(
+ GBinderRemoteObject* object,
+ const GBinderClientIfaceInfo* ifaces,
+ gsize count); /* since 1.0.42 */
+
+GBinderClient*
gbinder_client_ref(
GBinderClient* client);
@@ -62,10 +73,20 @@
gbinder_client_interface(
GBinderClient* client); /* since 1.0.22 */
+const char*
+gbinder_client_interface2(
+ GBinderClient* client,
+ guint32 code); /* since 1.0.42 */
+
GBinderLocalRequest*
gbinder_client_new_request(
GBinderClient* client);
+GBinderLocalRequest*
+gbinder_client_new_request2(
+ GBinderClient* client,
+ guint32 code); /* since 1.0.42 */
+
GBinderRemoteReply*
gbinder_client_transact_sync_reply(
GBinderClient* client,
|
[-]
[+]
|
Added |
_service:tar_git:libgbinder-1.0.46.tar.bz2/include/gbinder_eventloop.h
^
|
@@ -0,0 +1,194 @@
+/*
+ * Copyright (C) 2020 Jolla Ltd.
+ * Copyright (C) 2020 Slava Monich <slava.monich@jolla.com>
+ *
+ * You may use this file under the terms of BSD license as follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef GBINDER_EVENTLOOP_H
+#define GBINDER_EVENTLOOP_H
+
+#include "gbinder_types.h"
+
+G_BEGIN_DECLS
+
+/* Since 1.0.40 */
+
+typedef struct gbinder_eventloop_integration GBinderEventLoopIntegration;
+typedef void (*GBinderEventLoopCallbackFunc)(gpointer data);
+
+typedef struct gbinder_eventloop_timeout {
+ const GBinderEventLoopIntegration* eventloop;
+} GBinderEventLoopTimeout;
+
+typedef struct gbinder_eventloop_callback {
+ const GBinderEventLoopIntegration* eventloop;
+} GBinderEventLoopCallback;
+
+/**
+ * Main event loop integration. There is only one main event loop in the
+ * process (by definition).
+ *
+ * By default, GLib event loop is being used for callbacks and timeouts.
+ *
+ * It may be necessary to replace it with e.g. Qt event loop. Quite often
+ * Qt event loop is implemented by QEventDispatcherGlib which is sitting
+ * on top of GLib event and therefore works with the default implementation.
+ * But it won't work with e.g. QEventDispatcherUNIX.
+ *
+ * For Qt programs that use QEventDispatcherUNIX, it needs to be replaced
+ * with the one provided by libqbinder.
+ */
+typedef struct gbinder_eventloop_integration {
+
+ /**
+ * timeout_add
+ *
+ * Sets a function to be called at regular intervals (in milliseconds).
+ * If the function returns G_SOURCE_REMOVE, timeout is automatically
+ * destroyed (you must not call timeout_remove in this case). If the
+ * function returns G_SOURCE_CONTINUE, it will be called again after
+ * the same interval.
+ */
+ GBinderEventLoopTimeout* (*timeout_add)(guint millis, GSourceFunc func,
+ gpointer data);
+
+ /**
+ * timeout_remove
+ *
+ * Removes a pending timeout and destroys it. The caller makes sure that
+ * argument is not NULL. Note that timeout is automatically destroyed if
+ * the callback function returns G_SOURCE_REMOVE.
+ */
+ void (*timeout_remove)(GBinderEventLoopTimeout* timeout);
+
+ /**
+ * callback_new
+ *
+ * Creates a callback object. It returns you a reference, you must
+ * eventually pass the returned object to callback_unref to drop
+ * this reference.
+ *
+ * Note that it doesn't automatically schedule the callback. You
+ * must explicitly call callback_schedule to actually schedule it.
+ * The finalize function is invoked regardless of whether callback
+ * was cancelled or not.
+ */
+ GBinderEventLoopCallback* (*callback_new)(GBinderEventLoopCallbackFunc fun,
+ gpointer data, GDestroyNotify finalize);
+
+ /**
+ * callback_ref
+ *
+ * Increments the reference count. That prevents the object from being
+ * deleted before you drop this reference. The caller makes sure that
+ * argument is not NULL.
+ */
+ void (*callback_ref)(GBinderEventLoopCallback* cb);
+
+ /**
+ * callback_unref
+ *
+ * Decrements the reference count (drops the reference). When reference
+ * count reaches zero, the object gets deleted. The caller makes sure
+ * that argument is not NULL.
+ *
+ * Note that calling callback_schedule temporarily adds an internal
+ * reference until the callback is invoked or callback_cancel is called,
+ * whichever happens first.
+ */
+ void (*callback_unref)(GBinderEventLoopCallback* cb);
+
+ /**
+ * callback_schedule
+ *
+ * Schedules the callback to be invoked in the main loop at some point
+ * in the future (but as soon as possible). The caller makes sure that
+ * argument is not NULL.
+ *
+ * This adds an internal reference to the GBinderEventLoopCallback object
+ * until the callback is invoked or callback_cancel is called, whichever
+ * happens first.
+ */
+ void (*callback_schedule)(GBinderEventLoopCallback* cb);
+
+ /**
+ * callback_cancel
+ *
+ * Makes sure that callback won't be invoked (if it hasn't been
+ * invoked yet) and drops the internal reference. Does nothing
+ * if the callback has already been invoked. The caller makes sure that
+ * argument is not NULL.
+ */
+ void (*callback_cancel)(GBinderEventLoopCallback* cb);
+
+ /**
+ * cleanup
+ *
+ * This function is called when event loop integration is being replaced
+ * with a different one, or libgbinder is being unloaded.
+ */
+ void (*cleanup)(void);
+
+ /* Padding for future expansion */
+ void (*_reserved1)(void);
+ void (*_reserved2)(void);
+ void (*_reserved3)(void);
+ void (*_reserved4)(void);
+ void (*_reserved5)(void);
+ void (*_reserved6)(void);
+ void (*_reserved7)(void);
+ void (*_reserved8)(void);
+ void (*_reserved9)(void);
+
+ /*
+ * api_level will remain zero (and ignored) until we run out of
+ * the above placeholders. Hopefully, forever.
+ */
+ int api_level;
+} GBinderEventLoopIntegration;
+
+/**
+ * gbinder_eventloop_set should be called before libgbinder creates any of
+ * its internal threads. And it must be done from the main thread.
+ */
+void
+gbinder_eventloop_set(
+ const GBinderEventLoopIntegration* loop);
+
+G_END_DECLS
+
+#endif /* GBINDER_EVENTLOOP_H */
+
+/*
+ * Local Variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
|
[-]
[+]
|
Changed |
_service:tar_git:libgbinder-1.0.46.tar.bz2/libgbinder.pc.in
^
|
@@ -1,10 +1,10 @@
name=gbinder
-libdir=/usr/lib
+libdir=@libdir@
includedir=/usr/include
Name: libgbinder
Description: Binder client library
-Version: [version]
-Requires: glib-2.0 libglibutil
+Version: @version@
+Requires.private: glib-2.0 libglibutil
Libs: -L${libdir} -l${name}
Cflags: -I${includedir} -I${includedir}/${name}
|
[-]
[+]
|
Changed |
_service:tar_git:libgbinder-1.0.46.tar.bz2/src/gbinder_buffer_p.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2018 Jolla Ltd.
- * Copyright (C) 2018 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2018-2020 Jolla Ltd.
+ * Copyright (C) 2018-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -14,8 +14,8 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the names of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -42,42 +42,51 @@
GBinderDriver* driver,
void* data,
gsize size,
- void** objects);
+ void** objects)
+ GBINDER_INTERNAL;
GBinderBuffer*
gbinder_buffer_new_with_parent(
GBinderBuffer* parent,
void* data,
- gsize size);
+ gsize size)
+ GBINDER_INTERNAL;
GBinderDriver*
gbinder_buffer_driver(
- GBinderBuffer* buf);
+ GBinderBuffer* buf)
+ GBINDER_INTERNAL;
GBinderBufferContents*
gbinder_buffer_contents(
- GBinderBuffer* buf);
+ GBinderBuffer* buf)
+ GBINDER_INTERNAL;
gconstpointer
gbinder_buffer_data(
GBinderBuffer* buf,
- gsize* size);
+ gsize* size)
+ GBINDER_INTERNAL;
const GBinderIo*
gbinder_buffer_io(
- GBinderBuffer* buf);
+ GBinderBuffer* buf)
+ GBINDER_INTERNAL;
void**
gbinder_buffer_objects(
- GBinderBuffer* buffer);
+ GBinderBuffer* buffer)
+ GBINDER_INTERNAL;
GBinderBufferContents*
gbinder_buffer_contents_ref(
- GBinderBufferContents* contents);
+ GBinderBufferContents* contents)
+ GBINDER_INTERNAL;
void
gbinder_buffer_contents_unref(
- GBinderBufferContents* contents);
+ GBinderBufferContents* contents)
+ GBINDER_INTERNAL;
#endif /* GBINDER_BUFFER_PRIVATE_H */
|
[-]
[+]
|
Changed |
_service:tar_git:libgbinder-1.0.46.tar.bz2/src/gbinder_cleanup.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2018 Jolla Ltd.
- * Copyright (C) 2018 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2018-2020 Jolla Ltd.
+ * Copyright (C) 2018-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -37,17 +37,20 @@
void
gbinder_cleanup_free(
- GBinderCleanup* cleanup);
+ GBinderCleanup* cleanup)
+ GBINDER_INTERNAL;
void
gbinder_cleanup_reset(
- GBinderCleanup* cleanup);
+ GBinderCleanup* cleanup)
+ GBINDER_INTERNAL;
GBinderCleanup*
gbinder_cleanup_add(
GBinderCleanup* cleanup,
GDestroyNotify destroy,
- gpointer pointer);
+ gpointer pointer)
+ GBINDER_INTERNAL;
#endif /* GBINDER_CLEANUP_H */
|
[-]
[+]
|
Changed |
_service:tar_git:libgbinder-1.0.46.tar.bz2/src/gbinder_client.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2018-2019 Jolla Ltd.
- * Copyright (C) 2018-2019 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2018-2020 Jolla Ltd.
+ * Copyright (C) 2018-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -41,14 +41,22 @@
#include <gutil_macros.h>
+#include <stdlib.h>
#include <errno.h>
+#include <limits.h>
-typedef struct gbinder_client_priv {
- GBinderClient pub;
- guint32 refcount;
+typedef struct gbinder_client_iface_range {
char* iface;
GBytes* rpc_header;
GBinderLocalRequest* basic_req;
+ guint32 last_code;
+} GBinderClientIfaceRange;
+
+typedef struct gbinder_client_priv {
+ GBinderClient pub;
+ guint32 refcount;
+ GBinderClientIfaceRange* ranges;
+ guint nr;
} GBinderClientPriv;
typedef struct gbinder_client_tx {
@@ -66,18 +74,78 @@
*==========================================================================*/
static
+const GBinderClientIfaceRange*
+gbinder_client_find_range(
+ GBinderClientPriv* priv,
+ guint32 code)
+{
+ guint i;
+
+ for (i = 0; i < priv->nr; i++) {
+ const GBinderClientIfaceRange* r = priv->ranges + i;
+
+ if (r->last_code >= code) {
+ return r;
+ }
+ }
+ return NULL;
+}
+
+/*
+ * Generates basic request (without additional parameters) for the
+ * specified interface and pulls header data out of it. The basic
+ * request can be reused for those transactions which have no
+ * additional parameters. The header data are needed for building
+ * non-trivial requests.
+ */
+static
+void
+gbinder_client_init_range(
+ GBinderClientIfaceRange* r,
+ GBinderDriver* driver,
+ const GBinderClientIfaceInfo* info)
+{
+ GBinderOutputData* hdr;
+
+ r->basic_req = gbinder_driver_local_request_new(driver, info->iface);
+ hdr = gbinder_local_request_data(r->basic_req);
+ r->rpc_header = g_bytes_new(hdr->bytes->data, hdr->bytes->len);
+ r->iface = g_strdup(info->iface);
+ r->last_code = info->last_code;
+}
+
+static
+int
+gbinder_client_sort_ranges(
+ const void* p1,
+ const void* p2)
+{
+ const GBinderClientIfaceRange* r1 = p1;
+ const GBinderClientIfaceRange* r2 = p2;
+
+ return (r1->last_code < r2->last_code) ? (-1) :
+ (r1->last_code > r2->last_code) ? 1 : 0;
+}
+
+static
void
gbinder_client_free(
GBinderClientPriv* priv)
{
GBinderClient* self = &priv->pub;
+ guint i;
- gbinder_remote_object_unref(self->remote);
- gbinder_local_request_unref(priv->basic_req);
- g_free(priv->iface);
- if (priv->rpc_header) {
- g_bytes_unref(priv->rpc_header);
+ for (i = 0; i < priv->nr; i++) {
+ GBinderClientIfaceRange* r = priv->ranges + i;
+
+ gbinder_local_request_unref(r->basic_req);
+ g_free(r->iface);
+ if (r->rpc_header) {
+ g_bytes_unref(r->rpc_header);
+ }
}
+ g_free(priv->ranges);
+ gbinder_remote_object_unref(self->remote);
g_slice_free(GBinderClientPriv, priv);
}
@@ -115,9 +183,10 @@
*==========================================================================*/
GBinderClient*
-gbinder_client_new(
+gbinder_client_new2(
GBinderRemoteObject* remote,
- const char* iface)
+ const GBinderClientIfaceInfo* ifaces,
+ gsize count)
{
if (G_LIKELY(remote)) {
GBinderClientPriv* priv = g_slice_new0(GBinderClientPriv);
@@ -126,22 +195,22 @@
g_atomic_int_set(&priv->refcount, 1);
self->remote = gbinder_remote_object_ref(remote);
+ if (count > 0) {
+ gsize i;
- /*
- * Generate basic request (without additional parameters) and pull
- * header data out of it. The basic request can be reused for those
- * transactions which has no additional parameters. The header data
- * are needed for building non-trivial requests.
- */
- if (iface) {
- GBinderOutputData* hdr;
-
- priv->basic_req = gbinder_driver_local_request_new(driver, iface);
- hdr = gbinder_local_request_data(priv->basic_req);
- priv->rpc_header = g_bytes_new(hdr->bytes->data, hdr->bytes->len);
- self->iface = priv->iface = g_strdup(iface);
+ priv->nr = count;
+ priv->ranges = g_new(GBinderClientIfaceRange, priv->nr);
+ for (i = 0; i < count; i++) {
+ gbinder_client_init_range(priv->ranges + i, driver, ifaces + i);
+ }
+ qsort(priv->ranges, count, sizeof(GBinderClientIfaceRange),
+ gbinder_client_sort_ranges);
} else {
- priv->basic_req = gbinder_local_request_new
+ /* No interface info */
+ priv->nr = 1;
+ priv->ranges = g_new0(GBinderClientIfaceRange, 1);
+ priv->ranges[0].last_code = UINT_MAX;
+ priv->ranges[0].basic_req = gbinder_local_request_new
(gbinder_driver_io(driver), NULL);
}
return self;
@@ -150,6 +219,18 @@
}
GBinderClient*
+gbinder_client_new(
+ GBinderRemoteObject* remote,
+ const char* iface)
+{
+ GBinderClientIfaceInfo info;
+
+ info.iface = iface;
+ info.last_code = UINT_MAX;
+ return gbinder_client_new2(remote, &info, 1);
+}
+
+GBinderClient*
gbinder_client_ref(
GBinderClient* self)
{
@@ -180,7 +261,23 @@
gbinder_client_interface(
GBinderClient* self) /* since 1.0.22 */
{
- return G_LIKELY(self) ? gbinder_client_cast(self)->iface : NULL;
+ return G_LIKELY(self) ? gbinder_client_cast(self)->ranges->iface : NULL;
+}
+
+const char*
+gbinder_client_interface2(
+ GBinderClient* self,
+ guint32 code) /* since 1.0.42 */
|
[-]
[+]
|
Changed |
_service:tar_git:libgbinder-1.0.46.tar.bz2/src/gbinder_client_p.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2018 Jolla Ltd.
- * Copyright (C) 2018 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2018-2020 Jolla Ltd.
+ * Copyright (C) 2018-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -13,9 +13,9 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Jolla Ltd nor the names of its contributors may
- * be used to endorse or promote products derived from this software
- * without specific prior written permission.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -38,7 +38,6 @@
#include "gbinder_types_p.h"
struct gbinder_client {
- const char* iface;
GBinderRemoteObject* remote;
};
|
[-]
[+]
|
Changed |
_service:tar_git:libgbinder-1.0.46.tar.bz2/src/gbinder_defaultservicemanager.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2018-2019 Jolla Ltd.
- * Copyright (C) 2018-2019 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2018-2020 Jolla Ltd.
+ * Copyright (C) 2018-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -14,8 +14,8 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the names of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -33,6 +33,7 @@
#include "gbinder_servicemanager_p.h"
#include "gbinder_rpc_protocol.h"
#include "gbinder_servicepoll.h"
+#include "gbinder_eventloop_p.h"
#include "gbinder_log.h"
#include <gbinder_client.h>
@@ -48,7 +49,7 @@
GBinderServicePoll* poll;
char* name;
gulong handler_id;
- guint notify_id;
+ GBinderEventLoopTimeout* notify;
} GBinderDefaultServiceManagerWatch;
typedef GBinderServiceManagerClass GBinderDefaultServiceManagerClass;
@@ -99,9 +100,9 @@
GBinderServiceManager* manager =
gbinder_servicepoll_manager(watch->poll);
- if (watch->notify_id) {
- g_source_remove(watch->notify_id);
- watch->notify_id = 0;
+ if (watch->notify) {
+ gbinder_timeout_remove(watch->notify);
+ watch->notify = NULL;
}
gbinder_servicemanager_service_registered(manager, name_added);
}
@@ -116,8 +117,8 @@
GBinderServiceManager* manager = gbinder_servicepoll_manager(watch->poll);
char* name = g_strdup(watch->name);
- GASSERT(watch->notify_id);
- watch->notify_id = 0;
+ GASSERT(watch->notify);
+ watch->notify = NULL;
gbinder_servicemanager_service_registered(manager, name);
g_free(name);
return G_SOURCE_REMOVE;
@@ -130,9 +131,7 @@
{
GBinderDefaultServiceManagerWatch* watch = user_data;
- if (watch->notify_id) {
- g_source_remove(watch->notify_id);
- }
+ gbinder_timeout_remove(watch->notify);
gbinder_servicepoll_remove_handler(watch->poll, watch->handler_id);
gbinder_servicepoll_unref(watch->poll);
g_free(watch->name);
@@ -258,8 +257,8 @@
g_hash_table_replace(self->watch_table, watch->name, watch);
if (gbinder_servicepoll_is_known_name(watch->poll, name)) {
- watch->notify_id =
- g_idle_add(gbinder_defaultservicemanager_watch_notify, watch);
+ watch->notify = gbinder_idle_add
+ (gbinder_defaultservicemanager_watch_notify, watch);
}
return TRUE;
}
|
[-]
[+]
|
Changed |
_service:tar_git:libgbinder-1.0.46.tar.bz2/src/gbinder_driver.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2018-2019 Jolla Ltd.
- * Copyright (C) 2018-2019 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2018-2020 Jolla Ltd.
+ * Copyright (C) 2018-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -14,8 +14,8 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the names of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -61,9 +61,6 @@
#include <sys/stat.h>
#include <sys/mman.h>
-/* Log module */
-GLOG_MODULE_DEFINE("gbinder");
-
/* BINDER_VM_SIZE copied from native/libs/binder/ProcessState.cpp */
#define BINDER_VM_SIZE ((1024*1024) - sysconf(_SC_PAGE_SIZE)*2)
@@ -450,8 +447,14 @@
tx.code, tx.flags, &status);
break;
case GBINDER_LOCAL_TRANSACTION_SUPPORTED:
- reply = gbinder_handler_transact(h, obj, req, tx.code, tx.flags,
- &status);
+ /*
+ * NULL GBinderHandler means that this is a synchronous call
+ * executed on the main thread, meaning that we can call the
+ * local object directly.
+ */
+ reply = h ? gbinder_handler_transact(h, obj, req, tx.code, tx.flags,
+ &status) : gbinder_local_object_handle_transaction(obj, req,
+ tx.code, tx.flags, &status);
break;
default:
GWARN("Unhandled transaction %s 0x%08x", iface, tx.code);
@@ -966,6 +969,7 @@
gbinder_driver_transact(
GBinderDriver* self,
GBinderObjectRegistry* reg,
+ GBinderHandler* handler,
guint32 handle,
guint32 code,
GBinderLocalRequest* req,
@@ -1022,7 +1026,7 @@
if (err < 0) {
txstatus = err;
} else {
- txstatus = gbinder_driver_txstatus(self, reg, NULL, &rb, reply);
+ txstatus = gbinder_driver_txstatus(self, reg, handler, &rb, reply);
}
}
@@ -1031,14 +1035,14 @@
GASSERT(write.consumed == write.size || txstatus > 0);
/* Loop until we have handled all the incoming commands */
- gbinder_driver_handle_commands(self, reg, NULL, &rb);
+ gbinder_driver_handle_commands(self, reg, handler, &rb);
while (rb.buf.consumed) {
int err = gbinder_driver_write_read(self, NULL, &rb.buf);
if (err < 0) {
txstatus = err;
break;
} else {
- gbinder_driver_handle_commands(self, reg, NULL, &rb);
+ gbinder_driver_handle_commands(self, reg, handler, &rb);
}
}
}
@@ -1061,7 +1065,7 @@
gbinder_local_request_init_writer(req, &writer);
protocol->write_ping(&writer);
- ret = gbinder_driver_transact(self, reg, handle, protocol->ping_tx,
+ ret = gbinder_driver_transact(self, reg, NULL, handle, protocol->ping_tx,
req, reply);
gbinder_local_request_unref(req);
|
[-]
[+]
|
Changed |
_service:tar_git:libgbinder-1.0.46.tar.bz2/src/gbinder_driver.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2018-2019 Jolla Ltd.
- * Copyright (C) 2018-2019 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2018-2020 Jolla Ltd.
+ * Copyright (C) 2018-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -14,8 +14,8 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the names of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -40,107 +40,129 @@
GBinderDriver*
gbinder_driver_new(
const char* dev,
- const GBinderRpcProtocol* protocol);
+ const GBinderRpcProtocol* protocol)
+ GBINDER_INTERNAL;
GBinderDriver*
gbinder_driver_ref(
- GBinderDriver* driver);
+ GBinderDriver* driver)
+ GBINDER_INTERNAL;
void
gbinder_driver_unref(
- GBinderDriver* driver);
+ GBinderDriver* driver)
+ GBINDER_INTERNAL;
int
gbinder_driver_fd(
- GBinderDriver* driver);
+ GBinderDriver* driver)
+ GBINDER_INTERNAL;
int
gbinder_driver_poll(
GBinderDriver* driver,
- struct pollfd* pollfd);
+ struct pollfd* pollfd)
+ GBINDER_INTERNAL;
const char*
gbinder_driver_dev(
- GBinderDriver* driver);
+ GBinderDriver* driver)
+ GBINDER_INTERNAL;
const GBinderIo*
gbinder_driver_io(
- GBinderDriver* driver);
+ GBinderDriver* driver)
+ GBINDER_INTERNAL;
gboolean
gbinder_driver_request_death_notification(
GBinderDriver* driver,
- GBinderRemoteObject* obj);
+ GBinderRemoteObject* obj)
+ GBINDER_INTERNAL;
gboolean
gbinder_driver_clear_death_notification(
GBinderDriver* driver,
- GBinderRemoteObject* obj);
+ GBinderRemoteObject* obj)
+ GBINDER_INTERNAL;
gboolean
gbinder_driver_increfs(
GBinderDriver* driver,
- guint32 handle);
+ guint32 handle)
+ GBINDER_INTERNAL;
gboolean
gbinder_driver_decrefs(
GBinderDriver* driver,
- guint32 handle);
+ guint32 handle)
+ GBINDER_INTERNAL;
gboolean
gbinder_driver_acquire(
GBinderDriver* driver,
- guint32 handle);
+ guint32 handle)
+ GBINDER_INTERNAL;
gboolean
gbinder_driver_release(
GBinderDriver* driver,
- guint32 handle);
+ guint32 handle)
+ GBINDER_INTERNAL;
void
gbinder_driver_close_fds(
GBinderDriver* self,
void** objects,
- const void* end);
+ const void* end)
+ GBINDER_INTERNAL;
void
gbinder_driver_free_buffer(
GBinderDriver* driver,
- void* buffer);
+ void* buffer)
+ GBINDER_INTERNAL;
gboolean
gbinder_driver_enter_looper(
- GBinderDriver* driver);
+ GBinderDriver* driver)
+ GBINDER_INTERNAL;
gboolean
gbinder_driver_exit_looper(
- GBinderDriver* driver);
+ GBinderDriver* driver)
+ GBINDER_INTERNAL;
int
gbinder_driver_read(
GBinderDriver* driver,
GBinderObjectRegistry* reg,
- GBinderHandler* handler);
+ GBinderHandler* handler)
+ GBINDER_INTERNAL;
int
gbinder_driver_transact(
GBinderDriver* driver,
GBinderObjectRegistry* reg,
+ GBinderHandler* handler,
guint32 handle,
guint32 code,
GBinderLocalRequest* request,
- GBinderRemoteReply* reply);
+ GBinderRemoteReply* reply)
+ GBINDER_INTERNAL;
int
gbinder_driver_ping(
GBinderDriver* driver,
GBinderObjectRegistry* reg,
- guint32 handle);
+ guint32 handle)
+ GBINDER_INTERNAL;
GBinderLocalRequest*
gbinder_driver_local_request_new(
GBinderDriver* self,
- const char* iface);
+ const char* iface)
+ GBINDER_INTERNAL;
#endif /* GBINDER_DRIVER_H */
|
[-]
[+]
|
Added |
_service:tar_git:libgbinder-1.0.46.tar.bz2/src/gbinder_eventloop.c
^
|
@@ -0,0 +1,347 @@
+/*
+ * Copyright (C) 2020 Jolla Ltd.
+ * Copyright (C) 2020 Slava Monich <slava.monich@jolla.com>
+ *
+ * You may use this file under the terms of BSD license as follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "gbinder_eventloop_p.h"
+
+#include <gutil_macros.h>
+
+#define GBINDER_DEFAULT_EVENTLOOP (&gbinder_eventloop_glib)
+
+static const GBinderEventLoopIntegration gbinder_eventloop_glib;
+
+/*==========================================================================*
+ * GLib event loop integration
+ *==========================================================================*/
+
+typedef struct gbinder_eventloop_glib_timeout {
+ GBinderEventLoopTimeout timeout;
+ guint id;
+ GSourceFunc func;
+ gpointer data;
+} GBinderEventLoopTimeoutGLib;
+
+typedef struct gbinder_eventloop_glib_callback {
+ GSource source;
+ GBinderEventLoopCallback callback;
+} GBinderEventLoopCallbackGLib;
+
+static
+inline
+GBinderEventLoopTimeoutGLib*
+gbinder_eventloop_glib_timeout_cast(
+ GBinderEventLoopTimeout* timeout)
+{
+ return G_CAST(timeout,GBinderEventLoopTimeoutGLib,timeout);
+}
+
+static
+inline
+GSource*
+gbinder_eventloop_glib_callback_source(
+ GBinderEventLoopCallback* callback)
+{
+ return &(G_CAST(callback,GBinderEventLoopCallbackGLib,callback)->source);
+}
+
+static
+gboolean
+gbinder_eventloop_glib_timeout_callback(
+ gpointer data)
+{
+ GBinderEventLoopTimeoutGLib* timeout = data;
+
+ return timeout->func(timeout->data);
+}
+
+static
+void
+gbinder_eventloop_glib_timeout_finalize(
+ gpointer data)
+{
+ g_slice_free1(sizeof(GBinderEventLoopTimeoutGLib), data);
+}
+
+static
+GBinderEventLoopTimeout*
+gbinder_eventloop_glib_timeout_add(
+ guint interval,
+ GSourceFunc func,
+ gpointer data)
+{
+ GBinderEventLoopTimeoutGLib* impl =
+ g_slice_new(GBinderEventLoopTimeoutGLib);
+
+ impl->timeout.eventloop = &gbinder_eventloop_glib;
+ impl->func = func;
+ impl->data = data;
+ impl->id = g_timeout_add_full(G_PRIORITY_DEFAULT, interval,
+ gbinder_eventloop_glib_timeout_callback, impl,
+ gbinder_eventloop_glib_timeout_finalize);
+ return &impl->timeout;
+}
+
+static
+void
+gbinder_eventloop_glib_timeout_remove(
+ GBinderEventLoopTimeout* timeout)
+{
+ g_source_remove(gbinder_eventloop_glib_timeout_cast(timeout)->id);
+}
+
+static
+gboolean
+gbinder_eventloop_glib_callback_prepare(
+ GSource* source,
+ gint* timeout)
+{
+ *timeout = 0;
+ return TRUE;
+}
+
+static
+gboolean
+gbinder_eventloop_glib_callback_check(
+ GSource* source)
+{
+ return TRUE;
+}
+
+static
+gboolean
+gbinder_eventloop_glib_callback_dispatch(
+ GSource* source,
+ GSourceFunc callback,
+ gpointer user_data)
+{
+ ((GBinderEventLoopCallbackFunc)callback)(user_data);
+ return G_SOURCE_REMOVE;
+}
+
+static
+GBinderEventLoopCallback*
+gbinder_eventloop_glib_callback_new(
+ GBinderEventLoopCallbackFunc func,
+ gpointer data,
+ GDestroyNotify finalize)
+{
+ static GSourceFuncs callback_funcs = {
+ gbinder_eventloop_glib_callback_prepare,
+ gbinder_eventloop_glib_callback_check,
+ gbinder_eventloop_glib_callback_dispatch
+ };
+
+ GBinderEventLoopCallbackGLib* impl = (GBinderEventLoopCallbackGLib*)
+ g_source_new(&callback_funcs, sizeof(GBinderEventLoopCallbackGLib));
+
+ impl->callback.eventloop = &gbinder_eventloop_glib;
+ g_source_set_callback(&impl->source, (GSourceFunc) func, data, finalize);
+ return &impl->callback;
+}
+
+static
+void
+gbinder_eventloop_glib_callback_ref(
+ GBinderEventLoopCallback* cb)
+{
+ g_source_ref(gbinder_eventloop_glib_callback_source(cb));
+}
+
+static
+void
+gbinder_eventloop_glib_callback_unref(
+ GBinderEventLoopCallback* cb)
+{
+ g_source_unref(gbinder_eventloop_glib_callback_source(cb));
+}
+
+static
+void
+gbinder_eventloop_glib_callback_schedule(
+ GBinderEventLoopCallback* cb)
+{
+ static GMainContext* context = NULL;
+
+ if (!context) context = g_main_context_default();
+ g_source_attach(gbinder_eventloop_glib_callback_source(cb), context);
+}
+
+static
+void
+gbinder_eventloop_glib_callback_cancel(
|
[-]
[+]
|
Added |
_service:tar_git:libgbinder-1.0.46.tar.bz2/src/gbinder_eventloop_p.h
^
|
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2020 Jolla Ltd.
+ * Copyright (C) 2020 Slava Monich <slava.monich@jolla.com>
+ *
+ * You may use this file under the terms of BSD license as follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef GBINDER_EVENTLOOP_PRIVATE_H
+#define GBINDER_EVENTLOOP_PRIVATE_H
+
+#include "gbinder_types_p.h"
+#include "gbinder_eventloop.h"
+
+GBinderEventLoopTimeout*
+gbinder_timeout_add(
+ guint millis,
+ GSourceFunc func,
+ gpointer data)
+ GBINDER_INTERNAL;
+
+GBinderEventLoopTimeout*
+gbinder_idle_add(
+ GSourceFunc func,
+ gpointer data)
+ GBINDER_INTERNAL;
+
+void
+gbinder_timeout_remove(
+ GBinderEventLoopTimeout* timeout)
+ GBINDER_INTERNAL;
+
+GBinderEventLoopCallback*
+gbinder_idle_callback_new(
+ GBinderEventLoopCallbackFunc func,
+ gpointer data,
+ GDestroyNotify destroy)
+ GBINDER_INTERNAL;
+
+GBinderEventLoopCallback*
+gbinder_idle_callback_schedule_new(
+ GBinderEventLoopCallbackFunc func,
+ gpointer data,
+ GDestroyNotify destroy)
+ GBINDER_INTERNAL;
+
+GBinderEventLoopCallback*
+gbinder_idle_callback_ref(
+ GBinderEventLoopCallback* cb)
+ GBINDER_INTERNAL;
+
+void
+gbinder_idle_callback_unref(
+ GBinderEventLoopCallback* cb)
+ GBINDER_INTERNAL;
+
+void
+gbinder_idle_callback_schedule(
+ GBinderEventLoopCallback* cb)
+ GBINDER_INTERNAL;
+
+void
+gbinder_idle_callback_cancel(
+ GBinderEventLoopCallback* cb)
+ GBINDER_INTERNAL;
+
+void
+gbinder_idle_callback_destroy(
+ GBinderEventLoopCallback* cb)
+ GBINDER_INTERNAL;
+
+#endif /* GBINDER_EVENTLOOP_PRIVATE_H */
+
+/*
+ * Local Variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
|
[-]
[+]
|
Changed |
_service:tar_git:libgbinder-1.0.46.tar.bz2/src/gbinder_handler.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2018 Jolla Ltd.
- * Copyright (C) 2018 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2018-2020 Jolla Ltd.
+ * Copyright (C) 2018-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -13,9 +13,9 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Jolla Ltd nor the names of its contributors may
- * be used to endorse or promote products derived from this software
- * without specific prior written permission.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
[-]
[+]
|
Changed |
_service:tar_git:libgbinder-1.0.46.tar.bz2/src/gbinder_io.h
^
|
@@ -181,8 +181,8 @@
int (*write_read)(int fd, GBinderIoBuf* write, GBinderIoBuf* read);
};
-extern const GBinderIo gbinder_io_32;
-extern const GBinderIo gbinder_io_64;
+extern const GBinderIo gbinder_io_32 GBINDER_INTERNAL;
+extern const GBinderIo gbinder_io_64 GBINDER_INTERNAL;
#endif /* GBINDER_IO_H */
|
[-]
[+]
|
Changed |
_service:tar_git:libgbinder-1.0.46.tar.bz2/src/gbinder_ipc.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2018-2019 Jolla Ltd.
- * Copyright (C) 2018-2019 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2018-2020 Jolla Ltd.
+ * Copyright (C) 2018-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -30,6 +30,8 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#define GLIB_DISABLE_DEPRECATION_WARNINGS
+
#include "gbinder_ipc.h"
#include "gbinder_driver.h"
#include "gbinder_handler.h"
@@ -41,10 +43,10 @@
#include "gbinder_remote_object_p.h"
#include "gbinder_remote_reply_p.h"
#include "gbinder_remote_request_p.h"
+#include "gbinder_eventloop_p.h"
#include "gbinder_writer.h"
#include "gbinder_log.h"
-#include <gutil_idlepool.h>
#include <gutil_macros.h>
#include <unistd.h>
@@ -58,7 +60,6 @@
GBinderIpc* self;
GThreadPool* tx_pool;
GHashTable* tx_table;
- GMainContext* context;
char* key;
GBinderObjectRegistry object_registry;
@@ -161,6 +162,11 @@
int txfd[2];
};
+typedef struct gbinder_ipc_tx_handler {
+ int pipefd[2];
+ int txfd[2];
+} GBinderIpcTxHandler;
+
typedef struct gbinder_ipc_tx_priv GBinderIpcTxPriv;
typedef
@@ -173,7 +179,7 @@
GBinderIpcTxPrivFunc fn_exec;
GBinderIpcTxPrivFunc fn_done;
GBinderIpcTxPrivFunc fn_free;
- GSource* completion;
+ GBinderEventLoopCallback* completion;
} GBinderIpcTxPriv;
typedef struct gbinder_ipc_tx_internal {
@@ -204,6 +210,40 @@
GBinderIpc* ipc);
/*==========================================================================*
+ * Utilities
+ *==========================================================================*/
+
+static
+gboolean
+gbinder_ipc_wait(
+ int fd_wakeup,
+ int fd_read,
+ guint8* out)
+{
+ struct pollfd fds[2];
+
+ memset(fds, 0, sizeof(fds));
+ fds[0].fd = fd_wakeup;
+ fds[0].events = POLLIN | POLLERR | POLLHUP | POLLNVAL;
+ fds[1].fd = fd_read;
+ fds[1].events = POLLIN | POLLERR | POLLHUP | POLLNVAL;
+ if (poll(fds, 2, -1) < 0) {
+ GWARN("Transaction pipe polling error: %s", strerror(errno));
+ } else if (fds[1].revents & POLLIN) {
+ const ssize_t n = read(fds[1].fd, out, 1);
+
+ if (n == 1) {
+ return TRUE;
+ } else if (n < 0) {
+ GWARN("Transaction pipe read error: %s", strerror(errno));
+ } else {
+ GWARN("Nothing was read from the transaction pipe");
+ }
+ }
+ return FALSE;
+}
+
+/*==========================================================================*
* GBinderIpcLooperTx
*==========================================================================*/
@@ -341,7 +381,9 @@
tx->reply = gbinder_local_reply_ref(reply);
tx->state = GBINDER_IPC_LOOPER_TX_COMPLETE;
/* Wake up the looper */
- (void)write(tx->pipefd[1], &done, sizeof(done));
+ if (write(tx->pipefd[1], &done, sizeof(done)) <= 0) {
+ GWARN("Failed to wake up the looper");
+ }
break;
default:
GWARN("Unexpected state %d in request completion", tx->state);
@@ -402,7 +444,7 @@
}
static
-gboolean
+void
gbinder_ipc_looper_tx_handle(
gpointer data)
{
@@ -473,8 +515,9 @@
}
/* And wake up the looper */
- (void)write(tx->pipefd[1], &done, sizeof(done));
- return G_SOURCE_REMOVE;
+ if (write(tx->pipefd[1], &done, sizeof(done)) <= 0) {
+ GWARN("Failed to wake up the looper");
+ }
}
static
@@ -585,80 +628,60 @@
GBinderIpcLooperTx* tx = gbinder_ipc_looper_tx_new(obj, code, flags,
req, looper->txfd);
GBinderIpcPriv* priv = ipc->priv;
- struct pollfd fds[2];
guint8 done = 0;
- GSource* source = g_idle_source_new();
gboolean was_blocked = FALSE;
-
/* Let GBinderLocalObject handle the transaction on the main thread */
- g_source_set_callback(source, gbinder_ipc_looper_tx_handle,
- gbinder_ipc_looper_tx_ref(tx), gbinder_ipc_looper_tx_done);
- g_source_attach(source, priv->context);
+ GBinderEventLoopCallback* callback =
+ gbinder_idle_callback_schedule_new(gbinder_ipc_looper_tx_handle,
+ gbinder_ipc_looper_tx_ref(tx), gbinder_ipc_looper_tx_done);
/* Wait for either transaction completion or looper shutdown */
- memset(fds, 0, sizeof(fds));
- fds[0].fd = looper->pipefd[0];
- fds[0].events = POLLIN | POLLERR | POLLHUP | POLLNVAL;
- fds[1].fd = tx->pipefd[0];
- fds[1].events = POLLIN | POLLERR | POLLHUP | POLLNVAL;
- poll(fds, 2, -1);
-
- if ((fds[1].revents & POLLIN) &&
- read(fds[1].fd, &done, sizeof(done)) == 1) {
- /* Normal completion */
- if (done == TX_BLOCKED) {
- /*
- * We are going to block this looper for potentially
- * significant period of time. Start new looper to
- * accept normal incoming requests and terminate this
- * one when we are done with this transaction.
- *
- * For the duration of the transaction, this looper is
- * moved to the blocked_loopers list.
- */
- GBinderIpcPriv* priv = looper->ipc->priv;
- GBinderIpcLooper* new_looper = NULL;
+ if (gbinder_ipc_wait(looper->pipefd[0], tx->pipefd[0], &done) &&
+ done == TX_BLOCKED) {
+ /*
+ * We are going to block this looper for potentially
+ * significant period of time. Start new looper to
+ * accept normal incoming requests and terminate this
+ * one when we are done with this transaction.
+ *
+ * For the duration of the transaction, this looper is
+ * moved to the blocked_loopers list.
+ */
+ GBinderIpcPriv* priv = looper->ipc->priv;
+ GBinderIpcLooper* new_looper = NULL;
- /* Lock */
- g_mutex_lock(&priv->looper_mutex);
- if (gbinder_ipc_looper_remove_primary(looper)) {
- GDEBUG("Primary looper %s is blocked", looper->name);
- looper->next = priv->blocked_loopers;
- priv->blocked_loopers = looper;
- was_blocked = TRUE;
-
- /* If there's no more primary loopers left, create one */
- if (!priv->primary_loopers) {
- new_looper = gbinder_ipc_looper_new(ipc);
- if (new_looper) {
- /* Will unref it after it gets started */
- gbinder_ipc_looper_ref(new_looper);
|
[-]
[+]
|
Changed |
_service:tar_git:libgbinder-1.0.46.tar.bz2/src/gbinder_ipc.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2018-2019 Jolla Ltd.
- * Copyright (C) 2018-2019 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2018-2020 Jolla Ltd.
+ * Copyright (C) 2018-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -14,8 +14,8 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the names of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -42,7 +42,6 @@
GObject object;
GBinderIpcPriv* priv;
GBinderDriver* driver;
- GUtilIdlePool* pool;
const char* dev;
};
@@ -68,69 +67,68 @@
int status,
void* user_data);
-G_GNUC_INTERNAL
GBinderIpc*
gbinder_ipc_new(
- const char* dev,
- const GBinderRpcProtocol* protocol);
+ const char* dev,
+ const GBinderRpcProtocol* protocol)
+ GBINDER_INTERNAL;
-G_GNUC_INTERNAL
GBinderIpc*
gbinder_ipc_ref(
- GBinderIpc* ipc);
+ GBinderIpc* ipc)
+ GBINDER_INTERNAL;
-G_GNUC_INTERNAL
void
gbinder_ipc_unref(
- GBinderIpc* ipc);
+ GBinderIpc* ipc)
+ GBINDER_INTERNAL;
-G_GNUC_INTERNAL
void
gbinder_ipc_looper_check(
- GBinderIpc* ipc);
+ GBinderIpc* ipc)
+ GBINDER_INTERNAL;
-G_GNUC_INTERNAL
GBinderObjectRegistry*
gbinder_ipc_object_registry(
- GBinderIpc* ipc);
+ GBinderIpc* ipc)
+ GBINDER_INTERNAL;
-G_GNUC_INTERNAL
void
gbinder_ipc_register_local_object(
GBinderIpc* ipc,
- GBinderLocalObject* obj);
+ GBinderLocalObject* obj)
+ GBINDER_INTERNAL;
-G_GNUC_INTERNAL
GBinderRemoteObject*
gbinder_ipc_get_remote_object(
GBinderIpc* ipc,
guint32 handle,
- gboolean maybe_dead);
+ gboolean maybe_dead)
+ GBINDER_INTERNAL;
-G_GNUC_INTERNAL
void
gbinder_ipc_invalidate_remote_handle(
GBinderIpc* ipc,
- guint32 handle);
+ guint32 handle)
+ GBINDER_INTERNAL;
-G_GNUC_INTERNAL
GBinderRemoteReply*
gbinder_ipc_transact_sync_reply(
GBinderIpc* ipc,
guint32 handle,
guint32 code,
GBinderLocalRequest* req,
- int* status);
+ int* status)
+ GBINDER_INTERNAL;
-G_GNUC_INTERNAL
int
gbinder_ipc_transact_sync_oneway(
GBinderIpc* ipc,
guint32 handle,
guint32 code,
- GBinderLocalRequest* req);
+ GBinderLocalRequest* req)
+ GBINDER_INTERNAL;
-G_GNUC_INTERNAL
gulong
gbinder_ipc_transact(
GBinderIpc* ipc,
@@ -140,43 +138,44 @@
GBinderLocalRequest* req,
GBinderIpcReplyFunc func,
GDestroyNotify destroy,
- void* user_data);
+ void* user_data)
+ GBINDER_INTERNAL;
-G_GNUC_INTERNAL
gulong
gbinder_ipc_transact_custom(
GBinderIpc* ipc,
GBinderIpcTxFunc exec,
GBinderIpcTxFunc done,
GDestroyNotify destroy,
- void* user_data);
+ void* user_data)
+ GBINDER_INTERNAL;
-G_GNUC_INTERNAL
void
gbinder_ipc_cancel(
GBinderIpc* ipc,
- gulong id);
+ gulong id)
+ GBINDER_INTERNAL;
/* Internal for GBinderLocalObject */
-G_GNUC_INTERNAL
void
gbinder_ipc_local_object_disposed(
GBinderIpc* self,
- GBinderLocalObject* obj);
+ GBinderLocalObject* obj)
+ GBINDER_INTERNAL;
/* Internal for GBinderRemoteObject */
-G_GNUC_INTERNAL
void
gbinder_ipc_remote_object_disposed(
GBinderIpc* self,
- GBinderRemoteObject* obj);
+ GBinderRemoteObject* obj)
+ GBINDER_INTERNAL;
/* Declared for unit tests */
-G_GNUC_INTERNAL
__attribute__((destructor))
void
gbinder_ipc_exit(
- void);
+ void)
+ GBINDER_INTERNAL;
#endif /* GBINDER_IPC_H */
|
[-]
[+]
|
Changed |
_service:tar_git:libgbinder-1.0.46.tar.bz2/src/gbinder_local_object.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2018-2019 Jolla Ltd.
- * Copyright (C) 2018-2019 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2018-2020 Jolla Ltd.
+ * Copyright (C) 2018-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -30,6 +30,8 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#define GLIB_DISABLE_DEPRECATION_WARNINGS
+
#include "gbinder_driver.h"
#include "gbinder_ipc.h"
#include "gbinder_local_object_p.h"
|
[-]
[+]
|
Changed |
_service:tar_git:libgbinder-1.0.46.tar.bz2/src/gbinder_local_object_p.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2018-2019 Jolla Ltd.
- * Copyright (C) 2018-2019 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2018-2020 Jolla Ltd.
+ * Copyright (C) 2018-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -79,7 +79,7 @@
/* Need to add some placeholders if this class becomes public */
} GBinderLocalObjectClass;
-GType gbinder_local_object_get_type(void);
+GType gbinder_local_object_get_type(void) GBINDER_INTERNAL;
#define GBINDER_TYPE_LOCAL_OBJECT (gbinder_local_object_get_type())
#define GBINDER_LOCAL_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), \
GBINDER_TYPE_LOCAL_OBJECT, GBinderLocalObject))
@@ -91,24 +91,28 @@
gbinder_local_object_add_weak_refs_changed_handler(
GBinderLocalObject* obj,
GBinderLocalObjectFunc func,
- void* user_data);
+ void* user_data)
+ GBINDER_INTERNAL;
gulong
gbinder_local_object_add_strong_refs_changed_handler(
GBinderLocalObject* obj,
GBinderLocalObjectFunc func,
- void* user_data);
+ void* user_data)
+ GBINDER_INTERNAL;
void
gbinder_local_object_remove_handler(
GBinderLocalObject* obj,
- gulong id);
+ gulong id)
+ GBINDER_INTERNAL;
GBINDER_LOCAL_TRANSACTION_SUPPORT
gbinder_local_object_can_handle_transaction(
GBinderLocalObject* self,
const char* iface,
- guint code);
+ guint code)
+ GBINDER_INTERNAL;
GBinderLocalReply*
gbinder_local_object_handle_transaction(
@@ -116,7 +120,8 @@
GBinderRemoteRequest* req,
guint code,
guint flags,
- int* status);
+ int* status)
+ GBINDER_INTERNAL;
GBinderLocalReply*
gbinder_local_object_handle_looper_transaction(
@@ -124,23 +129,28 @@
GBinderRemoteRequest* req,
guint code,
guint flags,
- int* status);
+ int* status)
+ GBINDER_INTERNAL;
void
gbinder_local_object_handle_increfs(
- GBinderLocalObject* obj);
+ GBinderLocalObject* obj)
+ GBINDER_INTERNAL;
void
gbinder_local_object_handle_decrefs(
- GBinderLocalObject* obj);
+ GBinderLocalObject* obj)
+ GBINDER_INTERNAL;
void
gbinder_local_object_handle_acquire(
- GBinderLocalObject* obj);
+ GBinderLocalObject* obj)
+ GBINDER_INTERNAL;
void
gbinder_local_object_handle_release(
- GBinderLocalObject* obj);
+ GBinderLocalObject* obj)
+ GBINDER_INTERNAL;
#endif /* GBINDER_LOCAL_OBJECT_PRIVATE_H */
|
[-]
[+]
|
Changed |
_service:tar_git:libgbinder-1.0.46.tar.bz2/src/gbinder_local_reply_p.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2018 Jolla Ltd.
- * Copyright (C) 2018 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2018-2020 Jolla Ltd.
+ * Copyright (C) 2018-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -14,8 +14,8 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the names of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -39,15 +39,18 @@
GBinderLocalReply*
gbinder_local_reply_new(
- const GBinderIo* io);
+ const GBinderIo* io)
+ GBINDER_INTERNAL;
GBinderOutputData*
gbinder_local_reply_data(
- GBinderLocalReply* reply);
+ GBinderLocalReply* reply)
+ GBINDER_INTERNAL;
GBinderLocalReply*
gbinder_local_reply_new_from_data(
- GBinderBuffer* buffer);
+ GBinderBuffer* buffer)
+ GBINDER_INTERNAL;
#endif /* GBINDER_LOCAL_REPLY_PRIVATE_H */
|
[-]
[+]
|
Changed |
_service:tar_git:libgbinder-1.0.46.tar.bz2/src/gbinder_local_request_p.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2018 Jolla Ltd.
- * Copyright (C) 2018 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2018-2020 Jolla Ltd.
+ * Copyright (C) 2018-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -14,8 +14,8 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the names of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -40,15 +40,18 @@
GBinderLocalRequest*
gbinder_local_request_new(
const GBinderIo* io,
- GBytes* init);
+ GBytes* init)
+ GBINDER_INTERNAL;
GBinderOutputData*
gbinder_local_request_data(
- GBinderLocalRequest* req);
+ GBinderLocalRequest* req)
+ GBINDER_INTERNAL;
GBinderLocalRequest*
gbinder_local_request_new_from_data(
- GBinderBuffer* buffer);
+ GBinderBuffer* buffer)
+ GBINDER_INTERNAL;
#endif /* GBINDER_LOCAL_REQUEST_PRIVATE_H */
|
[-]
[+]
|
Added |
_service:tar_git:libgbinder-1.0.46.tar.bz2/src/gbinder_log.c
^
|
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2020 Jolla Ltd.
+ * Copyright (C) 2020 Slava Monich <slava.monich@jolla.com>
+ *
+ * You may use this file under the terms of BSD license as follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "gbinder_log.h"
+
+#include <gutil_misc.h>
+
+#include <stdlib.h>
+
+/* Log module */
+GLOG_MODULE_DEFINE("gbinder");
+
+/* Initializes the default log level at startup */
+void
+gbinder_log_init(
+ void)
+{
+ int level = GLOG_MODULE_NAME.level;
+
+ if (gutil_parse_int(getenv("GBINDER_DEFAULT_LOG_LEVEL"), 0, &level) &&
+ level >= GLOG_LEVEL_INHERIT && level <= GLOG_LEVEL_VERBOSE) {
+ GINFO("Log level %d", level);
+ GLOG_MODULE_NAME.level = level;
+ }
+}
+
+/*
+ * Local Variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
|
[-]
[+]
|
Changed |
_service:tar_git:libgbinder-1.0.46.tar.bz2/src/gbinder_log.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2018 Jolla Ltd.
- * Copyright (C) 2018 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2018-2020 Jolla Ltd.
+ * Copyright (C) 2018-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -13,9 +13,9 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Jolla Ltd nor the names of its contributors may
- * be used to endorse or promote products derived from this software
- * without specific prior written permission.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -33,11 +33,18 @@
#ifndef GBINDER_LOG_H
#define GBINDER_LOG_H
-#include "gbinder_types.h"
+#include "gbinder_types_p.h"
#define GLOG_MODULE_NAME GBINDER_LOG_MODULE
#include <gutil_log.h>
+/* Declared for unit tests */
+__attribute__((constructor))
+void
+gbinder_log_init(
+ void)
+ GBINDER_INTERNAL;
+
#endif /* GBINDER_LOG_H */
/*
|
[-]
[+]
|
Changed |
_service:tar_git:libgbinder-1.0.46.tar.bz2/src/gbinder_object_registry.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2018 Jolla Ltd.
- * Copyright (C) 2018 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2018-2020 Jolla Ltd.
+ * Copyright (C) 2018-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -13,9 +13,9 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Jolla Ltd nor the names of its contributors may
- * be used to endorse or promote products derived from this software
- * without specific prior written permission.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
[-]
[+]
|
Changed |
_service:tar_git:libgbinder-1.0.46.tar.bz2/src/gbinder_output_data.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2018 Jolla Ltd.
- * Copyright (C) 2018 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2018-2020 Jolla Ltd.
+ * Copyright (C) 2018-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -13,9 +13,9 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Jolla Ltd nor the names of its contributors may
- * be used to endorse or promote products derived from this software
- * without specific prior written permission.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
[-]
[+]
|
Changed |
_service:tar_git:libgbinder-1.0.46.tar.bz2/src/gbinder_reader_p.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2018 Jolla Ltd.
- * Copyright (C) 2018 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2018-2020 Jolla Ltd.
+ * Copyright (C) 2018-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -13,9 +13,9 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Jolla Ltd nor the names of its contributors may
- * be used to endorse or promote products derived from this software
- * without specific prior written permission.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -48,7 +48,8 @@
GBinderReader* reader,
GBinderReaderData* data,
gsize offset,
- gsize len);
+ gsize len)
+ GBINDER_INTERNAL;
#endif /* GBINDER_READER_PRIVATE_H */
|
[-]
[+]
|
Changed |
_service:tar_git:libgbinder-1.0.46.tar.bz2/src/gbinder_remote_object.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2018-2019 Jolla Ltd.
- * Copyright (C) 2018-2019 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2018-2020 Jolla Ltd.
+ * Copyright (C) 2018-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -30,6 +30,8 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#define GLIB_DISABLE_DEPRECATION_WARNINGS
+
#include "gbinder_driver.h"
#include "gbinder_ipc.h"
#include "gbinder_remote_object_p.h"
|
[-]
[+]
|
Changed |
_service:tar_git:libgbinder-1.0.46.tar.bz2/src/gbinder_remote_object_p.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2018-2019 Jolla Ltd.
- * Copyright (C) 2018-2019 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2018-2020 Jolla Ltd.
+ * Copyright (C) 2018-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -55,15 +55,18 @@
gbinder_remote_object_new(
GBinderIpc* ipc,
guint32 handle,
- gboolean maybe_dead);
+ gboolean maybe_dead)
+ GBINDER_INTERNAL;
gboolean
gbinder_remote_object_reanimate(
- GBinderRemoteObject* obj);
+ GBinderRemoteObject* obj)
+ GBINDER_INTERNAL;
void
gbinder_remote_object_handle_death_notification(
- GBinderRemoteObject* obj);
+ GBinderRemoteObject* obj)
+ GBINDER_INTERNAL;
#endif /* GBINDER_REMOTE_OBJECT_PRIVATE_H */
|
[-]
[+]
|
Changed |
_service:tar_git:libgbinder-1.0.46.tar.bz2/src/gbinder_remote_reply_p.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2018 Jolla Ltd.
- * Copyright (C) 2018 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2018-2020 Jolla Ltd.
+ * Copyright (C) 2018-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -39,16 +39,19 @@
GBinderRemoteReply*
gbinder_remote_reply_new(
- GBinderObjectRegistry* reg);
+ GBinderObjectRegistry* reg)
+ GBINDER_INTERNAL;
void
gbinder_remote_reply_set_data(
GBinderRemoteReply* reply,
- GBinderBuffer* buffer);
+ GBinderBuffer* buffer)
+ GBINDER_INTERNAL;
gboolean
gbinder_remote_reply_is_empty(
- GBinderRemoteReply* reply);
+ GBinderRemoteReply* reply)
+ GBINDER_INTERNAL;
#endif /* GBINDER_REMOTE_REPLY_PRIVATE_H */
|
[-]
[+]
|
Changed |
_service:tar_git:libgbinder-1.0.46.tar.bz2/src/gbinder_remote_request_p.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2018 Jolla Ltd.
- * Copyright (C) 2018 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2018-2020 Jolla Ltd.
+ * Copyright (C) 2018-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -46,13 +46,15 @@
GBinderObjectRegistry* reg,
const GBinderRpcProtocol* protocol,
pid_t pid,
- uid_t euid);
+ uid_t euid)
+ GBINDER_INTERNAL;
void
gbinder_remote_request_set_data(
GBinderRemoteRequest* request,
guint txcode,
- GBinderBuffer* buffer);
+ GBinderBuffer* buffer)
+ GBINDER_INTERNAL;
#endif /* GBINDER_REMOTE_REQUEST_PRIVATE_H */
|
[-]
[+]
|
Changed |
_service:tar_git:libgbinder-1.0.46.tar.bz2/src/gbinder_rpc_protocol.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2018-2019 Jolla Ltd.
- * Copyright (C) 2018-2019 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2018-2020 Jolla Ltd.
+ * Copyright (C) 2018-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -15,8 +15,8 @@
* documentation and/or other materials provided with the distribution.
* documentation and/or other materials provided with the distribution.
* 3. Neither the names of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -49,13 +49,14 @@
char** iface);
};
-extern const GBinderRpcProtocol gbinder_rpc_protocol_binder;
-extern const GBinderRpcProtocol gbinder_rpc_protocol_hwbinder;
+extern const GBinderRpcProtocol gbinder_rpc_protocol_binder GBINDER_INTERNAL;
+extern const GBinderRpcProtocol gbinder_rpc_protocol_hwbinder GBINDER_INTERNAL;
/* Returns one of the above based on the device name */
const GBinderRpcProtocol*
gbinder_rpc_protocol_for_device(
- const char* dev);
+ const char* dev)
+ GBINDER_INTERNAL;
#endif /* GBINDER_RPC_PROTOCOL_H */
|
[-]
[+]
|
Changed |
_service:tar_git:libgbinder-1.0.46.tar.bz2/src/gbinder_servicemanager.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2018-2019 Jolla Ltd.
- * Copyright (C) 2018-2019 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2018-2020 Jolla Ltd.
+ * Copyright (C) 2018-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -14,8 +14,8 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the names of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -30,17 +30,19 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#define GLIB_DISABLE_DEPRECATION_WARNINGS
+
#include "gbinder_servicemanager_p.h"
#include "gbinder_client_p.h"
#include "gbinder_local_object_p.h"
#include "gbinder_remote_object_p.h"
+#include "gbinder_eventloop_p.h"
#include "gbinder_driver.h"
#include "gbinder_ipc.h"
#include "gbinder_log.h"
#include <gbinder_client.h>
-#include <gutil_idlepool.h>
#include <gutil_misc.h>
#include <errno.h>
@@ -60,8 +62,10 @@
GHashTable* watch_table;
gulong death_id;
gboolean present;
- guint presence_check_id;
+ GBinderEventLoopTimeout* presence_check;
guint presence_check_delay_ms;
+ GBinderEventLoopCallback* autorelease_cb;
+ GSList* autorelease;
};
G_DEFINE_ABSTRACT_TYPE(GBinderServiceManager, gbinder_servicemanager,
@@ -273,9 +277,9 @@
{
GBinderServiceManagerPriv* priv = self->priv;
- if (priv->presence_check_id) {
- g_source_remove(priv->presence_check_id);
- priv->presence_check_id = 0;
+ if (priv->presence_check) {
+ gbinder_timeout_remove(priv->presence_check);
+ priv->presence_check = NULL;
}
GINFO("Service manager %s has appeared", self->dev);
/* Re-arm the watches */
@@ -315,13 +319,14 @@
gbinder_servicemanager_ref(self);
if (gbinder_remote_object_reanimate(remote)) {
/* Done */
- priv->presence_check_id = 0;
+ priv->presence_check = NULL;
gbinder_servicemanager_reanimated(self);
result = G_SOURCE_REMOVE;
} else if (priv->presence_check_delay_ms < PRESENSE_WAIT_MS_MAX) {
priv->presence_check_delay_ms += PRESENSE_WAIT_MS_STEP;
- priv->presence_check_id = g_timeout_add(priv->presence_check_delay_ms,
- gbinder_servicemanager_presense_check_timer, self);
+ priv->presence_check =
+ gbinder_timeout_add(priv->presence_check_delay_ms,
+ gbinder_servicemanager_presense_check_timer, self);
result = G_SOURCE_REMOVE;
} else {
result = G_SOURCE_CONTINUE;
@@ -337,9 +342,9 @@
{
GBinderServiceManagerPriv* priv = self->priv;
- GASSERT(!priv->presence_check_id);
+ GASSERT(!priv->presence_check);
priv->presence_check_delay_ms = PRESENSE_WAIT_MS_MIN;
- priv->presence_check_id = g_timeout_add(PRESENSE_WAIT_MS_MIN,
+ priv->presence_check = gbinder_timeout_add(PRESENSE_WAIT_MS_MIN,
gbinder_servicemanager_presense_check_timer, self);
}
@@ -389,6 +394,20 @@
(wait.tv_sec > 0 || wait.tv_nsec > 0));
}
+static
+void
+gbinder_servicemanager_autorelease_cb(
+ gpointer data)
+{
+ GBinderServiceManager* self = GBINDER_SERVICEMANAGER(data);
+ GBinderServiceManagerPriv* priv = self->priv;
+ GSList* list = priv->autorelease;
+
+ priv->autorelease_cb = NULL;
+ priv->autorelease = NULL;
+ g_slist_free_full(list, g_object_unref);
+}
+
/*==========================================================================*
* Internal interface
*==========================================================================*/
@@ -673,10 +692,15 @@
if (G_LIKELY(self) && name) {
obj = GBINDER_SERVICEMANAGER_GET_CLASS(self)->get_service
(self, name, status);
- if (!self->pool) {
- self->pool = gutil_idle_pool_new();
+ if (obj) {
+ GBinderServiceManagerPriv* priv = self->priv;
+
+ priv->autorelease = g_slist_prepend(priv->autorelease, obj);
+ if (!priv->autorelease_cb) {
+ priv->autorelease_cb = gbinder_idle_callback_schedule_new
+ (gbinder_servicemanager_autorelease_cb, self, NULL);
+ }
}
- gutil_idle_pool_add_object(self->pool, obj);
} else if (status) {
*status = (-EINVAL);
}
@@ -913,12 +937,11 @@
GBinderServiceManager* self = GBINDER_SERVICEMANAGER(object);
GBinderServiceManagerPriv* priv = self->priv;
- if (priv->presence_check_id) {
- g_source_remove(priv->presence_check_id);
- }
+ gbinder_timeout_remove(priv->presence_check);
gbinder_remote_object_remove_handler(self->client->remote, priv->death_id);
+ gbinder_idle_callback_destroy(priv->autorelease_cb);
+ g_slist_free_full(priv->autorelease, g_object_unref);
g_hash_table_destroy(priv->watch_table);
- gutil_idle_pool_destroy(self->pool);
gbinder_client_unref(self->client);
G_OBJECT_CLASS(PARENT_CLASS)->finalize(object);
}
|
[-]
[+]
|
Changed |
_service:tar_git:libgbinder-1.0.46.tar.bz2/src/gbinder_servicemanager_p.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2018-2019 Jolla Ltd.
- * Copyright (C) 2018-2019 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2018-2020 Jolla Ltd.
+ * Copyright (C) 2018-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -14,8 +14,8 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the names of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -49,7 +49,6 @@
GBinderServiceManagerPriv* priv;
const char* dev;
GBinderClient* client;
- GUtilIdlePool* pool;
} GBinderServiceManager;
typedef enum gbinder_servicemanager_name_check {
@@ -85,18 +84,20 @@
void (*unwatch)(GBinderServiceManager* self, const char* name);
} GBinderServiceManagerClass;
-GType gbinder_servicemanager_get_type(void);
+GType gbinder_servicemanager_get_type(void) GBINDER_INTERNAL;
#define GBINDER_TYPE_SERVICEMANAGER (gbinder_servicemanager_get_type())
GBinderServiceManager*
gbinder_servicemanager_new_with_type(
GType type,
- const char* dev);
+ const char* dev)
+ GBINDER_INTERNAL;
void
gbinder_servicemanager_service_registered(
GBinderServiceManager* self,
- const char* name);
+ const char* name)
+ GBINDER_INTERNAL;
#endif /* GBINDER_SERVICEMANAGER_PRIVATE_H */
|
[-]
[+]
|
Changed |
_service:tar_git:libgbinder-1.0.46.tar.bz2/src/gbinder_servicepoll.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2018 Jolla Ltd.
- * Copyright (C) 2018 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2018-2020 Jolla Ltd.
+ * Copyright (C) 2018-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -32,6 +32,7 @@
#include "gbinder_servicepoll.h"
#include "gbinder_servicemanager.h"
+#include "gbinder_eventloop_p.h"
#include <gutil_strv.h>
@@ -46,7 +47,7 @@
GBinderServiceManager* manager;
char** list;
gulong list_id;
- guint timer_id;
+ GBinderEventLoopTimeout* timer;
};
G_DEFINE_TYPE(GBinderServicePoll, gbinder_servicepoll, G_TYPE_OBJECT)
@@ -230,7 +231,7 @@
gbinder_servicepoll_init(
GBinderServicePoll* self)
{
- self->timer_id = g_timeout_add(gbinder_servicepoll_interval_ms,
+ self->timer = gbinder_timeout_add(gbinder_servicepoll_interval_ms,
gbinder_servicepoll_timer, self);
}
@@ -241,7 +242,7 @@
{
GBinderServicePoll* self = GBINDER_SERVICEPOLL(object);
- g_source_remove(self->timer_id);
+ gbinder_timeout_remove(self->timer);
gbinder_servicemanager_cancel(self->manager, self->list_id);
gbinder_servicemanager_unref(self->manager);
g_strfreev(self->list);
|
[-]
[+]
|
Changed |
_service:tar_git:libgbinder-1.0.46.tar.bz2/src/gbinder_servicepoll.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2018 Jolla Ltd.
- * Copyright (C) 2018 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2018-2020 Jolla Ltd.
+ * Copyright (C) 2018-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -35,7 +35,7 @@
#include "gbinder_types_p.h"
-extern guint gbinder_servicepoll_interval_ms;
+extern guint gbinder_servicepoll_interval_ms GBINDER_INTERNAL;
typedef
void
@@ -47,35 +47,42 @@
GBinderServicePoll*
gbinder_servicepoll_new(
GBinderServiceManager* manager,
- GBinderServicePoll** weakptr);
+ GBinderServicePoll** weakptr)
+ GBINDER_INTERNAL;
GBinderServicePoll*
gbinder_servicepoll_ref(
- GBinderServicePoll* poll);
+ GBinderServicePoll* poll)
+ GBINDER_INTERNAL;
void
gbinder_servicepoll_unref(
- GBinderServicePoll* poll);
+ GBinderServicePoll* poll)
+ GBINDER_INTERNAL;
GBinderServiceManager*
gbinder_servicepoll_manager(
- GBinderServicePoll* poll);
+ GBinderServicePoll* poll)
+ GBINDER_INTERNAL;
gboolean
gbinder_servicepoll_is_known_name(
GBinderServicePoll* poll,
- const char* name);
+ const char* name)
+ GBINDER_INTERNAL;
gulong
gbinder_servicepoll_add_handler(
GBinderServicePoll* poll,
GBinderServicePollFunc func,
- void* user_data);
+ void* user_data)
+ GBINDER_INTERNAL;
void
gbinder_servicepoll_remove_handler(
GBinderServicePoll* poll,
- gulong id);
+ gulong id)
+ GBINDER_INTERNAL;
#endif /* GBINDER_SERVICEPOLL_H */
|
[-]
[+]
|
Changed |
_service:tar_git:libgbinder-1.0.46.tar.bz2/src/gbinder_system.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2018 Jolla Ltd.
- * Contact: Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2018-2020 Jolla Ltd.
+ * Copyright (C) 2018-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -13,9 +13,9 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Jolla Ltd nor the names of its contributors may
- * be used to endorse or promote products derived from this software
- * without specific prior written permission.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -38,29 +38,34 @@
int
gbinder_system_open(
const char* path,
- int flags);
+ int flags)
+ GBINDER_INTERNAL;
int
gbinder_system_close(
- int fd);
+ int fd)
+ GBINDER_INTERNAL;
int
gbinder_system_ioctl(
int fd,
int request,
- void* data);
+ void* data)
+ GBINDER_INTERNAL;
void*
gbinder_system_mmap(
size_t length,
int prot,
int flags,
- int fd);
+ int fd)
+ GBINDER_INTERNAL;
int
gbinder_system_munmap(
void* addr,
- size_t length);
+ size_t length)
+ GBINDER_INTERNAL;
#endif /* GBINDER_SYSTEM_H */
|
[-]
[+]
|
Changed |
_service:tar_git:libgbinder-1.0.46.tar.bz2/src/gbinder_types_p.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2018-2019 Jolla Ltd.
- * Copyright (C) 2018-2019 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2018-2020 Jolla Ltd.
+ * Copyright (C) 2018-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -14,8 +14,8 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the names of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -47,6 +47,7 @@
typedef struct gbinder_ipc_looper_tx GBinderIpcLooperTx;
#define GBINDER_INLINE_FUNC static inline
+#define GBINDER_INTERNAL G_GNUC_INTERNAL
#define GBINDER_TRANSACTION(c2,c3,c4) GBINDER_FOURCC('_',c2,c3,c4)
#define GBINDER_PING_TRANSACTION GBINDER_TRANSACTION('P','N','G')
|
[-]
[+]
|
Changed |
_service:tar_git:libgbinder-1.0.46.tar.bz2/src/gbinder_writer.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2018-2019 Jolla Ltd.
- * Copyright (C) 2018-2019 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2018-2020 Jolla Ltd.
+ * Copyright (C) 2018-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -14,8 +14,8 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the names of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -686,13 +686,9 @@
vec->owns_buffer = TRUE;
data->cleanup = gbinder_cleanup_add(data->cleanup, g_free, vec);
- /* Write the buffer object pointing to the vector descriptor */
+ /* Every vector, even the one without data, requires two buffer objects */
gbinder_writer_data_write_buffer_object(data, vec, sizeof(*vec), NULL);
-
- /* Not sure what's the right way to deal with NULL vectors... */
- if (buf) {
- gbinder_writer_data_write_buffer_object(data, buf, total, &vec_parent);
- }
+ gbinder_writer_data_write_buffer_object(data, buf, total, &vec_parent);
}
void
@@ -732,13 +728,14 @@
gbinder_writer_data_write_buffer_object(data, hidl_string,
sizeof(*hidl_string), NULL);
- /* Not sure what's the right way to deal with NULL strings... */
if (str) {
/* Write the buffer pointing to the string data including the
* NULL terminator, referencing string descriptor as a parent. */
gbinder_writer_data_write_buffer_object(data, str, len+1, &str_parent);
GVERBOSE_("\"%s\" %u %u %u", str, (guint)len, (guint)str_parent.index,
(guint)data->buffers_size);
+ } else {
+ gbinder_writer_data_write_buffer_object(data, NULL, 0, &str_parent);
}
}
@@ -819,9 +816,16 @@
GVERBOSE_("%d. \"%s\" %u %u %u", i + 1, hidl_str->data.str,
(guint)hidl_str->len, (guint)str_parent.index,
(guint)data->buffers_size);
+ } else {
+ GVERBOSE_("%d. NULL %u %u %u", i + 1, (guint)hidl_str->len,
+ (guint)str_parent.index, (guint)data->buffers_size);
+ gbinder_writer_data_write_buffer_object(data, NULL, 0,
+ &str_parent);
}
str_parent.offset += sizeof(GBinderHidlString);
}
+ } else {
+ gbinder_writer_data_write_buffer_object(data, NULL, 0, &vec_parent);
}
}
|
[-]
[+]
|
Changed |
_service:tar_git:libgbinder-1.0.46.tar.bz2/src/gbinder_writer_p.h
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2018 Jolla Ltd.
- * Copyright (C) 2018 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2018-2020 Jolla Ltd.
+ * Copyright (C) 2018-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -14,8 +14,8 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the names of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -48,94 +48,111 @@
void
gbinder_writer_init(
GBinderWriter* writer,
- GBinderWriterData* data);
+ GBinderWriterData* data)
+ GBINDER_INTERNAL;
void
gbinder_writer_data_set_contents(
GBinderWriterData* data,
- GBinderBuffer* buffer);
+ GBinderBuffer* buffer)
+ GBINDER_INTERNAL;
void
gbinder_writer_data_append_bool(
GBinderWriterData* data,
- gboolean value);
+ gboolean value)
+ GBINDER_INTERNAL;
void
gbinder_writer_data_append_int32(
GBinderWriterData* data,
- guint32 value);
+ guint32 value)
+ GBINDER_INTERNAL;
void
gbinder_writer_data_append_int64(
GBinderWriterData* data,
- guint64 value);
+ guint64 value)
+ GBINDER_INTERNAL;
void
gbinder_writer_data_append_float(
GBinderWriterData* data,
- gfloat value);
+ gfloat value)
+ GBINDER_INTERNAL;
void
gbinder_writer_data_append_double(
GBinderWriterData* data,
- gdouble value);
+ gdouble value)
+ GBINDER_INTERNAL;
void
gbinder_writer_data_append_string8(
GBinderWriterData* data,
- const char* str);
+ const char* str)
+ GBINDER_INTERNAL;
void
gbinder_writer_data_append_string8_len(
GBinderWriterData* data,
const char* str,
- gsize len);
+ gsize len)
+ GBINDER_INTERNAL;
void
gbinder_writer_data_append_string16(
GBinderWriterData* data,
- const char* utf8);
+ const char* utf8)
+ GBINDER_INTERNAL;
void
gbinder_writer_data_append_string16_len(
GBinderWriterData* data,
const char* utf8,
- gssize num_bytes);
+ gssize num_bytes)
+ GBINDER_INTERNAL;
guint
gbinder_writer_data_append_buffer_object(
GBinderWriterData* data,
const void* ptr,
gsize size,
- const GBinderParent* parent);
+ const GBinderParent* parent)
+ GBINDER_INTERNAL;
void
gbinder_writer_data_append_hidl_vec(
GBinderWriterData* data,
const void* base,
guint count,
- guint elemsize);
+ guint elemsize)
+ GBINDER_INTERNAL;
void
gbinder_writer_data_append_hidl_string(
GBinderWriterData* data,
- const char* str);
+ const char* str)
+ GBINDER_INTERNAL;
void
gbinder_writer_data_append_hidl_string_vec(
GBinderWriterData* data,
const char* strv[],
- gssize count);
+ gssize count)
+ GBINDER_INTERNAL;
void
gbinder_writer_data_append_local_object(
GBinderWriterData* data,
- GBinderLocalObject* obj);
+ GBinderLocalObject* obj)
+ GBINDER_INTERNAL;
void
gbinder_writer_data_append_remote_object(
GBinderWriterData* data,
- GBinderRemoteObject* obj);
+ GBinderRemoteObject* obj)
+ GBINDER_INTERNAL;
#endif /* GBINDER_WRITER_PRIVATE_H */
|
[-]
[+]
|
Changed |
_service:tar_git:libgbinder-1.0.46.tar.bz2/test/Makefile
^
|
@@ -5,5 +5,6 @@
@$(MAKE) -C binder-client $*
@$(MAKE) -C binder-dump $*
@$(MAKE) -C binder-list $*
+ @$(MAKE) -C binder-ping $*
@$(MAKE) -C binder-service $*
@$(MAKE) -C rild-card-status $*
|
[-]
[+]
|
Changed |
_service:tar_git:libgbinder-1.0.46.tar.bz2/test/binder-client/Makefile
^
|
@@ -41,7 +41,7 @@
# Tools and flags
#
-CC = $(CROSS_COMPILE)gcc
+CC ?= $(CROSS_COMPILE)gcc
LD = $(CC)
WARNINGS = -Wall
INCLUDES = -I$(LIB_DIR)/include
|
[-]
[+]
|
Changed |
_service:tar_git:libgbinder-1.0.46.tar.bz2/test/binder-dump/Makefile
^
|
@@ -41,7 +41,7 @@
# Tools and flags
#
-CC = $(CROSS_COMPILE)gcc
+CC ?= $(CROSS_COMPILE)gcc
LD = $(CC)
WARNINGS = -Wall
INCLUDES = -I$(LIB_DIR)/include
|
[-]
[+]
|
Changed |
_service:tar_git:libgbinder-1.0.46.tar.bz2/test/binder-list/Makefile
^
|
@@ -41,7 +41,7 @@
# Tools and flags
#
-CC = $(CROSS_COMPILE)gcc
+CC ?= $(CROSS_COMPILE)gcc
LD = $(CC)
WARNINGS = -Wall
INCLUDES = -I$(LIB_DIR)/include
@@ -138,3 +138,17 @@
libgbinder-release:
@make $(SUBMAKE_OPTS) -C $(LIB_DIR) $(RELEASE_SO_FILE) $(RELEASE_LINK_FILE)
+
+#
+# Install
+#
+
+INSTALL = install
+
+INSTALL_BIN_DIR = $(DESTDIR)/usr/bin
+
+install: release $(INSTALL_BIN_DIR)
+ $(INSTALL) -m 755 $(RELEASE_EXE) $(INSTALL_BIN_DIR)
+
+$(INSTALL_BIN_DIR):
+ $(INSTALL) -d $@
|
[-]
[+]
|
Changed |
_service:tar_git:libgbinder-1.0.46.tar.bz2/test/binder-list/binder-list.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2018-2019 Jolla Ltd.
- * Copyright (C) 2018-2019 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2018-2020 Jolla Ltd.
+ * Copyright (C) 2018-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -39,7 +39,7 @@
#define RET_INVARG (2)
#define RET_ERR (3)
-#define DEV_DEFAULT "/dev/binder"
+#define DEV_DEFAULT GBINDER_DEFAULT_HWBINDER
typedef struct app_options {
char* dev;
|
[-]
[+]
|
Added |
_service:tar_git:libgbinder-1.0.46.tar.bz2/test/binder-ping/Makefile
^
|
@@ -0,0 +1,154 @@
+# -*- Mode: makefile-gmake -*-
+
+.PHONY: all debug release clean cleaner
+.PHONY: libgbinder-release libgbinder-debug
+
+#
+# Required packages
+#
+
+PKGS = glib-2.0 gio-2.0 gio-unix-2.0 libglibutil
+
+#
+# Default target
+#
+
+all: debug release
+
+#
+# Executable
+#
+
+EXE = binder-ping
+
+#
+# Sources
+#
+
+SRC = $(EXE).c
+
+#
+# Directories
+#
+
+SRC_DIR = .
+BUILD_DIR = build
+LIB_DIR = ../..
+DEBUG_BUILD_DIR = $(BUILD_DIR)/debug
+RELEASE_BUILD_DIR = $(BUILD_DIR)/release
+
+#
+# Tools and flags
+#
+
+CC ?= $(CROSS_COMPILE)gcc
+LD = $(CC)
+WARNINGS = -Wall
+INCLUDES = -I$(LIB_DIR)/include
+BASE_FLAGS = -fPIC
+CFLAGS = $(BASE_FLAGS) $(DEFINES) $(WARNINGS) $(INCLUDES) -MMD -MP \
+ $(shell pkg-config --cflags $(PKGS))
+LDFLAGS = $(BASE_FLAGS) $(shell pkg-config --libs $(PKGS))
+QUIET_MAKE = make --no-print-directory
+DEBUG_FLAGS = -g
+RELEASE_FLAGS =
+
+ifndef KEEP_SYMBOLS
+KEEP_SYMBOLS = 0
+endif
+
+ifneq ($(KEEP_SYMBOLS),0)
+RELEASE_FLAGS += -g
+SUBMAKE_OPTS += KEEP_SYMBOLS=1
+endif
+
+DEBUG_LDFLAGS = $(LDFLAGS) $(DEBUG_FLAGS)
+RELEASE_LDFLAGS = $(LDFLAGS) $(RELEASE_FLAGS)
+DEBUG_CFLAGS = $(CFLAGS) $(DEBUG_FLAGS) -DDEBUG
+RELEASE_CFLAGS = $(CFLAGS) $(RELEASE_FLAGS) -O2
+
+#
+# Files
+#
+
+DEBUG_OBJS = $(SRC:%.c=$(DEBUG_BUILD_DIR)/%.o)
+RELEASE_OBJS = $(SRC:%.c=$(RELEASE_BUILD_DIR)/%.o)
+DEBUG_SO_FILE := $(shell $(QUIET_MAKE) -C $(LIB_DIR) print_debug_so)
+RELEASE_SO_FILE := $(shell $(QUIET_MAKE) -C $(LIB_DIR) print_release_so)
+DEBUG_LINK_FILE := $(shell $(QUIET_MAKE) -C $(LIB_DIR) print_debug_link)
+RELEASE_LINK_FILE := $(shell $(QUIET_MAKE) -C $(LIB_DIR) print_release_link)
+DEBUG_SO = $(LIB_DIR)/$(DEBUG_SO_FILE)
+RELEASE_SO = $(LIB_DIR)/$(RELEASE_SO_FILE)
+
+#
+# Dependencies
+#
+
+DEPS = $(DEBUG_OBJS:%.o=%.d) $(RELEASE_OBJS:%.o=%.d)
+ifneq ($(MAKECMDGOALS),clean)
+ifneq ($(strip $(DEPS)),)
+-include $(DEPS)
+endif
+endif
+
+$(DEBUG_OBJS): | $(DEBUG_BUILD_DIR)
+$(RELEASE_OBJS): | $(RELEASE_BUILD_DIR)
+
+#
+# Rules
+#
+
+DEBUG_EXE = $(DEBUG_BUILD_DIR)/$(EXE)
+RELEASE_EXE = $(RELEASE_BUILD_DIR)/$(EXE)
+
+debug: libgbinder-debug $(DEBUG_EXE)
+
+release: libgbinder-release $(RELEASE_EXE)
+
+clean:
+ rm -f *~
+ rm -fr $(BUILD_DIR)
+
+cleaner: clean
+ @make -C $(LIB_DIR) clean
+
+$(DEBUG_BUILD_DIR):
+ mkdir -p $@
+
+$(RELEASE_BUILD_DIR):
+ mkdir -p $@
+
+$(DEBUG_BUILD_DIR)/%.o : $(SRC_DIR)/%.c
+ $(CC) -c $(DEBUG_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
+
+$(RELEASE_BUILD_DIR)/%.o : $(SRC_DIR)/%.c
+ $(CC) -c $(RELEASE_CFLAGS) -MT"$@" -MF"$(@:%.o=%.d)" $< -o $@
+
+$(DEBUG_EXE): $(DEBUG_SO) $(DEBUG_BUILD_DIR) $(DEBUG_OBJS)
+ $(LD) $(DEBUG_OBJS) $(DEBUG_LDFLAGS) $< -o $@
+
+$(RELEASE_EXE): $(RELEASE_SO) $(RELEASE_BUILD_DIR) $(RELEASE_OBJS)
+ $(LD) $(RELEASE_OBJS) $(RELEASE_LDFLAGS) $< -o $@
+ifeq ($(KEEP_SYMBOLS),0)
+ strip $@
+endif
+
+libgbinder-debug:
+ @make $(SUBMAKE_OPTS) -C $(LIB_DIR) $(DEBUG_SO_FILE) $(DEBUG_LINK_FILE)
+
+libgbinder-release:
+ @make $(SUBMAKE_OPTS) -C $(LIB_DIR) $(RELEASE_SO_FILE) $(RELEASE_LINK_FILE)
+
+#
+# Install
+#
+
+INSTALL = install
+
+INSTALL_BIN_DIR = $(DESTDIR)/usr/bin
+
+install: release $(INSTALL_BIN_DIR)
+ $(INSTALL) -m 755 $(RELEASE_EXE) $(INSTALL_BIN_DIR)
+
+$(INSTALL_BIN_DIR):
+ $(INSTALL) -d $@
|
[-]
[+]
|
Added |
_service:tar_git:libgbinder-1.0.46.tar.bz2/test/binder-ping/binder-ping.c
^
|
@@ -0,0 +1,187 @@
+/*
+ * Copyright (C) 2020 Jolla Ltd.
+ * Copyright (C) 2020 Slava Monich <slava.monich@jolla.com>
+ *
+ * You may use this file under the terms of BSD license as follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <gbinder.h>
+
+#include <gutil_log.h>
+
+#define RET_OK (0)
+#define RET_NOTFOUND (1)
+#define RET_INVARG (2)
+#define RET_ERR (3)
+
+#define DEFAULT_BINDER GBINDER_DEFAULT_HWBINDER
+#define AIDL_PING_TRANSACTION GBINDER_FOURCC('_','P','N','G')
+#define HIDL_PING_TRANSACTION GBINDER_FOURCC(0x0f,'P','N','G')
+
+typedef struct app_options {
+ const char* fqname;
+ char* dev;
+ guint32 ping_code;
+ const char* iface;
+} AppOptions;
+
+static
+int
+app_run(
+ const AppOptions* opt)
+{
+ int ret = RET_NOTFOUND;
+ GBinderServiceManager* sm = gbinder_servicemanager_new(opt->dev);
+
+ if (sm) {
+ int status = 0;
+ GBinderRemoteObject* remote = gbinder_servicemanager_get_service_sync
+ (sm, opt->fqname, &status);
+
+ if (remote) {
+ int status;
+ GBinderClient* client = gbinder_client_new(remote, opt->iface);
+ GBinderRemoteReply* reply = gbinder_client_transact_sync_reply
+ (client, opt->ping_code, NULL, &status);
+
+ if (reply) {
+ GINFO("OK");
+ ret = RET_OK;
+ } else {
+ GERR("Ping failed (%d)", status);
+ ret = RET_ERR;
+ }
+ gbinder_remote_reply_unref(reply);
+ gbinder_client_unref(client);
+ } else {
+ GERR("%s not found", opt->fqname);
+ }
+ gbinder_servicemanager_unref(sm);
+ } else {
+ GERR("No servicemanager at %s", opt->dev);
+ }
+ return ret;
+}
+
+static
+gboolean
+app_log_verbose(
+ const gchar* name,
+ const gchar* value,
+ gpointer data,
+ GError** error)
+{
+ gutil_log_default.level = GLOG_LEVEL_VERBOSE;
+ return TRUE;
+}
+
+static
+gboolean
+app_log_quiet(
+ const gchar* name,
+ const gchar* value,
+ gpointer data,
+ GError** error)
+{
+ gutil_log_default.level = GLOG_LEVEL_NONE;
+ return TRUE;
+}
+
+static
+gboolean
+app_init(
+ AppOptions* opt,
+ int argc,
+ char* argv[])
+{
+ gboolean ok = FALSE;
+ GOptionEntry entries[] = {
+ { "verbose", 'v', G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK,
+ app_log_verbose, "Enable verbose output", NULL },
+ { "quiet", 'q', G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK,
+ app_log_quiet, "Be quiet", NULL },
+ { "device", 'd', 0, G_OPTION_ARG_STRING, &opt->dev,
+ "Binder device [" DEFAULT_BINDER "]", "DEVICE" },
+ { NULL }
+ };
+
+ GError* error = NULL;
+ GOptionContext* options = g_option_context_new("[FQNAME]");
+
+ gutil_log_timestamp = FALSE;
+ gutil_log_default.level = GLOG_LEVEL_DEFAULT;
+
+ g_option_context_add_main_entries(options, entries, NULL);
+ if (g_option_context_parse(options, &argc, &argv, &error)) {
+ if (!opt->dev || !opt->dev[0]) {
+ opt->dev = g_strdup(DEFAULT_BINDER);
+ }
+ if (argc == 2) {
+ opt->fqname = argv[1];
+ if (g_strcmp0(opt->dev, GBINDER_DEFAULT_BINDER)) {
+ opt->ping_code = HIDL_PING_TRANSACTION;
+ opt->iface = "android.hidl.base@1.0::IBase";
+ } else {
+ opt->ping_code = AIDL_PING_TRANSACTION;
+ opt->iface = "android.os.IBinder";
+ }
+ ok = TRUE;
+ } else {
+ char* help = g_option_context_get_help(options, TRUE, NULL);
+
+ fprintf(stderr, "%s", help);
+ g_free(help);
+ }
+ } else {
+ GERR("%s", error->message);
+ g_error_free(error);
+ }
+ g_option_context_free(options);
+ return ok;
+}
+
+int main(int argc, char* argv[])
+{
+ AppOptions opt;
+ int ret = RET_INVARG;
+
+ memset(&opt, 0, sizeof(opt));
+ if (app_init(&opt, argc, argv)) {
+ ret = app_run(&opt);
+ }
+ g_free(opt.dev);
+ return ret;
+}
+
+/*
+ * Local Variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
|
[-]
[+]
|
Changed |
_service:tar_git:libgbinder-1.0.46.tar.bz2/test/binder-service/Makefile
^
|
@@ -41,7 +41,7 @@
# Tools and flags
#
-CC = $(CROSS_COMPILE)gcc
+CC ?= $(CROSS_COMPILE)gcc
LD = $(CC)
WARNINGS = -Wall
INCLUDES = -I$(LIB_DIR)/include
|
[-]
[+]
|
Changed |
_service:tar_git:libgbinder-1.0.46.tar.bz2/test/rild-card-status/Makefile
^
|
@@ -41,7 +41,7 @@
# Tools and flags
#
-CC = $(CROSS_COMPILE)gcc
+CC ?= $(CROSS_COMPILE)gcc
LD = $(CC)
WARNINGS = -Wall
INCLUDES = -I$(LIB_DIR)/include
|
[-]
[+]
|
Changed |
_service:tar_git:libgbinder-1.0.46.tar.bz2/unit/Makefile
^
|
@@ -6,10 +6,12 @@
@$(MAKE) -C unit_cleanup $*
@$(MAKE) -C unit_client $*
@$(MAKE) -C unit_driver $*
+ @$(MAKE) -C unit_eventloop $*
@$(MAKE) -C unit_ipc $*
@$(MAKE) -C unit_local_object $*
@$(MAKE) -C unit_local_reply $*
@$(MAKE) -C unit_local_request $*
+ @$(MAKE) -C unit_log $*
@$(MAKE) -C unit_protocol $*
@$(MAKE) -C unit_reader $*
@$(MAKE) -C unit_remote_object $*
|
[-]
[+]
|
Changed |
_service:tar_git:libgbinder-1.0.46.tar.bz2/unit/common/Makefile
^
|
@@ -42,7 +42,7 @@
# Tools and flags
#
-CC = $(CROSS_COMPILE)gcc
+CC ?= $(CROSS_COMPILE)gcc
LD = $(CC)
WARNINGS += -Wall
INCLUDES += -I$(COMMON_DIR) -I$(LIB_DIR)/src -I$(LIB_DIR)/include
|
[-]
[+]
|
Changed |
_service:tar_git:libgbinder-1.0.46.tar.bz2/unit/coverage/run
^
|
@@ -8,10 +8,12 @@
unit_cleanup \
unit_client \
unit_driver \
+unit_eventloop \
unit_ipc \
unit_local_object \
unit_local_reply \
unit_local_request \
+unit_log \
unit_protocol \
unit_reader \
unit_remote_object \
|
[-]
[+]
|
Changed |
_service:tar_git:libgbinder-1.0.46.tar.bz2/unit/unit_client/unit_client.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2018-2019 Jolla Ltd.
- * Copyright (C) 2018-2019 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2018-2020 Jolla Ltd.
+ * Copyright (C) 2018-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -75,10 +75,13 @@
void)
{
g_assert(!gbinder_client_new(NULL, NULL));
+ g_assert(!gbinder_client_new2(NULL, NULL, 0));
g_assert(!gbinder_client_ref(NULL));
g_assert(!gbinder_client_interface(NULL));
+ g_assert(!gbinder_client_interface2(NULL, 0));
gbinder_client_unref(NULL);
g_assert(!gbinder_client_new_request(NULL));
+ g_assert(!gbinder_client_new_request2(NULL, 0));
g_assert(!gbinder_client_transact_sync_reply(NULL, 0, NULL, NULL));
g_assert(gbinder_client_transact_sync_oneway(NULL, 0, NULL) == (-EINVAL));
g_assert(!gbinder_client_transact(NULL, 0, 0, NULL, NULL, NULL, NULL));
@@ -102,7 +105,7 @@
g_assert(client);
g_assert(gbinder_client_ref(client) == client);
- g_assert(!g_strcmp0(gbinder_client_interface(client), iface));
+ g_assert_cmpstr(gbinder_client_interface(client), == ,iface);
gbinder_client_unref(client);
gbinder_client_cancel(client, 0); /* does nothing */
@@ -112,6 +115,44 @@
}
/*==========================================================================*
+ * interfaces
+ *==========================================================================*/
+
+static
+void
+test_interfaces(
+ void)
+{
+ GBinderIpc* ipc = gbinder_ipc_new(GBINDER_DEFAULT_BINDER, NULL);
+ GBinderObjectRegistry* reg = gbinder_ipc_object_registry(ipc);
+ GBinderRemoteObject* obj = gbinder_object_registry_get_remote(reg, 0);
+ static const GBinderClientIfaceInfo ifaces[] = {
+ {"33", 33 }, { "11", 11 }, { "22", 22 }
+ };
+ GBinderClient* client = gbinder_client_new2(obj, ifaces,
+ G_N_ELEMENTS(ifaces));
+
+ g_assert(client);
+ g_assert_cmpstr(gbinder_client_interface(client), == ,"11");
+ g_assert_cmpstr(gbinder_client_interface2(client, 11), == ,"11");
+ g_assert_cmpstr(gbinder_client_interface2(client, 22), == ,"22");
+ g_assert_cmpstr(gbinder_client_interface2(client, 33), == ,"33");
+ g_assert(!gbinder_client_interface2(client, 34));
+ g_assert(!gbinder_client_new_request2(client, 34));
+ gbinder_client_unref(client);
+
+ /* Client with no interface info */
+ client = gbinder_client_new2(obj, NULL, 0);
+ g_assert(client);
+ g_assert(!gbinder_client_interface(client));
+ g_assert(!gbinder_client_interface2(client, 1));
+ gbinder_client_unref(client);
+
+ gbinder_remote_object_unref(obj);
+ gbinder_ipc_unref(ipc);
+}
+
+/*==========================================================================*
* no_header
*==========================================================================*/
@@ -344,8 +385,9 @@
GDestroyNotify destroy)
{
GBinderClient* client = test_client_new(0, TEST_INTERFACE);
- GBinderLocalRequest* req = gbinder_client_new_request(client);
+ GBinderLocalRequest* req = gbinder_client_new_request2(client, 0);
+ g_assert(req);
test_reply_tx(client, req, done, destroy);
gbinder_local_request_unref(req);
@@ -391,6 +433,7 @@
g_test_init(&argc, &argv, NULL);
g_test_add_func(TEST_("null"), test_null);
g_test_add_func(TEST_("basic"), test_basic);
+ g_test_add_func(TEST_("interfaces"), test_interfaces);
g_test_add_func(TEST_("dead"), test_dead);
g_test_add_func(TEST_("no_header"), test_no_header);
g_test_add_func(TEST_("sync_oneway"), test_sync_oneway);
|
[-]
[+]
|
Added |
_service:tar_git:libgbinder-1.0.46.tar.bz2/unit/unit_eventloop/Makefile
^
|
@@ -0,0 +1,5 @@
+# -*- Mode: makefile-gmake -*-
+
+EXE = unit_eventloop
+
+include ../common/Makefile
|
[-]
[+]
|
Added |
_service:tar_git:libgbinder-1.0.46.tar.bz2/unit/unit_eventloop/unit_eventloop.c
^
|
@@ -0,0 +1,262 @@
+/*
+ * Copyright (C) 2020 Jolla Ltd.
+ * Copyright (C) 2020 Slava Monich <slava.monich@jolla.com>
+ *
+ * You may use this file under the terms of BSD license as follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "test_common.h"
+#include "gbinder_eventloop_p.h"
+
+static TestOpt test_opt;
+
+static int test_eventloop_timeout_add_called;
+static int test_eventloop_callback_new_called;
+static int test_eventloop_cleanup_called;
+
+static
+gboolean
+test_unreached_proc(
+ gpointer data)
+{
+ g_assert_not_reached();
+ return G_SOURCE_CONTINUE;
+}
+
+/*==========================================================================*
+ * Test event loop integration
+ *==========================================================================*/
+
+static
+GBinderEventLoopTimeout*
+test_eventloop_timeout_add(
+ guint interval,
+ GSourceFunc func,
+ gpointer data)
+{
+ test_eventloop_timeout_add_called++;
+ return NULL;
+}
+
+static
+void
+test_eventloop_timeout_remove(
+ GBinderEventLoopTimeout* timeout)
+{
+ g_assert_not_reached();
+}
+
+static
+GBinderEventLoopCallback*
+test_eventloop_callback_new(
+ GBinderEventLoopCallbackFunc func,
+ gpointer data,
+ GDestroyNotify destroy)
+{
+ test_eventloop_callback_new_called++;
+ return NULL;
+}
+
+static
+void
+test_eventloop_callback_ref(
+ GBinderEventLoopCallback* cb)
+{
+ g_assert_not_reached();
+}
+
+static
+void
+test_eventloop_callback_unref(
+ GBinderEventLoopCallback* cb)
+{
+ g_assert_not_reached();
+}
+
+static
+void
+test_eventloop_callback_schedule(
+ GBinderEventLoopCallback* cb)
+{
+ g_assert_not_reached();
+}
+
+static
+void
+test_eventloop_callback_cancel(
+ GBinderEventLoopCallback* cb)
+{
+ g_assert_not_reached();
+}
+
+static
+void
+test_eventloop_cleanup(
+ void)
+{
+ test_eventloop_cleanup_called++;
+}
+
+static const GBinderEventLoopIntegration test_eventloop = {
+ test_eventloop_timeout_add,
+ test_eventloop_timeout_remove,
+ test_eventloop_callback_new,
+ test_eventloop_callback_ref,
+ test_eventloop_callback_unref,
+ test_eventloop_callback_schedule,
+ test_eventloop_callback_cancel,
+ test_eventloop_cleanup
+};
+
+/*==========================================================================*
+ * replace
+ *==========================================================================*/
+
+static
+void
+test_replace(
+ void)
+{
+ test_eventloop_timeout_add_called = 0;
+ test_eventloop_callback_new_called = 0;
+ test_eventloop_cleanup_called = 0;
+
+ gbinder_eventloop_set(NULL);
+ gbinder_eventloop_set(&test_eventloop);
+
+ g_assert(!gbinder_timeout_add(0, test_unreached_proc, NULL));
+ g_assert_cmpint(test_eventloop_timeout_add_called, == ,1);
+ g_assert(!gbinder_idle_add(test_unreached_proc, NULL));
+ g_assert_cmpint(test_eventloop_timeout_add_called, == ,2);
+ gbinder_timeout_remove(NULL);
+ g_assert(!gbinder_idle_callback_new(NULL, NULL, NULL));
+ g_assert_cmpint(test_eventloop_callback_new_called, == ,1);
+ g_assert(!gbinder_idle_callback_ref(NULL));
+ gbinder_idle_callback_unref(NULL);
+ gbinder_idle_callback_schedule(NULL);
+ gbinder_idle_callback_cancel(NULL);
+
+ gbinder_eventloop_set(NULL);
+ g_assert_cmpint(test_eventloop_cleanup_called, == ,1);
+}
+
+/*==========================================================================*
+ * idle
+ *==========================================================================*/
+
+static
+gboolean
+test_quit_func(
+ gpointer data)
+{
+ g_main_loop_quit((GMainLoop*)data);
+ return G_SOURCE_REMOVE;
+}
+
+static
+void
+test_idle(
+ void)
+{
+ GMainLoop* loop = g_main_loop_new(NULL, FALSE);
+
+ gbinder_eventloop_set(NULL);
+ g_assert(gbinder_idle_add(test_quit_func, loop));
+ test_run(&test_opt, loop);
+ g_main_loop_unref(loop);
+}
+
+/*==========================================================================*
+ * timeout
+ *==========================================================================*/
+
+static
+void
|
[-]
[+]
|
Changed |
_service:tar_git:libgbinder-1.0.46.tar.bz2/unit/unit_ipc/unit_ipc.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2018-2019 Jolla Ltd.
- * Copyright (C) 2018-2019 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2018-2020 Jolla Ltd.
+ * Copyright (C) 2018-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -684,6 +684,94 @@
}
/*==========================================================================*
+ * transact_2way
+ *==========================================================================*/
+
+static
+GBinderLocalReply*
+test_transact_2way_incoming_proc(
+ GBinderLocalObject* obj,
+ GBinderRemoteRequest* req,
+ guint code,
+ guint flags,
+ int* status,
+ void* user_data)
+{
+ int* incoming_call = user_data;
+
+ GVERBOSE_("\"%s\" %u", gbinder_remote_request_interface(req), code);
+ g_assert_cmpuint(flags, == ,0);
+ g_assert_cmpint(gbinder_remote_request_sender_pid(req), == ,getpid());
+ g_assert_cmpint(gbinder_remote_request_sender_euid(req), == ,geteuid());
+ g_assert_cmpstr(gbinder_remote_request_interface(req), == ,"test");
+ g_assert_cmpstr(gbinder_remote_request_read_string8(req), == ,"message");
+ g_assert_cmpuint(code, == ,2);
+ g_assert_cmpint(*incoming_call, == ,0);
+ (*incoming_call)++;
+
+ *status = GBINDER_STATUS_OK;
+ return gbinder_local_object_new_reply(obj);
+}
+
+static
+void
+test_transact_2way(
+ void)
+{
+ GBinderIpc* ipc = gbinder_ipc_new(GBINDER_DEFAULT_BINDER, NULL);
+ const GBinderIo* io = gbinder_driver_io(ipc->driver);
+ const int fd = gbinder_driver_fd(ipc->driver);
+ const char* dev = gbinder_driver_dev(ipc->driver);
+ const GBinderRpcProtocol* prot = gbinder_rpc_protocol_for_device(dev);
+ const char* const ifaces[] = { "test", NULL };
+ const guint32 handle = 0;
+ const guint32 code = 1;
+ int incoming_call = 0;
+ GMainLoop* loop = g_main_loop_new(NULL, FALSE);
+ GBinderLocalObject* obj = gbinder_local_object_new
+ (ipc, ifaces, test_transact_2way_incoming_proc, &incoming_call);
+ GBinderLocalRequest* req = gbinder_local_request_new(io, NULL);
+ GBinderLocalRequest* incoming_req = gbinder_local_request_new(io, NULL);
+ GBinderLocalReply* reply = gbinder_local_reply_new(io);
+ GBinderWriter writer;
+
+ /* Prepare reply */
+ g_assert(gbinder_local_reply_append_string16(reply, TEST_REQ_PARAM_STR));
+
+ /* Prepare incoming request */
+ gbinder_local_request_init_writer(req, &writer);
+ prot->write_rpc_header(&writer, "test");
+ gbinder_writer_append_string8(&writer, "message");
+
+ test_binder_br_transaction(fd, obj, 2,
+ gbinder_local_request_data(req)->bytes);
+ test_binder_br_noop(fd);
+ test_binder_br_transaction_complete(fd);
+ test_binder_br_noop(fd);
+ test_binder_br_reply(fd, handle, code,
+ gbinder_local_reply_data(reply)->bytes);
+
+ /* NB. Reusing test_transact_ok_done and test_transact_ok_destroy */
+ g_assert(gbinder_ipc_transact(ipc, handle, code, 0, req,
+ test_transact_ok_done, test_transact_ok_destroy, loop));
+
+ test_run(&test_opt, loop);
+
+ /* Now we need to wait until GBinderIpc is destroyed */
+ GDEBUG("waiting for GBinderIpc to get destroyed");
+ g_object_weak_ref(G_OBJECT(ipc), test_quit_when_destroyed, loop);
+ gbinder_local_object_unref(obj);
+ gbinder_local_request_unref(req);
+ gbinder_local_request_unref(incoming_req);
+ gbinder_local_reply_unref(reply);
+ g_idle_add(test_unref_ipc, ipc);
+ test_run(&test_opt, loop);
+
+ gbinder_ipc_exit();
+ g_main_loop_unref(loop);
+}
+
+/*==========================================================================*
* transact_incoming
*==========================================================================*/
@@ -724,16 +812,21 @@
GMainLoop* loop = g_main_loop_new(NULL, FALSE);
GBinderLocalObject* obj = gbinder_local_object_new
(ipc, ifaces, test_transact_incoming_proc, loop);
+ GBinderLocalRequest* ping = gbinder_local_request_new(io, NULL);
GBinderLocalRequest* req = gbinder_local_request_new(io, NULL);
- GBinderOutputData* data;
GBinderWriter writer;
+ gbinder_local_request_init_writer(ping, &writer);
+ prot->write_ping(&writer);
+
gbinder_local_request_init_writer(req, &writer);
prot->write_rpc_header(&writer, "test");
gbinder_writer_append_string8(&writer, "message");
- data = gbinder_local_request_data(req);
- test_binder_br_transaction(fd, obj, 1, data->bytes);
+ test_binder_br_transaction(fd, obj, prot->ping_tx,
+ gbinder_local_request_data(ping)->bytes);
+ test_binder_br_transaction(fd, obj, 1,
+ gbinder_local_request_data(req)->bytes);
test_binder_set_looper_enabled(fd, TRUE);
test_run(&test_opt, loop);
@@ -741,6 +834,7 @@
GDEBUG("waiting for GBinderIpc to get destroyed");
g_object_weak_ref(G_OBJECT(ipc), test_quit_when_destroyed, loop);
gbinder_local_object_unref(obj);
+ gbinder_local_request_unref(ping);
gbinder_local_request_unref(req);
g_idle_add(test_unref_ipc, ipc);
test_run(&test_opt, loop);
@@ -1097,6 +1191,7 @@
g_test_add_func(TEST_("transact_custom3"), test_transact_custom3);
g_test_add_func(TEST_("transact_cancel"), test_transact_cancel);
g_test_add_func(TEST_("transact_cancel2"), test_transact_cancel2);
+ g_test_add_func(TEST_("transact_2way"), test_transact_2way);
g_test_add_func(TEST_("transact_incoming"), test_transact_incoming);
g_test_add_func(TEST_("transact_status_reply"), test_transact_status_reply);
g_test_add_func(TEST_("transact_async"), test_transact_async);
|
[-]
[+]
|
Changed |
_service:tar_git:libgbinder-1.0.46.tar.bz2/unit/unit_local_reply/unit_local_reply.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2018-2019 Jolla Ltd.
- * Copyright (C) 2018-2019 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2018-2020 Jolla Ltd.
+ * Copyright (C) 2018-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -14,8 +14,8 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the names of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -357,10 +357,10 @@
gbinder_local_reply_append_hidl_string(reply, NULL);
data = gbinder_local_reply_data(reply);
offsets = gbinder_output_data_offsets(data);
- g_assert(offsets->count == 1);
+ g_assert(offsets->count == 2);
g_assert(offsets->data[0] == 0);
g_assert(gbinder_output_data_buffers_size(data)==sizeof(GBinderHidlString));
- g_assert(data->bytes->len == BUFFER_OBJECT_SIZE_32);
+ g_assert(data->bytes->len == 2*BUFFER_OBJECT_SIZE_32);
gbinder_local_reply_unref(reply);
}
@@ -380,10 +380,10 @@
gbinder_local_reply_append_hidl_string_vec(reply, NULL, 0);
data = gbinder_local_reply_data(reply);
offsets = gbinder_output_data_offsets(data);
- g_assert(offsets->count == 1);
+ g_assert(offsets->count == 2);
g_assert(offsets->data[0] == 0);
g_assert(gbinder_output_data_buffers_size(data) == sizeof(GBinderHidlVec));
- g_assert(data->bytes->len == BUFFER_OBJECT_SIZE_32);
+ g_assert(data->bytes->len == 2*BUFFER_OBJECT_SIZE_32);
gbinder_local_reply_unref(reply);
}
|
[-]
[+]
|
Changed |
_service:tar_git:libgbinder-1.0.46.tar.bz2/unit/unit_local_request/unit_local_request.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2018-2019 Jolla Ltd.
- * Copyright (C) 2018-2019 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2018-2020 Jolla Ltd.
+ * Copyright (C) 2018-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -14,8 +14,8 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the names of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -385,10 +385,10 @@
gbinder_local_request_append_hidl_string(req, NULL);
data = gbinder_local_request_data(req);
offsets = gbinder_output_data_offsets(data);
- g_assert(offsets->count == 1);
+ g_assert(offsets->count == 2);
g_assert(offsets->data[0] == 0);
g_assert(gbinder_output_data_buffers_size(data)==sizeof(GBinderHidlString));
- g_assert(data->bytes->len == BUFFER_OBJECT_SIZE_32);
+ g_assert(data->bytes->len == 2*BUFFER_OBJECT_SIZE_32);
gbinder_local_request_unref(req);
}
@@ -408,10 +408,10 @@
gbinder_local_request_append_hidl_string_vec(req, NULL, 0);
data = gbinder_local_request_data(req);
offsets = gbinder_output_data_offsets(data);
- g_assert(offsets->count == 1);
+ g_assert(offsets->count == 2);
g_assert(offsets->data[0] == 0);
g_assert(gbinder_output_data_buffers_size(data) == sizeof(GBinderHidlVec));
- g_assert(data->bytes->len == BUFFER_OBJECT_SIZE_32);
+ g_assert(data->bytes->len == 2*BUFFER_OBJECT_SIZE_32);
gbinder_local_request_unref(req);
}
|
[-]
[+]
|
Added |
_service:tar_git:libgbinder-1.0.46.tar.bz2/unit/unit_log/Makefile
^
|
@@ -0,0 +1,5 @@
+# -*- Mode: makefile-gmake -*-
+
+EXE = unit_log
+
+include ../common/Makefile
|
[-]
[+]
|
Added |
_service:tar_git:libgbinder-1.0.46.tar.bz2/unit/unit_log/unit_log.c
^
|
@@ -0,0 +1,146 @@
+/*
+ * Copyright (C) 2020 Jolla Ltd.
+ * Copyright (C) 2020 Slava Monich <slava.monich@jolla.com>
+ *
+ * You may use this file under the terms of BSD license as follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "test_binder.h"
+
+#include "gbinder_log.h"
+
+#include <stdlib.h>
+
+static TestOpt test_opt;
+
+static const char env[] = "GBINDER_DEFAULT_LOG_LEVEL";
+
+/*==========================================================================*
+ * empty
+ *==========================================================================*/
+
+static
+void
+test_empty(
+ void)
+{
+ const int level = GLOG_MODULE_NAME.level;
+ unsetenv(env);
+ gbinder_log_init();
+ g_assert_cmpint(level, == ,GLOG_MODULE_NAME.level);
+}
+
+/*==========================================================================*
+ * invalid
+ *==========================================================================*/
+
+static
+void
+test_invalid(
+ void)
+{
+ const int level = GLOG_MODULE_NAME.level;
+
+ setenv(env, "-2" /* GLOG_LEVEL_ALWAYS */, TRUE);
+ gbinder_log_init();
+ g_assert_cmpint(level, == ,GLOG_MODULE_NAME.level);
+
+ setenv(env, "6" /* GLOG_LEVEL_VERBOSE + 1 */, TRUE);
+ gbinder_log_init();
+ g_assert_cmpint(level, == ,GLOG_MODULE_NAME.level);
+
+ setenv(env, "foo", TRUE);
+ gbinder_log_init();
+ g_assert_cmpint(level, == ,GLOG_MODULE_NAME.level);
+}
+
+/*==========================================================================*
+ * level
+ *==========================================================================*/
+
+typedef struct test_level_data {
+ const char* test_name;
+ const char* env_value;
+ int level;
+} TestLevelData;
+
+static
+void
+test_level(
+ gconstpointer data)
+{
+ const TestLevelData* test = data;
+
+ GLOG_MODULE_NAME.level = GLOG_LEVEL_ALWAYS;
+ g_assert_cmpint(GLOG_MODULE_NAME.level, != ,test->level);
+ setenv(env, test->env_value, TRUE);
+ gbinder_log_init();
+ g_assert_cmpint(GLOG_MODULE_NAME.level, == ,test->level);
+}
+
+/*==========================================================================*
+ * Common
+ *==========================================================================*/
+
+#define TEST_PREFIX "/log/"
+#define TEST_(t) TEST_PREFIX t
+
+int main(int argc, char* argv[])
+{
+#define TEST_LEVEL_INIT(X,x) \
+ { TEST_(#x), #x, x }
+ static const TestLevelData level_tests[] = {
+ { TEST_("inherit"), "-1", GLOG_LEVEL_INHERIT },
+ { TEST_("none"), "0", GLOG_LEVEL_NONE },
+ { TEST_("err"), "1", GLOG_LEVEL_ERR },
+ { TEST_("warn"), "2", GLOG_LEVEL_WARN },
+ { TEST_("info"), "3", GLOG_LEVEL_INFO },
+ { TEST_("debug"), "4", GLOG_LEVEL_DEBUG },
+ { TEST_("verbose"), "5", GLOG_LEVEL_VERBOSE }
+ };
+
+ guint i;
+
+ g_test_init(&argc, &argv, NULL);
+ g_test_add_func(TEST_("empty"), test_empty);
+ g_test_add_func(TEST_("invalid"), test_invalid);
+ for (i = 0; i < G_N_ELEMENTS(level_tests); i++) {
+ g_test_add_data_func(level_tests[i].test_name, level_tests + i,
+ test_level);
+ }
+ test_init(&test_opt, argc, argv);
+ return g_test_run();
+}
+
+/*
+ * Local Variables:
+ * mode: C
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
|
[-]
[+]
|
Changed |
_service:tar_git:libgbinder-1.0.46.tar.bz2/unit/unit_writer/unit_writer.c
^
|
@@ -1,6 +1,6 @@
/*
- * Copyright (C) 2018-2019 Jolla Ltd.
- * Copyright (C) 2018-2019 Slava Monich <slava.monich@jolla.com>
+ * Copyright (C) 2018-2020 Jolla Ltd.
+ * Copyright (C) 2018-2020 Slava Monich <slava.monich@jolla.com>
*
* You may use this file under the terms of BSD license as follows:
*
@@ -14,8 +14,8 @@
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the names of the copyright holders nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -485,8 +485,6 @@
guint buffers_size;
} TestHidlVecData;
-static guint test_hidl_vec_offsets_0[] =
- { 0 };
static guint test_hidl_vec_offsets_32[] =
{ 0, BUFFER_OBJECT_SIZE_32 };
static guint test_hidl_vec_offsets_64[] =
@@ -494,12 +492,12 @@
static const TestHidlVecData test_hidl_vec_tests[] = {
{ "32/null", &gbinder_io_32, NULL, 0, 0,
- TEST_ARRAY_AND_COUNT(test_hidl_vec_offsets_0), sizeof(GBinderHidlVec) },
+ TEST_ARRAY_AND_COUNT(test_hidl_vec_offsets_32), sizeof(GBinderHidlVec) },
{ "32/2x1", &gbinder_io_32, "xy", 2, 1,
TEST_ARRAY_AND_COUNT(test_hidl_vec_offsets_32),
sizeof(GBinderHidlVec) + 8 /* vec data aligned at 8 bytes boundary */ },
{ "64/null", &gbinder_io_64, NULL, 0, 0,
- TEST_ARRAY_AND_COUNT(test_hidl_vec_offsets_0), sizeof(GBinderHidlVec) },
+ TEST_ARRAY_AND_COUNT(test_hidl_vec_offsets_64), sizeof(GBinderHidlVec) },
{ "64/2x2", &gbinder_io_64, "xxyy", 2, 2,
TEST_ARRAY_AND_COUNT(test_hidl_vec_offsets_64),
sizeof(GBinderHidlVec) + 8 /* vec data aligned at 8 bytes boundary */ }
@@ -544,8 +542,6 @@
guint buffers_size;
} TestHidlStringData;
-static guint test_hidl_string_offsets_0[] =
- { 0 };
static guint test_hidl_string_offsets_32[] =
{ 0, BUFFER_OBJECT_SIZE_32 };
static guint test_hidl_string_offsets_64[] =
@@ -553,13 +549,13 @@
static const TestHidlStringData test_hidl_string_tests[] = {
{ "32/null", &gbinder_io_32, NULL,
- TEST_ARRAY_AND_COUNT(test_hidl_string_offsets_0),
+ TEST_ARRAY_AND_COUNT(test_hidl_string_offsets_32),
sizeof(GBinderHidlString) },
{ "32/xxx", &gbinder_io_32, "xxx",
TEST_ARRAY_AND_COUNT(test_hidl_string_offsets_32),
sizeof(GBinderHidlString) + 8 /* string data aligned at 8 bytes */ },
{ "64/null", &gbinder_io_64, NULL,
- TEST_ARRAY_AND_COUNT(test_hidl_string_offsets_0),
+ TEST_ARRAY_AND_COUNT(test_hidl_string_offsets_64),
sizeof(GBinderHidlString) },
{ "64/xxxxxxx", &gbinder_io_64, "xxxxxxx",
TEST_ARRAY_AND_COUNT(test_hidl_string_offsets_64),
@@ -607,7 +603,7 @@
data = gbinder_local_request_data(req);
offsets = gbinder_output_data_offsets(data);
g_assert(offsets);
- g_assert(offsets->count == 3);
+ g_assert(offsets->count == 4);
g_assert(offsets->data[0] == 0);
g_assert(offsets->data[1] == BUFFER_OBJECT_SIZE_32);
g_assert(offsets->data[2] == 2*BUFFER_OBJECT_SIZE_32);
@@ -634,8 +630,10 @@
static char* test_hidl_string_vec_data_1[] = { "test" };
-static guint test_hidl_string_vec_offsets_empty[] =
- { 0 };
+static guint test_hidl_string_vec_offsets_empty_32[] =
+ { 0, BUFFER_OBJECT_SIZE_32 };
+static guint test_hidl_string_vec_offsets_empty_64[] =
+ { 0, BUFFER_OBJECT_SIZE_64 };
static guint test_hidl_string_vec_offsets_1_32[] =
{ 0, BUFFER_OBJECT_SIZE_32, 2*BUFFER_OBJECT_SIZE_32 };
static guint test_hidl_string_vec_offsets_1_64[] =
@@ -643,14 +641,14 @@
static const TestHidlStringVecData test_hidl_string_vec_tests[] = {
{ "32/null", &gbinder_io_32, NULL, -1,
- TEST_ARRAY_AND_COUNT(test_hidl_string_vec_offsets_empty),
+ TEST_ARRAY_AND_COUNT(test_hidl_string_vec_offsets_empty_32),
sizeof(GBinderHidlVec) },
{ "32/1", &gbinder_io_32,
(const char**)TEST_ARRAY_AND_COUNT(test_hidl_string_vec_data_1),
TEST_ARRAY_AND_COUNT(test_hidl_string_vec_offsets_1_32),
sizeof(GBinderHidlVec) + sizeof(GBinderHidlString) + 8 },
{ "64/null", &gbinder_io_64, NULL, -1,
- TEST_ARRAY_AND_COUNT(test_hidl_string_vec_offsets_empty),
+ TEST_ARRAY_AND_COUNT(test_hidl_string_vec_offsets_empty_64),
sizeof(GBinderHidlVec) },
{ "64/1", &gbinder_io_64,
(const char**)TEST_ARRAY_AND_COUNT(test_hidl_string_vec_data_1),
|