【发布时间】:2020-05-11 16:09:58
【问题描述】:
这是第一次在 Linux 环境中工作。 我需要你的很多帮助。 我想在 shced_setattr 添加 prink() https://elixir.bootlin.com/linux/v4.18/source/kernel/sched/core.c#L4578
SYSCALL_DEFINE3(sched_setattr, pid_t, pid, struct sched_attr __user *, uattr,
unsigned int, flags)
{
printk();
struct sched_attr attr;
struct task_struct *p;
int retval;
if (!uattr || pid < 0 || flags)
return -EINVAL;
retval = sched_copy_attr(uattr, &attr);
if (retval)
return retval;
if ((int)attr.sched_policy < 0)
return -EINVAL;
rcu_read_lock();
retval = -ESRCH;
p = find_process_by_pid(pid);
if (p != NULL)
retval = sched_setattr(p, &attr);
rcu_read_unlock();
return retval;
}
但我不知道如何编辑程序。 如果有人可以解释我为 printk() 函数编辑 linux 函数,那就太好了!
【问题讨论】:
-
它(大部分)像
printf一样工作 - 你有什么具体问题吗? -
您要打印什么?