On Tue, Mar 14, 2017 at 4:42 PM, Leixiang Wu <[email protected]> wrote:
> Hi,
>
> I am using strace to capture system call traces of a program. I would like
> to capture session ID and process group ID. Is this possible in strace? I
> looked the man page. It doens't say anything about those two process state
> information.
As strace is a system call tracer, this functionality is quite out of
its scope[1]. One can get this information from /proc/${pid}/stat, as
proc(5) suggests:
/proc/[pid]/stat
Status information about the process. This is used
by ps(1). It is defined in the kernel
source file fs/proc/array.c.
The fields, in order, with their proper scanf(3) format
specifiers, are listed below. Whether
or not certain of these fields display valid
information is governed by a ptrace access mode
PTRACE_MODE_READ_FSCREDS | PTRACE_MODE_NOAUDIT check
(refer to ptrace(2)). If the check
denies access, then the field value is displayed as 0.
The affected fields are indicated with
the marking [PT].
<...>
(5) pgrp %d
The process group ID of the process.
(6) session %d
The session ID of the process.
[1] You can, however, try to capture setpgid/getpgid and setsid/getsid
syscalls, in case you are sure tracee calls these.
> Best,
> Leixiang Wu
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Strace-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/strace-devel
>
--
Eugene Syromyatnikov
mailto:[email protected]
xmpp:esyr@jabber.{ru|org}
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Strace-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/strace-devel