03-14-2002
Briefly the ioctl function is called with three arguments. The first is a file descriptor, a socket in the case of network programming. The second argument is the request, e.g. what you want to do, there are many of them like SIOCGIFADDR which returns to you the protocol address assigned to your interface. The third argument is a pointer and it depends of the request, for instance if you want to get interface configuration parameters the pointer is of struct ifconf type. You can check the manual page of ioctl_list so as to get a list of the available requests.
The problem is that ioctl is not the same for all unix like os, it may vary. Last week I was trying to configure a proxy arp server with ioctl but the damn thing was not working properly. I posted a mail to the linux kernel mailing list but anfortunately nobody answered.
Last edited by developer; 03-18-2002 at 08:05 AM..
10 More Discussions You Might Find Interesting
1. UNIX Desktop Questions & Answers
Has anyone over seen this message on bootup? When booting up, I get:
" Warning: lckdioctl: unknown ioctl cmd:5 ".
It scrolls down the screen 5 - 10 times, the I finally get a login. It is also posting to my syslog file. The system came up, but I am still getting the message... (1 Reply)
Discussion started by: Diana
1 Replies
2. Filesystems, Disks and Memory
Hi,
We are running a perl script to upload some data using SQL* Loader. We pipe the data in a http request to SQL*Loader which loads the data to the database. We encounter the error "Inappropirate ioctl for device" when we try to upload huge data. Any solution would be greatly appreciated.... (4 Replies)
Discussion started by: tojaiganesh
4 Replies
3. Programming
Hi all,
I tried to output memory usage information while the process is
executing at a particular time. I found out some people
suggesting calling the ioctl. I followed it and wrote a test example:
#include <unistd.h>
#include <stdlib.h>
#include <iostream.h>
#include <fcntl.h>
#include... (2 Replies)
Discussion started by: lanchen
2 Replies
4. UNIX for Dummies Questions & Answers
When I try to format a slice in Solaris 10 I get the follow error :confused: :
-bash-3.00# mkfs /dev/dsk/c1d0s5 18877824
Can not determine partition size: Inappropriate ioctl for device
Some format command output:....
AVAILABLE DISK SELECTIONS:
0. c1d0 <DEFAULT cyl 38735 alt 2... (0 Replies)
Discussion started by: spoonman
0 Replies
5. UNIX for Dummies Questions & Answers
Hello,
I have a cron entry:
59 23 * * * . $HOME/.profile;mydate=`date '+%Y%m%d'`;mv filename filename_$mydate
Which works fine interactively, but gives me the following error when it runs in cron:
Your "cron" job on servername
. $HOME/.profile;mydate=`date '+
produced the... (4 Replies)
Discussion started by: steelrose
4 Replies
6. Shell Programming and Scripting
Dear all,
Problem goes like this:
I have a shell script which when run manually runs perfectly.
When same script is executed through a job schdeduler I get an error as Inappropriate ioctl for device and the script fails.
This problems seems quite guiling to me.
Any clues are heartly... (11 Replies)
Discussion started by: RishiPahuja
11 Replies
7. UNIX for Advanced & Expert Users
Hi All,
int ioctl(int d, int request, ...);
Can somebody tell me how does ioctl decides the input parameter: "request".
Sometimes, its SNDCTL_TMR_TIMEBASE or TCGETS
or FIONREAD...etc.
What is the pattern??
I am asking this coz my strace returns this: ... (1 Reply)
Discussion started by: angad.makkar
1 Replies
8. Shell Programming and Scripting
Hi All,
Am finding performance of my SD card using hdparm.
Code:
hdparm -tT /dev/BlockDev0
/dev/BlockDev0:
Timing cached reads: 1118 MB in 2.00 seconds = 558.61 MB/sec
HDIO_DRIVE_CMD(null) (wait for flush complete) failed: Inappropriate
ioctl for device
Timing buffered disk... (1 Reply)
Discussion started by: amio
1 Replies
9. Solaris
For some reason when I try to take a snapshot of the root slice on a particular machine I get an ioctl 22 error. I can't seem to find much on the problem by searching the internet other than some realtime processes such as ntp that use mlock can cause this to happen. I tried running it with truss... (2 Replies)
Discussion started by: ilikecows
2 Replies
10. Shell Programming and Scripting
Sample program tty, this will be get called from my script test_script.
#include <stdio.h>
#include <unistd.h>
#define TTY_NAME_MAX 32
#define STDIN_FILENO 0 /* Standard input. */
int main(void) {
int ret = 0;
char local_device_file;
printf("\npid =... (7 Replies)
Discussion started by: Gajendra_PH
7 Replies
ioctl(2) System Calls Manual ioctl(2)
Name
ioctl - control device
Syntax
#include <sys/ioctl.h>
ioctl(d, request, argp)
int d, request;
char *argp;
Description
The call performs a variety of functions on open descriptors. In particular, many operating characteristics of character special files
(for example, terminals) can be controlled with requests. Certain requests operate on a number of device types. These include informa-
tional requests, such as and The descriptions of various devices in the Reference Pages, Section 4: Special Files discuss how applies to
them. Also consult <sys/ioctl.h> for more information.
An request has encoded in it whether the argument is an "in" parameter or "out" parameter, and the size of the argument argp in bytes.
Macros and defines used in specifying an request are located in the file <sys/ioctl.h>.
Return Values
If an error has occurred, a value of -1 is returned, and errno is set to indicate the error.
Diagnostics
The call fails under the following conditions:
[EBADF] The d is not a valid descriptor.
[ENOTTY] The d is not associated with a character special device.
[ENOTTY] The specified request does not apply to the kind of object which the descriptor d references.
[EINVAL] The request or argp is not valid.
[EFAULT] The argp points to memory that is not part of the process' address space.
See Also
execve(2), fcntl(2), devio(4), intro(4n), mu(4), nbuf(4), tty(4)
ioctl(2)