30 lines
902 B
C
30 lines
902 B
C
// This file is part of noxos and licensed under the MIT open source license
|
|
|
|
#ifndef NOXOS_PIPE_H
|
|
#define NOXOS_PIPE_H
|
|
|
|
#ifndef NOX_PROCESS
|
|
typedef struct process_T process_T;
|
|
#endif
|
|
|
|
#include "utils/stream.h"
|
|
#include "utils/bitmap.h"
|
|
|
|
#define PIPE_MAX_SENDERS 8
|
|
#define PIPE_STD_STREAM_SIZE 0x1000
|
|
|
|
typedef struct {
|
|
stream_T* stream;
|
|
process_T* receiver;
|
|
process_T* senders [PIPE_MAX_SENDERS];
|
|
bitmap_T senders_bitmap;
|
|
} pipe_T;
|
|
|
|
void pipe_init (pipe_T* pipe, process_T* receiver);
|
|
void pipe_destruct (pipe_T* pipe);
|
|
bool pipe_add_sender (pipe_T* pipe, process_T* sender);
|
|
void pipe_remove_sender (pipe_T* pipe, process_T* sender);
|
|
uint64_t pipe_write (pipe_T* pipe, void* buffer_in, uint64_t n);
|
|
uint64_t pipe_read (pipe_T* pipe, void* buffer_out, uint64_t n);
|
|
|
|
#endif //NOXOS_PIPE_H
|