proc文件系统支持

This commit is contained in:
zhangzheng
2025-03-31 21:35:14 +08:00
parent be26567cfc
commit 6541993082
29 changed files with 1847 additions and 14 deletions

View File

@@ -41,6 +41,7 @@ enum task_op_code
TASK_GET_PID, //!< 获取task的pid
TASK_COPY_DATA, //!< 拷贝数据到task的数据区域
TASK_SET_OBJ_NAME, //!< 设置对象的名字
TASK_GET_OBJ_NAME, //!< 获取对象的名字
TASK_COPY_DATA_TO, //!< 从当前task拷贝数据到目的task
TASK_SET_COM_POINT, //!< 通信点
TASK_COM_UNLOCK, //!< 任务通信解锁
@@ -232,6 +233,29 @@ static void task_syscall_func(kobject_t *kobj, syscall_prot_t sys_p, msg_tag_t i
switch (sys_p.op)
{
case TASK_GET_OBJ_NAME:
{
mword_t status = spinlock_lock(&tag_task->kobj.lock);
if (status < 0)
{
tag = msg_tag_init4(0, 0, 0, -EINVAL);
break;
}
kobject_t *source_kobj = obj_space_lookup_kobj(&cur_task->obj_space, f->regs[0]);
if (!source_kobj)
{
spinlock_set(&tag_task->kobj.lock, status);
tag = msg_tag_init4(0, 0, 0, -EINVAL);
break;
}
char *kobj_name = kobject_get_name(source_kobj);
memcpy((char *)(&f->regs[1]), kobj_name, KOBJ_NAME_SIZE);
spinlock_set(&tag_task->kobj.lock, status);
tag = msg_tag_init4(0, 0, 0, 1);
}
break;
case TASK_SET_OBJ_NAME:
{
mword_t status = spinlock_lock(&tag_task->kobj.lock);