Subject: Re: VM_CMD() vs VM_CMD2()
To: Matt Thomas <matt@3am-software.com>
From: Bang Jun-Young <junyoung@netbsd.org>
List: tech-kern
Date: 08/23/2003 13:04:06
Oops, VM_CMD* should read NEW_VMCMD* (I needed more caffeine at the time
of that writing :-).

On Thu, Aug 21, 2003 at 07:39:27PM -0700, Matt Thomas wrote:
> 
> On Thursday, August 21, 2003, at 06:51 PM, Bang Jun-Young wrote:
> 
> >Hi,
> >
> >Could anyone shed light on why there are VM_CMD() and VM_CMD2() macros
> >defined separately in sys/exec.h? VM_CMD() is just a VM_CMD2() with
> >the last argument hardcoded 0 and doesn't seem to be very useful.
> 
> Because there are a lot of uses of NEW_VMCMD and only place the last 
> argument is going to be non-zero is in the loading of the ELF 
> interpreter.  So instead of changing all the instanses, adding a second 
> a #define with the flag seemed reasonable.  See sonewconn/sonewconn1 as 
> prior art.

Statistics:

NEW_VMCMD: 125 matches in 20 files
NEW_VMCMD2: 9 matches in 3 files.

Two places where NEW_VMCMD2() are used are kern/exec_elf32.c and
kern/exec_macho.c.

But I still prefer a single macro for the following reasons:

 a) it's simpler
 b) changing 125 matches is a mechanical work and shouldn't be difficult
 c) my own project is also using NEW_VMCMD2().

After all, it's just a matter of taste. :-)

Thanks,

Jun-Young

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