139 references to Interop
System.Net.Ping (139)
LibraryImports.g.cs (11)
71
private static partial int PathConf(string path, global::
Interop
.Sys.PathConfName name)
100
static extern unsafe int __PInvoke(byte* __path_native, global::
Interop
.Sys.PathConfName __name_native);
109
internal static partial int FStat(global::System.Runtime.InteropServices.SafeHandle fd, out global::
Interop
.Sys.FileStatus output)
122
fixed (global::
Interop
.Sys.FileStatus* __output_native = &output)
141
static extern unsafe int __PInvoke(nint __fd_native, global::
Interop
.Sys.FileStatus* __output_native);
150
internal static partial int Stat(string path, out global::
Interop
.Sys.FileStatus output)
163
fixed (global::
Interop
.Sys.FileStatus* __output_native = &output)
182
static extern unsafe int __PInvoke(byte* __path_native, global::
Interop
.Sys.FileStatus* __output_native);
191
internal static partial int LStat(string path, out global::
Interop
.Sys.FileStatus output)
204
fixed (global::
Interop
.Sys.FileStatus* __output_native = &output)
223
static extern unsafe int __PInvoke(byte* __path_native, global::
Interop
.Sys.FileStatus* __output_native);
src\libraries\Common\src\Interop\Unix\Interop.Errors.cs (6)
124
_error =
Interop
.Sys.ConvertErrorPlatformToPal(errno);
141
get { return _rawErrno == -1 ? (_rawErrno =
Interop
.Sys.ConvertErrorPalToPlatform(_error)) : _rawErrno; }
146
return
Interop
.Sys.StrError(RawErrno);
220
public static
Interop
.ErrorInfo Info(this
Interop
.Error error)
222
return new
Interop
.ErrorInfo(error);
src\libraries\Common\src\System\Net\SocketAddressPal.Unix.cs (23)
26
Interop
.Error err =
Interop
.Sys.GetSocketAddressSizes(&ipv4, &ipv6, &uds, &max);
27
Debug.Assert(err ==
Interop
.Error.SUCCESS, $"Unexpected err: {err}");
39
private static void ThrowOnFailure(
Interop
.Error err)
43
case
Interop
.Error.SUCCESS:
46
case
Interop
.Error.EFAULT:
50
case
Interop
.Error.EAFNOSUPPORT:
63
Interop
.Error err;
66
err =
Interop
.Sys.GetAddressFamily(rawAddress, buffer.Length, (int*)&family);
75
Interop
.Error err;
81
err =
Interop
.Sys.SetAddressFamily(rawAddress, buffer.Length, (int)family);
91
Interop
.Error err;
94
err =
Interop
.Sys.GetPort(rawAddress, buffer.Length, &port);
103
Interop
.Error err;
106
err =
Interop
.Sys.SetPort(rawAddress, buffer.Length, port);
115
Interop
.Error err;
118
err =
Interop
.Sys.GetIPv4Address(rawAddress, buffer.Length, &ipAddress);
128
Interop
.Error err;
132
err =
Interop
.Sys.GetIPv6Address(rawAddress, buffer.Length, ipAddress, address.Length, &localScope);
141
Interop
.Error err;
144
err =
Interop
.Sys.SetIPv4Address(rawAddress, buffer.Length, address);
167
Interop
.Error err;
170
err =
Interop
.Sys.SetIPv6Address(rawAddress, buffer.Length, address, addressLength, scope);
src\libraries\Common\src\System\Net\SocketProtocolSupportPal.Unix.cs (5)
25
Interop
.Error result =
Interop
.Sys.Socket((int)af, DgramSocketType, 0, &socket);
27
return result !=
Interop
.Error.EAFNOSUPPORT && result !=
Interop
.Error.EPROTONOSUPPORT;
33
Interop
.Sys.Close(socket);
src\libraries\Common\src\System\Net\Sockets\SocketErrorPal.Unix.cs (92)
20
internal static SocketError GetSocketErrorForNativeError(
Interop
.Error errno) => errno switch
22
Interop
.Error.EACCES => SocketError.AccessDenied,
23
Interop
.Error.EADDRINUSE => SocketError.AddressAlreadyInUse,
24
Interop
.Error.EADDRNOTAVAIL => SocketError.AddressNotAvailable,
25
Interop
.Error.EAFNOSUPPORT => SocketError.AddressFamilyNotSupported,
26
Interop
.Error.EAGAIN => SocketError.WouldBlock,
27
Interop
.Error.EALREADY => SocketError.AlreadyInProgress,
28
Interop
.Error.EBADF => SocketError.OperationAborted,
29
Interop
.Error.ECANCELED => SocketError.OperationAborted,
30
Interop
.Error.ECONNABORTED => SocketError.ConnectionAborted,
31
Interop
.Error.ECONNREFUSED => SocketError.ConnectionRefused,
32
Interop
.Error.ECONNRESET => SocketError.ConnectionReset,
33
Interop
.Error.EDESTADDRREQ => SocketError.DestinationAddressRequired,
34
Interop
.Error.EFAULT => SocketError.Fault,
35
Interop
.Error.EHOSTDOWN => SocketError.HostDown,
36
Interop
.Error.ENXIO => SocketError.HostNotFound, // not perfect, but closest match available
37
Interop
.Error.EHOSTUNREACH => SocketError.HostUnreachable,
38
Interop
.Error.EINPROGRESS => SocketError.InProgress,
39
Interop
.Error.EINTR => SocketError.Interrupted,
40
Interop
.Error.EINVAL => SocketError.InvalidArgument,
41
Interop
.Error.EISCONN => SocketError.IsConnected,
42
Interop
.Error.EMFILE => SocketError.TooManyOpenSockets,
43
Interop
.Error.EMSGSIZE => SocketError.MessageSize,
44
Interop
.Error.ENETDOWN => SocketError.NetworkDown,
45
Interop
.Error.ENETRESET => SocketError.NetworkReset,
46
Interop
.Error.ENETUNREACH => SocketError.NetworkUnreachable,
47
Interop
.Error.ENFILE => SocketError.TooManyOpenSockets,
48
Interop
.Error.ENOBUFS => SocketError.NoBufferSpaceAvailable,
49
Interop
.Error.ENODATA => SocketError.NoData,
50
Interop
.Error.ENOENT => SocketError.AddressNotAvailable,
51
Interop
.Error.ENOPROTOOPT => SocketError.ProtocolOption,
52
Interop
.Error.ENOTCONN => SocketError.NotConnected,
53
Interop
.Error.ENOTSOCK => SocketError.NotSocket,
54
Interop
.Error.ENOTSUP => SocketError.OperationNotSupported,
55
Interop
.Error.EPERM => SocketError.AccessDenied,
56
Interop
.Error.EPIPE => SocketError.Shutdown,
57
Interop
.Error.EPFNOSUPPORT => SocketError.ProtocolFamilyNotSupported,
58
Interop
.Error.EPROTONOSUPPORT => SocketError.ProtocolNotSupported,
59
Interop
.Error.EPROTOTYPE => SocketError.ProtocolType,
60
Interop
.Error.ESOCKTNOSUPPORT => SocketError.SocketNotSupported,
61
Interop
.Error.ESHUTDOWN => SocketError.Disconnecting,
62
Interop
.Error.SUCCESS => SocketError.Success,
63
Interop
.Error.ETIMEDOUT => SocketError.TimedOut,
67
private static
Interop
.Error GetNativeErrorForSocketErrorHelper(SocketError error) => error switch
75
SocketError.AccessDenied =>
Interop
.Error.EACCES, // could also have been EPERM
76
SocketError.AddressAlreadyInUse =>
Interop
.Error.EADDRINUSE,
77
SocketError.AddressNotAvailable =>
Interop
.Error.EADDRNOTAVAIL,
78
SocketError.AddressFamilyNotSupported =>
Interop
.Error.EAFNOSUPPORT,
79
SocketError.AlreadyInProgress =>
Interop
.Error.EALREADY,
80
SocketError.ConnectionAborted =>
Interop
.Error.ECONNABORTED,
81
SocketError.ConnectionRefused =>
Interop
.Error.ECONNREFUSED,
82
SocketError.ConnectionReset =>
Interop
.Error.ECONNRESET,
83
SocketError.DestinationAddressRequired =>
Interop
.Error.EDESTADDRREQ,
84
SocketError.Disconnecting =>
Interop
.Error.ESHUTDOWN,
85
SocketError.Fault =>
Interop
.Error.EFAULT,
86
SocketError.HostDown =>
Interop
.Error.EHOSTDOWN,
87
SocketError.HostNotFound =>
Interop
.Error.EHOSTNOTFOUND,
88
SocketError.HostUnreachable =>
Interop
.Error.EHOSTUNREACH,
89
SocketError.InProgress =>
Interop
.Error.EINPROGRESS,
90
SocketError.Interrupted =>
Interop
.Error.EINTR,
91
SocketError.InvalidArgument =>
Interop
.Error.EINVAL,
92
SocketError.IOPending =>
Interop
.Error.EINPROGRESS,
93
SocketError.IsConnected =>
Interop
.Error.EISCONN,
94
SocketError.MessageSize =>
Interop
.Error.EMSGSIZE,
95
SocketError.NetworkDown =>
Interop
.Error.ENETDOWN,
96
SocketError.NetworkReset =>
Interop
.Error.ENETRESET,
97
SocketError.NetworkUnreachable =>
Interop
.Error.ENETUNREACH,
98
SocketError.NoBufferSpaceAvailable =>
Interop
.Error.ENOBUFS,
99
SocketError.NoData =>
Interop
.Error.ENODATA,
100
SocketError.NotConnected =>
Interop
.Error.ENOTCONN,
101
SocketError.NotSocket =>
Interop
.Error.ENOTSOCK,
102
SocketError.OperationAborted =>
Interop
.Error.ECANCELED,
103
SocketError.OperationNotSupported =>
Interop
.Error.ENOTSUP,
104
SocketError.ProtocolFamilyNotSupported =>
Interop
.Error.EPFNOSUPPORT,
105
SocketError.ProtocolNotSupported =>
Interop
.Error.EPROTONOSUPPORT,
106
SocketError.ProtocolOption =>
Interop
.Error.ENOPROTOOPT,
107
SocketError.ProtocolType =>
Interop
.Error.EPROTOTYPE,
108
SocketError.Shutdown =>
Interop
.Error.EPIPE,
109
SocketError.SocketNotSupported =>
Interop
.Error.ESOCKTNOSUPPORT,
110
SocketError.Success =>
Interop
.Error.SUCCESS,
111
SocketError.TimedOut =>
Interop
.Error.ETIMEDOUT,
112
SocketError.TooManyOpenSockets =>
Interop
.Error.ENFILE, // could also have been EMFILE
113
SocketError.TryAgain =>
Interop
.Error.EAGAIN, // not a perfect mapping, but better than nothing
114
SocketError.WouldBlock =>
Interop
.Error.EAGAIN,
115
SocketError.SocketError =>
Interop
.Error.ESOCKETERROR,
116
_ =>
Interop
.Error.SUCCESS, // default for unknown mappings
119
internal static
Interop
.Error GetNativeErrorForSocketError(SocketError error)
121
Interop
.Error errno = GetNativeErrorForSocketErrorHelper(error);
122
if (errno ==
Interop
.Error.SUCCESS)
125
errno = (
Interop
.Error)(int)error;
130
internal static bool TryGetNativeErrorForSocketError(SocketError error, out
Interop
.Error errno)
133
return errno !=
Interop
.Error.SUCCESS;
System\Net\NetworkInformation\Ping.RawSocket.cs (2)
305
Interop
.Sys.MessageHeader header = default;
312
result =
Interop
.Sys.ReceiveSocketError(socket.SafeHandle, &header);