* task_struct's real_parent vs parent members
@ 2012-02-26 20:40 Vimal
2012-02-27 7:48 ` Mulyadi Santosa
0 siblings, 1 reply; 5+ messages in thread
From: Vimal @ 2012-02-26 20:40 UTC (permalink / raw)
To: kernelnewbies
Hi,
I am looking through kernel 3.2's task_struct, which has two pointers
for parents: real_parent and parent
(http://lxr.free-electrons.com/source/include/linux/sched.h#L1313) I
would like to know why there are two pointers, and how these two
differ.
init_task's parent and real_parent are initialised to point to itself.
Since the main way processes are created is through fork()/clone(), I
tried following do_fork function to see where a newly created
process's parent is set, but I am unable to find it. I see that
do_fork dups the current task_struct, and only updates the new
process's real_parent, depending on flags (passed via clone/fork
syscall).
The documentation in sched.h:1313 says that "parent" refers to the
parent task that would receive SIGCHLD (i.e., the one that issues
wait4()). I followed the wait4() syscall to do_wait(), I still am not
able to find where the task's parent is updated.
Is there something I'm missing?
Thanks,
--
Vimal
^ permalink raw reply [flat|nested] 5+ messages in thread
* task_struct's real_parent vs parent members
2012-02-26 20:40 task_struct's real_parent vs parent members Vimal
@ 2012-02-27 7:48 ` Mulyadi Santosa
2012-02-27 16:45 ` Vimal
0 siblings, 1 reply; 5+ messages in thread
From: Mulyadi Santosa @ 2012-02-27 7:48 UTC (permalink / raw)
To: kernelnewbies
Hi Vimal...
On Mon, Feb 27, 2012 at 03:40, Vimal <j.vimal@gmail.com> wrote:
> The documentation in sched.h:1313 says that "parent" refers to the
> parent task that would receive SIGCHLD (i.e., the one that issues
> wait4()). ?I followed the wait4() syscall to do_wait(), I still am not
> able to find where the task's parent is updated.
I am bit rusty here, but AFAIK sigchld is thrown to the process who
ptrace another process. CMIIW
--
regards,
Mulyadi Santosa
Freelance Linux trainer and consultant
blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* task_struct's real_parent vs parent members
2012-02-27 7:48 ` Mulyadi Santosa
@ 2012-02-27 16:45 ` Vimal
2012-02-27 20:58 ` Vimal
0 siblings, 1 reply; 5+ messages in thread
From: Vimal @ 2012-02-27 16:45 UTC (permalink / raw)
To: kernelnewbies
Hi Mulyadi,
On 26 February 2012 23:48, Mulyadi Santosa <mulyadi.santosa@gmail.com> wrote:
> I am bit rusty here, but AFAIK sigchld is thrown to the process who
> ptrace another process. CMIIW
>
sigchld's definition [1] says it's sent to the parent process when a
child terminates.
But I do agree that the notion of a parent seems a bit ambiguous when
a process is being ptraced.
ptrace is what I found when looking through some websites, and you may
very well be correct. But as always, it is good to confirm through
code. :) Let me try checking the ptrace functions.
Thanks!
--
Vimal
^ permalink raw reply [flat|nested] 5+ messages in thread
* task_struct's real_parent vs parent members
2012-02-27 16:45 ` Vimal
@ 2012-02-27 20:58 ` Vimal
2012-02-27 21:15 ` Mulyadi Santosa
0 siblings, 1 reply; 5+ messages in thread
From: Vimal @ 2012-02-27 20:58 UTC (permalink / raw)
To: kernelnewbies
Hi Mulyadi,
You were right. I found this code, which is called from
ptrace_attach function:
http://lxr.free-electrons.com/source/kernel/ptrace.c#L41
Thanks :)
On 27 February 2012 08:45, Vimal <j.vimal@gmail.com> wrote:
> Hi Mulyadi,
>
> On 26 February 2012 23:48, Mulyadi Santosa <mulyadi.santosa@gmail.com> wrote:
>> I am bit rusty here, but AFAIK sigchld is thrown to the process who
>> ptrace another process. CMIIW
>>
>
> sigchld's definition [1] says it's sent to the parent process when a
> child terminates.
>
> But I do agree that the notion of a parent seems a bit ambiguous when
> a process is being ptraced.
>
> ptrace is what I found when looking through some websites, and you may
> very well be correct. ? But as always, it is good to confirm through
> code. :) ? Let me try checking the ptrace functions.
>
> Thanks!
> --
> Vimal
--
Vimal
^ permalink raw reply [flat|nested] 5+ messages in thread
* task_struct's real_parent vs parent members
2012-02-27 20:58 ` Vimal
@ 2012-02-27 21:15 ` Mulyadi Santosa
0 siblings, 0 replies; 5+ messages in thread
From: Mulyadi Santosa @ 2012-02-27 21:15 UTC (permalink / raw)
To: kernelnewbies
On Tue, Feb 28, 2012 at 03:58, Vimal <j.vimal@gmail.com> wrote:
> Hi Mulyadi,
>
> You were right. ? I found this code, which is called from
> ptrace_attach function:
>
> http://lxr.free-electrons.com/source/kernel/ptrace.c#L41
Phewwww :) Like I said.... i am getting rusty :) glad to help btw :D
--
regards,
Mulyadi Santosa
Freelance Linux trainer and consultant
blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-02-27 21:15 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-26 20:40 task_struct's real_parent vs parent members Vimal
2012-02-27 7:48 ` Mulyadi Santosa
2012-02-27 16:45 ` Vimal
2012-02-27 20:58 ` Vimal
2012-02-27 21:15 ` Mulyadi Santosa
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).