From 1e6748b4fcabf56c632c35b9bb38657cf3d328bc Mon Sep 17 00:00:00 2001 From: Max Wash Date: Thu, 19 Feb 2026 19:29:17 +0000 Subject: [PATCH] lib: add libmsg* ipc protocol libraries --- lib/libmsg-fs/CMakeLists.txt | 21 ++++++++++++++++++++ lib/libmsg-fs/fs.c | 3 +++ lib/libmsg-fs/include/rosetta/msg/fs.h | 27 ++++++++++++++++++++++++++ lib/libmsg-ld/CMakeLists.txt | 21 ++++++++++++++++++++ lib/libmsg-ld/include/rosetta/msg/ld.h | 26 +++++++++++++++++++++++++ lib/libmsg-ld/ld.c | 3 +++ lib/libmsg/CMakeLists.txt | 21 ++++++++++++++++++++ lib/libmsg/include/rosetta/msg.h | 15 ++++++++++++++ lib/libmsg/msg.c | 3 +++ 9 files changed, 140 insertions(+) create mode 100644 lib/libmsg-fs/CMakeLists.txt create mode 100644 lib/libmsg-fs/fs.c create mode 100644 lib/libmsg-fs/include/rosetta/msg/fs.h create mode 100644 lib/libmsg-ld/CMakeLists.txt create mode 100644 lib/libmsg-ld/include/rosetta/msg/ld.h create mode 100644 lib/libmsg-ld/ld.c create mode 100644 lib/libmsg/CMakeLists.txt create mode 100644 lib/libmsg/include/rosetta/msg.h create mode 100644 lib/libmsg/msg.c diff --git a/lib/libmsg-fs/CMakeLists.txt b/lib/libmsg-fs/CMakeLists.txt new file mode 100644 index 0000000..abcbea3 --- /dev/null +++ b/lib/libmsg-fs/CMakeLists.txt @@ -0,0 +1,21 @@ +file(GLOB sources + ${CMAKE_CURRENT_SOURCE_DIR}/*.c) +file(GLOB headers + ${CMAKE_CURRENT_SOURCE_DIR}/include/rosetta/msg/fs.h + ${CMAKE_CURRENT_SOURCE_DIR}/*.h) + +set(public_include_dirs + ${CMAKE_CURRENT_SOURCE_DIR}/include) + +rosetta_add_library( + NAME libmsg-fs STATIC + PUBLIC_INCLUDE_DIRS ${public_include_dirs} + SOURCES ${sources} + HEADERS ${headers}) + +sysroot_add_library( + NAME libmsg-fs + HEADER_DIR /usr/include + LIB_DIR /usr/lib) + +target_link_libraries(libmsg-fs libmsg libmango) diff --git a/lib/libmsg-fs/fs.c b/lib/libmsg-fs/fs.c new file mode 100644 index 0000000..e4a0c44 --- /dev/null +++ b/lib/libmsg-fs/fs.c @@ -0,0 +1,3 @@ +void msg_fs_tmp(void) +{ +} diff --git a/lib/libmsg-fs/include/rosetta/msg/fs.h b/lib/libmsg-fs/include/rosetta/msg/fs.h new file mode 100644 index 0000000..b258673 --- /dev/null +++ b/lib/libmsg-fs/include/rosetta/msg/fs.h @@ -0,0 +1,27 @@ +#ifndef ROSETTA_MSG_FS_H_ +#define ROSETTA_MSG_FS_H_ + +#include + +/* rosetta.msg.fs protocol ID */ +#define ROSETTA_MSG_FS 0x01409DD2U + +/* rosetta.msg.fs.open message ID */ +#define ROSETTA_MSG_FS_OPEN 0x7D837778U + +struct rosetta_msg_fs_open { + struct rosetta_msg msg_base; + union { + struct { + uint16_t o_path; + uint16_t o_flags; + } msg_request; + + struct { + int o_err; + uint16_t o_fd_index; + } msg_response; + }; +}; + +#endif diff --git a/lib/libmsg-ld/CMakeLists.txt b/lib/libmsg-ld/CMakeLists.txt new file mode 100644 index 0000000..f34af92 --- /dev/null +++ b/lib/libmsg-ld/CMakeLists.txt @@ -0,0 +1,21 @@ +file(GLOB sources + ${CMAKE_CURRENT_SOURCE_DIR}/*.c) +file(GLOB headers + ${CMAKE_CURRENT_SOURCE_DIR}/include/rosetta/msg/ld.h + ${CMAKE_CURRENT_SOURCE_DIR}/*.h) + +set(public_include_dirs + ${CMAKE_CURRENT_SOURCE_DIR}/include) + +rosetta_add_library( + NAME libmsg-ld STATIC + PUBLIC_INCLUDE_DIRS ${public_include_dirs} + SOURCES ${sources} + HEADERS ${headers}) + +sysroot_add_library( + NAME libmsg-ld + HEADER_DIR /usr/include + LIB_DIR /usr/lib) + +target_link_libraries(libmsg-ld libmsg libmango) diff --git a/lib/libmsg-ld/include/rosetta/msg/ld.h b/lib/libmsg-ld/include/rosetta/msg/ld.h new file mode 100644 index 0000000..35ac104 --- /dev/null +++ b/lib/libmsg-ld/include/rosetta/msg/ld.h @@ -0,0 +1,26 @@ +#ifndef ROSETTA_MSG_LD_H_ +#define ROSETTA_MSG_LD_H_ + +#include + +/* rosetta.msg.ld protocol ID */ +#define ROSETTA_MSG_LD 0x5563D896U + +/* rosetta.msg.ld.get-object message ID */ +#define ROSETTA_MSG_LD_GET_OBJECT 1 + +struct rosetta_msg_ld_get_object { + struct rosetta_msg msg_base; + union { + struct { + uint16_t go_object_name; + } msg_request; + + struct { + int go_err; + uint16_t go_object_index; + } msg_response; + }; +}; + +#endif diff --git a/lib/libmsg-ld/ld.c b/lib/libmsg-ld/ld.c new file mode 100644 index 0000000..ef53832 --- /dev/null +++ b/lib/libmsg-ld/ld.c @@ -0,0 +1,3 @@ +void msg_ld_tmp(void) +{ +} diff --git a/lib/libmsg/CMakeLists.txt b/lib/libmsg/CMakeLists.txt new file mode 100644 index 0000000..e17787b --- /dev/null +++ b/lib/libmsg/CMakeLists.txt @@ -0,0 +1,21 @@ +file(GLOB sources + ${CMAKE_CURRENT_SOURCE_DIR}/*.c) +file(GLOB headers + ${CMAKE_CURRENT_SOURCE_DIR}/include/rosetta/msg.h + ${CMAKE_CURRENT_SOURCE_DIR}/*.h) + +set(public_include_dirs + ${CMAKE_CURRENT_SOURCE_DIR}/include) + +rosetta_add_library( + NAME libmsg STATIC + PUBLIC_INCLUDE_DIRS ${public_include_dirs} + SOURCES ${sources} + HEADERS ${headers}) + +sysroot_add_library( + NAME libmsg + HEADER_DIR /usr/include + LIB_DIR /usr/lib) + +target_link_libraries(libmsg libmango) diff --git a/lib/libmsg/include/rosetta/msg.h b/lib/libmsg/include/rosetta/msg.h new file mode 100644 index 0000000..80a9e4c --- /dev/null +++ b/lib/libmsg/include/rosetta/msg.h @@ -0,0 +1,15 @@ +#ifndef ROSETTA_MSG_H_ +#define ROSETTA_MSG_H_ + +#define ROSETTA_MSG_MAGIC 0x9AB07D10U + +#include + +struct rosetta_msg { + uint32_t msg_magic; + uint32_t msg_protocol; + uint16_t msg_id; + uint16_t msg_reserved; +}; + +#endif diff --git a/lib/libmsg/msg.c b/lib/libmsg/msg.c new file mode 100644 index 0000000..418fc0f --- /dev/null +++ b/lib/libmsg/msg.c @@ -0,0 +1,3 @@ +void msg_tmp(void) +{ +}