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>
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>
User's s->notify_read is called in ustream_fill_read(). If
s->read_blocked is set there, then stop reading more.
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
No functional change.
- Reuse existing NULL check on buf.
- Add some comments for ease of reading the code.
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Use PKG_SEARCH_MODULE() to detect json-c library,
otherwise the search fails, if both json-c and json
are not present in pkg-config database.
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
The ulog api is intended to be used by procd, fstools, ubox etc. to provide
a generic logging api for early boot messages and automatic switching between
syslog / kmsg / stdout depending on the way the process is executed.
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
Most app don't want to crash because of unhandled SIGPIPE. It could
happen is such trivial situations like writing to socket.
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
It turns out that mach_absolute_time() is not monotonic at all. While
at it, convert the CLOCK_REALTIME implementation to using
clock_get_time() as well.
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
It can be used to fill caller-specified buffer with data already in
ustream read buffer. Useful in the following use pattern.
int available = ustream_pending_data(s, false);
if (available >= sizeof(struct msghdr)) {
struct msghdr h;
ustream_read(s, &h, sizeof(h));
}
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Otherwise some flags like USOCK_NONBLOCK wouldn't work as expected
(O_NONBLOCK affects connect behavior).
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Though currently jshn is more a one-shot data transformation tool and
won't leak much memory in its lifetime, people may use it as example
code, so do it right.
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
- 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>
The cmake logic is wrong (E.G. PKG_CHECK_FOR_MODULES fails unless all
modules are found), and the legacy libjson.so name is also used by the other
libjson (http://sourceforge.net/projects/libjson/) which provides an
incompatible API, so just drop it.
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Add a new helper function usock_port() which converts the given numeric port number
into a string using a private static buffer. This way a calling application can
conveniently use numeric port arguments without having to convert them before:
int fd = usock(USOCK_UDP, "example.org", usock_port(80));
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>