]> Sergey Matveev's repositories - public-inbox.git/commitdiff
devel/syscall-list: support non-Linux, show sizeof(pid_t)
authorEric Wong <e@80x24.org>
Thu, 11 Aug 2022 20:33:39 +0000 (20:33 +0000)
committerEric Wong <e@80x24.org>
Thu, 11 Aug 2022 21:57:56 +0000 (21:57 +0000)
While I have no intention of using syscall numbers for
non-Linux, sizeof(pid_t) was useful for OpenBSD.  And maybe
Linux can have real competition from other OSes with stable
syscall numbers someday.

devel/syscall-list

index d33a8a78a86e00c4534259125fa2c380323d813c..adb450da27b829be299efb2fbdaa8aafdf8f3b0d 100755 (executable)
@@ -28,7 +28,10 @@ __DATA__
 #define _GNU_SOURCE
 #include <sys/syscall.h>
 #include <sys/ioctl.h>
+#ifdef __linux__
 #include <linux/fs.h>
+#endif
+#include <sys/types.h>
 #include <unistd.h>
 #include <stdio.h>
 
@@ -60,6 +63,7 @@ int main(void)
        D(SYS_renameat2);
 #endif
 #endif /* Linux, any other OSes with stable syscalls? */
-       printf("size_t=%zu off_t=%zu\n", sizeof(size_t), sizeof(off_t));
+       printf("size_t=%zu off_t=%zu pid_t=%zu\n",
+                sizeof(size_t), sizeof(off_t), sizeof(pid_t));
        return 0;
 }