summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2019-04-16afb-migration-to-binding-v3: fix broken linksClément Bénier1-3/+3
- fix broken link to the same section Change-Id: I5e104c5527fae29ff51b6208f43ed0eb3c5f8c04 Signed-off-by: Clément Bénier <clement.benier@iot.bzh>
2019-04-12Fix small issuesJose Bollo3-3/+6
These issues was discovered by static analysis tool. Change-Id: Iea75151c9b1f5e4cb139d2dc4e8a5c8bae5bb303 Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2019-04-12coverage: Update MakefileJosé Bollo1-1/+7
Add new definitions according to new compile flags. Change-Id: I49f19c8bb4dc2a5a142c03e2e415eaa725d4c0af Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-04-12Reordering of sample and tutorial bindingsJosé Bollo16-81/+40
The main idea here is to install the sample and tutorial bindings in specific directory. This will at the end help to package parts of the binder. It also includes a simplification of CMakeLists files. Also fix an error in packaging rpm. Bug-AGL: SPEC-2165 Change-Id: I494cc753796848cde849de1c3596893c78fa228f Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-04-09Fix rpm packaging following review 20926Frederic Marec1-1/+1
Change-Id: Iec9de4201e966ef53e3f1edf9d0a6a81ae2899fc Signed-off-by: Frederic Marec <frederic.marec@iot.bzh>
2019-04-05Change agl-app-framework-binder.shFrederic Marec3-9/+9
Aligned the two different names from the two ways of packaging From AGL-agl-app-framework-binder.sh to agl-app-framework-binder.sh for .rpm From AGL-app-framework-binder.sh to agl-app-framework-binder.sh for .deb Change-Id: Ie324ce159a55ccae7c051c97be5116d975e0da85 Signed-off-by: Frederic Marec <frederic.marec@iot.bzh>
2019-04-04afb-export: Fix heap corruptionJosé Bollo1-1/+1
The allocated size wasn't correct when 'path' was used. The effect be unseen depending on size and alignment of heap chunks. Change-Id: Id9f85a0078028319491b51bc3e11cd51e4bc3755 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-04-02Fix false ***buffer overflow*** detectionJosé Bollo12-29/+29
The compiling option __FORTIFY_SOURCE=2 introduced a false ***buffer overflow*** detection when the flexible array 'pattern' was initilized in globset. The compiler is only complaining when the array is in a struct that is in a struct like struct { ...; struct { ...; char name[1]; }} To avoid these false detections, it is enougth to ellipsese the dimension of the array. Seems to be the now standard way of declaring flexible arrays when it was before an extension. So now: struct { ...; struct { ...; char name[]; }} works even when __FORTIFY_SOURCE=2. Bug-AGL: SPEC-2292 Change-Id: I4b4a5df505a5357f92b9ab1657175911198ca582 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-04-02Add conditionnal support of dynamic bindingsJose Bollo17-24/+63
The load of dynamic bindings becomes removable. This is a step in direction of a tiny binder library. Also refactor AGL_DEVEL Signed-off-by: Jose Bollo <jose.bollo@iot.bzh> Change-Id: If283f431fd8a831429e717b2770464cb54476dc7
2019-04-02Add conditionnal support of bindings version 2Jose Bollo13-81/+185
Bindings version 2 will become legacy soon. This patch allows their removal Change-Id: Iecad3abd0ddd714e5d55c0b935be756a29d1ca37 Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2019-04-02Improve setting of optionsJose Bollo15-91/+109
Change-Id: Idbadb9b7b801cb61d527addb5d3137aeb4cf6311 Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2019-04-02jobs: Refactor exiting jobsJosé Bollo3-74/+63
The new termination function can allow the restart because it doesn't abort the waiting jobs. So after calling 'jobs_exit', all threads stop. The function 'job_start' returns. The threads that are in blocking state, i.e. in a call to 'jobs_enter' or 'jobs_call' are stopped. An error status -1 with errno=EINTR is returned in that case. But before returning, that function calls the exit handler if any. Change-Id: I85a4b1976b09b18804eb681af940531ae5ace6c3 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-04-02Workaround an exit issueJosé Bollo2-1/+8
When running gcov the running script is sometime blocking. GDB tells: Thread 1 (Thread 0x7ff14e783b40 (LWP 1318)): #0 0x00007ff14ccf334c in __lll_lock_wait_private () from /lib64/libc.so.6 #1 0x00007ff14cc70598 in malloc () from /lib64/libc.so.6 #2 0x000000000046523a in gcov_do_dump () #3 0x00000000004653f4 in __gcov_exit () #4 0x00000000004632df in _GLOBAL__sub_D_00100_1_wrap_json_get_error_position () at ../../src/wrap-json.c:1250 #5 0x00007ff14e5b5916 in _dl_fini () from /lib64/ld-linux-x86-64.so.2 #6 0x00007ff14cc255ec in __run_exit_handlers () from /lib64/libc.so.6 #7 0x00007ff14cc2571c in exit () from /lib64/libc.so.6 #8 0x00000000004069fc in on_sigchld (signum=17, info=0x7ffc3f43fa70, uctx=0x7ffc3f43f940) at ../../src/main-afb-daemon.c:411 #9 <signal handler called> #10 0x00007ff14cc6e527 in _int_malloc () from /lib64/libc.so.6 #11 0x00007ff14cc710a2 in calloc () from /lib64/libc.so.6 #12 0x00007ff14d454ff7 in json_object_new_int () from /lib64/libjson-c.so.4 ... It means that allocating memory in exit handlers can block! The work around here is to force the daemon to exit properly, i.e., not in a signal handler, by calling hello/exit from test script -at the very end-. Change-Id: Iee289fb1af8479628df895aac7eb021cedda4f2c Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-04-02evmgr: Fix a "maybe uninitialized" issueJosé Bollo2-5/+6
The warning maybe-uninitialized is emited only when the optimisation level is greater than 0. For this reason, the error was not discovered development process. The build config is tuned to detect that error and the error is fixed. Change-Id: I14c8ffe6daa3d498268cfadeab20300895b3360e Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-03-29Rename afb-config to afb-argsJosé Bollo8-32/+22
With the introduction of more compilation flags, it becomes interesting to use a configuration file. The configuration file is usually "config.h". So that renaming avoids future ambiguity. It also reflects better what the module does. Change-Id: I952adc1e1bf469132dc224900bd9140ccc51c58b Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-03-29hooks: Allow to remove hooking (and/or trace)Jose Bollo26-400/+620
This change allows to downsize the binder by removing its internal hooking and tracing features. Change-Id: Ifb080a7426216f6c6b1c8f8e5bf8ddd52df40a3e Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2019-03-29sig-monitor: Add compiling switchesJosé Bollo3-84/+206
The following new switches are added: - USE_SIG_MONITOR_DUMPSTACK activate dump stack on error - USE_SIG_MONITOR_SIGNALS activate handling of signals - USE_SIG_MONITOR_FOR_CALL activate monitoring of calls - USE_SIG_MONITOR_TIMERS activate monitoring of call expiration All enabled by default Change-Id: I2231e5f2a8db469b7258ce14530f72b4c5f38b00 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-03-29afb-args: Use secure_getenvJosé Bollo1-3/+3
Improves security of the binder by using secure_getenv instead of getenv. Change-Id: Iffd56ca65251763aacb0b9dbbaa768619cd92dd4 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-03-27evmgr: Isolate the event loop from jobsJosé Bollo4-152/+281
The event loop is renamed evmgr for "event manager" with the intention (1) still use evloop in jobs (2) to provide an abstract event manager/handler/loop abstraction. Change-Id: Ib1955f661f98df80e1c7be99e9fe26a1e06d78f6 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-03-27system & jobs: Reverse link and acquiring eventsJosé Bollo7-39/+81
- The new version of 'systemd_get_event_loop' dont depends anymore on jobs but returns a unique systemd event loop for any threads. - The event loop of jobs now use system.h function instead of the opposite. - The function 'jobs_get_sd_event' is removed - The function 'jobs_acquire_event_manager' is introduced. It is designed to that the current thread can manipulate the single event manager Change-Id: I31fe48dfe0f2cfa4d468e49338d36fea6e7e8081 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-03-27Rename afb-systemd to systemdJosé Bollo9-34/+36
Files "afb-systemd.[ch]" are renamed "systemd.[ch]" and their functions "afb_systemd_*" are renamed "systemd_*" Change-Id: I8362a2ca8b71945b54c6ab9a7ead51d9c50bc8e2 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-03-27watchdog: Isolate the watchdog from jobsJosé Bollo6-15/+88
Change-Id: Iaa7f71dc7e5d8d525463619b4da980c827722909 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-03-27jobs: Clean unneeded codeJosé Bollo1-2/+0
Minor cleanup Change-Id: Iddcaf85cdc30f74e54016ce300380b33662fbc04 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-03-27coverage: Allow removal of valgrindJosé Bollo2-1/+17
It can be usefull for debugging with gdb to avoid the use of valgrind in the test. This can be done by setting the environment NOVALGRIND to any not empty value. Also add more temporary files to ignore. Change-Id: I853eb566607aa7ec87c356ee3acd9b1fa658b659 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-03-25Prevent false positive during check sourceFrederic Marec1-1/+1
At runtime CFLAG _FORTIFY_SOURCE can provide false positive during its checking. Change _FORTIFY_SOURCE level to 1 to avoid wrong comportement of the package. Change-Id: Ice4b386c253c87903e58f82a446416831cb4c6bf Signed-off-by: Frederic Marec <frederic.marec@iot.bzh>
2019-03-22jobs: Ensure validy of event loopFrederic Marec1-0/+3
In rare circumstances during intialization threads should wait instead of using a null event loop. This is because no one has needed event loop at this stage of initialization. Change-Id: I05b6ddbc05bec50958d0981213219b1d641401a5 Signed-off-by: Frederic Marec <frederic.marec@iot.bzh>
2019-03-12json2c: Fix a fatal warningJosé Bollo1-3/+3
At the end, the case is never reached because json_object_to_json_string_ext only produces valid JSON strings and a string terminated by '\' isn't a valid JSON string. Change-Id: I58a6dc4d9c014487ff2dc85f7eb3dbf33ffea6b1 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-03-11c++: Add tutorial tuto-5 for C++ class base_api_tLoïc Collignon2-0/+94
Added the tuto-5 that show how to benefit from the new 'binding-object' header and its new class 'base_api_t'. Change-Id: I81e6fd8dc5899b8e93d75530d902c0e12fba72a9 Signed-off-by: Loïc Collignon <loic.collignon@iot.bzh>
2019-03-11c++: Inherit of class afb::apiLoïc Collignon1-12/+9
Base the class afb::base_api_t on the raw wrapper class afb::api Change-Id: Idbc4786d548ffcb0062a85b686c196758e49823c Signed-off-by: Loïc Collignon <loic.collignon@iot.bzh>
2019-03-11c++: Add the wrapper class 'afb::api'Loïc Collignon1-1/+155
New 'api' wrapper for 'afb_api_t' related functions. Change-Id: I695b65ff3d27b0ecc0f95f660a13b7a98fd92223 Signed-off-by: Loïc Collignon <loic.collignon@iot.bzh>
2019-03-11c++: Reworked the event classLoïc Collignon1-8/+11
Added move semantic and remove invalidation method as it's not used anymore since we drop the support of APIv2. Change-Id: If53840010d6f24d410712915051386190f55b504 Signed-off-by: Loïc Collignon <loic.collignon@iot.bzh>
2019-03-11c++: Fix multiple definition and castLoïc Collignon1-6/+3
The function was defined as many time as the header was included. Making it a weak function fix the issue. Also, a plain old C cast is required to make this constexpr valid. Change-Id: I278f376e00ec6728272df4fde8ca8984195dd533 Signed-off-by: Loïc Collignon <loic.collignon@iot.bzh>
2019-03-11c++: Add verb initialisation for C++Jose Bollo2-6/+37
This new constexpr initialisation method accepts a callback receiving a afb::req instead of a afb_req_t. Change-Id: I752e670b5545a9d7956987984e725b468196a6e9 Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2019-03-11c++: Fix a wrong callback versionLoïc Collignon1-1/+1
It used the legacy callback definition of apiv2 instead of the apiv3 one. Change-Id: Iab281131a923ae59cfbbb50cf72fd4a5c3f11d65 Signed-off-by: Loïc Collignon <loic.collignon@iot.bzh>
2019-03-11c++: Drop support of binding APIv2Loïc Collignon1-87/+3
The C++ interface is currently used only in APIv3. Change-Id: Id1a3bca5dc8e69c1af229871e7f33192395230e7 Signed-off-by: Loïc Collignon <loic.collignon@iot.bzh>
2019-03-11c++: Avoid relative path when including headersLoïc Collignon4-7/+8
Prefer the system path to include headers. Change-Id: I08a64e8d27808084ea4592988f36b7e5099a7fc6 Signed-off-by: Loïc Collignon <loic.collignon@iot.bzh>
2019-03-11c++: New C++ API for bindingsLoïc Collignon4-1/+344
You can implement a C++ binding API by inheriting the templated base class 'base_api_t' and overriding the methods you want. At the same time, the c++ files are now located in in their own subdirectory: afb/c++ Change-Id: Ie02535961ec6b4b5ae21390cb520acb1fdc44c9e Signed-off-by: Loïc Collignon <loic.collignon@iot.bzh>
2019-03-07afb-stub-ws: Allow unordered process of messagesJosé Bollo1-1/+1
Requests are already sequenced on need (noconcurrency flag of bindings). Sequencing messages until their completion has a side effect when dealing with events and synchronous calls: event -> call -> reply locked until event completion (see SPEC-2219). This change could be reverted if events are converted to jobs (see SPEC-2215). Bug-AGL: SPEC-2219 Change-Id: Ia577bc54ba38291817fd5ed3e3dda1b67b2818b7 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-03-07Fix build dep on OBSronan1-0/+6
Change-Id: I95fa03c430b9f488b3b5b9a9bdfc50a1ff0f0421 Signed-off-by: ronan <ronan.lemartret@iot.bzh>
2019-03-07Upgrade dependency to libmicrohttpd version 0.9.60José Bollo4-5/+5
The version of libmicrohttpd required is 0.9.60 at least. Change-Id: Ia0784f5433d63d4de50654dd7577a8767578c069 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-02-08stress: Improve the stress test scriptsJosé Bollo2-69/+109
The improvement was able to track the bug SPEC-2163 by launching: - ./stress-server.sh --ws --valgrind - ./stress-clients.sh --null --count 20 Bug-AGL: SPEC-2163 Change-Id: I04634f0e98ab7a28df7c1d34ecc0d9c1faf43d57 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-02-08afb-stub-ws: Fix concurrent memory issuesJosé Bollo1-3/+4
This changes takes care to increment the the count of reference before using it. Bug-AGL: SPEC-2163 Change-Id: Ia7882427eeae933eeb5030aad025ebb1da129d6f Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-02-06Update copyright datehalibut_7.90.0halibut/7.90.07.90.0José Bollo188-190/+190
Change-Id: I3aaa92b2bfb01699ee8ae609272e93032b6f1a9d Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-02-06Set next version of binderJosé Bollo1-1/+1
Change-Id: I53c43380902f96b7a46a6a131a956965d7cf6fbc Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-02-06jobs: Ensure releasing event loopJose Bollo3-1/+32
The internal functions blocking threads for implementing call_sync were not releasing the event loop, leading to deafness of the binder. Include a tuto-4 that reproduce the issue on a binder with the bug and that also shows interesting usages of the binder. Bug-AGL: SPEC-2161 Change-Id: I83ad4d55d721a6046e798a5e06967df4dd5a7284 Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2019-01-18Merge changes from topic 'spec-2089'guppy_6.99.4guppy/6.99.46.99.4Jan-Simon Moeller10-298/+264
* changes: hello3: Fix warning unused variable afb-hsrv: Avoid call to getnameinfo jobs: Remove conditionnal REMOVE_SYSTEMD_EVENT jobs: Separate internal threads from others jobs: Refactor event loop handling afb-proto-ws: Serialize incoming message
2019-01-18hello3: Fix warning unused variableJose Bollo1-1/+0
The variable 'calling' was not used anymore. Change-Id: I3a041cee57b2682374084003415d13a77a554fba Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2019-01-18afb-hsrv: Avoid call to getnameinfoJosé Bollo1-6/+12
Calling getnameinfo may block the program a long time (5s) when address is zero. Bug-AGL: SPEC-2133 Change-Id: Id52b2989c5e996363fd4b6f39049f059a6ee97a2 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-01-16jobs: Remove conditionnal REMOVE_SYSTEMD_EVENTJose Bollo3-128/+0
The removal of the systemd event loop will be made in later changes. Change-Id: Ia6c52feb4969f360c31cbfc50ae991f1767f007d Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2019-01-16jobs: Separate internal threads from othersJosé Bollo1-61/+92
Foreign threads, that are not started by jobs, are allowed to use synchronous jobs_call/job_leave (directly or indirectly). This commit ensure that those foreign thread will neither acquire the eventloop nor execute jobs. Includes a tiny cleanup of remain usage. Bug-AGL: SPEC-2089 Change-Id: I2ad7fcfe2c276e34bdc4ec0c2aa3a4207bea1854 Signed-off-by: José Bollo <jose.bollo@iot.bzh>