x/sys/unix: standardize Kevent_t Udata as integer, not pointer
#32,153 opened on May 20, 2019
Repository metrics
- Stars
- (133,883 stars)
- PR merge metrics
- (No merged PRs in 30d)
Description
unix.SetKevent only takes mode(eg. Filter field) and flags parameter.
Other fields also have different types depending on the ach/platform, say Udata which is either a *byte or a int32.
Since Go1 compat promise prevent us from changing the SetKevent function, perhaps it could be feasible to add new methods to the Kevent_t type to set the others fields, similar to *Iovec.SetLen for example.
Fflags and Data methods looks straightforward to implement, on the model of SetKevent, since types are integers on all platforms/archs.
However, so far, I am unsure about the type of the Udata parameter for the eponym method. I typically would do kev.Udata = (*byte)(unsafe.Pointer(&foobar)) on my own currently for darwin/amd64, but I guess that exposing unsafe.Pointer as a parameter type is not a good solution.