MCPcopy Create free account
hub / github.com/prometheus/procfs / KernelRandom

Method KernelRandom

kernel_random.go:41–62  ·  view source on GitHub ↗

KernelRandom returns values from /proc/sys/kernel/random.

()

Source from the content-addressed store, hash-verified

39
40// KernelRandom returns values from /proc/sys/kernel/random.
41func (fs FS) KernelRandom() (KernelRandom, error) {
42 random := KernelRandom{}
43
44 for file, p := range map[string]**uint64{
45 "entropy_avail": &random.EntropyAvaliable,
46 "poolsize": &random.PoolSize,
47 "urandom_min_reseed_secs": &random.URandomMinReseedSeconds,
48 "write_wakeup_threshold": &random.WriteWakeupThreshold,
49 "read_wakeup_threshold": &random.ReadWakeupThreshold,
50 } {
51 val, err := util.ReadUintFromFile(fs.proc.Path("sys", "kernel", "random", file))
52 if os.IsNotExist(err) {
53 continue
54 }
55 if err != nil {
56 return random, err
57 }
58 *p = &val
59 }
60
61 return random, nil
62}

Callers 1

TestKernelRandomFunction · 0.95

Calls 2

ReadUintFromFileFunction · 0.92
PathMethod · 0.45

Tested by 1

TestKernelRandomFunction · 0.76