Felix Fietkau [Sat, 5 Oct 2013 19:40:04 +0000 (21:40 +0200)]
vlist: constify key argument to vlist_add
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Fri, 4 Oct 2013 14:55:14 +0000 (16:55 +0200)]
blobmsg_json: allow signed output of integers
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Wed, 25 Sep 2013 06:44:39 +0000 (08:44 +0200)]
blob: add blob_put_raw() for copying one or more blob attributes into the buffer directly
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Wed, 11 Sep 2013 15:59:33 +0000 (17:59 +0200)]
blobmsg-example: fix length handling in dump_table() calls
Felix Fietkau [Wed, 31 Jul 2013 22:01:00 +0000 (00:01 +0200)]
uloop: fix deleting pending fd events on uloop_fd_del
When a fd gets deleted internally due to errors, fd->registered gets set
to false before events are moved to the staging array.
This leads to pending events not getting cleared properly when the fd
user finally calls uloop_fd_del.
Fix this by moving the check down and always checking for pending
events.
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Mon, 29 Jul 2013 12:44:11 +0000 (14:44 +0200)]
blob/blobmsg: add null pointer checks to the *_for_each_attr functions, fix formatting
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Helmut Schaa [Wed, 24 Jul 2013 12:51:55 +0000 (14:51 +0200)]
uloop: Fix incorrect timeout
uloop timeouts are calculated based on a time value that was fetched
before any callbacks were executed. Hence, the next timeout is off by
the time the callback execution took which can lead to strange side
effects.
Fix this by calculating the next timeout based on a fresh time value.
Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
John Crispin [Tue, 2 Jul 2013 16:31:25 +0000 (18:31 +0200)]
runqueue should cal the complete handler from more places
Signed-off-by: John Crispin <blogic@openwrt.org>
Felix Fietkau [Fri, 28 Jun 2013 11:05:06 +0000 (13:05 +0200)]
safe_list: add missing null pointer check in safe_list_del()
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Fri, 21 Jun 2013 17:53:09 +0000 (19:53 +0200)]
ustream: return NULL in ustream_get_read_buf if there's a buffer, but no data
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Fri, 21 Jun 2013 15:19:37 +0000 (17:19 +0200)]
blobmsg_json: do not corrupt UTF-8 strings
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Fri, 21 Jun 2013 15:06:34 +0000 (17:06 +0200)]
blobmsg_json: fix \u escaping for control characters
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Tue, 18 Jun 2013 10:01:08 +0000 (12:01 +0200)]
uloop: fix corner cases with recursive uloop_run calls
With multiple recursive calls to uloop_run, the callback for the same fd
can be run multiple times from different levels in the stack.
Prevent this by tracking the stack of uloop_fd callbacks and buffering new
incoming events for fds already on the stack.
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Tue, 18 Jun 2013 09:51:50 +0000 (11:51 +0200)]
uloop: fix event flags processing on mac os x
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Tue, 18 Jun 2013 09:11:04 +0000 (11:11 +0200)]
libubox: make uloop_fd::flags generic
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Tue, 18 Jun 2013 07:57:39 +0000 (09:57 +0200)]
uloop: fix edge trigger handling on mac os x
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Tue, 11 Jun 2013 10:21:09 +0000 (12:21 +0200)]
uloop: rework event processing, fix use-after-free issues
Recursive calls to uloop_run() need to process already fetched events
first, before running kqueue/epoll to get more.
The state of cur_fd/cur_nfds and the event list needs to be maintained
properly to prevent accidental running of events pointing at deleted
uloop_fd structs.
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Mon, 10 Jun 2013 11:37:14 +0000 (13:37 +0200)]
utils: add bitfield inline ops
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Fri, 31 May 2013 09:18:26 +0000 (11:18 +0200)]
ustream: only report stream eof once via state_change callback
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Fri, 31 May 2013 09:17:02 +0000 (11:17 +0200)]
ustream: only report a write error once via state_change callback
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Wed, 29 May 2013 10:14:40 +0000 (12:14 +0200)]
blobmsg_json: add blobmsg_add_json_from_file
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Wed, 8 May 2013 23:27:45 +0000 (01:27 +0200)]
runqueue: move completion handler from runqueue_process to runqueue_task to make it more generic
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Wed, 8 May 2013 23:15:05 +0000 (01:15 +0200)]
runqueue: fix include path
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Wed, 8 May 2013 23:04:49 +0000 (01:04 +0200)]
runqueue: add a simple task queueing/completion tracking implementation
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Wed, 8 May 2013 23:06:40 +0000 (01:06 +0200)]
ustream-example: fix container_of type errors
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Helmut Schaa [Tue, 7 May 2013 13:04:18 +0000 (15:04 +0200)]
libubox: Allow to build against libjson-c > 0.9
Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Felix Fietkau [Mon, 15 Apr 2013 13:53:57 +0000 (15:53 +0200)]
safe_list: add safe_list_empty()
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Mon, 15 Apr 2013 13:39:09 +0000 (15:39 +0200)]
safe_list: fix typo
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Mon, 18 Mar 2013 04:54:44 +0000 (05:54 +0100)]
list.h: implement type safety for container_of()
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Mon, 18 Mar 2013 04:53:44 +0000 (05:53 +0100)]
avl: fix type handling in container_of uses
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Mon, 18 Mar 2013 02:58:54 +0000 (03:58 +0100)]
safe_list: add a new linked list variant
Use this linked list implementation as a replacement for list.h if you
want to allow deleting arbitrary list entries from within one or more
recursive iterator calling context
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Sat, 16 Mar 2013 23:50:03 +0000 (00:50 +0100)]
jshn: add support for the double datatype
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Thomas Gstädtner [Tue, 5 Mar 2013 00:30:51 +0000 (01:30 +0100)]
add pkgconfig support for json-c
this includes a fallback for legacy support
Felix Fietkau [Sat, 2 Mar 2013 15:19:30 +0000 (16:19 +0100)]
json_script: do not rely on global includes for other libubox header files
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Thu, 28 Feb 2013 20:50:49 +0000 (21:50 +0100)]
add json_script, a minimalistic JSON based script interpreter
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Sun, 17 Feb 2013 15:42:12 +0000 (16:42 +0100)]
blobmsg: implement blobmsg_printf and blobmsg_vprintf
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Thu, 14 Feb 2013 22:39:57 +0000 (23:39 +0100)]
utils: make le16 endian conversion functions work with arguments that have side effects
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Thu, 14 Feb 2013 21:02:56 +0000 (22:02 +0100)]
utils.h: make 16-bit little endian conversion robust against pointer subtraction arguments
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Wed, 13 Feb 2013 11:35:19 +0000 (12:35 +0100)]
utils: add little-endian swap helpers
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Mon, 11 Feb 2013 21:00:08 +0000 (22:00 +0100)]
utils: prefer using gccs builtin swapping functions which support constant folding
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Mon, 11 Feb 2013 20:46:41 +0000 (21:46 +0100)]
utils: move endian swap helpers and __packed definition to utils.h
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Sun, 10 Feb 2013 19:43:51 +0000 (20:43 +0100)]
blobmsg: add blobmsg_realloc_string_buffer()
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Sun, 10 Feb 2013 19:43:33 +0000 (20:43 +0100)]
blob: add blob_buf_grow()
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Sun, 10 Feb 2013 14:32:45 +0000 (15:32 +0100)]
blobmsg_json: prefer to link against libjson-c over libjson (the new library name in git versions of json-c)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Thu, 31 Jan 2013 17:10:16 +0000 (18:10 +0100)]
ustream: another fix for ustream_read_buf_full() with split read buffers
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Thu, 31 Jan 2013 16:05:44 +0000 (17:05 +0100)]
ustream-fd: do not loop back into the callback from ustream_fd_set_uloop
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Thu, 31 Jan 2013 15:43:44 +0000 (16:43 +0100)]
ustream: set the right EOF flag
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Thu, 31 Jan 2013 15:43:00 +0000 (16:43 +0100)]
uloop: remove file descriptors if neither read nor write notification is requested
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Wed, 30 Jan 2013 16:48:55 +0000 (17:48 +0100)]
ustream-fd: only use read() == 0 as eof indication, and issue a state change notification when that happens
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Wed, 30 Jan 2013 15:52:32 +0000 (16:52 +0100)]
ustream: fix ustream_read_buf_full() for multiple read buffers
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Tue, 29 Jan 2013 22:06:55 +0000 (23:06 +0100)]
blobmsg_json: fix buffer growing on blobmsg json formatting
Jo-Philipp Wich [Wed, 23 Jan 2013 18:33:12 +0000 (19:33 +0100)]
uloop: rename uloop_timeout_pending() to uloop_timeout_remaining()
Jo-Philipp Wich [Tue, 22 Jan 2013 14:50:09 +0000 (15:50 +0100)]
uloop: add uloop_timeout_pending() function to determine the remaining time of an active timeout
Felix Fietkau [Wed, 23 Jan 2013 14:22:29 +0000 (15:22 +0100)]
build: remove install prefix override
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Wed, 23 Jan 2013 01:41:16 +0000 (02:41 +0100)]
blob/blobmsg: use 32 bit load/store for 64 bit access, unaligned attributes cause data corruption on ARM
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Tue, 22 Jan 2013 09:09:55 +0000 (10:09 +0100)]
ustream-fd: retry partial writes
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Luka Perkov [Tue, 8 Jan 2013 09:48:01 +0000 (10:48 +0100)]
rename internal variables in json_get_type
Signed-off-by: Luka Perkov <luka@openwrt.org>
Felix Fietkau [Sun, 13 Jan 2013 14:29:14 +0000 (15:29 +0100)]
blobmsg: add blobmsg_get_string
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Sun, 13 Jan 2013 14:27:34 +0000 (15:27 +0100)]
add license headers for usock
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Sun, 13 Jan 2013 08:49:16 +0000 (09:49 +0100)]
list_compat.h: add copyright info
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Sun, 13 Jan 2013 08:47:51 +0000 (09:47 +0100)]
uloop: replace copyright info (code has been completely rewritten over time), relicense to ISC
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Sun, 13 Jan 2013 08:45:59 +0000 (09:45 +0100)]
jshn: add copyright info
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Sun, 13 Jan 2013 08:07:32 +0000 (09:07 +0100)]
blobmsg: fix blobmsg_parse_array, drop name field requirement
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Sun, 13 Jan 2013 08:02:47 +0000 (09:02 +0100)]
blobmsg: allow BLOBMSG_TYPE_UNSPEC attributes, treat them as null for JSON conversion
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Tue, 8 Jan 2013 01:05:00 +0000 (02:05 +0100)]
blobmsg: add blobmsg_parse_array()
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Sun, 6 Jan 2013 02:04:04 +0000 (03:04 +0100)]
uloop: use clock_gettime with the monotonic clock instead of using gettimeofday()
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Sun, 6 Jan 2013 01:42:58 +0000 (02:42 +0100)]
uloop: add a clock_gettime() implementation for mac os x
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Sun, 6 Jan 2013 01:15:48 +0000 (02:15 +0100)]
blobmsg_json: export blobmsg_add_object
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Sat, 5 Jan 2013 15:04:41 +0000 (16:04 +0100)]
uloop: add back state tracking on mac os x, it seems to work reliably now (after the other fixes)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Luka Perkov [Fri, 4 Jan 2013 10:26:08 +0000 (11:26 +0100)]
sanitize json_get_type function
Signed-off-by: Luka Perkov <luka@openwrt.org>
Felix Fietkau [Fri, 4 Jan 2013 02:17:51 +0000 (03:17 +0100)]
uloop: improve edge trigger reliability on mac os x
Sometimes after re-arming a fd, an initial event for reads is not generated,
even though there is data pending. Work around this by making the trigger
level-triggered first, then switching to edge trigger after processing the first
event.
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Fri, 4 Jan 2013 02:13:29 +0000 (03:13 +0100)]
uloop: ensure SIGCHLD is properly received on mac os x
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Fri, 4 Jan 2013 00:15:45 +0000 (01:15 +0100)]
uloop: do less state/change tracking for kevent() on mac os x, it is unreliable
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Thu, 3 Jan 2013 15:32:25 +0000 (16:32 +0100)]
ustream: increment receive buffer count
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Thu, 3 Jan 2013 14:58:04 +0000 (15:58 +0100)]
ustream-fd: prevent callbacks during init
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Thu, 3 Jan 2013 14:46:21 +0000 (15:46 +0100)]
ustream-fd: fix read error handling
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Tue, 1 Jan 2013 22:37:17 +0000 (23:37 +0100)]
uloop: fix immediate timeout processing on mac os x
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Tue, 1 Jan 2013 15:10:27 +0000 (16:10 +0100)]
utils: add BUILD_BUG_ON (similar to the one in the linux kernel)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Tue, 1 Jan 2013 15:10:14 +0000 (16:10 +0100)]
ustream: add ustream_pending_data accessor function
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Mon, 31 Dec 2012 14:40:07 +0000 (15:40 +0100)]
utils: make it unnecessary to specify the last NULL argument for calloc_a
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Mon, 31 Dec 2012 14:02:31 +0000 (15:02 +0100)]
utils: move ARRAY_SIZE from uloop to utils.h
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Sun, 30 Dec 2012 21:42:46 +0000 (22:42 +0100)]
add utils.c, containing a calloc-like function to allocate multiple chunks with different sizes in one block and return pointers
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Sun, 30 Dec 2012 18:21:03 +0000 (19:21 +0100)]
ustream: avoid calling s->poll from a write path to avoid looping back through the notify_write cb
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Sun, 30 Dec 2012 16:26:40 +0000 (17:26 +0100)]
ustream: fix polling for write buffer availability after buffering writes
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Sun, 30 Dec 2012 14:46:18 +0000 (15:46 +0100)]
ustream: suppress write attempts in ustream_printf and ustream_vprintf if a write error was flagged
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Sun, 30 Dec 2012 14:25:35 +0000 (15:25 +0100)]
ustream: add ustream_read_buf_full() helper
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Tue, 18 Dec 2012 12:38:27 +0000 (13:38 +0100)]
jshn: fix check to reset array sequence counters on cleanup
Jo-Philipp Wich [Mon, 17 Dec 2012 12:54:45 +0000 (13:54 +0100)]
jshn: introduce json_is_a() convenience function to check field types without using a temporary variable
Felix Fietkau [Sun, 16 Dec 2012 18:58:06 +0000 (19:58 +0100)]
jshn: fix array handling
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Sun, 16 Dec 2012 17:04:14 +0000 (18:04 +0100)]
jshn: fix some variable handling regressions
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Sun, 16 Dec 2012 16:46:02 +0000 (17:46 +0100)]
jshn: add support for namespaces
Can be used to fix variable namespace clashes in library code using jshn
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Sun, 2 Dec 2012 16:49:08 +0000 (17:49 +0100)]
blob.h: fix endian check
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Wed, 31 Oct 2012 19:28:11 +0000 (20:28 +0100)]
uloop: fix tv_diff() calculation
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Wed, 31 Oct 2012 19:09:47 +0000 (20:09 +0100)]
uloop: another timer fix
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Wed, 31 Oct 2012 19:03:45 +0000 (20:03 +0100)]
uloop: fix sub-second timer offsets for uloop_timeout_set
Felix Fietkau [Mon, 29 Oct 2012 23:00:57 +0000 (00:00 +0100)]
ustream: make notify_state optional as well
Felix Fietkau [Mon, 29 Oct 2012 23:00:23 +0000 (00:00 +0100)]
ustream: mark notify_read cb as optional
Felix Fietkau [Mon, 29 Oct 2012 22:39:48 +0000 (23:39 +0100)]
ustream: add a poll callback function defined by the ustream implementation
Felix Fietkau [Mon, 29 Oct 2012 22:11:08 +0000 (23:11 +0100)]
ustream: fix variable initialization
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Felix Fietkau [Tue, 23 Oct 2012 16:00:18 +0000 (18:00 +0200)]
ustream-example: fix logic inversion