Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

ioctl(2) [v7 man page]

IOCTL(2)							System Calls Manual							  IOCTL(2)

ioctl, stty, gtty - control device SYNOPSIS
#include <sgtty.h> ioctl(fildes, request, argp) struct sgttyb *argp; stty(fildes, argp) struct sgttyb *argp; gtty(fildes, argp) struct sgttyb *argp; DESCRIPTION
Ioctl performs a variety of functions on character special files (devices). The writeups of various devices in section 4 discuss how ioctl applies to them. For certain status setting and status inquiries about terminal devices, the functions stty and gtty are equivalent to ioctl(fildes, TIOCSETP, argp) ioctl(fildes, TIOCGETP, argp) respectively; see tty(4). The following two calls, however, apply to any open file: ioctl(fildes, FIOCLEX, NULL); ioctl(fildes, FIONCLEX, NULL); The first causes the file to be closed automatically during a successful exec operation; the second reverses the effect of the first. SEE ALSO
stty(1), tty(4), exec(2) DIAGNOSTICS
Zero is returned if the call was successful; -1 if the file descriptor does not refer to the kind of file for which it was intended. BUGS
Strictly speaking, since ioctl may be extended in different ways to devices with different properties, argp should have an open-ended dec- laration like union { struct sgttyb ...; ... } *argp; The important thing is that the size is fixed by `struct sgttyb'. ASSEMBLER
(ioctl = 54.) sys ioctl; fildes; request; argp (stty = 31.) (file descriptor in r0) stty; argp (gtty = 32.) (file descriptor in r0) sys gtty; argp IOCTL(2)

Check Out this Related Man Page

IOCTL(2)							System Calls Manual							  IOCTL(2)

ioctl - control device SYNOPSIS
#include <sys/types.h> #include <sys/ioctl.h> int ioctl(int d, int request, void *argp) (Minix) int ioctl(int d, ioreq_t request, void *argp) (Minix-vmd) DESCRIPTION
Ioctl performs a variety of functions on open descriptors. In particular, many operating characteristics of character special files (e.g. terminals) may be controlled with ioctl requests. The writeups of various devices in section 4 discuss how ioctl applies to them. 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 VALUE
If an error has occurred, a value of -1 is returned and errno is set to indicate the error. ERRORS
Ioctl will fail if one or more of the following are true: [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
execve(2), fcntl(2), mt(4), tty(4), intro(4). 4th Berkeley Distribution March 4, 1986 IOCTL(2)
Man Page

15 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

cronjob prob

Hi all I am getting the following error when i execute my cronjob : stty: : No such device or address stty: : No such device or address What could be the problem. Thanks Rahul (3 Replies)
Discussion started by: rahul123_libra
3 Replies

5. Shell Programming and Scripting

stty: : Invalid argument

Hello Everyone; I have a script that is throwing the following message: stty: : Invalid argument The line that gives the message is the following, sailormoon$ scp home/voice.xml newwave@silvermoon:/newwave/config/radius stty: : Invalid argument voice.xml | ... (2 Replies)
Discussion started by: tony3101
2 Replies

6. UNIX for Dummies Questions & Answers

stty tcgetattr errors

Hi, I have an app that runs Oracle 8.1.7 residing on a AIX 4.3 ML 10 . preiodically app sends out a status log like the one displayed below. Lately I have noticed this stty:tcgetattr message in the log. Script that writes this output calls sqlplus, gets the required count and writes output to... (8 Replies)
Discussion started by: Student37
8 Replies

7. Programming

What does open() do anyways?

I know its kind of silly to think about it, but what does this function do anyways? I know it is used to open a given file with a variety of options but what is the best place to find out what is happening internally? I think it updates the file descriptor table and provides a lock file but does it... (3 Replies)
Discussion started by: Legend986
3 Replies

8. UNIX for Advanced & Expert Users

stty: : Not a typewriter -- Help please

Hi All, I have been runing the same set of program using the same auto profile for an year. Now when i run the same set of process , i getting the below error Not a terminal stty: : Not a typewriter stty: : Not a typewriter ksh: jil: not found ksh: sendevent: not found logout... (4 Replies)
Discussion started by: arunkumar_mca
4 Replies

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

10. Shell Programming and Scripting

stty error when script is called out of a cronjob

Hello, I'm trying to implement a script to call a third-party tool every so often and write the results to a file. If I run it interactively it works fine, but when it comes to run it out of a cronjob, I keep getting this error: stty: tcgetattr: a specified file does not support the... (3 Replies)
Discussion started by: fabiogilr
3 Replies

11. UNIX for Advanced & Expert Users

stty issues

Copy Paste Issue... Pasted some c**p of a excel...!! Sorry Guys. Please look Below for the issue. (4 Replies)
Discussion started by: grep_me
4 Replies

12. Shell Programming and Scripting

What does this really mean? "tty -s && stty istrip"

I am having hard time understanding what this really do to the environment? I do understand this part "tty -s && stty " but not "istrip" # stty command is executed only if a tty is attached to the process. # stty istrip : Strip input characters to 7 bits tty -s && stty istrip I am... (3 Replies)
Discussion started by: kchinnam
3 Replies

13. Shell Programming and Scripting

Troubles with pipes, fork, and dup2

I want to execute metasploit by two pipes to communicate with it, but I have troubles with that communication. When I run my program, I get this error: "stty: standard input: Inappropriate ioctl for device" and I don't receive the metasploit promt. just select an exploit. This is my code:... (2 Replies)
Discussion started by: dano88
2 Replies

14. HP-UX

Serial standard communication (stty)

Hello friends, I am trying to communicate with a programmer memory from Unix (HP-UX) via serial port. Well, I have some code ready stty parameters to achieve communicating the device with the computer, but I have my doubts. I would like to know if you have some code fragment where you use the... (5 Replies)
Discussion started by: Monttanna
5 Replies

15. UNIX for Advanced & Expert Users

Stty help in korn shell

We are getting a following stty error when I am running a script. stty: standard input: Inappropriate ioctl for device I have some of following stty settings in my .profile. Tried other options still not able to fix it. stty rows 40 cols 130 erase ^? intr ^C export TERM=xterm stty... (6 Replies)
Discussion started by: srikanth38
6 Replies