[PATCH] doc:kmsg: explictly state the return value in case of SEEK_CUR

From: Bruno Meneguele
Date: Thu Jul 09 2020 - 11:54:27 EST


The commit 625d3449788f ("Revert "kernel/printk: add kmsg SEEK_CUR
handling"") reverted a change done to the return value in case a SEEK_CUR
operation was performed for kmsg buffer based on the fact that different
userspace apps were handling the new return value (-ESPIPE) in different
ways, breaking them.

At the same time -ESPIPE was the wrong decision because kmsg /does support/
seek() but doesn't follow the "normal" behavior userspace is used to.
Because of that and also considering the time -EINVAL has been used, it was
decided to keep this way to avoid more userspace breakage.

This patch adds an official statement to the kmsg documentation pointing to
the current return value for SEEK_CUR, -EINVAL, thus userspace libraries and
apps can refer to it for a definitive guide on what to expected.

Signed-off-by: Bruno Meneguele <bmeneg@xxxxxxxxxx>
---
Documentation/ABI/testing/dev-kmsg | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/Documentation/ABI/testing/dev-kmsg b/Documentation/ABI/testing/dev-kmsg
index f307506eb54c..9bc854faaa79 100644
--- a/Documentation/ABI/testing/dev-kmsg
+++ b/Documentation/ABI/testing/dev-kmsg
@@ -56,6 +56,11 @@ Description: The /dev/kmsg character device node provides userspace access
seek after the last record available at the time
the last SYSLOG_ACTION_CLEAR was issued.

+ Considering that the seek operation is supported but has
+ special meaning to the device, any attempt to seek specific
+ positions on the buffer (i.e. using SEEK_CUR) results in an
+ -EINVAL error returned to userspace.
+
The output format consists of a prefix carrying the syslog
prefix including priority and facility, the 64 bit message
sequence number and the monotonic timestamp in microseconds,
--
2.26.2