[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT PATCH] lib/syscall_shim: Generate syscall_nrs2.h



Generates a second header containing the syscall numbers. Instead of
using the format SYS_<name>, it introduces the syscall number
definitions with __NR_<name>. This can be handy for some libc and
language environment ports.

Signed-off-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
---
 lib/syscall_shim/Makefile.uk          |  7 ++++++-
 lib/syscall_shim/gen_syscall_nrs2.awk | 13 +++++++++++++
 2 files changed, 19 insertions(+), 1 deletion(-)
 create mode 100644 lib/syscall_shim/gen_syscall_nrs2.awk

diff --git a/lib/syscall_shim/Makefile.uk b/lib/syscall_shim/Makefile.uk
index 17de49cd..c01ee494 100644
--- a/lib/syscall_shim/Makefile.uk
+++ b/lib/syscall_shim/Makefile.uk
@@ -2,7 +2,7 @@ $(eval $(call 
addlib_s,libsyscall_shim,$(CONFIG_LIBSYSCALL_SHIM)))
 
 LIBSYSCALL_SHIM_INCLUDES_PATH := $(LIBSYSCALL_SHIM_BUILD)/include/uk/bits
 
-LIBSYSCALL_SHIM_PHONY_SRC := syscall_map.h syscall_stubs.h syscall_nrs.h
+LIBSYSCALL_SHIM_PHONY_SRC := syscall_map.h syscall_stubs.h syscall_nrs.h 
syscall_nrs2.h
 LIBSYSCALL_SHIM_PHONY_SRC := $(addprefix $(LIBSYSCALL_SHIM_INCLUDES_PATH)/, 
$(LIBSYSCALL_SHIM_PHONY_SRC))
 LIBSYSCALL_SHIM_PHONY_SRC += $(LIBSYSCALL_SHIM_BUILD)/provided_syscalls.h.in
 LIBSYSCALL_SHIM_PHONY_SRC_NEW := $(addsuffix .new, 
$(LIBSYSCALL_SHIM_PHONY_SRC))
@@ -31,6 +31,11 @@ $(LIBSYSCALL_SHIM_INCLUDES_PATH)/syscall_nrs.h.new: 
$(LIBSYSCALL_SHIM_BASE)/gen_
                $(AWK) -f $(LIBSYSCALL_SHIM_BASE)/gen_syscall_nrs.awk \
                $(LIBSYSCALL_SHIM_TEMPL) > $@)
 
+$(LIBSYSCALL_SHIM_INCLUDES_PATH)/syscall_nrs2.h.new: 
$(LIBSYSCALL_SHIM_BASE)/gen_syscall_nrs2.awk $(LIBSYSCALL_SHIM_TEMPL)
+       $(call build_cmd,GEN,libsyscall_shim,$(notdir $@), \
+               $(AWK) -f $(LIBSYSCALL_SHIM_BASE)/gen_syscall_nrs2.awk \
+               $(LIBSYSCALL_SHIM_TEMPL) > $@)
+
 $(LIBSYSCALL_SHIM_INCLUDES_PATH)/syscall_map.h.new: 
$(LIBSYSCALL_SHIM_BASE)/gen_syscall_map.awk $(LIBSYSCALL_SHIM_TEMPL)
        $(call build_cmd,GEN,libsyscall_shim,$(notdir $@), \
                $(AWK) -f  $(LIBSYSCALL_SHIM_BASE)/gen_syscall_map.awk \
diff --git a/lib/syscall_shim/gen_syscall_nrs2.awk 
b/lib/syscall_shim/gen_syscall_nrs2.awk
new file mode 100644
index 00000000..fe658dcc
--- /dev/null
+++ b/lib/syscall_shim/gen_syscall_nrs2.awk
@@ -0,0 +1,13 @@
+BEGIN {
+       print "/* Automatically generated file; DO NOT EDIT */"
+       print "#ifndef __UK_SYSCALL_NRS_2_H__"
+       print "#define __UK_SYSCALL_NRS_2_H__"
+}
+
+/#define __NR_/{
+        printf "#define __NR_%s\t\t%s\n", substr($2,6),$3
+}
+
+END {
+       print "#endif /* __UK_SYSCALL_NRS_2_H__ */"
+}
-- 
2.20.1


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.