Skip to content

Commit 153ae40

Browse files
committed
add supporting for vxWorks
1 parent 36a92d5 commit 153ae40

File tree

1 file changed

+152
-0
lines changed

1 file changed

+152
-0
lines changed

libc-test/build.rs

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ fn do_ctest() {
2727
t if t.contains("solaris") => return test_solaris(t),
2828
t if t.contains("wasi") => return test_wasi(t),
2929
t if t.contains("windows") => return test_windows(t),
30+
t if t.contains("vxworks") => return test_vxworks(t),
3031
t => panic!("unknown target {}", t),
3132
}
3233
}
@@ -1927,6 +1928,157 @@ fn test_emscripten(target: &str) {
19271928
cfg.generate("../src/lib.rs", "main.rs");
19281929
}
19291930

1931+
fn test_vxworks(target: &str) {
1932+
assert!(target.contains("vxworks"));
1933+
1934+
let mut cfg = ctest::TestGenerator::new();
1935+
headers! { cfg:
1936+
"vxWorks.h",
1937+
"yvals.h",
1938+
"nfs/nfsCommon.h",
1939+
"rtpLibCommon.h",
1940+
"randomNumGen.h",
1941+
"taskLib.h",
1942+
"sysLib.h",
1943+
"ioLib.h",
1944+
"inetLib.h",
1945+
"socket.h",
1946+
"errnoLib.h",
1947+
"ctype.h",
1948+
"dirent.h",
1949+
"dlfcn.h",
1950+
"elf.h",
1951+
"fcntl.h",
1952+
"grp.h",
1953+
"sys/poll.h",
1954+
"ifaddrs.h",
1955+
"langinfo.h",
1956+
"limits.h",
1957+
"link.h",
1958+
"locale.h",
1959+
"sys/stat.h",
1960+
"netdb.h",
1961+
"pthread.h",
1962+
"pwd.h",
1963+
"sched.h",
1964+
"semaphore.h",
1965+
"signal.h",
1966+
"stddef.h",
1967+
"stdint.h",
1968+
"stdio.h",
1969+
"stdlib.h",
1970+
"string.h",
1971+
"sys/file.h",
1972+
"sys/ioctl.h",
1973+
"sys/socket.h",
1974+
"sys/time.h",
1975+
"sys/times.h",
1976+
"sys/types.h",
1977+
"sys/uio.h",
1978+
"sys/un.h",
1979+
"sys/utsname.h",
1980+
"sys/wait.h",
1981+
"netinet/tcp.h",
1982+
"syslog.h",
1983+
"termios.h",
1984+
"time.h",
1985+
"ucontext.h",
1986+
"unistd.h",
1987+
"utime.h",
1988+
"wchar.h",
1989+
"errno.h",
1990+
}
1991+
1992+
cfg.skip_struct(move |ty| {
1993+
match ty {
1994+
"passwd" |
1995+
//the below definitions is part of public/private/
1996+
"_Vx_EVENTS_RSRC" |
1997+
"_Vx_semaphore" |
1998+
//Avaliable in Kernel space.
1999+
"epoll_event" => true,
2000+
_ => false,
2001+
}
2002+
});
2003+
2004+
/* Fix me */
2005+
cfg.skip_const(move |name| match name {
2006+
"SIG_DFL"
2007+
| "SIG_IGN"
2008+
| "SIG_ERR"
2009+
| "EPOLLPRI"
2010+
| "EPOLLIN"
2011+
| "EPOLLOUT"
2012+
| "EPOLLERR"
2013+
| "EPOLLHUP"
2014+
| "EPOLLRDHUP"
2015+
| "EPOLLONESHOT"
2016+
| "EPOLLET"
2017+
| "EPOLL_CTL_ADD"
2018+
| "EPOLL_CTL_DEL"
2019+
| "EPOLL_CTL_MOD"
2020+
| "S_nfsLib_NFSERR_XDEV"
2021+
| "S_nfsLib_NFSERR_NODEV"
2022+
| "S_nfsLib_NFSERR_MLINK"
2023+
| "S_IFDEVMEM"
2024+
| "CHILD"
2025+
| "TIME_RELTIME"
2026+
| "RTLD_DEFAULT"
2027+
| "EIOA"
2028+
| "FIONBIO"
2029+
| "FIOWRITE"
2030+
| "FIONREAD"
2031+
| "VXSIM_EWOULDBLOCK" => true,
2032+
_ => false,
2033+
});
2034+
2035+
/* Fix me */
2036+
cfg.skip_type(move |ty| match ty {
2037+
"stat64" | "sighandler_t" | "off64_t" => true,
2038+
_ => false,
2039+
});
2040+
2041+
cfg.skip_field_type(move |struct_, field| match (struct_, field) {
2042+
("siginfo_t", "si_value")
2043+
| ("stat", "st_size")
2044+
| ("sigaction", "sa_u") => true,
2045+
_ => false,
2046+
});
2047+
2048+
cfg.skip_roundtrip(move |s| match s {
2049+
_ => false,
2050+
});
2051+
2052+
cfg.type_name(move |ty, is_struct, is_union| match ty {
2053+
"DIR" | "FILE" | "Dl_info" | "RTP_DESC" => ty.to_string(),
2054+
t if is_union => format!("union {}", t),
2055+
t if t.ends_with("_t") => t.to_string(),
2056+
t if is_struct => format!("struct {}", t),
2057+
t => t.to_string(),
2058+
});
2059+
2060+
/* Fix me */
2061+
cfg.skip_fn(move |name| match name {
2062+
"sigqueue" | "_sigqueue" | "_rtld_dladdr" | "getpwnam"
2063+
| "getpwuid" | "pclose" | "execl" | "execle" | "execlp" | "execv"
2064+
| "execve" | "renameat" | "readlinkat" | "mkdirat" | "linkat"
2065+
| "fchownat" | "fchmodat" | "openat" | "fdopendir" | "symlinkat"
2066+
| "lchown" | "setpgid" | "fstatat" | "setsid" | "tcgetpgrp"
2067+
| "tcsetpgrp" | "killpg" | "mlock" | "munlock" | "mlockall"
2068+
| "munlockall" | "mmap" | "munmap" | "if_nametoindex"
2069+
| "if_indextoname" | "flock" | "res_init" | "mknod" | "chroot"
2070+
| "getsid" | "tcdrain" | "tcflow" | "tcflush" | "tcgetsid"
2071+
| "tcsendbreak" | "mkdtemp" | "nice" | "grantpt" | "posix_openpt"
2072+
| "ptsname" | "unlockpt" | "strcasestr" | "socketpair"
2073+
| "pwrite64" | "pread64" | "fork" | "_pathIsAbsolute" | "execvp"
2074+
| "setgroups" | "signal" | "getpagesize" | "dlclose" | "dlsym"
2075+
| "dlerror" | "dlopen" | "setrlimit" | "getrlimit" => true,
2076+
_ => false,
2077+
});
2078+
2079+
cfg.generate("../src/lib.rs", "main.rs");
2080+
}
2081+
19302082
fn test_linux(target: &str) {
19312083
assert!(target.contains("linux"));
19322084

0 commit comments

Comments
 (0)