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
The following commit(s) were added to refs/heads/master by this push:
new 7acaadba591 fs/procfs: support partial reads of memory pressure
7acaadba591 is described below
commit 7acaadba591a451ab64d155d4c84a4f0c6d12517
Author: jingfei <[email protected]>
AuthorDate: Sun Nov 29 06:21:49 2026 +0800
fs/procfs: support partial reads of memory pressure
pressure_read rejects buffers smaller than the entire formatted line
before applying the file offset. This prevents short reads and reports
ENOMEM instead of EOF when the caller uses a small buffer.
Let procfs_memcpy bound the copy using the caller capacity and current
position, as it already does for other procfs entries. Keep the existing
output format and position update.
Signed-off-by: jingfei <[email protected]>
---
fs/procfs/fs_procfspressure.c | 5 -----
1 file changed, 5 deletions(-)
diff --git a/fs/procfs/fs_procfspressure.c b/fs/procfs/fs_procfspressure.c
index 86d3ddd5714..ea8a5b284a7 100644
--- a/fs/procfs/fs_procfspressure.c
+++ b/fs/procfs/fs_procfspressure.c
@@ -173,11 +173,6 @@ static ssize_t pressure_read(FAR struct file *filep, FAR
char *buffer,
ret = procfs_snprintf(buf, sizeof(buf), "remaining %zu, largest:%zu\n",
remain, largest);
- if (ret > buflen)
- {
- return -ENOMEM;
- }
-
offset = filep->f_pos;
ret = procfs_memcpy(buf, ret, buffer, buflen, &offset);