xref: /freebsd/sys/tools/syscalls/README.md (revision 913bfd86c1b2a161c21fccaef63c1e1702560366)
19ded074eSagge3# System call creation library
29ded074eSagge3Parses `syscalls.master` and packages information into objects with methods.
3*913bfd86SBrooks DavisModules reproduce the previously monolithic file auto-generation.
49ded074eSagge3
59ded074eSagge3We generally assume that this script will be run by flua, however we've
69ded074eSagge3carefully crafted modules for it that mimic interfaces provided by modules
79ded074eSagge3available in ports.  Currently, this script is compatible with lua from
89ded074eSagge3ports along with the compatible luafilesystem and lua-posix modules.
99ded074eSagge3
109ded074eSagge3## Usage
119ded074eSagge3`main.lua` generates all files.
129ded074eSagge3Files are associated with their respective modules, and modules can be run as
139ded074eSagge3standalone scripts to generate specific files.
149ded074eSagge3
159ded074eSagge3### Examples
169ded074eSagge3**All files:**
179ded074eSagge3`# /usr/libexec/flua /usr/src/sys/tools/syscalls/main.lua /usr/src/sys/kern/syscalls.master`
189ded074eSagge3<br>
199ded074eSagge3**syscalls.h:**
209ded074eSagge3`# /usr/libexec/flua /usr/src/sys/tools/syscalls/scripts/syscalls.h /usr/src/sys/kern/syscalls.master`
219ded074eSagge3
229ded074eSagge3## Organization
239ded074eSagge3* `root`
249ded074eSagge3  * `main.lua` - Main entry point that calls all scripts.
259ded074eSagge3  * `config.lua` - Contains the global configuration table and associated
269ded074eSagge3                   configuration functions.
279ded074eSagge3
289ded074eSagge3  * `core` (Core Classes)
299ded074eSagge3    * `syscall.lua` - Packages each system call entry from `syscalls.master`
309ded074eSagge3                      into a system call object.
319ded074eSagge3    * `scarg.lua` - Packages each argument for the system call into an argument
329ded074eSagge3                    object.
339ded074eSagge3    * `scret.lua` - An object for the return value of the system call.
349ded074eSagge3    * `freebsd-syscall.lua` - Contains the master system call table after
359ded074eSagge3                              processing.
369ded074eSagge3
379ded074eSagge3  * `scripts`
389ded074eSagge3    * `init_sysent.lua` - Generates `init_sysent.c`.
399ded074eSagge3    * `libsys_h.lua` - Generates `lib/libsys/_libsys.h`.
409ded074eSagge3    * `syscall_h.lua` - Generates `syscall.h`.
419ded074eSagge3    * `syscall_mk.lua` - Generates `syscall.mk`.
429ded074eSagge3    * `syscalls.lua` - Generates `syscalls.c`.
439ded074eSagge3    * `syscalls_map.lua` - Generates `lib/libsys/syscalls.map`.
449ded074eSagge3    * `sysproto_h.lua` - Generates `sysproto.h`.
459ded074eSagge3    * `systrace_args.lua` - Generates `systrace_args.c`.
469ded074eSagge3
479ded074eSagge3  * `tools`
489ded074eSagge3    * `util.lua` - Contains utility functions.
499ded074eSagge3    * `generator.lua` - Handles file generation for the library.
50