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

Function sbuf_setpos

freebsd/kern/subr_sbuf.c:331–350  ·  view source on GitHub ↗

* Set the sbuf's end position to an arbitrary value. * Effectively truncates the sbuf at the new position. */

Source from the content-addressed store, hash-verified

329 * Effectively truncates the sbuf at the new position.
330 */
331int
332sbuf_setpos(struct sbuf *s, ssize_t pos)
333{
334
335 assert_sbuf_integrity(s);
336 assert_sbuf_state(s, 0);
337
338 KASSERT(pos >= 0,
339 ("attempt to seek to a negative position (%jd)", (intmax_t)pos));
340 KASSERT(pos < s->s_size,
341 ("attempt to seek past end of sbuf (%jd >= %jd)",
342 (intmax_t)pos, (intmax_t)s->s_size));
343 KASSERT(!SBUF_ISSECTION(s),
344 ("attempt to seek when in a section"));
345
346 if (pos < 0 || pos > s->s_len)
347 return (-1);
348 s->s_len = pos;
349 return (0);
350}
351
352/*
353 * Drain into a counter. Counts amount of data without producing output.

Callers 6

mac_internal.hFile · 0.85
rctl_racct_to_sbufFunction · 0.85
sys_rctl_get_rulesFunction · 0.85
sys_rctl_get_limitsFunction · 0.85
vxlan_ftable_sysctl_dumpFunction · 0.85
vxlan_ftable_entry_dumpFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected