Skip to content

Commit e6436dc

Browse files
gautam899JohnTitor
authored andcommitted
Adding structs and defines for vxworks
(backport <#5003>) (cherry picked from commit e5c6bd4)
1 parent e9cca04 commit e6436dc

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed

libc-test/semver/vxworks.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,12 +241,15 @@ ONLCR
241241
OPOST
242242
O_ACCMODE
243243
O_APPEND
244+
O_ASYNC
244245
O_CLOEXEC
245246
O_CREAT
247+
O_DSYNC
246248
O_EXCL
247249
O_NONBLOCK
248250
O_RDONLY
249251
O_RDWR
252+
O_SYNC
250253
O_TRUNC
251254
O_WRONLY
252255
PARENB
@@ -468,6 +471,7 @@ connect
468471
creat
469472
dev_t
470473
dirent
474+
dirfd
471475
dladdr
472476
dlclose
473477
dlerror
@@ -482,7 +486,9 @@ fchown
482486
fchownat
483487
fclose
484488
fcntl
489+
fdatasync
485490
fdopen
491+
fdopendir
486492
feof
487493
ferror
488494
fflush
@@ -506,6 +512,7 @@ fscanf
506512
fseek
507513
fseeko
508514
fsetpos
515+
fsid_t
509516
fstat
510517
fsync
511518
ftell
@@ -586,6 +593,7 @@ memcpy
586593
memmove
587594
memset
588595
mkdir
596+
mkdirat
589597
mkdtemp
590598
mkfifo
591599
mkstemp
@@ -604,6 +612,7 @@ nfds_t
604612
nlink_t
605613
off_t
606614
open
615+
openat
607616
opendir
608617
openlog
609618
pathconf
@@ -676,6 +685,7 @@ raise
676685
read
677686
readdir
678687
readlink
688+
readlinkat
679689
readv
680690
realloc
681691
realpath
@@ -736,6 +746,7 @@ sprintf
736746
sscanf
737747
ssize_t
738748
stat
749+
statfs
739750
strcat
740751
strchr
741752
strcmp

src/vxworks/mod.rs

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,22 @@ s! {
241241
st_reserved4: Padding<c_int>,
242242
}
243243

244+
pub struct fsid_t {
245+
val: [c_long; 2],
246+
}
247+
248+
pub struct statfs {
249+
pub f_type: c_long,
250+
pub f_bsize: c_long,
251+
pub f_blocks: c_long,
252+
pub f_bfree: c_long,
253+
pub f_bavail: c_long,
254+
pub f_files: c_long,
255+
pub f_ffree: c_long,
256+
pub f_fsid: crate::fsid_t,
257+
f_spare: Padding<[c_long; 7]>,
258+
}
259+
244260
//b_struct__Timespec.h
245261
pub struct _Timespec {
246262
pub tv_sec: crate::time_t,
@@ -1374,6 +1390,9 @@ pub const O_ACCMODE: c_int = 3;
13741390
pub const O_CLOEXEC: c_int = 0x100000; // fcntlcom
13751391
pub const O_EXCL: c_int = 0x0800;
13761392
pub const O_CREAT: c_int = 0x0200;
1393+
pub const O_SYNC: c_int = 0x2000;
1394+
pub const O_ASYNC: c_int = 0x0040;
1395+
pub const O_DSYNC: c_int = 0x10000;
13771396
pub const O_TRUNC: c_int = 0x0400;
13781397
pub const O_APPEND: c_int = 0x0008;
13791398
pub const O_RDWR: c_int = 0x0002;
@@ -1560,6 +1579,15 @@ extern "C" {
15601579
flags: c_int,
15611580
) -> c_int;
15621581

1582+
pub fn mkdirat(dirfd: c_int, pathname: *const c_char, mode: mode_t) -> c_int;
1583+
1584+
pub fn readlinkat(
1585+
dirfd: c_int,
1586+
pathname: *const c_char,
1587+
buf: *mut c_char,
1588+
bufsiz: size_t,
1589+
) -> ssize_t;
1590+
15631591
pub fn unlinkat(dirfd: c_int, pathname: *const c_char, flags: c_int) -> c_int;
15641592

15651593
// netdb.h
@@ -1606,6 +1634,7 @@ extern "C" {
16061634
pub fn pause() -> c_int;
16071635
pub fn seteuid(uid: uid_t) -> c_int;
16081636
pub fn setegid(gid: gid_t) -> c_int;
1637+
pub fn statfs(path: *const c_char, buf: *mut statfs) -> c_int;
16091638
pub fn sleep(secs: c_uint) -> c_uint;
16101639
pub fn ttyname(fd: c_int) -> *mut c_char;
16111640
pub fn wait(status: *mut c_int) -> pid_t;
@@ -1818,6 +1847,9 @@ extern "C" {
18181847
// stat.h
18191848
pub fn fstat(fildes: c_int, buf: *mut stat) -> c_int;
18201849

1850+
// sys/statfs.h
1851+
pub fn fstatfs(fd: c_int, buf: *mut statfs) -> c_int;
1852+
18211853
// stat.h
18221854
pub fn lstat(path: *const c_char, buf: *mut stat) -> c_int;
18231855

@@ -1834,10 +1866,19 @@ extern "C" {
18341866
// dirent.h
18351867
pub fn readdir(pDir: *mut crate::DIR) -> *mut crate::dirent;
18361868

1869+
// dirent.h
1870+
pub fn fdopendir(fd: c_int) -> *mut crate::DIR;
1871+
1872+
// dirent.h
1873+
pub fn dirfd(dirp: *mut crate::DIR) -> c_int;
1874+
18371875
// fcntl.h or
18381876
// ioLib.h
18391877
pub fn open(path: *const c_char, oflag: c_int, ...) -> c_int;
18401878

1879+
// fcntl.h
1880+
pub fn openat(dirfd: c_int, pathname: *const c_char, flags: c_int, ...) -> c_int;
1881+
18411882
// poll.h
18421883
pub fn poll(fds: *mut pollfd, nfds: nfds_t, timeout: c_int) -> c_int;
18431884

@@ -2175,6 +2216,9 @@ extern "C" {
21752216
// unistd.h
21762217
pub fn fsync(fd: c_int) -> c_int;
21772218

2219+
// unistd.h
2220+
pub fn fdatasync(fd: c_int) -> c_int;
2221+
21782222
// dirent.h
21792223
pub fn closedir(ptr: *mut crate::DIR) -> c_int;
21802224

0 commit comments

Comments
 (0)