github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/sys/netbsd/socket_unix.txt (about) 1 # Copyright 2017 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 <stddef.h> 7 include <sys/types.h> 8 include <sys/socket.h> 9 include <netinet/in.h> 10 include <compat/linux/common/linux_socket.h> 11 12 resource sock_unix[sock] 13 14 socket$unix(domain const[AF_UNIX], type flags[unix_socket_type], proto const[0]) sock_unix 15 socketpair$unix(domain const[AF_UNIX], type flags[unix_socket_type], proto const[0], fds ptr[out, unix_pair]) 16 bind$unix(fd sock_unix, addr ptr[in, sockaddr_un], addrlen len[addr]) 17 connect$unix(fd sock_unix, addr ptr[in, sockaddr_un], addrlen len[addr]) 18 accept$unix(fd sock_unix, peer ptr[out, sockaddr_un, opt], peerlen ptr[inout, len[peer, int32]]) sock_unix 19 20 sendto$unix(fd sock_unix, buf buffer[in], len len[buf], f flags[send_flags], addr ptr[in, sockaddr_un, opt], addrlen len[addr]) 21 sendmsg$unix(fd sock_unix, msg ptr[in, msghdr_un], f flags[send_flags]) 22 recvfrom$unix(fd sock_unix, buf buffer[out], len len[buf], f flags[recv_flags], addr ptr[in, sockaddr_un, opt], addrlen len[addr]) 23 getsockname$unix(fd sock_unix, addr ptr[out, sockaddr_un], addrlen ptr[inout, len[addr, int32]]) 24 getpeername$unix(fd sock_unix, peer ptr[out, sockaddr_un], peerlen ptr[inout, len[peer, int32]]) 25 26 unix_socket_type = SOCK_STREAM, SOCK_DGRAM, SOCK_SEQPACKET 27 unix_socket_family = AF_UNIX, AF_UNSPEC 28 29 unix_pair { 30 fd0 sock_unix 31 fd1 sock_unix 32 } 33 34 sockaddr_un [ 35 file sockaddr_un_file 36 abs sockaddr_un_abstract 37 ] [varlen] 38 39 sockaddr_un_file { 40 family flags[unix_socket_family, int16] 41 path filename 42 } [packed] 43 44 sockaddr_un_abstract { 45 family flags[unix_socket_family, int16] 46 ind const[0, int8] 47 id proc[20000, 4, int32] 48 } 49 50 msghdr_un { 51 addr ptr[in, sockaddr_un] 52 addrlen len[addr, int32] 53 vec ptr[in, array[iovec_in]] 54 vlen len[vec, intptr] 55 ctrl ptr[in, array[cmsghdr_un], opt] 56 ctrllen bytesize[ctrl, intptr] 57 f flags[send_flags, int32] 58 } 59 60 cmsghdr_un [ 61 rights cmsghdr_un_rights 62 cred cmsghdr_un_cred 63 ] [varlen] 64 65 cmsghdr_un_rights { 66 len len[parent, intptr] 67 level const[SOL_SOCKET, int32] 68 type const[SCM_RIGHTS, int32] 69 fds array[fd] 70 } [align[PTR_SIZE]] 71 72 cmsghdr_un_cred { 73 len len[parent, intptr] 74 level const[SOL_SOCKET, int32] 75 type const[LINUX_SCM_CREDENTIALS, int32] 76 pid pid 77 uid uid 78 gid gid 79 } [align[PTR_SIZE]]