Subject: Re: Status report: sysmon_cpufreq(9) + powerctl(8)
To: Quentin Garnier <cube@cubidou.net>
From: Iain Hibbert <plunky@rya-online.net>
List: tech-kern
Date: 10/01/2006 15:20:41
On Sun, 1 Oct 2006, Quentin Garnier wrote:

> On Sun, Oct 01, 2006 at 09:52:42AM +0100, Iain Hibbert wrote:
> > On Sun, 1 Oct 2006, Juan RP wrote:
> >
> > > Interesting... if I use prop_dictionary_sendrecv_ioctl in powerctl.c it
> > > works but not with prop_dictionary_recv_ioctl that always returns
> > > ENOMEM.
> >
> > I think when you use _IOWR then you also must use _sendrecv_ (will look
> > properly in a bit, but I think both ioctls you have are IOWR?)
>
> There's no "must".  _IO?? defines what the kernel should do with the
> data, no matter what function you use that does the ioctl.

Well, you 'must' of course use the correct wrapper in this case otherwise
an error will occur.

If the cmd is IOW* and the kernel expects a valid struct plistref and if
you dont use prop_dictionary_send*_ioctl() then the kernel wont get a
valid plistref and the ioctl will fail.

> Anyway, now that prop_dictionary_recv_ioctl is just one ioctl call, it
> can be used with _IOR.

This also is a reason why I suggested to merge the wrappers to
prop_dictionary_ioctl() - the transfer direction is already encoded in the
command and to specify it separately should be unnecessary.

iain