From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932684Ab1JNLF3 (ORCPT ); Fri, 14 Oct 2011 07:05:29 -0400 Received: from mail-bw0-f46.google.com ([209.85.214.46]:59862 "EHLO mail-bw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754236Ab1JNLF1 (ORCPT ); Fri, 14 Oct 2011 07:05:27 -0400 Message-Id: <20111014110511.416851818@openvz.org> User-Agent: quilt/0.48-1 Date: Fri, 14 Oct 2011 15:04:19 +0400 From: Cyrill Gorcunov To: linux-kernel@vger.kernel.org Cc: Andrew Vagin , Pavel Emelyanov , James Bottomley , Glauber Costa , "H. Peter Anvin" , Ingo Molnar , Tejun Heo , Dave Hansen , "Eric W. Biederman" , Daniel Lezcano , Alexey Dobriyan , Cyrill Gorcunov Subject: [patch 3/5] fs, proc: Add /proc/$pid/tls entry References: <20111014110416.552685686@openvz.org> Content-Disposition: inline; filename=fs-proc-add-tls Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- fs/proc/base.c | 20 ++++++++++++++++++++ 1 file changed, 20 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,23 @@ static int proc_pid_personality(struct s return err; } +#ifdef CONFIG_X86 +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; +} +#endif + /* * Thread groups */ @@ -3169,6 +3186,9 @@ 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), +#ifdef CONFIG_X86 + ONE("tls", S_IRUGO, proc_pid_tls), +#endif INF("limits", S_IRUGO, proc_pid_limits), #ifdef CONFIG_SCHED_DEBUG REG("sched", S_IRUGO|S_IWUSR, proc_pid_sched_operations),