summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2019-07-29Fix detection of error in call synchronousJose Bollo1-1/+1
There fixes a bug with an inversion between info and error in implementation of synchronous calls, leading to bad detection of errors. Bug-AGL: SPEC-2697 Change-Id: I30a8cd9c45a91b442f6c501dd3b0c32cd3ea632d Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2019-07-23supervisor: Setup services for local API useJosé Bollo5-64/+42
The supervisor only allowed external accesses. This was wrong, it must also allow local access through standard API. This commit fix it. Bug-AGL: SPEC-2660 Signed-off-by: José Bollo <jose.bollo@iot.bzh> Change-Id: Ifa1119a6b2f22c87b1dbe087206d9f51c4005a57
2019-07-23AFB.js: Improve default token discoveryJosé Bollo1-1/+1
The example script AFB.js should look int the URLs of the page if the token is set or not and then use it. Bug-AGL: SPEC-2661 Signed-off-by: Jose Bollo <jose.bollo@iot.bzh> Change-Id: I4adba8eac214130b425b6cd3c56fc1dc63543011
2019-07-23afb-binding.h: Ensure json-c/json.h is sourcedJose Bollo1-1/+1
This is needed if we want to replace json-c with jsonfast. Bug-AGL: SPEC-2659 Signed-off-by: Jose Bollo <jose.bollo@iot.bzh> Change-Id: I32da71bd05bfe3538596cbf751d55ff45b4fe7f9
2019-07-23afb-xreq: Remove field 'listener'Jose Bollo3-6/+18
This simplifies the flow that now has only one case: the callbacks subscribe/unsubscribe of struct afb_xreq_query_itf. Bug-AGL: SPEC-2658 Signed-off-by: Jose Bollo <jose.bollo@iot.bzh> Change-Id: Ia49f3ce7aaa4d8603014fe163f311eadfcbf68e4
2019-07-18Fix bad memory access at client disconnectionJosé Bollo4-13/+12
The management of structures handling a client connection to a exported --ws-server was accessing freed memory. Tha commit fixes that issue. Bug-AGL: SPEC-2651 Change-Id: I511218afc907308347bc422a8aead32ca00bdae6 Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2019-07-18Tag broadcasted events with UUID and hopJosé Bollo10-39/+139
When API have mutual dependencies, leading to loops in dependecies, broadcasting an event never ends because of the loop (see SPEC-2625). To avoid that weird flood of events, a unic identifier (UUID) is attached to broadcasted event and a tiny memory records previously broadcasted events to avoid re-sending an already sent event. The size of the memory can be set using the macro variable EVENT_BROADCAST_MEMORY_COUNT whose default value is 8. It can be reduced to 0. An other mecanism is added to limit the count of hops that a broadcasted event can do. That count can be set using the macro variable EVENT_BROADCAST_HOP_MAX whose default value is 10. Bug-AGL: SPEC-2625 Change-Id: I29550a8a5c8f5e2ffb20edc3330357a1e870c0e2 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-07-18afb-evt: Refactor processing of broadcasted eventsJosé Bollo6-87/+68
Solving the bug SPEC-2625 needs to rework the broadcasting of events. It appeared that the numerical event identifier passed for broadcast wasn't used by called function except for hooking. Suppressing it introduces a clear distinction between the push and the broadcast paths. The file afb-ws-json1 is changed to avoid casting of functions. Bug-AGL: SPEC-2625 Change-Id: I9fe75adc8086812b21b70ce28baffcf77bd5e1cf Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-07-18uuid: Add module for UUID generationJosé Bollo4-70/+125
This commit allow modules of afb-daemon to request UUID. This introduce an abstraction above libuuid for 3 reasons: 1. Using uuid had bad side effect inthe past because it required enought entropy at start time, leading to hanging initialisations in wait for enough entropy. 2. Solving bug SPEC-2625 will require use of UUID. 3. Porting to systems that haven't libuuid is made more easy after that. Bug-AGL: SPEC-2625 Change-Id: I27d8b611946686dea6fab250697afe9b89aac869 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-07-12afb-client-demo: Allow pipe of messageshalibut_7.99.3halibut/7.99.37.99.3Jose Bollo1-17/+25
The tool afb-client-demo implements a synchronous mode (option -s) that allows to wait for a reply before to send the next request. It is interesting for the purpose of testing to allow afb-client-demo it to send a controlled count of requests, ensuring that there is a controlled count of pending requests. Bug-AGL: SPEC-2638 Signed-off-by: Jose Bollo <jose.bollo@iot.bzh> Change-Id: Ic854d68aaeb82c17b4640c5c9de46181ad3a7e5e
2019-07-12afb-xreq: Forbids (un)subscribes after replyJose Bollo4-12/+32
Allowing to subscribe to a request that was replied was possible and lead to problem revealed by issues SPEC-2542 and SPEC-2599 (these issues are more related to processing unordered incoming messages). The choice was - fix the bug and authorize (un)subscribe after reply - forbids to (un)subscribe after reply Second solution was chosen for its simplicity and its networking efficiency. Bug-AGL: SPEC-2542 Bug-AGL: SPEC-2599 Change-Id: I09f48b760b1fd6f70d42b80df3c8053696c45966 Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2019-07-12Revert "afb-stub-ws: Allow unordered process of messages"José Bollo1-1/+1
This reverts commit 5425e054fbf87fe6d024103f46e53f2a28e074f2. The change introduced in the reverted commit is no more necessary since events are sent asynchronousely. Bug-AGL: SPEC-2215 Bug-AGL: SPEC-2219 Bug-AGL: SPEC-2542 Bug-AGL: SPEC-2599 Signed-off-by: Jose Bollo <jose.bollo@iot.bzh> Change-Id: I4fd8d1516c97e2f95caaa244e28491f71b15bba7
2019-07-12afb-evt: send events in separate jobJose Bollo7-49/+240
Sending events in the context of the calling process had the consequence that the ordering of the messages had to be removed (see SPEC-2215 & SPEC-2219). This was not good by nature and lead to issues SPEC-2542 and SPEC-2599. Sending events in the context of the calling process also implies to delay the calling process. For this reasons, sending events is now done in an other jobs. For that reason, the count of allowed pending jobs is increased to 100 (was 50). Bug-AGL: SPEC-2215 Bug-AGL: SPEC-2219 Bug-AGL: SPEC-2542 Bug-AGL: SPEC-2599 Change-Id: I5b56d952cc187b65ad6eb9344ad74e5e8d3b7540 Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2019-07-12afb-evt: Improve compatibility to guppyJosé Bollo1-89/+99
The commit "a2cf84e: hooks: Allow to remove hooking" re-order fragment of code. But this is an issue when backporting changes to guppy. That commit improve the situation for the file afb-evt.c in the process of fixing the issue SPEC-2599 Bug-AGL: SPEC-2599 Signed-off-by: José Bollo <jose.bollo@iot.bzh> Change-Id: I4e56cbeee7d3a89770e37a3045f652f39fc07410
2019-07-09afb-args: Fix output of --versionJosé Bollo1-13/+5
The legacy V1 and V2 versions of bindings are no more printed if absent. The support of dynamic bindings is fixed. Bug-AGL: SPEC-2617 Signed-off-by: José Bollo <jose.bollo@iot.bzh> Change-Id: I429c0e2cdfcbfba6e0f1e639dbcbc2ca90a345ed
2019-07-09Fix syntax error in a constexpr functionLoïc Collignon1-25/+7
The function declaration contains a syntax error that was somehow ignored but raise an error about an illegal cast in a constexpr function. Fixed this error and clean up a bit surrounding code to be more concise. Bug-AGL: SPEC-2615 Change-Id: I931b086c96b093b3de4465c51dfc3e865f7ece3b Signed-off-by: Loïc Collignon <loic.collignon@iot.bzh>
2019-07-09Fix invalid TRACE setting in print versionSebastien Douheret1-1/+1
Bug-AGL: SPEC-2617 Change-Id: Ia935aab3b0b508e7a916e334237c639efb1feb15 Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
2019-07-01Fix warning when compiling with clangLoïc Collignon1-1/+5
The 'maybe-uninitialized' warning option is a GCC's only flag. The equivalent one for Clang is 'possible-uninitialized'. Added the right flag based on the compiler. Bug-AGL: SPEC-2584 Change-Id: I09ce434dfda21996cefbf0b527b43d666a042e0e Signed-off-by: Loïc Collignon <loic.collignon@iot.bzh>
2019-06-04Build af-binder-devtools-native using GCC-9.1.1halibut_7.99.2halibut/7.99.27.99.2Bechir Mghirbi1-1/+2
GCC-9.1.1 complains about variable ‘buf[0]’ that it may be used uninitialized in the function 'make_info()'. This patchset initialize the variable. Bug-AGL: SPEC-2482 Signed-off-by: Bechir Mghirbi <bechir.mghirbi@grammer.com> Change-Id: I38d0c6f47fed462f4ea48990c4cb63f21fb2ee16
2019-05-29afb-daemon: Add /tmp has fallback for uploadshalibut_7.99.1halibut/7.99.17.99.1José Bollo1-2/+6
During its start, when implementing HTTP server, afb-daemon checked that the upload directory was accessible and writable and afb-daemon refused to start when it was not the case. When trying to use systemd's DynamicUser for platform services, it had the effect to forbid service to run. That commit add the directory /tmp as a fallback upload directory. Bug-AGL: SPEC-2446 Signed-off-by: José Bollo <jose.bollo@iot.bzh> Change-Id: Ib4ee456d71cb1aefa19e8eed6774ef5f77919366
2019-05-29jobs: Fix infinite wait lockJosé Bollo3-0/+10
The binder was sometime locked until an external event comes. This was discovered during stressing startup test that don't expect external inputs and that then waits for always without terminating. The issue came from a little hole in the management of the state of evmgr object. By design the evmgr has to be synchronised against concurrent accesses not by itself but by the integration. However, the state of "running" wasn't set in the code protected against concurent accesses. The new function allows the integrator to correctly set the state before releasing protection. Bug-AGL: SPEC-2459 Signed-off-by: José Bollo <jose.bollo@iot.bzh> Change-Id: Id75fd97c06d69666ced912a0a61380573dab31af
2019-05-09Fix afb document typo.Li Xiaoming2-38/+38
Bug-AGL: SPEC-2391 Change-Id: I73efab27d09fce7ca16edabe14fe19d1092162db Signed-off-by: Li Xiaoming <lixm.fnst@cn.fujitsu.com>
2019-05-03afb-export: Fix requirement on multiple apisJosé Bollo8-28/+109
The test 'test-apiv3' was failing because the required api list "albert armel" wasn't splitted but set as-is. At the same time, test suite is improved. Bug-AGL: SPEC-1130 Bug-AGL: SPEC-2377 Change-Id: Ia4ab23bf666b5b4b1db3e1da2654d9387c2c01e5 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-04-30coverage: Add test of AFB_DEBUG_WAITJosé Bollo1-7/+24
Bug-AGL: SPEC-1130 Change-Id: I349c141015e3851ddecd4a6df7497d8ef4cceaa6 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-04-30coverage: Allow to run coverage everywhereJosé Bollo2-3/+9
Coverage presumed that an available afb-daemon without coverage instrumentation was available in the PATH. This fix that problem by compiling that requirement. Bug-AGL: SPEC-1130 Change-Id: Ic3435d73e830d630bef63dfb8e9b2ff9f1bf043c Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-04-30Allow to tune installation directoriesJosé Bollo7-16/+18
The location of intrinsic bindings and samples could not be tuned but was fixed to be ${CMAKE_INSTALL_FULL_LIBDIR}/afb and ${CMAKE_INSTALL_FULL_DATADIR}/af-binder These default locations are not bad but it is important to be able to tune that location. Bug-AGL: SPEC-2367 Change-Id: I4d4f9e9490d61e3278ef35ac42f2143a752a7c37 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2019-04-25doc: Improve comment on asynchronous callsJose Bollo4-1/+12
Following the remarks of fellow developers, the status of the object received by the callback function needs to be explained better. Change-Id: I0e6bcd51849bbc5af92af08675949a901bfd683e Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2019-04-23binding-wrap: Rework of context handlingJose Bollo2-33/+72
The C++ wrapper for handling contexts has to be improved. This is a proposition of improvement. Change-Id: I7df36383f427d109356bdf4df573cba4b6e6ec05 Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
2019-04-23samples: wrong parameter for get_new_board()Phong Tran1-1/+1
for fixing warning: too many arguments in call to 'get_new_board' Change-Id: I7b3d175310156ea3d2efed29e344f01c9904d534 Signed-off-by: Phong Tran <tranmanphong@gmail.com>
2019-04-23Merge changes Id24d9bb0,I6807ed25José Bollo3-11/+11
* changes: change style initialization of struct afb_auth missing full initialization for struct afb_verb_v3
2019-04-17change style initialization of struct afb_authPhong Tran1-9/+9
This is for fixing warning: suggest braces around initialization of subobject [-Wmissing-braces] Change-Id: Id24d9bb09e46d59df7d043ed931e00bb5ec9469a Signed-off-by: Phong Tran <tranmanphong@gmail.com>
2019-04-17missing full initialization for struct afb_verb_v3Phong Tran2-2/+2
This is for fixing warning: missing field 'callback' initializer [-Wmissing-field-initializers] Change-Id: I6807ed25bff96c96f347ec1e87f1b12cf0759498 Signed-off-by: Phong Tran <tranmanphong@gmail.com>
2019-04-16Merge "afb-migration-to-binding-v3: fix broken links"Jan-Simon Moeller1-3/+3
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>