Age | Commit message (Collapse) | Author |
|
Introduce signal handling
|
|
When the VM instance loading the uloop module has signal dispatching
enabled, implicitly register the signal pipe as file descriptor in the
global uloop and dispatch received signals to the VM instance.
This ensures that the respective managed ucode signal handlers are
invoked immediately and not just after `uloop_run()` returns.
Also end the uloop in case any invoked signal handler threw an
exception, to match the expected behaviour with other kinds of
callbacks.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
The `signal()` standard library function provides functionality for
registering signal handler callbacks, restoring default signal behaviour
or ignoring specific signals.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Enable signal dispatching by default for standalone ucode programs.
Also adjust the `gc()` testcase output as the default number of
allocations with enabled signal dispatching changes slightly.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
In order to prevent a premature release of the managed ucode signal handler
callbacks, ensure to treat the containing array as GC root to mark the
function values as reachable.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Introduce the basic facilities to implement UNIX process signal handling
in ucode. The VM structure is extended by a bitmap keeping track of
received signal numbers, a sigaction structure which holds a generic
signal handler to update the bitmap, a pipe where the generic signal
handler will send received signal numbers to and an array of managed
signal handler functions, indexed by signal number.
Additionally, three new C API functions are added to control signal
delivery in the VM instance:
- `uc_vm_signal_dispatch()`
This function invokes signal handler callbacks for each received
signal number, clears the bitmap and empties the pipe. The VM itself
will invoke this function after each executed bytecode instruction.
In some cases however it is useful for C code driving the VM to
force immediate signal delivery, e.g. from within long running C
functions that do not return to ucode (to the next bytecode
instruction) in a timely manner.
- `uc_vm_signal_raise()`
This function will deliver the given signal number, so that it is
picked up by the next call to `uc_vm_signal_dispatch()`. It is used
by the generic C signal handler function to forward received signals
to the VM instance.
- `uc_vm_signal_notifyfd()`
This functions returns the read end of the internal signal pipe.
It is mainly useful for integration into select or poll based event
loops, in order to be notified when there's pending signals for
delivery into the VM instance.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Fix 165
|
|
Reportedly, automatic conversion of the `isatty()` int result value to
a bool does not work correctly on PPC. Explicitly compare the result
value with `1` to infer the boolean result value.
Fixes: #165
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
- Don't implicitly convert intptr_t difference to int8_t but perform
explicit comparisons
- Don't implicitly convert strcmp() int result to int8_t
Fixes: #165
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
- Split README.md into several tutorial pages
- Expand all menu panes
- Hide class menu entries
- Add usage information
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Pipe symbols inside table definitions must be escaped.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
docs: various improvements
|
|
- Switch JSDoc theme to "clean-jsdoc-theme"
- Add some custom CSS and JS tweaks to the theme
- Use a condensed README.md for the toplevel directory
- Include a longer README.md in the documentation portal
- Tweak JSDoc annotations for better output results
- Register `ucode.mein.io` CNAME
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
fs: complete function documentation coverage
|
|
fs: use `fseeko()` and `ftello()`
|
|
Use `fseeko()` and `ftello()` instead of `fseek()` and `ftell()`
respectively in order to be able to deal with large file offsets.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Add missing function documentation and return value annotations.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Drop CNAME file which was automatically created by the Github ui during
pages testing.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Add initial JSDoc infrastructure
|
|
|
|
Add JSDoc documentation blocks to all exported core functions.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Add JSDoc documentation blocks to all exported filesystem functions.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Add JSDoc documentation blocks to all exported math functions.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Introduce the infrastructure for building ucode module documentation using
JSDoc annotations.
To build the documentation, run `npm install` followed by `npm run doc`.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Fixes for source offset tracking
|
|
- When skipping the interpreter line, don't count it's newline twice
- Fix reporting byte offsets beyond the end of line
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Avoid reporting a nonexisting final line by not counting the EOF character
as physical newline.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
ci: switch to official openwrt/gh-action-sdk
|
|
Utilize the official openwrt/gh-action-sdk CI actions to
test-build OpenWrt packages.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
lib: support object ordering in `uc_sort()`
|
|
nl80211: add constants for iftypes
|
|
Useful for adding/removing interfaces
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|
Extend `uc_sort()` to utilize `ucv_object_sort()` in order to support
reordering object keys.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Introduce a new function `ucv_object_sort()` which works similar to
`ucv_array_sort()` and allows reordering the keys of an object.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
README.md: fix debian dependencies
|
|
Fix Coverity Scan CID 1521107 reporting a memory leak in
uc_compiler_compile_import on early exit due to namelist not correctly
put before return.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
[add empty line before return]
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Build fails without pkg-config.
Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
|
|
Ensure to release the `this` context and the temporary argument stash
when we raise a non iterable type exception due to non-iterable values
while precessing spread operations in function call arguments.
Those values would've been garbage collected eventually but explicitly
releasing them here will allow the vm to free them immediately.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
|
|
This avoids unnecessary gc calls when configuring a gc interval while also
explicitly calling ucv_gc from C code embedding a vm at convenient points in
time.
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|
When converting ucode strings to blobmsg, use blobmsg_add_field in order to
explicltly pass the length of the data.
In the other direction, use ucv_string_new_length based on the attribute
length.
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|
It is unused and I couldn't find any purpose for it
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|
Allow -L to add library paths that take precedence over the built-in ones.
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|
program: fix memory leak in read_sourceinfo
|
|
Fix Coverty Scan CID 1521109 reporting a memory leak for path not freed
on read_size_t fail.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
|
ci: unbreak failing builds by using fixed gh-actions-openwrt-ci-sdk
|
|
* use mediatek/mt7622 SDK to have arm64 build test coverage
* use latest Ubuntu container to stay current
* use v3 of checkout action to stay current
Signed-off-by: Petr Štetiar <ynezz@true.cz>
|
|
To save some build resources, lets cancel ongoing builds after
force pushing new sources into the pull request branch.
Signed-off-by: Petr Štetiar <ynezz@true.cz>
|