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
0
votes
1 answer

How to check for existing argument on ioctl

I want to try out how to use i/o-controls of a loadable kernel module, here a character device. The question is: How to check if the ioctl call on userspace side has an argument or not. I found that on ioctl an argument is optional. Inside the…
Alex44
  • 3,597
  • 7
  • 39
  • 56
0
votes
0 answers

Link aggregation and status of network interfaces in "ipadm" command

I am again rephrasing the issue that we are facing: We are creating link aggregations [dlmp groups] with two interfaces named net0 & net5: # dladm create-aggr -m dlmp -l net0 -l net5 -l net2 aggr1 Setting prob targets for aggr1: # dladm…
amithreat
  • 51
  • 5
0
votes
1 answer

vxworks - ioctl(SIOCGIFCONF) error

ioctl(socketDescriptor, SIOCGIFCONF, &ifconf) This ioctl call works fine when I use it in normal RTP, but gives the following error when used in .a libraries. ENXIO i.e. "this driver or device was not found".
user4679636
0
votes
1 answer

Dealing with file handles using Mono and P/Invoke

I have some code originally written in Python that I'm trying to convert to C#. It will be running on Linux. The Python code, however, opens a file and then sends some Linux specific ioctl commands to the open file. class i2c(object): def…
user9993
  • 5,833
  • 11
  • 56
  • 117
0
votes
1 answer

understanding of ioctl call from assembly

following piece of code is part of program present at this link http://dune.scs.stanford.edu/. I/we am/are not able to understand its dune.S file specifically following piece. I hope this piece is calling DUNE_ENTER ioctl command defined as #define…
incompetent
  • 1,715
  • 18
  • 29
0
votes
0 answers

Differentiate between kernel and userspace IOCTLs

I have an IOCTL handling code in kernel space (Linux kernel version 3.10). In this code, I want to separate out the IOCTLs that have come from userspace from those which have come from kernel space. How can I achieve this? Thanks.
zeroByte
  • 21
  • 2
0
votes
0 answers

How to pass SCSI command to hard disk on Vmware ESXi (6.0)

I want to develop an application to pass SCSI command to hard disk using C language. In Linux, when pass SCSI or other command to device, we just use ioctl() function to do it. But hard disk device node was not showed as /dev/sdx on VMware ESXi just…
Juan Li
  • 1
  • 1
0
votes
0 answers

trying to read from stdout with NONBLOCKING set using winARM newlib lpc

I want read on stdout to be non-blocking. I was using the newlib-lpc library in WINarm to do this. But even though it is set as non-Blocking, the code stops at read every time and waits for a character to be received. Here is my read…
ej_01
  • 51
  • 4
0
votes
1 answer

file descriptor and loff_t offset in ioctl read and write interface

Recently i'm working on a sample code about the communication between kernel driver module and user space applications. I have a question about the .read and .write interface in the file_operations(). According to LDD3: ssize_t read(struct file…
uestclx
  • 41
  • 4
0
votes
1 answer

Why can't I in python call HDIO_GETGEO?

#!/usr/bin/env python # -*- coding: utf-8 -*- ########## THIS NOW WORKS! ########## UNSUITABLE_ENVIRONMENT_ERROR = \ "This program requires at least Python 2.6 and Linux" import sys import struct import os from array import array # +++…
user376403
  • 1,085
  • 2
  • 9
  • 18
0
votes
1 answer

Incomplete type 'struct ifmediareq' (ioctl)

I'm trying to rewrite some source code and I have the following function: tuntap_interface::if_ioctl(u_int32_t cmd, void *arg) { dprintf("tuntap: if ioctl: %d\n", (int) (cmd & 0xff)); switch (cmd) { case SIOCSIFADDR: { …
Dan Ramos
  • 1,092
  • 2
  • 19
  • 35
0
votes
2 answers

python library to access low-level detail of drive (SMART, scsi generic, ata security, etc)

Is there any python library to access low-level disk details? I need: SMART attributes Serial number Firmware version SATA Phy counters SMART Extended Self-test log records Enclosure/letter/sg-device mapping ATA Security command access SCSI…
George Shuklin
  • 6,952
  • 10
  • 39
  • 80
0
votes
1 answer

IOCtlSocket Ruby Winapi

Well, I'm trying to get the value of packets to be read by the recv with ioctlsocket(FIONREAD), But the function is not returning any value. Look: IOCtlSocket = Win32API.new('ws2_32', 'ioctlsocket', 'llp', 'i') ret_val = -1 result =…
user3571412
  • 105
  • 1
  • 9
0
votes
1 answer

Semaphore will not wake up in the context of Ioctl

I have a device driver I am working on. It works this way: 1. User app sends ioctl cmd 0x01 to driver that puts it to sleep. 2. User app sends another ioctl cmd 0x02 to driver that wakes it up. I am doing this because my hardware is not ready, so I…
0
votes
1 answer

why some ioctl cases always fails?

Recently, I am practicing a simple ioctl driver with three commands: print,get,set In the ioctl switch statement, it looks like this pseudo-code: switch (cmd) { case "print": break; case "get": break; case "set": break; default: …
Craig Yang
  • 330
  • 3
  • 13