Files
my-os-project2/user/init/main.c
2025-09-06 11:47:01 +02:00

30 lines
726 B
C

#include <stdint.h>
#include <string/string.h>
#include <system/system.h>
#include <sysdefs/ioctl.h>
#include <system/ioctl.h>
#include <sysdefs/ipcpipe.h>
#include <system/ipcpipe.h>
void main(void) {
debugprint("Hello world from userspace in C");
int32_t ioh = ioctl_openfile("base:/hello.txt", IOCTL_F_WRITE | IOCTL_F_READ | IOCTL_F_MAKE);
char *text = "Hello from the filesystem";
ioctl_writefile(ioh, (const uint8_t *const)text, string_len(text), 0);
char buf[0x100];
ioctl_readfile(ioh, (uint8_t *const)buf, string_len(text), 0);
debugprint(buf);
ioctl_closefile(ioh);
char *aba = "Hello!";
ipcpipe(IPCPIPE_SELFPID, IPCPIPE_OUT, IPCPIPE_WRITE, (uint8_t *)aba, string_len(aba));
for(;;);
}