Bug 124487 - [procfs] [patch] Extending the PROCFS (/proc) filesystem: patch + rationale
Summary: [procfs] [patch] Extending the PROCFS (/proc) filesystem: patch + rationale
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 6.3-STABLE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2008-06-11 14:20 UTC by Ighighi
Modified: 2022-10-17 12:40 UTC (History)
0 users

See Also:


Attachments
file.txt (3.62 KB, text/plain)
2008-06-11 14:20 UTC, Ighighi
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ighighi 2008-06-11 14:20:08 UTC
(This is something I've been running successfully since 2006 with FreeBSD
6.2-PRERELEASE (RELENG_6) but kept to myself out of fear that purists will
feel offended ;)

This patch extends the FreeBSD /proc filesystem (procfs) by adding support
for some entries that are present on other systems: Linux, Solaris and even
NetBSD (/proc/self & /proc/<pid>/exe)

The entries in question are:
/proc/self       -- Pointer to /proc/<pid> (FreeBSD uses /proc/curproc)
/proc/<pid>/exe  -- FreeBSD uses /proc/<pid>/file
/proc/<pid>/cwd  -- Pointer to the current working directory.
/proc/<pid>/root -- Pointer to the root directory.

I think it's convenient to add those because a lot of software originally
developed in the above systems above will integrate more easily, including
software in ports as you will see:

Fix: The attached patch is against -CURRENT.
The patch to RELENG_6 is available to anyone on demand.

This patch is a trivial one...
/proc/self & /proc/<pid>/exe exist in FreeBSD but with different names.
The code for /proc/<pid>/cwd & /proc/<pid>/root was copied verbatim from
src/sys/compat/linprocfs/linprocfs.c,v 1.119 2008/03/31 12:01:18 kib.

Patch attached with submission follows:
How-To-Repeat: I did a strings-scan on /usr/local that yielded the following (edited):

/usr/local/bin/upx: /proc/self/exe
/usr/local/bin/gdf: /proc/self
/usr/local/bin/gcp: /proc/self
/usr/local/bin/gchgrp: /proc/self
/usr/local/bin/gmv: /proc/self
/usr/local/bin/pterm: /proc/self/exe
/usr/local/bin/putty: /proc/self/exe
/usr/local/bin/puttytel: /proc/self/exe
/usr/local/bin/goldfind: /proc/self
/usr/local/bin/gfind: /proc/self
/usr/local/bin/gchown: /proc/self
/usr/local/bin/gchmod: /proc/self
/usr/local/bin/ginstall: /proc/self
/usr/local/bin/grm: /proc/self
/usr/local/bin/gdu: /proc/self
/usr/local/bin/supertux: /proc/self/exe
/usr/local/bin/supertux: Couldn't read /proc/self/exe, using default path: /usr/local/share/supertux
/usr/local/bin/gtar: /proc/self
/usr/local/Adobe/Acrobat7.0/ENU/Reader/intellinux/lib/librt3d.so: /proc/self/exe
/usr/local/intel_cc_80/bin/icpi: /proc/self/exe
/usr/local/intel_cc_80/bin/icpi: A/proc/self/cwd

The above files were installed by the following ports:
/usr/local/bin/upx: upx-3.02
/usr/local/bin/gdf: coreutils-6.9_2
/usr/local/bin/gcp: coreutils-6.9_2
/usr/local/bin/gchgrp: coreutils-6.9_2
/usr/local/bin/gmv: coreutils-6.9_2
/usr/local/bin/pterm: putty-0.60
/usr/local/bin/putty: putty-0.60
/usr/local/bin/puttytel: putty-0.60
/usr/local/bin/goldfind: findutils-4.4.0_1
/usr/local/bin/gfind: findutils-4.4.0_1
/usr/local/bin/gchown: coreutils-6.9_2
/usr/local/bin/gchmod: coreutils-6.9_2
/usr/local/bin/ginstall: coreutils-6.9_2
/usr/local/bin/grm: coreutils-6.9_2
/usr/local/bin/gdu: coreutils-6.9_2
/usr/local/bin/supertux: supertux-0.1.3_3
/usr/local/bin/supertux: supertux-0.1.3_3
/usr/local/bin/gtar: gtar-1.20
/usr/local/Adobe/Acrobat7.0/ENU/Reader/intellinux/lib/librt3d.so: acroread7-7.0.9_3,1
/usr/local/intel_cc_80/bin/icpi: icc-8.1.038_1
/usr/local/intel_cc_80/bin/icpi: icc-8.1.038_1
Comment 1 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 07:59:03 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped
Comment 2 Graham Perrin freebsd_committer freebsd_triage 2022-10-17 12:40:18 UTC
Keyword: 

    patch
or  patch-ready

– in lieu of summary line prefix: 

    [patch]

* bulk change for the keyword
* summary lines may be edited manually (not in bulk). 

Keyword descriptions and search interface: 

    <https://bugs.freebsd.org/bugzilla/describekeywords.cgi>