@@ -514,6 +514,77 @@ foreach ccattr: [
514514 srcconf.set10(' HAVE_COMPILER_ATTR_' + ccattr.underscorify().to_upper(), cc.has_function_attribute(ccattr))
515515endforeach
516516
517+ ## Headers.
518+ foreach ident : [
519+ [' bpf' , ''' #include <sys/syscall.h>
520+ #include <unistd.h>''' ],
521+ [' close_range' , ''' #include <unistd.h>''' ],
522+ [' execveat' , ''' #include <unistd.h>''' ],
523+ [' endmntent' , ''' #include <stdio.h>
524+ #include <mntent.h>''' ],
525+ [' faccessat' , ''' #include <fcntl.h>
526+ #include <unistd.h>''' ],
527+ [' fexecve' , ''' #include <unistd.h>''' ],
528+ [' fgetln' , ''' #include <stdio.h>''' ],
529+ [' fsconfig' , ''' #include <sys/mount.h>''' ],
530+ [' fsmount' , ''' #include <sys/mount.h>''' ],
531+ [' fsopen' , ''' #include <sys/mount.h>''' ],
532+ [' fspick' , ''' #include <sys/mount.h>''' ],
533+ [' getgrgid_r' , ''' #include <sys/types.h>
534+ #include <grp.h>''' ],
535+ [' getline' , ''' #include <stdio.h>''' ],
536+ [' getsubopt' , ''' #include <stdlib.h>''' ],
537+ [' gettid' , ''' #include <sys/types.h>
538+ #include <unistd.h>''' ],
539+ [' hasmntopt' , ''' #include <stdio.h>
540+ #include <mntent.h>''' ],
541+ [' kcmp' , ''' #include <linux/kcmp.h>''' ],
542+ [' keyctl' , ''' #include <sys/types.h>
543+ #include <keyutils.h>''' ],
544+ [' memfd_create' , ''' #include <sys/mman.h>''' ],
545+ [' mount_setattr' , ''' #include <sys/mount.h>''' ],
546+ [' move_mount' , ''' #include <sys/mount.h>''' ],
547+ [' openat2' , ''' #include <sys/types.h>
548+ #include <sys/stat.h>
549+ #include <fctnl.h>''' ],
550+ [' open_tree' , ''' #include <sys/mount.h>''' ],
551+ [' personality' , ''' #include <sys/personality.h>''' ],
552+ [' pidfd_open' , ''' #include <stdlib.h>
553+ #include <unistd.h>
554+ #include <signal.h>
555+ #include <sys/wait.h>''' ],
556+ [' pidfd_send_signal' , ''' #include <stdlib.h>
557+ #include <unistd.h>
558+ #include <signal.h>
559+ #include <sys/wait.h>''' ],
560+ [' pivot_root' , ''' #include <stdlib.h>
561+ #include <unistd.h>''' ], # no known header declares pivot_root
562+ [' prlimit' , ''' #include <sys/time.h>
563+ #include <sys/resource.h>''' ],
564+ [' prlimit64' , ''' #include <sys/time.h>
565+ #include <sys/resource.h>''' ],
566+ [' renameat2' , ''' #include <stdio.h>
567+ #include <fcntl.h>''' ],
568+ [' sethostname' , ''' #include <unistd.h>''' ],
569+ [' setmntent' , ''' #include <stdio.h>
570+ #include <mntent.h>''' ],
571+ [' setns' , ''' #include <sched.h>''' ],
572+ [' sigdescr_np' , ''' #include <string.h>''' ],
573+ [' signalfd' , ''' #include <sys/signalfd.h>''' ],
574+ [' statvfs' , ''' #include <sys/statvfs.h>''' ],
575+ [' statx' , ''' #include <sys/types.h>
576+ #include <sys/stat.h>
577+ #include <unistd.h>''' ],
578+ [' strchrnul' , ''' #include <string.h>''' ],
579+ [' strlcat' , ''' #include <string.h>''' ],
580+ [' strlcpy' , ''' #include <string.h>''' ],
581+ [' unshare' , ''' #include <sched.h>''' ],
582+ ]
583+
584+ have = cc.has_function(ident[0 ], prefix : ident[1 ], args : ' -D_GNU_SOURCE' )
585+ srcconf.set10(' HAVE_' + ident[0 ].to_upper(), have)
586+ endforeach
587+
517588## Syscalls.
518589found_syscalls = []
519590missing_syscalls = []
@@ -639,132 +710,77 @@ else
639710 missing_types += ' struct mount_attr (sys/mount.h)' endif
640711
641712## Check if sys/mount.h defines the fsconfig commands
642- if cc.get_define(' FSCONFIG_SET_FLAG' , prefix : decl_headers) != ''
713+ if cc.get_define(' FSCONFIG_SET_FLAG' , prefix : decl_headers) != '' or \
714+ cc.has_header_symbol(' sys/mount.h' ,' FSCONFIG_SET_FLAG' )
643715 srcconf.set10(' HAVE_' + ' FSCONFIG_SET_FLAG' .underscorify().to_upper(), true )
644716 found_types += ' FSCONFIG_SET_FLAG (sys/mount.h)'
645717else
646718 srcconf.set10(' HAVE_' + ' FSCONFIG_SET_FLAG' .underscorify().to_upper(), false )
647719 missing_types += ' FSCONFIG_SET_FLAG (sys/mount.h)'
648720endif
649721
650- if cc.get_define(' FS_CONFIG_SET_STRING' , prefix : decl_headers) != ''
651- srcconf.set10(' HAVE_' + ' FS_CONFIG_SET_STRING' .underscorify().to_upper(), true )
652- found_types += ' FS_CONFIG_SET_STRING (sys/mount.h)'
722+ if cc.get_define(' FS_CONFIG_SET_STRING' , prefix : decl_headers) != '' or \
723+ cc.has_header_symbol(' sys/mount.h' ,' FSCONFIG_SET_STRING' )
724+ srcconf.set10(' HAVE_' + ' FSCONFIG_SET_STRING' .underscorify().to_upper(), true )
725+ found_types += ' FSCONFIG_SET_STRING (sys/mount.h)'
653726else
654- srcconf.set10(' HAVE_' + ' FS_CONFIG_SET_STRING ' .underscorify().to_upper(), false )
655- missing_types += ' FS_CONFIG_SET_STRING (sys/mount.h)'
727+ srcconf.set10(' HAVE_' + ' FSCONFIG_SET_STRING ' .underscorify().to_upper(), false )
728+ missing_types += ' FSCONFIG_SET_STRING (sys/mount.h)'
656729endif
657730
658- if cc.get_define(' FS_CONFIG_SET_BINARY' , prefix : decl_headers) != ''
659- srcconf.set10(' HAVE_' + ' FS_CONFIG_SET_BINARY' .underscorify().to_upper(), true )
660- found_types += ' FS_CONFIG_SET_BINARY (sys/mount.h)'
731+ if cc.get_define(' FS_CONFIG_SET_BINARY' , prefix : decl_headers) != '' or \
732+ cc.has_header_symbol(' sys/mount.h' ,' FSCONFIG_SET_BINARY' )
733+ srcconf.set10(' HAVE_' + ' FSCONFIG_SET_BINARY' .underscorify().to_upper(), true )
734+ found_types += ' FSCONFIG_SET_BINARY (sys/mount.h)'
661735else
662- srcconf.set10(' HAVE_' + ' FS_CONFIG_SET_BINARY ' .underscorify().to_upper(), false )
663- missing_types += ' FS_CONFIG_SET_BINARY (sys/mount.h)'
736+ srcconf.set10(' HAVE_' + ' FSCONFIG_SET_BINARY ' .underscorify().to_upper(), false )
737+ missing_types += ' FSCONFIG_SET_BINARY (sys/mount.h)'
664738endif
665739
666- if cc.get_define(' FS_CONFIG_SET_PATH_EMPTY' , prefix : decl_headers) != ''
667- srcconf.set10(' HAVE_' + ' FS_CONFIG_SET_PATH_EMPTY' .underscorify().to_upper(), true )
668- found_types += ' FS_CONFIG_SET_PATH_EMPTY (sys/mount.h)'
740+ if cc.get_define(' FS_CONFIG_SET_PATH' , prefix : decl_headers) != '' or \
741+ cc.has_header_symbol(' sys/mount.h' ,' FSCONFIG_SET_PATH' )
742+ srcconf.set10(' HAVE_' + ' FSCONFIG_SET_PATH' .underscorify().to_upper(), true )
743+ found_types += ' FSCONFIG_SET_PATH (sys/mount.h)'
669744else
670- srcconf.set10(' HAVE_' + ' FS_CONFIG_SET_PATH_EMPTY ' .underscorify().to_upper(), false )
671- missing_types += ' FS_CONFIG_SET_PATH_EMPTY (sys/mount.h)'
745+ srcconf.set10(' HAVE_' + ' FSCONFIG_SET_PATH ' .underscorify().to_upper(), false )
746+ missing_types += ' FSCONFIG_SET_PATH (sys/mount.h)'
672747endif
673748
674- if cc.get_define(' FS_CONFIG_SET_PATH_FD' , prefix : decl_headers) != ''
675- srcconf.set10(' HAVE_' + ' FS_CONFIG_SET_PATH_FD' .underscorify().to_upper(), true )
676- found_types += ' FS_CONFIG_SET_PATH_FD (sys/mount.h)'
749+ if cc.get_define(' FS_CONFIG_SET_PATH_EMPTY' , prefix : decl_headers) != '' or \
750+ cc.has_header_symbol(' sys/mount.h' ,' FSCONFIG_SET_PATH_EMPTY' )
751+ srcconf.set10(' HAVE_' + ' FSCONFIG_SET_PATH_EMPTY' .underscorify().to_upper(), true )
752+ found_types += ' FSCONFIG_SET_PATH_EMPTY (sys/mount.h)'
677753else
678- srcconf.set10(' HAVE_' + ' FS_CONFIG_SET_PATH_FD ' .underscorify().to_upper(), false )
679- missing_types += ' FS_CONFIG_SET_PATH_FD (sys/mount.h)'
754+ srcconf.set10(' HAVE_' + ' FSCONFIG_SET_PATH_EMPTY ' .underscorify().to_upper(), false )
755+ missing_types += ' FSCONFIG_SET_PATH_EMPTY (sys/mount.h)'
680756endif
681757
682- if cc.get_define(' FS_CONFIG_SET_CMD_CREATE' , prefix : decl_headers) != ''
683- srcconf.set10(' HAVE_' + ' FS_CONFIG_SET_CMD_CREATE' .underscorify().to_upper(), true )
684- found_types += ' FS_CONFIG_SET_CMD_CREATE (sys/mount.h)'
758+ if cc.get_define(' FS_CONFIG_SET_PATH_FD' , prefix : decl_headers) != '' or \
759+ cc.has_header_symbol(' sys/mount.h' ,' FSCONFIG_SET_FD' )
760+ srcconf.set10(' HAVE_' + ' FSCONFIG_SET_FD' .underscorify().to_upper(), true )
761+ found_types += ' FSCONFIG_SET_FD (sys/mount.h)'
685762else
686- srcconf.set10(' HAVE_' + ' FS_CONFIG_SET_CMD_CREATE ' .underscorify().to_upper(), false )
687- missing_types += ' FS_CONFIG_SET_CMD_CREATE (sys/mount.h)'
763+ srcconf.set10(' HAVE_' + ' FSCONFIG_SET_FD ' .underscorify().to_upper(), false )
764+ missing_types += ' FSCONFIG_SET_FD (sys/mount.h)'
688765endif
689766
690- if cc.get_define(' FS_CONFIG_SET_CMD_RECONFIGURE' , prefix : decl_headers) != ''
691- srcconf.set10(' HAVE_' + ' FS_CONFIG_SET_CMD_RECONFIGURE' .underscorify().to_upper(), true )
692- found_types += ' FS_CONFIG_SET_CMD_RECONFIGURE (sys/mount.h)'
767+ if cc.get_define(' FS_CONFIG_SET_CMD_CREATE' , prefix : decl_headers) != '' or \
768+ cc.has_header_symbol(' sys/mount.h' ,' FSCONFIG_CMD_CREATE' )
769+ srcconf.set10(' HAVE_' + ' FSCONFIG_CMD_CREATE' .underscorify().to_upper(), true )
770+ found_types += ' FSCONFIG_CMD_CREATE (sys/mount.h)'
693771else
694- srcconf.set10(' HAVE_' + ' FS_CONFIG_SET_CMD_RECONFIGURE ' .underscorify().to_upper(), false )
695- missing_types += ' FS_CONFIG_SET_CMD_RECONFIGURE (sys/mount.h)'
772+ srcconf.set10(' HAVE_' + ' FSCONFIG_CMD_CREATE ' .underscorify().to_upper(), false )
773+ missing_types += ' FSCONFIG_CMD_CREATE (sys/mount.h)'
696774endif
697775
698- ## Headers.
699- foreach ident : [
700- [' bpf' , ''' #include <sys/syscall.h>
701- #include <unistd.h>''' ],
702- [' close_range' , ''' #include <unistd.h>''' ],
703- [' execveat' , ''' #include <unistd.h>''' ],
704- [' endmntent' , ''' #include <stdio.h>
705- #include <mntent.h>''' ],
706- [' faccessat' , ''' #include <fcntl.h>
707- #include <unistd.h>''' ],
708- [' fexecve' , ''' #include <unistd.h>''' ],
709- [' fgetln' , ''' #include <stdio.h>''' ],
710- [' fsconfig' , ''' #include <sys/mount.h>''' ],
711- [' fsmount' , ''' #include <sys/mount.h>''' ],
712- [' fsopen' , ''' #include <sys/mount.h>''' ],
713- [' fspick' , ''' #include <sys/mount.h>''' ],
714- [' getgrgid_r' , ''' #include <sys/types.h>
715- #include <grp.h>''' ],
716- [' getline' , ''' #include <stdio.h>''' ],
717- [' getsubopt' , ''' #include <stdlib.h>''' ],
718- [' gettid' , ''' #include <sys/types.h>
719- #include <unistd.h>''' ],
720- [' hasmntopt' , ''' #include <stdio.h>
721- #include <mntent.h>''' ],
722- [' kcmp' , ''' #include <linux/kcmp.h>''' ],
723- [' keyctl' , ''' #include <sys/types.h>
724- #include <keyutils.h>''' ],
725- [' memfd_create' , ''' #include <sys/mman.h>''' ],
726- [' mount_setattr' , ''' #include <sys/mount.h>''' ],
727- [' move_mount' , ''' #include <sys/mount.h>''' ],
728- [' openat2' , ''' #include <sys/types.h>
729- #include <sys/stat.h>
730- #include <fctnl.h>''' ],
731- [' open_tree' , ''' #include <sys/mount.h>''' ],
732- [' personality' , ''' #include <sys/personality.h>''' ],
733- [' pidfd_open' , ''' #include <stdlib.h>
734- #include <unistd.h>
735- #include <signal.h>
736- #include <sys/wait.h>''' ],
737- [' pidfd_send_signal' , ''' #include <stdlib.h>
738- #include <unistd.h>
739- #include <signal.h>
740- #include <sys/wait.h>''' ],
741- [' pivot_root' , ''' #include <stdlib.h>
742- #include <unistd.h>''' ], # no known header declares pivot_root
743- [' prlimit' , ''' #include <sys/time.h>
744- #include <sys/resource.h>''' ],
745- [' prlimit64' , ''' #include <sys/time.h>
746- #include <sys/resource.h>''' ],
747- [' renameat2' , ''' #include <stdio.h>
748- #include <fcntl.h>''' ],
749- [' sethostname' , ''' #include <unistd.h>''' ],
750- [' setmntent' , ''' #include <stdio.h>
751- #include <mntent.h>''' ],
752- [' setns' , ''' #include <sched.h>''' ],
753- [' sigdescr_np' , ''' #include <string.h>''' ],
754- [' signalfd' , ''' #include <sys/signalfd.h>''' ],
755- [' statvfs' , ''' #include <sys/statvfs.h>''' ],
756- [' statx' , ''' #include <sys/types.h>
757- #include <sys/stat.h>
758- #include <unistd.h>''' ],
759- [' strchrnul' , ''' #include <string.h>''' ],
760- [' strlcat' , ''' #include <string.h>''' ],
761- [' strlcpy' , ''' #include <string.h>''' ],
762- [' unshare' , ''' #include <sched.h>''' ],
763- ]
764-
765- have = cc.has_function(ident[0 ], prefix : ident[1 ], args : ' -D_GNU_SOURCE' )
766- srcconf.set10(' HAVE_' + ident[0 ].to_upper(), have)
767- endforeach
776+ if cc.get_define(' FS_CONFIG_SET_CMD_RECONFIGURE' , prefix : decl_headers) != '' or \
777+ cc.has_header_symbol(' sys/mount.h' ,' FSCONFIG_CMD_RECONFIGURE' )
778+ srcconf.set10(' HAVE_' + ' FSCONFIG_CMD_RECONFIGURE' .underscorify().to_upper(), true )
779+ found_types += ' FSCONFIG_CMD_RECONFIGURE (sys/mount.h)'
780+ else
781+ srcconf.set10(' HAVE_' + ' FSCONFIG_CMD_RECONFIGURE' .underscorify().to_upper(), false )
782+ missing_types += ' FSCONFIG_CMD_RECONFIGURE (sys/mount.h)'
783+ endif
768784
769785found_headers = []
770786missing_headers = []
0 commit comments