Questions tagged [ioctl]
The ioctl tag has no summary.
53 questions
2
votes
1
answer
262
views
What is holding a file descriptor to this block device aka why didn't losetup -d remove a block device
There's a number of posts about losetup -d /dev/loop0 not removing a lookback device, even though it returned a successful return code. I believe the root cause of those posts is that the block device ...
4
votes
3
answers
827
views
How do I read drive status for a USB attached optical drive?
My long-term backups are written to M-Disc platters (100GB BD-R) through a USB-attached BD-RW drive. This works well, but I would like to be able to check if there is a blank disc inserted in the ...
0
votes
1
answer
160
views
Why does running "amidi -l" produce an error message that says "Inappropriate ioctl for device"?
When I run amidi -l on my Thinkpad X1 Carbon (Generation 5) running Manjaro Linux, instead of no device info appearing in the output (which I'd expect since no MIDI hardware devices are connected) I ...
3
votes
2
answers
322
views
How does the Linux Kernel store hardware TX and RX filter modes?
I am working on a C program which gets the timestamping information for a given network interface, like my own version of ethtool. My goal is to get the information printed by $ ethtool -T myNetIf. ...
1
vote
1
answer
502
views
Can I trigger an auto-negotiation of an interface using the ethtool userspace API with NETLINK sockets?
I would like to replicate the behavior of ethtool -r when auto-negotiation is active in my C++ code with NETLINK sockets. I search the CLI ethtool source code and I found that they use IOCTL sockets ...
0
votes
0
answers
236
views
Non-root access to a wifi adapter via ioctl in Linux app - how to grant?
I'm trying to debug a Qt5 c app in Ubuntu 20.04 on Odroid board. The app communicates with wifi adapter via ioctl(), eg:
int fd = iw_sockets_open();
struct ifreq ifreq;
//ifreq.ifr_name holds "...
0
votes
0
answers
210
views
What is the right usage of SIOCGIWSCAN to scan WIFI AP?
I am working on an embedded Linux system (kernel 5.10.24), there is a WLAN interface in the system.
Now I want to scan the nearby AP, I think I can use socket and SIOCGIWSCAN command to get the AP ...
2
votes
1
answer
5k
views
Any tool to do ioctl() from bash?
I try to make an ioctl() call from bash. This is very easy to do in C, so there are tools ( https://github.com/jerome-pouiller/ioctl ) which wrap this functionality.
But it would make the distribution ...
0
votes
2
answers
137
views
uname: what ioctl does it use?
Does anyone know if uname() makes an ioctl() call directly or indirectly? I reviewed the source, however didn't see that it does. I also used strace and did not see the kernel call made.
Thanks
...
1
vote
0
answers
512
views
ioctl SIOCGIWSTATS signal level constantly 0
I have a block of C code that gets a variety of information about a network interface, namely the SSID and the signal level in dBm:
#include <ctype.h>
#include <errno.h>
#include <linux/...
1
vote
1
answer
297
views
Is there ever a reason to query ioctl for hardware info when we have sysfs?
My assumption is that sysfs is built using ioctl queries, meaning all the information you would want (or at least most of it) is already available by simply reading files on sysfs. I notice some ...
1
vote
1
answer
505
views
Not understanding the use of EVIOCGRAB for touchscreen devices
I am looking at a userspace library which handles touchscreen events from the Linux kernel.
The following line of code, I can't understand what it does. What is the purpose of EVIOCGRAB when passed to ...
-3
votes
1
answer
662
views
Reparenting a process
I create a Linux Kernel Module and I try to find a way to re-parent a given process or change a given process PID. Is there any way of doing that?
I found the following link but I could not make it ...
1
vote
1
answer
453
views
Efficiently disable fs-verity on large files
If the FS_IOC_ENABLE_VERITY ioctl was used to enable fs-verity on a file (e.g., with the fsverity enable command), and then I want to write to that file again, how can I disable fs-verity on it? Right ...
0
votes
2
answers
1k
views
Two different function prototypes for Linux kernel module ioctl
As pointed out in this question, the prototype for the ioctl function inside a Linux kernel module is:
(version 1)
int ioctl(struct inode *i, struct file *f, unsigned int cmd, unsigned long arg);
or
(...