why group leader cannnot able create the session in Linux
来源:互联网 发布:nginx 静态文件服务器 编辑:程序博客网 时间:2024/06/16 07:31
Forbidding setsid()
in a process group leader is required by POSIX:
The
setsid()
function shall create a new session, if the calling process is not a process group leader.
It is required to ensure that all members of a process group are members of the same session.
Long answer
Process group ID is PID of process group leader. Session ID is PID of session leader. After successful setsid()
call, process group ID, session ID and PID should be the same.
However, for the process group leader, process group ID is already equal to PID. If it would be able to call setsid()
, it's process group ID remains the same, so that:
- process group leader belongs to the new session;
- other process group members belong to old session.
Thus, in this case we have a process group with members belonging to different sessions. POSIX wants to forbid this situation.
Why?
Process groups and sessions were invented for job control. Process groups are used to determine foreground and background groups, so that foreground group will receive signals from terminal.
To implement this, terminal tracks its current foreground process group and sends signal to that group when some event occurs.
But this assumes that all processes from any given process group share the same controlling terminal, so that signals sent by terminal are meaningful for them.
Controlling terminal is shared by the following rules:
- all processes from the same session share the same controlling terminal;
- processes from different sessions can't share the same controlling terminal.
Thus, if we require all members of a process group to share the same controlling terminal, we also should require them to be members of the same session.
Reference
See "The Linux Programming Interface", Chapter 34 (Process Groups, Sessions, and Job Control).
https://stackoverflow.com/questions/27523451/why-group-leader-cannnot-able-create-the-session-in-linux- why group leader cannnot able create the session in Linux
- Stepping in as the new leader
- Msg 15581 Please create a master key in the database or open the master key in the session
- why excute self.session getTasksWithCompletionHandler in initWithSessionConfiguration?
- Software Development Group Leader
- OUI-67076 : OracleHomeInventory was not able to create a lock file" in Unix
- 145.Examine the commands executed in a DBA session: SQL> CREATE BIGFILE TABLESPACE MRKT 2 DATAFILE '
- cannnot find the Word template : WordToRqm.dot
- cannnot find the Word template : WordToRqm.dot
- why cannot sleep in the ISR
- people are able to buy the same products anywhere in the world
- A group password in Linux
- A group password in Linux
- session dialog in the SIP
- the type java.util.Map$Entry cannnot be resolved 解决办法
- what you like most in the city,why?
- Why can templates only be implemented in the header file?
- Why in the code “456”+1, output is “56”
- 简单选择排序、直接插入排序、归并排序
- 案例:数据库open时报错ORA-1172,ORA-1151 处理
- 斯坦福《编程方法学》Karel环境搭建问题一:运行时出现jpanel面板只有file选项 没有karel机器人的现象
- 使用mybatis-generator自动生成dao、model和mapper
- Springmvc controller 层 @Transactional 不起作用
- why group leader cannnot able create the session in Linux
- Volley NetworkImageView setImageResource 不起作用 原因
- 背包问题 初始化
- vue开发公共模块封装(http)
- Java学习笔记—注解(Annotation)的用法
- PHP的4种常见运行模式
- Pick apples
- 【离散化】【转载】
- 终于等来面试,但要注意这四个信号!