summaryrefslogtreecommitdiffhomepage
AgeCommit message (Collapse)Author
2023-10-19jsdoc: switch to own custom themeJo-Philipp Wich
Switch to a custom fork of the clean jsdoc theme to address a number of quirks and to directly incorporate CSS and markup changes. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2023-10-17jsdoc: properly handle indented documentation blocksJo-Philipp Wich
Fix the jsdoc C transpiler plugin to properly detect the start of indented multi line comment blocks. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2023-10-12lib: add/improve documentation for require(), loadfile(), loadstring()Jo-Philipp Wich
Add missing documentation for the `require()` function and factor our the description of the compile options dictionary into a separate typedef. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2023-10-11uci: fix potential memory leaks in `configs()`Jo-Philipp Wich
In case `uci.cursor.configs()` is invoked with a completely empty configuration directory, the empty configuration list is not free before returning the `UCI_ERR_NOTFOUND` status. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2023-10-11Merge pull request #175 from jow-/docs-improvementsJo-Philipp Wich
Various documentation improvements
2023-10-11ci: re-trigger workflows on pull request pushesJo-Philipp Wich
Re-trigger workflow runs for pull requests if the source branch is amended or force pushed. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2023-10-11lib: various documentation fixesJo-Philipp Wich
- Consistently use nullable instead of `type|null` expressions - Use @borrows to reduce some duplicated documentation blocks - Add typedef for timelocal()/timegm() TimeSpec value Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2023-10-11uci: add module documentationJo-Philipp Wich
Add complete JSDoc documentation coverage for the uci module. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2023-10-11docs: use CSS and local JavaScript fixups to improve formattingJo-Philipp Wich
- Reduced margins - Better visual separation of method descriptions - Improved display of argument and return value attributes - Improved display of object and array type descriptions - Shortened absolute module name paths The local JavaScript fixups are a stop-gap measure for now, in the long it likely makes more sense to fork the used JSDoc theme to apply the desired changes directly to the markup. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2023-10-10Merge pull request #174 from jow-/log-libJo-Philipp Wich
lib: introduce log library
2023-10-10lib: introduce log libraryJo-Philipp Wich
Introduce a new `log` library which provides bindings for syslog and, if available, the OpenWrt libubox ulog functions. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2023-10-10build: auto-enable module depending on present librariesJo-Philipp Wich
Decide based upon the found libraries whether to enable certain, OpenWrt specific modules by default. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2023-10-10build: convert CMakeLists.txt into lowercaseJo-Philipp Wich
Convert cmake directives into lowercase notation for better readability. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2023-10-09Merge pull request #173 from nbd168/misc-fixesJo-Philipp Wich
Misc fixes
2023-10-09ci: don't skip pull request workflows for `master` branchJo-Philipp Wich
We want pull request workflows to run, even if the source branch happens to be `master` from a forked repository. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2023-10-09include: fix execvpe compat function on macOSFelix Fietkau
Accept char * const *, cast internally. Fixes a compile error Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-10-09uloop: rename environ variable to avoid clashing with system macro on macOSFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-10-09types: ensure double serializatiion with decimal placesJo-Philipp Wich
The `%g` printf format used for serializing double values into strings will not include any decimal place if the value happens to be integral, leading to an unwanted double to integer conversion when serializing and subsequently deserializing an integral double value as JSON. Solve this issue by checking the serialized string result for a decimal point or exponential notation and appending `.0` if neither is found. Ref: #173 Suggested-by: Felix Fietkau <nbd@nbd.name> Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2023-09-25Merge pull request #171 from pktpls/rtnl-netnsidJo-Philipp Wich
rtnl: add IFLA_IF_NETNSID for operating in other namespaces
2023-09-22rtnl: update the link attr TODOsPacket Please
Signed-off-by: Packet Please <pktpls@systemli.org>
2023-09-22rtnl: add IFLA_TARGET_NETNSID for operating in other namespacesPacket Please
Signed-off-by: Packet Please <pktpls@systemli.org>
2023-09-11lib: fix documented return value for `splice()`Jo-Philipp Wich
Make the `splice()` documentation match the actual implementation. Fixes: #170 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2023-08-23Merge pull request #169 from jow-/docs-improvementsJo-Philipp Wich
Documentation improvements
2023-08-23docs: add struct module documentationJo-Philipp Wich
Add full documentation coverage for the struct module by utilizing large parts of the Python struct module documentation for the format string description. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2023-08-23docs: add missing headline to debug module documentationJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2023-08-22Merge pull request #168 from jow-/fix-binary-string-compareJo-Philipp Wich
types: improve comparison reliability of binary strings
2023-08-22types: improve comparison reliability of binary stringsJo-Philipp Wich
The existing `ucv_compare()` implementation utilized `strcmp()` to compare two ucode string values, which may lead to incorrect results for strings containing null bytes as the comparison prematurely aborts when encountering the first null. Rework the string comparison logic to use `memcmp()` for comparing both ucv strings with each other in order to ensure that expressions such as `"" == "\u0000"` lead to the expected `false` result. Ref: https://github.com/openwrt/luci/issues/6530 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2023-08-09Merge pull request #167 from jow-/debug-libraryJo-Philipp Wich
Introduce debug library
2023-08-09lib: introduce debug libraryJo-Philipp Wich
Introduce a new debug library which provides introspection facilities for debugging ucode scripts. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2023-08-09treewide: consolidate platform specific code in platform.cJo-Philipp Wich
Get rid of most __APPLE__ guards by introducing a central platform.c unit providing drop-in replacements for missing APIs. Also move system signal definitions into the new platform file to be able to share them with the upcoming debug library. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2023-08-07Merge pull request #157 from jow-/signal-handlingJo-Philipp Wich
Introduce signal handling
2023-07-27uloop: interrupt on VM signalsJo-Philipp Wich
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>
2023-07-27lib: add `signal()` stdlib functionJo-Philipp Wich
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>
2023-07-27main: enable signal dispatching in the standalone cli interpreterJo-Philipp Wich
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>
2023-07-27types: treat signal handler array as GC rootJo-Philipp Wich
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>
2023-07-27vm: introduce basic signal handling infrastructureJo-Philipp Wich
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>
2023-07-25Merge pull request #166 from jow-/fix-165Jo-Philipp Wich
Fix 165
2023-07-25fs: explicitly compare isatty() resultJo-Philipp Wich
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>
2023-07-25types: don't rely on implicit type conversion in ucv_compare()Jo-Philipp Wich
- 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>
2023-07-13docs: disable GitHub Jekyll post processingJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2023-07-13docs: further reworkJo-Philipp Wich
- 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>
2023-07-13docs: fix markup quirksJo-Philipp Wich
Pipe symbols inside table definitions must be escaped. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2023-07-13docs: add information about memory management and operator precedenceJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2023-07-13Merge pull request #164 from jow-/docs-improvementsJo-Philipp Wich
docs: various improvements
2023-07-13docs: various improvementsJo-Philipp Wich
- 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>
2023-07-12Merge pull request #163 from jow-/docs-improvementsJo-Philipp Wich
fs: complete function documentation coverage
2023-07-12Merge pull request #162 from jow-/fs-ftello-fseekoJo-Philipp Wich
fs: use `fseeko()` and `ftello()`
2023-07-12fs: use `fseeko()` and `ftello()`Jo-Philipp Wich
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>
2023-07-12fs: complete function documentation coverageJo-Philipp Wich
Add missing function documentation and return value annotations. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2023-07-12github: drop superfluous CNAME fileJo-Philipp Wich
Drop CNAME file which was automatically created by the Github ui during pages testing. Signed-off-by: Jo-Philipp Wich <jo@mein.io>