FAQ
That did the trick. Thank you Ian!


fredag 18. mars 2016 18.31.58 UTC+1 skrev Ian Lance Taylor følgende:
On Fri, Mar 18, 2016 at 10:18 AM, Lars Kulseng <larsk...@gmail.com
<javascript:>> wrote:
The structs in use look like this in if_packet.h:

struct tpacket_stats {
unsigned int tp_packets;
unsigned int tp_drops;
};

struct tpacket_stats_v3 {
unsigned int tp_packets;
unsigned int tp_drops;
unsigned int tp_freeze_q_cnt;
};

The panic seems to happen on the first call to func (h *TPacket)
SocketStats() and since I've managed to see this behavior while doing simple
tests, the tp_packets field should have a small number in it and the rest
should be 0.
Those structs don't contain any pointers, so they can't be the problem.

OK, I think the problem may be that calling unsafe.Pointer(&s.f)
causes the checker to check all of s, because it doesn't know the type
of s.f. It that is the problem, then the code is OK, but there is a
weakness in the checker--it's too conservative. In that case, the
workaround is going to be something like
var s tpacket_stats
C.getsockopt(..., &s, ...)
h.socketStats = s

Ian
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Discussion Posts

Previous

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 5 of 5 | next ›
Discussion Overview
groupgolang-nuts @
categoriesgo
postedMar 18, '16 at 4:43p
activeMar 18, '16 at 6:54p
posts5
users2
websitegolang.org

2 users in discussion

Lars Kulseng: 3 posts Ian Lance Taylor: 2 posts

People

Translate

site design / logo © 2022 Grokbase