Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Connection between terminal and processes Post 303019303 by Corona688 on Tuesday 26th of June 2018 03:06:21 PM
Old 06-26-2018
Quote:
Originally Posted by saeed13r
I'd never known that there is a session between processes and the terminal, how come is this?
You probably know roughly what it's doing - foreground and background processes, SIGINT on ctrl-c, any background process clutter cleaned up with SIGHUP when you quit, et cetera. This is the minutae on how the OS accomplishes that. It needs to know what processes belong to you to do that, and "you" means your login - i.e. your controlling terminal.

This assumption goes pretty deep. Things like sudo and ssh directly talk to your controlling terminal to get passwords securely, in the expectation that a terminal is a direct realtime line to the user - and if there isn't any controlling terminal, it shouldn't even try to ask for a password.

This control scheme goes all the way back to serial line modems. Some features come directly from that - like process cleanup on exit. When a serial line modem disconnects, it tells the operating system, causing the operating system to send SIGHUP - hangup - to all the processes spawned from it!
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

concurrent terminal connections and processes

we've got solaris 5.6 installed in a ultra 5 box that serves as gateway server going to the main unix box. just like to find out how to determine the number of concurrent terminal connections and processes that the ultra 5 box can handle? and handling at present time? thanks in advance! (1 Reply)
Discussion started by: eddie_villarta
1 Replies

2. UNIX for Dummies Questions & Answers

Howto setup terminal connection Solaris10?

Hello, Which services and daemons are used in Solaris in order to connect to Solaris10 from windows-Reflection ? Please just give me a brief information, I can read details from other resources. Thanks (0 Replies)
Discussion started by: XNOR
0 Replies

3. UNIX for Dummies Questions & Answers

terminal connection

Hello, I've a Solaris10 installed on a x86 based pc and want to connect via lan by using Windows&Reflection. To Set up a terminal connection to Solaris10, which services should I run on Solaris? Thanks (1 Reply)
Discussion started by: XNOR
1 Replies

4. UNIX for Advanced & Expert Users

Monitoring Processes - Killing hung processes

Is there a way to monitor certain processes and if they hang too long to kill them, but certain scripts which are expected to take a long time to let them go? Thank you Richard (4 Replies)
Discussion started by: ukndoit
4 Replies

5. Solaris

Identifying and grouping OS processes and APP processes

Hi Is there an easy way to identify and group currently running processes into OS processes and APP processes. Not all applications are installed as packages. Any free tools or scripts to do this? Many thanks. (2 Replies)
Discussion started by: wilsonee
2 Replies

6. Solaris

Solaris 10 ftp connection problem (connection refused, connection timed out)

Hi everyone, I am hoping anyone of you could help me in this weird problem we have in 1 of our Solaris 10 servers. Lately, we have been having some ftp problems in this server. Though it can ping any server within the network, it seems that it can only ftp to a select few. For most servers, the... (4 Replies)
Discussion started by: labdakos
4 Replies

7. Hardware

ADDS Regent 25 video terminal connection problem, help please :o(

Hi all, you may remember that I picked up an ADDS Regent 25 from where I worked a while ago. Well, I've been trying to connect it up to the laptop so that the laptop can act as a server for it. I've just finished making a cable for it, I connected the DB25 EIA loop of the ADDS to a serial... (6 Replies)
Discussion started by: RetroGamerVX
6 Replies

8. Homework & Coursework Questions

Display info about users (UID GID processes terminal)

I would like to get an opinion for my solution for this task and get feedback about better approach or mistakes I have made. 1. The problem statement, all variables and given/known data: The task is to create a script which prints information about users whose names are specified in the... (2 Replies)
Discussion started by: kornfan
2 Replies

9. Shell Programming and Scripting

Cannot get terminal application to launch with a graphical launcher when successful in terminal

I have been having an extremely annoying problem. For the record, I am relatively new at this. I've only been working with unix-based OS's for roughly two years, mostly Xubuntu and some Kali. I am pretty familiar with the BASH language, as that's the default shell for debian. Now, I've made this... (16 Replies)
Discussion started by: Huitzilopochtli
16 Replies

10. Shell Programming and Scripting

Pgrep for processes which are not associated with a terminal in Ubuntu

I would like to find all of the PIDs of processes which are not associated with a terminal and started by CRON. When I do the ps aux | less command, I see in the TTY field a lot of processes with ? character I would like to get those processes ID, is there a way to do that with pgrep? ... (1 Reply)
Discussion started by: ASF Studio
1 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.44 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 02:02 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy