ld: send fs.open() message to bootstrap
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include <mango/log.h>
|
||||
#include <mango/msg.h>
|
||||
#include <mango/types.h>
|
||||
#include <rosetta/msg/fs.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -35,21 +36,21 @@ int main(
|
||||
#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);
|
||||
const char *path = "/usr/lib/libc.so";
|
||||
int flags = 4;
|
||||
int err = 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("calling open(%s, %d)", path, flags);
|
||||
status = rosetta_msg_fs_open_send(port, path, flags, &err);
|
||||
|
||||
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);
|
||||
if (status != KERN_OK) {
|
||||
kern_logf("open call failed (status %d)", status);
|
||||
} else if (err != 0) {
|
||||
kern_logf("open call returned error %d", err);
|
||||
} else {
|
||||
kern_logf("open call succeeded");
|
||||
}
|
||||
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user