MCPcopy Create free account
hub / github.com/F-Stack/f-stack / sysctl_handle_counter_u64_array

Function sysctl_handle_counter_u64_array

freebsd/kern/subr_counter.c:95–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

93}
94
95int
96sysctl_handle_counter_u64_array(SYSCTL_HANDLER_ARGS)
97{
98 uint64_t *out;
99 int error;
100
101 out = malloc(arg2 * sizeof(uint64_t), M_TEMP, M_WAITOK);
102 for (int i = 0; i < arg2; i++)
103 out[i] = counter_u64_fetch(((counter_u64_t *)arg1)[i]);
104
105 error = SYSCTL_OUT(req, out, arg2 * sizeof(uint64_t));
106 free(out, M_TEMP);
107
108 if (error || !req->newptr)
109 return (error);
110
111 /*
112 * Any write attempt to a counter zeroes it.
113 */
114 for (int i = 0; i < arg2; i++)
115 counter_u64_zero(((counter_u64_t *)arg1)[i]);
116
117 return (0);
118}
119
120/*
121 * MP-friendly version of ppsratecheck().

Callers

nothing calls this directly

Calls 4

mallocFunction · 0.85
counter_u64_fetchFunction · 0.85
counter_u64_zeroFunction · 0.85
freeFunction · 0.70

Tested by

no test coverage detected