Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
os: add File.SyscallConn method to permit frobbing file descriptor #24331
Since go 1.9,
For working with device nodes (
Sadly it turns out one cannot use this new feature, for a trivial and equally frustrating reason:
Occasionally one needs to access the underlying file-descriptor of a device in order to do a trivial
One cannot turn the filedes to nonblocking mode himself, because he would also need to set internal
Alternatively, one cannot start with a filedes (i.e. use
So please: Provide a way to get a
I believe my case (accessing pollable device nodes) is exactly one of those for which the poller support was added to File's. So I should be able to use it.
An alternative solution would be for
@npat-efault thank you for filing and for articulating your motivations for this issue.
You might be interested in this issue #22939 that was accepted for Go1.11 in which the proposal was to add an API to construct an *os.File with a non-blocking file descriptor. Perhaps that issue might solve your problem without having to add another method, plus it is just waiting on implementation so perhaps you might be interested?
In regards to #24331 (comment)
And now to the question for clarity, your issue says
Did you mean to say instead either of these options below?
Sorry, this was a typo. I fixed the title.
My proposal is:
and one or, better, both of:
Technically 1 above could be said that it breaks backwards compatibility (in some sense), but if we agree that this break is not one we care about (the original behavior was not useful anyway), and if we agree that this is the way to go, I could post a (or two for 1 and 2) CLs in a couple of days or sooner.
If we don't want to break backward compatibility in no way whatsoever by changing the behavior of
referenced this issue
Mar 21, 2018
I agree... though a bit cumbersome to use,
I could start looking into the implementation of this, if there are no other takers...
pushed a commit
Apr 11, 2018
I'm currently having to use gross