libtracefs: Have nonblock tracefs_cpu reads set errno EAGAIN

If ring buffer memory mapping is used, and nothing is available to read on
the buffer, and nonblock is set, still update errno to EAGAIN.

Also always return subbuf_size when any data was read, and zero out the
rest of the buffer just like the kernel would do.

Link: https://lore.kernel.org/linux-trace-devel/20240110030116.81837-4-rostedt@goodmis.org

Cc: Vincent Donnefort <vdonnefort@google.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
1 file changed