Repository: rust-lang/socket2
Pull request #206 (2021-02-01 17:15:35)

Fuchsia doesn't support sendfile
Fuchsia doesn't support `sendfile`.

edit: previously I asked for a point release with this because of the typo in "fuchsia", but we don't actually need it since this was for an unsupported syscall.

tamird: Looks like some of this fails to compile; we should just remove those parts.

```
error[E0425]: cannot find function `sendfile` in crate `libc`
    --> src/sys/unix.rs:1384:18
     |
1384 |         syscall!(sendfile(self.inner, file, &mut offset, count)).map(|n| n as usize)
     |                  ^^^^^^^^ not found in `libc`

error[E0425]: cannot find function `sendfile` in crate `libc`
    --> src/sys/unix.rs:1384:18
     |
1384 |         syscall!(sendfile(self.inner, file, &mut offset, count)).map(|n| n as usize)
     |                  ^^^^^^^^ not found in `libc`
```
erickt: Turns out fuchsia doesn't support `sendfile`. I just removed these lines instead.
Thomasdezeeuw: @erickt can you run rustfmt on this, then I think it's good to go.

Patch:
diff --git a/src/sys/unix.rs b/src/sys/unix.rs
index ab21f0e..b1ccd4d 100644
--- a/src/sys/unix.rs
+++ b/src/sys/unix.rs
@@ -18,7 +18,6 @@ use std::net::{Ipv4Addr, Ipv6Addr};
     any(
         target_os = "android",
         target_os = "freebsd",
-        target_os = "fucsia",
         target_os = "linux",
         target_vendor = "apple",
     )
@@ -31,7 +30,6 @@ use std::os::unix::ffi::OsStrExt;
     any(
         target_os = "android",
         target_os = "freebsd",
-        target_os = "fucsia",
         target_os = "linux",
         target_vendor = "apple",
     )
@@ -1323,7 +1321,6 @@ impl crate::Socket {
         any(
             target_os = "android",
             target_os = "freebsd",
-            target_os = "fucsia",
             target_os = "linux",
             target_vendor = "apple",
         )
@@ -1365,10 +1362,7 @@ impl crate::Socket {
         .map(|_| length as usize)
     }
 
-    #[cfg(all(
-        feature = "all",
-        any(target_os = "android", target_os = "fucsia", target_os = "linux")
-    ))]
+    #[cfg(all(feature = "all", any(target_os = "android", target_os = "linux")))]
     fn _sendfile(
         &self,
         file: RawFd,


Test patch:
diff --git a/tests/socket.rs b/tests/socket.rs
index 696e6e8..17a61c9 100644
--- a/tests/socket.rs
+++ b/tests/socket.rs
@@ -3,7 +3,6 @@
     any(
         target_os = "android",
         target_os = "freebsd",
-        target_os = "fucsia",
         target_os = "linux",
         target_vendor = "apple",
     )
@@ -24,7 +23,6 @@ use std::net::{Ipv6Addr, SocketAddrV6};
     any(
         target_os = "android",
         target_os = "freebsd",
-        target_os = "fucsia",
         target_os = "linux",
         target_vendor = "apple",
     )
@@ -769,7 +767,6 @@ fn device() {
     any(
         target_os = "android",
         target_os = "freebsd",
-        target_os = "fucsia",
         target_os = "linux",
         target_vendor = "apple",
     )
@@ -845,7 +842,6 @@ fn sendfile() {
     any(
         target_os = "android",
         target_os = "freebsd",
-        target_os = "fucsia",
         target_os = "linux",
         target_vendor = "apple",
     )