fs, proc: Add /proc/$pid/tls entry

To be able to restart checkpointed tasks we need
to know TLS status at dumping time. Export this
information by /proc/$pid/tls entry.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
---
 fs/proc/base.c |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)

Index: linux-2.6.git/fs/proc/base.c
===================================================================
--- linux-2.6.git.orig/fs/proc/base.c
+++ linux-2.6.git/fs/proc/base.c
@@ -3150,6 +3150,21 @@ static int proc_pid_personality(struct s
 	return err;
 }
 
+static int proc_pid_tls(struct seq_file *m, struct pid_namespace *ns,
+			struct pid *pid, struct task_struct *task)
+{
+	int err = lock_trace(task);
+	if (!err) {
+		int i;
+		for (i = 0; i < GDT_ENTRY_TLS_ENTRIES; i++)
+			seq_printf(m, "%x %x\n",
+				   task->thread.tls_array[i].a,
+				   task->thread.tls_array[i].b);
+		unlock_trace(task);
+	}
+	return err;
+}
+
 /*
  * Thread groups
  */
@@ -3169,6 +3184,7 @@ static const struct pid_entry tgid_base_
 	INF("auxv",       S_IRUSR, proc_pid_auxv),
 	ONE("status",     S_IRUGO, proc_pid_status),
 	ONE("personality", S_IRUGO, proc_pid_personality),
+	ONE("tls",        S_IRUGO, proc_pid_tls),
 	INF("limits",	  S_IRUGO, proc_pid_limits),
 #ifdef CONFIG_SCHED_DEBUG
 	REG("sched",      S_IRUGO|S_IWUSR, proc_pid_sched_operations),
