casaroli opened a new pull request, #20561:
URL: https://github.com/apache/nuttx/pull/20561

   ## Summary
   
   This PR adds `<mntent.h>` with `setmntent()`, `getmntent()`, 
`getmntent_r()`, `addmntent()`, `endmntent()` and `hasmntopt()`, which programs 
use to list the mounted file systems.
   
   `MOUNTED` is `/proc/fs/mount`, the list that procfs keeps. `getmntent_r()` 
reads its `<mount point> type <type>` lines, and also the usual fstab and mtab 
format (`<fsname> <dir> <type> [<options> [<freq> [<passno>]]]`).
   
   ## Impact
   
   New header and functions, no new option. They are in the static C library, 
so a program that does not call them does not grow.
   
   ## Testing
   
   `qemu-armv8a:knsh` with a virtio 9P share mounted at `/mnt`, QEMU 11. The 
test program was built outside the tree against the export package.
   
   A program that lists `MOUNTED` with `getmntent()` and checks the options 
with `hasmntopt()`. Before, it does not compile (`mntent.h: No such file or 
directory`). After:
   
   ```
   v9fs on /mnt type v9fs (rw) rw
   procfs on /proc type procfs (rw) rw
   hostfs on /system type hostfs (rw) rw
   ```
   
   Builds with `-Wno-cpp -Werror`: `qemu-armv8a:knsh`, `lm3s6965-ek:qemu-flat`, 
`mps2-an500:nsh`, `rv-virt:knsh`, `raspberrypi-pico:nsh`. `tools/checkpatch.sh 
-c -u -m -g` passes.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to