Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

ioctl(2) [opendarwin man page]

IOCTL(2)						      BSD System Calls Manual							  IOCTL(2)

NAME
ioctl -- control device SYNOPSIS
#include <sys/ioctl.h> int ioctl(int d, unsigned long request, char *argp); DESCRIPTION
The ioctl() function manipulates the underlying device parameters of special files. In particular, many operating characteristics of charac- ter special files (e.g. terminals) may be controlled with ioctl() requests. The argument d must be an open file descriptor. An ioctl 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 ioctl 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. ERRORS
Ioctl() will fail if: [EBADF] d is not a valid descriptor. [ENOTTY] d is not associated with a character special device. [ENOTTY] The specified request does not apply to the kind of object that the descriptor d references. [EINVAL] Request or argp is not valid. SEE ALSO
mt(1), cdio(1), chio(1), execve(2), fcntl(2), tty(4), intro(4) HISTORY
An ioctl() function call appeared in Version 7 AT&T UNIX. 4th Berkeley Distribution December 11, 1993 4th Berkeley Distribution

Check Out this Related Man Page

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)
Man Page

14 More Discussions You Might Find Interesting

1. 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

2. Solaris

ioctl() fails to get window size from console login

Hi, I need to get the console window size for an application, for which I used ioctl() by passing the TIOCGWINSZ parameter. The ioctl() function does not fail (returns non zero), but it could not get the window size (gets 0x0). When I tried to verify the window size by the stty -a command, the... (2 Replies)
Discussion started by: diganta
2 Replies

3. UNIX for Dummies Questions & Answers

Using Sudo

Hi All, I have been trying to use the option -S in sudo for quite some time now but have not been successful. I get the error "Inappropriate ioctl for device" most of the time. Can anyone please tell me how to use this option to pass the password. Your help is appreciated. Thanks, Ambika (2 Replies)
Discussion started by: ambika
2 Replies

4. UNIX for Dummies Questions & Answers

IO Error

we have a test_script.sh. This is returning O/S Message: Inappropriate ioctl for device, when set linesize is bigger than 1020, and hence not writing properly to file. The issue is important, as our initialise feed calls the generate parm file script, which logs on to sql plus to make the... (1 Reply)
Discussion started by: ramsugav
1 Replies

5. 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

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. Solaris

Inappropriate ioctl for device, format error

When I try to format a slice in Solaris 10 I get the follow error : -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 hd 64 sec 63>... (2 Replies)
Discussion started by: spoonman
2 Replies

8. Solaris

Core dump failures

Does anyone have a list of error codes when core dumps fail? What is error 4? I also have another box that does error-2 occasionally. if anyone has a list of these error codes, it would be appreciated, thanks! I have the error below: NOTICE: core_log: ns-admin core dump failed,... (2 Replies)
Discussion started by: BG_JrAdmin
2 Replies

9. 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

10. UNIX for Advanced & Expert Users

ioctl() system call on Linux-i386

Greetings, Please help me with the following : Where can I find what means exactly and how to use each of the second argument of the ioctl() system call in Linux/386 : FIOxxx (file IOCTL requests), SIOxxx (socket IOCTL requests), TCxxx TIOxxx (terminal IOCTL requests) ? ... (1 Reply)
Discussion started by: aigoia
1 Replies

11. Programming

Using ioctl to read mice inputs

I was wondering if its possible to read mouse inputs using ioctl functions somehow ? If it is not too much of trouble can anyone write or even direct me to sample code of ioctl reading someother HID. (2 Replies)
Discussion started by: maverick_
2 Replies

12. 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

13. Solaris

ictl error - ENOTTY

Hi guys, I am getting the following error in a running process, I got this from the truss command, after this appears, the process just fails. ioctl(3, TCGETA, 0xFFBFB334) Err#25 ENOTTY So, my question is, I think that I know what a ENOTTY is, but from the error, how... (1 Reply)
Discussion started by: ocramas
1 Replies

14. What is on Your Mind?

Are the BSDs dying?

Source a quick google search making clear that this isn't really new, and if we look at our bsd Forum we see that its the only operation systems forum with the last comment dated to June last year, whereas all the others have more recent comments. One comment dated to 2014 is exactly what I... (10 Replies)
Discussion started by: dodona
10 Replies