Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

ioctl(2) [ultrix 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)

Check Out this Related Man Page

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

NAME
ioctl -- control device SYNOPSIS
#include <sys/ioctl.h> int ioctl(int fildes, unsigned long request, ...); 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 fildes 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] fildes is not a valid descriptor. [EINVAL] Request or argp is not valid. [ENOTTY] fildes is not associated with a character special device. [ENOTTY] The specified request does not apply to the kind of object that the descriptor fildes references. SEE ALSO
cdio(1), chio(1), mt(1), execve(2), fcntl(2), intro(4), tty(4) HISTORY
An ioctl() function call appeared in Version 7 AT&T UNIX. 4th Berkeley Distribution December 11, 1993 4th Berkeley Distribution
Man Page

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

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

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

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