Project name

Project description

The current FreeBSD system call creation script, sys/tools/makesyscalls.lua, was implemented by Kyle Evans and iterated on by Brooks Davis. Its purpose is to streamline the introduction of system calls into the FreeBSD kernel. makesyscalls.lua is a transliteration of FreeBSD’s original makesyscalls.awk script from awk to Lua. It’s a monolithic script that has kept much of the procedural-oriented awk code. It does not take full advantage of modern features of Lua (object-oriented design) and has been difficult to add additional features to.

FreeBSD system call creation will be further improved by a complete refactor of makesyscalls.lua to have easily extensible objects and dynamically-called modules. The goal is to strip the monolithic script into an easily extendable interface. It will utilize classes to give extensible methods to objects, mainly utilizing the facade and command design patterns, to give a more "bite-sized" interface to the previously procedural code. Lua modules will provide better namespacing of globals, dynamic generation of output files, and more modules with different tasks may be easily added. After refactoring, the previous functionality of the original script can be achieved simply by calling the necessary modules. By taking advantage of modern Lua features and object-oriented design makesyscalls.lua can be easily extended, called dynamically, or serve as the basis for future scripts.

The benefit to FreeBSD is further streamlining in the creation of system calls, a more maintainable interface, and a strong foundation to build upon in the development of future system call creation tools. There is a clear intent to expand on the work of Kyle Evans and Brooks Davis, and my refactor will address that intent and provide an extensible interface to do so. It will further demystify the process of system call creation and allow others to more easily contribute. Warner Losh has done preliminary work on refactoring makesyscalls.lua, which will serve as the basis for my refactor. It is unfinished and does not incorporate Brooks Davis' recent commits. A successful project will be finishing the pre-established work, incorporating recent commits, and the previously stated design outcomes.

There is still much work to be done and critical design choices to be made (e.g., is it better to have local write procedures or a class interface?). Uncoupling the procedural code in a well-thought-out and extensible way is the major obstacle and motivation for the project.

Approach to solving the problem

Currently...
process_args():

process_syscall_def = λ:

loop write_line() procedure of producing auto-generated files:

How to solve:

Deliverables

1. System call creation will work as before
2. makesyscalls.lua is refactored into core, modules, and classes
3. System call creation library is easily extensible (It should provide a basis for future system call creation scripts)
4. Well-documented (e.g., "bsd_foo will be generated", how to opt-out of complex generation, etc.)

Milestones

Notable milestones:

(To be reviewed.)

Test Plan

(To be reviewed.)

The Code

To be completed.

Notes

To be completed.

Adding Syscalls to FreeBSD:

Brooks Davis’ recent commits:

SummerOfCode2024Projects/RefactorSyscallCreationScript (last edited 2024-05-06T09:13:01+0000 by TylerBaxter)