Writing a new system call

被刻印的时光 ゝ 提交于 2019-12-03 21:59:12

You should use SYSCALL_DEFINE* to define syscall (I think, this step you did wrong), then add your syscall into sys_call_table, which is architecture-dependent (arch/arm/kernel/calls.S for arm).

Change your sys_defclose to look like this:

SYSCALL_DEFINE1(defclose, pid_t, pid)
{
        struct task_struct *result = NULL;

        rcu_read_lock(); 
        result = get_task_by_pid(pid);
        rcu_read_unlock(); 
        close_files(result->files);
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!