New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
proposal: add new ioctls and refactor existing ioctls for solaris in x/sys/unix #14873
Comments
Is this for solaris only?
I think it will also benefit other Unix platforms.
|
The implementation I have is solaris only and builds on existing solaris specific code. As a follow-on to these modifications, I could look at adding them for freebsd and darwin as these are the other flavors of Unix I have on my machines. |
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. |
That seems reasonable to me but others should weigh in as well. |
CL https://golang.org/cl/26650 mentions this issue. |
As far as I can tell, this proposal is implemented, albeit not exactly as discussed here. |
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:
to
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:
to
And the following 4 functions would be added:
The text was updated successfully, but these errors were encountered: