diff --git a/Application.mk b/Application.mk index 4e6622fe4..0c27c8fac 100644 --- a/Application.mk +++ b/Application.mk @@ -253,10 +253,19 @@ REGLIST := $(addprefix $(BUILTIN_REGISTRY)$(DELIM),$(addsuffix .bdat,$(PROGNAME) APPLIST := $(PROGNAME) $(REGLIST): $(DEPCONFIG) Makefile +ifeq ($(CONFIG_SCHED_USER_IDENTITY),y) + $(call REGISTER,$(firstword $(APPLIST)),$(firstword $(PRIORITY)),$(firstword $(STACKSIZE)),$(if $(BUILD_MODULE),,$(firstword $(APPLIST))_main),$(firstword $(UID)),$(firstword $(GID)),$(firstword $(MODE))) +else $(call REGISTER,$(firstword $(APPLIST)),$(firstword $(PRIORITY)),$(firstword $(STACKSIZE)),$(if $(BUILD_MODULE),,$(firstword $(APPLIST))_main)) +endif $(eval APPLIST=$(filter-out $(firstword $(APPLIST)),$(APPLIST))) $(if $(filter-out $(firstword $(PRIORITY)),$(PRIORITY)),$(eval PRIORITY=$(filter-out $(firstword $(PRIORITY)),$(PRIORITY)))) $(if $(filter-out $(firstword $(STACKSIZE)),$(STACKSIZE)),$(eval STACKSIZE=$(filter-out $(firstword $(STACKSIZE)),$(STACKSIZE)))) +ifeq ($(CONFIG_SCHED_USER_IDENTITY),y) + $(if $(filter-out $(firstword $(UID)),$(UID)),$(eval UID=$(filter-out $(firstword $(UID)),$(UID)))) + $(if $(filter-out $(firstword $(GID)),$(GID)),$(eval GID=$(filter-out $(firstword $(GID)),$(GID)))) + $(if $(filter-out $(firstword $(MODE)),$(MODE)),$(eval MODE=$(filter-out $(firstword $(MODE)),$(MODE)))) +endif register:: $(REGLIST) @: diff --git a/Make.defs b/Make.defs index fc1a3de3c..11bab7ca5 100644 --- a/Make.defs +++ b/Make.defs @@ -82,6 +82,15 @@ BUILTIN_REGISTRY = $(APPDIR)$(DELIM)builtin$(DELIM)registry DEPCONFIG = $(TOPDIR)$(DELIM).config ifeq ($(CONFIG_WINDOWS_NATIVE),y) +ifeq ($(CONFIG_SCHED_USER_IDENTITY),y) +define REGISTER + $(Q) echo Register: $1 + $(Q) echo { "$(subst ",,$(1))", $2, $3, $(patsubst ,0,$(subst ",,$(4))), $(patsubst ,0,$(5)), $(patsubst ,0,$(6)), $(patsubst ,0555,$(7))}, > "$(BUILTIN_REGISTRY)$(DELIM)$1.bdat" + $(Q) echo int $(subst ",,$(4))(int argc, char *argv[]); > "$(BUILTIN_REGISTRY)$(DELIM)$1.pdat" + + $(Q) touch $(BUILTIN_REGISTRY)$(DELIM).updated" +endef +else define REGISTER $(Q) echo Register: $1 $(Q) echo { "$(subst ",,$(1))", $2, $3, $(subst ",,$(4)) }, > "$(BUILTIN_REGISTRY)$(DELIM)$1.bdat" @@ -89,6 +98,16 @@ define REGISTER $(Q) touch $(BUILTIN_REGISTRY)$(DELIM).updated" endef +endif +else +ifeq ($(CONFIG_SCHED_USER_IDENTITY),y) +define REGISTER + $(Q) echo "{ \"$1\", $2, $3, $(patsubst ,0,$(4)), $(patsubst ,0,$(5)), $(patsubst ,0,$(6)), $(patsubst ,0555,$(7)) }," > "$(BUILTIN_REGISTRY)$(DELIM)$1.bdat" + $(Q) if [ ! -z $4 ]; then \ + echo "int $4(int argc, char *argv[]);" > "$(BUILTIN_REGISTRY)$(DELIM)$1.pdat"; \ + fi; + $(Q) touch "$(BUILTIN_REGISTRY)$(DELIM).updated" +endef else define REGISTER $(Q) echo "Register: $1" @@ -99,6 +118,7 @@ define REGISTER $(Q) touch "$(BUILTIN_REGISTRY)$(DELIM).updated" endef endif +endif # Standard include path diff --git a/builtin/builtin_list.c b/builtin/builtin_list.c index 825c53a3c..f8fe389b1 100644 --- a/builtin/builtin_list.c +++ b/builtin/builtin_list.c @@ -26,6 +26,8 @@ #include +#include + /**************************************************************************** * Private Types ****************************************************************************/ @@ -43,7 +45,11 @@ const struct builtin_s g_builtins[] = { # include "builtin_list.h" +#ifdef CONFIG_SCHED_USER_IDENTITY + { NULL, 0, 0, 0, 0, 0, 0 } +#else { NULL, 0, 0, 0 } +#endif }; const int g_builtin_count = sizeof(g_builtins) / sizeof(g_builtins[0]);