Print this page
OS-4602 lxbrand support recvmsg(MSG_PEEK|MSG_TRUNC) behavior
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Joshua M. Clulow <jmc@joyent.com>


 128         lloff_t         _uio_limit;     /* u-limit (maximum byte offset) */
 129         ssize_t         uio_resid;      /* residual count */
 130         /*
 131          * uioa extended members.
 132          */
 133         uint32_t        uioa_state;     /* state of asynch i/o */
 134         ssize_t         uioa_mbytes;    /* bytes that have been uioamove()ed */
 135         uioa_page_t     *uioa_lcur;     /* pointer into uioa_locked[] */
 136         void            **uioa_lppp;    /* pointer into lcur->uioa_ppp[] */
 137         void            *uioa_hwst[4];  /* opaque hardware state */
 138         uioa_page_t     uioa_locked[UIOA_IOV_MAX]; /* Per iov locked pages */
 139 } uioa_t;
 140 
 141 /*
 142  * uio extensions
 143  *
 144  * PSARC 2009/478: Copy Reduction Interfaces
 145  */
 146 typedef enum xuio_type {
 147         UIOTYPE_ASYNCIO,
 148         UIOTYPE_ZEROCOPY

 149 } xuio_type_t;
 150 
 151 typedef struct xuio {
 152         uio_t xu_uio;           /* Embedded UIO structure */
 153 
 154         /* Extended uio fields */
 155         enum xuio_type xu_type; /* What kind of uio structure? */
 156         union {
 157                 /* Async I/O Support, intend to replace uioa_t. */
 158                 struct {
 159                         uint32_t xu_a_state;    /* state of async i/o */
 160                         /* bytes that have been uioamove()ed */
 161                         ssize_t xu_a_mbytes;
 162                         uioa_page_t *xu_a_lcur; /* pointer into uioa_locked[] */
 163                         /* pointer into lcur->uioa_ppp[] */
 164                         void **xu_a_lppp;
 165                         void *xu_a_hwst[4];     /* opaque hardware state */
 166                         /* Per iov locked pages */
 167                         uioa_page_t xu_a_locked[UIOA_IOV_MAX];
 168                 } xu_aio;
 169 
 170                 /*
 171                  * Copy Reduction Support -- facilate loaning / returning of
 172                  * filesystem cache buffers.
 173                  */
 174                 struct {
 175                         int xu_zc_rw;   /* read or write buffer */
 176                         void *xu_zc_priv;       /* fs specific */
 177                 } xu_zc;









 178         } xu_ext;
 179 } xuio_t;
 180 
 181 #define XUIO_XUZC_PRIV(xuio)    xuio->xu_ext.xu_zc.xu_zc_priv
 182 #define XUIO_XUZC_RW(xuio)      xuio->xu_ext.xu_zc.xu_zc_rw
 183 
 184 #define UIOA_ALLOC      0x0001          /* allocated but not yet initialized */
 185 #define UIOA_INIT       0x0002          /* initialized but not yet enabled */
 186 #define UIOA_ENABLED    0x0004          /* enabled, asynch i/o active */
 187 #define UIOA_FINI       0x0008          /* finished waiting for uioafini() */
 188 
 189 #define UIOA_CLR        (~0x000F)       /* clear mutually exclusive bits */
 190 
 191 #define UIOA_POLL       0x0010          /* need dcopy_poll() */
 192 
 193 #define uio_loffset     _uio_offset._f
 194 #if !defined(_LP64)
 195 #define uio_offset      _uio_offset._p._l
 196 #else
 197 #define uio_offset      uio_loffset




 128         lloff_t         _uio_limit;     /* u-limit (maximum byte offset) */
 129         ssize_t         uio_resid;      /* residual count */
 130         /*
 131          * uioa extended members.
 132          */
 133         uint32_t        uioa_state;     /* state of asynch i/o */
 134         ssize_t         uioa_mbytes;    /* bytes that have been uioamove()ed */
 135         uioa_page_t     *uioa_lcur;     /* pointer into uioa_locked[] */
 136         void            **uioa_lppp;    /* pointer into lcur->uioa_ppp[] */
 137         void            *uioa_hwst[4];  /* opaque hardware state */
 138         uioa_page_t     uioa_locked[UIOA_IOV_MAX]; /* Per iov locked pages */
 139 } uioa_t;
 140 
 141 /*
 142  * uio extensions
 143  *
 144  * PSARC 2009/478: Copy Reduction Interfaces
 145  */
 146 typedef enum xuio_type {
 147         UIOTYPE_ASYNCIO,
 148         UIOTYPE_ZEROCOPY,
 149         UIOTYPE_PEEKSIZE
 150 } xuio_type_t;
 151 
 152 typedef struct xuio {
 153         uio_t xu_uio;           /* Embedded UIO structure */
 154 
 155         /* Extended uio fields */
 156         enum xuio_type xu_type; /* What kind of uio structure? */
 157         union {
 158                 /* Async I/O Support, intend to replace uioa_t. */
 159                 struct {
 160                         uint32_t xu_a_state;    /* state of async i/o */
 161                         /* bytes that have been uioamove()ed */
 162                         ssize_t xu_a_mbytes;
 163                         uioa_page_t *xu_a_lcur; /* pointer into uioa_locked[] */
 164                         /* pointer into lcur->uioa_ppp[] */
 165                         void **xu_a_lppp;
 166                         void *xu_a_hwst[4];     /* opaque hardware state */
 167                         /* Per iov locked pages */
 168                         uioa_page_t xu_a_locked[UIOA_IOV_MAX];
 169                 } xu_aio;
 170 
 171                 /*
 172                  * Copy Reduction Support -- facilate loaning / returning of
 173                  * filesystem cache buffers.
 174                  */
 175                 struct {
 176                         int xu_zc_rw;   /* read or write buffer */
 177                         void *xu_zc_priv;       /* fs specific */
 178                 } xu_zc;
 179 
 180                 /*
 181                  * Peek Size Support -- facilitate peeking at the size of a
 182                  * waiting message on a socket.
 183                  */
 184                 struct {
 185                         ssize_t xu_ps_size;     /* size of waiting msg */
 186                         boolean_t xu_ps_set;    /* was size calculated? */
 187                 } xu_ps;
 188         } xu_ext;
 189 } xuio_t;
 190 
 191 #define XUIO_XUZC_PRIV(xuio)    xuio->xu_ext.xu_zc.xu_zc_priv
 192 #define XUIO_XUZC_RW(xuio)      xuio->xu_ext.xu_zc.xu_zc_rw
 193 
 194 #define UIOA_ALLOC      0x0001          /* allocated but not yet initialized */
 195 #define UIOA_INIT       0x0002          /* initialized but not yet enabled */
 196 #define UIOA_ENABLED    0x0004          /* enabled, asynch i/o active */
 197 #define UIOA_FINI       0x0008          /* finished waiting for uioafini() */
 198 
 199 #define UIOA_CLR        (~0x000F)       /* clear mutually exclusive bits */
 200 
 201 #define UIOA_POLL       0x0010          /* need dcopy_poll() */
 202 
 203 #define uio_loffset     _uio_offset._f
 204 #if !defined(_LP64)
 205 #define uio_offset      _uio_offset._p._l
 206 #else
 207 #define uio_offset      uio_loffset