git: DragonFly_RELEASE_6_4 procfs(5): Add '/proc/self/exe' symlink support

Michael Neumann mneumann at ntecs.de
Sun Mar 31 03:40:17 PDT 2024


On Mon, Mar 18, 2024 at 12:01:22AM -0700, Aaron LI wrote:
> 
> commit c1359f7ed932f7aca951ea499af899edfc1dd79a
> Author: Ricardo Branco <rbranco at suse.de>
> Date:   Tue Mar 5 22:44:51 2024 +0100
> 
>     procfs(5): Add '/proc/self/exe' symlink support
>     
>     * Add the /proc/self symlink that's the same as /proc/curproc.
>     * Add the /proc/<pid>/exe entry that's the same as /proc/<pid>/file.
>     
>     The '/proc/self/exe' symlink has been already landed in NetBSD and
>     FreeBSD [0].  It could simplify some patches to ports that look for this
>     symlink.

Rust is one such case where we had to use a sysctl to implement function
`current_exe`:

https://github.com/rust-lang/rust/blob/688c30dc9f8434d63bddb65bd6a4d2258d19717c/library/std/src/sys/pal/unix/os.rs#L298

NetBSD already uses /proc/self/exe as fallback in case the sysctl fails.

Are there any downsides when using the sysctl [CTL_KERN, KERN_PROC,
KERN_PROC_PATHNAME] apart from being a bit more lines of code?

Regards,

  Michael

>     
>     [0] https://github.com/freebsd/freebsd-src/pull/976
>     
>     GitHub PR: https://github.com/DragonFlyBSD/DragonFlyBSD/pull/22
> 
> Summary of changes:
>  sys/vfs/procfs/procfs_vnops.c | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/c1359f7ed932f7aca951ea499af899edfc1dd79a
> 
> 
> -- 
> DragonFly BSD source repository

-- 
Michael Neumann
NTECS Consulting
www.ntecs.de


More information about the Commits mailing list