我正在为充当 FIFO 设备的 debian 6 内核编写设备驱动程序模块,编译显然是正确的,我使用以下代码创建它:
Major = register_chrdev(0, DEVICE_NAME, &fops); //Major is an integer value
if (Major < 0) {
printk(KERN_ALERT "Registering char device failed with %d\n", Major);
return -Major;
}
/*
* Creation of buffer;
*/
if( (buf = create_cbuffer_t(MAX_BUFFER_SIZE)) == NULL){
printk(KERN_ALERT "Error when creating the FIFO device.");
return -EINVAL;
}
printk(KERN_INFO "Buffer created without error.\n");
Run Code Online (Sandbox Code Playgroud)
分配的主要数字是 251,我使用这个创建它的文件:
sudo mknod /dev/fifodev c 251 0
Run Code Online (Sandbox Code Playgroud)
它工作正常,但是当我尝试在终端中访问时,结果是
dsouser@debian:~/Escritorio/Prac3/ParteB$ echo whatever > /dev/fifodev
bash: /dev/fifodev: Permiso denegado **This means:Permission denied** …Run Code Online (Sandbox Code Playgroud) 所以,我正在编写这个驱动程序,它通过"写入"收到一个"命令",它应该调用fork,让孩子在父母去世时完成工作.
当我编译它时输出就是这个.
victor@victor-desktop:~/Área de Trabalho/mc504-linux/linux-3.17.2$ make -j 5 ARCH=i386
CHK include/config/kernel.release
CHK include/generated/uapi/linux/version.h
CHK include/generated/utsrelease.h
CALL scripts/checksyscalls.sh
CHK include/generated/compile.h
CC [M] drivers/ofd/ofcd-lastchar.o
drivers/ofd/ofcd-lastchar.c: In function ‘my_read’:
drivers/ofd/ofcd-lastchar.c:36:5: error: implicit declaration of function ‘fork’ [-Werror=implicit-function-declaration
child_pid = fork();
^
cc1: some warnings being treated as errors
scripts/Makefile.build:263: recipe for target 'drivers/ofd/ofcd-lastchar.o' failed
make[2]: *** [drivers/ofd/ofcd-lastchar.o] Error 1
scripts/Makefile.build:404: recipe for target 'drivers/ofd' failed
make[1]: *** [drivers/ofd] Error 2
Makefile:929: recipe for target 'drivers' failed
make: *** [drivers] Error 2
Run Code Online (Sandbox Code Playgroud)
我正在使用从这里 …
PIPES是单向的,可以在通信中同步或异步.
但是如何在一个进程上创建一个双向命名管道,在另一个进程上创建另一个端点,这两个进程共享同一个内存,并且存在于同一操作系统中并异步通信.
有办法吗?
我对Linux非常熟悉(我已经使用它2年了,1年没用Windows了),我终于深入研究了内核编程,我正在开发一个项目.所以我的问题是:
我试图了解Linux中的中断延迟是否取决于内核滴答(计时器)。
中断等待时间是从生成中断到处理中断源(代码)所经过的时间。
我已经按照http://www.tldp.org/LDP/tlk/dd/interrupts.html中的说明进行了操作,该说明 将机制与“实时时钟”刻度相关。
因此,说中断等待时间取决于定时器滴答(CONFIG_HZ)是否正确,即较高的滴答值将导致较小的中断等待时间?
如果我想在用C编写的Windows NT内核驱动程序中使用正则表达式匹配,我有哪些选择?
我不认为Microsoft Windows有一个现成的API,但如果我错了,请纠正我.我假设我需要使用外部库或在C中编写自己的解析器.
这是一个商业项目,所以GPL开源不是一个选择.
谢谢,
我遇到了以下问题.更新Anaconda之后,因为我将一个错误导入skimage.io到Jupyter Notebook中的项目时出现了更大的错误 - 死内核.现在我无法启动项目,因为Jupyter给出以下错误:
Copy/paste this URL into your browser when you connect for the first time,
to login with a token:
http://localhost:8888/?
token=aaf85a5e18489792c87cce65d7a53a0263cd5c08cc7248b 6
[I 00:55:13.451 NotebookApp] Accepting one-time-token-authenticated
connection from ::1
[I 00:55:31.607 NotebookApp] Kernel started: 608d2190-59e6-4888-b09a-
e616f67bd5b4
Traceback (most recent call last):
ERROR:tornado.general:Uncaught exception in ZMQStream callback
Traceback (most recent call last):
File "C:\Program Files\Anaconda3\lib\site-
packages\zmq\eventloop\zmqstream.py", line 432, in _run_callback
callback(*args, **kwargs)
File "C:\Program Files\Anaconda3\lib\site-
packages\tornado\stack_context.py", line 276, in null_wrapper
return fn(*args, **kwargs)
File "C:\Program Files\Anaconda3\lib\site-packages\ipykernel\kernelbase.py",
line …Run Code Online (Sandbox Code Playgroud) 我读过,例如Linux的某些部分是汇编,我猜他们会在汇编中编写,以加快执行速度
但是,现代内核开发人员在需要时实际上直接在汇编中编写,或者他们使用高级语言编写并使用编译器将其转换为汇编,并且他们使用转换后的汇编代码?
哪一个更好?考虑到编译器也有代码优化,是不是将高级转换为汇编更高效?我真的需要在汇编中编写内核的哪些部分?
由于'fd'没有返回,它后来如何读/写?
例如:
void init(void)
{
....
(void) open("/dev/tty1",O_RDWR,0);
....
Run Code Online (Sandbox Code Playgroud) 我想知道如何bcmrpi使用Buildroot的ncurses接口来构建自定义内核defconfig(基于标准defconfig作为起点)。
目前,我已经Kernel configuration -> Using an in-tree defconfig file在Buildroot菜单配置中选择,bcmrpi作为Defconfig name。
我曾尝试使用make对内核进行一些更改,linux-menuconfig但是当我尝试使用make clean更改进行编译时,这些更改不会生成,并且当我linux-menuconfig随后检查它们是否已重置为bcmrpi设置时。
我想从这些默认设置中更改一些设置,然后将生成的设置保存到新的defconfig中,类似于Buildroot的用法make savedefconfig,但用于内核。我使用什么命令?