177 references to Sys
System.Net.Sockets (177)
src\libraries\Common\src\Interop\Unix\Interop.Errors.cs (3)
123_error = Interop.Sys.ConvertErrorPlatformToPal(errno); 140get { return _rawErrno == -1 ? (_rawErrno = Interop.Sys.ConvertErrorPalToPlatform(_error)) : _rawErrno; } 145return Interop.Sys.StrError(RawErrno);
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 (9)
26Interop.Error err = Interop.Sys.GetSocketAddressSizes(&ipv4, &ipv6, &uds, &max); 66err = Interop.Sys.GetAddressFamily(rawAddress, buffer.Length, (int*)&family); 81err = Interop.Sys.SetAddressFamily(rawAddress, buffer.Length, (int)family); 94err = Interop.Sys.GetPort(rawAddress, buffer.Length, &port); 106err = Interop.Sys.SetPort(rawAddress, buffer.Length, port); 118err = Interop.Sys.GetIPv4Address(rawAddress, buffer.Length, &ipAddress); 132err = Interop.Sys.GetIPv6Address(rawAddress, buffer.Length, ipAddress, address.Length, &localScope); 144err = Interop.Sys.SetIPv4Address(rawAddress, buffer.Length, address); 170err = Interop.Sys.SetIPv6Address(rawAddress, buffer.Length, address, addressLength, scope);
src\libraries\Common\src\System\Net\SocketProtocolSupportPal.Unix.cs (2)
25Interop.Error result = Interop.Sys.Socket((int)af, DgramSocketType, 0, &socket); 33Interop.Sys.Close(socket);
System\Net\Sockets\SafeSocketHandle.Unix.cs (9)
199int fdFlags = Interop.Sys.Fcntl.GetFD(handle); 208Interop.Error err = Interop.Sys.GetSockOpt(handle, SocketOptionLevel.Socket, SocketOptionName.Type, (byte*)&type, &optLen); 215Interop.Sys.Disconnect(handle); 219Interop.Sys.Shutdown(handle, SocketShutdown.Both); 256if (Interop.Sys.Fcntl.DangerousSetIsNonBlocking(handle, 0) == 0) 266var linger = new Interop.Sys.LingerOption 272errorCode = Interop.Sys.SetLingerOption(handle, &linger); 298if (Interop.Sys.Close(handle) != 0) 300errorCode = Interop.Sys.GetLastError();
System\Net\Sockets\Socket.Unix.cs (7)
68Interop.Error e = Interop.Sys.GetSocketType(handle, out addressFamily, out socketType, out protocolType, out isListening); 77if (Interop.Sys.FStat(handle, out Interop.Sys.FileStatus stat) == -1) 81isSocket = (stat.Mode & Interop.Sys.FileTypes.S_IFSOCK) == Interop.Sys.FileTypes.S_IFSOCK; 91Interop.Error e = Interop.Sys.GetSocketType(handle, out addressFamily, out socketType, out protocolType, out isListening); 110int rv = Interop.Sys.Fcntl.GetIsNonBlocking(handle, out nonBlocking);
System\Net\Sockets\SocketAsyncContext.Unix.cs (23)
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 unsafe 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 (18)
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; 151error = Interop.Sys.TryChangeSocketEventRegistration(_port, socketHandle, Interop.Sys.SocketEvents.None, 152Interop.Sys.SocketEvents.Read | Interop.Sys.SocketEvents.Write, context.GlobalContextIndex); 187err = Interop.Sys.CreateSocketEventPort(portPtr); 194fixed (Interop.Sys.SocketEvent** bufferPtr = &_buffer) 196err = Interop.Sys.CreateSocketEventBuffer(EventBufferCount, bufferPtr); 225Interop.Error err = Interop.Sys.WaitForSocketEvents(_port, handler.Buffer, &numEvents); 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 (99)
19public static readonly int MaximumAddressSize = Interop.Sys.GetMaximumAddressSize(); 29Interop.Sys.PlatformSupportsDualModeIPv4PacketInfo() != 0; 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); 78error = Interop.Sys.SetSockOpt(fd, SocketOptionLevel.IPv6, SocketOptionName.IPv6Only, (byte*)&on, sizeof(int)); 81Interop.Sys.Close(fd); 113received = Interop.Sys.Read(handle, b, buffer.Length); 114errno = received != -1 ? Interop.Error.SUCCESS : Interop.Sys.GetLastError(); 128errno = Interop.Sys.Receive( 153var iov = new Interop.Sys.IOVector { 160var messageHeader = new Interop.Sys.MessageHeader { 167errno = Interop.Sys.ReceiveMessage( 193sent = Interop.Sys.Write(handle, b + offset, count); 196errno = Interop.Sys.GetLastError(); 223errno = Interop.Sys.Send( 251var iov = new Interop.Sys.IOVector 257var messageHeader = new Interop.Sys.MessageHeader 266errno = Interop.Sys.SendMessage( 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( 374errno = Interop.Sys.SendFile(socket, fileHandle, offset, count, out bytesSent); 396errno = Interop.Sys.GetBytesAvailable(socket, &available); 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( 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( 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( 635errno = Interop.Sys.Accept(socket, rawSocketAddress, &sockAddrLen, &fd); 688err = Interop.Sys.Connectx(socket, rawSocketAddress, socketAddress.Length, data, data.Length, tfo ? 1 : 0, &sentBytes); 693err = Interop.Sys.Connect(socket, rawSocketAddress, socketAddress.Length); 725err = Interop.Sys.Poll(socket, Interop.PollEvents.POLLOUT, timeout: 0, out outEvents); 734err = Interop.Sys.GetSocketErrorOption(socket, &socketError); 1085Interop.Error err = Interop.Sys.GetSockName(handle, buffer, nameLen); 1092Interop.Error err = Interop.Sys.GetBytesAvailable(handle, &value); 1101Interop.Error err = Interop.Sys.GetAtOutOfBandMark(handle, &value); 1113err = Interop.Sys.GetPeerName(handle, rawBuffer, &addrLen); 1122Interop.Error err = Interop.Sys.Bind(handle, socketProtocolType, buffer); 1129Interop.Error err = Interop.Sys.Listen(handle, backlog); 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)); 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); 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); 1619Interop.Error getErrorError = Interop.Sys.GetSocketErrorOption(handle, &socketError); 1626Interop.Error err = Interop.Sys.GetSockOpt(handle, optionLevel, optionName, (byte*)&value, &optLen); 1651err = Interop.Sys.GetSockOpt(handle, optionLevel, optionName, null, &optLen); 1671err = Interop.Sys.GetSockOpt(handle, optionLevel, optionName, pinnedValue, &optLen); 1691Interop.Error err = Interop.Sys.GetRawSockOpt(handle, optionLevel, optionName, pinnedValue, &optLen); 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); 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); 1750Interop.Sys.LingerOption opt = default; 1751Interop.Error err = Interop.Sys.GetLingerOption(handle, &opt); 1775Interop.Error err = Interop.Sys.Poll(handle, inEvent, milliseconds, out outEvents); 1851Interop.Error err = Interop.Sys.Select(readFDs, readFDs.Length, writeFDs, writeFDs.Length, errorFDs, errorFDs.Length, microseconds, maxFd, out triggered); 1956Interop.Error err = Interop.Sys.Poll(events, (uint)eventsLength, milliseconds, &triggered); 2051Interop.Error err = Interop.Sys.Shutdown(handle, how); 2177Interop.Error err = Interop.Sys.Poll(handle, Interop.PollEvents.POLLOUT, timeout: 0, out Interop.PollEvents outEvents);
System\Net\Sockets\UnixDomainSocketEndPoint.Unix.cs (1)
24Interop.Sys.GetDomainSocketSizes(pathOffset, pathLength, addressSize);