The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/compat/linux/linux_socket.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * Copyright (c) 2000 Assar Westerlund
    3  * All rights reserved.
    4  *
    5  * Redistribution and use in source and binary forms, with or without
    6  * modification, are permitted provided that the following conditions
    7  * are met:
    8  * 1. Redistributions of source code must retain the above copyright
    9  *    notice, this list of conditions and the following disclaimer 
   10  *    in this position and unchanged.
   11  * 2. Redistributions in binary form must reproduce the above copyright
   12  *    notice, this list of conditions and the following disclaimer in the
   13  *    documentation and/or other materials provided with the distribution.
   14  * 3. The name of the author may not be used to endorse or promote products
   15  *    derived from this software without specific prior written permission
   16  *
   17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
   18  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   19  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   20  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
   21  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
   22  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   26  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   27  *
   28  * $FreeBSD: releng/11.2/sys/compat/linux/linux_socket.h 316970 2017-04-15 15:38:15Z dchagin $
   29  */
   30 
   31 #ifndef _LINUX_SOCKET_H_
   32 #define _LINUX_SOCKET_H_
   33 
   34 /* msg flags in recvfrom/recvmsg */
   35 
   36 #define LINUX_MSG_OOB           0x01
   37 #define LINUX_MSG_PEEK          0x02
   38 #define LINUX_MSG_DONTROUTE     0x04
   39 #define LINUX_MSG_CTRUNC        0x08
   40 #define LINUX_MSG_PROXY         0x10
   41 #define LINUX_MSG_TRUNC         0x20
   42 #define LINUX_MSG_DONTWAIT      0x40
   43 #define LINUX_MSG_EOR           0x80
   44 #define LINUX_MSG_WAITALL       0x100
   45 #define LINUX_MSG_FIN           0x200
   46 #define LINUX_MSG_SYN           0x400
   47 #define LINUX_MSG_CONFIRM       0x800
   48 #define LINUX_MSG_RST           0x1000
   49 #define LINUX_MSG_ERRQUEUE      0x2000
   50 #define LINUX_MSG_NOSIGNAL      0x4000
   51 #define LINUX_MSG_WAITFORONE    0x10000
   52 #define LINUX_MSG_CMSG_CLOEXEC  0x40000000
   53 
   54 /* Socket-level control message types */
   55 
   56 #define LINUX_SCM_RIGHTS        0x01
   57 #define LINUX_SCM_CREDENTIALS   0x02
   58 #define LINUX_SCM_TIMESTAMP     0x1D
   59 
   60 struct l_msghdr {
   61         l_uintptr_t     msg_name;
   62         l_int           msg_namelen;
   63         l_uintptr_t     msg_iov;
   64         l_size_t        msg_iovlen;
   65         l_uintptr_t     msg_control;
   66         l_size_t        msg_controllen;
   67         l_uint          msg_flags;
   68 };
   69 
   70 struct l_mmsghdr {
   71         struct l_msghdr msg_hdr;
   72         l_uint          msg_len;
   73 
   74 };
   75 
   76 struct l_cmsghdr {
   77         l_size_t        cmsg_len;
   78         l_int           cmsg_level;
   79         l_int           cmsg_type;
   80 };
   81 
   82 /* Ancillary data object information macros */
   83 
   84 #define LINUX_CMSG_ALIGN(len)   roundup2(len, sizeof(l_ulong))
   85 #define LINUX_CMSG_DATA(cmsg)   ((void *)((char *)(cmsg) + \
   86                                     LINUX_CMSG_ALIGN(sizeof(struct l_cmsghdr))))
   87 #define LINUX_CMSG_SPACE(len)   (LINUX_CMSG_ALIGN(sizeof(struct l_cmsghdr)) + \
   88                                     LINUX_CMSG_ALIGN(len))
   89 #define LINUX_CMSG_LEN(len)     (LINUX_CMSG_ALIGN(sizeof(struct l_cmsghdr)) + \
   90                                     (len))
   91 #define LINUX_CMSG_FIRSTHDR(msg) \
   92                                 ((msg)->msg_controllen >= \
   93                                     sizeof(struct l_cmsghdr) ? \
   94                                     (struct l_cmsghdr *) \
   95                                         PTRIN((msg)->msg_control) : \
   96                                     (struct l_cmsghdr *)(NULL))
   97 #define LINUX_CMSG_NXTHDR(msg, cmsg) \
   98                                 ((((char *)(cmsg) + \
   99                                     LINUX_CMSG_ALIGN((cmsg)->cmsg_len) + \
  100                                     sizeof(*(cmsg))) > \
  101                                     (((char *)PTRIN((msg)->msg_control)) + \
  102                                     (msg)->msg_controllen)) ? \
  103                                     (struct l_cmsghdr *) NULL : \
  104                                     (struct l_cmsghdr *)((char *)(cmsg) + \
  105                                     LINUX_CMSG_ALIGN((cmsg)->cmsg_len)))
  106 
  107 #define CMSG_HDRSZ              CMSG_LEN(0)
  108 #define L_CMSG_HDRSZ            LINUX_CMSG_LEN(0)
  109 
  110 /* Supported address families */
  111 
  112 #define LINUX_AF_UNSPEC         0
  113 #define LINUX_AF_UNIX           1
  114 #define LINUX_AF_INET           2
  115 #define LINUX_AF_AX25           3
  116 #define LINUX_AF_IPX            4
  117 #define LINUX_AF_APPLETALK      5
  118 #define LINUX_AF_INET6          10
  119 
  120 /* Supported socket types */
  121 
  122 #define LINUX_SOCK_STREAM       1
  123 #define LINUX_SOCK_DGRAM        2
  124 #define LINUX_SOCK_RAW          3
  125 #define LINUX_SOCK_RDM          4
  126 #define LINUX_SOCK_SEQPACKET    5
  127 
  128 #define LINUX_SOCK_MAX          LINUX_SOCK_SEQPACKET
  129 
  130 #define LINUX_SOCK_TYPE_MASK    0xf
  131 
  132 /* Flags for socket, socketpair, accept4 */
  133 
  134 #define LINUX_SOCK_CLOEXEC      LINUX_O_CLOEXEC
  135 #define LINUX_SOCK_NONBLOCK     LINUX_O_NONBLOCK
  136 
  137 struct l_ucred {
  138         uint32_t        pid;
  139         uint32_t        uid;
  140         uint32_t        gid;
  141 };
  142 
  143 #if defined(__i386__) || (defined(__amd64__) && defined(COMPAT_LINUX32))
  144 struct linux_accept_args {
  145         register_t s;
  146         register_t addr;
  147         register_t namelen;
  148 };
  149 
  150 int linux_accept(struct thread *td, struct linux_accept_args *args);
  151 
  152 /* Operations for socketcall */
  153 #define LINUX_SOCKET            1
  154 #define LINUX_BIND              2
  155 #define LINUX_CONNECT           3
  156 #define LINUX_LISTEN            4
  157 #define LINUX_ACCEPT            5
  158 #define LINUX_GETSOCKNAME       6
  159 #define LINUX_GETPEERNAME       7
  160 #define LINUX_SOCKETPAIR        8
  161 #define LINUX_SEND              9
  162 #define LINUX_RECV              10
  163 #define LINUX_SENDTO            11
  164 #define LINUX_RECVFROM          12
  165 #define LINUX_SHUTDOWN          13
  166 #define LINUX_SETSOCKOPT        14
  167 #define LINUX_GETSOCKOPT        15
  168 #define LINUX_SENDMSG           16
  169 #define LINUX_RECVMSG           17
  170 #define LINUX_ACCEPT4           18
  171 #define LINUX_RECVMMSG          19
  172 #define LINUX_SENDMMSG          20
  173 #endif /* __i386__ || (__amd64__ && COMPAT_LINUX32) */
  174 
  175 /* Socket defines */
  176 #define LINUX_SOL_SOCKET        1
  177 #define LINUX_SOL_IP            0
  178 #define LINUX_SOL_TCP           6
  179 #define LINUX_SOL_UDP           17
  180 #define LINUX_SOL_IPV6          41
  181 #define LINUX_SOL_IPX           256
  182 #define LINUX_SOL_AX25          257
  183 
  184 #define LINUX_SO_DEBUG          1
  185 #define LINUX_SO_REUSEADDR      2
  186 #define LINUX_SO_TYPE           3
  187 #define LINUX_SO_ERROR          4
  188 #define LINUX_SO_DONTROUTE      5
  189 #define LINUX_SO_BROADCAST      6
  190 #define LINUX_SO_SNDBUF         7
  191 #define LINUX_SO_RCVBUF         8
  192 #define LINUX_SO_KEEPALIVE      9
  193 #define LINUX_SO_OOBINLINE      10
  194 #define LINUX_SO_NO_CHECK       11
  195 #define LINUX_SO_PRIORITY       12
  196 #define LINUX_SO_LINGER         13
  197 #ifndef LINUX_SO_PASSCRED       /* powerpc differs */
  198 #define LINUX_SO_PASSCRED       16
  199 #define LINUX_SO_PEERCRED       17
  200 #define LINUX_SO_RCVLOWAT       18
  201 #define LINUX_SO_SNDLOWAT       19
  202 #define LINUX_SO_RCVTIMEO       20
  203 #define LINUX_SO_SNDTIMEO       21
  204 #endif
  205 #define LINUX_SO_TIMESTAMP      29
  206 #define LINUX_SO_ACCEPTCONN     30
  207 
  208 /* Socket options */
  209 #define LINUX_IP_TOS            1
  210 #define LINUX_IP_TTL            2
  211 #define LINUX_IP_HDRINCL        3
  212 #define LINUX_IP_OPTIONS        4
  213 
  214 #define LINUX_IP_MULTICAST_IF           32
  215 #define LINUX_IP_MULTICAST_TTL          33
  216 #define LINUX_IP_MULTICAST_LOOP         34
  217 #define LINUX_IP_ADD_MEMBERSHIP         35
  218 #define LINUX_IP_DROP_MEMBERSHIP        36
  219 
  220 #define LINUX_IPV6_CHECKSUM             7
  221 #define LINUX_IPV6_NEXTHOP              9
  222 #define LINUX_IPV6_UNICAST_HOPS         16
  223 #define LINUX_IPV6_MULTICAST_IF         17
  224 #define LINUX_IPV6_MULTICAST_HOPS       18
  225 #define LINUX_IPV6_MULTICAST_LOOP       19
  226 #define LINUX_IPV6_ADD_MEMBERSHIP       20
  227 #define LINUX_IPV6_DROP_MEMBERSHIP      21
  228 #define LINUX_IPV6_V6ONLY               26
  229 
  230 #define LINUX_IPV6_RECVPKTINFO          49
  231 #define LINUX_IPV6_PKTINFO              50
  232 #define LINUX_IPV6_RECVHOPLIMIT         51
  233 #define LINUX_IPV6_HOPLIMIT             52
  234 #define LINUX_IPV6_RECVHOPOPTS          53
  235 #define LINUX_IPV6_HOPOPTS              54
  236 #define LINUX_IPV6_RTHDRDSTOPTS         55
  237 #define LINUX_IPV6_RECVRTHDR            56
  238 #define LINUX_IPV6_RTHDR                57
  239 #define LINUX_IPV6_RECVDSTOPTS          58
  240 #define LINUX_IPV6_DSTOPTS              59
  241 #define LINUX_IPV6_RECVPATHMTU          60
  242 #define LINUX_IPV6_PATHMTU              61
  243 #define LINUX_IPV6_DONTFRAG             62
  244 
  245 #define LINUX_TCP_NODELAY       1
  246 #define LINUX_TCP_MAXSEG        2
  247 #define LINUX_TCP_KEEPIDLE      4
  248 #define LINUX_TCP_KEEPINTVL     5
  249 #define LINUX_TCP_KEEPCNT       6
  250 #define LINUX_TCP_MD5SIG        14
  251 
  252 #endif /* _LINUX_SOCKET_H_ */

Cache object: 54c11842b1ab263194d26023ff1c8a83


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.