Questions tagged [ioctl]

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.

691 questions
5
votes
1 answer

Communication between delphi application and Windows NT system driver

I am trying to build a very simple driver. Its sole purpose will be to register "PsSetCreateProcessNotifyRoutine" and on callbacks recieved from kernel, notify my Win32 application about which proccesses are started and stoped. I only know how to…
Runner
  • 6,073
  • 26
  • 38
5
votes
2 answers

Confusion over ioctl() and kernel headers

As far as I know, ioctl() is used to expose an "extended" system call interface to userspace applications. Rather than adding thousands of system calls that are unique to specific drivers, ioctl() is used to provide extensible driver-specific…
Matt K
  • 598
  • 5
  • 19
5
votes
3 answers

Having a problem figuring out how to get Ethernet interface info on Mac OS X using ioctl/SIOCGIFADDR/SIOCGIFCONF?

Are you having a problem figuring out how to get interface info on Mac OS X using ioctl/SIOCGIFADDR/SIOCGIFCONF? I had a lot of trouble getting code that worked fine on Linux to work on Mac OS X today.
Mark
  • 1,124
  • 1
  • 14
  • 21
5
votes
3 answers

Using "extern C" on non function call related declarations

I know questions regarding extern "C" have been asked before but I am getting mixed signals and would like it if someone could point me to what the best practice is in the scenario below. I have written a driver for Linux and have several struct…
user2205930
  • 1,046
  • 12
  • 26
5
votes
1 answer

select(2) and ioctl(2) returning 0 while stdin has data

I'm trying to detect whether there is data on stdin for me to read. Specifically, I've turned off canonical mode using tcsetattr, so I can read one character at a time (blocking). I want to detect escape sequences like those produced by the arrow…
tomsmeding
  • 916
  • 7
  • 25
5
votes
1 answer

Is there a way to use C variadic functions with the latest Swift 3 snapshot?

One example of this is ioctl error: 'ioctl' is unavailable: Variadic function is unavailable Darwin.ioctl:2:13: note: 'ioctl' has been explicitly marked unavailable here public func ioctl(_: Int32, _: UInt, _ varargs: Swift.Any...) -> Int32 When it…
ahyattdev
  • 529
  • 1
  • 6
  • 18
5
votes
1 answer

Getting WIFI signal strength- seeking the best way (IOCTL, iwlist (iw) etc.)

I want to scan the signal strength received from 3 AP. I would be happy if that could happen every 300ms (max.500ms). I flashed OpenWRT on the routers. I was seeking for a good tool to do that. First I found iwconfig which worked, but only with…
user3673464
  • 59
  • 1
  • 1
  • 4
5
votes
1 answer

How to call compat_ioctl or unlocked_ioctl?

I'm trying to implement a driver for RTC (Real Time Clock). I used ioctl function in kernel 2.6.32. It worked fine. But when I run same driver in kernel 3.13.0, it gave an error ‘struct file_operations’ has no member named ‘ioctl’ when I changed…
gangadhars
  • 2,584
  • 7
  • 41
  • 68
5
votes
1 answer

Is IOCTL return value

I came across the following code. if((error = ioctl(get_card_fd(card_ref), CARD_SETVERSION, &context))) { return EXIT_FAILURE; } My questions are the following: Does IOCTL always return '0' on success? How does the following expression…
liv2hak
  • 14,472
  • 53
  • 157
  • 270
5
votes
3 answers

How can I prevent SIOCGIFADDR from failing?

I want to get the eth0's IP. Here is what I've written (maybe there is a way around it?): int sockfd = socket(AF_INET, SOCK_DGRAM, 0); check(sockfd > 0, "cannot create socket\n"); #define INTERFACE_NAME "eth0" #define INTERFACE_NAME_LENGTH 4 char…
staroselskii
  • 365
  • 1
  • 3
  • 16
5
votes
2 answers

64-bit argument for fcntl.ioctl()

In my Python (2.7.3) code, I'm trying to use an ioctl call, accepting a long int (64 bit) as an argument. I'm on a 64-bit system, so a 64-bit int is the same size as a pointer. My problem is that Python doesn't seem to accept a 64-bit int as the…
Ziv
  • 2,369
  • 3
  • 24
  • 40
5
votes
1 answer

How to write into the VGA memory (not video buffer, memory) to display a logo on screen, in Linux?

I would like to write into the VGA memory (video memory, not buffer) from user space by mmap-ing in user space and sending the address to kernel space where, i would use pfn remap to map those mmap-ed address to the vga memory (i'll get the address…
neo
  • 69
  • 4
5
votes
0 answers

DeviceIoControl call fails with windows error code 183

I am trying to write buffer data to SCSI device, but when I fire the deviceIoControl call, I get the windows error code 183. The error code indicates File already exits but I am not able to understand the error with respect to the IOCTL call. The…
Kailash Akilesh
  • 173
  • 2
  • 2
  • 7
5
votes
3 answers

How can I determine the amount of write/output buffer space left on a linux serial port?

You can determine how much data is available to read from a serial port under linux using an ioctl. Is it possible to determine how much buffer space remains for the serial port when writing to it? Effectively I want to write a block of data to a…
Joe
  • 7,378
  • 4
  • 37
  • 54
5
votes
1 answer

Adding sys/ioctl.ph to Perl headers

I need to use sys/ioctl.ph and it's not included in the perl version (5.12.3) shipped with my slackware distribution. I did the following: cd /usr/include h2ph sys/ioctl.ph cd /usr/lib64/perl5/site_perl/5.12.3/x86_64-linux-thread-multi/ mkdir sys mv…
Zagorax
  • 11,440
  • 8
  • 44
  • 56