Page MenuHomeFreeBSD

procfs: return right hardlink from /proc/curproc/file
ClosedPublic

Authored by kib on Oct 29 2021, 8:18 PM.
Tags
None
Referenced Files
F136240389: D32738.id.diff
Sun, Nov 16, 8:04 PM
F136226261: D32738.id97683.diff
Sun, Nov 16, 6:26 PM
F136226259: D32738.id97691.diff
Sun, Nov 16, 6:26 PM
F136226258: D32738.id97756.diff
Sun, Nov 16, 6:26 PM
F136210845: D32738.diff
Sun, Nov 16, 4:45 PM
F136153842: D32738.id97756.diff
Sun, Nov 16, 6:03 AM
Unknown Object (File)
Wed, Oct 29, 6:07 AM
Unknown Object (File)
Oct 8 2025, 10:17 PM
Subscribers

Details

Summary

Extract proc_get_binpath() from sysctl_kern_proc_pathname().
Use proc_get_binpath() to get the hardlink right.

PR: 248184

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

kib requested review of this revision.Oct 29 2021, 8:18 PM
markj added inline comments.
sys/kern/kern_proc.c
2264–2265

Perhaps have the caller pass an explicit size instead of assuming MAXPATHLEN. Or at least have a comment above the function noting that it must be MAXPATHLEN bytes in size.

2328

If you write

if (error == 0)
    proc_get_binpath(...);
free(binname, M_TEMP);
if (error != 0)
    return (error);

then the error handling for pget() is not needed.

sys/sys/proc.h
1145

Keep it sorted? It's almost there, except for proc_add_orphan().

This revision is now accepted and ready to land.Oct 29 2021, 9:54 PM
kib marked 3 inline comments as done.

Add detailed herald comment for proc_get_binpath()
Simplify control flow in sysctl
Reorder proc_ declarations in sys/proc.h

This revision now requires review to proceed.Oct 29 2021, 10:15 PM
markj added inline comments.
sys/kern/kern_proc.c
2231
This revision is now accepted and ready to land.Oct 30 2021, 2:16 PM