Break ioctl() up into smaller syscalls

This commit is contained in:
2025-10-14 20:05:41 +02:00
parent c34a253d11
commit 406434fed0
21 changed files with 375 additions and 320 deletions

24
share/sysdefs/fs.h Normal file
View File

@ -0,0 +1,24 @@
#ifndef SHARE_SYSDEFS_FS_H_
#define SHARE_SYSDEFS_FS_H_
#define FS_OF_READ (1<<0)
#define FS_OF_WRITE (1<<1)
#define FS_OF_MAKE (1<<2)
#define FSSTAT_DIR 0
#define FSSTAT_FILE 1
#include <stdint.h>
#include <stddef.h>
typedef struct {
size_t size;
int32_t type;
} FsStat;
typedef struct {
FsStat stat;
char name[0x100];
} FsDirent;
#endif // SHARE_SYSDEFS_FS_H_

View File

@ -1,40 +0,0 @@
#ifndef SHARE_SYSDEFS_IOCTL_H_
#define SHARE_SYSDEFS_IOCTL_H_
#define IOCTL_NOHANDLE (-1)
#define IOCTL_OPENF 0
#define IOCTL_CLOSEF 1
#define IOCTL_READ 2
#define IOCTL_STAT 3
#define IOCTL_WRITE 4
#define IOCTL_FETCHDIRENT 5
#define IOCTL_MKDIR 6
#define IOCTL_F_READ (1<<0)
#define IOCTL_F_WRITE (1<<1)
#define IOCTL_F_MAKE (1<<2)
#define IOCTLSTAT_DIR 0
#define IOCTLSTAT_FILE 1
#if !defined(__ASSEMBLER__)
#include <stdint.h>
#include <stddef.h>
typedef struct IoctlStat {
size_t size;
int32_t type;
} IoctlStat;
typedef struct IoctlDirent {
IoctlStat stat;
char name[0x100];
} IoctlDirent;
typedef int32_t IOH;
#endif
#endif // SHARE_SYSDEFS_IOCTL_H_

View File

@ -24,6 +24,13 @@
#define SYS_PROC_ARGV 23
#define SYS_PROC_LISTSIZE 24
#define SYS_PROC_STAT 25
#define SYS_FS_OPENF 26
#define SYS_FS_CLOSEF 27
#define SYS_FS_READ 28
#define SYS_FS_STAT 29
#define SYS_FS_WRITE 30
#define SYS_FS_FETCHDIRENT 31
#define SYS_FS_MKDIR 32
#endif // SHARE_HDRS_SYSCALL_H_