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
2018-11-16switch from typeof to the more portable __typeof__lede-17.01Felix Fietkau
Depending on the existance/lack of container_of define including libubox or uci headers (e.g. #include <uci.h>) could result in compilation errors like: staging_dir/target-arm_cortex-a9_musl-1.1.16_eabi/usr/include/uci.h:643:10: error: expected declaration specifiers or '...' before '(' token return uci_to_package(e); staging_dir/target-arm_cortex-a9_musl-1.1.16_eabi/usr/include/uci.h:643:10: error: '__mptr' undeclared (first use in this function) return uci_to_package(e); Signed-off-by: Felix Fietkau <nbd@nbd.name> [rmilecki: add commit description] Signed-off-by: Rafał Miłecki <rafal@milecki.pl> (cherry picked from commit ace64897d47b9bc7af277d8a3f8a0ff67976cba8)
2018-01-07jshn: properly support JSON "null" typeJo-Philipp Wich
Instead of abort parsing, properly deal with "null" values by implementing support for reading and formatting such values. Signed-off-by: Jo-Philipp Wich <jo@mein.io> (cherry picked from commit 1c08e80313fd487112c48346889cc57badeef751)
2018-01-07jshn: read and write 64-bit integersChristian Beier
This allows for reading in and writing out bigger JSON Numbers. Following test script (that fails to print correct values _without_ this commit) verifies the functionality (tested on x86-64 as well as on ar71xx): ---snip--- # assumes you built jshn and sourced jshn.sh echo testing reading-in JSON SHELL_BIGNUM=12147483647 json_init json_load "{ \"bignum\": $SHELL_BIGNUM }" json_get_var BIGNUM bignum echo jshn bignum: $BIGNUM echo shll bignum: $SHELL_BIGNUM echo testing writing-out JSON json_init json_add_int bigint $SHELL_BIGNUM json_dump --snap--- Signed-off-by: Christian Beier <dontmind@freeshell.org> (cherry picked from commit 729f47fd5279f902986457682f8f166c324eafb5)
2017-06-14runqueue: fix use-after-free bugFelix Fietkau
Calling t->complete in runqueue_task_complete can free the memory associated with t. Change the runqueue_start_next accordingly. Fixes https://github.com/openwrt/openwrt/issues/493 Signed-off-by: Felix Fietkau <nbd@nbd.name>
2017-02-24libubox: Change calloc_a() to return size_t aligned pointersTed Hess
Un-aligned pointers were causing seg faults on some targets Signed-off-by: Ted Hess <thess@kitschensync.net>
2017-02-03uloop: add uloop_cancelling functionFelix Fietkau
Returns true if uloop_run is still running and uloop_cancelled is set Signed-off-by: Felix Fietkau <nbd@nbd.name>
2017-01-20utils: fix build on Mac OS X 10.12Felix Fietkau
clock_gettime and CLOCK_MONOTONIC are supported now Signed-off-by: Felix Fietkau <nbd@nbd.name>
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-12-29utils: add helper functions useful for allocating a ring bufferFelix Fietkau
This creates a mapping with twice the size of the allocated memory. The second half of that mapping points at the same memory as the first half. This is useful for ring buffers, because any read starting in the first half can overflow into the second half as long as the read size is smaller than the size of the memory area. Signed-off-by: Felix Fietkau <nbd@nbd.name>
2016-12-24libubox: replace strtok with _r version.Rosen Penev
_r is re-entrant. Also happens to silence a cppcheck warning. Signed-off by: Rosen Penev <rosenp@gmail.com>
2016-12-13libubox: allow reading out the pid of uloop process in luaFlorian Eckert
Add Lua method to get the forked pid of a uloop process Signed-off-by: Florian Eckert <Eckert.Florian@googlemail.com>
2016-12-12uloop: remove useless epoll data assignmentFelix Fietkau
ev.data is a union, so setting ev.data.fd is lost after setting ev.data.ptr Reported-by: Song Yaofei <songyaofei@joyware.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2016-12-05libubox: allow reading out the remaining time of a uloop timer in LuaStijn Cleynhens
Add Lua method to the uloop wrapper to allow reading out the remaining time of a uloop timer Signed-off-by: Stijn Cleynhens <stijncleynhens@gmail.com>
2016-11-29blob/blobmsg: add explicit typecasts for attribute iteratorsFelix Fietkau
Fixes C++ compatibility. Reported in https://forum.lede-project.org/t/blobmsg-for-each-attr-from-c/389 Signed-off-by: Felix Fietkau <nbd@nbd.name>
2016-10-24kvlist: add static initializer macrosFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2016-07-29libubox: add static initializer macro for runqueuesFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2016-07-29avl: add blob comparator functionFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2016-07-02blobmsg_json: add new functions blobmsg_format_json_value*Matthias Schiffer
The current blobmsg_format_json* functions will return invalid JSON when the "list" argument is given as false (blobmsg_format_element() will output the name of the blob_attr as if the value is printed as part of a JSON object). To avoid breaking software relying on this behaviour, introduce new functions which will never print the blob_attr name and thus always produce valid JSON. Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net> Acked-by: Jo-Philipp Wich <jo@mein.io> Signed-off-by: Felix Fietkau <nbd@nbd.name> [cosmetic style fix]
2016-06-26uloop: handle waker pipe write() return valueEyal Birger
Recent glibc warns if result of read() or write() is unused. Added a retry in case of EINTR, all other faults are silently discarded. Signed-off-by: Eyal Birger <eyal.birger@gmail.com> ----- - I was not able to reproduce the EINTR case, but it seems to be the right thing to do - Retrying on EAGAIN in this case would be weird as there is no one to read from the other end of the pipe. We could call waker_consume() directly but since the size of the message is just one byte, I think this would be dead code
2016-06-26loop: make uloop_run() return the cancelling signalMatthias Schiffer
When a process quits in response to a signal it handles, it should to so be re-sending the signal to itself. This especially important for SIGINT, as is explained in [1]. uloop currently hides the reason for quitting uloop_run(). Fix this by returning the signal that caused the loop to quit (or 0 when uloop_end() was used), so a program using loop an comply with [1]. [1] https://www.cons.org/cracauer/sigint.html Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
2016-06-26Fix various memory management issuesMatthias Schiffer
Consistently handle allocation failures. Some functions are changed to return bool or int instead of void to allow returning an error. Also fix a buffer size miscalculation in lua/uloop and use _exit() instead of exit() on errors after forking. Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
2016-06-15uloop: add missing waker_pipe initializationFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2016-06-15uloop: use a waker for notifying sigchld and loop cancel eventsYousong Zhou
Fix a race condition when do_sigchld, uloop_cancelled were set just before epoll_wait(timeout=-1), resulting the loop stuck in the syscall without noticing the events just happened Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
2016-05-19uloop: revert signalfd support for nowFelix Fietkau
It hasn't fixed the reported race condition and it introduced some new issues. Signed-off-by: Felix Fietkau <nbd@nbd.name>
2016-05-17uloop: add back support for overriding signal handlers when signalfd is in useFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2016-05-17uloop: fix signal unblockingFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2016-05-17uloop: retry waitpid on signal interruptFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2016-05-17uloop: try to use signalfd for signal handling if availableFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2016-05-17uloop: move epoll code into a separate fileFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2016-05-17uloop: move kqueue code into a separate fileFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2016-04-06blobmsg_json: simplify add_separator and fix thread-safetyMatthias Schiffer
The hard-coded length limits are replaced with strlen to make the code more robust. Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
2016-03-05jshn: use an avl tree for env variables to speed up processing of bigger ↵Felix Fietkau
json files Signed-off-by: Felix Fietkau <nbd@openwrt.org>
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>
2016-02-10blobmsg_json: support json_type_null in blobmsg_add_json_element()Jo-Philipp Wich
We already serialize BLOBMSG_TYPE_UNSPEC as "null" so represent JSON null values as blob attribute type unspec with payload size zero. Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2016-01-28usock: implement usock_inet_timeout() with RFC6555 supportFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2016-01-15ustream-fd: handle ENOTCONN for read/write on not-yet-connected socketsFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2016-01-15lua: add gc/delete support for processesFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2016-01-15lua: create a common function for userdata with gcFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2016-01-15usock: add usock_inet, which returns the remote addressFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2015-11-22libubox: lua: use pkg-config built in module to search for alternativesKarl Palsson
Different distributions have different names for the lua 5.1 package. Use cmake's built in pkg-config support to search for the first one, rather than running it explicitly and searching for a single version. Signed-off-by: Karl Palsson <karlp@remake.is>
2015-11-08json_script: allow non-string types in command argumentsFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2015-11-07json_script: add support for aborting script processingFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2015-09-15ulog: avoid accidental /dev/kmsg creationSergiy Kibrik
Race is possible in ulog_kmsg(): if no /dev/kmsg exists (e.g. while /dev gets re-mounted) regular file created instead. >From this point system goes without kernel logger: special character file can't be created anymore, all clients keep overwriting single message in regular file. To avoid this we open file in "r+" mode which doesn't create file if it's not found. Signed-off-by: Sergiy Kibrik <sakib@meta.ua> Cc: John Crispin <blogic@openwrt.org>
2015-09-09b64_encode(): fixed input[] not initialized warn under gcc 4.4.5Bachtin, Dmitri
Signed-off-by: Dmitri Bachtin <dbachtin@init-ka.de>
2015-09-09Build static version of libblobmsg_jsonBachtin, Dmitri
Signed-off-by: Dmitri Bachtin <dbachtin@init-ka.de>
2015-07-14ustream-fd: handle uloop errorsPhilip Craig
The default uloop error handling is to delete the fd. Continue to do that, but also set the write_error flag and notify the user. Signed-off-by: Philip Craig <philipjcraig@gmail.com>
2015-06-29md5: include utils.h instead of endian.h to fix portability issuesFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2015-06-29md5: include endian.h for musl, otherwise hashes are invalid for BESteven Barth
Signed-off-by: Steven Barth <steven@midlink.org>
2015-06-14ulog: always use stderr for ulog_stdio().Yousong Zhou
stdout is for normal program output. Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>