YAHAL
Yet Another Hardware Abstraction Library
Loading...
Searching...
No Matches
posix_io_interface.h
1// ---------------------------------------------
2// This file is part of
3// _ _ __ _ _ __ __
4// ( \/ ) /__\ ( )_( ) /__\ ( )
5// \ / /(__)\ ) _ ( /(__)\ )(__
6// (__)(__)(__)(_) (_)(__)(__)(____)
7//
8// Yet Another HW Abstraction Library
9// Copyright (C) Andreas Terstegge
10// BSD Licensed (see file LICENSE)
11//
12// ---------------------------------------------
13//
14// This file defines the low-level Posix system
15// calls for file I/O (also STDIN and STDOUT).
16
17#ifndef _POSIX_IO_INTERFACE_H_
18#define _POSIX_IO_INTERFACE_H_
19
20#include "sys/stat.h"
21
23public:
24
25 // Read from file
26 virtual int _read (int file, char *buf, int len) = 0;
27
28 // Write to file
29 virtual int _write (int file, const char *buf, int len) = 0;
30
31 // Open a file
32 virtual int _open (const char *name, int flags, int mode) = 0;
33
34 // Close a file
35 virtual int _close (int file) = 0;
36
37 // Rename a file
38 virtual int _link (char *old_name, char *new_name) = 0;
39
40 // Delete a file
41 virtual int _unlink (char *name) = 0;
42
43 // Status of a file
44 virtual int _stat (char *name, struct stat *st) = 0;
45
46 // Status of open file
47 virtual int _fstat (int file, struct stat *st) = 0;
48
49 // Set file position
50 virtual int _lseek (int file, int offset, int whence) = 0;
51
52 // Check for terminal I/O
53 virtual int _isatty (int file) = 0;
54
55protected:
56 virtual ~posix_io_interface() = default;
57};
58
59#endif // _POSIX_IO_INTERFACE_H_