This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 166b020283e153c67487695ea38ba202afe798bb
Author: yezhonghui <[email protected]>
AuthorDate: Tue Apr 7 10:45:58 2026 +0800

    drivers/syslog: add PIPEIOC_GETSIZE ioctl to ramlog driver
    
    Add PIPEIOC_GETSIZE ioctl support to ramlog driver so that
    userspace consumers can query the circular buffer size at
    runtime instead of relying on compile-time CONFIG macros.
    
    The size is written to the unsigned int that arg points to.
    
    Signed-off-by: yezhonghui <[email protected]>
---
 drivers/syslog/ramlog.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/syslog/ramlog.c b/drivers/syslog/ramlog.c
index 33f0b8c694b..74e2af67ef0 100644
--- a/drivers/syslog/ramlog.c
+++ b/drivers/syslog/ramlog.c
@@ -631,6 +631,16 @@ static int ramlog_file_ioctl(FAR struct file *filep, int 
cmd,
       case PIPEIOC_POLLINTHRD:
         upriv->rl_threashold = (uint32_t)arg;
         break;
+      case PIPEIOC_GETSIZE:
+        if (arg == 0)
+          {
+            ret = -EINVAL;
+          }
+        else
+          {
+            *(FAR unsigned int *)arg = priv->rl_bufsize;
+          }
+        break;
       case BIOC_FLUSH:
         ramlog_bufferflush(priv);
         break;

Reply via email to