Print this page
XXX AVX procfs


1507         }
1508 
1509         pup->pr_tstamp = gethrtime();
1510         prgetusage(pnp->pr_common->prc_thread, pup);
1511 
1512         prunlock(pnp);
1513 
1514         prcvtusage(pup, upup);
1515 
1516         error = pr_uioread(upup, sizeof (prusage_t), uiop);
1517 out:
1518         kmem_free(pup, sizeof (*pup));
1519         kmem_free(upup, sizeof (*upup));
1520         return (error);
1521 }
1522 
1523 /* ARGSUSED */
1524 static int
1525 pr_read_xregs(prnode_t *pnp, uio_t *uiop)
1526 {
1527 #if defined(__sparc)
1528         proc_t *p;
1529         kthread_t *t;
1530         int error;
1531         char *xreg;
1532         size_t size;
1533 
1534         ASSERT(pnp->pr_type == PR_XREGS);
1535 
1536         xreg = kmem_zalloc(sizeof (prxregset_t), KM_SLEEP);
1537 
1538         if ((error = prlock(pnp, ZNO)) != 0)
1539                 goto out;
1540 
1541         p = pnp->pr_common->prc_proc;
1542         t = pnp->pr_common->prc_thread;
1543 
1544         size = prhasx(p)? prgetprxregsize(p) : 0;
1545         if (uiop->uio_offset >= size) {
1546                 prunlock(pnp);
1547                 goto out;
1548         }
1549 
1550         /* drop p->p_lock while (possibly) touching the stack */
1551         mutex_exit(&p->p_lock);
1552         prgetprxregs(ttolwp(t), xreg);
1553         mutex_enter(&p->p_lock);
1554         prunlock(pnp);
1555 
1556         error = pr_uioread(xreg, size, uiop);
1557 out:
1558         kmem_free(xreg, sizeof (prxregset_t));
1559         return (error);
1560 #else
1561         return (0);
1562 #endif
1563 }
1564 
1565 #if defined(__sparc)
1566 
1567 static int
1568 pr_read_gwindows(prnode_t *pnp, uio_t *uiop)
1569 {
1570         proc_t *p;
1571         kthread_t *t;
1572         gwindows_t *gwp;
1573         int error;
1574         size_t size;
1575 
1576         ASSERT(pnp->pr_type == PR_GWINDOWS);
1577 
1578         gwp = kmem_zalloc(sizeof (gwindows_t), KM_SLEEP);
1579 
1580         if ((error = prlock(pnp, ZNO)) != 0)
1581                 goto out;
1582 




1507         }
1508 
1509         pup->pr_tstamp = gethrtime();
1510         prgetusage(pnp->pr_common->prc_thread, pup);
1511 
1512         prunlock(pnp);
1513 
1514         prcvtusage(pup, upup);
1515 
1516         error = pr_uioread(upup, sizeof (prusage_t), uiop);
1517 out:
1518         kmem_free(pup, sizeof (*pup));
1519         kmem_free(upup, sizeof (*upup));
1520         return (error);
1521 }
1522 
1523 /* ARGSUSED */
1524 static int
1525 pr_read_xregs(prnode_t *pnp, uio_t *uiop)
1526 {

1527         proc_t *p;
1528         kthread_t *t;
1529         int error;
1530         char *xreg;
1531         size_t size;
1532 
1533         ASSERT(pnp->pr_type == PR_XREGS);
1534 
1535         xreg = kmem_zalloc(sizeof (prxregset_t), KM_SLEEP);
1536 
1537         if ((error = prlock(pnp, ZNO)) != 0)
1538                 goto out;
1539 
1540         p = pnp->pr_common->prc_proc;
1541         t = pnp->pr_common->prc_thread;
1542 
1543         size = prhasx(p)? prgetprxregsize(p) : 0;
1544         if (uiop->uio_offset >= size) {
1545                 prunlock(pnp);
1546                 goto out;
1547         }
1548 
1549         /* drop p->p_lock while (possibly) touching the stack */
1550         mutex_exit(&p->p_lock);
1551         prgetprxregs(ttolwp(t), xreg);
1552         mutex_enter(&p->p_lock);
1553         prunlock(pnp);
1554 
1555         error = pr_uioread(xreg, size, uiop);
1556 out:
1557         kmem_free(xreg, sizeof (prxregset_t));
1558         return (error);



1559 }
1560 
1561 #if defined(__sparc)
1562 
1563 static int
1564 pr_read_gwindows(prnode_t *pnp, uio_t *uiop)
1565 {
1566         proc_t *p;
1567         kthread_t *t;
1568         gwindows_t *gwp;
1569         int error;
1570         size_t size;
1571 
1572         ASSERT(pnp->pr_type == PR_GWINDOWS);
1573 
1574         gwp = kmem_zalloc(sizeof (gwindows_t), KM_SLEEP);
1575 
1576         if ((error = prlock(pnp, ZNO)) != 0)
1577                 goto out;
1578