| 1586 | } |
| 1587 | |
| 1588 | static struct sbuf * |
| 1589 | rctl_racct_to_sbuf(struct racct *racct, int sloppy) |
| 1590 | { |
| 1591 | struct sbuf *sb; |
| 1592 | int64_t amount; |
| 1593 | int i; |
| 1594 | |
| 1595 | ASSERT_RACCT_ENABLED(); |
| 1596 | |
| 1597 | sb = sbuf_new_auto(); |
| 1598 | for (i = 0; i <= RACCT_MAX; i++) { |
| 1599 | if (sloppy == 0 && RACCT_IS_SLOPPY(i)) |
| 1600 | continue; |
| 1601 | RACCT_LOCK(); |
| 1602 | amount = racct->r_resources[i]; |
| 1603 | RACCT_UNLOCK(); |
| 1604 | if (RACCT_IS_IN_MILLIONS(i)) |
| 1605 | amount /= 1000000; |
| 1606 | sbuf_printf(sb, "%s=%jd,", rctl_resource_name(i), amount); |
| 1607 | } |
| 1608 | sbuf_setpos(sb, sbuf_len(sb) - 1); |
| 1609 | return (sb); |
| 1610 | } |
| 1611 | |
| 1612 | int |
| 1613 | sys_rctl_get_racct(struct thread *td, struct rctl_get_racct_args *uap) |
no test coverage detected