io.h (944B)
1 #ifndef IO_H 2 #define IO_H 3 4 #include <os9/const.h> 5 6 #define SEEK_SET 0 7 #define SEEK_CUR 1 8 #define SEEK_END 2 9 10 enum devflags { 11 O_READ = 1 << 0, 12 O_WRITE = 1 << 1, 13 O_RDWR = 1 << 2, 14 O_BIND = 1 << 3, 15 O_DIR = 1 << 4, 16 O_STAT = 1 << 5, 17 }; 18 19 struct dirent { 20 char d_name[NAMELEN]; 21 }; 22 23 typedef struct { 24 int fd; 25 unsigned char buf[DIRLEN]; 26 } DIR; 27 28 extern DIR *opendir(char *name); 29 extern int readdir(DIR *dir, struct dirent *ent); 30 extern int closedir(DIR *dir); 31 32 /* driver functions */ 33 extern int mount(char *srv, char *mnt, char *spec); 34 extern int create(char *name, int flags); 35 extern int open(char *name, int flags); 36 extern int close(int fd); 37 extern int read(int fd, void *buf, int n); 38 extern int write(int fd, void *buf, int n); 39 extern int seek(int fd, long off, int whence); 40 extern int bind(char *path, char *where); 41 extern int stat(char *path, void *buf, int n); 42 extern int fsync(int fd); 43 extern void sync(void); 44 45 #endif /* IO_H */