Skip to content

Commit f6c0ead

Browse files
committed
Style
1 parent 0da26d4 commit f6c0ead

File tree

1 file changed

+40
-38
lines changed

1 file changed

+40
-38
lines changed

src/unix/mod.rs

Lines changed: 40 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -605,35 +605,13 @@ extern {
605605
#[cfg_attr(target_os = "netbsd", link_name = "__opendir30")]
606606
pub fn opendir(dirname: *const c_char) -> *mut ::DIR;
607607

608-
#[cfg_attr(all(target_os = "macos", target_arch = "x86_64"),
609-
link_name = "fdopendir$INODE64")]
610-
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
611-
link_name = "fdopendir$INODE64$UNIX2003")]
612-
#[cfg(not(target_os = "redox"))]
613-
pub fn fdopendir(fd: ::c_int) -> *mut ::DIR;
614-
615608
#[cfg_attr(target_os = "macos", link_name = "readdir$INODE64")]
616609
#[cfg_attr(target_os = "netbsd", link_name = "__readdir30")]
617610
#[cfg_attr(
618611
all(target_os = "freebsd", not(freebsd12)),
619612
link_name = "readdir@FBSD_1.0"
620613
)]
621614
pub fn readdir(dirp: *mut ::DIR) -> *mut ::dirent;
622-
#[cfg_attr(target_os = "macos", link_name = "readdir_r$INODE64")]
623-
#[cfg_attr(target_os = "netbsd", link_name = "__readdir_r30")]
624-
#[cfg_attr(
625-
all(target_os = "freebsd", not(freebsd12)),
626-
link_name = "readdir_r@FBSD_1.0"
627-
)]
628-
/// The 64-bit libc on Solaris and illumos only has readdir_r. If a
629-
/// 32-bit Solaris or illumos target is ever created, it should use
630-
/// __posix_readdir_r. See libc(3LIB) on Solaris or illumos:
631-
/// https://illumos.org/man/3lib/libc
632-
/// https://docs.oracle.com/cd/E36784_01/html/E36873/libc-3lib.html
633-
/// https://www.unix.com/man-page/opensolaris/3LIB/libc/
634-
#[cfg(not(target_os = "redox"))]
635-
pub fn readdir_r(dirp: *mut ::DIR, entry: *mut ::dirent,
636-
result: *mut *mut ::dirent) -> ::c_int;
637615
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
638616
link_name = "closedir$UNIX2003")]
639617
pub fn closedir(dirp: *mut ::DIR) -> ::c_int;
@@ -643,9 +621,6 @@ extern {
643621
link_name = "rewinddir$INODE64$UNIX2003")]
644622
pub fn rewinddir(dirp: *mut ::DIR);
645623

