<feed xmlns='http://www.w3.org/2005/Atom'>
<title>src/sys/tools/syscalls/scripts, branch main</title>
<subtitle>FreeBSD source tree</subtitle>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/'/>
<entry>
<title>sysent: add a new NORETURN type flag</title>
<updated>2025-08-08T09:30:17+00:00</updated>
<author>
<name>Brooks Davis</name>
<email>brooks@FreeBSD.org</email>
</author>
<published>2025-08-08T09:30:17+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=202ac0975edcc4729e7016a9e9cb921de45e3a70'/>
<id>202ac0975edcc4729e7016a9e9cb921de45e3a70</id>
<content type='text'>
System calls of type NORETURN don't return and their stubs are declare
not to.

Reviewed by:	kevans, kib
Differential Revision:	https://reviews.freebsd.org/D51673
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
System calls of type NORETURN don't return and their stubs are declare
not to.

Reviewed by:	kevans, kib
Differential Revision:	https://reviews.freebsd.org/D51673
</pre>
</div>
</content>
</entry>
<entry>
<title>syscalls: normalize _exit(2) declerations</title>
<updated>2025-08-08T09:30:16+00:00</updated>
<author>
<name>Brooks Davis</name>
<email>brooks@FreeBSD.org</email>
</author>
<published>2025-08-08T09:30:16+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=e7e964cb2ebde11593786a28cea0238d9a6e24c3'/>
<id>e7e964cb2ebde11593786a28cea0238d9a6e24c3</id>
<content type='text'>
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, allow a
configured extra line in syscall.h to define SYS_exit to SYS__exit.

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

Reviewed by:	imp, kib, emaste
Differential Revision:	https://reviews.freebsd.org/D51672
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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, allow a
configured extra line in syscall.h to define SYS_exit to SYS__exit.

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

Reviewed by:	imp, kib, emaste
Differential Revision:	https://reviews.freebsd.org/D51672
</pre>
</div>
</content>
</entry>
<entry>
<title>makesyscalls: emit cpp in syscalls.map</title>
<updated>2025-02-18T22:03:33+00:00</updated>
<author>
<name>Brooks Davis</name>
<email>brooks@FreeBSD.org</email>
</author>
<published>2025-02-18T22:02:19+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=9355ad0b0bfaba9dc39972819185a7dc787a8950'/>
<id>9355ad0b0bfaba9dc39972819185a7dc787a8950</id>
<content type='text'>
If there are per-platform differences in which syscalls are supported,
we should only try to export implemented ones in libc.  Fortunately,
syscall maps are run though cpp.  This is arguably incomplete as
syscall.mk isn't (and can't practically be) supported.

Reviewed by:	kevans
Sponsored by:	DARPA, AFRL
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1575
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If there are per-platform differences in which syscalls are supported,
we should only try to export implemented ones in libc.  Fortunately,
syscall maps are run though cpp.  This is arguably incomplete as
syscall.mk isn't (and can't practically be) supported.

Reviewed by:	kevans
Sponsored by:	DARPA, AFRL
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1575
</pre>
</div>
</content>
</entry>
<entry>
<title>makesyscalls: Restore support for cpp in input</title>
<updated>2025-02-18T22:03:13+00:00</updated>
<author>
<name>Brooks Davis</name>
<email>brooks@FreeBSD.org</email>
</author>
<published>2025-02-18T22:02:19+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=42d075f4b7b74eb3c4f943d6bdcc2aeb56be6388'/>
<id>42d075f4b7b74eb3c4f943d6bdcc2aeb56be6388</id>
<content type='text'>
Allow patterns like this in syscalls.master:

	#if 0
	91	AUE_NULL	RESERVED
	#else
	91	AUE_NULL	STD|CAPENABLED {
			int newsyscall(void);
		}
	#endif

