Beispiel #1
0
asmlinkage long sys_getsid(pid_t pid)
{
	struct task_struct *p;
	struct pid *sid;
	int retval;

	rcu_read_lock();
	if (!pid)
		sid = task_session(current);
	else {
		retval = -ESRCH;
		p = find_task_by_vpid(pid);
		if (!p)
			goto out;
		sid = task_session(p);
		if (!sid)
			goto out;

		retval = security_task_getsid(p);
		if (retval)
			goto out;
	}
	retval = pid_vnr(sid);
out:
	rcu_read_unlock();
	return retval;
}
Beispiel #2
0
asmlinkage long sys_getsid(pid_t pid)
{
	if (!pid) {
		return current->signal->session;
	} else {
		int retval;
		struct task_struct *p;

		read_lock(&tasklist_lock);
		p = find_task_by_pid(pid);

		retval = -ESRCH;
		if(p) {
			retval = security_task_getsid(p);
			if (!retval)
				retval = p->signal->session;
		}
		read_unlock(&tasklist_lock);
		return retval;
	}
}
Beispiel #3
0
asmlinkage long sys_getsid(pid_t pid)
{
	if (!pid)
		return task_session_vnr(current);
	else {
		int retval;
		struct task_struct *p;
		struct pid_namespace *ns;

		ns = current->nsproxy->pid_ns;

		read_lock(&tasklist_lock);
		p = find_task_by_pid_ns(pid, ns);
		retval = -ESRCH;
		if (p) {
			retval = security_task_getsid(p);
			if (!retval)
				retval = task_session_nr_ns(p, ns);
		}
		read_unlock(&tasklist_lock);
		return retval;
	}
}