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

Comments

Projects
None yet
5 participants
@mikioh
Copy link
Contributor

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

This comment has been minimized.

Copy link

commented May 12, 2014

Comment 1:

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

This comment has been minimized.

Copy link
Member

commented May 12, 2014

Comment 2:

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

This comment has been minimized.

Copy link
Contributor

commented May 12, 2014

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

This comment has been minimized.

Copy link
Contributor Author

commented May 12, 2014

Comment 4:

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

This comment has been minimized.

Copy link
Contributor Author

commented May 12, 2014

Comment 5:

This issue was closed by revision 900d49b.

Status changed to Fixed.

@bradfitz

This comment has been minimized.

Copy link
Member

commented May 12, 2014

Comment 6:

This issue was closed by revision c91aea6.

@gopherbot

This comment has been minimized.

Copy link

commented May 12, 2014

Comment 7:

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

@mikioh mikioh added fixed labels May 12, 2014

@rsc rsc added this to the Go1.3 milestone Apr 14, 2015

@rsc rsc removed the release-go1.3maybe label 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.
You can’t perform that action at this time.