Questions tagged [procfs]

The proc filesystem is a virtual filesystem through which kernels of Unix-like operating systems, including Linux, expose process and kernel information. It is commonly mounted at /proc and implements a view of the system process table inside the file system. It provides a two-level view of process space.

Procfs, also known as the proc filesystem, is a virtual filesystem normally mounted at /proc. The details vary between unix variants, but on most, /proc/PID is a file or a directory that exposes information about the running process whose id is PID.

In addition, /proc can expose information about other aspects on the system. Linux, in particular, exposes information about mounted filesystems, network status, connected devices and more. This use is partly phased out in favor of the newer .

234 questions
2
votes
0 answers

cgroup and process memory usage mismactch

I have a memory cgroup with 1 process in it. And look for rss memory usage in that cgroup (in memory.stat) and it is much bigger than rss memory of the process (from /proc/[pid]/status). The only process pid in cgroup: $ cat…
2
votes
1 answer

O_TRUNC ignored when writing to the /proc filesystem

Trying to get rid of Ubuntu's apport by clearing /proc/sys/kernel/core_pattern using sh -c ': > /proc/sys/kernel/core_pattern' does not work. It looks like the O_TRUNC flag is ignored when writing to the /proc filesystem: echo nonsense >|…
Juergen
  • 272
  • 1
  • 11
2
votes
0 answers

Check if the process in in RUNNING state or RUNNABLE state in Linux

The state of any process can be found out by using multiple tools including reading from /proc/[pid]/status where $ cat /proc/8976/status Name: redis-server State: R (Running) Tgid: 8976 Pid: 8976 PPid: 8964 ... The R here typically…
user2512324
  • 791
  • 1
  • 6
  • 21
2
votes
1 answer

How can I delete proc entry by user request?

Usually proc entries are deleting inside function with __exit attribute. How can I delete it on user request? I've tired to call remove_proc_entry inside write callback, but the kernel crushes there. I cannot just remove module as it manages several…
2
votes
1 answer

What is the reason for the discrepancy between /proc/[pid]/status:RssAnon and /proc/[pid]/smaps_rollup:Anonymous?

I regularly notice discrepancies between the numbers given for RssAnon in /proc/[pid]/status and for Anonymous in /proc/[pid]/smaps_rollup. I also looked at RssShmem in /proc/[pid]/status, but that did not help to explain the difference. For…
Dirk Herrmann
  • 5,550
  • 1
  • 21
  • 47
2
votes
1 answer

How does the dynamic linker executes /proc/self/exe

When executing a dynamically linked executable on Linux, the dynamic linker is invoked as its interpreter (described in this answer). If I understand correctly, running: $ ./dynamic_elf Will result in Linux executing: /lib64/ld-linux.so.2…
uvuv
  • 368
  • 1
  • 7
2
votes
0 answers

Why does /proc/stat run behind /proc/uptime

I'm sure this is just the way it is, but can somebody give a good reference to an explanation of this observeation. When I add up all the fields for a CPU in /proc/stat, CPU0 only reports activity for 6134 seconds It is thus 89 seconds behind…
Kjeld Flarup
  • 1,471
  • 10
  • 15
2
votes
0 answers

Trying to get physical address using pagemap with CAP_SYS_ADMIN fails

I try to use /proc/self/pagemap to get physical address that matches with a virtual one by using the following C program that should give me a PFN (page frame number) by using /proc/self/pagemap. #include #include #include…
2
votes
0 answers

Why are shared files mapped 4 times in a process

I was trying to understand the maps in the /proc file system in Linux. I observed that every shared file was mapped 4 times, with different offsets and permissions. I concluded that these must be the different sections in the ELF and hence are…
Ajay Brahmakshatriya
  • 8,993
  • 3
  • 26
  • 49
2
votes
3 answers

Access /proc fs variable from other parts of Kernel code

I'm trying to get a user-level program to communicate with the kernel via /proc. I followed the instructions on tldp, and was successfully able to create a custom proc file, load it dynamically with insmod and read (cat) and write (echo) to the proc…
Warr1ck
  • 163
  • 1
  • 9
2
votes
4 answers

How to find all read-write memory address of a process in Linux/UNIX with C/C++ language?

Through /proc file system , it's probable to read memory mappings with /proc/PID_PROCESS/maps , but is there any native APIs that dedicated for this function in C/C++ ? i.e to find out memory address that are writable and readable for process with…
daisy
  • 22,498
  • 29
  • 129
  • 265
2
votes
1 answer

Cannot open uid_map for writing from an app with cap_setuid capability set

While toying around with an example from user_namespaces(7), I've come across a strange behaviour. What the application does The application user-ns-ex calls clone(2) with CLONE_NEWUSER, thus creating a new process in a new user namespace. The…
Arks
  • 569
  • 5
  • 19
2
votes
1 answer

Get /proc//map info with sysctl call under mac os

I wanted to use /proc//map directory in order to get info about virtual memory of a process (especially about its shared libraries). Since mac os doesn't have one I'm trying to find other ways. One of them seems to be sysctl call but I don't…
Artyom
  • 284
  • 2
  • 14
2
votes
1 answer

Ubuntu proc_root_driver missing from

I am trying to compile a kernel module in Ubuntu 10.04 with kernel 2.6.35-22 and it is complaining about proc_root_driver missing. I did some searching and I found that is supposed to define this but in my version of the linux-headers, it isn't…
rplankenhorn
  • 2,075
  • 2
  • 22
  • 32
2
votes
1 answer

Creating a simple write only proc entry in kernel

#include #include #include #include #include #include char *msg; ssize_t write_proc(struct file *filp,const char *buf,size_t count,loff_t *offp) { …
anor
  • 43
  • 1
  • 7