ioctl (Input Output ConTroL) is a system call for device-specific I/O operations and other operations which cannot be expressed by regular system calls and it provides an interface through which an application can communicate directly with a device driver(or any other global kernel space variables). Applications can use the standard control codes or device-specific control codes to perform direct input and output operations.
Questions tagged [ioctl]
691 questions
8
votes
2 answers
gpg: error Inappropriate ioctl for device
I'm running a self-hosted Renovate instance and I need to sign the commits to GitLab with GPG key.
For this I'm setting the env variable RENOVATE_GIT_PRIVATE_KEY with the PGP private key block for my GitLab user and this is automatically…

Fox
- 163
- 1
- 7
8
votes
1 answer
Valgrind: noted but unhandled ioctl; Is it necessary to handle and how to find?
I have a large application that I am checking for memory leaks. I am using valgrind with the options --leak-check=yes --track-origins=yes. A sample of the warning:
==2173== Warning: noted but unhandled ioctl 0xc410 with no size/direction…

Warpstar22
- 567
- 4
- 19
8
votes
1 answer
Linux input device reading ioctl(EVIOCGKEY()) versus read(input_event)
All my code was based upon an article from linuxjournal.com
here is the article I based my code on
I'm writing an embedded app, and I'm trying to read the keystrokes from a keyboard.
Here is the code I'm using
uint8_t key_b[KEY_MAX/8 +…

3Baos
- 141
- 1
- 7
8
votes
2 answers
equivalent of TIOCOUTQ / SIOCOUTQ in windows
Till date my googling and checking out of msdn suggests Microsoft Windows does not offer any equivalent of TIOCOUTQ / SIOCOUTQ to find the amount of unsent data in the socket send buffer.
It will be so useful if some good hack discovered something…

mdk
- 6,225
- 1
- 25
- 30
8
votes
3 answers
Get Terminal width Haskell
How to get the width of the terminal in Haskell?
Things I tried
System.Posix.IOCtl (could not figure out how to get it to work)
This only has to work unix.
Thanks

Bilal Syed Hussain
- 8,664
- 11
- 38
- 44
8
votes
3 answers
What is the point of using the linux macro access_ok()
I've been doing some research and I'm a little confused about this macro. Hopefully someone can give me some guidance. I have some ioctl code (which I've inherited, not written) and the first thing it does if check if access_ok() before moving on to…

Mike
- 47,263
- 29
- 113
- 177
7
votes
2 answers
Is there a way to know how much data is available in a Python socket to receive?
I have figured out that I must use ioctl. There are similar questions here:
How to tell how much data is in a Socket's send buffer
Determing the number of bytes ready to be recv()'d
My questions are:
What is an equivalent to FIONREAD in Python?…

utapyngo
- 6,946
- 3
- 44
- 65
7
votes
2 answers
What are the unwanted side effects of open in ioctl?
According to man ioctl, opening file descriptors with open may cause unwanted side-effects. The manual also states that opening with O_NONBLOCK solves those unwanted issues but I can't seem to find what's the reason for that, nor what are the actual…

Carles Araguz
- 1,157
- 1
- 17
- 37
7
votes
1 answer
Possible to use a 9 Pin Serial port as "GPIO" using ioctl()?
Is it possible to use the COM port on a linux box to read the value of a switch? I think that it should be possible with ioctl(), but i have struggled a little to find a comparable example. I only need one input, and only need it to read in a…

phatmanace
- 4,671
- 3
- 24
- 29
7
votes
1 answer
When pty [Pseudo terminal] slave fd settings are changed by "tcsetattr" , how can the master end capture this event without delay?
The slave fd is used by another application (say "A") as a serial port device .
A will set its baud rate/stop bit etc. My app needs this information .
BTW, is there any way for a process that has only the master fd open to be notified of all…

Shazoo
- 73
- 5
7
votes
2 answers
Physical disk size not correct (IoCtlDiskGetDriveGeometry)
I use the code below to get the physical disk size, but the size returned is not correct. I've checked the size with other tools.
The code below reports
Total disk space: 8.249.955.840 bytes
and it should be
Total disk space: 8.254.390.272…

John Doe
- 9,843
- 13
- 42
- 73
7
votes
2 answers
Adding custom struct types to strace
I'm trying to reverse-engineer a user-mode shared object that interacts with a kernel driver via ioctl syscalls. I have a header file with definitions for the kernel driver's ioctl interface (i.e. #defines for ioctl command numbers, and struct…

Kyle Gagnet
- 2,294
- 2
- 20
- 27
6
votes
1 answer
How does iwlist() command scans the wireless networks?
I want to know how iwlist command scans the wireless networks available, in linux. I read its source code and there was an ioctl call using SIOCSIWSCAN to trigger the scan and SIOCGIWSCAN to get the scan results. But how the beacon frames are…

Abhishek Anand
- 247
- 2
- 10
6
votes
1 answer
Replacement for the ioctl() function
I am developing a device driver I/O model for small microcontroller applications, using POSIX as a guideline for interface design. I implemented ioctl() as a means of controlling driver/hardware parameters – for example UART baud rate, I2C slave…

makes
- 6,438
- 3
- 40
- 58
6
votes
1 answer
Errno::ENOTTY Inappropriate ioctl for device when trying to send file to SFTP
I am using a rails webapp and trying to send an xml file to a sftp server, using the following script:
Net::SSH.start(SFTP_HOST, sftp_user, {:port => SFTP_PORT, :password => sftp_password}) do |ssh|
ssh.sftp.connect do |sftp|
sftp.upload!(…

moh19814
- 133
- 1
- 1
- 14