Spec-Zone.ru › Homebrew

Module: OS::Mac::UNIXSocketExt::ClassMethods Private

Extended by:
T::Helpers
Defined in:
extend/os/mac/utils/socket.rb

This module is part of a private API. This module may only be used in the Homebrew/brew repository. Third parties should avoid using this module if possible, as it may be removed or changed without warning.

Instance Method Summary collapse

  • #sockaddr_un(path) ⇒ String private

Instance Method Details

#sockaddr_un(path) ⇒ String

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Parameters:

  • path (String)

Returns:

  • (String)


16
17
18
19
20
21
22
23
24
25
26
# File 'extend/os/mac/utils/socket.rb', line 16

def sockaddr_un(path)
  if path.bytesize > 252 # largest size that can fit into a single-byte length
    raise ArgumentError, "too long unix socket path (#{path.bytesize} bytes given but 252 bytes max)"
  end

  [
    path.bytesize + 3, # = length (1 byte) + family (1 byte) + path (variable) + null terminator (1 byte)
    1, # AF_UNIX
    path,
  ].pack("CCZ*")
end

© 2009–present Homebrew contributors
Licensed under the BSD 2-Clause License.
https://docs.brew.sh/rubydoc/OS/Mac/UNIXSocketExt/ClassMethods.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API