2002-01-09 17:41:36

by Senhua Tao

[permalink] [raw]
Subject: absolute path of a process

Hi,

I am new to linux kernel. I like to know is there any way to find
the absolute path of a process. I mean, how the kernel knows which
process is currently running? I tried to follow the current variable
but got lost. Is the inode struct should I look at?

Thanks.

Sen Tao


2002-01-09 20:44:04

by Chris Wright

[permalink] [raw]
Subject: Re: absolute path of a process

* Senhua Tao ([email protected]) wrote:
> Hi,
>
> I am new to linux kernel. I like to know is there any way to find
> the absolute path of a process. I mean, how the kernel knows which
> process is currently running? I tried to follow the current variable
> but got lost. Is the inode struct should I look at?

look at the code in fs/proc/base.c::proc_exe_link(), that should explain
it.

cheers,
-chris

2002-01-09 23:39:15

by H. Peter Anvin

[permalink] [raw]
Subject: Re: absolute path of a process

Followup to: <[email protected]>
By author: Senhua Tao <[email protected]>
In newsgroup: linux.dev.kernel
>
> Hi,
>
> I am new to linux kernel. I like to know is there any way to find
> the absolute path of a process. I mean, how the kernel knows which
> process is currently running? I tried to follow the current variable
> but got lost. Is the inode struct should I look at?
>

Examine /proc/self/exe.

-hpa
--
<[email protected]> at work, <[email protected]> in private!
"Unix gives you enough rope to shoot yourself in the foot."
http://www.zytor.com/~hpa/puzzle.txt <[email protected]>