user: implement mlibc as the libc, finally.

It's finally done..

Signed-off-by: kaguya <vpshinomiya@protonmail.com>
This commit is contained in:
kaguya
2026-05-02 03:31:49 -04:00
parent 2fa39ad85a
commit 9a9b91c940
2387 changed files with 152741 additions and 315 deletions
@@ -0,0 +1,35 @@
#include <assert.h>
#include <stdio.h>
#include <sys/uio.h>
#include <unistd.h>
// Test variable to read and write
static int test = 42;
int main() {
// Read the variable using process_vm_readv
int temp;
struct iovec local_iov = {
.iov_base = &temp,
.iov_len = sizeof(temp),
};
struct iovec remote_iov = {
.iov_base = &test,
.iov_len = sizeof(test),
};
ssize_t bytes_read = process_vm_readv(getpid(), &local_iov, 1, &remote_iov, 1, 0);
assert(bytes_read == sizeof(test));
assert(temp == 42);
// Write a new value to the variable using process_vm_writev
int new_value = 1337;
struct iovec new_local_iov = {
.iov_base = &new_value,
.iov_len = sizeof(new_value),
};
ssize_t bytes_written = process_vm_writev(getpid(), &new_local_iov, 1, &remote_iov, 1, 0);
assert(bytes_written == sizeof(new_value));
assert(test == 1337);
return 0;
}