Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Application.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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)
@:
Expand Down
20 changes: 20 additions & 0 deletions Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,32 @@ 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"
$(Q) echo int $(subst ",,$(4))(int argc, char *argv[]); > "$(BUILTIN_REGISTRY)$(DELIM)$1.pdat"

$(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"
Expand All @@ -99,6 +118,7 @@ define REGISTER
$(Q) touch "$(BUILTIN_REGISTRY)$(DELIM).updated"
endef
endif
endif

# Standard include path

Expand Down
6 changes: 6 additions & 0 deletions builtin/builtin_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@

#include <nuttx/lib/builtin.h>

#include <sys/stat.h>

/****************************************************************************
* Private Types
****************************************************************************/
Expand All @@ -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]);
Expand Down