Page MenuHomeFreeBSD

p9fs: implement basic pathconf support
ClosedPublic

Authored by arichardson on Apr 18 2026, 5:56 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, May 17, 12:37 PM
Unknown Object (File)
Sat, May 16, 4:14 PM
Unknown Object (File)
Sat, May 16, 4:09 PM
Unknown Object (File)
Fri, May 15, 10:15 AM
Unknown Object (File)
Fri, May 15, 9:25 AM
Unknown Object (File)
Fri, May 15, 1:24 AM
Unknown Object (File)
Thu, May 14, 6:04 PM
Unknown Object (File)
Thu, May 14, 6:04 PM
Subscribers

Details

Summary

This is needed for various pjdfstest tests which fail with syntax errors
if pathconf _PC_NAME_MAX/_PC_PATH_MAX return -1. For NAME_MAX we can use
the 9P2000.L Tstatfs call to get namelen from the host. While this could
theoretically be different for nested filesystems in the shared mount it
is a much better guess than just returning 255.
There does not seem to be a way to get the host PATH_MAX, so we just
return the conservative kernel default.

Found while fixing https://github.com/CTSRD-CHERI/cheribsd/issues/2617.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

sys/fs/p9fs/p9fs_vnops.c
2286

Should we use cmpset there, or even something similar to compare-and-set-if_greater?

sys/fs/p9fs/p9fs_vnops.c
2286

We could do, but I think it's not worth it: if we end up racing and having multiple assignments those will always be the same unless we have nested mounts inside the p9fs.

And if we have nested mounts (which we can't know inside the guest) there isn't a single correct value, so any of the values should be acceptable.

This revision is now accepted and ready to land.Apr 19 2026, 1:26 AM
This revision was automatically updated to reflect the committed changes.