FrostWing
A lightweight raw-control operating system.
Loading...
Searching...
No Matches
stream.h
Go to the documentation of this file.
1
11#ifndef STREAM_H
12#define STREAM_H
13
14#include <stddef.h>
15#include <stdbool.h>
16#include <stdint.h>
17
18typedef struct vfs_file vfs_file_t;
19
20typedef enum {
21 STDIN = 0,
22 STDOUT = 1,
23 STDERR = 2
24} stream_t;
25
26#define STREAM_MAX_FDS 256
27
28void stream_init(void);
29
38// int stream_set_file(stream_t s, vfs_file_t* file);
39// vfs_file_t* stream_get_file(stream_t s);
40
41
42void stream_write(stream_t s, const char* buf, size_t len);
43
44
45void stream_putc(stream_t s, char c);
46
47void fd_table_init(void);
48bool fd_valid(int fd);
49vfs_file_t* fd_get_file(int fd);
50int fd_open(const char* path, int flags);
51int fd_close(int fd);
52int fd_dup(int oldfd);
53int fd_dup2(int oldfd, int newfd);
54int fd_flags(int fd);
55const char* fd_get_path(int fd);
56uint32_t fd_file_size(int fd);
57uint32_t* fd_pos_ptr(int fd);
58
59#endif
void stream_write(stream_t s, const char *buf, size_t len)
Redirect output to a file.