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
F86876896: D32738.id97683.diff
Wed, Jun 26, 9:58 PM
Unknown Object (File)
Wed, Jun 26, 12:46 AM
Unknown Object (File)
Wed, Jun 26, 12:24 AM
Unknown Object (File)
Mon, Jun 24, 5:57 PM
Unknown Object (File)
Mon, Jun 24, 4:37 AM
Unknown Object (File)
Mon, Jun 24, 3:24 AM
Unknown Object (File)
Mon, Jun 24, 1:53 AM
Unknown Object (File)
Mon, Jun 3, 2:33 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 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