Skip to contentSkip to conversation

libtracefs: An API to set the filtering of functions

PATCH In review Sameeruddin shaik 3 participants 10 messages Mar 5, 2021 – Mar 7, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libtracefs: An API to set the filtering of functions

This new API will write the function filters into the set_ftrace_filter file.

tracefs_function_filter()

https://bugzilla.kernel.org/show_bug.cgi?id=210643

include/tracefs.h +1 -0
index f3eec62..2e5d3e3 100644
@@ -50,6 +50,7 @@ int tracefs_trace_on(struct tracefs_instance *instance);
 int tracefs_trace_off(struct tracefs_instance *instance);
 int tracefs_trace_on_fd(int fd);
 int tracefs_trace_off_fd(int fd);
+int tracefs_function_filter(struct tracefs_instance *instance, const char **filters, const char *module, bool reset, const char **errs);
 
 /**
  * tracefs_trace_on_get_fd - Get a file descriptor of "tracing_on" in given instance
src/tracefs-tools.c +88 -0

97 lines not on this page · raw message

Signature · 1 line
2.7.4
#1 lore raw

Hi Sameer,

Quoted 44 lines · Sameeruddin shaik

This new API will write the function filters into the set_ftrace_filter file.

tracefs_function_filter()

https://bugzilla.kernel.org/show_bug.cgi?id=210643

include/tracefs.h +1 -0
index f3eec62..2e5d3e3 100644
@@ -50,6 +50,7 @@ int tracefs_trace_on(struct tracefs_instance *instance);
 int tracefs_trace_off(struct tracefs_instance *instance);
 int tracefs_trace_on_fd(int fd);
 int tracefs_trace_off_fd(int fd);
+int tracefs_function_filter(struct tracefs_instance *instance, const char **filters, const char *module, bool reset, const char **errs);
 
 /**
  * tracefs_trace_on_get_fd - Get a file descriptor of "tracing_on" in given instance
src/tracefs-tools.c +7 -0
index e2dfc7b..8311191 100644
@@ -18,6 +18,7 @@
 #include "tracefs-local.h"
 
 #define TRACE_CTRL     "tracing_on"
+#define TRACE_FILTER      "set_ftrace_filter"
 
 static const char * const options_map[] = {
        "unknown",
@@ -387,3 +388,90 @@ void tracefs_option_clear(struct tracefs_options_mask *options, enum tracefs_opt
        if (options && id > TRACEFS_OPTION_INVALID)
                options->mask &= ~(1ULL << (id - 1));
 }
+
+static int controlled_write(const char *filter_path, const char **filters, const char *module, bool reset, const char **errs)
+{
+       int flags = reset ? O_TRUNC : O_APPEND;
+       int write_size;
+       char *each_str;

src/tracefs-tools.c void tracefs_option_clear(struct tracefs_options_mask *options, enum tracefs_opt · line 406

Quoted 10 lines
src/tracefs-tools.c +10 -0
+       int ret = 0;
+       int j = 0;
+       int size;
+       int slen;
+       int fd;
+       int i;
+
+       fd = open(filter_path, O_WRONLY | flags);
+       if (fd < 0)
+               return -1;

The error return code should be 1, or the caller of this internal function should translate this "-1" to the error code according to the API description.

Quoted 5 lines
src/tracefs-tools.c +5 -0
+
+       for (i = 0; filters[i]; i++) {
+               slen = strlen(filters[i]);
+               if (!slen)
+                       continue;

src/tracefs-tools.c void tracefs_option_clear(struct tracefs_options_mask *options, enum tracefs_opt · line 421

Quoted 10 lines
src/tracefs-tools.c +10 -0
+
+               if (module)
+                       /* Adding 5 extra bytes for ":mod:"*/
+                       slen += strlen(module) + 5;
+
+               /* Adding 2 extra byte for the space and '\0' at the end*/
+               slen += 2;
+               each_str = calloc(1, slen);
+               if (!each_str)
+                       return -1;

Same here.

