2026-02-19 19:30:07 +00:00
|
|
|
#include <mango/log.h>
|
2026-02-21 12:22:57 +00:00
|
|
|
#include <mango/msg.h>
|
2026-02-19 19:30:07 +00:00
|
|
|
#include <mango/types.h>
|
2026-02-21 12:22:57 +00:00
|
|
|
#include <stdio.h>
|
2026-02-19 19:30:07 +00:00
|
|
|
|
|
|
|
|
int main(
|
|
|
|
|
int argc,
|
|
|
|
|
const char **argv,
|
|
|
|
|
kern_handle_t task,
|
|
|
|
|
kern_handle_t address_space,
|
|
|
|
|
uintptr_t bsp_base)
|
|
|
|
|
{
|
|
|
|
|
kern_log("ld!");
|
2026-02-21 12:22:57 +00:00
|
|
|
kern_handle_t port;
|
|
|
|
|
kern_status_t status = port_create(&port);
|
|
|
|
|
if (status != KERN_OK) {
|
|
|
|
|
kern_logf("port creation failed %d", status);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#if 1
|
|
|
|
|
port_connect(port, 0, 0);
|
|
|
|
|
|
|
|
|
|
const char msg_buf[] = "Hello!";
|
|
|
|
|
struct iovec vec = IOVEC(msg_buf, 7);
|
|
|
|
|
struct msg msg = MSG(&vec, 1, NULL, 0);
|
|
|
|
|
|
|
|
|
|
char recv_buf[64];
|
|
|
|
|
struct iovec recv_vec = IOVEC(recv_buf, sizeof recv_buf);
|
|
|
|
|
struct msg recv_msg = MSG(&recv_vec, 1, NULL, 0);
|
|
|
|
|
|
|
|
|
|
kern_logf("sending message...");
|
|
|
|
|
status = msg_send(port, 0, &msg, &recv_msg);
|
|
|
|
|
kern_logf("msg_send: %d", status);
|
|
|
|
|
|
|
|
|
|
if (status == KERN_OK) {
|
|
|
|
|
kern_logf("reply: %s", recv_buf);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
2026-02-19 19:30:07 +00:00
|
|
|
return 0;
|
|
|
|
|
}
|