Peter Memishian wrote:
> > >> 2. removal of the rvalp arg from the ioctl signature.
> > >>
> > >> the rvalp is useful if you want the ioctl to return something other
> than
> > >> 0 or -1. e.g. if you want to have your own error space other than use
> > >> the unix error space, you can return the error code this way. without
> > >> this, you'd have to embed a diagnostic value in each of your ioctl
> > >> command structures, which would still work but is not an ideal solution.
>
> So how would this mechanism work? That is, how does the framework know
> that *rvalp has been set, and how does the resulting error code get
> propagated up to userland?
>
framework doesn't have to know.
in common/syscall/ioctl.c:
error = VOP_IOCTL(fp->f_vnode, cmd, arg, flag, CRED(), &rv, NULL);
if (error != 0) {
releasef(fdes);
return (set_errno(error));
}
....
return (rv); <--- could be modified by our ioctl
if errno is set, -1 is returned, otherwise rv (by default = 0) is returned.
eric
_______________________________________________
networking-discuss mailing list
[email protected]