@@ -20,14 +20,10 @@ use crate::fcntl::AtFlags;
20
20
use crate :: fcntl:: OFlag ;
21
21
#[ cfg( all( feature = "fs" , bsd) ) ]
22
22
use crate :: sys:: stat:: FileFlag ;
23
- #[ cfg( feature = "fs" ) ]
24
- use crate :: sys:: stat:: Mode ;
25
23
use crate :: { Error , NixPath , Result } ;
26
24
#[ cfg( not( target_os = "redox" ) ) ]
27
25
use cfg_if:: cfg_if;
28
- use libc:: {
29
- c_char, c_int, c_long, c_uint, gid_t, mode_t, off_t, pid_t, size_t, uid_t,
30
- } ;
26
+ use libc:: { c_char, c_int, c_long, c_uint, gid_t, off_t, pid_t, size_t, uid_t} ;
31
27
use std:: convert:: Infallible ;
32
28
#[ cfg( not( target_os = "redox" ) ) ]
33
29
use std:: ffi:: CString ;
@@ -428,7 +424,7 @@ feature! {
428
424
///
429
425
/// * [`dup2()`]
430
426
/// * [`dup2_raw()`]
431
- /// * [ `dup3()`]
427
+ /// * `dup3()`
432
428
#[ inline]
433
429
pub fn dup<Fd : std:: os:: fd:: AsFd >( oldfd: Fd ) -> Result <std:: os:: fd:: OwnedFd > {
434
430
use std:: os:: fd:: AsRawFd ;
@@ -480,8 +476,7 @@ pub fn dup2_stderr<Fd: std::os::fd::AsFd>(fd: Fd) -> Result<()> {
480
476
/// more detail on the exact behavior of this function.
481
477
///
482
478
/// This function does not allow you to duplicate `oldfd` with any file descriptor
483
- /// you want, to do that, use [`dup2_raw()`]#[inline]
484
- .
479
+ /// you want, to do that, use [`dup2_raw()`].
485
480
///
486
481
/// # Reference
487
482
///
@@ -590,6 +585,9 @@ pub unsafe fn dup2_raw<Fd1: std::os::fd::AsFd, Fd2: std::os::fd::IntoRawFd>(oldf
590
585
///
591
586
/// This function behaves similar to `dup2()` but allows for flags to be
592
587
/// specified.
588
+ ///
589
+ /// This function does not allow you to duplicate `oldfd` with any file descriptor
590
+ /// you want, to do that, use [`dup3_raw()`].
593
591
#[ cfg( any(
594
592
netbsdlike,
595
593
solarish,
@@ -706,9 +704,9 @@ pub fn fchdir<Fd: std::os::fd::AsFd>(dirfd: Fd) -> Result<()> {
706
704
/// }
707
705
/// ```
708
706
#[ inline]
709
- pub fn mkdir<P : ?Sized + NixPath >( path: & P , mode: Mode ) -> Result <( ) > {
707
+ pub fn mkdir<P : ?Sized + NixPath >( path: & P , mode: crate :: sys :: stat :: Mode ) -> Result <( ) > {
710
708
let res = path. with_nix_path( |cstr| unsafe {
711
- libc:: mkdir( cstr. as_ptr( ) , mode. bits( ) as mode_t)
709
+ libc:: mkdir( cstr. as_ptr( ) , mode. bits( ) as libc :: mode_t)
712
710
} ) ?;
713
711
714
712
Errno :: result( res) . map( drop)
@@ -745,9 +743,9 @@ pub fn mkdir<P: ?Sized + NixPath>(path: &P, mode: Mode) -> Result<()> {
745
743
/// ```
746
744
#[ inline]
747
745
#[ cfg( not( target_os = "redox" ) ) ] // RedoxFS does not support fifo yet
748
- pub fn mkfifo<P : ?Sized + NixPath >( path: & P , mode: Mode ) -> Result <( ) > {
746
+ pub fn mkfifo<P : ?Sized + NixPath >( path: & P , mode: crate :: sys :: stat :: Mode ) -> Result <( ) > {
749
747
let res = path. with_nix_path( |cstr| unsafe {
750
- libc:: mkfifo( cstr. as_ptr( ) , mode. bits( ) as mode_t)
748
+ libc:: mkfifo( cstr. as_ptr( ) , mode. bits( ) as libc :: mode_t)
751
749
} ) ?;
752
750
753
751
Errno :: result( res) . map( drop)
@@ -769,12 +767,12 @@ pub fn mkfifo<P: ?Sized + NixPath>(path: &P, mode: Mode) -> Result<()> {
769
767
pub fn mkfifoat<Fd : std:: os:: fd:: AsFd , P : ?Sized + NixPath >(
770
768
dirfd: Fd ,
771
769
path: & P ,
772
- mode: Mode ,
770
+ mode: crate :: sys :: stat :: Mode ,
773
771
) -> Result <( ) > {
774
772
use std:: os:: fd:: AsRawFd ;
775
773
776
774
let res = path. with_nix_path( |cstr| unsafe {
777
- libc:: mkfifoat( dirfd. as_fd( ) . as_raw_fd( ) , cstr. as_ptr( ) , mode. bits( ) as mode_t)
775
+ libc:: mkfifoat( dirfd. as_fd( ) . as_raw_fd( ) , cstr. as_ptr( ) , mode. bits( ) as libc :: mode_t)
778
776
} ) ?;
779
777
780
778
Errno :: result( res) . map( drop)
0 commit comments