From ccabaf5e6a6e0d3d20cadd947890f57debee4535 Mon Sep 17 00:00:00 2001 From: Alfonso Acosta Date: Mon, 8 Feb 2016 12:38:36 +0000 Subject: [PATCH] Use uint64 for fd counter --- probe/endpoint/procspy/background_reader_linux.go | 2 +- probe/endpoint/procspy/proc_linux.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/probe/endpoint/procspy/background_reader_linux.go b/probe/endpoint/procspy/background_reader_linux.go index 2dd85285b..f51bf9f84 100644 --- a/probe/endpoint/procspy/background_reader_linux.go +++ b/probe/endpoint/procspy/background_reader_linux.go @@ -15,7 +15,7 @@ import ( const ( initialRateLimit = 50 * time.Millisecond // Read 20 * fdBlockSize file descriptors (/proc/PID/fd/*) per namespace per second maxRateLimit = 250 * time.Millisecond // Read at least 4 * fdBlockSize file descriptors per namespace per second - fdBlockSize = 300 + fdBlockSize = uint64(300) targetWalkTime = 10 * time.Second // Aim at walking all files in 10 seconds ) diff --git a/probe/endpoint/procspy/proc_linux.go b/probe/endpoint/procspy/proc_linux.go index 0329fb847..dec3055e6 100644 --- a/probe/endpoint/procspy/proc_linux.go +++ b/probe/endpoint/procspy/proc_linux.go @@ -106,14 +106,14 @@ func readProcessConnections(buf *bytes.Buffer, namespaceProcs []*process.Process } // walkNamespacePid does the work of walkProcPid for a single namespace -func walkNamespacePid(buf *bytes.Buffer, sockets map[uint64]*Proc, namespaceProcs []*process.Process, ticker <-chan time.Time, fdBlockSize int) error { +func walkNamespacePid(buf *bytes.Buffer, sockets map[uint64]*Proc, namespaceProcs []*process.Process, ticker <-chan time.Time, fdBlockSize uint64) error { if found, err := readProcessConnections(buf, namespaceProcs); err != nil || !found { return err } var statT syscall.Stat_t - var fdBlockCount int + var fdBlockCount uint64 for i, p := range namespaceProcs { // Get the sockets for all the processes in the namespace @@ -174,7 +174,7 @@ func walkNamespacePid(buf *bytes.Buffer, sockets map[uint64]*Proc, namespaceProc // /proc/PID/net/tcp{,6} for each namespace and sees if the ./fd/* files of each // process in that namespace are symlinks to sockets. Returns a map from socket // ID (inode) to PID. -func walkProcPid(buf *bytes.Buffer, walker process.Walker, ticker <-chan time.Time, fdBlockSize int) (map[uint64]*Proc, error) { +func walkProcPid(buf *bytes.Buffer, walker process.Walker, ticker <-chan time.Time, fdBlockSize uint64) (map[uint64]*Proc, error) { var ( sockets = map[uint64]*Proc{} // map socket inode -> process namespaces = map[uint64][]*process.Process{} // map network namespace id -> processes