Subject: pollscan (was Re: {sys,}trace_enter and retval arg)
To: Simon Burge <simonb@wasabisystems.com>
From: Bang Jun-Young <junyoung@netbsd.org>
List: tech-kern
Date: 10/27/2003 17:00:58
On Mon, Oct 27, 2003 at 04:40:26PM +0900, Bang Jun-Young wrote:
> On Mon, Oct 27, 2003 at 12:14:39PM +1100, Simon Burge wrote:
> > Folks,
> > 
> > trace_enter() and systrace_enter() don't use the return val arg
> > parsed to them.  Anyone mind if I remove them?  A mechanical diff
> > is below - I've test-compiled on a few archs so far without errors.
> 
> BTW, I remember one of sys_poll related functions not using the retval
> passed, either.

It's actually a different kind of code.

Currently pollscan() in sys_generic.c is defined as

int
pollscan(struct proc *p, struct pollfd *fds, int nfd, register_t *retval)

But unlike selscan() for sys_select(), it always returns 0 to the
caller,

	...
	*retval = n;
	return (0);
}

the following check in sys_poll()

	error = pollscan(p, (struct pollfd *)bits, SCARG(uap, nfds), retval);
	if (error || *retval)
		goto done;

can be simplified as

        pollscan(p, (struct pollfd *)bits, SCARG(uap, nfds), retval);
	if (*retval)
		goto done;

then pollscan() should be changed to return nothing (i.e. void).

I'm not sure if it is worth changing it, however.

Jun-Young

-- 
Bang Jun-Young <junyoung@NetBSD.org>