diff --git a/src/impls/impl-skift/entry.cpp b/src/impls/impl-skift/entry.cpp index beb3f66151..d4b0455602 100644 --- a/src/impls/impl-skift/entry.cpp +++ b/src/impls/impl-skift/entry.cpp @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include "fd.h" diff --git a/src/libs/karm-sys/ipc.h b/src/libs/karm-sys/rpc.h similarity index 88% rename from src/libs/karm-sys/ipc.h rename to src/libs/karm-sys/rpc.h index 882de3b040..15da5b5efd 100644 --- a/src/libs/karm-sys/ipc.h +++ b/src/libs/karm-sys/rpc.h @@ -148,15 +148,15 @@ struct Message { // MARK: Primitive Operations -------------------------------------------------- template -Res<> ipcSend(Sys::IpcConnection &con, Port to, u64 seq, Args &&...args) { +Res<> rpcSend(Sys::IpcConnection &con, Port to, u64 seq, Args &&...args) { Message msg = Message::packReq(to, seq, std::forward(args)...).take(); - logDebug("ipcSend : {}, len: {}", msg.header(), msg.len()); + logDebug("rpcSend : {}, len: {}", msg.header(), msg.len()); try$(con.send(msg.bytes(), msg.handles())); return Ok(); } -static inline Async::Task ipcRecvAsync(Sys::IpcConnection &con) { +static inline Async::Task rpcRecvAsync(Sys::IpcConnection &con) { Message msg; auto [bufLen, hndsLen] = co_trya$(con.recvAsync(msg._buf, msg._hnds)); if (bufLen < sizeof(Header)) @@ -164,26 +164,26 @@ static inline Async::Task ipcRecvAsync(Sys::IpcConnection &con) { msg._len = bufLen; msg._hndsLen = hndsLen; - logDebug("ipcRecv: {}, len: {}", msg.header(), msg.len()); + logDebug("rpcRecv: {}, len: {}", msg.header(), msg.len()); co_return msg; } -// MARK: Ipc ------------------------------------------------------------------- +// MARK: Rpc ------------------------------------------------------------------- -struct Ipc { +struct Rpc { Sys::IpcConnection _con; bool _receiving = false; Map> _pending{}; u64 _seq = 1; - static Ipc create(Sys::Context &ctx) { + static Rpc create(Sys::Context &ctx) { auto &channel = useChannel(ctx); - return Ipc{std::move(channel.con)}; + return Rpc{std::move(channel.con)}; } template Res<> send(Port port, Args &&...args) { - return ipcSend(_con, port, _seq++, std::forward(args)...); + return rpcSend(_con, port, _seq++, std::forward(args)...); } Async::Task recvAsync() { @@ -196,7 +196,7 @@ struct Ipc { }}; while (true) { - Message msg = co_trya$(ipcRecvAsync(_con)); + Message msg = co_trya$(rpcRecvAsync(_con)); auto header = msg._header; @@ -214,8 +214,8 @@ struct Ipc { Res<> resp(Message &msg, Res message) { auto header = msg._header; if (not message) - return ipcSend(_con, header.from, header.seq, message.none()); - return ipcSend(_con, header.from, header.seq, message.take()); + return rpcSend(_con, header.from, header.seq, message.none()); + return rpcSend(_con, header.from, header.seq, message.take()); } template @@ -226,7 +226,7 @@ struct Ipc { _pending.put(seq, std::move(promise)); - co_try$(ipcSend(_con, port, seq, std::forward(args)...)); + co_try$(rpcSend(_con, port, seq, std::forward(args)...)); Message msg = co_await future; diff --git a/src/srvs/grund-av/main.cpp b/src/srvs/grund-av/main.cpp index 8bd70a9030..025e6049bb 100644 --- a/src/srvs/grund-av/main.cpp +++ b/src/srvs/grund-av/main.cpp @@ -1,14 +1,14 @@ #include -#include +#include namespace Grund::Av { Async::Task<> serv(Sys::Context &ctx) { - Sys::Ipc ipc = Sys::Ipc::create(ctx); + Sys::Rpc rpc = Sys::Rpc::create(ctx); logInfo("service started"); while (true) { - co_trya$(ipc.recvAsync()); + co_trya$(rpc.recvAsync()); logDebug("received message from system"); } } diff --git a/src/srvs/grund-bus/api.h b/src/srvs/grund-bus/api.h index 5cf134ef84..e9d29f2ef2 100644 --- a/src/srvs/grund-bus/api.h +++ b/src/srvs/grund-bus/api.h @@ -1,7 +1,7 @@ #pragma once #include -#include +#include namespace Grund::Bus { diff --git a/src/srvs/grund-bus/bus.cpp b/src/srvs/grund-bus/bus.cpp index f80c708091..89659290a4 100644 --- a/src/srvs/grund-bus/bus.cpp +++ b/src/srvs/grund-bus/bus.cpp @@ -115,13 +115,13 @@ Res<> Service::activate(Sys::Context &ctx) { Async::Task<> Service::runAsync() { while (true) { - auto msg = co_trya$(Sys::ipcRecvAsync(_con)); + auto msg = co_trya$(Sys::rpcRecvAsync(_con)); logDebug("Received message on service '{}' {}", _id, msg.header()); auto res = dispatch(msg); if (not res) - co_try$(Sys::ipcSend(_con, port(), msg.header().seq, res.none())); + co_try$(Sys::rpcSend(_con, port(), msg.header().seq, res.none())); } } diff --git a/src/srvs/grund-bus/bus.h b/src/srvs/grund-bus/bus.h index a3cee8e4ab..ee8b1b4380 100644 --- a/src/srvs/grund-bus/bus.h +++ b/src/srvs/grund-bus/bus.h @@ -5,7 +5,7 @@ #include #include #include -#include +#include namespace Grund::Bus { diff --git a/src/srvs/grund-conf/main.cpp b/src/srvs/grund-conf/main.cpp index 719f85a727..36dcd071d4 100644 --- a/src/srvs/grund-conf/main.cpp +++ b/src/srvs/grund-conf/main.cpp @@ -1,14 +1,14 @@ #include -#include +#include namespace Grund::Conf { Async::Task<> serv(Sys::Context &ctx) { - Sys::Ipc ipc = Sys::Ipc::create(ctx); + auto rpc = Sys::Rpc::create(ctx); logInfo("service started"); while (true) { - co_trya$(ipc.recvAsync()); + co_trya$(rpc.recvAsync()); logDebug("received message from system"); } } diff --git a/src/srvs/grund-dhcp/main.cpp b/src/srvs/grund-dhcp/main.cpp index 123d3507c1..d245da7f08 100644 --- a/src/srvs/grund-dhcp/main.cpp +++ b/src/srvs/grund-dhcp/main.cpp @@ -1,14 +1,14 @@ #include -#include +#include namespace Grund::Dhcp { Async::Task<> serv(Sys::Context &ctx) { - Sys::Ipc ipc = Sys::Ipc::create(ctx); + auto rpc = Sys::Rpc::create(ctx); logInfo("service started"); while (true) { - co_trya$(ipc.recvAsync()); + co_trya$(rpc.recvAsync()); logDebug("received message from system"); } } diff --git a/src/srvs/grund-dns/main.cpp b/src/srvs/grund-dns/main.cpp index 6e5bc86704..927a5636c2 100644 --- a/src/srvs/grund-dns/main.cpp +++ b/src/srvs/grund-dns/main.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include "../grund-bus/api.h" #include "../grund-echo/api.h" @@ -7,19 +7,19 @@ namespace Grund::Dns { Async::Task<> serv(Sys::Context &ctx) { - Sys::Ipc ipc = Sys::Ipc::create(ctx); + auto rpc = Sys::Rpc::create(ctx); logDebug("sending nonsens to system"); - auto echoPort = co_trya$(ipc.callAsync(Sys::Port::BUS, "grund-echo"s)); + auto echoPort = co_trya$(rpc.callAsync(Sys::Port::BUS, "grund-echo"s)); logDebug("located echo service at port: {}", echoPort); - auto res = co_trya$(ipc.callAsync(echoPort, "nonsens"s)); + auto res = co_trya$(rpc.callAsync(echoPort, "nonsens"s)); logDebug("received response from system: {}", res); logInfo("service started"); while (true) { - co_trya$(ipc.recvAsync()); + co_trya$(rpc.recvAsync()); logDebug("received message from system"); } } diff --git a/src/srvs/grund-echo/main.cpp b/src/srvs/grund-echo/main.cpp index 8abc48b237..09fc75cbe3 100644 --- a/src/srvs/grund-echo/main.cpp +++ b/src/srvs/grund-echo/main.cpp @@ -1,17 +1,17 @@ #include -#include +#include #include "api.h" namespace Grund::Echo { Async::Task<> serv(Sys::Context &ctx) { - Sys::Ipc ipc = Sys::Ipc::create(ctx); + auto rpc = Sys::Rpc::create(ctx); while (true) { - auto msg = co_trya$(ipc.recvAsync()); + auto msg = co_trya$(rpc.recvAsync()); if (msg.is()) { auto req = co_try$(msg.unpack()); - co_try$(ipc.resp(msg, Ok(req.msg))); + co_try$(rpc.resp(msg, Ok(req.msg))); } } diff --git a/src/srvs/grund-fs/main.cpp b/src/srvs/grund-fs/main.cpp index e9974ad71a..3c5982a318 100644 --- a/src/srvs/grund-fs/main.cpp +++ b/src/srvs/grund-fs/main.cpp @@ -1,14 +1,14 @@ #include -#include +#include namespace Grund::Fs { Async::Task<> serv(Sys::Context &ctx) { - Sys::Ipc ipc = Sys::Ipc::create(ctx); + auto rpc = Sys::Rpc::create(ctx); logInfo("service started"); while (true) { - co_trya$(ipc.recvAsync()); + co_trya$(rpc.recvAsync()); logDebug("received message from system"); } } diff --git a/src/srvs/grund-net/main.cpp b/src/srvs/grund-net/main.cpp index 7afab28c32..6826b874c0 100644 --- a/src/srvs/grund-net/main.cpp +++ b/src/srvs/grund-net/main.cpp @@ -1,14 +1,14 @@ #include -#include +#include namespace Grund::Net { Async::Task<> serv(Sys::Context &ctx) { - Sys::Ipc ipc = Sys::Ipc::create(ctx); + auto rpc = Sys::Rpc::create(ctx); logInfo("service started"); while (true) { - co_trya$(ipc.recvAsync()); + co_trya$(rpc.recvAsync()); logDebug("received message from system"); } } diff --git a/src/srvs/grund-seat/main.cpp b/src/srvs/grund-seat/main.cpp index 868993c4e8..5f04d7cea7 100644 --- a/src/srvs/grund-seat/main.cpp +++ b/src/srvs/grund-seat/main.cpp @@ -1,14 +1,14 @@ #include -#include +#include namespace Grund::Seat { Async::Task<> serv(Sys::Context &ctx) { - Sys::Ipc ipc = Sys::Ipc::create(ctx); + auto rpc = Sys::Rpc::create(ctx); logInfo("service started"); while (true) { - co_trya$(ipc.recvAsync()); + co_trya$(rpc.recvAsync()); logDebug("received message from system"); } }