菜单

manbetx网页手机登录版创造属于别的Session的经过

2019年2月8日 - UNIXSolaris

 
创设其余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()创立一个对话。
#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
假诺调用进度不是CEO进程,函数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.
     调用经过成为新历程组的CEO进度。新历程组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地图