xref: /freebsd/sys/tools/syscalls/README.md (revision 913bfd86c1b2a161c21fccaef63c1e1702560366)
1# System call creation library
2Parses `syscalls.master` and packages information into objects with methods.
3Modules reproduce the previously monolithic file auto-generation.
4
5We generally assume that this script will be run by flua, however we've
6carefully crafted modules for it that mimic interfaces provided by modules
7available in ports.  Currently, this script is compatible with lua from
8ports along with the compatible luafilesystem and lua-posix modules.
9
10## Usage
11`main.lua` generates all files.
12Files are associated with their respective modules, and modules can be run as
13standalone scripts to generate specific files.
14
15### Examples
16**All files:**
17`# /usr/libexec/flua /usr/src/sys/tools/syscalls/main.lua /usr/src/sys/kern/syscalls.master`
18<br>
19**syscalls.h:**
20`# /usr/libexec/flua /usr/src/sys/tools/syscalls/scripts/syscalls.h /usr/src/sys/kern/syscalls.master`
21
22## Organization
23* `root`
24  * `main.lua` - Main entry point that calls all scripts.
25  * `config.lua` - Contains the global configuration table and associated
26                   configuration functions.
27
28  * `core` (Core Classes)
29    * `syscall.lua` - Packages each system call entry from `syscalls.master`
30                      into a system call object.
31    * `scarg.lua` - Packages each argument for the system call into an argument
32                    object.
33    * `scret.lua` - An object for the return value of the system call.
34    * `freebsd-syscall.lua` - Contains the master system call table after
35                              processing.
36
37  * `scripts`
38    * `init_sysent.lua` - Generates `init_sysent.c`.
39    * `libsys_h.lua` - Generates `lib/libsys/_libsys.h`.
40    * `syscall_h.lua` - Generates `syscall.h`.
41    * `syscall_mk.lua` - Generates `syscall.mk`.
42    * `syscalls.lua` - Generates `syscalls.c`.
43    * `syscalls_map.lua` - Generates `lib/libsys/syscalls.map`.
44    * `sysproto_h.lua` - Generates `sysproto.h`.
45    * `systrace_args.lua` - Generates `systrace_args.c`.
46
47  * `tools`
48    * `util.lua` - Contains utility functions.
49    * `generator.lua` - Handles file generation for the library.
50