makesyscalls.lua and it's predecessor makesyscalls.sh (really an awk
script with a tiny shell prolog) used a single pass parsing model where
lines beginning with `#` were emitted into most generated files as they
were read.  I belive this was initially there to allow includes to be
listed in syscalls.master, but Hyrum's Law[0] applies and people are using
it for things like architecture-specific syscall definitions.

This use of CPP macro is unsound and there are a number of sharp edges
in both the new and old implementations.  The macros are unsound because
not all the files were generate are run through CPP (or if they are not
in the same context) and this will increasingly be true as we generate
more things.  Sharp edges include the fact that anything before the
first syscall would be printed at a different scope (e.g., before an
array is declared).

In this patch I collect each non-#include CPP directive and attach them
to the syscall table or individual entries.  All entries before the
first syscall and after the last are attached to the prolog and epilog
members.  Within the syscall table all entries are attached to the next
system calls's prolog member.  In generators, each prolog entry is
printed regardless of the system call's visibiilty which replicates the
naive single pass model's behavior (including lots of empty blocks
of #if/#else/#endif in the output).  Unlike makesyscalls.lua, I discard
none #define entries at the top of the file and print a warning as their
usefulness appears limited.

[0] https://www.hyrumslaw.com

Reported by:	kevans
Reviewed by:	kevans
Sponsored by:	DARPA, AFRL
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1575
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Allow patterns like this in syscalls.master:

	#if 0
	91	AUE_NULL	RESERVED
	#else
	91	AUE_NULL	STD|CAPENABLED {
			int newsyscall(void);
		}
	#endif

makesyscalls.lua and it's predecessor makesyscalls.sh (really an awk
script with a tiny shell prolog) used a single pass parsing model where
lines beginning with `#` were emitted into most generated files as they
were read.  I belive this was initially there to allow includes to be
listed in syscalls.master, but Hyrum's Law[0] applies and people are using
it for things like architecture-specific syscall definitions.

This use of CPP macro is unsound and there are a number of sharp edges
in both the new and old implementations.  The macros are unsound because
not all the files were generate are run through CPP (or if they are not
in the same context) and this will increasingly be true as we generate
more things.  Sharp edges include the fact that anything before the
first syscall would be printed at a different scope (e.g., before an
array is declared).

In this patch I collect each non-#include CPP directive and attach them
to the syscall table or individual entries.  All entries before the
first syscall and after the last are attached to the prolog and epilog
members.  Within the syscall table all entries are attached to the next
system calls's prolog member.  In generators, each prolog entry is
printed regardless of the system call's visibiilty which replicates the
naive single pass model's behavior (including lots of empty blocks
of #if/#else/#endif in the output).  Unlike makesyscalls.lua, I discard
none #define entries at the top of the file and print a warning as their
usefulness appears limited.

[0] https://www.hyrumslaw.com

Reported by:	kevans
Reviewed by:	kevans
Sponsored by:	DARPA, AFRL
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1575
</pre>
</div>
</content>
</entry>
<entry>
<title>makesyscalls: reduce redundency in syscall.mk code</title>
<updated>2025-02-18T22:03:06+00:00</updated>
<author>
<name>Brooks Davis</name>
<email>brooks@FreeBSD.org</email>
</author>
<published>2025-02-18T22:02:19+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=daca374bc48b5f6975563ae9ecc227868039e807'/>
<id>daca374bc48b5f6975563ae9ecc227868039e807</id>
<content type='text'>
The two outer blocks had identical contents and the two inner blocks
differed in a single location.

Reviewed by:	kevans
Sponsored by:	DARPA, AFRL
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1575
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The two outer blocks had identical contents and the two inner blocks
differed in a single location.

Reviewed by:	kevans
Sponsored by:	DARPA, AFRL
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1575
</pre>
</div>
</content>
</entry>
<entry>
<title>sysent: add a NOLIB modifer to prevent stub generation</title>
<updated>2024-11-01T15:44:47+00:00</updated>
<author>
<name>Brooks Davis</name>
<email>brooks@FreeBSD.org</email>
</author>
<published>2024-10-30T22:48:49+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=bbc0f33b1317bb922ff3d960216ce7b4af88b8af'/>
<id>bbc0f33b1317bb922ff3d960216ce7b4af88b8af</id>
<content type='text'>
The yield system call has long existed, but never had a stub.  Replace
the hardcoded checks for it in libsys_h.lua and syscalls_map.lua and
stop inserting it into MIASM (requiring libsys/Makefile.sys to disable
the stub).

