Ken Van Hoeylandt 79d3dd4fdb
Improvements for apps, filesystems, terminal and shell (#659)
app-module

- Apps now have support for:
  - environment variables (inherit from parent app)
  - current workdir
  - window size (when running in terminal)
- Add type aliases like `AppId` and `PackageId`
- Remove data duplication between ledger and app instance records: create `AppManifestSet`
- `AppManifest` usage safety improved: pass by value where needed, or use `AppId` instead of a manifest.

Terminal and shell

- Moved shell commands into coreutils-module as proper apps.
- Refine stack size for terminal and shell because apps now run with their own task and stack (including in-memory apps)

Platform

- Fix for listing root dir on ESP32: wrap posix directory functions and wire in file systems.
- Moved all platform-specific file system init code to platform subprojects

Other

- Fix for screenshot capture (issue with paths)
- Fixes for coreutils app correctness
- Memory optimizations (use more PSRAM where possible) in various locations such as app-module, shell and terminal.
- `ls` and `help` commands now use terminal width and show columns of data by default
- Created fs helpers at `TactilityKernel/include/tactility/filesystem/fs.h` (partially ported from `ShellFs`)
2026-09-25 08:29:27 +02:00

56 lines
1.4 KiB
C

// SPDX-License-Identifier: Apache-2.0
#pragma once
#include <stddef.h>
#include <stdint.h>
#include <sys/types.h>
#include <tactility/error.h>
#include <tactility/freertos/freertos.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
APP_FILE_WAIT_READABLE,
APP_FILE_WAIT_WRITABLE,
} AppFileWait;
#define APP_FILE_READABLE (1u << 0)
#define APP_FILE_WRITABLE (1u << 1)
/** Request codes recognized by AppFileOps::ioctl(), if the bound object supports them. */
typedef enum {
/** arg: struct AppWindowSize*. Analogous to POSIX ioctl(fd, TIOCGWINSZ, ...). */
APP_IOCTL_GET_WINDOW_SIZE,
} AppIoctlRequest;
/** Terminal/window dimensions, as reported by APP_IOCTL_GET_WINDOW_SIZE. */
struct AppWindowSize {
uint16_t columns;
uint16_t rows;
};
struct AppFileOps {
ssize_t (*read)(void* object, void* buffer, size_t size);
ssize_t (*write)(void* object, const void* buffer, size_t size);
error_t (*close)(void* object);
error_t (*await)(void* object, AppFileWait wait, TickType_t timeout);
uint32_t (*poll)(void* object);
void (*retain)(void* object);
void (*release)(void* object);
/** Optional; nullptr if the object supports no ioctl requests. */
error_t (*ioctl)(void* object, AppIoctlRequest request, void* arg);
};
struct AppFile {
const struct AppFileOps* ops;
void* object;
bool suppress_console_tee;
};
#ifdef __cplusplus
}
#endif