Skip to main content

Questions tagged [ioctl]

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 ...
Huckle's user avatar
  • 1,097
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 ...
Lars Poulsen's user avatar
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 ...
aoeu's user avatar
  • 111
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. ...
Robbie's user avatar
  • 63
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 ...
Jairo Mejia's user avatar
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 "...
wowa's user avatar
  • 1
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 ...
wangt13's user avatar
  • 651
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 ...
Maestro's user avatar
  • 233
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 ...
Nick's user avatar
  • 205
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/...
Jack828's user avatar
  • 11
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 ...
Bob Odenkirk's user avatar
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 ...
Engineer999's user avatar
  • 1,233
-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 ...
superuser's user avatar
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 ...
Joseph Sible-Reinstate Monica's user avatar
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 (...
BowPark's user avatar
  • 5,195

15 30 50 per page