]> git.lizzy.rs Git - rust.git/blob - library/std/src/sys/unix/l4re.rs
Rollup merge of #90704 - ijackson:exitstatus-comments, r=joshtriplett
[rust.git] / library / std / src / sys / unix / l4re.rs
1 macro_rules! unimpl {
2     () => {
3         return Err(io::Error::new_const(
4             io::ErrorKind::Unsupported,
5             &"No networking available on L4Re.",
6         ));
7     };
8 }
9
10 pub mod net {
11     #![allow(warnings)]
12     use crate::convert::TryFrom;
13     use crate::fmt;
14     use crate::io::{self, IoSlice, IoSliceMut};
15     use crate::net::{Ipv4Addr, Ipv6Addr, Shutdown, SocketAddr};
16     use crate::sys::fd::FileDesc;
17     use crate::sys_common::{AsInner, FromInner, IntoInner};
18     use crate::time::Duration;
19
20     #[allow(unused_extern_crates)]
21     pub extern crate libc as netc;
22
23     pub struct Socket(FileDesc);
24     impl Socket {
25         pub fn new(_: &SocketAddr, _: libc::c_int) -> io::Result<Socket> {
26             unimpl!();
27         }
28
29         pub fn new_raw(_: libc::c_int, _: libc::c_int) -> io::Result<Socket> {
30             unimpl!();
31         }
32
33         pub fn new_pair(_: libc::c_int, _: libc::c_int) -> io::Result<(Socket, Socket)> {
34             unimpl!();
35         }
36
37         pub fn connect_timeout(&self, _: &SocketAddr, _: Duration) -> io::Result<()> {
38             unimpl!();
39         }
40
41         pub fn accept(
42             &self,
43             _: *mut libc::sockaddr,
44             _: *mut libc::socklen_t,
45         ) -> io::Result<Socket> {
46             unimpl!();
47         }
48
49         pub fn duplicate(&self) -> io::Result<Socket> {
50             unimpl!();
51         }
52
53         pub fn read(&self, _: &mut [u8]) -> io::Result<usize> {
54             unimpl!();
55         }
56
57         pub fn read_vectored(&self, _: &mut [IoSliceMut<'_>]) -> io::Result<usize> {
58             unimpl!();
59         }
60
61         pub fn is_read_vectored(&self) -> bool {
62             unimpl!();
63         }
64
65         pub fn peek(&self, _: &mut [u8]) -> io::Result<usize> {
66             unimpl!();
67         }
68
69         pub fn recv_from(&self, _: &mut [u8]) -> io::Result<(usize, SocketAddr)> {
70             unimpl!();
71         }
72
73         pub fn peek_from(&self, _: &mut [u8]) -> io::Result<(usize, SocketAddr)> {
74             unimpl!();
75         }
76
77         pub fn write(&self, _: &[u8]) -> io::Result<usize> {
78             unimpl!();
79         }
80
81         pub fn write_vectored(&self, _: &[IoSlice<'_>]) -> io::Result<usize> {
82             unimpl!();
83         }
84
85         pub fn is_write_vectored(&self) -> bool {
86             unimpl!();
87         }
88
89         pub fn set_timeout(&self, _: Option<Duration>, _: libc::c_int) -> io::Result<()> {
90             unimpl!();
91         }
92
93         pub fn timeout(&self, _: libc::c_int) -> io::Result<Option<Duration>> {
94             unimpl!();
95         }
96
97         pub fn shutdown(&self, _: Shutdown) -> io::Result<()> {
98             unimpl!();
99         }
100
101         pub fn set_linger(&self, _: Option<Duration>) -> io::Result<()> {
102             unimpl!();
103         }
104
105         pub fn linger(&self) -> io::Result<Option<Duration>> {
106             unimpl!();
107         }
108
109         pub fn set_nodelay(&self, _: bool) -> io::Result<()> {
110             unimpl!();
111         }
112
113         pub fn nodelay(&self) -> io::Result<bool> {
114             unimpl!();
115         }
116
117         pub fn set_nonblocking(&self, _: bool) -> io::Result<()> {
118             unimpl!();
119         }
120
121         pub fn take_error(&self) -> io::Result<Option<io::Error>> {
122             unimpl!();
123         }
124     }
125
126     impl AsInner<libc::c_int> for Socket {
127         fn as_inner(&self) -> &libc::c_int {
128             self.0.as_inner()
129         }
130     }
131
132     impl FromInner<libc::c_int> for Socket {
133         fn from_inner(fd: libc::c_int) -> Socket {
134             Socket(FileDesc::new(fd))
135         }
136     }
137
138     impl IntoInner<libc::c_int> for Socket {
139         fn into_inner(self) -> libc::c_int {
140             self.0.into_raw()
141         }
142     }
143
144     pub struct TcpStream {
145         inner: Socket,
146     }
147
148     impl TcpStream {
149         pub fn connect(_: io::Result<&SocketAddr>) -> io::Result<TcpStream> {
150             unimpl!();
151         }
152
153         pub fn connect_timeout(_: &SocketAddr, _: Duration) -> io::Result<TcpStream> {
154             unimpl!();
155         }
156
157         pub fn socket(&self) -> &Socket {
158             &self.inner
159         }
160
161         pub fn into_socket(self) -> Socket {
162             self.inner
163         }
164
165         pub fn set_read_timeout(&self, _: Option<Duration>) -> io::Result<()> {
166             unimpl!();
167         }
168
169         pub fn set_write_timeout(&self, _: Option<Duration>) -> io::Result<()> {
170             unimpl!();
171         }
172
173         pub fn read_timeout(&self) -> io::Result<Option<Duration>> {
174             unimpl!();
175         }
176
177         pub fn write_timeout(&self) -> io::Result<Option<Duration>> {
178             unimpl!();
179         }
180
181         pub fn peek(&self, _: &mut [u8]) -> io::Result<usize> {
182             unimpl!();
183         }
184
185         pub fn read(&self, _: &mut [u8]) -> io::Result<usize> {
186             unimpl!();
187         }
188
189         pub fn read_vectored(&self, _: &mut [IoSliceMut<'_>]) -> io::Result<usize> {
190             unimpl!();
191         }
192
193         pub fn is_read_vectored(&self) -> bool {
194             unimpl!();
195         }
196
197         pub fn write(&self, _: &[u8]) -> io::Result<usize> {
198             unimpl!();
199         }
200
201         pub fn write_vectored(&self, _: &[IoSlice<'_>]) -> io::Result<usize> {
202             unimpl!();
203         }
204
205         pub fn is_write_vectored(&self) -> bool {
206             unimpl!();
207         }
208
209         pub fn peer_addr(&self) -> io::Result<SocketAddr> {
210             unimpl!();
211         }
212
213         pub fn socket_addr(&self) -> io::Result<SocketAddr> {
214             unimpl!();
215         }
216
217         pub fn shutdown(&self, _: Shutdown) -> io::Result<()> {
218             unimpl!();
219         }
220
221         pub fn duplicate(&self) -> io::Result<TcpStream> {
222             unimpl!();
223         }
224
225         pub fn set_linger(&self, _: Option<Duration>) -> io::Result<()> {
226             unimpl!();
227         }
228
229         pub fn linger(&self) -> io::Result<Option<Duration>> {
230             unimpl!();
231         }
232
233         pub fn set_nodelay(&self, _: bool) -> io::Result<()> {
234             unimpl!();
235         }
236
237         pub fn nodelay(&self) -> io::Result<bool> {
238             unimpl!();
239         }
240
241         pub fn set_ttl(&self, _: u32) -> io::Result<()> {
242             unimpl!();
243         }
244
245         pub fn ttl(&self) -> io::Result<u32> {
246             unimpl!();
247         }
248
249         pub fn take_error(&self) -> io::Result<Option<io::Error>> {
250             unimpl!();
251         }
252
253         pub fn set_nonblocking(&self, _: bool) -> io::Result<()> {
254             unimpl!();
255         }
256     }
257
258     impl FromInner<Socket> for TcpStream {
259         fn from_inner(socket: Socket) -> TcpStream {
260             TcpStream { inner: socket }
261         }
262     }
263
264     impl fmt::Debug for TcpStream {
265         fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
266             write!(f, "No networking support available on L4Re")
267         }
268     }
269
270     pub struct TcpListener {
271         inner: Socket,
272     }
273
274     impl TcpListener {
275         pub fn bind(_: io::Result<&SocketAddr>) -> io::Result<TcpListener> {
276             unimpl!();
277         }
278
279         pub fn socket(&self) -> &Socket {
280             &self.inner
281         }
282
283         pub fn into_socket(self) -> Socket {
284             self.inner
285         }
286
287         pub fn socket_addr(&self) -> io::Result<SocketAddr> {
288             unimpl!();
289         }
290
291         pub fn accept(&self) -> io::Result<(TcpStream, SocketAddr)> {
292             unimpl!();
293         }
294
295         pub fn duplicate(&self) -> io::Result<TcpListener> {
296             unimpl!();
297         }
298
299         pub fn set_ttl(&self, _: u32) -> io::Result<()> {
300             unimpl!();
301         }
302
303         pub fn ttl(&self) -> io::Result<u32> {
304             unimpl!();
305         }
306
307         pub fn set_only_v6(&self, _: bool) -> io::Result<()> {
308             unimpl!();
309         }
310
311         pub fn only_v6(&self) -> io::Result<bool> {
312             unimpl!();
313         }
314
315         pub fn take_error(&self) -> io::Result<Option<io::Error>> {
316             unimpl!();
317         }
318
319         pub fn set_nonblocking(&self, _: bool) -> io::Result<()> {
320             unimpl!();
321         }
322     }
323
324     impl FromInner<Socket> for TcpListener {
325         fn from_inner(socket: Socket) -> TcpListener {
326             TcpListener { inner: socket }
327         }
328     }
329
330     impl fmt::Debug for TcpListener {
331         fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
332             write!(f, "No networking support available on L4Re.")
333         }
334     }
335
336     pub struct UdpSocket {
337         inner: Socket,
338     }
339
340     impl UdpSocket {
341         pub fn bind(_: io::Result<&SocketAddr>) -> io::Result<UdpSocket> {
342             unimpl!();
343         }
344
345         pub fn socket(&self) -> &Socket {
346             &self.inner
347         }
348
349         pub fn into_socket(self) -> Socket {
350             self.inner
351         }
352
353         pub fn peer_addr(&self) -> io::Result<SocketAddr> {
354             unimpl!();
355         }
356
357         pub fn socket_addr(&self) -> io::Result<SocketAddr> {
358             unimpl!();
359         }
360
361         pub fn recv_from(&self, _: &mut [u8]) -> io::Result<(usize, SocketAddr)> {
362             unimpl!();
363         }
364
365         pub fn peek_from(&self, _: &mut [u8]) -> io::Result<(usize, SocketAddr)> {
366             unimpl!();
367         }
368
369         pub fn send_to(&self, _: &[u8], _: &SocketAddr) -> io::Result<usize> {
370             unimpl!();
371         }
372
373         pub fn duplicate(&self) -> io::Result<UdpSocket> {
374             unimpl!();
375         }
376
377         pub fn set_read_timeout(&self, _: Option<Duration>) -> io::Result<()> {
378             unimpl!();
379         }
380
381         pub fn set_write_timeout(&self, _: Option<Duration>) -> io::Result<()> {
382             unimpl!();
383         }
384
385         pub fn read_timeout(&self) -> io::Result<Option<Duration>> {
386             unimpl!();
387         }
388
389         pub fn write_timeout(&self) -> io::Result<Option<Duration>> {
390             unimpl!();
391         }
392
393         pub fn set_broadcast(&self, _: bool) -> io::Result<()> {
394             unimpl!();
395         }
396
397         pub fn broadcast(&self) -> io::Result<bool> {
398             unimpl!();
399         }
400
401         pub fn set_multicast_loop_v4(&self, _: bool) -> io::Result<()> {
402             unimpl!();
403         }
404
405         pub fn multicast_loop_v4(&self) -> io::Result<bool> {
406             unimpl!();
407         }
408
409         pub fn set_multicast_ttl_v4(&self, _: u32) -> io::Result<()> {
410             unimpl!();
411         }
412
413         pub fn multicast_ttl_v4(&self) -> io::Result<u32> {
414             unimpl!();
415         }
416
417         pub fn set_multicast_loop_v6(&self, _: bool) -> io::Result<()> {
418             unimpl!();
419         }
420
421         pub fn multicast_loop_v6(&self) -> io::Result<bool> {
422             unimpl!();
423         }
424
425         pub fn join_multicast_v4(&self, _: &Ipv4Addr, _: &Ipv4Addr) -> io::Result<()> {
426             unimpl!();
427         }
428
429         pub fn join_multicast_v6(&self, _: &Ipv6Addr, _: u32) -> io::Result<()> {
430             unimpl!();
431         }
432
433         pub fn leave_multicast_v4(&self, _: &Ipv4Addr, _: &Ipv4Addr) -> io::Result<()> {
434             unimpl!();
435         }
436
437         pub fn leave_multicast_v6(&self, _: &Ipv6Addr, _: u32) -> io::Result<()> {
438             unimpl!();
439         }
440
441         pub fn set_ttl(&self, _: u32) -> io::Result<()> {
442             unimpl!();
443         }
444
445         pub fn ttl(&self) -> io::Result<u32> {
446             unimpl!();
447         }
448
449         pub fn take_error(&self) -> io::Result<Option<io::Error>> {
450             unimpl!();
451         }
452
453         pub fn set_nonblocking(&self, _: bool) -> io::Result<()> {
454             unimpl!();
455         }
456
457         pub fn recv(&self, _: &mut [u8]) -> io::Result<usize> {
458             unimpl!();
459         }
460
461         pub fn peek(&self, _: &mut [u8]) -> io::Result<usize> {
462             unimpl!();
463         }
464
465         pub fn send(&self, _: &[u8]) -> io::Result<usize> {
466             unimpl!();
467         }
468
469         pub fn connect(&self, _: io::Result<&SocketAddr>) -> io::Result<()> {
470             unimpl!();
471         }
472     }
473
474     impl FromInner<Socket> for UdpSocket {
475         fn from_inner(socket: Socket) -> UdpSocket {
476             UdpSocket { inner: socket }
477         }
478     }
479
480     impl fmt::Debug for UdpSocket {
481         fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
482             write!(f, "No networking support on L4Re available.")
483         }
484     }
485
486     pub struct LookupHost {
487         original: *mut libc::addrinfo,
488         cur: *mut libc::addrinfo,
489     }
490
491     impl Iterator for LookupHost {
492         type Item = SocketAddr;
493         fn next(&mut self) -> Option<SocketAddr> {
494             None
495         }
496     }
497
498     impl LookupHost {
499         pub fn port(&self) -> u16 {
500             unimpl!();
501         }
502     }
503
504     unsafe impl Sync for LookupHost {}
505     unsafe impl Send for LookupHost {}
506
507     impl TryFrom<&str> for LookupHost {
508         type Error = io::Error;
509
510         fn try_from(_v: &str) -> io::Result<LookupHost> {
511             unimpl!();
512         }
513     }
514
515     impl<'a> TryFrom<(&'a str, u16)> for LookupHost {
516         type Error = io::Error;
517
518         fn try_from(_v: (&'a str, u16)) -> io::Result<LookupHost> {
519             unimpl!();
520         }
521     }
522 }