Subject: Re: IPF in our source tree
To: Martin Husemann <martin@duskware.de>
From: Martti Kuparinen <martti.kuparinen@iki.fi>
List: tech-kern
Date: 06/01/2007 13:31:52
Martin Husemann wrote:
> On Fri, Jun 01, 2007 at 12:59:22PM +0300, Martti Kuparinen wrote:
>> - In some files under src/sys/dist/ipf/netinet the original code checks
>>   the return value from BCOPYIN() but we have removed those checks. Why?
>>   Any objections if I revert back to the original version?
> 
> That is not possible. The idiom used by Darren does not work for NetBSD,
> it can not even compile (unless you paper over it with gcc'isms and make
> the macros always return 0, which is not a lot better than the current
> state).

I don't understand this, copyin() is a normal function which takes 3 arguments 
and returns an int. The BCOPYIN macro is just an "alias" for copyin(), i.e. the 
preprosessor replaces BCOPYIN with copyin before the compiler compiles the code.

Isn't this exactly the same case as with the following test code?

n106:~> cat tryme.c
extern int copyin(const void *uaddr, void *kaddr, int len);

#define BCOPYIN(u, k, l) copyin((u), (k), (l))

int somename()
{
         char u[1], k[1];

         return BCOPYIN(&u, &k, sizeof(u));
}
n106:~> gcc -Wall -c tryme.c
n106:~>