userspace

Making Kernel Module and registering it as pci device driver and network device driver and accessing the module's buffer using ioctl. Possible?

本小妞迷上赌 提交于 2021-01-29 17:16:50
问题 I like to make a kernel module. And inside it I like to register it as pci and network device driver. And using ioctle from user space to access the module's buffer(in pci and network driver) and getting buffer. The buffer contains packets received in interrupt handler when packet arrives in my kernel module/device driver and the buffer is global in the module. Means it will not be inside interrupt handler for receiving packets. and in ioctl function implementation inside device driver just

How do I compile a userspace application for a particular Linux kernel?

送分小仙女□ 提交于 2020-06-17 14:15:25
问题 I have a Linux kernel source. I am building Linux kernel image from that source. Now, I have a userspace application. How do I compile the userspace application for that particular Linux kernel source? 来源: https://stackoverflow.com/questions/56693772/how-do-i-compile-a-userspace-application-for-a-particular-linux-kernel

How to test from userspace if the kernel supports IPv6?

你。 提交于 2019-12-25 01:14:42
问题 I am seeking for a simple way to test if the kernel supports IPv6 on Linux in C/C++. Is it enough to check if the socket() call fails and that errno is set to EINVAL ? 回答1: Indeed, read ipv6(7): the call to socket(7)-s routines, notably socket(2) and others, e.g. bind(2) etc..., could fail (and you should always handle such failures anyway). You could also use proc(5) e.g. read /proc/net/if_inet6 or /proc/net/sockstat6 (I believe it won't exist if ipv6 is unsupported). 来源: https:/

Can I pass an integer to `access_ok()` as it's second argument?

孤街醉人 提交于 2019-12-12 06:16:51
问题 In LDD3 's example, access_ok() is placed at the beginning of ioctl method of a kernel module to check whether a pointer passed from userspace is valid. It is correct when userspace application calls ioctl() system call, and passes it an address of a variable. In some cases, however, ioctl() system call is invoked with a value instead of a pointer as third argument and finally the second argument of access_ok() in kernel module. I've tried to pass an integer as access_ok() 's second argument