Ticket #257: socket.h.diff

File socket.h.diff, 2.4 KB (added by psmedley, 13 years ago)

sys/socket.h diff

  • socket.h

    old new  
    6363 */
    6464
    6565/*
     66 * Data types.
     67 */
     68#if __BSD_VISIBLE
     69#ifndef _GID_T_DECLARED
     70typedef __gid_t         gid_t;
     71#define _GID_T_DECLARED
     72#endif
     73
     74#ifndef _OFF_T_DECLARED
     75typedef __off_t         off_t;
     76#define _OFF_T_DECLARED
     77#endif
     78
     79#ifndef _PID_T_DECLARED
     80typedef __pid_t         pid_t;
     81#define _PID_T_DECLARED
     82#endif
     83#endif
     84
     85#ifndef _SA_FAMILY_T_DECLARED
     86typedef __sa_family_t   sa_family_t;
     87#define _SA_FAMILY_T_DECLARED
     88#endif
     89
     90#ifndef _SOCKLEN_T_DECLARED
     91typedef __socklen_t     socklen_t;
     92#define _SOCKLEN_T_DECLARED
     93#endif
     94 
     95#ifndef _SSIZE_T_DECLARED
     96typedef __ssize_t       ssize_t;
     97#define _SSIZE_T_DECLARED
     98#endif
     99
     100#if __BSD_VISIBLE
     101#ifndef _UID_T_DECLARED
     102typedef __uid_t         uid_t;
     103#define _UID_T_DECLARED
     104#endif
     105#endif
     106
     107/*
    66108 * Types
    67109 */
    68110#define SOCK_STREAM     1               /* stream socket */
     
    205247};
    206248
    207249/*
     250 * RFC 2553: protocol-independent placeholder for socket addresses
     251 */
     252#define _SS_MAXSIZE     128U
     253#define _SS_ALIGNSIZE   (sizeof(__int64_t))
     254#define _SS_PAD1SIZE    (_SS_ALIGNSIZE - sizeof(unsigned char) - \
     255                             sizeof(sa_family_t))
     256#define _SS_PAD2SIZE    (_SS_MAXSIZE - sizeof(unsigned char) - \
     257                             sizeof(sa_family_t) - _SS_PAD1SIZE - _SS_ALIGNSIZE)
     258 
     259struct sockaddr_storage {
     260         unsigned char   ss_len;         /* address length */
     261         sa_family_t     ss_family;      /* address family */
     262         char            __ss_pad1[_SS_PAD1SIZE];
     263         __int64_t       __ss_align;     /* force desired struct alignment */
     264         char            __ss_pad2[_SS_PAD2SIZE];
     265};
     266
     267/*
    208268 * Protocol families, same as address families for now.
    209269 */
    210270#define PF_UNSPEC       AF_UNSPEC
     
    391451
    392452#define CMSG_FIRSTHDR(mhdr)     ((struct cmsghdr *)(mhdr)->msg_control)
    393453
     454#if __BSD_VISIBLE
     455/* RFC 2292 additions */
     456#define CMSG_SPACE(l)           (_ALIGN(sizeof(struct cmsghdr)) + _ALIGN(l))
     457#define CMSG_LEN(l)             (_ALIGN(sizeof(struct cmsghdr)) + (l))
     458#endif
     459
     460#ifdef _KERNEL
     461#define CMSG_ALIGN(n)   _ALIGN(n)
     462#endif
     463
    394464/* "Socket"-level control message types: */
    395465#define SCM_RIGHTS      0x01            /* access rights (array of int) */
    396466