You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This might cause some unnecessary linux kernel context switches for longer paths (multiple buffer resizes).
Is there a reason for not using a larger buffer (eg. identical to the glibc implementation)?
The text was updated successfully, but these errors were encountered:
Also, I'm asking this question out of curiosity, what is the main reason for the 512 bytes value?
It seems like most implementations use the PATH_MAX value, eg. Golang uses Getwd (https://go.dev/src/os/getwd.go).
It seems like, by default, the initial buffer size for the return value of
getcwd
is set to 512 bytes:rust/library/std/src/sys/unix/os.rs
Line 139 in 600820d
The default in glibc is defined as follows (https://code.woboq.org/userspace/glibc/sysdeps/unix/sysv/linux/getcwd.c.html#61):
This might cause some unnecessary linux kernel context switches for longer paths (multiple buffer resizes).
Is there a reason for not using a larger buffer (eg. identical to the glibc implementation)?
The text was updated successfully, but these errors were encountered: