477 references to Interop
System.Net.Sockets (477)
LibraryImports.g.cs (11)
71private static partial int PathConf(string path, global::Interop.Sys.PathConfName name) 100static extern unsafe int __PInvoke(byte* __path_native, global::Interop.Sys.PathConfName __name_native); 109internal static partial int FStat(global::System.Runtime.InteropServices.SafeHandle fd, out global::Interop.Sys.FileStatus output) 122fixed (global::Interop.Sys.FileStatus* __output_native = &output) 141static extern unsafe int __PInvoke(nint __fd_native, global::Interop.Sys.FileStatus* __output_native); 150internal static partial int Stat(string path, out global::Interop.Sys.FileStatus output) 163fixed (global::Interop.Sys.FileStatus* __output_native = &output) 182static extern unsafe int __PInvoke(byte* __path_native, global::Interop.Sys.FileStatus* __output_native); 191internal static partial int LStat(string path, out global::Interop.Sys.FileStatus output) 204fixed (global::Interop.Sys.FileStatus* __output_native = &output) 223static 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); 141get { return _rawErrno == -1 ? (_rawErrno = Interop.Sys.ConvertErrorPalToPlatform(_error)) : _rawErrno; } 146return Interop.Sys.StrError(RawErrno); 220public static Interop.ErrorInfo Info(this Interop.Error error) 222return new Interop.ErrorInfo(error);
src\libraries\Common\src\System\Net\InteropIPAddressExtensions.Unix.cs (6)
11public static unsafe Interop.Sys.IPAddress GetNativeIPAddress(this IPAddress ipAddress) 13var nativeIPAddress = default(Interop.Sys.IPAddress); 15ipAddress.TryWriteBytes(new Span<byte>(nativeIPAddress.Address, Interop.Sys.IPv6AddressBytes), out int bytesWritten); 16Debug.Assert(bytesWritten == sizeof(uint) || bytesWritten == Interop.Sys.IPv6AddressBytes, $"Unexpected length: {bytesWritten}"); 27public static unsafe IPAddress GetIPAddress(this Interop.Sys.IPAddress nativeIPAddress) 37new ReadOnlySpan<byte>(nativeIPAddress.Address, Interop.Sys.IPv6AddressBytes),
src\libraries\Common\src\System\Net\SocketAddressPal.Unix.cs (23)
26Interop.Error err = Interop.Sys.GetSocketAddressSizes(&ipv4, &ipv6, &uds, &max); 27Debug.Assert(err == Interop.Error.SUCCESS, $"Unexpected err: {err}"); 39private static void ThrowOnFailure(Interop.Error err) 43case Interop.Error.SUCCESS: 46case Interop.Error.EFAULT: 50case Interop.Error.EAFNOSUPPORT: 63Interop.Error err; 66err = Interop.Sys.GetAddressFamily(rawAddress, buffer.Length, (int*)&family); 75Interop.Error err; 81err = Interop.Sys.SetAddressFamily(rawAddress, buffer.Length, (int)family); 91Interop.Error err; 94err = Interop.Sys.GetPort(rawAddress, buffer.Length, &port); 103Interop.Error err; 106err = Interop.Sys.SetPort(rawAddress, buffer.Length, port); 115Interop.Error err; 118err = Interop.Sys.GetIPv4Address(rawAddress, buffer.Length, &ipAddress); 128Interop.Error err; 132err = Interop.Sys.GetIPv6Address(rawAddress, buffer.Length, ipAddress, address.Length, &localScope); 141Interop.Error err; 144err = Interop.Sys.SetIPv4Address(rawAddress, buffer.Length, address); 167Interop.Error err; 170err = Interop.Sys.SetIPv6Address(rawAddress, buffer.Length, address, addressLength, scope);
src\libraries\Common\src\System\Net\SocketProtocolSupportPal.Unix.cs (5)
25Interop.Error result = Interop.Sys.Socket((int)af, DgramSocketType, 0, &socket); 27return result != Interop.Error.EAFNOSUPPORT && result != Interop.Error.EPROTONOSUPPORT; 33Interop.Sys.Close(socket);
src\libraries\Common\src\System\Net\Sockets\SocketErrorPal.Unix.cs (92)
20internal static SocketError GetSocketErrorForNativeError(Interop.Error errno) => errno switch 22Interop.Error.EACCES => SocketError.AccessDenied, 23Interop.Error.EADDRINUSE => SocketError.AddressAlreadyInUse, 24Interop.Error.EADDRNOTAVAIL => SocketError.AddressNotAvailable, 25Interop.Error.EAFNOSUPPORT => SocketError.AddressFamilyNotSupported, 26Interop.Error.EAGAIN => SocketError.WouldBlock, 27Interop.Error.EALREADY => SocketError.AlreadyInProgress, 28Interop.Error.EBADF => SocketError.OperationAborted, 29Interop.Error.ECANCELED => SocketError.OperationAborted, 30Interop.Error.ECONNABORTED => SocketError.ConnectionAborted, 31Interop.Error.ECONNREFUSED => SocketError.ConnectionRefused, 32Interop.Error.ECONNRESET => SocketError.ConnectionReset, 33Interop.Error.EDESTADDRREQ => SocketError.DestinationAddressRequired, 34Interop.Error.EFAULT => SocketError.Fault, 35Interop.Error.EHOSTDOWN => SocketError.HostDown, 36Interop.Error.ENXIO => SocketError.HostNotFound, // not perfect, but closest match available 37Interop.Error.EHOSTUNREACH => SocketError.HostUnreachable, 38Interop.Error.EINPROGRESS => SocketError.InProgress, 39Interop.Error.EINTR => SocketError.Interrupted, 40Interop.Error.EINVAL => SocketError.InvalidArgument, 41Interop.Error.EISCONN => SocketError.IsConnected, 42Interop.Error.EMFILE => SocketError.TooManyOpenSockets, 43Interop.Error.EMSGSIZE => SocketError.MessageSize, 44Interop.Error.ENETDOWN => SocketError.NetworkDown, 45Interop.Error.ENETRESET => SocketError.NetworkReset, 46Interop.Error.ENETUNREACH => SocketError.NetworkUnreachable, 47Interop.Error.ENFILE => SocketError.TooManyOpenSockets, 48Interop.Error.ENOBUFS => SocketError.NoBufferSpaceAvailable, 49Interop.Error.ENODATA => SocketError.NoData, 50Interop.Error.ENOENT => SocketError.AddressNotAvailable, 51Interop.Error.ENOPROTOOPT => SocketError.ProtocolOption, 52Interop.Error.ENOTCONN => SocketError.NotConnected, 53Interop.Error.ENOTSOCK => SocketError.NotSocket, 54Interop.Error.ENOTSUP => SocketError.OperationNotSupported, 55Interop.Error.EPERM => SocketError.AccessDenied, 56Interop.Error.EPIPE => SocketError.Shutdown, 57Interop.Error.EPFNOSUPPORT => SocketError.ProtocolFamilyNotSupported, 58Interop.Error.EPROTONOSUPPORT => SocketError.ProtocolNotSupported, 59Interop.Error.EPROTOTYPE => SocketError.ProtocolType, 60Interop.Error.ESOCKTNOSUPPORT => SocketError.SocketNotSupported, 61Interop.Error.ESHUTDOWN => SocketError.Disconnecting, 62Interop.Error.SUCCESS => SocketError.Success, 63Interop.Error.ETIMEDOUT => SocketError.TimedOut, 67private static Interop.Error GetNativeErrorForSocketErrorHelper(SocketError error) => error switch 75SocketError.AccessDenied => Interop.Error.EACCES, // could also have been EPERM 76SocketError.AddressAlreadyInUse => Interop.Error.EADDRINUSE, 77SocketError.AddressNotAvailable => Interop.Error.EADDRNOTAVAIL, 78SocketError.AddressFamilyNotSupported => Interop.Error.EAFNOSUPPORT, 79SocketError.AlreadyInProgress => Interop.Error.EALREADY, 80SocketError.ConnectionAborted => Interop.Error.ECONNABORTED, 81SocketError.ConnectionRefused => Interop.Error.ECONNREFUSED, 82SocketError.ConnectionReset => Interop.Error.ECONNRESET, 83SocketError.DestinationAddressRequired => Interop.Error.EDESTADDRREQ, 84SocketError.Disconnecting => Interop.Error.ESHUTDOWN, 85SocketError.Fault => Interop.Error.EFAULT, 86SocketError.HostDown => Interop.Error.EHOSTDOWN, 87SocketError.HostNotFound => Interop.Error.EHOSTNOTFOUND, 88SocketError.HostUnreachable => Interop.Error.EHOSTUNREACH, 89SocketError.InProgress => Interop.Error.EINPROGRESS, 90SocketError.Interrupted => Interop.Error.EINTR, 91SocketError.InvalidArgument => Interop.Error.EINVAL, 92SocketError.IOPending => Interop.Error.EINPROGRESS, 93SocketError.IsConnected => Interop.Error.EISCONN, 94SocketError.MessageSize => Interop.Error.EMSGSIZE, 95SocketError.NetworkDown => Interop.Error.ENETDOWN, 96SocketError.NetworkReset => Interop.Error.ENETRESET, 97SocketError.NetworkUnreachable => Interop.Error.ENETUNREACH, 98SocketError.NoBufferSpaceAvailable => Interop.Error.ENOBUFS, 99SocketError.NoData => Interop.Error.ENODATA, 100SocketError.NotConnected => Interop.Error.ENOTCONN, 101SocketError.NotSocket => Interop.Error.ENOTSOCK, 102SocketError.OperationAborted => Interop.Error.ECANCELED, 103SocketError.OperationNotSupported => Interop.Error.ENOTSUP, 104SocketError.ProtocolFamilyNotSupported => Interop.Error.EPFNOSUPPORT, 105SocketError.ProtocolNotSupported => Interop.Error.EPROTONOSUPPORT, 106SocketError.ProtocolOption => Interop.Error.ENOPROTOOPT, 107SocketError.ProtocolType => Interop.Error.EPROTOTYPE, 108SocketError.Shutdown => Interop.Error.EPIPE, 109SocketError.SocketNotSupported => Interop.Error.ESOCKTNOSUPPORT, 110SocketError.Success => Interop.Error.SUCCESS, 111SocketError.TimedOut => Interop.Error.ETIMEDOUT, 112SocketError.TooManyOpenSockets => Interop.Error.ENFILE, // could also have been EMFILE 113SocketError.TryAgain => Interop.Error.EAGAIN, // not a perfect mapping, but better than nothing 114SocketError.WouldBlock => Interop.Error.EAGAIN, 115SocketError.SocketError => Interop.Error.ESOCKETERROR, 116_ => Interop.Error.SUCCESS, // default for unknown mappings 119internal static Interop.Error GetNativeErrorForSocketError(SocketError error) 121Interop.Error errno = GetNativeErrorForSocketErrorHelper(error); 122if (errno == Interop.Error.SUCCESS) 125errno = (Interop.Error)(int)error; 130internal static bool TryGetNativeErrorForSocketError(SocketError error, out Interop.Error errno) 133return errno != Interop.Error.SUCCESS;
src\libraries\Common\src\System\Net\Sockets\SocketExceptionFactory.Unix.cs (1)
13if (SocketErrorPal.TryGetNativeErrorForSocketError((SocketError)socketError, out Interop.Error interopErr))
System\Net\Sockets\SafeSocketHandle.Unix.cs (23)
200int fdFlags = Interop.Sys.Fcntl.GetFD(handle); 209Interop.Error err = Interop.Sys.GetSockOpt(handle, SocketOptionLevel.Socket, SocketOptionName.Type, (byte*)&type, &optLen); 210if (err == Interop.Error.SUCCESS) 216Interop.Sys.Disconnect(handle); 220Interop.Sys.Shutdown(handle, SocketShutdown.Both); 229Interop.Error errorCode = Interop.Error.SUCCESS; 250if (errorCode != Interop.Error.EWOULDBLOCK) 257if (Interop.Sys.Fcntl.DangerousSetIsNonBlocking(handle, 0) == 0) 267var linger = new Interop.Sys.LingerOption 273errorCode = Interop.Sys.SetLingerOption(handle, &linger); 281case Interop.Error.SUCCESS: 282case Interop.Error.EINVAL: 283case Interop.Error.ENOPROTOOPT: 284case Interop.Error.ENOTSOCK: 294private Interop.Error CloseHandle(IntPtr handle) 296Interop.Error errorCode = Interop.Error.SUCCESS; 299if (Interop.Sys.Close(handle) != 0) 301errorCode = Interop.Sys.GetLastError(); 302if (errorCode == Interop.Error.ECONNRESET) 308errorCode = Interop.Error.SUCCESS;
System\Net\Sockets\Socket.Unix.cs (11)
70Interop.Error e = Interop.Sys.GetSocketType(handle, out addressFamily, out socketType, out protocolType, out isListening); 71if (e == Interop.Error.ENOTSOCK) 79if (Interop.Sys.FStat(handle, out Interop.Sys.FileStatus stat) == -1) 83isSocket = (stat.Mode & Interop.Sys.FileTypes.S_IFSOCK) == Interop.Sys.FileTypes.S_IFSOCK; 93Interop.Error e = Interop.Sys.GetSocketType(handle, out addressFamily, out socketType, out protocolType, out isListening); 94Debug.Assert(e == Interop.Error.SUCCESS, e.ToString()); 112int rv = Interop.Sys.Fcntl.GetIsNonBlocking(handle, out nonBlocking);
System\Net\Sockets\SocketAsyncContext.Unix.cs (31)
837if (!context.IsRegistered && !context.TryRegister(out Interop.Error error)) 921static void HandleFailedRegistration(SocketAsyncContext context, TOperation operation, Interop.Error error) 923Debug.Assert(error != Interop.Error.SUCCESS); 926if (error == Interop.Error.EPIPE) 936if (error == Interop.Error.ENOMEM || error == Interop.Error.ENOSPC) 1286private bool TryRegister(out Interop.Error error) 1319error = Interop.Error.SUCCESS; 1361if (Interop.Sys.Fcntl.SetIsNonBlocking(_socket, 1) != 0) 1363throw new SocketException((int)SocketPal.GetSocketErrorForErrorCode(Interop.Sys.GetLastError())); 2198public Interop.Sys.SocketEvents HandleSyncEventsSpeculatively(Interop.Sys.SocketEvents events) 2200if ((events & Interop.Sys.SocketEvents.Error) != 0) 2204events ^= Interop.Sys.SocketEvents.Error; 2205events |= Interop.Sys.SocketEvents.Read | Interop.Sys.SocketEvents.Write; 2208if ((events & Interop.Sys.SocketEvents.Read) != 0 && 2212events ^= Interop.Sys.SocketEvents.Read; 2215if ((events & Interop.Sys.SocketEvents.Write) != 0 && 2219events ^= Interop.Sys.SocketEvents.Write; 2226public void HandleEventsInline(Interop.Sys.SocketEvents events) 2228if ((events & Interop.Sys.SocketEvents.Error) != 0) 2232events ^= Interop.Sys.SocketEvents.Error; 2233events |= Interop.Sys.SocketEvents.Read | Interop.Sys.SocketEvents.Write; 2236if ((events & Interop.Sys.SocketEvents.Read) != 0) 2242if ((events & Interop.Sys.SocketEvents.Write) != 0) 2250public void HandleEvents(Interop.Sys.SocketEvents events) 2252Debug.Assert((events & Interop.Sys.SocketEvents.Error) == 0); 2255(events & Interop.Sys.SocketEvents.Read) != 0 ? _receiveQueue.ProcessSyncEventOrGetAsyncEvent(this) : null; 2257(events & Interop.Sys.SocketEvents.Write) != 0 ? _sendQueue.ProcessSyncEventOrGetAsyncEvent(this) : null;
System\Net\Sockets\SocketAsyncEngine.Unix.cs (26)
80/// <para>The index is used as the <see cref="Interop.Sys.SocketEvent.Data"/> to quickly map events to <see cref="SocketAsyncContext"/>s.</para> 87private readonly Interop.Sys.SocketEvent* _buffer; 115public static bool TryRegisterSocket(IntPtr socketHandle, SocketAsyncContext context, out SocketAsyncEngine? engine, out Interop.Error error) 124private bool TryRegisterCore(IntPtr socketHandle, SocketAsyncContext context, out Interop.Error error) 151error = Interop.Sys.TryChangeSocketEventRegistration(_port, socketHandle, Interop.Sys.SocketEvents.None, 152Interop.Sys.SocketEvents.Read | Interop.Sys.SocketEvents.Write, context.GlobalContextIndex); 153if (error == Interop.Error.SUCCESS) 184Interop.Error err; 187err = Interop.Sys.CreateSocketEventPort(portPtr); 188if (err != Interop.Error.SUCCESS) 194fixed (Interop.Sys.SocketEvent** bufferPtr = &_buffer) 196err = Interop.Sys.CreateSocketEventBuffer(EventBufferCount, bufferPtr); 197if (err != Interop.Error.SUCCESS) 225Interop.Error err = Interop.Sys.WaitForSocketEvents(_port, handler.Buffer, &numEvents); 226if (err != Interop.Error.SUCCESS) 340Interop.Sys.FreeSocketEventBuffer(_buffer); 344Interop.Sys.CloseSocketEventPort(_port); 355public Interop.Sys.SocketEvent* Buffer { get; } 369foreach (var socketEvent in new ReadOnlySpan<Interop.Sys.SocketEvent>(Buffer, numEvents)) 386Interop.Sys.SocketEvents events = context.HandleSyncEventsSpeculatively(socketEvent.Events); 388if (events != Interop.Sys.SocketEvents.None) 404public Interop.Sys.SocketEvents Events { get; } 406public SocketIOEvent(SocketAsyncContext context, Interop.Sys.SocketEvents events)
System\Net\Sockets\SocketPal.Unix.cs (241)
19public static readonly int MaximumAddressSize = Interop.Sys.GetMaximumAddressSize(); 29Interop.Sys.PlatformSupportsDualModeIPv4PacketInfo() != 0; 30public static SocketError GetSocketErrorForErrorCode(Interop.Error errorCode) 43private static unsafe IPPacketInformation GetIPPacketInformation(Interop.Sys.MessageHeader* messageHeader, bool isIPv4, bool isIPv6) 50Interop.Sys.IPPacketInformation nativePacketInfo = default; 51if (!Interop.Sys.TryGetIPPacketInformation(messageHeader, isIPv4, &nativePacketInfo)) 65Interop.Error error = Interop.Sys.Socket((int)addressFamily, (int)socketType, (int)protocolType, &fd); 66if (error == Interop.Error.SUCCESS) 78error = Interop.Sys.SetSockOpt(fd, SocketOptionLevel.IPv6, SocketOptionName.IPv6Only, (byte*)&on, sizeof(int)); 79if (error != Interop.Error.SUCCESS) 81Interop.Sys.Close(fd); 105private static unsafe int SysRead(SafeSocketHandle handle, Span<byte> buffer, out Interop.Error errno) 113received = Interop.Sys.Read(handle, b, buffer.Length); 114errno = received != -1 ? Interop.Error.SUCCESS : Interop.Sys.GetLastError(); 120private static unsafe int SysReceive(SafeSocketHandle socket, SocketFlags flags, Span<byte> buffer, out Interop.Error errno) 128errno = Interop.Sys.Receive( 136if (errno != Interop.Error.SUCCESS) 144private static unsafe int SysReceive(SafeSocketHandle socket, SocketFlags flags, Span<byte> buffer, Span<byte> socketAddress, out int socketAddressLen, out SocketFlags receivedFlags, out Interop.Error errno) 153var iov = new Interop.Sys.IOVector { 160var messageHeader = new Interop.Sys.MessageHeader { 167errno = Interop.Sys.ReceiveMessage( 177if (errno != Interop.Error.SUCCESS) 185private static unsafe int SysWrite(SafeSocketHandle handle, ReadOnlySpan<byte> buffer, ref int offset, ref int count, out Interop.Error errno) 193sent = Interop.Sys.Write(handle, b + offset, count); 196errno = Interop.Sys.GetLastError(); 200errno = Interop.Error.SUCCESS; 214private static unsafe int SysSend(SafeSocketHandle socket, SocketFlags flags, ReadOnlySpan<byte> buffer, ref int offset, ref int count, out Interop.Error errno) 223errno = Interop.Sys.Send( 231if (errno != Interop.Error.SUCCESS) 241private static unsafe int SysSend(SafeSocketHandle socket, SocketFlags flags, ReadOnlySpan<byte> buffer, ref int offset, ref int count, ReadOnlySpan<byte> socketAddress, out Interop.Error errno) 251var iov = new Interop.Sys.IOVector 257var messageHeader = new Interop.Sys.MessageHeader 266errno = Interop.Sys.SendMessage( 275if (errno != Interop.Error.SUCCESS) 285private static unsafe int SysSend(SafeSocketHandle socket, SocketFlags flags, IList<ArraySegment<byte>> buffers, ref int bufferIndex, ref int offset, ReadOnlySpan<byte> socketAddress, out Interop.Error errno) 300Span<Interop.Sys.IOVector> iovecs = allocOnStack ? stackalloc Interop.Sys.IOVector[IovStackThreshold] : new Interop.Sys.IOVector[maxBuffers]; 319fixed (Interop.Sys.IOVector* iov = iovecs) 321var messageHeader = new Interop.Sys.MessageHeader { 329errno = Interop.Sys.SendMessage( 347if (errno != Interop.Error.SUCCESS) 371private static long SendFile(SafeSocketHandle socket, SafeFileHandle fileHandle, ref long offset, ref long count, out Interop.Error errno) 374errno = Interop.Sys.SendFile(socket, fileHandle, offset, count, out bytesSent); 380private static unsafe int SysReceive(SafeSocketHandle socket, SocketFlags flags, IList<ArraySegment<byte>> buffers, Span<byte> socketAddress, out int socketAddressLen, out SocketFlags receivedFlags, out Interop.Error errno) 396errno = Interop.Sys.GetBytesAvailable(socket, &available); 397if (errno != Interop.Error.SUCCESS) 412Span<Interop.Sys.IOVector> iovecs = allocOnStack ? stackalloc Interop.Sys.IOVector[IovStackThreshold] : new Interop.Sys.IOVector[maxBuffers]; 445fixed (Interop.Sys.IOVector* iov = iovecs) 447var messageHeader = new Interop.Sys.MessageHeader { 454errno = Interop.Sys.ReceiveMessage( 475if (errno != Interop.Error.SUCCESS) 483private static unsafe int SysReceiveMessageFrom(SafeSocketHandle socket, SocketFlags flags, Span<byte> buffer, Span<byte> socketAddress, out int socketAddressLen, bool isIPv4, bool isIPv6, out SocketFlags receivedFlags, out IPPacketInformation ipPacketInformation, out Interop.Error errno) 487int cmsgBufferLen = Interop.Sys.GetControlMessageBufferSize(Convert.ToInt32(isIPv4), Convert.ToInt32(isIPv6)); 490Interop.Sys.MessageHeader messageHeader; 496var iov = new Interop.Sys.IOVector { 503messageHeader = new Interop.Sys.MessageHeader { 512errno = Interop.Sys.ReceiveMessage( 522if (errno != Interop.Error.SUCCESS) 541out SocketFlags receivedFlags, out IPPacketInformation ipPacketInformation, out Interop.Error errno) 554Span<Interop.Sys.IOVector> iovecs = allocOnStack ? stackalloc Interop.Sys.IOVector[IovStackThreshold] : new Interop.Sys.IOVector[buffersCount]; 572fixed (Interop.Sys.IOVector* iov = iovecs) 574int cmsgBufferLen = Interop.Sys.GetControlMessageBufferSize(Convert.ToInt32(isIPv4), Convert.ToInt32(isIPv6)); 577var messageHeader = new Interop.Sys.MessageHeader 588errno = Interop.Sys.ReceiveMessage( 597if (errno == Interop.Error.SUCCESS) 629Interop.Error errno; 635errno = Interop.Sys.Accept(socket, rawSocketAddress, &sockAddrLen, &fd); 648if (errno == Interop.Error.SUCCESS) 659if (errno != Interop.Error.EAGAIN && errno != Interop.Error.EWOULDBLOCK) 682Interop.Error err; 688err = Interop.Sys.Connectx(socket, rawSocketAddress, socketAddress.Length, data, data.Length, tfo ? 1 : 0, &sentBytes); 693err = Interop.Sys.Connect(socket, rawSocketAddress, socketAddress.Length); 697if (err == Interop.Error.SUCCESS) 703if (err != Interop.Error.EINPROGRESS) 715Interop.Error socketError = default; 716Interop.Error err; 724Interop.PollEvents outEvents; 725err = Interop.Sys.Poll(socket, Interop.PollEvents.POLLOUT, timeout: 0, out outEvents); 726if (err == Interop.Error.SUCCESS) 728if (outEvents == Interop.PollEvents.POLLNONE) 730socketError = Interop.Error.EINPROGRESS; 734err = Interop.Sys.GetSocketErrorOption(socket, &socketError); 745if (err != Interop.Error.SUCCESS) 747Debug.Assert(err == Interop.Error.EBADF, $"Unexpected err: {err}"); 752if (socketError == Interop.Error.SUCCESS) 757else if (socketError == Interop.Error.EINPROGRESS) 777Interop.Error errno; 814if (errno != Interop.Error.EAGAIN && errno != Interop.Error.EWOULDBLOCK) 836Interop.Error errno; 883if (errno != Interop.Error.EAGAIN && errno != Interop.Error.EWOULDBLOCK) 907Interop.Error errno; 928if (errno != Interop.Error.EAGAIN && errno != Interop.Error.EWOULDBLOCK) 975Interop.Error errno; 1001if (!successfulSend && errno != Interop.Error.EAGAIN && errno != Interop.Error.EWOULDBLOCK) 1041Interop.Error errno; 1054if (errno != Interop.Error.SUCCESS) 1056if (errno != Interop.Error.EAGAIN && errno != Interop.Error.EWOULDBLOCK) 1085Interop.Error err = Interop.Sys.GetSockName(handle, buffer, nameLen); 1086return err == Interop.Error.SUCCESS ? SocketError.Success : GetSocketErrorForErrorCode(err); 1092Interop.Error err = Interop.Sys.GetBytesAvailable(handle, &value); 1095return err == Interop.Error.SUCCESS ? SocketError.Success : GetSocketErrorForErrorCode(err); 1101Interop.Error err = Interop.Sys.GetAtOutOfBandMark(handle, &value); 1104return err == Interop.Error.SUCCESS ? SocketError.Success : GetSocketErrorForErrorCode(err); 1109Interop.Error err; 1113err = Interop.Sys.GetPeerName(handle, rawBuffer, &addrLen); 1117return err == Interop.Error.SUCCESS ? SocketError.Success : GetSocketErrorForErrorCode(err); 1122Interop.Error err = Interop.Sys.Bind(handle, socketProtocolType, buffer); 1124return err == Interop.Error.SUCCESS ? SocketError.Success : GetSocketErrorForErrorCode(err); 1129Interop.Error err = Interop.Sys.Listen(handle, backlog); 1130return err == Interop.Error.SUCCESS ? SocketError.Success : GetSocketErrorForErrorCode(err); 1421private static SocketError GetErrorAndTrackSetting(SafeSocketHandle handle, SocketOptionLevel optionLevel, SocketOptionName optionName, Interop.Error err) 1423if (err == Interop.Error.SUCCESS) 1433Interop.Error err; 1440err = Interop.Sys.SetReceiveTimeout(handle, optionValue); 1446err = Interop.Sys.SetSendTimeout(handle, optionValue); 1459var opt = new Interop.Sys.IPv4MulticastOption 1466err = Interop.Sys.SetIPv4MulticastOption(handle, Interop.Sys.MulticastOption.MULTICAST_IF, &opt); 1472err = Interop.Sys.SetSockOpt(handle, optionLevel, optionName, (byte*)&optionValue, sizeof(int)); 1474if (err == Interop.Error.SUCCESS) 1506Interop.Error err = Interop.Sys.SetSockOpt(handle, optionLevel, optionName, pinnedValue, optionValue != null ? optionValue.Length : 0); 1515Interop.Error err = Interop.Sys.SetRawSockOpt(handle, optionLevel, optionName, optionValuePtr, optionValue.Length); 1517if (err == Interop.Error.SUCCESS) 1536Interop.Sys.MulticastOption optName = optionName == SocketOptionName.AddMembership ? 1537Interop.Sys.MulticastOption.MULTICAST_ADD : 1538Interop.Sys.MulticastOption.MULTICAST_DROP; 1543var opt = new Interop.Sys.IPv4MulticastOption 1551Interop.Error err = Interop.Sys.SetIPv4MulticastOption(handle, optName, &opt); 1559Interop.Sys.MulticastOption optName = optionName == SocketOptionName.AddMembership ? 1560Interop.Sys.MulticastOption.MULTICAST_ADD : 1561Interop.Sys.MulticastOption.MULTICAST_DROP; 1563var opt = new Interop.Sys.IPv6MulticastOption { 1568Interop.Error err = Interop.Sys.SetIPv6MulticastOption(handle, optName, &opt); 1574var opt = new Interop.Sys.LingerOption { 1579Interop.Error err = Interop.Sys.SetLingerOption(handle, &opt); 1618Interop.Error socketError = default(Interop.Error); 1619Interop.Error getErrorError = Interop.Sys.GetSocketErrorOption(handle, &socketError); 1621return getErrorError == Interop.Error.SUCCESS ? SocketError.Success : GetSocketErrorForErrorCode(getErrorError); 1626Interop.Error err = Interop.Sys.GetSockOpt(handle, optionLevel, optionName, (byte*)&value, &optLen); 1640return err == Interop.Error.SUCCESS ? SocketError.Success : GetSocketErrorForErrorCode(err); 1647Interop.Error err; 1651err = Interop.Sys.GetSockOpt(handle, optionLevel, optionName, null, &optLen); 1671err = Interop.Sys.GetSockOpt(handle, optionLevel, optionName, pinnedValue, &optLen); 1675if (err == Interop.Error.SUCCESS) 1691Interop.Error err = Interop.Sys.GetRawSockOpt(handle, optionLevel, optionName, pinnedValue, &optLen); 1693if (err == Interop.Error.SUCCESS) 1707Interop.Sys.MulticastOption optName = optionName == SocketOptionName.AddMembership ? 1708Interop.Sys.MulticastOption.MULTICAST_ADD : 1709Interop.Sys.MulticastOption.MULTICAST_DROP; 1711Interop.Sys.IPv4MulticastOption opt = default; 1712Interop.Error err = Interop.Sys.GetIPv4MulticastOption(handle, optName, &opt); 1713if (err != Interop.Error.SUCCESS) 1732Interop.Sys.MulticastOption optName = optionName == SocketOptionName.AddMembership ? 1733Interop.Sys.MulticastOption.MULTICAST_ADD : 1734Interop.Sys.MulticastOption.MULTICAST_DROP; 1736Interop.Sys.IPv6MulticastOption opt = default; 1737Interop.Error err = Interop.Sys.GetIPv6MulticastOption(handle, optName, &opt); 1738if (err != Interop.Error.SUCCESS) 1750Interop.Sys.LingerOption opt = default; 1751Interop.Error err = Interop.Sys.GetLingerOption(handle, &opt); 1752if (err != Interop.Error.SUCCESS) 1764Interop.PollEvents inEvent = Interop.PollEvents.POLLNONE; 1767case SelectMode.SelectRead: inEvent = Interop.PollEvents.POLLIN; break; 1768case SelectMode.SelectWrite: inEvent = Interop.PollEvents.POLLOUT; break; 1769case SelectMode.SelectError: inEvent = Interop.PollEvents.POLLPRI; break; 1774Interop.PollEvents outEvents; 1775Interop.Error err = Interop.Sys.Poll(handle, inEvent, milliseconds, out outEvents); 1776if (err != Interop.Error.SUCCESS) 1784case SelectMode.SelectRead: status = (outEvents & (Interop.PollEvents.POLLIN | Interop.PollEvents.POLLHUP)) != 0; break; 1785case SelectMode.SelectWrite: status = (outEvents & Interop.PollEvents.POLLOUT) != 0; break; 1786case SelectMode.SelectError: status = (outEvents & (Interop.PollEvents.POLLERR | Interop.PollEvents.POLLPRI)) != 0; break; 1814Interop.PollEvent* eventsOnStack = stackalloc Interop.PollEvent[count]; 1823var eventsOnHeap = new Interop.PollEvent[count]; 1824fixed (Interop.PollEvent* eventsOnHeapPtr = &eventsOnHeap[0]) 1851Interop.Error err = Interop.Sys.Select(readFDs, readFDs.Length, writeFDs, writeFDs.Length, errorFDs, errorFDs.Length, microseconds, maxFd, out triggered); 1852if (err != Interop.Error.SUCCESS) 1936Interop.PollEvent* events, int eventsLength, 1947AddToPollArray(events, eventsLength, checkRead, ref offset, Interop.PollEvents.POLLIN | Interop.PollEvents.POLLHUP, ref refsAdded); 1948AddToPollArray(events, eventsLength, checkWrite, ref offset, Interop.PollEvents.POLLOUT, ref refsAdded); 1949AddToPollArray(events, eventsLength, checkError, ref offset, Interop.PollEvents.POLLPRI, ref refsAdded); 1956Interop.Error err = Interop.Sys.Poll(events, (uint)eventsLength, milliseconds, &triggered); 1957if (err != Interop.Error.SUCCESS) 1975FilterPollList(checkRead, events, checkReadInitialCount - 1, Interop.PollEvents.POLLIN | Interop.PollEvents.POLLHUP, ref refsAdded); 1976FilterPollList(checkWrite, events, checkWriteInitialCount + checkReadInitialCount - 1, Interop.PollEvents.POLLOUT, ref refsAdded); 1977FilterPollList(checkError, events, checkErrorInitialCount + checkWriteInitialCount + checkReadInitialCount - 1, Interop.PollEvents.POLLERR | Interop.PollEvents.POLLPRI, ref refsAdded); 1993private static unsafe void AddToPollArray(Interop.PollEvent* arr, int arrLength, IList? socketList, ref int arrOffset, Interop.PollEvents events, ref int refsAdded) 2013arr[arrOffset++] = new Interop.PollEvent { Events = events, FileDescriptor = fd }; 2018private static unsafe void FilterPollList(IList? socketList, Interop.PollEvent* arr, int arrEndOffset, Interop.PollEvents desiredEvents, ref int refsAdded) 2051Interop.Error err = Interop.Sys.Shutdown(handle, how); 2052if (err == Interop.Error.SUCCESS) 2061if (err == Interop.Error.ENOTCONN && (isConnected || isDisconnected)) 2177Interop.Error err = Interop.Sys.Poll(handle, Interop.PollEvents.POLLOUT, timeout: 0, out Interop.PollEvents outEvents); 2178if (err != Interop.Error.SUCCESS) 2184if ((outEvents & Interop.PollEvents.POLLOUT) == 0)
System\Net\Sockets\UnixDomainSocketEndPoint.Unix.cs (1)
24Interop.Sys.GetDomainSocketSizes(pathOffset, pathLength, addressSize);