Files in procfs are always changed by kernel.
It means if we read the data with more than one read syscall,
we could get an incorrect data which was broken by kernel.
A typical case about this problem was reported by psutil in
https://github.com/giampaolo/psutil/issues/2050
Using an big buffer let read reads the whole file can fix this.
psutil uses a 32K buffer while procps-ng uses a 8K buffer, i think a 8K buffer is enough.
Avoid unnecessary calls of ffStrbufEnsureFree and only allocate
necessary memory.
In most cases, this will save 30% ~ 50% of memory used by ffAppendFDBuffer.
- Use pipe2 on Linux and BSDs, which can set all flags through a single syscall.
- macOS/darwin does not support pipe2, add a wrapper for it.
- Close pipes when fork() failed. These fds should be closed when
the function returns.
- Set O_CLOEXEC at pipes, the exec() family of functions will close
this fds automatically.
- Use _exit instead of exit. Exit calls the callbacks registered by atexit
and flushes the stdio's buffer, which can lead to some unexpected behavior,
especially after an exec syscall failure.
- Fix timeout.
- Not use non-blocking IO. because we only wait for one file, and cannot
do other things during waiting.
Fastfetch incorrectly displays the terminal name as
"ltrace" or "perf" when debugging itself with ltrace and perf.
minor fix: remove duplicated ffStrbufClear since getShellVersion
already called it.
Avoiding unnecessary ffStrbufAppendC calls to speed up createSubfolders.
Now it finds and adds a subdirectory at a time instead of just appending a char.