Print this page
XXXX adding PID information to netstat output


1767 
1768 /*
1769  * Create a descriptor for the associated file and fill in the
1770  * attributes associated with it.
1771  *
1772  * Return 0 for success, -1 otherwise;
1773  */
1774 int
1775 door_insert(struct file *fp, door_desc_t *dp)
1776 {
1777         struct vnode *vp;
1778         int     fd;
1779         door_attr_t attributes = DOOR_DESCRIPTOR;
1780 
1781         ASSERT(MUTEX_NOT_HELD(&door_knob));
1782         if ((fd = ufalloc(0)) == -1)
1783                 return (-1);
1784         setf(fd, fp);
1785         dp->d_data.d_desc.d_descriptor = fd;
1786 






1787         /* Fill in the attributes */
1788         if (VOP_REALVP(fp->f_vnode, &vp, NULL))
1789                 vp = fp->f_vnode;
1790         if (vp && vp->v_type == VDOOR) {
1791                 if (VTOD(vp)->door_target == curproc)
1792                         attributes |= DOOR_LOCAL;
1793                 attributes |= VTOD(vp)->door_flags & DOOR_ATTR_MASK;
1794                 dp->d_data.d_desc.d_id = VTOD(vp)->door_index;
1795         }
1796         dp->d_attributes = attributes;
1797         return (0);
1798 }
1799 
1800 /*
1801  * Return an available thread for this server.  A NULL return value indicates
1802  * that either:
1803  *      The door has been revoked, or
1804  *      a signal was received.
1805  * The two conditions can be differentiated using DOOR_INVALID(dp).
1806  */




1767 
1768 /*
1769  * Create a descriptor for the associated file and fill in the
1770  * attributes associated with it.
1771  *
1772  * Return 0 for success, -1 otherwise;
1773  */
1774 int
1775 door_insert(struct file *fp, door_desc_t *dp)
1776 {
1777         struct vnode *vp;
1778         int     fd;
1779         door_attr_t attributes = DOOR_DESCRIPTOR;
1780 
1781         ASSERT(MUTEX_NOT_HELD(&door_knob));
1782         if ((fd = ufalloc(0)) == -1)
1783                 return (-1);
1784         setf(fd, fp);
1785         dp->d_data.d_desc.d_descriptor = fd;
1786 
1787         /* Add pid to the list associated with that descriptor. */
1788         if (fp->f_vnode != NULL)
1789                 (void) VOP_IOCTL(fp->f_vnode, F_ASSOCI_PID,
1790                     (intptr_t)curproc->p_pidp->pid_id, FKIOCTL, kcred, NULL,
1791                     NULL);
1792 
1793         /* Fill in the attributes */
1794         if (VOP_REALVP(fp->f_vnode, &vp, NULL))
1795                 vp = fp->f_vnode;
1796         if (vp && vp->v_type == VDOOR) {
1797                 if (VTOD(vp)->door_target == curproc)
1798                         attributes |= DOOR_LOCAL;
1799                 attributes |= VTOD(vp)->door_flags & DOOR_ATTR_MASK;
1800                 dp->d_data.d_desc.d_id = VTOD(vp)->door_index;
1801         }
1802         dp->d_attributes = attributes;
1803         return (0);
1804 }
1805 
1806 /*
1807  * Return an available thread for this server.  A NULL return value indicates
1808  * that either:
1809  *      The door has been revoked, or
1810  *      a signal was received.
1811  * The two conditions can be differentiated using DOOR_INVALID(dp).
1812  */