From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1262 invoked by alias); 11 May 2009 12:21:18 -0000 Received: (qmail 1255 invoked by uid 22791); 11 May 2009 12:21:17 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_73 X-Spam-Check-By: sourceware.org Received: from mta-2.ms.rz.RWTH-Aachen.DE (HELO mta-2.ms.rz.rwth-aachen.de) (134.130.7.73) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 11 May 2009 12:21:11 +0000 MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; charset=ISO-8859-1; format=flowed Received: from ironport-out-1.rz.rwth-aachen.de ([134.130.5.40]) by mta-2.ms.rz.RWTH-Aachen.de (Sun Java(tm) System Messaging Server 6.3-7.04 (built Sep 26 2008)) with ESMTP id <0KJH00FGJBN9CLG0@mta-2.ms.rz.RWTH-Aachen.de> for systemtap@sources.redhat.com; Mon, 11 May 2009 14:21:09 +0200 (CEST) Received: from relay-2.ms.rz.rwth-aachen.de (HELO relay.rwth-aachen.de) ([134.130.7.75]) by ironport-in-1.rz.rwth-aachen.de with ESMTP; Mon, 11 May 2009 14:21:09 +0200 Received: from [134.61.14.38] (lx3b07.physik.RWTH-Aachen.DE [134.61.14.38]) by relay.rwth-aachen.de (8.13.8+Sun/8.13.8/1) with ESMTP id n4BCL8Xn021142; Mon, 11 May 2009 14:21:09 +0200 (CEST) Message-id: <4A081834.8080004@physik.rwth-aachen.de> Date: Mon, 11 May 2009 12:21:00 -0000 From: Malte Nuhn User-Agent: Thunderbird 1.5.0.12 (X11/20090324) To: Josh Stone Cc: systemtap@sources.redhat.com Subject: Re: context.stp - read session ID - function sid() References: <4A044A00.8000600@physik.rwth-aachen.de> <4A0490C2.6060004@redhat.com> In-reply-to: <4A0490C2.6060004@redhat.com> X-IsSubscribed: yes Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org X-SW-Source: 2009-q2/txt/msg00537.txt.bz2 Josh Stone wrote: > On 05/08/2009 08:04 AM, Malte Nuhn wrote: > >> There's basically no magic in it. I checked that the session information >> is stored in the "signal_struct" since Kernel version 2.6.0 - so i guess >> it should work on every machine that is running systemtap. >> > > Unfortunately, that field is going away -- see this in the kernel: > > commit 1b0f7ffd0ea27cd3a0b9ca04e3df9522048c32a3 > Author: Oleg Nesterov > Date: Thu Apr 2 16:58:39 2009 -0700 > > pids: kill signal_struct-> __pgrp/__session and friends > > > Frank already committed your patch, but can you research whether there's > a way to let this continue to work on 2.6.30+? > > Thanks, > > Josh > Oh - I'm sorry - I missed that. So here is, what I could find out: Since commit 7af5729474b5b8ad385adadab78d6e723e7655a3, there is static inline pid_t task_session_vnr(struct task_struct *tsk) which i guess should do the job. There are some more wrappers for tgid, pgrp, and pid. Perhaps one should use them in the future. I'm sorry, I don't have have a machine with some newer kernel running at the moment; that's why I actually couldn't test if the above solution really works... I read about process namespaces @ http://lwn.net/Articles/259217/ and I'm not quite sure, what one should do (even in general) with these. Being exact, a call like "pid()" or "sid()" is not "valid" anymore, since you need to specify the pid namespace. The easiest thing to do is to always pull out the virtual pid implicitly. But but then, the user should at least know that systemtap chose the virtual one. What do you think about that? Malte