Skip to content

Commit

Permalink
tty: Move session_of_pgrp() and make static
Browse files Browse the repository at this point in the history
tiocspgrp() is the lone caller of session_of_pgrp(); relocate and
limit to file scope.

Signed-off-by: Peter Hurley <[email protected]>
Reviewed-by: Alan Cox <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
peterhurley authored and gregkh committed Nov 6, 2014
1 parent 2c411c1 commit e1c2296
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 24 deletions.
21 changes: 21 additions & 0 deletions drivers/tty/tty_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -2515,6 +2515,27 @@ struct pid *tty_get_pgrp(struct tty_struct *tty)
}
EXPORT_SYMBOL_GPL(tty_get_pgrp);

/*
* This checks not only the pgrp, but falls back on the pid if no
* satisfactory pgrp is found. I dunno - gdb doesn't work correctly
* without this...
*
* The caller must hold rcu lock or the tasklist lock.
*/
static struct pid *session_of_pgrp(struct pid *pgrp)
{
struct task_struct *p;
struct pid *sid = NULL;

p = pid_task(pgrp, PIDTYPE_PGID);
if (p == NULL)
p = pid_task(pgrp, PIDTYPE_PID);
if (p != NULL)
sid = task_session(p);

return sid;
}

/**
* tiocgpgrp - get process group
* @tty: tty passed by user
Expand Down
3 changes: 0 additions & 3 deletions include/linux/kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -411,9 +411,6 @@ extern int __kernel_text_address(unsigned long addr);
extern int kernel_text_address(unsigned long addr);
extern int func_ptr_is_kernel_text(void *ptr);

struct pid;
extern struct pid *session_of_pgrp(struct pid *pgrp);

unsigned long int_sqrt(unsigned long);

extern void bust_spinlocks(int yes);
Expand Down
21 changes: 0 additions & 21 deletions kernel/exit.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,27 +214,6 @@ void release_task(struct task_struct *p)
goto repeat;
}

/*
* This checks not only the pgrp, but falls back on the pid if no
* satisfactory pgrp is found. I dunno - gdb doesn't work correctly
* without this...
*
* The caller must hold rcu lock or the tasklist lock.
*/
struct pid *session_of_pgrp(struct pid *pgrp)
{
struct task_struct *p;
struct pid *sid = NULL;

p = pid_task(pgrp, PIDTYPE_PGID);
if (p == NULL)
p = pid_task(pgrp, PIDTYPE_PID);
if (p != NULL)
sid = task_session(p);

return sid;
}

/*
* Determine if a process group is "orphaned", according to the POSIX
* definition in 2.2.2.52. Orphaned process groups are not to be affected
Expand Down

0 comments on commit e1c2296

Please sign in to comment.