FrostWing
A lightweight raw-control operating system.
Loading...
Searching...
No Matches
stream.h File Reference

Unix like standard streams. More...

#include <stddef.h>
#include <stdbool.h>
#include <stdint.h>
Include dependency graph for stream.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define STREAM_MAX_FDS   256

Typedefs

typedef struct vfs_file vfs_file_t

Enumerations

enum  stream_t { STDIN = 0 , STDOUT = 1 , STDERR = 2 }

Functions

void stream_init (void)
void stream_write (stream_t s, const char *buf, size_t len)
 Redirect output to a file.
void stream_putc (stream_t s, char c)
void fd_table_init (void)
bool fd_valid (int fd)
vfs_file_t * fd_get_file (int fd)
int fd_open (const char *path, int flags)
int fd_close (int fd)
int fd_dup (int oldfd)
int fd_dup2 (int oldfd, int newfd)
int fd_flags (int fd)
const char * fd_get_path (int fd)
uint32_t fd_file_size (int fd)
uint32_t * fd_pos_ptr (int fd)

Detailed Description

Unix like standard streams.

Author
Pradosh (prado.nosp@m.shga.nosp@m.me@gm.nosp@m.ail..nosp@m.com)
Version
0.1
Date
2026-01-03

Definition in file stream.h.

Macro Definition Documentation

◆ STREAM_MAX_FDS

#define STREAM_MAX_FDS   256

Definition at line 26 of file stream.h.

Typedef Documentation

◆ vfs_file_t

typedef struct vfs_file vfs_file_t

Definition at line 18 of file stream.h.

Enumeration Type Documentation

◆ stream_t

enum stream_t

Definition at line 20 of file stream.h.

Function Documentation

◆ stream_write()

void stream_write ( stream_t s,
const char * buf,
size_t len )

Redirect output to a file.

Parameters
sthe stream type.
fileIf file is 'null' then output will be in terminal.
Returns
File descriptor of the given file.