看护进度之Sessions

 
创制其他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:是单个或七个进程组的1个凑合。

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

process establishes a new session by calling the setsid function.
进程靠调用setsid()创设三个对话。
#include <unistd.h>
亚洲必赢app,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.
而子进度取得一个新历程ID。因而,子进度ID等于它继续的历程组ID是不或者的。

发表评论

电子邮件地址不会被公开。 必填项已用*标注

网站地图xml地图