casaroli opened a new pull request, #3875: URL: https://github.com/apache/nuttx-apps/pull/3875
## Summary NSH had no way to show or change the resource limits of the shell, which the programs that it starts inherit. This PR adds `ulimit [-H|-S] [-a|-c|-d|-f|-l|-n|-s|-t|-v] [<limit>|unlimited]`, as in other shells. It runs in the shell, so a limit applies to the shell and to the programs that it starts. Without a resource option it uses `-f`, as POSIX says. Sizes are in KiB, `-n` is a number of files and `-t` is in seconds. `-H` and `-S` select the hard or the soft limit; without them, a new value sets both. `-a` shows all limits. `CONFIG_NSH_DISABLE_ULIMIT` removes the command. The first commit only fixes an old nxstyle error in `nsh_syscmds.c`. apache/nuttx#NNNN documents the command. depends-on: apache/nuttx/pull/20784 ## Impact A new NSH command. With apache/nuttx#20784, `-n` and `-s` change the limits of NSH and its programs; setting the other limits fails, because NuttX does not enforce them. ## Testing `qemu-armv8a:nsh` (QEMU, TCG) with apache/nuttx#20784: ``` nsh> ulimit -a core file size (KiB) (-c) unlimited data seg size (KiB) (-d) unlimited file size (KiB) (-f) unlimited max locked memory (KiB) (-l) unlimited open files (-n) 256 stack size (KiB) (-s) unlimited cpu time (seconds) (-t) unlimited virtual memory (KiB) (-v) unlimited nsh> ulimit -n 8; ulimit -n 8 nsh> ulimit -s 64; ulimit -s 64 nsh> ulimit -S -s 32; ulimit -s; ulimit -H -s; ulimit -c 0 32 unlimited nsh: ulimit: setrlimit failed: 22 ``` `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]
