The branch main has been updated by brooks:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=9355ad0b0bfaba9dc39972819185a7dc787a8950

commit 9355ad0b0bfaba9dc39972819185a7dc787a8950
Author:     Brooks Davis <bro...@freebsd.org>
AuthorDate: 2025-02-18 22:02:19 +0000
Commit:     Brooks Davis <bro...@freebsd.org>
CommitDate: 2025-02-18 22:03:33 +0000

    makesyscalls: emit cpp in syscalls.map
    
    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
---
 sys/tools/syscalls/examples/cpp/syscalls.conf     |  1 +
 sys/tools/syscalls/examples/cpp/test_syscalls.map | 18 ++++++++++++++++++
 sys/tools/syscalls/scripts/syscalls_map.lua       |  4 +++-
 3 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/sys/tools/syscalls/examples/cpp/syscalls.conf 
b/sys/tools/syscalls/examples/cpp/syscalls.conf
index 7fc15b6bb01f..ffcfa8d4c6aa 100644
--- a/sys/tools/syscalls/examples/cpp/syscalls.conf
+++ b/sys/tools/syscalls/examples/cpp/syscalls.conf
@@ -7,4 +7,5 @@ syscallprefix="TEST_SYS_"
 switchname="test_sysent"
 namesname="test_syscallnames"
 systrace="test_systrace_args.c"
+libsysmap="test_syscalls.map"
 compat_set=""
diff --git a/sys/tools/syscalls/examples/cpp/test_syscalls.map 
b/sys/tools/syscalls/examples/cpp/test_syscalls.map
new file mode 100644
index 000000000000..137496186402
--- /dev/null
+++ b/sys/tools/syscalls/examples/cpp/test_syscalls.map
@@ -0,0 +1,18 @@
+/*
+ * FreeBSD system call symbols.
+ *
+ * DO NOT EDIT-- this file is automatically @generated.
+ */
+
+FBSDprivate_1.0 {
+#ifdef PLATFORM_FOO
+       _syscall1;
+       __sys_syscall1;
+#else
+#endif
+#ifdef PLATFORM_FOO
+#else
+       _syscall2;
+       __sys_syscall2;
+#endif
+};
diff --git a/sys/tools/syscalls/scripts/syscalls_map.lua 
b/sys/tools/syscalls/scripts/syscalls_map.lua
index 023b43052921..52c3b294e338 100755
--- a/sys/tools/syscalls/scripts/syscalls_map.lua
+++ b/sys/tools/syscalls/scripts/syscalls_map.lua
@@ -37,7 +37,7 @@ function syscalls_map.generate(tbl, config, fh)
        gen:write(string.format("FBSDprivate_1.0 {\n"))
 
        for _, v in pairs(s) do
-               --print("num " .. v.num .. " name " .. v.name)
+               gen:write(v.prolog)
                if v:native() and not v.type.NODEF and not v.type.NOLIB then
                        if v.name ~= "exit" and v.name ~= "vfork" then
                                gen:write(string.format("\t_%s;\n", v.name))
@@ -45,6 +45,8 @@ function syscalls_map.generate(tbl, config, fh)
                        gen:write(string.format("\t__sys_%s;\n", v.name))
                end
        end
+       gen:write(tbl.epilog)
+
        -- End
        gen:write("};\n")
 end

Reply via email to