Re: [Lse-tech] [PATCH 09/11] Task watchers: Add support for per-task watchers

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

 



On Tue, 2006-06-20 at 16:15 -0700, Andrew Morton wrote:
> Matt Helsley <[email protected]> wrote:
> >
> > > > +static inline int notify_per_task_watchers(unsigned int val,
> > > > +					   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);
> > > > +}
> > > 
> > > It's possible for this task to exit without returning a result.
> > 
> > Assuming you meant s/task/function/:
> > 
> > 	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.
> 
> no......

	I've been looking through the source and, from what I can see, the end
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.

> It's possible for this function to fall off the end without returning
> anything.  The compiler should have spat a warning.

	I'll add a return value at the end of the function as well as the above
notification to keep things uniform and address the compiler warning.

	Incidentally, I've looked at my compilation logs and I did not get any
warnings (gcc version 3.3.4 (Debian 1:3.3.4-3)).

Cheers,
	-Matt Helsley

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux