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
F106114750: D32738.diff
Wed, Dec 25, 3:31 PM
Unknown Object (File)
Sun, Dec 15, 3:12 AM
Unknown Object (File)
Wed, Dec 11, 2:33 AM
Unknown Object (File)
Mon, Dec 9, 5:56 PM
Unknown Object (File)
Wed, Dec 4, 6:15 PM
Unknown Object (File)
Wed, Dec 4, 6:15 PM
Unknown Object (File)
Wed, Dec 4, 5:51 PM
Unknown Object (File)
Sep 28 2024, 11:53 AM
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 Not Applicable
Unit
Tests Not Applicable

Event Timeline

kib requested review of this revision.Oct 29 2021, 8:18 PM
markj added inline comments.
sys/kern/kern_proc.c
2252 ↗(On Diff #97683)

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.

2316 ↗(On Diff #97683)

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
1143

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 ↗(On Diff #97691)
This revision is now accepted and ready to land.Oct 30 2021, 2:16 PM