Peter Williams wrote:Andrew Morton wrote:On Tue, 20 Jun 2006 18:20:48 -0700
Matt Helsley <matthltc@xxxxxxxxxx> wrote:
I've been looking through the source and, from what I can see, the endno......Assuming you meant s/task/function/:+static inline int notify_per_task_watchers(unsigned int val,It's possible for this task to exit without returning a result.
+ struct task_struct *task)
+{
+ if (get_watch_event(val) != WATCH_TASK_INIT)
+ return raw_notifier_call_chain(&task->notify, val, task);
+ RAW_INIT_NOTIFIER_HEAD(&task->notify);
+ if (task->real_parent)
+ return raw_notifier_call_chain(&task->real_parent->notify,
+ val, task);
+}
In the common case this will return a result because most tasks have a
real parent. The only exception should be the init task. However, the
init task does not "fork" from another task so this function will never
get called with WATCH_TASK_INIT and the init task.
This means that if one wants to use per-task watchers to associate data
and a function call with *every* task, special care will need to be
taken to register with the init task.
of the function is not reachable. I think I need to add:
notify_watchers(WATCH_TASK_INIT, &init_task);
to make this into an applicable warning.
If the end of the function isn't reachable then the
`if (task->real_parent)' can simply be removed.
Perhaps with a comment to say that it's safe (and why) to dereference task->real_parent to help code reviewers?
Now that I understand this code better, I'm at a loss to understand why you're calling the parent with the notifier. I can't think of any circumstances where this would be useful.