Page MenuHomeFreeBSD

syscalls: normalize _exit(2) declerations
ClosedPublic

Authored by brooks on Aug 1 2025, 12:42 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Dec 11, 4:54 AM
Unknown Object (File)
Mon, Nov 24, 12:20 AM
Unknown Object (File)
Fri, Nov 21, 4:23 PM
Unknown Object (File)
Thu, Nov 20, 9:09 AM
Unknown Object (File)
Nov 8 2025, 7:04 PM
Unknown Object (File)
Nov 4 2025, 12:33 PM
Unknown Object (File)
Nov 4 2025, 3:36 AM
Unknown Object (File)
Nov 3 2025, 2:10 AM
Subscribers

Details

Summary

exit(3) is implemented by the runtime and performs a number of shutdown
actions before ultimately calling _exit(2) to terminate the program. We
historically named the syscall table entry exit rather than _exit,
but this requires special handling in libc/libsys to cause the _exit
symbol to exist while implementing exit in libc.

Declare the syscall as _exit and flow that through the system.

Because syscall(SYS_exit, code) is fairly widely used, add a specical
case to syscall.h generation to create SYS_exit when defining SYS__exit.
It's unfortunate to trade one special case for another, but this still
does reduce the number of special cases.

I've found no external uses of __sys_exit() so I've not bothered to
create a compatability version for this private symbol.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

In the title, declEration.

sys/tools/syscalls/scripts/syscall_h.lua
70

Could you emit '#define SYS_exit SYS__exit' unconditionally somewhere at start of file, for FreeBSD native generation?

This revision is now accepted and ready to land.Aug 1 2025, 1:09 PM
  • Make SYS_exit definition a config option rather than a special case in the script
This revision now requires review to proceed.Aug 6 2025, 1:04 PM
This revision is now accepted and ready to land.Aug 6 2025, 1:39 PM
This revision was automatically updated to reflect the committed changes.
brooks marked an inline comment as done.