2026-02-19 19:13:44 +00:00
|
|
|
#ifndef KERNEL_CHANNEL_H_
|
|
|
|
|
#define KERNEL_CHANNEL_H_
|
|
|
|
|
|
|
|
|
|
#include <kernel/object.h>
|
|
|
|
|
#include <kernel/sched.h>
|
|
|
|
|
|
2026-02-26 20:50:34 +00:00
|
|
|
struct msg;
|
2026-02-19 19:13:44 +00:00
|
|
|
|
|
|
|
|
struct channel {
|
|
|
|
|
struct object c_base;
|
|
|
|
|
unsigned int c_id;
|
|
|
|
|
struct waitqueue c_wq;
|
|
|
|
|
struct btree c_msg;
|
|
|
|
|
struct btree_node c_node;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
extern kern_status_t channel_type_init(void);
|
2026-02-21 11:32:57 +00:00
|
|
|
extern struct channel *channel_cast(struct object *obj);
|
2026-02-19 19:13:44 +00:00
|
|
|
|
|
|
|
|
extern struct channel *channel_create(void);
|
|
|
|
|
|
|
|
|
|
extern kern_status_t channel_enqueue_msg(
|
|
|
|
|
struct channel *channel,
|
2026-02-26 20:50:34 +00:00
|
|
|
struct msg *msg);
|
2026-02-19 19:13:44 +00:00
|
|
|
|
|
|
|
|
extern kern_status_t channel_recv_msg(
|
|
|
|
|
struct channel *channel,
|
2026-03-01 19:10:01 +00:00
|
|
|
kern_msg_t *out_msg,
|
2026-02-19 19:13:44 +00:00
|
|
|
unsigned long *irq_flags);
|
|
|
|
|
extern kern_status_t channel_reply_msg(
|
|
|
|
|
struct channel *channel,
|
|
|
|
|
msgid_t id,
|
2026-03-01 19:10:01 +00:00
|
|
|
const kern_msg_t *reply,
|
2026-02-19 19:13:44 +00:00
|
|
|
unsigned long *irq_flags);
|
|
|
|
|
|
|
|
|
|
extern kern_status_t channel_read_msg(
|
|
|
|
|
struct channel *channel,
|
|
|
|
|
msgid_t msg,
|
|
|
|
|
size_t offset,
|
2026-02-23 21:51:59 +00:00
|
|
|
struct vm_region *dest_region,
|
2026-03-01 19:10:01 +00:00
|
|
|
const kern_iovec_t *dest_iov,
|
2026-02-23 21:51:59 +00:00
|
|
|
size_t dest_iov_count,
|
2026-02-19 19:13:44 +00:00
|
|
|
size_t *nr_read);
|
|
|
|
|
extern kern_status_t channel_write_msg(
|
|
|
|
|
struct channel *channel,
|
|
|
|
|
msgid_t msg,
|
|
|
|
|
size_t offset,
|
2026-02-23 21:51:59 +00:00
|
|
|
struct vm_region *src_region,
|
2026-03-01 19:10:01 +00:00
|
|
|
const kern_iovec_t *src_iov,
|
2026-02-23 21:51:59 +00:00
|
|
|
size_t src_iov_count,
|
2026-02-19 19:13:44 +00:00
|
|
|
size_t *nr_written);
|
|
|
|
|
|
|
|
|
|
DEFINE_OBJECT_LOCK_FUNCTION(channel, c_base)
|
|
|
|
|
|
|
|
|
|
#endif
|