守护进度之Sessions

发布时间:2019-02-16  栏目:LINUX  评论:0 Comments

 
成立其余Session(User)的进度必要得到相应Session的Token作为CreateProcessAsUser的参数来运维进度。 

Sessions:A session is a collection of one or more process groups.

 
修改有System权限的Token的TokenId为其余Session的TokenId就足以在其它Session里面创制有System权限的长河了。

Sessions:是单个或七个进程组的一个凑合。

  相关的Blog: https://blog.csdn.net/highyyy/article/details/6129769

process establishes a new session by calling the setsid function.
进程靠调用setsid()创设1个会话。
#include <unistd.h>
pid_t setsid(void);

If the calling process is not a process group leader, this function
creates a new session. Three things happen
假诺调用进度不是主管进度,函数setsid()会创建三个新的对话。起到两个效用:
  1.The process becomes the session leader of this new session. (A
session leader is the process that creates a session.) 
     调用经过成为新会话的the session
leader。A session leader 是开创会话的经过。
     The process is the only process in this new session.
     在新的对话中,调用进度是绝无仅有的进度。
  2.The process becomes the process group leader of a new process group.
The new process group ID is the process ID of the calling process.
     调用经过成为新历程组的经理进度。新进度组ID就是调用进程的经过ID。
  3.The process has no controlling terminal. (We’ll discuss controlling
terminals in the next section.)   
     调用经过没有决定终端。
     If the process had a controlling terminal before calling setsid,
that association is broken.
     在调用setsid()从前,即使调用进度有支配终端,
那么调用进程会脱离那些决定终端。

 

This function returns an error if the caller is already a process group
leader. 

倘若调用进度一度是多个老板进度,则函数再次回到出错。
To ensure this is not the case, the usual practice is to call fork and
have the parent terminate and the child continue.
为了幸免那种境况暴发,平常的做法是调用fork()使父进度终止,子进度继续运转。
We are guaranteed that the child is not a process group leader, because
the process group ID of the parent is inherited by the child,
笔者们保险了子进程不是首席执行官进程,因为父进度的进度组ID没有被子进度继续,
but the child gets a new process ID. Hence, it is impossible for the
child’s process ID to equal its inherited process group ID.
而子进度取得3个新历程ID。因此,子进度ID等于它继续的经过组ID是不能的。

留下评论

网站地图xml地图