github.com/Andyfoo/golang/x/net@v0.0.0-20190901054642-57c1bf301704/internal/socket/defs_linux.go (about)

     1  // Copyright 2017 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // +build ignore
     6  
     7  // +godefs map struct_in_addr [4]byte /* in_addr */
     8  // +godefs map struct_in6_addr [16]byte /* in6_addr */
     9  
    10  package socket
    11  
    12  /*
    13  #include <linux/in.h>
    14  #include <linux/in6.h>
    15  
    16  #define _GNU_SOURCE
    17  #include <sys/socket.h>
    18  */
    19  import "C"
    20  
    21  type iovec C.struct_iovec
    22  
    23  type msghdr C.struct_msghdr
    24  
    25  type mmsghdr C.struct_mmsghdr
    26  
    27  type cmsghdr C.struct_cmsghdr
    28  
    29  type sockaddrInet C.struct_sockaddr_in
    30  
    31  type sockaddrInet6 C.struct_sockaddr_in6
    32  
    33  const (
    34  	sizeofIovec   = C.sizeof_struct_iovec
    35  	sizeofMsghdr  = C.sizeof_struct_msghdr
    36  	sizeofMmsghdr = C.sizeof_struct_mmsghdr
    37  	sizeofCmsghdr = C.sizeof_struct_cmsghdr
    38  
    39  	sizeofSockaddrInet  = C.sizeof_struct_sockaddr_in
    40  	sizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6
    41  )