Re: get_pid problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi...

On Fri, May 21, 2010 at 19:33, Shyam Burkule <shyam.burkule@xxxxxxxxx> wrote:
> Hi All,
>   I am using Linux kernel 2.6.27(SLES11). I am getting one strange problem.
> I am using task_pid function followed by get_pid function to get pid
> structure.
> Here is code snippet,
>          struct *pid = get_pid(task_pid(current));
>
> I am saving this pid structure in a variable which is used later to kill the
> same process using kill_pid providing the same "pid *" which we saved
> earlier. Since kill_pid() requires "pid *", we have save this somewhere
> during process creation. Whenever we use get(task_pid(current)) in the code,
> I observed that the process is not visible in "ps -ef" as well as "/proc"
> filesystem.

The codes say that get_pid increments the "count" field of the pid
struct. I failed to find the related code in fs/proc that says
anything about "don't show a task with count higher than 0".

Thus, I could offer two hypotheses:
a. The code that "hides" the pid in /proc is something else, probably
additional code not included in mainline (since you're saying it's
SLES kernel, right?)

b. it's just coincidence, that when you do something on this pid, you
accidentally remove the task structure, or at least the pid struct.

Hopefully I offer you helpful arguments...

-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux