Skip to content

Commit

Permalink
exit.c: unexport __set_special_pids()
Browse files Browse the repository at this point in the history
Move __set_special_pids() from exit.c to sys.c close to its single caller
and make it static.

And rename it to set_special_pids(), another helper with this name has
gone away.

Signed-off-by: Oleg Nesterov <[email protected]>
Cc: "Eric W. Biederman" <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
oleg-nesterov authored and torvalds committed Jul 3, 2013
1 parent 3f41854 commit 81dabb4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
2 changes: 0 additions & 2 deletions include/linux/sched.h
Original file line number Diff line number Diff line change
Expand Up @@ -1950,8 +1950,6 @@ extern struct task_struct *find_task_by_vpid(pid_t nr);
extern struct task_struct *find_task_by_pid_ns(pid_t nr,
struct pid_namespace *ns);

extern void __set_special_pids(struct pid *pid);

/* per-UID process charging. */
extern struct user_struct * alloc_uid(kuid_t);
static inline struct user_struct *get_uid(struct user_struct *u)
Expand Down
11 changes: 0 additions & 11 deletions kernel/exit.c
Original file line number Diff line number Diff line change
Expand Up @@ -312,17 +312,6 @@ kill_orphaned_pgrp(struct task_struct *tsk, struct task_struct *parent)
}
}

void __set_special_pids(struct pid *pid)
{
struct task_struct *curr = current->group_leader;

if (task_session(curr) != pid)
change_pid(curr, PIDTYPE_SID, pid);

if (task_pgrp(curr) != pid)
change_pid(curr, PIDTYPE_PGID, pid);
}

/*
* Let kernel threads use this to say that they allow a certain signal.
* Must not be used if kthread was cloned with CLONE_SIGHAND.
Expand Down
13 changes: 12 additions & 1 deletion kernel/sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -1309,6 +1309,17 @@ SYSCALL_DEFINE1(getsid, pid_t, pid)
return retval;
}

static void set_special_pids(struct pid *pid)
{
struct task_struct *curr = current->group_leader;

if (task_session(curr) != pid)
change_pid(curr, PIDTYPE_SID, pid);

if (task_pgrp(curr) != pid)
change_pid(curr, PIDTYPE_PGID, pid);
}

SYSCALL_DEFINE0(setsid)
{
struct task_struct *group_leader = current->group_leader;
Expand All @@ -1328,7 +1339,7 @@ SYSCALL_DEFINE0(setsid)
goto out;

group_leader->signal->leader = 1;
__set_special_pids(sid);
set_special_pids(sid);

proc_clear_tty(group_leader);

Expand Down

0 comments on commit 81dabb4

Please sign in to comment.