Files
mango/include/kernel/port.h

42 lines
1002 B
C
Raw Normal View History

2026-02-19 19:13:44 +00:00
#ifndef KERNEL_PORT_H_
#define KERNEL_PORT_H_
#include <kernel/object.h>
#include <kernel/sched.h>
enum port_status {
/* port is not connected */
PORT_OFFLINE = 0,
/* port is connected and ready to send messages */
PORT_READY,
/* port has sent a message, and is waiting for the remote to receive it
*/
PORT_SEND_BLOCKED,
/* port has sent a message, and the remote has received it. waiting for
* the remote to reply. */
PORT_REPLY_BLOCKED,
};
struct port {
struct object p_base;
enum port_status p_status;
struct channel *p_remote;
};
extern kern_status_t port_type_init(void);
extern struct port *port_cast(struct object *obj);
extern struct port *port_create(void);
extern kern_status_t port_connect(struct port *port, struct channel *remote);
extern kern_status_t port_disconnect(struct port *port);
2026-02-19 19:13:44 +00:00
extern kern_status_t port_send_msg(
struct port *port,
const struct msg *req,
struct msg *resp,
unsigned long *lock_flags);
2026-02-19 19:13:44 +00:00
DEFINE_OBJECT_LOCK_FUNCTION(port, p_base)
#endif