Also note that the contents of the procfs tree (typically mounted at /proc highly depends on both the operating system and the operating system version. Given any generic Unix-like system, I would expect to find one directory per running process, using the process ID as the directory name, and perhaps tons of OS-specific stuff. Inside the PID directories, I would expect to find even more OS-specific stuff. Note the term "OS-specific stuff", meaning exactly that. An unspecified amount (maybe even zero) of unspecified directory entries.

Just for fun, I've just logged into my pfSense box (currently running pfSense v2.4.4-RELEASE). It is based on FreeBSD 11.2-RELEASE-p3. And guess how /proc looks like there:

[2.4.4-RELEASE][root@pfSense]/root: ls /proc [2.4.4-RELEASE][root@pfSense]/root: ls -alF /proc total 8 dr-xr-xr-x 2 root wheel 512 Jul 19 2016 ./ drwxr-xr-x 22 root wheel 1024 Feb 2 17:47 ../ [2.4.4-RELEASE][root@pfSense]/root:

Yes, it's empty, to my surprise. pfSense works fine without it. Now imagine a tool insisting on having data in /proc ...

You can still mount it:

[2.4.4-RELEASE][root@pfSense]/root: mount /dev/ufsid/5895f1e0f622b3ed on / (ufs, local, journaled soft-updates) devfs on /dev (devfs, local) /dev/md0 on /var/run (ufs, local) devfs on /var/dhcpd/dev (devfs, local) [2.4.4-RELEASE][root@pfSense]/root: mount -t procfs proc /proc [2.4.4-RELEASE][root@pfSense]/root: ls -alF /proc total 4 dr-xr-xr-x 1 root wheel 0 May 20 23:06 ./ drwxr-xr-x 22 root wheel 1024 Feb 2 17:47 ../ dr-xr-xr-x 1 root wheel 0 May 20 23:06 0/ dr-xr-xr-x 1 root wheel 0 May 20 23:06 1/ dr-xr-xr-x 1 root wheel 0 May 20 23:06 10/ # many directories cut away dr-xr-xr-x 1 dhcpd _dhcp 0 May 20 23:06 65493/ dr-xr-xr-x 1 root wheel 0 May 20 23:06 7/ dr-xr-xr-x 1 root wheel 0 May 20 23:06 72338/ # more directories cut away dr-xr-xr-x 1 root wheel 0 May 20 23:06 98163/ lr--r--r-- 1 root wheel 0 May 20 23:06 curproc@ -> 85721 [2.4.4-RELEASE][root@pfSense]/root: ls -alF /proc/7 total 0 dr-xr-xr-x 1 root wheel 0 May 20 23:07 ./ dr-xr-xr-x 1 root wheel 0 May 20 23:07 ../ -r--r--r-- 1 root wheel 0 May 20 23:07 cmdline --w------- 1 root wheel 0 May 20 23:07 ctl -r--r--r-- 1 root wheel 0 May 20 23:07 etype -r--r--r-- 1 root wheel 0 May 20 23:07 rlimit -r--r--r-- 1 root wheel 0 May 20 23:07 status [2.4.4-RELEASE][root@pfSense]/root:

Compared with Linux, this is procfs on a strict diet. See also https://www.freebsd.org/doc/en/articles/linux-users/procfs.html.

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

In reply to Re^4: Use running system processes and filter them on different ways by afoken
in thread Use running system processes and filter them on different ways by edujs7

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.