src/tracefs-tools.c void tracefs_option_clear(struct tracefs_options_mask *options, enum tracefs_opt · line 429

Quoted 8 lines
src/tracefs-tools.c +8 -0
+               if (module)
+                       write_size = snprintf(each_str, slen, "%s:mod:%s ", filters[i], module);
+               else
+                       write_size = snprintf(each_str, slen, "%s ", filters[i]);
+
+               size = write(fd, each_str, write_size);
+               /* compare written bytes and also compare the written bytes with difference of added 5 bytes to string for ":mod:"*/
+               if ((size < write_size) && (size < (write_size - 5))) {

The second comparison is not needed, the size must be equal to write_size in case of success.

src/tracefs-tools.c void tracefs_option_clear(struct tracefs_options_mask *options, enum tracefs_opt · line 430

Quoted 1 line
src/tracefs-tools.c +1 -0
+                       errs[j++] = filters[i];

The errs must be (re)allocated here, to hold additional pointer to string. The user does not know in advance the number of failed filters and it is not expected to provide an already allocated array. So it should be a triple pointer.

It is OK to assign directly failed input string to the error array, but this should be written in the API description, i.e. the user should not free the strings from the @errs array as it is a subset of the @filters array, or something like that. But note, the user still must free the @errs itself.

Quoted 24 lines
src/tracefs-tools.c +24 -0
+                       ret -= 1;
+               }
+               free(each_str);
+       }
+       errs[j] = NULL;
+       close(fd);
+       return ret;
+}
+
+/**
+ * tracefs_function_filter - write to set_ftrace_filter file to trace particular functions
+ * @instance: ftrace instance, can be NULL for top tracing instance
+ * @filters: An array of function names ending with a NULL pointer
+ * @module: Module to be traced
+ * @reset: set to true to reset the file before applying the filter
+ * @errs: An Array of failed function names ending with a NULL pointer
+ *
+ * The @filters is an array of strings, where each string will be used to set
+ * a function or functions to be traced.
+ *
+ * If @reset is true, then all functions in the filter are cleared before
+ * adding functions from @filter. Otherwise, the functions set by @filter
+ * will be appended to the filter file
+ *

src/tracefs-tools.c void tracefs_option_clear(struct tracefs_options_mask *options, enum tracefs_opt · line 464

Quoted 10 lines
src/tracefs-tools.c +10 -0
+ * The @errs is an array of strings, where each string is a failed function
+ * name
+ *
+ * returns -x (where x is number of failed filter srtings or it can be
+ * 1 for general errors), or 0 if there are no errors.
+ */
+int tracefs_function_filter(struct tracefs_instance *instance, const char **filters, const char *module, bool reset, const char **errs)
+{
+       char *ftrace_filter_path;
+       int ret = 0;

This should be initialised to the error return code, to ensure that every "goto out" will return error.

src/tracefs-tools.c void tracefs_option_clear(struct tracefs_options_mask *options, enum tracefs_opt · line 467

Quoted 3 lines
src/tracefs-tools.c +3 -0
+
+       if (!filters)
+               return -1;

Should return 1, according to the API description.

src/tracefs-tools.c void tracefs_option_clear(struct tracefs_options_mask *options, enum tracefs_opt · line 471

Quoted 4 lines
src/tracefs-tools.c +4 -0
+
+       ftrace_filter_path = tracefs_instance_get_file(instance, TRACE_FILTER);
+       if (!ftrace_filter_path)
+               goto out;

"ret" is 0 here, so success will be returned, which is not the desired behaviour.
"ftrace_filter_path" is NULL and the tracefs_put_tracing_file() will be called with NULL, but this is OK, should not be a problem.

Quoted 9 lines
src/tracefs-tools.c +6 -1
+
+       ret = controlled_write(ftrace_filter_path, filters, module, reset, errs);
+ out:
+       tracefs_put_tracing_file(ftrace_filter_path);
+       return ret;
+}
--

2.7.4

It is a good starting point, thanks for sending this patch Sameer!

Signature · 2 lines
Tzvetomir (Ceco) Stoyanov
VMware Open Source Technology Center
#2 lore raw
Quoted 19 lines · On Fri, 5 Mar 2021 14:20:15 +0200 Tzvetomir Stoyanov <[email protected]>…

src/tracefs-tools.c void tracefs_option_clear(struct tracefs_options_mask *options, enum tracefs_opt · line 429

Quoted 8 lines
src/tracefs-tools.c +8 -0
+               if (module)
+                       write_size = snprintf(each_str, slen, "%s:mod:%s ", filters[i], module);
+               else
+                       write_size = snprintf(each_str, slen, "%s ", filters[i]);
+
+               size = write(fd, each_str, write_size);
+               /* compare written bytes and also compare the written bytes with difference of added 5 bytes to string for ":mod:"*/
+               if ((size < write_size) && (size < (write_size - 5))) {  

The second comparison is not needed, the size must be equal to write_size in case of success.

Quoted 1 line

+ errs[j++] = filters[i];

The errs must be (re)allocated here, to hold additional pointer to string. The user does not know in advance the number of failed filters and it is not expected to provide an already allocated array. So it should be a triple pointer.

Quoted 5 lines

It is OK to assign directly failed input string to the error array, but this should be written in the API description, i.e. the user should not free the strings from the @errs array as it is a subset of the @filters array, or something like that. But note, the user still must free the @errs itself.

A check to see if "errs" is NULL is needed too. If the user doesn't care about the errors, they can pass in NULL to errs, in which case, they should be ignored.

Quoted 17 lines
Quoted 7 lines
src/tracefs-tools.c +6 -0
+                       ret -= 1;
+               }
+               free(each_str);
+       }
+       errs[j] = NULL;
+       close(fd);

src/tracefs-tools.c void tracefs_option_clear(struct tracefs_options_mask *options, enum tracefs_opt · line 446

Quoted 10 lines
src/tracefs-tools.c +10 -0
+       return ret;
+}
+
+/**
+ * tracefs_function_filter - write to set_ftrace_filter file to trace particular functions
+ * @instance: ftrace instance, can be NULL for top tracing instance
+ * @filters: An array of function names ending with a NULL pointer
+ * @module: Module to be traced
+ * @reset: set to true to reset the file before applying the filter
+ * @errs: An Array of failed function names ending with a NULL pointer

Thus the description for @errs should be:

@errs: A pointer to an array of const strings that will be allocated on
a negative return of this function, pointing to the filters that failed. May be NULL, in which case this field will be ignored.

Quoted 7 lines
Quoted 7 lines

+ *
+ * The @filters is an array of strings, where each string will be used to set
+ * a function or functions to be traced.
+ *
+ * If @reset is true, then all functions in the filter are cleared before
+ * adding functions from @filter. Otherwise, the functions set by @filter
+ * will be appended to the filter file

Quoted 8 lines
Quoted 8 lines

+ *
+ * The @errs is an array of strings, where each string is a failed function
+ * name
+ *
+ * returns -x (where x is number of failed filter srtings or it can be
+ * 1 for general errors), or 0 if there are no errors.
+ */
+int tracefs_function_filter(struct tracefs_instance *instance, const char **filters, const char *module, bool reset, const char **errs)

Note, @filters should be of type: const char * const * filters, as not only is filters pointing to constant strings, the array itself will not be modified. And errs, should be of type: const char ***errs. Where it will be allocated.

Since a triple pointer is difficult to manage in the code, you could have:

	const char **e = NULL;

	
		if (errs) {
			e = realloc(sizeof(*e), j + 1);
			e[j++] = filters[i];
		}

Then at the end:

	if (errs)
		*errs = e;
Quoted 18 lines

src/tracefs-tools.c void tracefs_option_clear(struct tracefs_options_mask *options, enum tracefs_opt · line 464

Quoted 3 lines
src/tracefs-tools.c +3 -0
+{
+       char *ftrace_filter_path;
+       int ret = 0;  

This should be initialised to the error return code, to ensure that every "goto out" will return error.

src/tracefs-tools.c void tracefs_option_clear(struct tracefs_options_mask *options, enum tracefs_opt · line 467

Quoted 3 lines
src/tracefs-tools.c +3 -0
+
+       if (!filters)
+               return -1;  

Should return 1, according to the API description.

src/tracefs-tools.c void tracefs_option_clear(struct tracefs_options_mask *options, enum tracefs_opt · line 471

Quoted 4 lines
src/tracefs-tools.c +4 -0
+
+       ftrace_filter_path = tracefs_instance_get_file(instance, TRACE_FILTER);
+       if (!ftrace_filter_path)
+               goto out;  
Quoted 4 lines

"ret" is 0 here, so success will be returned, which is not the desired behaviour.
"ftrace_filter_path" is NULL and the tracefs_put_tracing_file() will be called with NULL, but this is OK, should not be a problem.

It shouldn't be a problem, but it is also fine to return directly here.

	if (!ftrace_filter_path)
		return 1;

Thanks!

-- Steve

Quoted 13 lines
Quoted 10 lines
src/tracefs-tools.c +6 -1
+
+       ret = controlled_write(ftrace_filter_path, filters, module, reset, errs);
+ out:
+       tracefs_put_tracing_file(ftrace_filter_path);
+       return ret;
+}
--

2.7.4

It is a good starting point, thanks for sending this patch Sameer!

#3 lore raw
Quoted 5 lines · On Fri, 5 Mar 2021 09:39:46 -0500 Steven Rostedt <[email protected]> wrote:
Quoted 5 lines
Quoted 5 lines

+ * The @filters is an array of strings, where each string will be used to set
+ * a function or functions to be traced.
+ *
+ * If @reset is true, then all functions in the filter are cleared before
+ * adding functions from @filter. Otherwise, the functions set by @filter

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

+ * will be appended to the filter file
+ *
+ * The @errs is an array of strings, where each string is a failed function
+ * name
+ *
+ * returns -x (where x is number of failed filter srtings or it can be
+ * 1 for general errors), or 0 if there are no errors.
+ */

We should for the return statement:

* returns -x on filter errorrs (where x is number of failed filter strings)

 *         and @errs if non-NULL will be an allocated string array pointing
 *         to the strings in @filter that failed, and must be freed with
 *         free().

*
* returns 1 on general errors not related to setting the filter.
* @errs is not set, even if supplied.
*
* returns 0 on success, and @errs is not set.

-- Steve

#4 lore raw

hi steve,

i have one doubt.

Quoted 3 lines

Note, @filters should be of type: const char * const * filters, as not only is filters pointing to constant strings, the array itself will not be modified.

what If the user wants to capture the filters at run time like below ? let's say

  filters = malloc(sizeof(char *));
        if (!filters)
                return 1;
        printf("please enter the input filters count\n");
        scanf("%d", &fil_count);
        while(i < fil_count) {
                scanf("%s", buf);
                slen = strlen(buf);
                if (!slen)
                        return 1;
                filters[i] = calloc(1, slen);
                strncpy(filters[i++], buf, slen);
        }

at that time, this declaration will be problematic right?, because we are trying to modify
the read-only memory. Are we expecting the user to supply filters at compile time like below?
const char * const *filters = {"kvm_pmu_reset", "kvm_pmu_init", "dir_item_err", NULL};

Tzvetomir & steve,

Quoted 10 lines

Since a triple pointer is difficult to manage in the code, you could have:

      const char **e = NULL;


              if (errs) {
                       e = realloc(sizeof(*e), j + 1);
                       e[j++] = filters[i];
              }
Quoted 4 lines

Then at the end:

      if (errs)
               *errs = e;

i have a concern here
when a double pointer is doing our work here without any overhead, why we want to make it a triple pointer?

Thanks,
sameer.

Quoted 32 lines · Steven Rostedt
Quoted 5 lines · On Fri, 5 Mar 2021 09:39:46 -0500 Steven Rostedt <[email protected]> wrote:
Quoted 5 lines
Quoted 5 lines

+ * The @filters is an array of strings, where each string will be used to set
+ * a function or functions to be traced.
+ *
+ * If @reset is true, then all functions in the filter are cleared before
+ * adding functions from @filter. Otherwise, the functions set by @filter

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

+ * will be appended to the filter file
+ *
+ * The @errs is an array of strings, where each string is a failed function
+ * name
+ *
+ * returns -x (where x is number of failed filter srtings or it can be
+ * 1 for general errors), or 0 if there are no errors.
+ */

We should for the return statement:

* returns -x on filter errorrs (where x is number of failed filter strings)

 *         and @errs if non-NULL will be an allocated string array pointing
 *         to the strings in @filter that failed, and must be freed with
 *         free().

*
* returns 1 on general errors not related to setting the filter.
* @errs is not set, even if supplied.
*
* returns 0 on success, and @errs is not set.

-- Steve

#5 lore raw
Quoted 23 lines · On Sat, 6 Mar 2021 07:25:18 +0530 Sameeruddin Shaik…

hi steve,

i have one doubt.

Quoted 3 lines

Note, @filters should be of type: const char * const * filters, as not only is filters pointing to constant strings, the array itself will not be modified.

what If the user wants to capture the filters at run time like below ? let's say

  filters = malloc(sizeof(char *));
        if (!filters)
                return 1;
        printf("please enter the input filters count\n");
        scanf("%d", &fil_count);
        while(i < fil_count) {
                scanf("%s", buf);
                slen = strlen(buf);
                if (!slen)
                        return 1;
                filters[i] = calloc(1, slen);
                strncpy(filters[i++], buf, slen);
        }
Quoted 2 lines

at that time, this declaration will be problematic right?, because we are trying to modify

No it wont. You can assign const pointers to dynamic pointers, but not the other way around. It's a way to show that the function you are calling wont do anything with the array you pass to it.

Quoted 4 lines

the read-only memory. Are we expecting the user to supply filters at compile time like below?
const char * const *filters = {"kvm_pmu_reset", "kvm_pmu_init", "dir_item_err", NULL};

No, as explained above.

Quoted 12 lines

Tzvetomir & steve,

Quoted 10 lines

Since a triple pointer is difficult to manage in the code, you could have:

      const char **e = NULL;


              if (errs) {
                       e = realloc(sizeof(*e), j + 1);
                       e[j++] = filters[i];
              }
Quoted 7 lines
Quoted 4 lines

Then at the end:

      if (errs)
               *errs = e;  

i have a concern here
when a double pointer is doing our work here without any overhead, why we want to make it a triple pointer?

What overhead? A string is a pointer, an array of strings is a double pointer, and passing in the address to an array of strings so you can modify that array is a triple pointer, and that's exactly what you need for errs.

This is basic C coding, nothing special here.

I'm curious to why you picked this particular API to implement. Is there something you are planning on using this for?

-- Steve

#6 lore raw

Okay steve

Actually I chose this API randomly from bugzilla, i don't have any plans as of now.
I am developing it, as per your requirement.

Out of curiosity, I started implementing this API. Actually I am a novice in development,
i know somewhat like how to write code logically and make it work, but i haven't followed any standard
till now. I am learning some new things from your reviews. Thanks,
sameer.

Quoted 72 lines · Steven Rostedt,
Quoted 23 lines · On Sat, 6 Mar 2021 07:25:18 +0530 Sameeruddin Shaik…

hi steve,

i have one doubt.

Quoted 3 lines

Note, @filters should be of type: const char * const * filters, as not only is filters pointing to constant strings, the array itself will not be modified.

what If the user wants to capture the filters at run time like below ? let's say

  filters = malloc(sizeof(char *));
        if (!filters)
                return 1;
        printf("please enter the input filters count\n");
        scanf("%d", &fil_count);
        while(i < fil_count) {
                scanf("%s", buf);
                slen = strlen(buf);
                if (!slen)
                        return 1;
                filters[i] = calloc(1, slen);
                strncpy(filters[i++], buf, slen);
        }
Quoted 2 lines

at that time, this declaration will be problematic right?, because we are trying to modify

No it wont. You can assign const pointers to dynamic pointers, but not the other way around. It's a way to show that the function you are calling wont do anything with the array you pass to it.

Quoted 4 lines

the read-only memory. Are we expecting the user to supply filters at compile time like below?
const char * const *filters = {"kvm_pmu_reset", "kvm_pmu_init", "dir_item_err", NULL};

No, as explained above.

Quoted 12 lines

Tzvetomir & steve,

Quoted 10 lines

Since a triple pointer is difficult to manage in the code, you could have:

      const char **e = NULL;


              if (errs) {
                       e = realloc(sizeof(*e), j + 1);
                       e[j++] = filters[i];
              }
Quoted 7 lines
Quoted 4 lines

Then at the end:

      if (errs)
               *errs = e;

i have a concern here
when a double pointer is doing our work here without any overhead, why we want to make it a triple pointer?

What overhead? A string is a pointer, an array of strings is a double pointer, and passing in the address to an array of strings so you can modify that array is a triple pointer, and that's exactly what you need for errs.

This is basic C coding, nothing special here.

I'm curious to why you picked this particular API to implement. Is there something you are planning on using this for?

-- Steve

#7 lore raw
Quoted 11 lines · On Sat, 6 Mar 2021 09:59:34 +0530 Sameeruddin Shaik…

Okay steve

Actually I chose this API randomly from bugzilla, i don't have any plans as of now.
I am developing it, as per your requirement.

Out of curiosity, I started implementing this API. Actually I am a novice in development,
i know somewhat like how to write code logically and make it work, but i haven't followed any standard
till now. I am learning some new things from your reviews.

We are happy to have you working with us.

I asked because the API you happened to pick is probably the most complex one to implement compared to some of the other APIs listed in the bugzilla, which is why I asked if you planned on doing anything with it, as it is also one of the more crucial APIs to get right.

-- Steve

#8 lore raw
In reply to Sameeruddin Shaik
Quoted 21 lines · On Sat, 6 Mar 2021 07:25:18 +0530 Sameeruddin Shaik…

i have one doubt.

Quoted 3 lines

Note, @filters should be of type: const char * const * filters, as not only is filters pointing to constant strings, the array itself will not be modified.

what If the user wants to capture the filters at run time like below ? let's say

  filters = malloc(sizeof(char *));
        if (!filters)
                return 1;
        printf("please enter the input filters count\n");
        scanf("%d", &fil_count);
        while(i < fil_count) {
                scanf("%s", buf);
                slen = strlen(buf);
                if (!slen)
                        return 1;
                filters[i] = calloc(1, slen);
                strncpy(filters[i++], buf, slen);
        }
Quoted 6 lines

at that time, this declaration will be problematic right?, because we are trying to modify
the read-only memory. Are we expecting the user to supply filters at compile time like below?
const char * const *filters = {"kvm_pmu_reset", "kvm_pmu_init", "dir_item_err", NULL};

OK, my apologies, I see the issue that you are having, and you are correct.

Because newer compiles will warn if you pass "char **" to a "const char * const *" parameter. Because it assumes that the two types are different, even when they shouldn't be. I'm not sure why the compiler wont let you pass in a char ** to a const char * const *, but it does indeed make them different.

Even though there's ways to always pass strings via this logic, (you can create a "const char **" array and assign it to the dynamic one, and pass that in just fine). I looked at other prototypes, and see that the common method is.

const char **

A couple do the "const char * const *" but they look to be special cases.

So yes, let's go with "const char **" as we want to show that the strings will not be modified, and have "const char ***" for errs.

Thanks!

-- Steve

#9 lore raw
Quoted 6 lines

We are happy to have you working with us.

I asked because the API you happened to pick is probably the most complex one to implement compared to some of the other APIs listed in the bugzilla, which is why I asked if you planned on doing anything with it, as it is also one of the more crucial APIs to get right.

At first I thought, my work will be done, if I write to that file, but complexity
increased gradually, but let me try, since i have started i will finish this.

Quoted 2 lines

So yes, let's go with "const char **" as we want to show that the strings will not be modified, and have "const char ***" for errs.

okay then i will change the errors declaration alone.

Thanks
sameer.

Quoted 57 lines · Steven Rostedt
Quoted 21 lines · On Sat, 6 Mar 2021 07:25:18 +0530 Sameeruddin Shaik…

i have one doubt.

Quoted 3 lines

Note, @filters should be of type: const char * const * filters, as not only is filters pointing to constant strings, the array itself will not be modified.

what If the user wants to capture the filters at run time like below ? let's say

  filters = malloc(sizeof(char *));
        if (!filters)
                return 1;
        printf("please enter the input filters count\n");
        scanf("%d", &fil_count);
        while(i < fil_count) {
                scanf("%s", buf);
                slen = strlen(buf);
                if (!slen)
                        return 1;
                filters[i] = calloc(1, slen);
                strncpy(filters[i++], buf, slen);
        }
Quoted 6 lines

at that time, this declaration will be problematic right?, because we are trying to modify
the read-only memory. Are we expecting the user to supply filters at compile time like below?
const char * const *filters = {"kvm_pmu_reset", "kvm_pmu_init", "dir_item_err", NULL};

OK, my apologies, I see the issue that you are having, and you are correct.

Because newer compiles will warn if you pass "char **" to a "const char * const *" parameter. Because it assumes that the two types are different, even when they shouldn't be. I'm not sure why the compiler wont let you pass in a char ** to a const char * const *, but it does indeed make them different.

Even though there's ways to always pass strings via this logic, (you can create a "const char **" array and assign it to the dynamic one, and pass that in just fine). I looked at other prototypes, and see that the common method is.

const char **

A couple do the "const char * const *" but they look to be special cases.

So yes, let's go with "const char **" as we want to show that the strings will not be modified, and have "const char ***" for errs.

Thanks!

-- Steve