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)
Thu, Nov 27, 8:35 AM
Unknown Object (File)
Sun, Nov 23, 5:26 PM
Unknown Object (File)
Sun, Nov 16, 8:04 PM
Unknown Object (File)
Sun, Nov 16, 6:26 PM
Unknown Object (File)
Sun, Nov 16, 6:26 PM
Unknown Object (File)
Sun, Nov 16, 6:26 PM
Unknown Object (File)
Sun, Nov 16, 4:45 PM
Unknown Object (File)
Sun, Nov 16, 6:03 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 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