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

Function sbuf_end_section

freebsd/kern/subr_sbuf.c:925–950  ·  view source on GitHub ↗

* End the section padding to the specified length with the specified * character. */

Source from the content-addressed store, hash-verified

923 * character.
924 */
925ssize_t
926sbuf_end_section(struct sbuf *s, ssize_t old_len, size_t pad, int c)
927{
928 ssize_t len;
929
930 assert_sbuf_integrity(s);
931 assert_sbuf_state(s, 0);
932 KASSERT(SBUF_ISSECTION(s),
933 ("attempt to end a section when not in a section"));
934
935 if (pad > 1) {
936 len = roundup(s->s_sect_len, pad) - s->s_sect_len;
937 for (; s->s_error == 0 && len > 0; len--)
938 sbuf_put_byte(s, c);
939 }
940 len = s->s_sect_len;
941 if (old_len == -1) {
942 s->s_rec_off = s->s_sect_len = 0;
943 SBUF_CLEARFLAG(s, SBUF_INSECTION);
944 } else {
945 s->s_sect_len += old_len;
946 }
947 if (s->s_error != 0)
948 return (-1);
949 return (len);
950}

Callers 3

__elfN(corehdr)Function · 0.85
__elfN(putnote)Function · 0.85
note_procstat_filesFunction · 0.85

Calls 1

sbuf_put_byteFunction · 0.85

Tested by

no test coverage detected