修复一些bug

This commit is contained in:
zhangzheng
2023-09-29 01:03:19 +08:00
parent 92dba05d2f
commit 57cd64e1a8
33 changed files with 484 additions and 222 deletions

View File

@@ -59,119 +59,10 @@ RPC_GENERATION_CALL2(ns_t, NS_REGISTER_OP, register,
rpc_ref_array_uint32_t_uint8_t_32_t, rpc_array_uint32_t_uint8_t_32_t, RPC_DIR_IN, RPC_TYPE_DATA, path,
rpc_obj_handler_t_t, rpc_obj_handler_t_t, RPC_DIR_IN, RPC_TYPE_BUF, svr_hd)
// RPC_GENERATION_CALL2(ns_t, NS_QUERY_OP, query,
// rpc_ref_array_uint32_t_uint8_t_32_t, rpc_array_uint32_t_uint8_t_32_t, RPC_DIR_IN, RPC_TYPE_DATA, path,
// rpc_obj_handler_t_t, rpc_obj_handler_t_t, RPC_DIR_INOUT, RPC_TYPE_BUF, cli_hd)
msg_tag_t ns_t_query_call(obj_handler_t hd, rpc_ref_array_uint32_t_uint8_t_32_t *var0, rpc_obj_handler_t_t *var1)
{
void *buf;
ipc_msg_t *msg_ipc;
thread_msg_buf_get(2, (umword_t *)(&buf), ((void *)0));
msg_ipc = (ipc_msg_t *)buf;
int off = 0;
int off_buf = 0;
int ret = -1;
size_t op_val = ((uint16_t)1);
rpc_memcpy(msg_ipc->msg_buf, &op_val, sizeof(op_val));
off += rpc_align(sizeof(op_val), __alignof(((uint16_t)1)));
do
{
if (1 == 1)
{
if (1 == 1 || 1 == 4)
{
int ret = rpc_cli_msg_to_buf_rpc_ref_array_uint32_t_uint8_t_32_t(var0, (uint8_t *)((uint8_t *)msg_ipc->msg_buf), off);
if (ret < 0)
{
return ((msg_tag_t){.flags = (0), .msg_buf_len = (0), .map_buf_len = (0), .prot = (ret)});
}
off = ret;
}
}
} while (0);
do
{
if (1 == 2)
{
if (1 == 1 || 1 == 4)
{
int ret = rpc_cli_msg_to_buf_rpc_ref_array_uint32_t_uint8_t_32_t(var0, (uint8_t *)((uint8_t *)msg_ipc->map_buf), off_buf);
if (ret < 0)
{
return ((msg_tag_t){.flags = (0), .msg_buf_len = (0), .map_buf_len = (0), .prot = (ret)});
}
off_buf = ret;
}
}
} while (0);
do
{
if (2 == 1)
{
if (4 == 1 || 4 == 4)
{
int ret = rpc_cli_msg_to_buf_rpc_obj_handler_t_t(var1, (uint8_t *)((uint8_t *)msg_ipc->msg_buf), off);
if (ret < 0)
{
return ((msg_tag_t){.flags = (0), .msg_buf_len = (0), .map_buf_len = (0), .prot = (ret)});
}
off = ret;
}
}
} while (0);
do
{
if (2 == 2)
{
if (4 == 1 || 4 == 4)
{
int ret = rpc_cli_msg_to_buf_rpc_obj_handler_t_t(var1, (uint8_t *)((uint8_t *)msg_ipc->map_buf), off_buf);
if (ret < 0)
{
return ((msg_tag_t){.flags = (0), .msg_buf_len = (0), .map_buf_len = (0), .prot = (ret)});
}
off_buf = ret;
}
}
} while (0);
msg_tag_t tag = ipc_call(hd, ((msg_tag_t){.flags = (0), .msg_buf_len = ((((off) / ((sizeof(void *)))) + (((off) % ((sizeof(void *)))) ? 1 : 0))), .map_buf_len = (0), .prot = (0)}), ipc_timeout_create2(0, 0));
if (((int16_t)((tag).prot)) < 0)
{
return tag;
}
off = 0;
do
{
if (1 == 1)
{
if (1 == 2 || 1 == 4)
{
int ret = rpc_cli_buf_to_msg_rpc_ref_array_uint32_t_uint8_t_32_t(var0, (uint8_t *)((uint8_t *)msg_ipc->msg_buf), off, tag.msg_buf_len * (sizeof(void *)));
if (ret < 0)
{
return ((msg_tag_t){.flags = (0), .msg_buf_len = (0), .map_buf_len = (0), .prot = (ret)});
}
off = ret;
}
}
} while (0);
do
{
if (2 == 1)
{
if (4 == 2 || 4 == 4)
{
int ret = rpc_cli_buf_to_msg_rpc_obj_handler_t_t(var1, (uint8_t *)((uint8_t *)msg_ipc->msg_buf), off, tag.msg_buf_len * (sizeof(void *)));
if (ret < 0)
{
return ((msg_tag_t){.flags = (0), .msg_buf_len = (0), .map_buf_len = (0), .prot = (ret)});
}
off = ret;
}
}
} while (0);
return tag;
}
RPC_GENERATION_CALL2(ns_t, NS_QUERY_OP, query,
rpc_ref_array_uint32_t_uint8_t_32_t, rpc_array_uint32_t_uint8_t_32_t, RPC_DIR_IN, RPC_TYPE_DATA, path,
rpc_obj_handler_t_t, rpc_obj_handler_t_t, RPC_DIR_INOUT, RPC_TYPE_BUF, cli_hd)
int ns_register(const char *path, obj_handler_t svr_hd)
{
assert(path);

View File

@@ -15,11 +15,11 @@ RPC_GENERATION_OP2(ns_t, NS_REGISTER_OP, register,
int ret = namespace_register((char *)(path->data), obj->hd);
if (ret >= 0)
{
printf("注册服务[%s]成功.\n", (char *)(path->data));
printf("register [%s] success.\n", (char *)(path->data));
}
else
{
printf("注册服务[%s]失败.\n", (char *)(path->data));
printf("register [%s] fail.\n", (char *)(path->data));
}
return ret;
}

View File

@@ -29,12 +29,12 @@ int main(int argc, char *args[])
printf_test();
thread_test();
thread_exit_test();
ipc_test();
map_test();
ipc_timeout_test();
mm_test();
app_test();
#endif
ipc_test();
uenv_t env = *u_get_global_env();
obj_handler_t ipc_hd;
int ret = rpc_creaite_bind_ipc(THREAD_MAIN, NULL, &ipc_hd);
@@ -47,14 +47,14 @@ int main(int argc, char *args[])
// printf("app load fail, 0x%x\n", ret);
// }
ret = app_load("app", &env);
if (ret < 0)
{
printf("app load fail, 0x%x\n", ret);
}
namespace_init(ipc_hd);
// ret = app_load("app", &env);
// if (ret < 0)
// {
// printf("app load fail, 0x%x\n", ret);
// }
// namespace_init(ipc_hd);
namespace_loop();
// namespace_loop();
task_unmap(TASK_THIS, vpage_create_raw3(KOBJ_DELETE_RIGHT, 0, TASK_THIS)); // 删除当前task以及申请得所有对象
printf("exit init.\n");
return 0;