github.com/influxdata/telegraf@v1.30.3/cmd/telegraf/telegraf_posix.go (about) 1 //go:build !windows 2 3 package main 4 5 import ( 6 "log" 7 "syscall" 8 9 "github.com/urfave/cli/v2" 10 ) 11 12 func (t *Telegraf) Run() error { 13 stop = make(chan struct{}) 14 return t.reloadLoop() 15 } 16 17 func cliFlags() []cli.Flag { 18 return []cli.Flag{} 19 } 20 21 func getLockedMemoryLimit() uint64 { 22 // From https://elixir.bootlin.com/linux/latest/source/include/uapi/asm-generic/resource.h#L35 23 const rLimitMemlock = 8 24 25 var limit syscall.Rlimit 26 if err := syscall.Getrlimit(rLimitMemlock, &limit); err != nil { 27 log.Printf("E! Cannot get limit for locked memory: %v", err) 28 return 0 29 } 30 //nolint:unconvert // required for e.g. FreeBSD that has the field as int64 31 return uint64(limit.Max) 32 }