Skip to content

Commit

Permalink
Compute size of struct tcp_info instead of hardcoding it.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 263040624
  • Loading branch information
mrahatm authored and gvisor-bot committed Aug 13, 2019
1 parent eac690e commit 691c2f8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/abi/linux/socket.go
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ type TCPInfo struct {
}

// SizeOfTCPInfo is the binary size of a TCPInfo struct.
const SizeOfTCPInfo = 104
var SizeOfTCPInfo = int(binary.Size(TCPInfo{}))

// Control message types, from linux/socket.h.
const (
Expand Down
4 changes: 2 additions & 2 deletions test/syscalls/linux/proc_net_tcp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,9 @@ TEST(ProcNetTCP, EntryUID) {
std::vector<TCPEntry> entries =
ASSERT_NO_ERRNO_AND_VALUE(ProcNetTCPEntries());
TCPEntry e;
EXPECT_TRUE(FindByLocalAddr(entries, &e, sockets->first_addr()));
ASSERT_TRUE(FindByLocalAddr(entries, &e, sockets->first_addr()));
EXPECT_EQ(e.uid, geteuid());
EXPECT_TRUE(FindByRemoteAddr(entries, &e, sockets->first_addr()));
ASSERT_TRUE(FindByRemoteAddr(entries, &e, sockets->first_addr()));
EXPECT_EQ(e.uid, geteuid());
}

Expand Down

0 comments on commit 691c2f8

Please sign in to comment.