646-
#[cfg(not(target_os = "redox"))]
647-
pub fn openat(dirfd: ::c_int, pathname: *const ::c_char,
648-
flags: ::c_int, ...) -> ::c_int;
649624
pub fn fchmodat(dirfd: ::c_int, pathname: *const ::c_char,
650625
mode: ::mode_t, flags: ::c_int) -> ::c_int;
651626
pub fn fchown(fd: ::c_int,
@@ -664,12 +639,6 @@ extern {
664639
pub fn linkat(olddirfd: ::c_int, oldpath: *const ::c_char,
665640
newdirfd: ::c_int, newpath: *const ::c_char,
666641
flags: ::c_int) -> ::c_int;
667-
#[cfg(not(target_os = "redox"))]
668-
pub fn mkdirat(dirfd: ::c_int, pathname: *const ::c_char,
669-
mode: ::mode_t) -> ::c_int;
670-
#[cfg(not(target_os = "redox"))]
671-
pub fn readlinkat(dirfd: ::c_int, pathname: *const ::c_char,
672-
buf: *mut ::c_char, bufsiz: ::size_t) -> ::ssize_t;
673642
pub fn renameat(olddirfd: ::c_int, oldpath: *const ::c_char,
674643
newdirfd: ::c_int, newpath: *const ::c_char)
675644
-> ::c_int;
@@ -732,8 +701,6 @@ extern {
732701
pub fn pathconf(path: *const c_char, name: ::c_int) -> c_long;
733702
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
734703
link_name = "pause$UNIX2003")]
735-
#[cfg(not(target_os = "redox"))]
736-
pub fn pause() -> ::c_int;
737704
pub fn pipe(fds: *mut ::c_int) -> ::c_int;
738705
pub fn posix_memalign(memptr: *mut *mut ::c_void,
739706
align: ::size_t,
@@ -842,8 +809,6 @@ extern {
842809
pub fn symlink(path1: *const c_char,
843810
path2: *const c_char) -> ::c_int;
844811

845-
#[cfg(not(target_os = "redox"))]
846-
pub fn truncate(path: *const c_char, length: off_t) -> ::c_int;
847812
pub fn ftruncate(fd: ::c_int, length: off_t) -> ::c_int;
848813

849814
pub fn signal(signum: ::c_int, handler: sighandler_t) -> sighandler_t;
@@ -1078,9 +1043,6 @@ extern {
10781043
#[cfg_attr(target_os = "netbsd", link_name = "__timegm50")]
10791044
pub fn timegm(tm: *mut ::tm) -> time_t;
10801045

1081-
#[cfg(not(target_os = "redox"))]
1082-
pub fn getsid(pid: pid_t) -> pid_t;
1083-
10841046
pub fn sysconf(name: ::c_int) -> ::c_long;
10851047

10861048
pub fn mkfifo(path: *const c_char, mode: mode_t) -> ::c_int;
@@ -1139,6 +1101,46 @@ extern {
11391101
stream: *mut FILE) -> ssize_t;
11401102
}
11411103

1104+
cfg_if! {
1105+
if #[cfg(not(target_os = "redox"))] {
1106+
extern {
1107+
pub fn getsid(pid: pid_t) -> pid_t;
1108+
pub fn truncate(path: *const c_char, length: off_t) -> ::c_int;
1109+
pub fn pause() -> ::c_int;
1110+
1111+
pub fn readlinkat(dirfd: ::c_int,
1112+
pathname: *const ::c_char,
1113+
buf: *mut ::c_char,
1114+
bufsiz: ::size_t) -> ::ssize_t;
1115+
pub fn mkdirat(dirfd: ::c_int, pathname: *const ::c_char,
1116+
mode: ::mode_t) -> ::c_int;
1117+
pub fn openat(dirfd: ::c_int, pathname: *const ::c_char,
1118+
flags: ::c_int, ...) -> ::c_int;
1119+
1120+
#[cfg_attr(all(target_os = "macos", target_arch = "x86_64"),
1121+
link_name = "fdopendir$INODE64")]
1122+
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
1123+
link_name = "fdopendir$INODE64$UNIX2003")]
1124+
pub fn fdopendir(fd: ::c_int) -> *mut ::DIR;
1125+
1126+
#[cfg_attr(target_os = "macos", link_name = "readdir_r$INODE64")]
1127+
#[cfg_attr(target_os = "netbsd", link_name = "__readdir_r30")]
1128+
#[cfg_attr(
1129+
all(target_os = "freebsd", not(freebsd12)),
1130+
link_name = "readdir_r@FBSD_1.0"
1131+
)]
1132+
/// The 64-bit libc on Solaris and illumos only has readdir_r. If a
1133+
/// 32-bit Solaris or illumos target is ever created, it should use
1134+
/// __posix_readdir_r. See libc(3LIB) on Solaris or illumos:
1135+
/// https://illumos.org/man/3lib/libc
1136+
/// https://docs.oracle.com/cd/E36784_01/html/E36873/libc-3lib.html
1137+
/// https://www.unix.com/man-page/opensolaris/3LIB/libc/
1138+
pub fn readdir_r(dirp: *mut ::DIR, entry: *mut ::dirent,
1139+
result: *mut *mut ::dirent) -> ::c_int;
1140+
}
1141+
}
1142+
}
1143+
11421144
cfg_if! {
11431145
if #[cfg(not(any(target_os = "solaris", target_os = "illumos")))] {
11441146
extern {

0 commit comments

Comments
 (0)