github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/sys/darwin/socket_unix.txt (about)

     1  # Copyright 2021 syzkaller project authors. All rights reserved.
     2  # Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
     3  
     4  # AF_UNIX support.
     5  
     6  include <sys/types.h>
     7  include <sys/socket.h>
     8  include <netinet/in.h>
     9  
    10  resource sock_unix[sock]
    11  
    12  socket$unix(domain const[AF_UNIX], type flags[unix_socket_type], proto const[0]) sock_unix
    13  socketpair$unix(domain const[AF_UNIX], type flags[unix_socket_type], proto const[0], fds ptr[out, unix_pair])
    14  bind$unix(fd sock_unix, addr ptr[in, sockaddr_un], addrlen len[addr])
    15  connect$unix(fd sock_unix, addr ptr[in, sockaddr_un], addrlen len[addr])
    16  accept$unix(fd sock_unix, peer ptr[out, sockaddr_un, opt], peerlen ptr[inout, len[peer, int32]]) sock_unix
    17  
    18  sendto$unix(fd sock_unix, buf buffer[in], len len[buf], f flags[send_flags], addr ptr[in, sockaddr_un, opt], addrlen len[addr])
    19  recvfrom$unix(fd sock_unix, buf buffer[out], len len[buf], f flags[recv_flags], addr ptr[in, sockaddr_un, opt], addrlen len[addr])
    20  getsockname$unix(fd sock_unix, addr ptr[out, sockaddr_un], addrlen ptr[inout, len[addr, int32]])
    21  getpeername$unix(fd sock_unix, peer ptr[out, sockaddr_un], peerlen ptr[inout, len[peer, int32]])
    22  
    23  unix_socket_type = SOCK_STREAM, SOCK_DGRAM, SOCK_SEQPACKET
    24  unix_socket_family = AF_UNIX, AF_UNSPEC
    25  
    26  unix_pair {
    27  	fd0	sock_unix
    28  	fd1	sock_unix
    29  }
    30  
    31  sockaddr_un [
    32  	file	sockaddr_un_file
    33  	abs	sockaddr_un_abstract
    34  ] [varlen]
    35  
    36  sockaddr_un_file {
    37  	len	len[parent, int8]
    38  	family	flags[unix_socket_family, int8]
    39  	path	filename
    40  } [packed]
    41  
    42  sockaddr_un_abstract {
    43  	len	len[parent, int8]
    44  	family	flags[unix_socket_family, int8]
    45  	ind	const[0, int8]
    46  	id	proc[20000, 4, int32]
    47  }