Questions tagged [ioctl]
The ioctl tag has no usage guidance.
49
questions
0
votes
0
answers
31
views
Errors when trying to bring ethernet interface up on embedded Linux
I am trying to compile the Linux kernel (3.0.8, buildroot-gcc-12.3.0, ARMv7) to run on my IP camera.
eth0 is not able to get up.
At first, kernel boot just crashed at Starting network step:
Unable to ...
0
votes
0
answers
57
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 ...
1
vote
1
answer
472
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
45
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
...
0
votes
0
answers
104
views
Usage of DRM_IOCTL_WAIT_VBLANK ioctl
I tried to adapt the code at http://betteros.org/tut/graphics1.php#dumb to prevent screen tearing. The example code draws different colors to the screen in rapid succession. My assumption is that the ...
1
vote
0
answers
196
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
123
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
181
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
224
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 ...
0
votes
1
answer
215
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
838
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
(...
0
votes
1
answer
213
views
Is socket sys (libc) function supposed to always return the same result for the same parameters?
I am writing a C# app that basically does a similar job that iwlist.
I am having trouble, though, in porting the IOCTL calls into .NET. I mean, the interop code I have written so far (to enable my ....
5
votes
2
answers
2k
views
Are ioctl calls blocking?
I am writing some code around libgpiod's interface. For example, I want to set a line to output high. Under the hood, libgpiod opens an fd provided by the kernel for the line, and then calls ioctl(fd, ...
0
votes
1
answer
308
views
Is there any way to change the I2C slave device address on a Linux board?
Aim: setAddress in i2c Slave Devices software side.
example :
3 sensor with same address 0x29. through some method sensor1 to set 0x22, sensor2 to set 0x25, sersor3 to set 0x28.
info:
I have 3 similar ...
1
vote
0
answers
50
views
How is ioctl handled in Linux?
When I trigger ioctl. Does linux just call ioctl from some fops struct, or does it do something more (handle some basic operations). I think I heard this once, but there is little information about ...
2
votes
0
answers
285
views
What could go wrong with sending input to /dev/tty?
My setup entails sending inputs to another terminal program running Bash in the same machine and same X session. I'm using ttyecho for that which, to put it short, sends input to /dev/tty/[id], ...
-1
votes
1
answer
155
views
Does BTRFS support the ioctl(fd, FIFREEZE) system call?
the manpage of fsfreeze states:
FSFREEZE(8) System Administration FSFREEZE(8)
...
2
votes
1
answer
201
views
FIDEDUPERANGE ioctl doesn't behave as expected on btrfs
According to ioctl_fideduperange,
The maximum size of src_length is filesystem dependent
and is typically 16 MiB.
However, I've been able use src_length of > 1 Gib successfully with a single call ...
4
votes
3
answers
734
views
How can I run a program in its own tty?
I'm messing with TIOCSTI which shoves data into the terminal's input buffer. I want to be able to capture this data before it arrives at the shell or redirects it to a file.
To better illustrate what ...
1
vote
1
answer
1k
views
Set can baudrate with ioctl or similar from C/C++
I'm currently setting the baudrate of my can0 with ip link:
/sbin/ip link set can0 up type can bitrate 250000
I'm just wondering how to do the same from within C/C++?
7
votes
1
answer
5k
views
device-mapper: reload ioctl on osprober-linux-nvme0n1p7 failed: Device or resource busy
I ran into the error
device-mapper: reload ioctl on osprober-linux-nvme0n1p7 failed: Device or resource busy
while compiling the kernel in Ubuntu Studio. I use ZFS for my main drive.
...
1
vote
1
answer
2k
views
Linux ioctl VT_GETSTATE fails if process is run manually
I'm using the ioctl syscall on Linux to get the current tty in a C program.
I don't know why the ioctl fails if the program is run manually (as root) while it works as expected if the init.d script ...
1
vote
0
answers
187
views
Detect if filesystem supports FIEMAP ioctl
How can I query the kernel to find out if a mounted filesystem supports the FIEMAP ioctl? Is there a way to request the inode_operations struct for a given filesystem?
As a workaround, I just test ...
3
votes
1
answer
916
views
How to I set the permissions necessary to make the ioctl CDROM_SEND_PACKET command run?
I've run into an error stemming from lacking permissions when using the CDIO library to issue an eject command to my USB CD-ROM drive. I always get an error message like this:
INFO: ioctl ...
0
votes
0
answers
377
views
How to run a process in background on startup?
I'm trying to run a process(myfile) on startup on my yocto linux board, but I'm getting either IOCTL or segmentation fault while I use nohup or & to run in background. I could run myfile in ...
2
votes
2
answers
438
views
What does the ioctl CDROMPLAYMSF command do exactly?
I've got a USB 2.0 CD/DVD drive, which is (amongst other use cases) used to play music CDs. But: The drive seems to ignore CDROMPLAYMSF commands.
The host is a Raspberry Pi 3B with the current ...
9
votes
1
answer
4k
views
Get all ioctl code and which module they map
By doc. , ioctl signature is int ioctl(int fd, int request, ...) . request is the code of ioctl.
Is there any way to know what are all the possible ioctl request code that available in my linux? And ...
8
votes
3
answers
8k
views
Why is CAP_NET_ADMIN insufficient permissions for ioctl(TUNSETIFF)?
I'm trying to write a tun/tap program in Rust. Since I don't want it to run as root I've added CAP_NET_ADMIN to the binary's capabilities:
$sudo setcap cap_net_admin=eip target/release/tunnel
$getcap ...
0
votes
1
answer
5k
views
netcat error: Inappropriate ioctl for device
Im trying to create a 'reverse shell' using a bash oneliner and a netcat listener. This combination worked great a few days ago however now it only gives errors when connection. Does anyone know what ...
9
votes
2
answers
3k
views
How to prevent DTR on open for cdc_acm?
I have an Arduino Uno attached over USB, using the cdc_acm driver. It is available at /dev/ttyACM0.
The convention for the Arduino's serial interface is for the DTR signal to be used for a reset ...
1
vote
1
answer
604
views
mapping of ioctl to its definition
The prototype of ioctl in linux driver modules is
int ioctl(struct inode *i, struct file *f, unsigned int cmd, unsigned long arg);
or
long ioctl(struct file *f, unsigned int cmd, unsigned long arg);...
0
votes
1
answer
5k
views
Inappropriate ioctl for device while reading flags on <file>
I am unable to set or view file attributes using lsattr and chattr commands on Reiser File System. Following result is observed:
chattr +i Temp.txt
chattr: Inappropriate ioctl for device while ...
1
vote
0
answers
256
views
Is it possible to access AES key of Self-encrypting drives (SEDs) in userspace?
In AES Hardware Encryption, is it possible to send or access AES key to and from hardware to userspace/software?
Is there an available IOCTL for this?
7
votes
1
answer
1k
views
What does a rmlint's "clone" for btrfs do?
I was reading the rmlint manual, and one of the duplicate handlers are clone and reflink:
· clone: btrfs only. Try to clone both files with the BTRFS_IOC_FILE_EXTENT_SAME ioctl(3p). This will ...
1
vote
0
answers
440
views
Max transfer size in SG_IO/SG_ATA_16
I need to pass a direct, raw ATA request to a hard drive (0x25, READ DMA EXT), to disobey max sector count (long story), and to bypass all possible OS caches, buffers, reorderings et al.
...
1
vote
1
answer
135
views
How detect playing video by ioctl?
Is it possible to detect video playing by ioctl in linux. Maybe detect decoding of the video file. How about this is working with flash player and html5 video?
Can you provide some information how ...
0
votes
1
answer
182
views
Why does libdevmapper have data structures?
As I'm looking through libdevmapper.h for clues on how to properly use device mapper ioctls (or potentially use libdevmapper instead), I'm confused as to why there is code in here for creating/...
6
votes
0
answers
1k
views
Documentation on Device Mapper ioctls?
In the Red Hat documentation on Device Mapper, it reads:
"the application interface to the Device Mapper is the ioctl system
call."
So far, I understand that the ioctls are sent to /dev/mapper/...
3
votes
1
answer
2k
views
Does keyboard input always go through a controlling terminal?
Am I right that all input typed from the keyboard goes through a controlling terminal? That means that if a program is run without a controlling terminal, it won't be able to receive any user input. ...
12
votes
1
answer
22k
views
How can I list net work devices and ipv4 address on linux without ifconfig/ip command [duplicate]
I already figured out that on Linux I can list network devices
(cd /proc/net/dev_snmp6/ && for device in *; do echo $device; done|sort)
but how can I get the ipv4 address of the device?
I ...
16
votes
1
answer
5k
views
Usage difference between device files, ioctl, sysfs, netlink
I'm trying to clarify which is the most useful (in terms of functionality) method of interacting with devices in Linux. As I understand, device files expose only part of functionality (address blocks ...
2
votes
0
answers
2k
views
how to detect CD physically inserted into drive
How to detect that CD was physically inserted into CD mechanics ASAP?
The CD is mounted automatically but it takes like 20 seconds sometimes - and it is just then that I know the CD is inserted.. ...
1
vote
1
answer
3k
views
Changing readahead value using blockdev command
I am trying to modify read ahead value using blockdev. When I issue this command
blockdev --setra xxx /dev/sda - it changes the readahead value of the entire partition in that device, which is fine. ...
10
votes
1
answer
13k
views
bash: no job control in this shell
I have a minimal Linux system.
init is /bin/bash, only bare minimum of libraries in /lib/, /dev/ is populated statically, no daemons running (no udev, ..)
When bash starts, I get following error:
...
1
vote
1
answer
2k
views
HDIO_GETGEO and HDIO_GET_IDENTITY in Linux using C++
Can anyone explain the core difference between HDIO_GETGEO and HDIO_GET_IDENTITY?
From the Linux documentation and this document titled: Summary of HDIO_ ioctl calls., I know that the former is for ...
15
votes
1
answer
22k
views
Is it possible to get network interface index not via /sys?
So what I'm looking for is an interface index (or name) but the real one.
if_nametoindex(3) and ioctl(2) don't seem to help me here. Now the only way I found how to do this is via /sys. Let me ...
7
votes
2
answers
7k
views
GNU/Linux: "device mapper: create ioctl failed" "device or resource busy"
I can't mount my encrypted devices anymore.
The error is:
device mapper: create ioctl failed
device or resource busy
This error arises both with two different programs to access TrueCrypt ...
2
votes
0
answers
440
views
How do I assign the controlling terminal to other process?
I use TIOCSCTTY to forcibly take over the controlling terminal in other "remote" application. But after the application finishes running, controlling terminal gets orphaned and bash stops reacting to ...
7
votes
1
answer
7k
views
Where do I find ioctl EVIOCGRAB documented?
I want to use the ioctl EVIOCGRAB function in a C based program, and from googling around I have found various bits of example source code that use the function, but I am struggling to find explicit ...