:The version of Linux kernel source that I have uses the first:
:
:asmlinkage long sys_getppid(void)
:{
: int pid;
: struct task_struct * me = current;
: struct task_struct * parent;
:
: parent = me-p_opptr;
: for (;;) {
: pid = parent-pid;
:#if
* Greg Lehey [EMAIL PROTECTED] [000403 18:07] wrote:
On Sunday, 2 April 2000 at 17:23:49 -0700, Alfred Perlstein wrote:
* Matthew Dillon [EMAIL PROTECTED] [000402 17:04] wrote:
:I did look at the code, struct proc is allocated from a zone,
:meaning it won't "go away" once allocated,
* Matt Dillon [EMAIL PROTECTED] [000402 11:18] wrote:
dillon 2000/04/02 10:52:44 PDT
Modified files:
sys/i386/i386support.s
sys/kern init_sysent.c kern_prot.c kern_sig.c
Log:
Make the sigprocmask() and geteuid() system calls MP SAFE. Expand
:Along with snagging the "easy ones" for MP safeness, shouldn't getpid
:be MP safe? The struct proc is allocated from the proc_zone, and
:afaik zalloc allows for stable storage meaning it's safe to dereference
:the ppid pointer once the entire struct proc is populated, which needs
:to happen
* Matthew Dillon [EMAIL PROTECTED] [000402 16:37] wrote:
:Along with snagging the "easy ones" for MP safeness, shouldn't getpid
:be MP safe? The struct proc is allocated from the proc_zone, and
:afaik zalloc allows for stable storage meaning it's safe to dereference
:the ppid pointer once
:I did look at the code, struct proc is allocated from a zone,
:meaning it won't "go away" once allocated, there's no danger in
:dereferencing p_pptr, I don't get it.
:
:--
:-Alfred Perlstein - [[EMAIL PROTECTED]|[EMAIL PROTECTED]]
:"I have the heart of a child; I keep it in a jar on my desk."
* Matthew Dillon [EMAIL PROTECTED] [000402 17:04] wrote:
:I did look at the code, struct proc is allocated from a zone,
:meaning it won't "go away" once allocated, there's no danger in
:dereferencing p_pptr, I don't get it.
:
:--
:-Alfred Perlstein - [[EMAIL PROTECTED]|[EMAIL PROTECTED]]
:Good call.
:
:Ugh, I should think about this more, but i'll just grasp at straws
:and suggest that p_pptr is set to volatile variable, and we re-read
:it after we snarf the pid from the pointer and make sure it hasn't
:changed out from under us.
:
:Either that or store it in the child's proc