nuttx
nuttx copied to clipboard
fs/procfs: fix output format of fd info
Summary
Fix output format of fd info. Refered to PRINTF(3), the [v]snprintf returns the number of characters printed (excluding the null byte used to end output to strings).
Upon successful return, these functions return the number of characters printed (excluding the null byte used to end output to strings). -- PRINTF(3)
Impact
- fs/procfs
Testing
- Currently
- Extra blank at line start, e.g. fd num 1 and below
- Truncated print, see fd num 3, missing end bracked "]"
nsh> fdinfo 9
FD OFLAGS TYPE POS PATH
0 3 1 0 /dev/console
1 3 1 0 /dev/console
2 3 1 0 /dev/console
3 3 9 0 tcp:[0.0.0.0:5554<->0.0.0.0:0, st 01, flg 31
4 1089 1 0 /dev/fastboot/ep
5 1090 1 0 /dev/fastboot/ep
6 0 1 0
nsh>
nsh>
- With this patch
nsh> fdinfo 9
FD OFLAGS TYPE POS PATH BACKTRACE
0 3 1 0 /dev/console
1 3 1 0 /dev/console
2 3 1 0 /dev/console
3 3 9 0 tcp:[0.0.0.0:5554<->0.0.0.0:0, st 01, flg 31]
4 1089 1 0 /dev/fastboot/ep2
5 1090 1 0 /dev/fastboot/ep1
6 0 1 0
nsh>