Simple file IO with the ioctl syscall
This commit is contained in:
40
share/sysdefs/ioctl.h
Normal file
40
share/sysdefs/ioctl.h
Normal 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_
|
Reference in New Issue
Block a user