tech-kern archive

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

Re: dtrace ioctls



On Wed, Oct 19, 2011 at 10:01:33PM +0100, David Laight wrote:
 > > > some dtrace ioctls, including DTRACEIOC_AGGSNAP, are defined as
 > > > the following.
 > > > 
 > > >  #define DTRACEIOC_AGGSNAP       _IOW('x',7,dtrace_bufdesc_t *)
 > > > 
 > > > and libdtrace has diffs like the following.
 > > > 
 > > >  #if defined(sun)
 > > >          if (dt_ioctl(dtp, DTRACEIOC_AGGSNAP, buf) == -1) {
 > > >  #else
 > > >          if (dt_ioctl(dtp, DTRACEIOC_AGGSNAP, &buf) == -1) {
 > > >  #endif
 > > > 
 > > > they seem weird to me.
 > > > why can't they be like the following?
 > > > 
 > > >  _IOW('x',7,dtrace_bufdesc_t)
 > > 
 > > I don't see any obvious reason... even though dtrace_bufdesc_t is not
 > > actually a primitive type, it's only a 40-byte structure, so it should
 > > be fine...
 > 
 > Hmmm... the sun code is passing the structure by value 

Is it? The non-sun code appears to be calling an ioctl that's defined
to take a pointer to a pointer to a structure. Or maybe I'm totally
misreading ioccom.h?

 > - which is
 > probably ABI compatible with passing the address of a copy!

yes, I was thinking of that :-/

-- 
David A. Holland
dholland%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index