Questions tagged [ioctl]
48 questions
16
votes
1 answer
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 in block devices, streams in character devices,…
Constantine
- 515
- 1
- 4
- 11
15
votes
1 answer
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 demonstrate on example what I need:
# cat…
UVV
- 2,928
- 3
- 23
- 36
12
votes
1 answer
How can I list net work devices and ipv4 address on linux without ifconfig/ip command
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 do not have ifconfig/ip installed - and I'd like to keep it…
Mandragor
- 1,050
- 3
- 13
- 22
10
votes
1 answer
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:
bash: cannot set terminal process group (-1)…
Martin Vegter
- 69
- 66
- 195
- 326
9
votes
1 answer
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 maybe to know for each code , to which kernel…
Keystone
- 231
- 3
- 4
9
votes
2 answers
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 signal—when using the integrated serial-to-USB…
JamesTheAwesomeDude
- 825
- 3
- 14
- 28
8
votes
3 answers
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 target/release/tunnel
target/release/tunnel =…
Teague Lasser
- 83
- 1
- 4
7
votes
1 answer
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.
Apparently, this is a bug: [zfs-root] "device-mapper: reload…
SharkTH
- 73
- 1
- 4
7
votes
1 answer
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 physically delete duplicate extents. Needs at least…
Dan
- 9,372
- 5
- 25
- 39
7
votes
2 answers
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 encrypted devices: TrueCrypt and Tc-play.
In this case, the…
Eleno
- 1,849
- 4
- 27
- 39
7
votes
1 answer
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 documentation that correctly describes how to…
Peter M
- 227
- 3
- 10
6
votes
0 answers
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/control (for most distributions), but it seems I…
Zomp
- 117
- 1
- 7
5
votes
2 answers
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, GPIO_V2_LINE_SET_VALUES_IOCTL, ...).
My…
detly
- 5,020
- 6
- 23
- 29
4
votes
3 answers
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 I'm trying to do:
gcc -x c -o pusher.bin -…
Tenders McChiken
- 908
- 1
- 9
- 24
3
votes
1 answer
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 CDROM_SEND_PACKET for command PREVENT ALLOW MEDIUM REMOVAL…
Neppomuk
- 316
- 2
- 12