aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hurley <peter@hurleysoftware.com>2014-10-16 14:59:48 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-11-05 16:26:14 -0800
commite1c2296c3485158304bfad5a80e89078463d70c8 (patch)
tree98103d2003b9b478c60b8a546e4917880e2150e3
parent2c411c11020ff356748268ca9cae4c1b4c410f00 (diff)
tty: Move session_of_pgrp() and make static
tiocspgrp() is the lone caller of session_of_pgrp(); relocate and limit to file scope. Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Reviewed-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/tty/tty_io.c21
-rw-r--r--include/linux/kernel.h3
-rw-r--r--kernel/exit.c21
3 files changed, 21 insertions, 24 deletions
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index 114854c5554b..ae8f53c7972d 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -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
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 3d770f5564b8..01bc530fbfcb 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -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);
diff --git a/kernel/exit.c b/kernel/exit.c
index 5d30019ff953..6a3e2e5004ba 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -215,27 +215,6 @@ 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
* by terminal-generated stop signals. Newly orphaned process groups are