Add sys_exec () and libprocess wrapper, fix ramdisk tar parsing
All checks were successful
Build documentation / build-and-deploy (push) Successful in 1m26s

This commit is contained in:
2026-02-14 21:50:09 +01:00
parent 690e09339e
commit b0b69f3e9e
27 changed files with 112 additions and 39 deletions

View File

@@ -4,7 +4,7 @@
bool path_validate_char (char ch) {
return ((ch >= '0' && ch <= '9') || (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') ||
(ch == '_') || (ch == '_'));
(ch == '_') || (ch == '-') || (ch == '/'));
}
bool path_validate (const char* path) {
@@ -13,21 +13,6 @@ bool path_validate (const char* path) {
const char* ptr = path;
if (*ptr == ':')
return false;
while (*ptr != ':' && *ptr != '\0') {
if (!path_validate_char (*ptr))
return false;
ptr++;
}
if (*ptr != ':')
return false;
ptr++;
if (*ptr != '/')
return false;
@@ -41,7 +26,7 @@ bool path_validate (const char* path) {
ptr++;
}
if (ptr > path && *(ptr - 1) == '/' && *(ptr - 2) != ':')
if (ptr > path + 1 && *(ptr - 1) == '/')
return false;
return true;

View File

@@ -6,6 +6,7 @@
#include <limine/requests.h>
#include <m/fs_desc_buffer.h>
#include <m/status.h>
#include <sys/debug.h>
struct ramdisk_tar_header {
char filename[100];
@@ -24,15 +25,16 @@ struct ramdisk_tar_file {
size_t size;
};
#define RAMDISK_FILES_MAX 128
#define RAMDISK_PATH "/boot/mop3dist.tar"
#define RAMDISK_FILES_MAX 128
#define RAMDISK_FILENAME_MAX 128
#define RAMDISK_PATH "/boot/mop3dist.tar"
static struct ramdisk_tar_file ramdisk_files[RAMDISK_FILES_MAX];
static struct ramdisk_tar_file* ramdisk_get_file (const char* filename) {
for (size_t i = 0; i < RAMDISK_FILES_MAX; i++) {
if ((ramdisk_files[i].header != NULL) &&
(memcmp (ramdisk_files[i].header->filename, filename, strlen (filename)) == 0))
(strncmp (ramdisk_files[i].header->filename, filename, RAMDISK_FILENAME_MAX) == 0))
return &ramdisk_files[i];
}
return NULL;
@@ -52,10 +54,10 @@ static size_t ramdisk_tar_get_size (uint8_t* in) {
static size_t ramdisk_tar_parse (uint8_t* addr) {
size_t i;
for (i = 0;; i++) {
for (i = 0; i < RAMDISK_FILES_MAX; i++) {
struct ramdisk_tar_header* hdr = (struct ramdisk_tar_header*)addr;
if (hdr->filename[i] == '\0')
if (hdr->filename[0] == '\0')
break;
size_t size = ramdisk_tar_get_size (hdr->size);
@@ -64,10 +66,7 @@ static size_t ramdisk_tar_parse (uint8_t* addr) {
ramdisk_files[i].content = (uint8_t*)((uintptr_t)hdr + 512);
ramdisk_files[i].size = ramdisk_tar_get_size ((uint8_t*)hdr->size);
addr += ((size / 512) + 1) * 512;
if (size % 512)
addr += 512;
addr += 512 + ((size + 511) & ~511);
}
return i;
@@ -83,7 +82,7 @@ bool ramdiskfs_mount (struct vfs_mountpoint* mountpoint) {
for (size_t i = 0; i < module->module_count; i++) {
struct limine_file* file = module->modules[i];
if (memcmp (file->path, RAMDISK_PATH, strlen (RAMDISK_PATH)) == 0) {
if (strncmp (file->path, RAMDISK_PATH, strlen (RAMDISK_PATH)) == 0) {
rd_addr = file->address;
}
}