questions about pseudo termial


 
Thread Tools Search this Thread
Top Forums Programming questions about pseudo termial
# 1  
Old 08-24-2011
questions about pseudo termial

I am studying APUE(advanced programming in the unix environment). I have read up to chapter19 pseudo terminal. I know that the pty is like a fake device for programs to direct STDIN and STDOUT to. But I don't know why we need it. Can someone tell me what is the use of pseudo terminal. Thanks.
# 2  
Old 08-24-2011
If you know why we need a terminal, it will be easy for you to know why we need a pseudo terminal. A terminal doest'nt just get your raw inputs and displays them, but also process them, eg: color, font, escape sequences. the ways terminals work vary, like vt100 and x-term. A pseudo terminal is a software amulated terminal to meet the need on internet.
# 3  
Old 08-24-2011
back in the day systems only had physical terminals(tty) - eg. old school green screens. Remote sessions use pty - eg. telnet, ssh.
# 4  
Old 08-25-2011
Quote:
Originally Posted by tefino
I am studying APUE(advanced programming in the unix environment). I have read up to chapter19 pseudo terminal. I know that the pty is like a fake device for programs to direct STDIN and STDOUT to. But I don't know why we need it. Can someone tell me what is the use of pseudo terminal. Thanks.
Several reasons, but it comes down to the way terminals are used on a UNIX system.

Things run by cron or system services don't get a terminal, and this is a problem. What if your ssh keys are messed up, and it prints "type password:" into /dev/null and hangs forever? UNIX solved this problem by adding three features:
  • The 'controlling terminal'. The kernel remembers which terminal a program belongs to, if any. Any interactive session uses a terminal.
  • The special '/dev/tty' device, which opens your terminal again if you need it. Programs which really, really need to talk to a human and not whatever program's next in the pipe chain can open /dev/tty and print directly to their screen.
  • The isatty() system call, which lets a program tell whether stdin/stdout/stderr is a terminal or not.

So when you do command | ssh username@host othercommand ssh will see that you're logged in interactively, and open your terminal directly to ask you for a password.

Of course, these days, most terminals aren't real, physical terminals. So a virtual terminal device is used to get all the side-effects of a real terminal without actually being in a terminal.
This User Gave Thanks to Corona688 For This Post:
# 5  
Old 08-25-2011
Thanks, man. Your reply gives me some insights.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

pseudo device?

sometimes I see this message in dmesg: what does it mean? thanks. (5 Replies)
Discussion started by: orange47
5 Replies

2. Homework & Coursework Questions

Print questions from a questions folder in a sequential order

1.) I am to write scripts that will be phasetest folder in the home directory. 2.) The folder should have a set-up,phase and display files I have written a small script which i used to check for the existing users and their password. What I need help with: I have a set of questions in a... (19 Replies)
Discussion started by: moraks007
19 Replies

3. UNIX for Dummies Questions & Answers

Pseudo Terminal

How can i view what my colleague is doing in the terminal pts/1 while i have logged into terminal pts/2 ?? Both have remotely logged in via ssh. (4 Replies)
Discussion started by: proactiveaditya
4 Replies

4. UNIX for Advanced & Expert Users

Need pseudo connectivity

Hi All, I have putty on my system (Vista). I need some server details to login via internet for my personnel practice. Can any body help me out. In case this not feasible, just let me know any other way to work with UNIX terminal on Windows Vista itself. Please help me since i am desparately... (3 Replies)
Discussion started by: vikas_kesarwani
3 Replies

5. Solaris

what is /devices/pseudo/ ??

Hi all, what does this mean? if then <something> fi here is what i know.. it checks if the specified argument no($devid) in some function call is made into a block device and then proceeds with the execution of the loop. However am not understand what lofi@0:means? also is there... (3 Replies)
Discussion started by: wrapster
3 Replies

6. Solaris

pseudo: [ID 129642 kern.info] pseudo-device: vol0

Hi I have a system that gave me some messages on bootup that I was not used to seeing: pseudo: pseudo-device: vol0 genunix: vol0 is /pseudo/vol@0 these came with these: Feb 13 17:42:17 system1 eri: SUNW,eri0 : 100 Mbps full duplex link up Feb 13 17:42:21 system1sendmail: My unqualified... (0 Replies)
Discussion started by: mndavies
0 Replies

7. Solaris

Monitering Other Termial

Dear Jems, Is it possible as a admin what commands are excuting in other terminal. Example:if the who cmd output is like these Can i watch online means at presently what commands are executing in the terminal "pts/7"/ (172.17.17.87) and result of the command. root console Oct 13... (3 Replies)
Discussion started by: salaathi
3 Replies

8. SCO

pseudo driver

explain differences between a device driver & a pseudo driver...???? thanks in advance (1 Reply)
Discussion started by: areef4u
1 Replies

9. Programming

Pseudo Terminals

I need to spawn a number of foreground process by reading a configuration file. Each process needs some form of I/O. Hence I need to run it on different terminals. How it can be done programatically , i.e. , my module needs to find which terminal is not in use, then open it, execute the process... (2 Replies)
Discussion started by: S.P.Prasad
2 Replies

10. UNIX for Dummies Questions & Answers

redirect termial output

How can I redirect the terminal out put to another terminal. ie. ifI give ls command in 1st telenet window, output of ls command should go to 2nd telenet window. (2 Replies)
Discussion started by: sushrut
2 Replies
Login or Register to Ask a Question