Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.openwrt.org/project/libubox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2023-11-02uloop: add support for user defined signal handlersJo-Philipp Wich
Reuse and extend the existing signal waker pipe mechanism to add user defined signal handling functionality to uloop. This commit introduces two new api functions `uloop_signal_add()` and `uloop_signal_remove()` along with a new structure type `uloop_signal` to allow adding and removing arbitrary signal handlers. Registered signal handlers are maintained in a linked list and matched by their signo member value which allows registering multiple handlers for the same signal numbers. Upon registering a new signal handler, the existing handler is saved in the `uloop_signal` structure. When removing the user defined signal handler, the original behavior is restored. The Lua binding has been updated as well to support the new signal handler mechanism. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2023-11-02uloop: add support for interval timersJo-Philipp Wich
So far, the only way to implement periodic interval timers was to use one-shot uloop_timeout timers which are rearmed within their completion callback immediately on expiration. While simple, this approach is not very precise and interval lengths will slowly drift over time, due to callback execution overhead, scheduling granularity etc. In order to make uloop provide stable and precise interval timer capabilities, this commit introduces a new `uloop_interval` structure along with the new related `uloop_interval_set()`, `uloop_interval_cancel()` and `uloop_interval_remaining()` api functions. Periodic timers are implemented using the timerfd facility an Linux and kqueue EVFILT_TIMER events on macOS/BSD. The Lua binding has been updated to include support for the new timer type as well. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-07-11examples/lua: attempt to highlight some trapsKarl Palsson
Ran into some issues with my fd event being garbage collected. As I never wanted to call :delete, I had seen no reason to keep the returned object, as my callback and upvalues were still valid. Signed-off-by: Karl Palsson <karlp@etactica.com>
2019-11-24add cram based unit testsPetr Štetiar
For improved QA etc. For the start with initial test cases for avl, base64, jshn and list components. Moved runqueue and blobmsg from examples to tests. Converted just a few first test cases from json-script example into the new cram based unit test, more to come. Signed-off-by: Petr Štetiar <ynezz@true.cz>
2019-11-20iron out all extra compiler warningsPetr Štetiar
gcc-9 on x86/64 has reported following issues: base64.c:173:17: error: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Werror=sign-compare] base64.c:230:18: error: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Werror=sign-compare] base64.c:238:18: error: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Werror=sign-compare] base64.c:242:22: error: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Werror=sign-compare] base64.c:252:18: error: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Werror=sign-compare] base64.c:256:22: error: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Werror=sign-compare] base64.c:266:18: error: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Werror=sign-compare] base64.c:315:27: error: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Werror=sign-compare] base64.c:329:15: error: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Werror=sign-compare] blob.c:207:11: error: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Werror=sign-compare] blob.c:210:11: error: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Werror=sign-compare] blob.c:243:31: error: comparison of integer expressions of different signedness: ‘int’ and ‘unsigned int’ [-Werror=sign-compare] blob.c:246:31: error: comparison of integer expressions of different signedness: ‘int’ and ‘unsigned int’ [-Werror=sign-compare] blob.h:245:37: error: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Werror=sign-compare] blob.h:253:37: error: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Werror=sign-compare] blobmsg.h:269:37: error: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Werror=sign-compare] blobmsg_json.c:155:10: error: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Werror=sign-compare] examples/../blob.h:245:37: error: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Werror=sign-compare] examples/../blobmsg.h:269:37: error: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Werror=sign-compare] json_script.c:590:7: error: this statement may fall through [-Werror=implicit-fallthrough=] Signed-off-by: Petr Štetiar <ynezz@true.cz>
2017-01-04blobmsg: add support for doubleAndré Gaul
This adds support for double floating point type to make it more JSON compatible. For type checking it also adds a stub BLOB_ATTR_DOUBLE type. If necessary, the accessor functions for blob can be added later Signed-off-by: André Gaul <andre@gaul.io> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2016-02-20examples: add shunit2 tests for json_scriptYousong Zhou
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
2016-02-20json_script: add "isdir" supportYousong Zhou
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
2015-06-14libubox: cmake: Add BUILD_EXAMPLES optionNikolay Dimitrov
Add ability to skip building the examples. The default value is ON to follow the original cmake behavior. Signed-off-by: Nikolay Dimitrov <picmaster@mail.bg>
2014-12-22examples: add example code for json_script.Yousong Zhou
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
2014-12-11examples: fix build.Yousong Zhou
- runqueue-example.c: fix include path for in-tree build. - blobmsg-example.c: add inttypes.h for using PRIu64. - add examples/ subdirectory to main CMakeLists.txt Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
2014-12-11lua: do not hardcode /opt/local/include for Apple.Yousong Zhou
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
2014-07-03blobmsg-example: use blobmsg_get_string()Felix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-07-03examples: fix build errorLuka Perkov
Patch fixes the following error: error: format ‘%s’ expects argument of type ‘char *’, but argument 3 has type ‘void *’ [-Werror=format=] indent_printf(indent, "%s\n", blobmsg_data(data)); Signed-off-by: Luka Perkov <luka@openwrt.org>
2014-07-03blobmsg_example: fix outputFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-07-03examples: use PRIu64 instead %lld when printing uint64_t valuesLuka Perkov
Patch fixes build failure: error: format ‘%lld’ expects argument of type ‘long long int’, but argument 3 has type ‘uint64_t’ [-Werror=format=] indent_printf(indent, "%lld\n", *(uint64_t *)data); Signed-off-by: Luka Perkov <luka@openwrt.org>
2014-07-03examples: add missing includeLuka Perkov
Patch fixes following build error: error: implicit declaration of function ‘close’ [-Werror=implicit-function-declaration] close(cl->s.fd.fd); Signed-off-by: Luka Perkov <luka@openwrt.org>
2014-07-03examples: fix linking with json-cLuka Perkov
Signed-off-by: Luka Perkov <luka@openwrt.org>
2014-07-03examples: remove set but unused variableLuka Perkov
Fixes build failure. Signed-off-by: Luka Perkov <luka@openwrt.org>
2014-06-24Support delete a fd event.Xiongfei Guo
When you call the fd_add, it will return an object with `delete` method. So you can delete that event if you want. Signed-off-by: Xiongfei(Alex) Guo <xfguo@credosemi.com>
2014-06-24Added fd_add method for uloop lua binding.Xiongfei Guo
Use uloop.fd_add like this: local socket = require "socket" udp = socket.udp() uloop.fd_add( udp, -- socket function( -- callback function ufd, -- socket object when register the fd events -- uloop events. eg. uloop.ULOOP_READ . ) local words, msg_or_ip, port_or_nil = ufd:receivefrom() print('Recv UDP packet from '..msg_or_ip..':'..port_or_nil..' : '..words) end, uloop.ULOOP_READ -- event you want to listen ) The `examples/uloop-example.lua` show an example of this work. Signed-off-by: Xiongfei(Alex) Guo <xfguo@credosemi.com>
2013-09-11blobmsg-example: fix length handling in dump_table() callsFelix Fietkau
2013-05-09runqueue: move completion handler from runqueue_process to runqueue_task to ↵Felix Fietkau
make it more generic Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-05-09runqueue: add a simple task queueing/completion tracking implementationFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-05-09ustream-example: fix container_of type errorsFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2012-10-23ustream-example: fix logic inversionFelix Fietkau
2012-10-22add a cmake file for the examples and add the binaries to .gitignoreFelix Fietkau
2012-10-22ustream: add example codeFelix Fietkau
2012-10-21blobmsg-example: fix compile errorsFelix Fietkau
2012-09-27add an example script for the uloop lua bindingFelix Fietkau
2012-03-14remove uhtbl-test.c, it is obsoleteFelix Fietkau
2011-01-30fix json list parsingFelix Fietkau
2011-01-29blobmsg: make arrays structually the same as tables - simplifies library ↵Felix Fietkau
user code
2011-01-29remove #if 0'd debug codeFelix Fietkau
2010-10-13Initial importFelix Fietkau