| 93 | } |
| 94 | |
| 95 | int |
| 96 | sysctl_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(). |
nothing calls this directly
no test coverage detected