@@ -106,7 +106,7 @@ fn do_semver() {
106106 // maintain a file for Android.
107107 // NOTE: AIX doesn't include the unix file because there are definitions
108108 // missing on AIX. It is easier to maintain a file for AIX.
109- if family != os && !matches ! ( os. as_str( ) , "android" | "aix" ) {
109+ if family != os && !matches ! ( os. as_str( ) , "android" | "aix" ) && os != "vxworks" {
110110 process_semver_file ( & mut output, & mut semver_root, & family) ;
111111 }
112112 // We don't do semver for unknown targets.
@@ -3477,13 +3477,33 @@ fn test_neutrino(target: &str) {
34773477 ctest:: generate_test ( & mut cfg, "../src/lib.rs" , "ctest_output.rs" ) . unwrap ( ) ;
34783478}
34793479
3480+ fn which_vxworks ( ) -> Option < ( u32 , u32 ) > {
3481+ let version = env:: var ( "WIND_RELEASE_ID" ) . ok ( ) ?; // When in VxWorks setup, WIND_RELEASE_ID is
3482+ // always set as the version of the release.
3483+
3484+ let mut pieces = version. trim ( ) . split ( [ '.' ] ) ;
3485+
3486+ let major: u32 = pieces. next ( ) . and_then ( |x| x. parse ( ) . ok ( ) ) . unwrap_or ( 0 ) ;
3487+ let minor: u32 = pieces. next ( ) . and_then ( |x| x. parse ( ) . ok ( ) ) . unwrap_or ( 0 ) ;
3488+
3489+ Some ( ( major, minor) )
3490+ }
3491+
34803492fn test_vxworks ( target : & str ) {
34813493 assert ! ( target. contains( "vxworks" ) ) ;
34823494
34833495 let mut cfg = ctest_cfg ( ) ;
3496+
3497+ let vxworks_ver = which_vxworks ( ) ;
3498+
3499+ if vxworks_ver < Some ( ( 25 , 9 ) ) {
3500+ cfg. cfg ( "vxworks_lt_25_09" , None ) ;
3501+ }
3502+
34843503 headers ! (
34853504 cfg,
34863505 "vxWorks.h" ,
3506+ "semLibCommon.h" ,
34873507 "yvals.h" ,
34883508 "nfs/nfsCommon.h" ,
34893509 "rtpLibCommon.h" ,
@@ -3500,13 +3520,11 @@ fn test_vxworks(target: &str) {
35003520 "elf.h" ,
35013521 "fcntl.h" ,
35023522 "grp.h" ,
3503- "sys/poll.h" ,
35043523 "ifaddrs.h" ,
35053524 "langinfo.h" ,
35063525 "limits.h" ,
35073526 "link.h" ,
35083527 "locale.h" ,
3509- "sys/stat.h" ,
35103528 "netdb.h" ,
35113529 "pthread.h" ,
35123530 "pwd.h" ,
@@ -3518,6 +3536,9 @@ fn test_vxworks(target: &str) {
35183536 "stdio.h" ,
35193537 "stdlib.h" ,
35203538 "string.h" ,
3539+ "sys/select.h" ,
3540+ "sys/stat.h" ,
3541+ "sys/poll.h" ,
35213542 "sys/file.h" ,
35223543 "sys/ioctl.h" ,
35233544 "sys/socket.h" ,
@@ -3528,7 +3549,14 @@ fn test_vxworks(target: &str) {
35283549 "sys/un.h" ,
35293550 "sys/utsname.h" ,
35303551 "sys/wait.h" ,
3552+ "sys/ttycom.h" ,
3553+ "sys/utsname.h" ,
3554+ "sys/resource.h" ,
3555+ "sys/mman.h" ,
35313556 "netinet/tcp.h" ,
3557+ "netinet/udp.h" ,
3558+ "netinet/in.h" ,
3559+ "netinet6/in6.h" ,
35323560 "syslog.h" ,
35333561 "termios.h" ,
35343562 "time.h" ,
@@ -3537,16 +3565,22 @@ fn test_vxworks(target: &str) {
35373565 "utime.h" ,
35383566 "wchar.h" ,
35393567 "errno.h" ,
3540- "sys/mman.h" ,
35413568 "pathLib.h" ,
35423569 "mqueue.h" ,
3570+ "fnmatch.h" ,
3571+ "sioLibCommon.h" ,
3572+ "net/if.h" ,
35433573 ) ;
35443574 // FIXME(vxworks)
35453575 cfg. skip_const ( move |constant| match constant. ident ( ) {
35463576 // sighandler_t weirdness
35473577 "SIG_DFL" | "SIG_ERR" | "SIG_IGN"
3548- // This is not defined in vxWorks
3549- | "RTLD_DEFAULT" => true ,
3578+ // These are not defined in VxWorks
3579+ | "RTLD_DEFAULT" | "PRIO_PROCESS"
3580+ // Sticky bits not supported
3581+ | "S_ISVTX"
3582+ // The following are obsolete for VxWorks
3583+ | "SIGIO" | "SIGWINCH" | "SIGLOST" => true ,
35503584 _ => false ,
35513585 } ) ;
35523586 // FIXME(vxworks)
@@ -3557,7 +3591,12 @@ fn test_vxworks(target: &str) {
35573591
35583592 cfg. skip_struct_field_type (
35593593 move |struct_, field| match ( struct_. ident ( ) , field. ident ( ) ) {
3560- ( "siginfo_t" , "si_value" ) | ( "stat" , "st_size" ) | ( "sigaction" , "sa_u" ) => true ,
3594+ ( "siginfo_t" , "si_value" )
3595+ | ( "stat" , "st_size" )
3596+ // sighandler_t type is super weird
3597+ | ( "sigaction" , "sa_sigaction" )
3598+ // sa_u_t type is not defined in vxworks
3599+ | ( "sigaction" , "sa_u" ) => true ,
35613600 _ => false ,
35623601 } ,
35633602 ) ;
@@ -3576,11 +3615,16 @@ fn test_vxworks(target: &str) {
35763615 "sigqueue" | "_sigqueue"
35773616 // sighandler_t
35783617 | "signal"
3618+ // This is used a realpath and not _realpath
3619+ | "_realpath"
35793620 // not used in static linking by default
35803621 | "dlerror" => true ,
35813622 _ => false ,
35823623 } ) ;
35833624
3625+ // Not defined in vxworks. Just a crate specific union type.
3626+ cfg. skip_union ( move |u| u. ident ( ) == "sa_u_t" ) ;
3627+
35843628 ctest:: generate_test ( & mut cfg, "../src/lib.rs" , "ctest_output.rs" ) . unwrap ( ) ;
35853629}
35863630
0 commit comments