小编sra*_*aok的帖子

__rcu在linux中代表什么?

我是linux内核的新手.我的问题是关于task_struct.我知道每个task_struct都通过指向父进程的指针来引用它的父进程task_struct.

在查看task_struct定义中的sched.h后,我注意到以下内容:

struct task_struct __rcu *real_parent; /* real parent process */
Run Code Online (Sandbox Code Playgroud)

我发现它引用了compiler.h.我猜"__rcu"代表"读取副本更新"

有人可以澄清语法吗?

linux-kernel

10
推荐指数
2
解决办法
3721
查看次数

C中的分段错误

基本上我想获得用户的输入并将其标记化.例如我输入 4 <tab> 5 <tab> 6 我想得到的

4
5
6
Run Code Online (Sandbox Code Playgroud)

但我的代码不起作用;(

#include <stdio.h>
#include <string.h>

int main ()
{
    char str;
    scanf("%c",&str);
    char *p = strtok(str, "\t");
    while(p != NULL) {
        printf("%s\n", p);
        p = strtok(NULL, "\t");
    }
}
Run Code Online (Sandbox Code Playgroud)

c segmentation-fault

-1
推荐指数
1
解决办法
84
查看次数

标签 统计

c ×1

linux-kernel ×1

segmentation-fault ×1