kernel: add K_INHERIT_PERMS flag

By default, threads are created only having access to their own thread
object and nothing else. This new flag to k_thread_create() gives the
thread access to all objects that the parent had at the time it was
created, with the exception of the parent thread itself.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
diff --git a/scripts/gen_kobject_list.py b/scripts/gen_kobject_list.py
index 4eca485..761f0e9 100755
--- a/scripts/gen_kobject_list.py
+++ b/scripts/gen_kobject_list.py
@@ -467,9 +467,11 @@
 header = """%compare-lengths
 %define lookup-function-name _k_object_lookup
 %language=ANSI-C
+%global-table
 %struct-type
 %{
 #include <kernel.h>
+#include <syscall_handler.h>
 #include <string.h>
 %}
 struct _k_object;
@@ -485,6 +487,17 @@
 {
     return _k_object_lookup((const char *)obj, sizeof(void *));
 }
+
+void _k_object_wordlist_foreach(_wordlist_cb_func_t func, void *context)
+{
+    int i;
+
+    for (i = MIN_HASH_VALUE; i <= MAX_HASH_VALUE; i++) {
+        if (wordlist[i].name) {
+            func(&wordlist[i], context);
+        }
+    }
+}
 """