Simple file IO with the ioctl syscall

This commit is contained in:
2025-09-05 19:56:27 +02:00
parent f42c4b7e44
commit fb5e88a175
16 changed files with 299 additions and 6 deletions

40
share/sysdefs/ioctl.h Normal file
View File

@ -0,0 +1,40 @@
#ifndef SHARE_SYSDEFS_IOCTL_H_
#define SHARE_SYSDEFS_IOCTL_H_
#include <stdint.h>
#include <stddef.h>
#define IOCTL_NOHANDLE (-1)
enum {
IOCTL_OPENF = 0,
IOCTL_CLOSEF = 1,
IOCTL_READ = 2,
IOCTL_STAT = 3,
IOCTL_WRITE = 4,
};
enum {
IOCTL_F_READ = 1<<0,
IOCTL_F_WRITE = 1<<1,
IOCTL_F_MAKE = 1<<2,
};
typedef struct {
const char *path;
int32_t flags;
} IOCtlOF;
typedef struct {
const uint8_t *const buffer;
size_t len;
size_t off;
} IOCtlWF;
typedef struct {
uint8_t *const buffer;
size_t len;
size_t off;
} IOCtlRF;
#endif // SHARE_SYSDEFS_IOCTL_H_