From b75fa3a2de0c9c0854ebd9a2adc75ce9e8d39bd4 Mon Sep 17 00:00:00 2001 From: Ricardo Branco Date: Fri, 2 Feb 2024 17:17:52 -0700 Subject: [PATCH] procfs: Add self & exe symlinks like NetBSD does NetBSD calls "curproc" "self" and "exe" "file" for proc. Reduce gratuitous differnces by including them as well. Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/976 --- share/man/man5/procfs.5 | 4 ++++ sys/fs/procfs/procfs.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/share/man/man5/procfs.5 b/share/man/man5/procfs.5 index d055faadf2c..5977a8bced8 100644 --- a/share/man/man5/procfs.5 +++ b/share/man/man5/procfs.5 @@ -253,10 +253,14 @@ directory containing process information for process .Pa pid . .It Pa /proc/curproc directory containing process information for the current process +.It Pa /proc/self +directory containing process information for the current process .It Pa /proc/curproc/cmdline the process executable name .It Pa /proc/curproc/etype executable type +.It Pa /proc/curproc/exe +executable image .It Pa /proc/curproc/file executable image .It Pa /proc/curproc/fpregs diff --git a/sys/fs/procfs/procfs.c b/sys/fs/procfs/procfs.c index 97b04fa2bc0..ab60ba47f32 100644 --- a/sys/fs/procfs/procfs.c +++ b/sys/fs/procfs/procfs.c @@ -158,6 +158,8 @@ procfs_init(PFS_INIT_ARGS) pfs_create_link(root, "curproc", procfs_docurproc, NULL, NULL, NULL, 0); + pfs_create_link(root, "self", procfs_docurproc, + NULL, NULL, NULL, 0); dir = pfs_create_dir(root, "pid", procfs_attr_all_rx, NULL, NULL, PFS_PROCDEP); @@ -188,6 +190,8 @@ procfs_init(PFS_INIT_ARGS) pfs_create_link(dir, "file", procfs_doprocfile, NULL, procfs_notsystem, NULL, 0); + pfs_create_link(dir, "exe", procfs_doprocfile, + NULL, procfs_notsystem, NULL, 0); return (0); }