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
Unknown Object (File)
Sep 28 2024, 11:53 AM
Unknown Object (File)
Sep 27 2024, 8:17 PM
Unknown Object (File)
Sep 23 2024, 11:39 PM
Unknown Object (File)
Sep 21 2024, 11:09 AM
Unknown Object (File)
Sep 19 2024, 5:37 PM
Unknown Object (File)
Sep 18 2024, 6:58 AM
Unknown Object (File)
Sep 18 2024, 12:45 AM
Unknown Object (File)
Sep 17 2024, 2:13 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