Skip to content
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

implement posix_fadvise #1089

Merged
merged 1 commit into from
Jul 11, 2019

Conversation

kevinwern
Copy link
Contributor

See:
https://github.com/CraneStation/wasi-common/issues/16
http://man7.org/linux/man-pages/man2/posix_fadvise.2.html

Conditional compilation derived from corresponding libc conditions:
Fuchsia:
https://github.com/rust-lang/libc/blob/0b02c4060a750983cebcccdf1f35a5ec4cdcf516/src/fuchsia/mod.rs#L3807
https://github.com/rust-lang/libc/blob/0e702c1b4e2e56788e8b67d3efd9c242807c3d4b/src/lib.rs#L104-L109

uClibc:
https://github.com/rust-lang/libc/blob/11c762c535cb43dda3d9d87a0845c55201a905fb/src/unix/uclibc/mod.rs#L1676
https://github.com/rust-lang/libc/blob/ce7e3a7e866dd7109a971b694a2bf58bd08f101a/src/unix/mod.rs#L1141-L1143
https://github.com/rust-lang/libc/blob/0e702c1b4e2e56788e8b67d3efd9c242807c3d4b/src/lib.rs#L116-L121

Linux, android, emscripten:
https://github.com/rust-lang/libc/blob/11c762c535cb43dda3d9d87a0845c55201a905fb/src/unix/linux_like/mod.rs#L1303
https://github.com/rust-lang/libc/blob/ce7e3a7e866dd7109a971b694a2bf58bd08f101a/src/unix/mod.rs#L1147-L1151
https://github.com/rust-lang/libc/blob/0e702c1b4e2e56788e8b67d3efd9c242807c3d4b/src/lib.rs#L116-L121

FreeBSD:
https://github.com/rust-lang/libc/blob/e0ff1e68b9e34173e9c4c3217d1b0fc81a7d352d/src/unix/bsd/freebsdlike/freebsd/mod.rs#L1223
https://github.com/rust-lang/libc/blob/ce7e3a7e866dd7109a971b694a2bf58bd08f101a/src/unix/bsd/freebsdlike/mod.rs#L1307-L1309
https://github.com/rust-lang/libc/blob/ce7e3a7e866dd7109a971b694a2bf58bd08f101a/src/unix/bsd/mod.rs#L683-L685
https://github.com/rust-lang/libc/blob/ce7e3a7e866dd7109a971b694a2bf58bd08f101a/src/unix/mod.rs#L1152-L1159
https://github.com/rust-lang/libc/blob/0e702c1b4e2e56788e8b67d3efd9c242807c3d4b/src/lib.rs#L116-L121

WASI:
https://github.com/rust-lang/libc/blob/0e702c1b4e2e56788e8b67d3efd9c242807c3d4b/src/wasi.rs#L1001
https://github.com/rust-lang/libc/blob/0e702c1b4e2e56788e8b67d3efd9c242807c3d4b/src/lib.rs#L134-L139

Copy link
Member

@asomers asomers left a comment

Choose a reason for hiding this comment

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

Looks good, but you do need a CHANGELOG entry.

test/test_fcntl.rs Outdated Show resolved Hide resolved
@kevinwern kevinwern force-pushed the feature/implement-posix-fadvise branch 2 times, most recently from e14bf1d to 841e4af Compare June 24, 2019 01:54
@kevinwern
Copy link
Contributor Author

Just noticed I should use libc_enum!, not libc_flags!, so I just made that change in addition to those mentioned.

Copy link
Member

@asomers asomers left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution!

bors r+

bors bot added a commit that referenced this pull request Jul 1, 2019
1089: implement posix_fadvise r=asomers a=kevinwern

See: 
https://github.com/CraneStation/wasi-common/issues/16
http://man7.org/linux/man-pages/man2/posix_fadvise.2.html

Conditional compilation derived from corresponding libc conditions:
Fuchsia:
https://github.com/rust-lang/libc/blob/0b02c4060a750983cebcccdf1f35a5ec4cdcf516/src/fuchsia/mod.rs#L3807
https://github.com/rust-lang/libc/blob/0e702c1b4e2e56788e8b67d3efd9c242807c3d4b/src/lib.rs#L104-L109

uClibc:
https://github.com/rust-lang/libc/blob/11c762c535cb43dda3d9d87a0845c55201a905fb/src/unix/uclibc/mod.rs#L1676
https://github.com/rust-lang/libc/blob/ce7e3a7e866dd7109a971b694a2bf58bd08f101a/src/unix/mod.rs#L1141-L1143
https://github.com/rust-lang/libc/blob/0e702c1b4e2e56788e8b67d3efd9c242807c3d4b/src/lib.rs#L116-L121

Linux, android, emscripten:
https://github.com/rust-lang/libc/blob/11c762c535cb43dda3d9d87a0845c55201a905fb/src/unix/linux_like/mod.rs#L1303
https://github.com/rust-lang/libc/blob/ce7e3a7e866dd7109a971b694a2bf58bd08f101a/src/unix/mod.rs#L1147-L1151
https://github.com/rust-lang/libc/blob/0e702c1b4e2e56788e8b67d3efd9c242807c3d4b/src/lib.rs#L116-L121

