Questions tagged [ioctl]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
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 ...
hypers's user avatar
  • 101
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 ...
wangt13's user avatar
  • 327
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 ...
Maestro's user avatar
  • 179
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 ...
Nick's user avatar
  • 195
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 ...
redWaterFish's user avatar
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/...
Jack828's user avatar
  • 11
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 ...
Bob Odenkirk's user avatar
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 ...
Engineer999's user avatar
  • 1,121
-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 ...
superuser's user avatar
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 ...
Joseph Sible-Reinstate Monica's user avatar
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 (...
BowPark's user avatar
  • 4,821
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 ....
Veverke's user avatar
  • 348
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, ...
detly's user avatar
  • 5,030
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 ...
Raj Mehta's user avatar
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 ...
yomol777's user avatar
  • 199
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], ...
resolritter's user avatar
-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) ...
fraleone's user avatar
  • 747
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 ...
jrw32982's user avatar
  • 704
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 ...
Tenders McChiken's user avatar
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++?
jpsalm's user avatar
  • 91
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. ...
SharkTH's user avatar
  • 73
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 ...
Bemipefe's user avatar
  • 165
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 ...
Reinstate Monica's user avatar
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 ...
Neppomuk's user avatar
  • 316
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 ...
reportin' in's user avatar
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 ...
Neppomuk's user avatar
  • 316
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 ...
Keystone's user avatar
  • 231
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 ...
Teague Lasser's user avatar
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 ...
toom's user avatar
  • 101
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 ...
JamesTheAwesomeDude's user avatar
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);...
Xter's user avatar
  • 41
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 ...
Sameer Khurd's user avatar
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?
starz's user avatar
  • 31
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 ...
Dan's user avatar
  • 9,402
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. ...
Pawel Kraszewski's user avatar
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 ...
Psottek's user avatar
  • 11
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/...
Zomp's user avatar
  • 117
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/...
Zomp's user avatar
  • 117
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. ...
anatoly techtonik's user avatar
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 ...
Mandragor's user avatar
  • 1,050
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 ...
Constantine's user avatar
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.. ...
nayana's user avatar
  • 153
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. ...
Sanchayeni B's user avatar
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: ...
Martin Vegter's user avatar
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 ...
Jackzz's user avatar
  • 1,363
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 ...
UVV's user avatar
  • 2,958
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 ...
Eleno's user avatar
  • 1,849
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 ...
Vi.'s user avatar
  • 5,558
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 ...
Peter M's user avatar
  • 227