AUPARSE_FLUSH_FEED(3)

πŸ’… AUPARSE_FLUSH_FEED ✨

okay bestie, welcome to the auparse_flush_feed(3) page β€” it's part of the Linux Audit API and it's genuinely one of those little functions that saves your whole pipeline, no cap 🫢


🌸 NAME 🌸

auparse_flush_feed β€” flush any unconsumed feed data through the parser, fr fr


✨ SYNOPSIS ✨

#include <auparse.h>

int auparse_flush_feed(auparse_state_t *au);"

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so here's the tea β˜• β€” you call auparse_flush_feed when you're done feeding input data, and it signals "that's it, that's the whole feed" to the parsing system and flushes any pending parse data on through. it's giving closing time at the club πŸ’…

the way that you must call auparse_add_callback() before flushing feed data, because complete events need a consumer β€” no callback means nobody's catching the events and that's just sad 😭

malformed feed records? rejected, periodt. they do not get passed to the callback, nope, not today πŸ™ˆ

and if malformed records are found, parsing continues for the rest of the available feed data before auparse_flush_feed returns an error. so it doesn't rage-quit halfway, it finishes the job first πŸ”₯


πŸ’– RETURN VALUE πŸ’–

  • returns -1 if an error occurs; otherwise 0 for success, slay βœ…
  • when -1 comes back, errno is set to indicate the error
  • the value of errno is meaningful only after an error return β€” callers should not assume it is cleared after a successful call πŸ‘‘
  • applications that may run with libauparse from before audit-4.1.5 should set errno to 0 before calling auparse_flush_feed
  • if auparse_flush_feed returns -1 and errno is still 0, the runtime library is using the older error behavior and did not set errno
  • clearing errno first avoids treating a pre-existing value as if it were set by auparse_flush_feed β€” like, don't blame the function for an errno it never touched, that's not fair bestie πŸ₯Ί
⚠️ seriously though, that errno-clearing thing is not a vibe check you want to fail. set it to 0 first if you might be on old libauparse. it's lowkey important.

🌈 ERRORS 🌈

  • EINVAL β€” the parser state is invalid, the parser was not initialized with AUSOURCE_FEED, or no callback has been registered. basically something's missing and the parser is like "who? what? where?" πŸ’€
  • ENOMEM β€” memory allocation failed while parsing feed data. the malloc said "no ❀️"
  • EBADMSG β€” a malformed feed record was found. the malformed record was rejected and was not passed to the callback. parsing continues for the rest of the available feed data before this error is returned. so it still eats the whole plate before telling you one bite was weird πŸ“
  • EIO β€” an internal parser failure occurred without a more specific error code. it's giving mystery ✨ and not the fun kind

πŸŽ€ SEE ALSO πŸŽ€


πŸ‘‘ AUTHOR πŸ‘‘

John Dennis β€” icon behavior, honestly


okay bestie that's the whole page!! πŸ’œ this one's from the Linux Audit API, brought to you by Red Hat, dated Apr 2016, and it lives at AUPARSE_FLUSH_FEED(3) β€” go flush that feed and slay βœ¨πŸ¦‹πŸ’