Skip to content
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

net: use SO_LINGER_SEC on darwin #7971

Closed
mikioh opened this issue May 12, 2014 · 7 comments
Closed

net: use SO_LINGER_SEC on darwin #7971

mikioh opened this issue May 12, 2014 · 7 comments
Milestone

Comments

@mikioh
Copy link
Contributor

mikioh commented May 12, 2014

a four and half year old bug.

% man 2 setsockopt on darwin

--
SO_LINGER controls the...

#define SO_LINGER 0x0080 /* linger on close if data present (in ticks) */
#define SO_LINGER_SEC 0x1080 /* linger on close if data present (in seconds) */

SO_LINGER_SEC is the same option as SO_LINGER except the linger time is in seconds for
SO_LINGER_SEC.
--

ticks... but fortunately no one knows what's the correct behavior to closing(*) a
SO_LINGER+O_NONBLOCK socket.

*) http://pubs.opengroup.org/onlinepubs/9699919799/functions/close.html
@gopherbot
Copy link

Comment 1:

CL https://golang.org/cl/92210044 mentions this issue.

@bradfitz
Copy link
Contributor

Comment 2:

Please explain clearly what the bug is. You just copy/pasted some stuff here.

@ianlancetaylor
Copy link
Contributor

Comment 3:

The bug is that setLinger takes a value in seconds, but the Darwin SO_LINGER setsockopt
option apparently takes a value in ticks.  To get a value in seconds, as on other Unix
systems, you apparently need to use SO_LINGER_SEC.

@mikioh
Copy link
Contributor Author

mikioh commented May 12, 2014

Comment 4:

Thanks for the explanation, Ian. I filed issue #7974 for documentation errata.

@mikioh
Copy link
Contributor Author

mikioh commented May 12, 2014

Comment 5:

This issue was closed by revision 900d49b.

Status changed to Fixed.

@bradfitz
Copy link
Contributor

Comment 6:

This issue was closed by revision c91aea6.

@gopherbot
Copy link

Comment 7:

CL https://golang.org/cl/93250045 mentions this issue.

@rsc rsc added this to the Go1.3 milestone Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants