Skip to content

Implement statfs for dragonfly, freebsd and openbsd #1039

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 17, 2018
Merged

Implement statfs for dragonfly, freebsd and openbsd #1039

merged 2 commits into from
Jul 17, 2018

Conversation

alesharik
Copy link
Contributor

No description provided.

@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@semarie
Copy link
Contributor

semarie commented Jul 13, 2018

for OpenBSD, could you put the c_uchar definition in src/unix/bsd/netbsdlike/openbsdlike/openbsd/mod.rs ? the three definition you added are the same, so it could be factorized.

pub mount_info: mount_info,
}

pub union mount_info {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have the following error will trying to run testsuite on openbsd:

error: no rules expected the token `union`
  --> src/unix/bsd/netbsdlike/openbsdlike/openbsd/mod.rs:54:9
   |
54 |     pub union mount_info {
   |         ^^^^^

The block is in s! marco block, and union seems unsupported by the macro

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fixed unions. Can you rerun the testsuite?

@alesharik alesharik changed the title Implement statfs for dragonfly, freebsd, netbsd and openbsd Implement statfs for dragonfly, freebsd and openbsd Jul 13, 2018
@semarie
Copy link
Contributor

semarie commented Jul 13, 2018

cargo:warning=/data/semarie/repos/rust/build-libc/./build/debug/build/libc-test-12b6aa225dc34292/out/main.c:13863:17: error: must use 'union' tag
 to refer to type 'mount_info'
cargo:warning=                mount_info* __test_field_type_statfs_mount_info(struct statfs* b) {
cargo:warning=                ^
cargo:warning=                union
cargo:warning=/data/semarie/repos/rust/build-libc/./build/debug/build/libc-test-12b6aa225dc34292/out/main.c:13868:67: error: use of undeclared id
entifier 'mount_info'
cargo:warning=            uint64_t __test_size_mount_info(void) { return sizeof(mount_info); }
cargo:warning=                                                                  ^
...
cargo:warning=fatal error: too many errors emitted, stopping now [-ferror-limit=]
cargo:warning=20 errors generated.
exit code: 1

@alexcrichton
Copy link
Member

Thanks! Looks like @semarie still has some errors though?

@alesharik
Copy link
Contributor Author

Yes. And I'm building Rust for OpenBSD to fix them

@semarie
Copy link
Contributor

semarie commented Jul 14, 2018

@alesharik just a side note: you will have some unrelated errors regarding this PR (depending the openbsd version you use): KERN_MAXID on current, SIGSTKSZ (changed again recently) and struct arphdr alignment. See #1040.

@semarie
Copy link
Contributor

semarie commented Jul 15, 2018

I still have the same kind of errors.

--- stdout
-----------------------------------------
cargo:rerun-if-changed=../src/lib.rs
cargo:rerun-if-changed=../src/macros.rs
cargo:rerun-if-changed=../src/dox.rs
cargo:rerun-if-changed=../src/unix/mod.rs
cargo:rerun-if-changed=../src/unix/bsd/mod.rs
cargo:rerun-if-changed=../src/unix/bsd/netbsdlike/mod.rs
cargo:rerun-if-changed=../src/unix/bsd/netbsdlike/openbsdlike/mod.rs
cargo:rerun-if-changed=../src/unix/bsd/netbsdlike/openbsdlike/openbsd/mod.rs
cargo:rerun-if-changed=../src/unix/bsd/netbsdlike/openbsdlike/openbsd/x86_64.rs
OPT_LEVEL = Some("0")
HOST = Some("x86_64-unknown-openbsd")
HOST = Some("x86_64-unknown-openbsd")
CC_x86_64-unknown-openbsd = None
CC_x86_64_unknown_openbsd = None
HOST_CC = None
CC = None
HOST = Some("x86_64-unknown-openbsd")
HOST = Some("x86_64-unknown-openbsd")
CFLAGS_x86_64-unknown-openbsd = None
CFLAGS_x86_64_unknown_openbsd = None
HOST_CFLAGS = None
CFLAGS = None
DEBUG = Some("true")
running: "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-m64" "-Wall" "-Wextra" "-Wall" "-Wextra" "-Werror" "-Wno-unused-parameter" "-Wno-type-limits" "-Wno-deprecated-declarations" "-Wno-deprecated-declarations" "-o" "/data/semarie/repos/rust/build-libc/./build/debug/build/libc-test-12b6aa225dc34292/out/main.o" "-c" "/data/semarie/repos/rust/build-libc/./build/debug/build/libc-test-12b6aa225dc34292/out/main.c"
cargo:warning=/data/semarie/repos/rust/build-libc/./build/debug/build/libc-test-12b6aa225dc34292/out/main.c:13961:17: error: must use 'union' tag to refer to type 'mount_info'
cargo:warning=                mount_info* __test_field_type_statfs_mount_info(struct statfs* b) {
cargo:warning=                ^
cargo:warning=                union
cargo:warning=/data/semarie/repos/rust/build-libc/./build/debug/build/libc-test-12b6aa225dc34292/out/main.c:13966:67: error: use of undeclared identifier 'mount_info'
cargo:warning=            uint64_t __test_size_mount_info(void) { return sizeof(mount_info); }
cargo:warning=                                                                  ^
cargo:warning=/data/semarie/repos/rust/build-libc/./build/debug/build/libc-test-12b6aa225dc34292/out/main.c:13967:73: error: use of undeclared identifier 'mount_info'
cargo:warning=            uint64_t __test_align_mount_info(void) { return __alignof__(mount_info); }
cargo:warning=                                                                        ^
cargo:warning=/data/semarie/repos/rust/build-libc/./build/debug/build/libc-test-12b6aa225dc34292/out/main.c:13971:37: error: must use 'union' tag to refer to type 'mount_info'
cargo:warning=                    return offsetof(mount_info, ufs_args);
cargo:warning=                                    ^
cargo:warning=                                    union
cargo:warning=/usr/include/stddef.h:69:51: note: expanded from macro 'offsetof'
cargo:warning=#define offsetof(type, member)  __builtin_offsetof(type, member)
cargo:warning=                                                   ^
cargo:warning=/data/semarie/repos/rust/build-libc/./build/debug/build/libc-test-12b6aa225dc34292/out/main.c:13974:21: error: must use 'union' tag to refer to type 'mount_info'
cargo:warning=                    mount_info* foo = NULL;
cargo:warning=                    ^
cargo:warning=                    union
cargo:warning=/data/semarie/repos/rust/build-libc/./build/debug/build/libc-test-12b6aa225dc34292/out/main.c:13979:72: error: must use 'union' tag to refer to type 'mount_info'
cargo:warning=                struct ufs_args* __test_field_type_mount_info_ufs_args(mount_info* b) {
cargo:warning=                                                                       ^
cargo:warning=                                                                       union
cargo:warning=/data/semarie/repos/rust/build-libc/./build/debug/build/libc-test-12b6aa225dc34292/out/main.c:13985:37: error: must use 'union' tag to refer to type 'mount_info'
cargo:warning=                    return offsetof(mount_info, mfs_args);
cargo:warning=                                    ^
cargo:warning=                                    union
cargo:warning=/usr/include/stddef.h:69:51: note: expanded from macro 'offsetof'
cargo:warning=#define offsetof(type, member)  __builtin_offsetof(type, member)
cargo:warning=                                                   ^
cargo:warning=/data/semarie/repos/rust/build-libc/./build/debug/build/libc-test-12b6aa225dc34292/out/main.c:13988:21: error: must use 'union' tag to refer to type 'mount_info'
cargo:warning=                    mount_info* foo = NULL;
cargo:warning=                    ^
cargo:warning=                    union
cargo:warning=/data/semarie/repos/rust/build-libc/./build/debug/build/libc-test-12b6aa225dc34292/out/main.c:13993:72: error: must use 'union' tag to refer to type 'mount_info'
cargo:warning=                struct mfs_args* __test_field_type_mount_info_mfs_args(mount_info* b) {
cargo:warning=                                                                       ^
cargo:warning=                                                                       union
cargo:warning=/data/semarie/repos/rust/build-libc/./build/debug/build/libc-test-12b6aa225dc34292/out/main.c:13999:37: error: must use 'union' tag to refer to type 'mount_info'
cargo:warning=                    return offsetof(mount_info, nfs_args);
cargo:warning=                                    ^
cargo:warning=                                    union
cargo:warning=/usr/include/stddef.h:69:51: note: expanded from macro 'offsetof'
cargo:warning=#define offsetof(type, member)  __builtin_offsetof(type, member)
cargo:warning=                                                   ^
cargo:warning=/data/semarie/repos/rust/build-libc/./build/debug/build/libc-test-12b6aa225dc34292/out/main.c:14002:21: error: must use 'union' tag to refer to type 'mount_info'
cargo:warning=                    mount_info* foo = NULL;
cargo:warning=                    ^
cargo:warning=                    union
cargo:warning=/data/semarie/repos/rust/build-libc/./build/debug/build/libc-test-12b6aa225dc34292/out/main.c:14007:72: error: must use 'union' tag to refer to type 'mount_info'
cargo:warning=                struct nfs_args* __test_field_type_mount_info_nfs_args(mount_info* b) {
cargo:warning=                                                                       ^
cargo:warning=                                                                       union
cargo:warning=/data/semarie/repos/rust/build-libc/./build/debug/build/libc-test-12b6aa225dc34292/out/main.c:14013:37: error: must use 'union' tag to refer to type 'mount_info'
cargo:warning=                    return offsetof(mount_info, iso_args);
cargo:warning=                                    ^
cargo:warning=                                    union
cargo:warning=/usr/include/stddef.h:69:51: note: expanded from macro 'offsetof'
cargo:warning=#define offsetof(type, member)  __builtin_offsetof(type, member)
cargo:warning=                                                   ^
cargo:warning=/data/semarie/repos/rust/build-libc/./build/debug/build/libc-test-12b6aa225dc34292/out/main.c:14016:21: error: must use 'union' tag to refer to type 'mount_info'
cargo:warning=                    mount_info* foo = NULL;
cargo:warning=                    ^
cargo:warning=                    union
cargo:warning=/data/semarie/repos/rust/build-libc/./build/debug/build/libc-test-12b6aa225dc34292/out/main.c:14021:72: error: must use 'union' tag to refer to type 'mount_info'
cargo:warning=                struct iso_args* __test_field_type_mount_info_iso_args(mount_info* b) {
cargo:warning=                                                                       ^
cargo:warning=                                                                       union
cargo:warning=/data/semarie/repos/rust/build-libc/./build/debug/build/libc-test-12b6aa225dc34292/out/main.c:14027:37: error: must use 'union' tag to refer to type 'mount_info'
cargo:warning=                    return offsetof(mount_info, msdosfs_args);
cargo:warning=                                    ^
cargo:warning=                                    union
cargo:warning=/usr/include/stddef.h:69:51: note: expanded from macro 'offsetof'
cargo:warning=#define offsetof(type, member)  __builtin_offsetof(type, member)
cargo:warning=                                                   ^
cargo:warning=/data/semarie/repos/rust/build-libc/./build/debug/build/libc-test-12b6aa225dc34292/out/main.c:14030:21: error: must use 'union' tag to refer to type 'mount_info'
cargo:warning=                    mount_info* foo = NULL;
cargo:warning=                    ^
cargo:warning=                    union
cargo:warning=/data/semarie/repos/rust/build-libc/./build/debug/build/libc-test-12b6aa225dc34292/out/main.c:14035:80: error: must use 'union' tag to refer to type 'mount_info'
cargo:warning=                struct msdosfs_args* __test_field_type_mount_info_msdosfs_args(mount_info* b) {
cargo:warning=                                                                               ^
cargo:warning=                                                                               union
cargo:warning=/data/semarie/repos/rust/build-libc/./build/debug/build/libc-test-12b6aa225dc34292/out/main.c:14041:37: error: must use 'union' tag to refer to type 'mount_info'
cargo:warning=                    return offsetof(mount_info, ntfs_args);
cargo:warning=                                    ^
cargo:warning=                                    union
cargo:warning=/usr/include/stddef.h:69:51: note: expanded from macro 'offsetof'
cargo:warning=#define offsetof(type, member)  __builtin_offsetof(type, member)
cargo:warning=                                                   ^
cargo:warning=fatal error: too many errors emitted, stopping now [-ferror-limit=]
cargo:warning=20 errors generated.
exit code: 1

--- stderr
thread 'main' panicked at '

Internal error occurred: Command "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-m64" "-Wall" "-Wextra" "-Wall" "-Wextra" "-Werror" "-Wno-unused-parameter" "-Wno-type-limits" "-Wno-deprecated-declarations" "-Wno-deprecated-declarations" "-o" "/data/semarie/repos/rust/build-libc/./build/debug/build/libc-test-12b6aa225dc34292/out/main.o" "-c" "/data/semarie/repos/rust/build-libc/./build/debug/build/libc-test-12b6aa225dc34292/out/main.c" with args "cc" did not execute successfully (status code exit code: 1).

', /data/semarie/repos/rust/build-libc/./crates/registry/src/git.colasdn.top-1ecc6299db9ec823/cc-1.0.17/src/lib.rs:2180:5
note: Run with `RUST_BACKTRACE=1` for a backtrace.

Does ctest crate (which is used to generate the C code that will be used in the libc testsuite) have union support at all ?

@alesharik
Copy link
Contributor Author

Nope, it doesn't. I'm working on it

@afdw
Copy link
Contributor

afdw commented Jul 16, 2018

Here is the PR that adds missing support for unions in the ctest crate: https://github.com/alexcrichton/ctest/pull/34

Copy link
Contributor

@semarie semarie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

first pass after the ctest changes: still need work for openbsd :)

thanks

pub ex_flags: ::c_int,
pub ex_root: ::uid_t,
pub ex_anon: xucred,
pub ex_addr: *mut sockaddr_in,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is struct sockaddr

pub ex_anon: xucred,
pub ex_addr: *mut sockaddr_in,
pub ex_addrlen: ::c_int,
pub ex_mask: *mut sockaddr_in,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

struct sockaddr

}

pub struct fusefs_args {
pub fspec: *mut ::c_char,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pub name: *mut ::c_char;

pub export_info: export_args,
pub uid: ::uid_t,
pub gid: ::gid_t,
pub mask: ::mode_t,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pub mode: ::mode_t

pub ex_masklen: ::c_int,
}

pub struct in_addr {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in_addr is already defined

pub struct in_addr {
pub s_addr: ::in_addr_t,
}
pub struct sockaddr_in {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sockaddr_in is already defined

@alexcrichton
Copy link
Member

This is looking good to me! Are there any final bits to fix or is this good to go?

@afdw
Copy link
Contributor

afdw commented Jul 16, 2018

One problem that @semarie has mentioned is still not fixed yet:

cargo:warning=/home/user/test/libc/target/debug/build/libc-test-12b6aa225dc34292/out/main.c:14593:28: error: no member named 'mode' in 'msdosfs_args'
cargo:warning=                    return offsetof(struct msdosfs_args, mode);
cargo:warning=                           ^                             ~~~~
cargo:warning=/usr/include/stddef.h:69:32: note: expanded from macro 'offsetof'
cargo:warning=#define offsetof(type, member)  __builtin_offsetof(type, member)
cargo:warning=                                ^                        ~~~~~~
cargo:warning=/home/user/test/libc/target/debug/build/libc-test-12b6aa225dc34292/out/main.c:14597:40: error: no member named 'mode' in 'struct msdosfs_args'
cargo:warning=                    return sizeof(foo->mode);
cargo:warning=                                  ~~~  ^
cargo:warning=/home/user/test/libc/target/debug/build/libc-test-12b6aa225dc34292/out/main.c:14602:32: error: no member named 'mode' in 'struct msdosfs_args'
cargo:warning=                    return &b->mode;
cargo:warning=                            ~  ^
cargo:warning=/home/user/test/libc/target/debug/build/libc-test-12b6aa225dc34292/out/main.c:14681:28: error: no member named 'mask' in 'ntfs_args'
cargo:warning=                    return offsetof(struct ntfs_args, mask);
cargo:warning=                           ^                          ~~~~
cargo:warning=/usr/include/stddef.h:69:32: note: expanded from macro 'offsetof'
cargo:warning=#define offsetof(type, member)  __builtin_offsetof(type, member)
cargo:warning=                                ^                        ~~~~~~
cargo:warning=/home/user/test/libc/target/debug/build/libc-test-12b6aa225dc34292/out/main.c:14685:40: error: no member named 'mask' in 'struct ntfs_args'
cargo:warning=                    return sizeof(foo->mask);
cargo:warning=                                  ~~~  ^
cargo:warning=/home/user/test/libc/target/debug/build/libc-test-12b6aa225dc34292/out/main.c:14690:32: error: no member named 'mask' in 'struct ntfs_args'
cargo:warning=                    return &b->mask;
cargo:warning=                            ~  ^

@alesharik
Copy link
Contributor Author

I think it is good to go

@alexcrichton
Copy link
Member

@bors: r+

@bors
Copy link
Contributor

bors commented Jul 16, 2018

📌 Commit 5ec8699 has been approved by alexcrichton

@afdw
Copy link
Contributor

afdw commented Jul 16, 2018

Yes, looks like it builds successfully and passes all tests.

@bors
Copy link
Contributor

bors commented Jul 16, 2018

⌛ Testing commit 5ec8699 with merge 03231e9...

bors added a commit that referenced this pull request Jul 16, 2018
Implement statfs for dragonfly, freebsd and openbsd
@bors
Copy link
Contributor

bors commented Jul 17, 2018

💔 Test failed - status-appveyor

@semarie
Copy link
Contributor

semarie commented Jul 17, 2018

it would be more simple to test if libc could be updated to use latest ctest crate... I need to rewrite the changes for each test

@semarie
Copy link
Contributor

semarie commented Jul 17, 2018

oh, it is just Cargo.lock that need to be updated

@semarie
Copy link
Contributor

semarie commented Jul 17, 2018

with an update of Cargo.lock to make ctest#bf780a0e be used, it is ok for me: all tests passes on openbsd

@alexcrichton
Copy link
Member

@bors: r+

@bors
Copy link
Contributor

bors commented Jul 17, 2018

📌 Commit ce4c140 has been approved by alexcrichton

@bors
Copy link
Contributor

bors commented Jul 17, 2018

⌛ Testing commit ce4c140 with merge 5ac35c8...

bors added a commit that referenced this pull request Jul 17, 2018
Implement statfs for dragonfly, freebsd and openbsd
@bors
Copy link
Contributor

bors commented Jul 17, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: alexcrichton
Pushing 5ac35c8 to master...

@bors bors merged commit ce4c140 into rust-lang:master Jul 17, 2018
@bors bors mentioned this pull request Jul 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants