@@ -2855,6 +2855,9 @@ fn test_freebsd(target: &str) {
2855
2855
"CAP_UNUSED0_44" | "CAP_UNUSED0_57" | "CAP_UNUSED1_22" | "CAP_UNUSED1_57"
2856
2856
| "CAP_ALL0" | "CAP_ALL1" => true ,
2857
2857
2858
+ // FIXME(freebsd): Removed in FreeBSD 15, deprecated in libc
2859
+ "TCP_PCAP_OUT" | "TCP_PCAP_IN" => true ,
2860
+
2858
2861
_ => false ,
2859
2862
}
2860
2863
} ) ;
@@ -3661,6 +3664,26 @@ fn test_vxworks(target: &str) {
3661
3664
cfg. generate ( src_hotfix_dir ( ) . join ( "lib.rs" ) , "main.rs" ) ;
3662
3665
}
3663
3666
3667
+ fn config_gnu_bits ( target : & str , cfg : & mut ctest:: TestGenerator ) {
3668
+ match env:: var ( "RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS" ) {
3669
+ Ok ( val) if val == "64" => {
3670
+ if target. contains ( "gnu" )
3671
+ && target. contains ( "linux" )
3672
+ && !target. ends_with ( "x32" )
3673
+ && !target. contains ( "riscv32" )
3674
+ && env:: var ( "CARGO_CFG_TARGET_POINTER_WIDTH" ) . unwrap ( ) == "32"
3675
+ {
3676
+ cfg. define ( "_FILE_OFFSET_BITS" , Some ( "64" ) ) ;
3677
+ cfg. cfg ( "gnu_file_offset_bits64" , None ) ;
3678
+ }
3679
+ }
3680
+ Ok ( val) if val != "32" => {
3681
+ panic ! ( "RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS may only be set to '32' or '64'" )
3682
+ }
3683
+ _ => { }
3684
+ }
3685
+ }
3686
+
3664
3687
fn test_linux ( target : & str ) {
3665
3688
assert ! ( target. contains( "linux" ) ) ;
3666
3689
@@ -3704,6 +3727,8 @@ fn test_linux(target: &str) {
3704
3727
// glibc versions older than 2.29.
3705
3728
cfg. define ( "__GLIBC_USE_DEPRECATED_SCANF" , None ) ;
3706
3729
3730
+ config_gnu_bits ( target, & mut cfg) ;
3731
+
3707
3732
headers ! { cfg:
3708
3733
"ctype.h" ,
3709
3734
"dirent.h" ,
@@ -4866,6 +4891,7 @@ fn test_linux_like_apis(target: &str) {
4866
4891
if linux || android || emscripten {
4867
4892
// test strerror_r from the `string.h` header
4868
4893
let mut cfg = ctest_cfg ( ) ;
4894
+ config_gnu_bits ( target, & mut cfg) ;
4869
4895
cfg. skip_type ( |_| true ) . skip_static ( |_| true ) ;
4870
4896
4871
4897
headers ! { cfg: "string.h" }
@@ -4882,6 +4908,7 @@ fn test_linux_like_apis(target: &str) {
4882
4908
// test fcntl - see:
4883
4909
// http://man7.org/linux/man-pages/man2/fcntl.2.html
4884
4910
let mut cfg = ctest_cfg ( ) ;
4911
+ config_gnu_bits ( target, & mut cfg) ;
4885
4912
4886
4913
if musl {
4887
4914
cfg. header ( "fcntl.h" ) ;
@@ -4911,6 +4938,7 @@ fn test_linux_like_apis(target: &str) {
4911
4938
if ( linux && !wali) || android {
4912
4939
// test termios
4913
4940
let mut cfg = ctest_cfg ( ) ;
4941
+ config_gnu_bits ( target, & mut cfg) ;
4914
4942
cfg. header ( "asm/termbits.h" ) ;
4915
4943
cfg. header ( "linux/termios.h" ) ;
4916
4944
cfg. skip_type ( |_| true )
@@ -4935,6 +4963,7 @@ fn test_linux_like_apis(target: &str) {
4935
4963
if linux || android {
4936
4964
// test IPV6_ constants:
4937
4965
let mut cfg = ctest_cfg ( ) ;
4966
+ config_gnu_bits ( target, & mut cfg) ;
4938
4967
headers ! {
4939
4968
cfg:
4940
4969
"linux/in6.h"
@@ -4966,6 +4995,7 @@ fn test_linux_like_apis(target: &str) {
4966
4995
// "resolve.h" defines a `p_type` macro that expands to `__p_type`
4967
4996
// making the tests for these fails when both are included.
4968
4997
let mut cfg = ctest_cfg ( ) ;
4998
+ config_gnu_bits ( target, & mut cfg) ;
4969
4999
cfg. header ( "elf.h" ) ;
4970
5000
cfg. skip_fn ( |_| true )
4971
5001
. skip_static ( |_| true )
@@ -4985,6 +5015,7 @@ fn test_linux_like_apis(target: &str) {
4985
5015
if ( linux && !wali) || android {
4986
5016
// Test `ARPHRD_CAN`.
4987
5017
let mut cfg = ctest_cfg ( ) ;
5018
+ config_gnu_bits ( target, & mut cfg) ;
4988
5019
cfg. header ( "linux/if_arp.h" ) ;
4989
5020
cfg. skip_fn ( |_| true )
4990
5021
. skip_static ( |_| true )
0 commit comments