ioctl()


 
Thread Tools Search this Thread
Top Forums Programming ioctl()
# 1  
Old 03-07-2002
ioctl()

UNIX, gnu cc compiler, SUN Ultra 60

Hello, this is my first post, so please bear with me. I'm currently developing a test environment for a network subsystem that, when live, accesses databases and other network elements.

However, my test environment will be run offline, so I need to fake the compiler out on several instances. I was wondering if anyone knew the details of the ioctl() command. I have already written a dummy function in its place, but right now the compiler gets confused because there are two definitions of ioctl(), but I need to have it see the one I wrote...

Anyone have an idea? Thanks a lot.
# 2  
Old 03-07-2002
This page might be usefull for you check it out.

http://www.mkssoftware.com/docs/man3/ioctl.3.asp

its a brief explanation of ioctl() and some examples also from the explanation i figured it out something similar with what you are looking for. Might help.
# 3  
Old 03-08-2002
I'm not exactly sure what you're asking about
but you probably do NOT want to create your
own "ioctl()". Since "ioctl()" is a UNIX system
call, it may be easier to just define it out
something like...

#ifndef TESTRUN
ioctl(...);
#else
...do some dummy thing
#endif

Then when you "make" the program just use...

make .... -DTESTRUN

...to build the "test" program.
# 4  
Old 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..
# 5  
Old 03-16-2002
On Solaris, you may want to check out

man streamio

It lists ioctls for Solaris.
From your post it looks as if you are writing a distributed system, so you may want want to
check out

man rpc

Atle
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Inappropriate ioctl for device

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

2. Solaris

fssnap ioctl error

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

3. Shell Programming and Scripting

hdparm + Inappropriate ioctl for device

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

4. UNIX for Advanced & Expert Users

ioctl : strace

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

5. Shell Programming and Scripting

Inappropriate ioctl for device

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

6. UNIX for Dummies Questions & Answers

Inappropriate ioctl for device

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

7. UNIX for Dummies Questions & Answers

Inappropriate ioctl for device

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

8. Programming

how to use ioctl to check out memory usage

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

9. Filesystems, Disks and Memory

Inappropriate ioctl for device

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

10. UNIX Desktop Questions & Answers

Warning message ioctl

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
Login or Register to Ask a Question