Skip to contentSkip to conversation

where to put kernel code to run on exec?

DISCUSSION Chris Friesen 2 participants 2 messages Jan 7, 2005 – Jan 8, 2005

lore
Share & tools
lore
#0 lore raw

I've added a field to the task struct to keep track of whether or not the process wants to be notified of various events. On exec() I'd like to clear this field.

I'm having problems finding a nice clean place to put the code to clear it. The obvious choice would be in the last bit of the success path in do_execve(), but there's nothing similar there already, so I'm probably missing something.

Is there some standard place to put code to run on a successful call to exec()?

Chris

Chris

#1 lore raw
Quoted 5 lines · Chris Friesen

I've added a field to the task struct to keep track of whether or not the process wants to be notified of various events. On exec() I'd like to clear this field.

Quoted 7 lines

I'm having problems finding a nice clean place to put the code to clear it. The obvious choice would be in the last bit of the success path in do_execve(), but there's nothing similar there already, so I'm probably missing something.

Is there some standard place to put code to run on a successful call to exec()?

What about in flush_old_exec()? Any place after exec_mmap() looks good. If the exec fails after that point, the process has to be killed, because all the old memory space is gone. In that case you don't have to worry about clearing the field because the process is gone.

Dave