Simplify linux_getcwd(), removing code that seems to be no longer used.
Details
- Reviewers
kib dchagin - Group Reviewers
Linux Emulation - Commits
- rS281882: Simplify linux_getcwd(), removing code that was longer used.
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
vn_fullpath may fail if intermediate entries in the path not in the cache.
sys/compat/linux/linux_getcwd.c | ||
---|---|---|
73 ↗ | (On Diff #4905) | kern___getcwd() limits buflen to MAXPATHLEN |
vn_fullpath() does what the removed code did, but probably with less bugs left. Only the last entry cache is critical to the operation, for the directories, the linear scan is performed if cache failed.
Split the non-linux part of the patch, for easy merging.
sys/compat/linux/linux_getcwd.c | ||
---|---|---|
77 ↗ | (On Diff #4923) | This whole block is not needed, kern__getcwd() does the same checks. |
82 ↗ | (On Diff #4923) | if (error == 0) { ... Then you can avoid goto. |
86 ↗ | (On Diff #4923) | Do not assign to td_retval() if later copyout() fails. |
sys/compat/linux/linux_getcwd.c | ||
---|---|---|
77 ↗ | (On Diff #4923) | Yes, but we need to cap the "len" before we call malloc. |
sys/compat/linux/linux_getcwd.c | ||
---|---|---|
77 ↗ | (On Diff #4923) | Always malloc LINUX_PATH_MAX bytes ? |
sys/compat/linux/linux_getcwd.c | ||
---|---|---|
85 ↗ | (On Diff #4923) | If we use UIO_USERSPACE, how do we determine the path length then? We can't call strlen() for user buffer. |
Another try. The kern/ parts were committed earlier. Yeah,
we could avoid strlen and a copy, but kern___getcwd() gets enough
parameters as it is; please let's leave it for another time.