Age | Commit message (Collapse) | Author |
|
Recent glibc versions require linking libresolv to obtain ns_initparse().
Fixes: #144
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
rtnl: add missing uc_vm_registry_set call
|
|
Fixes maintaining the listener array
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|
Fix reference count issues
|
|
Arguments stored in the registry need an extra reference
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|
Arguments stored in the registry need an extra reference
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|
nl80211: fix NL80211_ATTR_SURVEY_INFO
|
|
This is the last attribute, adapt .nattr to include it so it gets
parsed.
Signed-off-by: Andre Heider <a.heider@gmail.com>
|
|
rtnl: add support for registering an uloop based listener
|
|
Similar to nl80211 uloop listener
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|
nl80211: add support for registering an uloop based listener
|
|
- Fix `ucv_array_unshift()` improperly rejecting operation on empty arrays
- Fix `uc_unshift()` improperly reversing maintaining argument order
- Add missing test coverage for `push()`, `pop()`, `unshift()` and
`shift()` array operations.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
The `pipe()` function takes no arguments and will return a two element
array containing open read- and write file descriptors for a newly
created pipe.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Can be used to capture nl80211 messages in an event driven program
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|
- add missing overflow check
- make array size dynamic
- set all bits if command id is not specified
- add helper function for filling command bits
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|
Add an `.editorconfig` file to the source root in order to document the
preferred source code indentation style.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
fs: add `isatty()` function
|
|
Expose the `isatty(3)` libc function in the fs module to allow checking
whether a file descriptor refers to a terminal.
Signed-off-by: Petr Štetiar <ynezz@true.cz>
|
|
nl80211: add support for NL80211_ATTR_MPATH_INFO
|
|
Signed-off-by: John Crispin <john@phrozen.org>
|
|
include: add uc_fn_thisval()
|
|
Can be used to get rid of a layer of pointer indirection in resource type
handlers.
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|
Fixes: #132
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Adjust expected testcase outputs after double format change in the
previous commit.
Fixes: 4c654df ("types: adjust double printing format")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Change the printf format for formatting doubles from `%g` to `%.14g`.
This matches the behaviour of Lua 5.1.5 with LNUM used on OpenWrt and
ensures that expressions such as `print(31764740.0 / 100)` yield the
expected `317647.4` result and not a truncated (rounded down) value of
`317647`.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
|
|
The compiler emitted incorrect bytecode for logical assignment operations
on property expressions. The generated instructions left the stack in an
unclean state when the assignment condition was not fulfilled, causing a
stack layout mismatch between compiler and vm, leading to undefined
variable accesses and other non-deterministic behavior.
Solve this issue by rewriting the bytecode generation to yield an
instruction sequence that does not leave garbage on the stack.
The implementation is not optimal yet, as an expression in the form
`obj.prop ||= val` will load `obj.prop` twice. This is acceptable for
now as the load operation has no side effect, but should be solved in
a better way by introducing new instructions that allow for swapping
stack slots, allowing the vm to operate on a copy of the loaded value.
Also rewrite the corresponding test case to trigger a runtime error
on code versions before this fix.
Fixes: fdc9b6a ("compiler: fix `??=`, `||=` and `&&=` logical assignment semantics")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
fs: add `realpath()` function
|
|
Expose the `realpath(3)` libc function in the fs module to allow for
canonicalizing file paths.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
math: add isnan() function
|
|
Add a new `isnan()` convenience function to the math library which can
be used to test if a given value is a NaN double.
The same test can be realized without the math library by using a function
similar to the following one:
function isNaN(x) {
return x != x;
}
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
uloop: terminate parent uloop in task child processes
|
|
lib: uc_json(): accept trailing whitespace when parsing strings
|
|
Invoking `sleep(1000)` in the CI container often sleeps slightly longer
than exactly 1000ms, causing the test output to mismatch.
Relax the test requirement to simply ensure that t2 > t1.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Only raise a trailing garbage error if the given JSON source string is
followed by a non white space character.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Ensure that the main process uloop is terminated within task child
processes. Before this fix, using uloop in a task function would
trigger invalid memory accesses in the parent process by notifying
non-existing fd slots in the parent through the inherited shared
epoll descriptor.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
uci: auto-load package in `ctx.foreach()` and `ctx.get_first()`
|
|
compiler: ensure that arrow functions with block bodies return no value
|
|
Functions that use `uci_lookup_ptr()` internally, such as `ctx.get()`,
`ctx.set()` or `ctx.delete()`, implicitly load the given configuration
name while the higher level functions `ctx.foreach()` or `ctx.get_first()`
do not.
This behaviour violates the principle of least surprise and might lead to
non-deterministic program behavior as the outcome of these functions
depends on prior uci operations performed on the cursor.
Fix this issue by invoking `uci_load()` internally in case the given
uci package name cannot be found in the cursor's package cache.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Follow ES6 semantics and ensure that arrow functions with a block body
don't implicitly return the value of the last executed statement.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
compiler: fix `??=`, `||=` and `&&=` logical assignment sementics
|
|
When compiling logical assignment expressions, ensure that the right hand
side of the assignment is not evaluated when the assignment condition is
unfulfilled.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
add cmake to install requires for debian
|
|
|
|
fs: expose `getdelim()` functionality through `fd.read()`
|
|
When `fd.read()` is invoked with a single-character string argument,
invoke `getdelim()` internally to read the input until the give character
or EOF. This is useful for reading character delimited input data.
For example `fd.read('\n')` will read any data up to the first newline
(or EOF) while `fd.read('\0x00')` will read until the first null byte.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
fs: use `getline()` for line wise read operations
|
|
lexer: fixes for regex literal parsing
|