88// option. This file may not be copied, modified, or distributed
99// except according to those terms.
1010
11- #![ stable( feature = "unix_socket " , since = "1.10 .0" ) ]
11+ #![ stable( feature = "unix_socket_redox " , since = "1.27 .0" ) ]
1212
1313//! Unix-specific networking functionality
1414
@@ -36,7 +36,7 @@ use sys::{cvt, fd::FileDesc, syscall};
3636/// };
3737/// let addr = socket.local_addr().expect("Couldn't get local address");
3838/// ```
39- #[ stable( feature = "unix_socket " , since = "1.10 .0" ) ]
39+ #[ stable( feature = "unix_socket_redox " , since = "1.27 .0" ) ]
4040#[ derive( Clone ) ]
4141pub struct SocketAddr ;
4242
@@ -65,12 +65,12 @@ impl SocketAddr {
6565 /// let addr = socket.local_addr().expect("Couldn't get local address");
6666 /// assert_eq!(addr.as_pathname(), None);
6767 /// ```
68- #[ stable( feature = "unix_socket " , since = "1.10 .0" ) ]
68+ #[ stable( feature = "unix_socket_redox " , since = "1.27 .0" ) ]
6969 pub fn as_pathname ( & self ) -> Option < & Path > {
7070 None
7171 }
7272}
73- #[ stable( feature = "unix_socket " , since = "1.10 .0" ) ]
73+ #[ stable( feature = "unix_socket_redox " , since = "1.27 .0" ) ]
7474impl fmt:: Debug for SocketAddr {
7575 fn fmt ( & self , fmt : & mut fmt:: Formatter ) -> fmt:: Result {
7676 write ! ( fmt, "SocketAddr" )
@@ -91,10 +91,10 @@ impl fmt::Debug for SocketAddr {
9191/// stream.read_to_string(&mut response).unwrap();
9292/// println!("{}", response);
9393/// ```
94- #[ stable( feature = "unix_socket " , since = "1.10 .0" ) ]
94+ #[ stable( feature = "unix_socket_redox " , since = "1.27 .0" ) ]
9595pub struct UnixStream ( FileDesc ) ;
9696
97- #[ stable( feature = "unix_socket " , since = "1.10 .0" ) ]
97+ #[ stable( feature = "unix_socket_redox " , since = "1.27 .0" ) ]
9898impl fmt:: Debug for UnixStream {
9999 fn fmt ( & self , fmt : & mut fmt:: Formatter ) -> fmt:: Result {
100100 let mut builder = fmt. debug_struct ( "UnixStream" ) ;
@@ -125,7 +125,7 @@ impl UnixStream {
125125 /// }
126126 /// };
127127 /// ```
128- #[ stable( feature = "unix_socket " , since = "1.10 .0" ) ]
128+ #[ stable( feature = "unix_socket_redox " , since = "1.27 .0" ) ]
129129 pub fn connect < P : AsRef < Path > > ( path : P ) -> io:: Result < UnixStream > {
130130 if let Some ( s) = path. as_ref ( ) . to_str ( ) {
131131 cvt ( syscall:: open ( format ! ( "chan:{}" , s) , syscall:: O_CLOEXEC ) )
@@ -156,7 +156,7 @@ impl UnixStream {
156156 /// }
157157 /// };
158158 /// ```
159- #[ stable( feature = "unix_socket " , since = "1.10 .0" ) ]
159+ #[ stable( feature = "unix_socket_redox " , since = "1.27 .0" ) ]
160160 pub fn pair ( ) -> io:: Result < ( UnixStream , UnixStream ) > {
161161 let server = cvt ( syscall:: open ( "chan:" , syscall:: O_CREAT | syscall:: O_CLOEXEC ) )
162162 . map ( FileDesc :: new) ?;
@@ -180,7 +180,7 @@ impl UnixStream {
180180 /// let socket = UnixStream::connect("/tmp/sock").unwrap();
181181 /// let sock_copy = socket.try_clone().expect("Couldn't clone socket");
182182 /// ```
183- #[ stable( feature = "unix_socket " , since = "1.10 .0" ) ]
183+ #[ stable( feature = "unix_socket_redox " , since = "1.27 .0" ) ]
184184 pub fn try_clone ( & self ) -> io:: Result < UnixStream > {
185185 self . 0 . duplicate ( ) . map ( UnixStream )
186186 }
@@ -195,7 +195,7 @@ impl UnixStream {
195195 /// let socket = UnixStream::connect("/tmp/sock").unwrap();
196196 /// let addr = socket.local_addr().expect("Couldn't get local address");
197197 /// ```
198- #[ stable( feature = "unix_socket " , since = "1.10 .0" ) ]
198+ #[ stable( feature = "unix_socket_redox " , since = "1.27 .0" ) ]
199199 pub fn local_addr ( & self ) -> io:: Result < SocketAddr > {
200200 Err ( Error :: new ( ErrorKind :: Other , "UnixStream::local_addr unimplemented on redox" ) )
201201 }
@@ -210,7 +210,7 @@ impl UnixStream {
210210 /// let socket = UnixStream::connect("/tmp/sock").unwrap();
211211 /// let addr = socket.peer_addr().expect("Couldn't get peer address");
212212 /// ```
213- #[ stable( feature = "unix_socket " , since = "1.10 .0" ) ]
213+ #[ stable( feature = "unix_socket_redox " , since = "1.27 .0" ) ]
214214 pub fn peer_addr ( & self ) -> io:: Result < SocketAddr > {
215215 Err ( Error :: new ( ErrorKind :: Other , "UnixStream::peer_addr unimplemented on redox" ) )
216216 }
@@ -249,7 +249,7 @@ impl UnixStream {
249249 /// let err = result.unwrap_err();
250250 /// assert_eq!(err.kind(), io::ErrorKind::InvalidInput)
251251 /// ```
252- #[ stable( feature = "unix_socket " , since = "1.10 .0" ) ]
252+ #[ stable( feature = "unix_socket_redox " , since = "1.27 .0" ) ]
253253 pub fn set_read_timeout ( & self , _timeout : Option < Duration > ) -> io:: Result < ( ) > {
254254 Err ( Error :: new ( ErrorKind :: Other , "UnixStream::set_read_timeout unimplemented on redox" ) )
255255 }
@@ -288,7 +288,7 @@ impl UnixStream {
288288 /// let err = result.unwrap_err();
289289 /// assert_eq!(err.kind(), io::ErrorKind::InvalidInput)
290290 /// ```
291- #[ stable( feature = "unix_socket " , since = "1.10 .0" ) ]
291+ #[ stable( feature = "unix_socket_redox " , since = "1.27 .0" ) ]
292292 pub fn set_write_timeout ( & self , _timeout : Option < Duration > ) -> io:: Result < ( ) > {
293293 Err ( Error :: new ( ErrorKind :: Other , "UnixStream::set_write_timeout unimplemented on redox" ) )
294294 }
@@ -305,7 +305,7 @@ impl UnixStream {
305305 /// socket.set_read_timeout(Some(Duration::new(1, 0))).expect("Couldn't set read timeout");
306306 /// assert_eq!(socket.read_timeout().unwrap(), Some(Duration::new(1, 0)));
307307 /// ```
308- #[ stable( feature = "unix_socket " , since = "1.10 .0" ) ]
308+ #[ stable( feature = "unix_socket_redox " , since = "1.27 .0" ) ]
309309 pub fn read_timeout ( & self ) -> io:: Result < Option < Duration > > {
310310 Err ( Error :: new ( ErrorKind :: Other , "UnixStream::read_timeout unimplemented on redox" ) )
311311 }
@@ -322,7 +322,7 @@ impl UnixStream {
322322 /// socket.set_write_timeout(Some(Duration::new(1, 0))).expect("Couldn't set write timeout");
323323 /// assert_eq!(socket.write_timeout().unwrap(), Some(Duration::new(1, 0)));
324324 /// ```
325- #[ stable( feature = "unix_socket " , since = "1.10 .0" ) ]
325+ #[ stable( feature = "unix_socket_redox " , since = "1.27 .0" ) ]
326326 pub fn write_timeout ( & self ) -> io:: Result < Option < Duration > > {
327327 Err ( Error :: new ( ErrorKind :: Other , "UnixStream::write_timeout unimplemented on redox" ) )
328328 }
@@ -337,7 +337,7 @@ impl UnixStream {
337337 /// let socket = UnixStream::connect("/tmp/sock").unwrap();
338338 /// socket.set_nonblocking(true).expect("Couldn't set nonblocking");
339339 /// ```
340- #[ stable( feature = "unix_socket " , since = "1.10 .0" ) ]
340+ #[ stable( feature = "unix_socket_redox " , since = "1.27 .0" ) ]
341341 pub fn set_nonblocking ( & self , nonblocking : bool ) -> io:: Result < ( ) > {
342342 self . 0 . set_nonblocking ( nonblocking)
343343 }
@@ -354,7 +354,7 @@ impl UnixStream {
354354 /// println!("Got error: {:?}", err);
355355 /// }
356356 /// ```
357- #[ stable( feature = "unix_socket " , since = "1.10 .0" ) ]
357+ #[ stable( feature = "unix_socket_redox " , since = "1.27 .0" ) ]
358358 pub fn take_error ( & self ) -> io:: Result < Option < io:: Error > > {
359359 Ok ( None )
360360 }
@@ -376,13 +376,13 @@ impl UnixStream {
376376 /// let socket = UnixStream::connect("/tmp/sock").unwrap();
377377 /// socket.shutdown(Shutdown::Both).expect("shutdown function failed");
378378 /// ```
379- #[ stable( feature = "unix_socket " , since = "1.10 .0" ) ]
379+ #[ stable( feature = "unix_socket_redox " , since = "1.27 .0" ) ]
380380 pub fn shutdown ( & self , _how : Shutdown ) -> io:: Result < ( ) > {
381381 Err ( Error :: new ( ErrorKind :: Other , "UnixStream::shutdown unimplemented on redox" ) )
382382 }
383383}
384384
385- #[ stable( feature = "unix_socket " , since = "1.10 .0" ) ]
385+ #[ stable( feature = "unix_socket_redox " , since = "1.27 .0" ) ]
386386impl io:: Read for UnixStream {
387387 fn read ( & mut self , buf : & mut [ u8 ] ) -> io:: Result < usize > {
388388 io:: Read :: read ( & mut & * self , buf)
@@ -394,7 +394,7 @@ impl io::Read for UnixStream {
394394 }
395395}
396396
397- #[ stable( feature = "unix_socket " , since = "1.10 .0" ) ]
397+ #[ stable( feature = "unix_socket_redox " , since = "1.27 .0" ) ]
398398impl < ' a > io:: Read for & ' a UnixStream {
399399 fn read ( & mut self , buf : & mut [ u8 ] ) -> io:: Result < usize > {
400400 self . 0 . read ( buf)
@@ -406,7 +406,7 @@ impl<'a> io::Read for &'a UnixStream {
406406 }
407407}
408408
409- #[ stable( feature = "unix_socket " , since = "1.10 .0" ) ]
409+ #[ stable( feature = "unix_socket_redox " , since = "1.27 .0" ) ]
410410impl io:: Write for UnixStream {
411411 fn write ( & mut self , buf : & [ u8 ] ) -> io:: Result < usize > {
412412 io:: Write :: write ( & mut & * self , buf)
@@ -417,7 +417,7 @@ impl io::Write for UnixStream {
417417 }
418418}
419419
420- #[ stable( feature = "unix_socket " , since = "1.10 .0" ) ]
420+ #[ stable( feature = "unix_socket_redox " , since = "1.27 .0" ) ]
421421impl < ' a > io:: Write for & ' a UnixStream {
422422 fn write ( & mut self , buf : & [ u8 ] ) -> io:: Result < usize > {
423423 self . 0 . write ( buf)
@@ -428,21 +428,21 @@ impl<'a> io::Write for &'a UnixStream {
428428 }
429429}
430430
431- #[ stable( feature = "unix_socket " , since = "1.10 .0" ) ]
431+ #[ stable( feature = "unix_socket_redox " , since = "1.27 .0" ) ]
432432impl AsRawFd for UnixStream {
433433 fn as_raw_fd ( & self ) -> RawFd {
434434 self . 0 . raw ( )
435435 }
436436}
437437
438- #[ stable( feature = "unix_socket " , since = "1.10 .0" ) ]
438+ #[ stable( feature = "unix_socket_redox " , since = "1.27 .0" ) ]
439439impl FromRawFd for UnixStream {
440440 unsafe fn from_raw_fd ( fd : RawFd ) -> UnixStream {
441441 UnixStream ( FileDesc :: new ( fd) )
442442 }
443443}
444444
445- #[ stable( feature = "unix_socket " , since = "1.10 .0" ) ]
445+ #[ stable( feature = "unix_socket_redox " , since = "1.27 .0" ) ]
446446impl IntoRawFd for UnixStream {
447447 fn into_raw_fd ( self ) -> RawFd {
448448 self . 0 . into_raw ( )
@@ -477,10 +477,10 @@ impl IntoRawFd for UnixStream {
477477/// }
478478/// }
479479/// ```
480- #[ stable( feature = "unix_socket " , since = "1.10 .0" ) ]
480+ #[ stable( feature = "unix_socket_redox " , since = "1.27 .0" ) ]
481481pub struct UnixListener ( FileDesc ) ;
482482
483- #[ stable( feature = "unix_socket " , since = "1.10 .0" ) ]
483+ #[ stable( feature = "unix_socket_redox " , since = "1.27 .0" ) ]
484484impl fmt:: Debug for UnixListener {
485485 fn fmt ( & self , fmt : & mut fmt:: Formatter ) -> fmt:: Result {
486486 let mut builder = fmt. debug_struct ( "UnixListener" ) ;
@@ -508,7 +508,7 @@ impl UnixListener {
508508 /// }
509509 /// };
510510 /// ```
511- #[ stable( feature = "unix_socket " , since = "1.10 .0" ) ]
511+ #[ stable( feature = "unix_socket_redox " , since = "1.27 .0" ) ]
512512 pub fn bind < P : AsRef < Path > > ( path : P ) -> io:: Result < UnixListener > {
513513 if let Some ( s) = path. as_ref ( ) . to_str ( ) {
514514 cvt ( syscall:: open ( format ! ( "chan:{}" , s) , syscall:: O_CREAT | syscall:: O_CLOEXEC ) )
@@ -542,7 +542,7 @@ impl UnixListener {
542542 /// Err(e) => println!("accept function failed: {:?}", e),
543543 /// }
544544 /// ```
545- #[ stable( feature = "unix_socket " , since = "1.10 .0" ) ]
545+ #[ stable( feature = "unix_socket_redox " , since = "1.27 .0" ) ]
546546 pub fn accept ( & self ) -> io:: Result < ( UnixStream , SocketAddr ) > {
547547 self . 0 . duplicate_path ( b"listen" ) . map ( |fd| ( UnixStream ( fd) , SocketAddr ) )
548548 }
@@ -562,7 +562,7 @@ impl UnixListener {
562562 ///
563563 /// let listener_copy = listener.try_clone().expect("try_clone failed");
564564 /// ```
565- #[ stable( feature = "unix_socket " , since = "1.10 .0" ) ]
565+ #[ stable( feature = "unix_socket_redox " , since = "1.27 .0" ) ]
566566 pub fn try_clone ( & self ) -> io:: Result < UnixListener > {
567567 self . 0 . duplicate ( ) . map ( UnixListener )
568568 }
@@ -578,7 +578,7 @@ impl UnixListener {
578578 ///
579579 /// let addr = listener.local_addr().expect("Couldn't get local address");
580580 /// ```
581- #[ stable( feature = "unix_socket " , since = "1.10 .0" ) ]
581+ #[ stable( feature = "unix_socket_redox " , since = "1.27 .0" ) ]
582582 pub fn local_addr ( & self ) -> io:: Result < SocketAddr > {
583583 Err ( Error :: new ( ErrorKind :: Other , "UnixListener::local_addr unimplemented on redox" ) )
584584 }
@@ -594,7 +594,7 @@ impl UnixListener {
594594 ///
595595 /// listener.set_nonblocking(true).expect("Couldn't set non blocking");
596596 /// ```
597- #[ stable( feature = "unix_socket " , since = "1.10 .0" ) ]
597+ #[ stable( feature = "unix_socket_redox " , since = "1.27 .0" ) ]
598598 pub fn set_nonblocking ( & self , nonblocking : bool ) -> io:: Result < ( ) > {
599599 self . 0 . set_nonblocking ( nonblocking)
600600 }
@@ -612,7 +612,7 @@ impl UnixListener {
612612 /// println!("Got error: {:?}", err);
613613 /// }
614614 /// ```
615- #[ stable( feature = "unix_socket " , since = "1.10 .0" ) ]
615+ #[ stable( feature = "unix_socket_redox " , since = "1.27 .0" ) ]
616616 pub fn take_error ( & self ) -> io:: Result < Option < io:: Error > > {
617617 Ok ( None )
618618 }
@@ -648,34 +648,34 @@ impl UnixListener {
648648 /// }
649649 /// }
650650 /// ```
651- #[ stable( feature = "unix_socket " , since = "1.10 .0" ) ]
651+ #[ stable( feature = "unix_socket_redox " , since = "1.27 .0" ) ]
652652 pub fn incoming < ' a > ( & ' a self ) -> Incoming < ' a > {
653653 Incoming { listener : self }
654654 }
655655}
656656
657- #[ stable( feature = "unix_socket " , since = "1.10 .0" ) ]
657+ #[ stable( feature = "unix_socket_redox " , since = "1.27 .0" ) ]
658658impl AsRawFd for UnixListener {
659659 fn as_raw_fd ( & self ) -> RawFd {
660660 self . 0 . raw ( )
661661 }
662662}
663663
664- #[ stable( feature = "unix_socket " , since = "1.10 .0" ) ]
664+ #[ stable( feature = "unix_socket_redox " , since = "1.27 .0" ) ]
665665impl FromRawFd for UnixListener {
666666 unsafe fn from_raw_fd ( fd : RawFd ) -> UnixListener {
667667 UnixListener ( FileDesc :: new ( fd) )
668668 }
669669}
670670
671- #[ stable( feature = "unix_socket " , since = "1.10 .0" ) ]
671+ #[ stable( feature = "unix_socket_redox " , since = "1.27 .0" ) ]
672672impl IntoRawFd for UnixListener {
673673 fn into_raw_fd ( self ) -> RawFd {
674674 self . 0 . into_raw ( )
675675 }
676676}
677677
678- #[ stable( feature = "unix_socket " , since = "1.10 .0" ) ]
678+ #[ stable( feature = "unix_socket_redox " , since = "1.27 .0" ) ]
679679impl < ' a > IntoIterator for & ' a UnixListener {
680680 type Item = io:: Result < UnixStream > ;
681681 type IntoIter = Incoming < ' a > ;
@@ -716,12 +716,12 @@ impl<'a> IntoIterator for &'a UnixListener {
716716/// }
717717/// ```
718718#[ derive( Debug ) ]
719- #[ stable( feature = "unix_socket " , since = "1.10 .0" ) ]
719+ #[ stable( feature = "unix_socket_redox " , since = "1.27 .0" ) ]
720720pub struct Incoming < ' a > {
721721 listener : & ' a UnixListener ,
722722}
723723
724- #[ stable( feature = "unix_socket " , since = "1.10 .0" ) ]
724+ #[ stable( feature = "unix_socket_redox " , since = "1.27 .0" ) ]
725725impl < ' a > Iterator for Incoming < ' a > {
726726 type Item = io:: Result < UnixStream > ;
727727
0 commit comments