(This seems like overkill, but I've got another case in CheriBSD so this
reduces my diff appreciably.)

Reviewed by:	emaste
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1503
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The yield system call has long existed, but never had a stub.  Replace
the hardcoded checks for it in libsys_h.lua and syscalls_map.lua and
stop inserting it into MIASM (requiring libsys/Makefile.sys to disable
the stub).

(This seems like overkill, but I've got another case in CheriBSD so this
reduces my diff appreciably.)

Reviewed by:	emaste
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1503
</pre>
</div>
</content>
</entry>
<entry>
<title>sys/tools/syscalls: desupport capabilities.conf</title>
<updated>2024-10-30T21:04:31+00:00</updated>
<author>
<name>Brooks Davis</name>
<email>brooks@FreeBSD.org</email>
</author>
<published>2024-10-22T17:59:23+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=ec86d763d1c94648419aeb931683dcb37bf72656'/>
<id>ec86d763d1c94648419aeb931683dcb37bf72656</id>
<content type='text'>
We haven't used this since commit be67ea40c5a0 in 2021 so stop carrying
it forward.

Also remove support for setting the list in syscalls.conf via the
capenabled variable.  This was last used by cloudabi (removed in 2021
by commit cf0ee8738e31).
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We haven't used this since commit be67ea40c5a0 in 2021 so stop carrying
it forward.

Also remove support for setting the list in syscalls.conf via the
capenabled variable.  This was last used by cloudabi (removed in 2021
by commit cf0ee8738e31).
</pre>
</div>
</content>
</entry>
<entry>
<title>Refactor makesyscalls.lua into a library</title>
<updated>2024-10-30T21:04:30+00:00</updated>
<author>
<name>agge3</name>
<email>sterspark@gmail.com</email>
</author>
<published>2024-10-21T21:42:13+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=9ded074e875c29cb92d5f643801990d7bb23cca4'/>
<id>9ded074e875c29cb92d5f643801990d7bb23cca4</id>
<content type='text'>
* main.lua replicates the functionality of makesyscalls.lua
* Individual files are generated by their associated module
  * Modules can be called as standalone scripts to generate a specific
    file
* Data and procedures are performed by objects instead of procedual code
* Bitmasks are replaced by declarative types
* Temporary files are no longer produced, writing is stored in memory
* Comments provide explanation to functions and semantics

Google Summer of Code 2024 Final Work Product

Co-authored-by: Warner Losh &lt;imp@freebsd.org&gt;
Co-authored-by: Kyle Evans &lt;kevans@freebsd.org&gt;
Co-authored-by: Brooks Davis &lt;brooks@freebsd.org&gt;
Sponsored by:    Google (GSoC 24)
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1362
Signed-off-by: agge3 &lt;sterspark@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* main.lua replicates the functionality of makesyscalls.lua
* Individual files are generated by their associated module
  * Modules can be called as standalone scripts to generate a specific
    file
* Data and procedures are performed by objects instead of procedual code
* Bitmasks are replaced by declarative types
* Temporary files are no longer produced, writing is stored in memory
* Comments provide explanation to functions and semantics

Google Summer of Code 2024 Final Work Product

Co-authored-by: Warner Losh &lt;imp@freebsd.org&gt;
Co-authored-by: Kyle Evans &lt;kevans@freebsd.org&gt;
Co-authored-by: Brooks Davis &lt;brooks@freebsd.org&gt;
Sponsored by:    Google (GSoC 24)
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1362
Signed-off-by: agge3 &lt;sterspark@gmail.com&gt;
</pre>
</div>
</content>
</entry>
</feed>
