Sponsored Content
Full Discussion: Serial Lines Explained
Top Forums UNIX for Dummies Questions & Answers Serial Lines Explained Post 302912183 by Corona688 on Wednesday 6th of August 2014 11:56:56 AM
Old 08-06-2014
That's only half the story though. Serial ports in UNIX aren't just telecommunications, they're session control, job control, raw interaction.

I believe this all stems from the way terminals used to be used... You would login through a terminal, and that terminal would belong to you. Any processes you created would know what your terminal was(it would be your "controlling termina"). The kernel would know which processes were allowed to control it(foreground processes) or not allowed (background processes). Hitting ctrl-C would send SIGINT to processes belonging to your terminal. When you logged out, the group of processes belonging to that terminal would be killed.

Logging in through a remote teletype was almost the same, since it was an extension of the serial port. Modems had a few more signals, UNIX would know when a modem hung up for instance.

Having a "controlling terminal" does several things. For one thing, it means that all programs you run will be able to find out what your terminal is(they inherit their controlling terminal from you), and get direct access to it if they want it (by opening /dev/tty). This means that, even when you bury ssh in a 9-deep pipe chain, it can still go directly to the source and ask for your password. Or if /dev/tty can't be opened, they know there's no human there to ask for a password and just give up. If you ever see an error like "No tty present and no askpass program specified", that's what it means.

Last edited by Corona688; 08-06-2014 at 01:08 PM..
 

We Also Found This Discussion For You

1. Ubuntu

Ubuntu 9.04 Serial application to telnet to serial device

Hello! I am working on an application which reads environmental instruments which have serial ports. The application requires a serial port to be present to talk to the device (i.e. /dev/ttyS0 ). In some instances the environmental devices will be 100's of yards away from the computer, so a... (5 Replies)
Discussion started by: mvona
5 Replies
TCGETPGRP(3)						     Linux Programmer's Manual						      TCGETPGRP(3)

NAME
tcgetpgrp, tcsetpgrp - get and set terminal foreground process group SYNOPSIS
#include <unistd.h> pid_t tcgetpgrp(int fd); int tcsetpgrp(int fd, pid_t pgrp); DESCRIPTION
The function tcgetpgrp() returns the process group ID of the foreground process group on the terminal associated to fd, which must be the controlling terminal of the calling process. The function tcsetpgrp() makes the process group with process group ID pgrp the foreground process group on the terminal associated to fd, which must be the controlling terminal of the calling process, and still be associated with its session. Moreover, pgrp must be a (nonempty) process group belonging to the same session as the calling process. If tcsetpgrp() is called by a member of a background process group in its session, and the calling process is not blocking or ignoring SIGTTOU, a SIGTTOU signal is sent to all members of this background process group. RETURN VALUE
When fd refers to the controlling terminal of the calling process, the function tcgetpgrp() will return the foreground process group ID of that terminal if there is one, and some value larger than 1 that is not presently a process group ID otherwise. When fd does not refer to the controlling terminal of the calling process, -1 is returned, and errno is set appropriately. When successful, tcsetpgrp() returns 0. Otherwise, it returns -1, and errno is set appropriately. ERRORS
EBADF fd is not a valid file descriptor. EINVAL pgrp has an unsupported value. ENOTTY The calling process does not have a controlling terminal, or it has one but it is not described by fd, or, for tcsetpgrp(), this controlling terminal is no longer associated with the session of the calling process. EPERM pgrp has a supported value, but is not the process group ID of a process in the same session as the calling process. CONFORMING TO
POSIX.1-2001. NOTES
These functions are implemented via the TIOCGPGRP and TIOCSPGRP ioctls. History The ioctls appeared in 4.2BSD. The functions are POSIX inventions. SEE ALSO
setpgid(2), setsid(2), credentials(7) COLOPHON
This page is part of release 3.27 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. GNU
2003-01-28 TCGETPGRP(3)
All times are GMT -4. The time now is 05:38 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy