Rollup merge of #126351 - devnexen:to_sol11_upd, r=ChrisDenton · model-checking/verify-rust-std@ca52a2c (original) (raw)

`@@ -22,16 +22,12 @@ use crate::sys_common::{AsInner, AsInnerMut, FromInner, IntoInner};

`

22

22

``

23

23

`#[cfg(any(all(target_os = "linux", target_env = "gnu"), target_vendor = "apple"))]

`

24

24

`use crate::sys::weak::syscall;

`

25

``

`-

#[cfg(any(target_os = "android", target_os = "macos", target_os = "solaris"))]

`

``

25

`+

#[cfg(target_os = "android")]

`

26

26

`use crate::sys::weak::weak;

`

27

27

``

28

28

`use libc::{c_int, mode_t};

`

29

29

``

30

``

`-

#[cfg(any(

`

31

``

`-

target_os = "solaris",

`

32

``

`-

all(target_os = "linux", target_env = "gnu"),

`

33

``

`-

target_vendor = "apple",

`

34

``

`-

))]

`

``

30

`+

#[cfg(any(all(target_os = "linux", target_env = "gnu"), target_vendor = "apple"))]

`

35

31

`use libc::c_char;

`

36

32

`#[cfg(any(

`

37

33

` all(target_os = "linux", not(target_env = "musl")),

`

`@@ -1753,19 +1749,6 @@ pub fn link(original: &Path, link: &Path) -> io::Result<()> {

`

1753

1749

`` // Android has linkat on newer versions, but we happen to know link

``

1754

1750

`// always has the correct behavior, so it's here as well.

`

1755

1751

` cvt(unsafe { libc::link(original.as_ptr(), link.as_ptr()) })?;

`

1756

``

`-

} else if #[cfg(any(target_os = "macos", target_os = "solaris"))] {

`

1757

``

`-

// MacOS (<=10.9) and Solaris 10 lack support for linkat while newer

`

1758

``

`-

// versions have it. We want to use linkat if it is available, so we use weak!

`

1759

``

`` -

// to check. linkat is preferable to link because it gives us a flag to

``

1760

``

`-

// specify how symlinks should be handled. We pass 0 as the flags argument,

`

1761

``

`-

// meaning it shouldn't follow symlinks.

`

1762

``

`-

weak!(fn linkat(c_int, *const c_char, c_int, *const c_char, c_int) -> c_int);

`

1763

``

-

1764

``

`-

if let Some(f) = linkat.get() {

`

1765

``

`-

cvt(unsafe { f(libc::AT_FDCWD, original.as_ptr(), libc::AT_FDCWD, link.as_ptr(), 0) })?;

`

1766

``

`-

} else {

`

1767

``

`-

cvt(unsafe { libc::link(original.as_ptr(), link.as_ptr()) })?;

`

1768

``

`-

};

`

1769

1752

`} else {

`

1770

1753

`` // Where we can, use linkat instead of link; see the comment above

``

1771

1754

`// this one for details on why.

`