Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
proposal: add new ioctls and refactor existing ioctls for solaris in x/sys/unix #14873
I propose adding 4 additional ioctl functions for solaris:
In addition, I propose modifying the existing IoctlGetInt function to support passing in a nil pointer for the ioctl arg parameter. In the case of IoctlGetInt and IoctlGetUint, if arg is nil, the return value is the same as the return value from the underlying ioctl function. If the arg pointer is not nil, then the return value is also written into the memory location pointed to by arg.
To support the functionality of IoctlGetInt and IoctlGetUint, we need to change the underlying ioctl function from the current definition:
The existing IoctlGet and IoctlSet functions would also need to be modified to use the updated ioctl function.
To summarize, the existing IoctlGetInt function would change from:
And the following 4 functions would be added:
changed the title
Proposal add new ioctl's and refactor existing ioctl's for solaris in x/sys/unix
Mar 22, 2016
I commented on the CL, but really should have said something here. This is a proposal but it was not accepted. Proposals should be handled faster, and that is not your fault.
My point is that I don't want to see ioctl get helpers to make it look nice. It really doesn't need int and uint and *Termio and *Whatever helpers. The caller can do the conversion. It may be uglier but it will actually be faster, and anyway ioctl is hideous and I prefer not to hide that fact.
Ok. My apologies for not following procedure.
What about taking the following approach. I replace all the IoctlGetXxx and IoctlSetXxx functions with the following:
The only exception would be that I am inclined to leave the IoctlGetString and IoctlSetString functions in place to handle the conversion to/from Go strings, since that is more involved than a type conversion.