MCPcopy Create free account
hub / github.com/F-Stack/f-stack / rctl_read_inbuf

Function rctl_read_inbuf

freebsd/kern/kern_rctl.c:1539–1562  ·  view source on GitHub ↗

* Routine used by RCTL syscalls to read in input string. */

Source from the content-addressed store, hash-verified

1537 * Routine used by RCTL syscalls to read in input string.
1538 */
1539static int
1540rctl_read_inbuf(char **inputstr, const char *inbufp, size_t inbuflen)
1541{
1542 char *str;
1543 int error;
1544
1545 ASSERT_RACCT_ENABLED();
1546
1547 if (inbuflen <= 0)
1548 return (EINVAL);
1549 if (inbuflen > RCTL_MAX_INBUFSIZE)
1550 return (E2BIG);
1551
1552 str = malloc(inbuflen + 1, M_RCTL, M_WAITOK);
1553 error = copyinstr(inbufp, str, inbuflen, NULL);
1554 if (error != 0) {
1555 free(str, M_RCTL);
1556 return (error);
1557 }
1558
1559 *inputstr = str;
1560
1561 return (0);
1562}
1563
1564/*
1565 * Routine used by RCTL syscalls to write out output string.

Callers 5

sys_rctl_get_racctFunction · 0.85
sys_rctl_get_rulesFunction · 0.85
sys_rctl_get_limitsFunction · 0.85
sys_rctl_add_ruleFunction · 0.85
sys_rctl_remove_ruleFunction · 0.85

Calls 3

mallocFunction · 0.85
freeFunction · 0.70
copyinstrFunction · 0.50

Tested by

no test coverage detected