FreeBSD:
https://github.com/rust-lang/libc/blob/e0ff1e68b9e34173e9c4c3217d1b0fc81a7d352d/src/unix/bsd/freebsdlike/freebsd/mod.rs#L1223
https://github.com/rust-lang/libc/blob/ce7e3a7e866dd7109a971b694a2bf58bd08f101a/src/unix/bsd/freebsdlike/mod.rs#L1307-L1309
https://github.com/rust-lang/libc/blob/ce7e3a7e866dd7109a971b694a2bf58bd08f101a/src/unix/bsd/mod.rs#L683-L685
https://github.com/rust-lang/libc/blob/ce7e3a7e866dd7109a971b694a2bf58bd08f101a/src/unix/mod.rs#L1152-L1159
https://github.com/rust-lang/libc/blob/0e702c1b4e2e56788e8b67d3efd9c242807c3d4b/src/lib.rs#L116-L121

WASI:
https://github.com/rust-lang/libc/blob/0e702c1b4e2e56788e8b67d3efd9c242807c3d4b/src/wasi.rs#L1001
https://github.com/rust-lang/libc/blob/0e702c1b4e2e56788e8b67d3efd9c242807c3d4b/src/lib.rs#L134-L139


Co-authored-by: Kevin Wern <[email protected]>
@bors
Copy link
Contributor

bors bot commented Jul 1, 2019

Build failed

  • FreeBSD 11.2

@asomers
Copy link
Member

asomers commented Jul 1, 2019

You'll have to rebase to fix the problem with tempfile.

@kevinwern kevinwern force-pushed the feature/implement-posix-fadvise branch from 841e4af to f723b18 Compare July 9, 2019 05:09
Copy link
Member

@asomers asomers left a comment

Choose a reason for hiding this comment

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

All peachy now!

bors r+

bors bot added a commit that referenced this pull request Jul 11, 2019
1089: implement posix_fadvise r=asomers a=kevinwern

See: 
https://github.com/CraneStation/wasi-common/issues/16
http://man7.org/linux/man-pages/man2/posix_fadvise.2.html

Conditional compilation derived from corresponding libc conditions:
Fuchsia:
https://github.com/rust-lang/libc/blob/0b02c4060a750983cebcccdf1f35a5ec4cdcf516/src/fuchsia/mod.rs#L3807
https://github.com/rust-lang/libc/blob/0e702c1b4e2e56788e8b67d3efd9c242807c3d4b/src/lib.rs#L104-L109

uClibc:
https://github.com/rust-lang/libc/blob/11c762c535cb43dda3d9d87a0845c55201a905fb/src/unix/uclibc/mod.rs#L1676
https://github.com/rust-lang/libc/blob/ce7e3a7e866dd7109a971b694a2bf58bd08f101a/src/unix/mod.rs#L1141-L1143
https://github.com/rust-lang/libc/blob/0e702c1b4e2e56788e8b67d3efd9c242807c3d4b/src/lib.rs#L116-L121

Linux, android, emscripten:
https://github.com/rust-lang/libc/blob/11c762c535cb43dda3d9d87a0845c55201a905fb/src/unix/linux_like/mod.rs#L1303
https://github.com/rust-lang/libc/blob/ce7e3a7e866dd7109a971b694a2bf58bd08f101a/src/unix/mod.rs#L1147-L1151
https://github.com/rust-lang/libc/blob/0e702c1b4e2e56788e8b67d3efd9c242807c3d4b/src/lib.rs#L116-L121

FreeBSD:
https://github.com/rust-lang/libc/blob/e0ff1e68b9e34173e9c4c3217d1b0fc81a7d352d/src/unix/bsd/freebsdlike/freebsd/mod.rs#L1223
https://github.com/rust-lang/libc/blob/ce7e3a7e866dd7109a971b694a2bf58bd08f101a/src/unix/bsd/freebsdlike/mod.rs#L1307-L1309
https://github.com/rust-lang/libc/blob/ce7e3a7e866dd7109a971b694a2bf58bd08f101a/src/unix/bsd/mod.rs#L683-L685
https://github.com/rust-lang/libc/blob/ce7e3a7e866dd7109a971b694a2bf58bd08f101a/src/unix/mod.rs#L1152-L1159
https://github.com/rust-lang/libc/blob/0e702c1b4e2e56788e8b67d3efd9c242807c3d4b/src/lib.rs#L116-L121

WASI:
https://github.com/rust-lang/libc/blob/0e702c1b4e2e56788e8b67d3efd9c242807c3d4b/src/wasi.rs#L1001
https://github.com/rust-lang/libc/blob/0e702c1b4e2e56788e8b67d3efd9c242807c3d4b/src/lib.rs#L134-L139


Co-authored-by: Kevin Wern <[email protected]>
@bors
Copy link
Contributor

bors bot commented Jul 11, 2019

Build succeeded

@bors bors bot merged commit f723b18 into nix-rust:master Jul 11, 2019
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.

2 participants