Autogenerate syscall table based on other files #214
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR make it easier to maintain the syscall table used to match syscall number to their corresponding function.
For that, this script
syscall_gen.sh
is added. It will take as input the new filesyscall.tbl
andarch/ARCH/syscall.h.in
and generate the filesinclude/generated/syscall_number.h
andinclude/generated/syscall_table.h.in
.This script is called by the build system in the first steps.
syscall.tbl
is a custom file which list all syscall available in SO3 and a configuration requirements if there is any. This file isn't arch dependent and all new syscall implementation needs to be added there.arch/ARCH/syscall.h.in
is an exact copy from muslarch/ARCH/bits/syscall.h.in
which list all syscall available on Linux why there corresponding number.include/generated/syscall_number.h
will contain the all syscalls that are listed in bothsyscall.tbl
andsyscall.h.in
, with#ifdef CONFIG_...
around if necessary. This means that now ifSYSYCALL_xxx
is defined in the kernel, then the syscall is activated. It can allow to remove undeed syscall implementation to reduce the kernel code size.include/generated/syscall_table.h.in
will contain all syscall fromsyscall.tbl
in the following format:This file can then be included in the syscall table initialisation list to get the correct list of used syscall function with their correct number.
Those changes allow for a more easily maintainable list of syscall as only
syscall.tbl
needs to be updated when implmenting a new one, without having to add a lot of#if
around syscall table elements.