V3 [PATCH] Set tunable value as well as min/max values
Siddhesh Poyarekar
siddhesh@sourceware.org
Tue Sep 29 04:45:06 GMT 2020
On 29/09/20 09:30, H.J. Lu via Libc-alpha wrote:
> Here is the updated patch with TUNABLE_SET_WITH_BOUNDS.
>
> @@ -101,12 +101,19 @@ get_next_env (char **envp, char **name, size_t *namelen, char **val,
> })
>
> static void
> -do_tunable_update_val (tunable_t *cur, const void *valp)
> +do_tunable_update_val (tunable_t *cur, const void *valp,
> + const void *minp, const void *maxp)
> {
> uint64_t val;
>
> if (cur->type.type_code != TUNABLE_TYPE_STRING)
> - val = *((int64_t *) valp);
> + {
> + val = *((int64_t *) valp);
> + if (minp)
> + cur->type.min = *((int64_t *) minp);
> + if (maxp)
> + cur->type.max = *((int64_t *) maxp);
> + }
>
> switch (cur->type.type_code)
> {
> @@ -153,15 +160,15 @@ tunable_initialize (tunable_t *cur, con
There should be a check here to ensure that the bounds do not exceed
statically set bounds. That is:
if (minp != NULL && cur->type.min < *((int64_t *) minp))
cur->type.min = *((int64_t *) minp);
if (maxp != NULL && cur->type.max > *((int64_t *) maxp))
cur->type.max = *((int64_t *) maxp);
Siddhesh
More information about the Libc-alpha
mailing list